mesa|mapi: replace _mesa_[v]snprintf with [v]snprintf
[mesa.git] / src / mesa / main / uniform_query.cpp
index 14ecfdca2f3dd874cd3a78dd3f019772f4142d53..db2f173dd2f7ab17b0588dde98cbd8d9570f2ad5 100644 (file)
@@ -26,8 +26,8 @@
 
 #include <stdlib.h>
 #include <inttypes.h>  /* for PRIx64 macro */
+#include <math.h>
 
-#include "main/core.h"
 #include "main/context.h"
 #include "main/shaderapi.h"
 #include "main/shaderobj.h"
@@ -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
@@ -1584,7 +1594,7 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
       return true;
 
    if (!shProg->SamplersValidated) {
-      _mesa_snprintf(errMsg, errMsgLength,
+      snprintf(errMsg, errMsgLength,
                      "active samplers with a different type "
                      "refer to the same texture image unit");
       return false;