<div dir="ltr"><div>For patches 8, 9:<br></div><div><br></div><div>Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br><br></div>Marek<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 14, 2018 at 2:01 AM, Timothy Arceri <span dir="ltr"><<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
src/mesa/state_tracker/st_<wbr>glsl_to_nir.cpp | 42 +++++++++++++++++++++++++++---<wbr>-<br>
1 file changed, 37 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/mesa/state_tracker/st_<wbr>glsl_to_nir.cpp b/src/mesa/state_tracker/st_<wbr>glsl_to_nir.cpp<br>
index 0bd9c4e4e3..1fd553fdf8 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>glsl_to_nir.cpp<br>
+++ b/src/mesa/state_tracker/st_<wbr>glsl_to_nir.cpp<br>
@@ -218,7 +218,8 @@ st_nir_lookup_parameter_index(<wbr>const struct gl_program_parameter_list *params,<br>
}<br>
<br>
static void<br>
-st_nir_assign_uniform_<wbr>locations(struct gl_program *prog,<br>
+st_nir_assign_uniform_<wbr>locations(struct gl_context *ctx,<br>
+ struct gl_program *prog,<br>
struct gl_shader_program *shader_program,<br>
struct exec_list *uniform_list, unsigned *size)<br>
{<br>
@@ -247,7 +248,21 @@ st_nir_assign_uniform_<wbr>locations(struct gl_program *prog,<br>
/* This state reference has already been setup by ir_to_mesa, but we'll<br>
* get the same index back here.<br>
*/<br>
- loc = _mesa_add_state_reference(<wbr>prog->Parameters, stateTokens);<br>
+<br>
+ unsigned comps;<br>
+ const struct glsl_type *type = glsl_without_array(uniform-><wbr>type);<br>
+ if (glsl_type_is_struct(type)) {<br>
+ comps = 4;<br>
+ } else {<br>
+ comps = glsl_get_vector_elements(type)<wbr>;<br>
+ }<br>
+<br>
+ if (ctx->Const.<wbr>PackedDriverUniformStorage) {<br>
+ loc = _mesa_add_sized_state_<wbr>reference(prog->Parameters,<br>
+ stateTokens, comps, false);<br>
+ } else {<br>
+ loc = _mesa_add_state_reference(<wbr>prog->Parameters, stateTokens);<br>
+ }<br>
} else {<br>
loc = st_nir_lookup_parameter_index(<wbr>prog->Parameters, uniform->name);<br>
}<br>
@@ -359,9 +374,26 @@ st_glsl_to_nir_post_opts(<wbr>struct st_context *st, struct gl_program *prog,<br>
const nir_state_slot *const slots = var->state_slots;<br>
assert(var->state_slots != NULL);<br>
<br>
+ const struct glsl_type *type = glsl_without_array(var->type);<br>
for (unsigned int i = 0; i < var->num_state_slots; i++) {<br>
- _mesa_add_state_reference(<wbr>prog->Parameters,<br>
- slots[i].tokens);<br>
+ unsigned comps;<br>
+ if (glsl_type_is_struct(type)) {<br>
+ /* Builtin struct require specical handling for now we just<br>
+ * make all members vec4. See st_nir_lower_builtin.<br>
+ */<br>
+ comps = 4;<br>
+ } else {<br>
+ comps = glsl_get_vector_elements(type)<wbr>;<br>
+ }<br>
+<br>
+ if (st->ctx->Const.<wbr>PackedDriverUniformStorage) {<br>
+ _mesa_add_sized_state_<wbr>reference(prog->Parameters,<br>
+ slots[i].tokens,<br>
+ comps, false);<br>
+ } else {<br>
+ _mesa_add_state_reference(<wbr>prog->Parameters,<br>
+ slots[i].tokens);<br>
+ }<br>
}<br>
}<br>
}<br>
@@ -717,7 +749,7 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,<br>
NIR_PASS_V(nir, nir_lower_atomics_to_ssbo,<br>
st->ctx->Const.Program[nir-><wbr>info.stage].MaxAtomicBuffers);<br>
<br>
- st_nir_assign_uniform_<wbr>locations(prog, shader_program,<br>
+ st_nir_assign_uniform_<wbr>locations(st->ctx, prog, shader_program,<br>
&nir->uniforms, &nir->num_uniforms);<br>
<br>
if (screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_<wbr>DEREF))<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">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/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>