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

Capability System: __target_switch never compares case: capabilities to the parent [require(...)] #4508

Closed
ArielG-NV opened this issue Jun 28, 2024 · 0 comments · Fixed by #4510
Assignees
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should

Comments

@ArielG-NV
Copy link
Contributor

ArielG-NV commented Jun 28, 2024

Problem:
following code will compile but should at a minimum warn:

[require(glsl_hlsl)]
void myfunc()
{
    __target_switch
    {
    case hlsl:
    case spirv:
    }
}

Expected behavior:
error since spirv is not listed by the parent [require(...)]

@ArielG-NV ArielG-NV added kind:bug something doesn't work like it should goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang labels Jun 28, 2024
@ArielG-NV ArielG-NV self-assigned this Jun 28, 2024
ArielG-NV added a commit to ArielG-NV/slang that referenced this issue Jun 28, 2024
fixes: shader-slang#4506
fixes: shader-slang#4508

1. As per shader-slang#4506, no longer allow invalid `[require(...)]`
2. As per shader-slang#4508, no longer allow mismatch between `case` and `require` of a calling function
3. Fixes incorrect hlsl.meta capabilities
4. Added a ref to the parent function/decl for when erroring with capabilities to help debug meta.slang files for when weird source locations are generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant