summaryrefslogtreecommitdiffstats
path: root/src/mesa/program/prog_parameter_layout.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-06-16 10:17:56 +1000
committerTimothy Arceri <[email protected]>2018-03-20 14:17:33 +1100
commitedded1237607348683f492db313e823dc2e380c3 (patch)
tree1fb861be1d324eb309fbef50e6b353dfff4a0c83 /src/mesa/program/prog_parameter_layout.c
parentb13b9eb432a3b67efb29ca25c3e244b467c3c4af (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/program/prog_parameter_layout.c')
-rw-r--r--src/mesa/program/prog_parameter_layout.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mesa/program/prog_parameter_layout.c b/src/mesa/program/prog_parameter_layout.c
index 282a367ad04..d28a6675c06 100644
--- a/src/mesa/program/prog_parameter_layout.c
+++ b/src/mesa/program/prog_parameter_layout.c
@@ -92,10 +92,20 @@ copy_indirect_accessed_array(struct gl_program_parameter_list *src,
assert(j == dst->NumParameters);
/* copy src parameter [i] to dest parameter [j] */
- memcpy(& dst->Parameters[j], curr,
+ memcpy(&dst->Parameters[j], curr,
sizeof(dst->Parameters[j]));
- memcpy(dst->ParameterValues[j], src->ParameterValues[i],
- sizeof(GLfloat) * 4);
+
+ dst->ParameterValueOffset[j] = dst->NumParameterValues;
+
+ gl_constant_value *pv_dst =
+ dst->ParameterValues + dst->ParameterValueOffset[j];
+ gl_constant_value *pv_src =
+ src->ParameterValues + src->ParameterValueOffset[i];
+
+ memcpy(pv_dst, pv_src, MIN2(src->Parameters[i].Size, 4) *
+ sizeof(GLfloat));
+ dst->NumParameterValues += MIN2(dst->Parameters[j].Size, 4);
+
/* Pointer to the string name was copied. Null-out src param name
* to prevent double free later.
@@ -183,8 +193,9 @@ _mesa_layout_parameters(struct asm_parser_state *state)
switch (p->Type) {
case PROGRAM_CONSTANT: {
- const gl_constant_value *const v =
- state->prog->Parameters->ParameterValues[idx];
+ unsigned pvo = state->prog->Parameters->ParameterValueOffset[idx];
+ const gl_constant_value *const v =
+ state->prog->Parameters->ParameterValues + pvo;
inst->Base.SrcReg[i].Index =
_mesa_add_unnamed_constant(layout, v, p->Size, & swizzle);