microsoft / microsoft/DirectXShaderCompiler

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

Open
#7,122 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

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, 8df0a9d2e)
  • Host Operating System: Windows 11 23H2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the HLSL reproducer from the Godbolt link and run it with -E PSMain -T ps_6_6 -spirv. Trace how the generated SPIR-V validation failure is reported and preserve the requested source file and line information. Done means this invalid SV_IsFrontFace type produces an ordinary compiler error instead of a fatal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.