From 4bfeed5fe80645c2b8ed383a7b30baa5c4be2399 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 22 Jan 2016 15:40:24 -0700 Subject: [PATCH] Semantics: Spec. changing to reflect reality of int/uint conversion for |^&. This effects 4.x, where int/uint conversions are done, but not earlier. --- Test/400.frag | 10 + Test/Operations.frag | 44 +-- Test/baseResults/Operations.frag.out | 284 +++++++++++++++++++- glslang/MachineIndependent/Intermediate.cpp | 4 + 4 files changed, 318 insertions(+), 24 deletions(-) diff --git a/Test/400.frag b/Test/400.frag index 059743e44..b7460b4a0 100644 --- a/Test/400.frag +++ b/Test/400.frag @@ -185,3 +185,13 @@ void qlod() } struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member + +uniform uint uu; +out int iout; + +void bitwiseConv() +{ + iout = uu & i; + iout += uu ^ i; + iout += i | uu; +} diff --git a/Test/Operations.frag b/Test/Operations.frag index 820048f22..ca06a752e 100644 --- a/Test/Operations.frag +++ b/Test/Operations.frag @@ -7,10 +7,10 @@ uniform bvec4 ub41, ub42; uniform float uf; uniform int ui; -#ifdef TEST_POST_110 + uniform uvec4 uuv4; -uniform unsigned int uui; -#endif +uniform uint uui; + void main() { @@ -19,9 +19,9 @@ void main() bool b; bvec4 bv4; int i; -#ifdef TEST_POST_110 + uint u; -#endif + // floating point v = radians(uv4); @@ -51,37 +51,37 @@ void main() v += sign(v); v += floor(v); -#ifdef TEST_POST_110 + v += trunc(v); v += round(v); v += roundEven(v); -#endif + v += ceil(v); v += fract(v); v += mod(v, v); v += mod(v, v.x); -#ifdef TEST_POST_110 + v += modf(v, v); -#endif + v += min(v, uv4); v += max(v, uv4); v += clamp(v, uv4, uv4); v += mix(v,v,v); -#ifdef TEST_POST_110 - v += mix(v,v,ub); - v += intBitsToFloat(v); - v += uintBitsToFloat(v); - v += fma(v); + + v += mix(v,v,bv4); + v += intBitsToFloat(ivec4(i)); + v += uintBitsToFloat(uv4); + v += fma(v,v,v); v += frexp(v); v += ldexp(v); v += unpackUnorm2x16(v); v += unpackUnorm4x8(v); v += unpackSnorm4x8(v); -#endif + v += step(v,v); v += smoothstep(v,v,v); @@ -96,7 +96,7 @@ void main() v += fwidth(v); //noise*(v); -#ifdef TEST_POST_110 + // signed integer i += abs(ui); i += sign(i); @@ -118,15 +118,15 @@ void main() u += floatsBitToInt(v); u += packUnorm2x16(v); u += packUnorm4x8(v); - u += packSnorm4x8(v); - u += floatBitsToUInt(v); -#endif + i += uui & i; // ERRORs, no int/uint conversions before 400 + i += uui ^ i; + i += i | uui; // bool -#ifdef TEST_POST_110 + b = isnan(uf); - b = isinf(v); -#endif + b = isinf(v.y); + b = any(lessThan(v, uv4)); b = (b && any(lessThanEqual(v, uv4))); b = (b && any(greaterThan(v, uv4))); diff --git a/Test/baseResults/Operations.frag.out b/Test/baseResults/Operations.frag.out index 4bf19699a..bc12fe0da 100644 --- a/Test/baseResults/Operations.frag.out +++ b/Test/baseResults/Operations.frag.out @@ -1,6 +1,34 @@ Operations.frag +ERROR: 0:76: 'intBitsToFloat' : no matching overloaded function found +ERROR: 0:77: 'uintBitsToFloat' : no matching overloaded function found +ERROR: 0:78: 'fma' : no matching overloaded function found +ERROR: 0:79: 'frexp' : no matching overloaded function found +ERROR: 0:80: 'ldexp' : no matching overloaded function found +ERROR: 0:81: 'unpackUnorm2x16' : no matching overloaded function found +ERROR: 0:82: 'unpackUnorm4x8' : no matching overloaded function found +ERROR: 0:83: 'unpackSnorm4x8' : no matching overloaded function found +ERROR: 0:107: 'floatsBitsToInt' : no matching overloaded function found +ERROR: 0:108: 'packUnorm2x16' : no matching overloaded function found +ERROR: 0:109: 'packUnorm4x8' : no matching overloaded function found +ERROR: 0:110: 'packSnorm4x8' : no matching overloaded function found +ERROR: 0:113: 'assign' : cannot convert from 'global float' to 'temp uint' +ERROR: 0:114: 'assign' : cannot convert from 'global float' to 'temp uint' +ERROR: 0:118: 'floatsBitToInt' : no matching overloaded function found +ERROR: 0:118: 'assign' : cannot convert from 'const float' to 'temp uint' +ERROR: 0:119: 'packUnorm2x16' : no matching overloaded function found +ERROR: 0:119: 'assign' : cannot convert from 'const float' to 'temp uint' +ERROR: 0:120: 'packUnorm4x8' : no matching overloaded function found +ERROR: 0:120: 'assign' : cannot convert from 'const float' to 'temp uint' +ERROR: 0:121: '&' : wrong operand types: no operation '&' exists that takes a left-hand operand of type 'uniform uint' and a right operand of type 'temp int' (or there is no acceptable conversion) +ERROR: 0:121: 'assign' : cannot convert from 'uniform uint' to 'temp int' +ERROR: 0:122: '^' : wrong operand types: no operation '^' exists that takes a left-hand operand of type 'uniform uint' and a right operand of type 'temp int' (or there is no acceptable conversion) +ERROR: 0:122: 'assign' : cannot convert from 'uniform uint' to 'temp int' +ERROR: 0:123: '|' : wrong operand types: no operation '|' exists that takes a left-hand operand of type 'temp int' and a right operand of type 'uniform uint' (or there is no acceptable conversion) +ERROR: 25 compilation errors. No code generated. + + Shader version: 130 -0:? Sequence +ERROR: node is still EOpNull! 0:15 Function Definition: main( (global void) 0:15 Function Parameters: 0:? Sequence @@ -107,6 +135,18 @@ Shader version: 130 0:52 'v' (temp 4-component vector of float) 0:52 Floor (global 4-component vector of float) 0:52 'v' (temp 4-component vector of float) +0:55 add second child into first child (temp 4-component vector of float) +0:55 'v' (temp 4-component vector of float) +0:55 trunc (global 4-component vector of float) +0:55 'v' (temp 4-component vector of float) +0:56 add second child into first child (temp 4-component vector of float) +0:56 'v' (temp 4-component vector of float) +0:56 round (global 4-component vector of float) +0:56 'v' (temp 4-component vector of float) +0:57 add second child into first child (temp 4-component vector of float) +0:57 'v' (temp 4-component vector of float) +0:57 roundEven (global 4-component vector of float) +0:57 'v' (temp 4-component vector of float) 0:60 add second child into first child (temp 4-component vector of float) 0:60 'v' (temp 4-component vector of float) 0:60 Ceiling (global 4-component vector of float) @@ -128,6 +168,11 @@ Shader version: 130 0:63 'v' (temp 4-component vector of float) 0:63 Constant: 0:63 0 (const int) +0:66 add second child into first child (temp 4-component vector of float) +0:66 'v' (temp 4-component vector of float) +0:66 modf (global 4-component vector of float) +0:66 'v' (temp 4-component vector of float) +0:66 'v' (temp 4-component vector of float) 0:69 add second child into first child (temp 4-component vector of float) 0:69 'v' (temp 4-component vector of float) 0:69 min (global 4-component vector of float) @@ -150,6 +195,44 @@ Shader version: 130 0:72 'v' (temp 4-component vector of float) 0:72 'v' (temp 4-component vector of float) 0:72 'v' (temp 4-component vector of float) +0:75 add second child into first child (temp 4-component vector of float) +0:75 'v' (temp 4-component vector of float) +0:75 mix (global 4-component vector of float) +0:75 'v' (temp 4-component vector of float) +0:75 'v' (temp 4-component vector of float) +0:75 'bv4' (temp 4-component vector of bool) +0:76 add second child into first child (temp 4-component vector of float) +0:76 'v' (temp 4-component vector of float) +0:76 Constant: +0:76 0.000000 +0:77 add second child into first child (temp 4-component vector of float) +0:77 'v' (temp 4-component vector of float) +0:77 Constant: +0:77 0.000000 +0:78 add second child into first child (temp 4-component vector of float) +0:78 'v' (temp 4-component vector of float) +0:78 Constant: +0:78 0.000000 +0:79 add second child into first child (temp 4-component vector of float) +0:79 'v' (temp 4-component vector of float) +0:79 Constant: +0:79 0.000000 +0:80 add second child into first child (temp 4-component vector of float) +0:80 'v' (temp 4-component vector of float) +0:80 Constant: +0:80 0.000000 +0:81 add second child into first child (temp 4-component vector of float) +0:81 'v' (temp 4-component vector of float) +0:81 Constant: +0:81 0.000000 +0:82 add second child into first child (temp 4-component vector of float) +0:82 'v' (temp 4-component vector of float) +0:82 Constant: +0:82 0.000000 +0:83 add second child into first child (temp 4-component vector of float) +0:83 'v' (temp 4-component vector of float) +0:83 Constant: +0:83 0.000000 0:86 add second child into first child (temp 4-component vector of float) 0:86 'v' (temp 4-component vector of float) 0:86 step (global 4-component vector of float) @@ -205,6 +288,75 @@ Shader version: 130 0:96 'v' (temp 4-component vector of float) 0:96 fwidth (global 4-component vector of float) 0:96 'v' (temp 4-component vector of float) +0:101 add second child into first child (temp int) +0:101 'i' (temp int) +0:101 Absolute value (global int) +0:101 'ui' (uniform int) +0:102 add second child into first child (temp int) +0:102 'i' (temp int) +0:102 Sign (global int) +0:102 'i' (temp int) +0:103 add second child into first child (temp int) +0:103 'i' (temp int) +0:103 min (global int) +0:103 'i' (temp int) +0:103 'ui' (uniform int) +0:104 add second child into first child (temp int) +0:104 'i' (temp int) +0:104 max (global int) +0:104 'i' (temp int) +0:104 'ui' (uniform int) +0:105 add second child into first child (temp int) +0:105 'i' (temp int) +0:105 clamp (global int) +0:105 'i' (temp int) +0:105 'ui' (uniform int) +0:105 'ui' (uniform int) +0:107 Constant: +0:107 0.000000 +0:108 Constant: +0:108 0.000000 +0:109 Constant: +0:109 0.000000 +0:110 Constant: +0:110 0.000000 +0:113 'u' (temp uint) +0:114 'u' (temp uint) +0:115 add second child into first child (temp uint) +0:115 'u' (temp uint) +0:115 min (global uint) +0:115 'u' (temp uint) +0:115 'uui' (uniform uint) +0:116 add second child into first child (temp uint) +0:116 'u' (temp uint) +0:116 max (global uint) +0:116 'u' (temp uint) +0:116 'uui' (uniform uint) +0:117 add second child into first child (temp uint) +0:117 'u' (temp uint) +0:117 clamp (global uint) +0:117 'u' (temp uint) +0:117 'uui' (uniform uint) +0:117 'uui' (uniform uint) +0:118 'u' (temp uint) +0:119 'u' (temp uint) +0:120 'u' (temp uint) +0:121 'i' (temp int) +0:122 'i' (temp int) +0:123 add second child into first child (temp int) +0:123 'i' (temp int) +0:123 'i' (temp int) +0:127 move second child to first child (temp bool) +0:127 'b' (temp bool) +0:127 isnan (global bool) +0:127 'uf' (uniform float) +0:128 move second child to first child (temp bool) +0:128 'b' (temp bool) +0:128 isinf (global bool) +0:128 direct index (temp float) +0:128 'v' (temp 4-component vector of float) +0:128 Constant: +0:128 1 (const int) 0:130 move second child to first child (temp bool) 0:130 'b' (temp bool) 0:130 any (global bool) @@ -431,13 +583,15 @@ Shader version: 130 0:? 'ub42' (uniform 4-component vector of bool) 0:? 'uf' (uniform float) 0:? 'ui' (uniform int) +0:? 'uuv4' (uniform 4-component vector of uint) +0:? 'uui' (uniform uint) Linked fragment stage: Shader version: 130 -0:? Sequence +ERROR: node is still EOpNull! 0:15 Function Definition: main( (global void) 0:15 Function Parameters: 0:? Sequence @@ -544,6 +698,18 @@ Shader version: 130 0:52 'v' (temp 4-component vector of float) 0:52 Floor (global 4-component vector of float) 0:52 'v' (temp 4-component vector of float) +0:55 add second child into first child (temp 4-component vector of float) +0:55 'v' (temp 4-component vector of float) +0:55 trunc (global 4-component vector of float) +0:55 'v' (temp 4-component vector of float) +0:56 add second child into first child (temp 4-component vector of float) +0:56 'v' (temp 4-component vector of float) +0:56 round (global 4-component vector of float) +0:56 'v' (temp 4-component vector of float) +0:57 add second child into first child (temp 4-component vector of float) +0:57 'v' (temp 4-component vector of float) +0:57 roundEven (global 4-component vector of float) +0:57 'v' (temp 4-component vector of float) 0:60 add second child into first child (temp 4-component vector of float) 0:60 'v' (temp 4-component vector of float) 0:60 Ceiling (global 4-component vector of float) @@ -565,6 +731,11 @@ Shader version: 130 0:63 'v' (temp 4-component vector of float) 0:63 Constant: 0:63 0 (const int) +0:66 add second child into first child (temp 4-component vector of float) +0:66 'v' (temp 4-component vector of float) +0:66 modf (global 4-component vector of float) +0:66 'v' (temp 4-component vector of float) +0:66 'v' (temp 4-component vector of float) 0:69 add second child into first child (temp 4-component vector of float) 0:69 'v' (temp 4-component vector of float) 0:69 min (global 4-component vector of float) @@ -587,6 +758,44 @@ Shader version: 130 0:72 'v' (temp 4-component vector of float) 0:72 'v' (temp 4-component vector of float) 0:72 'v' (temp 4-component vector of float) +0:75 add second child into first child (temp 4-component vector of float) +0:75 'v' (temp 4-component vector of float) +0:75 mix (global 4-component vector of float) +0:75 'v' (temp 4-component vector of float) +0:75 'v' (temp 4-component vector of float) +0:75 'bv4' (temp 4-component vector of bool) +0:76 add second child into first child (temp 4-component vector of float) +0:76 'v' (temp 4-component vector of float) +0:76 Constant: +0:76 0.000000 +0:77 add second child into first child (temp 4-component vector of float) +0:77 'v' (temp 4-component vector of float) +0:77 Constant: +0:77 0.000000 +0:78 add second child into first child (temp 4-component vector of float) +0:78 'v' (temp 4-component vector of float) +0:78 Constant: +0:78 0.000000 +0:79 add second child into first child (temp 4-component vector of float) +0:79 'v' (temp 4-component vector of float) +0:79 Constant: +0:79 0.000000 +0:80 add second child into first child (temp 4-component vector of float) +0:80 'v' (temp 4-component vector of float) +0:80 Constant: +0:80 0.000000 +0:81 add second child into first child (temp 4-component vector of float) +0:81 'v' (temp 4-component vector of float) +0:81 Constant: +0:81 0.000000 +0:82 add second child into first child (temp 4-component vector of float) +0:82 'v' (temp 4-component vector of float) +0:82 Constant: +0:82 0.000000 +0:83 add second child into first child (temp 4-component vector of float) +0:83 'v' (temp 4-component vector of float) +0:83 Constant: +0:83 0.000000 0:86 add second child into first child (temp 4-component vector of float) 0:86 'v' (temp 4-component vector of float) 0:86 step (global 4-component vector of float) @@ -642,6 +851,75 @@ Shader version: 130 0:96 'v' (temp 4-component vector of float) 0:96 fwidth (global 4-component vector of float) 0:96 'v' (temp 4-component vector of float) +0:101 add second child into first child (temp int) +0:101 'i' (temp int) +0:101 Absolute value (global int) +0:101 'ui' (uniform int) +0:102 add second child into first child (temp int) +0:102 'i' (temp int) +0:102 Sign (global int) +0:102 'i' (temp int) +0:103 add second child into first child (temp int) +0:103 'i' (temp int) +0:103 min (global int) +0:103 'i' (temp int) +0:103 'ui' (uniform int) +0:104 add second child into first child (temp int) +0:104 'i' (temp int) +0:104 max (global int) +0:104 'i' (temp int) +0:104 'ui' (uniform int) +0:105 add second child into first child (temp int) +0:105 'i' (temp int) +0:105 clamp (global int) +0:105 'i' (temp int) +0:105 'ui' (uniform int) +0:105 'ui' (uniform int) +0:107 Constant: +0:107 0.000000 +0:108 Constant: +0:108 0.000000 +0:109 Constant: +0:109 0.000000 +0:110 Constant: +0:110 0.000000 +0:113 'u' (temp uint) +0:114 'u' (temp uint) +0:115 add second child into first child (temp uint) +0:115 'u' (temp uint) +0:115 min (global uint) +0:115 'u' (temp uint) +0:115 'uui' (uniform uint) +0:116 add second child into first child (temp uint) +0:116 'u' (temp uint) +0:116 max (global uint) +0:116 'u' (temp uint) +0:116 'uui' (uniform uint) +0:117 add second child into first child (temp uint) +0:117 'u' (temp uint) +0:117 clamp (global uint) +0:117 'u' (temp uint) +0:117 'uui' (uniform uint) +0:117 'uui' (uniform uint) +0:118 'u' (temp uint) +0:119 'u' (temp uint) +0:120 'u' (temp uint) +0:121 'i' (temp int) +0:122 'i' (temp int) +0:123 add second child into first child (temp int) +0:123 'i' (temp int) +0:123 'i' (temp int) +0:127 move second child to first child (temp bool) +0:127 'b' (temp bool) +0:127 isnan (global bool) +0:127 'uf' (uniform float) +0:128 move second child to first child (temp bool) +0:128 'b' (temp bool) +0:128 isinf (global bool) +0:128 direct index (temp float) +0:128 'v' (temp 4-component vector of float) +0:128 Constant: +0:128 1 (const int) 0:130 move second child to first child (temp bool) 0:130 'b' (temp bool) 0:130 any (global bool) @@ -868,4 +1146,6 @@ Shader version: 130 0:? 'ub42' (uniform 4-component vector of bool) 0:? 'uf' (uniform float) 0:? 'ui' (uniform int) +0:? 'uuv4' (uniform 4-component vector of uint) +0:? 'uui' (uniform uint) diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 2e9fa85c3..dcd310ea4 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -457,6 +457,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpMatrixTimesVector: case EOpMatrixTimesScalar: + case EOpAnd: + case EOpInclusiveOr: + case EOpExclusiveOr: + case EOpFunctionCall: case EOpReturn: case EOpAssign: