summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_context.cpp
diff options
context:
space:
mode:
authorBruce Cherniak <[email protected]>2017-04-12 18:43:25 -0500
committerTim Rowley <[email protected]>2017-04-14 15:22:44 -0500
commit97bbb7b6a3afadc22ef956f507f70998629fe99a (patch)
treec44f7732d99ec82c85d1b921d761ad0fca3847d8 /src/gallium/drivers/swr/swr_context.cpp
parent4dcfa83114df1026c715c2eb8a6168084fd2e5ac (diff)
swr: Align swr_context allocation to SIMD alignment.
The context now contains SIMD vectors which must be aligned (specifically samplePositions in the rastState in the derived state). Failure to align can result in segv crash on unaligned memory access in vector instructions. Reviewed-by: Tim Rowley <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_context.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_context.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
index 8c5a2692db7..6f46d666ac5 100644
--- a/src/gallium/drivers/swr/swr_context.cpp
+++ b/src/gallium/drivers/swr/swr_context.cpp
@@ -386,7 +386,7 @@ swr_destroy(struct pipe_context *pipe)
if (screen->pipe == pipe)
screen->pipe = NULL;
- FREE(ctx);
+ AlignedFree(ctx);
}
@@ -452,7 +452,10 @@ swr_UpdateStatsFE(HANDLE hPrivateContext, const SWR_STATS_FE *pStats)
struct pipe_context *
swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
{
- struct swr_context *ctx = CALLOC_STRUCT(swr_context);
+ struct swr_context *ctx = (struct swr_context *)
+ AlignedMalloc(sizeof(struct swr_context), KNOB_SIMD_BYTES);
+ memset(ctx, 0, sizeof(struct swr_context));
+
ctx->blendJIT =
new std::unordered_map<BLEND_COMPILE_STATE, PFN_BLEND_JIT_FUNC>;