ERROR: 0:128: 'atomic_uint' : samplers and atomic_uints cannot be output parameters
ERROR: 0:130: 'return' : type does not match, or is not convertible to, the function's return type
ERROR: 0:136: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: non_uniform_counter
-ERROR: 0:136: 'atomic_uint' : layout(binding=X) is required
ERROR: 0:141: 'atomic_uint' : atomic counters can only be highp
ERROR: 0:141: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings
ERROR: 0:143: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings
ERROR: 0:244: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:245: 'gl_ViewIndex' : undeclared identifier
ERROR: 0:255: 'gl_ViewIndex' : undeclared identifier
-ERROR: 83 compilation errors. No code generated.
+ERROR: 82 compilation errors. No code generated.
Shader version: 310
ERROR: 0:10: 'atomic_uint' : samplers and atomic_uints cannot be output parameters
ERROR: 0:12: 'return' : type does not match, or is not convertible to, the function's return type
ERROR: 0:18: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: non_uniform_counter
-ERROR: 0:18: 'atomic_uint' : layout(binding=X) is required
ERROR: 0:23: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings
ERROR: 0:28: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( binding=0 offset=0) uniform atomic_uint' and a right operand of type 'layout( binding=0 offset=0) uniform atomic_uint' (or there is no acceptable conversion)
ERROR: 0:29: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( binding=0 offset=0) uniform atomic_uint (or there is no acceptable conversion)
ERROR: 0:34: 'assign' : l-value required "counter" (can't modify a uniform)
ERROR: 0:34: 'assign' : cannot convert from ' const int' to 'layout( binding=0 offset=0) uniform atomic_uint'
ERROR: 0:37: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: acin
-ERROR: 0:37: 'atomic_uint' : layout(binding=X) is required
ERROR: 0:38: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: acg
-ERROR: 0:38: 'atomic_uint' : layout(binding=X) is required
-ERROR: 0:40: 'atomic_uint' : layout(binding=X) is required
-ERROR: 0:46: 'atomic_uint' : layout(binding=X) is required
ERROR: 0:47: 'offset' : atomic counters sharing the same offset: 12
ERROR: 0:48: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings
-ERROR: 18 compilation errors. No code generated.
+ERROR: 13 compilation errors. No code generated.
Shader version: 420
glspv.frag
ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error )
ERROR: 0:6: '#error' : GL_SPIR is 100
+ERROR: 0:14: 'f' : non-opaque uniform variables need a layout(location=L)
ERROR: 0:21: 'noise1' : no matching overloaded function found
ERROR: 0:22: 'noise2' : no matching overloaded function found
ERROR: 0:23: 'noise3' : no matching overloaded function found
ERROR: 0:24: 'noise4' : no matching overloaded function found
-ERROR: 0:27: 'input_attachment_index' : only allowed when using GLSL for Vulkan
-ERROR: 0:27: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
-ERROR: 8 compilation errors. No code generated.
+ERROR: 0:27: 'atomic_uint' : layout(binding=X) is required
+ERROR: 0:28: 'input_attachment_index' : only allowed when using GLSL for Vulkan
+ERROR: 0:28: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
+ERROR: 10 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
0:7 Sequence
0:7 Branch: Return with expression
0:7 texture ( global highp 4-component vector of float)
-0:7 's2D' ( uniform highp sampler2D)
+0:7 's2D' (layout( binding=1) uniform highp sampler2D)
0:7 Constant:
0:7 0.500000
0:7 0.500000
0:? Linker Objects
-0:? 's2D' ( uniform highp sampler2D)
+0:? 's2D' (layout( binding=1) uniform highp sampler2D)
Linked fragment stage:
0:7 Sequence
0:7 Branch: Return with expression
0:7 texture ( global highp 4-component vector of float)
-0:7 's2D' ( uniform highp sampler2D)
+0:7 's2D' (layout( binding=1) uniform highp sampler2D)
0:7 Constant:
0:7 0.500000
0:7 0.500000
0:? Linker Objects
0:? 'color' ( out highp 4-component vector of float)
-0:? 's2D' ( uniform highp sampler2D)
+0:? 's2D' (layout( binding=1) uniform highp sampler2D)
SPIR-V is not generated for failed compile or link
ERROR: 0:87: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings
ERROR: 0:89: 'binding' : atomic_uint binding is too large
ERROR: 0:91: 'bar' : redefinition
-ERROR: 0:92: 'atomic_uint' : layout(binding=X) is required
ERROR: 0:94: 'a2' : redefinition
ERROR: 0:95: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings
ERROR: 0:96: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings
ERROR: 0:136: '' : function does not return a value: funcB
ERROR: 0:153: '' : function does not return a value: func3
ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter
-ERROR: 33 compilation errors. No code generated.
+ERROR: 32 compilation errors. No code generated.
Shader version: 430
1: String "spv.debugInfo.frag"
Source GLSL 450 1 "// OpModuleProcessed no-storage-format
// OpModuleProcessed resource-set-binding 3
+// OpModuleProcessed auto-map-bindings
// OpModuleProcessed auto-map-locations
// OpModuleProcessed client opengl100
// OpModuleProcessed target-env opengl
MemberDecorate 54(ubuf) 0 Offset 0
Decorate 54(ubuf) Block
Decorate 56 DescriptorSet 3
+ Decorate 56 Binding 0
Decorate 69(s2d) DescriptorSet 3
+ Decorate 69(s2d) Binding 1
3: TypeVoid
4: TypeFunction 3
7: TypeInt 32 1
Name 137 "FragColor"
Name 141 "g_tTex_unused3"
Decorate 17(g_tTex1) DescriptorSet 0
- Decorate 17(g_tTex1) Binding 11
+ Decorate 17(g_tTex1) Binding 17
Decorate 21(g_sSamp1) DescriptorSet 0
Decorate 21(g_sSamp1) Binding 5
Decorate 27(g_tTex2) DescriptorSet 0
+ Decorate 27(g_tTex2) Binding 18
Decorate 29(g_sSamp2) DescriptorSet 0
+ Decorate 29(g_sSamp2) Binding 6
Decorate 39(g_tTex3) DescriptorSet 0
- Decorate 39(g_tTex3) Binding 13
+ Decorate 39(g_tTex3) Binding 19
Decorate 46(g_sSamp3) DescriptorSet 0
Decorate 46(g_sSamp3) Binding 7
Decorate 64(g_tTex4) DescriptorSet 0
+ Decorate 64(g_tTex4) Binding 20
Decorate 69(g_sSamp4) DescriptorSet 0
+ Decorate 69(g_sSamp4) Binding 8
Decorate 84(g_tTex5) DescriptorSet 0
+ Decorate 84(g_tTex5) Binding 21
Decorate 86(g_sSamp5) DescriptorSet 0
+ Decorate 86(g_sSamp5) Binding 9
MemberDecorate 93(MyStruct_t) 0 Offset 0
MemberDecorate 93(MyStruct_t) 1 Offset 4
MemberDecorate 93(MyStruct_t) 2 Offset 16
Decorate 97 DescriptorSet 0
Decorate 97 Binding 19
Decorate 119(g_tTex_unused1) DescriptorSet 0
- Decorate 119(g_tTex_unused1) Binding 10
+ Decorate 119(g_tTex_unused1) Binding 22
Decorate 121(g_sSamp_unused1) DescriptorSet 0
+ Decorate 121(g_sSamp_unused1) Binding 10
Decorate 126(g_tTex_unused2) DescriptorSet 0
- Decorate 126(g_tTex_unused2) Binding 12
+ Decorate 126(g_tTex_unused2) Binding 23
Decorate 128(g_sSamp_unused2) DescriptorSet 0
+ Decorate 128(g_sSamp_unused2) Binding 11
Decorate 137(FragColor) Location 0
Decorate 141(g_tTex_unused3) DescriptorSet 0
+ Decorate 141(g_tTex_unused3) Binding 24
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
vulkan.frag
+ERROR: 0:3: 'binding' : sampler/texture/image requires layout(binding=X)
+ERROR: 0:4: 'binding' : sampler/texture/image requires layout(binding=X)
+ERROR: 0:5: 'binding' : sampler/texture/image requires layout(binding=X)
+ERROR: 0:6: 'binding' : sampler/texture/image requires layout(binding=X)
+ERROR: 0:8: 'binding' : sampler/texture/image requires layout(binding=X)
+ERROR: 0:9: 'binding' : sampler/texture/image requires layout(binding=X)
+ERROR: 0:10: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:14: 'sampler2D' : sampler-constructor requires two arguments
ERROR: 0:15: 'sampler2D' : sampler-constructor first argument must be a scalar textureXXX type
ERROR: 0:16: 'sampler2D' : sampler-constructor first argument must be a scalar textureXXX type
ERROR: 0:29: 'sampler3D' : sampler-constructor cannot make an array of samplers
ERROR: 0:29: 'sampler3D' : sampler/image types can only be used in uniform variables or function parameters: s3d
ERROR: 0:29: '=' : cannot convert from ' const float' to ' global 4-element array of highp sampler3D'
+ERROR: 0:31: 'location' : SPIR-V requires location for user input/output
ERROR: 0:39: 'push_constant' : can only be used with a uniform
ERROR: 0:43: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan
ERROR: 0:43: 'push_constant' : can only be used with a block
ERROR: 0:45: 'push_constant' : cannot declare a default, can only be used on a block
+ERROR: 0:51: 'binding' : sampler/texture/image requires layout(binding=X)
+ERROR: 0:52: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:52: 'input_attachment_index' : can only be used with a subpass
+ERROR: 0:53: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:53: 'input_attachment_index' : can only be used with a subpass
+ERROR: 0:54: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:54: 'subpass' : requires an input_attachment_index layout qualifier
+ERROR: 0:55: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:60: 'subpassLoadMS' : no matching overloaded function found
ERROR: 0:61: 'subpassLoad' : no matching overloaded function found
ERROR: 0:63: 'subpassLoadMS' : no matching overloaded function found
ERROR: 0:102: 'noise2' : no matching overloaded function found
ERROR: 0:103: 'noise3' : no matching overloaded function found
ERROR: 0:104: 'noise4' : no matching overloaded function found
-ERROR: 42 compilation errors. No code generated.
+ERROR: 55 compilation errors. No code generated.
ERROR: Linking fragment stage: Only one push_constant block is allowed per stage
vulkan.vert
ERROR: 0:3: 'subpass input' : not supported in this stage: vertex
+ERROR: 0:3: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:4: 'subpass input' : not supported in this stage: vertex
+ERROR: 0:4: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:5: 'subpass input' : not supported in this stage: vertex
+ERROR: 0:5: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:6: 'subpass input' : not supported in this stage: vertex
+ERROR: 0:6: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:7: 'subpass input' : not supported in this stage: vertex
+ERROR: 0:7: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:8: 'subpass input' : not supported in this stage: vertex
+ERROR: 0:8: 'binding' : sampler/texture/image requires layout(binding=X)
+ERROR: 0:10: 'location' : SPIR-V requires location for user input/output
ERROR: 0:12: 'constant_id' : can only be applied to a scalar
ERROR: 0:13: 'constant_id' : specialization-constant id already used
+ERROR: 0:13: 'binding' : sampler/texture/image requires layout(binding=X)
ERROR: 0:13: 'constant_id' : can only be applied to 'const'-qualified scalar
ERROR: 0:13: 'constant_id' : cannot be applied to this type
ERROR: 0:14: 'constant_id' : specialization-constant id is too large
ERROR: 0:50: '[]' : only outermost dimension of an array of arrays can be a specialization constant
ERROR: 0:51: '[]' : only outermost dimension of an array of arrays can be a specialization constant
ERROR: 0:54: '[]' : only outermost dimension of an array of arrays can be a specialization constant
-ERROR: 27 compilation errors. No code generated.
+ERROR: 0:54: 'location' : SPIR-V requires location for user input/output
+ERROR: 0:58: 'location' : SPIR-V requires location for user input/output
+ERROR: 37 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
{\r
}\r
\r
-uniform float f; // ERROR, no location\r
+uniform float f; // ERROR, no location\r
layout(location = 2) uniform float g;\r
-uniform sampler2D s1;\r
-layout(location = 3) uniform sampler2D s2;\r
+uniform sampler2D s1; // ERROR, no binding\r
+layout(location = 3) uniform sampler2D s2; // ERROR, no binding\r
\r
void noise()\r
{\r
noise4(1);\r
}\r
\r
+uniform atomic_uint atomic; // ERROR, no binding\r
layout(input_attachment_index = 1) uniform subpassInput sub; // ERROR, no inputs\r
layout(set = 0, binding = 0, std140) uniform Bt1 { int a; } bt1;\r
layout(set = 1, binding = 0, std140) uniform Bt2 { int a; } bt2; // ERROR, set has to be 0\r
\r
-layout(shared) uniform Bt3 { int a; } bt3; // ERROR, no shared\r
-layout(packed) uniform Bt4 { int a; } bt4; // ERROR, no shared\r
+layout(shared) uniform Bt3 { int a; } bt3; // ERROR, no shared, no binding\r
+layout(packed) uniform Bt4 { int a; } bt4; // ERROR, no shared, no binding\r
\r
void main()\r
{\r
#version 450\r
\r
-uniform sampler2D s2D;\r
+layout(binding=1) uniform sampler2D s2D;\r
\r
vec4 getColor()\r
{\r
# Testing debug information
#
echo Testing SPV Debug Information
-$EXE -g --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf \
+$EXE -g --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf \
-G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out
diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1
$EXE -g -D -Od -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \
#version 450
uniform layout(binding=0) sampler g_sSamp1;
-uniform sampler g_sSamp2;
+uniform layout(binding=1) sampler g_sSamp2;
uniform layout(binding=2) sampler g_sSamp3[2];
-uniform sampler g_sSamp4[3];
-uniform sampler g_sSamp5;
+uniform layout(binding=3) sampler g_sSamp4[3];
+uniform layout(binding=4) sampler g_sSamp5;
-uniform sampler g_sSamp_unused1;
-uniform sampler g_sSamp_unused2;
+uniform layout(binding=5) sampler g_sSamp_unused1;
+uniform layout(binding=6) sampler g_sSamp_unused2;
-uniform layout(binding=1) texture1D g_tTex1;
-uniform texture1D g_tTex2;
-uniform layout(binding=3) texture1D g_tTex3[2];
-uniform texture1D g_tTex4[3];
-uniform texture1D g_tTex5;
+uniform layout(binding=7) texture1D g_tTex1;
+uniform layout(binding=8) texture1D g_tTex2;
+uniform layout(binding=9) texture1D g_tTex3[2];
+uniform layout(binding=10) texture1D g_tTex4[3];
+uniform layout(binding=11) texture1D g_tTex5;
-uniform layout(binding=0) texture1D g_tTex_unused1;
-uniform layout(binding=2) texture1D g_tTex_unused2;
-uniform texture1D g_tTex_unused3;
+uniform layout(binding=12) texture1D g_tTex_unused1;
+uniform layout(binding=13) texture1D g_tTex_unused2;
+uniform layout(binding=14) texture1D g_tTex_unused3;
struct MyStruct_t {
int a;
\r
layout(constant_id = 3) const int a = 2;\r
layout(location = 2) uniform float f;\r
-layout(location = 4) uniform sampler2D s1;\r
-uniform sampler2D s2;\r
+layout(location = 4, binding = 1) uniform sampler2D s1;\r
+layout(binding = 2) uniform sampler2D s2;\r
\r
void main()\r
{\r
#version 450\r
\r
-uniform sampler s;\r
-uniform sampler sA[4];\r
-uniform texture2D t2d;\r
-uniform texture3D t3d[4];\r
+uniform sampler s; // ERROR, no binding\r
+uniform sampler sA[4]; // ERROR, no binding\r
+uniform texture2D t2d; // ERROR, no binding\r
+uniform texture3D t3d[4]; // ERROR, no binding\r
int i;\r
uniform samplerShadow sShadow;\r
uniform texture3D t3d5[5];\r
sampler2D s2D = sampler2D(t2d, s); // ERROR, no sampler constructor\r
sampler3D s3d[4] = sampler3D[4](t3d, sA[2]); // ERROR, no sampler constructor\r
\r
-out vec4 color;\r
+out vec4 color; // ERROR, no location\r
\r
void main()\r
{\r
return;
}
}
- }
+ } else if (!intermediate.getAutoMapBindings()) {
+ // some types require bindings
- // atomic_uint
- if (type.getBasicType() == EbtAtomicUint) {
- if (! type.getQualifier().hasBinding())
+ // atomic_uint
+ if (type.getBasicType() == EbtAtomicUint)
error(loc, "layout(binding=X) is required", "atomic_uint", "");
+
+ // SPIR-V
+ if (spvVersion.spv > 0) {
+ if (qualifier.isUniformOrBuffer()) {
+ if (type.getBasicType() == EbtBlock && !qualifier.layoutPushConstant &&
+ !qualifier.layoutAttachment)
+ error(loc, "uniform/buffer blocks require layout(binding=X)", "binding", "");
+ else if (spvVersion.vulkan > 0 && type.getBasicType() == EbtSampler)
+ error(loc, "sampler/texture/image requires layout(binding=X)", "binding", "");
+ }
+ }
}
// "The offset qualifier can only be used on block members of blocks..."
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan,
- Target::BothASTAndSpv, GetParam().entryPoint);
+ Target::BothASTAndSpv, true, GetParam().entryPoint);
}
TEST_P(HlslCompileAndFlattenTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan,
- Target::Spv, GetParam().entryPoint,
+ Target::Spv, true, GetParam().entryPoint,
"/baseLegalResults/", false);
}
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan,
- Target::Spv);
+ Target::Spv, false);
}
// GLSL-level Vulkan semantics test. Expected to error out before generating
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::OpenGL,
- Target::Spv);
+ Target::Spv, false);
}
// GLSL-level Vulkan semantics test that need to see the AST for validation.
TEST_P(CompileVulkanToSpirvTestNV, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
- Source::GLSL, Semantics::Vulkan,
- Target::Spv);
+ Source::GLSL, Semantics::Vulkan,
+ Target::Spv);
}
#endif
const std::string& entryPointName, EShMessages controls,
bool flattenUniformArrays = false,
EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
- bool disableOptimizer = true)
+ bool disableOptimizer = true,
+ bool automap = true)
{
const EShLanguage kind = GetShaderStage(GetSuffix(shaderName));
glslang::TShader shader(kind);
- shader.setAutoMapLocations(true);
+ if (automap) {
+ shader.setAutoMapLocations(true);
+ shader.setAutoMapBindings(true);
+ }
shader.setTextureSamplerTransformMode(texSampTransMode);
shader.setFlattenUniformArrays(flattenUniformArrays);
const EShLanguage kind = GetShaderStage(GetSuffix(shaderName));
glslang::TShader shader(kind);
+ shader.setAutoMapBindings(true);
shader.setAutoMapLocations(true);
bool success = compile(&shader, code, entryPointName, controls);
Source source,
Semantics semantics,
Target target,
+ bool automap = true,
const std::string& entryPointName="",
const std::string& baseDir="/baseResults/",
const bool disableOptimizer = true)
tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
const EShMessages controls = DeriveOptions(source, semantics, target);
- GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransKeep, disableOptimizer);
+ GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransKeep,
+ disableOptimizer, automap);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;
tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
const EShMessages controls = DeriveOptions(source, semantics, target);
- GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransUpgradeTextureRemoveSampler);
+ GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false,
+ EShTexSampTransUpgradeTextureRemoveSampler);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;