John Kessenich | 6c292d3 | 2016-02-15 20:58:50 -0700 | [diff] [blame] | 1 | #version 450
|
| 2 |
|
| 3 | uniform sampler s;
|
| 4 | uniform sampler sA[4];
|
| 5 | uniform texture2D t2d;
|
| 6 | uniform texture3D t3d[4];
|
| 7 | int i;
|
| 8 | uniform samplerShadow sShadow;
|
| 9 | uniform texture3D t3d5[5];
|
| 10 | writeonly uniform image2D i2d;
|
| 11 |
|
| 12 | void 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); // ERROR, shadow mismatch
|
| 25 | sampler2DShadow(t2d, s); // ERROR, shadow mismatch
|
| 26 | }
|
| 27 |
|
| 28 | sampler2D s2D = sampler2D(t2d, s); // ERROR, no sampler constructor
|
| 29 | sampler3D s3d[4] = sampler3D[4](t3d, sA[2]); // ERROR, no sampler constructor
|
| 30 |
|
| 31 | out vec4 color;
|
| 32 |
|
| 33 | void main()
|
| 34 | {
|
| 35 | color = texture(s2D, vec2(0.5));
|
| 36 | color += texture(s3d[i], vec3(0.5));
|
| 37 | }
|
| 38 |
|
| 39 | layout(push_constant) buffer pcb { // ERROR, not on a buffer
|
| 40 | int a;
|
| 41 | } pcbInst;
|
| 42 |
|
| 43 | layout(push_constant) uniform float pcfloat; // ERROR 2X: not on a non-block, and non-opaque outside block
|
| 44 |
|
| 45 | layout(push_constant) uniform; // ERROR, needs an object
|
| 46 |
|
| 47 | layout(push_constant) uniform pcb2 {
|
| 48 | int a;
|
John Kessenich | 33f85b6 | 2017-03-06 08:51:35 -0700 | [diff] [blame] | 49 | }; // Okay now to have no instance name
|
John Kessenich | 6c292d3 | 2016-02-15 20:58:50 -0700 | [diff] [blame] | 50 |
|
| 51 | layout(input_attachment_index = 2) uniform subpassInput subD;
|
| 52 | layout(input_attachment_index = 3) uniform texture2D subDbad1; // ERROR, not a texture
|
| 53 | layout(input_attachment_index = 4) writeonly uniform image2D subDbad2; // ERROR, not an image
|
| 54 | uniform subpassInput subDbad3; // ERROR, need attachment number
|
| 55 | layout(input_attachment_index = 2) uniform subpassInputMS subDMS;
|
| 56 |
|
| 57 | void 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 |
|
| 66 | subroutine int fooS; // ERROR, not in SPV
|
| 67 | subroutine int fooSub(); // ERROR, not in SPV
|
| 68 |
|
| 69 | uniform vec4 dv4; // ERROR, no default uniforms
|
John Kessenich | 2921e0c | 2016-05-20 16:59:27 -0600 | [diff] [blame] | 70 |
|
| 71 | void 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
|
John Kessenich | 1176530 | 2016-07-31 12:39:46 -0600 | [diff] [blame] | 75 | }
|
| 76 |
|
| 77 | precision highp float;
|
| 78 |
|
| 79 | layout(location=0) in vec2 vTexCoord;
|
| 80 | layout(location=0) out vec4 FragColor;
|
| 81 |
|
| 82 | vec4 userTexture(mediump sampler2D samp, vec2 coord)
|
| 83 | {
|
| 84 | return texture(samp, coord);
|
| 85 | }
|
| 86 |
|
| 87 | bool cond;
|
| 88 |
|
| 89 | void 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
|
John Kessenich | bc5196c | 2017-01-02 17:01:21 -0700 | [diff] [blame] | 95 |
|
| 96 | gl_NumSamples; // ERROR, not for Vulkan
|
John Kessenich | 1176530 | 2016-07-31 12:39:46 -0600 | [diff] [blame] | 97 | }
|