Commit 0971c1d3 by John Kessenich

Merge remote-tracking branch 'GitHub/master'

parents 9bb239ee f88e5824
Language: Cpp Language: Cpp
IndentWidth: 4 IndentWidth: 4
PointerAlignment: Left
BreakBeforeBraces: Custom BreakBeforeBraces: Custom
BraceWrapping: { AfterFunction: true, AfterControlStatement: true } BraceWrapping: { AfterFunction: true, AfterControlStatement: false }
IndentCaseLabels: false IndentCaseLabels: false
ReflowComments: false ReflowComments: false
ColumnLimit: 120 ColumnLimit: 120
......
...@@ -10,7 +10,8 @@ if(BUILD_TESTING) ...@@ -10,7 +10,8 @@ if(BUILD_TESTING)
if(WIN32) if(WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif(WIN32) endif(WIN32)
add_subdirectory(googletest) # EXCLUDE_FROM_ALL keeps the install target from installing GTEST files.
add_subdirectory(googletest EXCLUDE_FROM_ALL)
set(GTEST_TARGETS set(GTEST_TARGETS
gtest gtest
gtest_main gtest_main
......
...@@ -45,7 +45,7 @@ namespace spv { ...@@ -45,7 +45,7 @@ namespace spv {
// MSVC defines __cplusplus as an older value, even when it supports almost all of 11. // MSVC defines __cplusplus as an older value, even when it supports almost all of 11.
// We handle that here by making our own symbol. // We handle that here by making our own symbol.
#if __cplusplus >= 201103L || _MSC_VER >= 1700 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
# define use_cpp11 1 # define use_cpp11 1
#endif #endif
......
...@@ -118,9 +118,46 @@ void Builder::postProcessType(const Instruction& inst, Id typeId) ...@@ -118,9 +118,46 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
case OpAccessChain: case OpAccessChain:
case OpPtrAccessChain: case OpPtrAccessChain:
case OpCopyObject: case OpCopyObject:
break;
case OpFConvert: case OpFConvert:
case OpSConvert: case OpSConvert:
case OpUConvert: case OpUConvert:
// Look for any 8/16-bit storage capabilities. If there are none, assume that
// the convert instruction requires the Float16/Int8/16 capability.
if (containsType(typeId, OpTypeFloat, 16) || containsType(typeId, OpTypeInt, 16)) {
bool foundStorage = false;
for (auto it = capabilities.begin(); it != capabilities.end(); ++it) {
spv::Capability cap = *it;
if (cap == spv::CapabilityStorageInputOutput16 ||
cap == spv::CapabilityStoragePushConstant16 ||
cap == spv::CapabilityStorageUniformBufferBlock16 ||
cap == spv::CapabilityStorageUniform16) {
foundStorage = true;
break;
}
}
if (!foundStorage) {
if (containsType(typeId, OpTypeFloat, 16))
addCapability(CapabilityFloat16);
if (containsType(typeId, OpTypeInt, 16))
addCapability(CapabilityInt16);
}
}
if (containsType(typeId, OpTypeInt, 8)) {
bool foundStorage = false;
for (auto it = capabilities.begin(); it != capabilities.end(); ++it) {
spv::Capability cap = *it;
if (cap == spv::CapabilityStoragePushConstant8 ||
cap == spv::CapabilityUniformAndStorageBuffer8BitAccess ||
cap == spv::CapabilityStorageBuffer8BitAccess) {
foundStorage = true;
break;
}
}
if (!foundStorage) {
addCapability(CapabilityInt8);
}
}
break; break;
case OpExtInst: case OpExtInst:
#if AMD_EXTENSIONS #if AMD_EXTENSIONS
...@@ -327,6 +364,24 @@ void Builder::postProcess() ...@@ -327,6 +364,24 @@ void Builder::postProcess()
// Add per-instruction capabilities, extensions, etc., // Add per-instruction capabilities, extensions, etc.,
// Look for any 8/16 bit type in physical storage buffer class, and set the
// appropriate capability. This happens in createSpvVariable for other storage
// classes, but there isn't always a variable for physical storage buffer.
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {
Instruction* type = groupedTypes[OpTypePointer][t];
if (type->getImmediateOperand(0) == (unsigned)StorageClassPhysicalStorageBufferEXT) {
if (containsType(type->getIdOperand(1), OpTypeInt, 8)) {
addExtension(spv::E_SPV_KHR_8bit_storage);
addCapability(spv::CapabilityStorageBuffer8BitAccess);
}
if (containsType(type->getIdOperand(1), OpTypeInt, 16) ||
containsType(type->getIdOperand(1), OpTypeFloat, 16)) {
addExtension(spv::E_SPV_KHR_16bit_storage);
addCapability(spv::CapabilityStorageBuffer16BitAccess);
}
}
}
// process all reachable instructions... // process all reachable instructions...
for (auto bi = reachableBlocks.cbegin(); bi != reachableBlocks.cend(); ++bi) { for (auto bi = reachableBlocks.cbegin(); bi != reachableBlocks.cend(); ++bi) {
const Block* block = *bi; const Block* block = *bi;
...@@ -366,24 +421,6 @@ void Builder::postProcess() ...@@ -366,24 +421,6 @@ void Builder::postProcess()
} }
} }
} }
// Look for any 8/16 bit type in physical storage buffer class, and set the
// appropriate capability. This happens in createSpvVariable for other storage
// classes, but there isn't always a variable for physical storage buffer.
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {
Instruction* type = groupedTypes[OpTypePointer][t];
if (type->getImmediateOperand(0) == (unsigned)StorageClassPhysicalStorageBufferEXT) {
if (containsType(type->getIdOperand(1), OpTypeInt, 8)) {
addExtension(spv::E_SPV_KHR_8bit_storage);
addCapability(spv::CapabilityStorageBuffer8BitAccess);
}
if (containsType(type->getIdOperand(1), OpTypeInt, 16) ||
containsType(type->getIdOperand(1), OpTypeFloat, 16)) {
addExtension(spv::E_SPV_KHR_16bit_storage);
addCapability(spv::CapabilityStorageBuffer16BitAccess);
}
}
}
} }
}; // end spv namespace }; // end spv namespace
...@@ -162,6 +162,7 @@ const char* shaderStageName = nullptr; ...@@ -162,6 +162,7 @@ const char* shaderStageName = nullptr;
const char* variableName = nullptr; const char* variableName = nullptr;
bool HlslEnable16BitTypes = false; bool HlslEnable16BitTypes = false;
bool HlslDX9compatible = false; bool HlslDX9compatible = false;
bool DumpBuiltinSymbols = false;
std::vector<std::string> IncludeDirectoryList; std::vector<std::string> IncludeDirectoryList;
// Source environment // Source environment
...@@ -494,6 +495,8 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem ...@@ -494,6 +495,8 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Error("--client expects vulkan100 or opengl100"); Error("--client expects vulkan100 or opengl100");
} }
bumpArg(); bumpArg();
} else if (lowerword == "dump-builtin-symbols") {
DumpBuiltinSymbols = true;
} else if (lowerword == "entry-point") { } else if (lowerword == "entry-point") {
entryPointName = argv[1]; entryPointName = argv[1];
if (argc <= 1) if (argc <= 1)
...@@ -833,6 +836,8 @@ void SetMessageOptions(EShMessages& messages) ...@@ -833,6 +836,8 @@ void SetMessageOptions(EShMessages& messages)
messages = (EShMessages)(messages | EShMsgHlslLegalization); messages = (EShMessages)(messages | EShMsgHlslLegalization);
if (HlslDX9compatible) if (HlslDX9compatible)
messages = (EShMessages)(messages | EShMsgHlslDX9Compatible); messages = (EShMessages)(messages | EShMsgHlslDX9Compatible);
if (DumpBuiltinSymbols)
messages = (EShMessages)(messages | EShMsgBuiltinSymbolTable);
} }
// //
...@@ -1520,6 +1525,7 @@ void usage() ...@@ -1520,6 +1525,7 @@ void usage()
" --auto-map-locations | --aml automatically locate input/output lacking\n" " --auto-map-locations | --aml automatically locate input/output lacking\n"
" 'location' (fragile, not cross stage)\n" " 'location' (fragile, not cross stage)\n"
" --client {vulkan<ver>|opengl<ver>} see -V and -G\n" " --client {vulkan<ver>|opengl<ver>} see -V and -G\n"
" --dump-builtin-symbols prints builtin symbol table prior each compile\n"
" -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n" " -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n"
" --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n" " --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n"
" scalars\n" " scalars\n"
......
...@@ -106,9 +106,9 @@ layout(r32i) coherent restrict readonly uniform iimage2D qualim2; ...@@ -106,9 +106,9 @@ layout(r32i) coherent restrict readonly uniform iimage2D qualim2;
void passrc() void passrc()
{ {
passr(qualim1); passr(qualim1); // ERROR, changing formats
passr(qualim2); // ERROR, drops restrict passr(qualim2); // ERROR, drops restrict, ERROR, changing formats
passr(iimg2D); passr(iimg2D); // ERROR, changing formats
} }
highp layout(rg8i) uniform readonly uimage2D i1bad; // ERROR, type mismatch highp layout(rg8i) uniform readonly uimage2D i1bad; // ERROR, type mismatch
......
...@@ -131,9 +131,9 @@ layout(r32i) coherent volatile readonly uniform iimage2D qualim2; ...@@ -131,9 +131,9 @@ layout(r32i) coherent volatile readonly uniform iimage2D qualim2;
void passrc() void passrc()
{ {
passr(qualim1); passr(qualim1); // ERROR, changing formats
passr(qualim2); // ERROR, drops volatile passr(qualim2); // ERROR, drops volatile, ERROR, changing formats
passr(iimg2D); passr(iimg2D); // ERROR, changing formats
} }
layout(rg8i) uniform uimage2D i1bad; // ERROR, type mismatch layout(rg8i) uniform uimage2D i1bad; // ERROR, type mismatch
......
...@@ -28,6 +28,10 @@ ERROR: 0:90: 'imageAtomicMax' : no matching overloaded function found ...@@ -28,6 +28,10 @@ ERROR: 0:90: 'imageAtomicMax' : no matching overloaded function found
ERROR: 0:94: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:94: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:97: '' : memory qualifiers cannot be used on this type ERROR: 0:97: '' : memory qualifiers cannot be used on this type
ERROR: 0:98: '' : memory qualifiers cannot be used on this type ERROR: 0:98: '' : memory qualifiers cannot be used on this type
ERROR: 0:109: 'format' : image formats must match
ERROR: 0:110: 'restrict' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:110: 'format' : image formats must match
ERROR: 0:111: 'format' : image formats must match
ERROR: 0:114: 'image load-store format' : not supported with this profile: es ERROR: 0:114: 'image load-store format' : not supported with this profile: es
ERROR: 0:114: 'rg8i' : does not apply to unsigned integer images ERROR: 0:114: 'rg8i' : does not apply to unsigned integer images
ERROR: 0:115: 'rgba32i' : does not apply to floating point images ERROR: 0:115: 'rgba32i' : does not apply to floating point images
...@@ -83,7 +87,7 @@ WARNING: 0:238: '#define' : names containing consecutive underscores are reserve ...@@ -83,7 +87,7 @@ WARNING: 0:238: '#define' : names containing consecutive underscores are reserve
ERROR: 0:244: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group ERROR: 0:244: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:245: 'gl_ViewIndex' : undeclared identifier ERROR: 0:245: 'gl_ViewIndex' : undeclared identifier
ERROR: 0:255: 'gl_ViewIndex' : undeclared identifier ERROR: 0:255: 'gl_ViewIndex' : undeclared identifier
ERROR: 82 compilation errors. No code generated. ERROR: 86 compilation errors. No code generated.
Shader version: 310 Shader version: 310
......
...@@ -38,7 +38,10 @@ ERROR: 0:115: 'imageAtomicMax' : no matching overloaded function found ...@@ -38,7 +38,10 @@ ERROR: 0:115: 'imageAtomicMax' : no matching overloaded function found
ERROR: 0:119: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:119: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:122: '' : memory qualifiers cannot be used on this type ERROR: 0:122: '' : memory qualifiers cannot be used on this type
ERROR: 0:123: '' : memory qualifiers cannot be used on this type ERROR: 0:123: '' : memory qualifiers cannot be used on this type
ERROR: 0:134: 'format' : image formats must match
ERROR: 0:135: 'volatile' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:135: 'volatile' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:135: 'format' : image formats must match
ERROR: 0:136: 'format' : image formats must match
ERROR: 0:139: 'rg8i' : does not apply to unsigned integer images ERROR: 0:139: 'rg8i' : does not apply to unsigned integer images
ERROR: 0:140: 'rgba32i' : does not apply to floating point images ERROR: 0:140: 'rgba32i' : does not apply to floating point images
ERROR: 0:141: 'rgba32f' : does not apply to unsigned integer images ERROR: 0:141: 'rgba32f' : does not apply to unsigned integer images
...@@ -52,7 +55,7 @@ ERROR: 0:157: 'assign' : cannot convert from ' const float' to ' temp int' ...@@ -52,7 +55,7 @@ ERROR: 0:157: 'assign' : cannot convert from ' const float' to ' temp int'
ERROR: 0:158: 'textureQueryLevels' : no matching overloaded function found ERROR: 0:158: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:158: 'assign' : cannot convert from ' const float' to ' temp int' ERROR: 0:158: 'assign' : cannot convert from ' const float' to ' temp int'
WARNING: 0:161: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array WARNING: 0:161: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array
ERROR: 51 compilation errors. No code generated. ERROR: 54 compilation errors. No code generated.
Shader version: 420 Shader version: 420
......
...@@ -17,6 +17,7 @@ ERROR: 0:47: 'gl_ClipDistance array size' : must be less than or equal to gl_Max ...@@ -17,6 +17,7 @@ ERROR: 0:47: 'gl_ClipDistance array size' : must be less than or equal to gl_Max
ERROR: 0:51: 'start' : undeclared identifier ERROR: 0:51: 'start' : undeclared identifier
ERROR: 0:51: '' : constant expression required ERROR: 0:51: '' : constant expression required
ERROR: 0:51: 'layout-id value' : scalar integer expression required ERROR: 0:51: 'layout-id value' : scalar integer expression required
ERROR: 0:51: 'location' : needs a literal integer
ERROR: 0:53: 'input block' : not supported in this stage: vertex ERROR: 0:53: 'input block' : not supported in this stage: vertex
ERROR: 0:54: 'location on block member' : not supported for this version or the enabled extensions ERROR: 0:54: 'location on block member' : not supported for this version or the enabled extensions
ERROR: 0:57: 'input block' : not supported in this stage: vertex ERROR: 0:57: 'input block' : not supported in this stage: vertex
...@@ -63,7 +64,7 @@ ERROR: 0:221: 'textureQueryLevels' : no matching overloaded function found ...@@ -63,7 +64,7 @@ ERROR: 0:221: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:221: 'assign' : cannot convert from ' const float' to ' temp int' ERROR: 0:221: 'assign' : cannot convert from ' const float' to ' temp int'
ERROR: 0:222: 'textureQueryLevels' : no matching overloaded function found ERROR: 0:222: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:222: 'assign' : cannot convert from ' const float' to ' temp int' ERROR: 0:222: 'assign' : cannot convert from ' const float' to ' temp int'
ERROR: 64 compilation errors. No code generated. ERROR: 65 compilation errors. No code generated.
Shader version: 430 Shader version: 430
......
...@@ -30,8 +30,10 @@ ERROR: 0:132: 'shared' : not supported in this stage: vertex ...@@ -30,8 +30,10 @@ ERROR: 0:132: 'shared' : not supported in this stage: vertex
ERROR: 0:134: '' : function does not return a value: funcA ERROR: 0:134: '' : function does not return a value: funcA
ERROR: 0:136: '' : function does not return a value: funcB ERROR: 0:136: '' : function does not return a value: funcB
ERROR: 0:153: '' : function does not return a value: func3 ERROR: 0:153: '' : function does not return a value: func3
ERROR: 0:169: 'format' : image formats must match
ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 32 compilation errors. No code generated. ERROR: 0:170: 'format' : image formats must match
ERROR: 34 compilation errors. No code generated.
Shader version: 430 Shader version: 430
......
...@@ -31,8 +31,10 @@ ERROR: 0:132: 'shared' : not supported in this stage: vertex ...@@ -31,8 +31,10 @@ ERROR: 0:132: 'shared' : not supported in this stage: vertex
ERROR: 0:134: '' : function does not return a value: funcA ERROR: 0:134: '' : function does not return a value: funcA
ERROR: 0:136: '' : function does not return a value: funcB ERROR: 0:136: '' : function does not return a value: funcB
ERROR: 0:153: '' : function does not return a value: func3 ERROR: 0:153: '' : function does not return a value: func3
ERROR: 0:169: 'format' : image formats must match
ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 33 compilation errors. No code generated. ERROR: 0:170: 'format' : image formats must match
ERROR: 35 compilation errors. No code generated.
Shader version: 430 Shader version: 430
......
spv.float16convertonlyarith.comp
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 22
Capability Shader
Capability Float16
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 16 16 1
Source GLSL 450
SourceExtension "GL_EXT_shader_explicit_arithmetic_types_float16"
Name 4 "main"
Name 9 "v"
Decorate 21 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: 6(float) Constant 0
11: 7(fvec4) ConstantComposite 10 10 10 10
13: TypeFloat 16
14: TypeVector 13(float16_t) 4
17: TypeInt 32 0
18: TypeVector 17(int) 3
19: 17(int) Constant 16
20: 17(int) Constant 1
21: 18(ivec3) ConstantComposite 19 19 20
4(main): 2 Function None 3
5: Label
9(v): 8(ptr) Variable Function
Store 9(v) 11
12: 7(fvec4) Load 9(v)
15: 14(f16vec4) FConvert 12
16: 7(fvec4) FConvert 15
Return
FunctionEnd
spv.float16convertonlystorage.comp
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 22
Capability Shader
Capability Float16
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 16 16 1
Source GLSL 450
SourceExtension "GL_EXT_shader_16bit_storage"
Name 4 "main"
Name 9 "v"
Decorate 21 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: 6(float) Constant 0
11: 7(fvec4) ConstantComposite 10 10 10 10
13: TypeFloat 16
14: TypeVector 13(float16_t) 4
17: TypeInt 32 0
18: TypeVector 17(int) 3
19: 17(int) Constant 16
20: 17(int) Constant 1
21: 18(ivec3) ConstantComposite 19 19 20
4(main): 2 Function None 3
5: Label
9(v): 8(ptr) Variable Function
Store 9(v) 11
12: 7(fvec4) Load 9(v)
15: 14(f16vec4) FConvert 12
16: 7(fvec4) FConvert 15
Return
FunctionEnd
...@@ -2,14 +2,14 @@ spv.paramMemory.frag ...@@ -2,14 +2,14 @@ spv.paramMemory.frag
Validation failed Validation failed
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80007 // Generated by (magic number): 80007
// Id's are bound by 69 // Id's are bound by 64
Capability Shader Capability Shader
Capability StorageImageReadWithoutFormat Capability StorageImageReadWithoutFormat
Capability StorageImageWriteWithoutFormat Capability StorageImageWriteWithoutFormat
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 27 66 EntryPoint Fragment 4 "main" 27 61
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source ESSL 310 Source ESSL 310
Name 4 "main" Name 4 "main"
...@@ -22,39 +22,28 @@ Validation failed ...@@ -22,39 +22,28 @@ Validation failed
Name 22 "data" Name 22 "data"
Name 27 "in_coords" Name 27 "in_coords"
Name 35 "read1" Name 35 "read1"
Name 38 "image1" Name 38 "read2"
Name 39 "param" Name 43 "image3"
Name 42 "read2"
Name 45 "image2"
Name 46 "param" Name 46 "param"
Name 49 "image3" Name 48 "param"
Name 53 "param" Name 52 "image4"
Name 55 "param" Name 56 "param"
Name 57 "image4" Name 58 "param"
Name 61 "param" Name 61 "out_color"
Name 63 "param"
Name 66 "out_color"
Decorate 14(image) Coherent Decorate 14(image) Coherent
Decorate 14(image) NonWritable Decorate 14(image) NonWritable
Decorate 20(image) Coherent Decorate 20(image) Coherent
Decorate 20(image) NonReadable Decorate 20(image) NonReadable
Decorate 27(in_coords) Flat Decorate 27(in_coords) Flat
Decorate 27(in_coords) Location 0 Decorate 27(in_coords) Location 0
Decorate 38(image1) DescriptorSet 0 Decorate 43(image3) DescriptorSet 0
Decorate 38(image1) Binding 0 Decorate 43(image3) Binding 1
Decorate 38(image1) Coherent Decorate 43(image3) Coherent
Decorate 38(image1) NonWritable Decorate 43(image3) NonReadable
Decorate 45(image2) DescriptorSet 0 Decorate 52(image4) DescriptorSet 0
Decorate 45(image2) Binding 2 Decorate 52(image4) Binding 3
Decorate 45(image2) NonWritable Decorate 52(image4) NonReadable
Decorate 49(image3) DescriptorSet 0 Decorate 61(out_color) Location 0
Decorate 49(image3) Binding 1
Decorate 49(image3) Coherent
Decorate 49(image3) NonReadable
Decorate 57(image4) DescriptorSet 0
Decorate 57(image4) Binding 3
Decorate 57(image4) NonReadable
Decorate 66(out_color) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -69,51 +58,44 @@ Validation failed ...@@ -69,51 +58,44 @@ Validation failed
19: TypeFunction 2 8(ptr) 11(ptr) 18(ptr) 19: TypeFunction 2 8(ptr) 11(ptr) 18(ptr)
26: TypePointer Input 10(ivec2) 26: TypePointer Input 10(ivec2)
27(in_coords): 26(ptr) Variable Input 27(in_coords): 26(ptr) Variable Input
36: TypeImage 6(float) 2D nonsampled format:Rgba32f 36: 6(float) Constant 1053609165
37: TypePointer UniformConstant 36 37: 12(fvec4) ConstantComposite 36 36 36 36
38(image1): 37(ptr) Variable UniformConstant 39: 6(float) Constant 1056964608
43: TypeImage 6(float) 2D nonsampled format:Rgba16f 40: 12(fvec4) ConstantComposite 39 39 39 39
44: TypePointer UniformConstant 43 41: TypeImage 6(float) 2D nonsampled format:Rgba32f
45(image2): 44(ptr) Variable UniformConstant 42: TypePointer UniformConstant 41
49(image3): 37(ptr) Variable UniformConstant 43(image3): 42(ptr) Variable UniformConstant
51: 6(float) Constant 1056964608 50: TypeImage 6(float) 2D nonsampled format:Rgba16f
57(image4): 44(ptr) Variable UniformConstant 51: TypePointer UniformConstant 50
59: 6(float) Constant 1073741824 52(image4): 51(ptr) Variable UniformConstant
65: TypePointer Output 12(fvec4) 54: 6(float) Constant 1073741824
66(out_color): 65(ptr) Variable Output 60: TypePointer Output 12(fvec4)
67: 6(float) Constant 0 61(out_color): 60(ptr) Variable Output
68: 12(fvec4) ConstantComposite 67 67 67 67 62: 6(float) Constant 0
63: 12(fvec4) ConstantComposite 62 62 62 62
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
35(read1): 18(ptr) Variable Function 35(read1): 18(ptr) Variable Function
39(param): 11(ptr) Variable Function 38(read2): 18(ptr) Variable Function
42(read2): 18(ptr) Variable Function
46(param): 11(ptr) Variable Function 46(param): 11(ptr) Variable Function
53(param): 11(ptr) Variable Function 48(param): 18(ptr) Variable Function
55(param): 18(ptr) Variable Function 56(param): 11(ptr) Variable Function
61(param): 11(ptr) Variable Function 58(param): 18(ptr) Variable Function
63(param): 18(ptr) Variable Function Store 35(read1) 37
40: 10(ivec2) Load 27(in_coords) Store 38(read2) 40
Store 39(param) 40 44: 12(fvec4) Load 35(read1)
41: 12(fvec4) FunctionCall 16(image_load(I21;vi2;) 38(image1) 39(param) 45: 12(fvec4) VectorTimesScalar 44 39
Store 35(read1) 41
47: 10(ivec2) Load 27(in_coords) 47: 10(ivec2) Load 27(in_coords)
Store 46(param) 47 Store 46(param) 47
48: 12(fvec4) FunctionCall 16(image_load(I21;vi2;) 45(image2) 46(param) Store 48(param) 45
Store 42(read2) 48 49: 2 FunctionCall 23(image_store(I21;vi2;vf4;) 43(image3) 46(param) 48(param)
50: 12(fvec4) Load 35(read1) 53: 12(fvec4) Load 38(read2)
52: 12(fvec4) VectorTimesScalar 50 51 55: 12(fvec4) VectorTimesScalar 53 54
54: 10(ivec2) Load 27(in_coords) 57: 10(ivec2) Load 27(in_coords)
Store 53(param) 54 Store 56(param) 57
Store 55(param) 52 Store 58(param) 55
56: 2 FunctionCall 23(image_store(I21;vi2;vf4;) 49(image3) 53(param) 55(param) 59: 2 FunctionCall 23(image_store(I21;vi2;vf4;) 52(image4) 56(param) 58(param)
58: 12(fvec4) Load 42(read2) Store 61(out_color) 63
60: 12(fvec4) VectorTimesScalar 58 59
62: 10(ivec2) Load 27(in_coords)
Store 61(param) 62
Store 63(param) 60
64: 2 FunctionCall 23(image_store(I21;vi2;vf4;) 57(image4) 61(param) 63(param)
Store 66(out_color) 68
Return Return
FunctionEnd FunctionEnd
16(image_load(I21;vi2;): 12(fvec4) Function None 13 16(image_load(I21;vi2;): 12(fvec4) Function None 13
......
...@@ -34,7 +34,26 @@ ERROR: 0:54: '[]' : only outermost dimension of an array of arrays can be a spec ...@@ -34,7 +34,26 @@ ERROR: 0:54: '[]' : only outermost dimension of an array of arrays can be a spec
ERROR: 0:54: 'location' : SPIR-V requires location for user input/output 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: 0:58: 'location' : SPIR-V requires location for user input/output
ERROR: 0:65: 'location' : overlapping use of location 10 ERROR: 0:65: 'location' : overlapping use of location 10
ERROR: 35 compilation errors. No code generated. ERROR: 0:68: 'location' : needs a literal integer
ERROR: 0:68: 'component' : needs a literal integer
ERROR: 0:69: 'binding' : needs a literal integer
ERROR: 0:69: 'set' : needs a literal integer
ERROR: 0:70: 'offset' : needs a literal integer
ERROR: 0:71: 'align' : must be a power of 2
ERROR: 0:71: 'align' : needs a literal integer
ERROR: 0:72: 'xfb_offset' : needs a literal integer
ERROR: 0:73: 'xfb_buffer' : needs a literal integer
ERROR: 0:74: 'xfb_stride' : needs a literal integer
ERROR: 0:73: 'xfb_buffer' : member cannot contradict block (or what block inherited from global)
ERROR: 0:72: 'xfb layout qualifier' : can only be used on an output
ERROR: 0:73: 'xfb layout qualifier' : can only be used on an output
ERROR: 0:74: 'xfb layout qualifier' : can only be used on an output
ERROR: 0:76: 'input_attachment_index' : needs a literal integer
ERROR: 0:76: 'input_attachment_index' : can only be used with a subpass
ERROR: 0:77: 'constant_id' : needs a literal integer
ERROR: 0:77: 'constant_id' : can only be applied to 'const'-qualified scalar
ERROR: 0:77: 'constant_id' : can only be applied to a scalar
ERROR: 54 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link SPIR-V is not generated for failed compile or link
...@@ -166,8 +166,8 @@ void main() ...@@ -166,8 +166,8 @@ void main()
v.x = func2(a.x, b.x, c.x, d.x); // precise! v.x = func2(a.x, b.x, c.x, d.x); // precise!
func3(a.x * b.x, c.x * d.x, v.x); // precise! func3(a.x * b.x, c.x * d.x, v.x); // precise!
funcA(img1); // OK, adding "restrict" is allowed funcA(img1); // OK, adding "restrict" is allowed, ERROR, changing formats
funcB(img2); // illegal, stripping "coherent" is not funcB(img2); // illegal, stripping "coherent" is not, ERROR, changing formats
{ {
struct light { struct light {
......
#version 450 core
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
void main()
{
vec4 v = vec4(0.0);
vec4(f16vec4(v));
}
\ No newline at end of file
#version 450 core
#extension GL_EXT_shader_16bit_storage : require
layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
void main()
{
vec4 v = vec4(0.0);
vec4(f16vec4(v));
}
\ No newline at end of file
#version 310 es #version 310 es
readonly coherent uniform layout(set = 0, binding = 0, rgba32f) highp image2D image1; // readonly coherent uniform layout(set = 0, binding = 0) highp image2D image1;
readonly uniform layout(set = 0, binding = 2, rgba16f) highp image2D image2; // readonly uniform layout(set = 0, binding = 2) highp image2D image2;
writeonly coherent uniform layout(set = 0, binding = 1, rgba32f) highp image2D image3; writeonly coherent uniform layout(set = 0, binding = 1, rgba32f) highp image2D image3;
writeonly uniform layout(set = 0, binding = 3, rgba16f) highp image2D image4; writeonly uniform layout(set = 0, binding = 3, rgba16f) highp image2D image4;
...@@ -20,8 +20,8 @@ void image_store(writeonly coherent highp image2D image, highp ivec2 coords, hig ...@@ -20,8 +20,8 @@ void image_store(writeonly coherent highp image2D image, highp ivec2 coords, hig
void main() void main()
{ {
highp vec4 read1 = image_load(image1, in_coords); highp vec4 read1 = vec4(0.4); // = image_load(image1, in_coords);
highp vec4 read2 = image_load(image2, in_coords); highp vec4 read2 = vec4(0.5); // = image_load(image2, in_coords);
image_store(image3, in_coords, read1*0.5); image_store(image3, in_coords, read1*0.5);
image_store(image4, in_coords, read2*2.0); image_store(image4, in_coords, read2*2.0);
......
...@@ -63,3 +63,15 @@ layout(binding = 3000) uniform sampler2D s3000; ...@@ -63,3 +63,15 @@ layout(binding = 3000) uniform sampler2D s3000;
layout(binding = 3001) uniform b3001 { int a; }; layout(binding = 3001) uniform b3001 { int a; };
layout(location = 10) in vec4 in1; layout(location = 10) in vec4 in1;
layout(location = 10) in vec4 in2; // ERROR, no location aliasing layout(location = 10) in vec4 in2; // ERROR, no location aliasing
layout(constant_id = 400) const int nonLit = 1;
layout(location = nonLit, component = nonLit) in vec4 nonLit1; // ERROR, non literal
layout(binding = nonLit, set = nonLit) uniform nonLitBN { // ERROR, non literal
layout(offset = nonLit) vec4 nonLit1; // ERROR, non literal
layout(align = nonLit) vec4 nonLit3; // ERROR, non literal
layout(xfb_offset = nonLit) vec4 nonLit4; // ERROR, non literal
layout(xfb_buffer = nonLit) vec4 nonLit5; // ERROR, non literal
layout(xfb_stride = nonLit) vec4 nonLit6; // ERROR, non literal
} nonLitBI;
layout(input_attachment_index = nonLit) vec4 nonLit3; // ERROR, non literal
layout(constant_id = nonLit) vec4 nonLit4; // ERROR, non literal
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define _COMMON_INCLUDED_ #define _COMMON_INCLUDED_
#if defined(__ANDROID__) || _MSC_VER < 1700 #if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700)
#include <sstream> #include <sstream>
namespace std { namespace std {
template<typename T> template<typename T>
...@@ -102,6 +102,7 @@ std::string to_string(const T& val) { ...@@ -102,6 +102,7 @@ std::string to_string(const T& val) {
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <cstdio> #include <cstdio>
#include <cstdlib>
#include <cassert> #include <cassert>
#include "PoolAlloc.h" #include "PoolAlloc.h"
......
...@@ -2018,7 +2018,7 @@ public: ...@@ -2018,7 +2018,7 @@ public:
} }
// Add struct/block members // Add struct/block members
if (isStruct()) { if (isStruct() && structure) {
appendStr("{"); appendStr("{");
for (size_t i = 0; i < structure->size(); ++i) { for (size_t i = 0; i < structure->size(); ++i) {
if (! (*structure)[i].type->hiddenMember()) { if (! (*structure)[i].type->hiddenMember()) {
......
// This header is generated by the make-revision script. // This header is generated by the make-revision script.
#define GLSLANG_PATCH_LEVEL 3170 #define GLSLANG_PATCH_LEVEL 3205
...@@ -410,7 +410,7 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOper ...@@ -410,7 +410,7 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOper
// //
// This is the safe way to change the operator on an aggregate, as it // This is the safe way to change the operator on an aggregate, as it
// does lots of error checking and fixing. Especially for establishing // does lots of error checking and fixing. Especially for establishing
// a function call's operation on it's set of parameters. Sequences // a function call's operation on its set of parameters. Sequences
// of instructions are also aggregates, but they just directly set // of instructions are also aggregates, but they just directly set
// their operator to EOpSequence. // their operator to EOpSequence.
// //
...@@ -498,6 +498,58 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped ...@@ -498,6 +498,58 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
TOperator newOp = EOpNull; TOperator newOp = EOpNull;
// Certain explicit conversions are allowed conditionally
bool arithemeticInt8Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
#ifdef AMD_EXTENSIONS
bool arithemeticInt16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16) ||
extensionRequested(E_GL_AMD_gpu_shader_int16);
bool arithemeticFloat16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16) ||
extensionRequested(E_GL_AMD_gpu_shader_half_float);
#else
bool arithemeticInt16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
bool arithemeticFloat16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
#endif
bool convertToIntTypes = (convertTo == EbtInt8 || convertTo == EbtUint8 ||
convertTo == EbtInt16 || convertTo == EbtUint16 ||
convertTo == EbtInt || convertTo == EbtUint ||
convertTo == EbtInt64 || convertTo == EbtUint64);
bool convertFromIntTypes = (node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8 ||
node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16 ||
node->getBasicType() == EbtInt || node->getBasicType() == EbtUint ||
node->getBasicType() == EbtInt64 || node->getBasicType() == EbtUint64);
bool convertToFloatTypes = (convertTo == EbtFloat16 || convertTo == EbtFloat || convertTo == EbtDouble);
bool convertFromFloatTypes = (node->getBasicType() == EbtFloat16 ||
node->getBasicType() == EbtFloat ||
node->getBasicType() == EbtDouble);
if (! arithemeticInt8Enabled) {
if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) ||
((node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8) && ! convertToIntTypes))
return nullptr;
}
if (! arithemeticInt16Enabled) {
if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) ||
((node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16) && ! convertToIntTypes))
return nullptr;
}
if (! arithemeticFloat16Enabled) {
if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) ||
(node->getBasicType() == EbtFloat16 && ! convertToFloatTypes))
return nullptr;
}
switch (convertTo) { switch (convertTo) {
case EbtDouble: case EbtDouble:
switch (node->getBasicType()) { switch (node->getBasicType()) {
......
...@@ -377,6 +377,8 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS ...@@ -377,6 +377,8 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
infoSink, commonTable, symbolTables); infoSink, commonTable, symbolTables);
#endif #endif
return true; return true;
} }
...@@ -474,6 +476,16 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp ...@@ -474,6 +476,16 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
glslang::ReleaseGlobalLock(); glslang::ReleaseGlobalLock();
} }
// Function to Print all builtins
void DumpBuiltinSymbolTable(TInfoSink& infoSink, const TSymbolTable& symbolTable)
{
infoSink.debug << "BuiltinSymbolTable {\n";
symbolTable.dump(infoSink, true);
infoSink.debug << "}\n";
}
// Return true if the shader was correctly specified for version/profile/stage. // Return true if the shader was correctly specified for version/profile/stage.
bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNotFirst, int defaultVersion, bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNotFirst, int defaultVersion,
EShSource source, int& version, EProfile& profile, const SpvVersion& spvVersion) EShSource source, int& version, EProfile& profile, const SpvVersion& spvVersion)
...@@ -905,6 +917,9 @@ bool ProcessDeferred( ...@@ -905,6 +917,9 @@ bool ProcessDeferred(
return false; return false;
} }
if (messages & EShMsgBuiltinSymbolTable)
DumpBuiltinSymbolTable(compiler->infoSink, *symbolTable);
// //
// Now we can process the full shader under proper symbols and rules. // Now we can process the full shader under proper symbols and rules.
// //
......
...@@ -176,37 +176,77 @@ void TType::buildMangledName(TString& mangledName) const ...@@ -176,37 +176,77 @@ void TType::buildMangledName(TString& mangledName) const
// Dump functions. // Dump functions.
// //
void TVariable::dump(TInfoSink& infoSink) const void TSymbol::dumpExtensions(TInfoSink& infoSink) const
{ {
infoSink.debug << getName().c_str() << ": " << type.getStorageQualifierString() << " " << type.getBasicTypeString(); int numExtensions = getNumExtensions();
if (type.isArray()) { if (numExtensions) {
infoSink.debug << "[0]"; infoSink.debug << " <";
for (int i = 0; i < numExtensions; i++)
infoSink.debug << getExtensions()[i] << ",";
infoSink.debug << ">";
} }
}
void TVariable::dump(TInfoSink& infoSink, bool complete) const
{
if (complete) {
infoSink.debug << getName().c_str() << ": " << type.getCompleteString();
dumpExtensions(infoSink);
} else {
infoSink.debug << getName().c_str() << ": " << type.getStorageQualifierString() << " "
<< type.getBasicTypeString();
if (type.isArray())
infoSink.debug << "[0]";
}
infoSink.debug << "\n"; infoSink.debug << "\n";
} }
void TFunction::dump(TInfoSink& infoSink) const void TFunction::dump(TInfoSink& infoSink, bool complete) const
{ {
infoSink.debug << getName().c_str() << ": " << returnType.getBasicTypeString() << " " << getMangledName().c_str() << "\n"; if (complete) {
infoSink.debug << getName().c_str() << ": " << returnType.getCompleteString() << " " << getName().c_str()
<< "(";
int numParams = getParamCount();
for (int i = 0; i < numParams; i++) {
const TParameter &param = parameters[i];
infoSink.debug << param.type->getCompleteString() << " "
<< (param.type->isStruct() ? "of " + param.type->getTypeName() + " " : "")
<< (param.name ? *param.name : "") << (i < numParams - 1 ? "," : "");
}
infoSink.debug << ")";
dumpExtensions(infoSink);
} else {
infoSink.debug << getName().c_str() << ": " << returnType.getBasicTypeString() << " "
<< getMangledName().c_str() << "n";
}
infoSink.debug << "\n";
} }
void TAnonMember::dump(TInfoSink& TInfoSink) const void TAnonMember::dump(TInfoSink& TInfoSink, bool complete) const
{ {
TInfoSink.debug << "anonymous member " << getMemberNumber() << " of " << getAnonContainer().getName().c_str() << "\n"; TInfoSink.debug << "anonymous member " << getMemberNumber() << " of " << getAnonContainer().getName().c_str()
<< "\n";
} }
void TSymbolTableLevel::dump(TInfoSink &infoSink) const void TSymbolTableLevel::dump(TInfoSink& infoSink, bool complete) const
{ {
tLevel::const_iterator it; tLevel::const_iterator it;
for (it = level.begin(); it != level.end(); ++it) for (it = level.begin(); it != level.end(); ++it)
(*it).second->dump(infoSink); (*it).second->dump(infoSink, complete);
} }
void TSymbolTable::dump(TInfoSink &infoSink) const void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const
{ {
for (int level = currentLevel(); level >= 0; --level) { for (int level = currentLevel(); level >= 0; --level) {
infoSink.debug << "LEVEL " << level << "\n"; infoSink.debug << "LEVEL " << level << "\n";
table[level]->dump(infoSink); table[level]->dump(infoSink, complete);
} }
} }
......
...@@ -116,7 +116,8 @@ public: ...@@ -116,7 +116,8 @@ public:
} }
virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); } virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); }
virtual const char** getExtensions() const { return extensions->data(); } virtual const char** getExtensions() const { return extensions->data(); }
virtual void dump(TInfoSink &infoSink) const = 0; virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0;
void dumpExtensions(TInfoSink& infoSink) const;
virtual bool isReadOnly() const { return ! writable; } virtual bool isReadOnly() const { return ! writable; }
virtual void makeReadOnly() { writable = false; } virtual void makeReadOnly() { writable = false; }
...@@ -192,7 +193,7 @@ public: ...@@ -192,7 +193,7 @@ public:
} }
virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); } virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); }
virtual void dump(TInfoSink &infoSink) const; virtual void dump(TInfoSink& infoSink, bool complete = false) const;
protected: protected:
explicit TVariable(const TVariable&); explicit TVariable(const TVariable&);
...@@ -313,7 +314,7 @@ public: ...@@ -313,7 +314,7 @@ public:
virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; } virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; }
virtual const TParameter& operator[](int i) const { return parameters[i]; } virtual const TParameter& operator[](int i) const { return parameters[i]; }
virtual void dump(TInfoSink &infoSink) const override; virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
protected: protected:
explicit TFunction(const TFunction&); explicit TFunction(const TFunction&);
...@@ -373,7 +374,7 @@ public: ...@@ -373,7 +374,7 @@ public:
virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); } virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); }
virtual int getAnonId() const { return anonId; } virtual int getAnonId() const { return anonId; }
virtual void dump(TInfoSink &infoSink) const override; virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
protected: protected:
explicit TAnonMember(const TAnonMember&); explicit TAnonMember(const TAnonMember&);
...@@ -541,7 +542,7 @@ public: ...@@ -541,7 +542,7 @@ public:
void relateToOperator(const char* name, TOperator op); void relateToOperator(const char* name, TOperator op);
void setFunctionExtensions(const char* name, int num, const char* const extensions[]); void setFunctionExtensions(const char* name, int num, const char* const extensions[]);
void dump(TInfoSink &infoSink) const; void dump(TInfoSink& infoSink, bool complete = false) const;
TSymbolTableLevel* clone() const; TSymbolTableLevel* clone() const;
void readOnly(); void readOnly();
...@@ -842,7 +843,7 @@ public: ...@@ -842,7 +843,7 @@ public:
} }
int getMaxSymbolId() { return uniqueId; } int getMaxSymbolId() { return uniqueId; }
void dump(TInfoSink &infoSink) const; void dump(TInfoSink& infoSink, bool complete = false) const;
void copyTable(const TSymbolTable& copyOf); void copyTable(const TSymbolTable& copyOf);
void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); } void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); }
......
...@@ -85,6 +85,9 @@ const TConstUnion* TAttributeArgs::getConstUnion(TBasicType basicType, int argNu ...@@ -85,6 +85,9 @@ const TConstUnion* TAttributeArgs::getConstUnion(TBasicType basicType, int argNu
if (argNum >= (int)args->getSequence().size()) if (argNum >= (int)args->getSequence().size())
return nullptr; return nullptr;
if (args->getSequence()[argNum]->getAsConstantUnion() == nullptr)
return nullptr;
const TConstUnion* constVal = &args->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0]; const TConstUnion* constVal = &args->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0];
if (constVal == nullptr || constVal->getType() != basicType) if (constVal == nullptr || constVal->getType() != basicType)
return nullptr; return nullptr;
......
...@@ -234,6 +234,7 @@ enum EShMessages { ...@@ -234,6 +234,7 @@ enum EShMessages {
EShMsgHlslEnable16BitTypes = (1 << 11), // enable use of 16-bit types in SPIR-V for HLSL EShMsgHlslEnable16BitTypes = (1 << 11), // enable use of 16-bit types in SPIR-V for HLSL
EShMsgHlslLegalization = (1 << 12), // enable HLSL Legalization messages EShMsgHlslLegalization = (1 << 12), // enable HLSL Legalization messages
EShMsgHlslDX9Compatible = (1 << 13), // enable HLSL DX9 compatible mode (right now only for samplers) EShMsgHlslDX9Compatible = (1 << 13), // enable HLSL DX9 compatible mode (right now only for samplers)
EShMsgBuiltinSymbolTable = (1 << 14), // print the builtin symbol table
}; };
// //
......
...@@ -300,6 +300,8 @@ INSTANTIATE_TEST_CASE_P( ...@@ -300,6 +300,8 @@ INSTANTIATE_TEST_CASE_P(
"spv.earlyReturnDiscard.frag", "spv.earlyReturnDiscard.frag",
"spv.extPostDepthCoverage.frag", "spv.extPostDepthCoverage.frag",
"spv.extPostDepthCoverage_Error.frag", "spv.extPostDepthCoverage_Error.frag",
"spv.float16convertonlyarith.comp",
"spv.float16convertonlystorage.comp",
"spv.flowControl.frag", "spv.flowControl.frag",
"spv.forLoop.frag", "spv.forLoop.frag",
"spv.forwardFun.frag", "spv.forwardFun.frag",
......
...@@ -1899,13 +1899,16 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr ...@@ -1899,13 +1899,16 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr
// location // location
if (it->getInt(value)) if (it->getInt(value))
type.getQualifier().layoutLocation = value; type.getQualifier().layoutLocation = value;
else
error(loc, "needs a literal integer", "location", "");
break; break;
case EatBinding: case EatBinding:
// binding // binding
if (it->getInt(value)) { if (it->getInt(value)) {
type.getQualifier().layoutBinding = value; type.getQualifier().layoutBinding = value;
type.getQualifier().layoutSet = 0; type.getQualifier().layoutSet = 0;
} } else
error(loc, "needs a literal integer", "binding", "");
// set // set
if (it->getInt(value, 1)) if (it->getInt(value, 1))
type.getQualifier().layoutSet = value; type.getQualifier().layoutSet = value;
...@@ -1914,7 +1917,9 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr ...@@ -1914,7 +1917,9 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr
// global cbuffer binding // global cbuffer binding
if (it->getInt(value)) if (it->getInt(value))
globalUniformBinding = value; globalUniformBinding = value;
// global cbuffer binding else
error(loc, "needs a literal integer", "global binding", "");
// global cbuffer set
if (it->getInt(value, 1)) if (it->getInt(value, 1))
globalUniformSet = value; globalUniformSet = value;
break; break;
...@@ -1922,6 +1927,8 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr ...@@ -1922,6 +1927,8 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr
// input attachment // input attachment
if (it->getInt(value)) if (it->getInt(value))
type.getQualifier().layoutAttachment = value; type.getQualifier().layoutAttachment = value;
else
error(loc, "needs a literal integer", "input attachment", "");
break; break;
case EatBuiltIn: case EatBuiltIn:
// PointSize built-in // PointSize built-in
......
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
"site" : "github", "site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Tools", "subrepo" : "KhronosGroup/SPIRV-Tools",
"subdir" : "External/spirv-tools", "subdir" : "External/spirv-tools",
"commit" : "2ff54e34ed3730477401f340c71ae14b7641031e" "commit" : "26c1b8878315a7a5c188df45e0bc236bb222b698"
}, },
{ {
"name" : "spirv-tools/external/spirv-headers", "name" : "spirv-tools/external/spirv-headers",
"site" : "github", "site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Headers", "subrepo" : "KhronosGroup/SPIRV-Headers",
"subdir" : "External/spirv-tools/external/spirv-headers", "subdir" : "External/spirv-tools/external/spirv-headers",
"commit" : "111a25e4ae45e2b4d7c18415e1d6884712b958c4" "commit" : "2434b89345a50c018c84f42a310b0fad4f3fd94f"
} }
] ]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment