mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
Externals: Update glslang.
This updates glslang to commit 9bb8cfffb0eed010e07132282c41d73064a7a609 which is the current version listed in the known_good.json file for the version 1.3.212 of the Vulkan-ValidationLayers repo.
This commit is contained in:
76
Externals/glslang/StandAlone/CMakeLists.txt
vendored
76
Externals/glslang/StandAlone/CMakeLists.txt
vendored
@ -1,5 +1,55 @@
|
||||
# Copyright (C) 2020 The Khronos Group Inc.
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# Neither the name of The Khronos Group Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
find_host_package(PythonInterp 3 REQUIRED)
|
||||
|
||||
set(GLSLANG_INTRINSIC_H "${GLSLANG_GENERATED_INCLUDEDIR}/glslang/glsl_intrinsic_header.h")
|
||||
set(GLSLANG_INTRINSIC_PY "${CMAKE_CURRENT_SOURCE_DIR}/../gen_extension_headers.py")
|
||||
set(GLSLANG_INTRINSIC_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../glslang/ExtensionHeaders")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${GLSLANG_INTRINSIC_H}
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${GLSLANG_INTRINSIC_PY}"
|
||||
"-i" ${GLSLANG_INTRINSIC_HEADER_DIR}
|
||||
"-o" ${GLSLANG_INTRINSIC_H}
|
||||
DEPENDS ${GLSLANG_INTRINSIC_PY}
|
||||
COMMENT "Generating ${GLSLANG_INTRINSIC_H}")
|
||||
|
||||
#add_custom_target(glslangValidator DEPENDS ${GLSLANG_INTRINSIC_H})
|
||||
|
||||
add_library(glslang-default-resource-limits
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resource_limits_c.cpp)
|
||||
set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
|
||||
set_property(TARGET glslang-default-resource-limits PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
@ -7,8 +57,7 @@ target_include_directories(glslang-default-resource-limits
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
|
||||
|
||||
|
||||
set(SOURCES StandAlone.cpp DirStackFileIncluder.h)
|
||||
set(SOURCES StandAlone.cpp DirStackFileIncluder.h ${GLSLANG_INTRINSIC_H})
|
||||
|
||||
add_executable(glslangValidator ${SOURCES})
|
||||
set_property(TARGET glslangValidator PROPERTY FOLDER tools)
|
||||
@ -29,13 +78,19 @@ elseif(UNIX)
|
||||
if(NOT ANDROID)
|
||||
set(LIBRARIES ${LIBRARIES} pthread)
|
||||
endif()
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
target_link_libraries(glslangValidator ${LIBRARIES})
|
||||
target_include_directories(glslangValidator PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
|
||||
|
||||
if(ENABLE_OPT)
|
||||
target_include_directories(glslangValidator
|
||||
PRIVATE ${spirv-tools_SOURCE_DIR}/include
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SPVREMAPPER)
|
||||
set(REMAPPER_SOURCES spirv-remap.cpp)
|
||||
add_executable(spirv-remap ${REMAPPER_SOURCES})
|
||||
@ -46,7 +101,7 @@ endif()
|
||||
|
||||
if(WIN32)
|
||||
source_group("Source" FILES ${SOURCES})
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
if(ENABLE_GLSLANG_INSTALL)
|
||||
install(TARGETS glslangValidator EXPORT glslangValidatorTargets
|
||||
@ -61,7 +116,12 @@ if(ENABLE_GLSLANG_INSTALL)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
else()
|
||||
install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
endif(ENABLE_GLSLANG_INSTALL)
|
||||
install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
endif()
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
||||
#include "./../glslang/Public/ShaderLang.h"
|
||||
|
||||
@ -84,12 +85,18 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual std::set<std::string> getIncludedFiles()
|
||||
{
|
||||
return includedFiles;
|
||||
}
|
||||
|
||||
virtual ~DirStackFileIncluder() override { }
|
||||
|
||||
protected:
|
||||
typedef char tUserDataElement;
|
||||
std::vector<std::string> directoryStack;
|
||||
int externalLocalDirectoryCount;
|
||||
std::set<std::string> includedFiles;
|
||||
|
||||
// Search for a valid "local" path based on combining the stack of include
|
||||
// directories and the nominal name of the header.
|
||||
@ -108,6 +115,7 @@ protected:
|
||||
std::ifstream file(path, std::ios_base::binary | std::ios_base::ate);
|
||||
if (file) {
|
||||
directoryStack.push_back(getDirectory(path));
|
||||
includedFiles.insert(path);
|
||||
return newIncludeResult(path, file, (int)file.tellg());
|
||||
}
|
||||
}
|
||||
|
@ -134,6 +134,7 @@ const TBuiltInResource DefaultTBuiltInResource = {
|
||||
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
||||
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
||||
/* .maxMeshViewCountNV = */ 4,
|
||||
/* .maxDualSourceDrawBuffersEXT = */ 1,
|
||||
|
||||
/* .limits = */ {
|
||||
/* .nonInductiveForLoops = */ 1,
|
||||
@ -243,6 +244,7 @@ std::string GetDefaultTBuiltInResourceString()
|
||||
<< "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n"
|
||||
<< "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n"
|
||||
<< "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n"
|
||||
<< "MaxDualSourceDrawBuffersEXT " << DefaultTBuiltInResource.maxDualSourceDrawBuffersEXT << "\n"
|
||||
<< "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
|
||||
<< "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
|
||||
<< "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
|
||||
|
448
Externals/glslang/StandAlone/StandAlone.cpp
vendored
448
Externals/glslang/StandAlone/StandAlone.cpp
vendored
@ -1,6 +1,8 @@
|
||||
//
|
||||
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
||||
// Copyright (C) 2013-2016 LunarG, Inc.
|
||||
// Copyright (C) 2016-2020 Google, Inc.
|
||||
// Modifications Copyright(C) 2021 Advanced Micro Devices, Inc.All rights reserved.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@ -43,7 +45,6 @@
|
||||
#include "Worklist.h"
|
||||
#include "DirStackFileIncluder.h"
|
||||
#include "./../glslang/Include/ShHandle.h"
|
||||
#include "./../glslang/Include/revision.h"
|
||||
#include "./../glslang/Public/ShaderLang.h"
|
||||
#include "../SPIRV/GlslangToSpv.h"
|
||||
#include "../SPIRV/GLSL.std.450.h"
|
||||
@ -58,11 +59,17 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <set>
|
||||
|
||||
#include "../glslang/OSDependent/osinclude.h"
|
||||
|
||||
// Build-time generated includes
|
||||
#include "glslang/build_info.h"
|
||||
|
||||
#include "glslang/glsl_intrinsic_header.h"
|
||||
|
||||
extern "C" {
|
||||
SH_IMPORT_EXPORT void ShOutputHtml();
|
||||
GLSLANG_EXPORT void ShOutputHtml();
|
||||
}
|
||||
|
||||
// Command-line options
|
||||
@ -105,6 +112,10 @@ bool targetHlslFunctionality1 = false;
|
||||
bool SpvToolsDisassembler = false;
|
||||
bool SpvToolsValidate = false;
|
||||
bool NaNClamp = false;
|
||||
bool stripDebugInfo = false;
|
||||
bool beQuiet = false;
|
||||
bool VulkanRulesRelaxed = false;
|
||||
bool autoSampledTextures = false;
|
||||
|
||||
//
|
||||
// Return codes from main/exit().
|
||||
@ -159,12 +170,15 @@ int ReflectOptions = EShReflectionDefault;
|
||||
int Options = 0;
|
||||
const char* ExecutableName = nullptr;
|
||||
const char* binaryFileName = nullptr;
|
||||
const char* depencyFileName = nullptr;
|
||||
const char* entryPointName = nullptr;
|
||||
const char* sourceEntryPointName = nullptr;
|
||||
const char* shaderStageName = nullptr;
|
||||
const char* variableName = nullptr;
|
||||
bool HlslEnable16BitTypes = false;
|
||||
bool HlslDX9compatible = false;
|
||||
bool HlslDxPositionW = false;
|
||||
bool EnhancedMsgs = false;
|
||||
bool DumpBuiltinSymbols = false;
|
||||
std::vector<std::string> IncludeDirectoryList;
|
||||
|
||||
@ -178,6 +192,9 @@ glslang::EShTargetClientVersion ClientVersion; // not valid until Client i
|
||||
glslang::EShTargetLanguage TargetLanguage = glslang::EShTargetNone;
|
||||
glslang::EShTargetLanguageVersion TargetVersion; // not valid until TargetLanguage is set
|
||||
|
||||
// GLSL version
|
||||
int GlslVersion = 0; // GLSL version specified on CLI, overrides #version in shader source
|
||||
|
||||
std::vector<std::string> Processes; // what should be recorded by OpModuleProcessed, or equivalent
|
||||
|
||||
// Per descriptor-set binding base data
|
||||
@ -190,6 +207,17 @@ std::array<std::array<unsigned int, EShLangCount>, glslang::EResCount> baseBindi
|
||||
std::array<std::array<TPerSetBaseBinding, EShLangCount>, glslang::EResCount> baseBindingForSet;
|
||||
std::array<std::vector<std::string>, EShLangCount> baseResourceSetBinding;
|
||||
|
||||
std::vector<std::pair<std::string, glslang::TBlockStorageClass>> blockStorageOverrides;
|
||||
|
||||
bool setGlobalUniformBlock = false;
|
||||
std::string globalUniformName;
|
||||
unsigned int globalUniformBinding;
|
||||
unsigned int globalUniformSet;
|
||||
|
||||
bool setGlobalBufferBlock = false;
|
||||
std::string atomicCounterBlockName;
|
||||
unsigned int atomicCounterBlockSet;
|
||||
|
||||
// Add things like "#define ..." to a preamble to use in the beginning of the shader.
|
||||
class TPreamble {
|
||||
public:
|
||||
@ -241,7 +269,9 @@ protected:
|
||||
std::string text; // contents of preamble
|
||||
};
|
||||
|
||||
// Track the user's #define and #undef from the command line.
|
||||
TPreamble UserPreamble;
|
||||
std::string PreambleString;
|
||||
|
||||
//
|
||||
// Create the default name for saving a binary if -o is not provided.
|
||||
@ -257,12 +287,12 @@ const char* GetBinaryName(EShLanguage stage)
|
||||
case EShLangGeometry: name = "geom.spv"; break;
|
||||
case EShLangFragment: name = "frag.spv"; break;
|
||||
case EShLangCompute: name = "comp.spv"; break;
|
||||
case EShLangRayGenNV: name = "rgen.spv"; break;
|
||||
case EShLangIntersectNV: name = "rint.spv"; break;
|
||||
case EShLangAnyHitNV: name = "rahit.spv"; break;
|
||||
case EShLangClosestHitNV: name = "rchit.spv"; break;
|
||||
case EShLangMissNV: name = "rmiss.spv"; break;
|
||||
case EShLangCallableNV: name = "rcall.spv"; break;
|
||||
case EShLangRayGen: name = "rgen.spv"; break;
|
||||
case EShLangIntersect: name = "rint.spv"; break;
|
||||
case EShLangAnyHit: name = "rahit.spv"; break;
|
||||
case EShLangClosestHit: name = "rchit.spv"; break;
|
||||
case EShLangMiss: name = "rmiss.spv"; break;
|
||||
case EShLangCallable: name = "rcall.spv"; break;
|
||||
case EShLangMeshNV: name = "mesh.spv"; break;
|
||||
case EShLangTaskNV: name = "task.spv"; break;
|
||||
default: name = "unknown"; break;
|
||||
@ -326,13 +356,13 @@ void ProcessBindingBase(int& argc, char**& argv, glslang::TResourceType res)
|
||||
lang = FindLanguage(argv[arg++], false);
|
||||
}
|
||||
|
||||
if ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
|
||||
if ((argc - arg) >= 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
|
||||
// Parse a per-set binding base
|
||||
while ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
|
||||
do {
|
||||
const int baseNum = atoi(argv[arg++]);
|
||||
const int setNum = atoi(argv[arg++]);
|
||||
perSetBase[setNum] = baseNum;
|
||||
}
|
||||
} while ((argc - arg) >= 2 && isdigit(argv[arg + 0][0]) && isdigit(argv[arg + 1][0]));
|
||||
} else {
|
||||
// Parse single binding base
|
||||
singleBase = atoi(argv[arg++]);
|
||||
@ -390,6 +420,115 @@ void ProcessResourceSetBindingBase(int& argc, char**& argv, std::array<std::vect
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Process an optional binding base of one the forms:
|
||||
// --argname name {uniform|buffer|push_constant}
|
||||
void ProcessBlockStorage(int& argc, char**& argv, std::vector<std::pair<std::string, glslang::TBlockStorageClass>>& storage)
|
||||
{
|
||||
if (argc < 3)
|
||||
usage();
|
||||
|
||||
glslang::TBlockStorageClass blockStorage = glslang::EbsNone;
|
||||
|
||||
std::string strBacking(argv[2]);
|
||||
if (strBacking == "uniform")
|
||||
blockStorage = glslang::EbsUniform;
|
||||
else if (strBacking == "buffer")
|
||||
blockStorage = glslang::EbsStorageBuffer;
|
||||
else if (strBacking == "push_constant")
|
||||
blockStorage = glslang::EbsPushConstant;
|
||||
else {
|
||||
printf("%s: invalid block storage\n", strBacking.c_str());
|
||||
usage();
|
||||
}
|
||||
|
||||
storage.push_back(std::make_pair(std::string(argv[1]), blockStorage));
|
||||
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
}
|
||||
|
||||
inline bool isNonDigit(char c) {
|
||||
// a non-digit character valid in a glsl identifier
|
||||
return (c == '_') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
// whether string isa valid identifier to be used in glsl
|
||||
bool isValidIdentifier(const char* str) {
|
||||
std::string idn(str);
|
||||
|
||||
if (idn.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (idn.length() >= 3 && idn.substr(0, 3) == "gl_") {
|
||||
// identifiers startin with "gl_" are reserved
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isNonDigit(idn[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (unsigned int i = 1; i < idn.length(); ++i) {
|
||||
if (!(isdigit(idn[i]) || isNonDigit(idn[i]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Process settings for either the global buffer block or global unfirom block
|
||||
// of the form:
|
||||
// --argname name set binding
|
||||
void ProcessGlobalBlockSettings(int& argc, char**& argv, std::string* name, unsigned int* set, unsigned int* binding)
|
||||
{
|
||||
if (argc < 4)
|
||||
usage();
|
||||
|
||||
unsigned int curArg = 1;
|
||||
|
||||
assert(name || set || binding);
|
||||
|
||||
if (name) {
|
||||
if (!isValidIdentifier(argv[curArg])) {
|
||||
printf("%s: invalid identifier\n", argv[curArg]);
|
||||
usage();
|
||||
}
|
||||
*name = argv[curArg];
|
||||
|
||||
curArg++;
|
||||
}
|
||||
|
||||
if (set) {
|
||||
errno = 0;
|
||||
int setVal = ::strtol(argv[curArg], NULL, 10);
|
||||
if (errno || setVal < 0) {
|
||||
printf("%s: invalid set\n", argv[curArg]);
|
||||
usage();
|
||||
}
|
||||
*set = setVal;
|
||||
|
||||
curArg++;
|
||||
}
|
||||
|
||||
if (binding) {
|
||||
errno = 0;
|
||||
int bindingVal = ::strtol(argv[curArg], NULL, 10);
|
||||
if (errno || bindingVal < 0) {
|
||||
printf("%s: invalid binding\n", argv[curArg]);
|
||||
usage();
|
||||
}
|
||||
*binding = bindingVal;
|
||||
|
||||
curArg++;
|
||||
}
|
||||
|
||||
argc -= (curArg - 1);
|
||||
argv += (curArg - 1);
|
||||
}
|
||||
|
||||
//
|
||||
// Do all command-line argument parsing. This includes building up the work-items
|
||||
// to be processed later, and saving all the command-line options.
|
||||
@ -518,6 +657,48 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
lowerword == "flatten-uniform-array" ||
|
||||
lowerword == "fua") {
|
||||
Options |= EOptionFlattenUniformArrays;
|
||||
} else if (lowerword == "glsl-version") {
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "100") == 0) {
|
||||
GlslVersion = 100;
|
||||
} else if (strcmp(argv[1], "110") == 0) {
|
||||
GlslVersion = 110;
|
||||
} else if (strcmp(argv[1], "120") == 0) {
|
||||
GlslVersion = 120;
|
||||
} else if (strcmp(argv[1], "130") == 0) {
|
||||
GlslVersion = 130;
|
||||
} else if (strcmp(argv[1], "140") == 0) {
|
||||
GlslVersion = 140;
|
||||
} else if (strcmp(argv[1], "150") == 0) {
|
||||
GlslVersion = 150;
|
||||
} else if (strcmp(argv[1], "300es") == 0) {
|
||||
GlslVersion = 300;
|
||||
} else if (strcmp(argv[1], "310es") == 0) {
|
||||
GlslVersion = 310;
|
||||
} else if (strcmp(argv[1], "320es") == 0) {
|
||||
GlslVersion = 320;
|
||||
} else if (strcmp(argv[1], "330") == 0) {
|
||||
GlslVersion = 330;
|
||||
} else if (strcmp(argv[1], "400") == 0) {
|
||||
GlslVersion = 400;
|
||||
} else if (strcmp(argv[1], "410") == 0) {
|
||||
GlslVersion = 410;
|
||||
} else if (strcmp(argv[1], "420") == 0) {
|
||||
GlslVersion = 420;
|
||||
} else if (strcmp(argv[1], "430") == 0) {
|
||||
GlslVersion = 430;
|
||||
} else if (strcmp(argv[1], "440") == 0) {
|
||||
GlslVersion = 440;
|
||||
} else if (strcmp(argv[1], "450") == 0) {
|
||||
GlslVersion = 450;
|
||||
} else if (strcmp(argv[1], "460") == 0) {
|
||||
GlslVersion = 460;
|
||||
} else
|
||||
Error("--glsl-version expected one of: 100, 110, 120, 130, 140, 150,\n"
|
||||
"300es, 310es, 320es, 330\n"
|
||||
"400, 410, 420, 430, 440, 450, 460");
|
||||
}
|
||||
bumpArg();
|
||||
} else if (lowerword == "hlsl-offsets") {
|
||||
Options |= EOptionHlslOffsets;
|
||||
} else if (lowerword == "hlsl-iomap" ||
|
||||
@ -528,6 +709,12 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
HlslEnable16BitTypes = true;
|
||||
} else if (lowerword == "hlsl-dx9-compatible") {
|
||||
HlslDX9compatible = true;
|
||||
} else if (lowerword == "hlsl-dx-position-w") {
|
||||
HlslDxPositionW = true;
|
||||
} else if (lowerword == "enhanced-msgs") {
|
||||
EnhancedMsgs = true;
|
||||
} else if (lowerword == "auto-sampled-textures") {
|
||||
autoSampledTextures = true;
|
||||
} else if (lowerword == "invert-y" || // synonyms
|
||||
lowerword == "iy") {
|
||||
Options |= EOptionInvertY;
|
||||
@ -553,10 +740,27 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
ReflectOptions |= EShReflectionAllBlockVariables;
|
||||
} else if (lowerword == "reflect-unwrap-io-blocks") {
|
||||
ReflectOptions |= EShReflectionUnwrapIOBlocks;
|
||||
} else if (lowerword == "reflect-all-io-variables") {
|
||||
ReflectOptions |= EShReflectionAllIOVariables;
|
||||
} else if (lowerword == "reflect-shared-std140-ubo") {
|
||||
ReflectOptions |= EShReflectionSharedStd140UBO;
|
||||
} else if (lowerword == "reflect-shared-std140-ssbo") {
|
||||
ReflectOptions |= EShReflectionSharedStd140SSBO;
|
||||
} else if (lowerword == "resource-set-bindings" || // synonyms
|
||||
lowerword == "resource-set-binding" ||
|
||||
lowerword == "rsb") {
|
||||
ProcessResourceSetBindingBase(argc, argv, baseResourceSetBinding);
|
||||
} else if (lowerword == "set-block-storage" ||
|
||||
lowerword == "sbs") {
|
||||
ProcessBlockStorage(argc, argv, blockStorageOverrides);
|
||||
} else if (lowerword == "set-atomic-counter-block" ||
|
||||
lowerword == "sacb") {
|
||||
ProcessGlobalBlockSettings(argc, argv, &atomicCounterBlockName, &atomicCounterBlockSet, nullptr);
|
||||
setGlobalBufferBlock = true;
|
||||
} else if (lowerword == "set-default-uniform-block" ||
|
||||
lowerword == "sdub") {
|
||||
ProcessGlobalBlockSettings(argc, argv, &globalUniformName, &globalUniformSet, &globalUniformBinding);
|
||||
setGlobalUniformBlock = true;
|
||||
} else if (lowerword == "shift-image-bindings" || // synonyms
|
||||
lowerword == "shift-image-binding" ||
|
||||
lowerword == "sib") {
|
||||
@ -611,6 +815,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
} else if (strcmp(argv[1], "vulkan1.2") == 0) {
|
||||
setVulkanSpv();
|
||||
ClientVersion = glslang::EShTargetVulkan_1_2;
|
||||
} else if (strcmp(argv[1], "vulkan1.3") == 0) {
|
||||
setVulkanSpv();
|
||||
ClientVersion = glslang::EShTargetVulkan_1_3;
|
||||
} else if (strcmp(argv[1], "opengl") == 0) {
|
||||
setOpenGlSpv();
|
||||
ClientVersion = glslang::EShTargetOpenGL_450;
|
||||
@ -632,9 +839,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
} else if (strcmp(argv[1], "spirv1.5") == 0) {
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_5;
|
||||
} else if (strcmp(argv[1], "spirv1.6") == 0) {
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_6;
|
||||
} else
|
||||
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2, opengl,\n"
|
||||
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5");
|
||||
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2,\n"
|
||||
"vulkan1.3, opengl, spirv1.0, spirv1.1, spirv1.2, spirv1.3,\n"
|
||||
"spirv1.4, spirv1.5 or spirv1.6");
|
||||
}
|
||||
bumpArg();
|
||||
} else if (lowerword == "undef-macro" ||
|
||||
@ -652,8 +863,18 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
variableName = argv[1];
|
||||
bumpArg();
|
||||
break;
|
||||
} else if (lowerword == "quiet") {
|
||||
beQuiet = true;
|
||||
} else if (lowerword == "depfile") {
|
||||
if (argc <= 1)
|
||||
Error("no <depfile-name> provided", lowerword.c_str());
|
||||
depencyFileName = argv[1];
|
||||
bumpArg();
|
||||
} else if (lowerword == "version") {
|
||||
Options |= EOptionDumpVersions;
|
||||
} else if (lowerword == "help") {
|
||||
usage();
|
||||
break;
|
||||
} else {
|
||||
Error("unrecognized command-line option", argv[0]);
|
||||
}
|
||||
@ -679,6 +900,8 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
setOpenGlSpv();
|
||||
if (argv[0][2] != 0)
|
||||
ClientInputSemanticsVersion = getAttachedNumber("-G<num> client input semantics");
|
||||
if (ClientInputSemanticsVersion != 100)
|
||||
Error("unknown client version for -G, should be 100");
|
||||
break;
|
||||
case 'H':
|
||||
Options |= EOptionHumanReadableSpv;
|
||||
@ -702,6 +925,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
else
|
||||
Error("unknown -O option");
|
||||
break;
|
||||
case 'R':
|
||||
VulkanRulesRelaxed = true;
|
||||
break;
|
||||
case 'S':
|
||||
if (argc <= 1)
|
||||
Error("no <stage> specified for -S");
|
||||
@ -715,6 +941,8 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
setVulkanSpv();
|
||||
if (argv[0][2] != 0)
|
||||
ClientInputSemanticsVersion = getAttachedNumber("-V<num> client input semantics");
|
||||
if (ClientInputSemanticsVersion != 100)
|
||||
Error("unknown client version for -V, should be 100");
|
||||
break;
|
||||
case 'c':
|
||||
Options |= EOptionDumpConfig;
|
||||
@ -739,7 +967,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
Error("-f: expected hlsl_functionality1");
|
||||
break;
|
||||
case 'g':
|
||||
Options |= EOptionDebug;
|
||||
// Override previous -g or -g0 argument
|
||||
stripDebugInfo = false;
|
||||
Options &= ~EOptionDebug;
|
||||
if (argv[0][2] == '0')
|
||||
stripDebugInfo = true;
|
||||
else
|
||||
Options |= EOptionDebug;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
@ -817,6 +1051,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
(Options & EOptionReadHlsl) == 0)
|
||||
Error("uniform array flattening only valid when compiling HLSL source.");
|
||||
|
||||
if ((Options & EOptionReadHlsl) && (Client == glslang::EShClientOpenGL)) {
|
||||
Error("Using HLSL input under OpenGL semantics is not currently supported.");
|
||||
}
|
||||
|
||||
// rationalize client and target language
|
||||
if (TargetLanguage == glslang::EShTargetNone) {
|
||||
switch (ClientVersion) {
|
||||
@ -832,6 +1070,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_5;
|
||||
break;
|
||||
case glslang::EShTargetVulkan_1_3:
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_6;
|
||||
break;
|
||||
case glslang::EShTargetOpenGL_450:
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_0;
|
||||
@ -879,6 +1121,8 @@ void SetMessageOptions(EShMessages& messages)
|
||||
messages = (EShMessages)(messages | EShMsgHlslDX9Compatible);
|
||||
if (DumpBuiltinSymbols)
|
||||
messages = (EShMessages)(messages | EShMsgBuiltinSymbolTable);
|
||||
if (EnhancedMsgs)
|
||||
messages = (EShMessages)(messages | EShMsgEnhanced);
|
||||
}
|
||||
|
||||
//
|
||||
@ -969,6 +1213,46 @@ struct ShaderCompUnit {
|
||||
}
|
||||
};
|
||||
|
||||
// Writes a string into a depfile, escaping some special characters following the Makefile rules.
|
||||
static void writeEscapedDepString(std::ofstream& file, const std::string& str)
|
||||
{
|
||||
for (char c : str) {
|
||||
switch (c) {
|
||||
case ' ':
|
||||
case ':':
|
||||
case '#':
|
||||
case '[':
|
||||
case ']':
|
||||
case '\\':
|
||||
file << '\\';
|
||||
break;
|
||||
case '$':
|
||||
file << '$';
|
||||
break;
|
||||
}
|
||||
file << c;
|
||||
}
|
||||
}
|
||||
|
||||
// Writes a depfile similar to gcc -MMD foo.c
|
||||
bool writeDepFile(std::string depfile, std::vector<std::string>& binaryFiles, const std::vector<std::string>& sources)
|
||||
{
|
||||
std::ofstream file(depfile);
|
||||
if (file.fail())
|
||||
return false;
|
||||
|
||||
for (auto binaryFile = binaryFiles.begin(); binaryFile != binaryFiles.end(); binaryFile++) {
|
||||
writeEscapedDepString(file, *binaryFile);
|
||||
file << ":";
|
||||
for (auto sourceFile = sources.begin(); sourceFile != sources.end(); sourceFile++) {
|
||||
file << " ";
|
||||
writeEscapedDepString(file, *sourceFile);
|
||||
}
|
||||
file << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// For linking mode: Will independently parse each compilation unit, but then put them
|
||||
// in the same program and link them together, making at most one linked module per
|
||||
@ -985,6 +1269,12 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
EShMessages messages = EShMsgDefault;
|
||||
SetMessageOptions(messages);
|
||||
|
||||
DirStackFileIncluder includer;
|
||||
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
|
||||
includer.pushExternalLocalDirectory(dir); });
|
||||
|
||||
std::vector<std::string> sources;
|
||||
|
||||
//
|
||||
// Per-shader processing...
|
||||
//
|
||||
@ -992,6 +1282,9 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
glslang::TProgram& program = *new glslang::TProgram;
|
||||
for (auto it = compUnits.cbegin(); it != compUnits.cend(); ++it) {
|
||||
const auto &compUnit = *it;
|
||||
for (int i = 0; i < compUnit.count; i++) {
|
||||
sources.push_back(compUnit.fileNameList[i]);
|
||||
}
|
||||
glslang::TShader* shader = new glslang::TShader(compUnit.stage);
|
||||
shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count);
|
||||
if (entryPointName)
|
||||
@ -1002,8 +1295,19 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
"Use '-e <name>'.\n");
|
||||
shader->setSourceEntryPoint(sourceEntryPointName);
|
||||
}
|
||||
|
||||
shader->setOverrideVersion(GlslVersion);
|
||||
|
||||
std::string intrinsicString = getIntrinsic(compUnit.text, compUnit.count);
|
||||
|
||||
PreambleString = "";
|
||||
if (UserPreamble.isSet())
|
||||
shader->setPreamble(UserPreamble.get());
|
||||
PreambleString.append(UserPreamble.get());
|
||||
|
||||
if (!intrinsicString.empty())
|
||||
PreambleString.append(intrinsicString);
|
||||
|
||||
shader->setPreamble(PreambleString.c_str());
|
||||
shader->addProcesses(Processes);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
@ -1023,6 +1327,9 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
|
||||
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
||||
|
||||
if (autoSampledTextures)
|
||||
shader->setTextureSamplerTransformMode(EShTexSampTransUpgradeTextureRemoveSampler);
|
||||
|
||||
if (Options & EOptionAutoMapBindings)
|
||||
shader->setAutoMapBindings(true);
|
||||
|
||||
@ -1037,6 +1344,24 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
shader->setUniformLocationBase(uniformBase);
|
||||
#endif
|
||||
|
||||
if (VulkanRulesRelaxed) {
|
||||
for (auto& storageOverride : blockStorageOverrides) {
|
||||
shader->addBlockStorageOverride(storageOverride.first.c_str(),
|
||||
storageOverride.second);
|
||||
}
|
||||
|
||||
if (setGlobalBufferBlock) {
|
||||
shader->setAtomicCounterBlockName(atomicCounterBlockName.c_str());
|
||||
shader->setAtomicCounterBlockSet(atomicCounterBlockSet);
|
||||
}
|
||||
|
||||
if (setGlobalUniformBlock) {
|
||||
shader->setGlobalUniformBlockName(globalUniformName.c_str());
|
||||
shader->setGlobalUniformSet(globalUniformSet);
|
||||
shader->setGlobalUniformBinding(globalUniformBinding);
|
||||
}
|
||||
}
|
||||
|
||||
shader->setNanMinMaxClamp(NaNClamp);
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
@ -1048,6 +1373,12 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
if (Options & EOptionInvertY)
|
||||
shader->setInvertY(true);
|
||||
|
||||
if (HlslDxPositionW)
|
||||
shader->setDxPositionW(true);
|
||||
|
||||
if (EnhancedMsgs)
|
||||
shader->setEnhancedMsgs();
|
||||
|
||||
// Set up the environment, some subsettings take precedence over earlier
|
||||
// ways of setting things.
|
||||
if (Options & EOptionSpv) {
|
||||
@ -1060,15 +1391,14 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
if (targetHlslFunctionality1)
|
||||
shader->setEnvTargetHlslFunctionality1();
|
||||
#endif
|
||||
if (VulkanRulesRelaxed)
|
||||
shader->setEnvInputVulkanRulesRelaxed();
|
||||
}
|
||||
|
||||
shaders.push_back(shader);
|
||||
|
||||
const int defaultVersion = Options & EOptionDefaultDesktop ? 110 : 100;
|
||||
|
||||
DirStackFileIncluder includer;
|
||||
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
|
||||
includer.pushExternalLocalDirectory(dir); });
|
||||
#ifndef GLSLANG_WEB
|
||||
if (Options & EOptionOutputPreprocessed) {
|
||||
std::string str;
|
||||
@ -1090,7 +1420,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
|
||||
if (! (Options & EOptionSuppressInfolog) &&
|
||||
! (Options & EOptionMemoryLeakMode)) {
|
||||
PutsIfNonEmpty(compUnit.fileName[0].c_str());
|
||||
if (!beQuiet)
|
||||
PutsIfNonEmpty(compUnit.fileName[0].c_str());
|
||||
PutsIfNonEmpty(shader->getInfoLog());
|
||||
PutsIfNonEmpty(shader->getInfoDebugLog());
|
||||
}
|
||||
@ -1127,6 +1458,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::string> outputFiles;
|
||||
|
||||
// Dump SPIR-V
|
||||
if (Options & EOptionSpv) {
|
||||
if (CompileFailed || LinkFailed)
|
||||
@ -1135,11 +1468,12 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
for (int stage = 0; stage < EShLangCount; ++stage) {
|
||||
if (program.getIntermediate((EShLanguage)stage)) {
|
||||
std::vector<unsigned int> spirv;
|
||||
std::string warningsErrors;
|
||||
spv::SpvBuildLogger logger;
|
||||
glslang::SpvOptions spvOptions;
|
||||
if (Options & EOptionDebug)
|
||||
spvOptions.generateDebugInfo = true;
|
||||
else if (stripDebugInfo)
|
||||
spvOptions.stripDebugInfo = true;
|
||||
spvOptions.disableOptimizer = (Options & EOptionOptimizeDisable) != 0;
|
||||
spvOptions.optimizeSize = (Options & EOptionOptimizeSize) != 0;
|
||||
spvOptions.disassemble = SpvToolsDisassembler;
|
||||
@ -1155,6 +1489,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
} else {
|
||||
glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage));
|
||||
}
|
||||
|
||||
outputFiles.push_back(GetBinaryName((EShLanguage)stage));
|
||||
#ifndef GLSLANG_WEB
|
||||
if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv))
|
||||
spv::Disassemble(std::cout, spirv);
|
||||
@ -1165,6 +1501,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
}
|
||||
}
|
||||
|
||||
if (depencyFileName && !(CompileFailed || LinkFailed)) {
|
||||
std::set<std::string> includedFiles = includer.getIncludedFiles();
|
||||
sources.insert(sources.end(), includedFiles.begin(), includedFiles.end());
|
||||
|
||||
writeDepFile(depencyFileName, outputFiles, sources);
|
||||
}
|
||||
|
||||
// Free everything up, program has to go before the shaders
|
||||
// because it might have merged stuff from the shaders, and
|
||||
// the stuff from the shaders has to have its destructors called
|
||||
@ -1255,13 +1598,13 @@ int singleMain()
|
||||
#endif
|
||||
|
||||
if (Options & EOptionDumpBareVersion) {
|
||||
printf("%d.%d.%d\n",
|
||||
glslang::GetSpirvGeneratorVersion(), GLSLANG_MINOR_VERSION, GLSLANG_PATCH_LEVEL);
|
||||
printf("%d:%d.%d.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR, GLSLANG_VERSION_MINOR,
|
||||
GLSLANG_VERSION_PATCH, GLSLANG_VERSION_FLAVOR);
|
||||
if (workList.empty())
|
||||
return ESuccess;
|
||||
} else if (Options & EOptionDumpVersions) {
|
||||
printf("Glslang Version: %d.%d.%d\n",
|
||||
glslang::GetSpirvGeneratorVersion(), GLSLANG_MINOR_VERSION, GLSLANG_PATCH_LEVEL);
|
||||
printf("Glslang Version: %d:%d.%d.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR,
|
||||
GLSLANG_VERSION_MINOR, GLSLANG_VERSION_PATCH, GLSLANG_VERSION_FLAVOR);
|
||||
printf("ESSL Version: %s\n", glslang::GetEsslVersionString());
|
||||
printf("GLSL Version: %s\n", glslang::GetGlslVersionString());
|
||||
std::string spirvVersion;
|
||||
@ -1425,17 +1768,17 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
|
||||
else if (stageName == "comp")
|
||||
return EShLangCompute;
|
||||
else if (stageName == "rgen")
|
||||
return EShLangRayGenNV;
|
||||
return EShLangRayGen;
|
||||
else if (stageName == "rint")
|
||||
return EShLangIntersectNV;
|
||||
return EShLangIntersect;
|
||||
else if (stageName == "rahit")
|
||||
return EShLangAnyHitNV;
|
||||
return EShLangAnyHit;
|
||||
else if (stageName == "rchit")
|
||||
return EShLangClosestHitNV;
|
||||
return EShLangClosestHit;
|
||||
else if (stageName == "rmiss")
|
||||
return EShLangMissNV;
|
||||
return EShLangMiss;
|
||||
else if (stageName == "rcall")
|
||||
return EShLangCallableNV;
|
||||
return EShLangCallable;
|
||||
else if (stageName == "mesh")
|
||||
return EShLangMeshNV;
|
||||
else if (stageName == "task")
|
||||
@ -1532,12 +1875,16 @@ void usage()
|
||||
" 'ver', when present, is the version of the input semantics,\n"
|
||||
" which will appear in #define GL_SPIRV ver;\n"
|
||||
" '--client opengl100' is the same as -G100;\n"
|
||||
" a '--target-env' for OpenGL will also imply '-G'\n"
|
||||
" a '--target-env' for OpenGL will also imply '-G';\n"
|
||||
" currently only supports GLSL\n"
|
||||
" -H print human readable form of SPIR-V; turns on -V\n"
|
||||
" -I<dir> add dir to the include search path; includer's directory\n"
|
||||
" is searched first, followed by left-to-right order of -I\n"
|
||||
" -Od disables optimization; may cause illegal SPIR-V for HLSL\n"
|
||||
" -Os optimizes SPIR-V to minimize size\n"
|
||||
" -R use relaxed verification rules for generating Vulkan SPIR-V,\n"
|
||||
" allowing the use of default uniforms, atomic_uints, and\n"
|
||||
" gl_VertexID and gl_InstanceID keywords.\n"
|
||||
" -S <stage> uses specified stage rather than parsing the file extension\n"
|
||||
" choices for <stage> are vert, tesc, tese, geom, frag, or comp\n"
|
||||
" -U<name> | --undef-macro <name> | --U <name>\n"
|
||||
@ -1558,6 +1905,7 @@ void usage()
|
||||
" 'hlsl_functionality1' enables use of the\n"
|
||||
" SPV_GOOGLE_hlsl_functionality1 extension\n"
|
||||
" -g generate debug information\n"
|
||||
" -g0 strip debug information\n"
|
||||
" -h print this usage message\n"
|
||||
" -i intermediate tree (glslang AST) is printed out\n"
|
||||
" -l link all input files together to form a single module\n"
|
||||
@ -1579,21 +1927,35 @@ void usage()
|
||||
" without explicit bindings\n"
|
||||
" --auto-map-locations | --aml automatically locate input/output lacking\n"
|
||||
" 'location' (fragile, not cross stage)\n"
|
||||
" --auto-sampled-textures Removes sampler variables and converts\n"
|
||||
" existing textures to sampled textures\n"
|
||||
" --client {vulkan<ver>|opengl<ver>} see -V and -G\n"
|
||||
" --depfile <file> writes depfile for build systems\n"
|
||||
" --dump-builtin-symbols prints builtin symbol table prior each compile\n"
|
||||
" -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n"
|
||||
" --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n"
|
||||
" scalars\n"
|
||||
" --glsl-version {100 | 110 | 120 | 130 | 140 | 150 |\n"
|
||||
" 300es | 310es | 320es | 330\n"
|
||||
" 400 | 410 | 420 | 430 | 440 | 450 | 460}\n"
|
||||
" set GLSL version, overrides #version\n"
|
||||
" in shader sourcen\n"
|
||||
" --hlsl-offsets allow block offsets to follow HLSL rules\n"
|
||||
" works independently of source language\n"
|
||||
" --hlsl-iomap perform IO mapping in HLSL register space\n"
|
||||
" --hlsl-enable-16bit-types allow 16-bit types in SPIR-V for HLSL\n"
|
||||
" --hlsl-dx9-compatible interprets sampler declarations as a\n"
|
||||
" texture/sampler combo like DirectX9 would.\n"
|
||||
" texture/sampler combo like DirectX9 would,\n"
|
||||
" and recognizes DirectX9-specific semantics\n"
|
||||
" --hlsl-dx-position-w W component of SV_Position in HLSL fragment\n"
|
||||
" shaders compatible with DirectX\n"
|
||||
" --invert-y | --iy invert position.Y output in vertex shader\n"
|
||||
" --enhanced-msgs print more readable error messages (GLSL only)\n"
|
||||
" --keep-uncalled | --ku don't eliminate uncalled functions\n"
|
||||
" --nan-clamp favor non-NaN operand in min, max, and clamp\n"
|
||||
" --no-storage-format | --nsf use Unknown image format\n"
|
||||
" --quiet do not print anything to stdout, unless\n"
|
||||
" requested by another option\n"
|
||||
" --reflect-strict-array-suffix use strict array suffix rules when\n"
|
||||
" reflecting\n"
|
||||
" --reflect-basic-array-suffix arrays of basic types will have trailing [0]\n"
|
||||
@ -1611,6 +1973,22 @@ void usage()
|
||||
" --resource-set-binding [stage] set\n"
|
||||
" set descriptor set for all resources\n"
|
||||
" --rsb synonym for --resource-set-binding\n"
|
||||
" --set-block-backing name {uniform|buffer|push_constant}\n"
|
||||
" changes the backing type of a uniform, buffer,\n"
|
||||
" or push_constant block declared in\n"
|
||||
" in the program, when using -R option.\n"
|
||||
" This can be used to change the backing\n"
|
||||
" for existing blocks as well as implicit ones\n"
|
||||
" such as 'gl_DefaultUniformBlock'.\n"
|
||||
" --sbs synonym for set-block-storage\n"
|
||||
" --set-atomic-counter-block name set\n"
|
||||
" set name, and descriptor set for\n"
|
||||
" atomic counter blocks, with -R opt\n"
|
||||
" --sacb synonym for set-atomic-counter-block\n"
|
||||
" --set-default-uniform-block name set binding\n"
|
||||
" set name, descriptor set, and binding for\n"
|
||||
" global default-uniform-block, with -R opt\n"
|
||||
" --sdub synonym for set-default-uniform-block\n"
|
||||
" --shift-image-binding [stage] num\n"
|
||||
" base binding number for images (uav)\n"
|
||||
" --shift-image-binding [stage] [num set]...\n"
|
||||
@ -1647,8 +2025,9 @@ void usage()
|
||||
" --sep synonym for --source-entrypoint\n"
|
||||
" --stdin read from stdin instead of from a file;\n"
|
||||
" requires providing the shader stage using -S\n"
|
||||
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | opengl | \n"
|
||||
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 | spirv1.5}\n"
|
||||
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | vulkan1.3 | opengl |\n"
|
||||
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 |\n"
|
||||
" spirv1.5 | spirv1.6}\n"
|
||||
" Set the execution environment that the\n"
|
||||
" generated code will be executed in.\n"
|
||||
" Defaults to:\n"
|
||||
@ -1657,6 +2036,7 @@ void usage()
|
||||
" * spirv1.0 under --target-env vulkan1.0\n"
|
||||
" * spirv1.3 under --target-env vulkan1.1\n"
|
||||
" * spirv1.5 under --target-env vulkan1.2\n"
|
||||
" * spirv1.6 under --target-env vulkan1.3\n"
|
||||
" Multiple --target-env can be specified.\n"
|
||||
" --variable-name <name>\n"
|
||||
" --vn <name> creates a C header file that contains a\n"
|
||||
|
65
Externals/glslang/StandAlone/resource_limits_c.cpp
vendored
Normal file
65
Externals/glslang/StandAlone/resource_limits_c.cpp
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2020, Travis Fort
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**/
|
||||
|
||||
#include "resource_limits_c.h"
|
||||
#include "ResourceLimits.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
const glslang_resource_t* glslang_default_resource(void)
|
||||
{
|
||||
return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource);
|
||||
}
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
const char* glslang_default_resource_string()
|
||||
{
|
||||
std::string cpp_str = glslang::GetDefaultTBuiltInResourceString();
|
||||
char* c_str = (char*)malloc(cpp_str.length() + 1);
|
||||
strcpy(c_str, cpp_str.c_str());
|
||||
return c_str;
|
||||
}
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
|
||||
{
|
||||
glslang::DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config);
|
||||
}
|
54
Externals/glslang/StandAlone/resource_limits_c.h
vendored
Normal file
54
Externals/glslang/StandAlone/resource_limits_c.h
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2020, Travis Fort
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**/
|
||||
|
||||
#ifndef _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
|
||||
#define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
|
||||
|
||||
#include "../glslang/Include/glslang_c_interface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// These are the default resources for TBuiltInResources, used for both
|
||||
// - parsing this string for the case where the user didn't supply one,
|
||||
// - dumping out a template for user construction of a config file.
|
||||
const glslang_resource_t* glslang_default_resource(void);
|
||||
|
||||
// Returns the DefaultTBuiltInResource as a human-readable string.
|
||||
// NOTE: User is responsible for freeing this string.
|
||||
const char* glslang_default_resource_string();
|
||||
|
||||
// Decodes the resource limits from |config| to |resources|.
|
||||
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
|
2
Externals/glslang/StandAlone/spirv-remap.cpp
vendored
2
Externals/glslang/StandAlone/spirv-remap.cpp
vendored
@ -334,8 +334,6 @@ int main(int argc, char** argv)
|
||||
if (outputDir.empty())
|
||||
usage(argv[0], "Output directory required");
|
||||
|
||||
std::string errmsg;
|
||||
|
||||
// Main operations: read, remap, and write.
|
||||
execute(inputFile, outputDir, opts, verbosity);
|
||||
|
||||
|
Reference in New Issue
Block a user