Skip to content

Commit

Permalink
Add support for extension GL_EXT_shader_integer_mix (#2203)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmistryNV authored May 1, 2020
1 parent 97ee5c8 commit 2c53bae
Show file tree
Hide file tree
Showing 9 changed files with 391 additions and 10 deletions.
28 changes: 28 additions & 0 deletions Test/150.frag
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,31 @@ void qlodPass()
lod = textureQueryLod(sampBuf, pf); // ERROR
lod = textureQueryLod(sampRect, pf2); // ERROR
}

// Test extension GL_EXT_shader_integer_mix
#extension GL_EXT_shader_integer_mix : enable
bool b1, b2, b;
int x,y;
uint z,w;

void testmix()
{
int ival = mix(x, y, b);
ivec2 iv2 = mix(ivec2(x), ivec2(y), bvec2(b));
ivec3 iv3 = mix(ivec3(x), ivec3(y), bvec3(b));
ivec4 iv4 = mix(ivec4(x), ivec4(x), bvec4(b));
uint uiv = mix(z, w, b);
uvec2 uv2 = mix(uvec2(z), uvec2(z), bvec2(b));
uvec3 uv3 = mix(uvec3(z), uvec3(z), bvec3(b));
uvec4 uv4 = mix(uvec4(z), uvec4(z), bvec4(b));
bool bv = mix(b1, b2, b);
bvec2 bv2 = mix(bvec2(b1), bvec2(b2), bvec2(b));
bvec3 bv3 = mix(bvec3(b1), bvec3(b2), bvec3(b));
bvec4 bv4 = mix(bvec4(b1), bvec4(b2), bvec4(b));
}

#extension GL_EXT_shader_integer_mix : disable
void testmixFail()
{
int ival = mix(x, y, b); // Error since extenson GL_EXT_shader_integer_mix is disabled
}
28 changes: 28 additions & 0 deletions Test/300.frag
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,34 @@ uniform mediump; // ERROR

layout(early_fragment_tests) in; // ERROR

// Test extension GL_EXT_shader_integer_mix
#extension GL_EXT_shader_integer_mix : enable
bool b1, b2, b;
int x,y;
uint z,w;

void testmix()
{
int ival = mix(x, y, b);
ivec2 iv2 = mix(ivec2(x), ivec2(y), bvec2(b));
ivec3 iv3 = mix(ivec3(x), ivec3(y), bvec3(b));
ivec4 iv4 = mix(ivec4(x), ivec4(x), bvec4(b));
uint uiv = mix(z, w, b);
uvec2 uv2 = mix(uvec2(z), uvec2(z), bvec2(b));
uvec3 uv3 = mix(uvec3(z), uvec3(z), bvec3(b));
uvec4 uv4 = mix(uvec4(z), uvec4(z), bvec4(b));
bool bv = mix(b1, b2, b);
bvec2 bv2 = mix(bvec2(b1), bvec2(b2), bvec2(b));
bvec3 bv3 = mix(bvec3(b1), bvec3(b2), bvec3(b));
bvec4 bv4 = mix(bvec4(b1), bvec4(b2), bvec4(b));
}

#extension GL_EXT_shader_integer_mix : disable
void testmixFail()
{
int ival = mix(x, y, b); // Error since extenson GL_EXT_shader_integer_mix is disabled
}

#ifndef GL_FRAGMENT_PRECISION_HIGH
#error missing GL_FRAGMENT_PRECISION_HIGH
#endif
Expand Down
143 changes: 142 additions & 1 deletion Test/baseResults/150.frag.out
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ ERROR: 0:154: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:154: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 0:155: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:155: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 18 compilation errors. No code generated.
ERROR: 0:183: 'mix' : required extension not requested: GL_EXT_shader_integer_mix
ERROR: 19 compilation errors. No code generated.


