summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/slang/slang_emit.c8
-rw-r--r--src/mesa/slang/slang_link.c12
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c19
-rw-r--r--src/mesa/state_tracker/st_program.c3
4 files changed, 29 insertions, 13 deletions
diff --git a/src/mesa/slang/slang_emit.c b/src/mesa/slang/slang_emit.c
index 4a02ba6d466..6cd9ce65a02 100644
--- a/src/mesa/slang/slang_emit.c
+++ b/src/mesa/slang/slang_emit.c
@@ -2320,7 +2320,13 @@ emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n)
}
else if (n->Store->File == PROGRAM_INPUT) {
assert(n->Store->Index >= 0);
- emitInfo->prog->InputsRead |= (1 << n->Store->Index);
+ /* geometry shaders have the input index in the second
+ * index */
+ if (emitInfo->prog->Target == MESA_GEOMETRY_PROGRAM &&
+ n->Store->Is2D) {
+ emitInfo->prog->InputsRead |= (1 << n->Store->Index2D);
+ } else
+ emitInfo->prog->InputsRead |= (1 << n->Store->Index);
}
if (n->Store->Index < 0) {
diff --git a/src/mesa/slang/slang_link.c b/src/mesa/slang/slang_link.c
index bc2bd31fda5..8d5a9e96ad9 100644
--- a/src/mesa/slang/slang_link.c
+++ b/src/mesa/slang/slang_link.c
@@ -761,9 +761,15 @@ _slang_update_inputs_outputs(struct gl_program *prog)
const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
for (j = 0; j < numSrc; j++) {
if (inst->SrcReg[j].File == PROGRAM_INPUT) {
- prog->InputsRead |= get_inputs_read_mask(prog->Target,
- inst->SrcReg[j].Index,
- inst->SrcReg[j].RelAddr);
+ if (prog->Target == MESA_GEOMETRY_PROGRAM &&
+ inst->SrcReg[j].HasIndex2D)
+ prog->InputsRead |= get_inputs_read_mask(prog->Target,
+ inst->SrcReg[j].Index2D,
+ inst->SrcReg[j].RelAddr2D);
+ else
+ prog->InputsRead |= get_inputs_read_mask(prog->Target,
+ inst->SrcReg[j].Index,
+ inst->SrcReg[j].RelAddr);
}
else if (inst->SrcReg[j].File == PROGRAM_ADDRESS) {
maxAddrReg = MAX2(maxAddrReg, (GLuint) (inst->SrcReg[j].Index + 1));
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 050b5d164d7..c870db2d699 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -176,7 +176,7 @@ dst_register( struct st_translate *t,
else if (t->procType == TGSI_PROCESSOR_FRAGMENT)
assert(index < FRAG_RESULT_MAX);
else
- assert(0 && "geom shaders not handled in dst_register() yet");
+ assert(index < GEOM_RESULT_MAX);
assert(t->outputMapping[index] < Elements(t->outputs));
@@ -305,6 +305,15 @@ translate_src( struct st_translate *t,
{
struct ureg_src src = src_register( t, SrcReg->File, SrcReg->Index );
+ if (t->procType == TGSI_PROCESSOR_GEOMETRY && SrcReg->HasIndex2D) {
+ src = src_register( t, SrcReg->File, SrcReg->Index2D );
+ if (SrcReg->RelAddr2D)
+ src = ureg_src_dimension_indirect( src, ureg_src(t->address[0]),
+ SrcReg->Index);
+ else
+ src = ureg_src_dimension( src, SrcReg->Index);
+ }
+
src = ureg_swizzle( src,
GET_SWZ( SrcReg->Swizzle, 0 ) & 0x3,
GET_SWZ( SrcReg->Swizzle, 1 ) & 0x3,
@@ -330,14 +339,6 @@ translate_src( struct st_translate *t,
}
}
- if (SrcReg->HasIndex2D) {
- if (SrcReg->RelAddr2D)
- src = ureg_src_dimension_indirect( src, ureg_src(t->address[0]),
- SrcReg->Index2D);
- else
- src = ureg_src_dimension( src, SrcReg->Index2D);
- }
-
return src;
}
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 1d748965f80..6f3ecdbce11 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -492,6 +492,9 @@ st_translate_geometry_program(struct st_context *st,
/* which vertex output goes to the first geometry input */
vslot = 0;
+ memset(inputMapping, 0, sizeof(inputMapping));
+ memset(outputMapping, 0, sizeof(outputMapping));
+
/*
* Convert Mesa program inputs to TGSI input register semantics.
*/