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] HLSL clip is treated as OpKill instead of OpDemoteToHelperInvocation in Vulkan 1.3 or -fspv-extension=SPV_EXT_demote_to_helper_invocation #5937

Closed
danginsburg opened this issue Oct 27, 2023 · 3 comments
Assignees
Labels
bug Bug, regression, crash spirv Work related to SPIR-V

Comments

@danginsburg
Copy link
Contributor

danginsburg commented Oct 27, 2023

Description
DXC supports generating OpDemoteToHelperInvocation for HLSL discard if using Vulkan 1.3 or -fspv-extension=SPV_EXT_demote_to_helper_invocation. This is correct. But if you use clip(-1) in your shader you will still get OpKill. Is this just a bug?

Steps to Reproduce
https://shader-playground.timjones.io/6c6b28f4a3a9fe0365846aff9b7aa2c7

struct PSInput
{
	float4 color : COLOR;
};

float4 PSMain(PSInput input) : SV_TARGET
{
    // Incorrect: OpKill
    clip(input.color.a < 0 ? -1 : 1);
    // Correct: OpDemoteToHelperInvocation
    //if (input.color.a < 0 )
      //  discard;
	return input.color;
}

Actual Behavior
I think clip should produce the same output as discard?

Environment

  • DXC version : Updated from trunk on 2023-06-16
  • Host Operating System : N/A
@sudonatalie
Copy link
Collaborator

@Keenuts Can you take a look at this?

@sudonatalie sudonatalie removed the needs-triage Awaiting triage label Nov 1, 2023
@s-perron
Copy link
Collaborator

s-perron commented Nov 3, 2023

Yes, this is a bug, and should be fixed. We should never be generating OpKill.

@s-perron s-perron assigned s-perron and unassigned Keenuts Nov 3, 2023
@jeremy-lunarg
Copy link
Contributor

@s-perron

I believe this issue can be closed. You fixed this in #5970, but I think you referenced the wrong issue when you submitted.

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
Archived in project
Development

No branches or pull requests

5 participants