X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_mesa_to_tgsi.c;h=dca9acb3f31d55745289e3371dc6b07168a87d7e;hb=d94bec5c49d926069f97a4b12fb2532611a9080c;hp=75825c3cf627eab2804466ec9d25d27517442cd0;hpb=d4726b13183c45fbc0869596c128f7c030b3cd9c;p=mesa.git diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 75825c3cf62..dca9acb3f31 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -37,6 +37,7 @@ #include "pipe/p_shader_tokens.h" #include "pipe/p_state.h" #include "tgsi/tgsi_ureg.h" +#include "tgsi/tgsi_from_mesa.h" #include "st_mesa_to_tgsi.h" #include "st_context.h" #include "program/prog_instruction.h" @@ -96,9 +97,12 @@ dst_register(struct st_translate *t, gl_register_file file, GLuint index) else assert(index < VARYING_SLOT_MAX); - assert(t->outputMapping[index] < ARRAY_SIZE(t->outputs)); - - return t->outputs[t->outputMapping[index]]; + if (t->outputMapping[index] < ARRAY_SIZE(t->outputs)) + return t->outputs[t->outputMapping[index]]; + else { + assert(t->procType == PIPE_SHADER_VERTEX); + return ureg_dst(ureg_DECL_constant(t->ureg, 0)); + } case PROGRAM_ADDRESS: return t->address[index]; @@ -140,12 +144,20 @@ src_register(struct st_translate *t, return t->constants[index]; case PROGRAM_INPUT: - assert(t->inputMapping[index] < ARRAY_SIZE(t->inputs)); - return t->inputs[t->inputMapping[index]]; + if (t->inputMapping[index] < ARRAY_SIZE(t->inputs)) + return t->inputs[t->inputMapping[index]]; + else { + assert(t->procType == PIPE_SHADER_VERTEX); + return ureg_DECL_constant(t->ureg, 0); + } case PROGRAM_OUTPUT: - assert(t->outputMapping[index] < ARRAY_SIZE(t->outputs)); - return ureg_src(t->outputs[t->outputMapping[index]]); /* not needed? */ + if (t->outputMapping[index] < ARRAY_SIZE(t->outputs)) + return ureg_src(t->outputs[t->outputMapping[index]]); + else { + assert(t->procType == PIPE_SHADER_VERTEX); + return ureg_DECL_constant(t->ureg, 0); + } case PROGRAM_ADDRESS: return ureg_src(t->address[index]); @@ -622,7 +634,7 @@ emit_wpos_adjustment(struct gl_context *ctx, * Need to replace instances of INPUT[WPOS] with temp T * where T = INPUT[WPOS] by y is inverted. */ - static const gl_state_index wposTransformState[STATE_LENGTH] + static const gl_state_index16 wposTransformState[STATE_LENGTH] = { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM, 0, 0, 0 }; /* XXX: note we are modifying the incoming shader here! Need to @@ -734,7 +746,7 @@ emit_wpos(struct st_context *st, * u,i -> l,h: (99.0 + 0.5) * -1 + 100 = 0.5 * u,h -> l,i: (99.5 + 0.5) * -1 + 100 = 0 */ - if (program->OriginUpperLeft) { + if (program->info.fs.origin_upper_left) { /* Fragment shader wants origin in upper-left */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) { @@ -764,7 +776,7 @@ emit_wpos(struct st_context *st, assert(0); } - if (program->PixelCenterInteger) { + if (program->info.fs.pixel_center_integer) { /* Fragment shader wants pixel center integer */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { @@ -951,10 +963,10 @@ st_translate_mesa_program(struct gl_context *ctx, /* Declare misc input registers */ - GLbitfield sysInputs = program->info.system_values_read; + GLbitfield64 sysInputs = program->info.system_values_read; for (i = 0; sysInputs; i++) { - if (sysInputs & (1 << i)) { - unsigned semName = _mesa_sysval_to_semantic(i); + if (sysInputs & (1ull << i)) { + unsigned semName = tgsi_get_sysval_semantic(i); t->systemValues[i] = ureg_DECL_system_value(ureg, semName, 0); @@ -985,7 +997,7 @@ st_translate_mesa_program(struct gl_context *ctx, semName == TGSI_SEMANTIC_POSITION) emit_wpos(st_context(ctx), t, program, ureg); - sysInputs &= ~(1 << i); + sysInputs &= ~(1ull << i); } } @@ -1011,6 +1023,8 @@ st_translate_mesa_program(struct gl_context *ctx, } for (i = 0; i < program->Parameters->NumParameters; i++) { + unsigned pvo = program->Parameters->ParameterValueOffset[i]; + switch (program->Parameters->Parameters[i].Type) { case PROGRAM_STATE_VAR: case PROGRAM_UNIFORM: @@ -1025,12 +1039,12 @@ st_translate_mesa_program(struct gl_context *ctx, */ case PROGRAM_CONSTANT: if (program->arb.IndirectRegisterFiles & PROGRAM_ANY_CONST) - t->constants[i] = ureg_DECL_constant(ureg, i); + t->constants[i] = ureg_DECL_constant( ureg, i ); else - t->constants[i] = + t->constants[i] = ureg_DECL_immediate(ureg, (const float *) - program->Parameters->ParameterValues[i], + program->Parameters->ParameterValues + pvo, 4); break; default: