-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1409 from KhronosGroup/fix-1405
Improve expression usage tracking
- Loading branch information
Showing
17 changed files
with
189 additions
and
17 deletions.
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
29 changes: 29 additions & 0 deletions
29
reference/opt/shaders/frag/avoid-expression-lowering-to-loop.frag
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,29 @@ | ||
#version 310 es | ||
precision mediump float; | ||
precision highp int; | ||
|
||
layout(binding = 1, std140) uniform Count | ||
{ | ||
float count; | ||
} _44; | ||
|
||
layout(binding = 0) uniform mediump sampler2D tex; | ||
|
||
layout(location = 0) in highp vec4 vertex; | ||
layout(location = 0) out vec4 fragColor; | ||
|
||
void main() | ||
{ | ||
highp float _24 = 1.0 / float(textureSize(tex, 0).x); | ||
highp float _34 = dFdx(vertex.x); | ||
float _62; | ||
_62 = 0.0; | ||
for (float _61 = 0.0; _61 < _44.count; ) | ||
{ | ||
_62 += (_24 * _34); | ||
_61 += 1.0; | ||
continue; | ||
} | ||
fragColor = vec4(_62); | ||
} | ||
|
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
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
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
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
26 changes: 26 additions & 0 deletions
26
reference/shaders/frag/avoid-expression-lowering-to-loop.frag
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,26 @@ | ||
#version 310 es | ||
precision mediump float; | ||
precision highp int; | ||
|
||
layout(binding = 1, std140) uniform Count | ||
{ | ||
float count; | ||
} _44; | ||
|
||
layout(binding = 0) uniform mediump sampler2D tex; | ||
|
||
layout(location = 0) in highp vec4 vertex; | ||
layout(location = 0) out vec4 fragColor; | ||
|
||
void main() | ||
{ | ||
highp float size = 1.0 / float(textureSize(tex, 0).x); | ||
float r = 0.0; | ||
float d = dFdx(vertex.x); | ||
for (float i = 0.0; i < _44.count; i += 1.0) | ||
{ | ||
r += (size * d); | ||
} | ||
fragColor = vec4(r); | ||
} | ||
|
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,23 @@ | ||
#version 310 es | ||
precision mediump float; | ||
precision mediump int; | ||
|
||
layout(binding = 0) uniform mediump sampler2D tex; | ||
layout(binding = 1) uniform Count | ||
{ | ||
float count; | ||
}; | ||
|
||
layout(location = 0) in highp vec4 vertex; | ||
layout(location = 0) out vec4 fragColor; | ||
|
||
void main() { | ||
|
||
highp float size = 1.0 / float(textureSize(tex, 0).x); | ||
float r = 0.0; | ||
float d = dFdx(vertex.x); | ||
for (float i = 0.0; i < count ; i += 1.0) | ||
r += size * d; | ||
|
||
fragColor = vec4(r); | ||
} |
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
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
Oops, something went wrong.