yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
3357d870
16.3.0
1#version 450 2#extension GL_EXT_tessellation_shader : require 3#extension GL_EXT_gpu_shader5 : require 4 5float minimal () { 6precise float result = 5.0 ; 7float a = 10.0 ; 8float b = 20.0 ; 9float c = 30.0 ; 10float d = 40.0 ; 11result = a * b + c * d ; // c * d, a * b and rvalue1 + rvalue2 should be 'noContraction'. 12return result ; 13} 14 15void continuous_assignment () { 16precise float result = 5.0 ; 17float a = 10.0 ; 18float b = 20.0 ; 19result = a = b + 4 ; // b + 4 should be 'noContraction'. 20} 21 22void convert () { 23precise double result ; 24float a = 10.0 ; 25float b = 20.0 ; 26b = a + b ; // a + b should be 'noContraction'. 27result = double ( b ) ; // convert operation should not be 'noContraction'. 28} 29 30float loop_for () { 31precise float r1 = 5.0 ; 32precise float r2 = 10.0 ; 33int a = 10 ; 34int b = 20 ; 35int c = 30 ; 36for ( int i = 0 ; i < a ; i ++ ) { 37r1 += 3.12 + b + i ; // 'noContration', this make i++ also 'noContraction' 38c += 1 ; // 'noContration' 39} 40a += 1 ; // a + 1 should not be 'noContraction'. 41r2 = c ; // The calculation of c should be 'noContration'. 42return float ( r1 + r2 ) ; // conversion should not be 'noContration'. 43} 44 45void loop_array ( void ) { 46precise float result ; 47 48int x = 22 ; 49int y = 33 ; 50 51float a0 [ 3 ] ; 52result += float ( x ) + float ( y ) ; // x + y should be 'noContraction' also result + rvalue. 53 54for ( int i = 0 ; i < 3 ; ++ i ) { 55// a's dereference + 2 should be 'noContraction'. 56result += a0 [ i ] + 2 ; 57// result + 1 and 3 - rvalue should be 'noContraction'. 58a0 [ i ] = 3 - result ++ ; 59} 60} 61 62void loop_while () { 63precise float result = 5.0 ; 64int a = 10 ; 65int b = 20 ; 66while ( result < 10 ) { 67result += 3.12 + b ; // result + 3.12 should be 'noContraction'. 68} 69result = a + b + 5 ; // b + 5 should not be 'noCtraction' because all operands are integers. 70result = 11.1 ; 71} 72 73float fma_not_decorated () { 74precise float result ; 75float a = 1.0 ; 76float b = 2.0 ; 77float c = 3.0 ; 78b = b + c ; // b + c should be decorated with 'noContraction' 79result = fma ( a , b , c ) ; // fma() should not be decorated with 'noContradtion' 80return result ; 81} 82 83precise float precise_return_exp_func () { 84float a = 1.0 ; 85float b = 2.0 ; 86return a + b ; // the ADD operation should be 'noContraction' 87} 88 89precise float precise_return_val_func () { 90float a = 1.0 ; 91float b = 2.0 ; 92float result = a + b ; // the ADD operation should be 'noContraction' 93return result ; 94} 95 96float precise_func_parameter ( float b , precise out float c ) { 97float a = 0.5 ; 98c = a + b ; // noContration 99return a - b ; // Not noContraction 100} 101 102mat3 matrix ( mat2x3 a , mat3x2 b ) { 103mat2x3 c = mat2x3 ( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ) ; 104precise mat3 result ; 105result = ( a + c ) * b ; // should be noContraction 106return result ; 107} 108 109void main (){}