Mesa (master): i965g: get trivial/tri working again after edgeflag changes

Keith Whitwell keithw at kemper.freedesktop.org
Thu Dec 24 04:53:59 PST 2009


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Thu Dec 24 12:52:43 2009 +0000

i965g: get trivial/tri working again after edgeflag changes

---

 src/gallium/drivers/i965/brw_clip.c        |   12 ++++----
 src/gallium/drivers/i965/brw_context.h     |    9 +++++-
 src/gallium/drivers/i965/brw_pipe_shader.c |    7 +++++
 src/gallium/drivers/i965/brw_vs_emit.c     |   39 +++++++++------------------
 4 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/src/gallium/drivers/i965/brw_clip.c b/src/gallium/drivers/i965/brw_clip.c
index 58d9e56..d67a1a6 100644
--- a/src/gallium/drivers/i965/brw_clip.c
+++ b/src/gallium/drivers/i965/brw_clip.c
@@ -83,19 +83,19 @@ compile_clip_prog( struct brw_context *brw,
 
    c.offset_hpos = delta + c.key.output_hpos * ATTR_SIZE;
 
-   if (c.key.output_color0)
+   if (c.key.output_color0 != BRW_OUTPUT_NOT_PRESENT)
       c.offset_color0 = delta + c.key.output_color0 * ATTR_SIZE;
 
-   if (c.key.output_color1)
+   if (c.key.output_color1 != BRW_OUTPUT_NOT_PRESENT)
       c.offset_color1 = delta + c.key.output_color1 * ATTR_SIZE;
 
-   if (c.key.output_bfc0)
+   if (c.key.output_bfc0 != BRW_OUTPUT_NOT_PRESENT)
       c.offset_bfc0 = delta + c.key.output_bfc0 * ATTR_SIZE;
 
-   if (c.key.output_bfc1)
+   if (c.key.output_bfc1 != BRW_OUTPUT_NOT_PRESENT)
       c.offset_bfc1 = delta + c.key.output_bfc1 * ATTR_SIZE;
 
-   if (c.key.output_edgeflag)
+   if (c.key.output_edgeflag != BRW_OUTPUT_NOT_PRESENT)
       c.offset_edgeflag = delta + c.key.output_edgeflag * ATTR_SIZE;
    
    if (BRW_IS_IGDNG(brw))
@@ -182,7 +182,6 @@ upload_clip_prog(struct brw_context *brw)
     */
    /* CACHE_NEW_VS_PROG */
    key.nr_attrs        = brw->vs.prog_data->nr_outputs;
-   key.output_edgeflag = brw->vs.prog_data->output_edgeflag;
 
    /* PIPE_NEW_VS */
    key.output_hpos     = vs->output_hpos;
@@ -190,6 +189,7 @@ upload_clip_prog(struct brw_context *brw)
    key.output_color1   = vs->output_color1;
    key.output_bfc0     = vs->output_bfc0;
    key.output_bfc1     = vs->output_bfc1;
+   key.output_edgeflag = vs->output_edgeflag;
 
    /* PIPE_NEW_CLIP */
    key.nr_userclip = brw->curr.ucp.nr;
diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h
index 56e7807..8c006bb 100644
--- a/src/gallium/drivers/i965/brw_context.h
+++ b/src/gallium/drivers/i965/brw_context.h
@@ -120,6 +120,13 @@
 
 #define BRW_MAX_CURBE                    (32*16)
 
+
+/* Need a value to say a particular vertex shader output isn't
+ * present.  Limits us to 63 outputs currently.
+ */
+#define BRW_OUTPUT_NOT_PRESENT           ((1<<6)-1)
+
+
 struct brw_context;
 
 struct brw_depth_stencil_state {
@@ -335,8 +342,6 @@ struct brw_vs_prog_data {
 
    GLuint nr_params;       /**< number of TGSI_FILE_CONSTANT's */
 
-   GLuint output_edgeflag;
-
    GLboolean writes_psiz;
 
    /* Used for calculating urb partitions:
diff --git a/src/gallium/drivers/i965/brw_pipe_shader.c b/src/gallium/drivers/i965/brw_pipe_shader.c
index 20f2057..bb32d90 100644
--- a/src/gallium/drivers/i965/brw_pipe_shader.c
+++ b/src/gallium/drivers/i965/brw_pipe_shader.c
@@ -197,6 +197,13 @@ static void *brw_create_vs_state( struct pipe_context *pipe,
    vs->id = brw->program_id++;
    vs->has_flow_control = has_flow_control(&vs->info);
 
+   vs->output_hpos = BRW_OUTPUT_NOT_PRESENT;
+   vs->output_color0 = BRW_OUTPUT_NOT_PRESENT;
+   vs->output_color1 = BRW_OUTPUT_NOT_PRESENT;
+   vs->output_bfc0 = BRW_OUTPUT_NOT_PRESENT;
+   vs->output_bfc1 = BRW_OUTPUT_NOT_PRESENT;
+   vs->output_edgeflag = BRW_OUTPUT_NOT_PRESENT;
+
    for (i = 0; i < vs->info.num_outputs; i++) {
       int index = vs->info.output_semantic_index[i];
       switch (vs->info.output_semantic_name[i]) {
diff --git a/src/gallium/drivers/i965/brw_vs_emit.c b/src/gallium/drivers/i965/brw_vs_emit.c
index 714def5..8a16205 100644
--- a/src/gallium/drivers/i965/brw_vs_emit.c
+++ b/src/gallium/drivers/i965/brw_vs_emit.c
@@ -79,18 +79,12 @@ static void release_tmps( struct brw_vs_compile *c )
 static boolean is_position_output( struct brw_vs_compile *c,
                                    unsigned vs_output )
 {
-   struct brw_vertex_shader *vs = c->vp;
-
-   if (vs_output == c->prog_data.output_edgeflag) {
-      return FALSE;
-   }
-   else {
-      unsigned semantic = vs->info.output_semantic_name[vs_output];
-      unsigned index = vs->info.output_semantic_index[vs_output];
+   const struct brw_vertex_shader *vs = c->vp;
+   unsigned semantic = vs->info.output_semantic_name[vs_output];
+   unsigned index = vs->info.output_semantic_index[vs_output];
       
-      return (semantic == TGSI_SEMANTIC_POSITION &&
-              index == 0);
-   }
+   return (semantic == TGSI_SEMANTIC_POSITION &&
+           index == 0);
 }
 
 
@@ -98,23 +92,16 @@ static boolean find_output_slot( struct brw_vs_compile *c,
                                   unsigned vs_output,
                                   unsigned *fs_input_slot )
 {
-   struct brw_vertex_shader *vs = c->vp;
+   const struct brw_vertex_shader *vs = c->vp;
+   unsigned semantic = vs->info.output_semantic_name[vs_output];
+   unsigned index = vs->info.output_semantic_index[vs_output];
+   unsigned i;
 
-   if (vs_output == c->prog_data.output_edgeflag) {
-      *fs_input_slot = c->key.fs_signature.nr_inputs;
-      return TRUE;
-   }
-   else {
-      unsigned semantic = vs->info.output_semantic_name[vs_output];
-      unsigned index = vs->info.output_semantic_index[vs_output];
-      unsigned i;
-
-      for (i = 0; i < c->key.fs_signature.nr_inputs; i++) {
-         if (c->key.fs_signature.input[i].semantic == semantic &&
+   for (i = 0; i < c->key.fs_signature.nr_inputs; i++) {
+      if (c->key.fs_signature.input[i].semantic == semantic &&
           c->key.fs_signature.input[i].semantic_index == index) {
-            *fs_input_slot = i;
-            return TRUE;
-         }
+         *fs_input_slot = i;
+         return TRUE;
       }
    }
 



More information about the mesa-commit mailing list