[Mesa-dev] [WIP 08/25] i965/fs: Add support for double precision uniform loading

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Oct 16 05:24:20 PDT 2014


Unfortunately the safety assertion needs to be dropped as the
amount occupied by different types of uniforms is not the same
anymore.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 3b2c2f9..0b41ad3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1148,7 +1148,6 @@ fs_visitor::setup_uniform_values(ir_variable *ir)
     * order we'd walk the type, so walk the list of storage and find anything
     * with our name, or the prefix of a component that starts with our name.
     */
-   unsigned params_before = uniforms;
    for (unsigned u = 0; u < shader_prog->NumUserUniformStorage; u++) {
       struct gl_uniform_storage *storage = &shader_prog->UniformStorage[u];
 
@@ -1163,14 +1162,17 @@ fs_visitor::setup_uniform_values(ir_variable *ir)
       if (storage->array_elements)
          slots *= storage->array_elements;
 
-      for (unsigned i = 0; i < slots; i++) {
-         stage_prog_data->param[uniforms++] = &storage->storage[i];
+      for (unsigned i = 0, slot = 0; i < slots; i++) {
+         /* Double precision constants take two consecutive slots. */
+         if (storage->type->base_type == GLSL_TYPE_DOUBLE) {
+            stage_prog_data->param[uniforms++] = &storage->storage[slot];
+            stage_prog_data->param[uniforms++] = &storage->storage[slot + 1];
+            slot += 2;
+         } else {
+            stage_prog_data->param[uniforms++] = &storage->storage[slot++];
+         }
       }
    }
-
-   /* Make sure we actually initialized the right amount of stuff here. */
-   assert(params_before + ir->type->component_slots() == uniforms);
-   (void)params_before;
 }
 
 
-- 
1.8.3.1



More information about the mesa-dev mailing list