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/compiler/glsl/serialize.cpp | |
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/compiler/glsl/serialize.cpp')
-rw-r--r-- | src/compiler/glsl/serialize.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/compiler/glsl/serialize.cpp b/src/compiler/glsl/serialize.cpp index 1fdbaa990f4..727822633df 100644 --- a/src/compiler/glsl/serialize.cpp +++ b/src/compiler/glsl/serialize.cpp @@ -950,6 +950,7 @@ write_shader_parameters(struct blob *metadata, struct gl_program_parameter_list *params) { blob_write_uint32(metadata, params->NumParameters); + blob_write_uint32(metadata, params->NumParameterValues); uint32_t i = 0; while (i < params->NumParameters) { @@ -966,7 +967,10 @@ write_shader_parameters(struct blob *metadata, } blob_write_bytes(metadata, params->ParameterValues, - sizeof(gl_constant_value) * 4 * params->NumParameters); + sizeof(gl_constant_value) * params->NumParameterValues); + + blob_write_bytes(metadata, params->ParameterValueOffset, + sizeof(uint32_t) * params->NumParameters); blob_write_uint32(metadata, params->StateFlags); } @@ -978,6 +982,7 @@ read_shader_parameters(struct blob_reader *metadata, gl_state_index16 state_indexes[STATE_LENGTH]; uint32_t i = 0; uint32_t num_parameters = blob_read_uint32(metadata); + uint32_t num_parameters_values = blob_read_uint32(metadata); _mesa_reserve_parameter_storage(params, num_parameters); while (i < num_parameters) { @@ -989,13 +994,16 @@ read_shader_parameters(struct blob_reader *metadata, sizeof(state_indexes)); _mesa_add_parameter(params, type, name, size, data_type, - NULL, state_indexes); + NULL, state_indexes, false); i++; } blob_copy_bytes(metadata, (uint8_t *) params->ParameterValues, - sizeof(gl_constant_value) * 4 * params->NumParameters); + sizeof(gl_constant_value) * num_parameters_values); + + blob_copy_bytes(metadata, (uint8_t *) params->ParameterValueOffset, + sizeof(uint32_t) * num_parameters); params->StateFlags = blob_read_uint32(metadata); } |