Shader version: 150
Requested GL_ARB_gpu_shader_fp64
Requested GL_ARB_shader_bit_encoding
Requested GL_ARB_shading_language_packing
Requested GL_ARB_texture_query_lod
Requested GL_EXT_shader_integer_mix
gl_FragCoord pixel center is integer
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
Expand Down Expand Up @@ -290,6 +292,130 @@ ERROR: node is still EOpNull!
0:152 'pf2' ( temp 2-component vector of float)
0:154 'lod' ( temp 2-component vector of float)
0:155 'lod' ( temp 2-component vector of float)
0:164 Function Definition: testmix( ( global void)
0:164 Function Parameters:
0:166 Sequence
0:166 Sequence
0:166 move second child to first child ( temp int)
0:166 'ival' ( temp int)
0:166 mix ( global int)
0:166 'x' ( global int)
0:166 'y' ( global int)
0:166 'b' ( global bool)
0:167 Sequence
0:167 move second child to first child ( temp 2-component vector of int)
0:167 'iv2' ( temp 2-component vector of int)
0:167 mix ( global 2-component vector of int)
0:167 Construct ivec2 ( temp 2-component vector of int)
0:167 'x' ( global int)
0:167 Construct ivec2 ( temp 2-component vector of int)
0:167 'y' ( global int)
0:167 Construct bvec2 ( temp 2-component vector of bool)
0:167 'b' ( global bool)
0:168 Sequence
0:168 move second child to first child ( temp 3-component vector of int)
0:168 'iv3' ( temp 3-component vector of int)
0:168 mix ( global 3-component vector of int)
0:168 Construct ivec3 ( temp 3-component vector of int)
0:168 'x' ( global int)
0:168 Construct ivec3 ( temp 3-component vector of int)
0:168 'y' ( global int)
0:168 Construct bvec3 ( temp 3-component vector of bool)
0:168 'b' ( global bool)
0:169 Sequence
0:169 move second child to first child ( temp 4-component vector of int)
0:169 'iv4' ( temp 4-component vector of int)
0:169 mix ( global 4-component vector of int)
0:169 Construct ivec4 ( temp 4-component vector of int)
0:169 'x' ( global int)
0:169 Construct ivec4 ( temp 4-component vector of int)
0:169 'x' ( global int)
0:169 Construct bvec4 ( temp 4-component vector of bool)
0:169 'b' ( global bool)
0:170 Sequence
0:170 move second child to first child ( temp uint)
0:170 'uiv' ( temp uint)
0:170 mix ( global uint)
0:170 'z' ( global uint)
0:170 'w' ( global uint)
0:170 'b' ( global bool)
0:171 Sequence
0:171 move second child to first child ( temp 2-component vector of uint)
0:171 'uv2' ( temp 2-component vector of uint)
0:171 mix ( global 2-component vector of uint)
0:171 Construct uvec2 ( temp 2-component vector of uint)
0:171 'z' ( global uint)
0:171 Construct uvec2 ( temp 2-component vector of uint)
0:171 'z' ( global uint)
0:171 Construct bvec2 ( temp 2-component vector of bool)
0:171 'b' ( global bool)
0:172 Sequence
0:172 move second child to first child ( temp 3-component vector of uint)
0:172 'uv3' ( temp 3-component vector of uint)
0:172 mix ( global 3-component vector of uint)
0:172 Construct uvec3 ( temp 3-component vector of uint)
0:172 'z' ( global uint)
0:172 Construct uvec3 ( temp 3-component vector of uint)
0:172 'z' ( global uint)
0:172 Construct bvec3 ( temp 3-component vector of bool)
0:172 'b' ( global bool)
0:173 Sequence
0:173 move second child to first child ( temp 4-component vector of uint)
0:173 'uv4' ( temp 4-component vector of uint)
0:173 mix ( global 4-component vector of uint)
0:173 Construct uvec4 ( temp 4-component vector of uint)
0:173 'z' ( global uint)
0:173 Construct uvec4 ( temp 4-component vector of uint)
0:173 'z' ( global uint)
0:173 Construct bvec4 ( temp 4-component vector of bool)
0:173 'b' ( global bool)
0:174 Sequence
0:174 move second child to first child ( temp bool)
0:174 'bv' ( temp bool)
0:174 mix ( global bool)
0:174 'b1' ( global bool)
0:174 'b2' ( global bool)
0:174 'b' ( global bool)
0:175 Sequence
0:175 move second child to first child ( temp 2-component vector of bool)
0:175 'bv2' ( temp 2-component vector of bool)
0:175 mix ( global 2-component vector of bool)
0:175 Construct bvec2 ( temp 2-component vector of bool)
0:175 'b1' ( global bool)
0:175 Construct bvec2 ( temp 2-component vector of bool)
0:175 'b2' ( global bool)
0:175 Construct bvec2 ( temp 2-component vector of bool)
0:175 'b' ( global bool)
0:176 Sequence
0:176 move second child to first child ( temp 3-component vector of bool)
0:176 'bv3' ( temp 3-component vector of bool)
0:176 mix ( global 3-component vector of bool)
0:176 Construct bvec3 ( temp 3-component vector of bool)
0:176 'b1' ( global bool)
0:176 Construct bvec3 ( temp 3-component vector of bool)
0:176 'b2' ( global bool)
0:176 Construct bvec3 ( temp 3-component vector of bool)
0:176 'b' ( global bool)
0:177 Sequence
0:177 move second child to first child ( temp 4-component vector of bool)
0:177 'bv4' ( temp 4-component vector of bool)
0:177 mix ( global 4-component vector of bool)
0:177 Construct bvec4 ( temp 4-component vector of bool)
0:177 'b1' ( global bool)
0:177 Construct bvec4 ( temp 4-component vector of bool)
0:177 'b2' ( global bool)
0:177 Construct bvec4 ( temp 4-component vector of bool)
0:177 'b' ( global bool)
0:181 Function Definition: testmixFail( ( global void)
0:181 Function Parameters:
0:183 Sequence
0:183 Sequence
0:183 move second child to first child ( temp int)
0:183 'ival' ( temp int)
0:183 mix ( global int)
0:183 'x' ( global int)
0:183 'y' ( global int)
0:183 'b' ( global bool)
0:? Linker Objects
0:? 'gl_FragCoord' ( gl_FragCoord 4-component vector of float FragCoord)
0:? 'foo' ( smooth in 4-component vector of float)
Expand Down Expand Up @@ -330,6 +456,13 @@ ERROR: node is still EOpNull!
0:? 'samp2DAs' ( uniform sampler2DArrayShadow)
0:? 'sampBuf' ( uniform samplerBuffer)
0:? 'sampRect' ( uniform sampler2DRect)
0:? 'b1' ( global bool)
0:? 'b2' ( global bool)
0:? 'b' ( global bool)
0:? 'x' ( global int)
0:? 'y' ( global int)
0:? 'z' ( global uint)
0:? 'w' ( global uint)


Linked fragment stage:
Expand All @@ -340,6 +473,7 @@ Requested GL_ARB_gpu_shader_fp64
Requested GL_ARB_shader_bit_encoding
Requested GL_ARB_shading_language_packing
Requested GL_ARB_texture_query_lod
Requested GL_EXT_shader_integer_mix
gl_FragCoord pixel center is integer
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
Expand Down Expand Up @@ -415,4 +549,11 @@ ERROR: node is still EOpNull!
0:? 'samp2DAs' ( uniform sampler2DArrayShadow)
0:? 'sampBuf' ( uniform samplerBuffer)
0:? 'sampRect' ( uniform sampler2DRect)
0:? 'b1' ( global bool)
0:? 'b2' ( global bool)
0:? 'b' ( global bool)
0:? 'x' ( global int)
0:? 'y' ( global int)
0:? 'z' ( global uint)
0:? 'w' ( global uint)

Loading

0 comments on commit 2c53bae

Please sign in to comment.