Implement frexp, ldexp, packUnorm2x16, unpackUnorm2x16, packUnorm4x8, packSnorm4x8, unpackUnorm4x8, unpackSnorm4x8, and unpackDouble2x32().

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27738 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-08-14 19:45:52 +00:00
parent 122c5f199b
commit 0a33592810
6 changed files with 207 additions and 17 deletions

View File

@ -35,4 +35,15 @@ void main()
i4 = findLSB(u4);
i1 = findMSB(i1);
i2 = findMSB(u2);
vec3 v3;
v3 = frexp(v3, i3);
vec2 v2;
v2 = ldexp(v2, i2);
mediump vec4 v4;
u1 = packUnorm4x8(v4);
u1 = packSnorm4x8(v4);
v4 = unpackUnorm4x8(u1);
v4 = unpackSnorm4x8(u1);
}

View File

@ -82,4 +82,20 @@ void foodc2()
vec2 v2 = dFdxFine(in2);
vec3 v3 = dFdyCoarse(in3);
vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4);
uint u1;
ivec3 i3;
ivec2 i2;
v2 = frexp(v2, i2);
v3 = ldexp(v3, i3);
u1 = packUnorm4x8(v4);
u1 = packSnorm4x8(v4);
v4 = unpackUnorm4x8(u1);
v4 = unpackSnorm4x8(u1);
double d;
uvec2 u2;
d = packDouble2x32(u2);
u2 = unpackDouble2x32(d);
}

View File

