projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
u_upload_mgr: pass alignment to u_upload_alloc manually
[mesa.git]
/
src
/
mesa
/
state_tracker
/
st_cb_drawtex.c
diff --git
a/src/mesa/state_tracker/st_cb_drawtex.c
b/src/mesa/state_tracker/st_cb_drawtex.c
index a8806c91edd4d40ed23f63b6bb3153c2a92d9595..b3e4b5bb70cd86d34083ef5c678a6d61d2661c96 100644
(file)
--- a/
src/mesa/state_tracker/st_cb_drawtex.c
+++ b/
src/mesa/state_tracker/st_cb_drawtex.c
@@
-1,6
+1,6
@@
/**************************************************************************
*
/**************************************************************************
*
- * Copyright 2008
Tungsten Graphics, Inc., Cedar Park, Texas
.
+ * Copyright 2008
VMware, Inc
.
* All Rights Reserved.
*
**************************************************************************/
* All Rights Reserved.
*
**************************************************************************/
@@
-15,7
+15,7
@@
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
-#include "main/
mfeatures
.h"
+#include "main/
teximage
.h"
#include "program/program.h"
#include "program/prog_print.h"
#include "program/program.h"
#include "program/prog_print.h"
@@
-92,7
+92,7
@@
lookup_shader(struct pipe_context *pipe,
util_make_vertex_passthrough_shader(pipe,
num_attribs,
semantic_names,
util_make_vertex_passthrough_shader(pipe,
num_attribs,
semantic_names,
- semantic_indexes);
+ semantic_indexes
, FALSE
);
NumCachedShaders++;
return CachedShaders[i].handle;
NumCachedShaders++;
return CachedShaders[i].handle;
@@
-124,7
+124,8
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
/* determine how many enabled sets of texcoords */
numTexCoords = 0;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
/* determine how many enabled sets of texcoords */
numTexCoords = 0;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_2D_BIT) {
+ if (ctx->Texture.Unit[i]._Current &&
+ ctx->Texture.Unit[i]._Current->Target == GL_TEXTURE_2D) {
numTexCoords++;
}
}
numTexCoords++;
}
}
@@
-148,9
+149,10
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat *vbuf = NULL;
GLuint attr;
GLfloat *vbuf = NULL;
GLuint attr;
- if (u_upload_alloc(st->uploader, 0,
- numAttribs * 4 * 4 * sizeof(GLfloat),
- &offset, &vbuffer, (void **) &vbuf) != PIPE_OK) {
+ u_upload_alloc(st->uploader, 0,
+ numAttribs * 4 * 4 * sizeof(GLfloat), 4,
+ &offset, &vbuffer, (void **) &vbuf);
+ if (!vbuffer) {
return;
}
return;
}
@@
-193,9
+195,10
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
/* texcoords */
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
/* texcoords */
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_2D_BIT) {
+ if (ctx->Texture.Unit[i]._Current &&
+ ctx->Texture.Unit[i]._Current->Target == GL_TEXTURE_2D) {
struct gl_texture_object *obj = ctx->Texture.Unit[i]._Current;
struct gl_texture_object *obj = ctx->Texture.Unit[i]._Current;
-
struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]
;
+
const struct gl_texture_image *img = _mesa_base_tex_image(obj)
;
const GLfloat wt = (GLfloat) img->Width;
const GLfloat ht = (GLfloat) img->Height;
const GLfloat s0 = obj->CropRect[0] / wt;
const GLfloat wt = (GLfloat) img->Width;
const GLfloat ht = (GLfloat) img->Height;
const GLfloat s0 = obj->CropRect[0] / wt;
@@
-209,7
+212,9
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
SET_ATTRIB(2, attr, s1, t1, 0.0f, 1.0f); /* upper right */
SET_ATTRIB(3, attr, s0, t1, 0.0f, 1.0f); /* upper left */
SET_ATTRIB(2, attr, s1, t1, 0.0f, 1.0f); /* upper right */
SET_ATTRIB(3, attr, s0, t1, 0.0f, 1.0f); /* upper left */
- semantic_names[attr] = TGSI_SEMANTIC_GENERIC;
+ semantic_names[attr] = st->needs_texcoord_semantic ?
+ TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
+ /* XXX: should this use semantic index i instead of 0 ? */
semantic_indexes[attr] = 0;
attr++;
semantic_indexes[attr] = 0;
attr++;
@@
-225,6
+230,8
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
cso_save_viewport(cso);
cso_save_stream_outputs(cso);
cso_save_vertex_shader(cso);
cso_save_viewport(cso);
cso_save_stream_outputs(cso);
cso_save_vertex_shader(cso);
+ cso_save_tessctrl_shader(cso);
+ cso_save_tesseval_shader(cso);
cso_save_geometry_shader(cso);
cso_save_vertex_elements(cso);
cso_save_aux_vertex_buffer_slot(cso);
cso_save_geometry_shader(cso);
cso_save_vertex_elements(cso);
cso_save_aux_vertex_buffer_slot(cso);
@@
-234,6
+241,8
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
semantic_names, semantic_indexes);
cso_set_vertex_shader_handle(cso, vs);
}
semantic_names, semantic_indexes);
cso_set_vertex_shader_handle(cso, vs);
}
+ cso_set_tessctrl_shader_handle(cso, NULL);
+ cso_set_tesseval_shader_handle(cso, NULL);
cso_set_geometry_shader_handle(cso, NULL);
for (i = 0; i < numAttribs; i++) {
cso_set_geometry_shader_handle(cso, NULL);
for (i = 0; i < numAttribs; i++) {
@@
-243,7
+252,7
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
}
cso_set_vertex_elements(cso, numAttribs, velements);
velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
}
cso_set_vertex_elements(cso, numAttribs, velements);
- cso_set_stream_outputs(st->cso_context, 0, NULL,
0
);
+ cso_set_stream_outputs(st->cso_context, 0, NULL,
NULL
);
/* viewport state: viewport matching window dims */
{
/* viewport state: viewport matching window dims */
{
@@
-255,11
+264,9
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
vp.scale[0] = 0.5f * width;
vp.scale[1] = height * (invert ? -0.5f : 0.5f);
vp.scale[2] = 1.0f;
vp.scale[0] = 0.5f * width;
vp.scale[1] = height * (invert ? -0.5f : 0.5f);
vp.scale[2] = 1.0f;
- vp.scale[3] = 1.0f;
vp.translate[0] = 0.5f * width;
vp.translate[1] = 0.5f * height;
vp.translate[2] = 0.0f;
vp.translate[0] = 0.5f * width;
vp.translate[1] = 0.5f * height;
vp.translate[2] = 0.0f;
- vp.translate[3] = 0.0f;
cso_set_viewport(cso, &vp);
}
cso_set_viewport(cso, &vp);
}
@@
-277,6
+284,8
@@
st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
/* restore state */
cso_restore_viewport(cso);
cso_restore_vertex_shader(cso);
/* restore state */
cso_restore_viewport(cso);
cso_restore_vertex_shader(cso);
+ cso_restore_tessctrl_shader(cso);
+ cso_restore_tesseval_shader(cso);
cso_restore_geometry_shader(cso);
cso_restore_vertex_elements(cso);
cso_restore_aux_vertex_buffer_slot(cso);
cso_restore_geometry_shader(cso);
cso_restore_vertex_elements(cso);
cso_restore_aux_vertex_buffer_slot(cso);