forked from KhronosGroup/glslang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standalone: Implement -D and -U for preprocessor macros.
Works for both GLSL and HLSL. Fixes KhronosGroup#87.
- Loading branch information
1 parent
04acb1b
commit a931366
Showing
7 changed files
with
262 additions
and
13 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
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,47 @@ | ||
glsl.-D-U.frag | ||
Shader version: 450 | ||
0:? Sequence | ||
0:7 Function Definition: main( ( global void) | ||
0:7 Function Parameters: | ||
0:10 Sequence | ||
0:10 move second child to first child ( temp 4-component vector of float) | ||
0:10 'color' (layout( location=0) out 4-component vector of float) | ||
0:10 Constant: | ||
0:10 1.000000 | ||
0:10 1.000000 | ||
0:10 1.000000 | ||
0:10 1.000000 | ||
0:16 Post-Increment ( temp 4-component vector of float) | ||
0:16 'color' (layout( location=0) out 4-component vector of float) | ||
0:24 vector scale second child into first child ( temp 4-component vector of float) | ||
0:24 'color' (layout( location=0) out 4-component vector of float) | ||
0:24 Constant: | ||
0:24 3.000000 | ||
0:? Linker Objects | ||
0:? 'color' (layout( location=0) out 4-component vector of float) | ||
|
||
|
||
Linked fragment stage: | ||
|
||
|
||
Shader version: 450 | ||
0:? Sequence | ||
0:7 Function Definition: main( ( global void) | ||
0:7 Function Parameters: | ||
0:10 Sequence | ||
0:10 move second child to first child ( temp 4-component vector of float) | ||
0:10 'color' (layout( location=0) out 4-component vector of float) | ||
0:10 Constant: | ||
0:10 1.000000 | ||
0:10 1.000000 | ||
0:10 1.000000 | ||
0:10 1.000000 | ||
0:16 Post-Increment ( temp 4-component vector of float) | ||
0:16 'color' (layout( location=0) out 4-component vector of float) | ||
0:24 vector scale second child into first child ( temp 4-component vector of float) | ||
0:24 'color' (layout( location=0) out 4-component vector of float) | ||
0:24 Constant: | ||
0:24 3.000000 | ||
0:? Linker Objects | ||
0:? 'color' (layout( location=0) out 4-component vector of float) | ||
|
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,65 @@ | ||
hlsl.-D-U.frag | ||
Shader version: 500 | ||
gl_FragCoord origin is upper left | ||
0:? Sequence | ||
0:7 Function Definition: @main( ( temp void) | ||
0:7 Function Parameters: | ||
0:? Sequence | ||
0:9 move second child to first child ( temp 4-component vector of float) | ||
0:9 'color' ( global 4-component vector of float) | ||
0:9 Constant: | ||
0:9 1.000000 | ||
0:9 1.000000 | ||
0:9 1.000000 | ||
0:9 1.000000 | ||
0:15 subtract second child into first child ( temp 4-component vector of float) | ||
0:15 'color' ( global 4-component vector of float) | ||
0:15 Constant: | ||
0:15 5.000000 | ||
0:21 Post-Increment ( temp 4-component vector of float) | ||
0:21 'color' ( global 4-component vector of float) | ||
0:29 vector scale second child into first child ( temp 4-component vector of float) | ||
0:29 'color' ( global 4-component vector of float) | ||
0:29 Constant: | ||
0:29 3.000000 | ||
0:7 Function Definition: main( ( temp void) | ||
0:7 Function Parameters: | ||
0:? Sequence | ||
0:7 Function Call: @main( ( temp void) | ||
0:? Linker Objects | ||
0:? 'color' ( global 4-component vector of float) | ||
|
||
|
||
Linked fragment stage: | ||
|
||
|
||
Shader version: 500 | ||
gl_FragCoord origin is upper left | ||
0:? Sequence | ||
0:7 Function Definition: @main( ( temp void) | ||
0:7 Function Parameters: | ||
0:? Sequence | ||
0:9 move second child to first child ( temp 4-component vector of float) | ||
0:9 'color' ( global 4-component vector of float) | ||
0:9 Constant: | ||
0:9 1.000000 | ||
0:9 1.000000 | ||
0:9 1.000000 | ||
0:9 1.000000 | ||
0:15 subtract second child into first child ( temp 4-component vector of float) | ||
0:15 'color' ( global 4-component vector of float) | ||
0:15 Constant: | ||
0:15 5.000000 | ||
0:21 Post-Increment ( temp 4-component vector of float) | ||
0:21 'color' ( global 4-component vector of float) | ||
0:29 vector scale second child into first child ( temp 4-component vector of float) | ||
0:29 'color' ( global 4-component vector of float) | ||
0:29 Constant: | ||
0:29 3.000000 | ||
0:7 Function Definition: main( ( temp void) | ||
0:7 Function Parameters: | ||
0:? Sequence | ||
0:7 Function Call: @main( ( temp void) | ||
0:? Linker Objects | ||
0:? 'color' ( global 4-component vector of float) | ||
|
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,32 @@ | ||
#version 450 | ||
|
||
#define IN_SHADER | ||
|
||
layout(location=0) out vec4 color; | ||
|
||
void main() | ||
{ | ||
#if FOO==200 | ||
color = vec4(1.0); | ||
#else | ||
#error expected FOO 200 | ||
#endif | ||
|
||
#ifdef IN_SHADER | ||
color++; | ||
#else | ||
#error IN_SHADER was undef | ||
#endif | ||
|
||
#ifdef UNDEFED | ||
#error UNDEFED defined | ||
#else | ||
color *= 3.0; | ||
#endif | ||
|
||
#if MUL == 400 | ||
color *= MUL; | ||
#else | ||
#error bad MUL | ||
#endif | ||
} |
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,31 @@ | ||
|
||
#define IN_SHADER | ||
|
||
static float4 color; | ||
|
||
void main() | ||
{ | ||
#if FOO==200 | ||
color = 1.0; | ||
#else | ||
#error expected FOO 200 | ||
#endif | ||
|
||
#ifdef FOO | ||
color -= 5.0; | ||
#else | ||
#error expected FOO 200 | ||
#endif | ||
|
||
#ifdef IN_SHADER | ||
color++; | ||
#else | ||
#error IN_SHADER was undef | ||
#endif | ||
|
||
#ifdef UNDEFED | ||
#error UNDEFED defined | ||
#else | ||
color *= 3.0; | ||
#endif | ||
} |
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.