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(binding=2, push_constant) uniform pcbnd1 { // ERROR, can't have binding 47 int a; 48} pcbnd1inst; 49layout(push_constant) uniform pcbnd2 { // ERROR, can't be array 50 float a; 51} pcbnd2inst[2]; 52layout(std430, push_constant) uniform pcb1 { int a; } pcb1inst; 53layout(push_constant) uniform pcb2 { 54 int a; 55}; // Okay now to have no instance name 56 57layout(input_attachment_index = 2) uniform subpassInput subD; 58layout(input_attachment_index = 3) uniform texture2D subDbad1; // ERROR, not a texture 59layout(input_attachment_index = 4) writeonly uniform image2D subDbad2; // ERROR, not an image 60uniform subpassInput subDbad3; // ERROR, need attachment number 61layout(input_attachment_index = 2) uniform subpassInputMS subDMS; 62 63void foo() 64{ 65 vec4 v = subpassLoad(subD); 66 v += subpassLoadMS(subD); // ERROR, no such function 67 v += subpassLoad(subD, 2); // ERROR, no such sig. 68 v += subpassLoad(subDMS, 2); 69 v += subpassLoadMS(subDMS, 2); // ERROR, no such function 70} 71 72subroutine int fooS; // ERROR, not in SPV 73subroutine int fooSub(); // ERROR, not in SPV 74 75uniform vec4 dv4; // ERROR, no default uniforms 76 77void fooTex() 78{ 79 texture(t2d, vec2(1.0)); // ERROR, need a sampler, not a pure texture 80 imageStore(t2d, ivec2(4, 5), vec4(1.2)); // ERROR, need an image, not a pure texture 81} 82 83precision highp float; 84 85layout(location=0) in vec2 vTexCoord; 86layout(location=0) out vec4 FragColor; 87 88vec4 userTexture(mediump sampler2D samp, vec2 coord) 89{ 90 return texture(samp, coord); 91} 92 93bool cond; 94 95void callUserTexture() 96{ 97 userTexture(sampler2D(t2d,s), vTexCoord); // ERROR, not point of use 98 userTexture((sampler2D(t2d,s)), vTexCoord); // ERROR, not point of use 99 userTexture((sampler2D(t2d,s), sampler2D(t2d,s)), vTexCoord); // ERROR, not point of use 100 userTexture(cond ? sampler2D(t2d,s) : sampler2D(t2d,s), vTexCoord); // ERROR, no ?:, not point of use 101 102 gl_NumSamples; // ERROR, not for Vulkan 103} 104 105void noise() 106{ 107 noise1(dv4); 108 noise2(4.0); 109 noise3(vec2(3)); 110 noise4(dv4); 111} 112