Mesa (master): mesa: add packing support for setting uniform handles

Timothy Arceri tarceri at kemper.freedesktop.org
Tue Mar 20 03:24:30 UTC 2018


Module: Mesa
Branch: master
Commit: a2198d4fdb7d93568ba0792a326971abb6d6b3a9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2198d4fdb7d93568ba0792a326971abb6d6b3a9

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Tue Jun 20 10:31:32 2017 +1000

mesa: add packing support for setting uniform handles

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/mesa/main/uniform_query.cpp | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 14ecfdca2f..f901fcb3e5 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -1523,10 +1523,20 @@ _mesa_uniform_handle(GLint location, GLsizei count, const GLvoid *values,
 
    /* Store the data in the "actual type" backing storage for the uniform.
     */
-   memcpy(&uni->storage[size_mul * components * offset], values,
-          sizeof(uni->storage[0]) * components * count * size_mul);
+   gl_constant_value *storage;
+   if (ctx->Const.PackedDriverUniformStorage) {
+      for (unsigned s = 0; s < uni->num_driver_storage; s++) {
+         storage = (gl_constant_value *)
+            uni->driver_storage[s].data + (size_mul * offset * components);
+         memcpy(storage, values,
+                sizeof(uni->storage[0]) * components * count * size_mul);
+      }
+   } else {
+      memcpy(&uni->storage[size_mul * components * offset], values,
+             sizeof(uni->storage[0]) * components * count * size_mul);
 
-   _mesa_propagate_uniforms_to_driver_storage(uni, offset, count);
+      _mesa_propagate_uniforms_to_driver_storage(uni, offset, count);
+   }
 
    if (uni->type->is_sampler()) {
       /* Mark this bindless sampler as not bound to a texture unit because




More information about the mesa-commit mailing list