<div dir="ltr"><div>Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>></div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 27, 2019 at 2:26 AM Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Some types of params such as some builtins are always padded. We<br>
need to keep track of this so we can restore the list correctly.<br>
<br>
Here we also remove a couple of cache entries that are not actually<br>
required as they get rebuilt by the _mesa_add_parameter() calls.<br>
<br>
This patch fixes a bunch of arb_texture_multisample and<br>
arb_sample_shading piglit test for the radeonsi NIR backend.<br>
<br>
Fixes: edded1237607 ("mesa: rework ParameterList to allow packing")<br>
---<br>
src/compiler/glsl/serialize.cpp | 15 ++++-----------<br>
src/mesa/program/prog_parameter.c | 1 +<br>
src/mesa/program/prog_parameter.h | 6 ++++++<br>
3 files changed, 11 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/src/compiler/glsl/serialize.cpp b/src/compiler/glsl/serialize.cpp<br>
index fdd99ec59da..ad258f8bcb1 100644<br>
--- a/src/compiler/glsl/serialize.cpp<br>
+++ b/src/compiler/glsl/serialize.cpp<br>
@@ -996,15 +996,14 @@ write_shader_parameters(struct blob *metadata,<br>
struct gl_program_parameter_list *params)<br>
{<br>
blob_write_uint32(metadata, params->NumParameters);<br>
- blob_write_uint32(metadata, params->NumParameterValues);<br>
uint32_t i = 0;<br>
<br>
while (i < params->NumParameters) {<br>
struct gl_program_parameter *param = ¶ms->Parameters[i];<br>
-<br>
blob_write_uint32(metadata, param->Type);<br>
blob_write_string(metadata, param->Name);<br>
blob_write_uint32(metadata, param->Size);<br>
+ blob_write_uint32(metadata, param->Padded);<br>
blob_write_uint32(metadata, param->DataType);<br>
blob_write_bytes(metadata, param->StateIndexes,<br>
sizeof(param->StateIndexes));<br>
@@ -1015,9 +1014,6 @@ write_shader_parameters(struct blob *metadata,<br>
blob_write_bytes(metadata, params->ParameterValues,<br>
sizeof(gl_constant_value) * params->NumParameterValues);<br>
<br>
- blob_write_bytes(metadata, params->ParameterValueOffset,<br>
- sizeof(uint32_t) * params->NumParameters);<br>
-<br>
blob_write_uint32(metadata, params->StateFlags);<br>
}<br>
<br>
@@ -1028,28 +1024,25 @@ read_shader_parameters(struct blob_reader *metadata,<br>
gl_state_index16 state_indexes[STATE_LENGTH];<br>
uint32_t i = 0;<br>
uint32_t num_parameters = blob_read_uint32(metadata);<br>
- uint32_t num_parameters_values = blob_read_uint32(metadata);<br>
<br>
_mesa_reserve_parameter_storage(params, num_parameters);<br>
while (i < num_parameters) {<br>
gl_register_file type = (gl_register_file) blob_read_uint32(metadata);<br>
const char *name = blob_read_string(metadata);<br>
unsigned size = blob_read_uint32(metadata);<br>
+ bool padded = blob_read_uint32(metadata);<br>
unsigned data_type = blob_read_uint32(metadata);<br>
blob_copy_bytes(metadata, (uint8_t *) state_indexes,<br>
sizeof(state_indexes));<br>
<br>
_mesa_add_parameter(params, type, name, size, data_type,<br>
- NULL, state_indexes, false);<br>
+ NULL, state_indexes, padded);<br>
<br>
i++;<br>
}<br>
<br>
blob_copy_bytes(metadata, (uint8_t *) params->ParameterValues,<br>
- sizeof(gl_constant_value) * num_parameters_values);<br>
-<br>
- blob_copy_bytes(metadata, (uint8_t *) params->ParameterValueOffset,<br>
- sizeof(uint32_t) * num_parameters);<br>
+ sizeof(gl_constant_value) * params->NumParameterValues);<br>
<br>
params->StateFlags = blob_read_uint32(metadata);<br>
}<br>
diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c<br>
index 62f31f205af..2f3520bf750 100644<br>
--- a/src/mesa/program/prog_parameter.c<br>
+++ b/src/mesa/program/prog_parameter.c<br>
@@ -275,6 +275,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,<br>
p->Name = strdup(name ? name : "");<br>
p->Type = type;<br>
p->Size = size;<br>
+ p->Padded = pad_and_align;<br>
p->DataType = datatype;<br>
<br>
paramList->ParameterValueOffset[oldNum] = oldValNum;<br>
diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h<br>
index 78c9909f5cc..57050042012 100644<br>
--- a/src/mesa/program/prog_parameter.h<br>
+++ b/src/mesa/program/prog_parameter.h<br>
@@ -104,6 +104,12 @@ struct gl_program_parameter<br>
* A sequence of STATE_* tokens and integers to identify GL state.<br>
*/<br>
gl_state_index16 StateIndexes[STATE_LENGTH];<br>
+<br>
+ /**<br>
+ * We need to keep track of whether the param is padded for use in the<br>
+ * shader cache.<br>
+ */<br>
+ bool Padded;<br>
};<br>
<br>
<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></blockquote></div>