diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/program/prog_instruction.h | 16 | ||||
-rw-r--r-- | src/mesa/program/prog_print.c | 10 | ||||
-rw-r--r-- | src/mesa/slang/slang_emit.c | 6 | ||||
-rw-r--r-- | src/mesa/slang/slang_ir.c | 14 | ||||
-rw-r--r-- | src/mesa/slang/slang_ir.h | 4 | ||||
-rw-r--r-- | src/mesa/slang/slang_link.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 6 |
7 files changed, 37 insertions, 25 deletions
diff --git a/src/mesa/program/prog_instruction.h b/src/mesa/program/prog_instruction.h index cb5beb9b00d..dacbc33704b 100644 --- a/src/mesa/program/prog_instruction.h +++ b/src/mesa/program/prog_instruction.h @@ -272,9 +272,19 @@ struct prog_src_register */ GLuint Negate:4; - GLuint HasIndex2D:1; - GLuint RelAddr2D:1; - GLint Index2D:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit. + /** + * Is the register two-dimensional. + * Two dimensional registers are of the + * REGISTER[index][index2] format. + * They are used by the geometry shaders where + * the first index is the index within an array + * and the second index is the semantic of the + * array, e.g. gl_PositionIn[index] would become + * INPUT[index][gl_PositionIn] + */ + GLuint HasIndex2:1; + GLuint RelAddr2:1; + GLint Index2:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit. * May be negative for relative * addressing. */ }; diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 876b2d46186..6ab199aa02b 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -266,7 +266,7 @@ arb_output_attrib_string(GLint index, GLenum progType) static const char * reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, GLboolean relAddr, const struct gl_program *prog, - GLboolean hasIndex2D, GLboolean relAddr2D, GLint index2D) + GLboolean hasIndex2, GLboolean relAddr2, GLint index2) { static char str[100]; const char *addr = relAddr ? "ADDR+" : ""; @@ -276,10 +276,10 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, switch (mode) { case PROG_PRINT_DEBUG: sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index); - if (hasIndex2D) { + if (hasIndex2) { int offset = strlen(str); - const char *addr2D = relAddr2D ? "ADDR+" : ""; - sprintf(str+offset, "[%s%d]", addr2D, index2D); + const char *addr2 = relAddr2 ? "ADDR+" : ""; + sprintf(str+offset, "[%s%d]", addr2, index2); } break; @@ -516,7 +516,7 @@ fprint_src_reg(FILE *f, abs, reg_string((gl_register_file) srcReg->File, srcReg->Index, mode, srcReg->RelAddr, prog, - srcReg->HasIndex2D, srcReg->RelAddr2D, srcReg->Index2D), + srcReg->HasIndex2, srcReg->RelAddr2, srcReg->Index2), _mesa_swizzle_string(srcReg->Swizzle, srcReg->Negate, GL_FALSE), abs); diff --git a/src/mesa/slang/slang_emit.c b/src/mesa/slang/slang_emit.c index 15d75eb8fb8..a9aa6fe1c3a 100644 --- a/src/mesa/slang/slang_emit.c +++ b/src/mesa/slang/slang_emit.c @@ -379,8 +379,8 @@ storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st) assert(GET_SWZ(swizzle, 3) <= SWIZZLE_W); src->Swizzle = swizzle; - src->HasIndex2D = st->Is2D; - src->Index2D = st->Index2D; + src->HasIndex2 = st->Is2D; + src->Index2 = st->Index2; src->RelAddr = relAddr; } @@ -2324,7 +2324,7 @@ emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) * index */ if (emitInfo->prog->Target == MESA_GEOMETRY_PROGRAM && n->Store->Is2D) { - emitInfo->prog->InputsRead |= (1 << n->Store->Index2D); + emitInfo->prog->InputsRead |= (1 << n->Store->Index2); } else emitInfo->prog->InputsRead |= (1 << n->Store->Index); } diff --git a/src/mesa/slang/slang_ir.c b/src/mesa/slang/slang_ir.c index 131093d2a7e..078c9369a89 100644 --- a/src/mesa/slang/slang_ir.c +++ b/src/mesa/slang/slang_ir.c @@ -134,7 +134,7 @@ _slang_init_ir_storage(slang_ir_storage *st, st->Parent = NULL; st->IsIndirect = GL_FALSE; st->Is2D = GL_FALSE; - st->Index2D = 0; + st->Index2 = 0; } @@ -154,7 +154,7 @@ _slang_new_ir_storage(gl_register_file file, GLint index, GLint size) st->Parent = NULL; st->IsIndirect = GL_FALSE; st->Is2D = GL_FALSE; - st->Index2D = 0; + st->Index2 = 0; } return st; } @@ -177,7 +177,7 @@ _slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, st->Parent = NULL; st->IsIndirect = GL_FALSE; st->Is2D = GL_FALSE; - st->Index2D = 0; + st->Index2 = 0; } return st; } @@ -187,7 +187,7 @@ _slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, */ slang_ir_storage * _slang_new_ir_storage_2d(gl_register_file file, - GLint index, GLint index2d, + GLint index, GLint index2, GLint size, GLuint swizzle) { slang_ir_storage *st; @@ -200,7 +200,7 @@ _slang_new_ir_storage_2d(gl_register_file file, st->Parent = NULL; st->IsIndirect = GL_FALSE; st->Is2D = GL_TRUE; - st->Index2D = index2d; + st->Index2 = index2; } return st; } @@ -224,7 +224,7 @@ _slang_new_ir_storage_relative(GLint index, GLint size, st->Parent = parent; st->IsIndirect = GL_FALSE; st->Is2D = GL_FALSE; - st->Index2D = 0; + st->Index2 = 0; } return st; } @@ -250,7 +250,7 @@ _slang_new_ir_storage_indirect(gl_register_file file, st->IndirectIndex = indirectIndex; st->IndirectSwizzle = indirectSwizzle; st->Is2D = GL_FALSE; - st->Index2D = 0; + st->Index2 = 0; } return st; } diff --git a/src/mesa/slang/slang_ir.h b/src/mesa/slang/slang_ir.h index 543cf0acc78..b7a373746b4 100644 --- a/src/mesa/slang/slang_ir.h +++ b/src/mesa/slang/slang_ir.h @@ -189,8 +189,10 @@ struct slang_ir_storage_ GLuint IndirectSwizzle; GLuint TexTarget; /**< If File==PROGRAM_SAMPLER, one of TEXTURE_x_INDEX */ + /* Is the register two-dimensional and + * if so what's the second index */ GLboolean Is2D; - GLint Index2D; + GLint Index2; /** If Parent is non-null, Index is relative to parent. * The other fields are ignored. diff --git a/src/mesa/slang/slang_link.c b/src/mesa/slang/slang_link.c index 8d5a9e96ad9..955ee79ed86 100644 --- a/src/mesa/slang/slang_link.c +++ b/src/mesa/slang/slang_link.c @@ -762,10 +762,10 @@ _slang_update_inputs_outputs(struct gl_program *prog) for (j = 0; j < numSrc; j++) { if (inst->SrcReg[j].File == PROGRAM_INPUT) { if (prog->Target == MESA_GEOMETRY_PROGRAM && - inst->SrcReg[j].HasIndex2D) + inst->SrcReg[j].HasIndex2) prog->InputsRead |= get_inputs_read_mask(prog->Target, - inst->SrcReg[j].Index2D, - inst->SrcReg[j].RelAddr2D); + inst->SrcReg[j].Index2, + inst->SrcReg[j].RelAddr2); else prog->InputsRead |= get_inputs_read_mask(prog->Target, inst->SrcReg[j].Index, diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index c870db2d699..bacd091853b 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -305,9 +305,9 @@ 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) + if (t->procType == TGSI_PROCESSOR_GEOMETRY && SrcReg->HasIndex2) { + src = src_register( t, SrcReg->File, SrcReg->Index2 ); + if (SrcReg->RelAddr2) src = ureg_src_dimension_indirect( src, ureg_src(t->address[0]), SrcReg->Index); else |