diff options
author | Timothy Arceri <[email protected]> | 2017-06-16 10:17:56 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-03-20 14:17:33 +1100 |
commit | edded1237607348683f492db313e823dc2e380c3 (patch) | |
tree | 1fb861be1d324eb309fbef50e6b353dfff4a0c83 /src/mesa/state_tracker | |
parent | b13b9eb432a3b67efb29ca25c3e244b467c3c4af (diff) |
mesa: rework ParameterList to allow packing
Currently everything is padded to 4 components. Making the list
more flexible will allow us to do uniform packing.
V2 (suggestions from Nicolai):
- always pass existing calls to _mesa_add_parameter() true for padd_and_align
- fix bindless param value offsets
- remove left over wip logic from pad and align code
- zero out param value padding
- whitespace fix
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atifs_to_tgsi.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_constbuf.c | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 8 |
4 files changed, 15 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c index 76236cf9656..1180ede35e6 100644 --- a/src/mesa/state_tracker/st_atifs_to_tgsi.c +++ b/src/mesa/state_tracker/st_atifs_to_tgsi.c @@ -476,6 +476,8 @@ st_translate_atifs_program( } 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: @@ -484,7 +486,7 @@ st_translate_atifs_program( case PROGRAM_CONSTANT: t->constants[i] = ureg_DECL_immediate(ureg, - (const float*)program->Parameters->ParameterValues[i], + (const float*)program->Parameters->ParameterValues + pvo, 4); break; default: @@ -601,7 +603,7 @@ st_init_atifs_prog(struct gl_context *ctx, struct gl_program *prog) /* we always have the ATI_fs constants, and the fog params */ for (i = 0; i < MAX_NUM_FRAGMENT_CONSTANTS_ATI; i++) { _mesa_add_parameter(prog->Parameters, PROGRAM_UNIFORM, - NULL, 4, GL_FLOAT, NULL, NULL); + NULL, 4, GL_FLOAT, NULL, NULL, true); } _mesa_add_state_reference(prog->Parameters, fog_params_state); _mesa_add_state_reference(prog->Parameters, fog_color); diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 0a6b23aff3b..87a72b2622c 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -71,11 +71,12 @@ void st_upload_constants(struct st_context *st, struct gl_program *prog) unsigned c; for (c = 0; c < MAX_NUM_FRAGMENT_CONSTANTS_ATI; c++) { + unsigned offset = params->ParameterValueOffset[c]; if (ati_fs->LocalConstDef & (1 << c)) - memcpy(params->ParameterValues[c], + memcpy(params->ParameterValues + offset, ati_fs->Constants[c], sizeof(GLfloat) * 4); else - memcpy(params->ParameterValues[c], + memcpy(params->ParameterValues + offset, st->ctx->ATIFragmentShader.GlobalConstants[c], sizeof(GLfloat) * 4); } } diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 911c855d43a..f0f68ac02c6 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6591,6 +6591,8 @@ st_translate_program( t->num_constants = proginfo->Parameters->NumParameters; for (i = 0; i < proginfo->Parameters->NumParameters; i++) { + unsigned pvo = proginfo->Parameters->ParameterValueOffset[i]; + switch (proginfo->Parameters->Parameters[i].Type) { case PROGRAM_STATE_VAR: case PROGRAM_UNIFORM: @@ -6608,7 +6610,7 @@ st_translate_program( t->constants[i] = ureg_DECL_constant(ureg, i); else t->constants[i] = emit_immediate(t, - proginfo->Parameters->ParameterValues[i], + proginfo->Parameters->ParameterValues + pvo, proginfo->Parameters->Parameters[i].DataType, 4); break; diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 99cddd66282..0ea201fdd6a 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -1011,6 +1011,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 +1027,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: |