-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix potential unsafe swizzle optimizations #298
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,16 @@ float withExtraComponents() { | |
vec2 v2 = vec2(1); | ||
vec3 v3 = vec3(1, 2, v2.x); | ||
vec4 v4 = vec4(v2, v3.xy); | ||
return v2.x + v3.x + v4.x; | ||
vec3 v5 = vec3(1, v3.rg); | ||
return v2.x + v3.x + v4.x + v5.x; | ||
} | ||
|
||
float withExtraComponentsUnsafe(in vec3 a) { | ||
vec3 v1 = vec3(a.x); | ||
vec3 v2 = vec3(1.0, a.x); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If I understand you, that would apply to calls like this, which are AIUI unsafe to transform (this is equivalent to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So I think that |
||
vec2 v3 = vec3(1.0, a.y); | ||
vec3 v4 = vec3(1.0, 2.0, a.y); | ||
return v1.x + v2.x + v3.x + v4.x; | ||
} | ||
|
||
struct S{ | ||
|
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.
Again, assuming I understand you correctly -- that is also properly handled by this PR, and tested via these cases here?
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.
alright, I think we can merge
Thank!