i965g: get trivial/tri working again after edgeflag changes
authorKeith Whitwell <keithw@vmware.com>
Thu, 24 Dec 2009 12:52:43 +0000 (12:52 +0000)
committerKeith Whitwell <keithw@vmware.com>
Thu, 24 Dec 2009 12:53:07 +0000 (12:53 +0000)
src/gallium/drivers/i965/brw_clip.c
src/gallium/drivers/i965/brw_context.h
src/gallium/drivers/i965/brw_pipe_shader.c
src/gallium/drivers/i965/brw_vs_emit.c

index 58d9e56df2746f560e426c83ef0fe4562befeb1c..d67a1a62633e03fcc7d5935202b73a63b85f49bb 100644 (file)
@@ -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;
index 56e78074000a218379087baa8595e9f097d2a5ea..8c006bb95b2e7de5ef1e02021a557b1a30c1e253 100644 (file)
 
 #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:
index 20f20571f653b39a036e1a586791f9afe05fac8b..bb32d90e331df9349e28f35e26ab36a91b355ad0 100644 (file)
@@ -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]) {
index 714def5046d167d2e8e6fb2214f3259dac4fd014..8a16205d2f60cc9c1ae9efacbb33fdf4bae09233 100644 (file)
@@ -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;
       }
    }