Skip to content
Snippets Groups Projects
Commit 726d841d authored by Faith Ekstrand's avatar Faith Ekstrand :speech_balloon: Committed by Eric Engestrom
Browse files

anv: Handle clamping of inverted depth ranges


Tested-by: default avatarMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: default avatarIvan Briano <ivan.briano@intel.com>
Part-of: <!5792>
(cherry picked from commit 1d5e1882)
parent 68155102
No related branches found
No related tags found
No related merge requests found
......@@ -319,7 +319,7 @@
"description": "anv: Handle clamping of inverted depth ranges",
"nominated": false,
"nomination_type": null,
"resolution": 4,
"resolution": 1,
"master_sha": null,
"because_sha": null
},
......
......@@ -104,9 +104,17 @@ gen8_cmd_buffer_emit_depth_viewport(struct anv_cmd_buffer *cmd_buffer,
for (uint32_t i = 0; i < count; i++) {
const VkViewport *vp = &viewports[i];
/* From the Vulkan spec:
*
* "It is valid for minDepth to be greater than or equal to
* maxDepth."
*/
float min_depth = MIN2(vp->minDepth, vp->maxDepth);
float max_depth = MAX2(vp->minDepth, vp->maxDepth);
struct GENX(CC_VIEWPORT) cc_viewport = {
.MinimumDepth = depth_clamp_enable ? vp->minDepth : 0.0f,
.MaximumDepth = depth_clamp_enable ? vp->maxDepth : 1.0f,
.MinimumDepth = depth_clamp_enable ? min_depth : 0.0f,
.MaximumDepth = depth_clamp_enable ? max_depth : 1.0f,
};
GENX(CC_VIEWPORT_pack)(NULL, cc_state.map + i * 8, &cc_viewport);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment