Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register usage incorrectly produces a warning and suggests [[vk::binding(...)]] #5938

Open
stanoddly opened this issue Dec 26, 2024 · 1 comment

Comments

@stanoddly
Copy link
Contributor

If I try to compile this shader:

Sampler2D CombinedSampler : register(t0): register(s0);

[shader("fragment")]
float4 main(float2 TexCoord : TEXCOORD0) : SV_Target0
{
    return CombinedSampler.Sample(TexCoord);
}

via command line:

/opt/slang/bin/slangc shader.slang -target "spirv" -o "shader.spv"

it seems to generate shader.spv as expected, but also a warning is produced:

 warning 39013: shader parameter 'CombinedSampler' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan

However, such usage is explicitly documented in "SPIR-V specific functionalities" (link):

Combined texture sampler

Slang supports Combined texture sampler such as Sampler2D. Slang emits SPIR-V code with OpTypeSampledImage instruction.

You can specify two different register numbers for each: one for the texture register and another for the sampler register.

Sampler2D explicitBindingSampler : register(t4): register(s3);

So, there should be no warning for a register usage, shouldn't be? I know the warning could be disabled via -warnings-disable, however I would expect there is nothing to warn about or alternatively register usage shouldn't be documented.

I would personally say that any usage of register shouldn't produce any warning. I think the behavior should be aligned with how dxc - dxc produces no warnings when compiling to SPIR-V (source + verified manually).

@csyonghe
Copy link
Collaborator

We should remove this warning now that we now support the same -fvk-shift options as in DXC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants