summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_query.cpp
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2017-01-18 17:09:08 -0600
committerTim Rowley <[email protected]>2017-01-23 14:15:54 -0600
commit00847e4f14dd237dfcdb2c3d15be1325a08ccf5a (patch)
treef1e08469f88d95e17970ba53ef5ad7179910a791 /src/gallium/drivers/swr/swr_query.cpp
parentb829206b0739925501bcc68233437d6d03b79795 (diff)
swr: Align query results allocation
Some query results struct contents are declared as cache line aligned. Use aligned malloc, and align the whole struct, to be safe. Fixes crash when compiling with clang. CC: <[email protected]> Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_query.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_query.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/drivers/swr/swr_query.cpp b/src/gallium/drivers/swr/swr_query.cpp
index 6eb07810c02..e097790892d 100644
--- a/src/gallium/drivers/swr/swr_query.cpp
+++ b/src/gallium/drivers/swr/swr_query.cpp
@@ -29,7 +29,7 @@
#include "swr_query.h"
#include "swr_screen.h"
#include "swr_state.h"
-
+#include "common/os.h"
static struct swr_query *
swr_query(struct pipe_query *p)
@@ -45,7 +45,8 @@ swr_create_query(struct pipe_context *pipe, unsigned type, unsigned index)
assert(type < PIPE_QUERY_TYPES);
assert(index < MAX_SO_STREAMS);
- pq = CALLOC_STRUCT(swr_query);
+ pq = (struct swr_query *) AlignedMalloc(sizeof(struct swr_query), 64);
+ memset(pq, 0, sizeof(*pq));
if (pq) {
pq->type = type;
@@ -67,7 +68,7 @@ swr_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
swr_fence_reference(pipe->screen, &pq->fence, NULL);
}
- FREE(pq);
+ AlignedFree(pq);
}