From: Greg Fischer Date: Thu, 2 Sep 2021 16:49:46 +0000 (-0600) Subject: Perform update_precision on constructors and converts X-Git-Tag: upstream/1.3.239~188^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ef6a4cb4d348aa2b2f3895f0beaf9208a2f8d34;p=platform%2Fupstream%2Fglslang.git Perform update_precision on constructors and converts Fixes #2740 --- diff --git a/Test/baseResults/300block.frag.out b/Test/baseResults/300block.frag.out index e5b07dd..1a5bd9b 100644 --- a/Test/baseResults/300block.frag.out +++ b/Test/baseResults/300block.frag.out @@ -24,18 +24,18 @@ ERROR: node is still EOpNull! 0:42 Function Definition: main( ( global void) 0:42 Function Parameters: 0:44 Sequence -0:44 texture ( global lowp 4-component vector of int) +0:44 texture ( global lowp 4-component vector of int, operation at mediump) 0:44 sampler: direct index for structure ( global lowp isampler3D) 0:44 's' ( uniform structure{ global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{ global mediump int a} t}) 0:44 Constant: 0:44 2 (const int) -0:44 Construct vec3 ( temp lowp 3-component vector of float) -0:44 Convert int to float ( temp lowp float) +0:44 Construct vec3 ( temp mediump 3-component vector of float) +0:44 Convert int to float ( temp mediump float) 0:44 ni: direct index for structure (layout( column_major shared) uniform mediump int) 0:44 'inst' (layout( column_major shared) uniform block{layout( column_major shared) uniform mediump 4-component vector of uint nbv, layout( column_major shared) uniform mediump int ni}) 0:44 Constant: 0:44 1 (const int) -0:44 Convert uint to float ( temp lowp float) +0:44 Convert uint to float ( temp mediump float) 0:44 direct index ( temp mediump uint) 0:44 bv: direct index for structure (layout( column_major shared) uniform mediump 4-component vector of uint) 0:44 'anon@0' (layout( column_major shared) uniform block{layout( column_major shared) uniform mediump 4-component vector of uint bv, layout( column_major shared) uniform mediump 2X2 matrix of float bm2, layout( column_major shared) uniform lowp isampler2D sampler, layout( column_major shared) uniform structure{ global mediump int a} t, layout( column_major shared) uniform structure{ global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, layout( column_major) global structure{ global mediump int a} t} fbs}) @@ -43,7 +43,7 @@ ERROR: node is still EOpNull! 0:44 0 (const uint) 0:44 Constant: 0:44 1 (const int) -0:44 Convert uint to float ( temp lowp float) +0:44 Convert uint to float ( temp mediump float) 0:44 direct index ( temp mediump uint) 0:44 nbv: direct index for structure (layout( column_major shared) uniform mediump 4-component vector of uint) 0:44 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform mediump 4-component vector of uint nbv, layout( column_major shared) uniform mediump int ni}) @@ -92,18 +92,18 @@ ERROR: node is still EOpNull! 0:42 Function Definition: main( ( global void) 0:42 Function Parameters: 0:44 Sequence -0:44 texture ( global lowp 4-component vector of int) +0:44 texture ( global lowp 4-component vector of int, operation at mediump) 0:44 sampler: direct index for structure ( global lowp isampler3D) 0:44 's' ( uniform structure{ global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{ global mediump int a} t}) 0:44 Constant: 0:44 2 (const int) -0:44 Construct vec3 ( temp lowp 3-component vector of float) -0:44 Convert int to float ( temp lowp float) +0:44 Construct vec3 ( temp mediump 3-component vector of float) +0:44 Convert int to float ( temp mediump float) 0:44 ni: direct index for structure (layout( column_major shared) uniform mediump int) 0:44 'inst' (layout( column_major shared) uniform block{layout( column_major shared) uniform mediump 4-component vector of uint nbv, layout( column_major shared) uniform mediump int ni}) 0:44 Constant: 0:44 1 (const int) -0:44 Convert uint to float ( temp lowp float) +0:44 Convert uint to float ( temp mediump float) 0:44 direct index ( temp mediump uint) 0:44 bv: direct index for structure (layout( column_major shared) uniform mediump 4-component vector of uint) 0:44 'anon@0' (layout( column_major shared) uniform block{layout( column_major shared) uniform mediump 4-component vector of uint bv, layout( column_major shared) uniform mediump 2X2 matrix of float bm2, layout( column_major shared) uniform lowp isampler2D sampler, layout( column_major shared) uniform structure{ global mediump int a} t, layout( column_major shared) uniform structure{ global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, layout( column_major) global structure{ global mediump int a} t} fbs}) @@ -111,7 +111,7 @@ ERROR: node is still EOpNull! 0:44 0 (const uint) 0:44 Constant: 0:44 1 (const int) -0:44 Convert uint to float ( temp lowp float) +0:44 Convert uint to float ( temp mediump float) 0:44 direct index ( temp mediump uint) 0:44 nbv: direct index for structure (layout( column_major shared) uniform mediump 4-component vector of uint) 0:44 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform mediump 4-component vector of uint nbv, layout( column_major shared) uniform mediump int ni}) diff --git a/Test/baseResults/310.comp.out b/Test/baseResults/310.comp.out index 85b0116..ac76cbd 100644 --- a/Test/baseResults/310.comp.out +++ b/Test/baseResults/310.comp.out @@ -180,7 +180,7 @@ ERROR: node is still EOpNull! 0:91 'i' ( temp highp int) 0:92 imageStore ( global highp void) 0:92 'ii2da' ( writeonly uniform highp iimage2DArray) -0:92 Construct ivec3 ( temp 3-component vector of int) +0:92 Construct ivec3 ( temp highp 3-component vector of int) 0:92 'i' ( temp highp int) 0:92 'i' ( temp highp int) 0:92 'i' ( temp highp int) @@ -189,9 +189,9 @@ ERROR: node is still EOpNull! 0:92 0 (const int) 0:92 0 (const int) 0:92 0 (const int) -0:93 imageLoad ( global mediump 4-component vector of float) +0:93 imageLoad ( global mediump 4-component vector of float, operation at highp) 0:93 'img2Drgba' (layout( rgba32f) readonly uniform mediump image2D) -0:93 Construct ivec2 ( temp mediump 2-component vector of int) +0:93 Construct ivec2 ( temp highp 2-component vector of int) 0:93 'i' ( temp highp int) 0:93 'i' ( temp highp int) 0:94 imageLoad ( global highp 4-component vector of int) diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out index 9f73c67..e43a887 100644 --- a/Test/baseResults/310.frag.out +++ b/Test/baseResults/310.frag.out @@ -270,7 +270,7 @@ ERROR: node is still EOpNull! 0:42 Constant: 0:42 0.000000 0:42 0.000000 -0:42 Convert float to int ( temp highp 2-component vector of int) +0:42 Convert float to int ( temp mediump 2-component vector of int) 0:42 'c2D' ( smooth in mediump 2-component vector of float) 0:43 textureProjGradOffset ( global highp 4-component vector of uint) 0:43 'usamp2d' ( uniform highp usampler2D) @@ -471,7 +471,7 @@ ERROR: node is still EOpNull! 0:211 Constant: 0:211 0.100000 0:211 0.100000 -0:211 Convert float to int ( temp highp 2-component vector of int) +0:211 Convert float to int ( temp mediump 2-component vector of int) 0:211 'inf' ( smooth in mediump 2-component vector of float) 0:212 textureGatherOffsets ( global highp 4-component vector of float) 0:212 direct index ( temp highp sampler2D) @@ -507,7 +507,7 @@ ERROR: node is still EOpNull! 0:221 Constant: 0:221 0.100000 0:221 0.100000 -0:221 Convert float to int ( temp highp 2-component vector of int) +0:221 Convert float to int ( temp mediump 2-component vector of int) 0:221 'inf' ( smooth in mediump 2-component vector of float) 0:222 textureGatherOffsets ( global highp 4-component vector of float) 0:222 direct index ( temp highp sampler2D) diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out index 1d2152d..13a88df 100644 --- a/Test/baseResults/310.vert.out +++ b/Test/baseResults/310.vert.out @@ -330,7 +330,7 @@ ERROR: node is still EOpNull! 0:164 'sIndex' ( uniform highp int) 0:164 Constant: 0:164 2 (const int) -0:165 textureGatherOffset ( global lowp 4-component vector of float) +0:165 textureGatherOffset ( global lowp 4-component vector of float, operation at highp) 0:165 direct index ( temp lowp sampler2D) 0:165 'sArray' ( uniform 4-element array of lowp sampler2D) 0:165 Constant: @@ -338,7 +338,7 @@ ERROR: node is still EOpNull! 0:165 Constant: 0:165 0.100000 0:165 0.100000 -0:165 Convert float to int ( temp lowp 2-component vector of int) +0:165 Convert float to int ( temp highp 2-component vector of int) 0:165 'inf' ( in highp 2-component vector of float) 0:166 textureGatherOffsets ( global lowp 4-component vector of float, operation at highp) 0:166 direct index ( temp lowp sampler2D) @@ -394,7 +394,7 @@ ERROR: node is still EOpNull! 0:179 'sIndex' ( uniform highp int) 0:179 Constant: 0:179 2 (const int) -0:180 textureGatherOffset ( global lowp 4-component vector of float) +0:180 textureGatherOffset ( global lowp 4-component vector of float, operation at highp) 0:180 direct index ( temp lowp sampler2D) 0:180 'sArray' ( uniform 4-element array of lowp sampler2D) 0:180 Constant: @@ -402,7 +402,7 @@ ERROR: node is still EOpNull! 0:180 Constant: 0:180 0.100000 0:180 0.100000 -0:180 Convert float to int ( temp lowp 2-component vector of int) +0:180 Convert float to int ( temp highp 2-component vector of int) 0:180 'inf' ( in highp 2-component vector of float) 0:181 textureGatherOffsets ( global lowp 4-component vector of float, operation at highp) 0:181 direct index ( temp lowp sampler2D) diff --git a/Test/baseResults/320.frag.out b/Test/baseResults/320.frag.out index 002aa7f..9f4a817 100644 --- a/Test/baseResults/320.frag.out +++ b/Test/baseResults/320.frag.out @@ -121,7 +121,7 @@ ERROR: node is still EOpNull! 0:76 'inf' ( smooth in mediump 2-component vector of float) 0:76 'ing' ( smooth in mediump 2-component vector of float) 0:76 'h' ( noContraction temp mediump 2-component vector of float) -0:77 textureGatherOffset ( global lowp 4-component vector of float) +0:77 textureGatherOffset ( global lowp 4-component vector of float, operation at mediump) 0:77 direct index ( temp lowp sampler2D) 0:77 'sArray' ( uniform 4-element array of lowp sampler2D) 0:77 Constant: @@ -129,7 +129,7 @@ ERROR: node is still EOpNull! 0:77 Constant: 0:77 0.100000 0:77 0.100000 -0:77 Convert float to int ( temp lowp 2-component vector of int) +0:77 Convert float to int ( temp mediump 2-component vector of int) 0:77 'inf' ( smooth in mediump 2-component vector of float) 0:78 textureGatherOffsets ( global lowp 4-component vector of float, operation at mediump) 0:78 direct index ( temp lowp sampler2D) diff --git a/Test/baseResults/320.vert.out b/Test/baseResults/320.vert.out index 0313b61..5e80d14 100644 --- a/Test/baseResults/320.vert.out +++ b/Test/baseResults/320.vert.out @@ -99,7 +99,7 @@ ERROR: node is still EOpNull! 0:70 'sIndex' ( uniform highp int) 0:70 Constant: 0:70 2 (const int) -0:71 textureGatherOffset ( global lowp 4-component vector of float) +0:71 textureGatherOffset ( global lowp 4-component vector of float, operation at highp) 0:71 direct index ( temp lowp sampler2D) 0:71 'sArray' ( uniform 4-element array of lowp sampler2D) 0:71 Constant: @@ -107,7 +107,7 @@ ERROR: node is still EOpNull! 0:71 Constant: 0:71 0.100000 0:71 0.100000 -0:71 Convert float to int ( temp lowp 2-component vector of int) +0:71 Convert float to int ( temp highp 2-component vector of int) 0:71 'inf' ( in highp 2-component vector of float) 0:72 textureGatherOffsets ( global lowp 4-component vector of float, operation at highp) 0:72 direct index ( temp lowp sampler2D) diff --git a/Test/baseResults/glsl.es320.subgroup.geom.out b/Test/baseResults/glsl.es320.subgroup.geom.out index 5d18d30..eab5454 100644 --- a/Test/baseResults/glsl.es320.subgroup.geom.out +++ b/Test/baseResults/glsl.es320.subgroup.geom.out @@ -16,7 +16,7 @@ output primitive = points 0:12 Constant: 0:12 0 (const uint) 0:12 'gl_PrimitiveIDIn' ( in highp int PrimitiveID) -0:12 Construct uvec4 ( temp highp 4-component vector of uint) +0:12 Construct uvec4 ( temp mediump 4-component vector of uint) 0:12 'gl_SubgroupSize' ( in mediump uint SubgroupSize) 0:12 'gl_SubgroupInvocationID' ( in mediump uint SubgroupInvocationID) 0:12 Constant: @@ -47,7 +47,7 @@ output primitive = points 0:12 Constant: 0:12 0 (const uint) 0:12 'gl_PrimitiveIDIn' ( in highp int PrimitiveID) -0:12 Construct uvec4 ( temp highp 4-component vector of uint) +0:12 Construct uvec4 ( temp mediump 4-component vector of uint) 0:12 'gl_SubgroupSize' ( in mediump uint SubgroupSize) 0:12 'gl_SubgroupInvocationID' ( in mediump uint SubgroupInvocationID) 0:12 Constant: diff --git a/Test/baseResults/glsl.es320.subgroup.tesc.out b/Test/baseResults/glsl.es320.subgroup.tesc.out index 9512bc5..431a3c3 100644 --- a/Test/baseResults/glsl.es320.subgroup.tesc.out +++ b/Test/baseResults/glsl.es320.subgroup.tesc.out @@ -13,7 +13,7 @@ vertices = 1 0:11 Constant: 0:11 0 (const uint) 0:11 'gl_PrimitiveID' ( in highp int PrimitiveID) -0:11 Construct uvec4 ( temp highp 4-component vector of uint) +0:11 Construct uvec4 ( temp mediump 4-component vector of uint) 0:11 'gl_SubgroupSize' ( in mediump uint SubgroupSize) 0:11 'gl_SubgroupInvocationID' ( in mediump uint SubgroupInvocationID) 0:11 Constant: @@ -41,7 +41,7 @@ vertices = 1 0:11 Constant: 0:11 0 (const uint) 0:11 'gl_PrimitiveID' ( in highp int PrimitiveID) -0:11 Construct uvec4 ( temp highp 4-component vector of uint) +0:11 Construct uvec4 ( temp mediump 4-component vector of uint) 0:11 'gl_SubgroupSize' ( in mediump uint SubgroupSize) 0:11 'gl_SubgroupInvocationID' ( in mediump uint SubgroupInvocationID) 0:11 Constant: diff --git a/Test/baseResults/glsl.es320.subgroup.tese.out b/Test/baseResults/glsl.es320.subgroup.tese.out index 29f7b73..198a757 100644 --- a/Test/baseResults/glsl.es320.subgroup.tese.out +++ b/Test/baseResults/glsl.es320.subgroup.tese.out @@ -15,7 +15,7 @@ triangle order = none 0:11 Constant: 0:11 0 (const uint) 0:11 'gl_PrimitiveID' ( in highp int PrimitiveID) -0:11 Construct uvec4 ( temp highp 4-component vector of uint) +0:11 Construct uvec4 ( temp mediump 4-component vector of uint) 0:11 'gl_SubgroupSize' ( in mediump uint SubgroupSize) 0:11 'gl_SubgroupInvocationID' ( in mediump uint SubgroupInvocationID) 0:11 Constant: @@ -45,7 +45,7 @@ triangle order = ccw 0:11 Constant: 0:11 0 (const uint) 0:11 'gl_PrimitiveID' ( in highp int PrimitiveID) -0:11 Construct uvec4 ( temp highp 4-component vector of uint) +0:11 Construct uvec4 ( temp mediump 4-component vector of uint) 0:11 'gl_SubgroupSize' ( in mediump uint SubgroupSize) 0:11 'gl_SubgroupInvocationID' ( in mediump uint SubgroupInvocationID) 0:11 Constant: diff --git a/Test/baseResults/glsl.es320.subgroup.vert.out b/Test/baseResults/glsl.es320.subgroup.vert.out index bf1da49..e1a6bea 100644 --- a/Test/baseResults/glsl.es320.subgroup.vert.out +++ b/Test/baseResults/glsl.es320.subgroup.vert.out @@ -12,7 +12,7 @@ Requested GL_KHR_shader_subgroup_basic 0:10 Constant: 0:10 0 (const uint) 0:10 'gl_VertexID' ( gl_VertexId highp int VertexId) -0:10 Construct uvec4 ( temp highp 4-component vector of uint) +0:10 Construct uvec4 ( temp mediump 4-component vector of uint) 0:10 'gl_SubgroupSize' ( in mediump uint SubgroupSize) 0:10 'gl_SubgroupInvocationID' ( in mediump uint SubgroupInvocationID) 0:10 Constant: @@ -41,7 +41,7 @@ Requested GL_KHR_shader_subgroup_basic 0:10 Constant: 0:10 0 (const uint) 0:10 'gl_VertexID' ( gl_VertexId highp int VertexId) -0:10 Construct uvec4 ( temp highp 4-component vector of uint) +0:10 Construct uvec4 ( temp mediump 4-component vector of uint) 0:10 'gl_SubgroupSize' ( in mediump uint SubgroupSize) 0:10 'gl_SubgroupInvocationID' ( in mediump uint SubgroupInvocationID) 0:10 Constant: diff --git a/Test/baseResults/spv.ext.AnyHitShader.rahit.out b/Test/baseResults/spv.ext.AnyHitShader.rahit.out index 7bcf812..880be33 100644 --- a/Test/baseResults/spv.ext.AnyHitShader.rahit.out +++ b/Test/baseResults/spv.ext.AnyHitShader.rahit.out @@ -73,6 +73,7 @@ spv.ext.AnyHitShader.rahit Decorate 98(gl_SubgroupSize) RelaxedPrecision Decorate 98(gl_SubgroupSize) BuiltIn SubgroupSize Decorate 99 RelaxedPrecision + Decorate 100 RelaxedPrecision 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 diff --git a/Test/baseResults/spv.ext.ClosestHitShader_Subgroup.rchit.out b/Test/baseResults/spv.ext.ClosestHitShader_Subgroup.rchit.out index 14ec09b..7f5af89 100644 --- a/Test/baseResults/spv.ext.ClosestHitShader_Subgroup.rchit.out +++ b/Test/baseResults/spv.ext.ClosestHitShader_Subgroup.rchit.out @@ -38,10 +38,21 @@ spv.ext.ClosestHitShader_Subgroup.rchit Decorate 28(gl_SubgroupInvocationID) RelaxedPrecision Decorate 28(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId Decorate 29 RelaxedPrecision + Decorate 30 RelaxedPrecision Decorate 34(gl_SubGroupGeMaskARB) BuiltIn SubgroupGeMaskKHR + Decorate 41 RelaxedPrecision + Decorate 42 RelaxedPrecision Decorate 43(gl_SubgroupGtMask) BuiltIn SubgroupGtMaskKHR + Decorate 46 RelaxedPrecision + Decorate 46 RelaxedPrecision + Decorate 47 RelaxedPrecision Decorate 48(gl_SubgroupLeMask) BuiltIn SubgroupLeMaskKHR + Decorate 51 RelaxedPrecision + Decorate 51 RelaxedPrecision + Decorate 52 RelaxedPrecision Decorate 53(gl_SubGroupLtMaskARB) BuiltIn SubgroupLtMaskKHR + Decorate 59 RelaxedPrecision + Decorate 60 RelaxedPrecision Decorate 61(gl_SMIDNV) BuiltIn SMIDNV 2: TypeVoid 3: TypeFunction 2 diff --git a/Test/baseResults/spv.precise.tese.out b/Test/baseResults/spv.precise.tese.out index a23b073..7db4ed0 100644 --- a/Test/baseResults/spv.precise.tese.out +++ b/Test/baseResults/spv.precise.tese.out @@ -36,10 +36,6 @@ spv.precise.tese Decorate 43 NoContraction Decorate 62(in_f_color) RelaxedPrecision Decorate 62(in_f_color) Location 0 - Decorate 67 RelaxedPrecision - Decorate 68 RelaxedPrecision - Decorate 69 RelaxedPrecision - Decorate 70 RelaxedPrecision Decorate 97 NoContraction Decorate 99 NoContraction Decorate 101 NoContraction diff --git a/Test/baseResults/spv.subgroup.frag.out b/Test/baseResults/spv.subgroup.frag.out index ad11586..a3e427f 100644 --- a/Test/baseResults/spv.subgroup.frag.out +++ b/Test/baseResults/spv.subgroup.frag.out @@ -24,6 +24,7 @@ spv.subgroup.frag Decorate 13(gl_SubgroupInvocationID) Flat Decorate 13(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 diff --git a/Test/baseResults/spv.subgroup.geom.out b/Test/baseResults/spv.subgroup.geom.out index c866f8e..27f05b2 100644 --- a/Test/baseResults/spv.subgroup.geom.out +++ b/Test/baseResults/spv.subgroup.geom.out @@ -33,6 +33,7 @@ spv.subgroup.geom Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId Decorate 21 RelaxedPrecision + Decorate 23 RelaxedPrecision 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 diff --git a/Test/baseResults/spv.subgroup.tesc.out b/Test/baseResults/spv.subgroup.tesc.out index ed6b5c1..8322a4a 100644 --- a/Test/baseResults/spv.subgroup.tesc.out +++ b/Test/baseResults/spv.subgroup.tesc.out @@ -30,6 +30,7 @@ spv.subgroup.tesc Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId Decorate 21 RelaxedPrecision + Decorate 23 RelaxedPrecision 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 diff --git a/Test/baseResults/spv.subgroup.tese.out b/Test/baseResults/spv.subgroup.tese.out index 70cdc96..360f98b 100644 --- a/Test/baseResults/spv.subgroup.tese.out +++ b/Test/baseResults/spv.subgroup.tese.out @@ -32,6 +32,7 @@ spv.subgroup.tese Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId Decorate 21 RelaxedPrecision + Decorate 23 RelaxedPrecision 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 diff --git a/Test/baseResults/spv.subgroup.vert.out b/Test/baseResults/spv.subgroup.vert.out index 34b090d..6de8a0a 100644 --- a/Test/baseResults/spv.subgroup.vert.out +++ b/Test/baseResults/spv.subgroup.vert.out @@ -29,6 +29,7 @@ spv.subgroup.vert Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId Decorate 21 RelaxedPrecision + Decorate 23 RelaxedPrecision 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 diff --git a/Test/baseResults/spv.uint.frag.out b/Test/baseResults/spv.uint.frag.out index c19064d..7dbc3b3 100644 --- a/Test/baseResults/spv.uint.frag.out +++ b/Test/baseResults/spv.uint.frag.out @@ -75,6 +75,7 @@ spv.uint.frag Decorate 90 RelaxedPrecision Decorate 91 RelaxedPrecision Decorate 92 RelaxedPrecision + Decorate 93 RelaxedPrecision Decorate 97 RelaxedPrecision Decorate 98 RelaxedPrecision Decorate 101 RelaxedPrecision diff --git a/Test/baseResults/uint.frag.out b/Test/baseResults/uint.frag.out index 3a12d6b..ce6d02d 100644 --- a/Test/baseResults/uint.frag.out +++ b/Test/baseResults/uint.frag.out @@ -134,7 +134,7 @@ ERROR: node is still EOpNull! 0:59 Condition 0:59 Compare Equal ( temp bool) 0:59 'shiftedii' ( temp mediump int) -0:59 Convert uint to int ( temp int) +0:59 Convert uint to int ( temp mediump int) 0:59 'shiftedui' ( temp mediump uint) 0:59 true case 0:60 move second child to first child ( temp mediump 4-component vector of uint) @@ -433,7 +433,7 @@ ERROR: node is still EOpNull! 0:59 Condition 0:59 Compare Equal ( temp bool) 0:59 'shiftedii' ( temp mediump int) -0:59 Convert uint to int ( temp int) +0:59 Convert uint to int ( temp mediump int) 0:59 'shiftedui' ( temp mediump uint) 0:59 true case 0:60 move second child to first child ( temp mediump 4-component vector of uint) diff --git a/Test/baseResults/vulkan.ast.vert.out b/Test/baseResults/vulkan.ast.vert.out index 05a6355..68e892b 100644 --- a/Test/baseResults/vulkan.ast.vert.out +++ b/Test/baseResults/vulkan.ast.vert.out @@ -19,10 +19,10 @@ Shader version: 450 0:14 Convert bool to float ( temp float) 0:14 'scbt' ( specialization-constant const bool) 0:14 true (const bool) -0:15 Convert int to float ( temp float) +0:15 Convert int to float ( temp highp float) 0:15 'sci2' ( specialization-constant const highp int) 0:15 2 (const int) -0:17 Convert float to int ( temp int) +0:17 Convert float to int ( temp highp int) 0:17 'scf1' ( specialization-constant const highp float) 0:17 1.000000 0:18 Convert bool to int ( specialization-constant const int) @@ -86,34 +86,34 @@ Shader version: 450 0:35 2 (const int) 0:35 'sci2' ( specialization-constant const highp int) 0:35 2 (const int) -0:37 Construct ivec2 ( specialization-constant const 2-component vector of int) +0:37 Construct ivec2 ( specialization-constant const highp 2-component vector of int) 0:37 'sci2' ( specialization-constant const highp int) 0:37 2 (const int) 0:37 'sci2' ( specialization-constant const highp int) 0:37 2 (const int) -0:38 Construct ivec2 ( temp 2-element array of 2-component vector of int) -0:38 Construct ivec2 ( specialization-constant const 2-component vector of int) +0:38 Construct ivec2 ( temp 2-element array of highp 2-component vector of int) +0:38 Construct ivec2 ( specialization-constant const highp 2-component vector of int) 0:38 'sci2' ( specialization-constant const highp int) 0:38 2 (const int) 0:38 'sci2' ( specialization-constant const highp int) 0:38 2 (const int) -0:38 Construct ivec2 ( specialization-constant const 2-component vector of int) +0:38 Construct ivec2 ( specialization-constant const highp 2-component vector of int) 0:38 'sci2' ( specialization-constant const highp int) 0:38 2 (const int) 0:38 'sci2' ( specialization-constant const highp int) 0:38 2 (const int) -0:40 Construct vec2 ( specialization-constant const 2-component vector of float) +0:40 Construct vec2 ( specialization-constant const highp 2-component vector of float) 0:40 'scf1' ( specialization-constant const highp float) 0:40 1.000000 0:40 'scf1' ( specialization-constant const highp float) 0:40 1.000000 -0:41 Construct vec2 ( temp 2-element array of 2-component vector of float) -0:41 Construct vec2 ( specialization-constant const 2-component vector of float) +0:41 Construct vec2 ( temp 2-element array of highp 2-component vector of float) +0:41 Construct vec2 ( specialization-constant const highp 2-component vector of float) 0:41 'scf1' ( specialization-constant const highp float) 0:41 1.000000 0:41 'scf1' ( specialization-constant const highp float) 0:41 1.000000 -0:41 Construct vec2 ( specialization-constant const 2-component vector of float) +0:41 Construct vec2 ( specialization-constant const highp 2-component vector of float) 0:41 'scf1' ( specialization-constant const highp float) 0:41 1.000000 0:41 'scf1' ( specialization-constant const highp float) @@ -150,10 +150,10 @@ Shader version: 450 0:14 Convert bool to float ( temp float) 0:14 'scbt' ( specialization-constant const bool) 0:14 true (const bool) -0:15 Convert int to float ( temp float) +0:15 Convert int to float ( temp highp float) 0:15 'sci2' ( specialization-constant const highp int) 0:15 2 (const int) -0:17 Convert float to int ( temp int) +0:17 Convert float to int ( temp highp int) 0:17 'scf1' ( specialization-constant const highp float) 0:17 1.000000 0:18 Convert bool to int ( specialization-constant const int) @@ -217,34 +217,34 @@ Shader version: 450 0:35 2 (const int) 0:35 'sci2' ( specialization-constant const highp int) 0:35 2 (const int) -0:37 Construct ivec2 ( specialization-constant const 2-component vector of int) +0:37 Construct ivec2 ( specialization-constant const highp 2-component vector of int) 0:37 'sci2' ( specialization-constant const highp int) 0:37 2 (const int) 0:37 'sci2' ( specialization-constant const highp int) 0:37 2 (const int) -0:38 Construct ivec2 ( temp 2-element array of 2-component vector of int) -0:38 Construct ivec2 ( specialization-constant const 2-component vector of int) +0:38 Construct ivec2 ( temp 2-element array of highp 2-component vector of int) +0:38 Construct ivec2 ( specialization-constant const highp 2-component vector of int) 0:38 'sci2' ( specialization-constant const highp int) 0:38 2 (const int) 0:38 'sci2' ( specialization-constant const highp int) 0:38 2 (const int) -0:38 Construct ivec2 ( specialization-constant const 2-component vector of int) +0:38 Construct ivec2 ( specialization-constant const highp 2-component vector of int) 0:38 'sci2' ( specialization-constant const highp int) 0:38 2 (const int) 0:38 'sci2' ( specialization-constant const highp int) 0:38 2 (const int) -0:40 Construct vec2 ( specialization-constant const 2-component vector of float) +0:40 Construct vec2 ( specialization-constant const highp 2-component vector of float) 0:40 'scf1' ( specialization-constant const highp float) 0:40 1.000000 0:40 'scf1' ( specialization-constant const highp float) 0:40 1.000000 -0:41 Construct vec2 ( temp 2-element array of 2-component vector of float) -0:41 Construct vec2 ( specialization-constant const 2-component vector of float) +0:41 Construct vec2 ( temp 2-element array of highp 2-component vector of float) +0:41 Construct vec2 ( specialization-constant const highp 2-component vector of float) 0:41 'scf1' ( specialization-constant const highp float) 0:41 1.000000 0:41 'scf1' ( specialization-constant const highp float) 0:41 1.000000 -0:41 Construct vec2 ( specialization-constant const 2-component vector of float) +0:41 Construct vec2 ( specialization-constant const highp 2-component vector of float) 0:41 'scf1' ( specialization-constant const highp float) 0:41 1.000000 0:41 'scf1' ( specialization-constant const highp float) diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index 1e6ab4a..595bd62 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -1643,6 +1643,7 @@ public: ~TIntermAggregate() { delete pragmaTable; } virtual TIntermAggregate* getAsAggregate() { return this; } virtual const TIntermAggregate* getAsAggregate() const { return this; } + virtual void updatePrecision(); virtual void setOperator(TOperator o) { op = o; } virtual TIntermSequence& getSequence() { return sequence; } virtual const TIntermSequence& getSequence() const { return sequence; } diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 0278445..1283f44 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -416,20 +416,24 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, // TODO: but, did this bypass constant folding? // switch (op) { - case EOpConstructInt8: - case EOpConstructUint8: - case EOpConstructInt16: - case EOpConstructUint16: - case EOpConstructInt: - case EOpConstructUint: - case EOpConstructInt64: - case EOpConstructUint64: - case EOpConstructBool: - case EOpConstructFloat: - case EOpConstructDouble: - case EOpConstructFloat16: - return child; - default: break; // some compilers want this + case EOpConstructInt8: + case EOpConstructUint8: + case EOpConstructInt16: + case EOpConstructUint16: + case EOpConstructInt: + case EOpConstructUint: + case EOpConstructInt64: + case EOpConstructUint64: + case EOpConstructBool: + case EOpConstructFloat: + case EOpConstructDouble: + case EOpConstructFloat16: { + TIntermUnary* unary_node = child->getAsUnaryNode(); + if (unary_node != nullptr) + unary_node->updatePrecision(); + return child; + } + default: break; // some compilers want this } // @@ -3778,6 +3782,28 @@ bool TIntermediate::promoteAggregate(TIntermAggregate& node) // Propagate precision qualifiers *up* from children to parent, and then // back *down* again to the children's subtrees. +void TIntermAggregate::updatePrecision() +{ + if (getBasicType() == EbtInt || getBasicType() == EbtUint || + getBasicType() == EbtFloat || getBasicType() == EbtFloat16) { + TPrecisionQualifier maxPrecision = EpqNone; + TIntermSequence operands = getSequence(); + for (unsigned int i = 0; i < operands.size(); ++i) { + TIntermTyped* typedNode = operands[i]->getAsTyped(); + assert(typedNode); + maxPrecision = std::max(maxPrecision, typedNode->getQualifier().precision); + } + getQualifier().precision = maxPrecision; + for (unsigned int i = 0; i < operands.size(); ++i) { + TIntermTyped* typedNode = operands[i]->getAsTyped(); + assert(typedNode); + typedNode->propagatePrecision(maxPrecision); + } + } +} + +// Propagate precision qualifiers *up* from children to parent, and then +// back *down* again to the children's subtrees. void TIntermBinary::updatePrecision() { if (getBasicType() == EbtInt || getBasicType() == EbtUint || diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index b957bb8..a2dd5a6 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -7691,7 +7691,13 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode* return nullptr; } - return intermediate.setAggregateOperator(aggrNode, op, type, loc); + TIntermTyped *ret_node = intermediate.setAggregateOperator(aggrNode, op, type, loc); + + TIntermAggregate *agg_node = ret_node->getAsAggregate(); + if (agg_node && agg_node->isVector()) + agg_node->updatePrecision(); + + return ret_node; } // Function for constructor implementation. Calls addUnaryMath with appropriate EOp value