summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_program.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-12-14 11:00:46 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-12-14 11:00:46 -0700
commite785f190f0d49f0367f7468c22b77962d0f14ea0 (patch)
tree41af7dbb2b05556deed248ff88b0934195e3ce78 /src/mesa/state_tracker/st_program.c
parent23e36c2dfb1f9501a6a1023afc1d0c151f2e99c3 (diff)
Don't always declare frag shader INPUT[0] as fragment position.
We were doing this for the sake of softpipe and the tgsi intergrepter since we always need the fragment position and W-coordinate information in order to compute fragment interpolants. But that's not appropriate for hardware drivers. The tgsi interpreter now get x,y,w information from a separate tgsi_exec_vector variable setup by softpipe. The new pipe_shader_state->input_map[] defines how vert shader outputs map to frag shader inputs. It may go away though, since one can also examine the semantic label on frag shader input[0] to figure things out.
Diffstat (limited to 'src/mesa/state_tracker/st_program.c')
-rw-r--r--src/mesa/state_tracker/st_program.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index e64bf14d56..fe22233c93 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -47,7 +47,7 @@
#include "st_mesa_to_tgsi.h"
-#define TGSI_DEBUG 0
+#define TGSI_DEBUG 01
/**
@@ -283,16 +283,17 @@ st_translate_fragment_program(struct st_context *st,
const struct cso_fragment_shader *cso;
GLuint interpMode[16]; /* XXX size? */
GLuint attr;
- GLbitfield inputsRead = stfp->Base.Base.InputsRead;
-
- /* For software rendering, we always need the fragment input position
- * in order to calculate interpolated values.
- * For i915, we always want to emit the semantic info for position.
- */
- inputsRead |= FRAG_BIT_WPOS;
+ const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
+ GLuint vslot = 0;
memset(&fs, 0, sizeof(fs));
+ /* which vertex output goes to the first fragment input: */
+ if (inputsRead & FRAG_BIT_WPOS)
+ vslot = 0;
+ else
+ vslot = 1;
+
/*
* Convert Mesa program inputs to TGSI input register semantics.
*/
@@ -300,15 +301,17 @@ st_translate_fragment_program(struct st_context *st,
if (inputsRead & (1 << attr)) {
const GLuint slot = fs.num_inputs;
- fs.num_inputs++;
-
defaultInputMapping[attr] = slot;
+ fs.input_map[slot] = vslot++;
+
+ fs.num_inputs++;
+
switch (attr) {
case FRAG_ATTRIB_WPOS:
fs.input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
fs.input_semantic_index[slot] = 0;
- interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
+ interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
break;
case FRAG_ATTRIB_COL0:
fs.input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;