Skip to content

[spirv] Support translation of SV_ShadingRate to FragmentSizeNV(or FragSizeEXT).. #2208

@oscarbg

Description

@oscarbg

Hi,
just interested in VRS new D3D12 feature and seems VRS only adds one HLSL intrinsic: SV_ShadingRate..
seeing Vulkan we have currently two similar extensions:
1)VK_NV_shading_rate_image supp. currently on NV Turing GPUs
2)VK_EXT_fragment_density_map currently supported on Qualcomm Adreno devices:
https://vulkan.gpuinfo.org/listdevices.php?platform=android&extension=VK_EXT_fragment_density_map

The respective SPV specs add similar intrinsic to SPIR-V:
*SPV_NV_shading_rate adds FragmentSizeNV
*SPV_EXT_fragment_invocation_density adds FragSizeEXT

Fortunately from spec (http://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/EXT/SPV_EXT_fragment_invocation_density.html) we read from issue #2:
"Re-using the tokens from SPV_NV_shading_rate as this is meant to be a drop-in replacement."
so FragmentSizeNV & FragSizeEXT are the same token on generated SPIR-V
issue #1 also has the table with correspondence between the two..
If not mistaken that's the common functionality between Vulkan and D3D12 "VRS" ..
Vulkan exts add another intrinsic "InvocationsPerPixelNV" for NV case with missing equivalent to D3D12..
Another difference seems to be SV_ShadingRate can be written in VS/GS stages & readonly in PS in D3D12 while VK exts it's a readonly in PS with missing write VS/GS functionality..
that's because VK exts lack "Tier 1 functionality of D3D12 VRS" where the shading rate can be set also per-object/triangle in addition via a density image..
VK exts are like VRS Tier 2 functionality allowing setting shading rate via image..

thanks..

Metadata

Metadata

Assignees

Labels

enhancementFeature suggestionspirvWork related to SPIR-V

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions