microsoft / DirectXShaderCompiler

This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.
Other
2.99k stars 671 forks source link

[SPIR-V] Automatically map SV_BaseVertexLocation/SV_StartInstanceLocation to BaseVertex/BaseInstance #6671

Open crud89 opened 1 month ago

crud89 commented 1 month ago

Description

Shader model 6.8 added two new semantics to refer to the base instance and vertex index of a draw call within a vertex shader. #2907 explicitly mentions that they are semanitcally equal to the SPIR-V builtin variables BaseVertex and BaseInstance. As a result I was a bit surprised that they are currently not mapped automatically to those when compiling to SPIR-V. Instead attempting to compile a shader produces the error semantic SV_StartInstanceLocation unimplemented. To fix this, I manually have to specify the [[vk::builtin("BaseInstance")]] attribute, which then produces a warning if I attempt to compile the shader for DXIL.

Steps to Reproduce

https://godbolt.org/z/xP5Mzev9P

Actual Behavior

As the semanitcs are equal, I would expect them to be mapped automatically to their SPIR-V builtin counterparts, without the explicit attribute.

Environment

Keenuts commented 1 month ago

Hi! Thanks for the feedback! I added this in our SM6.8 task list. Right now our team is a bit short of staff so I cannot give a time estimate, but we'll get to that eventually. 😊