1#version 450 2 3uniform sampler s; // ERROR, no binding 4uniform sampler sA[4]; // ERROR, no binding 5uniform texture2D t2d; // ERROR, no binding 6uniform texture3D t3d[4]; // ERROR, no binding 7int i; 8uniform samplerShadow sShadow; 9uniform texture3D t3d5[5]; 10writeonly uniform image2D i2d; 11 12void badConst() 13{ 14 sampler2D(t2d); // ERROR, need 2 args 15 sampler2D(s, s); // ERROR, wrong type 16 sampler2D(i, i); // ERROR, wrong type 17 sampler2D(t2d, i); // ERROR, wrong type 18 sampler2D(t2d, t2d); // ERROR, wrong type 19 sampler2D(t2d, sA); // ERROR, wrong type 20 21 sampler3D[4](t3d5, sA[2]); // ERROR, can't make array 22 sampler2D(i2d, s); // ERROR, image instead of texture 23 sampler2D(t3d[1], s); // ERROR, 3D not 2D 24 sampler2D(t2d, sShadow); 25 sampler2DShadow(t2d, s); 26} 27 28sampler2D s2D = sampler2D(t2d, s); // ERROR, no sampler constructor 29sampler3D s3d[4] = sampler3D[4](t3d, sA[2]); // ERROR, no sampler constructor 30 31out vec4 color; // ERROR, no location 32 33void main() 34{ 35 color = texture(s2D, vec2(0.5)); 36 color += texture(s3d[i], vec3(0.5)); 37} 38 39layout(push_constant) buffer pcb { // ERROR, not on a buffer 40 int a; 41} pcbInst; 42 43layout(push_constant) uniform float pcfloat; // ERROR 2X: not on a non-block, and non-opaque outside block 44 45layout(push_constant) uniform; // ERROR, needs an object 46layout(std430, push_constant) uniform pcb1 { int a; } pcb1inst; 47layout(push_constant) uniform pcb2 { 48 int a; 49}; // Okay now to have no instance name 50 51layout(input_attachment_index = 2) uniform subpassInput subD; 52layout(input_attachment_index = 3) uniform texture2D subDbad1; // ERROR, not a texture 53layout(input_attachment_index = 4) writeonly uniform image2D subDbad2; // ERROR, not an image 54uniform subpassInput subDbad3; // ERROR, need attachment number 55layout(input_attachment_index = 2) uniform subpassInputMS subDMS; 56 57void foo() 58{ 59 vec4 v = subpassLoad(subD); 60 v += subpassLoadMS(subD); // ERROR, no such function 61 v += subpassLoad(subD, 2); // ERROR, no such sig. 62 v += subpassLoad(subDMS, 2); 63 v += subpassLoadMS(subDMS, 2); // ERROR, no such function 64} 65 66subroutine int fooS; // ERROR, not in SPV 67subroutine int fooSub(); // ERROR, not in SPV 68 69uniform vec4 dv4; // ERROR, no default uniforms 70 71void fooTex() 72{ 73 texture(t2d, vec2(1.0)); // ERROR, need a sampler, not a pure texture 74 imageStore(t2d, ivec2(4, 5), vec4(1.2)); // ERROR, need an image, not a pure texture 75} 76 77precision highp float; 78 79layout(location=0) in vec2 vTexCoord; 80layout(location=0) out vec4 FragColor; 81 82vec4 userTexture(mediump sampler2D samp, vec2 coord) 83{ 84 return texture(samp, coord); 85} 86 87bool cond; 88 89void callUserTexture() 90{ 91 userTexture(sampler2D(t2d,s), vTexCoord); // ERROR, not point of use 92 userTexture((sampler2D(t2d,s)), vTexCoord); // ERROR, not point of use 93 userTexture((sampler2D(t2d,s), sampler2D(t2d,s)), vTexCoord); // ERROR, not point of use 94 userTexture(cond ? sampler2D(t2d,s) : sampler2D(t2d,s), vTexCoord); // ERROR, no ?:, not point of use 95 96 gl_NumSamples; // ERROR, not for Vulkan 97} 98 99void noise() 100{ 101 noise1(dv4); 102 noise2(4.0); 103 noise3(vec2(3)); 104 noise4(dv4); 105} 106