summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_vs.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-05-29 12:38:49 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-05-29 12:38:49 +0100
commitbb2e13b9e82b68ec3b9fc56a4c35e7ead8fd138f (patch)
tree65f387b426dcd113f602d9a51ef6fc8d1652200f /src/gallium/auxiliary/draw/draw_vs.c
parent82605d7bcd533d7c96cc619c45970efd7229dc3b (diff)
draw: make sure constant buffer data is aligned before passing to aos.c
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_vs.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index a8b6d0c90d..ce35112fc1 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -43,8 +43,22 @@
void draw_vs_set_constants( struct draw_context *draw,
- const float (*constants)[4] )
+ const float (*constants)[4],
+ unsigned size )
{
+ if (((unsigned)constants) & 0xf) {
+ if (size > draw->vs.const_storage_size) {
+ if (draw->vs.aligned_constant_storage)
+ align_free(draw->vs.aligned_constant_storage);
+ draw->vs.aligned_constant_storage = align_malloc( size, 16 );
+ }
+ memcpy( draw->vs.aligned_constant_storage,
+ constants,
+ size );
+ constants = draw->vs.aligned_constant_storage;
+ }
+
+ draw->vs.aligned_constants = constants;
draw_vs_aos_machine_constants( draw->vs.aos_machine, constants );
}
@@ -159,6 +173,9 @@ draw_vs_destroy( struct draw_context *draw )
if (draw->vs.aos_machine)
draw_vs_aos_machine_destroy(draw->vs.aos_machine);
+ if (draw->vs.aligned_constant_storage)
+ align_free(draw->vs.aligned_constant_storage);
+
tgsi_exec_machine_free_data(&draw->vs.machine);
}