st/mesa: pass inlinable uniforms to drivers if they requested it
authorMarek Olšák <marek.olsak@amd.com>
Tue, 29 Sep 2020 21:36:57 +0000 (17:36 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 7 Oct 2020 17:30:12 +0000 (17:30 +0000)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6955>

src/mesa/state_tracker/st_atom_constbuf.c

index 2b5cc54..5612bb5 100644 (file)
@@ -119,6 +119,21 @@ st_upload_constants(struct st_context *st, struct gl_program *prog)
       cso_set_constant_buffer(st->cso_context, shader_type, 0, &cb);
       pipe_resource_reference(&cb.buffer, NULL);
 
+      /* Set inlinable constants. */
+      unsigned num_inlinable_uniforms = prog->info.num_inlinable_uniforms;
+      if (num_inlinable_uniforms) {
+         struct pipe_context *pipe = st->pipe;
+         uint32_t values[MAX_INLINABLE_UNIFORMS];
+         gl_constant_value *constbuf = params->ParameterValues;
+
+         for (unsigned i = 0; i < num_inlinable_uniforms; i++)
+            values[i] = constbuf[prog->info.inlinable_uniform_dw_offsets[i]].u;
+
+         pipe->set_inlinable_constants(pipe, shader_type,
+                                       prog->info.num_inlinable_uniforms,
+                                       values);
+      }
+
       st->state.constants[shader_type].ptr = params->ParameterValues;
       st->state.constants[shader_type].size = paramBytes;
    }