@@ -803,7 +803,14 @@ tgsi_dump_instruction( | |||
ENM( src->SrcRegister.File, TGSI_FILES_SHORT ); | |||
CHR( '[' ); | |||
SID( src->SrcRegister.Index ); | |||
if (src->SrcRegister.Indirect) { | |||
TXT( "addr" ); | |||
if (src->SrcRegister.Index > 0) | |||
CHR( '+' ); | |||
SID( src->SrcRegister.Index ); | |||
} | |||
else | |||
SID( src->SrcRegister.Index ); | |||
CHR( ']' ); | |||
if (src->SrcRegister.SwizzleX != TGSI_SWIZZLE_X || |
@@ -3880,7 +3880,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, | |||
} | |||
#if DEBUG_FP | |||
_mesa_printf("____________Fragment program %u ________\n", program->Base.ID); | |||
_mesa_printf("____________Fragment program %u ________\n", program->Base.Id); | |||
_mesa_print_program(&program->Base); | |||
#endif | |||
} |
@@ -206,7 +206,7 @@ arb_output_attrib_string(GLint index, GLenum progType) | |||
*/ | |||
static const char * | |||
reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, | |||
const struct gl_program *prog) | |||
GLint relAddr, const struct gl_program *prog) | |||
{ | |||
static char str[100]; | |||
@@ -214,7 +214,10 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, | |||
switch (mode) { | |||
case PROG_PRINT_DEBUG: | |||
sprintf(str, "%s[%d]", file_string(f, mode), index); | |||
if (relAddr) | |||
sprintf(str, "%s[ADDR%s%d]", file_string(f, mode), (index > 0) ? "+" : "", index); | |||
else | |||
sprintf(str, "%s[%d]", file_string(f, mode), index); | |||
break; | |||
case PROG_PRINT_ARB: | |||
@@ -401,7 +404,7 @@ print_dst_reg(const struct prog_dst_register *dstReg, gl_prog_print_mode mode, | |||
{ | |||
_mesa_printf("%s%s", | |||
reg_string((enum register_file) dstReg->File, | |||
dstReg->Index, mode, prog), | |||
dstReg->Index, mode, GL_FALSE, prog), | |||
writemask_string(dstReg->WriteMask)); | |||
if (dstReg->CondMask != COND_TR) { | |||
@@ -424,9 +427,9 @@ print_src_reg(const struct prog_src_register *srcReg, gl_prog_print_mode mode, | |||
{ | |||
_mesa_printf("%s%s", | |||
reg_string((enum register_file) srcReg->File, | |||
srcReg->Index, mode, prog), | |||
srcReg->Index, mode, srcReg->RelAddr, prog), | |||
_mesa_swizzle_string(srcReg->Swizzle, | |||
srcReg->NegateBase, GL_FALSE)); | |||
srcReg->NegateBase, GL_FALSE)); | |||
#if 0 | |||
_mesa_printf("%s[%d]%s", | |||
file_string((enum register_file) srcReg->File, mode), | |||
@@ -590,7 +593,9 @@ _mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, | |||
break; | |||
case OPCODE_ARL: | |||
_mesa_printf("ARL addr.x, "); | |||
_mesa_printf("ARL "); | |||
print_dst_reg(&inst->DstReg, mode, prog); | |||
_mesa_printf(", "); | |||
print_src_reg(&inst->SrcReg[0], mode, prog); | |||
print_comment(inst); | |||
break; |
@@ -223,6 +223,7 @@ storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st) | |||
assert(st->Size <= 4); | |||
src->File = st->File; | |||
src->Index = st->Index; | |||
src->RelAddr = st->RelAddr; | |||
if (st->Swizzle != SWIZZLE_NOOP) | |||
src->Swizzle = st->Swizzle; | |||
else | |||
@@ -1488,11 +1489,16 @@ emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n) | |||
n->Store->Index = arrayAddr + index; | |||
} | |||
else { | |||
/* Variable index - PROBLEM */ | |||
const GLint arrayAddr = n->Children[0]->Store->Index; | |||
const GLint index = 0; | |||
_mesa_problem(NULL, "variable array indexes not supported yet!"); | |||
n->Store->Index = arrayAddr + index; | |||
/* Variable index*/ | |||
struct prog_instruction *inst; | |||
inst = new_instruction(emitInfo, OPCODE_ARL); | |||
storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask); | |||
storage_to_src_reg(&inst->SrcReg[0], n->Children[1]->Store); | |||
inst->DstReg.File = PROGRAM_ADDRESS; | |||
inst->Comment = _mesa_strdup("ARL ADDR"); | |||
n->Store->RelAddr = GL_TRUE; | |||
n->Store->Index = inst->DstReg.Index;/*index of the array*/ | |||
inst->DstReg.Index = 0; /*addr index is always 0*/ | |||
} | |||
return NULL; /* no instruction */ | |||
} |
@@ -146,6 +146,7 @@ struct _slang_ir_storage | |||
GLint Size; /**< number of floats */ | |||
GLuint Swizzle; | |||
GLint RefCount; /**< Used during IR tree delete */ | |||
GLboolean RelAddr; | |||
}; | |||
typedef struct _slang_ir_storage slang_ir_storage; |
@@ -68,8 +68,8 @@ map_register_file( | |||
case PROGRAM_STATE_VAR: | |||
case PROGRAM_NAMED_PARAM: | |||
case PROGRAM_UNIFORM: | |||
if (immediateMapping[index] != ~0) | |||
return TGSI_FILE_IMMEDIATE; | |||
if (immediateMapping && immediateMapping[index] != ~0) | |||
return TGSI_FILE_IMMEDIATE; | |||
else | |||
return TGSI_FILE_CONSTANT; | |||
case PROGRAM_CONSTANT: |