mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-27 11:00:37 +02:00
anv: Add support for VK_EXT_depth_clamp_control
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31411>
This commit is contained in:
parent
12b4ab3b04
commit
4994c5a243
4 changed files with 21 additions and 1 deletions
|
|
@ -190,6 +190,7 @@ get_device_extensions(const struct anv_physical_device *device,
|
|||
.EXT_custom_border_color = true,
|
||||
.EXT_depth_bias_control = true,
|
||||
.EXT_depth_clamp_zero_one = true,
|
||||
.EXT_depth_clamp_control = true,
|
||||
.EXT_depth_clip_control = true,
|
||||
.EXT_depth_range_unrestricted = device->info.ver >= 20,
|
||||
.EXT_depth_clip_enable = true,
|
||||
|
|
@ -719,6 +720,9 @@ get_features(const struct anv_physical_device *pdevice,
|
|||
.primitiveTopologyListRestart = true,
|
||||
.primitiveTopologyPatchListRestart = true,
|
||||
|
||||
/* VK_EXT_depth_clamp_control */
|
||||
.depthClampControl = true,
|
||||
|
||||
/* VK_EXT_depth_clip_control */
|
||||
.depthClipControl = true,
|
||||
|
||||
|
|
|
|||
|
|
@ -1287,7 +1287,8 @@ genX(cmd_buffer_flush_gfx_runtime_state)(struct anv_cmd_buffer *cmd_buffer)
|
|||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_VIEWPORTS) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_SCISSORS) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_CLAMP_ENABLE) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE)) {
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_DEPTH_CLAMP_RANGE)) {
|
||||
struct anv_instance *instance = cmd_buffer->device->physical->instance;
|
||||
const VkViewport *viewports = dyn->vp.viewports;
|
||||
|
||||
|
|
@ -1429,6 +1430,12 @@ genX(cmd_buffer_flush_gfx_runtime_state)(struct anv_cmd_buffer *cmd_buffer)
|
|||
float max_depth = dyn->rs.depth_clamp_enable ?
|
||||
MAX2(vp->minDepth, vp->maxDepth) : max_depth_limit;
|
||||
|
||||
if (dyn->rs.depth_clamp_enable &&
|
||||
dyn->vp.depth_clamp_mode == VK_DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT) {
|
||||
min_depth = dyn->vp.depth_clamp_range.minDepthClamp;
|
||||
max_depth = dyn->vp.depth_clamp_range.maxDepthClamp;
|
||||
}
|
||||
|
||||
SET(VIEWPORT_CC, vp_cc.elem[i].MinimumDepth, min_depth);
|
||||
SET(VIEWPORT_CC, vp_cc.elem[i].MaximumDepth, max_depth);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,6 +285,7 @@ get_device_extensions(const struct anv_physical_device *device,
|
|||
.EXT_conditional_rendering = device->info.verx10 >= 75,
|
||||
.EXT_custom_border_color = device->info.ver >= 8,
|
||||
.EXT_depth_clamp_zero_one = true,
|
||||
.EXT_depth_clamp_control = true,
|
||||
.EXT_depth_clip_control = true,
|
||||
.EXT_depth_clip_enable = true,
|
||||
#ifdef VK_USE_PLATFORM_DISPLAY_KHR
|
||||
|
|
@ -649,6 +650,9 @@ get_features(const struct anv_physical_device *pdevice,
|
|||
.primitiveTopologyListRestart = true,
|
||||
.primitiveTopologyPatchListRestart = true,
|
||||
|
||||
/* VK_EXT_depth_clamp_control */
|
||||
.depthClampControl = true,
|
||||
|
||||
/* VK_EXT_depth_clip_control */
|
||||
.depthClipControl = true,
|
||||
|
||||
|
|
|
|||
|
|
@ -3065,6 +3065,11 @@ cmd_buffer_emit_depth_viewport(struct anv_cmd_buffer *cmd_buffer,
|
|||
float min_depth = MIN2(vp->minDepth, vp->maxDepth);
|
||||
float max_depth = MAX2(vp->minDepth, vp->maxDepth);
|
||||
|
||||
if (dyn->vp.depth_clamp_mode == VK_DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT) {
|
||||
min_depth = dyn->vp.depth_clamp_range.minDepthClamp;
|
||||
max_depth = dyn->vp.depth_clamp_range.maxDepthClamp;
|
||||
}
|
||||
|
||||
struct GENX(CC_VIEWPORT) cc_viewport = {
|
||||
.MinimumDepth = depth_clamp_enable ? min_depth : 0.0f,
|
||||
.MaximumDepth = depth_clamp_enable ? max_depth : 1.0f,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue