mesa: add comments and change Index2D to just Index2

This commit is contained in:
Zack Rusin 2010-07-13 21:49:53 -04:00
parent 79b643dd02
commit 1491c6aa2d
7 changed files with 37 additions and 25 deletions

View file

@ -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. */
};

View file

@ -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);

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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.

View file

@ -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,

View file

@ -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