SPV: Prevent issue #415 with better semantic checking.

This commit is contained in:
John Kessenich
2016-07-31 12:39:46 -06:00
parent 11e1a073f3
commit 1176530bf5
9 changed files with 2681 additions and 2937 deletions

View File

@@ -33,7 +33,12 @@ ERROR: 0:67: 'uniform' : no qualifiers allowed for function return
ERROR: 0:69: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan
ERROR: 0:73: 'texture' : no matching overloaded function found
ERROR: 0:74: 'imageStore' : no matching overloaded function found
ERROR: 33 compilation errors. No code generated.
ERROR: 0:91: 'call argument' : sampler constructor must appear at point of use
ERROR: 0:92: 'call argument' : sampler constructor must appear at point of use
ERROR: 0:93: ',' : sampler constructor must appear at point of use
ERROR: 0:94: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type 'temp sampler2D' and a right operand of type 'temp sampler2D' (or there is no acceptable conversion)
ERROR: 0:94: 'call argument' : sampler constructor must appear at point of use
ERROR: 38 compilation errors. No code generated.

View File

@@ -72,4 +72,24 @@ void fooTex()
{
texture(t2d, vec2(1.0)); // ERROR, need a sampler, not a pure texture
imageStore(t2d, ivec2(4, 5), vec4(1.2)); // ERROR, need an image, not a pure texture
}
}
precision highp float;
layout(location=0) in vec2 vTexCoord;
layout(location=0) out vec4 FragColor;
vec4 userTexture(mediump sampler2D samp, vec2 coord)
{
return texture(samp, coord);
}
bool cond;
void callUserTexture()
{
userTexture(sampler2D(t2d,s), vTexCoord); // ERROR, not point of use
userTexture((sampler2D(t2d,s)), vTexCoord); // ERROR, not point of use
userTexture((sampler2D(t2d,s), sampler2D(t2d,s)), vTexCoord); // ERROR, not point of use
userTexture(cond ? sampler2D(t2d,s) : sampler2D(t2d,s), vTexCoord); // ERROR, no ?:, not point of use
}