tgsi: move to using vector for system values.
authorDave Airlie <airlied@redhat.com>
Mon, 25 Apr 2016 23:48:46 +0000 (09:48 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 26 Apr 2016 22:26:53 +0000 (08:26 +1000)
For compute support some of the system values are .xyz types,
so move to using a vector instead of a single channel.

[airlied: squash swizzle fix from compute series].

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/auxiliary/draw/draw_gs.c
src/gallium/auxiliary/draw/draw_vs_exec.c
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/tgsi/tgsi_exec.h

index ca03238885c7d18ebf0f6f730f2594270c88b600..adba93165171db5c9e8d262d3a90b6f11a22044a 100644 (file)
@@ -197,7 +197,7 @@ static void tgsi_gs_prepare(struct draw_geometry_shader *shader,
    if (shader->info.uses_invocationid) {
       unsigned i = machine->SysSemanticToIndex[TGSI_SEMANTIC_INVOCATIONID];
       for (j = 0; j < TGSI_QUAD_SIZE; j++)
-         machine->SystemValue[i].i[j] = shader->invocation_id;
+         machine->SystemValue[i].xyzw[0].i[j] = shader->invocation_id;
    }
 }
 
index da0d1a7f9a8f8d79cb6aadfbfd242238312bb744..fe6ad5b33d9b0f07409e4367ca2287ef1ebdd73e 100644 (file)
@@ -107,7 +107,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
       unsigned i = machine->SysSemanticToIndex[TGSI_SEMANTIC_INSTANCEID];
       assert(i < Elements(machine->SystemValue));
       for (j = 0; j < TGSI_QUAD_SIZE; j++)
-         machine->SystemValue[i].i[j] = shader->draw->instance_id;
+         machine->SystemValue[i].xyzw[0].i[j] = shader->draw->instance_id;
    }
 
    for (i = 0; i < count; i += MAX_TGSI_VERTICES) {
@@ -130,19 +130,19 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
          if (shader->info.uses_vertexid) {
             unsigned vid = machine->SysSemanticToIndex[TGSI_SEMANTIC_VERTEXID];
             assert(vid < Elements(machine->SystemValue));
-            machine->SystemValue[vid].i[j] = i + j;
+            machine->SystemValue[vid].xyzw[0].i[j] = i + j;
             /* XXX this should include base vertex. Where to get it??? */
          }
          if (shader->info.uses_basevertex) {
             unsigned vid = machine->SysSemanticToIndex[TGSI_SEMANTIC_BASEVERTEX];
             assert(vid < Elements(machine->SystemValue));
-            machine->SystemValue[vid].i[j] = 0;
+            machine->SystemValue[vid].xyzw[0].i[j] = 0;
             /* XXX Where to get it??? */
          }
          if (shader->info.uses_vertexid_nobase) {
             unsigned vid = machine->SysSemanticToIndex[TGSI_SEMANTIC_VERTEXID_NOBASE];
             assert(vid < Elements(machine->SystemValue));
-            machine->SystemValue[vid].i[j] = i + j;
+            machine->SystemValue[vid].xyzw[0].i[j] = i + j;
          }
 
          for (slot = 0; slot < shader->info.num_inputs; slot++) {
index e8bb1036420ef7785bb630e735f3823b921a7392..f6b08bc8ee849b3040ef2d51a241285f3ac0a408 100644 (file)
@@ -1282,7 +1282,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
        * gl_FragCoord, for example, in a sys value register.
        */
       for (i = 0; i < TGSI_QUAD_SIZE; i++) {
-         chan->u[i] = mach->SystemValue[index->i[i]].u[i];
+         chan->u[i] = mach->SystemValue[index->i[i]].xyzw[swizzle].u[i];
       }
       break;
 
index 5e554d584cc4b71a22cffaa85d13dfe61646bff1..b12f7bed9b873c5f1016198880dc8574687623f7 100644 (file)
@@ -356,7 +356,7 @@ struct tgsi_exec_machine
 
    /* System values */
    unsigned                      SysSemanticToIndex[TGSI_SEMANTIC_COUNT];
-   union tgsi_exec_channel       SystemValue[TGSI_MAX_MISC_INPUTS];
+   struct tgsi_exec_vector       SystemValue[TGSI_MAX_MISC_INPUTS];
 
    struct tgsi_exec_vector       *Addrs;
    struct tgsi_exec_vector       *Predicates;