diff options
author | Plamena Manolova <plamena.manolova@intel.com> | 2019-10-23 20:59:02 +0100 |
---|---|---|
committer | Plamena Manolova <plamena.manolova@intel.com> | 2019-10-25 19:50:53 +0100 |
commit | e113d1a0f8eb9693b581ac85a67fd46be367ccd6 (patch) | |
tree | d28748f52563c75ebe0abae33677d22481b8d187 | |
parent | a2372ffa0bb26f835bd797fca60f93c32a619af8 (diff) | |
download | mesa-wip/tgl-depth-bounds-test.tar.gz |
anv: Add support for depth bounds testing.wip/tgl-depth-bounds-test
In gen12 we use the 3DSTATE_DEPTH_BOUNDS instruction
to enable depth bounds testing.
Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
-rw-r--r-- | src/intel/vulkan/anv_private.h | 4 | ||||
-rw-r--r-- | src/intel/vulkan/gen8_cmd_buffer.c | 19 | ||||
-rw-r--r-- | src/intel/vulkan/genX_pipeline.c | 20 |
3 files changed, 43 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index aa1f2cbea87..f6d47463a67 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2898,6 +2898,10 @@ struct anv_pipeline { uint32_t wm_depth_stencil[4]; } gen9; + struct { + uint32_t depth_bounds[4]; + } gen12; + uint32_t interface_descriptor_data[8]; }; diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c index e4f0c1410fb..e4497ac7b9f 100644 --- a/src/intel/vulkan/gen8_cmd_buffer.c +++ b/src/intel/vulkan/gen8_cmd_buffer.c @@ -542,6 +542,25 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) } #endif +#if GEN_GEN >= 12 + if(cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_DYNAMIC_DEPTH_BOUNDS) { + uint32_t dwords[GENX(3DSTATE_DEPTH_BOUNDS_length)]; + struct GENX(3DSTATE_DEPTH_BOUNDS) depth_bounds = { + GENX(3DSTATE_DEPTH_BOUNDS_header), + .DepthBoundsTestValueModifyDisable = false, + .DepthBoundsTestEnableModifyDisable = false, + .DepthBoundsTestEnable = pipeline->depth_test_enable, + .DepthBoundsTestMinValue = d->depth_bounds.min, + .DepthBoundsTestMaxValue = d->depth_bounds.max, + }; + + GENX(3DSTATE_DEPTH_BOUNDS_pack)(NULL, dwords, &depth_bounds); + + anv_batch_emit_merge(&cmd_buffer->batch, dwords, + pipeline->gen12.depth_bounds); + } +#endif + if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_DYNAMIC_LINE_STIPPLE) { anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_LINE_STIPPLE), ls) { ls.LineStipplePattern = d->line_stipple.pattern; diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 88f5b358faf..e6eda2371e3 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -997,6 +997,10 @@ emit_ds_state(struct anv_pipeline *pipeline, # define depth_stencil_dw pipeline->gen9.wm_depth_stencil #endif +#if GEN_GEN >= 12 +# define depth_bounds_dw pipeline->gen12.depth_bounds +#endif + if (pCreateInfo == NULL) { /* We're going to OR this together with the dynamic state. We need * to make sure it's initialized to something useful. @@ -1006,6 +1010,9 @@ emit_ds_state(struct anv_pipeline *pipeline, pipeline->writes_depth = false; pipeline->depth_test_enable = false; memset(depth_stencil_dw, 0, sizeof(depth_stencil_dw)); +#if GEN_GEN >= 12 + memset(depth_bounds_dw, 0, sizeof(depth_bounds_dw)); +#endif return; } @@ -1050,6 +1057,19 @@ emit_ds_state(struct anv_pipeline *pipeline, #else GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, depth_stencil_dw, &depth_stencil); #endif + +#if GEN_GEN >= 12 + struct GENX(3DSTATE_DEPTH_BOUNDS) depth_bounds = { + GENX(3DSTATE_DEPTH_BOUNDS_header), + .DepthBoundsTestValueModifyDisable = false, + .DepthBoundsTestEnableModifyDisable = false, + .DepthBoundsTestEnable = info.depthBoundsTestEnable, + .DepthBoundsTestMinValue = info.minDepthBounds, + .DepthBoundsTestMaxValue = info.maxDepthBounds, + }; + + GENX(3DSTATE_DEPTH_BOUNDS_pack)(NULL, depth_bounds_dw, &depth_bounds); +#endif } static bool |