blob: 2b686eb2a7e55c63e06de51a2ff75f82ab811ada [file] [log] [blame]
John Kessenich6c292d32016-02-15 20:58:50 -07001#version 450
2
3uniform sampler s;
4uniform sampler sA[4];
5uniform texture2D t2d;
6uniform texture3D t3d[4];
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); // ERROR, shadow mismatch
25 sampler2DShadow(t2d, s); // ERROR, shadow mismatch
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;
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
46
47layout(push_constant) uniform pcb2 {
48 int a;
John Kessenich33f85b62017-03-06 08:51:35 -070049}; // Okay now to have no instance name
John Kessenich6c292d32016-02-15 20:58:50 -070050
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
John Kessenich2921e0c2016-05-20 16:59:27 -060070
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
John Kessenich11765302016-07-31 12:39:46 -060075}
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
John Kessenichbc5196c2017-01-02 17:01:21 -070095
96 gl_NumSamples; // ERROR, not for Vulkan
John Kessenich11765302016-07-31 12:39:46 -060097}