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

[SPIR-V] Fatal error instead of ordinary error with file and line number when SV_IsFrontFace is not bool. #7122

Open
neversleeping opened this issue Feb 4, 2025 · 2 comments
Labels
bug Bug, regression, crash spirv Work related to SPIR-V
Milestone

Comments

@neversleeping
Copy link

Description
When entry point parameter with SV_IsFrontFace semantic have type other than bool, SPIR-V compilation result in fatal error:

fatal error: generated SPIR-V is invalid: [VUID-FrontFacing-FrontFacing-04231] According to the Vulkan spec BuiltIn FrontFacing variable needs to be a bool scalar. ID <2> (OpVariable) is not a bool scalar.
  %gl_FrontFacing = OpVariable %_ptr_Input_uint Input

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

Steps to Reproduce
https://godbolt.org/z/1v7ec17nG

Compile with -E PSMain -T ps_6_6 -spirv

struct VSOut
{
	float3 pos : SV_Position;
};

float4 PSMain(
    VSOut input,
    uint isFrontFace : SV_IsFrontFace) : SV_Target
{
	return (isFrontFace ? 1.0 : -1.0);
}

Actual Behavior
Ordinary error with file and line number should be displayed instead of fatal error.

Environment

  • DXC version: 1.8 - 1.8.0.4666 (release-1.8.2407, 8df0a9d)
  • Host Operating System: Windows 11 23H2
@neversleeping neversleeping added bug Bug, regression, crash needs-triage Awaiting triage spirv Work related to SPIR-V labels Feb 4, 2025
@pow2clk pow2clk self-assigned this Feb 4, 2025
@pow2clk pow2clk removed this from HLSL Support Feb 4, 2025
@pow2clk pow2clk removed this from HLSL Support Feb 4, 2025
@pow2clk pow2clk removed their assignment Feb 5, 2025
@damyanp damyanp moved this to For Google in HLSL Triage Feb 6, 2025
@damyanp
Copy link
Member

damyanp commented Feb 6, 2025

Note that we don't generally do validation for semantics in the frontend and instead rely on the DXIL & SPIR-V validators to do this.

@s-perron - I don't know if you want to do something different for SPIR-V.

@s-perron
Copy link
Collaborator

s-perron commented Feb 7, 2025

Because of the poor error message from spirv-val, we try to catch these earlier when possible. We could try to validate the type somewhere in SpirvEmitter.cpp. However, these type of bugs are low priority for us at this time.

We will accept a fix, but my team will not be looking into it.

@s-perron s-perron added this to the Dormant milestone Feb 7, 2025
@s-perron s-perron moved this from For Google to Triaged in HLSL Triage Feb 7, 2025
@s-perron s-perron removed the needs-triage Awaiting triage label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash spirv Work related to SPIR-V
Projects
Status: New
Status: Triaged
Development

No branches or pull requests

4 participants