summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2014-11-18 15:22:29 +0100
committerRoland Scheidegger <[email protected]>2014-11-18 15:26:59 +0100
commit74f505fa73eda0c9b5b1984bebb44cedac8e8794 (patch)
treef85c9c2403c74ae006e0744e65145ae1e6ff081f /src/gallium/drivers/llvmpipe
parent3958378abb31164443f888f09f644100d5c34dae (diff)
gallivm: fix alignment issue for vertex data fetch
We cannot guarantee that vertex buffers have the necessary alignment for fetching all AoS members at once (for instance 4x32bit XYZW data). We can however guarantee that for textures. This did not cause errors for older llvm versions but it now matters and will cause segfaults if the data happens to not be aligned. Thus we need to set alignment manually. (Note that we can't actually really guarantee data to be even element aligned due to offsets in vertex buffers being bytes and OpenGL allowing this, but it does not matter for x86 as alignment is only required for sse vectors - not sure what happens on other archs, however.) This fixes https://bugs.freedesktop.org/show_bug.cgi?id=85467.
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_format.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c
index 48bf06e3c45..d9abd1ae37c 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_format.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_format.c
@@ -112,7 +112,7 @@ add_fetch_rgba_test(struct gallivm_state *gallivm, unsigned verbose,
block = LLVMAppendBasicBlockInContext(context, func, "entry");
LLVMPositionBuilderAtEnd(builder, block);
- rgba = lp_build_fetch_rgba_aos(gallivm, desc, type,
+ rgba = lp_build_fetch_rgba_aos(gallivm, desc, type, TRUE,
packed_ptr, offset, i, j);
LLVMBuildStore(builder, rgba, rgba_ptr);
@@ -252,6 +252,7 @@ test_format_unorm8(unsigned verbose, FILE *fp,
}
/* To ensure it's 16-byte aligned */
+ /* Could skip this and use unaligned lp_build_fetch_rgba_aos */
memcpy(packed, test->packed, sizeof packed);
for (i = 0; i < desc->block.height; ++i) {