summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-06-01 16:32:46 -0700
committerEric Anholt <[email protected]>2010-06-24 15:05:21 -0700
commit224f712950494730c76b48864f2ca19acde1c8cf (patch)
treea29876dd425788ffec4425c8e4ca316f366f8ba7
parentab386f18b045fe260112bd9a239cb503e737c1db (diff)
ir_to_mesa: Fix mapping of FS texcoord inputs and color output.
-rw-r--r--ir_to_mesa.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/ir_to_mesa.cpp b/ir_to_mesa.cpp
index 8d3f65ffb20..f121fc88b34 100644
--- a/ir_to_mesa.cpp
+++ b/ir_to_mesa.cpp
@@ -613,13 +613,14 @@ static const struct {
/* core_fs */
{"gl_FragCoord", PROGRAM_INPUT, FRAG_ATTRIB_WPOS},
{"gl_FrontFacing", PROGRAM_INPUT, FRAG_ATTRIB_FACE},
- {"gl_FragColor", PROGRAM_INPUT, FRAG_ATTRIB_COL0},
+ {"gl_FragColor", PROGRAM_OUTPUT, FRAG_ATTRIB_COL0},
{"gl_FragDepth", PROGRAM_UNDEFINED, FRAG_ATTRIB_WPOS}, /* FINISHME: WPOS.z */
/* 110_deprecated_fs */
{"gl_Color", PROGRAM_INPUT, FRAG_ATTRIB_COL0},
{"gl_SecondaryColor", PROGRAM_INPUT, FRAG_ATTRIB_COL1},
{"gl_FogFragCoord", PROGRAM_INPUT, FRAG_ATTRIB_FOGC},
+ {"gl_TexCoord", PROGRAM_INPUT, FRAG_ATTRIB_TEX0}, /* array */
/* 110_deprecated_vs */
{"gl_Vertex", PROGRAM_INPUT, VERT_ATTRIB_POS},
@@ -669,12 +670,24 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
if (strncmp(ir->var->name, "gl_", 3) == 0) {
unsigned int i;
+ bool var_in = (ir->var->mode == ir_var_in ||
+ ir->var->mode == ir_var_inout);
+
+ tree = this->create_tree(MB_TERM_reference_vec4, ir, NULL, NULL);
for (i = 0; i < ARRAY_SIZE(builtin_var_to_mesa_reg); i++) {
- if (strcmp(ir->var->name, builtin_var_to_mesa_reg[i].name) == 0)
+ bool in = builtin_var_to_mesa_reg[i].file == PROGRAM_INPUT;
+
+ if (strcmp(ir->var->name, builtin_var_to_mesa_reg[i].name) == 0 &&
+ !(var_in ^ in))
break;
}
- assert(i != ARRAY_SIZE(builtin_var_to_mesa_reg));
+ if (i == ARRAY_SIZE(builtin_var_to_mesa_reg)) {
+ printf("Failed to find builtin for %s variable %s\n",
+ var_in ? "in" : "out",
+ ir->var->name);
+ abort();
+ }
ir_to_mesa_set_tree_reg(tree, builtin_var_to_mesa_reg[i].file,
builtin_var_to_mesa_reg[i].index);
} else {