ir_to_mesa: Propagate initial values in _mesa_associate_uniform_storage
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 9 Apr 2012 18:19:24 +0000 (11:19 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 23 May 2012 18:42:08 +0000 (11:42 -0700)
The linker may have set initial values for uniforms.  Propagate these
values to the driver's backing storage when it is first associated.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/program/ir_to_mesa.cpp

index 840648e04495a282d4c8d97c30d103d4ba09d2a4..b8e256069f788bcebeb07ff7dec0ba81ef2ad8e9 100644 (file)
@@ -2526,6 +2526,15 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
                                             4 * sizeof(float),
                                             format,
                                             &params->ParameterValues[i]);
+
+        /* After attaching the driver's storage to the uniform, propagate any
+         * data from the linker's backing store.  This will cause values from
+         * initializers in the source code to be copied over.
+         */
+        _mesa_propagate_uniforms_to_driver_storage(storage,
+                                                   0,
+                                                   MAX2(1, storage->array_elements));
+
         last_location = location;
       }
    }