Update glslang to 15.2.0
This commit is contained in:
parent
9967cfb319
commit
c6344588c2
74 changed files with 12225 additions and 12593 deletions
|
|
@ -1,165 +0,0 @@
|
|||
//
|
||||
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
||||
// 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 3Dlabs Inc. Ltd. 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.
|
||||
//
|
||||
|
||||
#define SH_EXPORTING
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "InitializeDll.h"
|
||||
#include "../glslang/Include/InitializeGlobals.h"
|
||||
#include "../glslang/Public/ShaderLang.h"
|
||||
#include "../glslang/Include/PoolAlloc.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
OS_TLSIndex ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
|
||||
|
||||
// Per-process initialization.
|
||||
// Needs to be called at least once before parsing, etc. is done.
|
||||
// Will also do thread initialization for the calling thread; other
|
||||
// threads will need to do that explicitly.
|
||||
bool InitProcess()
|
||||
{
|
||||
glslang::GetGlobalLock();
|
||||
|
||||
if (ThreadInitializeIndex != OS_INVALID_TLS_INDEX) {
|
||||
//
|
||||
// Function is re-entrant.
|
||||
//
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return true;
|
||||
}
|
||||
|
||||
ThreadInitializeIndex = OS_AllocTLSIndex();
|
||||
|
||||
if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) {
|
||||
assert(0 && "InitProcess(): Failed to allocate TLS area for init flag");
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! InitializePoolIndex()) {
|
||||
assert(0 && "InitProcess(): Failed to initialize global pool");
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! InitThread()) {
|
||||
assert(0 && "InitProcess(): Failed to initialize thread");
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return false;
|
||||
}
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Per-thread scoped initialization.
|
||||
// Must be called at least once by each new thread sharing the
|
||||
// symbol tables, etc., needed to parse.
|
||||
bool InitThread()
|
||||
{
|
||||
//
|
||||
// This function is re-entrant
|
||||
//
|
||||
if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) {
|
||||
assert(0 && "InitThread(): Process hasn't been initalised.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (OS_GetTLSValue(ThreadInitializeIndex) != 0)
|
||||
return true;
|
||||
|
||||
if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) {
|
||||
assert(0 && "InitThread(): Unable to set init flag.");
|
||||
return false;
|
||||
}
|
||||
|
||||
glslang::SetThreadPoolAllocator(nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not necessary to call this: InitThread() is reentrant, and the need
|
||||
// to do per thread tear down has been removed.
|
||||
//
|
||||
// This is kept, with memory management removed, to satisfy any exiting
|
||||
// calls to it that rely on it.
|
||||
bool DetachThread()
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
|
||||
return true;
|
||||
|
||||
//
|
||||
// Function is re-entrant and this thread may not have been initialized.
|
||||
//
|
||||
if (OS_GetTLSValue(ThreadInitializeIndex) != 0) {
|
||||
if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) {
|
||||
assert(0 && "DetachThread(): Unable to clear init flag.");
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Not necessary to call this: InitProcess() is reentrant.
|
||||
//
|
||||
// This is kept, with memory management removed, to satisfy any exiting
|
||||
// calls to it that rely on it.
|
||||
//
|
||||
// Users of glslang should call shFinalize() or glslang::FinalizeProcess() for
|
||||
// process-scoped memory tear down.
|
||||
bool DetachProcess()
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
|
||||
return true;
|
||||
|
||||
success = DetachThread();
|
||||
|
||||
OS_FreeTLSIndex(ThreadInitializeIndex);
|
||||
ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
@ -44,12 +44,10 @@
|
|||
#include "glslang/Public/ResourceLimits.h"
|
||||
#include "Worklist.h"
|
||||
#include "DirStackFileIncluder.h"
|
||||
#include "./../glslang/Include/ShHandle.h"
|
||||
#include "./../glslang/Public/ShaderLang.h"
|
||||
#include "../glslang/MachineIndependent/localintermediate.h"
|
||||
#include "../SPIRV/GlslangToSpv.h"
|
||||
#include "../SPIRV/GLSL.std.450.h"
|
||||
#include "../SPIRV/doc.h"
|
||||
#include "../SPIRV/disassemble.h"
|
||||
|
||||
#include <array>
|
||||
|
|
@ -58,10 +56,12 @@
|
|||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
|
||||
#include "../glslang/OSDependent/osinclude.h"
|
||||
|
||||
|
|
@ -110,6 +110,8 @@ enum TOptions : uint64_t {
|
|||
EOptionInvertY = (1ull << 30),
|
||||
EOptionDumpBareVersion = (1ull << 31),
|
||||
EOptionCompileOnly = (1ull << 32),
|
||||
EOptionDisplayErrorColumn = (1ull << 33),
|
||||
EOptionLinkTimeOptimization = (1ull << 34),
|
||||
};
|
||||
bool targetHlslFunctionality1 = false;
|
||||
bool SpvToolsDisassembler = false;
|
||||
|
|
@ -842,6 +844,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
|||
} else if (strcmp(argv[1], "vulkan1.3") == 0) {
|
||||
setVulkanSpv();
|
||||
ClientVersion = glslang::EShTargetVulkan_1_3;
|
||||
} else if (strcmp(argv[1], "vulkan1.4") == 0) {
|
||||
setVulkanSpv();
|
||||
ClientVersion = glslang::EShTargetVulkan_1_4;
|
||||
} else if (strcmp(argv[1], "opengl") == 0) {
|
||||
setOpenGlSpv();
|
||||
ClientVersion = glslang::EShTargetOpenGL_450;
|
||||
|
|
@ -898,6 +903,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
|||
Options |= EOptionDumpVersions;
|
||||
} else if (lowerword == "no-link") {
|
||||
Options |= EOptionCompileOnly;
|
||||
} else if (lowerword == "error-column") {
|
||||
Options |= EOptionDisplayErrorColumn;
|
||||
} else if (lowerword == "lto") {
|
||||
Options |= EOptionLinkTimeOptimization;
|
||||
} else if (lowerword == "help") {
|
||||
usage();
|
||||
break;
|
||||
|
|
@ -1082,6 +1091,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
|||
if ((Options & EOptionDumpReflection) && !(Options & EOptionLinkProgram))
|
||||
Error("reflection requires -l for linking");
|
||||
|
||||
// link time optimization makes no sense unless linking
|
||||
if ((Options & EOptionLinkTimeOptimization) && !(Options & EOptionLinkProgram))
|
||||
Error("link time optimization requires -l for linking");
|
||||
|
||||
// -o or -x makes no sense if there is no target binary
|
||||
if (binaryFileName && (Options & EOptionSpv) == 0)
|
||||
Error("no binary generation requested (e.g., -V)");
|
||||
|
|
@ -1113,6 +1126,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
|||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_6;
|
||||
break;
|
||||
case glslang::EShTargetVulkan_1_4:
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_6;
|
||||
break;
|
||||
case glslang::EShTargetOpenGL_450:
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_0;
|
||||
|
|
@ -1164,6 +1181,10 @@ void SetMessageOptions(EShMessages& messages)
|
|||
messages = (EShMessages)(messages | EShMsgEnhanced);
|
||||
if (AbsolutePath)
|
||||
messages = (EShMessages)(messages | EShMsgAbsolutePath);
|
||||
if (Options & EOptionDisplayErrorColumn)
|
||||
messages = (EShMessages)(messages | EShMsgDisplayErrorColumn);
|
||||
if (Options & EOptionLinkTimeOptimization)
|
||||
messages = (EShMessages)(messages | EShMsgLinkTimeOptimization);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1506,6 +1527,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
|
||||
// Dump SPIR-V
|
||||
if (Options & EOptionSpv) {
|
||||
#ifdef ENABLE_SPIRV
|
||||
CompileOrLinkFailed.fetch_or(CompileFailed);
|
||||
CompileOrLinkFailed.fetch_or(LinkFailed);
|
||||
if (static_cast<bool>(CompileOrLinkFailed.load()))
|
||||
|
|
@ -1565,6 +1587,9 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
Error("This configuration of glslang does not have SPIR-V support");
|
||||
#endif
|
||||
}
|
||||
|
||||
CompileOrLinkFailed.fetch_or(CompileFailed);
|
||||
|
|
@ -1664,21 +1689,31 @@ int singleMain()
|
|||
}
|
||||
|
||||
if (Options & EOptionDumpBareVersion) {
|
||||
printf("%d:%d.%d.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR, GLSLANG_VERSION_MINOR,
|
||||
int spirvGeneratorVersion = 0;
|
||||
#ifdef ENABLE_SPIRV
|
||||
spirvGeneratorVersion = glslang::GetSpirvGeneratorVersion();
|
||||
#endif
|
||||
printf("%d:%d.%d.%d%s\n", spirvGeneratorVersion, 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.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR,
|
||||
int spirvGeneratorVersion = 0;
|
||||
#ifdef ENABLE_SPIRV
|
||||
spirvGeneratorVersion = glslang::GetSpirvGeneratorVersion();
|
||||
#endif
|
||||
printf("Glslang Version: %d:%d.%d.%d%s\n", spirvGeneratorVersion, 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;
|
||||
#if ENABLE_SPIRV
|
||||
glslang::GetSpirvVersion(spirvVersion);
|
||||
#endif
|
||||
printf("SPIR-V Version %s\n", spirvVersion.c_str());
|
||||
printf("GLSL.std.450 Version %d, Revision %d\n", GLSLstd450Version, GLSLstd450Revision);
|
||||
printf("Khronos Tool ID %d\n", glslang::GetKhronosToolId());
|
||||
printf("SPIR-V Generator Version %d\n", glslang::GetSpirvGeneratorVersion());
|
||||
printf("SPIR-V Generator Version %d\n", spirvGeneratorVersion);
|
||||
printf("GL_KHR_vulkan_glsl version %d\n", 100);
|
||||
printf("ARB_GL_gl_spirv version %d\n", 100);
|
||||
if (workList.empty())
|
||||
|
|
@ -2024,6 +2059,7 @@ void usage()
|
|||
" 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"
|
||||
" --error-column display the column of the error along the line\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"
|
||||
|
|
@ -2117,7 +2153,8 @@ void usage()
|
|||
" initialized with the shader binary code\n"
|
||||
" --no-link Only compile shader; do not link (GLSL-only)\n"
|
||||
" NOTE: this option will set the export linkage\n"
|
||||
" attribute on all functions\n");
|
||||
" attribute on all functions\n"
|
||||
" --lto perform link time optimization\n");
|
||||
|
||||
exit(EFailUsage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#ifndef WORKLIST_H_INCLUDED
|
||||
#define WORKLIST_H_INCLUDED
|
||||
|
||||
#include "../glslang/OSDependent/osinclude.h"
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ namespace {
|
|||
std::cout << " " << basename(name) << " [--version | -V]" << std::endl;
|
||||
std::cout << " " << basename(name) << " [--help | -?]" << std::endl;
|
||||
|
||||
exit(5);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// grind through each SPIR in turn
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
#ifndef GLSLANG_BUILD_INFO
|
||||
#define GLSLANG_BUILD_INFO
|
||||
|
||||
#define GLSLANG_VERSION_MAJOR 14
|
||||
#define GLSLANG_VERSION_MINOR 3
|
||||
#define GLSLANG_VERSION_MAJOR 15
|
||||
#define GLSLANG_VERSION_MINOR 2
|
||||
#define GLSLANG_VERSION_PATCH 0
|
||||
#define GLSLANG_VERSION_FLAVOR ""
|
||||
|
||||
|
|
|
|||
|
|
@ -30,15 +30,19 @@ 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 "../Include/glslang_c_interface.h"
|
||||
#include "glslang/glslang/Include/glslang_c_interface.h"
|
||||
|
||||
#include "../../StandAlone/DirStackFileIncluder.h"
|
||||
#include "../Public/ResourceLimits.h"
|
||||
#include "../Include/ShHandle.h"
|
||||
#include "glslang/StandAlone/DirStackFileIncluder.h"
|
||||
#include "glslang/glslang/Public/ResourceLimits.h"
|
||||
#include "glslang/glslang/Public/ShaderLang.h"
|
||||
#include "glslang/glslang/Include/ShHandle.h"
|
||||
|
||||
#include "../Include/ResourceLimits.h"
|
||||
#include "../MachineIndependent/Versions.h"
|
||||
#include "../MachineIndependent/localintermediate.h"
|
||||
#include "glslang/glslang/Include/BaseTypes.h"
|
||||
#include "glslang/glslang/Include/ResourceLimits.h"
|
||||
#include "glslang/glslang/Include/Types.h"
|
||||
#include "glslang/glslang/MachineIndependent/iomapper.h"
|
||||
#include "glslang/glslang/MachineIndependent/Versions.h"
|
||||
#include "glslang/glslang/MachineIndependent/localintermediate.h"
|
||||
|
||||
static_assert(int(GLSLANG_STAGE_COUNT) == EShLangCount, "");
|
||||
static_assert(int(GLSLANG_STAGE_MASK_COUNT) == EShLanguageMaskCount, "");
|
||||
|
|
@ -54,10 +58,12 @@ static_assert(int(GLSLANG_REFLECTION_COUNT) == EShReflectionCount, "");
|
|||
static_assert(int(GLSLANG_PROFILE_COUNT) == EProfileCount, "");
|
||||
static_assert(sizeof(glslang_limits_t) == sizeof(TLimits), "");
|
||||
static_assert(sizeof(glslang_resource_t) == sizeof(TBuiltInResource), "");
|
||||
static_assert(sizeof(glslang_version_t) == sizeof(glslang::Version), "");
|
||||
|
||||
typedef struct glslang_shader_s {
|
||||
glslang::TShader* shader;
|
||||
std::string preprocessedGLSL;
|
||||
std::vector<std::string> baseResourceSetBinding;
|
||||
} glslang_shader_t;
|
||||
|
||||
typedef struct glslang_program_s {
|
||||
|
|
@ -141,6 +147,11 @@ private:
|
|||
void* context;
|
||||
};
|
||||
|
||||
GLSLANG_EXPORT void glslang_get_version(glslang_version_t* version)
|
||||
{
|
||||
*reinterpret_cast<glslang::Version*>(version) = glslang::GetVersion();
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT int glslang_initialize_process() { return static_cast<int>(glslang::InitializeProcess()); }
|
||||
|
||||
GLSLANG_EXPORT void glslang_finalize_process() { glslang::FinalizeProcess(); }
|
||||
|
|
@ -205,7 +216,9 @@ static int c_shader_messages(glslang_messages_t messages)
|
|||
CONVERT_MSG(GLSLANG_MSG_HLSL_LEGALIZATION_BIT, EShMsgHlslLegalization);
|
||||
CONVERT_MSG(GLSLANG_MSG_HLSL_DX9_COMPATIBLE_BIT, EShMsgHlslDX9Compatible);
|
||||
CONVERT_MSG(GLSLANG_MSG_BUILTIN_SYMBOL_TABLE_BIT, EShMsgBuiltinSymbolTable);
|
||||
CONVERT_MSG(GLSLANG_MSG_ENHANCED, EShMsgEnhanced);
|
||||
CONVERT_MSG(GLSLANG_MSG_ABSOLUTE_PATH, EShMsgAbsolutePath);
|
||||
CONVERT_MSG(GLSLANG_MSG_DISPLAY_ERROR_COLUMN, EShMsgDisplayErrorColumn);
|
||||
return res;
|
||||
#undef CONVERT_MSG
|
||||
}
|
||||
|
|
@ -257,6 +270,8 @@ static glslang::EShTargetClientVersion c_shader_client_version(glslang_target_cl
|
|||
return glslang::EShTargetVulkan_1_2;
|
||||
case GLSLANG_TARGET_VULKAN_1_3:
|
||||
return glslang::EShTargetVulkan_1_3;
|
||||
case GLSLANG_TARGET_VULKAN_1_4:
|
||||
return glslang::EShTargetVulkan_1_4;
|
||||
case GLSLANG_TARGET_OPENGL_450:
|
||||
return glslang::EShTargetOpenGL_450;
|
||||
default:
|
||||
|
|
@ -311,7 +326,7 @@ static EProfile c_shader_profile(glslang_profile_t profile)
|
|||
GLSLANG_EXPORT glslang_shader_t* glslang_shader_create(const glslang_input_t* input)
|
||||
{
|
||||
if (!input || !input->code) {
|
||||
printf("Error creating shader: null input(%p)/input->code\n", input);
|
||||
printf("Error creating shader: null input(%p)/input->code\n", (void*)input);
|
||||
|
||||
if (input)
|
||||
printf("input->code = %p\n", input->code);
|
||||
|
|
@ -368,11 +383,35 @@ GLSLANG_EXPORT void glslang_shader_set_glsl_version(glslang_shader_t* shader, in
|
|||
shader->shader->setOverrideVersion(version);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_shader_set_default_uniform_block_set_and_binding(glslang_shader_t* shader, unsigned int set, unsigned int binding) {
|
||||
shader->shader->setGlobalUniformSet(set);
|
||||
shader->shader->setGlobalUniformBinding(binding);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_shader_set_default_uniform_block_name(glslang_shader_t* shader, const char *name) {
|
||||
shader->shader->setGlobalUniformBlockName(name);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_shader_set_resource_set_binding(glslang_shader_t* shader, const char *const *bindings, unsigned int num_bindings) {
|
||||
shader->baseResourceSetBinding.clear();
|
||||
|
||||
for (unsigned int i = 0; i < num_bindings; ++i) {
|
||||
shader->baseResourceSetBinding.push_back(std::string(bindings[i]));
|
||||
}
|
||||
|
||||
shader->shader->setResourceSetBinding(shader->baseResourceSetBinding);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t* shader)
|
||||
{
|
||||
return shader->preprocessedGLSL.c_str();
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_shader_set_preprocessed_code(glslang_shader_t* shader, const char* code)
|
||||
{
|
||||
shader->preprocessedGLSL.assign(code);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT int glslang_shader_preprocess(glslang_shader_t* shader, const glslang_input_t* input)
|
||||
{
|
||||
DirStackFileIncluder dirStackFileIncluder;
|
||||
|
|
@ -459,6 +498,11 @@ GLSLANG_EXPORT int glslang_program_map_io(glslang_program_t* program)
|
|||
return (int)program->program->mapIO();
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT int glslang_program_map_io_with_resolver_and_mapper(glslang_program_t* program, glslang_resolver_t* resolver, glslang_mapper_t* mapper)
|
||||
{
|
||||
return (int)program->program->mapIO(reinterpret_cast<glslang::TDefaultGlslIoResolver*>(resolver), reinterpret_cast<glslang::TGlslIoMapper*>(mapper));
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT const char* glslang_program_get_info_log(glslang_program_t* program)
|
||||
{
|
||||
return program->program->getInfoLog();
|
||||
|
|
@ -468,3 +512,30 @@ GLSLANG_EXPORT const char* glslang_program_get_info_debug_log(glslang_program_t*
|
|||
{
|
||||
return program->program->getInfoDebugLog();
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT glslang_mapper_t* glslang_glsl_mapper_create()
|
||||
{
|
||||
return reinterpret_cast<glslang_mapper_t*>(new glslang::TGlslIoMapper());
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_glsl_mapper_delete(glslang_mapper_t* mapper)
|
||||
{
|
||||
if (!mapper)
|
||||
return;
|
||||
|
||||
delete reinterpret_cast<glslang::TGlslIoMapper* >(mapper);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT glslang_resolver_t* glslang_glsl_resolver_create(glslang_program_t* program, glslang_stage_t stage)
|
||||
{
|
||||
glslang::TIntermediate* intermediate = program->program->getIntermediate(c_shader_stage(stage));
|
||||
return reinterpret_cast<glslang_resolver_t*>(new glslang::TDefaultGlslIoResolver(reinterpret_cast<const glslang::TIntermediate&>(*intermediate)));
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_glsl_resolver_delete(glslang_resolver_t* resolver)
|
||||
{
|
||||
if (!resolver)
|
||||
return;
|
||||
|
||||
delete reinterpret_cast<glslang::TDefaultGlslIoResolver* >(resolver);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -31,19 +35,4 @@
|
|||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
#ifndef __INITIALIZEDLL_H
|
||||
#define __INITIALIZEDLL_H
|
||||
|
||||
#include "../glslang/OSDependent/osinclude.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
bool InitProcess();
|
||||
bool InitThread();
|
||||
bool DetachThread(); // not called from standalone, perhaps other tools rely on parts of it
|
||||
bool DetachProcess(); // not called from standalone, perhaps other tools rely on parts of it
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // __INITIALIZEDLL_H
|
||||
|
||||
|
|
@ -67,6 +67,10 @@ enum TBasicType {
|
|||
EbtRayQuery,
|
||||
EbtHitObjectNV,
|
||||
EbtCoopmat,
|
||||
EbtFunction,
|
||||
EbtTensorLayoutNV,
|
||||
EbtTensorViewNV,
|
||||
EbtCoopvecNV,
|
||||
// SPIR-V type defined by spirv_type
|
||||
EbtSpirvType,
|
||||
|
||||
|
|
@ -275,6 +279,7 @@ enum TBuiltInVariable {
|
|||
EbvWorldToObject3x4,
|
||||
EbvIncomingRayFlags,
|
||||
EbvCurrentRayTimeNV,
|
||||
EbvClusterIDNV,
|
||||
// barycentrics
|
||||
EbvBaryCoordNV,
|
||||
EbvBaryCoordNoPerspNV,
|
||||
|
|
@ -295,6 +300,13 @@ enum TBuiltInVariable {
|
|||
EbvHitKindFrontFacingMicroTriangleNV,
|
||||
EbvHitKindBackFacingMicroTriangleNV,
|
||||
|
||||
EbvHitIsSphereNV,
|
||||
EbvHitIsLSSNV,
|
||||
EbvHitSpherePositionNV,
|
||||
EbvHitSphereRadiusNV,
|
||||
EbvHitLSSPositionsNV,
|
||||
EbvHitLSSRadiiNV,
|
||||
|
||||
//GL_EXT_mesh_shader
|
||||
EbvPrimitivePointIndicesEXT,
|
||||
EbvPrimitiveLineIndicesEXT,
|
||||
|
|
@ -499,6 +511,7 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
case EbvObjectToWorld: return "ObjectToWorldNV";
|
||||
case EbvWorldToObject: return "WorldToObjectNV";
|
||||
case EbvCurrentRayTimeNV: return "CurrentRayTimeNV";
|
||||
case EbvClusterIDNV: return "ClusterIDNV";
|
||||
|
||||
case EbvBaryCoordEXT:
|
||||
case EbvBaryCoordNV: return "BaryCoordKHR";
|
||||
|
|
@ -530,6 +543,13 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
case EbvHitKindFrontFacingMicroTriangleNV: return "HitKindFrontFacingMicroTriangleNV";
|
||||
case EbvHitKindBackFacingMicroTriangleNV: return "HitKindBackFacingMicroTriangleNV";
|
||||
|
||||
case EbvHitIsSphereNV: return "HitIsSphereNV";
|
||||
case EbvHitIsLSSNV: return "HitIsLSSNV";
|
||||
case EbvHitSpherePositionNV: return "HitSpherePositionNV";
|
||||
case EbvHitSphereRadiusNV: return "HitSphereRadiusNV";
|
||||
case EbvHitLSSPositionsNV: return "HitSpherePositionsNV";
|
||||
case EbvHitLSSRadiiNV: return "HitLSSRadiiNV";
|
||||
|
||||
default: return "unknown built-in variable";
|
||||
}
|
||||
}
|
||||
|
|
@ -588,6 +608,30 @@ __inline bool isTypeFloat(TBasicType type)
|
|||
}
|
||||
}
|
||||
|
||||
__inline uint32_t GetNumBits(TBasicType type)
|
||||
{
|
||||
switch (type) {
|
||||
case EbtInt8:
|
||||
case EbtUint8:
|
||||
return 8;
|
||||
case EbtFloat16:
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
return 16;
|
||||
case EbtInt:
|
||||
case EbtUint:
|
||||
case EbtFloat:
|
||||
return 32;
|
||||
case EbtDouble:
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
return 64;
|
||||
default:
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
__inline int getTypeRank(TBasicType type)
|
||||
{
|
||||
int res = -1;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
|
@ -95,6 +94,11 @@ std::string to_string(const T& val) {
|
|||
#pragma warning(disable : 4201) // nameless union
|
||||
#endif
|
||||
|
||||
// Allow compilation to WASI which does not support threads yet.
|
||||
#ifdef __wasi__
|
||||
#define DISABLE_THREAD_SUPPORT
|
||||
#endif
|
||||
|
||||
#include "PoolAlloc.h"
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -95,10 +95,14 @@ public:
|
|||
default: append("UNKNOWN ERROR: "); break;
|
||||
}
|
||||
}
|
||||
void location(const TSourceLoc& loc, bool absolute = false) {
|
||||
void location(const TSourceLoc& loc, bool absolute = false, bool displayColumn = false) {
|
||||
const int maxSize = 24;
|
||||
char locText[maxSize];
|
||||
snprintf(locText, maxSize, ":%d", loc.line);
|
||||
if (displayColumn) {
|
||||
snprintf(locText, maxSize, ":%d:%d", loc.line, loc.column);
|
||||
} else {
|
||||
snprintf(locText, maxSize, ":%d", loc.line);
|
||||
}
|
||||
|
||||
if(loc.getFilename() == nullptr && shaderFileName != nullptr && absolute) {
|
||||
append(std::filesystem::absolute(shaderFileName).string());
|
||||
|
|
@ -119,9 +123,11 @@ public:
|
|||
append(s);
|
||||
append("\n");
|
||||
}
|
||||
void message(TPrefixType message, const char* s, const TSourceLoc& loc) {
|
||||
void message(TPrefixType message, const char* s, const TSourceLoc& loc, bool absolute = false,
|
||||
bool displayColumn = false)
|
||||
{
|
||||
prefix(message);
|
||||
location(loc);
|
||||
location(loc, absolute, displayColumn);
|
||||
append(s);
|
||||
append("\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,21 +307,6 @@ typedef TVector<TTypeLoc> TTypeList;
|
|||
|
||||
typedef TVector<TString*> TIdentifierList;
|
||||
|
||||
//
|
||||
// Following are a series of helper enums for managing layouts and qualifiers,
|
||||
// used for TPublicType, TType, others.
|
||||
//
|
||||
|
||||
enum TLayoutPacking {
|
||||
ElpNone,
|
||||
ElpShared, // default, but different than saying nothing
|
||||
ElpStd140,
|
||||
ElpStd430,
|
||||
ElpPacked,
|
||||
ElpScalar,
|
||||
ElpCount // If expanding, see bitfield width below
|
||||
};
|
||||
|
||||
enum TLayoutMatrix {
|
||||
ElmNone,
|
||||
ElmRowMajor,
|
||||
|
|
@ -567,6 +552,7 @@ public:
|
|||
shadercallcoherent = false;
|
||||
nonprivate = false;
|
||||
volatil = false;
|
||||
nontemporal = false;
|
||||
restrict = false;
|
||||
readonly = false;
|
||||
writeonly = false;
|
||||
|
|
@ -604,6 +590,7 @@ public:
|
|||
bool writeonly : 1;
|
||||
bool coherent : 1;
|
||||
bool volatil : 1;
|
||||
bool nontemporal : 1;
|
||||
bool devicecoherent : 1;
|
||||
bool queuefamilycoherent : 1;
|
||||
bool workgroupcoherent : 1;
|
||||
|
|
@ -618,14 +605,15 @@ public:
|
|||
bool isRestrict() const { return restrict; }
|
||||
bool isCoherent() const { return coherent; }
|
||||
bool isVolatile() const { return volatil; }
|
||||
bool isNonTemporal() const { return nontemporal; }
|
||||
bool isSample() const { return sample; }
|
||||
bool isMemory() const
|
||||
{
|
||||
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate;
|
||||
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || nontemporal || restrict || readonly || writeonly || nonprivate;
|
||||
}
|
||||
bool isMemoryQualifierImageAndSSBOOnly() const
|
||||
{
|
||||
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly;
|
||||
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || nontemporal || restrict || readonly || writeonly;
|
||||
}
|
||||
bool bufferReferenceNeedsVulkanMemoryModel() const
|
||||
{
|
||||
|
|
@ -1475,6 +1463,7 @@ public:
|
|||
uint32_t matrixRows : 4;
|
||||
bool coopmatNV : 1;
|
||||
bool coopmatKHR : 1;
|
||||
bool coopvecNV : 1;
|
||||
TArraySizes* arraySizes;
|
||||
const TType* userDef;
|
||||
TSourceLoc loc;
|
||||
|
|
@ -1485,6 +1474,11 @@ public:
|
|||
bool isCoopmat() const { return coopmatNV || coopmatKHR; }
|
||||
bool isCoopmatNV() const { return coopmatNV; }
|
||||
bool isCoopmatKHR() const { return coopmatKHR; }
|
||||
bool isCoopvecNV() const { return coopvecNV; }
|
||||
bool isCoopmatOrvec() const { return isCoopmat() || isCoopvecNV(); }
|
||||
|
||||
bool isTensorLayoutNV() const { return basicType == EbtTensorLayoutNV; }
|
||||
bool isTensorViewNV() const { return basicType == EbtTensorViewNV; }
|
||||
|
||||
void initType(const TSourceLoc& l)
|
||||
{
|
||||
|
|
@ -1498,6 +1492,7 @@ public:
|
|||
typeParameters = nullptr;
|
||||
coopmatNV = false;
|
||||
coopmatKHR = false;
|
||||
coopvecNV = false;
|
||||
spirvType = nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -1557,7 +1552,7 @@ public:
|
|||
// for "empty" type (no args) or simple scalar/vector/matrix
|
||||
explicit TType(TBasicType t = EbtVoid, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0,
|
||||
bool isVector = false) :
|
||||
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
|
|
@ -1573,7 +1568,7 @@ public:
|
|||
// for explicit precision qualifier
|
||||
TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0,
|
||||
bool isVector = false) :
|
||||
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
|
|
@ -1591,7 +1586,7 @@ public:
|
|||
// for turning a TPublicType into a TType, using a shallow copy
|
||||
explicit TType(const TPublicType& p) :
|
||||
basicType(p.basicType),
|
||||
vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(p.coopvecNV),
|
||||
arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters),
|
||||
spirvType(p.spirvType)
|
||||
{
|
||||
|
|
@ -1640,13 +1635,15 @@ public:
|
|||
assert(dimSize >= 0);
|
||||
coopmatKHRuse = static_cast<uint32_t>(dimSize) & 0b111;
|
||||
coopmatKHRUseValid = true;
|
||||
p.typeParameters->arraySizes->removeLastSize();
|
||||
}
|
||||
}
|
||||
if (p.isCoopvecNV() && p.typeParameters) {
|
||||
basicType = p.typeParameters->basicType;
|
||||
}
|
||||
}
|
||||
// for construction of sampler types
|
||||
TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) :
|
||||
basicType(EbtSampler), vectorSize(1u), matrixCols(0u), matrixRows(0u), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
basicType(EbtSampler), vectorSize(1u), matrixCols(0u), matrixRows(0u), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr),
|
||||
sampler(sampler), typeParameters(nullptr), spirvType(nullptr)
|
||||
{
|
||||
|
|
@ -1689,18 +1686,19 @@ public:
|
|||
// dereference from vector to scalar
|
||||
vectorSize = 1;
|
||||
vector1 = false;
|
||||
} else if (isCoopMat()) {
|
||||
} else if (isCoopMat() || isCoopVecNV()) {
|
||||
coopmatNV = false;
|
||||
coopmatKHR = false;
|
||||
coopmatKHRuse = 0;
|
||||
coopmatKHRUseValid = false;
|
||||
coopvecNV = false;
|
||||
typeParameters = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
// for making structures, ...
|
||||
TType(TTypeList* userDef, const TString& n) :
|
||||
basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
|
|
@ -1710,7 +1708,7 @@ public:
|
|||
}
|
||||
// For interface blocks
|
||||
TType(TTypeList* userDef, const TString& n, const TQualifier& q) :
|
||||
basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
|
|
@ -1758,6 +1756,7 @@ public:
|
|||
coopmatKHR = copyOf.isCoopMatKHR();
|
||||
coopmatKHRuse = copyOf.coopmatKHRuse;
|
||||
coopmatKHRUseValid = copyOf.coopmatKHRUseValid;
|
||||
coopvecNV = copyOf.isCoopVecNV();
|
||||
}
|
||||
|
||||
// Make complete copy of the whole type graph rooted at 'copyOf'.
|
||||
|
|
@ -1841,7 +1840,7 @@ public:
|
|||
virtual const TTypeParameters* getTypeParameters() const { return typeParameters; }
|
||||
virtual TTypeParameters* getTypeParameters() { return typeParameters; }
|
||||
|
||||
virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray(); }
|
||||
virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray() && ! isCoopVecNV(); }
|
||||
virtual bool isScalarOrVec1() const { return isScalar() || vector1; }
|
||||
virtual bool isScalarOrVector() const { return !isMatrix() && !isStruct() && !isArray(); }
|
||||
virtual bool isVector() const { return vectorSize > 1u || vector1; }
|
||||
|
|
@ -1892,10 +1891,15 @@ public:
|
|||
bool isCoopMat() const { return coopmatNV || coopmatKHR; }
|
||||
bool isCoopMatNV() const { return coopmatNV; }
|
||||
bool isCoopMatKHR() const { return coopmatKHR; }
|
||||
bool isCoopVecNV() const { return coopvecNV; }
|
||||
bool isCoopMatOrVec() const { return isCoopMat() || isCoopVecNV(); }
|
||||
bool isReference() const { return getBasicType() == EbtReference; }
|
||||
bool isSpirvType() const { return getBasicType() == EbtSpirvType; }
|
||||
int getCoopMatKHRuse() const { return static_cast<int>(coopmatKHRuse); }
|
||||
|
||||
bool isTensorLayoutNV() const { return getBasicType() == EbtTensorLayoutNV; }
|
||||
bool isTensorViewNV() const { return getBasicType() == EbtTensorViewNV; }
|
||||
|
||||
// return true if this type contains any subtype which satisfies the given predicate.
|
||||
template <typename P>
|
||||
bool contains(P predicate) const
|
||||
|
|
@ -2004,6 +2008,10 @@ public:
|
|||
{
|
||||
return contains([](const TType* t) { return t->coopmatNV || t->coopmatKHR; } );
|
||||
}
|
||||
bool containsCoopVec() const
|
||||
{
|
||||
return contains([](const TType* t) { return t->coopvecNV; } );
|
||||
}
|
||||
bool containsReference() const
|
||||
{
|
||||
return containsBasicType(EbtReference);
|
||||
|
|
@ -2121,6 +2129,9 @@ public:
|
|||
case EbtString: return "string";
|
||||
case EbtSpirvType: return "spirv_type";
|
||||
case EbtCoopmat: return "coopmat";
|
||||
case EbtTensorLayoutNV: return "tensorLayoutNV";
|
||||
case EbtTensorViewNV: return "tensorViewNV";
|
||||
case EbtCoopvecNV: return "coopvecNV";
|
||||
default: return "unknown type";
|
||||
}
|
||||
}
|
||||
|
|
@ -2289,6 +2300,8 @@ public:
|
|||
appendStr(" nonprivate");
|
||||
if (qualifier.volatil)
|
||||
appendStr(" volatile");
|
||||
if (qualifier.nontemporal)
|
||||
appendStr(" nontemporal");
|
||||
if (qualifier.restrict)
|
||||
appendStr(" restrict");
|
||||
if (qualifier.readonly)
|
||||
|
|
@ -2431,6 +2444,18 @@ public:
|
|||
appendStr(" ");
|
||||
appendStr("coopmat");
|
||||
}
|
||||
if (isTensorLayoutNV()) {
|
||||
appendStr(" ");
|
||||
appendStr("tensorLayoutNV");
|
||||
}
|
||||
if (isTensorViewNV()) {
|
||||
appendStr(" ");
|
||||
appendStr("tensorViewNV");
|
||||
}
|
||||
if (isCoopVecNV()) {
|
||||
appendStr(" ");
|
||||
appendStr("coopvecNV");
|
||||
}
|
||||
|
||||
appendStr("<");
|
||||
for (int i = 0; i < (int)typeParameters->arraySizes->getNumDims(); ++i) {
|
||||
|
|
@ -2438,10 +2463,6 @@ public:
|
|||
if (i != (int)typeParameters->arraySizes->getNumDims() - 1)
|
||||
appendStr(", ");
|
||||
}
|
||||
if (coopmatKHRUseValid) {
|
||||
appendStr(", ");
|
||||
appendInt(coopmatKHRuse);
|
||||
}
|
||||
appendStr(">");
|
||||
}
|
||||
if (getPrecision && qualifier.precision != EpqNone) {
|
||||
|
|
@ -2516,7 +2537,9 @@ public:
|
|||
{
|
||||
uint32_t components = 0;
|
||||
|
||||
if (getBasicType() == EbtStruct || getBasicType() == EbtBlock) {
|
||||
if (isCoopVecNV()) {
|
||||
components = typeParameters->arraySizes->getDimSize(0);
|
||||
} else if (getBasicType() == EbtStruct || getBasicType() == EbtBlock) {
|
||||
for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++)
|
||||
components += ((*tl).type)->computeNumComponents();
|
||||
} else if (matrixCols)
|
||||
|
|
@ -2720,6 +2743,7 @@ public:
|
|||
vector1 == right.vector1 &&
|
||||
isCoopMatNV() == right.isCoopMatNV() &&
|
||||
isCoopMatKHR() == right.isCoopMatKHR() &&
|
||||
isCoopVecNV() == right.isCoopVecNV() &&
|
||||
sameStructType(right, lpidx, rpidx) &&
|
||||
sameReferenceType(right);
|
||||
}
|
||||
|
|
@ -2741,6 +2765,18 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
// See if a cooperative vector type parameter with unspecified parameters is
|
||||
// an OK function parameter
|
||||
bool coopVecParameterOK(const TType& right) const
|
||||
{
|
||||
if (isCoopVecNV() && right.isCoopVecNV()) {
|
||||
return ((getBasicType() == right.getBasicType()) || (getBasicType() == EbtCoopvecNV) ||
|
||||
(right.getBasicType() == EbtCoopvecNV)) &&
|
||||
typeParameters == nullptr && right.typeParameters != nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sameCoopMatBaseType(const TType &right) const {
|
||||
bool rv = false;
|
||||
|
||||
|
|
@ -2767,24 +2803,60 @@ public:
|
|||
return rv;
|
||||
}
|
||||
|
||||
bool tensorParameterOK(const TType& right) const
|
||||
{
|
||||
if (isTensorLayoutNV()) {
|
||||
return right.isTensorLayoutNV() && right.typeParameters == nullptr && typeParameters != nullptr;
|
||||
}
|
||||
if (isTensorViewNV()) {
|
||||
return right.isTensorViewNV() && right.typeParameters == nullptr && typeParameters != nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sameCoopVecBaseType(const TType &right) const {
|
||||
bool rv = false;
|
||||
|
||||
if (isCoopVecNV() && right.isCoopVecNV()) {
|
||||
if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16)
|
||||
rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16 || right.getBasicType() == EbtCoopvecNV;
|
||||
else if (getBasicType() == EbtUint || getBasicType() == EbtUint8 || getBasicType() == EbtUint16)
|
||||
rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8 || right.getBasicType() == EbtUint16 || right.getBasicType() == EbtCoopvecNV;
|
||||
else if (getBasicType() == EbtInt || getBasicType() == EbtInt8 || getBasicType() == EbtInt16)
|
||||
rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8 || right.getBasicType() == EbtInt16 || right.getBasicType() == EbtCoopvecNV;
|
||||
else
|
||||
rv = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool sameCoopMatUse(const TType &right) const {
|
||||
return coopmatKHRuse == right.coopmatKHRuse;
|
||||
}
|
||||
|
||||
bool sameCoopMatShapeAndUse(const TType &right) const
|
||||
bool sameCoopMatShape(const TType &right) const
|
||||
{
|
||||
if (!isCoopMat() || !right.isCoopMat() || isCoopMatKHR() != right.isCoopMatKHR())
|
||||
return false;
|
||||
|
||||
// Skip bit width type parameter (first array size) for coopmatNV
|
||||
int firstArrayDimToCompare = isCoopMatNV() ? 1 : 0;
|
||||
int lastArrayDimToCompare = typeParameters->arraySizes->getNumDims() - (isCoopMatKHR() ? 1 : 0);
|
||||
for (int i = firstArrayDimToCompare; i < lastArrayDimToCompare; ++i) {
|
||||
if (typeParameters->arraySizes->getDimSize(i) != right.typeParameters->arraySizes->getDimSize(i))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sameCoopMatShapeAndUse(const TType &right) const
|
||||
{
|
||||
if (!sameCoopMatShape(right))
|
||||
return false;
|
||||
|
||||
if (coopmatKHRuse != right.coopmatKHRuse)
|
||||
return false;
|
||||
|
||||
// Skip bit width type parameter (first array size) for coopmatNV
|
||||
int firstArrayDimToCompare = isCoopMatNV() ? 1 : 0;
|
||||
for (int i = firstArrayDimToCompare; i < typeParameters->arraySizes->getNumDims(); ++i) {
|
||||
if (typeParameters->arraySizes->getDimSize(i) != right.typeParameters->arraySizes->getDimSize(i))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2842,7 +2914,9 @@ protected:
|
|||
typeParameters = new TTypeParameters;
|
||||
typeParameters->arraySizes = new TArraySizes;
|
||||
*typeParameters->arraySizes = *copyOf.typeParameters->arraySizes;
|
||||
*typeParameters->spirvType = *copyOf.typeParameters->spirvType;
|
||||
if (copyOf.typeParameters->spirvType) {
|
||||
*typeParameters->spirvType = *copyOf.typeParameters->spirvType;
|
||||
}
|
||||
typeParameters->basicType = copyOf.basicType;
|
||||
}
|
||||
|
||||
|
|
@ -2885,6 +2959,7 @@ protected:
|
|||
bool coopmatKHR : 1;
|
||||
uint32_t coopmatKHRuse : 3; // Accepts one of three values: 0, 1, 2 (gl_MatrixUseA, gl_MatrixUseB, gl_MatrixUseAccumulator)
|
||||
bool coopmatKHRUseValid : 1; // True if coopmatKHRuse has been set
|
||||
bool coopvecNV : 1;
|
||||
TQualifier qualifier;
|
||||
|
||||
TArraySizes* arraySizes; // nullptr unless an array; can be shared across types
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
// 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.
|
||||
|
||||
#ifndef GLSLANG_BUILD_INFO
|
||||
#define GLSLANG_BUILD_INFO
|
||||
|
||||
#define GLSLANG_VERSION_MAJOR 11
|
||||
#define GLSLANG_VERSION_MINOR 6
|
||||
#define GLSLANG_VERSION_PATCH 0
|
||||
#define GLSLANG_VERSION_FLAVOR ""
|
||||
|
||||
#define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \
|
||||
(((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
(((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
((patch) > GLSLANG_VERSION_PATCH)))))
|
||||
|
||||
#define GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch) \
|
||||
(((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
(((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
((patch) >= GLSLANG_VERSION_PATCH)))))
|
||||
|
||||
#define GLSLANG_VERSION_LESS_THAN(major, minor, patch) \
|
||||
(((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
(((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
((patch) < GLSLANG_VERSION_PATCH)))))
|
||||
|
||||
#define GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch) \
|
||||
(((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
(((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
((patch) <= GLSLANG_VERSION_PATCH)))))
|
||||
|
||||
#endif // GLSLANG_BUILD_INFO
|
||||
|
|
@ -37,9 +37,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "glslang_c_shader_types.h"
|
||||
#include "visibility.h"
|
||||
|
||||
typedef struct glslang_shader_s glslang_shader_t;
|
||||
typedef struct glslang_program_s glslang_program_t;
|
||||
typedef struct glslang_mapper_s glslang_mapper_t;
|
||||
typedef struct glslang_resolver_s glslang_resolver_t;
|
||||
|
||||
/* Version counterpart */
|
||||
typedef struct glslang_version_s {
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
const char* flavor;
|
||||
} glslang_version_t;
|
||||
|
||||
/* TLimits counterpart */
|
||||
typedef struct glslang_limits_s {
|
||||
|
|
@ -227,27 +238,14 @@ typedef struct glslang_spv_options_s {
|
|||
bool emit_nonsemantic_shader_debug_info;
|
||||
bool emit_nonsemantic_shader_debug_source;
|
||||
bool compile_only;
|
||||
bool optimize_allow_expanded_id_bound;
|
||||
} glslang_spv_options_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef GLSLANG_IS_SHARED_LIBRARY
|
||||
#ifdef _WIN32
|
||||
#ifdef GLSLANG_EXPORTING
|
||||
#define GLSLANG_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define GLSLANG_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#elif __GNUC__ >= 4
|
||||
#define GLSLANG_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#endif // GLSLANG_IS_SHARED_LIBRARY
|
||||
|
||||
#ifndef GLSLANG_EXPORT
|
||||
#define GLSLANG_EXPORT
|
||||
#endif
|
||||
GLSLANG_EXPORT void glslang_get_version(glslang_version_t* version);
|
||||
|
||||
GLSLANG_EXPORT int glslang_initialize_process(void);
|
||||
GLSLANG_EXPORT void glslang_finalize_process(void);
|
||||
|
|
@ -259,9 +257,13 @@ GLSLANG_EXPORT void glslang_shader_shift_binding(glslang_shader_t* shader, glsla
|
|||
GLSLANG_EXPORT void glslang_shader_shift_binding_for_set(glslang_shader_t* shader, glslang_resource_type_t res, unsigned int base, unsigned int set);
|
||||
GLSLANG_EXPORT void glslang_shader_set_options(glslang_shader_t* shader, int options); // glslang_shader_options_t
|
||||
GLSLANG_EXPORT void glslang_shader_set_glsl_version(glslang_shader_t* shader, int version);
|
||||
GLSLANG_EXPORT void glslang_shader_set_default_uniform_block_set_and_binding(glslang_shader_t* shader, unsigned int set, unsigned int binding);
|
||||
GLSLANG_EXPORT void glslang_shader_set_default_uniform_block_name(glslang_shader_t* shader, const char *name);
|
||||
GLSLANG_EXPORT void glslang_shader_set_resource_set_binding(glslang_shader_t* shader, const char *const *bindings, unsigned int num_bindings);
|
||||
GLSLANG_EXPORT int glslang_shader_preprocess(glslang_shader_t* shader, const glslang_input_t* input);
|
||||
GLSLANG_EXPORT int glslang_shader_parse(glslang_shader_t* shader, const glslang_input_t* input);
|
||||
GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t* shader);
|
||||
GLSLANG_EXPORT void glslang_shader_set_preprocessed_code(glslang_shader_t* shader, const char* code);
|
||||
GLSLANG_EXPORT const char* glslang_shader_get_info_log(glslang_shader_t* shader);
|
||||
GLSLANG_EXPORT const char* glslang_shader_get_info_debug_log(glslang_shader_t* shader);
|
||||
|
||||
|
|
@ -272,6 +274,7 @@ GLSLANG_EXPORT int glslang_program_link(glslang_program_t* program, int messages
|
|||
GLSLANG_EXPORT void glslang_program_add_source_text(glslang_program_t* program, glslang_stage_t stage, const char* text, size_t len);
|
||||
GLSLANG_EXPORT void glslang_program_set_source_file(glslang_program_t* program, glslang_stage_t stage, const char* file);
|
||||
GLSLANG_EXPORT int glslang_program_map_io(glslang_program_t* program);
|
||||
GLSLANG_EXPORT int glslang_program_map_io_with_resolver_and_mapper(glslang_program_t* program, glslang_resolver_t* resolver, glslang_mapper_t* mapper);
|
||||
GLSLANG_EXPORT void glslang_program_SPIRV_generate(glslang_program_t* program, glslang_stage_t stage);
|
||||
GLSLANG_EXPORT void glslang_program_SPIRV_generate_with_options(glslang_program_t* program, glslang_stage_t stage, glslang_spv_options_t* spv_options);
|
||||
GLSLANG_EXPORT size_t glslang_program_SPIRV_get_size(glslang_program_t* program);
|
||||
|
|
@ -281,6 +284,12 @@ GLSLANG_EXPORT const char* glslang_program_SPIRV_get_messages(glslang_program_t*
|
|||
GLSLANG_EXPORT const char* glslang_program_get_info_log(glslang_program_t* program);
|
||||
GLSLANG_EXPORT const char* glslang_program_get_info_debug_log(glslang_program_t* program);
|
||||
|
||||
GLSLANG_EXPORT glslang_mapper_t* glslang_glsl_mapper_create(void);
|
||||
GLSLANG_EXPORT void glslang_glsl_mapper_delete(glslang_mapper_t* mapper);
|
||||
|
||||
GLSLANG_EXPORT glslang_resolver_t* glslang_glsl_resolver_create(glslang_program_t* program, glslang_stage_t stage);
|
||||
GLSLANG_EXPORT void glslang_glsl_resolver_delete(glslang_resolver_t* resolver);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -118,8 +118,9 @@ typedef enum {
|
|||
GLSLANG_TARGET_VULKAN_1_1 = (1 << 22) | (1 << 12),
|
||||
GLSLANG_TARGET_VULKAN_1_2 = (1 << 22) | (2 << 12),
|
||||
GLSLANG_TARGET_VULKAN_1_3 = (1 << 22) | (3 << 12),
|
||||
GLSLANG_TARGET_VULKAN_1_4 = (1 << 22) | (4 << 12),
|
||||
GLSLANG_TARGET_OPENGL_450 = 450,
|
||||
LAST_ELEMENT_MARKER(GLSLANG_TARGET_CLIENT_VERSION_COUNT = 5),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_TARGET_CLIENT_VERSION_COUNT = 6),
|
||||
} glslang_target_client_version_t;
|
||||
|
||||
/* SH_TARGET_LanguageVersion counterpart */
|
||||
|
|
@ -175,6 +176,8 @@ typedef enum {
|
|||
GLSLANG_MSG_BUILTIN_SYMBOL_TABLE_BIT = (1 << 14),
|
||||
GLSLANG_MSG_ENHANCED = (1 << 15),
|
||||
GLSLANG_MSG_ABSOLUTE_PATH = (1 << 16),
|
||||
GLSLANG_MSG_DISPLAY_ERROR_COLUMN = (1 << 17),
|
||||
GLSLANG_MSG_LINK_TIME_OPTIMIZATION_BIT = (1 << 18),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_MSG_COUNT),
|
||||
} glslang_messages_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -87,189 +87,9 @@ enum TOperator {
|
|||
|
||||
EOpDeclare, // Used by debugging to force declaration of variable in correct scope
|
||||
|
||||
// (u)int* -> bool
|
||||
EOpConvInt8ToBool,
|
||||
EOpConvUint8ToBool,
|
||||
EOpConvInt16ToBool,
|
||||
EOpConvUint16ToBool,
|
||||
EOpConvIntToBool,
|
||||
EOpConvUintToBool,
|
||||
EOpConvInt64ToBool,
|
||||
EOpConvUint64ToBool,
|
||||
|
||||
// float* -> bool
|
||||
EOpConvFloat16ToBool,
|
||||
EOpConvFloatToBool,
|
||||
EOpConvDoubleToBool,
|
||||
|
||||
// bool -> (u)int*
|
||||
EOpConvBoolToInt8,
|
||||
EOpConvBoolToUint8,
|
||||
EOpConvBoolToInt16,
|
||||
EOpConvBoolToUint16,
|
||||
EOpConvBoolToInt,
|
||||
EOpConvBoolToUint,
|
||||
EOpConvBoolToInt64,
|
||||
EOpConvBoolToUint64,
|
||||
|
||||
// bool -> float*
|
||||
EOpConvBoolToFloat16,
|
||||
EOpConvBoolToFloat,
|
||||
EOpConvBoolToDouble,
|
||||
|
||||
// int8_t -> (u)int*
|
||||
EOpConvInt8ToInt16,
|
||||
EOpConvInt8ToInt,
|
||||
EOpConvInt8ToInt64,
|
||||
EOpConvInt8ToUint8,
|
||||
EOpConvInt8ToUint16,
|
||||
EOpConvInt8ToUint,
|
||||
EOpConvInt8ToUint64,
|
||||
|
||||
// uint8_t -> (u)int*
|
||||
EOpConvUint8ToInt8,
|
||||
EOpConvUint8ToInt16,
|
||||
EOpConvUint8ToInt,
|
||||
EOpConvUint8ToInt64,
|
||||
EOpConvUint8ToUint16,
|
||||
EOpConvUint8ToUint,
|
||||
EOpConvUint8ToUint64,
|
||||
|
||||
// int8_t -> float*
|
||||
EOpConvInt8ToFloat16,
|
||||
EOpConvInt8ToFloat,
|
||||
EOpConvInt8ToDouble,
|
||||
|
||||
// uint8_t -> float*
|
||||
EOpConvUint8ToFloat16,
|
||||
EOpConvUint8ToFloat,
|
||||
EOpConvUint8ToDouble,
|
||||
|
||||
// int16_t -> (u)int*
|
||||
EOpConvInt16ToInt8,
|
||||
EOpConvInt16ToInt,
|
||||
EOpConvInt16ToInt64,
|
||||
EOpConvInt16ToUint8,
|
||||
EOpConvInt16ToUint16,
|
||||
EOpConvInt16ToUint,
|
||||
EOpConvInt16ToUint64,
|
||||
|
||||
// uint16_t -> (u)int*
|
||||
EOpConvUint16ToInt8,
|
||||
EOpConvUint16ToInt16,
|
||||
EOpConvUint16ToInt,
|
||||
EOpConvUint16ToInt64,
|
||||
EOpConvUint16ToUint8,
|
||||
EOpConvUint16ToUint,
|
||||
EOpConvUint16ToUint64,
|
||||
|
||||
// int16_t -> float*
|
||||
EOpConvInt16ToFloat16,
|
||||
EOpConvInt16ToFloat,
|
||||
EOpConvInt16ToDouble,
|
||||
|
||||
// uint16_t -> float*
|
||||
EOpConvUint16ToFloat16,
|
||||
EOpConvUint16ToFloat,
|
||||
EOpConvUint16ToDouble,
|
||||
|
||||
// int32_t -> (u)int*
|
||||
EOpConvIntToInt8,
|
||||
EOpConvIntToInt16,
|
||||
EOpConvIntToInt64,
|
||||
EOpConvIntToUint8,
|
||||
EOpConvIntToUint16,
|
||||
EOpConvIntToUint,
|
||||
EOpConvIntToUint64,
|
||||
|
||||
// uint32_t -> (u)int*
|
||||
EOpConvUintToInt8,
|
||||
EOpConvUintToInt16,
|
||||
EOpConvUintToInt,
|
||||
EOpConvUintToInt64,
|
||||
EOpConvUintToUint8,
|
||||
EOpConvUintToUint16,
|
||||
EOpConvUintToUint64,
|
||||
|
||||
// int32_t -> float*
|
||||
EOpConvIntToFloat16,
|
||||
EOpConvIntToFloat,
|
||||
EOpConvIntToDouble,
|
||||
|
||||
// uint32_t -> float*
|
||||
EOpConvUintToFloat16,
|
||||
EOpConvUintToFloat,
|
||||
EOpConvUintToDouble,
|
||||
|
||||
// int64_t -> (u)int*
|
||||
EOpConvInt64ToInt8,
|
||||
EOpConvInt64ToInt16,
|
||||
EOpConvInt64ToInt,
|
||||
EOpConvInt64ToUint8,
|
||||
EOpConvInt64ToUint16,
|
||||
EOpConvInt64ToUint,
|
||||
EOpConvInt64ToUint64,
|
||||
|
||||
// uint64_t -> (u)int*
|
||||
EOpConvUint64ToInt8,
|
||||
EOpConvUint64ToInt16,
|
||||
EOpConvUint64ToInt,
|
||||
EOpConvUint64ToInt64,
|
||||
EOpConvUint64ToUint8,
|
||||
EOpConvUint64ToUint16,
|
||||
EOpConvUint64ToUint,
|
||||
|
||||
// int64_t -> float*
|
||||
EOpConvInt64ToFloat16,
|
||||
EOpConvInt64ToFloat,
|
||||
EOpConvInt64ToDouble,
|
||||
|
||||
// uint64_t -> float*
|
||||
EOpConvUint64ToFloat16,
|
||||
EOpConvUint64ToFloat,
|
||||
EOpConvUint64ToDouble,
|
||||
|
||||
// float16_t -> (u)int*
|
||||
EOpConvFloat16ToInt8,
|
||||
EOpConvFloat16ToInt16,
|
||||
EOpConvFloat16ToInt,
|
||||
EOpConvFloat16ToInt64,
|
||||
EOpConvFloat16ToUint8,
|
||||
EOpConvFloat16ToUint16,
|
||||
EOpConvFloat16ToUint,
|
||||
EOpConvFloat16ToUint64,
|
||||
|
||||
// float16_t -> float*
|
||||
EOpConvFloat16ToFloat,
|
||||
EOpConvFloat16ToDouble,
|
||||
|
||||
// float -> (u)int*
|
||||
EOpConvFloatToInt8,
|
||||
EOpConvFloatToInt16,
|
||||
EOpConvFloatToInt,
|
||||
EOpConvFloatToInt64,
|
||||
EOpConvFloatToUint8,
|
||||
EOpConvFloatToUint16,
|
||||
EOpConvFloatToUint,
|
||||
EOpConvFloatToUint64,
|
||||
|
||||
// float -> float*
|
||||
EOpConvFloatToFloat16,
|
||||
EOpConvFloatToDouble,
|
||||
|
||||
// float64 _t-> (u)int*
|
||||
EOpConvDoubleToInt8,
|
||||
EOpConvDoubleToInt16,
|
||||
EOpConvDoubleToInt,
|
||||
EOpConvDoubleToInt64,
|
||||
EOpConvDoubleToUint8,
|
||||
EOpConvDoubleToUint16,
|
||||
EOpConvDoubleToUint,
|
||||
EOpConvDoubleToUint64,
|
||||
|
||||
// float64_t -> float*
|
||||
EOpConvDoubleToFloat16,
|
||||
EOpConvDoubleToFloat,
|
||||
// Operator used to represent all conversions between int, float, and bool.
|
||||
// The specific types are inferred from TBasicType.
|
||||
EOpConvNumeric,
|
||||
|
||||
// uint64_t <-> pointer
|
||||
EOpConvUint64ToPtr,
|
||||
|
|
@ -567,6 +387,11 @@ enum TOperator {
|
|||
EOpSubgroupPartitionedExclusiveXor,
|
||||
|
||||
EOpSubgroupGuardStop,
|
||||
|
||||
// Integer dot product
|
||||
EOpDotPackedEXT,
|
||||
EOpDotAccSatEXT,
|
||||
EOpDotPackedAccSatEXT,
|
||||
|
||||
EOpMinInvocations,
|
||||
EOpMaxInvocations,
|
||||
|
|
@ -628,7 +453,31 @@ enum TOperator {
|
|||
EOpCooperativeMatrixMulAdd,
|
||||
EOpCooperativeMatrixLoadNV,
|
||||
EOpCooperativeMatrixStoreNV,
|
||||
EOpCooperativeMatrixLoadTensorNV,
|
||||
EOpCooperativeMatrixStoreTensorNV,
|
||||
EOpCooperativeMatrixMulAddNV,
|
||||
EOpCooperativeMatrixReduceNV,
|
||||
EOpCooperativeMatrixPerElementOpNV,
|
||||
EOpCooperativeMatrixTransposeNV,
|
||||
|
||||
EOpCreateTensorLayoutNV,
|
||||
EOpTensorLayoutSetBlockSizeNV,
|
||||
EOpTensorLayoutSetDimensionNV,
|
||||
EOpTensorLayoutSetStrideNV,
|
||||
EOpTensorLayoutSliceNV,
|
||||
EOpTensorLayoutSetClampValueNV,
|
||||
|
||||
EOpCreateTensorViewNV,
|
||||
EOpTensorViewSetDimensionNV,
|
||||
EOpTensorViewSetStrideNV,
|
||||
EOpTensorViewSetClipNV,
|
||||
|
||||
EOpCooperativeVectorMatMulNV,
|
||||
EOpCooperativeVectorMatMulAddNV,
|
||||
EOpCooperativeVectorLoadNV,
|
||||
EOpCooperativeVectorStoreNV,
|
||||
EOpCooperativeVectorOuterProductAccumulateNV,
|
||||
EOpCooperativeVectorReduceSumAccumulateNV,
|
||||
|
||||
EOpBeginInvocationInterlock, // Fragment only
|
||||
EOpEndInvocationInterlock, // Fragment only
|
||||
|
|
@ -768,6 +617,7 @@ enum TOperator {
|
|||
EOpConstructReference,
|
||||
EOpConstructCooperativeMatrixNV,
|
||||
EOpConstructCooperativeMatrixKHR,
|
||||
EOpConstructCooperativeVectorNV,
|
||||
EOpConstructAccStruct,
|
||||
EOpConstructGuardEnd,
|
||||
|
||||
|
|
@ -1117,8 +967,31 @@ enum TOperator {
|
|||
EOpImageBlockMatchWindowSADQCOM,
|
||||
EOpImageBlockMatchGatherSSDQCOM,
|
||||
EOpImageBlockMatchGatherSADQCOM,
|
||||
|
||||
// GL_NV_cluster_acceleration_structure
|
||||
EOpRayQueryGetIntersectionClusterIdNV,
|
||||
EOpHitObjectGetClusterIdNV,
|
||||
|
||||
// GL_NV_linear_swept_spheres
|
||||
EOpRayQueryGetIntersectionSpherePositionNV,
|
||||
EOpRayQueryGetIntersectionSphereRadiusNV,
|
||||
EOpRayQueryGetIntersectionLSSHitValueNV,
|
||||
EOpRayQueryGetIntersectionLSSPositionsNV,
|
||||
EOpRayQueryGetIntersectionLSSRadiiNV,
|
||||
EOpRayQueryIsSphereHitNV,
|
||||
EOpRayQueryIsLSSHitNV,
|
||||
EOpHitObjectGetSpherePositionNV,
|
||||
EOpHitObjectGetSphereRadiusNV,
|
||||
EOpHitObjectGetLSSPositionsNV,
|
||||
EOpHitObjectGetLSSRadiiNV,
|
||||
EOpHitObjectIsSphereHitNV,
|
||||
EOpHitObjectIsLSSHitNV,
|
||||
};
|
||||
|
||||
inline bool IsOpNumericConv(const TOperator op) {
|
||||
return op == EOpConvNumeric;
|
||||
}
|
||||
|
||||
enum TLinkType {
|
||||
ELinkNone,
|
||||
ELinkExport,
|
||||
|
|
@ -1356,11 +1229,19 @@ public:
|
|||
// if symbol is initialized as symbol(sym), the memory comes from the pool allocator of sym. If sym comes from
|
||||
// per process threadPoolAllocator, then it causes increased memory usage per compile
|
||||
// it is essential to use "symbol = sym" to assign to symbol
|
||||
TIntermSymbol(long long i, const TString& n, const TType& t)
|
||||
: TIntermTyped(t), id(i), flattenSubset(-1), constSubtree(nullptr) { name = n; }
|
||||
TIntermSymbol(long long i, const TString& n, EShLanguage s, const TType& t, const TString* mn = nullptr)
|
||||
: TIntermTyped(t), id(i), flattenSubset(-1), stage(s), constSubtree(nullptr) {
|
||||
name = n;
|
||||
if (mn) {
|
||||
mangledName = *mn;
|
||||
} else {
|
||||
mangledName = n;
|
||||
}
|
||||
}
|
||||
virtual long long getId() const { return id; }
|
||||
virtual void changeId(long long i) { id = i; }
|
||||
virtual const TString& getName() const { return name; }
|
||||
virtual const TString& getMangledName() const { return mangledName; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
virtual TIntermSymbol* getAsSymbolNode() { return this; }
|
||||
virtual const TIntermSymbol* getAsSymbolNode() const { return this; }
|
||||
|
|
@ -1376,11 +1257,14 @@ public:
|
|||
// This is meant for cases where a node has already been constructed, and
|
||||
// later on, it becomes necessary to switch to a different symbol.
|
||||
virtual void switchId(long long newId) { id = newId; }
|
||||
EShLanguage getStage() const { return stage; }
|
||||
|
||||
protected:
|
||||
long long id; // the unique id of the symbol this node represents
|
||||
int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced
|
||||
TString name; // the name of the symbol this node represents
|
||||
EShLanguage stage;
|
||||
TString mangledName; // mangled function name, or a copy of name if not a function
|
||||
TConstUnionArray constArray; // if the symbol is a front-end compile-time constant, this is its value
|
||||
TIntermTyped* constSubtree;
|
||||
};
|
||||
|
|
@ -1694,8 +1578,12 @@ typedef TVector<TStorageQualifier> TQualifierList;
|
|||
//
|
||||
class TIntermAggregate : public TIntermOperator {
|
||||
public:
|
||||
TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(nullptr) { }
|
||||
TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(nullptr) { }
|
||||
TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(nullptr) {
|
||||
endLoc.init();
|
||||
}
|
||||
TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(nullptr) {
|
||||
endLoc.init();
|
||||
}
|
||||
~TIntermAggregate() { delete pragmaTable; }
|
||||
virtual TIntermAggregate* getAsAggregate() { return this; }
|
||||
virtual const TIntermAggregate* getAsAggregate() const { return this; }
|
||||
|
|
@ -1719,6 +1607,9 @@ public:
|
|||
void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; }
|
||||
const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; }
|
||||
|
||||
void setEndLoc(TSourceLoc loc) { endLoc = loc; }
|
||||
TSourceLoc getEndLoc() const { return endLoc; }
|
||||
|
||||
void setLinkType(TLinkType l) { linkType = l; }
|
||||
TLinkType getLinkType() const { return linkType; }
|
||||
protected:
|
||||
|
|
@ -1733,6 +1624,10 @@ protected:
|
|||
TPragmaTable* pragmaTable;
|
||||
TSpirvInstruction spirvInst;
|
||||
TLinkType linkType = ELinkNone;
|
||||
|
||||
// Marking the end source location of the aggregate.
|
||||
// This is currently only set for a compound statement or a function body, pointing to '}'.
|
||||
TSourceLoc endLoc;
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
//
|
||||
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
||||
// Copyright (C) 2023 LunarG, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -31,44 +32,23 @@
|
|||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
#ifdef GLSLANG_IS_SHARED_LIBRARY
|
||||
#ifdef _WIN32
|
||||
#ifdef GLSLANG_EXPORTING
|
||||
#define GLSLANG_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define GLSLANG_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#elif __GNUC__ >= 4
|
||||
#define GLSLANG_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#endif // GLSLANG_IS_SHARED_LIBRARY
|
||||
|
||||
#include "InitializeDll.h"
|
||||
#ifndef GLSLANG_EXPORT
|
||||
#define GLSLANG_EXPORT
|
||||
#endif
|
||||
|
||||
#define STRICT
|
||||
#define VC_EXTRALEAN 1
|
||||
#include <windows.h>
|
||||
#include <assert.h>
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
|
||||
if (! glslang::InitProcess())
|
||||
return FALSE;
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
|
||||
if (! glslang::InitThread())
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
|
||||
if (! glslang::DetachThread())
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
|
||||
glslang::DetachProcess();
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0 && "DllMain(): Reason for calling DLL Main is unknown");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
// Symbols marked with this macro are only meant for public use by the test suite
|
||||
// and do not appear in publicly installed headers. They are not considered to be
|
||||
// part of the glslang library ABI.
|
||||
#define GLSLANG_EXPORT_FOR_TESTS GLSLANG_EXPORT
|
||||
|
|
@ -490,6 +490,163 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
|
||||
// Process component-wise operations
|
||||
for (int i = 0; i < objectSize; i++) {
|
||||
// First read the value and convert to i64/u64/f64/bool, then convert
|
||||
// to the destination type (still 64b), then convert down to the
|
||||
// destination size.
|
||||
if (IsOpNumericConv(op)) {
|
||||
enum ConvType { CONV_FLOAT, CONV_INT, CONV_UINT, CONV_BOOL };
|
||||
ConvType srcType = CONV_UINT, dstType = CONV_UINT;
|
||||
double valf = 0.0;
|
||||
uint64_t valu = 0;
|
||||
int64_t vali = 0;
|
||||
bool valb = false;
|
||||
switch (getType().getBasicType()) {
|
||||
case EbtDouble:
|
||||
case EbtFloat16:
|
||||
case EbtFloat:
|
||||
valf = unionArray[i].getDConst();
|
||||
srcType = CONV_FLOAT;
|
||||
break;
|
||||
case EbtInt8:
|
||||
vali = unionArray[i].getI8Const();
|
||||
srcType = CONV_INT;
|
||||
break;
|
||||
case EbtInt16:
|
||||
vali = unionArray[i].getI16Const();
|
||||
srcType = CONV_INT;
|
||||
break;
|
||||
case EbtInt:
|
||||
vali = unionArray[i].getIConst();
|
||||
srcType = CONV_INT;
|
||||
break;
|
||||
case EbtInt64:
|
||||
vali = unionArray[i].getI64Const();
|
||||
srcType = CONV_INT;
|
||||
break;
|
||||
case EbtUint8:
|
||||
valu = unionArray[i].getU8Const();
|
||||
srcType = CONV_UINT;
|
||||
break;
|
||||
case EbtUint16:
|
||||
valu = unionArray[i].getU16Const();
|
||||
srcType = CONV_UINT;
|
||||
break;
|
||||
case EbtUint:
|
||||
valu = unionArray[i].getUConst();
|
||||
srcType = CONV_UINT;
|
||||
break;
|
||||
case EbtUint64:
|
||||
valu = unionArray[i].getU64Const();
|
||||
srcType = CONV_UINT;
|
||||
break;
|
||||
case EbtBool:
|
||||
valb = unionArray[i].getBConst();
|
||||
srcType = CONV_BOOL;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (returnType.getBasicType()) {
|
||||
case EbtDouble:
|
||||
case EbtFloat16:
|
||||
case EbtFloat:
|
||||
dstType = CONV_FLOAT;
|
||||
break;
|
||||
case EbtInt8:
|
||||
case EbtInt16:
|
||||
case EbtInt:
|
||||
case EbtInt64:
|
||||
dstType = CONV_INT;
|
||||
break;
|
||||
case EbtUint8:
|
||||
case EbtUint16:
|
||||
case EbtUint:
|
||||
case EbtUint64:
|
||||
dstType = CONV_UINT;
|
||||
break;
|
||||
case EbtBool:
|
||||
dstType = CONV_BOOL;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
if (dstType == CONV_BOOL) {
|
||||
switch (srcType) {
|
||||
case CONV_FLOAT:
|
||||
valb = (valf != 0.0); break;
|
||||
case CONV_INT:
|
||||
valb = (vali != 0.0); break;
|
||||
case CONV_UINT:
|
||||
valb = (valu != 0.0); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (dstType == CONV_FLOAT) {
|
||||
switch (srcType) {
|
||||
case CONV_BOOL:
|
||||
valf = (double)valb; break;
|
||||
case CONV_INT:
|
||||
valf = (double)vali; break;
|
||||
case CONV_UINT:
|
||||
valf = (double)valu; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (dstType == CONV_INT) {
|
||||
switch (srcType) {
|
||||
case CONV_BOOL:
|
||||
vali = (int64_t)valb; break;
|
||||
case CONV_FLOAT:
|
||||
vali = (int64_t)valf; break;
|
||||
case CONV_UINT:
|
||||
vali = (int64_t)valu; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (dstType == CONV_UINT) {
|
||||
switch (srcType) {
|
||||
case CONV_BOOL:
|
||||
valu = (uint64_t)valb; break;
|
||||
case CONV_FLOAT:
|
||||
valu = (uint64_t)valf; break;
|
||||
case CONV_INT:
|
||||
valu = (uint64_t)vali; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (returnType.getBasicType()) {
|
||||
case EbtDouble:
|
||||
case EbtFloat16:
|
||||
case EbtFloat:
|
||||
newConstArray[i].setDConst(valf); break;
|
||||
case EbtInt8:
|
||||
newConstArray[i].setI8Const(static_cast<int8_t>(vali)); break;
|
||||
case EbtInt16:
|
||||
newConstArray[i].setI16Const(static_cast<int16_t>(vali)); break;
|
||||
case EbtInt:
|
||||
newConstArray[i].setIConst(static_cast<int32_t>(vali)); break;
|
||||
case EbtInt64:
|
||||
newConstArray[i].setI64Const(vali); break;
|
||||
case EbtUint8:
|
||||
newConstArray[i].setU8Const(static_cast<uint8_t>(valu)); break;
|
||||
case EbtUint16:
|
||||
newConstArray[i].setU16Const(static_cast<uint16_t>(valu)); break;
|
||||
case EbtUint:
|
||||
newConstArray[i].setUConst(static_cast<uint32_t>(valu)); break;
|
||||
case EbtUint64:
|
||||
newConstArray[i].setU64Const(valu); break;
|
||||
case EbtBool:
|
||||
newConstArray[i].setBConst(valb); break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
switch (op) {
|
||||
case EOpNegative:
|
||||
switch (getType().getBasicType()) {
|
||||
|
|
@ -507,7 +664,11 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
case EbtUint8: newConstArray[i].setU8Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU8Const()))); break;
|
||||
case EbtInt16: newConstArray[i].setI16Const(-unionArray[i].getI16Const()); break;
|
||||
case EbtUint16:newConstArray[i].setU16Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU16Const()))); break;
|
||||
case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break;
|
||||
case EbtInt64: {
|
||||
int64_t i64val = unionArray[i].getI64Const();
|
||||
newConstArray[i].setI64Const(i64val == INT64_MIN ? INT64_MIN : -i64val);
|
||||
break;
|
||||
}
|
||||
case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(-static_cast<long long>(unionArray[i].getU64Const()))); break;
|
||||
default:
|
||||
return nullptr;
|
||||
|
|
@ -637,277 +798,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
break;
|
||||
}
|
||||
|
||||
case EOpConvIntToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break;
|
||||
case EOpConvUintToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break;
|
||||
case EOpConvBoolToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getBConst()); break;
|
||||
case EOpConvIntToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getIConst()); break;
|
||||
case EOpConvUintToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getUConst()); break;
|
||||
|
||||
case EOpConvFloatToBool:
|
||||
case EOpConvDoubleToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
|
||||
|
||||
case EOpConvBoolToFloat:
|
||||
case EOpConvBoolToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
|
||||
|
||||
case EOpConvIntToFloat:
|
||||
case EOpConvIntToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
|
||||
|
||||
case EOpConvUintToFloat:
|
||||
case EOpConvUintToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
|
||||
|
||||
case EOpConvDoubleToFloat:
|
||||
case EOpConvFloatToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
|
||||
case EOpConvFloatToUint:
|
||||
case EOpConvDoubleToUint:
|
||||
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
|
||||
|
||||
case EOpConvFloatToInt:
|
||||
case EOpConvDoubleToInt:
|
||||
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
|
||||
|
||||
case EOpConvInt8ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break;
|
||||
case EOpConvUint8ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getU8Const() != 0); break;
|
||||
case EOpConvInt16ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break;
|
||||
case EOpConvUint16ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getU16Const() != 0); break;
|
||||
case EOpConvInt64ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
|
||||
case EOpConvUint64ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getU64Const() != 0); break;
|
||||
case EOpConvFloat16ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
|
||||
|
||||
case EOpConvBoolToInt8:
|
||||
newConstArray[i].setI8Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToUint8:
|
||||
newConstArray[i].setU8Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToInt16:
|
||||
newConstArray[i].setI16Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToUint16:
|
||||
newConstArray[i].setU16Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
|
||||
|
||||
case EOpConvInt8ToInt16:
|
||||
newConstArray[i].setI16Const(unionArray[i].getI8Const()); break;
|
||||
case EOpConvInt8ToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getI8Const()); break;
|
||||
case EOpConvInt8ToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getI8Const()); break;
|
||||
case EOpConvInt8ToUint8:
|
||||
newConstArray[i].setU8Const(unionArray[i].getI8Const()); break;
|
||||
case EOpConvInt8ToUint16:
|
||||
newConstArray[i].setU16Const(unionArray[i].getI8Const()); break;
|
||||
case EOpConvInt8ToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getI8Const()); break;
|
||||
case EOpConvInt8ToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getI8Const()); break;
|
||||
case EOpConvUint8ToInt8:
|
||||
newConstArray[i].setI8Const(unionArray[i].getU8Const()); break;
|
||||
case EOpConvUint8ToInt16:
|
||||
newConstArray[i].setI16Const(unionArray[i].getU8Const()); break;
|
||||
case EOpConvUint8ToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getU8Const()); break;
|
||||
case EOpConvUint8ToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getU8Const()); break;
|
||||
case EOpConvUint8ToUint16:
|
||||
newConstArray[i].setU16Const(unionArray[i].getU8Const()); break;
|
||||
case EOpConvUint8ToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getU8Const()); break;
|
||||
case EOpConvUint8ToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getU8Const()); break;
|
||||
case EOpConvInt8ToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getI8Const()); break;
|
||||
case EOpConvInt8ToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getI8Const()); break;
|
||||
case EOpConvInt8ToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getI8Const()); break;
|
||||
case EOpConvUint8ToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getU8Const()); break;
|
||||
case EOpConvUint8ToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getU8Const()); break;
|
||||
case EOpConvUint8ToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getU8Const()); break;
|
||||
|
||||
case EOpConvInt16ToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI16Const())); break;
|
||||
case EOpConvInt16ToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getI16Const()); break;
|
||||
case EOpConvInt16ToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getI16Const()); break;
|
||||
case EOpConvInt16ToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getI16Const())); break;
|
||||
case EOpConvInt16ToUint16:
|
||||
newConstArray[i].setU16Const(unionArray[i].getI16Const()); break;
|
||||
case EOpConvInt16ToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getI16Const()); break;
|
||||
case EOpConvInt16ToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getI16Const()); break;
|
||||
case EOpConvUint16ToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getU16Const())); break;
|
||||
case EOpConvUint16ToInt16:
|
||||
newConstArray[i].setI16Const(unionArray[i].getU16Const()); break;
|
||||
case EOpConvUint16ToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getU16Const()); break;
|
||||
case EOpConvUint16ToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getU16Const()); break;
|
||||
case EOpConvUint16ToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getU16Const())); break;
|
||||
|
||||
case EOpConvUint16ToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getU16Const()); break;
|
||||
case EOpConvUint16ToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getU16Const()); break;
|
||||
case EOpConvInt16ToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getI16Const()); break;
|
||||
case EOpConvInt16ToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getI16Const()); break;
|
||||
case EOpConvInt16ToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getI16Const()); break;
|
||||
case EOpConvUint16ToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getU16Const()); break;
|
||||
case EOpConvUint16ToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getU16Const()); break;
|
||||
case EOpConvUint16ToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getU16Const()); break;
|
||||
|
||||
case EOpConvIntToInt8:
|
||||
newConstArray[i].setI8Const((signed char)unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToInt16:
|
||||
newConstArray[i].setI16Const((signed short)unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToUint8:
|
||||
newConstArray[i].setU8Const((unsigned char)unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToUint16:
|
||||
newConstArray[i].setU16Const((unsigned char)unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getIConst()); break;
|
||||
|
||||
case EOpConvUintToInt8:
|
||||
newConstArray[i].setI8Const((signed char)unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToInt16:
|
||||
newConstArray[i].setI16Const((signed short)unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToUint8:
|
||||
newConstArray[i].setU8Const((unsigned char)unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToUint16:
|
||||
newConstArray[i].setU16Const((unsigned short)unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getUConst()); break;
|
||||
case EOpConvIntToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
|
||||
case EOpConvUintToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
|
||||
case EOpConvInt64ToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToInt16:
|
||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToInt:
|
||||
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToUint16:
|
||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToUint:
|
||||
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getI64Const()); break;
|
||||
case EOpConvUint64ToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvUint64ToInt16:
|
||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvUint64ToInt:
|
||||
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvUint64ToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getU64Const()); break;
|
||||
case EOpConvUint64ToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvUint64ToUint16:
|
||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvUint64ToUint:
|
||||
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvInt64ToFloat16:
|
||||
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToFloat:
|
||||
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToDouble:
|
||||
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvUint64ToFloat16:
|
||||
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvUint64ToFloat:
|
||||
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvUint64ToDouble:
|
||||
newConstArray[i].setDConst(static_cast<double>(unionArray[i].getU64Const())); break;
|
||||
case EOpConvFloat16ToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloat16ToInt16:
|
||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloat16ToInt:
|
||||
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloat16ToInt64:
|
||||
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloat16ToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloat16ToUint16:
|
||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloat16ToUint:
|
||||
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloat16ToUint64:
|
||||
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloat16ToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
case EOpConvFloat16ToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
case EOpConvFloatToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToInt16:
|
||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToInt64:
|
||||
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToUint16:
|
||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToUint64:
|
||||
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
case EOpConvDoubleToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToInt16:
|
||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToInt64:
|
||||
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToUint16:
|
||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToUint64:
|
||||
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
case EOpConvPtrToUint64:
|
||||
case EOpConvUint64ToPtr:
|
||||
case EOpConstructReference:
|
||||
|
|
@ -1009,6 +899,12 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
objectSize = std::max(children[0]->getAsTyped()->getType().getVectorSize(),
|
||||
children[2]->getAsTyped()->getType().getVectorSize());
|
||||
break;
|
||||
case EOpMul:
|
||||
{
|
||||
TIntermConstantUnion* left = children[0]->getAsConstantUnion();
|
||||
TIntermConstantUnion* right = children[1]->getAsConstantUnion();
|
||||
return left->fold(EOpMul, right);
|
||||
}
|
||||
default:
|
||||
return aggrNode;
|
||||
}
|
||||
|
|
@ -1223,6 +1119,9 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
break;
|
||||
}
|
||||
case EOpDot:
|
||||
if (!children[0]->getAsTyped()->isFloatingDomain()) {
|
||||
return aggrNode;
|
||||
}
|
||||
newConstArray[0].setDConst(childConstUnions[0].dot(childConstUnions[1]));
|
||||
break;
|
||||
case EOpCross:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -65,10 +65,10 @@ namespace glslang {
|
|||
// Returns the added node.
|
||||
//
|
||||
|
||||
TIntermSymbol* TIntermediate::addSymbol(long long id, const TString& name, const TType& type, const TConstUnionArray& constArray,
|
||||
TIntermSymbol* TIntermediate::addSymbol(long long id, const TString& name, const TString& mangledName, const TType& type, const TConstUnionArray& constArray,
|
||||
TIntermTyped* constSubtree, const TSourceLoc& loc)
|
||||
{
|
||||
TIntermSymbol* node = new TIntermSymbol(id, name, type);
|
||||
TIntermSymbol* node = new TIntermSymbol(id, name, getStage(), type, &mangledName);
|
||||
node->setLoc(loc);
|
||||
node->setConstArray(constArray);
|
||||
node->setConstSubtree(constSubtree);
|
||||
|
|
@ -80,6 +80,7 @@ TIntermSymbol* TIntermediate::addSymbol(const TIntermSymbol& intermSymbol)
|
|||
{
|
||||
return addSymbol(intermSymbol.getId(),
|
||||
intermSymbol.getName(),
|
||||
intermSymbol.getMangledName(),
|
||||
intermSymbol.getType(),
|
||||
intermSymbol.getConstArray(),
|
||||
intermSymbol.getConstSubtree(),
|
||||
|
|
@ -96,14 +97,14 @@ TIntermSymbol* TIntermediate::addSymbol(const TVariable& variable)
|
|||
|
||||
TIntermSymbol* TIntermediate::addSymbol(const TVariable& variable, const TSourceLoc& loc)
|
||||
{
|
||||
return addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), variable.getConstArray(), variable.getConstSubtree(), loc);
|
||||
return addSymbol(variable.getUniqueId(), variable.getName(), variable.getMangledName(), variable.getType(), variable.getConstArray(), variable.getConstSubtree(), loc);
|
||||
}
|
||||
|
||||
TIntermSymbol* TIntermediate::addSymbol(const TType& type, const TSourceLoc& loc)
|
||||
{
|
||||
TConstUnionArray unionArray; // just a null constant
|
||||
|
||||
return addSymbol(0, "", type, unionArray, nullptr, loc);
|
||||
return addSymbol(0, "", "", type, unionArray, nullptr, loc);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -163,8 +164,8 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
|||
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
|
||||
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
|
||||
|
||||
left = addBuiltInFunctionCall(loc, EOpConvUint64ToInt64, true, left, TType(EbtInt64));
|
||||
right = addBuiltInFunctionCall(loc, EOpConvUint64ToInt64, true, right, TType(EbtInt64));
|
||||
left = addBuiltInFunctionCall(loc, EOpConvNumeric, true, left, TType(EbtInt64));
|
||||
right = addBuiltInFunctionCall(loc, EOpConvNumeric, true, right, TType(EbtInt64));
|
||||
|
||||
left = addBinaryMath(EOpSub, left, right, loc);
|
||||
|
||||
|
|
@ -567,222 +568,12 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const
|
|||
|
||||
bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& newOp) const
|
||||
{
|
||||
switch (dst) {
|
||||
case EbtDouble:
|
||||
switch (src) {
|
||||
case EbtUint: newOp = EOpConvUintToDouble; break;
|
||||
case EbtBool: newOp = EOpConvBoolToDouble; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToDouble; break;
|
||||
case EbtInt: newOp = EOpConvIntToDouble; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToDouble; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToDouble; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToDouble; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToDouble; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToDouble; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtFloat:
|
||||
switch (src) {
|
||||
case EbtInt: newOp = EOpConvIntToFloat; break;
|
||||
case EbtUint: newOp = EOpConvUintToFloat; break;
|
||||
case EbtBool: newOp = EOpConvBoolToFloat; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToFloat; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToFloat; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToFloat; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToFloat; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToFloat; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToFloat; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtFloat16:
|
||||
switch (src) {
|
||||
case EbtInt8: newOp = EOpConvInt8ToFloat16; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToFloat16; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToFloat16; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToFloat16; break;
|
||||
case EbtInt: newOp = EOpConvIntToFloat16; break;
|
||||
case EbtUint: newOp = EOpConvUintToFloat16; break;
|
||||
case EbtBool: newOp = EOpConvBoolToFloat16; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToFloat16; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToFloat16; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToFloat16; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToFloat16; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtBool:
|
||||
switch (src) {
|
||||
case EbtInt: newOp = EOpConvIntToBool; break;
|
||||
case EbtUint: newOp = EOpConvUintToBool; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToBool; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToBool; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToBool; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToBool; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToBool; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToBool; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToBool; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToBool; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToBool; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtInt8:
|
||||
switch (src) {
|
||||
case EbtUint8: newOp = EOpConvUint8ToInt8; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToInt8; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToInt8; break;
|
||||
case EbtInt: newOp = EOpConvIntToInt8; break;
|
||||
case EbtUint: newOp = EOpConvUintToInt8; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToInt8; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt8; break;
|
||||
case EbtBool: newOp = EOpConvBoolToInt8; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt8; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToInt8; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToInt8; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtUint8:
|
||||
switch (src) {
|
||||
case EbtInt8: newOp = EOpConvInt8ToUint8; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToUint8; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToUint8; break;
|
||||
case EbtInt: newOp = EOpConvIntToUint8; break;
|
||||
case EbtUint: newOp = EOpConvUintToUint8; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint8; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToUint8; break;
|
||||
case EbtBool: newOp = EOpConvBoolToUint8; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint8; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToUint8; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToUint8; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case EbtInt16:
|
||||
switch (src) {
|
||||
case EbtUint8: newOp = EOpConvUint8ToInt16; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToInt16; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToInt16; break;
|
||||
case EbtInt: newOp = EOpConvIntToInt16; break;
|
||||
case EbtUint: newOp = EOpConvUintToInt16; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToInt16; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt16; break;
|
||||
case EbtBool: newOp = EOpConvBoolToInt16; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt16; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToInt16; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToInt16; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtUint16:
|
||||
switch (src) {
|
||||
case EbtInt8: newOp = EOpConvInt8ToUint16; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToUint16; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToUint16; break;
|
||||
case EbtInt: newOp = EOpConvIntToUint16; break;
|
||||
case EbtUint: newOp = EOpConvUintToUint16; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint16; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToUint16; break;
|
||||
case EbtBool: newOp = EOpConvBoolToUint16; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint16; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToUint16; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToUint16; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case EbtInt:
|
||||
switch (src) {
|
||||
case EbtUint: newOp = EOpConvUintToInt; break;
|
||||
case EbtBool: newOp = EOpConvBoolToInt; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToInt; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToInt; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToInt; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToInt; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToInt; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToInt; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToInt; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch (src) {
|
||||
case EbtInt: newOp = EOpConvIntToUint; break;
|
||||
case EbtBool: newOp = EOpConvBoolToUint; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToUint; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToUint; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToUint; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToUint; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToUint; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToUint; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToUint; break;
|
||||
// For bindless texture type conversion, add a dummy convert op, just
|
||||
// to generate a new TIntermTyped
|
||||
// uvec2(any sampler type)
|
||||
// uvec2(any image type)
|
||||
case EbtSampler: newOp = EOpConvIntToUint; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
switch (src) {
|
||||
case EbtInt8: newOp = EOpConvInt8ToInt64; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToInt64; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToInt64; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToInt64; break;
|
||||
case EbtInt: newOp = EOpConvIntToInt64; break;
|
||||
case EbtUint: newOp = EOpConvUintToInt64; break;
|
||||
case EbtBool: newOp = EOpConvBoolToInt64; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt64; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToInt64; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToInt64; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt64; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case EbtUint64:
|
||||
switch (src) {
|
||||
case EbtInt8: newOp = EOpConvInt8ToUint64; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToUint64; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToUint64; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToUint64; break;
|
||||
case EbtInt: newOp = EOpConvIntToUint64; break;
|
||||
case EbtUint: newOp = EOpConvUintToUint64; break;
|
||||
case EbtBool: newOp = EOpConvBoolToUint64; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint64; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToUint64; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToUint64; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint64; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
if ((isTypeInt(dst) || isTypeFloat(dst) || dst == EbtBool) &&
|
||||
(isTypeInt(src) || isTypeFloat(src) || src == EbtBool)) {
|
||||
newOp = EOpConvNumeric;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is 'mechanism' here, it does any conversion told.
|
||||
|
|
@ -1034,6 +825,15 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
op != EOpConstructCooperativeMatrixKHR)
|
||||
return nullptr;
|
||||
|
||||
if (node->getType().isTensorLayoutNV() ||
|
||||
node->getType().isTensorViewNV())
|
||||
return nullptr;
|
||||
|
||||
// Reject implicit conversions to cooperative vector types
|
||||
if (node->getType().isCoopVecNV() &&
|
||||
op != EOpConstructCooperativeVectorNV)
|
||||
return nullptr;
|
||||
|
||||
// Note: callers are responsible for other aspects of shape,
|
||||
// like vector and matrix sizes.
|
||||
|
||||
|
|
@ -1101,6 +901,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EOpConstructStruct:
|
||||
case EOpConstructCooperativeMatrixNV:
|
||||
case EOpConstructCooperativeMatrixKHR:
|
||||
case EOpConstructCooperativeVectorNV:
|
||||
|
||||
if (type.isReference() || node->getType().isReference()) {
|
||||
// types must match to assign a reference
|
||||
|
|
@ -1977,6 +1778,9 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||
if (type.isCoopMatKHR())
|
||||
return EOpConstructCooperativeMatrixKHR;
|
||||
|
||||
if (type.isCoopVecNV())
|
||||
return EOpConstructCooperativeVectorNV;
|
||||
|
||||
switch (type.getBasicType()) {
|
||||
case EbtStruct:
|
||||
op = EOpConstructStruct;
|
||||
|
|
@ -2962,17 +2766,16 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
|
|||
// (However, some floating-point operations result in bool, like ">",
|
||||
// so are handled later.)
|
||||
if (node.getType().isFloatingDomain()) {
|
||||
if (IsOpNumericConv(node.getOp()) &&
|
||||
isTypeFloat(node.getType().getBasicType()) &&
|
||||
isTypeFloat(node.getAsUnaryNode()->getOperand()->getAsTyped()->getType().getBasicType())) {
|
||||
return true;
|
||||
}
|
||||
switch (node.getOp()) {
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect:
|
||||
case EOpIndexDirectStruct:
|
||||
case EOpVectorSwizzle:
|
||||
case EOpConvFloatToDouble:
|
||||
case EOpConvDoubleToFloat:
|
||||
case EOpConvFloat16ToFloat:
|
||||
case EOpConvFloatToFloat16:
|
||||
case EOpConvFloat16ToDouble:
|
||||
case EOpConvDoubleToFloat16:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -2987,6 +2790,15 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
|
|||
|
||||
// So, for now, we can assume everything left is non-floating-point...
|
||||
|
||||
if (IsOpNumericConv(node.getOp())) {
|
||||
TBasicType srcType = node.getAsUnaryNode()->getOperand()->getAsTyped()->getType().getBasicType();
|
||||
TBasicType dstType = node.getType().getBasicType();
|
||||
if ((isTypeInt(srcType) || srcType == EbtBool) &&
|
||||
(isTypeInt(dstType) || dstType == EbtBool)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Now check for integer/bool-based operations
|
||||
switch (node.getOp()) {
|
||||
|
||||
|
|
@ -2996,98 +2808,6 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
|
|||
case EOpIndexDirectStruct:
|
||||
case EOpVectorSwizzle:
|
||||
|
||||
// (u)int* -> bool
|
||||
case EOpConvInt8ToBool:
|
||||
case EOpConvInt16ToBool:
|
||||
case EOpConvIntToBool:
|
||||
case EOpConvInt64ToBool:
|
||||
case EOpConvUint8ToBool:
|
||||
case EOpConvUint16ToBool:
|
||||
case EOpConvUintToBool:
|
||||
case EOpConvUint64ToBool:
|
||||
|
||||
// bool -> (u)int*
|
||||
case EOpConvBoolToInt8:
|
||||
case EOpConvBoolToInt16:
|
||||
case EOpConvBoolToInt:
|
||||
case EOpConvBoolToInt64:
|
||||
case EOpConvBoolToUint8:
|
||||
case EOpConvBoolToUint16:
|
||||
case EOpConvBoolToUint:
|
||||
case EOpConvBoolToUint64:
|
||||
|
||||
// int8_t -> (u)int*
|
||||
case EOpConvInt8ToInt16:
|
||||
case EOpConvInt8ToInt:
|
||||
case EOpConvInt8ToInt64:
|
||||
case EOpConvInt8ToUint8:
|
||||
case EOpConvInt8ToUint16:
|
||||
case EOpConvInt8ToUint:
|
||||
case EOpConvInt8ToUint64:
|
||||
|
||||
// int16_t -> (u)int*
|
||||
case EOpConvInt16ToInt8:
|
||||
case EOpConvInt16ToInt:
|
||||
case EOpConvInt16ToInt64:
|
||||
case EOpConvInt16ToUint8:
|
||||
case EOpConvInt16ToUint16:
|
||||
case EOpConvInt16ToUint:
|
||||
case EOpConvInt16ToUint64:
|
||||
|
||||
// int32_t -> (u)int*
|
||||
case EOpConvIntToInt8:
|
||||
case EOpConvIntToInt16:
|
||||
case EOpConvIntToInt64:
|
||||
case EOpConvIntToUint8:
|
||||
case EOpConvIntToUint16:
|
||||
case EOpConvIntToUint:
|
||||
case EOpConvIntToUint64:
|
||||
|
||||
// int64_t -> (u)int*
|
||||
case EOpConvInt64ToInt8:
|
||||
case EOpConvInt64ToInt16:
|
||||
case EOpConvInt64ToInt:
|
||||
case EOpConvInt64ToUint8:
|
||||
case EOpConvInt64ToUint16:
|
||||
case EOpConvInt64ToUint:
|
||||
case EOpConvInt64ToUint64:
|
||||
|
||||
// uint8_t -> (u)int*
|
||||
case EOpConvUint8ToInt8:
|
||||
case EOpConvUint8ToInt16:
|
||||
case EOpConvUint8ToInt:
|
||||
case EOpConvUint8ToInt64:
|
||||
case EOpConvUint8ToUint16:
|
||||
case EOpConvUint8ToUint:
|
||||
case EOpConvUint8ToUint64:
|
||||
|
||||
// uint16_t -> (u)int*
|
||||
case EOpConvUint16ToInt8:
|
||||
case EOpConvUint16ToInt16:
|
||||
case EOpConvUint16ToInt:
|
||||
case EOpConvUint16ToInt64:
|
||||
case EOpConvUint16ToUint8:
|
||||
case EOpConvUint16ToUint:
|
||||
case EOpConvUint16ToUint64:
|
||||
|
||||
// uint32_t -> (u)int*
|
||||
case EOpConvUintToInt8:
|
||||
case EOpConvUintToInt16:
|
||||
case EOpConvUintToInt:
|
||||
case EOpConvUintToInt64:
|
||||
case EOpConvUintToUint8:
|
||||
case EOpConvUintToUint16:
|
||||
case EOpConvUintToUint64:
|
||||
|
||||
// uint64_t -> (u)int*
|
||||
case EOpConvUint64ToInt8:
|
||||
case EOpConvUint64ToInt16:
|
||||
case EOpConvUint64ToInt:
|
||||
case EOpConvUint64ToInt64:
|
||||
case EOpConvUint64ToUint8:
|
||||
case EOpConvUint64ToUint16:
|
||||
case EOpConvUint64ToUint:
|
||||
|
||||
// unary operations
|
||||
case EOpNegative:
|
||||
case EOpLogicalNot:
|
||||
|
|
@ -3590,6 +3310,43 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (left->getType().isCoopVecNV() || right->getType().isCoopVecNV()) {
|
||||
// Operations on two cooperative vectors must have identical types
|
||||
if (left->getType().isCoopVecNV() && right->getType().isCoopVecNV() &&
|
||||
left->getType() != right->getType()) {
|
||||
return false;
|
||||
}
|
||||
switch (op) {
|
||||
case EOpMul:
|
||||
case EOpMulAssign:
|
||||
// Use VectorTimesScalar if either operand is not a vector. Otherwise use Mul.
|
||||
if (!left->getType().isCoopVecNV() || !right->getType().isCoopVecNV()) {
|
||||
node.setOp(op == EOpMulAssign ? EOpVectorTimesScalarAssign : EOpVectorTimesScalar);
|
||||
}
|
||||
// In case of scalar*vector, take the result type from the vector.
|
||||
if (right->getType().isCoopVecNV()) {
|
||||
node.setType(right->getType());
|
||||
}
|
||||
return true;
|
||||
case EOpLeftShift:
|
||||
case EOpLeftShiftAssign:
|
||||
case EOpRightShift:
|
||||
case EOpRightShiftAssign:
|
||||
case EOpAdd:
|
||||
case EOpSub:
|
||||
case EOpDiv:
|
||||
case EOpAssign:
|
||||
// These require both to be cooperative vectors
|
||||
if (!left->getType().isCoopVecNV() || !right->getType().isCoopVecNV()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Finish handling the case, for all ops, where both operands are scalars.
|
||||
if (left->isScalar() && right->isScalar())
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void TParseContextBase::outputMessage(const TSourceLoc& loc, const char* szReaso
|
|||
safe_vsprintf(szExtraInfo, maxSize, szExtraInfoFormat, args);
|
||||
|
||||
infoSink.info.prefix(prefix);
|
||||
infoSink.info.location(loc, messages & EShMsgAbsolutePath);
|
||||
infoSink.info.location(loc, messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
infoSink.info << "'" << szToken << "' : " << szReason << " " << szExtraInfo << "\n";
|
||||
|
||||
if (prefix == EPrefixError) {
|
||||
|
|
@ -305,6 +305,11 @@ void TParseContextBase::checkIndex(const TSourceLoc& loc, const TType& type, int
|
|||
error(loc, "", "[", "matrix index out of range '%d'", index);
|
||||
index = type.getMatrixCols() - 1;
|
||||
}
|
||||
} else if (type.isCoopVecNV()) {
|
||||
if (index >= type.computeNumComponents()) {
|
||||
error(loc, "", "[", "cooperative vector index out of range '%d'", index);
|
||||
index = type.computeNumComponents() - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -384,7 +384,7 @@ public:
|
|||
void globalCheck(const TSourceLoc&, const char* token);
|
||||
bool constructorError(const TSourceLoc&, TIntermNode*, TFunction&, TOperator, TType&);
|
||||
bool constructorTextureSamplerError(const TSourceLoc&, const TFunction&);
|
||||
void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&, const char *sizeType, const bool allowZero = false);
|
||||
void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&, const char *sizeType, const bool isTypeParameter = false);
|
||||
bool arrayQualifierError(const TSourceLoc&, const TQualifier&);
|
||||
bool arrayError(const TSourceLoc&, const TType&);
|
||||
void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&);
|
||||
|
|
@ -397,6 +397,7 @@ public:
|
|||
void samplerCheck(const TSourceLoc&, const TType&, const TString& identifier, TIntermTyped* initializer);
|
||||
void atomicUintCheck(const TSourceLoc&, const TType&, const TString& identifier);
|
||||
void accStructCheck(const TSourceLoc & loc, const TType & type, const TString & identifier);
|
||||
void hitObjectNVCheck(const TSourceLoc & loc, const TType & type, const TString & identifier);
|
||||
void transparentOpaqueCheck(const TSourceLoc&, const TType&, const TString& identifier);
|
||||
void memberQualifierCheck(glslang::TPublicType&);
|
||||
void globalQualifierFixCheck(const TSourceLoc&, TQualifier&, bool isMemberCheck = false, const TPublicType* publicType = nullptr);
|
||||
|
|
@ -406,7 +407,7 @@ public:
|
|||
void setDefaultPrecision(const TSourceLoc&, TPublicType&, TPrecisionQualifier);
|
||||
int computeSamplerTypeIndex(TSampler&);
|
||||
TPrecisionQualifier getDefaultPrecision(TPublicType&);
|
||||
void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&, bool isCoopMat);
|
||||
void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&, bool isCoopMatOrVec);
|
||||
void parameterTypeCheck(const TSourceLoc&, TStorageQualifier qualifier, const TType& type);
|
||||
bool containsFieldWithBasicType(const TType& type ,TBasicType basicType);
|
||||
TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&);
|
||||
|
|
@ -424,7 +425,7 @@ public:
|
|||
void inductiveLoopCheck(const TSourceLoc&, TIntermNode* init, TIntermLoop* loop);
|
||||
void arrayLimitCheck(const TSourceLoc&, const TString&, int size);
|
||||
void limitCheck(const TSourceLoc&, int value, const char* limit, const char* feature);
|
||||
void coopMatTypeParametersCheck(const TSourceLoc&, const TPublicType&);
|
||||
void typeParametersCheck(const TSourceLoc&, const TPublicType&);
|
||||
|
||||
void inductiveLoopBodyCheck(TIntermNode*, long long loopIndexId, TSymbolTable&);
|
||||
void constantIndexExpressionCheck(TIntermNode*);
|
||||
|
|
@ -508,6 +509,7 @@ protected:
|
|||
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
|
||||
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
|
||||
void finish() override;
|
||||
void handleCoopMat2FunctionCall(const TSourceLoc& loc, const TFunction* fnCandidate, TIntermTyped* result, TIntermNode* arguments);
|
||||
|
||||
virtual const char* getGlobalUniformBlockName() const override;
|
||||
virtual void finalizeGlobalUniformBlockLayout(TVariable&) override;
|
||||
|
|
|
|||
|
|
@ -35,14 +35,21 @@
|
|||
#include "../Include/Common.h"
|
||||
#include "../Include/PoolAlloc.h"
|
||||
|
||||
// Mostly here for target that do not support threads such as WASI.
|
||||
#ifdef DISABLE_THREAD_SUPPORT
|
||||
#define THREAD_LOCAL
|
||||
#else
|
||||
#define THREAD_LOCAL thread_local
|
||||
#endif
|
||||
|
||||
namespace glslang {
|
||||
|
||||
namespace {
|
||||
thread_local TPoolAllocator* threadPoolAllocator = nullptr;
|
||||
THREAD_LOCAL TPoolAllocator* threadPoolAllocator = nullptr;
|
||||
|
||||
TPoolAllocator* GetDefaultThreadPoolAllocator()
|
||||
{
|
||||
thread_local TPoolAllocator defaultAllocator;
|
||||
THREAD_LOCAL TPoolAllocator defaultAllocator;
|
||||
return &defaultAllocator;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -73,7 +73,7 @@
|
|||
#include "preprocessor/PpTokens.h"
|
||||
|
||||
// Build-time generated includes
|
||||
#include "../../build_info.h"
|
||||
#include "glslang/build_info.h"
|
||||
|
||||
namespace { // anonymous namespace for file-local functions and symbols
|
||||
|
||||
|
|
@ -82,7 +82,10 @@ namespace { // anonymous namespace for file-local functions and symbols
|
|||
int NumberOfClients = 0;
|
||||
|
||||
// global initialization lock
|
||||
#ifndef DISABLE_THREAD_SUPPORT
|
||||
std::mutex init_lock;
|
||||
#endif
|
||||
|
||||
|
||||
using namespace glslang;
|
||||
|
||||
|
|
@ -294,18 +297,21 @@ int CommonIndex(EProfile profile, EShLanguage language)
|
|||
//
|
||||
// To initialize per-stage shared tables, with the common table already complete.
|
||||
//
|
||||
void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int version, EProfile profile, const SpvVersion& spvVersion,
|
||||
bool InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int version, EProfile profile, const SpvVersion& spvVersion,
|
||||
EShLanguage language, EShSource source, TInfoSink& infoSink, TSymbolTable** commonTable,
|
||||
TSymbolTable** symbolTables)
|
||||
{
|
||||
(*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]);
|
||||
InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spvVersion, language, source,
|
||||
infoSink, *symbolTables[language]);
|
||||
if (!InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spvVersion, language, source,
|
||||
infoSink, *symbolTables[language]))
|
||||
return false;
|
||||
builtInParseables.identifyBuiltIns(version, profile, spvVersion, language, *symbolTables[language]);
|
||||
if (profile == EEsProfile && version >= 300)
|
||||
(*symbolTables[language]).setNoBuiltInRedeclarations();
|
||||
if (version == 110)
|
||||
(*symbolTables[language]).setSeparateNameSpaces();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -314,6 +320,7 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi
|
|||
//
|
||||
bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, const SpvVersion& spvVersion, EShSource source)
|
||||
{
|
||||
bool success = true;
|
||||
std::unique_ptr<TBuiltInParseables> builtInParseables(CreateBuiltInParseables(infoSink, source));
|
||||
|
||||
if (builtInParseables == nullptr)
|
||||
|
|
@ -322,70 +329,70 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
|||
builtInParseables->initialize(version, profile, spvVersion);
|
||||
|
||||
// do the common tables
|
||||
InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, EShLangVertex, source,
|
||||
success &= InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, EShLangVertex, source,
|
||||
infoSink, *commonTable[EPcGeneral]);
|
||||
if (profile == EEsProfile)
|
||||
InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, EShLangFragment, source,
|
||||
success &= InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, EShLangFragment, source,
|
||||
infoSink, *commonTable[EPcFragment]);
|
||||
|
||||
// do the per-stage tables
|
||||
|
||||
// always have vertex and fragment
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangVertex, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangVertex, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
// check for tessellation
|
||||
if ((profile != EEsProfile && version >= 150) ||
|
||||
(profile == EEsProfile && version >= 310)) {
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTessControl, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTessControl, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTessEvaluation, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTessEvaluation, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
}
|
||||
|
||||
// check for geometry
|
||||
if ((profile != EEsProfile && version >= 150) ||
|
||||
(profile == EEsProfile && version >= 310))
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangGeometry, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangGeometry, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
// check for compute
|
||||
if ((profile != EEsProfile && version >= 420) ||
|
||||
(profile == EEsProfile && version >= 310))
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
// check for ray tracing stages
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGen, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGen, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangIntersect, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangIntersect, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangAnyHit, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangAnyHit, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangClosestHit, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangClosestHit, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangMiss, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangMiss, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCallable, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCallable, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
}
|
||||
|
||||
// check for mesh
|
||||
if ((profile != EEsProfile && version >= 450) ||
|
||||
(profile == EEsProfile && version >= 320))
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangMesh, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangMesh, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
// check for task
|
||||
if ((profile != EEsProfile && version >= 450) ||
|
||||
(profile == EEsProfile && version >= 320))
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTask, source,
|
||||
success &= InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTask, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
return true;
|
||||
return success;
|
||||
}
|
||||
|
||||
bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable& symbolTable, int version,
|
||||
|
|
@ -397,7 +404,8 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
|
|||
return false;
|
||||
|
||||
builtInParseables->initialize(*resources, version, profile, spvVersion, language);
|
||||
InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, language, source, infoSink, symbolTable);
|
||||
if (!InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, language, source, infoSink, symbolTable))
|
||||
return false;
|
||||
builtInParseables->identifyBuiltIns(version, profile, spvVersion, language, symbolTable, *resources);
|
||||
|
||||
return true;
|
||||
|
|
@ -415,20 +423,24 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
|
|||
// This only gets done the first time any thread needs a particular symbol table
|
||||
// (lazy evaluation).
|
||||
//
|
||||
void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& spvVersion, EShSource source)
|
||||
bool SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& spvVersion, EShSource source)
|
||||
{
|
||||
TInfoSink infoSink;
|
||||
bool success;
|
||||
|
||||
// Make sure only one thread tries to do this at a time
|
||||
#ifndef DISABLE_THREAD_SUPPORT
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
#endif
|
||||
|
||||
// See if it's already been done for this version/profile combination
|
||||
int versionIndex = MapVersionToIndex(version);
|
||||
int spvVersionIndex = MapSpvVersionToIndex(spvVersion);
|
||||
int profileIndex = MapProfileToIndex(profile);
|
||||
int sourceIndex = MapSourceToIndex(source);
|
||||
if (CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][EPcGeneral])
|
||||
return;
|
||||
if (CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][EPcGeneral]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Switch to a new pool
|
||||
TPoolAllocator& previousAllocator = GetThreadPoolAllocator();
|
||||
|
|
@ -444,7 +456,10 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
|||
stageTables[stage] = new TSymbolTable;
|
||||
|
||||
// Generate the local symbol tables using the new pool
|
||||
InitializeSymbolTables(infoSink, commonTable, stageTables, version, profile, spvVersion, source);
|
||||
if (!InitializeSymbolTables(infoSink, commonTable, stageTables, version, profile, spvVersion, source)) {
|
||||
success = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Switch to the process-global pool
|
||||
SetThreadPoolAllocator(PerProcessGPA);
|
||||
|
|
@ -466,7 +481,9 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
|||
SharedSymbolTables[versionIndex][spvVersionIndex][profileIndex][sourceIndex][stage]->readOnly();
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
|
||||
cleanup:
|
||||
// Clean up the local tables before deleting the pool they used.
|
||||
for (int precClass = 0; precClass < EPcCount; ++precClass)
|
||||
delete commonTable[precClass];
|
||||
|
|
@ -475,6 +492,8 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
|||
|
||||
delete builtInPoolAllocator;
|
||||
SetThreadPoolAllocator(&previousAllocator);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Function to Print all builtins
|
||||
|
|
@ -910,7 +929,9 @@ bool ProcessDeferred(
|
|||
intermediate.addSourceText(strings[numPre + s], lengths[numPre + s]);
|
||||
}
|
||||
}
|
||||
SetupBuiltinSymbolTable(version, profile, spvVersion, source);
|
||||
if (!SetupBuiltinSymbolTable(version, profile, spvVersion, source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)]
|
||||
[MapSpvVersionToIndex(spvVersion)]
|
||||
|
|
@ -1311,17 +1332,14 @@ bool CompileDeferred(
|
|||
//
|
||||
int ShInitialize()
|
||||
{
|
||||
#ifndef DISABLE_THREAD_SUPPORT
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
#endif
|
||||
++NumberOfClients;
|
||||
|
||||
if (PerProcessGPA == nullptr)
|
||||
PerProcessGPA = new TPoolAllocator();
|
||||
|
||||
glslang::TScanContext::fillInKeywordMap();
|
||||
#ifdef ENABLE_HLSL
|
||||
glslang::HlslScanContext::fillInKeywordMap();
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -1371,7 +1389,9 @@ void ShDestruct(ShHandle handle)
|
|||
//
|
||||
int ShFinalize()
|
||||
{
|
||||
#ifndef DISABLE_THREAD_SUPPORT
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
#endif
|
||||
--NumberOfClients;
|
||||
assert(NumberOfClients >= 0);
|
||||
if (NumberOfClients > 0)
|
||||
|
|
@ -1408,11 +1428,6 @@ int ShFinalize()
|
|||
PerProcessGPA = nullptr;
|
||||
}
|
||||
|
||||
glslang::TScanContext::deleteKeywordMap();
|
||||
#ifdef ENABLE_HLSL
|
||||
glslang::HlslScanContext::deleteKeywordMap();
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -1717,6 +1732,10 @@ public:
|
|||
virtual bool compile(TIntermNode*, int = 0, EProfile = ENoProfile) { return true; }
|
||||
};
|
||||
|
||||
TIoMapper* GetGlslIoMapper() {
|
||||
return static_cast<TIoMapper*>(new TGlslIoMapper());
|
||||
}
|
||||
|
||||
TShader::TShader(EShLanguage s)
|
||||
: stage(s), lengths(nullptr), stringNames(nullptr), preamble(""), overrideVersion(0)
|
||||
{
|
||||
|
|
@ -1849,6 +1868,9 @@ void TShader::setGlobalUniformBinding(unsigned int binding) { intermediate->setG
|
|||
void TShader::setAtomicCounterBlockName(const char* name) { intermediate->setAtomicCounterBlockName(name); }
|
||||
void TShader::setAtomicCounterBlockSet(unsigned int set) { intermediate->setAtomicCounterBlockSet(set); }
|
||||
|
||||
void TShader::addSourceText(const char* text, size_t len) { intermediate->addSourceText(text, len); }
|
||||
void TShader::setSourceFile(const char* file) { intermediate->setSourceFile(file); }
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
|
||||
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
|
||||
|
|
@ -2033,7 +2055,7 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
|
|||
//
|
||||
// Return true if no errors.
|
||||
//
|
||||
bool TProgram::crossStageCheck(EShMessages) {
|
||||
bool TProgram::crossStageCheck(EShMessages messages) {
|
||||
|
||||
// make temporary intermediates to hold the linkage symbols for each linking interface
|
||||
// while we do the checks
|
||||
|
|
@ -2088,6 +2110,13 @@ bool TProgram::crossStageCheck(EShMessages) {
|
|||
error |= (activeStages[i - 1]->getNumErrors() != 0);
|
||||
}
|
||||
|
||||
// if requested, optimize cross stage IO
|
||||
if (messages & EShMsgLinkTimeOptimization) {
|
||||
for (unsigned int i = 1; i < activeStages.size(); ++i) {
|
||||
activeStages[i - 1]->optimizeStageIO(*infoSink, *activeStages[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return !error;
|
||||
}
|
||||
|
||||
|
|
@ -2112,6 +2141,8 @@ bool TProgram::buildReflection(int opts)
|
|||
if (! linked || reflection != nullptr)
|
||||
return false;
|
||||
|
||||
SetThreadPoolAllocator(pool);
|
||||
|
||||
int firstStage = EShLangVertex, lastStage = EShLangFragment;
|
||||
|
||||
if (opts & EShReflectionIntermediateIO) {
|
||||
|
|
@ -2160,6 +2191,12 @@ int TProgram::getNumAtomicCounters() const { return r
|
|||
const TObjectReflection& TProgram::getAtomicCounter(int index) const { return reflection->getAtomicCounter(index); }
|
||||
void TProgram::dumpReflection() { if (reflection != nullptr) reflection->dump(); }
|
||||
|
||||
TIoMapResolver* TProgram::getGlslIoResolver(EShLanguage stage) {
|
||||
auto *intermediate = getIntermediate(stage);
|
||||
if (!intermediate)
|
||||
return NULL;
|
||||
return static_cast<TIoMapResolver*>(new TDefaultGlslIoResolver(*intermediate));
|
||||
}
|
||||
//
|
||||
// I/O mapping implementation.
|
||||
//
|
||||
|
|
@ -2167,6 +2204,9 @@ bool TProgram::mapIO(TIoMapResolver* pResolver, TIoMapper* pIoMapper)
|
|||
{
|
||||
if (! linked)
|
||||
return false;
|
||||
|
||||
SetThreadPoolAllocator(pool);
|
||||
|
||||
TIoMapper* ioMapper = nullptr;
|
||||
TIoMapper defaultIOMapper;
|
||||
if (pIoMapper == nullptr)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
else if (isVector())
|
||||
mangledName += 'v';
|
||||
|
||||
if (isCoopVecNV())
|
||||
mangledName += "coopvec";
|
||||
|
||||
switch (basicType) {
|
||||
case EbtFloat: mangledName += 'f'; break;
|
||||
case EbtInt: mangledName += 'i'; break;
|
||||
|
|
@ -78,6 +81,8 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
case EbtRayQuery: mangledName += "rq"; break;
|
||||
case EbtSpirvType: mangledName += "spv-t"; break;
|
||||
case EbtHitObjectNV: mangledName += "ho"; break;
|
||||
case EbtTensorLayoutNV: mangledName += "tl"; break;
|
||||
case EbtTensorViewNV: mangledName += "tv"; break;
|
||||
case EbtSampler:
|
||||
switch (sampler.type) {
|
||||
case EbtFloat16: mangledName += "f16"; break;
|
||||
|
|
@ -161,6 +166,23 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
mangledName += static_cast<char>('0' + getMatrixRows());
|
||||
}
|
||||
|
||||
if (typeParameters) {
|
||||
const int maxSize = 11;
|
||||
char buf[maxSize];
|
||||
for (int i = 0; i < typeParameters->arraySizes->getNumDims(); ++i) {
|
||||
if (typeParameters->arraySizes->getDimNode(i)) {
|
||||
if (typeParameters->arraySizes->getDimNode(i)->getAsSymbolNode())
|
||||
snprintf(buf, maxSize, "s%lld", typeParameters->arraySizes->getDimNode(i)->getAsSymbolNode()->getId());
|
||||
else
|
||||
snprintf(buf, maxSize, "s%p", typeParameters->arraySizes->getDimNode(i));
|
||||
} else
|
||||
snprintf(buf, maxSize, "%d", typeParameters->arraySizes->getDimSize(i));
|
||||
mangledName += '<';
|
||||
mangledName += buf;
|
||||
mangledName += '>';
|
||||
}
|
||||
}
|
||||
|
||||
if (arraySizes) {
|
||||
const int maxSize = 11;
|
||||
char buf[maxSize];
|
||||
|
|
@ -169,7 +191,7 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
if (arraySizes->getDimNode(i)->getAsSymbolNode())
|
||||
snprintf(buf, maxSize, "s%lld", arraySizes->getDimNode(i)->getAsSymbolNode()->getId());
|
||||
else
|
||||
snprintf(buf, maxSize, "s%p", arraySizes->getDimNode(i));
|
||||
snprintf(buf, maxSize, "s%p", (void*)(arraySizes->getDimNode(i)));
|
||||
} else
|
||||
snprintf(buf, maxSize, "%d", arraySizes->getDimSize(i));
|
||||
mangledName += '[';
|
||||
|
|
@ -344,6 +366,7 @@ void TSymbolTableLevel::readOnly()
|
|||
TSymbol::TSymbol(const TSymbol& copyOf)
|
||||
{
|
||||
name = NewPoolTString(copyOf.name->c_str());
|
||||
mangledName = NewPoolTString(copyOf.mangledName->c_str());
|
||||
uniqueId = copyOf.uniqueId;
|
||||
writable = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ typedef TVector<const char*> TExtensionList;
|
|||
class TSymbol {
|
||||
public:
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(nullptr), writable(true) { }
|
||||
explicit TSymbol(const TString *n, const TString *mn) : name(n), mangledName(mn), uniqueId(0), extensions(nullptr), writable(true) { }
|
||||
explicit TSymbol(const TString *n) : TSymbol(n, n) { }
|
||||
virtual TSymbol* clone() const = 0;
|
||||
virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool
|
||||
|
||||
|
|
@ -96,7 +97,7 @@ public:
|
|||
newName.append(*name);
|
||||
changeName(NewPoolTString(newName.c_str()));
|
||||
}
|
||||
virtual const TString& getMangledName() const { return getName(); }
|
||||
virtual const TString& getMangledName() const { return *mangledName; }
|
||||
virtual TFunction* getAsFunction() { return nullptr; }
|
||||
virtual const TFunction* getAsFunction() const { return nullptr; }
|
||||
virtual TVariable* getAsVariable() { return nullptr; }
|
||||
|
|
@ -128,6 +129,7 @@ protected:
|
|||
TSymbol& operator=(const TSymbol&);
|
||||
|
||||
const TString *name;
|
||||
const TString *mangledName;
|
||||
unsigned long long uniqueId; // For cross-scope comparing during code generation
|
||||
|
||||
// For tracking what extensions must be present
|
||||
|
|
@ -154,7 +156,9 @@ protected:
|
|||
class TVariable : public TSymbol {
|
||||
public:
|
||||
TVariable(const TString *name, const TType& t, bool uT = false )
|
||||
: TSymbol(name),
|
||||
: TVariable(name, name, t, uT) {}
|
||||
TVariable(const TString *name, const TString *mangledName, const TType& t, bool uT = false )
|
||||
: TSymbol(name, mangledName),
|
||||
userType(uT),
|
||||
constSubtree(nullptr),
|
||||
memberExtensions(nullptr),
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
|
||||
const extensionData exts[] = { {E_GL_EXT_ray_tracing, EShTargetSpv_1_4},
|
||||
{E_GL_NV_ray_tracing_motion_blur, EShTargetSpv_1_4},
|
||||
{E_GL_EXT_mesh_shader, EShTargetSpv_1_4}
|
||||
{E_GL_EXT_mesh_shader, EShTargetSpv_1_4},
|
||||
{E_GL_NV_cooperative_matrix2, EShTargetSpv_1_6}
|
||||
};
|
||||
|
||||
for (size_t ii = 0; ii < sizeof(exts) / sizeof(exts[0]); ii++) {
|
||||
|
|
@ -268,6 +269,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_spec_constant_composites] = EBhDisable;
|
||||
|
||||
extensionBehavior[E_GL_KHR_cooperative_matrix] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_cooperative_vector] = EBhDisable;
|
||||
|
||||
// #line and #include
|
||||
extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable;
|
||||
|
|
@ -310,6 +312,9 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_NV_shader_invocation_reorder] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_displacement_micromap] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_shader_atomic_fp16_vector] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_cooperative_matrix2] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_cluster_acceleration_structure] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_linear_swept_spheres] = EBhDisable;
|
||||
|
||||
// ARM
|
||||
extensionBehavior[E_GL_ARM_shader_core_builtins] = EBhDisable;
|
||||
|
|
@ -371,6 +376,8 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_texture_shadow_lod] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_draw_instanced] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_texture_array] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_texture_offset_non_const] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_nontemporal_keyword] = EBhDisable;
|
||||
|
||||
// OVR extensions
|
||||
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;
|
||||
|
|
@ -394,6 +401,8 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_shader_atomic_float] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_atomic_float2] = EBhDisable;
|
||||
|
||||
extensionBehavior[E_GL_EXT_integer_dot_product] = EBhDisable;
|
||||
|
||||
// Record extensions not for spv.
|
||||
spvUnsupportedExt.push_back(E_GL_ARB_bindless_texture);
|
||||
}
|
||||
|
|
@ -574,6 +583,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_NV_cooperative_matrix 1\n"
|
||||
"#define GL_NV_integer_cooperative_matrix 1\n"
|
||||
"#define GL_NV_shader_invocation_reorder 1\n"
|
||||
"#define GL_NV_cooperative_matrix2 1\n"
|
||||
|
||||
"#define GL_QCOM_image_processing 1\n"
|
||||
"#define GL_QCOM_image_processing2 1\n"
|
||||
|
|
@ -600,6 +610,8 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_EXT_texture_array 1\n"
|
||||
|
||||
"#define GL_EXT_control_flow_attributes2 1\n"
|
||||
|
||||
"#define GL_EXT_integer_dot_product 1\n"
|
||||
;
|
||||
|
||||
if (spvVersion.spv == 0) {
|
||||
|
|
@ -632,6 +644,11 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
;
|
||||
}
|
||||
|
||||
if ((!isEsProfile() && version >= 130) ||
|
||||
(isEsProfile() && version >= 300)) {
|
||||
preamble += "#define GL_EXT_texture_offset_non_const 1\n";
|
||||
}
|
||||
|
||||
if (version >= 300 /* both ES and non-ES */) {
|
||||
preamble +=
|
||||
"#define GL_OVR_multiview 1\n"
|
||||
|
|
@ -775,7 +792,7 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
|
|||
for (int i = 0; i < numExtensions; ++i) {
|
||||
switch (getExtensionBehavior(extensions[i])) {
|
||||
case EBhWarn:
|
||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
|
||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc, messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
[[fallthrough]];
|
||||
case EBhRequire:
|
||||
case EBhEnable:
|
||||
|
|
@ -813,7 +830,8 @@ void TParseVersions::checkDeprecated(const TSourceLoc& loc, int profileMask, int
|
|||
error(loc, "deprecated, may be removed in future release", featureDesc, "");
|
||||
else if (! suppressWarnings())
|
||||
infoSink.info.message(EPrefixWarning, (TString(featureDesc) + " deprecated in version " +
|
||||
String(depVersion) + "; may be removed in future release").c_str(), loc);
|
||||
String(depVersion) + "; may be removed in future release").c_str(),
|
||||
loc, messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -850,11 +868,14 @@ bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExte
|
|||
for (int i = 0; i < numExtensions; ++i) {
|
||||
TExtensionBehavior behavior = getExtensionBehavior(extensions[i]);
|
||||
if (behavior == EBhDisable && relaxedErrors()) {
|
||||
infoSink.info.message(EPrefixWarning, "The following extension must be enabled to use this feature:", loc);
|
||||
infoSink.info.message(EPrefixWarning, "The following extension must be enabled to use this feature:", loc,
|
||||
messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
behavior = EBhWarn;
|
||||
}
|
||||
if (behavior == EBhWarn) {
|
||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
|
||||
infoSink.info.message(EPrefixWarning,
|
||||
("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(),
|
||||
loc, messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
warned = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1017,6 +1038,8 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
|
|||
updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString);
|
||||
else if (strcmp(extension, "GL_NV_integer_cooperative_matrix") == 0)
|
||||
updateExtensionBehavior(line, "GL_NV_cooperative_matrix", behaviorString);
|
||||
else if (strcmp(extension, "GL_NV_cooperative_matrix2") == 0)
|
||||
updateExtensionBehavior(line, "GL_KHR_cooperative_matrix", behaviorString);
|
||||
// subgroup extended types to explicit types
|
||||
else if (strcmp(extension, "GL_EXT_shader_subgroup_extended_types_int8") == 0)
|
||||
updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_int8", behaviorString);
|
||||
|
|
@ -1377,6 +1400,22 @@ void TParseVersions::coopmatCheck(const TSourceLoc& loc, const char* op, bool bu
|
|||
}
|
||||
}
|
||||
|
||||
void TParseVersions::tensorLayoutViewCheck(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||
{
|
||||
if (!builtIn) {
|
||||
const char* const extensions[] = {E_GL_NV_cooperative_matrix2};
|
||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
||||
}
|
||||
}
|
||||
|
||||
void TParseVersions::coopvecCheck(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||
{
|
||||
if (!builtIn) {
|
||||
const char* const extensions[] = {E_GL_NV_cooperative_vector};
|
||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
||||
}
|
||||
}
|
||||
|
||||
// Call for any operation removed because SPIR-V is in use.
|
||||
void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// Copyright (C) 2017, 2022-2024 Arm Limited.
|
||||
// Copyright (C) 2015-2018 Google, Inc.
|
||||
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Modifications Copyright (C) 2024 Valve Corporation.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -223,6 +224,8 @@ const char* const E_GL_EXT_maximal_reconvergence = "GL_EXT_maximal_re
|
|||
const char* const E_GL_EXT_expect_assume = "GL_EXT_expect_assume";
|
||||
const char* const E_GL_EXT_control_flow_attributes2 = "GL_EXT_control_flow_attributes2";
|
||||
const char* const E_GL_EXT_spec_constant_composites = "GL_EXT_spec_constant_composites";
|
||||
const char* const E_GL_EXT_texture_offset_non_const = "GL_EXT_texture_offset_non_const";
|
||||
const char* const E_GL_EXT_nontemporal_keyword = "GL_EXT_nontemporal_keyword";
|
||||
|
||||
// Arrays of extensions for the above viewportEXTs duplications
|
||||
|
||||
|
|
@ -282,6 +285,10 @@ const char* const E_GL_NV_shader_invocation_reorder = "GL_NV_shader_
|
|||
const char* const E_GL_EXT_ray_tracing_position_fetch = "GL_EXT_ray_tracing_position_fetch";
|
||||
const char* const E_GL_NV_displacement_micromap = "GL_NV_displacement_micromap";
|
||||
const char* const E_GL_NV_shader_atomic_fp16_vector = "GL_NV_shader_atomic_fp16_vector";
|
||||
const char* const E_GL_NV_cooperative_matrix2 = "GL_NV_cooperative_matrix2";
|
||||
const char* const E_GL_NV_cooperative_vector = "GL_NV_cooperative_vector";
|
||||
const char* const E_GL_NV_cluster_acceleration_structure = "GL_NV_cluster_acceleration_structure";
|
||||
const char* const E_GL_NV_linear_swept_spheres = "GL_NV_linear_swept_spheres";
|
||||
|
||||
// ARM
|
||||
const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins";
|
||||
|
|
@ -347,6 +354,8 @@ const char* const E_GL_EXT_shader_tile_image = "GL_EXT_shader_tile_image";
|
|||
|
||||
const char* const E_GL_EXT_texture_shadow_lod = "GL_EXT_texture_shadow_lod";
|
||||
|
||||
const char* const E_GL_EXT_integer_dot_product = "GL_EXT_integer_dot_product";
|
||||
|
||||
// Arrays of extensions for the above AEP duplications
|
||||
|
||||
const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader };
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -178,7 +178,9 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> RAYQUERYEXT
|
||||
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
|
||||
%token <lex> COOPMAT
|
||||
%token <lex> COOPVECNV
|
||||
%token <lex> HITOBJECTNV HITOBJECTATTRNV
|
||||
%token <lex> TENSORLAYOUTNV TENSORVIEWNV
|
||||
|
||||
// combined image/sampler
|
||||
%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
|
||||
|
|
@ -275,11 +277,11 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
|
||||
%token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT
|
||||
%token <lex> INT64CONSTANT UINT64CONSTANT
|
||||
%token <lex> SUBROUTINE DEMOTE
|
||||
%token <lex> SUBROUTINE DEMOTE FUNCTION
|
||||
%token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
|
||||
%token <lex> PAYLOADEXT PAYLOADINEXT HITATTREXT CALLDATAEXT CALLDATAINEXT
|
||||
%token <lex> PATCH SAMPLE NONUNIFORM
|
||||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
|
||||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY NONTEMPORAL DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
|
||||
%token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT
|
||||
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT
|
||||
%token <lex> PRECISE
|
||||
|
|
@ -1104,7 +1106,7 @@ parameter_declaration
|
|||
$$ = $2;
|
||||
if ($1.qualifier.precision != EpqNone)
|
||||
$$.param.type->getQualifier().precision = $1.qualifier.precision;
|
||||
parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMat());
|
||||
parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMatOrVec());
|
||||
|
||||
parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
|
||||
parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
|
||||
|
|
@ -1116,7 +1118,7 @@ parameter_declaration
|
|||
|
||||
parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
|
||||
parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
|
||||
parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMat());
|
||||
parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMatOrVec());
|
||||
}
|
||||
//
|
||||
// Without name
|
||||
|
|
@ -1125,7 +1127,7 @@ parameter_declaration
|
|||
$$ = $2;
|
||||
if ($1.qualifier.precision != EpqNone)
|
||||
$$.param.type->getQualifier().precision = $1.qualifier.precision;
|
||||
parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMat());
|
||||
parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMatOrVec());
|
||||
|
||||
parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
|
||||
parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
|
||||
|
|
@ -1136,7 +1138,7 @@ parameter_declaration
|
|||
|
||||
parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
|
||||
parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
|
||||
parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMat());
|
||||
parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMatOrVec());
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1211,7 +1213,7 @@ fully_specified_type
|
|||
parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
|
||||
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
|
||||
}
|
||||
parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier, $$.isCoopmat());
|
||||
parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier, $$.isCoopmatOrvec());
|
||||
}
|
||||
| type_qualifier type_specifier {
|
||||
parseContext.globalQualifierFixCheck($1.loc, $1.qualifier, false, &$2);
|
||||
|
|
@ -1228,7 +1230,7 @@ fully_specified_type
|
|||
parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers);
|
||||
$2.shaderQualifiers.merge($1.shaderQualifiers);
|
||||
parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
|
||||
parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier, $2.isCoopmat());
|
||||
parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier, $2.isCoopmatOrvec());
|
||||
|
||||
$$ = $2;
|
||||
|
||||
|
|
@ -1656,6 +1658,10 @@ storage_qualifier
|
|||
$$.init($1.loc);
|
||||
$$.qualifier.writeonly = true;
|
||||
}
|
||||
| NONTEMPORAL {
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.nontemporal = true;
|
||||
}
|
||||
| SUBROUTINE {
|
||||
parseContext.spvRemoved($1.loc, "subroutine");
|
||||
parseContext.globalCheck($1.loc, "subroutine");
|
||||
|
|
@ -1700,7 +1706,7 @@ type_specifier
|
|||
$$ = $1;
|
||||
$$.qualifier.precision = parseContext.getDefaultPrecision($$);
|
||||
$$.typeParameters = $2;
|
||||
parseContext.coopMatTypeParametersCheck($1.loc, $$);
|
||||
parseContext.typeParametersCheck($1.loc, $$);
|
||||
|
||||
}
|
||||
| type_specifier_nonarray type_parameter_specifier_opt array_specifier {
|
||||
|
|
@ -1709,7 +1715,7 @@ type_specifier
|
|||
$$.qualifier.precision = parseContext.getDefaultPrecision($$);
|
||||
$$.typeParameters = $2;
|
||||
$$.arraySizes = $3.arraySizes;
|
||||
parseContext.coopMatTypeParametersCheck($1.loc, $$);
|
||||
parseContext.typeParametersCheck($1.loc, $$);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -3535,6 +3541,26 @@ type_specifier_nonarray
|
|||
$$.coopmatNV = false;
|
||||
$$.coopmatKHR = true;
|
||||
}
|
||||
| TENSORLAYOUTNV {
|
||||
parseContext.tensorLayoutViewCheck($1.loc, "tensorLayoutNV", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtTensorLayoutNV;
|
||||
}
|
||||
| TENSORVIEWNV {
|
||||
parseContext.tensorLayoutViewCheck($1.loc, "tensorViewNV", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtTensorViewNV;
|
||||
}
|
||||
| FUNCTION {
|
||||
$$.init($1.loc);
|
||||
$$.basicType = EbtFunction;
|
||||
}
|
||||
| COOPVECNV {
|
||||
parseContext.coopvecCheck($1.loc, "coopvecNV", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtCoopvecNV;
|
||||
$$.coopvecNV = true;
|
||||
}
|
||||
| spirv_type_specifier {
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier");
|
||||
$$ = $1;
|
||||
|
|
@ -3636,7 +3662,7 @@ struct_declaration
|
|||
$$ = $2;
|
||||
|
||||
parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType);
|
||||
parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier, $1.isCoopmat());
|
||||
parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier, $1.isCoopmatOrvec());
|
||||
|
||||
for (unsigned int i = 0; i < $$->size(); ++i) {
|
||||
TType type($1);
|
||||
|
|
@ -3660,7 +3686,7 @@ struct_declaration
|
|||
parseContext.memberQualifierCheck($1);
|
||||
parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType);
|
||||
parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
|
||||
parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier, $2.isCoopmat());
|
||||
parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier, $2.isCoopmatOrvec());
|
||||
|
||||
for (unsigned int i = 0; i < $$->size(); ++i) {
|
||||
TType type($2);
|
||||
|
|
@ -3773,8 +3799,10 @@ compound_statement
|
|||
--parseContext.statementNestingLevel;
|
||||
}
|
||||
RIGHT_BRACE {
|
||||
if ($3 && $3->getAsAggregate())
|
||||
if ($3 && $3->getAsAggregate()) {
|
||||
$3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
|
||||
$3->getAsAggregate()->setEndLoc($5.loc);
|
||||
}
|
||||
$$ = $3;
|
||||
}
|
||||
;
|
||||
|
|
@ -3810,8 +3838,10 @@ compound_statement_no_new_scope
|
|||
$$ = 0;
|
||||
}
|
||||
| LEFT_BRACE statement_list RIGHT_BRACE {
|
||||
if ($2 && $2->getAsAggregate())
|
||||
if ($2 && $2->getAsAggregate()) {
|
||||
$2->getAsAggregate()->setOperator(EOpSequence);
|
||||
$2->getAsAggregate()->setEndLoc($3.loc);
|
||||
}
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -218,304 +218,309 @@ extern int yydebug;
|
|||
ICOOPMATNV = 419, /* ICOOPMATNV */
|
||||
UCOOPMATNV = 420, /* UCOOPMATNV */
|
||||
COOPMAT = 421, /* COOPMAT */
|
||||
HITOBJECTNV = 422, /* HITOBJECTNV */
|
||||
HITOBJECTATTRNV = 423, /* HITOBJECTATTRNV */
|
||||
SAMPLERCUBEARRAY = 424, /* SAMPLERCUBEARRAY */
|
||||
SAMPLERCUBEARRAYSHADOW = 425, /* SAMPLERCUBEARRAYSHADOW */
|
||||
ISAMPLERCUBEARRAY = 426, /* ISAMPLERCUBEARRAY */
|
||||
USAMPLERCUBEARRAY = 427, /* USAMPLERCUBEARRAY */
|
||||
SAMPLER1D = 428, /* SAMPLER1D */
|
||||
SAMPLER1DARRAY = 429, /* SAMPLER1DARRAY */
|
||||
SAMPLER1DARRAYSHADOW = 430, /* SAMPLER1DARRAYSHADOW */
|
||||
ISAMPLER1D = 431, /* ISAMPLER1D */
|
||||
SAMPLER1DSHADOW = 432, /* SAMPLER1DSHADOW */
|
||||
SAMPLER2DRECT = 433, /* SAMPLER2DRECT */
|
||||
SAMPLER2DRECTSHADOW = 434, /* SAMPLER2DRECTSHADOW */
|
||||
ISAMPLER2DRECT = 435, /* ISAMPLER2DRECT */
|
||||
USAMPLER2DRECT = 436, /* USAMPLER2DRECT */
|
||||
SAMPLERBUFFER = 437, /* SAMPLERBUFFER */
|
||||
ISAMPLERBUFFER = 438, /* ISAMPLERBUFFER */
|
||||
USAMPLERBUFFER = 439, /* USAMPLERBUFFER */
|
||||
SAMPLER2DMS = 440, /* SAMPLER2DMS */
|
||||
ISAMPLER2DMS = 441, /* ISAMPLER2DMS */
|
||||
USAMPLER2DMS = 442, /* USAMPLER2DMS */
|
||||
SAMPLER2DMSARRAY = 443, /* SAMPLER2DMSARRAY */
|
||||
ISAMPLER2DMSARRAY = 444, /* ISAMPLER2DMSARRAY */
|
||||
USAMPLER2DMSARRAY = 445, /* USAMPLER2DMSARRAY */
|
||||
SAMPLEREXTERNALOES = 446, /* SAMPLEREXTERNALOES */
|
||||
SAMPLEREXTERNAL2DY2YEXT = 447, /* SAMPLEREXTERNAL2DY2YEXT */
|
||||
ISAMPLER1DARRAY = 448, /* ISAMPLER1DARRAY */
|
||||
USAMPLER1D = 449, /* USAMPLER1D */
|
||||
USAMPLER1DARRAY = 450, /* USAMPLER1DARRAY */
|
||||
F16SAMPLER1D = 451, /* F16SAMPLER1D */
|
||||
F16SAMPLER2D = 452, /* F16SAMPLER2D */
|
||||
F16SAMPLER3D = 453, /* F16SAMPLER3D */
|
||||
F16SAMPLER2DRECT = 454, /* F16SAMPLER2DRECT */
|
||||
F16SAMPLERCUBE = 455, /* F16SAMPLERCUBE */
|
||||
F16SAMPLER1DARRAY = 456, /* F16SAMPLER1DARRAY */
|
||||
F16SAMPLER2DARRAY = 457, /* F16SAMPLER2DARRAY */
|
||||
F16SAMPLERCUBEARRAY = 458, /* F16SAMPLERCUBEARRAY */
|
||||
F16SAMPLERBUFFER = 459, /* F16SAMPLERBUFFER */
|
||||
F16SAMPLER2DMS = 460, /* F16SAMPLER2DMS */
|
||||
F16SAMPLER2DMSARRAY = 461, /* F16SAMPLER2DMSARRAY */
|
||||
F16SAMPLER1DSHADOW = 462, /* F16SAMPLER1DSHADOW */
|
||||
F16SAMPLER2DSHADOW = 463, /* F16SAMPLER2DSHADOW */
|
||||
F16SAMPLER1DARRAYSHADOW = 464, /* F16SAMPLER1DARRAYSHADOW */
|
||||
F16SAMPLER2DARRAYSHADOW = 465, /* F16SAMPLER2DARRAYSHADOW */
|
||||
F16SAMPLER2DRECTSHADOW = 466, /* F16SAMPLER2DRECTSHADOW */
|
||||
F16SAMPLERCUBESHADOW = 467, /* F16SAMPLERCUBESHADOW */
|
||||
F16SAMPLERCUBEARRAYSHADOW = 468, /* F16SAMPLERCUBEARRAYSHADOW */
|
||||
IMAGE1D = 469, /* IMAGE1D */
|
||||
IIMAGE1D = 470, /* IIMAGE1D */
|
||||
UIMAGE1D = 471, /* UIMAGE1D */
|
||||
IMAGE2D = 472, /* IMAGE2D */
|
||||
IIMAGE2D = 473, /* IIMAGE2D */
|
||||
UIMAGE2D = 474, /* UIMAGE2D */
|
||||
IMAGE3D = 475, /* IMAGE3D */
|
||||
IIMAGE3D = 476, /* IIMAGE3D */
|
||||
UIMAGE3D = 477, /* UIMAGE3D */
|
||||
IMAGE2DRECT = 478, /* IMAGE2DRECT */
|
||||
IIMAGE2DRECT = 479, /* IIMAGE2DRECT */
|
||||
UIMAGE2DRECT = 480, /* UIMAGE2DRECT */
|
||||
IMAGECUBE = 481, /* IMAGECUBE */
|
||||
IIMAGECUBE = 482, /* IIMAGECUBE */
|
||||
UIMAGECUBE = 483, /* UIMAGECUBE */
|
||||
IMAGEBUFFER = 484, /* IMAGEBUFFER */
|
||||
IIMAGEBUFFER = 485, /* IIMAGEBUFFER */
|
||||
UIMAGEBUFFER = 486, /* UIMAGEBUFFER */
|
||||
IMAGE1DARRAY = 487, /* IMAGE1DARRAY */
|
||||
IIMAGE1DARRAY = 488, /* IIMAGE1DARRAY */
|
||||
UIMAGE1DARRAY = 489, /* UIMAGE1DARRAY */
|
||||
IMAGE2DARRAY = 490, /* IMAGE2DARRAY */
|
||||
IIMAGE2DARRAY = 491, /* IIMAGE2DARRAY */
|
||||
UIMAGE2DARRAY = 492, /* UIMAGE2DARRAY */
|
||||
IMAGECUBEARRAY = 493, /* IMAGECUBEARRAY */
|
||||
IIMAGECUBEARRAY = 494, /* IIMAGECUBEARRAY */
|
||||
UIMAGECUBEARRAY = 495, /* UIMAGECUBEARRAY */
|
||||
IMAGE2DMS = 496, /* IMAGE2DMS */
|
||||
IIMAGE2DMS = 497, /* IIMAGE2DMS */
|
||||
UIMAGE2DMS = 498, /* UIMAGE2DMS */
|
||||
IMAGE2DMSARRAY = 499, /* IMAGE2DMSARRAY */
|
||||
IIMAGE2DMSARRAY = 500, /* IIMAGE2DMSARRAY */
|
||||
UIMAGE2DMSARRAY = 501, /* UIMAGE2DMSARRAY */
|
||||
F16IMAGE1D = 502, /* F16IMAGE1D */
|
||||
F16IMAGE2D = 503, /* F16IMAGE2D */
|
||||
F16IMAGE3D = 504, /* F16IMAGE3D */
|
||||
F16IMAGE2DRECT = 505, /* F16IMAGE2DRECT */
|
||||
F16IMAGECUBE = 506, /* F16IMAGECUBE */
|
||||
F16IMAGE1DARRAY = 507, /* F16IMAGE1DARRAY */
|
||||
F16IMAGE2DARRAY = 508, /* F16IMAGE2DARRAY */
|
||||
F16IMAGECUBEARRAY = 509, /* F16IMAGECUBEARRAY */
|
||||
F16IMAGEBUFFER = 510, /* F16IMAGEBUFFER */
|
||||
F16IMAGE2DMS = 511, /* F16IMAGE2DMS */
|
||||
F16IMAGE2DMSARRAY = 512, /* F16IMAGE2DMSARRAY */
|
||||
I64IMAGE1D = 513, /* I64IMAGE1D */
|
||||
U64IMAGE1D = 514, /* U64IMAGE1D */
|
||||
I64IMAGE2D = 515, /* I64IMAGE2D */
|
||||
U64IMAGE2D = 516, /* U64IMAGE2D */
|
||||
I64IMAGE3D = 517, /* I64IMAGE3D */
|
||||
U64IMAGE3D = 518, /* U64IMAGE3D */
|
||||
I64IMAGE2DRECT = 519, /* I64IMAGE2DRECT */
|
||||
U64IMAGE2DRECT = 520, /* U64IMAGE2DRECT */
|
||||
I64IMAGECUBE = 521, /* I64IMAGECUBE */
|
||||
U64IMAGECUBE = 522, /* U64IMAGECUBE */
|
||||
I64IMAGEBUFFER = 523, /* I64IMAGEBUFFER */
|
||||
U64IMAGEBUFFER = 524, /* U64IMAGEBUFFER */
|
||||
I64IMAGE1DARRAY = 525, /* I64IMAGE1DARRAY */
|
||||
U64IMAGE1DARRAY = 526, /* U64IMAGE1DARRAY */
|
||||
I64IMAGE2DARRAY = 527, /* I64IMAGE2DARRAY */
|
||||
U64IMAGE2DARRAY = 528, /* U64IMAGE2DARRAY */
|
||||
I64IMAGECUBEARRAY = 529, /* I64IMAGECUBEARRAY */
|
||||
U64IMAGECUBEARRAY = 530, /* U64IMAGECUBEARRAY */
|
||||
I64IMAGE2DMS = 531, /* I64IMAGE2DMS */
|
||||
U64IMAGE2DMS = 532, /* U64IMAGE2DMS */
|
||||
I64IMAGE2DMSARRAY = 533, /* I64IMAGE2DMSARRAY */
|
||||
U64IMAGE2DMSARRAY = 534, /* U64IMAGE2DMSARRAY */
|
||||
TEXTURECUBEARRAY = 535, /* TEXTURECUBEARRAY */
|
||||
ITEXTURECUBEARRAY = 536, /* ITEXTURECUBEARRAY */
|
||||
UTEXTURECUBEARRAY = 537, /* UTEXTURECUBEARRAY */
|
||||
TEXTURE1D = 538, /* TEXTURE1D */
|
||||
ITEXTURE1D = 539, /* ITEXTURE1D */
|
||||
UTEXTURE1D = 540, /* UTEXTURE1D */
|
||||
TEXTURE1DARRAY = 541, /* TEXTURE1DARRAY */
|
||||
ITEXTURE1DARRAY = 542, /* ITEXTURE1DARRAY */
|
||||
UTEXTURE1DARRAY = 543, /* UTEXTURE1DARRAY */
|
||||
TEXTURE2DRECT = 544, /* TEXTURE2DRECT */
|
||||
ITEXTURE2DRECT = 545, /* ITEXTURE2DRECT */
|
||||
UTEXTURE2DRECT = 546, /* UTEXTURE2DRECT */
|
||||
TEXTUREBUFFER = 547, /* TEXTUREBUFFER */
|
||||
ITEXTUREBUFFER = 548, /* ITEXTUREBUFFER */
|
||||
UTEXTUREBUFFER = 549, /* UTEXTUREBUFFER */
|
||||
TEXTURE2DMS = 550, /* TEXTURE2DMS */
|
||||
ITEXTURE2DMS = 551, /* ITEXTURE2DMS */
|
||||
UTEXTURE2DMS = 552, /* UTEXTURE2DMS */
|
||||
TEXTURE2DMSARRAY = 553, /* TEXTURE2DMSARRAY */
|
||||
ITEXTURE2DMSARRAY = 554, /* ITEXTURE2DMSARRAY */
|
||||
UTEXTURE2DMSARRAY = 555, /* UTEXTURE2DMSARRAY */
|
||||
F16TEXTURE1D = 556, /* F16TEXTURE1D */
|
||||
F16TEXTURE2D = 557, /* F16TEXTURE2D */
|
||||
F16TEXTURE3D = 558, /* F16TEXTURE3D */
|
||||
F16TEXTURE2DRECT = 559, /* F16TEXTURE2DRECT */
|
||||
F16TEXTURECUBE = 560, /* F16TEXTURECUBE */
|
||||
F16TEXTURE1DARRAY = 561, /* F16TEXTURE1DARRAY */
|
||||
F16TEXTURE2DARRAY = 562, /* F16TEXTURE2DARRAY */
|
||||
F16TEXTURECUBEARRAY = 563, /* F16TEXTURECUBEARRAY */
|
||||
F16TEXTUREBUFFER = 564, /* F16TEXTUREBUFFER */
|
||||
F16TEXTURE2DMS = 565, /* F16TEXTURE2DMS */
|
||||
F16TEXTURE2DMSARRAY = 566, /* F16TEXTURE2DMSARRAY */
|
||||
SUBPASSINPUT = 567, /* SUBPASSINPUT */
|
||||
SUBPASSINPUTMS = 568, /* SUBPASSINPUTMS */
|
||||
ISUBPASSINPUT = 569, /* ISUBPASSINPUT */
|
||||
ISUBPASSINPUTMS = 570, /* ISUBPASSINPUTMS */
|
||||
USUBPASSINPUT = 571, /* USUBPASSINPUT */
|
||||
USUBPASSINPUTMS = 572, /* USUBPASSINPUTMS */
|
||||
F16SUBPASSINPUT = 573, /* F16SUBPASSINPUT */
|
||||
F16SUBPASSINPUTMS = 574, /* F16SUBPASSINPUTMS */
|
||||
SPIRV_INSTRUCTION = 575, /* SPIRV_INSTRUCTION */
|
||||
SPIRV_EXECUTION_MODE = 576, /* SPIRV_EXECUTION_MODE */
|
||||
SPIRV_EXECUTION_MODE_ID = 577, /* SPIRV_EXECUTION_MODE_ID */
|
||||
SPIRV_DECORATE = 578, /* SPIRV_DECORATE */
|
||||
SPIRV_DECORATE_ID = 579, /* SPIRV_DECORATE_ID */
|
||||
SPIRV_DECORATE_STRING = 580, /* SPIRV_DECORATE_STRING */
|
||||
SPIRV_TYPE = 581, /* SPIRV_TYPE */
|
||||
SPIRV_STORAGE_CLASS = 582, /* SPIRV_STORAGE_CLASS */
|
||||
SPIRV_BY_REFERENCE = 583, /* SPIRV_BY_REFERENCE */
|
||||
SPIRV_LITERAL = 584, /* SPIRV_LITERAL */
|
||||
ATTACHMENTEXT = 585, /* ATTACHMENTEXT */
|
||||
IATTACHMENTEXT = 586, /* IATTACHMENTEXT */
|
||||
UATTACHMENTEXT = 587, /* UATTACHMENTEXT */
|
||||
LEFT_OP = 588, /* LEFT_OP */
|
||||
RIGHT_OP = 589, /* RIGHT_OP */
|
||||
INC_OP = 590, /* INC_OP */
|
||||
DEC_OP = 591, /* DEC_OP */
|
||||
LE_OP = 592, /* LE_OP */
|
||||
GE_OP = 593, /* GE_OP */
|
||||
EQ_OP = 594, /* EQ_OP */
|
||||
NE_OP = 595, /* NE_OP */
|
||||
AND_OP = 596, /* AND_OP */
|
||||
OR_OP = 597, /* OR_OP */
|
||||
XOR_OP = 598, /* XOR_OP */
|
||||
MUL_ASSIGN = 599, /* MUL_ASSIGN */
|
||||
DIV_ASSIGN = 600, /* DIV_ASSIGN */
|
||||
ADD_ASSIGN = 601, /* ADD_ASSIGN */
|
||||
MOD_ASSIGN = 602, /* MOD_ASSIGN */
|
||||
LEFT_ASSIGN = 603, /* LEFT_ASSIGN */
|
||||
RIGHT_ASSIGN = 604, /* RIGHT_ASSIGN */
|
||||
AND_ASSIGN = 605, /* AND_ASSIGN */
|
||||
XOR_ASSIGN = 606, /* XOR_ASSIGN */
|
||||
OR_ASSIGN = 607, /* OR_ASSIGN */
|
||||
SUB_ASSIGN = 608, /* SUB_ASSIGN */
|
||||
STRING_LITERAL = 609, /* STRING_LITERAL */
|
||||
LEFT_PAREN = 610, /* LEFT_PAREN */
|
||||
RIGHT_PAREN = 611, /* RIGHT_PAREN */
|
||||
LEFT_BRACKET = 612, /* LEFT_BRACKET */
|
||||
RIGHT_BRACKET = 613, /* RIGHT_BRACKET */
|
||||
LEFT_BRACE = 614, /* LEFT_BRACE */
|
||||
RIGHT_BRACE = 615, /* RIGHT_BRACE */
|
||||
DOT = 616, /* DOT */
|
||||
COMMA = 617, /* COMMA */
|
||||
COLON = 618, /* COLON */
|
||||
EQUAL = 619, /* EQUAL */
|
||||
SEMICOLON = 620, /* SEMICOLON */
|
||||
BANG = 621, /* BANG */
|
||||
DASH = 622, /* DASH */
|
||||
TILDE = 623, /* TILDE */
|
||||
PLUS = 624, /* PLUS */
|
||||
STAR = 625, /* STAR */
|
||||
SLASH = 626, /* SLASH */
|
||||
PERCENT = 627, /* PERCENT */
|
||||
LEFT_ANGLE = 628, /* LEFT_ANGLE */
|
||||
RIGHT_ANGLE = 629, /* RIGHT_ANGLE */
|
||||
VERTICAL_BAR = 630, /* VERTICAL_BAR */
|
||||
CARET = 631, /* CARET */
|
||||
AMPERSAND = 632, /* AMPERSAND */
|
||||
QUESTION = 633, /* QUESTION */
|
||||
INVARIANT = 634, /* INVARIANT */
|
||||
HIGH_PRECISION = 635, /* HIGH_PRECISION */
|
||||
MEDIUM_PRECISION = 636, /* MEDIUM_PRECISION */
|
||||
LOW_PRECISION = 637, /* LOW_PRECISION */
|
||||
PRECISION = 638, /* PRECISION */
|
||||
PACKED = 639, /* PACKED */
|
||||
RESOURCE = 640, /* RESOURCE */
|
||||
SUPERP = 641, /* SUPERP */
|
||||
FLOATCONSTANT = 642, /* FLOATCONSTANT */
|
||||
INTCONSTANT = 643, /* INTCONSTANT */
|
||||
UINTCONSTANT = 644, /* UINTCONSTANT */
|
||||
BOOLCONSTANT = 645, /* BOOLCONSTANT */
|
||||
IDENTIFIER = 646, /* IDENTIFIER */
|
||||
TYPE_NAME = 647, /* TYPE_NAME */
|
||||
CENTROID = 648, /* CENTROID */
|
||||
IN = 649, /* IN */
|
||||
OUT = 650, /* OUT */
|
||||
INOUT = 651, /* INOUT */
|
||||
STRUCT = 652, /* STRUCT */
|
||||
VOID = 653, /* VOID */
|
||||
WHILE = 654, /* WHILE */
|
||||
BREAK = 655, /* BREAK */
|
||||
CONTINUE = 656, /* CONTINUE */
|
||||
DO = 657, /* DO */
|
||||
ELSE = 658, /* ELSE */
|
||||
FOR = 659, /* FOR */
|
||||
IF = 660, /* IF */
|
||||
DISCARD = 661, /* DISCARD */
|
||||
RETURN = 662, /* RETURN */
|
||||
SWITCH = 663, /* SWITCH */
|
||||
CASE = 664, /* CASE */
|
||||
DEFAULT = 665, /* DEFAULT */
|
||||
TERMINATE_INVOCATION = 666, /* TERMINATE_INVOCATION */
|
||||
TERMINATE_RAY = 667, /* TERMINATE_RAY */
|
||||
IGNORE_INTERSECTION = 668, /* IGNORE_INTERSECTION */
|
||||
UNIFORM = 669, /* UNIFORM */
|
||||
SHARED = 670, /* SHARED */
|
||||
BUFFER = 671, /* BUFFER */
|
||||
TILEIMAGEEXT = 672, /* TILEIMAGEEXT */
|
||||
FLAT = 673, /* FLAT */
|
||||
SMOOTH = 674, /* SMOOTH */
|
||||
LAYOUT = 675, /* LAYOUT */
|
||||
DOUBLECONSTANT = 676, /* DOUBLECONSTANT */
|
||||
INT16CONSTANT = 677, /* INT16CONSTANT */
|
||||
UINT16CONSTANT = 678, /* UINT16CONSTANT */
|
||||
FLOAT16CONSTANT = 679, /* FLOAT16CONSTANT */
|
||||
INT32CONSTANT = 680, /* INT32CONSTANT */
|
||||
UINT32CONSTANT = 681, /* UINT32CONSTANT */
|
||||
INT64CONSTANT = 682, /* INT64CONSTANT */
|
||||
UINT64CONSTANT = 683, /* UINT64CONSTANT */
|
||||
SUBROUTINE = 684, /* SUBROUTINE */
|
||||
DEMOTE = 685, /* DEMOTE */
|
||||
PAYLOADNV = 686, /* PAYLOADNV */
|
||||
PAYLOADINNV = 687, /* PAYLOADINNV */
|
||||
HITATTRNV = 688, /* HITATTRNV */
|
||||
CALLDATANV = 689, /* CALLDATANV */
|
||||
CALLDATAINNV = 690, /* CALLDATAINNV */
|
||||
PAYLOADEXT = 691, /* PAYLOADEXT */
|
||||
PAYLOADINEXT = 692, /* PAYLOADINEXT */
|
||||
HITATTREXT = 693, /* HITATTREXT */
|
||||
CALLDATAEXT = 694, /* CALLDATAEXT */
|
||||
CALLDATAINEXT = 695, /* CALLDATAINEXT */
|
||||
PATCH = 696, /* PATCH */
|
||||
SAMPLE = 697, /* SAMPLE */
|
||||
NONUNIFORM = 698, /* NONUNIFORM */
|
||||
COHERENT = 699, /* COHERENT */
|
||||
VOLATILE = 700, /* VOLATILE */
|
||||
RESTRICT = 701, /* RESTRICT */
|
||||
READONLY = 702, /* READONLY */
|
||||
WRITEONLY = 703, /* WRITEONLY */
|
||||
DEVICECOHERENT = 704, /* DEVICECOHERENT */
|
||||
QUEUEFAMILYCOHERENT = 705, /* QUEUEFAMILYCOHERENT */
|
||||
WORKGROUPCOHERENT = 706, /* WORKGROUPCOHERENT */
|
||||
SUBGROUPCOHERENT = 707, /* SUBGROUPCOHERENT */
|
||||
NONPRIVATE = 708, /* NONPRIVATE */
|
||||
SHADERCALLCOHERENT = 709, /* SHADERCALLCOHERENT */
|
||||
NOPERSPECTIVE = 710, /* NOPERSPECTIVE */
|
||||
EXPLICITINTERPAMD = 711, /* EXPLICITINTERPAMD */
|
||||
PERVERTEXEXT = 712, /* PERVERTEXEXT */
|
||||
PERVERTEXNV = 713, /* PERVERTEXNV */
|
||||
PERPRIMITIVENV = 714, /* PERPRIMITIVENV */
|
||||
PERVIEWNV = 715, /* PERVIEWNV */
|
||||
PERTASKNV = 716, /* PERTASKNV */
|
||||
PERPRIMITIVEEXT = 717, /* PERPRIMITIVEEXT */
|
||||
TASKPAYLOADWORKGROUPEXT = 718, /* TASKPAYLOADWORKGROUPEXT */
|
||||
PRECISE = 719 /* PRECISE */
|
||||
COOPVECNV = 422, /* COOPVECNV */
|
||||
HITOBJECTNV = 423, /* HITOBJECTNV */
|
||||
HITOBJECTATTRNV = 424, /* HITOBJECTATTRNV */
|
||||
TENSORLAYOUTNV = 425, /* TENSORLAYOUTNV */
|
||||
TENSORVIEWNV = 426, /* TENSORVIEWNV */
|
||||
SAMPLERCUBEARRAY = 427, /* SAMPLERCUBEARRAY */
|
||||
SAMPLERCUBEARRAYSHADOW = 428, /* SAMPLERCUBEARRAYSHADOW */
|
||||
ISAMPLERCUBEARRAY = 429, /* ISAMPLERCUBEARRAY */
|
||||
USAMPLERCUBEARRAY = 430, /* USAMPLERCUBEARRAY */
|
||||
SAMPLER1D = 431, /* SAMPLER1D */
|
||||
SAMPLER1DARRAY = 432, /* SAMPLER1DARRAY */
|
||||
SAMPLER1DARRAYSHADOW = 433, /* SAMPLER1DARRAYSHADOW */
|
||||
ISAMPLER1D = 434, /* ISAMPLER1D */
|
||||
SAMPLER1DSHADOW = 435, /* SAMPLER1DSHADOW */
|
||||
SAMPLER2DRECT = 436, /* SAMPLER2DRECT */
|
||||
SAMPLER2DRECTSHADOW = 437, /* SAMPLER2DRECTSHADOW */
|
||||
ISAMPLER2DRECT = 438, /* ISAMPLER2DRECT */
|
||||
USAMPLER2DRECT = 439, /* USAMPLER2DRECT */
|
||||
SAMPLERBUFFER = 440, /* SAMPLERBUFFER */
|
||||
ISAMPLERBUFFER = 441, /* ISAMPLERBUFFER */
|
||||
USAMPLERBUFFER = 442, /* USAMPLERBUFFER */
|
||||
SAMPLER2DMS = 443, /* SAMPLER2DMS */
|
||||
ISAMPLER2DMS = 444, /* ISAMPLER2DMS */
|
||||
USAMPLER2DMS = 445, /* USAMPLER2DMS */
|
||||
SAMPLER2DMSARRAY = 446, /* SAMPLER2DMSARRAY */
|
||||
ISAMPLER2DMSARRAY = 447, /* ISAMPLER2DMSARRAY */
|
||||
USAMPLER2DMSARRAY = 448, /* USAMPLER2DMSARRAY */
|
||||
SAMPLEREXTERNALOES = 449, /* SAMPLEREXTERNALOES */
|
||||
SAMPLEREXTERNAL2DY2YEXT = 450, /* SAMPLEREXTERNAL2DY2YEXT */
|
||||
ISAMPLER1DARRAY = 451, /* ISAMPLER1DARRAY */
|
||||
USAMPLER1D = 452, /* USAMPLER1D */
|
||||
USAMPLER1DARRAY = 453, /* USAMPLER1DARRAY */
|
||||
F16SAMPLER1D = 454, /* F16SAMPLER1D */
|
||||
F16SAMPLER2D = 455, /* F16SAMPLER2D */
|
||||
F16SAMPLER3D = 456, /* F16SAMPLER3D */
|
||||
F16SAMPLER2DRECT = 457, /* F16SAMPLER2DRECT */
|
||||
F16SAMPLERCUBE = 458, /* F16SAMPLERCUBE */
|
||||
F16SAMPLER1DARRAY = 459, /* F16SAMPLER1DARRAY */
|
||||
F16SAMPLER2DARRAY = 460, /* F16SAMPLER2DARRAY */
|
||||
F16SAMPLERCUBEARRAY = 461, /* F16SAMPLERCUBEARRAY */
|
||||
F16SAMPLERBUFFER = 462, /* F16SAMPLERBUFFER */
|
||||
F16SAMPLER2DMS = 463, /* F16SAMPLER2DMS */
|
||||
F16SAMPLER2DMSARRAY = 464, /* F16SAMPLER2DMSARRAY */
|
||||
F16SAMPLER1DSHADOW = 465, /* F16SAMPLER1DSHADOW */
|
||||
F16SAMPLER2DSHADOW = 466, /* F16SAMPLER2DSHADOW */
|
||||
F16SAMPLER1DARRAYSHADOW = 467, /* F16SAMPLER1DARRAYSHADOW */
|
||||
F16SAMPLER2DARRAYSHADOW = 468, /* F16SAMPLER2DARRAYSHADOW */
|
||||
F16SAMPLER2DRECTSHADOW = 469, /* F16SAMPLER2DRECTSHADOW */
|
||||
F16SAMPLERCUBESHADOW = 470, /* F16SAMPLERCUBESHADOW */
|
||||
F16SAMPLERCUBEARRAYSHADOW = 471, /* F16SAMPLERCUBEARRAYSHADOW */
|
||||
IMAGE1D = 472, /* IMAGE1D */
|
||||
IIMAGE1D = 473, /* IIMAGE1D */
|
||||
UIMAGE1D = 474, /* UIMAGE1D */
|
||||
IMAGE2D = 475, /* IMAGE2D */
|
||||
IIMAGE2D = 476, /* IIMAGE2D */
|
||||
UIMAGE2D = 477, /* UIMAGE2D */
|
||||
IMAGE3D = 478, /* IMAGE3D */
|
||||
IIMAGE3D = 479, /* IIMAGE3D */
|
||||
UIMAGE3D = 480, /* UIMAGE3D */
|
||||
IMAGE2DRECT = 481, /* IMAGE2DRECT */
|
||||
IIMAGE2DRECT = 482, /* IIMAGE2DRECT */
|
||||
UIMAGE2DRECT = 483, /* UIMAGE2DRECT */
|
||||
IMAGECUBE = 484, /* IMAGECUBE */
|
||||
IIMAGECUBE = 485, /* IIMAGECUBE */
|
||||
UIMAGECUBE = 486, /* UIMAGECUBE */
|
||||
IMAGEBUFFER = 487, /* IMAGEBUFFER */
|
||||
IIMAGEBUFFER = 488, /* IIMAGEBUFFER */
|
||||
UIMAGEBUFFER = 489, /* UIMAGEBUFFER */
|
||||
IMAGE1DARRAY = 490, /* IMAGE1DARRAY */
|
||||
IIMAGE1DARRAY = 491, /* IIMAGE1DARRAY */
|
||||
UIMAGE1DARRAY = 492, /* UIMAGE1DARRAY */
|
||||
IMAGE2DARRAY = 493, /* IMAGE2DARRAY */
|
||||
IIMAGE2DARRAY = 494, /* IIMAGE2DARRAY */
|
||||
UIMAGE2DARRAY = 495, /* UIMAGE2DARRAY */
|
||||
IMAGECUBEARRAY = 496, /* IMAGECUBEARRAY */
|
||||
IIMAGECUBEARRAY = 497, /* IIMAGECUBEARRAY */
|
||||
UIMAGECUBEARRAY = 498, /* UIMAGECUBEARRAY */
|
||||
IMAGE2DMS = 499, /* IMAGE2DMS */
|
||||
IIMAGE2DMS = 500, /* IIMAGE2DMS */
|
||||
UIMAGE2DMS = 501, /* UIMAGE2DMS */
|
||||
IMAGE2DMSARRAY = 502, /* IMAGE2DMSARRAY */
|
||||
IIMAGE2DMSARRAY = 503, /* IIMAGE2DMSARRAY */
|
||||
UIMAGE2DMSARRAY = 504, /* UIMAGE2DMSARRAY */
|
||||
F16IMAGE1D = 505, /* F16IMAGE1D */
|
||||
F16IMAGE2D = 506, /* F16IMAGE2D */
|
||||
F16IMAGE3D = 507, /* F16IMAGE3D */
|
||||
F16IMAGE2DRECT = 508, /* F16IMAGE2DRECT */
|
||||
F16IMAGECUBE = 509, /* F16IMAGECUBE */
|
||||
F16IMAGE1DARRAY = 510, /* F16IMAGE1DARRAY */
|
||||
F16IMAGE2DARRAY = 511, /* F16IMAGE2DARRAY */
|
||||
F16IMAGECUBEARRAY = 512, /* F16IMAGECUBEARRAY */
|
||||
F16IMAGEBUFFER = 513, /* F16IMAGEBUFFER */
|
||||
F16IMAGE2DMS = 514, /* F16IMAGE2DMS */
|
||||
F16IMAGE2DMSARRAY = 515, /* F16IMAGE2DMSARRAY */
|
||||
I64IMAGE1D = 516, /* I64IMAGE1D */
|
||||
U64IMAGE1D = 517, /* U64IMAGE1D */
|
||||
I64IMAGE2D = 518, /* I64IMAGE2D */
|
||||
U64IMAGE2D = 519, /* U64IMAGE2D */
|
||||
I64IMAGE3D = 520, /* I64IMAGE3D */
|
||||
U64IMAGE3D = 521, /* U64IMAGE3D */
|
||||
I64IMAGE2DRECT = 522, /* I64IMAGE2DRECT */
|
||||
U64IMAGE2DRECT = 523, /* U64IMAGE2DRECT */
|
||||
I64IMAGECUBE = 524, /* I64IMAGECUBE */
|
||||
U64IMAGECUBE = 525, /* U64IMAGECUBE */
|
||||
I64IMAGEBUFFER = 526, /* I64IMAGEBUFFER */
|
||||
U64IMAGEBUFFER = 527, /* U64IMAGEBUFFER */
|
||||
I64IMAGE1DARRAY = 528, /* I64IMAGE1DARRAY */
|
||||
U64IMAGE1DARRAY = 529, /* U64IMAGE1DARRAY */
|
||||
I64IMAGE2DARRAY = 530, /* I64IMAGE2DARRAY */
|
||||
U64IMAGE2DARRAY = 531, /* U64IMAGE2DARRAY */
|
||||
I64IMAGECUBEARRAY = 532, /* I64IMAGECUBEARRAY */
|
||||
U64IMAGECUBEARRAY = 533, /* U64IMAGECUBEARRAY */
|
||||
I64IMAGE2DMS = 534, /* I64IMAGE2DMS */
|
||||
U64IMAGE2DMS = 535, /* U64IMAGE2DMS */
|
||||
I64IMAGE2DMSARRAY = 536, /* I64IMAGE2DMSARRAY */
|
||||
U64IMAGE2DMSARRAY = 537, /* U64IMAGE2DMSARRAY */
|
||||
TEXTURECUBEARRAY = 538, /* TEXTURECUBEARRAY */
|
||||
ITEXTURECUBEARRAY = 539, /* ITEXTURECUBEARRAY */
|
||||
UTEXTURECUBEARRAY = 540, /* UTEXTURECUBEARRAY */
|
||||
TEXTURE1D = 541, /* TEXTURE1D */
|
||||
ITEXTURE1D = 542, /* ITEXTURE1D */
|
||||
UTEXTURE1D = 543, /* UTEXTURE1D */
|
||||
TEXTURE1DARRAY = 544, /* TEXTURE1DARRAY */
|
||||
ITEXTURE1DARRAY = 545, /* ITEXTURE1DARRAY */
|
||||
UTEXTURE1DARRAY = 546, /* UTEXTURE1DARRAY */
|
||||
TEXTURE2DRECT = 547, /* TEXTURE2DRECT */
|
||||
ITEXTURE2DRECT = 548, /* ITEXTURE2DRECT */
|
||||
UTEXTURE2DRECT = 549, /* UTEXTURE2DRECT */
|
||||
TEXTUREBUFFER = 550, /* TEXTUREBUFFER */
|
||||
ITEXTUREBUFFER = 551, /* ITEXTUREBUFFER */
|
||||
UTEXTUREBUFFER = 552, /* UTEXTUREBUFFER */
|
||||
TEXTURE2DMS = 553, /* TEXTURE2DMS */
|
||||
ITEXTURE2DMS = 554, /* ITEXTURE2DMS */
|
||||
UTEXTURE2DMS = 555, /* UTEXTURE2DMS */
|
||||
TEXTURE2DMSARRAY = 556, /* TEXTURE2DMSARRAY */
|
||||
ITEXTURE2DMSARRAY = 557, /* ITEXTURE2DMSARRAY */
|
||||
UTEXTURE2DMSARRAY = 558, /* UTEXTURE2DMSARRAY */
|
||||
F16TEXTURE1D = 559, /* F16TEXTURE1D */
|
||||
F16TEXTURE2D = 560, /* F16TEXTURE2D */
|
||||
F16TEXTURE3D = 561, /* F16TEXTURE3D */
|
||||
F16TEXTURE2DRECT = 562, /* F16TEXTURE2DRECT */
|
||||
F16TEXTURECUBE = 563, /* F16TEXTURECUBE */
|
||||
F16TEXTURE1DARRAY = 564, /* F16TEXTURE1DARRAY */
|
||||
F16TEXTURE2DARRAY = 565, /* F16TEXTURE2DARRAY */
|
||||
F16TEXTURECUBEARRAY = 566, /* F16TEXTURECUBEARRAY */
|
||||
F16TEXTUREBUFFER = 567, /* F16TEXTUREBUFFER */
|
||||
F16TEXTURE2DMS = 568, /* F16TEXTURE2DMS */
|
||||
F16TEXTURE2DMSARRAY = 569, /* F16TEXTURE2DMSARRAY */
|
||||
SUBPASSINPUT = 570, /* SUBPASSINPUT */
|
||||
SUBPASSINPUTMS = 571, /* SUBPASSINPUTMS */
|
||||
ISUBPASSINPUT = 572, /* ISUBPASSINPUT */
|
||||
ISUBPASSINPUTMS = 573, /* ISUBPASSINPUTMS */
|
||||
USUBPASSINPUT = 574, /* USUBPASSINPUT */
|
||||
USUBPASSINPUTMS = 575, /* USUBPASSINPUTMS */
|
||||
F16SUBPASSINPUT = 576, /* F16SUBPASSINPUT */
|
||||
F16SUBPASSINPUTMS = 577, /* F16SUBPASSINPUTMS */
|
||||
SPIRV_INSTRUCTION = 578, /* SPIRV_INSTRUCTION */
|
||||
SPIRV_EXECUTION_MODE = 579, /* SPIRV_EXECUTION_MODE */
|
||||
SPIRV_EXECUTION_MODE_ID = 580, /* SPIRV_EXECUTION_MODE_ID */
|
||||
SPIRV_DECORATE = 581, /* SPIRV_DECORATE */
|
||||
SPIRV_DECORATE_ID = 582, /* SPIRV_DECORATE_ID */
|
||||
SPIRV_DECORATE_STRING = 583, /* SPIRV_DECORATE_STRING */
|
||||
SPIRV_TYPE = 584, /* SPIRV_TYPE */
|
||||
SPIRV_STORAGE_CLASS = 585, /* SPIRV_STORAGE_CLASS */
|
||||
SPIRV_BY_REFERENCE = 586, /* SPIRV_BY_REFERENCE */
|
||||
SPIRV_LITERAL = 587, /* SPIRV_LITERAL */
|
||||
ATTACHMENTEXT = 588, /* ATTACHMENTEXT */
|
||||
IATTACHMENTEXT = 589, /* IATTACHMENTEXT */
|
||||
UATTACHMENTEXT = 590, /* UATTACHMENTEXT */
|
||||
LEFT_OP = 591, /* LEFT_OP */
|
||||
RIGHT_OP = 592, /* RIGHT_OP */
|
||||
INC_OP = 593, /* INC_OP */
|
||||
DEC_OP = 594, /* DEC_OP */
|
||||
LE_OP = 595, /* LE_OP */
|
||||
GE_OP = 596, /* GE_OP */
|
||||
EQ_OP = 597, /* EQ_OP */
|
||||
NE_OP = 598, /* NE_OP */
|
||||
AND_OP = 599, /* AND_OP */
|
||||
OR_OP = 600, /* OR_OP */
|
||||
XOR_OP = 601, /* XOR_OP */
|
||||
MUL_ASSIGN = 602, /* MUL_ASSIGN */
|
||||
DIV_ASSIGN = 603, /* DIV_ASSIGN */
|
||||
ADD_ASSIGN = 604, /* ADD_ASSIGN */
|
||||
MOD_ASSIGN = 605, /* MOD_ASSIGN */
|
||||
LEFT_ASSIGN = 606, /* LEFT_ASSIGN */
|
||||
RIGHT_ASSIGN = 607, /* RIGHT_ASSIGN */
|
||||
AND_ASSIGN = 608, /* AND_ASSIGN */
|
||||
XOR_ASSIGN = 609, /* XOR_ASSIGN */
|
||||
OR_ASSIGN = 610, /* OR_ASSIGN */
|
||||
SUB_ASSIGN = 611, /* SUB_ASSIGN */
|
||||
STRING_LITERAL = 612, /* STRING_LITERAL */
|
||||
LEFT_PAREN = 613, /* LEFT_PAREN */
|
||||
RIGHT_PAREN = 614, /* RIGHT_PAREN */
|
||||
LEFT_BRACKET = 615, /* LEFT_BRACKET */
|
||||
RIGHT_BRACKET = 616, /* RIGHT_BRACKET */
|
||||
LEFT_BRACE = 617, /* LEFT_BRACE */
|
||||
RIGHT_BRACE = 618, /* RIGHT_BRACE */
|
||||
DOT = 619, /* DOT */
|
||||
COMMA = 620, /* COMMA */
|
||||
COLON = 621, /* COLON */
|
||||
EQUAL = 622, /* EQUAL */
|
||||
SEMICOLON = 623, /* SEMICOLON */
|
||||
BANG = 624, /* BANG */
|
||||
DASH = 625, /* DASH */
|
||||
TILDE = 626, /* TILDE */
|
||||
PLUS = 627, /* PLUS */
|
||||
STAR = 628, /* STAR */
|
||||
SLASH = 629, /* SLASH */
|
||||
PERCENT = 630, /* PERCENT */
|
||||
LEFT_ANGLE = 631, /* LEFT_ANGLE */
|
||||
RIGHT_ANGLE = 632, /* RIGHT_ANGLE */
|
||||
VERTICAL_BAR = 633, /* VERTICAL_BAR */
|
||||
CARET = 634, /* CARET */
|
||||
AMPERSAND = 635, /* AMPERSAND */
|
||||
QUESTION = 636, /* QUESTION */
|
||||
INVARIANT = 637, /* INVARIANT */
|
||||
HIGH_PRECISION = 638, /* HIGH_PRECISION */
|
||||
MEDIUM_PRECISION = 639, /* MEDIUM_PRECISION */
|
||||
LOW_PRECISION = 640, /* LOW_PRECISION */
|
||||
PRECISION = 641, /* PRECISION */
|
||||
PACKED = 642, /* PACKED */
|
||||
RESOURCE = 643, /* RESOURCE */
|
||||
SUPERP = 644, /* SUPERP */
|
||||
FLOATCONSTANT = 645, /* FLOATCONSTANT */
|
||||
INTCONSTANT = 646, /* INTCONSTANT */
|
||||
UINTCONSTANT = 647, /* UINTCONSTANT */
|
||||
BOOLCONSTANT = 648, /* BOOLCONSTANT */
|
||||
IDENTIFIER = 649, /* IDENTIFIER */
|
||||
TYPE_NAME = 650, /* TYPE_NAME */
|
||||
CENTROID = 651, /* CENTROID */
|
||||
IN = 652, /* IN */
|
||||
OUT = 653, /* OUT */
|
||||
INOUT = 654, /* INOUT */
|
||||
STRUCT = 655, /* STRUCT */
|
||||
VOID = 656, /* VOID */
|
||||
WHILE = 657, /* WHILE */
|
||||
BREAK = 658, /* BREAK */
|
||||
CONTINUE = 659, /* CONTINUE */
|
||||
DO = 660, /* DO */
|
||||
ELSE = 661, /* ELSE */
|
||||
FOR = 662, /* FOR */
|
||||
IF = 663, /* IF */
|
||||
DISCARD = 664, /* DISCARD */
|
||||
RETURN = 665, /* RETURN */
|
||||
SWITCH = 666, /* SWITCH */
|
||||
CASE = 667, /* CASE */
|
||||
DEFAULT = 668, /* DEFAULT */
|
||||
TERMINATE_INVOCATION = 669, /* TERMINATE_INVOCATION */
|
||||
TERMINATE_RAY = 670, /* TERMINATE_RAY */
|
||||
IGNORE_INTERSECTION = 671, /* IGNORE_INTERSECTION */
|
||||
UNIFORM = 672, /* UNIFORM */
|
||||
SHARED = 673, /* SHARED */
|
||||
BUFFER = 674, /* BUFFER */
|
||||
TILEIMAGEEXT = 675, /* TILEIMAGEEXT */
|
||||
FLAT = 676, /* FLAT */
|
||||
SMOOTH = 677, /* SMOOTH */
|
||||
LAYOUT = 678, /* LAYOUT */
|
||||
DOUBLECONSTANT = 679, /* DOUBLECONSTANT */
|
||||
INT16CONSTANT = 680, /* INT16CONSTANT */
|
||||
UINT16CONSTANT = 681, /* UINT16CONSTANT */
|
||||
FLOAT16CONSTANT = 682, /* FLOAT16CONSTANT */
|
||||
INT32CONSTANT = 683, /* INT32CONSTANT */
|
||||
UINT32CONSTANT = 684, /* UINT32CONSTANT */
|
||||
INT64CONSTANT = 685, /* INT64CONSTANT */
|
||||
UINT64CONSTANT = 686, /* UINT64CONSTANT */
|
||||
SUBROUTINE = 687, /* SUBROUTINE */
|
||||
DEMOTE = 688, /* DEMOTE */
|
||||
FUNCTION = 689, /* FUNCTION */
|
||||
PAYLOADNV = 690, /* PAYLOADNV */
|
||||
PAYLOADINNV = 691, /* PAYLOADINNV */
|
||||
HITATTRNV = 692, /* HITATTRNV */
|
||||
CALLDATANV = 693, /* CALLDATANV */
|
||||
CALLDATAINNV = 694, /* CALLDATAINNV */
|
||||
PAYLOADEXT = 695, /* PAYLOADEXT */
|
||||
PAYLOADINEXT = 696, /* PAYLOADINEXT */
|
||||
HITATTREXT = 697, /* HITATTREXT */
|
||||
CALLDATAEXT = 698, /* CALLDATAEXT */
|
||||
CALLDATAINEXT = 699, /* CALLDATAINEXT */
|
||||
PATCH = 700, /* PATCH */
|
||||
SAMPLE = 701, /* SAMPLE */
|
||||
NONUNIFORM = 702, /* NONUNIFORM */
|
||||
COHERENT = 703, /* COHERENT */
|
||||
VOLATILE = 704, /* VOLATILE */
|
||||
RESTRICT = 705, /* RESTRICT */
|
||||
READONLY = 706, /* READONLY */
|
||||
WRITEONLY = 707, /* WRITEONLY */
|
||||
NONTEMPORAL = 708, /* NONTEMPORAL */
|
||||
DEVICECOHERENT = 709, /* DEVICECOHERENT */
|
||||
QUEUEFAMILYCOHERENT = 710, /* QUEUEFAMILYCOHERENT */
|
||||
WORKGROUPCOHERENT = 711, /* WORKGROUPCOHERENT */
|
||||
SUBGROUPCOHERENT = 712, /* SUBGROUPCOHERENT */
|
||||
NONPRIVATE = 713, /* NONPRIVATE */
|
||||
SHADERCALLCOHERENT = 714, /* SHADERCALLCOHERENT */
|
||||
NOPERSPECTIVE = 715, /* NOPERSPECTIVE */
|
||||
EXPLICITINTERPAMD = 716, /* EXPLICITINTERPAMD */
|
||||
PERVERTEXEXT = 717, /* PERVERTEXEXT */
|
||||
PERVERTEXNV = 718, /* PERVERTEXNV */
|
||||
PERPRIMITIVENV = 719, /* PERPRIMITIVENV */
|
||||
PERVIEWNV = 720, /* PERVIEWNV */
|
||||
PERTASKNV = 721, /* PERTASKNV */
|
||||
PERPRIMITIVEEXT = 722, /* PERPRIMITIVEEXT */
|
||||
TASKPAYLOADWORKGROUPEXT = 723, /* TASKPAYLOADWORKGROUPEXT */
|
||||
PRECISE = 724 /* PRECISE */
|
||||
};
|
||||
typedef enum yytokentype yytoken_kind_t;
|
||||
#endif
|
||||
|
|
@ -563,7 +568,7 @@ union YYSTYPE
|
|||
glslang::TTypeParameters* typeParameters;
|
||||
} interm;
|
||||
|
||||
#line 567 "MachineIndependent/glslang_tab.cpp.h"
|
||||
#line 572 "MachineIndependent/glslang_tab.cpp.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
|
|
|||
|
|
@ -204,6 +204,13 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
|
||||
OutputTreeText(out, node, depth);
|
||||
|
||||
if (IsOpNumericConv(node->getAsOperator()->getOp())) {
|
||||
out.debug << "Convert " << TType::getBasicString(node->getOperand()->getType().getBasicType()) << " to " << TType::getBasicString(node->getType().getBasicType());
|
||||
out.debug << " (" << node->getCompleteString() << ")";
|
||||
out.debug << "\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (node->getOp()) {
|
||||
case EOpNegative: out.debug << "Negate value"; break;
|
||||
case EOpVectorLogicalNot:
|
||||
|
|
@ -216,192 +223,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpPreDecrement: out.debug << "Pre-Decrement"; break;
|
||||
case EOpCopyObject: out.debug << "copy object"; break;
|
||||
|
||||
// * -> bool
|
||||
case EOpConvInt8ToBool: out.debug << "Convert int8_t to bool"; break;
|
||||
case EOpConvUint8ToBool: out.debug << "Convert uint8_t to bool"; break;
|
||||
case EOpConvInt16ToBool: out.debug << "Convert int16_t to bool"; break;
|
||||
case EOpConvUint16ToBool: out.debug << "Convert uint16_t to bool";break;
|
||||
case EOpConvIntToBool: out.debug << "Convert int to bool"; break;
|
||||
case EOpConvUintToBool: out.debug << "Convert uint to bool"; break;
|
||||
case EOpConvInt64ToBool: out.debug << "Convert int64 to bool"; break;
|
||||
case EOpConvUint64ToBool: out.debug << "Convert uint64 to bool"; break;
|
||||
case EOpConvFloat16ToBool: out.debug << "Convert float16_t to bool"; break;
|
||||
case EOpConvFloatToBool: out.debug << "Convert float to bool"; break;
|
||||
case EOpConvDoubleToBool: out.debug << "Convert double to bool"; break;
|
||||
|
||||
// bool -> *
|
||||
case EOpConvBoolToInt8: out.debug << "Convert bool to int8_t"; break;
|
||||
case EOpConvBoolToUint8: out.debug << "Convert bool to uint8_t"; break;
|
||||
case EOpConvBoolToInt16: out.debug << "Convert bool to in16t_t"; break;
|
||||
case EOpConvBoolToUint16: out.debug << "Convert bool to uint16_t";break;
|
||||
case EOpConvBoolToInt: out.debug << "Convert bool to int" ; break;
|
||||
case EOpConvBoolToUint: out.debug << "Convert bool to uint"; break;
|
||||
case EOpConvBoolToInt64: out.debug << "Convert bool to int64"; break;
|
||||
case EOpConvBoolToUint64: out.debug << "Convert bool to uint64";break;
|
||||
case EOpConvBoolToFloat16: out.debug << "Convert bool to float16_t"; break;
|
||||
case EOpConvBoolToFloat: out.debug << "Convert bool to float"; break;
|
||||
case EOpConvBoolToDouble: out.debug << "Convert bool to double"; break;
|
||||
|
||||
// int8_t -> (u)int*
|
||||
case EOpConvInt8ToInt16: out.debug << "Convert int8_t to int16_t";break;
|
||||
case EOpConvInt8ToInt: out.debug << "Convert int8_t to int"; break;
|
||||
case EOpConvInt8ToInt64: out.debug << "Convert int8_t to int64"; break;
|
||||
case EOpConvInt8ToUint8: out.debug << "Convert int8_t to uint8_t";break;
|
||||
case EOpConvInt8ToUint16: out.debug << "Convert int8_t to uint16_t";break;
|
||||
case EOpConvInt8ToUint: out.debug << "Convert int8_t to uint"; break;
|
||||
case EOpConvInt8ToUint64: out.debug << "Convert int8_t to uint64"; break;
|
||||
|
||||
// uint8_t -> (u)int*
|
||||
case EOpConvUint8ToInt8: out.debug << "Convert uint8_t to int8_t";break;
|
||||
case EOpConvUint8ToInt16: out.debug << "Convert uint8_t to int16_t";break;
|
||||
case EOpConvUint8ToInt: out.debug << "Convert uint8_t to int"; break;
|
||||
case EOpConvUint8ToInt64: out.debug << "Convert uint8_t to int64"; break;
|
||||
case EOpConvUint8ToUint16: out.debug << "Convert uint8_t to uint16_t";break;
|
||||
case EOpConvUint8ToUint: out.debug << "Convert uint8_t to uint"; break;
|
||||
case EOpConvUint8ToUint64: out.debug << "Convert uint8_t to uint64"; break;
|
||||
|
||||
// int8_t -> float*
|
||||
case EOpConvInt8ToFloat16: out.debug << "Convert int8_t to float16_t";break;
|
||||
case EOpConvInt8ToFloat: out.debug << "Convert int8_t to float"; break;
|
||||
case EOpConvInt8ToDouble: out.debug << "Convert int8_t to double"; break;
|
||||
|
||||
// uint8_t -> float*
|
||||
case EOpConvUint8ToFloat16: out.debug << "Convert uint8_t to float16_t";break;
|
||||
case EOpConvUint8ToFloat: out.debug << "Convert uint8_t to float"; break;
|
||||
case EOpConvUint8ToDouble: out.debug << "Convert uint8_t to double"; break;
|
||||
|
||||
// int16_t -> (u)int*
|
||||
case EOpConvInt16ToInt8: out.debug << "Convert int16_t to int8_t";break;
|
||||
case EOpConvInt16ToInt: out.debug << "Convert int16_t to int"; break;
|
||||
case EOpConvInt16ToInt64: out.debug << "Convert int16_t to int64"; break;
|
||||
case EOpConvInt16ToUint8: out.debug << "Convert int16_t to uint8_t";break;
|
||||
case EOpConvInt16ToUint16: out.debug << "Convert int16_t to uint16_t";break;
|
||||
case EOpConvInt16ToUint: out.debug << "Convert int16_t to uint"; break;
|
||||
case EOpConvInt16ToUint64: out.debug << "Convert int16_t to uint64"; break;
|
||||
|
||||
// int16_t -> float*
|
||||
case EOpConvInt16ToFloat16: out.debug << "Convert int16_t to float16_t";break;
|
||||
case EOpConvInt16ToFloat: out.debug << "Convert int16_t to float"; break;
|
||||
case EOpConvInt16ToDouble: out.debug << "Convert int16_t to double"; break;
|
||||
|
||||
// uint16_t -> (u)int*
|
||||
case EOpConvUint16ToInt8: out.debug << "Convert uint16_t to int8_t";break;
|
||||
case EOpConvUint16ToInt16: out.debug << "Convert uint16_t to int16_t";break;
|
||||
case EOpConvUint16ToInt: out.debug << "Convert uint16_t to int"; break;
|
||||
case EOpConvUint16ToInt64: out.debug << "Convert uint16_t to int64"; break;
|
||||
case EOpConvUint16ToUint8: out.debug << "Convert uint16_t to uint8_t";break;
|
||||
case EOpConvUint16ToUint: out.debug << "Convert uint16_t to uint"; break;
|
||||
case EOpConvUint16ToUint64: out.debug << "Convert uint16_t to uint64"; break;
|
||||
|
||||
// uint16_t -> float*
|
||||
case EOpConvUint16ToFloat16: out.debug << "Convert uint16_t to float16_t";break;
|
||||
case EOpConvUint16ToFloat: out.debug << "Convert uint16_t to float"; break;
|
||||
case EOpConvUint16ToDouble: out.debug << "Convert uint16_t to double"; break;
|
||||
|
||||
// int32_t -> (u)int*
|
||||
case EOpConvIntToInt8: out.debug << "Convert int to int8_t";break;
|
||||
case EOpConvIntToInt16: out.debug << "Convert int to int16_t";break;
|
||||
case EOpConvIntToInt64: out.debug << "Convert int to int64"; break;
|
||||
case EOpConvIntToUint8: out.debug << "Convert int to uint8_t";break;
|
||||
case EOpConvIntToUint16: out.debug << "Convert int to uint16_t";break;
|
||||
case EOpConvIntToUint: out.debug << "Convert int to uint"; break;
|
||||
case EOpConvIntToUint64: out.debug << "Convert int to uint64"; break;
|
||||
|
||||
// int32_t -> float*
|
||||
case EOpConvIntToFloat16: out.debug << "Convert int to float16_t";break;
|
||||
case EOpConvIntToFloat: out.debug << "Convert int to float"; break;
|
||||
case EOpConvIntToDouble: out.debug << "Convert int to double"; break;
|
||||
|
||||
// uint32_t -> (u)int*
|
||||
case EOpConvUintToInt8: out.debug << "Convert uint to int8_t";break;
|
||||
case EOpConvUintToInt16: out.debug << "Convert uint to int16_t";break;
|
||||
case EOpConvUintToInt: out.debug << "Convert uint to int";break;
|
||||
case EOpConvUintToInt64: out.debug << "Convert uint to int64"; break;
|
||||
case EOpConvUintToUint8: out.debug << "Convert uint to uint8_t";break;
|
||||
case EOpConvUintToUint16: out.debug << "Convert uint to uint16_t";break;
|
||||
case EOpConvUintToUint64: out.debug << "Convert uint to uint64"; break;
|
||||
|
||||
// uint32_t -> float*
|
||||
case EOpConvUintToFloat16: out.debug << "Convert uint to float16_t";break;
|
||||
case EOpConvUintToFloat: out.debug << "Convert uint to float"; break;
|
||||
case EOpConvUintToDouble: out.debug << "Convert uint to double"; break;
|
||||
|
||||
// int64 -> (u)int*
|
||||
case EOpConvInt64ToInt8: out.debug << "Convert int64 to int8_t"; break;
|
||||
case EOpConvInt64ToInt16: out.debug << "Convert int64 to int16_t"; break;
|
||||
case EOpConvInt64ToInt: out.debug << "Convert int64 to int"; break;
|
||||
case EOpConvInt64ToUint8: out.debug << "Convert int64 to uint8_t";break;
|
||||
case EOpConvInt64ToUint16: out.debug << "Convert int64 to uint16_t";break;
|
||||
case EOpConvInt64ToUint: out.debug << "Convert int64 to uint"; break;
|
||||
case EOpConvInt64ToUint64: out.debug << "Convert int64 to uint64"; break;
|
||||
|
||||
// int64 -> float*
|
||||
case EOpConvInt64ToFloat16: out.debug << "Convert int64 to float16_t";break;
|
||||
case EOpConvInt64ToFloat: out.debug << "Convert int64 to float"; break;
|
||||
case EOpConvInt64ToDouble: out.debug << "Convert int64 to double"; break;
|
||||
|
||||
// uint64 -> (u)int*
|
||||
case EOpConvUint64ToInt8: out.debug << "Convert uint64 to int8_t";break;
|
||||
case EOpConvUint64ToInt16: out.debug << "Convert uint64 to int16_t";break;
|
||||
case EOpConvUint64ToInt: out.debug << "Convert uint64 to int"; break;
|
||||
case EOpConvUint64ToInt64: out.debug << "Convert uint64 to int64"; break;
|
||||
case EOpConvUint64ToUint8: out.debug << "Convert uint64 to uint8_t";break;
|
||||
case EOpConvUint64ToUint16: out.debug << "Convert uint64 to uint16"; break;
|
||||
case EOpConvUint64ToUint: out.debug << "Convert uint64 to uint"; break;
|
||||
|
||||
// uint64 -> float*
|
||||
case EOpConvUint64ToFloat16: out.debug << "Convert uint64 to float16_t";break;
|
||||
case EOpConvUint64ToFloat: out.debug << "Convert uint64 to float"; break;
|
||||
case EOpConvUint64ToDouble: out.debug << "Convert uint64 to double"; break;
|
||||
|
||||
// float16_t -> int*
|
||||
case EOpConvFloat16ToInt8: out.debug << "Convert float16_t to int8_t"; break;
|
||||
case EOpConvFloat16ToInt16: out.debug << "Convert float16_t to int16_t"; break;
|
||||
case EOpConvFloat16ToInt: out.debug << "Convert float16_t to int"; break;
|
||||
case EOpConvFloat16ToInt64: out.debug << "Convert float16_t to int64"; break;
|
||||
|
||||
// float16_t -> uint*
|
||||
case EOpConvFloat16ToUint8: out.debug << "Convert float16_t to uint8_t"; break;
|
||||
case EOpConvFloat16ToUint16: out.debug << "Convert float16_t to uint16_t"; break;
|
||||
case EOpConvFloat16ToUint: out.debug << "Convert float16_t to uint"; break;
|
||||
case EOpConvFloat16ToUint64: out.debug << "Convert float16_t to uint64"; break;
|
||||
|
||||
// float16_t -> float*
|
||||
case EOpConvFloat16ToFloat: out.debug << "Convert float16_t to float"; break;
|
||||
case EOpConvFloat16ToDouble: out.debug << "Convert float16_t to double"; break;
|
||||
|
||||
// float32 -> float*
|
||||
case EOpConvFloatToFloat16: out.debug << "Convert float to float16_t"; break;
|
||||
case EOpConvFloatToDouble: out.debug << "Convert float to double"; break;
|
||||
|
||||
// float32_t -> int*
|
||||
case EOpConvFloatToInt8: out.debug << "Convert float to int8_t"; break;
|
||||
case EOpConvFloatToInt16: out.debug << "Convert float to int16_t"; break;
|
||||
case EOpConvFloatToInt: out.debug << "Convert float to int"; break;
|
||||
case EOpConvFloatToInt64: out.debug << "Convert float to int64"; break;
|
||||
|
||||
// float32_t -> uint*
|
||||
case EOpConvFloatToUint8: out.debug << "Convert float to uint8_t"; break;
|
||||
case EOpConvFloatToUint16: out.debug << "Convert float to uint16_t"; break;
|
||||
case EOpConvFloatToUint: out.debug << "Convert float to uint"; break;
|
||||
case EOpConvFloatToUint64: out.debug << "Convert float to uint64"; break;
|
||||
|
||||
// double -> float*
|
||||
case EOpConvDoubleToFloat16: out.debug << "Convert double to float16_t"; break;
|
||||
case EOpConvDoubleToFloat: out.debug << "Convert double to float"; break;
|
||||
|
||||
// double -> int*
|
||||
case EOpConvDoubleToInt8: out.debug << "Convert double to int8_t"; break;
|
||||
case EOpConvDoubleToInt16: out.debug << "Convert double to int16_t"; break;
|
||||
case EOpConvDoubleToInt: out.debug << "Convert double to int"; break;
|
||||
case EOpConvDoubleToInt64: out.debug << "Convert double to int64"; break;
|
||||
|
||||
// float32_t -> uint*
|
||||
case EOpConvDoubleToUint8: out.debug << "Convert double to uint8_t"; break;
|
||||
case EOpConvDoubleToUint16: out.debug << "Convert double to uint16_t"; break;
|
||||
case EOpConvDoubleToUint: out.debug << "Convert double to uint"; break;
|
||||
case EOpConvDoubleToUint64: out.debug << "Convert double to uint64"; break;
|
||||
|
||||
case EOpConvUint64ToPtr: out.debug << "Convert uint64_t to pointer"; break;
|
||||
case EOpConvPtrToUint64: out.debug << "Convert pointer to uint64_t"; break;
|
||||
|
||||
|
|
@ -673,6 +494,17 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
|
||||
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
|
||||
|
||||
case EOpCreateTensorLayoutNV: out.debug << "createTensorLayoutNV"; break;
|
||||
case EOpTensorLayoutSetBlockSizeNV: out.debug << "setTensorLayoutBlockSizeNV"; break;
|
||||
case EOpTensorLayoutSetDimensionNV: out.debug << "setTensorLayoutDimensionNV"; break;
|
||||
case EOpTensorLayoutSetStrideNV: out.debug << "setTensorLayoutStrideNV"; break;
|
||||
case EOpTensorLayoutSliceNV: out.debug << "sliceTensorLayoutNV"; break;
|
||||
case EOpTensorLayoutSetClampValueNV: out.debug << "setTensorLayoutClampValueNV"; break;
|
||||
case EOpCreateTensorViewNV: out.debug << "createTensorViewNV"; break;
|
||||
case EOpTensorViewSetDimensionNV: out.debug << "setTensorViewDimensionsNV"; break;
|
||||
case EOpTensorViewSetStrideNV: out.debug << "setTensorViewStrideNV"; break;
|
||||
case EOpTensorViewSetClipNV: out.debug << "setTensorViewClipNV"; break;
|
||||
|
||||
default: out.debug.message(EPrefixError, "Bad unary op");
|
||||
}
|
||||
|
||||
|
|
@ -811,6 +643,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpConstructReference: out.debug << "Construct reference"; break;
|
||||
case EOpConstructCooperativeMatrixNV: out.debug << "Construct cooperative matrix NV"; break;
|
||||
case EOpConstructCooperativeMatrixKHR: out.debug << "Construct cooperative matrix KHR"; break;
|
||||
case EOpConstructCooperativeVectorNV: out.debug << "Construct cooperative vector NV"; break;
|
||||
case EOpConstructAccStruct: out.debug << "Construct acceleration structure"; break;
|
||||
|
||||
case EOpLessThan: out.debug << "Compare Less Than"; break;
|
||||
|
|
@ -835,6 +668,9 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
|
||||
case EOpDistance: out.debug << "distance"; break;
|
||||
case EOpDot: out.debug << "dot-product"; break;
|
||||
case EOpDotPackedEXT: out.debug << "dot-product-packed";break;
|
||||
case EOpDotAccSatEXT: out.debug << "dot-product-accumulate-saturate";break;
|
||||
case EOpDotPackedAccSatEXT: out.debug << "dot-product-packed-accumulate-saturate";break;
|
||||
case EOpCross: out.debug << "cross-product"; break;
|
||||
case EOpFaceForward: out.debug << "face-forward"; break;
|
||||
case EOpReflect: out.debug << "reflect"; break;
|
||||
|
|
@ -1107,13 +943,33 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpRayQueryGetIntersectionObjectToWorld: out.debug << "rayQueryGetIntersectionObjectToWorldEXT"; break;
|
||||
case EOpRayQueryGetIntersectionWorldToObject: out.debug << "rayQueryGetIntersectionWorldToObjectEXT"; break;
|
||||
case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: out.debug << "rayQueryGetIntersectionTriangleVertexPositionsEXT"; break;
|
||||
case EOpRayQueryGetIntersectionClusterIdNV: out.debug << "rayQueryGetIntersectionClusterIdNV"; break;
|
||||
case EOpRayQueryGetIntersectionSpherePositionNV: out.debug << "rayQueryGetIntersectionSpherePositionNV"; break;
|
||||
case EOpRayQueryGetIntersectionSphereRadiusNV: out.debug << "rayQueryGetIntersectionSphereRadiusNV"; break;
|
||||
case EOpRayQueryGetIntersectionLSSHitValueNV: out.debug << "rayQueryGetIntersectionLSSHitValueNV"; break;
|
||||
case EOpRayQueryGetIntersectionLSSPositionsNV: out.debug << "rayQueryGetIntersectionLSSPositionsNV"; break;
|
||||
case EOpRayQueryGetIntersectionLSSRadiiNV: out.debug << "rayQueryGetIntersectionLSSRadiiNV"; break;
|
||||
case EOpRayQueryIsSphereHitNV: out.debug << "rayQueryIsSphereHitNV"; break;
|
||||
case EOpRayQueryIsLSSHitNV: out.debug << "rayQueryIsLSSHitNV"; break;
|
||||
|
||||
case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix KHR"; break;
|
||||
case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix KHR"; break;
|
||||
case EOpCooperativeMatrixMulAdd: out.debug << "MulAdd cooperative matrices KHR"; break;
|
||||
case EOpCooperativeMatrixLoadNV: out.debug << "Load cooperative matrix NV"; break;
|
||||
case EOpCooperativeMatrixStoreNV: out.debug << "Store cooperative matrix NV"; break;
|
||||
case EOpCooperativeMatrixLoadTensorNV: out.debug << "Load cooperative matrix tensor NV"; break;
|
||||
case EOpCooperativeMatrixStoreTensorNV: out.debug << "Store cooperative matrix tensor NV"; break;
|
||||
case EOpCooperativeMatrixMulAddNV: out.debug << "MulAdd cooperative matrices NV"; break;
|
||||
case EOpCooperativeMatrixReduceNV: out.debug << "Reduce cooperative matrices"; break;
|
||||
case EOpCooperativeMatrixPerElementOpNV: out.debug << "cooperative matrix per element op"; break;
|
||||
case EOpCooperativeMatrixTransposeNV: out.debug << "Transpose cooperative matrix"; break;
|
||||
|
||||
case EOpCooperativeVectorMatMulNV: out.debug << "Cooperative vector matrix multiply NV"; break;
|
||||
case EOpCooperativeVectorMatMulAddNV: out.debug << "Cooperative vector matrix multiply add NV"; break;
|
||||
case EOpCooperativeVectorLoadNV: out.debug << "Load cooperative vector NV"; break;
|
||||
case EOpCooperativeVectorStoreNV: out.debug << "Store cooperative vector NV"; break;
|
||||
case EOpCooperativeVectorOuterProductAccumulateNV: out.debug << "Cooperative vector outer product accumulate NV"; break;
|
||||
case EOpCooperativeVectorReduceSumAccumulateNV: out.debug << "Cooperative vector reduce sum accumulate NV"; break;
|
||||
|
||||
case EOpIsHelperInvocation: out.debug << "IsHelperInvocation"; break;
|
||||
case EOpDebugPrintf: out.debug << "Debug printf"; break;
|
||||
|
|
@ -1148,14 +1004,32 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpHitObjectGetCurrentTimeNV: out.debug << "HitObjectGetCurrentTimeNV"; break;
|
||||
case EOpHitObjectGetShaderBindingTableRecordIndexNV: out.debug << "HitObjectGetShaderBindingTableRecordIndexNV"; break;
|
||||
case EOpHitObjectGetShaderRecordBufferHandleNV: out.debug << "HitObjectReadShaderRecordBufferHandleNV"; break;
|
||||
case EOpHitObjectGetClusterIdNV: out.debug << "HitObjectGetClusterIdNV"; break;
|
||||
case EOpReorderThreadNV: out.debug << "ReorderThreadNV"; break;
|
||||
case EOpFetchMicroTriangleVertexPositionNV: out.debug << "MicroTriangleVertexPositionNV"; break;
|
||||
case EOpFetchMicroTriangleVertexBarycentricNV: out.debug << "MicroTriangleVertexBarycentricNV"; break;
|
||||
case EOpHitObjectGetSpherePositionNV: out.debug << "HitObjectGetSpherePositionNV"; break;
|
||||
case EOpHitObjectGetSphereRadiusNV: out.debug << "HitObjectGetSphereRadiusNV"; break;
|
||||
case EOpHitObjectGetLSSPositionsNV: out.debug << "HitObjectGetLSSPositionsNV"; break;
|
||||
case EOpHitObjectGetLSSRadiiNV: out.debug << "HitObjectGetLSSRadiiNV"; break;
|
||||
case EOpHitObjectIsSphereHitNV: out.debug << "HitObjectIsSphereHitNV"; break;
|
||||
case EOpHitObjectIsLSSHitNV: out.debug << "HitObjectIsLSSHitNV"; break;
|
||||
|
||||
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
|
||||
case EOpStencilAttachmentReadEXT: out.debug << "stencilAttachmentReadEXT"; break;
|
||||
case EOpDepthAttachmentReadEXT: out.debug << "depthAttachmentReadEXT"; break;
|
||||
|
||||
case EOpCreateTensorLayoutNV: out.debug << "createTensorLayout"; break;
|
||||
case EOpTensorLayoutSetBlockSizeNV: out.debug << "setBlockSize"; break;
|
||||
case EOpTensorLayoutSetDimensionNV: out.debug << "setDimension"; break;
|
||||
case EOpTensorLayoutSetStrideNV: out.debug << "setStride"; break;
|
||||
case EOpTensorLayoutSliceNV: out.debug << "slice"; break;
|
||||
case EOpTensorLayoutSetClampValueNV: out.debug << "setClampValue"; break;
|
||||
case EOpCreateTensorViewNV: out.debug << "createTensorView"; break;
|
||||
case EOpTensorViewSetDimensionNV: out.debug << "setTensorViewDimensions"; break;
|
||||
case EOpTensorViewSetStrideNV: out.debug << "setTensorViewStride"; break;
|
||||
case EOpTensorViewSetClipNV: out.debug << "clipTensorView"; break;
|
||||
|
||||
default: out.debug.message(EPrefixError, "Bad aggregation op");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "gl_types.h"
|
||||
#include "iomapper.h"
|
||||
#include "LiveTraverser.h"
|
||||
#include "SymbolTable.h"
|
||||
|
||||
//
|
||||
|
|
@ -60,6 +61,108 @@
|
|||
|
||||
namespace glslang {
|
||||
|
||||
struct TVarEntryInfo {
|
||||
long long id;
|
||||
TIntermSymbol* symbol;
|
||||
bool live;
|
||||
TLayoutPacking upgradedToPushConstantPacking; // ElpNone means it hasn't been upgraded
|
||||
int newBinding;
|
||||
int newSet;
|
||||
int newLocation;
|
||||
int newComponent;
|
||||
int newIndex;
|
||||
EShLanguage stage;
|
||||
|
||||
void clearNewAssignments() {
|
||||
upgradedToPushConstantPacking = ElpNone;
|
||||
newBinding = -1;
|
||||
newSet = -1;
|
||||
newLocation = -1;
|
||||
newComponent = -1;
|
||||
newIndex = -1;
|
||||
}
|
||||
|
||||
struct TOrderById {
|
||||
inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { return l.id < r.id; }
|
||||
};
|
||||
|
||||
struct TOrderByPriority {
|
||||
// ordering:
|
||||
// 1) has both binding and set
|
||||
// 2) has binding but no set
|
||||
// 3) has no binding but set
|
||||
// 4) has no binding and no set
|
||||
inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) {
|
||||
const TQualifier& lq = l.symbol->getQualifier();
|
||||
const TQualifier& rq = r.symbol->getQualifier();
|
||||
|
||||
// simple rules:
|
||||
// has binding gives 2 points
|
||||
// has set gives 1 point
|
||||
// who has the most points is more important.
|
||||
int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0);
|
||||
int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0);
|
||||
|
||||
if (lPoints == rPoints)
|
||||
return l.id < r.id;
|
||||
return lPoints > rPoints;
|
||||
}
|
||||
};
|
||||
|
||||
struct TOrderByPriorityAndLive {
|
||||
// ordering:
|
||||
// 1) do live variables first
|
||||
// 2) has both binding and set
|
||||
// 3) has binding but no set
|
||||
// 4) has no binding but set
|
||||
// 5) has no binding and no set
|
||||
inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) {
|
||||
|
||||
const TQualifier& lq = l.symbol->getQualifier();
|
||||
const TQualifier& rq = r.symbol->getQualifier();
|
||||
|
||||
// simple rules:
|
||||
// has binding gives 2 points
|
||||
// has set gives 1 point
|
||||
// who has the most points is more important.
|
||||
int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0);
|
||||
int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0);
|
||||
|
||||
if (l.live != r.live)
|
||||
return l.live > r.live;
|
||||
|
||||
if (lPoints != rPoints)
|
||||
return lPoints > rPoints;
|
||||
|
||||
return l.id < r.id;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// override function "operator=", if a vector<const _Kty, _Ty> being sort,
|
||||
// when use vc++, the sort function will call :
|
||||
// pair& operator=(const pair<_Other1, _Other2>& _Right)
|
||||
// {
|
||||
// first = _Right.first;
|
||||
// second = _Right.second;
|
||||
// return (*this);
|
||||
// }
|
||||
// that will make a const type handing on left.
|
||||
// override this function can avoid a compiler error.
|
||||
// In the future, if the vc++ compiler can handle such a situation,
|
||||
// this part of the code will be removed.
|
||||
struct TVarLivePair : std::pair<const TString, TVarEntryInfo> {
|
||||
TVarLivePair(const std::pair<const TString, TVarEntryInfo>& _Right) : pair(_Right.first, _Right.second) {}
|
||||
TVarLivePair& operator=(const TVarLivePair& _Right) {
|
||||
const_cast<TString&>(first) = _Right.first;
|
||||
second = _Right.second;
|
||||
return (*this);
|
||||
}
|
||||
TVarLivePair(const TVarLivePair& src) : pair(src) { }
|
||||
};
|
||||
typedef std::vector<TVarLivePair> TVarLiveVector;
|
||||
|
||||
|
||||
class TVarGatherTraverser : public TLiveTraverser {
|
||||
public:
|
||||
TVarGatherTraverser(const TIntermediate& i, bool traverseDeadCode, TVarLiveMap& inList, TVarLiveMap& outList, TVarLiveMap& uniformList)
|
||||
|
|
@ -143,8 +246,11 @@ public:
|
|||
base->getWritableType().getQualifier().layoutComponent = at->second.newComponent;
|
||||
if (at->second.newIndex != -1)
|
||||
base->getWritableType().getQualifier().layoutIndex = at->second.newIndex;
|
||||
if (at->second.upgradedToPushConstant)
|
||||
if (at->second.upgradedToPushConstantPacking != ElpNone) {
|
||||
base->getWritableType().getQualifier().layoutPushConstant = true;
|
||||
base->getWritableType().getQualifier().setBlockStorage(EbsPushConstant);
|
||||
base->getWritableType().getQualifier().layoutPacking = at->second.upgradedToPushConstantPacking;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -176,7 +282,7 @@ struct TNotifyInOutAdaptor
|
|||
{
|
||||
EShLanguage stage;
|
||||
TIoMapResolver& resolver;
|
||||
inline TNotifyInOutAdaptor(EShLanguage s, TIoMapResolver& r)
|
||||
inline TNotifyInOutAdaptor(EShLanguage s, TIoMapResolver& r)
|
||||
: stage(s)
|
||||
, resolver(r)
|
||||
{
|
||||
|
|
@ -1497,6 +1603,36 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
|
|||
return !hadError;
|
||||
}
|
||||
|
||||
TGlslIoMapper::TGlslIoMapper() {
|
||||
memset(inVarMaps, 0, sizeof(TVarLiveMap*) * EShLangCount);
|
||||
memset(outVarMaps, 0, sizeof(TVarLiveMap*) * EShLangCount);
|
||||
memset(uniformVarMap, 0, sizeof(TVarLiveMap*) * EShLangCount);
|
||||
memset(intermediates, 0, sizeof(TIntermediate*) * EShLangCount);
|
||||
profile = ENoProfile;
|
||||
version = 0;
|
||||
autoPushConstantMaxSize = 128;
|
||||
autoPushConstantBlockPacking = ElpStd430;
|
||||
}
|
||||
|
||||
TGlslIoMapper::~TGlslIoMapper() {
|
||||
for (size_t stage = 0; stage < EShLangCount; stage++) {
|
||||
if (inVarMaps[stage] != nullptr) {
|
||||
delete inVarMaps[stage];
|
||||
inVarMaps[stage] = nullptr;
|
||||
}
|
||||
if (outVarMaps[stage] != nullptr) {
|
||||
delete outVarMaps[stage];
|
||||
outVarMaps[stage] = nullptr;
|
||||
}
|
||||
if (uniformVarMap[stage] != nullptr) {
|
||||
delete uniformVarMap[stage];
|
||||
uniformVarMap[stage] = nullptr;
|
||||
}
|
||||
if (intermediates[stage] != nullptr)
|
||||
intermediates[stage] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Map I/O variables to provided offsets, and make bindings for
|
||||
// unbound but live variables.
|
||||
//
|
||||
|
|
@ -1677,7 +1813,8 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
|
|||
std::for_each(uniformVector.begin(), uniformVector.end(),
|
||||
[this](TVarLivePair& p) {
|
||||
if (p.first == autoPushConstantBlockName) {
|
||||
p.second.upgradedToPushConstant = true;
|
||||
p.second.upgradedToPushConstantPacking = autoPushConstantBlockPacking;
|
||||
p.second.newSet = TQualifier::layoutSetEnd;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -1690,8 +1827,8 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
|
|||
std::for_each(uniformVector.begin(), uniformVector.end(), [pUniformVarMap, stage](TVarLivePair p) {
|
||||
auto at = pUniformVarMap[stage]->find(p.second.symbol->getAccessName());
|
||||
if (at != pUniformVarMap[stage]->end() && at->second.id == p.second.id){
|
||||
if (p.second.upgradedToPushConstant) {
|
||||
at->second.upgradedToPushConstant = true;
|
||||
if (p.second.upgradedToPushConstantPacking != ElpNone) {
|
||||
at->second.upgradedToPushConstantPacking = p.second.upgradedToPushConstantPacking;
|
||||
} else {
|
||||
int resolvedBinding = at->second.newBinding;
|
||||
at->second = p.second;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#define _IOMAPPER_INCLUDED
|
||||
|
||||
#include <cstdint>
|
||||
#include "LiveTraverser.h"
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
//
|
||||
|
|
@ -49,84 +48,7 @@ class TInfoSink;
|
|||
namespace glslang {
|
||||
|
||||
class TIntermediate;
|
||||
struct TVarEntryInfo {
|
||||
long long id;
|
||||
TIntermSymbol* symbol;
|
||||
bool live;
|
||||
bool upgradedToPushConstant;
|
||||
int newBinding;
|
||||
int newSet;
|
||||
int newLocation;
|
||||
int newComponent;
|
||||
int newIndex;
|
||||
EShLanguage stage;
|
||||
|
||||
void clearNewAssignments() {
|
||||
upgradedToPushConstant = false;
|
||||
newBinding = -1;
|
||||
newSet = -1;
|
||||
newLocation = -1;
|
||||
newComponent = -1;
|
||||
newIndex = -1;
|
||||
}
|
||||
|
||||
struct TOrderById {
|
||||
inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { return l.id < r.id; }
|
||||
};
|
||||
|
||||
struct TOrderByPriority {
|
||||
// ordering:
|
||||
// 1) has both binding and set
|
||||
// 2) has binding but no set
|
||||
// 3) has no binding but set
|
||||
// 4) has no binding and no set
|
||||
inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) {
|
||||
const TQualifier& lq = l.symbol->getQualifier();
|
||||
const TQualifier& rq = r.symbol->getQualifier();
|
||||
|
||||
// simple rules:
|
||||
// has binding gives 2 points
|
||||
// has set gives 1 point
|
||||
// who has the most points is more important.
|
||||
int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0);
|
||||
int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0);
|
||||
|
||||
if (lPoints == rPoints)
|
||||
return l.id < r.id;
|
||||
return lPoints > rPoints;
|
||||
}
|
||||
};
|
||||
|
||||
struct TOrderByPriorityAndLive {
|
||||
// ordering:
|
||||
// 1) do live variables first
|
||||
// 2) has both binding and set
|
||||
// 3) has binding but no set
|
||||
// 4) has no binding but set
|
||||
// 5) has no binding and no set
|
||||
inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) {
|
||||
|
||||
const TQualifier& lq = l.symbol->getQualifier();
|
||||
const TQualifier& rq = r.symbol->getQualifier();
|
||||
|
||||
// simple rules:
|
||||
// has binding gives 2 points
|
||||
// has set gives 1 point
|
||||
// who has the most points is more important.
|
||||
int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0);
|
||||
int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0);
|
||||
|
||||
if (l.live != r.live)
|
||||
return l.live > r.live;
|
||||
|
||||
if (lPoints != rPoints)
|
||||
return lPoints > rPoints;
|
||||
|
||||
return l.id < r.id;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct TVarEntryInfo;
|
||||
// Base class for shared TIoMapResolver services, used by several derivations.
|
||||
struct TDefaultIoResolverBase : public glslang::TIoMapResolver {
|
||||
public:
|
||||
|
|
@ -267,82 +189,22 @@ protected:
|
|||
|
||||
typedef std::map<TString, TVarEntryInfo> TVarLiveMap;
|
||||
|
||||
// override function "operator=", if a vector<const _Kty, _Ty> being sort,
|
||||
// when use vc++, the sort function will call :
|
||||
// pair& operator=(const pair<_Other1, _Other2>& _Right)
|
||||
// {
|
||||
// first = _Right.first;
|
||||
// second = _Right.second;
|
||||
// return (*this);
|
||||
// }
|
||||
// that will make a const type handing on left.
|
||||
// override this function can avoid a compiler error.
|
||||
// In the future, if the vc++ compiler can handle such a situation,
|
||||
// this part of the code will be removed.
|
||||
struct TVarLivePair : std::pair<const TString, TVarEntryInfo> {
|
||||
TVarLivePair(const std::pair<const TString, TVarEntryInfo>& _Right) : pair(_Right.first, _Right.second) {}
|
||||
TVarLivePair& operator=(const TVarLivePair& _Right) {
|
||||
const_cast<TString&>(first) = _Right.first;
|
||||
second = _Right.second;
|
||||
return (*this);
|
||||
}
|
||||
TVarLivePair(const TVarLivePair& src) : pair(src) { }
|
||||
};
|
||||
typedef std::vector<TVarLivePair> TVarLiveVector;
|
||||
|
||||
// I/O mapper
|
||||
class TIoMapper {
|
||||
public:
|
||||
TIoMapper() {}
|
||||
virtual ~TIoMapper() {}
|
||||
// grow the reflection stage by stage
|
||||
bool virtual addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*);
|
||||
bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; }
|
||||
};
|
||||
|
||||
// I/O mapper for GLSL
|
||||
class TGlslIoMapper : public TIoMapper {
|
||||
public:
|
||||
TGlslIoMapper() {
|
||||
memset(inVarMaps, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1));
|
||||
memset(outVarMaps, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1));
|
||||
memset(uniformVarMap, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1));
|
||||
memset(intermediates, 0, sizeof(TIntermediate*) * (EShLangCount + 1));
|
||||
profile = ENoProfile;
|
||||
version = 0;
|
||||
autoPushConstantMaxSize = 128;
|
||||
autoPushConstantBlockPacking = ElpStd430;
|
||||
}
|
||||
virtual ~TGlslIoMapper() {
|
||||
for (size_t stage = 0; stage < EShLangCount; stage++) {
|
||||
if (inVarMaps[stage] != nullptr) {
|
||||
delete inVarMaps[stage];
|
||||
inVarMaps[stage] = nullptr;
|
||||
}
|
||||
if (outVarMaps[stage] != nullptr) {
|
||||
delete outVarMaps[stage];
|
||||
outVarMaps[stage] = nullptr;
|
||||
}
|
||||
if (uniformVarMap[stage] != nullptr) {
|
||||
delete uniformVarMap[stage];
|
||||
uniformVarMap[stage] = nullptr;
|
||||
}
|
||||
if (intermediates[stage] != nullptr)
|
||||
intermediates[stage] = nullptr;
|
||||
}
|
||||
}
|
||||
TGlslIoMapper();
|
||||
virtual ~TGlslIoMapper();
|
||||
// If set, the uniform block with the given name will be changed to be backed by
|
||||
// push_constant if it's size is <= maxSize
|
||||
void setAutoPushConstantBlock(const char* name, unsigned int maxSize, TLayoutPacking packing) {
|
||||
bool setAutoPushConstantBlock(const char* name, unsigned int maxSize, TLayoutPacking packing) override {
|
||||
autoPushConstantBlockName = name;
|
||||
autoPushConstantMaxSize = maxSize;
|
||||
autoPushConstantBlockPacking = packing;
|
||||
return true;
|
||||
}
|
||||
// grow the reflection stage by stage
|
||||
bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*) override;
|
||||
bool doMap(TIoMapResolver*, TInfoSink&) override;
|
||||
TVarLiveMap *inVarMaps[EShLangCount], *outVarMaps[EShLangCount],
|
||||
*uniformVarMap[EShLangCount];
|
||||
TIntermediate* intermediates[EShLangCount];
|
||||
bool hadError = false;
|
||||
EProfile profile;
|
||||
|
|
@ -352,6 +214,8 @@ private:
|
|||
TString autoPushConstantBlockName;
|
||||
unsigned int autoPushConstantMaxSize;
|
||||
TLayoutPacking autoPushConstantBlockPacking;
|
||||
TVarLiveMap *inVarMaps[EShLangCount], *outVarMaps[EShLangCount],
|
||||
*uniformVarMap[EShLangCount];
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -46,9 +46,11 @@
|
|||
// even if no merging was done (i.e., the stage was only one compilation unit).
|
||||
//
|
||||
|
||||
#include "glslang/glslang/Public/ShaderLang.h"
|
||||
#include "localintermediate.h"
|
||||
#include "../Include/InfoSink.h"
|
||||
#include "SymbolTable.h"
|
||||
#include "LiveTraverser.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
|
|
@ -58,10 +60,12 @@ namespace glslang {
|
|||
void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage unitStage)
|
||||
{
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
if (unitStage < EShLangCount)
|
||||
infoSink.info << "Linking " << StageName(getStage()) << " and " << StageName(unitStage) << " stages: " << message << "\n";
|
||||
else
|
||||
if (unitStage == EShLangCount)
|
||||
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
|
||||
else if (language == EShLangCount)
|
||||
infoSink.info << "Linking " << StageName(unitStage) << " stage: " << message << "\n";
|
||||
else
|
||||
infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n";
|
||||
|
||||
++numErrors;
|
||||
}
|
||||
|
|
@ -70,10 +74,12 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage
|
|||
void TIntermediate::warn(TInfoSink& infoSink, const char* message, EShLanguage unitStage)
|
||||
{
|
||||
infoSink.info.prefix(EPrefixWarning);
|
||||
if (unitStage < EShLangCount)
|
||||
infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n";
|
||||
else
|
||||
if (unitStage == EShLangCount)
|
||||
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
|
||||
else if (language == EShLangCount)
|
||||
infoSink.info << "Linking " << StageName(unitStage) << " stage: " << message << "\n";
|
||||
else
|
||||
infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n";
|
||||
}
|
||||
|
||||
// TODO: 4.4 offset/align: "Two blocks linked together in the same program with the same block
|
||||
|
|
@ -113,6 +119,30 @@ void TIntermediate::mergeUniformObjects(TInfoSink& infoSink, TIntermediate& unit
|
|||
mergeLinkerObjects(infoSink, linkerObjects, unitLinkerObjects, unit.getStage());
|
||||
}
|
||||
|
||||
static inline bool isSameInterface(TIntermSymbol* symbol, TIntermSymbol* unitSymbol) {
|
||||
EShLanguage stage = symbol->getStage();
|
||||
EShLanguage unitStage = unitSymbol->getStage();
|
||||
return // 1) same stage and same shader interface
|
||||
(stage == unitStage && symbol->getType().getShaderInterface() == unitSymbol->getType().getShaderInterface()) ||
|
||||
// 2) accross stages and both are uniform or buffer
|
||||
(symbol->getQualifier().storage == EvqUniform && unitSymbol->getQualifier().storage == EvqUniform) ||
|
||||
(symbol->getQualifier().storage == EvqBuffer && unitSymbol->getQualifier().storage == EvqBuffer) ||
|
||||
// 3) in/out matched across stage boundary
|
||||
(stage < unitStage && symbol->getQualifier().storage == EvqVaryingOut && unitSymbol->getQualifier().storage == EvqVaryingIn) ||
|
||||
(unitStage < stage && symbol->getQualifier().storage == EvqVaryingIn && unitSymbol->getQualifier().storage == EvqVaryingOut);
|
||||
}
|
||||
|
||||
static bool isSameSymbol(TIntermSymbol* symbol1, TIntermSymbol* symbol2) {
|
||||
// If they are both blocks in the same shader interface,
|
||||
// match by the block-name, not the identifier name.
|
||||
if (symbol1->getType().getBasicType() == EbtBlock && symbol2->getType().getBasicType() == EbtBlock) {
|
||||
if (isSameInterface(symbol1, symbol2)) {
|
||||
return symbol1->getType().getTypeName() == symbol2->getType().getTypeName();
|
||||
}
|
||||
} else if (symbol1->getName() == symbol2->getName())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
//
|
||||
// do error checking on the shader boundary in / out vars
|
||||
//
|
||||
|
|
@ -140,6 +170,107 @@ void TIntermediate::checkStageIO(TInfoSink& infoSink, TIntermediate& unit) {
|
|||
// TODO: final check; make sure that any statically used `in` have matching `out` written to
|
||||
}
|
||||
|
||||
void TIntermediate::optimizeStageIO(TInfoSink&, TIntermediate& unit)
|
||||
{
|
||||
// don't do any input/output demotion on compute, raytracing, or task/mesh stages
|
||||
// TODO: support task/mesh
|
||||
if (getStage() > EShLangFragment || unit.getStage() > EShLangFragment) {
|
||||
return;
|
||||
}
|
||||
|
||||
class TIOTraverser : public TLiveTraverser {
|
||||
public:
|
||||
TIOTraverser(TIntermediate& i, bool all, TIntermSequence& sequence, TStorageQualifier storage)
|
||||
: TLiveTraverser(i, all, true, false, false), sequence(sequence), storage(storage)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol* symbol)
|
||||
{
|
||||
if (symbol->getQualifier().storage == storage) {
|
||||
sequence.push_back(symbol);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
TIntermSequence& sequence;
|
||||
TStorageQualifier storage;
|
||||
};
|
||||
|
||||
// live symbols only
|
||||
TIntermSequence unitLiveInputs;
|
||||
|
||||
TIOTraverser unitTraverser(unit, false, unitLiveInputs, EvqVaryingIn);
|
||||
unitTraverser.pushFunction(unit.getEntryPointMangledName().c_str());
|
||||
while (! unitTraverser.destinations.empty()) {
|
||||
TIntermNode* destination = unitTraverser.destinations.back();
|
||||
unitTraverser.destinations.pop_back();
|
||||
destination->traverse(&unitTraverser);
|
||||
}
|
||||
|
||||
TIntermSequence allOutputs;
|
||||
TIntermSequence unitAllInputs;
|
||||
|
||||
TIOTraverser allTraverser(*this, true, allOutputs, EvqVaryingOut);
|
||||
getTreeRoot()->traverse(&allTraverser);
|
||||
|
||||
TIOTraverser unitAllTraverser(unit, true, unitAllInputs, EvqVaryingIn);
|
||||
unit.getTreeRoot()->traverse(&unitAllTraverser);
|
||||
|
||||
// find outputs not consumed by the next stage
|
||||
std::for_each(allOutputs.begin(), allOutputs.end(), [&unitLiveInputs, &unitAllInputs](TIntermNode* output) {
|
||||
// don't do anything to builtins
|
||||
if (output->getAsSymbolNode()->getAccessName().compare(0, 3, "gl_") == 0)
|
||||
return;
|
||||
|
||||
// don't demote block outputs (for now)
|
||||
if (output->getAsSymbolNode()->getBasicType() == EbtBlock)
|
||||
return;
|
||||
|
||||
// check if the (loose) output has a matching loose input
|
||||
auto isMatchingInput = [output](TIntermNode* input) {
|
||||
return output->getAsSymbolNode()->getAccessName() == input->getAsSymbolNode()->getAccessName();
|
||||
};
|
||||
|
||||
// check if the (loose) output has a matching block member input
|
||||
auto isMatchingInputBlockMember = [output](TIntermNode* input) {
|
||||
// ignore loose inputs
|
||||
if (input->getAsSymbolNode()->getBasicType() != EbtBlock)
|
||||
return false;
|
||||
|
||||
// don't demote loose outputs with matching input block members
|
||||
auto isMatchingBlockMember = [output](TTypeLoc type) {
|
||||
return type.type->getFieldName() == output->getAsSymbolNode()->getName();
|
||||
};
|
||||
const TTypeList* members = input->getAsSymbolNode()->getType().getStruct();
|
||||
return std::any_of(members->begin(), members->end(), isMatchingBlockMember);
|
||||
};
|
||||
|
||||
// determine if the input/output pair should be demoted
|
||||
// do the faster (and more likely) loose-loose check first
|
||||
if (std::none_of(unitLiveInputs.begin(), unitLiveInputs.end(), isMatchingInput) &&
|
||||
std::none_of(unitAllInputs.begin(), unitAllInputs.end(), isMatchingInputBlockMember)) {
|
||||
// demote any input matching the output
|
||||
auto demoteMatchingInputs = [output](TIntermNode* input) {
|
||||
if (output->getAsSymbolNode()->getAccessName() == input->getAsSymbolNode()->getAccessName()) {
|
||||
// demote input to a plain variable
|
||||
TIntermSymbol* symbol = input->getAsSymbolNode();
|
||||
symbol->getQualifier().storage = EvqGlobal;
|
||||
symbol->getQualifier().clearInterstage();
|
||||
symbol->getQualifier().clearLayout();
|
||||
}
|
||||
};
|
||||
|
||||
// demote all matching outputs to a plain variable
|
||||
TIntermSymbol* symbol = output->getAsSymbolNode();
|
||||
symbol->getQualifier().storage = EvqGlobal;
|
||||
symbol->getQualifier().clearInterstage();
|
||||
symbol->getQualifier().clearLayout();
|
||||
std::for_each(unitAllInputs.begin(), unitAllInputs.end(), demoteMatchingInputs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit)
|
||||
{
|
||||
if (unit.getNumEntryPoints() > 0) {
|
||||
|
|
@ -511,17 +642,6 @@ void TIntermediate::mergeBodies(TInfoSink& infoSink, TIntermSequence& globals, c
|
|||
globals.insert(globals.end() - 1, unitGlobals.begin(), unitGlobals.end() - 1);
|
||||
}
|
||||
|
||||
static inline bool isSameInterface(TIntermSymbol* symbol, EShLanguage stage, TIntermSymbol* unitSymbol, EShLanguage unitStage) {
|
||||
return // 1) same stage and same shader interface
|
||||
(stage == unitStage && symbol->getType().getShaderInterface() == unitSymbol->getType().getShaderInterface()) ||
|
||||
// 2) accross stages and both are uniform or buffer
|
||||
(symbol->getQualifier().storage == EvqUniform && unitSymbol->getQualifier().storage == EvqUniform) ||
|
||||
(symbol->getQualifier().storage == EvqBuffer && unitSymbol->getQualifier().storage == EvqBuffer) ||
|
||||
// 3) in/out matched across stage boundary
|
||||
(stage < unitStage && symbol->getQualifier().storage == EvqVaryingOut && unitSymbol->getQualifier().storage == EvqVaryingIn) ||
|
||||
(unitStage < stage && symbol->getQualifier().storage == EvqVaryingIn && unitSymbol->getQualifier().storage == EvqVaryingOut);
|
||||
}
|
||||
|
||||
//
|
||||
// Global Unfiform block stores any default uniforms (i.e. uniforms without a block)
|
||||
// If two linked stages declare the same member, they are meant to be the same uniform
|
||||
|
|
@ -611,10 +731,10 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl
|
|||
// don't need as many checks as when merging symbols, since
|
||||
// initializers and most qualifiers are stripped when the member is moved into the block
|
||||
if ((*memberType) != (*unitMemberType)) {
|
||||
error(infoSink, "Types must match:");
|
||||
error(infoSink, "Types must match:", unitBlock->getStage());
|
||||
infoSink.info << " " << memberType->getFieldName() << ": ";
|
||||
infoSink.info << "\"" << memberType->getCompleteString() << "\" versus ";
|
||||
infoSink.info << "\"" << unitMemberType->getCompleteString() << "\"\n";
|
||||
infoSink.info << "\"" << memberType->getCompleteString() << "\" in stage " << StageName(block->getStage()) << " versus ";
|
||||
infoSink.info << "\"" << unitMemberType->getCompleteString() << "\" in stage " << StageName(unitBlock->getStage()) << "\n";
|
||||
}
|
||||
|
||||
memberIndexUpdates[i] = j;
|
||||
|
|
@ -713,18 +833,7 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
|
|||
TIntermSymbol* unitSymbol = unitLinkerObjects[unitLinkObj]->getAsSymbolNode();
|
||||
assert(symbol && unitSymbol);
|
||||
|
||||
bool isSameSymbol = false;
|
||||
// If they are both blocks in the same shader interface,
|
||||
// match by the block-name, not the identifier name.
|
||||
if (symbol->getType().getBasicType() == EbtBlock && unitSymbol->getType().getBasicType() == EbtBlock) {
|
||||
if (isSameInterface(symbol, getStage(), unitSymbol, unitStage)) {
|
||||
isSameSymbol = symbol->getType().getTypeName() == unitSymbol->getType().getTypeName();
|
||||
}
|
||||
}
|
||||
else if (symbol->getName() == unitSymbol->getName())
|
||||
isSameSymbol = true;
|
||||
|
||||
if (isSameSymbol) {
|
||||
if (isSameSymbol(symbol, unitSymbol)) {
|
||||
// filter out copy
|
||||
merge = false;
|
||||
|
||||
|
|
@ -761,7 +870,7 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
|
|||
mergeImplicitArraySizes(symbol->getWritableType(), unitSymbol->getType());
|
||||
|
||||
// Check for consistent types/qualification/initializers etc.
|
||||
mergeErrorCheck(infoSink, *symbol, *unitSymbol, unitStage);
|
||||
mergeErrorCheck(infoSink, *symbol, *unitSymbol);
|
||||
}
|
||||
// If different symbols, verify they arn't push_constant since there can only be one per stage
|
||||
else if (symbol->getQualifier().isPushConstant() && unitSymbol->getQualifier().isPushConstant() && getStage() == unitStage)
|
||||
|
|
@ -803,7 +912,7 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
|
|||
}
|
||||
};
|
||||
|
||||
if (isSameInterface(symbol, getStage(), unitSymbol, unitStage)) {
|
||||
if (isSameInterface(symbol, unitSymbol)) {
|
||||
checkName(symbol->getName());
|
||||
|
||||
// check members of other anonymous blocks
|
||||
|
|
@ -847,9 +956,11 @@ void TIntermediate::mergeImplicitArraySizes(TType& type, const TType& unitType)
|
|||
//
|
||||
// This function only does one of intra- or cross-stage matching per call.
|
||||
//
|
||||
void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol, EShLanguage unitStage)
|
||||
void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol)
|
||||
{
|
||||
bool crossStage = getStage() != unitStage;
|
||||
EShLanguage stage = symbol.getStage();
|
||||
EShLanguage unitStage = unitSymbol.getStage();
|
||||
bool crossStage = stage != unitStage;
|
||||
bool writeTypeComparison = false;
|
||||
bool errorReported = false;
|
||||
bool printQualifiers = false;
|
||||
|
|
@ -861,10 +972,10 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
// but, we make an exception if one is an implicit array and the other is sized
|
||||
// or if the array sizes differ because of the extra array dimension on some in/out boundaries
|
||||
bool arraysMatch = false;
|
||||
if (isIoResizeArray(symbol.getType(), getStage()) || isIoResizeArray(unitSymbol.getType(), unitStage)) {
|
||||
if (isIoResizeArray(symbol.getType(), stage) || isIoResizeArray(unitSymbol.getType(), unitStage)) {
|
||||
// if the arrays have an extra dimension because of the stage.
|
||||
// compare dimensions while ignoring the outer dimension
|
||||
unsigned int firstDim = isIoResizeArray(symbol.getType(), getStage()) ? 1 : 0;
|
||||
unsigned int firstDim = isIoResizeArray(symbol.getType(), stage) ? 1 : 0;
|
||||
unsigned int numDim = symbol.getArraySizes()
|
||||
? symbol.getArraySizes()->getNumDims() : 0;
|
||||
unsigned int unitFirstDim = isIoResizeArray(unitSymbol.getType(), unitStage) ? 1 : 0;
|
||||
|
|
@ -893,7 +1004,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
if (lpidx >= 0 && rpidx >= 0) {
|
||||
error(infoSink, "Member names and types must match:", unitStage);
|
||||
infoSink.info << " Block: " << symbol.getType().getTypeName() << "\n";
|
||||
infoSink.info << " " << StageName(getStage()) << " stage: \""
|
||||
infoSink.info << " " << StageName(stage) << " stage: \""
|
||||
<< (*symbol.getType().getStruct())[lpidx].type->getCompleteString(true, false, false, true,
|
||||
(*symbol.getType().getStruct())[lpidx].type->getFieldName()) << "\"\n";
|
||||
infoSink.info << " " << StageName(unitStage) << " stage: \""
|
||||
|
|
@ -901,20 +1012,20 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
(*unitSymbol.getType().getStruct())[rpidx].type->getFieldName()) << "\"\n";
|
||||
errorReported = true;
|
||||
} else if (lpidx >= 0 && rpidx == -1) {
|
||||
TString errmsg = StageName(getStage());
|
||||
TString errmsg = StageName(stage);
|
||||
errmsg.append(" block member has no corresponding member in ").append(StageName(unitStage)).append(" block:");
|
||||
error(infoSink, errmsg.c_str(), unitStage);
|
||||
infoSink.info << " " << StageName(getStage()) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: "
|
||||
infoSink.info << " " << StageName(stage) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: "
|
||||
<< (*symbol.getType().getStruct())[lpidx].type->getFieldName() << "\n";
|
||||
infoSink.info << " " << StageName(unitStage) << " stage: Block: " << unitSymbol.getType().getTypeName() << ", Member: n/a \n";
|
||||
errorReported = true;
|
||||
} else if (lpidx == -1 && rpidx >= 0) {
|
||||
TString errmsg = StageName(unitStage);
|
||||
errmsg.append(" block member has no corresponding member in ").append(StageName(getStage())).append(" block:");
|
||||
errmsg.append(" block member has no corresponding member in ").append(StageName(stage)).append(" block:");
|
||||
error(infoSink, errmsg.c_str(), unitStage);
|
||||
infoSink.info << " " << StageName(unitStage) << " stage: Block: " << unitSymbol.getType().getTypeName() << ", Member: "
|
||||
<< (*unitSymbol.getType().getStruct())[rpidx].type->getFieldName() << "\n";
|
||||
infoSink.info << " " << StageName(getStage()) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: n/a \n";
|
||||
infoSink.info << " " << StageName(stage) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: n/a \n";
|
||||
errorReported = true;
|
||||
} else {
|
||||
error(infoSink, "Types must match:", unitStage);
|
||||
|
|
@ -971,7 +1082,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
layoutQualifierError = true;
|
||||
}
|
||||
if (layoutQualifierError) {
|
||||
infoSink.info << " " << StageName(getStage()) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: "
|
||||
infoSink.info << " " << StageName(stage) << " stage: Block: " << symbol.getType().getTypeName() << ", Member: "
|
||||
<< (*symbol.getType().getStruct())[li].type->getFieldName() << " \""
|
||||
<< (*symbol.getType().getStruct())[li].type->getCompleteString(true, true, false, false) << "\"\n";
|
||||
infoSink.info << " " << StageName(unitStage) << " stage: Block: " << unitSymbol.getType().getTypeName() << ", Member: "
|
||||
|
|
@ -1083,6 +1194,10 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
error(infoSink, "Memory volatil qualifier must match:", unitStage);
|
||||
memoryQualifierError = true;
|
||||
}
|
||||
if (symbol.getQualifier().nontemporal != unitSymbol.getQualifier().nontemporal) {
|
||||
error(infoSink, "Memory nontemporal qualifier must match:", unitStage);
|
||||
memoryQualifierError = true;
|
||||
}
|
||||
if (symbol.getQualifier().restrict != unitSymbol.getQualifier().restrict) {
|
||||
error(infoSink, "Memory restrict qualifier must match:", unitStage);
|
||||
memoryQualifierError = true;
|
||||
|
|
@ -1152,24 +1267,24 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
if (symbol.getType().getBasicType() == EbtBlock && unitSymbol.getType().getBasicType() == EbtBlock &&
|
||||
symbol.getType().getStruct() && unitSymbol.getType().getStruct()) {
|
||||
if (printType) {
|
||||
infoSink.info << " " << StageName(getStage()) << " stage: \"" << symbol.getType().getCompleteString(true, printQualifiers, printPrecision,
|
||||
infoSink.info << " " << StageName(stage) << " stage: \"" << symbol.getType().getCompleteString(true, printQualifiers, printPrecision,
|
||||
printType, symbol.getName(), symbol.getType().getTypeName()) << "\"\n";
|
||||
infoSink.info << " " << StageName(unitStage) << " stage: \"" << unitSymbol.getType().getCompleteString(true, printQualifiers, printPrecision,
|
||||
printType, unitSymbol.getName(), unitSymbol.getType().getTypeName()) << "\"\n";
|
||||
} else {
|
||||
infoSink.info << " " << StageName(getStage()) << " stage: Block: " << symbol.getType().getTypeName() << " Instance: " << symbol.getName()
|
||||
infoSink.info << " " << StageName(stage) << " stage: Block: " << symbol.getType().getTypeName() << " Instance: " << symbol.getName()
|
||||
<< ": \"" << symbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType) << "\"\n";
|
||||
infoSink.info << " " << StageName(unitStage) << " stage: Block: " << unitSymbol.getType().getTypeName() << " Instance: " << unitSymbol.getName()
|
||||
<< ": \"" << unitSymbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType) << "\"\n";
|
||||
}
|
||||
} else {
|
||||
if (printType) {
|
||||
infoSink.info << " " << StageName(getStage()) << " stage: \""
|
||||
infoSink.info << " " << StageName(stage) << " stage: \""
|
||||
<< symbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType, symbol.getName()) << "\"\n";
|
||||
infoSink.info << " " << StageName(unitStage) << " stage: \""
|
||||
<< unitSymbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType, unitSymbol.getName()) << "\"\n";
|
||||
} else {
|
||||
infoSink.info << " " << StageName(getStage()) << " stage: " << symbol.getName() << " \""
|
||||
infoSink.info << " " << StageName(stage) << " stage: " << symbol.getName() << " \""
|
||||
<< symbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType) << "\"\n";
|
||||
infoSink.info << " " << StageName(unitStage) << " stage: " << unitSymbol.getName() << " \""
|
||||
<< unitSymbol.getType().getCompleteString(true, printQualifiers, printPrecision, printType) << "\"\n";
|
||||
|
|
@ -1689,7 +1804,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
// First range:
|
||||
TRange locationRange(qualifier.layoutLocation, qualifier.layoutLocation);
|
||||
TRange componentRange(0, 3);
|
||||
TIoRange range(locationRange, componentRange, type.getBasicType(), 0, qualifier.centroid, qualifier.smooth, qualifier.flat);
|
||||
TIoRange range(locationRange, componentRange, type.getBasicType(), 0, qualifier.centroid, qualifier.smooth, qualifier.flat, qualifier.sample, qualifier.patch);
|
||||
|
||||
// check for collisions
|
||||
collision = checkLocationRange(set, range, type, typeCollision);
|
||||
|
|
@ -1699,7 +1814,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
// Second range:
|
||||
TRange locationRange2(qualifier.layoutLocation + 1, qualifier.layoutLocation + 1);
|
||||
TRange componentRange2(0, 1);
|
||||
TIoRange range2(locationRange2, componentRange2, type.getBasicType(), 0, qualifier.centroid, qualifier.smooth, qualifier.flat);
|
||||
TIoRange range2(locationRange2, componentRange2, type.getBasicType(), 0, qualifier.centroid, qualifier.smooth, qualifier.flat, qualifier.sample, qualifier.patch);
|
||||
|
||||
// check for collisions
|
||||
collision = checkLocationRange(set, range2, type, typeCollision);
|
||||
|
|
@ -1725,7 +1840,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
TBasicType basicTy = type.getBasicType();
|
||||
if (basicTy == EbtSampler && type.getSampler().isAttachmentEXT())
|
||||
basicTy = type.getSampler().type;
|
||||
TIoRange range(locationRange, componentRange, basicTy, qualifier.hasIndex() ? qualifier.getIndex() : 0, qualifier.centroid, qualifier.smooth, qualifier.flat);
|
||||
TIoRange range(locationRange, componentRange, basicTy, qualifier.hasIndex() ? qualifier.getIndex() : 0, qualifier.centroid, qualifier.smooth, qualifier.flat, qualifier.sample, qualifier.patch);
|
||||
|
||||
// check for collisions, except for vertex inputs on desktop targeting OpenGL
|
||||
if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
|
||||
|
|
@ -1737,6 +1852,24 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
return collision;
|
||||
}
|
||||
|
||||
// Check that two types can be stored in different components in the same location.
|
||||
// They must be the same type, except signed/unsigned integers are considered compatible.
|
||||
static bool checkCompatibleTypes(TBasicType t1, TBasicType t2) {
|
||||
if (t1 != t2) {
|
||||
if ((t1 == EbtInt8 && t2 == EbtUint8) ||
|
||||
(t2 == EbtInt8 && t1 == EbtUint8) ||
|
||||
(t1 == EbtInt16 && t2 == EbtUint16) ||
|
||||
(t2 == EbtInt16 && t1 == EbtUint16)||
|
||||
(t1 == EbtInt && t2 == EbtUint) ||
|
||||
(t2 == EbtInt && t1 == EbtUint)||
|
||||
(t1 == EbtInt64 && t2 == EbtUint64) ||
|
||||
(t2 == EbtInt64 && t1 == EbtUint64)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return t1 == t2;
|
||||
}
|
||||
|
||||
// Compare a new (the passed in) 'range' against the existing set, and see
|
||||
// if there are any collisions.
|
||||
//
|
||||
|
|
@ -1749,10 +1882,12 @@ int TIntermediate::checkLocationRange(int set, const TIoRange& range, const TTyp
|
|||
// there is a collision; pick one
|
||||
return std::max(range.location.start, usedIo[set][r].location.start);
|
||||
} else if (range.location.overlap(usedIo[set][r].location) &&
|
||||
(type.getBasicType() != usedIo[set][r].basicType ||
|
||||
(!checkCompatibleTypes(type.getBasicType(), usedIo[set][r].basicType) ||
|
||||
type.getQualifier().centroid != usedIo[set][r].centroid ||
|
||||
type.getQualifier().smooth != usedIo[set][r].smooth ||
|
||||
type.getQualifier().flat != usedIo[set][r].flat)) {
|
||||
type.getQualifier().flat != usedIo[set][r].flat ||
|
||||
type.getQualifier().sample != usedIo[set][r].sample ||
|
||||
type.getQualifier().patch != usedIo[set][r].patch)) {
|
||||
// aliased-type mismatch
|
||||
typeCollision = true;
|
||||
return std::max(range.location.start, usedIo[set][r].location.start);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ private:
|
|||
// A "call" is a pair: <caller, callee>.
|
||||
// There can be duplicates. General assumption is the list is small.
|
||||
struct TCall {
|
||||
TCall(const TString& pCaller, const TString& pCallee) : caller(pCaller), callee(pCallee) { }
|
||||
TCall(const TString& pCaller, const TString& pCallee)
|
||||
: caller(pCaller), callee(pCallee), visited(false), currentPath(false), errorGiven(false) { }
|
||||
TString caller;
|
||||
TString callee;
|
||||
bool visited;
|
||||
|
|
@ -123,8 +124,8 @@ struct TRange {
|
|||
// within the same location range, component range, and index value. Locations don't alias unless
|
||||
// all other dimensions of their range overlap.
|
||||
struct TIoRange {
|
||||
TIoRange(TRange location, TRange component, TBasicType basicType, int index, bool centroid, bool smooth, bool flat)
|
||||
: location(location), component(component), basicType(basicType), index(index), centroid(centroid), smooth(smooth), flat(flat)
|
||||
TIoRange(TRange location, TRange component, TBasicType basicType, int index, bool centroid, bool smooth, bool flat, bool sample, bool patch)
|
||||
: location(location), component(component), basicType(basicType), index(index), centroid(centroid), smooth(smooth), flat(flat), sample(sample), patch(patch)
|
||||
{
|
||||
}
|
||||
bool overlap(const TIoRange& rhs) const
|
||||
|
|
@ -138,6 +139,8 @@ struct TIoRange {
|
|||
bool centroid;
|
||||
bool smooth;
|
||||
bool flat;
|
||||
bool sample;
|
||||
bool patch;
|
||||
};
|
||||
|
||||
// An offset range is a 2-D rectangle; the set of (binding, offset) pairs all lying
|
||||
|
|
@ -436,6 +439,9 @@ public:
|
|||
case EShTargetVulkan_1_3:
|
||||
processes.addProcess("target-env vulkan1.3");
|
||||
break;
|
||||
case EShTargetVulkan_1_4:
|
||||
processes.addProcess("target-env vulkan1.4");
|
||||
break;
|
||||
default:
|
||||
processes.addProcess("target-env vulkanUnknown");
|
||||
break;
|
||||
|
|
@ -1029,11 +1035,11 @@ public:
|
|||
#endif
|
||||
|
||||
bool usingScalarBlockLayout() const {
|
||||
for (auto extIt = requestedExtensions.begin(); extIt != requestedExtensions.end(); ++extIt) {
|
||||
if (*extIt == E_GL_EXT_scalar_block_layout)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return IsRequestedExtension(E_GL_EXT_scalar_block_layout);
|
||||
}
|
||||
|
||||
bool usingTextureOffsetNonConst() const {
|
||||
return IsRequestedExtension(E_GL_EXT_texture_offset_non_const);
|
||||
}
|
||||
|
||||
bool IsRequestedExtension(const char* extension) const
|
||||
|
|
@ -1048,6 +1054,7 @@ public:
|
|||
void mergeGlobalUniformBlocks(TInfoSink& infoSink, TIntermediate& unit, bool mergeExistingOnly);
|
||||
void mergeUniformObjects(TInfoSink& infoSink, TIntermediate& unit);
|
||||
void checkStageIO(TInfoSink&, TIntermediate&);
|
||||
void optimizeStageIO(TInfoSink&, TIntermediate&);
|
||||
|
||||
bool buildConvertOp(TBasicType dst, TBasicType src, TOperator& convertOp) const;
|
||||
TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const;
|
||||
|
|
@ -1060,6 +1067,7 @@ public:
|
|||
int checkLocationRT(int set, int location);
|
||||
int addUsedOffsets(int binding, int offset, int numOffsets);
|
||||
bool addUsedConstantId(int id);
|
||||
GLSLANG_EXPORT_FOR_TESTS
|
||||
static int computeTypeLocationSize(const TType&, EShLanguage);
|
||||
static int computeTypeUniformLocationSize(const TType&);
|
||||
|
||||
|
|
@ -1115,7 +1123,7 @@ public:
|
|||
{ on ? numericFeatures.insert(f) : numericFeatures.erase(f); }
|
||||
|
||||
protected:
|
||||
TIntermSymbol* addSymbol(long long Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
|
||||
TIntermSymbol* addSymbol(long long Id, const TString&, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
|
||||
void error(TInfoSink& infoSink, const char*, EShLanguage unitStage = EShLangCount);
|
||||
void warn(TInfoSink& infoSink, const char*, EShLanguage unitStage = EShLangCount);
|
||||
void mergeCallGraphs(TInfoSink&, TIntermediate&);
|
||||
|
|
@ -1127,7 +1135,7 @@ protected:
|
|||
void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects, EShLanguage);
|
||||
void mergeBlockDefinitions(TInfoSink&, TIntermSymbol* block, TIntermSymbol* unitBlock, TIntermediate* unitRoot);
|
||||
void mergeImplicitArraySizes(TType&, const TType&);
|
||||
void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, EShLanguage);
|
||||
void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&);
|
||||
void checkCallGraphCycles(TInfoSink&);
|
||||
void checkCallGraphBodies(TInfoSink&, bool keepUncalled);
|
||||
void inOutLocationCheck(TInfoSink&);
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ public:
|
|||
virtual void fcoopmatCheckNV(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void intcoopmatCheckNV(const TSourceLoc&, const char *op, bool builtIn = false);
|
||||
virtual void coopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void tensorLayoutViewCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void coopvecCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; }
|
||||
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
|
||||
bool isForwardCompatible() const { return forwardCompatible; }
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ int TPpContext::CPPundef(TPpToken* ppToken)
|
|||
*/
|
||||
int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
||||
{
|
||||
inElseSkip = true;
|
||||
int depth = 0;
|
||||
int token = scanToken(ppToken);
|
||||
|
||||
|
|
@ -297,7 +298,7 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
|||
elseSeen[elsetracker] = false;
|
||||
--elsetracker;
|
||||
}
|
||||
|
||||
inElseSkip = false;
|
||||
return CPPif(ppToken);
|
||||
}
|
||||
} else if (nextAtom == PpAtomElse) {
|
||||
|
|
@ -311,7 +312,8 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
|||
parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inElseSkip = false;
|
||||
return token;
|
||||
}
|
||||
|
||||
|
|
@ -374,7 +376,7 @@ namespace {
|
|||
int op_div(int a, int b) { return a == INT_MIN && b == -1 ? 0 : a / b; }
|
||||
int op_mod(int a, int b) { return a == INT_MIN && b == -1 ? 0 : a % b; }
|
||||
int op_pos(int a) { return a; }
|
||||
int op_neg(int a) { return -a; }
|
||||
int op_neg(int a) { return a == INT_MIN ? INT_MIN : -a; }
|
||||
int op_cmpl(int a) { return ~a; }
|
||||
int op_not(int a) { return !a; }
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, T
|
|||
preamble(nullptr), strings(nullptr), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false),
|
||||
rootFileName(rootFileName),
|
||||
currentSourceFile(rootFileName),
|
||||
disableEscapeSequences(false)
|
||||
disableEscapeSequences(false),
|
||||
inElseSkip(false)
|
||||
{
|
||||
ifdepth = 0;
|
||||
for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++)
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ protected:
|
|||
break;
|
||||
popInput();
|
||||
}
|
||||
if (!inputStack.empty() && inputStack.back()->isStringInput()) {
|
||||
if (!inputStack.empty() && inputStack.back()->isStringInput() && !inElseSkip) {
|
||||
if (token == '\n') {
|
||||
bool seenNumSign = false;
|
||||
for (int i = 0; i < (int)lastLineTokens.size() - 1;) {
|
||||
|
|
@ -732,6 +732,9 @@ protected:
|
|||
|
||||
std::istringstream strtodStream;
|
||||
bool disableEscapeSequences;
|
||||
// True if we're skipping a section enclosed by #if/#ifdef/#elif/#else which was evaluated to
|
||||
// be inactive, e.g. #if 0
|
||||
bool inElseSkip;
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -174,6 +174,9 @@ bool isArithmeticOperation(glslang::TOperator op)
|
|||
case glslang::EOpMatrixTimesMatrix:
|
||||
|
||||
case glslang::EOpDot:
|
||||
case glslang::EOpDotPackedEXT:
|
||||
case glslang::EOpDotAccSatEXT:
|
||||
case glslang::EOpDotPackedAccSatEXT:
|
||||
|
||||
case glslang::EOpPostIncrement:
|
||||
case glslang::EOpPostDecrement:
|
||||
|
|
|
|||
|
|
@ -52,4 +52,5 @@ namespace glslang {
|
|||
// 'noContraction' means the object is 'precise'; and for arithmetic operation
|
||||
// nodes, it means the operation should not be contracted.
|
||||
void PropagateNoContraction(const glslang::TIntermediate& intermediate);
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@
|
|||
#define _REFLECTION_INCLUDED
|
||||
|
||||
#include "../Public/ShaderLang.h"
|
||||
#include "../Include/Types.h"
|
||||
|
||||
#include "../Include/BaseTypes.h"
|
||||
#include "../Include/visibility.h"
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
|
|
@ -65,6 +65,7 @@ public:
|
|||
virtual ~TReflection() {}
|
||||
|
||||
// grow the reflection stage by stage
|
||||
GLSLANG_EXPORT_FOR_TESTS
|
||||
bool addStage(EShLanguage, const TIntermediate&);
|
||||
|
||||
// for mapping a uniform index to a uniform object's description
|
||||
|
|
|
|||
|
|
@ -31,15 +31,18 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
add_library(OSDependent STATIC ossource.cpp ../osinclude.h)
|
||||
set(OSDEPENDENT_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ossource.cpp
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(OSDEPENDENT_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../osinclude.h
|
||||
PARENT_SCOPE)
|
||||
|
||||
add_library(OSDependent STATIC ${CMAKE_CURRENT_SOURCE_DIR}/../../stub.cpp)
|
||||
set_property(TARGET OSDependent PROPERTY FOLDER glslang)
|
||||
set_property(TARGET OSDependent PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# Link pthread
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(OSDependent Threads::Threads)
|
||||
|
||||
if(GLSLANG_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS)
|
||||
install(TARGETS OSDependent EXPORT glslang-targets)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2020 The Khronos Group Inc.
|
||||
# Copyright (C) 2020-2025 The Khronos Group Inc.
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
if(ENABLE_GLSLANG_JS)
|
||||
add_executable(glslang.js "glslang.js.cpp")
|
||||
glslang_set_link_args(glslang.js)
|
||||
target_link_libraries(glslang.js glslang SPIRV)
|
||||
target_link_libraries(glslang.js glslang)
|
||||
|
||||
# Link library names that start with "-" are treated as link flags.
|
||||
# "-Os" should be OK in MSVC; don't use /Os because CMake won't
|
||||
|
|
@ -67,28 +67,9 @@ if(ENABLE_GLSLANG_JS)
|
|||
endif()
|
||||
|
||||
if(NOT ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE)
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
add_custom_command(TARGET glslang.js POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E cat ${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js >> ${CMAKE_CURRENT_BINARY_DIR}/glslang.js
|
||||
)
|
||||
else()
|
||||
if (MINGW)
|
||||
message(FATAL_ERROR "Must use at least CMake 3.18")
|
||||
endif()
|
||||
|
||||
if (CMAKE_HOST_SYSTEM MATCHES "Windows.*")
|
||||
# There are several ways we could append one file to another on Windows, but unfortunately 'cat' is not one of them
|
||||
# (there is no 'cat' command in cmd). Also, since this will ultimately run in cmd and not pwsh, we need to ensure
|
||||
# Windows path separators are used.
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/glslang.js" glslang_js_path)
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js" glslang_after_js_path)
|
||||
add_custom_command(TARGET glslang.js POST_BUILD
|
||||
COMMAND type "${glslang_after_js_path}" >> "${glslang_js_path}")
|
||||
else()
|
||||
add_custom_command(TARGET glslang.js POST_BUILD
|
||||
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js >> ${CMAKE_CURRENT_BINARY_DIR}/glslang.js)
|
||||
endif()
|
||||
endif()
|
||||
add_custom_command(TARGET glslang.js POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E cat ${CMAKE_CURRENT_SOURCE_DIR}/glslang.after.js >> ${CMAKE_CURRENT_BINARY_DIR}/glslang.js
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -31,12 +31,18 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set(OSDEPENDENT_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ossource.cpp
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(OSDEPENDENT_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../osinclude.h
|
||||
PARENT_SCOPE)
|
||||
|
||||
add_library(OSDependent STATIC)
|
||||
|
||||
target_sources(OSDependent PRIVATE
|
||||
../osinclude.h
|
||||
ossource.cpp
|
||||
)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../stub.cpp)
|
||||
|
||||
set_property(TARGET OSDependent PROPERTY FOLDER glslang)
|
||||
set_property(TARGET OSDependent PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
|
@ -44,7 +50,7 @@ set_property(TARGET OSDependent PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|||
# MinGW GCC complains about function pointer casts to void*.
|
||||
# Turn that off with -fpermissive.
|
||||
if(MINGW AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
||||
target_compile_options(OSDependent PRIVATE -fpermissive)
|
||||
set_source_files_properties(${OSDEPENDENT_SOURCES} PROPERTIES COMPILE_FLAGS -fpermissive)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
|
|
|||
|
|
@ -35,9 +35,10 @@
|
|||
#ifndef __OSINCLUDE_H
|
||||
#define __OSINCLUDE_H
|
||||
|
||||
#include "../Include/visibility.h"
|
||||
namespace glslang {
|
||||
|
||||
void OS_DumpMemoryCounters();
|
||||
GLSLANG_EXPORT void OS_DumpMemoryCounters();
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
|
|
|
|||
|
|
@ -38,20 +38,21 @@
|
|||
#include <string>
|
||||
|
||||
#include "../Include/ResourceLimits.h"
|
||||
#include "../Include/visibility.h"
|
||||
|
||||
// Return pointer to user-writable Resource to pass through API in
|
||||
// future-proof way.
|
||||
extern TBuiltInResource* GetResources();
|
||||
GLSLANG_EXPORT extern TBuiltInResource* GetResources();
|
||||
|
||||
// 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.
|
||||
extern const TBuiltInResource* GetDefaultResources();
|
||||
GLSLANG_EXPORT extern const TBuiltInResource* GetDefaultResources();
|
||||
|
||||
// Returns the DefaultTBuiltInResource as a human-readable string.
|
||||
std::string GetDefaultTBuiltInResourceString();
|
||||
GLSLANG_EXPORT std::string GetDefaultTBuiltInResourceString();
|
||||
|
||||
// Decodes the resource limits from |config| to |resources|.
|
||||
void DecodeResourceLimits(TBuiltInResource* resources, char* config);
|
||||
GLSLANG_EXPORT void DecodeResourceLimits(TBuiltInResource* resources, char* config);
|
||||
|
||||
#endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#define _COMPILER_INTERFACE_INCLUDED_
|
||||
|
||||
#include "../Include/ResourceLimits.h"
|
||||
#include "../Include/visibility.h"
|
||||
#include "../MachineIndependent/Versions.h"
|
||||
|
||||
#include <cstring>
|
||||
|
|
@ -49,22 +50,6 @@
|
|||
#define C_DECL
|
||||
#endif
|
||||
|
||||
#ifdef GLSLANG_IS_SHARED_LIBRARY
|
||||
#ifdef _WIN32
|
||||
#ifdef GLSLANG_EXPORTING
|
||||
#define GLSLANG_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define GLSLANG_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#elif __GNUC__ >= 4
|
||||
#define GLSLANG_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#endif // GLSLANG_IS_SHARED_LIBRARY
|
||||
|
||||
#ifndef GLSLANG_EXPORT
|
||||
#define GLSLANG_EXPORT
|
||||
#endif
|
||||
|
||||
//
|
||||
// This is the platform independent interface between an OGL driver
|
||||
// and the shading language compiler/linker.
|
||||
|
|
@ -171,8 +156,9 @@ typedef enum {
|
|||
EShTargetVulkan_1_1 = (1 << 22) | (1 << 12), // Vulkan 1.1
|
||||
EShTargetVulkan_1_2 = (1 << 22) | (2 << 12), // Vulkan 1.2
|
||||
EShTargetVulkan_1_3 = (1 << 22) | (3 << 12), // Vulkan 1.3
|
||||
EShTargetVulkan_1_4 = (1 << 22) | (4 << 12), // Vulkan 1.4
|
||||
EShTargetOpenGL_450 = 450, // OpenGL
|
||||
LAST_ELEMENT_MARKER(EShTargetClientVersionCount = 5),
|
||||
LAST_ELEMENT_MARKER(EShTargetClientVersionCount = 6),
|
||||
} EShTargetClientVersion;
|
||||
|
||||
typedef EShTargetClientVersion EshTargetClientVersion;
|
||||
|
|
@ -188,6 +174,21 @@ typedef enum {
|
|||
LAST_ELEMENT_MARKER(EShTargetLanguageVersionCount = 7),
|
||||
} EShTargetLanguageVersion;
|
||||
|
||||
//
|
||||
// Following are a series of helper enums for managing layouts and qualifiers,
|
||||
// used for TPublicType, TType, others.
|
||||
//
|
||||
|
||||
enum TLayoutPacking {
|
||||
ElpNone,
|
||||
ElpShared, // default, but different than saying nothing
|
||||
ElpStd140,
|
||||
ElpStd430,
|
||||
ElpPacked,
|
||||
ElpScalar,
|
||||
ElpCount // If expanding, see bitfield width below
|
||||
};
|
||||
|
||||
struct TInputLanguage {
|
||||
EShSource languageFamily; // redundant information with other input, this one overrides when not EShSourceNone
|
||||
EShLanguage stage; // redundant information with other input, this one overrides when not EShSourceNone
|
||||
|
|
@ -270,6 +271,8 @@ enum EShMessages : unsigned {
|
|||
EShMsgBuiltinSymbolTable = (1 << 14), // print the builtin symbol table
|
||||
EShMsgEnhanced = (1 << 15), // enhanced message readability
|
||||
EShMsgAbsolutePath = (1 << 16), // Output Absolute path for messages
|
||||
EShMsgDisplayErrorColumn = (1 << 17), // Display error message column aswell as line
|
||||
EShMsgLinkTimeOptimization = (1 << 18), // perform cross-stage optimizations during linking
|
||||
LAST_ELEMENT_MARKER(EShMsgCount),
|
||||
};
|
||||
|
||||
|
|
@ -414,6 +417,7 @@ GLSLANG_EXPORT int GetKhronosToolId();
|
|||
class TIntermediate;
|
||||
class TProgram;
|
||||
class TPoolAllocator;
|
||||
class TIoMapResolver;
|
||||
|
||||
// Call this exactly once per process before using anything else
|
||||
GLSLANG_EXPORT bool InitializeProcess();
|
||||
|
|
@ -509,6 +513,9 @@ public:
|
|||
GLSLANG_EXPORT void setAtomicCounterBlockSet(unsigned int set);
|
||||
GLSLANG_EXPORT void setAtomicCounterBlockBinding(unsigned int binding);
|
||||
|
||||
GLSLANG_EXPORT void addSourceText(const char* text, size_t len);
|
||||
GLSLANG_EXPORT void setSourceFile(const char* file);
|
||||
|
||||
// For setting up the environment (cleared to nothingness in the constructor).
|
||||
// These must be called so that parsing is done for the right source language and
|
||||
// target environment, either indirectly through TranslateEnvironment() based on
|
||||
|
|
@ -849,6 +856,20 @@ public:
|
|||
virtual void addStage(EShLanguage stage, TIntermediate& stageIntermediate) = 0;
|
||||
};
|
||||
|
||||
// I/O mapper
|
||||
class TIoMapper {
|
||||
public:
|
||||
TIoMapper() {}
|
||||
virtual ~TIoMapper() {}
|
||||
// grow the reflection stage by stage
|
||||
bool virtual addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*);
|
||||
bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; }
|
||||
bool virtual setAutoPushConstantBlock(const char*, unsigned int, TLayoutPacking) { return false; }
|
||||
};
|
||||
|
||||
// Get the default GLSL IO mapper
|
||||
GLSLANG_EXPORT TIoMapper* GetGlslIoMapper();
|
||||
|
||||
// Make one TProgram per set of shaders that will get linked together. Add all
|
||||
// the shaders that are to be linked together. After calling shader.parse()
|
||||
// for all shaders, call link().
|
||||
|
|
@ -956,6 +977,10 @@ public:
|
|||
const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); }
|
||||
|
||||
GLSLANG_EXPORT void dumpReflection();
|
||||
|
||||
// Get the IO resolver to use for mapIO
|
||||
GLSLANG_EXPORT TIoMapResolver* getGlslIoResolver(EShLanguage stage);
|
||||
|
||||
// I/O mapping: apply base offsets and map live unbound variables
|
||||
// If resolver is not provided it uses the previous approach
|
||||
// and respects auto assignment and offsets.
|
||||
|
|
|
|||
|
|
@ -30,25 +30,26 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
|
||||
|
||||
#include "../Include/glslang_c_interface.h"
|
||||
#include "../Include/visibility.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Returns a struct that can be use to create custom resource values.
|
||||
glslang_resource_t* glslang_resource(void);
|
||||
GLSLANG_EXPORT glslang_resource_t* glslang_resource(void);
|
||||
|
||||
// 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);
|
||||
GLSLANG_EXPORT 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();
|
||||
GLSLANG_EXPORT 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);
|
||||
GLSLANG_EXPORT void glslang_decode_resource_limits(glslang_resource_t* resources, char* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include <sstream>
|
||||
#include <cctype>
|
||||
|
||||
#include "../Public/ResourceLimits.h"
|
||||
#include "glslang/glslang/Public/ResourceLimits.h"
|
||||
|
||||
TBuiltInResource Resources;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#include "../Public/resource_limits_c.h"
|
||||
#include "../Public/ResourceLimits.h"
|
||||
#include "glslang/glslang/Public/resource_limits_c.h"
|
||||
#include "glslang/glslang/Public/ResourceLimits.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -30,11 +30,13 @@ 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 "../../glslang/Include/glslang_c_interface.h"
|
||||
#include "glslang/glslang/Include/glslang_c_interface.h"
|
||||
|
||||
#include "../GlslangToSpv.h"
|
||||
#include "../Logger.h"
|
||||
#include "../SpvTools.h"
|
||||
#include <cstring>
|
||||
#include "glslang/glslang/Public/ShaderLang.h"
|
||||
#include "glslang/spirv/GlslangToSpv.h"
|
||||
#include "glslang/spirv/Logger.h"
|
||||
#include "glslang/spirv/SpvTools.h"
|
||||
|
||||
static_assert(sizeof(glslang_spv_options_t) == sizeof(glslang::SpvOptions), "");
|
||||
|
||||
|
|
|
|||
|
|
@ -63,5 +63,7 @@ static const char* const E_SPV_KHR_subgroup_rotate = "SPV_KHR_subgr
|
|||
static const char* const E_SPV_KHR_expect_assume = "SPV_KHR_expect_assume";
|
||||
static const char* const E_SPV_EXT_replicated_composites = "SPV_EXT_replicated_composites";
|
||||
static const char* const E_SPV_KHR_relaxed_extended_instruction = "SPV_KHR_relaxed_extended_instruction";
|
||||
static const char* const E_SPV_KHR_integer_dot_product = "SPV_KHR_integer_dot_product";
|
||||
static const char* const E_SPV_NV_cooperative_vector = "SPV_NV_cooperative_vector";
|
||||
|
||||
#endif // #ifndef GLSLextKHR_H
|
||||
|
|
|
|||
|
|
@ -90,4 +90,15 @@ const char* const E_SPV_NV_displacement_micromap = "SPV_NV_displacement_micromap
|
|||
//SPV_NV_shader_atomic_fp16_vector
|
||||
const char* const E_SPV_NV_shader_atomic_fp16_vector = "SPV_NV_shader_atomic_fp16_vector";
|
||||
|
||||
//SPV_NV_tensor_addressing
|
||||
const char* const E_SPV_NV_tensor_addressing = "SPV_NV_tensor_addressing";
|
||||
|
||||
//SPV_NV_cooperative_matrix2
|
||||
const char* const E_SPV_NV_cooperative_matrix2 = "SPV_NV_cooperative_matrix2";
|
||||
|
||||
//SPV_NV_cluster_acceleration_structure
|
||||
const char* const E_SPV_NV_cluster_acceleration_structure = "SPV_NV_cluster_acceleration_structure";
|
||||
|
||||
//SPV_NV_linear_swept_spheres
|
||||
const char* const E_SPV_NV_linear_swept_spheres = "SPV_NV_linear_swept_spheres";
|
||||
#endif // #ifndef GLSLextNV_H
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -39,6 +39,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "Logger.h"
|
||||
#include "glslang/glslang/Include/visibility.h"
|
||||
|
||||
namespace glslang {
|
||||
class TIntermediate;
|
||||
|
|
@ -53,15 +54,16 @@ struct SpvOptions {
|
|||
bool emitNonSemanticShaderDebugInfo {false};
|
||||
bool emitNonSemanticShaderDebugSource{ false };
|
||||
bool compileOnly{false};
|
||||
bool optimizerAllowExpandedIDBound{false};
|
||||
};
|
||||
|
||||
void GetSpirvVersion(std::string&);
|
||||
int GetSpirvGeneratorVersion();
|
||||
void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
SpvOptions* options = nullptr);
|
||||
void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger* logger, SpvOptions* options = nullptr);
|
||||
bool OutputSpvBin(const std::vector<unsigned int>& spirv, const char* baseName);
|
||||
bool OutputSpvHex(const std::vector<unsigned int>& spirv, const char* baseName, const char* varName);
|
||||
GLSLANG_EXPORT void GetSpirvVersion(std::string&);
|
||||
GLSLANG_EXPORT int GetSpirvGeneratorVersion();
|
||||
GLSLANG_EXPORT void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
SpvOptions* options = nullptr);
|
||||
GLSLANG_EXPORT void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger* logger, SpvOptions* options = nullptr);
|
||||
GLSLANG_EXPORT bool OutputSpvBin(const std::vector<unsigned int>& spirv, const char* baseName);
|
||||
GLSLANG_EXPORT bool OutputSpvHex(const std::vector<unsigned int>& spirv, const char* baseName, const char* varName);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,12 +37,13 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "glslang/glslang/Include/visibility.h"
|
||||
|
||||
namespace spv {
|
||||
|
||||
// A class for holding all SPIR-V build status messages, including
|
||||
// missing/TBD functionalities, warnings, and errors.
|
||||
class SpvBuildLogger {
|
||||
class GLSLANG_EXPORT SpvBuildLogger {
|
||||
public:
|
||||
SpvBuildLogger() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include "../glslang/Include/Common.h"
|
||||
|
||||
namespace spv {
|
||||
|
||||
|
|
@ -651,6 +650,40 @@ namespace spv {
|
|||
case spv::OperandExecutionMode:
|
||||
return nextInst;
|
||||
|
||||
case spv::OperandMemoryAccess:
|
||||
{
|
||||
uint32_t mask = spv[word];
|
||||
if (mask & uint32_t(spv::MemoryAccessMask::MemoryAccessAlignedMask)) {
|
||||
++word;
|
||||
--numOperands;
|
||||
}
|
||||
if (mask & uint32_t(spv::MemoryAccessMask::MemoryAccessMakePointerAvailableMask |
|
||||
spv::MemoryAccessMask::MemoryAccessMakePointerVisibleMask)) {
|
||||
idFn(asId(word+1));
|
||||
++word;
|
||||
--numOperands;
|
||||
}
|
||||
++word;
|
||||
}
|
||||
break;
|
||||
|
||||
case spv::OperandTensorAddressingOperands:
|
||||
{
|
||||
uint32_t mask = spv[word];
|
||||
if (mask & uint32_t(spv::TensorAddressingOperandsMask::TensorAddressingOperandsTensorViewMask)) {
|
||||
idFn(asId(word+1));
|
||||
++word;
|
||||
--numOperands;
|
||||
}
|
||||
if (mask & uint32_t(spv::TensorAddressingOperandsMask::TensorAddressingOperandsDecodeFuncMask)) {
|
||||
idFn(asId(word+1));
|
||||
++word;
|
||||
--numOperands;
|
||||
}
|
||||
++word;
|
||||
}
|
||||
break;
|
||||
|
||||
// Single word operands we simply ignore, as they hold no IDs
|
||||
case spv::OperandLiteralNumber:
|
||||
case spv::OperandSource:
|
||||
|
|
@ -675,7 +708,6 @@ namespace spv {
|
|||
case spv::OperandSelect:
|
||||
case spv::OperandLoop:
|
||||
case spv::OperandFunction:
|
||||
case spv::OperandMemoryAccess:
|
||||
case spv::OperandGroupOperation:
|
||||
case spv::OperandKernelEnqueueFlags:
|
||||
case spv::OperandKernelProfilingInfo:
|
||||
|
|
@ -1352,13 +1384,15 @@ namespace spv {
|
|||
return hash;
|
||||
}
|
||||
|
||||
case spv::OpTypeEvent: return 300000;
|
||||
case spv::OpTypeDeviceEvent: return 300001;
|
||||
case spv::OpTypeReserveId: return 300002;
|
||||
case spv::OpTypeQueue: return 300003;
|
||||
case spv::OpTypePipe: return 300004;
|
||||
case spv::OpConstantTrue: return 300007;
|
||||
case spv::OpConstantFalse: return 300008;
|
||||
case spv::OpTypeEvent: return 300000;
|
||||
case spv::OpTypeDeviceEvent: return 300001;
|
||||
case spv::OpTypeReserveId: return 300002;
|
||||
case spv::OpTypeQueue: return 300003;
|
||||
case spv::OpTypePipe: return 300004;
|
||||
case spv::OpConstantTrue: return 300007;
|
||||
case spv::OpConstantFalse: return 300008;
|
||||
case spv::OpTypeRayQueryKHR: return 300009;
|
||||
case spv::OpTypeAccelerationStructureKHR: return 300010;
|
||||
case spv::OpConstantComposite:
|
||||
{
|
||||
std::uint32_t hash = 300011 + hashType(idPos(spv[typeStart+1]));
|
||||
|
|
|
|||
|
|
@ -41,6 +41,21 @@
|
|||
#include <cstdlib>
|
||||
#include <exception>
|
||||
|
||||
#ifdef GLSLANG_IS_SHARED_LIBRARY
|
||||
#ifdef _WIN32
|
||||
#ifdef GLSLANG_EXPORTING
|
||||
#define GLSLANG_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define GLSLANG_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#elif __GNUC__ >= 4
|
||||
#define GLSLANG_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#endif // GLSLANG_IS_SHARED_LIBRARY
|
||||
#ifndef GLSLANG_EXPORT
|
||||
#define GLSLANG_EXPORT
|
||||
#endif
|
||||
|
||||
namespace spv {
|
||||
|
||||
class spirvbin_base_t
|
||||
|
|
@ -79,10 +94,11 @@ public:
|
|||
#include "spirv.hpp"
|
||||
|
||||
namespace spv {
|
||||
const Id NoResult = 0;
|
||||
|
||||
static inline constexpr Id NoResult = 0;
|
||||
|
||||
// class to hold SPIR-V binary data for remapping, DCE, and debug stripping
|
||||
class spirvbin_t : public spirvbin_base_t
|
||||
class GLSLANG_EXPORT spirvbin_t : public spirvbin_base_t
|
||||
{
|
||||
public:
|
||||
spirvbin_t(int verbose = 0) : entryPoint(spv::NoResult), largestNewId(0), verbose(verbose), errorLatch(false)
|
||||
|
|
|
|||
|
|
@ -439,6 +439,43 @@ Id Builder::makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id col
|
|||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
if (emitNonSemanticShaderDebugInfo)
|
||||
{
|
||||
// Find a name for one of the parameters. It can either come from debuginfo for another
|
||||
// type, or an OpName from a constant.
|
||||
auto const findName = [&](Id id) {
|
||||
Id id2 = debugId[id];
|
||||
for (auto &t : groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic]) {
|
||||
if (t->getResultId() == id2) {
|
||||
for (auto &s : strings) {
|
||||
if (s->getResultId() == t->getIdOperand(2)) {
|
||||
return s->getNameString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto &t : names) {
|
||||
if (t->getIdOperand(0) == id) {
|
||||
return t->getNameString();
|
||||
}
|
||||
}
|
||||
return "unknown";
|
||||
};
|
||||
std::string debugName = "coopmat<";
|
||||
debugName += std::string(findName(component)) + ", ";
|
||||
if (isConstantScalar(scope)) {
|
||||
debugName += std::string("gl_Scope") + std::string(spv::ScopeToString((spv::Scope)getConstantScalar(scope))) + ", ";
|
||||
} else {
|
||||
debugName += std::string(findName(scope)) + ", ";
|
||||
}
|
||||
debugName += std::string(findName(rows)) + ", ";
|
||||
debugName += std::string(findName(cols)) + ">";
|
||||
// There's no nonsemantic debug info instruction for cooperative matrix types,
|
||||
// use opaque composite instead.
|
||||
auto const debugResultId = makeCompositeDebugType({}, debugName.c_str(), NonSemanticShaderDebugInfo100Structure, true);
|
||||
debugId[type->getResultId()] = debugResultId;
|
||||
}
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
|
|
@ -478,6 +515,28 @@ Id Builder::makeCooperativeMatrixTypeWithSameShape(Id component, Id otherType)
|
|||
}
|
||||
}
|
||||
|
||||
Id Builder::makeCooperativeVectorTypeNV(Id componentType, Id components)
|
||||
{
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypeCooperativeVectorNV].size(); ++t) {
|
||||
type = groupedTypes[OpTypeCooperativeVectorNV][t];
|
||||
if (type->getIdOperand(0) == componentType &&
|
||||
type->getIdOperand(1) == components)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
// not found, make it
|
||||
type = new Instruction(getUniqueId(), NoType, OpTypeCooperativeVectorNV);
|
||||
type->addIdOperand(componentType);
|
||||
type->addIdOperand(components);
|
||||
groupedTypes[OpTypeCooperativeVectorNV].push_back(type);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands)
|
||||
{
|
||||
// try to find it
|
||||
|
|
@ -1326,6 +1385,7 @@ unsigned int Builder::getNumTypeConstituents(Id typeId) const
|
|||
case OpTypeVector:
|
||||
case OpTypeMatrix:
|
||||
return instr->getImmediateOperand(1);
|
||||
case OpTypeCooperativeVectorNV:
|
||||
case OpTypeArray:
|
||||
{
|
||||
Id lengthId = instr->getIdOperand(1);
|
||||
|
|
@ -1364,6 +1424,7 @@ Id Builder::getScalarTypeId(Id typeId) const
|
|||
case OpTypeArray:
|
||||
case OpTypeRuntimeArray:
|
||||
case OpTypePointer:
|
||||
case OpTypeCooperativeVectorNV:
|
||||
return getScalarTypeId(getContainedTypeId(typeId));
|
||||
default:
|
||||
assert(0);
|
||||
|
|
@ -1385,6 +1446,7 @@ Id Builder::getContainedTypeId(Id typeId, int member) const
|
|||
case OpTypeRuntimeArray:
|
||||
case OpTypeCooperativeMatrixKHR:
|
||||
case OpTypeCooperativeMatrixNV:
|
||||
case OpTypeCooperativeVectorNV:
|
||||
return instr->getIdOperand(0);
|
||||
case OpTypePointer:
|
||||
return instr->getIdOperand(1);
|
||||
|
|
@ -1767,7 +1829,7 @@ Id Builder::importNonSemanticShaderDebugInfoInstructions()
|
|||
return nonSemanticShaderDebugInfo;
|
||||
}
|
||||
|
||||
Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps)
|
||||
Id Builder::findCompositeConstant(Op typeClass, Op opcode, Id typeId, const std::vector<Id>& comps, size_t numMembers)
|
||||
{
|
||||
Instruction* constant = nullptr;
|
||||
bool found = false;
|
||||
|
|
@ -1777,6 +1839,13 @@ Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>
|
|||
if (constant->getTypeId() != typeId)
|
||||
continue;
|
||||
|
||||
if (constant->getOpCode() != opcode) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (constant->getNumOperands() != (int)numMembers)
|
||||
continue;
|
||||
|
||||
// same contents?
|
||||
bool mismatch = false;
|
||||
for (int op = 0; op < constant->getNumOperands(); ++op) {
|
||||
|
|
@ -1826,7 +1895,7 @@ Id Builder::makeCompositeConstant(Id typeId, const std::vector<Id>& members, boo
|
|||
|
||||
bool replicate = false;
|
||||
size_t numMembers = members.size();
|
||||
if (useReplicatedComposites) {
|
||||
if (useReplicatedComposites || typeClass == OpTypeCooperativeVectorNV) {
|
||||
// use replicate if all members are the same
|
||||
replicate = numMembers > 0 &&
|
||||
std::equal(members.begin() + 1, members.end(), members.begin());
|
||||
|
|
@ -1848,8 +1917,9 @@ Id Builder::makeCompositeConstant(Id typeId, const std::vector<Id>& members, boo
|
|||
case OpTypeMatrix:
|
||||
case OpTypeCooperativeMatrixKHR:
|
||||
case OpTypeCooperativeMatrixNV:
|
||||
case OpTypeCooperativeVectorNV:
|
||||
if (! specConstant) {
|
||||
Id existing = findCompositeConstant(typeClass, typeId, members);
|
||||
Id existing = findCompositeConstant(typeClass, opcode, typeId, members, numMembers);
|
||||
if (existing)
|
||||
return existing;
|
||||
}
|
||||
|
|
@ -1979,7 +2049,7 @@ void Builder::addDecoration(Id id, Decoration decoration, int num)
|
|||
if (num >= 0)
|
||||
dec->addImmediateOperand(num);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addDecoration(Id id, Decoration decoration, const char* s)
|
||||
|
|
@ -1993,7 +2063,7 @@ void Builder::addDecoration(Id id, Decoration decoration, const char* s)
|
|||
dec->addImmediateOperand(decoration);
|
||||
dec->addStringOperand(s);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addDecoration(Id id, Decoration decoration, const std::vector<unsigned>& literals)
|
||||
|
|
@ -2008,7 +2078,7 @@ void Builder::addDecoration(Id id, Decoration decoration, const std::vector<unsi
|
|||
for (auto literal : literals)
|
||||
dec->addImmediateOperand(literal);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addDecoration(Id id, Decoration decoration, const std::vector<const char*>& strings)
|
||||
|
|
@ -2023,7 +2093,7 @@ void Builder::addDecoration(Id id, Decoration decoration, const std::vector<cons
|
|||
for (auto string : strings)
|
||||
dec->addStringOperand(string);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addLinkageDecoration(Id id, const char* name, spv::LinkageType linkType) {
|
||||
|
|
@ -2034,7 +2104,7 @@ void Builder::addLinkageDecoration(Id id, const char* name, spv::LinkageType lin
|
|||
dec->addStringOperand(name);
|
||||
dec->addImmediateOperand(linkType);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addDecorationId(Id id, Decoration decoration, Id idDecoration)
|
||||
|
|
@ -2048,7 +2118,7 @@ void Builder::addDecorationId(Id id, Decoration decoration, Id idDecoration)
|
|||
dec->addImmediateOperand(decoration);
|
||||
dec->addIdOperand(idDecoration);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addDecorationId(Id id, Decoration decoration, const std::vector<Id>& operandIds)
|
||||
|
|
@ -2064,7 +2134,7 @@ void Builder::addDecorationId(Id id, Decoration decoration, const std::vector<Id
|
|||
for (auto operandId : operandIds)
|
||||
dec->addIdOperand(operandId);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, int num)
|
||||
|
|
@ -2080,7 +2150,7 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
|
|||
if (num >= 0)
|
||||
dec->addImmediateOperand(num);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, const char *s)
|
||||
|
|
@ -2095,7 +2165,7 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
|
|||
dec->addImmediateOperand(decoration);
|
||||
dec->addStringOperand(s);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, const std::vector<unsigned>& literals)
|
||||
|
|
@ -2111,7 +2181,7 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
|
|||
for (auto literal : literals)
|
||||
dec->addImmediateOperand(literal);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, const std::vector<const char*>& strings)
|
||||
|
|
@ -2127,10 +2197,16 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
|
|||
for (auto string : strings)
|
||||
dec->addStringOperand(string);
|
||||
|
||||
decorations.push_back(std::unique_ptr<Instruction>(dec));
|
||||
decorations.insert(std::unique_ptr<Instruction>(dec));
|
||||
}
|
||||
|
||||
void Builder::addInstruction(std::unique_ptr<Instruction> inst) {
|
||||
// Phis must appear first in their block, don't insert line tracking instructions
|
||||
// in front of them, just add the OpPhi and return.
|
||||
if (inst->getOpCode() == OpPhi) {
|
||||
buildPoint->addInstruction(std::move(inst));
|
||||
return;
|
||||
}
|
||||
// Optionally insert OpDebugScope
|
||||
if (emitNonSemanticShaderDebugInfo && dirtyScopeTracker) {
|
||||
if (buildPoint->updateDebugScope(currentDebugScopeId.top())) {
|
||||
|
|
@ -2176,6 +2252,10 @@ void Builder::addInstruction(std::unique_ptr<Instruction> inst) {
|
|||
buildPoint->addInstruction(std::move(inst));
|
||||
}
|
||||
|
||||
void Builder::addInstructionNoDebugInfo(std::unique_ptr<Instruction> inst) {
|
||||
buildPoint->addInstruction(std::move(inst));
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
Function* Builder::makeEntryPoint(const char* entryPoint)
|
||||
{
|
||||
|
|
@ -2236,14 +2316,13 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const
|
|||
return function;
|
||||
}
|
||||
|
||||
void Builder::setupDebugFunctionEntry(Function* function, const char* name, int line, const std::vector<Id>& paramTypes,
|
||||
const std::vector<char const*>& paramNames)
|
||||
void Builder::setupFunctionDebugInfo(Function* function, const char* name, const std::vector<Id>& paramTypes,
|
||||
const std::vector<char const*>& paramNames)
|
||||
{
|
||||
|
||||
if (!emitNonSemanticShaderDebugInfo)
|
||||
return;
|
||||
|
||||
currentLine = line;
|
||||
Id nameId = getStringId(unmangleFunctionName(name));
|
||||
Id funcTypeId = function->getFuncTypeId();
|
||||
assert(debugId[funcTypeId] != 0);
|
||||
|
|
@ -2315,7 +2394,7 @@ Id Builder::makeDebugFunction([[maybe_unused]] Function* function, Id nameId, Id
|
|||
return funcId;
|
||||
}
|
||||
|
||||
Id Builder::makeDebugLexicalBlock(uint32_t line) {
|
||||
Id Builder::makeDebugLexicalBlock(uint32_t line, uint32_t column) {
|
||||
assert(!currentDebugScopeId.empty());
|
||||
|
||||
Id lexId = getUniqueId();
|
||||
|
|
@ -2325,7 +2404,7 @@ Id Builder::makeDebugLexicalBlock(uint32_t line) {
|
|||
lex->addImmediateOperand(NonSemanticShaderDebugInfo100DebugLexicalBlock);
|
||||
lex->addIdOperand(makeDebugSource(currentFileId));
|
||||
lex->addIdOperand(makeUintConstant(line));
|
||||
lex->addIdOperand(makeUintConstant(0)); // column
|
||||
lex->addIdOperand(makeUintConstant(column)); // column
|
||||
lex->addIdOperand(currentDebugScopeId.top()); // scope
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(lex));
|
||||
module.mapInstruction(lex);
|
||||
|
|
@ -2358,10 +2437,14 @@ void Builder::makeReturn(bool implicit, Id retVal)
|
|||
}
|
||||
|
||||
// Comments in header
|
||||
void Builder::enterLexicalBlock(uint32_t line)
|
||||
void Builder::enterLexicalBlock(uint32_t line, uint32_t column)
|
||||
{
|
||||
if (!emitNonSemanticShaderDebugInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate new lexical scope debug instruction
|
||||
Id lexId = makeDebugLexicalBlock(line);
|
||||
Id lexId = makeDebugLexicalBlock(line, column);
|
||||
currentDebugScopeId.push(lexId);
|
||||
dirtyScopeTracker = true;
|
||||
}
|
||||
|
|
@ -2369,6 +2452,10 @@ void Builder::enterLexicalBlock(uint32_t line)
|
|||
// Comments in header
|
||||
void Builder::leaveLexicalBlock()
|
||||
{
|
||||
if (!emitNonSemanticShaderDebugInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Pop current scope from stack and clear current scope
|
||||
currentDebugScopeId.pop();
|
||||
dirtyScopeTracker = true;
|
||||
|
|
@ -2967,7 +3054,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)
|
|||
assert(getTypeId(scalar) == getScalarTypeId(vectorType));
|
||||
|
||||
int numComponents = getNumTypeComponents(vectorType);
|
||||
if (numComponents == 1)
|
||||
if (numComponents == 1 && !isCooperativeVectorType(vectorType))
|
||||
return scalar;
|
||||
|
||||
Instruction* smear = nullptr;
|
||||
|
|
@ -2984,7 +3071,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)
|
|||
auto result_id = makeCompositeConstant(vectorType, members, isSpecConstant(scalar));
|
||||
smear = module.getInstruction(result_id);
|
||||
} else {
|
||||
bool replicate = useReplicatedComposites && (numComponents > 0);
|
||||
bool replicate = (useReplicatedComposites || isCooperativeVectorType(vectorType)) && (numComponents > 0);
|
||||
|
||||
if (replicate) {
|
||||
numComponents = 1;
|
||||
|
|
@ -3098,6 +3185,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
|||
if (parameters.volatil) {
|
||||
mask = mask | ImageOperandsVolatileTexelKHRMask;
|
||||
}
|
||||
if (parameters.nontemporal) {
|
||||
mask = mask | ImageOperandsNontemporalMask;
|
||||
}
|
||||
mask = mask | signExtensionMask;
|
||||
// insert the operand for the mask, if any bits were set.
|
||||
if (mask != ImageOperandsMaskNone)
|
||||
|
|
@ -3371,7 +3461,8 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b
|
|||
Id Builder::createCompositeConstruct(Id typeId, const std::vector<Id>& constituents)
|
||||
{
|
||||
assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 &&
|
||||
getNumTypeConstituents(typeId) == constituents.size()));
|
||||
getNumTypeConstituents(typeId) == constituents.size()) ||
|
||||
(isCooperativeVectorType(typeId) && constituents.size() == 1));
|
||||
|
||||
if (generatingOpCodeForSpecConst) {
|
||||
// Sometime, even in spec-constant-op mode, the constant composite to be
|
||||
|
|
@ -3390,7 +3481,7 @@ Id Builder::createCompositeConstruct(Id typeId, const std::vector<Id>& constitue
|
|||
bool replicate = false;
|
||||
size_t numConstituents = constituents.size();
|
||||
|
||||
if (useReplicatedComposites) {
|
||||
if (useReplicatedComposites || isCooperativeVectorType(typeId)) {
|
||||
replicate = numConstituents > 0 &&
|
||||
std::equal(constituents.begin() + 1, constituents.end(), constituents.begin());
|
||||
}
|
||||
|
|
@ -3412,6 +3503,41 @@ Id Builder::createCompositeConstruct(Id typeId, const std::vector<Id>& constitue
|
|||
return op->getResultId();
|
||||
}
|
||||
|
||||
// coopmat conversion
|
||||
Id Builder::createCooperativeMatrixConversion(Id typeId, Id source)
|
||||
{
|
||||
Instruction* op = new Instruction(getUniqueId(), typeId, OpCooperativeMatrixConvertNV);
|
||||
op->addIdOperand(source);
|
||||
addInstruction(std::unique_ptr<Instruction>(op));
|
||||
|
||||
return op->getResultId();
|
||||
}
|
||||
|
||||
// coopmat reduce
|
||||
Id Builder::createCooperativeMatrixReduce(Op opcode, Id typeId, Id source, unsigned int mask, Id func)
|
||||
{
|
||||
Instruction* op = new Instruction(getUniqueId(), typeId, opcode);
|
||||
op->addIdOperand(source);
|
||||
op->addImmediateOperand(mask);
|
||||
op->addIdOperand(func);
|
||||
addInstruction(std::unique_ptr<Instruction>(op));
|
||||
|
||||
return op->getResultId();
|
||||
}
|
||||
|
||||
// coopmat per-element operation
|
||||
Id Builder::createCooperativeMatrixPerElementOp(Id typeId, const std::vector<Id>& operands)
|
||||
{
|
||||
Instruction* op = new Instruction(getUniqueId(), typeId, spv::OpCooperativeMatrixPerElementOpNV);
|
||||
// skip operand[0], which is where the result is stored
|
||||
for (uint32_t i = 1; i < operands.size(); ++i) {
|
||||
op->addIdOperand(operands[i]);
|
||||
}
|
||||
addInstruction(std::unique_ptr<Instruction>(op));
|
||||
|
||||
return op->getResultId();
|
||||
}
|
||||
|
||||
// Vector or scalar constructor
|
||||
Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId)
|
||||
{
|
||||
|
|
@ -3421,7 +3547,7 @@ Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sourc
|
|||
|
||||
// Special case: when calling a vector constructor with a single scalar
|
||||
// argument, smear the scalar
|
||||
if (sources.size() == 1 && isScalar(sources[0]) && numTargetComponents > 1)
|
||||
if (sources.size() == 1 && isScalar(sources[0]) && (numTargetComponents > 1 || isCooperativeVectorType(resultTypeId)))
|
||||
return smearScalar(precision, sources[0], resultTypeId);
|
||||
|
||||
// Special case: 2 vectors of equal size
|
||||
|
|
@ -3485,7 +3611,7 @@ Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sourc
|
|||
|
||||
if (isScalar(sources[i]) || isPointer(sources[i]))
|
||||
latchResult(sources[i]);
|
||||
else if (isVector(sources[i]))
|
||||
else if (isVector(sources[i]) || isCooperativeVector(sources[i]))
|
||||
accumulateVectorConstituents(sources[i]);
|
||||
else if (isMatrix(sources[i]))
|
||||
accumulateMatrixConstituents(sources[i]);
|
||||
|
|
@ -3654,6 +3780,7 @@ Builder::If::If(Id cond, unsigned int ctrl, Builder& gb) :
|
|||
// Save the current block, so that we can add in the flow control split when
|
||||
// makeEndIf is called.
|
||||
headerBlock = builder.getBuildPoint();
|
||||
builder.createSelectionMerge(mergeBlock, control);
|
||||
|
||||
function->addBlock(thenBlock);
|
||||
builder.setBuildPoint(thenBlock);
|
||||
|
|
@ -3663,7 +3790,7 @@ Builder::If::If(Id cond, unsigned int ctrl, Builder& gb) :
|
|||
void Builder::If::makeBeginElse()
|
||||
{
|
||||
// Close out the "then" by having it jump to the mergeBlock
|
||||
builder.createBranch(mergeBlock);
|
||||
builder.createBranch(true, mergeBlock);
|
||||
|
||||
// Make the first else block and add it to the function
|
||||
elseBlock = new Block(builder.getUniqueId(), *function);
|
||||
|
|
@ -3677,11 +3804,10 @@ void Builder::If::makeBeginElse()
|
|||
void Builder::If::makeEndIf()
|
||||
{
|
||||
// jump to the merge block
|
||||
builder.createBranch(mergeBlock);
|
||||
builder.createBranch(true, mergeBlock);
|
||||
|
||||
// Go back to the headerBlock and make the flow control split
|
||||
builder.setBuildPoint(headerBlock);
|
||||
builder.createSelectionMerge(mergeBlock, control);
|
||||
if (elseBlock)
|
||||
builder.createConditionalBranch(condition, thenBlock, elseBlock);
|
||||
else
|
||||
|
|
@ -3727,10 +3853,10 @@ void Builder::makeSwitch(Id selector, unsigned int control, int numSegments, con
|
|||
}
|
||||
|
||||
// Comments in header
|
||||
void Builder::addSwitchBreak()
|
||||
void Builder::addSwitchBreak(bool implicit)
|
||||
{
|
||||
// branch to the top of the merge block stack
|
||||
createBranch(switchMerges.top());
|
||||
createBranch(implicit, switchMerges.top());
|
||||
createAndSetNoPredecessorBlock("post-switch-break");
|
||||
}
|
||||
|
||||
|
|
@ -3741,7 +3867,7 @@ void Builder::nextSwitchSegment(std::vector<Block*>& segmentBlock, int nextSegme
|
|||
if (lastSegment >= 0) {
|
||||
// Close out previous segment by jumping, if necessary, to next segment
|
||||
if (! buildPoint->isTerminated())
|
||||
createBranch(segmentBlock[nextSegment]);
|
||||
createBranch(true, segmentBlock[nextSegment]);
|
||||
}
|
||||
Block* block = segmentBlock[nextSegment];
|
||||
block->getParent().addBlock(block);
|
||||
|
|
@ -3753,7 +3879,7 @@ void Builder::endSwitch(std::vector<Block*>& /*segmentBlock*/)
|
|||
{
|
||||
// Close out previous segment by jumping, if necessary, to next segment
|
||||
if (! buildPoint->isTerminated())
|
||||
addSwitchBreak();
|
||||
addSwitchBreak(true);
|
||||
|
||||
switchMerges.top()->getParent().addBlock(switchMerges.top());
|
||||
setBuildPoint(switchMerges.top());
|
||||
|
|
@ -3786,14 +3912,14 @@ Builder::LoopBlocks& Builder::makeNewLoop()
|
|||
|
||||
void Builder::createLoopContinue()
|
||||
{
|
||||
createBranch(&loops.top().continue_target);
|
||||
createBranch(false, &loops.top().continue_target);
|
||||
// Set up a block for dead code.
|
||||
createAndSetNoPredecessorBlock("post-loop-continue");
|
||||
}
|
||||
|
||||
void Builder::createLoopExit()
|
||||
{
|
||||
createBranch(&loops.top().merge);
|
||||
createBranch(false, &loops.top().merge);
|
||||
// Set up a block for dead code.
|
||||
createAndSetNoPredecessorBlock("post-loop-break");
|
||||
}
|
||||
|
|
@ -3932,6 +4058,9 @@ Id Builder::accessChainLoad(Decoration precision, Decoration l_nonUniform,
|
|||
if (constant) {
|
||||
id = createCompositeExtract(accessChain.base, swizzleBase, indexes);
|
||||
setPrecision(id, precision);
|
||||
} else if (isCooperativeVector(accessChain.base)) {
|
||||
assert(accessChain.indexChain.size() == 1);
|
||||
id = createVectorExtractDynamic(accessChain.base, resultType, accessChain.indexChain[0]);
|
||||
} else {
|
||||
Id lValue = NoResult;
|
||||
if (spvVersion >= Spv_1_4 && isValidInitializer(accessChain.base)) {
|
||||
|
|
@ -4235,11 +4364,16 @@ void Builder::createAndSetNoPredecessorBlock(const char* /*name*/)
|
|||
}
|
||||
|
||||
// Comments in header
|
||||
void Builder::createBranch(Block* block)
|
||||
void Builder::createBranch(bool implicit, Block* block)
|
||||
{
|
||||
Instruction* branch = new Instruction(OpBranch);
|
||||
branch->addIdOperand(block->getId());
|
||||
addInstruction(std::unique_ptr<Instruction>(branch));
|
||||
if (implicit) {
|
||||
addInstructionNoDebugInfo(std::unique_ptr<Instruction>(branch));
|
||||
}
|
||||
else {
|
||||
addInstruction(std::unique_ptr<Instruction>(branch));
|
||||
}
|
||||
block->addPredecessor(buildPoint);
|
||||
}
|
||||
|
||||
|
|
@ -4272,7 +4406,10 @@ void Builder::createConditionalBranch(Id condition, Block* thenBlock, Block* els
|
|||
branch->addIdOperand(condition);
|
||||
branch->addIdOperand(thenBlock->getId());
|
||||
branch->addIdOperand(elseBlock->getId());
|
||||
addInstruction(std::unique_ptr<Instruction>(branch));
|
||||
|
||||
// A conditional branch is always attached to a condition expression
|
||||
addInstructionNoDebugInfo(std::unique_ptr<Instruction>(branch));
|
||||
|
||||
thenBlock->addPredecessor(buildPoint);
|
||||
elseBlock->addPredecessor(buildPoint);
|
||||
}
|
||||
|
|
@ -4330,11 +4467,10 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
|
|||
dumpSourceInstructions(iItr->first, *iItr->second, out);
|
||||
}
|
||||
|
||||
void Builder::dumpInstructions(std::vector<unsigned int>& out,
|
||||
const std::vector<std::unique_ptr<Instruction> >& instructions) const
|
||||
template <class Range> void Builder::dumpInstructions(std::vector<unsigned int>& out, const Range& instructions) const
|
||||
{
|
||||
for (int i = 0; i < (int)instructions.size(); ++i) {
|
||||
instructions[i]->dump(out);
|
||||
for (const auto& inst : instructions) {
|
||||
inst->dump(out);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4347,4 +4483,40 @@ void Builder::dumpModuleProcesses(std::vector<unsigned int>& out) const
|
|||
}
|
||||
}
|
||||
|
||||
bool Builder::DecorationInstructionLessThan::operator()(const std::unique_ptr<Instruction>& lhs,
|
||||
const std::unique_ptr<Instruction>& rhs) const
|
||||
{
|
||||
// Order by the id to which the decoration applies first. This is more intuitive.
|
||||
assert(lhs->isIdOperand(0) && rhs->isIdOperand(0));
|
||||
if (lhs->getIdOperand(0) != rhs->getIdOperand(0)) {
|
||||
return lhs->getIdOperand(0) < rhs->getIdOperand(0);
|
||||
}
|
||||
|
||||
if (lhs->getOpCode() != rhs->getOpCode())
|
||||
return lhs->getOpCode() < rhs->getOpCode();
|
||||
|
||||
// Now compare the operands.
|
||||
int minSize = std::min(lhs->getNumOperands(), rhs->getNumOperands());
|
||||
for (int i = 1; i < minSize; ++i) {
|
||||
if (lhs->isIdOperand(i) != rhs->isIdOperand(i)) {
|
||||
return lhs->isIdOperand(i) < rhs->isIdOperand(i);
|
||||
}
|
||||
|
||||
if (lhs->isIdOperand(i)) {
|
||||
if (lhs->getIdOperand(i) != rhs->getIdOperand(i)) {
|
||||
return lhs->getIdOperand(i) < rhs->getIdOperand(i);
|
||||
}
|
||||
} else {
|
||||
if (lhs->getImmediateOperand(i) != rhs->getImmediateOperand(i)) {
|
||||
return lhs->getImmediateOperand(i) < rhs->getImmediateOperand(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lhs->getNumOperands() != rhs->getNumOperands())
|
||||
return lhs->getNumOperands() < rhs->getNumOperands();
|
||||
|
||||
// In this case they are equal.
|
||||
return false;
|
||||
}
|
||||
} // end spv namespace
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
#define SpvBuilder_H
|
||||
|
||||
#include "Logger.h"
|
||||
#define SPV_ENABLE_UTILITY_CODE
|
||||
#include "spirv.hpp"
|
||||
#include "spvIR.h"
|
||||
namespace spv {
|
||||
|
|
@ -56,6 +57,7 @@ namespace spv {
|
|||
}
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
|
@ -73,6 +75,7 @@ typedef enum {
|
|||
Spv_1_3 = (1 << 16) | (3 << 8),
|
||||
Spv_1_4 = (1 << 16) | (4 << 8),
|
||||
Spv_1_5 = (1 << 16) | (5 << 8),
|
||||
Spv_1_6 = (1 << 16) | (6 << 8),
|
||||
} SpvVersion;
|
||||
|
||||
class Builder {
|
||||
|
|
@ -107,7 +110,7 @@ public:
|
|||
spv::Id getMainFileId() const { return mainFileId; }
|
||||
|
||||
// Initialize the main source file name
|
||||
void setDebugSourceFile(const std::string& file)
|
||||
void setDebugMainSourceFile(const std::string& file)
|
||||
{
|
||||
if (trackDebugInfo) {
|
||||
dirtyLineTracker = true;
|
||||
|
|
@ -214,6 +217,7 @@ public:
|
|||
Id makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id cols, Id use);
|
||||
Id makeCooperativeMatrixTypeNV(Id component, Id scope, Id rows, Id cols);
|
||||
Id makeCooperativeMatrixTypeWithSameShape(Id component, Id otherType);
|
||||
Id makeCooperativeVectorTypeNV(Id componentType, Id components);
|
||||
Id makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands);
|
||||
|
||||
// SPIR-V NonSemantic Shader DebugInfo Instructions
|
||||
|
|
@ -245,11 +249,14 @@ public:
|
|||
Id makeDebugValue(Id const debugLocalVariable, Id const value);
|
||||
Id makeDebugFunctionType(Id returnType, const std::vector<Id>& paramTypes);
|
||||
Id makeDebugFunction(Function* function, Id nameId, Id funcTypeId);
|
||||
Id makeDebugLexicalBlock(uint32_t line);
|
||||
Id makeDebugLexicalBlock(uint32_t line, uint32_t column);
|
||||
std::string unmangleFunctionName(std::string const& name) const;
|
||||
void setupDebugFunctionEntry(Function* function, const char* name, int line,
|
||||
const std::vector<Id>& paramTypes,
|
||||
const std::vector<char const*>& paramNames);
|
||||
|
||||
// Initialize non-semantic debug information for a function, including those of:
|
||||
// - The function definition
|
||||
// - The function parameters
|
||||
void setupFunctionDebugInfo(Function* function, const char* name, const std::vector<Id>& paramTypes,
|
||||
const std::vector<char const*>& paramNames);
|
||||
|
||||
// accelerationStructureNV type
|
||||
Id makeAccelerationStructureType();
|
||||
|
|
@ -275,14 +282,17 @@ public:
|
|||
{ return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
|
||||
Id getResultingAccessChainType() const;
|
||||
Id getIdOperand(Id resultId, int idx) { return module.getInstruction(resultId)->getIdOperand(idx); }
|
||||
Id getCooperativeVectorNumComponents(Id typeId) const { return module.getInstruction(typeId)->getIdOperand(1); }
|
||||
|
||||
bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
|
||||
bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
|
||||
bool isVector(Id resultId) const { return isVectorType(getTypeId(resultId)); }
|
||||
bool isMatrix(Id resultId) const { return isMatrixType(getTypeId(resultId)); }
|
||||
bool isCooperativeMatrix(Id resultId)const { return isCooperativeMatrixType(getTypeId(resultId)); }
|
||||
bool isCooperativeVector(Id resultId)const { return isCooperativeVectorType(getTypeId(resultId)); }
|
||||
bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); }
|
||||
bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); }
|
||||
bool isTensorView(Id resultId)const { return isTensorViewType(getTypeId(resultId)); }
|
||||
|
||||
bool isBoolType(Id typeId)
|
||||
{ return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
|
||||
|
|
@ -303,6 +313,8 @@ public:
|
|||
{
|
||||
return getTypeClass(typeId) == OpTypeCooperativeMatrixKHR || getTypeClass(typeId) == OpTypeCooperativeMatrixNV;
|
||||
}
|
||||
bool isTensorViewType(Id typeId) const { return getTypeClass(typeId) == OpTypeTensorViewNV; }
|
||||
bool isCooperativeVectorType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeVectorNV; }
|
||||
bool isAggregateType(Id typeId) const
|
||||
{ return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
|
||||
bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
|
||||
|
|
@ -367,6 +379,8 @@ public:
|
|||
// For making new constants (will return old constant if the requested one was already made).
|
||||
Id makeNullConstant(Id typeId);
|
||||
Id makeBoolConstant(bool b, bool specConstant = false);
|
||||
Id makeIntConstant(Id typeId, unsigned value, bool specConstant);
|
||||
Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant);
|
||||
Id makeInt8Constant(int i, bool specConstant = false)
|
||||
{ return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); }
|
||||
Id makeUint8Constant(unsigned u, bool specConstant = false)
|
||||
|
|
@ -416,8 +430,7 @@ public:
|
|||
// Also reset current last DebugScope and current source line to unknown
|
||||
void setBuildPoint(Block* bp) {
|
||||
buildPoint = bp;
|
||||
// TODO: Technically, change of build point should set line tracker dirty. But we'll have bad line info for
|
||||
// branch instructions. Commenting this for now because at least this matches the old behavior.
|
||||
dirtyLineTracker = true;
|
||||
dirtyScopeTracker = true;
|
||||
}
|
||||
Block* getBuildPoint() const { return buildPoint; }
|
||||
|
|
@ -426,6 +439,11 @@ public:
|
|||
// Optionally, additional debug info instructions may also be prepended.
|
||||
void addInstruction(std::unique_ptr<Instruction> inst);
|
||||
|
||||
// Append an instruction to the end of the current build point without prepending any debug instructions.
|
||||
// This is useful for insertion of some debug info instructions themselves or some control flow instructions
|
||||
// that are attached to its predecessor instruction.
|
||||
void addInstructionNoDebugInfo(std::unique_ptr<Instruction> inst);
|
||||
|
||||
// Make the entry-point function. The returned pointer is only valid
|
||||
// for the lifetime of this builder.
|
||||
Function* makeEntryPoint(const char*);
|
||||
|
|
@ -442,7 +460,7 @@ public:
|
|||
void makeReturn(bool implicit, Id retVal = 0);
|
||||
|
||||
// Initialize state and generate instructions for new lexical scope
|
||||
void enterLexicalBlock(uint32_t line);
|
||||
void enterLexicalBlock(uint32_t line, uint32_t column);
|
||||
|
||||
// Set state and generate instructions to exit current lexical scope
|
||||
void leaveLexicalBlock();
|
||||
|
|
@ -573,6 +591,7 @@ public:
|
|||
Id coarse;
|
||||
bool nonprivate;
|
||||
bool volatil;
|
||||
bool nontemporal;
|
||||
};
|
||||
|
||||
// Select the correct texture operation based on all inputs, and emit the correct instruction
|
||||
|
|
@ -600,6 +619,11 @@ public:
|
|||
// matrix constructor
|
||||
Id createMatrixConstructor(Decoration precision, const std::vector<Id>& sources, Id constructee);
|
||||
|
||||
// coopmat conversion
|
||||
Id createCooperativeMatrixConversion(Id typeId, Id source);
|
||||
Id createCooperativeMatrixReduce(Op opcode, Id typeId, Id source, unsigned int mask, Id func);
|
||||
Id createCooperativeMatrixPerElementOp(Id typeId, const std::vector<Id>& operands);
|
||||
|
||||
// Helper to use for building nested control flow with if-then-else.
|
||||
class If {
|
||||
public:
|
||||
|
|
@ -639,7 +663,7 @@ public:
|
|||
const std::vector<int>& valueToSegment, int defaultSegment, std::vector<Block*>& segmentBB);
|
||||
|
||||
// Add a branch to the innermost switch's merge block.
|
||||
void addSwitchBreak();
|
||||
void addSwitchBreak(bool implicit);
|
||||
|
||||
// Move to the next code segment, passing in the return argument in makeSwitch()
|
||||
void nextSwitchSegment(std::vector<Block*>& segmentBB, int segment);
|
||||
|
|
@ -736,6 +760,7 @@ public:
|
|||
unsigned shadercallcoherent : 1;
|
||||
unsigned nonprivate : 1;
|
||||
unsigned volatil : 1;
|
||||
unsigned nontemporal : 1;
|
||||
unsigned isImage : 1;
|
||||
unsigned nonUniform : 1;
|
||||
|
||||
|
|
@ -748,6 +773,7 @@ public:
|
|||
shadercallcoherent = 0;
|
||||
nonprivate = 0;
|
||||
volatil = 0;
|
||||
nontemporal = 0;
|
||||
isImage = 0;
|
||||
nonUniform = 0;
|
||||
}
|
||||
|
|
@ -761,6 +787,7 @@ public:
|
|||
shadercallcoherent |= other.shadercallcoherent;
|
||||
nonprivate |= other.nonprivate;
|
||||
volatil |= other.volatil;
|
||||
nontemporal = other.nontemporal;
|
||||
isImage |= other.isImage;
|
||||
nonUniform |= other.nonUniform;
|
||||
return *this;
|
||||
|
|
@ -861,7 +888,9 @@ public:
|
|||
|
||||
void dump(std::vector<unsigned int>&) const;
|
||||
|
||||
void createBranch(Block* block);
|
||||
// Add a branch to the target block.
|
||||
// If set implicit, the branch instruction shouldn't have debug source location.
|
||||
void createBranch(bool implicit, Block* block);
|
||||
void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
|
||||
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
|
||||
const std::vector<unsigned int>& operands);
|
||||
|
|
@ -876,11 +905,9 @@ public:
|
|||
void setUseReplicatedComposites(bool use) { useReplicatedComposites = use; }
|
||||
|
||||
protected:
|
||||
Id makeIntConstant(Id typeId, unsigned value, bool specConstant);
|
||||
Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant);
|
||||
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value);
|
||||
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2);
|
||||
Id findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps);
|
||||
Id findCompositeConstant(Op typeClass, Op opcode, Id typeId, const std::vector<Id>& comps, size_t numMembers);
|
||||
Id findStructConstant(Id typeId, const std::vector<Id>& comps);
|
||||
Id collapseAccessChain();
|
||||
void remapDynamicSwizzle();
|
||||
|
|
@ -890,10 +917,13 @@ public:
|
|||
void createSelectionMerge(Block* mergeBlock, unsigned int control);
|
||||
void dumpSourceInstructions(std::vector<unsigned int>&) const;
|
||||
void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector<unsigned int>&) const;
|
||||
void dumpInstructions(std::vector<unsigned int>&, const std::vector<std::unique_ptr<Instruction> >&) const;
|
||||
template <class Range> void dumpInstructions(std::vector<unsigned int>& out, const Range& instructions) const;
|
||||
void dumpModuleProcesses(std::vector<unsigned int>&) const;
|
||||
spv::MemoryAccessMask sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc)
|
||||
const;
|
||||
struct DecorationInstructionLessThan {
|
||||
bool operator()(const std::unique_ptr<Instruction>& lhs, const std::unique_ptr<Instruction>& rhs) const;
|
||||
};
|
||||
|
||||
unsigned int spvVersion; // the version of SPIR-V to emit in the header
|
||||
SourceLanguage sourceLang;
|
||||
|
|
@ -950,7 +980,7 @@ public:
|
|||
std::vector<std::unique_ptr<Instruction> > entryPoints;
|
||||
std::vector<std::unique_ptr<Instruction> > executionModes;
|
||||
std::vector<std::unique_ptr<Instruction> > names;
|
||||
std::vector<std::unique_ptr<Instruction> > decorations;
|
||||
std::set<std::unique_ptr<Instruction>, DecorationInstructionLessThan> decorations;
|
||||
std::vector<std::unique_ptr<Instruction> > constantsTypesGlobals;
|
||||
std::vector<std::unique_ptr<Instruction> > externals;
|
||||
std::vector<std::unique_ptr<Function> > functions;
|
||||
|
|
@ -990,6 +1020,6 @@ public:
|
|||
SpvBuildLogger* logger;
|
||||
}; // end Builder class
|
||||
|
||||
}; // end spv namespace
|
||||
} // end spv namespace
|
||||
|
||||
#endif // SpvBuilder_H
|
||||
|
|
|
|||
|
|
@ -387,12 +387,14 @@ void Builder::postProcessCFG()
|
|||
}
|
||||
|
||||
// Remove unneeded decorations, for unreachable instructions
|
||||
decorations.erase(std::remove_if(decorations.begin(), decorations.end(),
|
||||
[&unreachableDefinitions](std::unique_ptr<Instruction>& I) -> bool {
|
||||
Id decoration_id = I.get()->getIdOperand(0);
|
||||
return unreachableDefinitions.count(decoration_id) != 0;
|
||||
}),
|
||||
decorations.end());
|
||||
for (auto decorationIter = decorations.begin(); decorationIter != decorations.end();) {
|
||||
Id decorationId = (*decorationIter)->getIdOperand(0);
|
||||
if (unreachableDefinitions.count(decorationId) != 0) {
|
||||
decorationIter = decorations.erase(decorationIter);
|
||||
} else {
|
||||
++decorationIter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// comment in header
|
||||
|
|
@ -546,4 +548,4 @@ void Builder::postProcess(bool compileOnly)
|
|||
postProcessSamplers();
|
||||
}
|
||||
|
||||
}; // end spv namespace
|
||||
} // end spv namespace
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#include "SpvTools.h"
|
||||
#include "spirv-tools/optimizer.hpp"
|
||||
#include "glslang/MachineIndependent/localintermediate.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
|
|
@ -70,6 +71,8 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
|
|||
return spv_target_env::SPV_ENV_VULKAN_1_2;
|
||||
case glslang::EShTargetVulkan_1_3:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_3;
|
||||
case glslang::EShTargetVulkan_1_4:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_4;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -81,6 +84,11 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
|
|||
return spv_target_env::SPV_ENV_UNIVERSAL_1_0;
|
||||
}
|
||||
|
||||
spv_target_env MapToSpirvToolsEnv(const glslang::TIntermediate& intermediate, spv::SpvBuildLogger* logger)
|
||||
{
|
||||
return MapToSpirvToolsEnv(intermediate.getSpv(), logger);
|
||||
}
|
||||
|
||||
// Callback passed to spvtools::Optimizer::SetMessageConsumer
|
||||
void OptimizerMesssageConsumer(spv_message_level_t level, const char *source,
|
||||
const spv_position_t &position, const char *message)
|
||||
|
|
@ -157,6 +165,7 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
|
|||
spvValidatorOptionsSetBeforeHlslLegalization(options, prelegalization);
|
||||
spvValidatorOptionsSetScalarBlockLayout(options, intermediate.usingScalarBlockLayout());
|
||||
spvValidatorOptionsSetWorkgroupScalarBlockLayout(options, intermediate.usingScalarBlockLayout());
|
||||
spvValidatorOptionsSetAllowOffsetTextureOperand(options, intermediate.usingTextureOffsetNonConst());
|
||||
spvValidateWithOptions(context, options, &binary, &diagnostic);
|
||||
|
||||
// report
|
||||
|
|
@ -218,9 +227,20 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector
|
|||
optimizer.RegisterPass(spvtools::CreateCFGCleanupPass());
|
||||
|
||||
spvtools::OptimizerOptions spvOptOptions;
|
||||
if (options->optimizerAllowExpandedIDBound)
|
||||
spvOptOptions.set_max_id_bound(0x3FFFFFFF);
|
||||
optimizer.SetTargetEnv(MapToSpirvToolsEnv(intermediate.getSpv(), logger));
|
||||
spvOptOptions.set_run_validator(false); // The validator may run as a separate step later on
|
||||
optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
|
||||
|
||||
if (options->optimizerAllowExpandedIDBound) {
|
||||
if (spirv.size() > 3 && spirv[3] > kDefaultMaxIdBound) {
|
||||
spvtools::Optimizer optimizer2(target_env);
|
||||
optimizer2.SetMessageConsumer(OptimizerMesssageConsumer);
|
||||
optimizer2.RegisterPass(spvtools::CreateCompactIdsPass());
|
||||
optimizer2.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
|
||||
|
|
@ -292,6 +312,6 @@ void SpirvToolsStripDebugInfo(const glslang::TIntermediate& intermediate,
|
|||
optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
|
||||
}
|
||||
|
||||
}; // end namespace glslang
|
||||
} // end namespace glslang
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -44,10 +44,12 @@
|
|||
#if ENABLE_OPT
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include <unordered_set>
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#endif
|
||||
|
||||
#include "../glslang/MachineIndependent/localintermediate.h"
|
||||
#include "glslang/glslang/MachineIndependent/Versions.h"
|
||||
#include "glslang/glslang/Include/visibility.h"
|
||||
#include "GlslangToSpv.h"
|
||||
#include "Logger.h"
|
||||
|
||||
|
|
@ -55,45 +57,50 @@ namespace glslang {
|
|||
|
||||
#if ENABLE_OPT
|
||||
|
||||
class TIntermediate;
|
||||
|
||||
// Translate glslang's view of target versioning to what SPIRV-Tools uses.
|
||||
spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger);
|
||||
GLSLANG_EXPORT spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger);
|
||||
GLSLANG_EXPORT spv_target_env MapToSpirvToolsEnv(const glslang::TIntermediate& intermediate, spv::SpvBuildLogger* logger);
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment.
|
||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
|
||||
GLSLANG_EXPORT void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V with a provided SPIR-V environment.
|
||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv,
|
||||
spv_target_env requested_context);
|
||||
GLSLANG_EXPORT void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv,
|
||||
spv_target_env requested_context);
|
||||
|
||||
// Apply the SPIRV-Tools validator to generated SPIR-V.
|
||||
void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*, bool prelegalization);
|
||||
GLSLANG_EXPORT void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*, bool prelegalization);
|
||||
|
||||
// Apply the SPIRV-Tools optimizer to generated SPIR-V. HLSL SPIR-V is legalized in the process.
|
||||
void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*, const SpvOptions*);
|
||||
GLSLANG_EXPORT void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*, const SpvOptions*);
|
||||
|
||||
// Apply the SPIRV-Tools EliminateDeadInputComponents pass to generated SPIR-V. Put result in |spirv|.
|
||||
void SpirvToolsEliminateDeadInputComponents(spv_target_env target_env, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*);
|
||||
GLSLANG_EXPORT void SpirvToolsEliminateDeadInputComponents(spv_target_env target_env, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*);
|
||||
|
||||
// Apply the SPIRV-Tools AnalyzeDeadOutputStores pass to generated SPIR-V. Put result in |live_locs|.
|
||||
// Return true if the result is valid.
|
||||
bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
|
||||
std::unordered_set<uint32_t>* live_locs,
|
||||
std::unordered_set<uint32_t>* live_builtins, spv::SpvBuildLogger*);
|
||||
GLSLANG_EXPORT bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
|
||||
std::unordered_set<uint32_t>* live_locs,
|
||||
std::unordered_set<uint32_t>* live_builtins,
|
||||
spv::SpvBuildLogger*);
|
||||
|
||||
// Apply the SPIRV-Tools EliminateDeadOutputStores and AggressiveDeadCodeElimination passes to generated SPIR-V using
|
||||
// |live_locs|. Put result in |spirv|.
|
||||
void SpirvToolsEliminateDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
|
||||
std::unordered_set<uint32_t>* live_locs,
|
||||
std::unordered_set<uint32_t>* live_builtins, spv::SpvBuildLogger*);
|
||||
GLSLANG_EXPORT void SpirvToolsEliminateDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
|
||||
std::unordered_set<uint32_t>* live_locs,
|
||||
std::unordered_set<uint32_t>* live_builtins,
|
||||
spv::SpvBuildLogger*);
|
||||
|
||||
// Apply the SPIRV-Tools optimizer to strip debug info from SPIR-V. This is implicitly done by
|
||||
// SpirvToolsTransform if spvOptions->stripDebugInfo is set, but can be called separately if
|
||||
// optimization is disabled.
|
||||
void SpirvToolsStripDebugInfo(const glslang::TIntermediate& intermediate,
|
||||
std::vector<unsigned int>& spirv, spv::SpvBuildLogger*);
|
||||
GLSLANG_EXPORT void SpirvToolsStripDebugInfo(const glslang::TIntermediate& intermediate,
|
||||
std::vector<unsigned int>& spirv, spv::SpvBuildLogger*);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
// Disassembler for SPIR-V.
|
||||
//
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
|
@ -338,6 +339,18 @@ int SpirvStream::disassembleString()
|
|||
return decoderes.first;
|
||||
}
|
||||
|
||||
static uint32_t popcount(uint32_t mask)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
while (mask) {
|
||||
if (mask & 1) {
|
||||
count++;
|
||||
}
|
||||
mask >>= 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
|
||||
{
|
||||
// Process the opcode
|
||||
|
|
@ -552,18 +565,41 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
|||
numOperands -= disassembleString();
|
||||
return;
|
||||
case OperandMemoryAccess:
|
||||
outputMask(OperandMemoryAccess, stream[word++]);
|
||||
--numOperands;
|
||||
// Aligned is the only memory access operand that uses an immediate
|
||||
// value, and it is also the first operand that uses a value at all.
|
||||
if (stream[word-1] & MemoryAccessAlignedMask) {
|
||||
disassembleImmediates(1);
|
||||
numOperands--;
|
||||
if (numOperands)
|
||||
{
|
||||
outputMask(OperandMemoryAccess, stream[word++]);
|
||||
--numOperands;
|
||||
// Put a space after "None" if there are any remaining operands
|
||||
if (numOperands && stream[word-1] == 0) {
|
||||
out << " ";
|
||||
}
|
||||
uint32_t mask = stream[word-1];
|
||||
// Aligned is the only memory access operand that uses an immediate
|
||||
// value, and it is also the first operand that uses a value at all.
|
||||
if (mask & MemoryAccessAlignedMask) {
|
||||
disassembleImmediates(1);
|
||||
numOperands--;
|
||||
if (numOperands)
|
||||
out << " ";
|
||||
}
|
||||
|
||||
uint32_t bitCount = popcount(mask & (MemoryAccessMakePointerAvailableMask | MemoryAccessMakePointerVisibleMask));
|
||||
disassembleIds(bitCount);
|
||||
numOperands -= bitCount;
|
||||
}
|
||||
disassembleIds(numOperands);
|
||||
return;
|
||||
break;
|
||||
case OperandTensorAddressingOperands:
|
||||
{
|
||||
outputMask(OperandTensorAddressingOperands, stream[word++]);
|
||||
--numOperands;
|
||||
// Put a space after "None" if there are any remaining operands
|
||||
if (numOperands && stream[word-1] == 0) {
|
||||
out << " ";
|
||||
}
|
||||
uint32_t bitCount = popcount(stream[word-1]);
|
||||
disassembleIds(bitCount);
|
||||
numOperands -= bitCount;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(operandClass >= OperandSource && operandClass < OperandOpcode);
|
||||
|
||||
|
|
@ -825,4 +861,4 @@ void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
|
|||
SpirvStream.processInstructions();
|
||||
}
|
||||
|
||||
}; // end namespace spv
|
||||
} // end namespace spv
|
||||
|
|
|
|||
|
|
@ -43,10 +43,12 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "glslang/glslang/Include/visibility.h"
|
||||
|
||||
namespace spv {
|
||||
|
||||
// disassemble with glslang custom disassembler
|
||||
void Disassemble(std::ostream& out, const std::vector<unsigned int>&);
|
||||
GLSLANG_EXPORT void Disassemble(std::ostream& out, const std::vector<unsigned int>&);
|
||||
|
||||
} // end namespace spv
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// Copyright (C) 2014-2015 LunarG, Inc.
|
||||
// Copyright (C) 2022-2024 Arm Limited.
|
||||
// Copyright (C) 2022-2025 Arm Limited.
|
||||
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// All rights reserved.
|
||||
|
|
@ -424,6 +424,12 @@ const char* BuiltInString(int builtIn)
|
|||
case BuiltInHitMicroTriangleVertexBarycentricsNV: return "HitMicroTriangleVertexBarycentricsNV";
|
||||
case BuiltInHitKindFrontFacingMicroTriangleNV: return "HitKindFrontFacingMicroTriangleNV";
|
||||
case BuiltInHitKindBackFacingMicroTriangleNV: return "HitKindBackFacingMicroTriangleNV";
|
||||
case BuiltInHitIsSphereNV: return "HitIsSphereNV";
|
||||
case BuiltInHitIsLSSNV: return "HitIsLSSNV";
|
||||
case BuiltInHitSpherePositionNV: return "HitSpherePositionNV";
|
||||
case BuiltInHitSphereRadiusNV: return "HitSphereRadiusNV";
|
||||
case BuiltInHitLSSPositionsNV: return "HitLSSPositionsNV";
|
||||
case BuiltInHitLSSRadiiNV: return "HitLLSSRadiiNV";
|
||||
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
|
||||
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
|
||||
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
|
||||
|
|
@ -440,6 +446,7 @@ const char* BuiltInString(int builtIn)
|
|||
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
|
||||
case BuiltInBaryCoordKHR: return "BaryCoordKHR";
|
||||
case BuiltInBaryCoordNoPerspKHR: return "BaryCoordNoPerspKHR";
|
||||
case BuiltInClusterIDNV: return "ClusterIDNV";
|
||||
|
||||
case BuiltInFragSizeEXT: return "FragSizeEXT";
|
||||
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||
|
|
@ -630,7 +637,7 @@ const char* ImageChannelDataTypeString(int type)
|
|||
}
|
||||
}
|
||||
|
||||
const int ImageOperandsCeiling = 14;
|
||||
const int ImageOperandsCeiling = 15;
|
||||
|
||||
const char* ImageOperandsString(int format)
|
||||
{
|
||||
|
|
@ -649,6 +656,7 @@ const char* ImageOperandsString(int format)
|
|||
case ImageOperandsVolatileTexelKHRShift: return "VolatileTexelKHR";
|
||||
case ImageOperandsSignExtendShift: return "SignExtend";
|
||||
case ImageOperandsZeroExtendShift: return "ZeroExtend";
|
||||
case ImageOperandsNontemporalShift: return "Nontemporal";
|
||||
|
||||
case ImageOperandsCeiling:
|
||||
default:
|
||||
|
|
@ -818,6 +826,18 @@ const char* CooperativeMatrixOperandsString(int op)
|
|||
}
|
||||
}
|
||||
|
||||
const int TensorAddressingOperandsCeiling = 3;
|
||||
|
||||
const char* TensorAddressingOperandsString(int op)
|
||||
{
|
||||
switch (op) {
|
||||
case TensorAddressingOperandsTensorViewShift: return "TensorView";
|
||||
case TensorAddressingOperandsDecodeFuncShift: return "DecodeFunc";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
}
|
||||
|
||||
const char* ScopeString(int mem)
|
||||
{
|
||||
switch (mem) {
|
||||
|
|
@ -989,6 +1009,7 @@ const char* CapabilityString(int info)
|
|||
case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
|
||||
case CapabilityRayTracingPositionFetchKHR: return "RayTracingPositionFetchKHR";
|
||||
case CapabilityDisplacementMicromapNV: return "DisplacementMicromapNV";
|
||||
case CapabilityRayTracingOpacityMicromapEXT: return "RayTracingOpacityMicromapEXT";
|
||||
case CapabilityRayTracingDisplacementMicromapNV: return "CapabilityRayTracingDisplacementMicromapNV";
|
||||
case CapabilityRayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR";
|
||||
case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV";
|
||||
|
|
@ -1025,8 +1046,18 @@ const char* CapabilityString(int info)
|
|||
|
||||
case CapabilityCooperativeMatrixNV: return "CooperativeMatrixNV";
|
||||
case CapabilityCooperativeMatrixKHR: return "CooperativeMatrixKHR";
|
||||
case CapabilityCooperativeMatrixReductionsNV: return "CooperativeMatrixReductionsNV";
|
||||
case CapabilityCooperativeMatrixConversionsNV: return "CooperativeMatrixConversionsNV";
|
||||
case CapabilityCooperativeMatrixPerElementOperationsNV: return "CooperativeMatrixPerElementOperationsNV";
|
||||
case CapabilityCooperativeMatrixTensorAddressingNV: return "CooperativeMatrixTensorAddressingNV";
|
||||
case CapabilityCooperativeMatrixBlockLoadsNV: return "CooperativeMatrixBlockLoadsNV";
|
||||
case CapabilityTensorAddressingNV: return "TensorAddressingNV";
|
||||
|
||||
case CapabilityShaderSMBuiltinsNV: return "ShaderSMBuiltinsNV";
|
||||
|
||||
case CapabilityCooperativeVectorNV: return "CooperativeVectorNV";
|
||||
case CapabilityCooperativeVectorTrainingNV: return "CooperativeVectorTrainingNV";
|
||||
|
||||
case CapabilityFragmentShaderSampleInterlockEXT: return "CapabilityFragmentShaderSampleInterlockEXT";
|
||||
case CapabilityFragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT";
|
||||
case CapabilityFragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT";
|
||||
|
|
@ -1070,6 +1101,15 @@ const char* CapabilityString(int info)
|
|||
|
||||
case CapabilityReplicatedCompositesEXT: return "CapabilityReplicatedCompositesEXT";
|
||||
|
||||
case CapabilityDotProductKHR: return "DotProductKHR";
|
||||
case CapabilityDotProductInputAllKHR: return "DotProductInputAllKHR";
|
||||
case CapabilityDotProductInput4x8BitKHR: return "DotProductInput4x8BitKHR";
|
||||
case CapabilityDotProductInput4x8BitPackedKHR: return "DotProductInput4x8BitPackedKHR";
|
||||
|
||||
case CapabilityRayTracingClusterAccelerationStructureNV: return "RayTracingClusterAccelerationStructureNV";
|
||||
|
||||
case CapabilityRayTracingSpheresGeometryNV: return "RayTracingSpheresGeometryNV";
|
||||
case CapabilityRayTracingLinearSweptSpheresGeometryNV: return "RayTracingLinearSweptSpheresGeometryNV";
|
||||
default: return "Bad";
|
||||
}
|
||||
}
|
||||
|
|
@ -1522,6 +1562,15 @@ const char* OpcodeString(int op)
|
|||
case OpRayQueryGetIntersectionObjectToWorldKHR: return "OpRayQueryGetIntersectionObjectToWorldKHR";
|
||||
case OpRayQueryGetIntersectionWorldToObjectKHR: return "OpRayQueryGetIntersectionWorldToObjectKHR";
|
||||
case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: return "OpRayQueryGetIntersectionTriangleVertexPositionsKHR";
|
||||
case OpRayQueryGetIntersectionClusterIdNV: return "OpRayQueryGetIntersectionClusterIdNV";
|
||||
|
||||
case OpRayQueryGetIntersectionSpherePositionNV: return "OpRayQueryGetIntersectionSpherePositionNV";
|
||||
case OpRayQueryGetIntersectionSphereRadiusNV: return "OpRayQueryGetIntersectionSphereRadiusNV";
|
||||
case OpRayQueryGetIntersectionLSSHitValueNV: return "OpRayQueryGetIntersectionLSSHitValueNV";
|
||||
case OpRayQueryGetIntersectionLSSPositionsNV: return "OpRayQueryGetIntersectionLSSPositionsNV";
|
||||
case OpRayQueryGetIntersectionLSSRadiiNV: return "OpRayQueryGetIntersectionLSSRadiiNV";
|
||||
case OpRayQueryIsSphereHitNV: return "OpRayQueryIsSphereHitNV";
|
||||
case OpRayQueryIsLSSHitNV: return "OpRayQueryIsLSSHitNV";
|
||||
|
||||
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
|
||||
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
|
||||
|
|
@ -1536,6 +1585,33 @@ const char* OpcodeString(int op)
|
|||
case OpDemoteToHelperInvocationEXT: return "OpDemoteToHelperInvocationEXT";
|
||||
case OpIsHelperInvocationEXT: return "OpIsHelperInvocationEXT";
|
||||
|
||||
case OpCooperativeMatrixConvertNV: return "OpCooperativeMatrixConvertNV";
|
||||
case OpCooperativeMatrixTransposeNV: return "OpCooperativeMatrixTransposeNV";
|
||||
case OpCooperativeMatrixReduceNV: return "OpCooperativeMatrixReduceNV";
|
||||
case OpCooperativeMatrixLoadTensorNV: return "OpCooperativeMatrixLoadTensorNV";
|
||||
case OpCooperativeMatrixStoreTensorNV: return "OpCooperativeMatrixStoreTensorNV";
|
||||
case OpCooperativeMatrixPerElementOpNV: return "OpCooperativeMatrixPerElementOpNV";
|
||||
case OpTypeTensorLayoutNV: return "OpTypeTensorLayoutNV";
|
||||
case OpTypeTensorViewNV: return "OpTypeTensorViewNV";
|
||||
case OpCreateTensorLayoutNV: return "OpCreateTensorLayoutNV";
|
||||
case OpTensorLayoutSetBlockSizeNV: return "OpTensorLayoutSetBlockSizeNV";
|
||||
case OpTensorLayoutSetDimensionNV: return "OpTensorLayoutSetDimensionNV";
|
||||
case OpTensorLayoutSetStrideNV: return "OpTensorLayoutSetStrideNV";
|
||||
case OpTensorLayoutSliceNV: return "OpTensorLayoutSliceNV";
|
||||
case OpTensorLayoutSetClampValueNV: return "OpTensorLayoutSetClampValueNV";
|
||||
case OpCreateTensorViewNV: return "OpCreateTensorViewNV";
|
||||
case OpTensorViewSetDimensionNV: return "OpTensorViewSetDimensionNV";
|
||||
case OpTensorViewSetStrideNV: return "OpTensorViewSetStrideNV";
|
||||
case OpTensorViewSetClipNV: return "OpTensorViewSetClipNV";
|
||||
|
||||
case OpTypeCooperativeVectorNV: return "OpTypeCooperativeVectorNV";
|
||||
case OpCooperativeVectorMatrixMulNV: return "OpCooperativeVectorMatrixMulNV";
|
||||
case OpCooperativeVectorMatrixMulAddNV: return "OpCooperativeVectorMatrixMulAddNV";
|
||||
case OpCooperativeVectorLoadNV: return "OpCooperativeVectorLoadNV";
|
||||
case OpCooperativeVectorStoreNV: return "OpCooperativeVectorStoreNV";
|
||||
case OpCooperativeVectorOuterProductAccumulateNV: return "OpCooperativeVectorOuterProductAccumulateNV";
|
||||
case OpCooperativeVectorReduceSumAccumulateNV: return "OpCooperativeVectorReduceSumAccumulateNV";
|
||||
|
||||
case OpBeginInvocationInterlockEXT: return "OpBeginInvocationInterlockEXT";
|
||||
case OpEndInvocationInterlockEXT: return "OpEndInvocationInterlockEXT";
|
||||
|
||||
|
|
@ -1572,6 +1648,13 @@ const char* OpcodeString(int op)
|
|||
case OpHitObjectIsMissNV: return "OpHitObjectIsMissNV";
|
||||
case OpHitObjectGetShaderBindingTableRecordIndexNV: return "OpHitObjectGetShaderBindingTableRecordIndexNV";
|
||||
case OpHitObjectGetShaderRecordBufferHandleNV: return "OpHitObjectGetShaderRecordBufferHandleNV";
|
||||
case OpHitObjectGetClusterIdNV: return "OpHitObjectGetClusterIdNV";
|
||||
case OpHitObjectGetSpherePositionNV: return "OpHitObjectGetSpherePositionNV";
|
||||
case OpHitObjectGetSphereRadiusNV: return "OpHitObjectGetSphereRadiusNV";
|
||||
case OpHitObjectGetLSSPositionsNV: return "OpHitObjectGetLSSPositionsNV";
|
||||
case OpHitObjectGetLSSRadiiNV: return "OpHitObjectGetLSSRadiiNV";
|
||||
case OpHitObjectIsSphereHitNV: return "OpHitObjectIsSphereHitNV";
|
||||
case OpHitObjectIsLSSHitNV: return "OpHitObjectIsLSSHitNV";
|
||||
|
||||
case OpFetchMicroTriangleVertexBarycentricNV: return "OpFetchMicroTriangleVertexBarycentricNV";
|
||||
case OpFetchMicroTriangleVertexPositionNV: return "OpFetchMicroTriangleVertexPositionNV";
|
||||
|
|
@ -1593,6 +1676,13 @@ const char* OpcodeString(int op)
|
|||
case OpSpecConstantCompositeReplicateEXT: return "OpSpecConstantCompositeReplicateEXT";
|
||||
case OpCompositeConstructReplicateEXT: return "OpCompositeConstructReplicateEXT";
|
||||
|
||||
case OpSDotKHR: return "OpSDotKHR";
|
||||
case OpUDotKHR: return "OpUDotKHR";
|
||||
case OpSUDotKHR: return "OpSUDotKHR";
|
||||
case OpSDotAccSatKHR: return "OpSDotAccSatKHR";
|
||||
case OpUDotAccSatKHR: return "OpUDotAccSatKHR";
|
||||
case OpSUDotAccSatKHR: return "OpSUDotAccSatKHR";
|
||||
|
||||
default:
|
||||
return "Bad";
|
||||
}
|
||||
|
|
@ -1613,6 +1703,7 @@ EnumParameters SelectionControlParams[SelectControlCeiling];
|
|||
EnumParameters FunctionControlParams[FunctionControlCeiling];
|
||||
EnumParameters MemoryAccessParams[MemoryAccessCeiling];
|
||||
EnumParameters CooperativeMatrixOperandsParams[CooperativeMatrixOperandsCeiling];
|
||||
EnumParameters TensorAddressingOperandsParams[TensorAddressingOperandsCeiling];
|
||||
|
||||
// Set up all the parameterizing descriptions of the opcodes, operands, etc.
|
||||
void Parameterize()
|
||||
|
|
@ -1712,6 +1803,14 @@ void Parameterize()
|
|||
InstructionDesc[OpBeginInvocationInterlockEXT].setResultAndType(false, false);
|
||||
InstructionDesc[OpEndInvocationInterlockEXT].setResultAndType(false, false);
|
||||
InstructionDesc[OpAssumeTrueKHR].setResultAndType(false, false);
|
||||
InstructionDesc[OpTypeTensorLayoutNV].setResultAndType(true, false);
|
||||
InstructionDesc[OpTypeTensorViewNV].setResultAndType(true, false);
|
||||
InstructionDesc[OpCooperativeMatrixStoreTensorNV].setResultAndType(false, false);
|
||||
InstructionDesc[OpTypeCooperativeVectorNV].setResultAndType(true, false);
|
||||
InstructionDesc[OpCooperativeVectorStoreNV].setResultAndType(false, false);
|
||||
InstructionDesc[OpCooperativeVectorOuterProductAccumulateNV].setResultAndType(false, false);
|
||||
InstructionDesc[OpCooperativeVectorReduceSumAccumulateNV].setResultAndType(false, false);
|
||||
|
||||
// Specific additional context-dependent operands
|
||||
|
||||
ExecutionModeOperands[ExecutionModeInvocations].push(OperandLiteralNumber, "'Number of <<Invocation,invocations>>'");
|
||||
|
|
@ -1781,6 +1880,7 @@ void Parameterize()
|
|||
OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true);
|
||||
OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr);
|
||||
OperandClassParams[OperandCooperativeMatrixOperands].set(CooperativeMatrixOperandsCeiling, CooperativeMatrixOperandsString, CooperativeMatrixOperandsParams, true);
|
||||
OperandClassParams[OperandTensorAddressingOperands].set(TensorAddressingOperandsCeiling, TensorAddressingOperandsString, TensorAddressingOperandsParams, true);
|
||||
OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, nullptr);
|
||||
|
||||
// set name of operator, an initial set of <id> style operands, and the description
|
||||
|
|
@ -3142,6 +3242,37 @@ void Parameterize()
|
|||
InstructionDesc[OpRayQueryGetIntersectionTriangleVertexPositionsKHR].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionTriangleVertexPositionsKHR].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].setResultAndType(true, true);
|
||||
InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpRayQueryIsSphereHitNV].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryIsSphereHitNV].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryIsSphereHitNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpRayQueryIsLSSHitNV].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryIsLSSHitNV].operands.push(OperandId, "'Committed'");
|
||||
InstructionDesc[OpRayQueryIsLSSHitNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'");
|
||||
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'");
|
||||
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'");
|
||||
|
|
@ -3217,6 +3348,61 @@ void Parameterize()
|
|||
|
||||
InstructionDesc[OpCooperativeMatrixLengthKHR].operands.push(OperandId, "'Type'");
|
||||
|
||||
InstructionDesc[OpTypeCooperativeVectorNV].operands.push(OperandId, "'Component Type'");
|
||||
InstructionDesc[OpTypeCooperativeVectorNV].operands.push(OperandId, "'Components'");
|
||||
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'Input'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'InputInterpretation'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'Matrix'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'MatrixOffset'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'MatrixInterpretation'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'M'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'K'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'MemoryLayout'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'Transpose'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandId, "'MatrixStride'", true);
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulNV].operands.push(OperandCooperativeMatrixOperands, "'Cooperative Matrix Operands'", true);
|
||||
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'Input'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'InputInterpretation'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'Matrix'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'MatrixOffset'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'MatrixInterpretation'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'Bias'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'BiasOffset'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'BiasInterpretation'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'M'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'K'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'MemoryLayout'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'Transpose'");
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandId, "'MatrixStride'", true);
|
||||
InstructionDesc[OpCooperativeVectorMatrixMulAddNV].operands.push(OperandCooperativeMatrixOperands, "'Cooperative Matrix Operands'", true);
|
||||
|
||||
InstructionDesc[OpCooperativeVectorLoadNV].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpCooperativeVectorLoadNV].operands.push(OperandId, "'Offset'");
|
||||
InstructionDesc[OpCooperativeVectorLoadNV].operands.push(OperandMemoryAccess, "'Memory Access'");
|
||||
InstructionDesc[OpCooperativeVectorLoadNV].operands.push(OperandLiteralNumber, "", true);
|
||||
InstructionDesc[OpCooperativeVectorLoadNV].operands.push(OperandId, "", true);
|
||||
|
||||
InstructionDesc[OpCooperativeVectorStoreNV].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpCooperativeVectorStoreNV].operands.push(OperandId, "'Offset'");
|
||||
InstructionDesc[OpCooperativeVectorStoreNV].operands.push(OperandId, "'Object'");
|
||||
InstructionDesc[OpCooperativeVectorStoreNV].operands.push(OperandMemoryAccess, "'Memory Access'");
|
||||
InstructionDesc[OpCooperativeVectorStoreNV].operands.push(OperandLiteralNumber, "", true);
|
||||
InstructionDesc[OpCooperativeVectorStoreNV].operands.push(OperandId, "", true);
|
||||
|
||||
InstructionDesc[OpCooperativeVectorOuterProductAccumulateNV].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpCooperativeVectorOuterProductAccumulateNV].operands.push(OperandId, "'Offset'");
|
||||
InstructionDesc[OpCooperativeVectorOuterProductAccumulateNV].operands.push(OperandId, "'A'");
|
||||
InstructionDesc[OpCooperativeVectorOuterProductAccumulateNV].operands.push(OperandId, "'B'");
|
||||
InstructionDesc[OpCooperativeVectorOuterProductAccumulateNV].operands.push(OperandId, "'MemoryLayout'");
|
||||
InstructionDesc[OpCooperativeVectorOuterProductAccumulateNV].operands.push(OperandId, "'MatrixInterpretation'");
|
||||
InstructionDesc[OpCooperativeVectorOuterProductAccumulateNV].operands.push(OperandId, "'MatrixStride'", true);
|
||||
|
||||
InstructionDesc[OpCooperativeVectorReduceSumAccumulateNV].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpCooperativeVectorReduceSumAccumulateNV].operands.push(OperandId, "'Offset'");
|
||||
InstructionDesc[OpCooperativeVectorReduceSumAccumulateNV].operands.push(OperandId, "'V'");
|
||||
|
||||
InstructionDesc[OpDemoteToHelperInvocationEXT].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpReadClockKHR].operands.push(OperandScope, "'Scope'");
|
||||
|
|
@ -3406,6 +3592,26 @@ void Parameterize()
|
|||
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Payload'");
|
||||
InstructionDesc[OpHitObjectTraceRayMotionNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpHitObjectGetClusterIdNV].operands.push(OperandId, "'HitObject'");
|
||||
InstructionDesc[OpHitObjectGetClusterIdNV].setResultAndType(true, true);
|
||||
InstructionDesc[OpHitObjectGetSpherePositionNV].operands.push(OperandId, "'HitObject'");
|
||||
InstructionDesc[OpHitObjectGetSpherePositionNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpHitObjectGetSphereRadiusNV].operands.push(OperandId, "'HitObject'");
|
||||
InstructionDesc[OpHitObjectGetSphereRadiusNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpHitObjectGetLSSPositionsNV].operands.push(OperandId, "'HitObject'");
|
||||
InstructionDesc[OpHitObjectGetLSSPositionsNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpHitObjectGetLSSRadiiNV].operands.push(OperandId, "'HitObject'");
|
||||
InstructionDesc[OpHitObjectGetLSSRadiiNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpHitObjectIsSphereHitNV].operands.push(OperandId, "'HitObject'");
|
||||
InstructionDesc[OpHitObjectIsSphereHitNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpHitObjectIsLSSHitNV].operands.push(OperandId, "'HitObject'");
|
||||
InstructionDesc[OpHitObjectIsLSSHitNV].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpFetchMicroTriangleVertexBarycentricNV].operands.push(OperandId, "'Acceleration Structure'");
|
||||
InstructionDesc[OpFetchMicroTriangleVertexBarycentricNV].operands.push(OperandId, "'Instance ID'");
|
||||
InstructionDesc[OpFetchMicroTriangleVertexBarycentricNV].operands.push(OperandId, "'Geometry Index'");
|
||||
|
|
@ -3488,7 +3694,95 @@ void Parameterize()
|
|||
InstructionDesc[OpConstantCompositeReplicateEXT].operands.push(OperandId, "'Value'");
|
||||
InstructionDesc[OpSpecConstantCompositeReplicateEXT].operands.push(OperandId, "'Value'");
|
||||
InstructionDesc[OpCompositeConstructReplicateEXT].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixConvertNV].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixTransposeNV].operands.push(OperandId, "'Matrix'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandId, "'Matrix'");
|
||||
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandLiteralNumber, "'ReduceMask'");
|
||||
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandId, "'CombineFunc'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixPerElementOpNV].operands.push(OperandId, "'Matrix'");
|
||||
InstructionDesc[OpCooperativeMatrixPerElementOpNV].operands.push(OperandId, "'Operation'");
|
||||
InstructionDesc[OpCooperativeMatrixPerElementOpNV].operands.push(OperandVariableIds, "'Operands'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandId, "'Object'");
|
||||
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandId, "'TensorLayout'");
|
||||
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandMemoryAccess, "'Memory Access'");
|
||||
InstructionDesc[OpCooperativeMatrixLoadTensorNV].operands.push(OperandTensorAddressingOperands, "'Tensor Addressing Operands'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandId, "'Object'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandId, "'TensorLayout'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandMemoryAccess, "'Memory Access'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreTensorNV].operands.push(OperandTensorAddressingOperands, "'Tensor Addressing Operands'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandId, "'Matrix'");
|
||||
InstructionDesc[OpCooperativeMatrixReduceNV].operands.push(OperandLiteralNumber, "'ReduceMask'");
|
||||
|
||||
InstructionDesc[OpTypeTensorLayoutNV].operands.push(OperandId, "'Dim'");
|
||||
InstructionDesc[OpTypeTensorLayoutNV].operands.push(OperandId, "'ClampMode'");
|
||||
|
||||
InstructionDesc[OpTypeTensorViewNV].operands.push(OperandId, "'Dim'");
|
||||
InstructionDesc[OpTypeTensorViewNV].operands.push(OperandId, "'HasDimensions'");
|
||||
InstructionDesc[OpTypeTensorViewNV].operands.push(OperandVariableIds, "'p'");
|
||||
|
||||
InstructionDesc[OpTensorLayoutSetBlockSizeNV].operands.push(OperandId, "'TensorLayout'");
|
||||
InstructionDesc[OpTensorLayoutSetBlockSizeNV].operands.push(OperandVariableIds, "'BlockSize'");
|
||||
|
||||
InstructionDesc[OpTensorLayoutSetDimensionNV].operands.push(OperandId, "'TensorLayout'");
|
||||
InstructionDesc[OpTensorLayoutSetDimensionNV].operands.push(OperandVariableIds, "'Dim'");
|
||||
|
||||
InstructionDesc[OpTensorLayoutSetStrideNV].operands.push(OperandId, "'TensorLayout'");
|
||||
InstructionDesc[OpTensorLayoutSetStrideNV].operands.push(OperandVariableIds, "'Stride'");
|
||||
|
||||
InstructionDesc[OpTensorLayoutSliceNV].operands.push(OperandId, "'TensorLayout'");
|
||||
InstructionDesc[OpTensorLayoutSliceNV].operands.push(OperandVariableIds, "'Operands'");
|
||||
|
||||
InstructionDesc[OpTensorLayoutSetClampValueNV].operands.push(OperandId, "'TensorLayout'");
|
||||
InstructionDesc[OpTensorLayoutSetClampValueNV].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpTensorViewSetDimensionNV].operands.push(OperandId, "'TensorView'");
|
||||
InstructionDesc[OpTensorViewSetDimensionNV].operands.push(OperandVariableIds, "'Dim'");
|
||||
|
||||
InstructionDesc[OpTensorViewSetStrideNV].operands.push(OperandId, "'TensorView'");
|
||||
InstructionDesc[OpTensorViewSetStrideNV].operands.push(OperandVariableIds, "'Stride'");
|
||||
|
||||
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'TensorView'");
|
||||
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'ClipRowOffset'");
|
||||
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'ClipRowSpan'");
|
||||
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'ClipColOffset'");
|
||||
InstructionDesc[OpTensorViewSetClipNV].operands.push(OperandId, "'ClipColSpan'");
|
||||
|
||||
InstructionDesc[OpSDotKHR].operands.push(OperandId, "'Vector1'");
|
||||
InstructionDesc[OpSDotKHR].operands.push(OperandId, "'Vector2'");
|
||||
InstructionDesc[OpSDotKHR].operands.push(OperandLiteralNumber, "'PackedVectorFormat'");
|
||||
|
||||
InstructionDesc[OpUDotKHR].operands.push(OperandId, "'Vector1'");
|
||||
InstructionDesc[OpUDotKHR].operands.push(OperandId, "'Vector2'");
|
||||
InstructionDesc[OpUDotKHR].operands.push(OperandLiteralNumber, "'PackedVectorFormat'");
|
||||
|
||||
InstructionDesc[OpSUDotKHR].operands.push(OperandId, "'Vector1'");
|
||||
InstructionDesc[OpSUDotKHR].operands.push(OperandId, "'Vector2'");
|
||||
InstructionDesc[OpSUDotKHR].operands.push(OperandLiteralNumber, "'PackedVectorFormat'");
|
||||
|
||||
InstructionDesc[OpSDotAccSatKHR].operands.push(OperandId, "'Vector1'");
|
||||
InstructionDesc[OpSDotAccSatKHR].operands.push(OperandId, "'Vector2'");
|
||||
InstructionDesc[OpSDotAccSatKHR].operands.push(OperandId, "'Accumulator'");
|
||||
InstructionDesc[OpSDotAccSatKHR].operands.push(OperandLiteralNumber, "'PackedVectorFormat'");
|
||||
|
||||
InstructionDesc[OpUDotAccSatKHR].operands.push(OperandId, "'Vector1'");
|
||||
InstructionDesc[OpUDotAccSatKHR].operands.push(OperandId, "'Vector2'");
|
||||
InstructionDesc[OpUDotAccSatKHR].operands.push(OperandId, "'Accumulator'");
|
||||
InstructionDesc[OpUDotAccSatKHR].operands.push(OperandLiteralNumber, "'PackedVectorFormat'");
|
||||
|
||||
InstructionDesc[OpSUDotAccSatKHR].operands.push(OperandId, "'Vector1'");
|
||||
InstructionDesc[OpSUDotAccSatKHR].operands.push(OperandId, "'Vector2'");
|
||||
InstructionDesc[OpSUDotAccSatKHR].operands.push(OperandId, "'Accumulator'");
|
||||
InstructionDesc[OpSUDotAccSatKHR].operands.push(OperandLiteralNumber, "'PackedVectorFormat'");
|
||||
});
|
||||
}
|
||||
|
||||
}; // end spv namespace
|
||||
} // end spv namespace
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ enum OperandClass {
|
|||
OperandKernelProfilingInfo,
|
||||
OperandCapability,
|
||||
OperandCooperativeMatrixOperands,
|
||||
OperandTensorAddressingOperands,
|
||||
|
||||
OperandOpcode,
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -189,6 +189,15 @@ public:
|
|||
out.push_back(operands[op]);
|
||||
}
|
||||
|
||||
const char *getNameString() const {
|
||||
if (opCode == OpString) {
|
||||
return (const char *)&operands[0];
|
||||
} else {
|
||||
assert(opCode == OpName);
|
||||
return (const char *)&operands[1];
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
Instruction(const Instruction&);
|
||||
Id resultId;
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ void VkShaderCache::Load()
|
|||
return;
|
||||
|
||||
uint32_t version = readUInt32(fr);
|
||||
if (version != 1)
|
||||
if (version != 2)
|
||||
return;
|
||||
|
||||
std::vector<char> strbuffer;
|
||||
|
|
@ -265,7 +265,7 @@ void VkShaderCache::Save()
|
|||
|
||||
fw->Write("shadercache", 11);
|
||||
|
||||
uint32_t version = 1;
|
||||
uint32_t version = 2;
|
||||
writeUInt32(fw, version);
|
||||
|
||||
writeUInt32(fw, CodeCache.size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue