-
Notifications
You must be signed in to change notification settings - Fork 148
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
Correctly report liveness of variables passed as function parameters #267
Merged
spencer-lunarg
merged 3 commits into
KhronosGroup:main
from
daniel-story:function-parameter-liveness
Jul 12, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
glslangValidator -V -S frag -g0 --ku -o function_parameter_access.spv function_parameter_access.glsl | ||
*/ | ||
|
||
#version 450 | ||
|
||
layout(binding = 0) uniform sampler Sampler; | ||
layout(binding = 1) uniform texture2D Texture; | ||
layout(binding = 2) uniform sampler2D Sampler2D; | ||
|
||
layout(binding = 3) uniform sampler NeverAccessedSampler; | ||
layout(binding = 4) uniform texture2D NeverAccessedTexture; | ||
layout(binding = 5) uniform sampler2D NeverAccessedSampler2D; | ||
|
||
layout(location = 0) out vec4 color; | ||
|
||
vec4 access_sampler_and_texture(texture2D t, sampler s, vec2 coord) | ||
{ | ||
vec4 ret = texture(sampler2D(t, s), coord); | ||
return vec4(5.0) * ret; | ||
} | ||
|
||
vec4 access_combined_sampler(sampler2D s) | ||
{ | ||
vec2 coord = vec2(0.5, 0.5); | ||
vec4 ret = texture(s, coord); | ||
return vec4(1.0, 2.0, 3.0, 1.0) * ret; | ||
} | ||
|
||
vec4 call_access_functions(texture2D t, sampler s) | ||
{ | ||
return access_combined_sampler(Sampler2D) + access_sampler_and_texture(t, s, vec2(0.25, 0.75)); | ||
} | ||
|
||
vec4 never_called(texture2D t, sampler s, float u, float v) | ||
{ | ||
vec4 ret = texture(sampler2D(t, s), vec2(u, v)); | ||
return vec4(-3.0) * ret; | ||
} | ||
|
||
vec4 never_called_2(vec2 coord) | ||
{ | ||
vec4 ret = texture(sampler2D(NeverAccessedTexture, NeverAccessedSampler), coord); | ||
ret *= texture(NeverAccessedSampler2D, coord); | ||
return ret; | ||
} | ||
|
||
void main() | ||
{ | ||
color = vec4(-1.0) * call_access_functions(Texture, Sampler); | ||
} |
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does
access_ptr
indicate that it's accessing a pointer or is the_ptr
suffix to indicate that this is variable is a pointer? If it's the latter, then it should bep_access
instead.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.
This line was copied and pasted from the SpvOpLoad..SpvOpImageTexelPointer case below (see line 1204). I can change it on this line, but perhaps it's better to fix both lines at once in a separate PR?
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.
Ahh, apologies I didn't see that. You're right, that should be handled in a separate PR, not critical.