--- src/mesa/state_tracker/st_atifs_to_tgsi.c | 7 +++++-- src/mesa/state_tracker/st_atifs_to_tgsi.h | 1 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 +++-- src/mesa/state_tracker/st_mesa_to_tgsi.c | 5 +++-- src/mesa/state_tracker/st_program.c | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c index 34d4378..3b8975f 100644 --- a/src/mesa/state_tracker/st_atifs_to_tgsi.c +++ b/src/mesa/state_tracker/st_atifs_to_tgsi.c @@ -414,20 +414,21 @@ finalize_shader(struct st_translate *t, unsigned numPasses) /* signal the end of the program */ ureg_insn(t->ureg, TGSI_OPCODE_END, dst, 0, src, 0); } /** * Called when a new variant is needed, we need to translate * the ATI fragment shader to TGSI */ enum pipe_error st_translate_atifs_program( + struct gl_context *ctx, struct ureg_program *ureg, struct ati_fragment_shader *atifs, struct gl_program *program, GLuint numInputs, const ubyte inputMapping[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const ubyte interpMode[], GLuint numOutputs, const ubyte outputMapping[], @@ -474,23 +475,25 @@ st_translate_atifs_program( if (t->constants == NULL) { ret = PIPE_ERROR_OUT_OF_MEMORY; goto out; } 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: - t->constants[i] = ureg_DECL_constant(ureg, i); + case PROGRAM_UNIFORM: { + unsigned idx = ctx->Const.PackedDriverUniformStorage ? pvo : i; + t->constants[i] = ureg_DECL_constant(ureg, idx); break; + } case PROGRAM_CONSTANT: t->constants[i] = ureg_DECL_immediate(ureg, (const float*)program->Parameters->ParameterValues + pvo, 4); break; default: break; } } diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.h b/src/mesa/state_tracker/st_atifs_to_tgsi.h index ce54791..50b069c 100644 --- a/src/mesa/state_tracker/st_atifs_to_tgsi.h +++ b/src/mesa/state_tracker/st_atifs_to_tgsi.h @@ -32,20 +32,21 @@ extern "C" { struct gl_context; struct gl_program; struct ureg_program; struct tgsi_token; struct ati_fragment_shader; struct st_fp_variant_key; enum pipe_error st_translate_atifs_program( + struct gl_context *ctx, struct ureg_program *ureg, struct ati_fragment_shader *atifs, struct gl_program *program, GLuint numInputs, const ubyte inputMapping[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const ubyte interpMode[], GLuint numOutputs, const ubyte outputMapping[], diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 1bd55e4..5d82536 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6631,36 +6631,37 @@ st_translate_program( t->constants = (struct ureg_src *) calloc(proginfo->Parameters->NumParameters, sizeof(t->constants[0])); if (t->constants == NULL) { ret = PIPE_ERROR_OUT_OF_MEMORY; goto out; } t->num_constants = proginfo->Parameters->NumParameters; for (i = 0; i < proginfo->Parameters->NumParameters; i++) { unsigned pvo = proginfo->Parameters->ParameterValueOffset[i]; + unsigned idx = ctx->Const.PackedDriverUniformStorage ? pvo : i; switch (proginfo->Parameters->Parameters[i].Type) { case PROGRAM_STATE_VAR: case PROGRAM_UNIFORM: - t->constants[i] = ureg_DECL_constant(ureg, i); + t->constants[i] = ureg_DECL_constant(ureg, idx); break; /* Emit immediates for PROGRAM_CONSTANT only when there's no indirect * addressing of the const buffer. * FIXME: Be smarter and recognize param arrays: * indirect addressing is only valid within the referenced * array. */ case PROGRAM_CONSTANT: if (program->indirect_addr_consts) - t->constants[i] = ureg_DECL_constant(ureg, i); + t->constants[i] = ureg_DECL_constant(ureg, idx); else t->constants[i] = emit_immediate(t, proginfo->Parameters->ParameterValues + pvo, proginfo->Parameters->Parameters[i].DataType, proginfo->Parameters->Parameters[i].Size); break; default: break; } } diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 30dc5cb..83dbabd 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -992,36 +992,37 @@ st_translate_mesa_program( if (program->Parameters) { t->constants = calloc( program->Parameters->NumParameters, sizeof t->constants[0] ); if (t->constants == NULL) { ret = PIPE_ERROR_OUT_OF_MEMORY; goto out; } for (i = 0; i < program->Parameters->NumParameters; i++) { unsigned pvo = program->Parameters->ParameterValueOffset[i]; + unsigned idx = ctx->Const.PackedDriverUniformStorage ? pvo : i; switch (program->Parameters->Parameters[i].Type) { case PROGRAM_STATE_VAR: case PROGRAM_UNIFORM: - t->constants[i] = ureg_DECL_constant( ureg, i ); + t->constants[i] = ureg_DECL_constant(ureg, idx); break; /* Emit immediates only when there's no indirect addressing of * the const buffer. * FIXME: Be smarter and recognize param arrays: * indirect addressing is only valid within the referenced * array. */ 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, idx); else t->constants[i] = ureg_DECL_immediate(ureg, (const float*) program->Parameters->ParameterValues + pvo, program->Parameters->Parameters[i].Size); break; default: break; } } diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 6de6174..83248be 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1027,21 +1027,21 @@ st_translate_fragment_program(struct st_context *st, input_semantic_index, interpMode, /* outputs */ fs_num_outputs, outputMapping, fs_output_semantic_name, fs_output_semantic_index); free_glsl_to_tgsi_visitor(stfp->glsl_to_tgsi); } else if (stfp->ati_fs) - st_translate_atifs_program(ureg, + st_translate_atifs_program(st->ctx, ureg, stfp->ati_fs, &stfp->Base, /* inputs */ fs_num_inputs, inputMapping, input_semantic_name, input_semantic_index, interpMode, /* outputs */ fs_num_outputs, -- 2.9.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev