Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Copies of depth values outside [0, 1] #789

@austinEng

Description

@austinEng

VK_EXT_depth_range_unrestricted

This extension removes the VkViewport minDepth and maxDepth restrictions that the values must be between 0.0 and 1.0, inclusive. It also removes the same restriction on VkPipelineDepthStencilStateCreateInfo minDepthBounds and maxDepthBounds. Finally it removes the restriction on the depth value in VkClearDepthStencilValue.

Interaction with VkBufferImageCopy

When copying to a depth aspect, and the VK_EXT_depth_range_unrestricted extension is not enabled, the data in buffer memory must be in the range [0,1], or the resulting values are undefined.

@Jiawei-Shao discovered this restriction when the latest Intel drivers began failing some of Dawn's depth texture tests. The extension is not supported on that new driver, and according to vulkan.gpuinfo.org, this extension is supported on 1.7% of Android devices, 55.3% of Windows devices, and 65% of Linux devices. This leads me to believe that a large number of current devices have this restriction as well.

It seems that core WebGPU may have to enforce the restriction that depth values stay within the [0, 1] range. This is most problematic for copyBufferToTexture when copying to the depth aspect of a texture. The WebGPU implementation will either need to validate or clamp the copied contents. It could instead perform the copy by running a compute shader or drawing a full screen quad to write depth.

Other parts of the API where depth writes may occur:

  • depthLoadValue: it is already a validation layer error on Metal, and perhaps other APIs, to have a MTLRenderPassDepthAttachmentDescriptor.clearDepth value outside the [0, 1] range
  • fragment shader output: this would be clipped if outside the viewport which is restricted to [0, 1]
  • storage texture writes: would need to be clamped in the shader

Metadata

Metadata

Assignees

Labels

copyeditingPure editorial stuff (copyediting, *.bs file syntax, etc.)investigation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions