This commit is contained in:
Branimir Karadžić 2018-09-15 08:58:21 -07:00
Родитель 4faf60d903
Коммит 59178d5cad
19 изменённых файлов: 55 добавлений и 28 удалений

12
3rdparty/glslang/SPIRV/GlslangToSpv.cpp поставляемый Normal file → Executable file
Просмотреть файл

@ -2729,10 +2729,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
spvType = builder.makeFloatType(64); spvType = builder.makeFloatType(64);
break; break;
case glslang::EbtFloat16: case glslang::EbtFloat16:
#if AMD_EXTENSIONS
if (builder.getSpvVersion() < glslang::EShTargetSpv_1_3)
builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float);
#endif
spvType = builder.makeFloatType(16); spvType = builder.makeFloatType(16);
break; break;
case glslang::EbtBool: case glslang::EbtBool:
@ -2750,17 +2746,9 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
spvType = builder.makeUintType(8); spvType = builder.makeUintType(8);
break; break;
case glslang::EbtInt16: case glslang::EbtInt16:
#ifdef AMD_EXTENSIONS
if (builder.getSpvVersion() < glslang::EShTargetSpv_1_3)
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16);
#endif
spvType = builder.makeIntType(16); spvType = builder.makeIntType(16);
break; break;
case glslang::EbtUint16: case glslang::EbtUint16:
#ifdef AMD_EXTENSIONS
if (builder.getSpvVersion() < glslang::EShTargetSpv_1_3)
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16);
#endif
spvType = builder.makeUintType(16); spvType = builder.makeUintType(16);
break; break;
case glslang::EbtInt: case glslang::EbtInt:

19
3rdparty/glslang/SPIRV/SpvPostProcess.cpp поставляемый Normal file → Executable file
Просмотреть файл

@ -120,6 +120,25 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
case OpSConvert: case OpSConvert:
case OpUConvert: case OpUConvert:
break; break;
case OpExtInst:
switch (inst.getImmediateOperand(1)) {
#if AMD_EXTENSIONS
case GLSLstd450Frexp:
case GLSLstd450FrexpStruct:
if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeInt, 16))
addExtension(spv::E_SPV_AMD_gpu_shader_int16);
break;
case GLSLstd450InterpolateAtCentroid:
case GLSLstd450InterpolateAtSample:
case GLSLstd450InterpolateAtOffset:
if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeFloat, 16))
addExtension(spv::E_SPV_AMD_gpu_shader_half_float);
break;
#endif
default:
break;
}
break;
default: default:
if (basicTypeOp == OpTypeFloat && width == 16) if (basicTypeOp == OpTypeFloat && width == 16)
addCapability(CapabilityFloat16); addCapability(CapabilityFloat16);

2
3rdparty/glslang/SPIRV/bitutils.h поставляемый
Просмотреть файл

@ -26,7 +26,7 @@ Dest BitwiseCast(Src source) {
Dest dest; Dest dest;
static_assert(sizeof(source) == sizeof(dest), static_assert(sizeof(source) == sizeof(dest),
"BitwiseCast: Source and destination must have the same size"); "BitwiseCast: Source and destination must have the same size");
std::memcpy(&dest, &source, sizeof(dest)); std::memcpy(static_cast<void*>(&dest), &source, sizeof(dest));
return dest; return dest;
} }

Просмотреть файл

@ -14,5 +14,6 @@ struct A
void main() void main()
{ {
"a string"
} }

Просмотреть файл

@ -6,7 +6,6 @@ spv.16bitstorage-int.frag
Capability Shader Capability Shader
Capability StorageUniformBufferBlock16 Capability StorageUniformBufferBlock16
Capability StorageUniform16 Capability StorageUniform16
Extension "SPV_AMD_gpu_shader_int16"
Extension "SPV_KHR_16bit_storage" Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450

Просмотреть файл

@ -6,7 +6,6 @@ spv.16bitstorage-uint.frag
Capability Shader Capability Shader
Capability StorageUniformBufferBlock16 Capability StorageUniformBufferBlock16
Capability StorageUniform16 Capability StorageUniform16
Extension "SPV_AMD_gpu_shader_int16"
Extension "SPV_KHR_16bit_storage" Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450

Просмотреть файл

@ -6,7 +6,6 @@ spv.16bitstorage.frag
Capability Shader Capability Shader
Capability StorageUniformBufferBlock16 Capability StorageUniformBufferBlock16
Capability StorageUniform16 Capability StorageUniform16
Extension "SPV_AMD_gpu_shader_half_float"
Extension "SPV_KHR_16bit_storage" Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450

Просмотреть файл

@ -27,7 +27,6 @@ error: Capability Float16 is not allowed by Vulkan 1.0 specification (or require
Capability StorageInputOutput16 Capability StorageInputOutput16
Capability Float16ImageAMD Capability Float16ImageAMD
Capability ImageGatherBiasLodAMD Capability ImageGatherBiasLodAMD
Extension "SPV_AMD_gpu_shader_half_float"
Extension "SPV_AMD_gpu_shader_half_float_fetch" Extension "SPV_AMD_gpu_shader_half_float_fetch"
Extension "SPV_AMD_texture_gather_bias_lod" Extension "SPV_AMD_texture_gather_bias_lod"
Extension "SPV_KHR_16bit_storage" Extension "SPV_KHR_16bit_storage"

Просмотреть файл

@ -14,7 +14,6 @@ error: Capability Float16 is not allowed by Vulkan 1.0 specification (or require
Capability Int16 Capability Int16
Capability StorageUniform16 Capability StorageUniform16
Capability StorageInputOutput16 Capability StorageInputOutput16
Extension "SPV_AMD_gpu_shader_half_float"
Extension "SPV_AMD_gpu_shader_int16" Extension "SPV_AMD_gpu_shader_int16"
Extension "SPV_KHR_16bit_storage" Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"

Просмотреть файл

@ -14,8 +14,6 @@ error: Capability Float16 is not allowed by Vulkan 1.0 specification (or require
Capability Int16 Capability Int16
Capability Int8 Capability Int8
Capability StorageUniform16 Capability StorageUniform16
Extension "SPV_AMD_gpu_shader_half_float"
Extension "SPV_AMD_gpu_shader_int16"
Extension "SPV_KHR_16bit_storage" Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450

Просмотреть файл

@ -14,8 +14,6 @@ error: Capability Float16 is not allowed by Vulkan 1.0 specification (or require
Capability Groups Capability Groups
Capability Int16 Capability Int16
Capability StorageUniformBufferBlock16 Capability StorageUniformBufferBlock16
Extension "SPV_AMD_gpu_shader_half_float"
Extension "SPV_AMD_gpu_shader_int16"
Extension "SPV_AMD_shader_ballot" Extension "SPV_AMD_shader_ballot"
Extension "SPV_KHR_16bit_storage" Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"

1
3rdparty/glslang/Test/hlsl.pp.expand.frag поставляемый Normal file → Executable file
Просмотреть файл

@ -14,4 +14,5 @@ struct A
void main() void main()
{ {
"a string"
} }

2
3rdparty/glslang/glslang/Include/revision.h поставляемый
Просмотреть файл

@ -1,3 +1,3 @@
// This header is generated by the make-revision script. // This header is generated by the make-revision script.
#define GLSLANG_PATCH_LEVEL 2880 #define GLSLANG_PATCH_LEVEL 2888

Просмотреть файл

@ -982,7 +982,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n"); "\n");
} }
#ifdef NV_EXTENSIONS
if (profile != EEsProfile && version >= 440) { if (profile != EEsProfile && version >= 440) {
commonBuiltins.append( commonBuiltins.append(
"uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);" "uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);"
@ -1032,7 +1031,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void atomicStore(coherent volatile out int64_t, int64_t, int, int, int);" "void atomicStore(coherent volatile out int64_t, int64_t, int, int, int);"
"\n"); "\n");
} }
#endif
if ((profile == EEsProfile && version >= 310) || if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 450)) { (profile != EEsProfile && version >= 450)) {

Просмотреть файл

@ -1858,11 +1858,15 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
if (argp->size() > 3) { if (argp->size() > 3) {
requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str()); requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str());
memorySemanticsCheck(loc, fnCandidate, callNode); memorySemanticsCheck(loc, fnCandidate, callNode);
} } else if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64) {
#ifdef NV_EXTENSIONS #ifdef NV_EXTENSIONS
else if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64) const char* const extensions[2] = { E_GL_NV_shader_atomic_int64,
requireExtensions(loc, 1, &E_GL_NV_shader_atomic_int64, fnCandidate.getName().c_str()); E_GL_EXT_shader_atomic_int64 };
requireExtensions(loc, 2, extensions, fnCandidate.getName().c_str());
#else
requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_int64, fnCandidate.getName().c_str());
#endif #endif
}
break; break;
} }

17
3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp поставляемый Normal file → Executable file
Просмотреть файл

