[Mesa-dev] [PATCH 1/2] glsl: Fix memcpy size in ir_constant

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Fri Jan 10 04:57:10 PST 2014


ir_constant::ir_constant(const struct glsl_type,
const ir_constant_data *) was copying too much memory.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/glsl/ir.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index ba6903d..83feb49 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -622,7 +622,7 @@ ir_constant::ir_constant(const struct glsl_type *type,
 
    this->ir_type = ir_type_constant;
    this->type = type;
-   memcpy(& this->value, data, sizeof(this->value));
+   memcpy(& this->value, data, type->std140_size(false));
 }
 
 ir_constant::ir_constant(float f, unsigned vector_elements)
-- 
1.8.1.2



More information about the mesa-dev mailing list