summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2014-10-24 20:27:31 +0100
committerJosé Fonseca <[email protected]>2014-10-24 21:35:23 +0100
commit701f739d7fa1bc2d56dac41ac1f7f3ec8969544d (patch)
tree5c467c5e312c5b7c718549ae790284e04b02781a /src/gallium/drivers/llvmpipe
parent1ef6d439ba9a31af5063f55312bf17228c336177 (diff)
llvmpipe: Ensure the packed input of the lp_test_format is aligned.
Fixes: - https://bugs.freedesktop.org/show_bug.cgi?id=85377 - http://llvm.org/bugs/show_bug.cgi?id=21365 Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_format.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c
index a4b3b564d65..48bf06e3c45 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_format.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_format.c
@@ -133,6 +133,7 @@ test_format_float(unsigned verbose, FILE *fp,
struct gallivm_state *gallivm;
LLVMValueRef fetch = NULL;
fetch_ptr_t fetch_ptr;
+ PIPE_ALIGN_VAR(16) uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
PIPE_ALIGN_VAR(16) float unpacked[4];
boolean first = TRUE;
boolean success = TRUE;
@@ -160,13 +161,16 @@ test_format_float(unsigned verbose, FILE *fp,
first = FALSE;
}
+ /* To ensure it's 16-byte aligned */
+ memcpy(packed, test->packed, sizeof packed);
+
for (i = 0; i < desc->block.height; ++i) {
for (j = 0; j < desc->block.width; ++j) {
boolean match = TRUE;
memset(unpacked, 0, sizeof unpacked);
- fetch_ptr(unpacked, test->packed, j, i);
+ fetch_ptr(unpacked, packed, j, i);
for(k = 0; k < 4; ++k) {
if (util_double_inf_sign(test->unpacked[i][j][k]) != util_inf_sign(unpacked[k])) {
@@ -220,6 +224,7 @@ test_format_unorm8(unsigned verbose, FILE *fp,
struct gallivm_state *gallivm;
LLVMValueRef fetch = NULL;
fetch_ptr_t fetch_ptr;
+ PIPE_ALIGN_VAR(16) uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
uint8_t unpacked[4];
boolean first = TRUE;
boolean success = TRUE;
@@ -246,13 +251,16 @@ test_format_unorm8(unsigned verbose, FILE *fp,
first = FALSE;
}
+ /* To ensure it's 16-byte aligned */
+ memcpy(packed, test->packed, sizeof packed);
+
for (i = 0; i < desc->block.height; ++i) {
for (j = 0; j < desc->block.width; ++j) {
boolean match;
memset(unpacked, 0, sizeof unpacked);
- fetch_ptr(unpacked, test->packed, j, i);
+ fetch_ptr(unpacked, packed, j, i);
match = TRUE;
for(k = 0; k < 4; ++k) {