Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make binop constant folding work on floats as well, plus tests
- Loading branch information
Showing
7 changed files
with
166 additions
and
40 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,15 @@ | ||
static const int kInt1 = 3; | ||
const int kInt2 = 7; | ||
static int kInt3 = 11; | ||
|
||
float size1 = 512.0; | ||
float size2 = 1.0 / 512.0; | ||
float size3 = kInt1; | ||
//float size4 = kInt2 / 3.0; | ||
//float size5 = 5 + kInt3; | ||
//float size6 = kInt2 * 512.0; | ||
|
||
float4 main() : POSITION | ||
{ | ||
return float4(kInt1, kInt2, kInt3, size2); | ||
} |
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 120 | ||
const int kInt1 = 3; | ||
const int kInt2 = 7; | ||
#line 3 | ||
int kInt3 = 11; | ||
uniform float size1 = 512.0; | ||
uniform float size2 = 0.00195313; | ||
#line 7 | ||
uniform float size3 = 3.0; | ||
#line 12 | ||
vec4 xlat_main( ); | ||
#line 12 | ||
vec4 xlat_main( ) { | ||
return vec4( 3.0, 7.0, float(kInt3), size2); | ||
} | ||
void main() { | ||
vec4 xl_retval; | ||
xl_retval = xlat_main( ); | ||
gl_Position = vec4(xl_retval); | ||
} | ||
|
||
// uniforms: | ||
// size2:<none> type 9 arrsize 0 |
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 120 | ||
const int kInt1 = 3; | ||
const int kInt2 = 7; | ||
#line 3 | ||
int kInt3 = 11; | ||
uniform float size1 = 512.0; | ||
uniform float size2 = 0.00195313; | ||
#line 7 | ||
uniform float size3 = 3.0; | ||
#line 12 | ||
vec4 xlat_main( ); | ||
#line 12 | ||
vec4 xlat_main( ) { | ||
return vec4( 3.0, 7.0, float(kInt3), size2); | ||
} | ||
void main() { | ||
vec4 xl_retval; | ||
xl_retval = xlat_main( ); | ||
gl_Position = vec4(xl_retval); | ||
} | ||
|
||
// uniforms: | ||
// size2:<none> type 9 arrsize 0 |
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,15 @@ | ||
static const int kInt1 = 3; | ||
const int kInt2 = 7; | ||
static int kInt3 = 11; | ||
|
||
float size1 = 512.0; | ||
float size2 = 1.0 / 512.0; | ||
float size3 = kInt1; | ||
//float size4 = kInt2 / 3.0; | ||
//float size5 = 5 + kInt3; | ||
//float size6 = kInt2 * 512.0; | ||
|
||
float4 main() : POSITION | ||
{ | ||
return float4(kInt1, kInt2, kInt3, size2); | ||
} |
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,22 @@ | ||
const int kInt1 = 3; | ||
const int kInt2 = 7; | ||
#line 3 | ||
int kInt3; | ||
uniform float size1; | ||
uniform float size2; | ||
#line 7 | ||
uniform float size3; | ||
#line 12 | ||
vec4 xlat_main( ); | ||
#line 12 | ||
vec4 xlat_main( ) { | ||
return vec4( 3.0, 7.0, float(kInt3), size2); | ||
} | ||
void main() { | ||
vec4 xl_retval; | ||
xl_retval = xlat_main( ); | ||
gl_Position = vec4(xl_retval); | ||
} | ||
|
||
// uniforms: | ||
// size2:<none> type 9 arrsize 0 |
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,22 @@ | ||
const highp int kInt1 = 3; | ||
const highp int kInt2 = 7; | ||
#line 3 | ||
highp int kInt3; | ||
uniform highp float size1; | ||
uniform highp float size2; | ||
#line 7 | ||
uniform highp float size3; | ||
#line 12 | ||
highp vec4 xlat_main( ); | ||
#line 12 | ||
highp vec4 xlat_main( ) { | ||
return vec4( 3.0, 7.0, float(kInt3), size2); | ||
} | ||
void main() { | ||
highp vec4 xl_retval; | ||
xl_retval = xlat_main( ); | ||
gl_Position = vec4(xl_retval); | ||
} | ||
|
||
// uniforms: | ||
// size2:<none> type 9 arrsize 0 |