@ -100,6 +100,32 @@ ERROR: node is still EOpNull!
0:37 'i2' (highp 2-component vector of int)
0:37 Function Call: findMSB(vu2; (highp 2-component vector of int)
0:37 'u2' (highp 2-component vector of uint)
0:40 move second child to first child (highp 3-component vector of float)
0:40 'v3' (highp 3-component vector of float)
0:40 Function Call: frexp(vf3;vi3; (highp 3-component vector of float)
0:40 'v3' (highp 3-component vector of float)
0:40 'i3' (highp 3-component vector of int)
0:42 move second child to first child (highp 2-component vector of float)
0:42 'v2' (highp 2-component vector of float)
0:42 Function Call: ldexp(vf2;vi2; (highp 2-component vector of float)
0:42 'v2' (highp 2-component vector of float)
0:42 'i2' (highp 2-component vector of int)
0:45 move second child to first child (highp uint)
0:45 'u1' (highp uint)
0:45 Function Call: packUnorm4x8(vf4; (highp uint)
0:45 'v4' (mediump 4-component vector of float)
0:46 move second child to first child (highp uint)
0:46 'u1' (highp uint)
0:46 Function Call: packSnorm4x8(vf4; (highp uint)
0:46 'v4' (mediump 4-component vector of float)
0:47 move second child to first child (mediump 4-component vector of float)
0:47 'v4' (mediump 4-component vector of float)
0:47 Function Call: unpackUnorm4x8(u1; (mediump 4-component vector of float)
0:47 'u1' (highp uint)
0:48 move second child to first child (mediump 4-component vector of float)
0:48 'v4' (mediump 4-component vector of float)
0:48 Function Call: unpackSnorm4x8(u1; (mediump 4-component vector of float)
0:48 'u1' (highp uint)
0:? Linker Objects
0:? 's' (shared highp 4-component vector of float)
0:? 'v' (buffer highp 4-component vector of float)
@ -207,6 +233,32 @@ ERROR: node is still EOpNull!
0:37 'i2' (highp 2-component vector of int)
0:37 Function Call: findMSB(vu2; (highp 2-component vector of int)
0:37 'u2' (highp 2-component vector of uint)
0:40 move second child to first child (highp 3-component vector of float)
0:40 'v3' (highp 3-component vector of float)
0:40 Function Call: frexp(vf3;vi3; (highp 3-component vector of float)
0:40 'v3' (highp 3-component vector of float)
0:40 'i3' (highp 3-component vector of int)
0:42 move second child to first child (highp 2-component vector of float)
0:42 'v2' (highp 2-component vector of float)
0:42 Function Call: ldexp(vf2;vi2; (highp 2-component vector of float)
0:42 'v2' (highp 2-component vector of float)
0:42 'i2' (highp 2-component vector of int)
0:45 move second child to first child (highp uint)
0:45 'u1' (highp uint)
0:45 Function Call: packUnorm4x8(vf4; (highp uint)
0:45 'v4' (mediump 4-component vector of float)
0:46 move second child to first child (highp uint)
0:46 'u1' (highp uint)
0:46 Function Call: packSnorm4x8(vf4; (highp uint)
0:46 'v4' (mediump 4-component vector of float)
0:47 move second child to first child (mediump 4-component vector of float)
0:47 'v4' (mediump 4-component vector of float)
0:47 Function Call: unpackUnorm4x8(u1; (mediump 4-component vector of float)
0:47 'u1' (highp uint)
0:48 move second child to first child (mediump 4-component vector of float)
0:48 'v4' (mediump 4-component vector of float)
0:48 Function Call: unpackSnorm4x8(u1; (mediump 4-component vector of float)
0:48 'u1' (highp uint)
0:? Linker Objects
0:? 's' (shared highp 4-component vector of float)
0:? 'v' (buffer highp 4-component vector of float)

View File

@ -264,6 +264,40 @@ ERROR: node is still EOpNull!
0:84 'in4' (smooth in 4-component vector of float)
0:84 fwidthFine (4-component vector of float)
0:84 'in4' (smooth in 4-component vector of float)
0:89 move second child to first child (2-component vector of float)
0:89 'v2' (2-component vector of float)
0:89 Function Call: frexp(vf2;vi2; (2-component vector of float)
0:89 'v2' (2-component vector of float)
0:89 'i2' (2-component vector of int)
0:90 move second child to first child (3-component vector of float)
0:90 'v3' (3-component vector of float)
0:90 Function Call: ldexp(vf3;vi3; (3-component vector of float)
0:90 'v3' (3-component vector of float)
0:90 'i3' (3-component vector of int)
0:92 move second child to first child (uint)
0:92 'u1' (uint)
0:92 Function Call: packUnorm4x8(vf4; (uint)
0:92 'v4' (4-component vector of float)
0:93 move second child to first child (uint)
0:93 'u1' (uint)
0:93 Function Call: packSnorm4x8(vf4; (uint)
0:93 'v4' (4-component vector of float)
0:94 move second child to first child (4-component vector of float)
0:94 'v4' (4-component vector of float)
0:94 Function Call: unpackUnorm4x8(u1; (4-component vector of float)
0:94 'u1' (uint)
0:95 move second child to first child (4-component vector of float)
0:95 'v4' (4-component vector of float)
0:95 Function Call: unpackSnorm4x8(u1; (4-component vector of float)
0:95 'u1' (uint)
0:99 move second child to first child (double)
0:99 'd' (double)
0:99 Function Call: packDouble2x32(vu2; (double)
0:99 'u2' (2-component vector of uint)
0:100 move second child to first child (2-component vector of uint)
0:100 'u2' (2-component vector of uint)
0:100 Function Call: unpackDouble2x32(d1; (2-component vector of uint)
0:100 'd' (double)
0:? Linker Objects
0:? 'c2D' (smooth in 2-component vector of float)
0:? 'i' (flat in int)
@ -533,6 +567,40 @@ ERROR: node is still EOpNull!
0:84 'in4' (smooth in 4-component vector of float)
0:84 fwidthFine (4-component vector of float)
0:84 'in4' (smooth in 4-component vector of float)
0:89 move second child to first child (2-component vector of float)
0:89 'v2' (2-component vector of float)
0:89 Function Call: frexp(vf2;vi2; (2-component vector of float)
0:89 'v2' (2-component vector of float)
0:89 'i2' (2-component vector of int)
0:90 move second child to first child (3-component vector of float)
0:90 'v3' (3-component vector of float)
0:90 Function Call: ldexp(vf3;vi3; (3-component vector of float)
0:90 'v3' (3-component vector of float)
0:90 'i3' (3-component vector of int)
0:92 move second child to first child (uint)
0:92 'u1' (uint)
0:92 Function Call: packUnorm4x8(vf4; (uint)
0:92 'v4' (4-component vector of float)
0:93 move second child to first child (uint)
0:93 'u1' (uint)
0:93 Function Call: packSnorm4x8(vf4; (uint)
0:93 'v4' (4-component vector of float)
0:94 move second child to first child (4-component vector of float)
0:94 'v4' (4-component vector of float)
0:94 Function Call: unpackUnorm4x8(u1; (4-component vector of float)
0:94 'u1' (uint)
0:95 move second child to first child (4-component vector of float)
0:95 'v4' (4-component vector of float)
0:95 Function Call: unpackSnorm4x8(u1; (4-component vector of float)
0:95 'u1' (uint)
0:99 move second child to first child (double)
0:99 'd' (double)
0:99 Function Call: packDouble2x32(vu2; (double)
0:99 'u2' (2-component vector of uint)
0:100 move second child to first child (2-component vector of uint)
0:100 'u2' (2-component vector of uint)
0:100 Function Call: unpackDouble2x32(d1; (2-component vector of uint)
0:100 'd' (double)
0:? Linker Objects
0:? 'c2D' (smooth in 2-component vector of float)
0:? 'i' (flat in int)

View File

@ -83,8 +83,8 @@ Shader Functionality to Implement/Finish
- overlapping bindings
- offset post incrementing
- overlapping offsets
- frexp/ldexp
- packUnorm4x8(),packSnorm4x8(), unpackUnorm4x8(), unpackSnorm4x8()
+ frexp/ldexp
+ packUnorm4x8(),packSnorm4x8(), unpackUnorm4x8(), unpackSnorm4x8()
- 2DMS samplers and images
- inheritance of memory qualifiers in block members
GLSL 1.2
@ -148,17 +148,17 @@ Shader Functionality to Implement/Finish
- Per-sample shading. Including sample input mask gl_SampleMaskIn[] and per-sample interpolation, with explicit interpolation built-ins interpolateAtCentroid(), interpolateAtSample(), and interpolateAtOffset().
- New precise qualifier to disallow optimizations that re-order operations or treat different instances of the same operator with different precision.
- Add a fused multiply and add built-in, fma(), in relation to the new precise qualifier. (Because “a * b + c” will require two operations under new rules for precise.)
- Added new built-in floating-point functions
- frexp() and ldexp()
+ Added new built-in floating-point functions
+ frexp() and ldexp()
+ packUnorm2x16(), unpackUnorm2x16(),
- packUnorm4x8(),packSnorm4x8(), and packDouble2x32()
- unpackUnorm4x8(),unpackSnorm4x8(), and unpackDouble2x32()
- Add new built-in integer functions
- uaddCarry() andusubBorrow()
- umulExtended() andimulExtended()
- bitfieldExtract() andbitfieldInsert()
- bitfieldReverse()
- bitCount(),findLSB(), andfindMSB()
+ packUnorm4x8(), packSnorm4x8(), unpackUnorm4x8(), unpackSnorm4x8()
+ packDouble2x32() and unpackDouble2x32()
+ Add new built-in integer functions
+ uaddCarry() and usubBorrow()
+ umulExtended() and imulExtended()
+ bitfieldExtract() and bitfieldInsert()
+ bitfieldReverse()
+ bitCount(), findLSB(), andfindMSB()
- New built-in to query LOD, textureQueryLod().
- New overloaded function matching algorithm, handling selection from many valid multiple choices.
+ Texture gather functions that return four texels with a single call.

View File

@ -492,16 +492,59 @@ void TBuiltIns::initialize(int version, EProfile profile)
"\n");
}
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 400)) {
commonBuiltins.append(
"highp float frexp(highp float, out highp int);"
"highp vec2 frexp(highp vec2, out highp ivec2);"
"highp vec3 frexp(highp vec3, out highp ivec3);"
"highp vec4 frexp(highp vec4, out highp ivec4);"
"highp float ldexp(highp float, highp int);"
"highp vec2 ldexp(highp vec2, highp ivec2);"
"highp vec3 ldexp(highp vec3, highp ivec3);"
"highp vec4 ldexp(highp vec4, highp ivec4);"
"\n");
}
if (profile != EEsProfile && version >= 400) {
commonBuiltins.append(
"double frexp(double, out int);"
"dvec2 frexp( dvec2, out ivec2);"
"dvec3 frexp( dvec3, out ivec3);"
"dvec4 frexp( dvec4, out ivec4);"
"double ldexp(double, int);"
"dvec2 ldexp( dvec2, ivec2);"
"dvec3 ldexp( dvec3, ivec3);"
"dvec4 ldexp( dvec4, ivec4);"
"double packDouble2x32(uvec2);"
"uvec2 unpackDouble2x32(double);"
"\n");
}
if ((profile == EEsProfile && version >= 300) ||
(profile != EEsProfile && version >= 400)) {
commonBuiltins.append(
"highp uint packSnorm2x16 (vec2);"
"highp vec2 unpackSnorm2x16 (highp uint);"
"highp uint packUnorm2x16 (vec2);"
"highp vec2 unpackUnorm2x16 (highp uint);"
"highp uint packSnorm2x16(vec2);"
"highp vec2 unpackSnorm2x16(highp uint);"
"highp uint packUnorm2x16(vec2);"
"highp vec2 unpackUnorm2x16(highp uint);"
"highp uint packHalf2x16(mediump vec2);"
"mediump vec2 unpackHalf2x16(highp uint);"
"\n");
}
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 400)) {
commonBuiltins.append(
"highp uint packSnorm4x8 (mediump vec4);"
"mediump vec4 unpackSnorm4x8(highp uint);"
"highp uint packUnorm4x8 (mediump vec4);"
"mediump vec4 unpackUnorm4x8(highp uint);"
"\n");
}