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

GLSL/HLSL Code Emitter: kIROp_ControlBarrier is unimplemented #4913

Closed
ArielG-NV opened this issue Aug 26, 2024 · 0 comments · Fixed by #4915
Closed

GLSL/HLSL Code Emitter: kIROp_ControlBarrier is unimplemented #4913

ArielG-NV opened this issue Aug 26, 2024 · 0 comments · Fixed by #4915
Assignees
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:enhancement a desirable new feature, option, or behavior

Comments

@ArielG-NV
Copy link
Contributor

ArielG-NV commented Aug 26, 2024

Problem:

  • If IR produces a kIROp_ControlBarrier Slang will assert when emitting GLSL/HLSL due to not implementing kIROp_ControlBarrier.

Repro:

  • Run the following slang-test:
//TEST:SIMPLE(filecheck=GLSL):-target glsl -entry hullMain -stage hull -allow-glsl
//TEST:SIMPLE(filecheck=HLSL):-target hlsl -entry hullMain -stage hull -allow-glsl

//GLSL: location = 0
//GLSL-NOT: location = 0
//GLSL: location = 1
//GLSL-NOT: location = 1
//GLSL: location = 2

//SPIRV: location 0
//SPIRV-NOT: location 0
//SPIRV: location 1
//SPIRV-NOT: location 1
//SPIRV: location = 2

//SPIRV: location = 0
//HLSL: hullMain

struct HsOut
{
    float2 pos;
    float2 hm;
};

struct HscOut
{
    float EdgeTessFactor[4] : SV_TessFactor;
    float InsideTessFactor[2] : SV_InsideTessFactor;
    uint instanceId;
};

[domain("quad")]
[partitioning("integer")]
[outputtopology("triangle_ccw")]
[outputcontrolpoints(4)]
[patchconstantfunc("constants")]
HsOut hullMain()
{
    HsOut o;
    o.pos = 1;
    o.hm = 2;
    return o;
}

HscOut constants()
{
    HscOut o;
    o.instanceId = 123;
    o.EdgeTessFactor[0] = 1;
    o.EdgeTessFactor[1] = 2;
    o.EdgeTessFactor[2] = 3;
    o.EdgeTessFactor[3] = 4;
    o.InsideTessFactor[0] = 0.5;
    o.InsideTessFactor[1] = 0.5;
    return o;
}
@ArielG-NV ArielG-NV added kind:enhancement a desirable new feature, option, or behavior goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang labels Aug 26, 2024
@ArielG-NV ArielG-NV self-assigned this Aug 26, 2024
@ArielG-NV ArielG-NV added this to the Q3 2024 (Summer) milestone Aug 26, 2024
ArielG-NV added a commit to ArielG-NV/slang that referenced this issue Aug 26, 2024
Fixes: shader-slang#4913
Fixes: shader-slang#4540

Changes:
1. Added `kIROp_ControlBarrier` to HLSL/GLSL emitting.
2. Added a method to track 'used' and 'unused' varyings for when legalizing GLSL. This allows us to assign correct offsets to automatically added varyings
    * Added a `ZeroLSB` check to UIntSet for this purpose
ArielG-NV added a commit to ArielG-NV/slang that referenced this issue Aug 26, 2024
Fixes: shader-slang#4913
Fixes: shader-slang#4540

Changes:
1. Added `kIROp_ControlBarrier` to HLSL/GLSL emitting.
2. Added a method to track 'used' and 'unused' varyings for when legalizing GLSL. This allows us to assign correct offsets to automatically added varyings
    * Added a `ZeroLSB` check to UIntSet for this purpose
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:enhancement a desirable new feature, option, or behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant