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

Using Texture2D<bool*>.Load results in validation errors with both DXIL and SPIR-V backends (not with FXC) #3218

Open
Dredhog opened this issue Oct 23, 2020 · 1 comment
Labels
fxc-disagrees Issues tracking differences between FXC and DXC

Comments

@Dredhog
Copy link

Dredhog commented Oct 23, 2020

Title

Using Texture2D<bool*>.Load results in validation errors with both DXIL and SPIR-V backends (not with FXC)

Functional impact

Cannot use bool typed textures. Breaks compatibility with FXC.

Minimal repro steps

  1. Compile the following shader with dxc.exe -T ps_6_0 -E PSMain issue_shader.txt:
Texture2D<bool> myTex;
float4 PSMain() : SV_Target0 {
    bool temp = myTex.Load(int3(0,0,0)).r;
    
    if(temp)
        return float4(1, 1, 1, 1);
    else
    	return float4(0, 0, 0, 0);
}

  1. Observe compiler output for the DXIL backend:
error: validation errors
Invalid resource return type''

Validation failed.
  1. Compile the same shader for the SPIR-V by adding the -spirv flag dxc.exe -T ps_6_0 -E PSMain -spirv issue_shader.txt and observe the compiler output:
fatal error: generated SPIR-V is invalid: Expected Sampled Type to be a 32-bit int or float scalar type for Vulkan environment
  %type_2d_image = OpTypeImage %bool 2D 2 0 0 1 Unknown

note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible

Expected result

Validation/compilation succeeds.

Actual result

Validation/compilation fails when targeting either DXIL or SPIR-V

Further technical details

Note: the same happens when using bool2, bool3 or bool4 as the Texture2D template argument. For convenience, here's the link to the original example on shader-playground.

@ehsannas
Copy link
Contributor

ehsannas commented Nov 2, 2020

To track progress of DXIL and SPIR-V separately, I have filed #3236 for the SPIR-V side.

This issue can track the fix for DXIL.

@llvm-beanz llvm-beanz added the needs-triage Awaiting triage label Jun 29, 2023
@llvm-beanz llvm-beanz added fxc-disagrees Issues tracking differences between FXC and DXC and removed needs-triage Awaiting triage labels Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fxc-disagrees Issues tracking differences between FXC and DXC
Projects
Status: Triaged
Development

No branches or pull requests

3 participants