aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2015-06-29 14:21:38 +0200
committerJason Ekstrand <[email protected]>2015-08-03 09:40:51 -0700
commit82f2e706bfd646b91bc0b8beecdff4e54b1f7b04 (patch)
tree1a6173c830e2332f2a385cfb9825850b953a26c4 /src/mesa
parent90825e3ca977057c8f3d6ad2d1aa38277cc3ff11 (diff)
i965/nir/vec4: Handle uniforms on vertex programs
The implementation takes into account that on ARB_vertex_program only a single nir variable is generated to support all the uniform data. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_nir.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index a5af33e6e10..b13465bcb30 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -153,8 +153,38 @@ vec4_visitor::nir_setup_uniforms(nir_shader *shader)
nir_setup_uniform(var);
}
} else {
- /* ARB_vertex_program is not supported yet */
- assert("Not implemented");
+ /* For ARB_vertex_program, only a single "parameters" variable is
+ * generated to support uniform data.
+ */
+ nir_variable *var = (nir_variable *) shader->uniforms.get_head();
+ assert(shader->uniforms.length() == 1 &&
+ strcmp(var->name, "parameters") == 0);
+
+ assert(uniforms < uniform_array_size);
+ this->uniform_size[uniforms] = type_size(var->type);
+
+ struct gl_program_parameter_list *plist = prog->Parameters;
+ for (unsigned p = 0; p < plist->NumParameters; p++) {
+ uniform_vector_size[uniforms] = plist->Parameters[p].Size;
+
+ /* Parameters should be either vec4 uniforms or single component
+ * constants; matrices and other larger types should have been broken
+ * down earlier.
+ */
+ assert(uniform_vector_size[uniforms] <= 4);
+
+ int i;
+ for (i = 0; i < uniform_vector_size[uniforms]; i++) {
+ stage_prog_data->param[uniforms * 4 + i] = &plist->ParameterValues[p][i];
+ }
+ for (; i < 4; i++) {
+ static const gl_constant_value zero = { 0.0 };
+ stage_prog_data->param[uniforms * 4 + i] = &zero;
+ }
+
+ nir_uniform_driver_location[uniforms] = var->data.driver_location;
+ uniforms++;
+ }
}
}