-
Notifications
You must be signed in to change notification settings - Fork 273
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
Add support for GLSL interface blocks #6351
Conversation
In slang-ir-translate-global-var.cpp:97, instead of creating a new field type layout for the global var, there should already be a layout created on |
Okay, thanks, that seems to be working, though I don't know what to do about the call to "addResourceUsage" on the fieldTypeLayout builder which would go unused in the case that I reuse a layout from IRLayoutDecoration. |
|
That's what I think I'm doing, and it mostly works. I'll just upload a commit to explain. |
LayoutSize(1)); | ||
if (!hasExistingLayout) | ||
{ | ||
fieldTypeLayoutBuilder.addResourceUsage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doubt I was having was about this call to addResourceUsage. I think it doesn't make sense if I'm pulling fieldTypeLayout from IRLayoutDecoration.
glsl-intrinsic/fragment-processing/fragment-processing.slang is failing due to the missing shadowed globals replacement optimization. I believe the output of the test is still correct, but doesn't match expect output for that reason. |
With the change to use tryReplaceUsesofStageInput for the case of nested input, compilation of the test case outputs this:
|
I guess the left over global variable _S3 can be removed if we add an optimization pass that removes non-output global variables that has only writes but no reads. |
// input, and it makes no sense to store values into such real | ||
// input locations. | ||
traverseUses( | ||
globalVar, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also follow uses of any FieldAddr on the globalVar and remove the stores to those field addrs to get rid of the store to _S3 in the test case.
/format |
🌈 Formatted, please merge the changes from this PR |
Format code for PR shader-slang#6351
This adds support for GLSL style syntax for shader inputs, e.g.:
in VertexData
{
vec2 texcoord_0;
vec2 texcoord_1;
} vd;