Module: Mesa
Branch: master
Commit: e45c969fe5890472d0a49bf2f7d561f3d315be2a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e45c969fe5890472d0a49bf2f7d561f3d315be2a

Author: Christoph Bumiller <[email protected]>
Date:   Sat Mar 30 14:57:21 2013 +0100

st/mesa: fix bitmap,drawpix,drawtex for PIPE_CAP_TGSI_TEXCOORD

NOTE: Changed the semantic index for the drawtex coordinate to
be the texture unit index instead of always 0.
Not sure if this is correct but since the value seems to depend
on the unit it would make sense to use different varying slots.

---

 src/mesa/state_tracker/st_cb_bitmap.c     |    1 +
 src/mesa/state_tracker/st_cb_drawpixels.c |    5 ++++-
 src/mesa/state_tracker/st_cb_drawtex.c    |    4 +++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bitmap.c 
b/src/mesa/state_tracker/st_cb_bitmap.c
index bae9ff8..0513814 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -766,6 +766,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
       /* create pass-through vertex shader now */
       const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
                                       TGSI_SEMANTIC_COLOR,
+        st->needs_texcoord_semantic ? TGSI_SEMANTIC_TEXCOORD :
                                       TGSI_SEMANTIC_GENERIC };
       const uint semantic_indexes[] = { 0, 0, 0 };
       st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3,
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c 
b/src/mesa/state_tracker/st_cb_drawpixels.c
index f0baa34..b25b776 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -294,6 +294,9 @@ static void *
 make_passthrough_vertex_shader(struct st_context *st, 
                                GLboolean passColor)
 {
+   const unsigned texcoord_semantic = st->needs_texcoord_semantic ?
+      TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
+
    if (!st->drawpix.vert_shaders[passColor]) {
       struct ureg_program *ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
 
@@ -307,7 +310,7 @@ make_passthrough_vertex_shader(struct st_context *st,
       
       /* MOV result.texcoord0, vertex.attr[1]; */
       ureg_MOV(ureg, 
-               ureg_DECL_output( ureg, TGSI_SEMANTIC_GENERIC, 0 ),
+               ureg_DECL_output( ureg, texcoord_semantic, 0 ),
                ureg_DECL_vs_input( ureg, 1 ));
       
       if (passColor) {
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c 
b/src/mesa/state_tracker/st_cb_drawtex.c
index a8806c9..c4efce0 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -209,7 +209,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 */
 
-            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++;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to