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.
This commit is contained in:
Kristian Høgsberg Kristensen
2015-11-26 10:11:52 -08:00
parent cd4721c062
commit d6d82f1ab3
3 changed files with 14 additions and 6 deletions
+6 -2
View File
@@ -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 {
+2 -2
View File
@@ -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
+6 -2
View File
@@ -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