@ -67,6 +67,11 @@
#include "iomapper.h" #include "iomapper.h"
#include "Initialize.h" #include "Initialize.h"
// TODO: this really shouldn't be here, it is only because of the trial addition
// of printing pre-processed tokens, which requires knowing the string literal
// token to print ", but none of that seems appropriate for this file.
#include "preprocessor/PpTokens.h"
namespace { // anonymous namespace for file-local functions and symbols namespace { // anonymous namespace for file-local functions and symbols
// Total number of successful initializers of glslang: a refcount // Total number of successful initializers of glslang: a refcount
@ -965,6 +970,8 @@ private:
// DoPreprocessing is a valid ProcessingContext template argument, // DoPreprocessing is a valid ProcessingContext template argument,
// which only performs the preprocessing step of compilation. // which only performs the preprocessing step of compilation.
// It places the result in the "string" argument to its constructor. // It places the result in the "string" argument to its constructor.
//
// This is not an officially supported or fully working path.
struct DoPreprocessing { struct DoPreprocessing {
explicit DoPreprocessing(std::string* string): outputString(string) {} explicit DoPreprocessing(std::string* string): outputString(string) {}
bool operator()(TParseContextBase& parseContext, TPpContext& ppContext, bool operator()(TParseContextBase& parseContext, TPpContext& ppContext,
@ -1072,7 +1079,11 @@ struct DoPreprocessing {
outputBuffer += ' '; outputBuffer += ' ';
} }
lastToken = token; lastToken = token;
if (token == PpAtomConstString)
outputBuffer += "\"";
outputBuffer += ppToken.name; outputBuffer += ppToken.name;
if (token == PpAtomConstString)
outputBuffer += "\"";
} while (true); } while (true);
outputBuffer += '\n'; outputBuffer += '\n';
*outputString = std::move(outputBuffer); *outputString = std::move(outputBuffer);
@ -1122,6 +1133,9 @@ struct DoFullParse{
// Return: True if there were no issues found in preprocessing, // Return: True if there were no issues found in preprocessing,
// False if during preprocessing any unknown version, pragmas or // False if during preprocessing any unknown version, pragmas or
// extensions were found. // extensions were found.
//
// NOTE: Doing just preprocessing to obtain a correct preprocessed shader string
// is not an officially supported or fully working path.
bool PreprocessDeferred( bool PreprocessDeferred(
TCompiler* compiler, TCompiler* compiler,
const char* const shaderStrings[], const char* const shaderStrings[],
@ -1726,6 +1740,9 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
// Fill in a string with the result of preprocessing ShaderStrings // Fill in a string with the result of preprocessing ShaderStrings
// Returns true if all extensions, pragmas and version strings were valid. // Returns true if all extensions, pragmas and version strings were valid.
//
// NOTE: Doing just preprocessing to obtain a correct preprocessed shader string
// is not an officially supported or fully working path.
bool TShader::preprocess(const TBuiltInResource* builtInResources, bool TShader::preprocess(const TBuiltInResource* builtInResources,
int defaultVersion, EProfile defaultProfile, int defaultVersion, EProfile defaultProfile,
bool forceDefaultVersionAndProfile, bool forceDefaultVersionAndProfile,

Просмотреть файл

@ -196,6 +196,8 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_KHR_shader_subgroup_quad] = EBhDisable; extensionBehavior[E_GL_KHR_shader_subgroup_quad] = EBhDisable;
extensionBehavior[E_GL_KHR_memory_scope_semantics] = EBhDisable; extensionBehavior[E_GL_KHR_memory_scope_semantics] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_atomic_int64] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable; extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_image_load_formatted] = EBhDisable; extensionBehavior[E_GL_EXT_shader_image_load_formatted] = EBhDisable;
extensionBehavior[E_GL_EXT_post_depth_coverage] = EBhDisable; extensionBehavior[E_GL_EXT_post_depth_coverage] = EBhDisable;
@ -381,6 +383,8 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_KHR_shader_subgroup_clustered 1\n" "#define GL_KHR_shader_subgroup_clustered 1\n"
"#define GL_KHR_shader_subgroup_quad 1\n" "#define GL_KHR_shader_subgroup_quad 1\n"
"#define E_GL_EXT_shader_atomic_int64 1\n"
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
"#define GL_AMD_shader_ballot 1\n" "#define GL_AMD_shader_ballot 1\n"
"#define GL_AMD_shader_trinary_minmax 1\n" "#define GL_AMD_shader_trinary_minmax 1\n"

Просмотреть файл

@ -150,6 +150,8 @@ const char* const E_GL_KHR_shader_subgroup_clustered = "GL_KHR_shader_sub
const char* const E_GL_KHR_shader_subgroup_quad = "GL_KHR_shader_subgroup_quad"; const char* const E_GL_KHR_shader_subgroup_quad = "GL_KHR_shader_subgroup_quad";
const char* const E_GL_KHR_memory_scope_semantics = "GL_KHR_memory_scope_semantics"; const char* const E_GL_KHR_memory_scope_semantics = "GL_KHR_memory_scope_semantics";
const char* const E_GL_EXT_shader_atomic_int64 = "GL_EXT_shader_atomic_int64";
const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers"; const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers";
const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_load_formatted"; const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_load_formatted";

2
3rdparty/glslang/glslang/Public/ShaderLang.h поставляемый Normal file → Executable file
Просмотреть файл

@ -532,6 +532,8 @@ public:
return parse(builtInResources, defaultVersion, ENoProfile, false, forwardCompatible, messages, includer); return parse(builtInResources, defaultVersion, ENoProfile, false, forwardCompatible, messages, includer);
} }
// NOTE: Doing just preprocessing to obtain a correct preprocessed shader string
// is not an officially supported or fully working path.
bool preprocess(const TBuiltInResource* builtInResources, bool preprocess(const TBuiltInResource* builtInResources,
int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile,
bool forwardCompatible, EShMessages message, std::string* outputString, bool forwardCompatible, EShMessages message, std::string* outputString,