freedreno/ir3: bit of shader API refactoring
[mesa.git] / src / gallium / drivers / freedreno / a3xx / fd3_program.c
index 4581a6b7af919911d8e3eb0e5115fe474920a048..9bf42f5b9310f9aceb81d9fbd846a9f7f930835f 100644 (file)
@@ -51,7 +51,7 @@ create_shader_stateobj(struct pipe_context *pctx, const struct pipe_shader_state
                enum shader_t type)
 {
        struct fd3_shader_stateobj *so = CALLOC_STRUCT(fd3_shader_stateobj);
-       so->shader = ir3_shader_create(pctx, cso->tokens, type);
+       so->shader = ir3_shader_create(pctx, cso, type);
        return so;
 }
 
@@ -413,11 +413,15 @@ fd3_program_emit(struct fd_ringbuffer *ring, struct fd3_emit *emit,
                                }
                        }
 
-                       /* TODO: Figure out if there's a way to make it spit out 0's and
-                        * 1's for the .z and .w components.
+                       /* Replace the .xy coordinates with S/T from the point sprite. Set
+                        * interpolation bits for .zw such that they become .01
                         */
-                       if (emit->sprite_coord_enable & (1 << sem2idx(fp->inputs[j].semantic)))
-                               vpsrepl[inloc / 16] |= 0x09 << ((inloc % 16) * 2);
+                       if (emit->sprite_coord_enable & (1 << sem2idx(fp->inputs[j].semantic))) {
+                               vpsrepl[inloc / 16] |= (emit->sprite_coord_mode ? 0x0d : 0x09)
+                                       << ((inloc % 16) * 2);
+                               vinterp[(inloc + 2) / 16] |= 2 << (((inloc + 2) % 16) * 2);
+                               vinterp[(inloc + 3) / 16] |= 3 << (((inloc + 3) % 16) * 2);
+                       }
                }
 
                OUT_PKT0(ring, REG_A3XX_VPC_ATTR, 2);