summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2015-11-26 10:11:52 -0800
committerKristian Høgsberg Kristensen <[email protected]>2015-11-26 10:11:52 -0800
commitd6d82f1ab33b7885f11dd720e93d9890df27ce36 (patch)
treef2e4e7b0addbf5d7acfb0e9da1e0539aa33ecba0 /src/vulkan
parentcd4721c062a300739b107925f801c9b9ced5f9fa (diff)
vk: Fix 3DSTATE_WM_DEPTH_STENCIL for gen8
This packet is a different size on gen8 and we hit an assertion when we try to merge a gen9 size dword array from the pipeline with the gen8 sized array we create from dynamic state. Use a static assert in the merge macro and fix this issue by using different wm_depth_stencil arrays on gen8 and gen9.
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/anv_private.h8
-rw-r--r--src/vulkan/gen8_cmd_buffer.c4
-rw-r--r--src/vulkan/gen8_pipeline.c8
3 files changed, 14 insertions, 6 deletions
diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h
index 36cee88602d..d208b2d74a0 100644
--- a/src/vulkan/anv_private.h
+++ b/src/vulkan/anv_private.h
@@ -677,7 +677,7 @@ __gen_combine_address(struct anv_batch *batch, void *location,
do { \
uint32_t *dw; \
\
- assert(ARRAY_SIZE(dwords0) == ARRAY_SIZE(dwords1)); \
+ static_assert(ARRAY_SIZE(dwords0) == ARRAY_SIZE(dwords1), "mismatch merge"); \
dw = anv_batch_emit_dwords((batch), ARRAY_SIZE(dwords0)); \
for (uint32_t i = 0; i < ARRAY_SIZE(dwords0); i++) \
dw[i] = (dwords0)[i] | (dwords1)[i]; \
@@ -1201,8 +1201,12 @@ struct anv_pipeline {
struct {
uint32_t sf[4];
uint32_t raster[5];
- uint32_t wm_depth_stencil[4];
+ uint32_t wm_depth_stencil[3];
} gen8;
+
+ struct {
+ uint32_t wm_depth_stencil[4];
+ } gen9;
};
struct anv_graphics_pipeline_create_info {
diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c
index 09315319001..1d1433817d9 100644
--- a/src/vulkan/gen8_cmd_buffer.c
+++ b/src/vulkan/gen8_cmd_buffer.c
@@ -248,7 +248,7 @@ cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer)
pipeline->gen8.raster);
}
- /* Stencil reference values were moves from COLOR_CALC_STATE in gen8 to
+ /* Stencil reference values moved from COLOR_CALC_STATE in gen8 to
* 3DSTATE_WM_DEPTH_STENCIL in gen9. That means the dirty bits gets split
* across different state packets for gen8 and gen9. We handle that by
* using a big old #if switch here.
@@ -347,7 +347,7 @@ cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer)
GEN9_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, dwords, &wm_depth_stencil);
anv_batch_emit_merge(&cmd_buffer->batch, dwords,
- pipeline->gen8.wm_depth_stencil);
+ pipeline->gen9.wm_depth_stencil);
}
#endif
diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c
index 0038bca01b4..b62bc44e710 100644
--- a/src/vulkan/gen8_pipeline.c
+++ b/src/vulkan/gen8_pipeline.c
@@ -290,13 +290,17 @@ static void
emit_ds_state(struct anv_pipeline *pipeline,
const VkPipelineDepthStencilStateCreateInfo *info)
{
+ uint32_t *dw = ANV_GEN == 8 ?
+ pipeline->gen8.wm_depth_stencil : pipeline->gen9.wm_depth_stencil;
+
if (info == NULL) {
/* We're going to OR this together with the dynamic state. We need
* to make sure it's initialized to something useful.
*/
- /* FIXME: gen9 wm_depth_stencil */
memset(pipeline->gen8.wm_depth_stencil, 0,
sizeof(pipeline->gen8.wm_depth_stencil));
+ memset(pipeline->gen9.wm_depth_stencil, 0,
+ sizeof(pipeline->gen9.wm_depth_stencil));
return;
}
@@ -319,7 +323,7 @@ emit_ds_state(struct anv_pipeline *pipeline,
.BackfaceStencilTestFunction = vk_to_gen_compare_op[info->back.stencilCompareOp],
};
- GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, pipeline->gen8.wm_depth_stencil, &wm_depth_stencil);
+ GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, dw, &wm_depth_stencil);
}
VkResult