mirror of https://github.com/auygun/kaliber.git
Upgrade glslang
This commit is contained in:
parent
655c0a7b71
commit
429660d2d3
|
@ -68,6 +68,7 @@ CFLAGS += -DSYSCONFDIR='"/etc"'
|
|||
CFLAGS += -DFALLBACK_DATA_DIRS='"/usr/local/share:/usr/share"'
|
||||
CFLAGS += -DFALLBACK_CONFIG_DIRS='"/etc/xdg"'
|
||||
CFLAGS += -DHAVE_SECURE_GETENV
|
||||
CXXFLAGS += -I$(SRC_ROOT)/third_party/glslang
|
||||
|
||||
# --- Internal functions ---
|
||||
|
||||
|
@ -144,7 +145,6 @@ THIRD_PARTY_CXXFLAGS := $(filter-out -Wextra -Werror, $(THIRD_PARTY_CXXFLAGS))
|
|||
|
||||
THIRD_PARTY_SRC := \
|
||||
$(SRC_ROOT)/third_party/glew/glew.c \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/CInterface/glslang_c_interface.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/GenericCodeGen/CodeGen.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/GenericCodeGen/Link.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/MachineIndependent/attribute.cpp \
|
||||
|
@ -172,11 +172,11 @@ THIRD_PARTY_SRC := \
|
|||
$(SRC_ROOT)/third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/MachineIndependent/Scan.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/MachineIndependent/SpirvIntrinsics.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/MachineIndependent/Versions.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/glslang/OSDependent/Unix/ossource.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/OGLCompilersDLL/InitializeDll.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/SPIRV/CInterface/spirv_c_interface.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/SPIRV/disassemble.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/SPIRV/doc.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/SPIRV/GlslangToSpv.cpp \
|
||||
|
@ -186,7 +186,6 @@ THIRD_PARTY_SRC := \
|
|||
$(SRC_ROOT)/third_party/glslang/SPIRV/SpvPostProcess.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/SPIRV/SPVRemapper.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/SPIRV/SpvTools.cpp \
|
||||
$(SRC_ROOT)/third_party/glslang/StandAlone/ResourceLimits.cpp \
|
||||
$(SRC_ROOT)/third_party/jsoncpp/jsoncpp.cpp \
|
||||
$(SRC_ROOT)/third_party/spirv-reflect/spirv_reflect.c \
|
||||
$(SRC_ROOT)/third_party/stb/stb_image.c \
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "engine/renderer/texture.h"
|
||||
#include "engine/shader_source.h"
|
||||
#include "third_party/glslang/SPIRV/GlslangToSpv.h"
|
||||
#include "third_party/glslang/StandAlone/ResourceLimits.h"
|
||||
#include "third_party/glslang/glslang/Include/ResourceLimits.h"
|
||||
#include "third_party/glslang/glslang/Include/Types.h"
|
||||
#include "third_party/glslang/glslang/Public/ShaderLang.h"
|
||||
#include "third_party/spirv-reflect/spirv_reflect.h"
|
||||
|
@ -23,6 +23,125 @@ using namespace base;
|
|||
|
||||
namespace {
|
||||
|
||||
// Synchronized with glslang/StandAlone/ResourceLimits.cpp which was removed
|
||||
// from the public API.
|
||||
const TBuiltInResource DefaultTBuiltInResource = {
|
||||
/* .MaxLights = */ 32,
|
||||
/* .MaxClipPlanes = */ 6,
|
||||
/* .MaxTextureUnits = */ 32,
|
||||
/* .MaxTextureCoords = */ 32,
|
||||
/* .MaxVertexAttribs = */ 64,
|
||||
/* .MaxVertexUniformComponents = */ 4096,
|
||||
/* .MaxVaryingFloats = */ 64,
|
||||
/* .MaxVertexTextureImageUnits = */ 32,
|
||||
/* .MaxCombinedTextureImageUnits = */ 80,
|
||||
/* .MaxTextureImageUnits = */ 32,
|
||||
/* .MaxFragmentUniformComponents = */ 4096,
|
||||
/* .MaxDrawBuffers = */ 32,
|
||||
/* .MaxVertexUniformVectors = */ 128,
|
||||
/* .MaxVaryingVectors = */ 8,
|
||||
/* .MaxFragmentUniformVectors = */ 16,
|
||||
/* .MaxVertexOutputVectors = */ 16,
|
||||
/* .MaxFragmentInputVectors = */ 15,
|
||||
/* .MinProgramTexelOffset = */ -8,
|
||||
/* .MaxProgramTexelOffset = */ 7,
|
||||
/* .MaxClipDistances = */ 8,
|
||||
/* .MaxComputeWorkGroupCountX = */ 65535,
|
||||
/* .MaxComputeWorkGroupCountY = */ 65535,
|
||||
/* .MaxComputeWorkGroupCountZ = */ 65535,
|
||||
/* .MaxComputeWorkGroupSizeX = */ 1024,
|
||||
/* .MaxComputeWorkGroupSizeY = */ 1024,
|
||||
/* .MaxComputeWorkGroupSizeZ = */ 64,
|
||||
/* .MaxComputeUniformComponents = */ 1024,
|
||||
/* .MaxComputeTextureImageUnits = */ 16,
|
||||
/* .MaxComputeImageUniforms = */ 8,
|
||||
/* .MaxComputeAtomicCounters = */ 8,
|
||||
/* .MaxComputeAtomicCounterBuffers = */ 1,
|
||||
/* .MaxVaryingComponents = */ 60,
|
||||
/* .MaxVertexOutputComponents = */ 64,
|
||||
/* .MaxGeometryInputComponents = */ 64,
|
||||
/* .MaxGeometryOutputComponents = */ 128,
|
||||
/* .MaxFragmentInputComponents = */ 128,
|
||||
/* .MaxImageUnits = */ 8,
|
||||
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
|
||||
/* .MaxCombinedShaderOutputResources = */ 8,
|
||||
/* .MaxImageSamples = */ 0,
|
||||
/* .MaxVertexImageUniforms = */ 0,
|
||||
/* .MaxTessControlImageUniforms = */ 0,
|
||||
/* .MaxTessEvaluationImageUniforms = */ 0,
|
||||
/* .MaxGeometryImageUniforms = */ 0,
|
||||
/* .MaxFragmentImageUniforms = */ 8,
|
||||
/* .MaxCombinedImageUniforms = */ 8,
|
||||
/* .MaxGeometryTextureImageUnits = */ 16,
|
||||
/* .MaxGeometryOutputVertices = */ 256,
|
||||
/* .MaxGeometryTotalOutputComponents = */ 1024,
|
||||
/* .MaxGeometryUniformComponents = */ 1024,
|
||||
/* .MaxGeometryVaryingComponents = */ 64,
|
||||
/* .MaxTessControlInputComponents = */ 128,
|
||||
/* .MaxTessControlOutputComponents = */ 128,
|
||||
/* .MaxTessControlTextureImageUnits = */ 16,
|
||||
/* .MaxTessControlUniformComponents = */ 1024,
|
||||
/* .MaxTessControlTotalOutputComponents = */ 4096,
|
||||
/* .MaxTessEvaluationInputComponents = */ 128,
|
||||
/* .MaxTessEvaluationOutputComponents = */ 128,
|
||||
/* .MaxTessEvaluationTextureImageUnits = */ 16,
|
||||
/* .MaxTessEvaluationUniformComponents = */ 1024,
|
||||
/* .MaxTessPatchComponents = */ 120,
|
||||
/* .MaxPatchVertices = */ 32,
|
||||
/* .MaxTessGenLevel = */ 64,
|
||||
/* .MaxViewports = */ 16,
|
||||
/* .MaxVertexAtomicCounters = */ 0,
|
||||
/* .MaxTessControlAtomicCounters = */ 0,
|
||||
/* .MaxTessEvaluationAtomicCounters = */ 0,
|
||||
/* .MaxGeometryAtomicCounters = */ 0,
|
||||
/* .MaxFragmentAtomicCounters = */ 8,
|
||||
/* .MaxCombinedAtomicCounters = */ 8,
|
||||
/* .MaxAtomicCounterBindings = */ 1,
|
||||
/* .MaxVertexAtomicCounterBuffers = */ 0,
|
||||
/* .MaxTessControlAtomicCounterBuffers = */ 0,
|
||||
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
|
||||
/* .MaxGeometryAtomicCounterBuffers = */ 0,
|
||||
/* .MaxFragmentAtomicCounterBuffers = */ 1,
|
||||
/* .MaxCombinedAtomicCounterBuffers = */ 1,
|
||||
/* .MaxAtomicCounterBufferSize = */ 16384,
|
||||
/* .MaxTransformFeedbackBuffers = */ 4,
|
||||
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
|
||||
/* .MaxCullDistances = */ 8,
|
||||
/* .MaxCombinedClipAndCullDistances = */ 8,
|
||||
/* .MaxSamples = */ 4,
|
||||
/* .maxMeshOutputVerticesNV = */ 256,
|
||||
/* .maxMeshOutputPrimitivesNV = */ 512,
|
||||
/* .maxMeshWorkGroupSizeX_NV = */ 32,
|
||||
/* .maxMeshWorkGroupSizeY_NV = */ 1,
|
||||
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
|
||||
/* .maxTaskWorkGroupSizeX_NV = */ 32,
|
||||
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
||||
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
||||
/* .maxMeshViewCountNV = */ 4,
|
||||
/* .maxMeshOutputVerticesEXT = */ 256,
|
||||
/* .maxMeshOutputPrimitivesEXT = */ 256,
|
||||
/* .maxMeshWorkGroupSizeX_EXT = */ 128,
|
||||
/* .maxMeshWorkGroupSizeY_EXT = */ 128,
|
||||
/* .maxMeshWorkGroupSizeZ_EXT = */ 128,
|
||||
/* .maxTaskWorkGroupSizeX_EXT = */ 128,
|
||||
/* .maxTaskWorkGroupSizeY_EXT = */ 128,
|
||||
/* .maxTaskWorkGroupSizeZ_EXT = */ 128,
|
||||
/* .maxMeshViewCountEXT = */ 4,
|
||||
/* .maxDualSourceDrawBuffersEXT = */ 1,
|
||||
|
||||
/* .limits = */
|
||||
{
|
||||
/* .nonInductiveForLoops = */ true,
|
||||
/* .whileLoops = */ true,
|
||||
/* .doWhileLoops = */ true,
|
||||
/* .generalUniformIndexing = */ true,
|
||||
/* .generalAttributeMatrixVectorIndexing = */ true,
|
||||
/* .generalVaryingIndexing = */ true,
|
||||
/* .generalSamplerIndexing = */ true,
|
||||
/* .generalVariableIndexing = */ true,
|
||||
/* .generalConstantMatrixVectorIndexing = */ true,
|
||||
}};
|
||||
|
||||
using VertexInputDescription =
|
||||
std::pair<std::vector<VkVertexInputBindingDescription>,
|
||||
std::vector<VkVertexInputAttributeDescription>>;
|
||||
|
@ -99,9 +218,9 @@ std::vector<uint8_t> CompileGlsl(EShLanguage stage,
|
|||
std::string pre_processed_code;
|
||||
|
||||
// Preprocess
|
||||
if (!shader.preprocess(&glslang::DefaultTBuiltInResource, kDefaultVersion,
|
||||
ENoProfile, false, false, messages,
|
||||
&pre_processed_code, includer)) {
|
||||
if (!shader.preprocess(&DefaultTBuiltInResource, kDefaultVersion, ENoProfile,
|
||||
false, false, messages, &pre_processed_code,
|
||||
includer)) {
|
||||
if (error) {
|
||||
(*error) = "Failed pre-process:\n";
|
||||
(*error) += shader.getInfoLog();
|
||||
|
@ -115,7 +234,7 @@ std::vector<uint8_t> CompileGlsl(EShLanguage stage,
|
|||
shader.setStrings(&cs_strings, 1);
|
||||
|
||||
// Parse
|
||||
if (!shader.parse(&glslang::DefaultTBuiltInResource, kDefaultVersion, false,
|
||||
if (!shader.parse(&DefaultTBuiltInResource, kDefaultVersion, false,
|
||||
messages)) {
|
||||
if (error) {
|
||||
(*error) = "Failed parse:\n";
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,110 +0,0 @@
|
|||
/**
|
||||
This code is based on the glslang_c_interface implementation by Viktor Latypov
|
||||
**/
|
||||
|
||||
/**
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2019, Viktor Latypov
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**/
|
||||
|
||||
#include "../../glslang/Include/glslang_c_interface.h"
|
||||
|
||||
#include "../GlslangToSpv.h"
|
||||
#include "../Logger.h"
|
||||
#include "../SpvTools.h"
|
||||
|
||||
typedef struct glslang_program_s {
|
||||
glslang::TProgram* program;
|
||||
std::vector<unsigned int> spirv;
|
||||
std::string loggerMessages;
|
||||
} glslang_program_t;
|
||||
|
||||
static EShLanguage c_shader_stage(glslang_stage_t stage)
|
||||
{
|
||||
switch (stage) {
|
||||
case GLSLANG_STAGE_VERTEX:
|
||||
return EShLangVertex;
|
||||
case GLSLANG_STAGE_TESSCONTROL:
|
||||
return EShLangTessControl;
|
||||
case GLSLANG_STAGE_TESSEVALUATION:
|
||||
return EShLangTessEvaluation;
|
||||
case GLSLANG_STAGE_GEOMETRY:
|
||||
return EShLangGeometry;
|
||||
case GLSLANG_STAGE_FRAGMENT:
|
||||
return EShLangFragment;
|
||||
case GLSLANG_STAGE_COMPUTE:
|
||||
return EShLangCompute;
|
||||
case GLSLANG_STAGE_RAYGEN_NV:
|
||||
return EShLangRayGen;
|
||||
case GLSLANG_STAGE_INTERSECT_NV:
|
||||
return EShLangIntersect;
|
||||
case GLSLANG_STAGE_ANYHIT_NV:
|
||||
return EShLangAnyHit;
|
||||
case GLSLANG_STAGE_CLOSESTHIT_NV:
|
||||
return EShLangClosestHit;
|
||||
case GLSLANG_STAGE_MISS_NV:
|
||||
return EShLangMiss;
|
||||
case GLSLANG_STAGE_CALLABLE_NV:
|
||||
return EShLangCallable;
|
||||
case GLSLANG_STAGE_TASK_NV:
|
||||
return EShLangTaskNV;
|
||||
case GLSLANG_STAGE_MESH_NV:
|
||||
return EShLangMeshNV;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return EShLangCount;
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_program_SPIRV_generate(glslang_program_t* program, glslang_stage_t stage)
|
||||
{
|
||||
spv::SpvBuildLogger logger;
|
||||
glslang::SpvOptions spvOptions;
|
||||
spvOptions.validate = true;
|
||||
|
||||
const glslang::TIntermediate* intermediate = program->program->getIntermediate(c_shader_stage(stage));
|
||||
|
||||
glslang::GlslangToSpv(*intermediate, program->spirv, &logger, &spvOptions);
|
||||
|
||||
program->loggerMessages = logger.getAllMessages();
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT size_t glslang_program_SPIRV_get_size(glslang_program_t* program) { return program->spirv.size(); }
|
||||
|
||||
GLSLANG_EXPORT void glslang_program_SPIRV_get(glslang_program_t* program, unsigned int* out)
|
||||
{
|
||||
memcpy(out, program->spirv.data(), program->spirv.size() * sizeof(unsigned int));
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT unsigned int* glslang_program_SPIRV_get_ptr(glslang_program_t* program)
|
||||
{
|
||||
return program->spirv.data();
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT const char* glslang_program_SPIRV_get_messages(glslang_program_t* program)
|
||||
{
|
||||
return program->loggerMessages.empty() ? nullptr : program->loggerMessages.c_str();
|
||||
}
|
|
@ -36,5 +36,9 @@ static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fu
|
|||
static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density";
|
||||
static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_atomic_float_add";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max";
|
||||
static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64";
|
||||
static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader";
|
||||
|
||||
#endif // #ifndef GLSLextEXT_H
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#define GLSLextKHR_H
|
||||
|
||||
static const int GLSLextKHRVersion = 100;
|
||||
static const int GLSLextKHRRevision = 2;
|
||||
static const int GLSLextKHRRevision = 3;
|
||||
|
||||
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
|
||||
static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote";
|
||||
|
@ -48,4 +48,11 @@ static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shade
|
|||
static const char* const E_SPV_KHR_non_semantic_info = "SPV_KHR_non_semantic_info";
|
||||
static const char* const E_SPV_KHR_ray_tracing = "SPV_KHR_ray_tracing";
|
||||
static const char* const E_SPV_KHR_ray_query = "SPV_KHR_ray_query";
|
||||
static const char* const E_SPV_KHR_fragment_shading_rate = "SPV_KHR_fragment_shading_rate";
|
||||
static const char* const E_SPV_KHR_terminate_invocation = "SPV_KHR_terminate_invocation";
|
||||
static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_workgroup_memory_explicit_layout";
|
||||
static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow";
|
||||
static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragment_shader_barycentric";
|
||||
static const char* const E_SPV_AMD_shader_early_and_late_fragment_tests = "SPV_AMD_shader_early_and_late_fragment_tests";
|
||||
|
||||
#endif // #ifndef GLSLextKHR_H
|
||||
|
|
|
@ -69,6 +69,9 @@ const char* const E_SPV_NV_mesh_shader = "SPV_NV_mesh_shader";
|
|||
//SPV_NV_raytracing
|
||||
const char* const E_SPV_NV_ray_tracing = "SPV_NV_ray_tracing";
|
||||
|
||||
//SPV_NV_ray_tracing_motion_blur
|
||||
const char* const E_SPV_NV_ray_tracing_motion_blur = "SPV_NV_ray_tracing_motion_blur";
|
||||
|
||||
//SPV_NV_shading_rate
|
||||
const char* const E_SPV_NV_shading_rate = "SPV_NV_shading_rate";
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -40,7 +40,7 @@
|
|||
#endif
|
||||
|
||||
#include "SpvTools.h"
|
||||
#include "../glslang/Include/intermediate.h"
|
||||
#include "glslang/Include/intermediate.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
// Copyright (c) 2018 The Khronos Group Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and/or associated documentation files (the "Materials"),
|
||||
// to deal in the Materials without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Materials, and to permit persons to whom the
|
||||
// Materials are furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Materials.
|
||||
//
|
||||
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
|
||||
// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
|
||||
// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
|
||||
//
|
||||
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
|
||||
// IN THE MATERIALS.
|
||||
|
||||
#ifndef SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_
|
||||
#define SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
NonSemanticShaderDebugInfo100Version = 100,
|
||||
NonSemanticShaderDebugInfo100Version_BitWidthPadding = 0x7fffffff
|
||||
};
|
||||
enum {
|
||||
NonSemanticShaderDebugInfo100Revision = 6,
|
||||
NonSemanticShaderDebugInfo100Revision_BitWidthPadding = 0x7fffffff
|
||||
};
|
||||
|
||||
enum NonSemanticShaderDebugInfo100Instructions {
|
||||
NonSemanticShaderDebugInfo100DebugInfoNone = 0,
|
||||
NonSemanticShaderDebugInfo100DebugCompilationUnit = 1,
|
||||
NonSemanticShaderDebugInfo100DebugTypeBasic = 2,
|
||||
NonSemanticShaderDebugInfo100DebugTypePointer = 3,
|
||||
NonSemanticShaderDebugInfo100DebugTypeQualifier = 4,
|
||||
NonSemanticShaderDebugInfo100DebugTypeArray = 5,
|
||||
NonSemanticShaderDebugInfo100DebugTypeVector = 6,
|
||||
NonSemanticShaderDebugInfo100DebugTypedef = 7,
|
||||
NonSemanticShaderDebugInfo100DebugTypeFunction = 8,
|
||||
NonSemanticShaderDebugInfo100DebugTypeEnum = 9,
|
||||
NonSemanticShaderDebugInfo100DebugTypeComposite = 10,
|
||||
NonSemanticShaderDebugInfo100DebugTypeMember = 11,
|
||||
NonSemanticShaderDebugInfo100DebugTypeInheritance = 12,
|
||||
NonSemanticShaderDebugInfo100DebugTypePtrToMember = 13,
|
||||
NonSemanticShaderDebugInfo100DebugTypeTemplate = 14,
|
||||
NonSemanticShaderDebugInfo100DebugTypeTemplateParameter = 15,
|
||||
NonSemanticShaderDebugInfo100DebugTypeTemplateTemplateParameter = 16,
|
||||
NonSemanticShaderDebugInfo100DebugTypeTemplateParameterPack = 17,
|
||||
NonSemanticShaderDebugInfo100DebugGlobalVariable = 18,
|
||||
NonSemanticShaderDebugInfo100DebugFunctionDeclaration = 19,
|
||||
NonSemanticShaderDebugInfo100DebugFunction = 20,
|
||||
NonSemanticShaderDebugInfo100DebugLexicalBlock = 21,
|
||||
NonSemanticShaderDebugInfo100DebugLexicalBlockDiscriminator = 22,
|
||||
NonSemanticShaderDebugInfo100DebugScope = 23,
|
||||
NonSemanticShaderDebugInfo100DebugNoScope = 24,
|
||||
NonSemanticShaderDebugInfo100DebugInlinedAt = 25,
|
||||
NonSemanticShaderDebugInfo100DebugLocalVariable = 26,
|
||||
NonSemanticShaderDebugInfo100DebugInlinedVariable = 27,
|
||||
NonSemanticShaderDebugInfo100DebugDeclare = 28,
|
||||
NonSemanticShaderDebugInfo100DebugValue = 29,
|
||||
NonSemanticShaderDebugInfo100DebugOperation = 30,
|
||||
NonSemanticShaderDebugInfo100DebugExpression = 31,
|
||||
NonSemanticShaderDebugInfo100DebugMacroDef = 32,
|
||||
NonSemanticShaderDebugInfo100DebugMacroUndef = 33,
|
||||
NonSemanticShaderDebugInfo100DebugImportedEntity = 34,
|
||||
NonSemanticShaderDebugInfo100DebugSource = 35,
|
||||
NonSemanticShaderDebugInfo100DebugFunctionDefinition = 101,
|
||||
NonSemanticShaderDebugInfo100DebugSourceContinued = 102,
|
||||
NonSemanticShaderDebugInfo100DebugLine = 103,
|
||||
NonSemanticShaderDebugInfo100DebugNoLine = 104,
|
||||
NonSemanticShaderDebugInfo100DebugBuildIdentifier = 105,
|
||||
NonSemanticShaderDebugInfo100DebugStoragePath = 106,
|
||||
NonSemanticShaderDebugInfo100DebugEntryPoint = 107,
|
||||
NonSemanticShaderDebugInfo100DebugTypeMatrix = 108,
|
||||
NonSemanticShaderDebugInfo100InstructionsMax = 0x7fffffff
|
||||
};
|
||||
|
||||
|
||||
enum NonSemanticShaderDebugInfo100DebugInfoFlags {
|
||||
NonSemanticShaderDebugInfo100None = 0x0000,
|
||||
NonSemanticShaderDebugInfo100FlagIsProtected = 0x01,
|
||||
NonSemanticShaderDebugInfo100FlagIsPrivate = 0x02,
|
||||
NonSemanticShaderDebugInfo100FlagIsPublic = 0x03,
|
||||
NonSemanticShaderDebugInfo100FlagIsLocal = 0x04,
|
||||
NonSemanticShaderDebugInfo100FlagIsDefinition = 0x08,
|
||||
NonSemanticShaderDebugInfo100FlagFwdDecl = 0x10,
|
||||
NonSemanticShaderDebugInfo100FlagArtificial = 0x20,
|
||||
NonSemanticShaderDebugInfo100FlagExplicit = 0x40,
|
||||
NonSemanticShaderDebugInfo100FlagPrototyped = 0x80,
|
||||
NonSemanticShaderDebugInfo100FlagObjectPointer = 0x100,
|
||||
NonSemanticShaderDebugInfo100FlagStaticMember = 0x200,
|
||||
NonSemanticShaderDebugInfo100FlagIndirectVariable = 0x400,
|
||||
NonSemanticShaderDebugInfo100FlagLValueReference = 0x800,
|
||||
NonSemanticShaderDebugInfo100FlagRValueReference = 0x1000,
|
||||
NonSemanticShaderDebugInfo100FlagIsOptimized = 0x2000,
|
||||
NonSemanticShaderDebugInfo100FlagIsEnumClass = 0x4000,
|
||||
NonSemanticShaderDebugInfo100FlagTypePassByValue = 0x8000,
|
||||
NonSemanticShaderDebugInfo100FlagTypePassByReference = 0x10000,
|
||||
NonSemanticShaderDebugInfo100FlagUnknownPhysicalLayout = 0x20000,
|
||||
NonSemanticShaderDebugInfo100DebugInfoFlagsMax = 0x7fffffff
|
||||
};
|
||||
|
||||
enum NonSemanticShaderDebugInfo100BuildIdentifierFlags {
|
||||
NonSemanticShaderDebugInfo100IdentifierPossibleDuplicates = 0x01,
|
||||
NonSemanticShaderDebugInfo100BuildIdentifierFlagsMax = 0x7fffffff
|
||||
};
|
||||
|
||||
enum NonSemanticShaderDebugInfo100DebugBaseTypeAttributeEncoding {
|
||||
NonSemanticShaderDebugInfo100Unspecified = 0,
|
||||
NonSemanticShaderDebugInfo100Address = 1,
|
||||
NonSemanticShaderDebugInfo100Boolean = 2,
|
||||
NonSemanticShaderDebugInfo100Float = 3,
|
||||
NonSemanticShaderDebugInfo100Signed = 4,
|
||||
NonSemanticShaderDebugInfo100SignedChar = 5,
|
||||
NonSemanticShaderDebugInfo100Unsigned = 6,
|
||||
NonSemanticShaderDebugInfo100UnsignedChar = 7,
|
||||
NonSemanticShaderDebugInfo100DebugBaseTypeAttributeEncodingMax = 0x7fffffff
|
||||
};
|
||||
|
||||
enum NonSemanticShaderDebugInfo100DebugCompositeType {
|
||||
NonSemanticShaderDebugInfo100Class = 0,
|
||||
NonSemanticShaderDebugInfo100Structure = 1,
|
||||
NonSemanticShaderDebugInfo100Union = 2,
|
||||
NonSemanticShaderDebugInfo100DebugCompositeTypeMax = 0x7fffffff
|
||||
};
|
||||
|
||||
enum NonSemanticShaderDebugInfo100DebugTypeQualifier {
|
||||
NonSemanticShaderDebugInfo100ConstType = 0,
|
||||
NonSemanticShaderDebugInfo100VolatileType = 1,
|
||||
NonSemanticShaderDebugInfo100RestrictType = 2,
|
||||
NonSemanticShaderDebugInfo100AtomicType = 3,
|
||||
NonSemanticShaderDebugInfo100DebugTypeQualifierMax = 0x7fffffff
|
||||
};
|
||||
|
||||
enum NonSemanticShaderDebugInfo100DebugOperation {
|
||||
NonSemanticShaderDebugInfo100Deref = 0,
|
||||
NonSemanticShaderDebugInfo100Plus = 1,
|
||||
NonSemanticShaderDebugInfo100Minus = 2,
|
||||
NonSemanticShaderDebugInfo100PlusUconst = 3,
|
||||
NonSemanticShaderDebugInfo100BitPiece = 4,
|
||||
NonSemanticShaderDebugInfo100Swap = 5,
|
||||
NonSemanticShaderDebugInfo100Xderef = 6,
|
||||
NonSemanticShaderDebugInfo100StackValue = 7,
|
||||
NonSemanticShaderDebugInfo100Constu = 8,
|
||||
NonSemanticShaderDebugInfo100Fragment = 9,
|
||||
NonSemanticShaderDebugInfo100DebugOperationMax = 0x7fffffff
|
||||
};
|
||||
|
||||
enum NonSemanticShaderDebugInfo100DebugImportedEntity {
|
||||
NonSemanticShaderDebugInfo100ImportedModule = 0,
|
||||
NonSemanticShaderDebugInfo100ImportedDeclaration = 1,
|
||||
NonSemanticShaderDebugInfo100DebugImportedEntityMax = 0x7fffffff
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_
|
|
@ -160,15 +160,29 @@ namespace spv {
|
|||
}
|
||||
|
||||
// Is this an opcode we should remove when using --strip?
|
||||
bool spirvbin_t::isStripOp(spv::Op opCode) const
|
||||
bool spirvbin_t::isStripOp(spv::Op opCode, unsigned start) const
|
||||
{
|
||||
switch (opCode) {
|
||||
case spv::OpSource:
|
||||
case spv::OpSourceExtension:
|
||||
case spv::OpName:
|
||||
case spv::OpMemberName:
|
||||
case spv::OpLine: return true;
|
||||
default: return false;
|
||||
case spv::OpLine :
|
||||
{
|
||||
const std::string name = literalString(start + 2);
|
||||
|
||||
std::vector<std::string>::const_iterator it;
|
||||
for (it = stripWhiteList.begin(); it < stripWhiteList.end(); it++)
|
||||
{
|
||||
if (name.find(*it) != std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
default :
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,15 +311,21 @@ namespace spv {
|
|||
std::string spirvbin_t::literalString(unsigned word) const
|
||||
{
|
||||
std::string literal;
|
||||
const spirword_t * pos = spv.data() + word;
|
||||
|
||||
literal.reserve(16);
|
||||
|
||||
const char* bytes = reinterpret_cast<const char*>(spv.data() + word);
|
||||
|
||||
while (bytes && *bytes)
|
||||
literal += *bytes++;
|
||||
|
||||
return literal;
|
||||
do {
|
||||
spirword_t word = *pos;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
char c = word & 0xff;
|
||||
if (c == '\0')
|
||||
return literal;
|
||||
literal += c;
|
||||
word >>= 8;
|
||||
}
|
||||
pos++;
|
||||
} while (true);
|
||||
}
|
||||
|
||||
void spirvbin_t::applyMap()
|
||||
|
@ -366,7 +386,7 @@ namespace spv {
|
|||
process(
|
||||
[&](spv::Op opCode, unsigned start) {
|
||||
// remember opcodes we want to strip later
|
||||
if (isStripOp(opCode))
|
||||
if (isStripOp(opCode, start))
|
||||
stripInst(start);
|
||||
return true;
|
||||
},
|
||||
|
@ -544,6 +564,9 @@ namespace spv {
|
|||
// Extended instructions: currently, assume everything is an ID.
|
||||
// TODO: add whatever data we need for exceptions to that
|
||||
if (opCode == spv::OpExtInst) {
|
||||
|
||||
idFn(asId(word)); // Instruction set is an ID that also needs to be mapped
|
||||
|
||||
word += 2; // instruction set, and instruction from set
|
||||
numOperands -= 2;
|
||||
|
||||
|
@ -830,7 +853,15 @@ namespace spv {
|
|||
[&](spv::Id& id) {
|
||||
if (thisOpCode != spv::OpNop) {
|
||||
++idCounter;
|
||||
const std::uint32_t hashval = opCounter[thisOpCode] * thisOpCode * 50047 + idCounter + fnId * 117;
|
||||
const std::uint32_t hashval =
|
||||
// Explicitly cast operands to unsigned int to avoid integer
|
||||
// promotion to signed int followed by integer overflow,
|
||||
// which would result in undefined behavior.
|
||||
static_cast<unsigned int>(opCounter[thisOpCode])
|
||||
* thisOpCode
|
||||
* 50047
|
||||
+ idCounter
|
||||
+ static_cast<unsigned int>(fnId) * 117;
|
||||
|
||||
if (isOldIdUnmapped(id))
|
||||
localId(id, nextUnusedId(hashval % softTypeIdLimit + firstMappedID));
|
||||
|
@ -1477,13 +1508,24 @@ namespace spv {
|
|||
}
|
||||
|
||||
// remap from a memory image
|
||||
void spirvbin_t::remap(std::vector<std::uint32_t>& in_spv, std::uint32_t opts)
|
||||
void spirvbin_t::remap(std::vector<std::uint32_t>& in_spv, const std::vector<std::string>& whiteListStrings,
|
||||
std::uint32_t opts)
|
||||
{
|
||||
stripWhiteList = whiteListStrings;
|
||||
spv.swap(in_spv);
|
||||
remap(opts);
|
||||
spv.swap(in_spv);
|
||||
}
|
||||
|
||||
// remap from a memory image - legacy interface without white list
|
||||
void spirvbin_t::remap(std::vector<std::uint32_t>& in_spv, std::uint32_t opts)
|
||||
{
|
||||
stripWhiteList.clear();
|
||||
spv.swap(in_spv);
|
||||
remap(opts);
|
||||
spv.swap(in_spv);
|
||||
}
|
||||
|
||||
} // namespace SPV
|
||||
|
||||
#endif // defined (use_cpp11)
|
||||
|
|
|
@ -118,6 +118,10 @@ public:
|
|||
virtual ~spirvbin_t() { }
|
||||
|
||||
// remap on an existing binary in memory
|
||||
void remap(std::vector<std::uint32_t>& spv, const std::vector<std::string>& whiteListStrings,
|
||||
std::uint32_t opts = DO_EVERYTHING);
|
||||
|
||||
// remap on an existing binary in memory - legacy interface without white list
|
||||
void remap(std::vector<std::uint32_t>& spv, std::uint32_t opts = DO_EVERYTHING);
|
||||
|
||||
// Type for error/log handler functions
|
||||
|
@ -180,6 +184,8 @@ private:
|
|||
unsigned typeSizeInWords(spv::Id id) const;
|
||||
unsigned idTypeSizeInWords(spv::Id id) const;
|
||||
|
||||
bool isStripOp(spv::Op opCode, unsigned start) const;
|
||||
|
||||
spv::Id& asId(unsigned word) { return spv[word]; }
|
||||
const spv::Id& asId(unsigned word) const { return spv[word]; }
|
||||
spv::Op asOpCode(unsigned word) const { return opOpCode(spv[word]); }
|
||||
|
@ -249,6 +255,8 @@ private:
|
|||
|
||||
std::vector<spirword_t> spv; // SPIR words
|
||||
|
||||
std::vector<std::string> stripWhiteList;
|
||||
|
||||
namemap_t nameMap; // ID names from OpName
|
||||
|
||||
// Since we want to also do binary ops, we can't use std::vector<bool>. we could use
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,6 +50,10 @@
|
|||
#include "Logger.h"
|
||||
#include "spirv.hpp"
|
||||
#include "spvIR.h"
|
||||
namespace spv {
|
||||
#include "GLSL.ext.KHR.h"
|
||||
#include "NonSemanticShaderDebugInfo100.h"
|
||||
}
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
@ -82,7 +86,7 @@ public:
|
|||
|
||||
void setSource(spv::SourceLanguage lang, int version)
|
||||
{
|
||||
source = lang;
|
||||
sourceLang = lang;
|
||||
sourceVersion = version;
|
||||
}
|
||||
spv::Id getStringId(const std::string& str)
|
||||
|
@ -99,14 +103,32 @@ public:
|
|||
stringIds[file_c_str] = strId;
|
||||
return strId;
|
||||
}
|
||||
spv::Id getSourceFile() const
|
||||
{
|
||||
return sourceFileStringId;
|
||||
}
|
||||
void setSourceFile(const std::string& file)
|
||||
{
|
||||
sourceFileStringId = getStringId(file);
|
||||
currentFileId = sourceFileStringId;
|
||||
}
|
||||
void setSourceText(const std::string& text) { sourceText = text; }
|
||||
void addSourceExtension(const char* ext) { sourceExtensions.push_back(ext); }
|
||||
void addModuleProcessed(const std::string& p) { moduleProcesses.push_back(p.c_str()); }
|
||||
void setEmitOpLines() { emitOpLines = true; }
|
||||
void setEmitNonSemanticShaderDebugInfo(bool const emit)
|
||||
{
|
||||
emitNonSemanticShaderDebugInfo = emit;
|
||||
|
||||
if(emit)
|
||||
{
|
||||
importNonSemanticShaderDebugInfoInstructions();
|
||||
}
|
||||
}
|
||||
void setEmitNonSemanticShaderDebugSource(bool const src)
|
||||
{
|
||||
emitNonSemanticShaderDebugSource = src;
|
||||
}
|
||||
void addExtension(const char* ext) { extensions.insert(ext); }
|
||||
void removeExtension(const char* ext)
|
||||
{
|
||||
|
@ -159,10 +181,11 @@ public:
|
|||
void setLine(int line, const char* filename);
|
||||
// Low-level OpLine. See setLine() for a layered helper.
|
||||
void addLine(Id fileName, int line, int column);
|
||||
void addDebugScopeAndLine(Id fileName, int line, int column);
|
||||
|
||||
// For creating new types (will return old type if the requested one was already made).
|
||||
Id makeVoidType();
|
||||
Id makeBoolType();
|
||||
Id makeBoolType(bool const compilerGenerated = true);
|
||||
Id makePointer(StorageClass, Id pointee);
|
||||
Id makeForwardPointer(StorageClass);
|
||||
Id makePointerFromForwardPointer(StorageClass, Id forwardPointerType, Id pointee);
|
||||
|
@ -170,7 +193,7 @@ public:
|
|||
Id makeIntType(int width) { return makeIntegerType(width, true); }
|
||||
Id makeUintType(int width) { return makeIntegerType(width, false); }
|
||||
Id makeFloatType(int width);
|
||||
Id makeStructType(const std::vector<Id>& members, const char*);
|
||||
Id makeStructType(const std::vector<Id>& members, const char* name, bool const compilerGenerated = true);
|
||||
Id makeStructResultType(Id type0, Id type1);
|
||||
Id makeVectorType(Id component, int size);
|
||||
Id makeMatrixType(Id component, int cols, int rows);
|
||||
|
@ -181,6 +204,37 @@ public:
|
|||
Id makeSamplerType();
|
||||
Id makeSampledImageType(Id imageType);
|
||||
Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols);
|
||||
Id makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands);
|
||||
|
||||
// SPIR-V NonSemantic Shader DebugInfo Instructions
|
||||
struct DebugTypeLoc {
|
||||
std::string name {};
|
||||
int line {0};
|
||||
int column {0};
|
||||
};
|
||||
std::unordered_map<Id, DebugTypeLoc> debugTypeLocs;
|
||||
Id makeDebugInfoNone();
|
||||
Id makeBoolDebugType(int const size);
|
||||
Id makeIntegerDebugType(int const width, bool const hasSign);
|
||||
Id makeFloatDebugType(int const width);
|
||||
Id makeSequentialDebugType(Id const baseType, Id const componentCount, NonSemanticShaderDebugInfo100Instructions const sequenceType);
|
||||
Id makeArrayDebugType(Id const baseType, Id const componentCount);
|
||||
Id makeVectorDebugType(Id const baseType, int const componentCount);
|
||||
Id makeMatrixDebugType(Id const vectorType, int const vectorCount, bool columnMajor = true);
|
||||
Id makeMemberDebugType(Id const memberType, DebugTypeLoc const& debugTypeLoc);
|
||||
Id makeCompositeDebugType(std::vector<Id> const& memberTypes, char const*const name,
|
||||
NonSemanticShaderDebugInfo100DebugCompositeType const tag, bool const isOpaqueType = false);
|
||||
Id makeDebugSource(const Id fileName);
|
||||
Id makeDebugCompilationUnit();
|
||||
Id createDebugGlobalVariable(Id const type, char const*const name, Id const variable);
|
||||
Id createDebugLocalVariable(Id type, char const*const name, size_t const argNumber = 0);
|
||||
Id makeDebugExpression();
|
||||
Id makeDebugDeclare(Id const debugLocalVariable, Id const localVariable);
|
||||
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);
|
||||
std::string unmangleFunctionName(std::string const& name) const;
|
||||
|
||||
// accelerationStructureNV type
|
||||
Id makeAccelerationStructureType();
|
||||
|
@ -202,6 +256,7 @@ public:
|
|||
StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); }
|
||||
ImageFormat getImageTypeFormat(Id typeId) const
|
||||
{ return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
|
||||
Id getResultingAccessChainType() const;
|
||||
|
||||
bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
|
||||
bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
|
||||
|
@ -255,6 +310,8 @@ public:
|
|||
// See if a resultId is valid for use as an initializer.
|
||||
bool isValidInitializer(Id resultId) const { return isConstant(resultId) || isGlobalVariable(resultId); }
|
||||
|
||||
bool isRayTracingOpCode(Op opcode) const;
|
||||
|
||||
int getScalarTypeWidth(Id typeId) const
|
||||
{
|
||||
Id scalarTypeId = getScalarTypeId(typeId);
|
||||
|
@ -293,6 +350,7 @@ 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 makeInt8Constant(int i, bool specConstant = false)
|
||||
{ return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); }
|
||||
|
@ -315,6 +373,8 @@ public:
|
|||
Id makeFloat16Constant(float f16, bool specConstant = false);
|
||||
Id makeFpConstant(Id type, double d, bool specConstant = false);
|
||||
|
||||
Id importNonSemanticShaderDebugInfoInstructions();
|
||||
|
||||
// Turn the array of constants into a proper spv constant of the requested type.
|
||||
Id makeCompositeConstant(Id type, const std::vector<Id>& comps, bool specConst = false);
|
||||
|
||||
|
@ -337,7 +397,12 @@ public:
|
|||
void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector<const char*>& strings);
|
||||
|
||||
// At the end of what block do the next create*() instructions go?
|
||||
void setBuildPoint(Block* bp) { buildPoint = bp; }
|
||||
// Also reset current last DebugScope and current source line to unknown
|
||||
void setBuildPoint(Block* bp) {
|
||||
buildPoint = bp;
|
||||
lastDebugScopeId = NoResult;
|
||||
currentLine = 0;
|
||||
}
|
||||
Block* getBuildPoint() const { return buildPoint; }
|
||||
|
||||
// Make the entry-point function. The returned pointer is only valid
|
||||
|
@ -348,21 +413,36 @@ public:
|
|||
// Return the function, pass back the entry.
|
||||
// The returned pointer is only valid for the lifetime of this builder.
|
||||
Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name,
|
||||
const std::vector<Id>& paramTypes, const std::vector<std::vector<Decoration>>& precisions, Block **entry = 0);
|
||||
const std::vector<Id>& paramTypes, const std::vector<char const*>& paramNames,
|
||||
const std::vector<std::vector<Decoration>>& precisions, Block **entry = 0);
|
||||
|
||||
// Create a return. An 'implicit' return is one not appearing in the source
|
||||
// code. In the case of an implicit return, no post-return block is inserted.
|
||||
void makeReturn(bool implicit, Id retVal = 0);
|
||||
|
||||
// Initialize state and generate instructions for new lexical scope
|
||||
void enterScope(uint32_t line);
|
||||
|
||||
// Set state and generate instructions to exit current lexical scope
|
||||
void leaveScope();
|
||||
|
||||
// Prepare builder for generation of instructions for a function.
|
||||
void enterFunction(Function const* function);
|
||||
|
||||
// Generate all the code needed to finish up a function.
|
||||
void leaveFunction();
|
||||
|
||||
// Create a discard.
|
||||
void makeDiscard();
|
||||
// Create block terminator instruction for certain statements like
|
||||
// discard, terminate-invocation, terminateRayEXT, or ignoreIntersectionEXT
|
||||
void makeStatementTerminator(spv::Op opcode, const char *name);
|
||||
|
||||
// Create block terminator instruction for statements that have input operands
|
||||
// such as OpEmitMeshTasksEXT
|
||||
void makeStatementTerminator(spv::Op opcode, const std::vector<Id>& operands, const char* name);
|
||||
|
||||
// Create a global or function local or IO variable.
|
||||
Id createVariable(Decoration precision, StorageClass, Id type, const char* name = nullptr,
|
||||
Id initializer = NoResult);
|
||||
Id createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name = nullptr,
|
||||
Id initializer = NoResult, bool const compilerGenerated = true);
|
||||
|
||||
// Create an intermediate with an undefined value.
|
||||
Id createUndefined(Id type);
|
||||
|
@ -624,6 +704,7 @@ public:
|
|||
CoherentFlags operator |=(const CoherentFlags &other) { return *this; }
|
||||
#else
|
||||
bool isVolatile() const { return volatil; }
|
||||
bool isNonUniform() const { return nonUniform; }
|
||||
bool anyCoherent() const {
|
||||
return coherent || devicecoherent || queuefamilycoherent || workgroupcoherent ||
|
||||
subgroupcoherent || shadercallcoherent;
|
||||
|
@ -638,6 +719,7 @@ public:
|
|||
unsigned nonprivate : 1;
|
||||
unsigned volatil : 1;
|
||||
unsigned isImage : 1;
|
||||
unsigned nonUniform : 1;
|
||||
|
||||
void clear() {
|
||||
coherent = 0;
|
||||
|
@ -649,6 +731,7 @@ public:
|
|||
nonprivate = 0;
|
||||
volatil = 0;
|
||||
isImage = 0;
|
||||
nonUniform = 0;
|
||||
}
|
||||
|
||||
CoherentFlags operator |=(const CoherentFlags &other) {
|
||||
|
@ -661,6 +744,7 @@ public:
|
|||
nonprivate |= other.nonprivate;
|
||||
volatil |= other.volatil;
|
||||
isImage |= other.isImage;
|
||||
nonUniform |= other.nonUniform;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
@ -721,11 +805,12 @@ public:
|
|||
}
|
||||
|
||||
// use accessChain and swizzle to store value
|
||||
void accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
|
||||
void accessChainStore(Id rvalue, Decoration nonUniform,
|
||||
spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
|
||||
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
|
||||
|
||||
// use accessChain and swizzle to load an r-value
|
||||
Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType,
|
||||
Id accessChainLoad(Decoration precision, Decoration l_nonUniform, Decoration r_nonUniform, Id ResultType,
|
||||
spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax,
|
||||
unsigned int alignment = 0);
|
||||
|
||||
|
@ -792,13 +877,23 @@ public:
|
|||
const;
|
||||
|
||||
unsigned int spvVersion; // the version of SPIR-V to emit in the header
|
||||
SourceLanguage source;
|
||||
SourceLanguage sourceLang;
|
||||
int sourceVersion;
|
||||
spv::Id sourceFileStringId;
|
||||
spv::Id nonSemanticShaderCompilationUnitId {0};
|
||||
spv::Id nonSemanticShaderDebugInfo {0};
|
||||
spv::Id debugInfoNone {0};
|
||||
spv::Id debugExpression {0}; // Debug expression with zero operations.
|
||||
std::string sourceText;
|
||||
int currentLine;
|
||||
const char* currentFile;
|
||||
spv::Id currentFileId;
|
||||
std::stack<spv::Id> currentDebugScopeId;
|
||||
spv::Id lastDebugScopeId;
|
||||
bool emitOpLines;
|
||||
bool emitNonSemanticShaderDebugInfo;
|
||||
bool restoreNonSemanticShaderDebugInfo;
|
||||
bool emitNonSemanticShaderDebugSource;
|
||||
std::set<std::string> extensions;
|
||||
std::vector<const char*> sourceExtensions;
|
||||
std::vector<const char*> moduleProcesses;
|
||||
|
@ -832,6 +927,10 @@ public:
|
|||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedStructConstants;
|
||||
// map type opcodes to type instructions
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedTypes;
|
||||
// map type opcodes to debug type instructions
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedDebugTypes;
|
||||
// list of OpConstantNull instructions
|
||||
std::vector<Instruction*> nullConstants;
|
||||
|
||||
// stack of switches
|
||||
std::stack<Block*> switchMerges;
|
||||
|
@ -845,6 +944,12 @@ public:
|
|||
// map from include file name ids to their contents
|
||||
std::map<spv::Id, const std::string*> includeFiles;
|
||||
|
||||
// map from core id to debug id
|
||||
std::map <spv::Id, spv::Id> debugId;
|
||||
|
||||
// map from file name string id to DebugSource id
|
||||
std::unordered_map<spv::Id, spv::Id> debugSourceId;
|
||||
|
||||
// The stream for outputting warnings and errors.
|
||||
SpvBuildLogger* logger;
|
||||
}; // end Builder class
|
||||
|
|
|
@ -44,10 +44,8 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include "SpvBuilder.h"
|
||||
|
||||
#include "spirv.hpp"
|
||||
#include "GlslangToSpv.h"
|
||||
#include "SpvBuilder.h"
|
||||
|
||||
namespace spv {
|
||||
#include "GLSL.std.450.h"
|
||||
#include "GLSL.ext.KHR.h"
|
||||
|
@ -113,8 +111,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case OpAccessChain:
|
||||
case OpPtrAccessChain:
|
||||
case OpCopyObject:
|
||||
break;
|
||||
case OpFConvert:
|
||||
|
@ -161,26 +157,43 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
|||
switch (inst.getImmediateOperand(1)) {
|
||||
case GLSLstd450Frexp:
|
||||
case GLSLstd450FrexpStruct:
|
||||
if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeInt, 16))
|
||||
if (getSpvVersion() < spv::Spv_1_3 && containsType(typeId, OpTypeInt, 16))
|
||||
addExtension(spv::E_SPV_AMD_gpu_shader_int16);
|
||||
break;
|
||||
case GLSLstd450InterpolateAtCentroid:
|
||||
case GLSLstd450InterpolateAtSample:
|
||||
case GLSLstd450InterpolateAtOffset:
|
||||
if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeFloat, 16))
|
||||
if (getSpvVersion() < spv::Spv_1_3 && containsType(typeId, OpTypeFloat, 16))
|
||||
addExtension(spv::E_SPV_AMD_gpu_shader_half_float);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case OpAccessChain:
|
||||
case OpPtrAccessChain:
|
||||
if (isPointerType(typeId))
|
||||
break;
|
||||
if (basicTypeOp == OpTypeInt) {
|
||||
if (width == 16)
|
||||
addCapability(CapabilityInt16);
|
||||
else if (width == 8)
|
||||
addCapability(CapabilityInt8);
|
||||
}
|
||||
default:
|
||||
if (basicTypeOp == OpTypeFloat && width == 16)
|
||||
addCapability(CapabilityFloat16);
|
||||
if (basicTypeOp == OpTypeInt && width == 16)
|
||||
addCapability(CapabilityInt16);
|
||||
if (basicTypeOp == OpTypeInt && width == 8)
|
||||
addCapability(CapabilityInt8);
|
||||
if (basicTypeOp == OpTypeInt) {
|
||||
if (width == 16)
|
||||
addCapability(CapabilityInt16);
|
||||
else if (width == 8)
|
||||
addCapability(CapabilityInt8);
|
||||
else if (width == 64)
|
||||
addCapability(CapabilityInt64);
|
||||
} else if (basicTypeOp == OpTypeFloat) {
|
||||
if (width == 16)
|
||||
addCapability(CapabilityFloat16);
|
||||
else if (width == 64)
|
||||
addCapability(CapabilityFloat64);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -436,6 +449,38 @@ void Builder::postProcessFeatures() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If any Vulkan memory model-specific functionality is used, update the
|
||||
// OpMemoryModel to match.
|
||||
if (capabilities.find(spv::CapabilityVulkanMemoryModelKHR) != capabilities.end()) {
|
||||
memoryModel = spv::MemoryModelVulkanKHR;
|
||||
addIncorporatedExtension(spv::E_SPV_KHR_vulkan_memory_model, spv::Spv_1_5);
|
||||
}
|
||||
|
||||
// Add Aliased decoration if there's more than one Workgroup Block variable.
|
||||
if (capabilities.find(spv::CapabilityWorkgroupMemoryExplicitLayoutKHR) != capabilities.end()) {
|
||||
assert(entryPoints.size() == 1);
|
||||
auto &ep = entryPoints[0];
|
||||
|
||||
std::vector<Id> workgroup_variables;
|
||||
for (int i = 0; i < (int)ep->getNumOperands(); i++) {
|
||||
if (!ep->isIdOperand(i))
|
||||
continue;
|
||||
|
||||
const Id id = ep->getIdOperand(i);
|
||||
const Instruction *instr = module.getInstruction(id);
|
||||
if (instr->getOpCode() != spv::OpVariable)
|
||||
continue;
|
||||
|
||||
if (instr->getImmediateOperand(0) == spv::StorageClassWorkgroup)
|
||||
workgroup_variables.push_back(id);
|
||||
}
|
||||
|
||||
if (workgroup_variables.size() > 1) {
|
||||
for (size_t i = 0; i < workgroup_variables.size(); i++)
|
||||
addDecoration(workgroup_variables[i], spv::DecorationAliased);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
|
||||
#include "SpvTools.h"
|
||||
#include "spirv-tools/optimizer.hpp"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
|
@ -69,6 +68,8 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
|
|||
}
|
||||
case glslang::EShTargetVulkan_1_2:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_2;
|
||||
case glslang::EShTargetVulkan_1_3:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_3;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -114,11 +115,18 @@ void OptimizerMesssageConsumer(spv_message_level_t level, const char *source,
|
|||
out << std::endl;
|
||||
}
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V.
|
||||
// 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)
|
||||
{
|
||||
SpirvToolsDisassemble(out, spirv, spv_target_env::SPV_ENV_UNIVERSAL_1_3);
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
// disassemble
|
||||
spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_3);
|
||||
spv_context context = spvContextCreate(requested_context);
|
||||
spv_text text;
|
||||
spv_diagnostic diagnostic = nullptr;
|
||||
spvBinaryToText(context, spirv.data(), spirv.size(),
|
||||
|
@ -147,6 +155,8 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
|
|||
spv_validator_options options = spvValidatorOptionsCreate();
|
||||
spvValidatorOptionsSetRelaxBlockLayout(options, intermediate.usingHlslOffsets());
|
||||
spvValidatorOptionsSetBeforeHlslLegalization(options, prelegalization);
|
||||
spvValidatorOptionsSetScalarBlockLayout(options, intermediate.usingScalarBlockLayout());
|
||||
spvValidatorOptionsSetWorkgroupScalarBlockLayout(options, intermediate.usingScalarBlockLayout());
|
||||
spvValidateWithOptions(context, options, &binary, &diagnostic);
|
||||
|
||||
// report
|
||||
|
@ -174,10 +184,7 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector
|
|||
// line information into all SPIR-V instructions. This avoids loss of
|
||||
// information when instructions are deleted or moved. Later, remove
|
||||
// redundant information to minimize final SPRIR-V size.
|
||||
if (options->generateDebugInfo) {
|
||||
optimizer.RegisterPass(spvtools::CreatePropagateLineInfoPass());
|
||||
}
|
||||
else if (options->stripDebugInfo) {
|
||||
if (options->stripDebugInfo) {
|
||||
optimizer.RegisterPass(spvtools::CreateStripDebugInfoPass());
|
||||
}
|
||||
optimizer.RegisterPass(spvtools::CreateWrapOpKillPass());
|
||||
|
@ -202,14 +209,14 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector
|
|||
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
|
||||
optimizer.RegisterPass(spvtools::CreateVectorDCEPass());
|
||||
optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass());
|
||||
optimizer.RegisterPass(spvtools::CreateInterpolateFixupPass());
|
||||
if (options->optimizeSize) {
|
||||
optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass());
|
||||
if (intermediate.getStage() == EShLanguage::EShLangVertex)
|
||||
optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsPass());
|
||||
}
|
||||
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
|
||||
optimizer.RegisterPass(spvtools::CreateCFGCleanupPass());
|
||||
if (options->generateDebugInfo) {
|
||||
optimizer.RegisterPass(spvtools::CreateRedundantLineInfoElimPass());
|
||||
}
|
||||
|
||||
spvtools::OptimizerOptions spvOptOptions;
|
||||
optimizer.SetTargetEnv(MapToSpirvToolsEnv(intermediate.getSpv(), logger));
|
||||
|
|
|
@ -41,32 +41,37 @@
|
|||
#ifndef GLSLANG_SPV_TOOLS_H
|
||||
#define GLSLANG_SPV_TOOLS_H
|
||||
|
||||
#ifdef ENABLE_OPT
|
||||
#if ENABLE_OPT
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#endif
|
||||
|
||||
#include "../glslang/MachineIndependent/localintermediate.h"
|
||||
#include "glslang/MachineIndependent/localintermediate.h"
|
||||
#include "Logger.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
struct SpvOptions {
|
||||
SpvOptions() : generateDebugInfo(false), stripDebugInfo(false), disableOptimizer(true),
|
||||
optimizeSize(false), disassemble(false), validate(false) { }
|
||||
bool generateDebugInfo;
|
||||
bool stripDebugInfo;
|
||||
bool disableOptimizer;
|
||||
bool optimizeSize;
|
||||
bool disassemble;
|
||||
bool validate;
|
||||
bool generateDebugInfo {false};
|
||||
bool stripDebugInfo {false};
|
||||
bool disableOptimizer {true};
|
||||
bool optimizeSize {false};
|
||||
bool disassemble {false};
|
||||
bool validate {false};
|
||||
bool emitNonSemanticShaderDebugInfo {false};
|
||||
bool emitNonSemanticShaderDebugSource{ false };
|
||||
};
|
||||
|
||||
#ifdef ENABLE_OPT
|
||||
#if ENABLE_OPT
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V.
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// Apply the SPIRV-Tools validator to generated SPIR-V.
|
||||
void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*, bool prelegalization);
|
||||
|
|
|
@ -43,10 +43,10 @@
|
|||
#include <stack>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
#include "disassemble.h"
|
||||
#include "doc.h"
|
||||
#include "SpvTools.h"
|
||||
|
||||
namespace spv {
|
||||
extern "C" {
|
||||
|
@ -101,6 +101,7 @@ protected:
|
|||
void outputMask(OperandClass operandClass, unsigned mask);
|
||||
void disassembleImmediates(int numOperands);
|
||||
void disassembleIds(int numOperands);
|
||||
std::pair<int, std::string> decodeString();
|
||||
int disassembleString();
|
||||
void disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands);
|
||||
|
||||
|
@ -291,31 +292,44 @@ void SpirvStream::disassembleIds(int numOperands)
|
|||
}
|
||||
}
|
||||
|
||||
// return the number of operands consumed by the string
|
||||
int SpirvStream::disassembleString()
|
||||
// decode string from words at current position (non-consuming)
|
||||
std::pair<int, std::string> SpirvStream::decodeString()
|
||||
{
|
||||
int startWord = word;
|
||||
|
||||
out << " \"";
|
||||
|
||||
const char* wordString;
|
||||
std::string res;
|
||||
int wordPos = word;
|
||||
char c;
|
||||
bool done = false;
|
||||
|
||||
do {
|
||||
unsigned int content = stream[word];
|
||||
wordString = (const char*)&content;
|
||||
unsigned int content = stream[wordPos];
|
||||
for (int charCount = 0; charCount < 4; ++charCount) {
|
||||
if (*wordString == 0) {
|
||||
c = content & 0xff;
|
||||
content >>= 8;
|
||||
if (c == '\0') {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
out << *(wordString++);
|
||||
res += c;
|
||||
}
|
||||
++word;
|
||||
} while (! done);
|
||||
++wordPos;
|
||||
} while(! done);
|
||||
|
||||
return std::make_pair(wordPos - word, res);
|
||||
}
|
||||
|
||||
// return the number of operands consumed by the string
|
||||
int SpirvStream::disassembleString()
|
||||
{
|
||||
out << " \"";
|
||||
|
||||
std::pair<int, std::string> decoderes = decodeString();
|
||||
|
||||
out << decoderes.second;
|
||||
out << "\"";
|
||||
|
||||
return word - startWord;
|
||||
word += decoderes.first;
|
||||
|
||||
return decoderes.first;
|
||||
}
|
||||
|
||||
void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
|
||||
|
@ -332,7 +346,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
|||
nextNestedControl = 0;
|
||||
}
|
||||
} else if (opCode == OpExtInstImport) {
|
||||
idDescriptor[resultId] = (const char*)(&stream[word]);
|
||||
idDescriptor[resultId] = decodeString().second;
|
||||
}
|
||||
else {
|
||||
if (resultId != 0 && idDescriptor[resultId].size() == 0) {
|
||||
|
@ -429,7 +443,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
|||
--numOperands;
|
||||
// Get names for printing "(XXX)" for readability, *after* this id
|
||||
if (opCode == OpName)
|
||||
idDescriptor[stream[word - 1]] = (const char*)(&stream[word]);
|
||||
idDescriptor[stream[word - 1]] = decodeString().second;
|
||||
break;
|
||||
case OperandVariableIds:
|
||||
disassembleIds(numOperands);
|
||||
|
|
|
@ -97,6 +97,8 @@ const char* ExecutionModelString(int model)
|
|||
case 6: return "Kernel";
|
||||
case ExecutionModelTaskNV: return "TaskNV";
|
||||
case ExecutionModelMeshNV: return "MeshNV";
|
||||
case ExecutionModelTaskEXT: return "TaskEXT";
|
||||
case ExecutionModelMeshEXT: return "MeshEXT";
|
||||
|
||||
default: return "Bad";
|
||||
|
||||
|
@ -173,27 +175,32 @@ const char* ExecutionModeString(int mode)
|
|||
case 31: return "ContractionOff";
|
||||
case 32: return "Bad";
|
||||
|
||||
case ExecutionModeInitializer: return "Initializer";
|
||||
case ExecutionModeFinalizer: return "Finalizer";
|
||||
case ExecutionModeSubgroupSize: return "SubgroupSize";
|
||||
case ExecutionModeSubgroupsPerWorkgroup: return "SubgroupsPerWorkgroup";
|
||||
case ExecutionModeSubgroupsPerWorkgroupId: return "SubgroupsPerWorkgroupId";
|
||||
case ExecutionModeLocalSizeId: return "LocalSizeId";
|
||||
case ExecutionModeLocalSizeHintId: return "LocalSizeHintId";
|
||||
case ExecutionModeInitializer: return "Initializer";
|
||||
case ExecutionModeFinalizer: return "Finalizer";
|
||||
case ExecutionModeSubgroupSize: return "SubgroupSize";
|
||||
case ExecutionModeSubgroupsPerWorkgroup: return "SubgroupsPerWorkgroup";
|
||||
case ExecutionModeSubgroupsPerWorkgroupId: return "SubgroupsPerWorkgroupId";
|
||||
case ExecutionModeLocalSizeId: return "LocalSizeId";
|
||||
case ExecutionModeLocalSizeHintId: return "LocalSizeHintId";
|
||||
|
||||
case ExecutionModePostDepthCoverage: return "PostDepthCoverage";
|
||||
case ExecutionModeDenormPreserve: return "DenormPreserve";
|
||||
case ExecutionModeDenormFlushToZero: return "DenormFlushToZero";
|
||||
case ExecutionModeSignedZeroInfNanPreserve: return "SignedZeroInfNanPreserve";
|
||||
case ExecutionModeRoundingModeRTE: return "RoundingModeRTE";
|
||||
case ExecutionModeRoundingModeRTZ: return "RoundingModeRTZ";
|
||||
case ExecutionModeStencilRefReplacingEXT: return "StencilRefReplacingEXT";
|
||||
case ExecutionModePostDepthCoverage: return "PostDepthCoverage";
|
||||
case ExecutionModeDenormPreserve: return "DenormPreserve";
|
||||
case ExecutionModeDenormFlushToZero: return "DenormFlushToZero";
|
||||
case ExecutionModeSignedZeroInfNanPreserve: return "SignedZeroInfNanPreserve";
|
||||
case ExecutionModeRoundingModeRTE: return "RoundingModeRTE";
|
||||
case ExecutionModeRoundingModeRTZ: return "RoundingModeRTZ";
|
||||
case ExecutionModeEarlyAndLateFragmentTestsAMD: return "EarlyAndLateFragmentTestsAMD";
|
||||
case ExecutionModeStencilRefUnchangedFrontAMD: return "StencilRefUnchangedFrontAMD";
|
||||
case ExecutionModeStencilRefLessFrontAMD: return "StencilRefLessFrontAMD";
|
||||
case ExecutionModeStencilRefGreaterBackAMD: return "StencilRefGreaterBackAMD";
|
||||
case ExecutionModeStencilRefReplacingEXT: return "StencilRefReplacingEXT";
|
||||
case ExecutionModeSubgroupUniformControlFlowKHR: return "SubgroupUniformControlFlow";
|
||||
|
||||
case ExecutionModeOutputLinesNV: return "OutputLinesNV";
|
||||
case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV";
|
||||
case ExecutionModeOutputTrianglesNV: return "OutputTrianglesNV";
|
||||
case ExecutionModeDerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV";
|
||||
case ExecutionModeDerivativeGroupLinearNV: return "DerivativeGroupLinearNV";
|
||||
case ExecutionModeOutputLinesNV: return "OutputLinesNV";
|
||||
case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV";
|
||||
case ExecutionModeOutputTrianglesNV: return "OutputTrianglesNV";
|
||||
case ExecutionModeDerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV";
|
||||
case ExecutionModeDerivativeGroupLinearNV: return "DerivativeGroupLinearNV";
|
||||
|
||||
case ExecutionModePixelInterlockOrderedEXT: return "PixelInterlockOrderedEXT";
|
||||
case ExecutionModePixelInterlockUnorderedEXT: return "PixelInterlockUnorderedEXT";
|
||||
|
@ -237,7 +244,7 @@ const char* StorageClassString(int StorageClass)
|
|||
case StorageClassIncomingCallableDataKHR: return "IncomingCallableDataKHR";
|
||||
|
||||
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
|
||||
|
||||
case StorageClassTaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT";
|
||||
default: return "Bad";
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +311,8 @@ const char* DecorationString(int decoration)
|
|||
case DecorationPerPrimitiveNV: return "PerPrimitiveNV";
|
||||
case DecorationPerViewNV: return "PerViewNV";
|
||||
case DecorationPerTaskNV: return "PerTaskNV";
|
||||
case DecorationPerVertexNV: return "PerVertexNV";
|
||||
|
||||
case DecorationPerVertexKHR: return "PerVertexKHR";
|
||||
|
||||
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
|
||||
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
|
||||
|
@ -372,6 +380,8 @@ const char* BuiltInString(int builtIn)
|
|||
case 4424: return "BaseVertex";
|
||||
case 4425: return "BaseInstance";
|
||||
case 4426: return "DrawIndex";
|
||||
case 4432: return "PrimitiveShadingRateKHR";
|
||||
case 4444: return "ShadingRateKHR";
|
||||
case 5014: return "FragStencilRefEXT";
|
||||
|
||||
case 4992: return "BaryCoordNoPerspAMD";
|
||||
|
@ -389,11 +399,12 @@ const char* BuiltInString(int builtIn)
|
|||
case BuiltInObjectRayDirectionKHR: return "ObjectRayDirectionKHR";
|
||||
case BuiltInRayTminKHR: return "RayTminKHR";
|
||||
case BuiltInRayTmaxKHR: return "RayTmaxKHR";
|
||||
case BuiltInCullMaskKHR: return "CullMaskKHR";
|
||||
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
|
||||
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
|
||||
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
|
||||
case BuiltInWorldToObjectKHR: return "WorldToObjectKHR";
|
||||
case BuiltInHitTKHR: return "HitTKHR";
|
||||
case BuiltInHitTNV: return "HitTNV";
|
||||
case BuiltInHitKindKHR: return "HitKindKHR";
|
||||
case BuiltInIncomingRayFlagsKHR: return "IncomingRayFlagsKHR";
|
||||
case BuiltInViewportMaskNV: return "ViewportMaskNV";
|
||||
|
@ -403,8 +414,8 @@ const char* BuiltInString(int builtIn)
|
|||
case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
|
||||
// case BuiltInFragmentSizeNV: return "FragmentSizeNV"; // superseded by BuiltInFragSizeEXT
|
||||
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
|
||||
case BuiltInBaryCoordNV: return "BaryCoordNV";
|
||||
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
|
||||
case BuiltInBaryCoordKHR: return "BaryCoordKHR";
|
||||
case BuiltInBaryCoordNoPerspKHR: return "BaryCoordNoPerspKHR";
|
||||
|
||||
case BuiltInFragSizeEXT: return "FragSizeEXT";
|
||||
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||
|
@ -423,6 +434,11 @@ const char* BuiltInString(int builtIn)
|
|||
case BuiltInSMCountNV: return "SMCountNV";
|
||||
case BuiltInWarpIDNV: return "WarpIDNV";
|
||||
case BuiltInSMIDNV: return "SMIDNV";
|
||||
case BuiltInCurrentRayTimeNV: return "CurrentRayTimeNV";
|
||||
case BuiltInPrimitivePointIndicesEXT: return "PrimitivePointIndicesEXT";
|
||||
case BuiltInPrimitiveLineIndicesEXT: return "PrimitiveLineIndicesEXT";
|
||||
case BuiltInPrimitiveTriangleIndicesEXT: return "PrimitiveTriangleIndicesEXT";
|
||||
case BuiltInCullPrimitiveEXT: return "CullPrimitiveEXT";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
|
@ -521,6 +537,8 @@ const char* ImageFormatString(int format)
|
|||
case 37: return "Rg8ui";
|
||||
case 38: return "R16ui";
|
||||
case 39: return "R8ui";
|
||||
case 40: return "R64ui";
|
||||
case 41: return "R64i";
|
||||
|
||||
default:
|
||||
return "Bad";
|
||||
|
@ -894,6 +912,12 @@ const char* CapabilityString(int info)
|
|||
case CapabilityDeviceGroup: return "DeviceGroup";
|
||||
case CapabilityMultiView: return "MultiView";
|
||||
|
||||
case CapabilityDenormPreserve: return "DenormPreserve";
|
||||
case CapabilityDenormFlushToZero: return "DenormFlushToZero";
|
||||
case CapabilitySignedZeroInfNanPreserve: return "SignedZeroInfNanPreserve";
|
||||
case CapabilityRoundingModeRTE: return "RoundingModeRTE";
|
||||
case CapabilityRoundingModeRTZ: return "RoundingModeRTZ";
|
||||
|
||||
case CapabilityStencilExportEXT: return "StencilExportEXT";
|
||||
|
||||
case CapabilityFloat16ImageAMD: return "Float16ImageAMD";
|
||||
|
@ -911,14 +935,18 @@ const char* CapabilityString(int info)
|
|||
case CapabilityPerViewAttributesNV: return "PerViewAttributesNV";
|
||||
case CapabilityGroupNonUniformPartitionedNV: return "GroupNonUniformPartitionedNV";
|
||||
case CapabilityRayTracingNV: return "RayTracingNV";
|
||||
case CapabilityRayTracingMotionBlurNV: return "RayTracingMotionBlurNV";
|
||||
case CapabilityRayTracingKHR: return "RayTracingKHR";
|
||||
case CapabilityRayCullMaskKHR: return "RayCullMaskKHR";
|
||||
case CapabilityRayQueryKHR: return "RayQueryKHR";
|
||||
case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR";
|
||||
case CapabilityRayQueryProvisionalKHR: return "RayQueryProvisionalKHR";
|
||||
case CapabilityRayTraversalPrimitiveCullingProvisionalKHR: return "RayTraversalPrimitiveCullingProvisionalKHR";
|
||||
case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
|
||||
case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV";
|
||||
case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV";
|
||||
case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV";
|
||||
case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR";
|
||||
case CapabilityMeshShadingNV: return "MeshShadingNV";
|
||||
case CapabilityImageFootprintNV: return "ImageFootprintNV";
|
||||
case CapabilityMeshShadingEXT: return "MeshShadingEXT";
|
||||
// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT
|
||||
case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV";
|
||||
case CapabilityFragmentDensityEXT: return "FragmentDensityEXT";
|
||||
|
@ -952,13 +980,24 @@ const char* CapabilityString(int info)
|
|||
case CapabilityFragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT";
|
||||
case CapabilityFragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT";
|
||||
|
||||
case CapabilityFragmentShadingRateKHR: return "FragmentShadingRateKHR";
|
||||
|
||||
case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT";
|
||||
case CapabilityShaderClockKHR: return "ShaderClockKHR";
|
||||
case CapabilityInt64ImageEXT: return "Int64ImageEXT";
|
||||
|
||||
case CapabilityIntegerFunctions2INTEL: return "CapabilityIntegerFunctions2INTEL";
|
||||
|
||||
case CapabilityAtomicFloat16AddEXT: return "AtomicFloat16AddEXT";
|
||||
case CapabilityAtomicFloat32AddEXT: return "AtomicFloat32AddEXT";
|
||||
case CapabilityAtomicFloat64AddEXT: return "AtomicFloat64AddEXT";
|
||||
case CapabilityAtomicFloat16MinMaxEXT: return "AtomicFloat16MinMaxEXT";
|
||||
case CapabilityAtomicFloat32MinMaxEXT: return "AtomicFloat32MinMaxEXT";
|
||||
case CapabilityAtomicFloat64MinMaxEXT: return "AtomicFloat64MinMaxEXT";
|
||||
|
||||
case CapabilityWorkgroupMemoryExplicitLayoutKHR: return "CapabilityWorkgroupMemoryExplicitLayoutKHR";
|
||||
case CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR";
|
||||
case CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
|
@ -1329,6 +1368,8 @@ const char* OpcodeString(int op)
|
|||
case 365: return "OpGroupNonUniformQuadBroadcast";
|
||||
case 366: return "OpGroupNonUniformQuadSwap";
|
||||
|
||||
case OpTerminateInvocation: return "OpTerminateInvocation";
|
||||
|
||||
case 4421: return "OpSubgroupBallotKHR";
|
||||
case 4422: return "OpSubgroupFirstInvocationKHR";
|
||||
case 4428: return "OpSubgroupAllKHR";
|
||||
|
@ -1337,6 +1378,8 @@ const char* OpcodeString(int op)
|
|||
case 4432: return "OpSubgroupReadInvocationKHR";
|
||||
|
||||
case OpAtomicFAddEXT: return "OpAtomicFAddEXT";
|
||||
case OpAtomicFMinEXT: return "OpAtomicFMinEXT";
|
||||
case OpAtomicFMaxEXT: return "OpAtomicFMaxEXT";
|
||||
|
||||
case 5000: return "OpGroupIAddNonUniformAMD";
|
||||
case 5001: return "OpGroupFAddNonUniformAMD";
|
||||
|
@ -1355,17 +1398,26 @@ const char* OpcodeString(int op)
|
|||
case OpDecorateStringGOOGLE: return "OpDecorateStringGOOGLE";
|
||||
case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
|
||||
|
||||
case OpReportIntersectionKHR: return "OpReportIntersectionKHR";
|
||||
case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV";
|
||||
case OpIgnoreIntersectionKHR: return "OpIgnoreIntersectionKHR";
|
||||
case OpTerminateRayNV: return "OpTerminateRayNV";
|
||||
case OpTerminateRayKHR: return "OpTerminateRayKHR";
|
||||
case OpTraceNV: return "OpTraceNV";
|
||||
case OpTraceRayMotionNV: return "OpTraceRayMotionNV";
|
||||
case OpTraceRayKHR: return "OpTraceRayKHR";
|
||||
case OpTypeAccelerationStructureKHR: return "OpTypeAccelerationStructureKHR";
|
||||
case OpExecuteCallableNV: return "OpExecuteCallableNV";
|
||||
case OpExecuteCallableKHR: return "OpExecuteCallableKHR";
|
||||
case OpConvertUToAccelerationStructureKHR: return "OpConvertUToAccelerationStructureKHR";
|
||||
|
||||
case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV";
|
||||
case OpReportIntersectionKHR: return "OpReportIntersectionKHR";
|
||||
case OpIgnoreIntersectionKHR: return "OpIgnoreIntersectionKHR";
|
||||
case OpTerminateRayKHR: return "OpTerminateRayKHR";
|
||||
case OpTraceRayKHR: return "OpTraceRayKHR";
|
||||
case OpTypeAccelerationStructureKHR: return "OpTypeAccelerationStructureKHR";
|
||||
case OpExecuteCallableKHR: return "OpExecuteCallableKHR";
|
||||
case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV";
|
||||
case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV";
|
||||
case OpEmitMeshTasksEXT: return "OpEmitMeshTasksEXT";
|
||||
case OpSetMeshOutputsEXT: return "OpSetMeshOutputsEXT";
|
||||
|
||||
case OpTypeRayQueryProvisionalKHR: return "OpTypeRayQueryProvisionalKHR";
|
||||
case OpTypeRayQueryKHR: return "OpTypeRayQueryKHR";
|
||||
case OpRayQueryInitializeKHR: return "OpRayQueryInitializeKHR";
|
||||
case OpRayQueryTerminateKHR: return "OpRayQueryTerminateKHR";
|
||||
case OpRayQueryGenerateIntersectionKHR: return "OpRayQueryGenerateIntersectionKHR";
|
||||
|
@ -1497,6 +1549,7 @@ void Parameterize()
|
|||
InstructionDesc[OpBranchConditional].setResultAndType(false, false);
|
||||
InstructionDesc[OpSwitch].setResultAndType(false, false);
|
||||
InstructionDesc[OpKill].setResultAndType(false, false);
|
||||
InstructionDesc[OpTerminateInvocation].setResultAndType(false, false);
|
||||
InstructionDesc[OpReturn].setResultAndType(false, false);
|
||||
InstructionDesc[OpReturnValue].setResultAndType(false, false);
|
||||
InstructionDesc[OpUnreachable].setResultAndType(false, false);
|
||||
|
@ -2320,6 +2373,16 @@ void Parameterize()
|
|||
InstructionDesc[OpAtomicSMax].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicSMax].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
|
@ -2698,7 +2761,7 @@ void Parameterize()
|
|||
|
||||
InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "X");
|
||||
InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandLiteralNumber, "'Direction'");
|
||||
InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "'Direction'");
|
||||
|
||||
InstructionDesc[OpSubgroupBallotKHR].operands.push(OperandId, "'Predicate'");
|
||||
|
||||
|
@ -2761,7 +2824,34 @@ void Parameterize()
|
|||
|
||||
InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false);
|
||||
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'NV Acceleration Structure'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Acceleration Structure'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Flags'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Cull Mask'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Offset'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Stride'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Miss Index'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Origin'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMin'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Direction'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMax'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Payload'");
|
||||
InstructionDesc[OpTraceNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Acceleration Structure'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Flags'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Cull Mask'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'SBT Record Offset'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'SBT Record Stride'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Miss Index'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Origin'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'TMin'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Direction'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'TMax'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Time'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Payload'");
|
||||
InstructionDesc[OpTraceRayMotionNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Acceleration Structure'");
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Flags'");
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Cull Mask'");
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'SBT Record Offset'");
|
||||
|
@ -2777,17 +2867,28 @@ void Parameterize()
|
|||
InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Parameter'");
|
||||
InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Kind'");
|
||||
|
||||
InstructionDesc[OpIgnoreIntersectionNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpIgnoreIntersectionKHR].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpTerminateRayNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpTerminateRayKHR].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "SBT Record Index");
|
||||
InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "CallableData ID");
|
||||
InstructionDesc[OpExecuteCallableNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "SBT Record Index");
|
||||
InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "CallableData ID");
|
||||
InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "CallableData");
|
||||
InstructionDesc[OpExecuteCallableKHR].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpConvertUToAccelerationStructureKHR].operands.push(OperandId, "Value");
|
||||
InstructionDesc[OpConvertUToAccelerationStructureKHR].setResultAndType(true, true);
|
||||
|
||||
// Ray Query
|
||||
InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false);
|
||||
InstructionDesc[OpTypeRayQueryProvisionalKHR].setResultAndType(true, false);
|
||||
InstructionDesc[OpTypeRayQueryKHR].setResultAndType(true, false);
|
||||
|
||||
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'AccelerationS'");
|
||||
|
@ -2889,6 +2990,17 @@ void Parameterize()
|
|||
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'");
|
||||
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'");
|
||||
|
||||
InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountX'");
|
||||
InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountY'");
|
||||
InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountZ'");
|
||||
InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'Payload'");
|
||||
InstructionDesc[OpEmitMeshTasksEXT].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpSetMeshOutputsEXT].operands.push(OperandId, "'vertexCount'");
|
||||
InstructionDesc[OpSetMeshOutputsEXT].operands.push(OperandId, "'primitiveCount'");
|
||||
InstructionDesc[OpSetMeshOutputsEXT].setResultAndType(false, false);
|
||||
|
||||
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'");
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'");
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Rows'");
|
||||
|
|
|
@ -49,12 +49,12 @@ namespace spv {
|
|||
|
||||
typedef unsigned int Id;
|
||||
|
||||
#define SPV_VERSION 0x10500
|
||||
#define SPV_REVISION 3
|
||||
#define SPV_VERSION 0x10600
|
||||
#define SPV_REVISION 1
|
||||
|
||||
static const unsigned int MagicNumber = 0x07230203;
|
||||
static const unsigned int Version = 0x00010500;
|
||||
static const unsigned int Revision = 3;
|
||||
static const unsigned int Version = 0x00010600;
|
||||
static const unsigned int Revision = 1;
|
||||
static const unsigned int OpCodeMask = 0xffff;
|
||||
static const unsigned int WordCountShift = 16;
|
||||
|
||||
|
@ -65,6 +65,7 @@ enum SourceLanguage {
|
|||
SourceLanguageOpenCL_C = 3,
|
||||
SourceLanguageOpenCL_CPP = 4,
|
||||
SourceLanguageHLSL = 5,
|
||||
SourceLanguageCPP_for_OpenCL = 6,
|
||||
SourceLanguageMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -90,6 +91,8 @@ enum ExecutionModel {
|
|||
ExecutionModelMissNV = 5317,
|
||||
ExecutionModelCallableKHR = 5318,
|
||||
ExecutionModelCallableNV = 5318,
|
||||
ExecutionModelTaskEXT = 5364,
|
||||
ExecutionModelMeshEXT = 5365,
|
||||
ExecutionModelMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -150,17 +153,28 @@ enum ExecutionMode {
|
|||
ExecutionModeSubgroupsPerWorkgroupId = 37,
|
||||
ExecutionModeLocalSizeId = 38,
|
||||
ExecutionModeLocalSizeHintId = 39,
|
||||
ExecutionModeSubgroupUniformControlFlowKHR = 4421,
|
||||
ExecutionModePostDepthCoverage = 4446,
|
||||
ExecutionModeDenormPreserve = 4459,
|
||||
ExecutionModeDenormFlushToZero = 4460,
|
||||
ExecutionModeSignedZeroInfNanPreserve = 4461,
|
||||
ExecutionModeRoundingModeRTE = 4462,
|
||||
ExecutionModeRoundingModeRTZ = 4463,
|
||||
ExecutionModeEarlyAndLateFragmentTestsAMD = 5017,
|
||||
ExecutionModeStencilRefReplacingEXT = 5027,
|
||||
ExecutionModeStencilRefUnchangedFrontAMD = 5079,
|
||||
ExecutionModeStencilRefGreaterFrontAMD = 5080,
|
||||
ExecutionModeStencilRefLessFrontAMD = 5081,
|
||||
ExecutionModeStencilRefUnchangedBackAMD = 5082,
|
||||
ExecutionModeStencilRefGreaterBackAMD = 5083,
|
||||
ExecutionModeStencilRefLessBackAMD = 5084,
|
||||
ExecutionModeOutputLinesEXT = 5269,
|
||||
ExecutionModeOutputLinesNV = 5269,
|
||||
ExecutionModeOutputPrimitivesEXT = 5270,
|
||||
ExecutionModeOutputPrimitivesNV = 5270,
|
||||
ExecutionModeDerivativeGroupQuadsNV = 5289,
|
||||
ExecutionModeDerivativeGroupLinearNV = 5290,
|
||||
ExecutionModeOutputTrianglesEXT = 5298,
|
||||
ExecutionModeOutputTrianglesNV = 5298,
|
||||
ExecutionModePixelInterlockOrderedEXT = 5366,
|
||||
ExecutionModePixelInterlockUnorderedEXT = 5367,
|
||||
|
@ -168,10 +182,16 @@ enum ExecutionMode {
|
|||
ExecutionModeSampleInterlockUnorderedEXT = 5369,
|
||||
ExecutionModeShadingRateInterlockOrderedEXT = 5370,
|
||||
ExecutionModeShadingRateInterlockUnorderedEXT = 5371,
|
||||
ExecutionModeSharedLocalMemorySizeINTEL = 5618,
|
||||
ExecutionModeRoundingModeRTPINTEL = 5620,
|
||||
ExecutionModeRoundingModeRTNINTEL = 5621,
|
||||
ExecutionModeFloatingPointModeALTINTEL = 5622,
|
||||
ExecutionModeFloatingPointModeIEEEINTEL = 5623,
|
||||
ExecutionModeMaxWorkgroupSizeINTEL = 5893,
|
||||
ExecutionModeMaxWorkDimINTEL = 5894,
|
||||
ExecutionModeNoGlobalOffsetINTEL = 5895,
|
||||
ExecutionModeNumSIMDWorkitemsINTEL = 5896,
|
||||
ExecutionModeSchedulerTargetFmaxMhzINTEL = 5903,
|
||||
ExecutionModeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -203,7 +223,10 @@ enum StorageClass {
|
|||
StorageClassShaderRecordBufferNV = 5343,
|
||||
StorageClassPhysicalStorageBuffer = 5349,
|
||||
StorageClassPhysicalStorageBufferEXT = 5349,
|
||||
StorageClassTaskPayloadWorkgroupEXT = 5402,
|
||||
StorageClassCodeSectionINTEL = 5605,
|
||||
StorageClassDeviceOnlyINTEL = 5936,
|
||||
StorageClassHostOnlyINTEL = 5937,
|
||||
StorageClassMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -274,6 +297,8 @@ enum ImageFormat {
|
|||
ImageFormatRg8ui = 37,
|
||||
ImageFormatR16ui = 38,
|
||||
ImageFormatR8ui = 39,
|
||||
ImageFormatR64ui = 40,
|
||||
ImageFormatR64i = 41,
|
||||
ImageFormatMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -341,6 +366,8 @@ enum ImageOperandsShift {
|
|||
ImageOperandsVolatileTexelKHRShift = 11,
|
||||
ImageOperandsSignExtendShift = 12,
|
||||
ImageOperandsZeroExtendShift = 13,
|
||||
ImageOperandsNontemporalShift = 14,
|
||||
ImageOperandsOffsetsShift = 16,
|
||||
ImageOperandsMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -364,6 +391,8 @@ enum ImageOperandsMask {
|
|||
ImageOperandsVolatileTexelKHRMask = 0x00000800,
|
||||
ImageOperandsSignExtendMask = 0x00001000,
|
||||
ImageOperandsZeroExtendMask = 0x00002000,
|
||||
ImageOperandsNontemporalMask = 0x00004000,
|
||||
ImageOperandsOffsetsMask = 0x00010000,
|
||||
};
|
||||
|
||||
enum FPFastMathModeShift {
|
||||
|
@ -372,6 +401,8 @@ enum FPFastMathModeShift {
|
|||
FPFastMathModeNSZShift = 2,
|
||||
FPFastMathModeAllowRecipShift = 3,
|
||||
FPFastMathModeFastShift = 4,
|
||||
FPFastMathModeAllowContractFastINTELShift = 16,
|
||||
FPFastMathModeAllowReassocINTELShift = 17,
|
||||
FPFastMathModeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -382,6 +413,8 @@ enum FPFastMathModeMask {
|
|||
FPFastMathModeNSZMask = 0x00000004,
|
||||
FPFastMathModeAllowRecipMask = 0x00000008,
|
||||
FPFastMathModeFastMask = 0x00000010,
|
||||
FPFastMathModeAllowContractFastINTELMask = 0x00010000,
|
||||
FPFastMathModeAllowReassocINTELMask = 0x00020000,
|
||||
};
|
||||
|
||||
enum FPRoundingMode {
|
||||
|
@ -395,6 +428,7 @@ enum FPRoundingMode {
|
|||
enum LinkageType {
|
||||
LinkageTypeExport = 0,
|
||||
LinkageTypeImport = 1,
|
||||
LinkageTypeLinkOnceODR = 2,
|
||||
LinkageTypeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -472,9 +506,11 @@ enum Decoration {
|
|||
DecorationPassthroughNV = 5250,
|
||||
DecorationViewportRelativeNV = 5252,
|
||||
DecorationSecondaryViewportRelativeNV = 5256,
|
||||
DecorationPerPrimitiveEXT = 5271,
|
||||
DecorationPerPrimitiveNV = 5271,
|
||||
DecorationPerViewNV = 5272,
|
||||
DecorationPerTaskNV = 5273,
|
||||
DecorationPerVertexKHR = 5285,
|
||||
DecorationPerVertexNV = 5285,
|
||||
DecorationNonUniform = 5300,
|
||||
DecorationNonUniformEXT = 5300,
|
||||
|
@ -482,12 +518,26 @@ enum Decoration {
|
|||
DecorationRestrictPointerEXT = 5355,
|
||||
DecorationAliasedPointer = 5356,
|
||||
DecorationAliasedPointerEXT = 5356,
|
||||
DecorationBindlessSamplerNV = 5398,
|
||||
DecorationBindlessImageNV = 5399,
|
||||
DecorationBoundSamplerNV = 5400,
|
||||
DecorationBoundImageNV = 5401,
|
||||
DecorationSIMTCallINTEL = 5599,
|
||||
DecorationReferencedIndirectlyINTEL = 5602,
|
||||
DecorationClobberINTEL = 5607,
|
||||
DecorationSideEffectsINTEL = 5608,
|
||||
DecorationVectorComputeVariableINTEL = 5624,
|
||||
DecorationFuncParamIOKindINTEL = 5625,
|
||||
DecorationVectorComputeFunctionINTEL = 5626,
|
||||
DecorationStackCallINTEL = 5627,
|
||||
DecorationGlobalVariableOffsetINTEL = 5628,
|
||||
DecorationCounterBuffer = 5634,
|
||||
DecorationHlslCounterBufferGOOGLE = 5634,
|
||||
DecorationHlslSemanticGOOGLE = 5635,
|
||||
DecorationUserSemantic = 5635,
|
||||
DecorationUserTypeGOOGLE = 5636,
|
||||
DecorationFunctionRoundingModeINTEL = 5822,
|
||||
DecorationFunctionDenormModeINTEL = 5823,
|
||||
DecorationRegisterINTEL = 5825,
|
||||
DecorationMemoryINTEL = 5826,
|
||||
DecorationNumbanksINTEL = 5827,
|
||||
|
@ -500,6 +550,18 @@ enum Decoration {
|
|||
DecorationMergeINTEL = 5834,
|
||||
DecorationBankBitsINTEL = 5835,
|
||||
DecorationForcePow2DepthINTEL = 5836,
|
||||
DecorationBurstCoalesceINTEL = 5899,
|
||||
DecorationCacheSizeINTEL = 5900,
|
||||
DecorationDontStaticallyCoalesceINTEL = 5901,
|
||||
DecorationPrefetchINTEL = 5902,
|
||||
DecorationStallEnableINTEL = 5905,
|
||||
DecorationFuseLoopsInFunctionINTEL = 5907,
|
||||
DecorationBufferLocationINTEL = 5921,
|
||||
DecorationIOPipeStorageINTEL = 5944,
|
||||
DecorationFunctionFloatingPointModeINTEL = 6080,
|
||||
DecorationSingleElementVectorINTEL = 6085,
|
||||
DecorationVectorComputeCallableFunctionINTEL = 6087,
|
||||
DecorationMediaBlockIOINTEL = 6140,
|
||||
DecorationMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -558,8 +620,10 @@ enum BuiltIn {
|
|||
BuiltInBaseVertex = 4424,
|
||||
BuiltInBaseInstance = 4425,
|
||||
BuiltInDrawIndex = 4426,
|
||||
BuiltInPrimitiveShadingRateKHR = 4432,
|
||||
BuiltInDeviceIndex = 4438,
|
||||
BuiltInViewIndex = 4440,
|
||||
BuiltInShadingRateKHR = 4444,
|
||||
BuiltInBaryCoordNoPerspAMD = 4992,
|
||||
BuiltInBaryCoordNoPerspCentroidAMD = 4993,
|
||||
BuiltInBaryCoordNoPerspSampleAMD = 4994,
|
||||
|
@ -582,12 +646,18 @@ enum BuiltIn {
|
|||
BuiltInLayerPerViewNV = 5279,
|
||||
BuiltInMeshViewCountNV = 5280,
|
||||
BuiltInMeshViewIndicesNV = 5281,
|
||||
BuiltInBaryCoordKHR = 5286,
|
||||
BuiltInBaryCoordNV = 5286,
|
||||
BuiltInBaryCoordNoPerspKHR = 5287,
|
||||
BuiltInBaryCoordNoPerspNV = 5287,
|
||||
BuiltInFragSizeEXT = 5292,
|
||||
BuiltInFragmentSizeNV = 5292,
|
||||
BuiltInFragInvocationCountEXT = 5293,
|
||||
BuiltInInvocationsPerPixelNV = 5293,
|
||||
BuiltInPrimitivePointIndicesEXT = 5294,
|
||||
BuiltInPrimitiveLineIndicesEXT = 5295,
|
||||
BuiltInPrimitiveTriangleIndicesEXT = 5296,
|
||||
BuiltInCullPrimitiveEXT = 5299,
|
||||
BuiltInLaunchIdKHR = 5319,
|
||||
BuiltInLaunchIdNV = 5319,
|
||||
BuiltInLaunchSizeKHR = 5320,
|
||||
|
@ -610,10 +680,10 @@ enum BuiltIn {
|
|||
BuiltInObjectToWorldNV = 5330,
|
||||
BuiltInWorldToObjectKHR = 5331,
|
||||
BuiltInWorldToObjectNV = 5331,
|
||||
BuiltInHitTKHR = 5332,
|
||||
BuiltInHitTNV = 5332,
|
||||
BuiltInHitKindKHR = 5333,
|
||||
BuiltInHitKindNV = 5333,
|
||||
BuiltInCurrentRayTimeNV = 5334,
|
||||
BuiltInIncomingRayFlagsKHR = 5351,
|
||||
BuiltInIncomingRayFlagsNV = 5351,
|
||||
BuiltInRayGeometryIndexKHR = 5352,
|
||||
|
@ -621,6 +691,7 @@ enum BuiltIn {
|
|||
BuiltInSMCountNV = 5375,
|
||||
BuiltInWarpIDNV = 5376,
|
||||
BuiltInSMIDNV = 5377,
|
||||
BuiltInCullMaskKHR = 6021,
|
||||
BuiltInMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -653,6 +724,7 @@ enum LoopControlShift {
|
|||
LoopControlLoopCoalesceINTELShift = 20,
|
||||
LoopControlMaxInterleavingINTELShift = 21,
|
||||
LoopControlSpeculatedIterationsINTELShift = 22,
|
||||
LoopControlNoFusionINTELShift = 23,
|
||||
LoopControlMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -674,6 +746,7 @@ enum LoopControlMask {
|
|||
LoopControlLoopCoalesceINTELMask = 0x00100000,
|
||||
LoopControlMaxInterleavingINTELMask = 0x00200000,
|
||||
LoopControlSpeculatedIterationsINTELMask = 0x00400000,
|
||||
LoopControlNoFusionINTELMask = 0x00800000,
|
||||
};
|
||||
|
||||
enum FunctionControlShift {
|
||||
|
@ -681,6 +754,7 @@ enum FunctionControlShift {
|
|||
FunctionControlDontInlineShift = 1,
|
||||
FunctionControlPureShift = 2,
|
||||
FunctionControlConstShift = 3,
|
||||
FunctionControlOptNoneINTELShift = 16,
|
||||
FunctionControlMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -690,6 +764,7 @@ enum FunctionControlMask {
|
|||
FunctionControlDontInlineMask = 0x00000002,
|
||||
FunctionControlPureMask = 0x00000004,
|
||||
FunctionControlConstMask = 0x00000008,
|
||||
FunctionControlOptNoneINTELMask = 0x00010000,
|
||||
};
|
||||
|
||||
enum MemorySemanticsShift {
|
||||
|
@ -870,8 +945,13 @@ enum Capability {
|
|||
CapabilityGroupNonUniformQuad = 68,
|
||||
CapabilityShaderLayer = 69,
|
||||
CapabilityShaderViewportIndex = 70,
|
||||
CapabilityUniformDecoration = 71,
|
||||
CapabilityFragmentShadingRateKHR = 4422,
|
||||
CapabilitySubgroupBallotKHR = 4423,
|
||||
CapabilityDrawParameters = 4427,
|
||||
CapabilityWorkgroupMemoryExplicitLayoutKHR = 4428,
|
||||
CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR = 4429,
|
||||
CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR = 4430,
|
||||
CapabilitySubgroupVoteKHR = 4431,
|
||||
CapabilityStorageBuffer16BitAccess = 4433,
|
||||
CapabilityStorageUniformBufferBlock16 = 4433,
|
||||
|
@ -894,12 +974,15 @@ enum Capability {
|
|||
CapabilityRoundingModeRTE = 4467,
|
||||
CapabilityRoundingModeRTZ = 4468,
|
||||
CapabilityRayQueryProvisionalKHR = 4471,
|
||||
CapabilityRayTraversalPrimitiveCullingProvisionalKHR = 4478,
|
||||
CapabilityRayQueryKHR = 4472,
|
||||
CapabilityRayTraversalPrimitiveCullingKHR = 4478,
|
||||
CapabilityRayTracingKHR = 4479,
|
||||
CapabilityFloat16ImageAMD = 5008,
|
||||
CapabilityImageGatherBiasLodAMD = 5009,
|
||||
CapabilityFragmentMaskAMD = 5010,
|
||||
CapabilityStencilExportEXT = 5013,
|
||||
CapabilityImageReadWriteLodAMD = 5015,
|
||||
CapabilityInt64ImageEXT = 5016,
|
||||
CapabilityShaderClockKHR = 5055,
|
||||
CapabilitySampleMaskOverrideCoverageNV = 5249,
|
||||
CapabilityGeometryShaderPassthroughNV = 5251,
|
||||
|
@ -911,6 +994,8 @@ enum Capability {
|
|||
CapabilityFragmentFullyCoveredEXT = 5265,
|
||||
CapabilityMeshShadingNV = 5266,
|
||||
CapabilityImageFootprintNV = 5282,
|
||||
CapabilityMeshShadingEXT = 5283,
|
||||
CapabilityFragmentBarycentricKHR = 5284,
|
||||
CapabilityFragmentBarycentricNV = 5284,
|
||||
CapabilityComputeDerivativeGroupQuadsNV = 5288,
|
||||
CapabilityFragmentDensityEXT = 5291,
|
||||
|
@ -941,6 +1026,7 @@ enum Capability {
|
|||
CapabilityStorageTexelBufferArrayNonUniformIndexing = 5312,
|
||||
CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312,
|
||||
CapabilityRayTracingNV = 5340,
|
||||
CapabilityRayTracingMotionBlurNV = 5341,
|
||||
CapabilityVulkanMemoryModel = 5345,
|
||||
CapabilityVulkanMemoryModelKHR = 5345,
|
||||
CapabilityVulkanMemoryModelDeviceScope = 5346,
|
||||
|
@ -954,26 +1040,63 @@ enum Capability {
|
|||
CapabilityFragmentShaderShadingRateInterlockEXT = 5372,
|
||||
CapabilityShaderSMBuiltinsNV = 5373,
|
||||
CapabilityFragmentShaderPixelInterlockEXT = 5378,
|
||||
CapabilityDemoteToHelperInvocation = 5379,
|
||||
CapabilityDemoteToHelperInvocationEXT = 5379,
|
||||
CapabilityBindlessTextureNV = 5390,
|
||||
CapabilitySubgroupShuffleINTEL = 5568,
|
||||
CapabilitySubgroupBufferBlockIOINTEL = 5569,
|
||||
CapabilitySubgroupImageBlockIOINTEL = 5570,
|
||||
CapabilitySubgroupImageMediaBlockIOINTEL = 5579,
|
||||
CapabilityRoundToInfinityINTEL = 5582,
|
||||
CapabilityFloatingPointModeINTEL = 5583,
|
||||
CapabilityIntegerFunctions2INTEL = 5584,
|
||||
CapabilityFunctionPointersINTEL = 5603,
|
||||
CapabilityIndirectReferencesINTEL = 5604,
|
||||
CapabilityAsmINTEL = 5606,
|
||||
CapabilityAtomicFloat32MinMaxEXT = 5612,
|
||||
CapabilityAtomicFloat64MinMaxEXT = 5613,
|
||||
CapabilityAtomicFloat16MinMaxEXT = 5616,
|
||||
CapabilityVectorComputeINTEL = 5617,
|
||||
CapabilityVectorAnyINTEL = 5619,
|
||||
CapabilityExpectAssumeKHR = 5629,
|
||||
CapabilitySubgroupAvcMotionEstimationINTEL = 5696,
|
||||
CapabilitySubgroupAvcMotionEstimationIntraINTEL = 5697,
|
||||
CapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698,
|
||||
CapabilityVariableLengthArrayINTEL = 5817,
|
||||
CapabilityFunctionFloatControlINTEL = 5821,
|
||||
CapabilityFPGAMemoryAttributesINTEL = 5824,
|
||||
CapabilityFPFastMathModeINTEL = 5837,
|
||||
CapabilityArbitraryPrecisionIntegersINTEL = 5844,
|
||||
CapabilityArbitraryPrecisionFloatingPointINTEL = 5845,
|
||||
CapabilityUnstructuredLoopControlsINTEL = 5886,
|
||||
CapabilityFPGALoopControlsINTEL = 5888,
|
||||
CapabilityKernelAttributesINTEL = 5892,
|
||||
CapabilityFPGAKernelAttributesINTEL = 5897,
|
||||
CapabilityFPGAMemoryAccessesINTEL = 5898,
|
||||
CapabilityFPGAClusterAttributesINTEL = 5904,
|
||||
CapabilityLoopFuseINTEL = 5906,
|
||||
CapabilityFPGABufferLocationINTEL = 5920,
|
||||
CapabilityArbitraryPrecisionFixedPointINTEL = 5922,
|
||||
CapabilityUSMStorageClassesINTEL = 5935,
|
||||
CapabilityIOPipesINTEL = 5943,
|
||||
CapabilityBlockingPipesINTEL = 5945,
|
||||
CapabilityFPGARegINTEL = 5948,
|
||||
CapabilityDotProductInputAll = 6016,
|
||||
CapabilityDotProductInputAllKHR = 6016,
|
||||
CapabilityDotProductInput4x8Bit = 6017,
|
||||
CapabilityDotProductInput4x8BitKHR = 6017,
|
||||
CapabilityDotProductInput4x8BitPacked = 6018,
|
||||
CapabilityDotProductInput4x8BitPackedKHR = 6018,
|
||||
CapabilityDotProduct = 6019,
|
||||
CapabilityDotProductKHR = 6019,
|
||||
CapabilityRayCullMaskKHR = 6020,
|
||||
CapabilityBitInstructions = 6025,
|
||||
CapabilityAtomicFloat32AddEXT = 6033,
|
||||
CapabilityAtomicFloat64AddEXT = 6034,
|
||||
CapabilityLongConstantCompositeINTEL = 6089,
|
||||
CapabilityOptNoneINTEL = 6094,
|
||||
CapabilityAtomicFloat16AddEXT = 6095,
|
||||
CapabilityDebugInfoModuleINTEL = 6114,
|
||||
CapabilityMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -1024,6 +1147,60 @@ enum RayQueryCandidateIntersectionType {
|
|||
RayQueryCandidateIntersectionTypeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum FragmentShadingRateShift {
|
||||
FragmentShadingRateVertical2PixelsShift = 0,
|
||||
FragmentShadingRateVertical4PixelsShift = 1,
|
||||
FragmentShadingRateHorizontal2PixelsShift = 2,
|
||||
FragmentShadingRateHorizontal4PixelsShift = 3,
|
||||
FragmentShadingRateMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum FragmentShadingRateMask {
|
||||
FragmentShadingRateMaskNone = 0,
|
||||
FragmentShadingRateVertical2PixelsMask = 0x00000001,
|
||||
FragmentShadingRateVertical4PixelsMask = 0x00000002,
|
||||
FragmentShadingRateHorizontal2PixelsMask = 0x00000004,
|
||||
FragmentShadingRateHorizontal4PixelsMask = 0x00000008,
|
||||
};
|
||||
|
||||
enum FPDenormMode {
|
||||
FPDenormModePreserve = 0,
|
||||
FPDenormModeFlushToZero = 1,
|
||||
FPDenormModeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum FPOperationMode {
|
||||
FPOperationModeIEEE = 0,
|
||||
FPOperationModeALT = 1,
|
||||
FPOperationModeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum QuantizationModes {
|
||||
QuantizationModesTRN = 0,
|
||||
QuantizationModesTRN_ZERO = 1,
|
||||
QuantizationModesRND = 2,
|
||||
QuantizationModesRND_ZERO = 3,
|
||||
QuantizationModesRND_INF = 4,
|
||||
QuantizationModesRND_MIN_INF = 5,
|
||||
QuantizationModesRND_CONV = 6,
|
||||
QuantizationModesRND_CONV_ODD = 7,
|
||||
QuantizationModesMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum OverflowModes {
|
||||
OverflowModesWRAP = 0,
|
||||
OverflowModesSAT = 1,
|
||||
OverflowModesSAT_ZERO = 2,
|
||||
OverflowModesSAT_SYM = 3,
|
||||
OverflowModesMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum PackedVectorFormat {
|
||||
PackedVectorFormatPackedVectorFormat4x8Bit = 0,
|
||||
PackedVectorFormatPackedVectorFormat4x8BitKHR = 0,
|
||||
PackedVectorFormatMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum Op {
|
||||
OpNop = 0,
|
||||
OpUndef = 1,
|
||||
|
@ -1369,13 +1546,31 @@ enum Op {
|
|||
OpPtrEqual = 401,
|
||||
OpPtrNotEqual = 402,
|
||||
OpPtrDiff = 403,
|
||||
OpTerminateInvocation = 4416,
|
||||
OpSubgroupBallotKHR = 4421,
|
||||
OpSubgroupFirstInvocationKHR = 4422,
|
||||
OpSubgroupAllKHR = 4428,
|
||||
OpSubgroupAnyKHR = 4429,
|
||||
OpSubgroupAllEqualKHR = 4430,
|
||||
OpSubgroupReadInvocationKHR = 4432,
|
||||
OpTypeRayQueryProvisionalKHR = 4472,
|
||||
OpTraceRayKHR = 4445,
|
||||
OpExecuteCallableKHR = 4446,
|
||||
OpConvertUToAccelerationStructureKHR = 4447,
|
||||
OpIgnoreIntersectionKHR = 4448,
|
||||
OpTerminateRayKHR = 4449,
|
||||
OpSDot = 4450,
|
||||
OpSDotKHR = 4450,
|
||||
OpUDot = 4451,
|
||||
OpUDotKHR = 4451,
|
||||
OpSUDot = 4452,
|
||||
OpSUDotKHR = 4452,
|
||||
OpSDotAccSat = 4453,
|
||||
OpSDotAccSatKHR = 4453,
|
||||
OpUDotAccSat = 4454,
|
||||
OpUDotAccSatKHR = 4454,
|
||||
OpSUDotAccSat = 4455,
|
||||
OpSUDotAccSatKHR = 4455,
|
||||
OpTypeRayQueryKHR = 4472,
|
||||
OpRayQueryInitializeKHR = 4473,
|
||||
OpRayQueryTerminateKHR = 4474,
|
||||
OpRayQueryGenerateIntersectionKHR = 4475,
|
||||
|
@ -1394,19 +1589,19 @@ enum Op {
|
|||
OpFragmentFetchAMD = 5012,
|
||||
OpReadClockKHR = 5056,
|
||||
OpImageSampleFootprintNV = 5283,
|
||||
OpEmitMeshTasksEXT = 5294,
|
||||
OpSetMeshOutputsEXT = 5295,
|
||||
OpGroupNonUniformPartitionNV = 5296,
|
||||
OpWritePackedPrimitiveIndices4x8NV = 5299,
|
||||
OpReportIntersectionKHR = 5334,
|
||||
OpReportIntersectionNV = 5334,
|
||||
OpIgnoreIntersectionKHR = 5335,
|
||||
OpIgnoreIntersectionNV = 5335,
|
||||
OpTerminateRayKHR = 5336,
|
||||
OpTerminateRayNV = 5336,
|
||||
OpTraceNV = 5337,
|
||||
OpTraceRayKHR = 5337,
|
||||
OpTraceMotionNV = 5338,
|
||||
OpTraceRayMotionNV = 5339,
|
||||
OpTypeAccelerationStructureKHR = 5341,
|
||||
OpTypeAccelerationStructureNV = 5341,
|
||||
OpExecuteCallableKHR = 5344,
|
||||
OpExecuteCallableNV = 5344,
|
||||
OpTypeCooperativeMatrixNV = 5358,
|
||||
OpCooperativeMatrixLoadNV = 5359,
|
||||
|
@ -1415,8 +1610,16 @@ enum Op {
|
|||
OpCooperativeMatrixLengthNV = 5362,
|
||||
OpBeginInvocationInterlockEXT = 5364,
|
||||
OpEndInvocationInterlockEXT = 5365,
|
||||
OpDemoteToHelperInvocation = 5380,
|
||||
OpDemoteToHelperInvocationEXT = 5380,
|
||||
OpIsHelperInvocationEXT = 5381,
|
||||
OpConvertUToImageNV = 5391,
|
||||
OpConvertUToSamplerNV = 5392,
|
||||
OpConvertImageToUNV = 5393,
|
||||
OpConvertSamplerToUNV = 5394,
|
||||
OpConvertUToSampledImageNV = 5395,
|
||||
OpConvertSampledImageToUNV = 5396,
|
||||
OpSamplerImageAddressingModeNV = 5397,
|
||||
OpSubgroupShuffleINTEL = 5571,
|
||||
OpSubgroupShuffleDownINTEL = 5572,
|
||||
OpSubgroupShuffleUpINTEL = 5573,
|
||||
|
@ -1441,8 +1644,15 @@ enum Op {
|
|||
OpUSubSatINTEL = 5596,
|
||||
OpIMul32x16INTEL = 5597,
|
||||
OpUMul32x16INTEL = 5598,
|
||||
OpFunctionPointerINTEL = 5600,
|
||||
OpConstantFunctionPointerINTEL = 5600,
|
||||
OpFunctionPointerCallINTEL = 5601,
|
||||
OpAsmTargetINTEL = 5609,
|
||||
OpAsmINTEL = 5610,
|
||||
OpAsmCallINTEL = 5611,
|
||||
OpAtomicFMinEXT = 5614,
|
||||
OpAtomicFMaxEXT = 5615,
|
||||
OpAssumeTrueKHR = 5630,
|
||||
OpExpectKHR = 5631,
|
||||
OpDecorateString = 5632,
|
||||
OpDecorateStringGOOGLE = 5632,
|
||||
OpMemberDecorateString = 5633,
|
||||
|
@ -1565,7 +1775,64 @@ enum Op {
|
|||
OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814,
|
||||
OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815,
|
||||
OpSubgroupAvcSicGetInterRawSadsINTEL = 5816,
|
||||
OpVariableLengthArrayINTEL = 5818,
|
||||
OpSaveMemoryINTEL = 5819,
|
||||
OpRestoreMemoryINTEL = 5820,
|
||||
OpArbitraryFloatSinCosPiINTEL = 5840,
|
||||
OpArbitraryFloatCastINTEL = 5841,
|
||||
OpArbitraryFloatCastFromIntINTEL = 5842,
|
||||
OpArbitraryFloatCastToIntINTEL = 5843,
|
||||
OpArbitraryFloatAddINTEL = 5846,
|
||||
OpArbitraryFloatSubINTEL = 5847,
|
||||
OpArbitraryFloatMulINTEL = 5848,
|
||||
OpArbitraryFloatDivINTEL = 5849,
|
||||
OpArbitraryFloatGTINTEL = 5850,
|
||||
OpArbitraryFloatGEINTEL = 5851,
|
||||
OpArbitraryFloatLTINTEL = 5852,
|
||||
OpArbitraryFloatLEINTEL = 5853,
|
||||
OpArbitraryFloatEQINTEL = 5854,
|
||||
OpArbitraryFloatRecipINTEL = 5855,
|
||||
OpArbitraryFloatRSqrtINTEL = 5856,
|
||||
OpArbitraryFloatCbrtINTEL = 5857,
|
||||
OpArbitraryFloatHypotINTEL = 5858,
|
||||
OpArbitraryFloatSqrtINTEL = 5859,
|
||||
OpArbitraryFloatLogINTEL = 5860,
|
||||
OpArbitraryFloatLog2INTEL = 5861,
|
||||
OpArbitraryFloatLog10INTEL = 5862,
|
||||
OpArbitraryFloatLog1pINTEL = 5863,
|
||||
OpArbitraryFloatExpINTEL = 5864,
|
||||
OpArbitraryFloatExp2INTEL = 5865,
|
||||
OpArbitraryFloatExp10INTEL = 5866,
|
||||
OpArbitraryFloatExpm1INTEL = 5867,
|
||||
OpArbitraryFloatSinINTEL = 5868,
|
||||
OpArbitraryFloatCosINTEL = 5869,
|
||||
OpArbitraryFloatSinCosINTEL = 5870,
|
||||
OpArbitraryFloatSinPiINTEL = 5871,
|
||||
OpArbitraryFloatCosPiINTEL = 5872,
|
||||
OpArbitraryFloatASinINTEL = 5873,
|
||||
OpArbitraryFloatASinPiINTEL = 5874,
|
||||
OpArbitraryFloatACosINTEL = 5875,
|
||||
OpArbitraryFloatACosPiINTEL = 5876,
|
||||
OpArbitraryFloatATanINTEL = 5877,
|
||||
OpArbitraryFloatATanPiINTEL = 5878,
|
||||
OpArbitraryFloatATan2INTEL = 5879,
|
||||
OpArbitraryFloatPowINTEL = 5880,
|
||||
OpArbitraryFloatPowRINTEL = 5881,
|
||||
OpArbitraryFloatPowNINTEL = 5882,
|
||||
OpLoopControlINTEL = 5887,
|
||||
OpFixedSqrtINTEL = 5923,
|
||||
OpFixedRecipINTEL = 5924,
|
||||
OpFixedRsqrtINTEL = 5925,
|
||||
OpFixedSinINTEL = 5926,
|
||||
OpFixedCosINTEL = 5927,
|
||||
OpFixedSinCosINTEL = 5928,
|
||||
OpFixedSinPiINTEL = 5929,
|
||||
OpFixedCosPiINTEL = 5930,
|
||||
OpFixedSinCosPiINTEL = 5931,
|
||||
OpFixedLogINTEL = 5932,
|
||||
OpFixedExpINTEL = 5933,
|
||||
OpPtrCastToCrossWorkgroupINTEL = 5934,
|
||||
OpCrossWorkgroupCastToPtrINTEL = 5938,
|
||||
OpReadPipeBlockingINTEL = 5946,
|
||||
OpWritePipeBlockingINTEL = 5947,
|
||||
OpFPGARegINTEL = 5949,
|
||||
|
@ -1587,6 +1854,10 @@ enum Op {
|
|||
OpRayQueryGetIntersectionObjectToWorldKHR = 6031,
|
||||
OpRayQueryGetIntersectionWorldToObjectKHR = 6032,
|
||||
OpAtomicFAddEXT = 6035,
|
||||
OpTypeBufferSurfaceINTEL = 6086,
|
||||
OpTypeStructContinuedINTEL = 6090,
|
||||
OpConstantCompositeContinuedINTEL = 6091,
|
||||
OpSpecConstantCompositeContinuedINTEL = 6092,
|
||||
OpMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
@ -1939,13 +2210,25 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpPtrEqual: *hasResult = true; *hasResultType = true; break;
|
||||
case OpPtrNotEqual: *hasResult = true; *hasResultType = true; break;
|
||||
case OpPtrDiff: *hasResult = true; *hasResultType = true; break;
|
||||
case OpTerminateInvocation: *hasResult = false; *hasResultType = false; break;
|
||||
case OpSubgroupBallotKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupFirstInvocationKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpTypeRayQueryProvisionalKHR: *hasResult = true; *hasResultType = false; break;
|
||||
case OpTraceRayKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpIgnoreIntersectionKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpTerminateRayKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpSDot: *hasResult = true; *hasResultType = true; break;
|
||||
case OpUDot: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSUDot: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSDotAccSat: *hasResult = true; *hasResultType = true; break;
|
||||
case OpUDotAccSat: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSUDotAccSat: *hasResult = true; *hasResultType = true; break;
|
||||
case OpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break;
|
||||
case OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpRayQueryGenerateIntersectionKHR: *hasResult = false; *hasResultType = false; break;
|
||||
|
@ -1965,11 +2248,15 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpReadClockKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break;
|
||||
case OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break;
|
||||
case OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break;
|
||||
case OpReportIntersectionNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break;
|
||||
case OpTerminateRayNV: *hasResult = false; *hasResultType = false; break;
|
||||
case OpTraceNV: *hasResult = false; *hasResultType = false; break;
|
||||
case OpTraceMotionNV: *hasResult = false; *hasResultType = false; break;
|
||||
case OpTraceRayMotionNV: *hasResult = false; *hasResultType = false; break;
|
||||
case OpTypeAccelerationStructureNV: *hasResult = true; *hasResultType = false; break;
|
||||
case OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break;
|
||||
case OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break;
|
||||
|
@ -1979,8 +2266,15 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpCooperativeMatrixLengthNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpBeginInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break;
|
||||
case OpEndInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break;
|
||||
case OpDemoteToHelperInvocationEXT: *hasResult = false; *hasResultType = false; break;
|
||||
case OpDemoteToHelperInvocation: *hasResult = false; *hasResultType = false; break;
|
||||
case OpIsHelperInvocationEXT: *hasResult = true; *hasResultType = true; break;
|
||||
case OpConvertUToImageNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpConvertUToSamplerNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpConvertImageToUNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpConvertSamplerToUNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpConvertUToSampledImageNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpConvertSampledImageToUNV: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSamplerImageAddressingModeNV: *hasResult = false; *hasResultType = false; break;
|
||||
case OpSubgroupShuffleINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupShuffleDownINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupShuffleUpINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
|
@ -2005,8 +2299,15 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpUSubSatINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpIMul32x16INTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpUMul32x16INTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpConstantFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFunctionPointerCallINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAsmTargetINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAsmINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAsmCallINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAtomicFMinEXT: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAtomicFMaxEXT: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAssumeTrueKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpExpectKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpDecorateString: *hasResult = false; *hasResultType = false; break;
|
||||
case OpMemberDecorateString: *hasResult = false; *hasResultType = false; break;
|
||||
case OpVmeImageINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
|
@ -2127,7 +2428,64 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSubgroupAvcSicGetInterRawSadsINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break;
|
||||
case OpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatLog1pINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatExpINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatExp2INTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatExp10INTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatExpm1INTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatSinINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatCosINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatSinCosINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatSinPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatCosPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatASinINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatASinPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatACosINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatACosPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatATanINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatATanPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatATan2INTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatPowINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break;
|
||||
case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedSinINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedCosINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedLogINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFixedExpINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpWritePipeBlockingINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpFPGARegINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
|
@ -2149,6 +2507,10 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpRayQueryGetIntersectionObjectToWorldKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionWorldToObjectKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAtomicFAddEXT: *hasResult = true; *hasResultType = true; break;
|
||||
case OpTypeBufferSurfaceINTEL: *hasResult = true; *hasResultType = false; break;
|
||||
case OpTypeStructContinuedINTEL: *hasResult = false; *hasResultType = false; break;
|
||||
case OpConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break;
|
||||
case OpSpecConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break;
|
||||
}
|
||||
}
|
||||
#endif /* SPV_ENABLE_UTILITY_CODE */
|
||||
|
@ -2164,8 +2526,8 @@ inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask
|
|||
inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); }
|
||||
inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); }
|
||||
inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); }
|
||||
inline FragmentShadingRateMask operator|(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) | unsigned(b)); }
|
||||
|
||||
} // end namespace spv
|
||||
|
||||
#endif // #ifndef spirv_HPP
|
||||
|
||||
|
|
|
@ -111,27 +111,23 @@ public:
|
|||
|
||||
void addStringOperand(const char* str)
|
||||
{
|
||||
unsigned int word;
|
||||
char* wordString = (char*)&word;
|
||||
char* wordPtr = wordString;
|
||||
int charCount = 0;
|
||||
unsigned int word = 0;
|
||||
unsigned int shiftAmount = 0;
|
||||
char c;
|
||||
|
||||
do {
|
||||
c = *(str++);
|
||||
*(wordPtr++) = c;
|
||||
++charCount;
|
||||
if (charCount == 4) {
|
||||
word |= ((unsigned int)c) << shiftAmount;
|
||||
shiftAmount += 8;
|
||||
if (shiftAmount == 32) {
|
||||
addImmediateOperand(word);
|
||||
wordPtr = wordString;
|
||||
charCount = 0;
|
||||
word = 0;
|
||||
shiftAmount = 0;
|
||||
}
|
||||
} while (c != 0);
|
||||
|
||||
// deal with partial last word
|
||||
if (charCount > 0) {
|
||||
// pad with 0s
|
||||
for (; charCount < 4; ++charCount)
|
||||
*(wordPtr++) = 0;
|
||||
if (shiftAmount > 0) {
|
||||
addImmediateOperand(word);
|
||||
}
|
||||
}
|
||||
|
@ -263,6 +259,7 @@ public:
|
|||
case OpBranchConditional:
|
||||
case OpSwitch:
|
||||
case OpKill:
|
||||
case OpTerminateInvocation:
|
||||
case OpReturn:
|
||||
case OpReturnValue:
|
||||
case OpUnreachable:
|
||||
|
@ -352,6 +349,7 @@ public:
|
|||
const std::vector<Block*>& getBlocks() const { return blocks; }
|
||||
void addLocalVariable(std::unique_ptr<Instruction> inst);
|
||||
Id getReturnType() const { return functionInstruction.getTypeId(); }
|
||||
Id getFuncId() const { return functionInstruction.getResultId(); }
|
||||
void setReturnPrecision(Decoration precision)
|
||||
{
|
||||
if (precision == DecorationRelaxedPrecision)
|
||||
|
@ -360,6 +358,14 @@ public:
|
|||
Decoration getReturnPrecision() const
|
||||
{ return reducedPrecisionReturn ? DecorationRelaxedPrecision : NoPrecision; }
|
||||
|
||||
void setDebugLineInfo(Id fileName, int line, int column) {
|
||||
lineInstruction = std::unique_ptr<Instruction>{new Instruction(OpLine)};
|
||||
lineInstruction->addIdOperand(fileName);
|
||||
lineInstruction->addImmediateOperand(line);
|
||||
lineInstruction->addImmediateOperand(column);
|
||||
}
|
||||
bool hasDebugLineInfo() const { return lineInstruction != nullptr; }
|
||||
|
||||
void setImplicitThis() { implicitThis = true; }
|
||||
bool hasImplicitThis() const { return implicitThis; }
|
||||
|
||||
|
@ -376,6 +382,11 @@ public:
|
|||
|
||||
void dump(std::vector<unsigned int>& out) const
|
||||
{
|
||||
// OpLine
|
||||
if (lineInstruction != nullptr) {
|
||||
lineInstruction->dump(out);
|
||||
}
|
||||
|
||||
// OpFunction
|
||||
functionInstruction.dump(out);
|
||||
|
||||
|
@ -394,6 +405,7 @@ protected:
|
|||
Function& operator=(Function&);
|
||||
|
||||
Module& parent;
|
||||
std::unique_ptr<Instruction> lineInstruction;
|
||||
Instruction functionInstruction;
|
||||
std::vector<Instruction*> parameterInstructions;
|
||||
std::vector<Block*> blocks;
|
||||
|
@ -460,7 +472,8 @@ protected:
|
|||
// - the OpFunction instruction
|
||||
// - all the OpFunctionParameter instructions
|
||||
__inline Function::Function(Id id, Id resultType, Id functionType, Id firstParamId, Module& parent)
|
||||
: parent(parent), functionInstruction(id, resultType, OpFunction), implicitThis(false),
|
||||
: parent(parent), lineInstruction(nullptr),
|
||||
functionInstruction(id, resultType, OpFunction), implicitThis(false),
|
||||
reducedPrecisionReturn(false)
|
||||
{
|
||||
// OpFunction
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
//
|
||||
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
||||
// Copyright (C) 2017 Google, 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 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.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include "./../glslang/Public/ShaderLang.h"
|
||||
|
||||
// Default include class for normal include convention of search backward
|
||||
// through the stack of active include paths (for nested includes).
|
||||
// Can be overridden to customize.
|
||||
class DirStackFileIncluder : public glslang::TShader::Includer {
|
||||
public:
|
||||
DirStackFileIncluder() : externalLocalDirectoryCount(0) { }
|
||||
|
||||
virtual IncludeResult* includeLocal(const char* headerName,
|
||||
const char* includerName,
|
||||
size_t inclusionDepth) override
|
||||
{
|
||||
return readLocalPath(headerName, includerName, (int)inclusionDepth);
|
||||
}
|
||||
|
||||
virtual IncludeResult* includeSystem(const char* headerName,
|
||||
const char* /*includerName*/,
|
||||
size_t /*inclusionDepth*/) override
|
||||
{
|
||||
return readSystemPath(headerName);
|
||||
}
|
||||
|
||||
// Externally set directories. E.g., from a command-line -I<dir>.
|
||||
// - Most-recently pushed are checked first.
|
||||
// - All these are checked after the parse-time stack of local directories
|
||||
// is checked.
|
||||
// - This only applies to the "local" form of #include.
|
||||
// - Makes its own copy of the path.
|
||||
virtual void pushExternalLocalDirectory(const std::string& dir)
|
||||
{
|
||||
directoryStack.push_back(dir);
|
||||
externalLocalDirectoryCount = (int)directoryStack.size();
|
||||
}
|
||||
|
||||
virtual void releaseInclude(IncludeResult* result) override
|
||||
{
|
||||
if (result != nullptr) {
|
||||
delete [] static_cast<tUserDataElement*>(result->userData);
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~DirStackFileIncluder() override { }
|
||||
|
||||
protected:
|
||||
typedef char tUserDataElement;
|
||||
std::vector<std::string> directoryStack;
|
||||
int externalLocalDirectoryCount;
|
||||
|
||||
// Search for a valid "local" path based on combining the stack of include
|
||||
// directories and the nominal name of the header.
|
||||
virtual IncludeResult* readLocalPath(const char* headerName, const char* includerName, int depth)
|
||||
{
|
||||
// Discard popped include directories, and
|
||||
// initialize when at parse-time first level.
|
||||
directoryStack.resize(depth + externalLocalDirectoryCount);
|
||||
if (depth == 1)
|
||||
directoryStack.back() = getDirectory(includerName);
|
||||
|
||||
// Find a directory that works, using a reverse search of the include stack.
|
||||
for (auto it = directoryStack.rbegin(); it != directoryStack.rend(); ++it) {
|
||||
std::string path = *it + '/' + headerName;
|
||||
std::replace(path.begin(), path.end(), '\\', '/');
|
||||
std::ifstream file(path, std::ios_base::binary | std::ios_base::ate);
|
||||
if (file) {
|
||||
directoryStack.push_back(getDirectory(path));
|
||||
return newIncludeResult(path, file, (int)file.tellg());
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Search for a valid <system> path.
|
||||
// Not implemented yet; returning nullptr signals failure to find.
|
||||
virtual IncludeResult* readSystemPath(const char* /*headerName*/) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Do actual reading of the file, filling in a new include result.
|
||||
virtual IncludeResult* newIncludeResult(const std::string& path, std::ifstream& file, int length) const
|
||||
{
|
||||
char* content = new tUserDataElement [length];
|
||||
file.seekg(0, file.beg);
|
||||
file.read(content, length);
|
||||
return new IncludeResult(path, content, length, content);
|
||||
}
|
||||
|
||||
// If no path markers, return current working directory.
|
||||
// Otherwise, strip file name and return path leading up to it.
|
||||
virtual std::string getDirectory(const std::string path) const
|
||||
{
|
||||
size_t last = path.find_last_of("/\\");
|
||||
return last == std::string::npos ? "." : path.substr(0, last);
|
||||
}
|
||||
};
|
|
@ -1,496 +0,0 @@
|
|||
//
|
||||
// Copyright (C) 2016 Google, 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 Google 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.
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
|
||||
#include "ResourceLimits.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
const TBuiltInResource DefaultTBuiltInResource = {
|
||||
/* .MaxLights = */ 32,
|
||||
/* .MaxClipPlanes = */ 6,
|
||||
/* .MaxTextureUnits = */ 32,
|
||||
/* .MaxTextureCoords = */ 32,
|
||||
/* .MaxVertexAttribs = */ 64,
|
||||
/* .MaxVertexUniformComponents = */ 4096,
|
||||
/* .MaxVaryingFloats = */ 64,
|
||||
/* .MaxVertexTextureImageUnits = */ 32,
|
||||
/* .MaxCombinedTextureImageUnits = */ 80,
|
||||
/* .MaxTextureImageUnits = */ 32,
|
||||
/* .MaxFragmentUniformComponents = */ 4096,
|
||||
/* .MaxDrawBuffers = */ 32,
|
||||
/* .MaxVertexUniformVectors = */ 128,
|
||||
/* .MaxVaryingVectors = */ 8,
|
||||
/* .MaxFragmentUniformVectors = */ 16,
|
||||
/* .MaxVertexOutputVectors = */ 16,
|
||||
/* .MaxFragmentInputVectors = */ 15,
|
||||
/* .MinProgramTexelOffset = */ -8,
|
||||
/* .MaxProgramTexelOffset = */ 7,
|
||||
/* .MaxClipDistances = */ 8,
|
||||
/* .MaxComputeWorkGroupCountX = */ 65535,
|
||||
/* .MaxComputeWorkGroupCountY = */ 65535,
|
||||
/* .MaxComputeWorkGroupCountZ = */ 65535,
|
||||
/* .MaxComputeWorkGroupSizeX = */ 1024,
|
||||
/* .MaxComputeWorkGroupSizeY = */ 1024,
|
||||
/* .MaxComputeWorkGroupSizeZ = */ 64,
|
||||
/* .MaxComputeUniformComponents = */ 1024,
|
||||
/* .MaxComputeTextureImageUnits = */ 16,
|
||||
/* .MaxComputeImageUniforms = */ 8,
|
||||
/* .MaxComputeAtomicCounters = */ 8,
|
||||
/* .MaxComputeAtomicCounterBuffers = */ 1,
|
||||
/* .MaxVaryingComponents = */ 60,
|
||||
/* .MaxVertexOutputComponents = */ 64,
|
||||
/* .MaxGeometryInputComponents = */ 64,
|
||||
/* .MaxGeometryOutputComponents = */ 128,
|
||||
/* .MaxFragmentInputComponents = */ 128,
|
||||
/* .MaxImageUnits = */ 8,
|
||||
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
|
||||
/* .MaxCombinedShaderOutputResources = */ 8,
|
||||
/* .MaxImageSamples = */ 0,
|
||||
/* .MaxVertexImageUniforms = */ 0,
|
||||
/* .MaxTessControlImageUniforms = */ 0,
|
||||
/* .MaxTessEvaluationImageUniforms = */ 0,
|
||||
/* .MaxGeometryImageUniforms = */ 0,
|
||||
/* .MaxFragmentImageUniforms = */ 8,
|
||||
/* .MaxCombinedImageUniforms = */ 8,
|
||||
/* .MaxGeometryTextureImageUnits = */ 16,
|
||||
/* .MaxGeometryOutputVertices = */ 256,
|
||||
/* .MaxGeometryTotalOutputComponents = */ 1024,
|
||||
/* .MaxGeometryUniformComponents = */ 1024,
|
||||
/* .MaxGeometryVaryingComponents = */ 64,
|
||||
/* .MaxTessControlInputComponents = */ 128,
|
||||
/* .MaxTessControlOutputComponents = */ 128,
|
||||
/* .MaxTessControlTextureImageUnits = */ 16,
|
||||
/* .MaxTessControlUniformComponents = */ 1024,
|
||||
/* .MaxTessControlTotalOutputComponents = */ 4096,
|
||||
/* .MaxTessEvaluationInputComponents = */ 128,
|
||||
/* .MaxTessEvaluationOutputComponents = */ 128,
|
||||
/* .MaxTessEvaluationTextureImageUnits = */ 16,
|
||||
/* .MaxTessEvaluationUniformComponents = */ 1024,
|
||||
/* .MaxTessPatchComponents = */ 120,
|
||||
/* .MaxPatchVertices = */ 32,
|
||||
/* .MaxTessGenLevel = */ 64,
|
||||
/* .MaxViewports = */ 16,
|
||||
/* .MaxVertexAtomicCounters = */ 0,
|
||||
/* .MaxTessControlAtomicCounters = */ 0,
|
||||
/* .MaxTessEvaluationAtomicCounters = */ 0,
|
||||
/* .MaxGeometryAtomicCounters = */ 0,
|
||||
/* .MaxFragmentAtomicCounters = */ 8,
|
||||
/* .MaxCombinedAtomicCounters = */ 8,
|
||||
/* .MaxAtomicCounterBindings = */ 1,
|
||||
/* .MaxVertexAtomicCounterBuffers = */ 0,
|
||||
/* .MaxTessControlAtomicCounterBuffers = */ 0,
|
||||
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
|
||||
/* .MaxGeometryAtomicCounterBuffers = */ 0,
|
||||
/* .MaxFragmentAtomicCounterBuffers = */ 1,
|
||||
/* .MaxCombinedAtomicCounterBuffers = */ 1,
|
||||
/* .MaxAtomicCounterBufferSize = */ 16384,
|
||||
/* .MaxTransformFeedbackBuffers = */ 4,
|
||||
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
|
||||
/* .MaxCullDistances = */ 8,
|
||||
/* .MaxCombinedClipAndCullDistances = */ 8,
|
||||
/* .MaxSamples = */ 4,
|
||||
/* .maxMeshOutputVerticesNV = */ 256,
|
||||
/* .maxMeshOutputPrimitivesNV = */ 512,
|
||||
/* .maxMeshWorkGroupSizeX_NV = */ 32,
|
||||
/* .maxMeshWorkGroupSizeY_NV = */ 1,
|
||||
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
|
||||
/* .maxTaskWorkGroupSizeX_NV = */ 32,
|
||||
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
||||
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
||||
/* .maxMeshViewCountNV = */ 4,
|
||||
/* .maxDualSourceDrawBuffersEXT = */ 1,
|
||||
|
||||
/* .limits = */ {
|
||||
/* .nonInductiveForLoops = */ 1,
|
||||
/* .whileLoops = */ 1,
|
||||
/* .doWhileLoops = */ 1,
|
||||
/* .generalUniformIndexing = */ 1,
|
||||
/* .generalAttributeMatrixVectorIndexing = */ 1,
|
||||
/* .generalVaryingIndexing = */ 1,
|
||||
/* .generalSamplerIndexing = */ 1,
|
||||
/* .generalVariableIndexing = */ 1,
|
||||
/* .generalConstantMatrixVectorIndexing = */ 1,
|
||||
}};
|
||||
|
||||
std::string GetDefaultTBuiltInResourceString()
|
||||
{
|
||||
std::ostringstream ostream;
|
||||
|
||||
ostream << "MaxLights " << DefaultTBuiltInResource.maxLights << "\n"
|
||||
<< "MaxClipPlanes " << DefaultTBuiltInResource.maxClipPlanes << "\n"
|
||||
<< "MaxTextureUnits " << DefaultTBuiltInResource.maxTextureUnits << "\n"
|
||||
<< "MaxTextureCoords " << DefaultTBuiltInResource.maxTextureCoords << "\n"
|
||||
<< "MaxVertexAttribs " << DefaultTBuiltInResource.maxVertexAttribs << "\n"
|
||||
<< "MaxVertexUniformComponents " << DefaultTBuiltInResource.maxVertexUniformComponents << "\n"
|
||||
<< "MaxVaryingFloats " << DefaultTBuiltInResource.maxVaryingFloats << "\n"
|
||||
<< "MaxVertexTextureImageUnits " << DefaultTBuiltInResource.maxVertexTextureImageUnits << "\n"
|
||||
<< "MaxCombinedTextureImageUnits " << DefaultTBuiltInResource.maxCombinedTextureImageUnits << "\n"
|
||||
<< "MaxTextureImageUnits " << DefaultTBuiltInResource.maxTextureImageUnits << "\n"
|
||||
<< "MaxFragmentUniformComponents " << DefaultTBuiltInResource.maxFragmentUniformComponents << "\n"
|
||||
<< "MaxDrawBuffers " << DefaultTBuiltInResource.maxDrawBuffers << "\n"
|
||||
<< "MaxVertexUniformVectors " << DefaultTBuiltInResource.maxVertexUniformVectors << "\n"
|
||||
<< "MaxVaryingVectors " << DefaultTBuiltInResource.maxVaryingVectors << "\n"
|
||||
<< "MaxFragmentUniformVectors " << DefaultTBuiltInResource.maxFragmentUniformVectors << "\n"
|
||||
<< "MaxVertexOutputVectors " << DefaultTBuiltInResource.maxVertexOutputVectors << "\n"
|
||||
<< "MaxFragmentInputVectors " << DefaultTBuiltInResource.maxFragmentInputVectors << "\n"
|
||||
<< "MinProgramTexelOffset " << DefaultTBuiltInResource.minProgramTexelOffset << "\n"
|
||||
<< "MaxProgramTexelOffset " << DefaultTBuiltInResource.maxProgramTexelOffset << "\n"
|
||||
<< "MaxClipDistances " << DefaultTBuiltInResource.maxClipDistances << "\n"
|
||||
<< "MaxComputeWorkGroupCountX " << DefaultTBuiltInResource.maxComputeWorkGroupCountX << "\n"
|
||||
<< "MaxComputeWorkGroupCountY " << DefaultTBuiltInResource.maxComputeWorkGroupCountY << "\n"
|
||||
<< "MaxComputeWorkGroupCountZ " << DefaultTBuiltInResource.maxComputeWorkGroupCountZ << "\n"
|
||||
<< "MaxComputeWorkGroupSizeX " << DefaultTBuiltInResource.maxComputeWorkGroupSizeX << "\n"
|
||||
<< "MaxComputeWorkGroupSizeY " << DefaultTBuiltInResource.maxComputeWorkGroupSizeY << "\n"
|
||||
<< "MaxComputeWorkGroupSizeZ " << DefaultTBuiltInResource.maxComputeWorkGroupSizeZ << "\n"
|
||||
<< "MaxComputeUniformComponents " << DefaultTBuiltInResource.maxComputeUniformComponents << "\n"
|
||||
<< "MaxComputeTextureImageUnits " << DefaultTBuiltInResource.maxComputeTextureImageUnits << "\n"
|
||||
<< "MaxComputeImageUniforms " << DefaultTBuiltInResource.maxComputeImageUniforms << "\n"
|
||||
<< "MaxComputeAtomicCounters " << DefaultTBuiltInResource.maxComputeAtomicCounters << "\n"
|
||||
<< "MaxComputeAtomicCounterBuffers " << DefaultTBuiltInResource.maxComputeAtomicCounterBuffers << "\n"
|
||||
<< "MaxVaryingComponents " << DefaultTBuiltInResource.maxVaryingComponents << "\n"
|
||||
<< "MaxVertexOutputComponents " << DefaultTBuiltInResource.maxVertexOutputComponents << "\n"
|
||||
<< "MaxGeometryInputComponents " << DefaultTBuiltInResource.maxGeometryInputComponents << "\n"
|
||||
<< "MaxGeometryOutputComponents " << DefaultTBuiltInResource.maxGeometryOutputComponents << "\n"
|
||||
<< "MaxFragmentInputComponents " << DefaultTBuiltInResource.maxFragmentInputComponents << "\n"
|
||||
<< "MaxImageUnits " << DefaultTBuiltInResource.maxImageUnits << "\n"
|
||||
<< "MaxCombinedImageUnitsAndFragmentOutputs " << DefaultTBuiltInResource.maxCombinedImageUnitsAndFragmentOutputs << "\n"
|
||||
<< "MaxCombinedShaderOutputResources " << DefaultTBuiltInResource.maxCombinedShaderOutputResources << "\n"
|
||||
<< "MaxImageSamples " << DefaultTBuiltInResource.maxImageSamples << "\n"
|
||||
<< "MaxVertexImageUniforms " << DefaultTBuiltInResource.maxVertexImageUniforms << "\n"
|
||||
<< "MaxTessControlImageUniforms " << DefaultTBuiltInResource.maxTessControlImageUniforms << "\n"
|
||||
<< "MaxTessEvaluationImageUniforms " << DefaultTBuiltInResource.maxTessEvaluationImageUniforms << "\n"
|
||||
<< "MaxGeometryImageUniforms " << DefaultTBuiltInResource.maxGeometryImageUniforms << "\n"
|
||||
<< "MaxFragmentImageUniforms " << DefaultTBuiltInResource.maxFragmentImageUniforms << "\n"
|
||||
<< "MaxCombinedImageUniforms " << DefaultTBuiltInResource.maxCombinedImageUniforms << "\n"
|
||||
<< "MaxGeometryTextureImageUnits " << DefaultTBuiltInResource.maxGeometryTextureImageUnits << "\n"
|
||||
<< "MaxGeometryOutputVertices " << DefaultTBuiltInResource.maxGeometryOutputVertices << "\n"
|
||||
<< "MaxGeometryTotalOutputComponents " << DefaultTBuiltInResource.maxGeometryTotalOutputComponents << "\n"
|
||||
<< "MaxGeometryUniformComponents " << DefaultTBuiltInResource.maxGeometryUniformComponents << "\n"
|
||||
<< "MaxGeometryVaryingComponents " << DefaultTBuiltInResource.maxGeometryVaryingComponents << "\n"
|
||||
<< "MaxTessControlInputComponents " << DefaultTBuiltInResource.maxTessControlInputComponents << "\n"
|
||||
<< "MaxTessControlOutputComponents " << DefaultTBuiltInResource.maxTessControlOutputComponents << "\n"
|
||||
<< "MaxTessControlTextureImageUnits " << DefaultTBuiltInResource.maxTessControlTextureImageUnits << "\n"
|
||||
<< "MaxTessControlUniformComponents " << DefaultTBuiltInResource.maxTessControlUniformComponents << "\n"
|
||||
<< "MaxTessControlTotalOutputComponents " << DefaultTBuiltInResource.maxTessControlTotalOutputComponents << "\n"
|
||||
<< "MaxTessEvaluationInputComponents " << DefaultTBuiltInResource.maxTessEvaluationInputComponents << "\n"
|
||||
<< "MaxTessEvaluationOutputComponents " << DefaultTBuiltInResource.maxTessEvaluationOutputComponents << "\n"
|
||||
<< "MaxTessEvaluationTextureImageUnits " << DefaultTBuiltInResource.maxTessEvaluationTextureImageUnits << "\n"
|
||||
<< "MaxTessEvaluationUniformComponents " << DefaultTBuiltInResource.maxTessEvaluationUniformComponents << "\n"
|
||||
<< "MaxTessPatchComponents " << DefaultTBuiltInResource.maxTessPatchComponents << "\n"
|
||||
<< "MaxPatchVertices " << DefaultTBuiltInResource.maxPatchVertices << "\n"
|
||||
<< "MaxTessGenLevel " << DefaultTBuiltInResource.maxTessGenLevel << "\n"
|
||||
<< "MaxViewports " << DefaultTBuiltInResource.maxViewports << "\n"
|
||||
<< "MaxVertexAtomicCounters " << DefaultTBuiltInResource.maxVertexAtomicCounters << "\n"
|
||||
<< "MaxTessControlAtomicCounters " << DefaultTBuiltInResource.maxTessControlAtomicCounters << "\n"
|
||||
<< "MaxTessEvaluationAtomicCounters " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounters << "\n"
|
||||
<< "MaxGeometryAtomicCounters " << DefaultTBuiltInResource.maxGeometryAtomicCounters << "\n"
|
||||
<< "MaxFragmentAtomicCounters " << DefaultTBuiltInResource.maxFragmentAtomicCounters << "\n"
|
||||
<< "MaxCombinedAtomicCounters " << DefaultTBuiltInResource.maxCombinedAtomicCounters << "\n"
|
||||
<< "MaxAtomicCounterBindings " << DefaultTBuiltInResource.maxAtomicCounterBindings << "\n"
|
||||
<< "MaxVertexAtomicCounterBuffers " << DefaultTBuiltInResource.maxVertexAtomicCounterBuffers << "\n"
|
||||
<< "MaxTessControlAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessControlAtomicCounterBuffers << "\n"
|
||||
<< "MaxTessEvaluationAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounterBuffers << "\n"
|
||||
<< "MaxGeometryAtomicCounterBuffers " << DefaultTBuiltInResource.maxGeometryAtomicCounterBuffers << "\n"
|
||||
<< "MaxFragmentAtomicCounterBuffers " << DefaultTBuiltInResource.maxFragmentAtomicCounterBuffers << "\n"
|
||||
<< "MaxCombinedAtomicCounterBuffers " << DefaultTBuiltInResource.maxCombinedAtomicCounterBuffers << "\n"
|
||||
<< "MaxAtomicCounterBufferSize " << DefaultTBuiltInResource.maxAtomicCounterBufferSize << "\n"
|
||||
<< "MaxTransformFeedbackBuffers " << DefaultTBuiltInResource.maxTransformFeedbackBuffers << "\n"
|
||||
<< "MaxTransformFeedbackInterleavedComponents " << DefaultTBuiltInResource.maxTransformFeedbackInterleavedComponents << "\n"
|
||||
<< "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n"
|
||||
<< "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
|
||||
<< "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n"
|
||||
<< "MaxMeshOutputVerticesNV " << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n"
|
||||
<< "MaxMeshOutputPrimitivesNV " << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n"
|
||||
<< "MaxMeshWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n"
|
||||
<< "MaxMeshWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeY_NV << "\n"
|
||||
<< "MaxMeshWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeZ_NV << "\n"
|
||||
<< "MaxTaskWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeX_NV << "\n"
|
||||
<< "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n"
|
||||
<< "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n"
|
||||
<< "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n"
|
||||
<< "MaxDualSourceDrawBuffersEXT " << DefaultTBuiltInResource.maxDualSourceDrawBuffersEXT << "\n"
|
||||
<< "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
|
||||
<< "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
|
||||
<< "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
|
||||
<< "generalUniformIndexing " << DefaultTBuiltInResource.limits.generalUniformIndexing << "\n"
|
||||
<< "generalAttributeMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalAttributeMatrixVectorIndexing << "\n"
|
||||
<< "generalVaryingIndexing " << DefaultTBuiltInResource.limits.generalVaryingIndexing << "\n"
|
||||
<< "generalSamplerIndexing " << DefaultTBuiltInResource.limits.generalSamplerIndexing << "\n"
|
||||
<< "generalVariableIndexing " << DefaultTBuiltInResource.limits.generalVariableIndexing << "\n"
|
||||
<< "generalConstantMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalConstantMatrixVectorIndexing << "\n"
|
||||
;
|
||||
|
||||
return ostream.str();
|
||||
}
|
||||
|
||||
void DecodeResourceLimits(TBuiltInResource* resources, char* config)
|
||||
{
|
||||
static const char* delims = " \t\n\r";
|
||||
|
||||
size_t pos = 0;
|
||||
std::string configStr(config);
|
||||
|
||||
while ((pos = configStr.find_first_not_of(delims, pos)) != std::string::npos) {
|
||||
const size_t token_s = pos;
|
||||
const size_t token_e = configStr.find_first_of(delims, token_s);
|
||||
const size_t value_s = configStr.find_first_not_of(delims, token_e);
|
||||
const size_t value_e = configStr.find_first_of(delims, value_s);
|
||||
pos = value_e;
|
||||
|
||||
// Faster to use compare(), but prefering readability.
|
||||
const std::string tokenStr = configStr.substr(token_s, token_e-token_s);
|
||||
const std::string valueStr = configStr.substr(value_s, value_e-value_s);
|
||||
|
||||
if (value_s == std::string::npos || ! (valueStr[0] == '-' || isdigit(valueStr[0]))) {
|
||||
printf("Error: '%s' bad .conf file. Each name must be followed by one number.\n",
|
||||
valueStr.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
const int value = std::atoi(valueStr.c_str());
|
||||
|
||||
if (tokenStr == "MaxLights")
|
||||
resources->maxLights = value;
|
||||
else if (tokenStr == "MaxClipPlanes")
|
||||
resources->maxClipPlanes = value;
|
||||
else if (tokenStr == "MaxTextureUnits")
|
||||
resources->maxTextureUnits = value;
|
||||
else if (tokenStr == "MaxTextureCoords")
|
||||
resources->maxTextureCoords = value;
|
||||
else if (tokenStr == "MaxVertexAttribs")
|
||||
resources->maxVertexAttribs = value;
|
||||
else if (tokenStr == "MaxVertexUniformComponents")
|
||||
resources->maxVertexUniformComponents = value;
|
||||
else if (tokenStr == "MaxVaryingFloats")
|
||||
resources->maxVaryingFloats = value;
|
||||
else if (tokenStr == "MaxVertexTextureImageUnits")
|
||||
resources->maxVertexTextureImageUnits = value;
|
||||
else if (tokenStr == "MaxCombinedTextureImageUnits")
|
||||
resources->maxCombinedTextureImageUnits = value;
|
||||
else if (tokenStr == "MaxTextureImageUnits")
|
||||
resources->maxTextureImageUnits = value;
|
||||
else if (tokenStr == "MaxFragmentUniformComponents")
|
||||
resources->maxFragmentUniformComponents = value;
|
||||
else if (tokenStr == "MaxDrawBuffers")
|
||||
resources->maxDrawBuffers = value;
|
||||
else if (tokenStr == "MaxVertexUniformVectors")
|
||||
resources->maxVertexUniformVectors = value;
|
||||
else if (tokenStr == "MaxVaryingVectors")
|
||||
resources->maxVaryingVectors = value;
|
||||
else if (tokenStr == "MaxFragmentUniformVectors")
|
||||
resources->maxFragmentUniformVectors = value;
|
||||
else if (tokenStr == "MaxVertexOutputVectors")
|
||||
resources->maxVertexOutputVectors = value;
|
||||
else if (tokenStr == "MaxFragmentInputVectors")
|
||||
resources->maxFragmentInputVectors = value;
|
||||
else if (tokenStr == "MinProgramTexelOffset")
|
||||
resources->minProgramTexelOffset = value;
|
||||
else if (tokenStr == "MaxProgramTexelOffset")
|
||||
resources->maxProgramTexelOffset = value;
|
||||
else if (tokenStr == "MaxClipDistances")
|
||||
resources->maxClipDistances = value;
|
||||
else if (tokenStr == "MaxComputeWorkGroupCountX")
|
||||
resources->maxComputeWorkGroupCountX = value;
|
||||
else if (tokenStr == "MaxComputeWorkGroupCountY")
|
||||
resources->maxComputeWorkGroupCountY = value;
|
||||
else if (tokenStr == "MaxComputeWorkGroupCountZ")
|
||||
resources->maxComputeWorkGroupCountZ = value;
|
||||
else if (tokenStr == "MaxComputeWorkGroupSizeX")
|
||||
resources->maxComputeWorkGroupSizeX = value;
|
||||
else if (tokenStr == "MaxComputeWorkGroupSizeY")
|
||||
resources->maxComputeWorkGroupSizeY = value;
|
||||
else if (tokenStr == "MaxComputeWorkGroupSizeZ")
|
||||
resources->maxComputeWorkGroupSizeZ = value;
|
||||
else if (tokenStr == "MaxComputeUniformComponents")
|
||||
resources->maxComputeUniformComponents = value;
|
||||
else if (tokenStr == "MaxComputeTextureImageUnits")
|
||||
resources->maxComputeTextureImageUnits = value;
|
||||
else if (tokenStr == "MaxComputeImageUniforms")
|
||||
resources->maxComputeImageUniforms = value;
|
||||
else if (tokenStr == "MaxComputeAtomicCounters")
|
||||
resources->maxComputeAtomicCounters = value;
|
||||
else if (tokenStr == "MaxComputeAtomicCounterBuffers")
|
||||
resources->maxComputeAtomicCounterBuffers = value;
|
||||
else if (tokenStr == "MaxVaryingComponents")
|
||||
resources->maxVaryingComponents = value;
|
||||
else if (tokenStr == "MaxVertexOutputComponents")
|
||||
resources->maxVertexOutputComponents = value;
|
||||
else if (tokenStr == "MaxGeometryInputComponents")
|
||||
resources->maxGeometryInputComponents = value;
|
||||
else if (tokenStr == "MaxGeometryOutputComponents")
|
||||
resources->maxGeometryOutputComponents = value;
|
||||
else if (tokenStr == "MaxFragmentInputComponents")
|
||||
resources->maxFragmentInputComponents = value;
|
||||
else if (tokenStr == "MaxImageUnits")
|
||||
resources->maxImageUnits = value;
|
||||
else if (tokenStr == "MaxCombinedImageUnitsAndFragmentOutputs")
|
||||
resources->maxCombinedImageUnitsAndFragmentOutputs = value;
|
||||
else if (tokenStr == "MaxCombinedShaderOutputResources")
|
||||
resources->maxCombinedShaderOutputResources = value;
|
||||
else if (tokenStr == "MaxImageSamples")
|
||||
resources->maxImageSamples = value;
|
||||
else if (tokenStr == "MaxVertexImageUniforms")
|
||||
resources->maxVertexImageUniforms = value;
|
||||
else if (tokenStr == "MaxTessControlImageUniforms")
|
||||
resources->maxTessControlImageUniforms = value;
|
||||
else if (tokenStr == "MaxTessEvaluationImageUniforms")
|
||||
resources->maxTessEvaluationImageUniforms = value;
|
||||
else if (tokenStr == "MaxGeometryImageUniforms")
|
||||
resources->maxGeometryImageUniforms = value;
|
||||
else if (tokenStr == "MaxFragmentImageUniforms")
|
||||
resources->maxFragmentImageUniforms = value;
|
||||
else if (tokenStr == "MaxCombinedImageUniforms")
|
||||
resources->maxCombinedImageUniforms = value;
|
||||
else if (tokenStr == "MaxGeometryTextureImageUnits")
|
||||
resources->maxGeometryTextureImageUnits = value;
|
||||
else if (tokenStr == "MaxGeometryOutputVertices")
|
||||
resources->maxGeometryOutputVertices = value;
|
||||
else if (tokenStr == "MaxGeometryTotalOutputComponents")
|
||||
resources->maxGeometryTotalOutputComponents = value;
|
||||
else if (tokenStr == "MaxGeometryUniformComponents")
|
||||
resources->maxGeometryUniformComponents = value;
|
||||
else if (tokenStr == "MaxGeometryVaryingComponents")
|
||||
resources->maxGeometryVaryingComponents = value;
|
||||
else if (tokenStr == "MaxTessControlInputComponents")
|
||||
resources->maxTessControlInputComponents = value;
|
||||
else if (tokenStr == "MaxTessControlOutputComponents")
|
||||
resources->maxTessControlOutputComponents = value;
|
||||
else if (tokenStr == "MaxTessControlTextureImageUnits")
|
||||
resources->maxTessControlTextureImageUnits = value;
|
||||
else if (tokenStr == "MaxTessControlUniformComponents")
|
||||
resources->maxTessControlUniformComponents = value;
|
||||
else if (tokenStr == "MaxTessControlTotalOutputComponents")
|
||||
resources->maxTessControlTotalOutputComponents = value;
|
||||
else if (tokenStr == "MaxTessEvaluationInputComponents")
|
||||
resources->maxTessEvaluationInputComponents = value;
|
||||
else if (tokenStr == "MaxTessEvaluationOutputComponents")
|
||||
resources->maxTessEvaluationOutputComponents = value;
|
||||
else if (tokenStr == "MaxTessEvaluationTextureImageUnits")
|
||||
resources->maxTessEvaluationTextureImageUnits = value;
|
||||
else if (tokenStr == "MaxTessEvaluationUniformComponents")
|
||||
resources->maxTessEvaluationUniformComponents = value;
|
||||
else if (tokenStr == "MaxTessPatchComponents")
|
||||
resources->maxTessPatchComponents = value;
|
||||
else if (tokenStr == "MaxPatchVertices")
|
||||
resources->maxPatchVertices = value;
|
||||
else if (tokenStr == "MaxTessGenLevel")
|
||||
resources->maxTessGenLevel = value;
|
||||
else if (tokenStr == "MaxViewports")
|
||||
resources->maxViewports = value;
|
||||
else if (tokenStr == "MaxVertexAtomicCounters")
|
||||
resources->maxVertexAtomicCounters = value;
|
||||
else if (tokenStr == "MaxTessControlAtomicCounters")
|
||||
resources->maxTessControlAtomicCounters = value;
|
||||
else if (tokenStr == "MaxTessEvaluationAtomicCounters")
|
||||
resources->maxTessEvaluationAtomicCounters = value;
|
||||
else if (tokenStr == "MaxGeometryAtomicCounters")
|
||||
resources->maxGeometryAtomicCounters = value;
|
||||
else if (tokenStr == "MaxFragmentAtomicCounters")
|
||||
resources->maxFragmentAtomicCounters = value;
|
||||
else if (tokenStr == "MaxCombinedAtomicCounters")
|
||||
resources->maxCombinedAtomicCounters = value;
|
||||
else if (tokenStr == "MaxAtomicCounterBindings")
|
||||
resources->maxAtomicCounterBindings = value;
|
||||
else if (tokenStr == "MaxVertexAtomicCounterBuffers")
|
||||
resources->maxVertexAtomicCounterBuffers = value;
|
||||
else if (tokenStr == "MaxTessControlAtomicCounterBuffers")
|
||||
resources->maxTessControlAtomicCounterBuffers = value;
|
||||
else if (tokenStr == "MaxTessEvaluationAtomicCounterBuffers")
|
||||
resources->maxTessEvaluationAtomicCounterBuffers = value;
|
||||
else if (tokenStr == "MaxGeometryAtomicCounterBuffers")
|
||||
resources->maxGeometryAtomicCounterBuffers = value;
|
||||
else if (tokenStr == "MaxFragmentAtomicCounterBuffers")
|
||||
resources->maxFragmentAtomicCounterBuffers = value;
|
||||
else if (tokenStr == "MaxCombinedAtomicCounterBuffers")
|
||||
resources->maxCombinedAtomicCounterBuffers = value;
|
||||
else if (tokenStr == "MaxAtomicCounterBufferSize")
|
||||
resources->maxAtomicCounterBufferSize = value;
|
||||
else if (tokenStr == "MaxTransformFeedbackBuffers")
|
||||
resources->maxTransformFeedbackBuffers = value;
|
||||
else if (tokenStr == "MaxTransformFeedbackInterleavedComponents")
|
||||
resources->maxTransformFeedbackInterleavedComponents = value;
|
||||
else if (tokenStr == "MaxCullDistances")
|
||||
resources->maxCullDistances = value;
|
||||
else if (tokenStr == "MaxCombinedClipAndCullDistances")
|
||||
resources->maxCombinedClipAndCullDistances = value;
|
||||
else if (tokenStr == "MaxSamples")
|
||||
resources->maxSamples = value;
|
||||
else if (tokenStr == "MaxMeshOutputVerticesNV")
|
||||
resources->maxMeshOutputVerticesNV = value;
|
||||
else if (tokenStr == "MaxMeshOutputPrimitivesNV")
|
||||
resources->maxMeshOutputPrimitivesNV = value;
|
||||
else if (tokenStr == "MaxMeshWorkGroupSizeX_NV")
|
||||
resources->maxMeshWorkGroupSizeX_NV = value;
|
||||
else if (tokenStr == "MaxMeshWorkGroupSizeY_NV")
|
||||
resources->maxMeshWorkGroupSizeY_NV = value;
|
||||
else if (tokenStr == "MaxMeshWorkGroupSizeZ_NV")
|
||||
resources->maxMeshWorkGroupSizeZ_NV = value;
|
||||
else if (tokenStr == "MaxTaskWorkGroupSizeX_NV")
|
||||
resources->maxTaskWorkGroupSizeX_NV = value;
|
||||
else if (tokenStr == "MaxTaskWorkGroupSizeY_NV")
|
||||
resources->maxTaskWorkGroupSizeY_NV = value;
|
||||
else if (tokenStr == "MaxTaskWorkGroupSizeZ_NV")
|
||||
resources->maxTaskWorkGroupSizeZ_NV = value;
|
||||
else if (tokenStr == "MaxMeshViewCountNV")
|
||||
resources->maxMeshViewCountNV = value;
|
||||
else if (tokenStr == "nonInductiveForLoops")
|
||||
resources->limits.nonInductiveForLoops = (value != 0);
|
||||
else if (tokenStr == "whileLoops")
|
||||
resources->limits.whileLoops = (value != 0);
|
||||
else if (tokenStr == "doWhileLoops")
|
||||
resources->limits.doWhileLoops = (value != 0);
|
||||
else if (tokenStr == "generalUniformIndexing")
|
||||
resources->limits.generalUniformIndexing = (value != 0);
|
||||
else if (tokenStr == "generalAttributeMatrixVectorIndexing")
|
||||
resources->limits.generalAttributeMatrixVectorIndexing = (value != 0);
|
||||
else if (tokenStr == "generalVaryingIndexing")
|
||||
resources->limits.generalVaryingIndexing = (value != 0);
|
||||
else if (tokenStr == "generalSamplerIndexing")
|
||||
resources->limits.generalSamplerIndexing = (value != 0);
|
||||
else if (tokenStr == "generalVariableIndexing")
|
||||
resources->limits.generalVariableIndexing = (value != 0);
|
||||
else if (tokenStr == "generalConstantMatrixVectorIndexing")
|
||||
resources->limits.generalConstantMatrixVectorIndexing = (value != 0);
|
||||
else
|
||||
printf("Warning: unrecognized limit (%s) in configuration file.\n", tokenStr.c_str());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
|
@ -1,57 +0,0 @@
|
|||
//
|
||||
// Copyright (C) 2016 Google, 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 Google 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 _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
|
||||
#define _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../glslang/Include/ResourceLimits.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
// 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 DefaultTBuiltInResource;
|
||||
|
||||
// Returns the DefaultTBuiltInResource as a human-readable string.
|
||||
std::string GetDefaultTBuiltInResourceString();
|
||||
|
||||
// Decodes the resource limits from |config| to |resources|.
|
||||
void DecodeResourceLimits(TBuiltInResource* resources, char* config);
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
|
|
@ -1,428 +0,0 @@
|
|||
/**
|
||||
This code is based on the glslang_c_interface implementation by Viktor Latypov
|
||||
**/
|
||||
|
||||
/**
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2019, Viktor Latypov
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**/
|
||||
|
||||
#include "../Include/glslang_c_interface.h"
|
||||
|
||||
#include "../../StandAlone/DirStackFileIncluder.h"
|
||||
#include "../../StandAlone/ResourceLimits.h"
|
||||
#include "../Include/ShHandle.h"
|
||||
|
||||
#include "../Include/ResourceLimits.h"
|
||||
#include "../MachineIndependent/Versions.h"
|
||||
|
||||
static_assert(int(GLSLANG_STAGE_COUNT) == EShLangCount, "");
|
||||
static_assert(int(GLSLANG_STAGE_MASK_COUNT) == EShLanguageMaskCount, "");
|
||||
static_assert(int(GLSLANG_SOURCE_COUNT) == glslang::EShSourceCount, "");
|
||||
static_assert(int(GLSLANG_CLIENT_COUNT) == glslang::EShClientCount, "");
|
||||
static_assert(int(GLSLANG_TARGET_COUNT) == glslang::EShTargetCount, "");
|
||||
static_assert(int(GLSLANG_TARGET_CLIENT_VERSION_COUNT) == glslang::EShTargetClientVersionCount, "");
|
||||
static_assert(int(GLSLANG_TARGET_LANGUAGE_VERSION_COUNT) == glslang::EShTargetLanguageVersionCount, "");
|
||||
static_assert(int(GLSLANG_OPT_LEVEL_COUNT) == EshOptLevelCount, "");
|
||||
static_assert(int(GLSLANG_TEX_SAMP_TRANS_COUNT) == EShTexSampTransCount, "");
|
||||
static_assert(int(GLSLANG_MSG_COUNT) == EShMsgCount, "");
|
||||
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), "");
|
||||
|
||||
typedef struct glslang_shader_s {
|
||||
glslang::TShader* shader;
|
||||
std::string preprocessedGLSL;
|
||||
} glslang_shader_t;
|
||||
|
||||
typedef struct glslang_program_s {
|
||||
glslang::TProgram* program;
|
||||
std::vector<unsigned int> spirv;
|
||||
std::string loggerMessages;
|
||||
} glslang_program_t;
|
||||
|
||||
/* Wrapper/Adapter for C glsl_include_callbacks_t functions
|
||||
|
||||
This class contains a 'glsl_include_callbacks_t' structure
|
||||
with C include_local/include_system callback pointers.
|
||||
|
||||
This class implement TShader::Includer interface
|
||||
by redirecting C++ virtual methods to C callbacks.
|
||||
|
||||
The 'IncludeResult' instances produced by this Includer
|
||||
contain a reference to glsl_include_result_t C structure
|
||||
to allow its lifetime management by another C callback
|
||||
(CallbackIncluder::callbacks::free_include_result)
|
||||
*/
|
||||
class CallbackIncluder : public glslang::TShader::Includer {
|
||||
public:
|
||||
/* Wrapper of IncludeResult which stores a glsl_include_result object internally */
|
||||
class CallbackIncludeResult : public glslang::TShader::Includer::IncludeResult {
|
||||
public:
|
||||
CallbackIncludeResult(const std::string& headerName, const char* const headerData, const size_t headerLength,
|
||||
void* userData, glsl_include_result_t* includeResult)
|
||||
: glslang::TShader::Includer::IncludeResult(headerName, headerData, headerLength, userData),
|
||||
includeResult(includeResult)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CallbackIncludeResult() {}
|
||||
|
||||
protected:
|
||||
friend class CallbackIncluder;
|
||||
|
||||
glsl_include_result_t* includeResult;
|
||||
};
|
||||
|
||||
public:
|
||||
CallbackIncluder(glsl_include_callbacks_t _callbacks, void* _context) : callbacks(_callbacks), context(_context) {}
|
||||
|
||||
virtual ~CallbackIncluder() {}
|
||||
|
||||
virtual IncludeResult* includeSystem(const char* headerName, const char* includerName,
|
||||
size_t inclusionDepth) override
|
||||
{
|
||||
if (this->callbacks.include_system) {
|
||||
glsl_include_result_t* result =
|
||||
this->callbacks.include_system(this->context, headerName, includerName, inclusionDepth);
|
||||
|
||||
return new CallbackIncludeResult(std::string(headerName), result->header_data, result->header_length,
|
||||
nullptr, result);
|
||||
}
|
||||
|
||||
return glslang::TShader::Includer::includeSystem(headerName, includerName, inclusionDepth);
|
||||
}
|
||||
|
||||
virtual IncludeResult* includeLocal(const char* headerName, const char* includerName,
|
||||
size_t inclusionDepth) override
|
||||
{
|
||||
if (this->callbacks.include_local) {
|
||||
glsl_include_result_t* result =
|
||||
this->callbacks.include_local(this->context, headerName, includerName, inclusionDepth);
|
||||
|
||||
return new CallbackIncludeResult(std::string(headerName), result->header_data, result->header_length,
|
||||
nullptr, result);
|
||||
}
|
||||
|
||||
return glslang::TShader::Includer::includeLocal(headerName, includerName, inclusionDepth);
|
||||
}
|
||||
|
||||
/* This function only calls free_include_result callback
|
||||
when the IncludeResult instance is allocated by a C function */
|
||||
virtual void releaseInclude(IncludeResult* result) override
|
||||
{
|
||||
if (result == nullptr)
|
||||
return;
|
||||
|
||||
if (this->callbacks.free_include_result && (result->userData == nullptr)) {
|
||||
CallbackIncludeResult* innerResult = static_cast<CallbackIncludeResult*>(result);
|
||||
/* use internal free() function */
|
||||
this->callbacks.free_include_result(this->context, innerResult->includeResult);
|
||||
/* ignore internal fields of TShader::Includer::IncludeResult */
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
delete[] static_cast<char*>(result->userData);
|
||||
delete result;
|
||||
}
|
||||
|
||||
private:
|
||||
CallbackIncluder() {}
|
||||
|
||||
/* C callback pointers */
|
||||
glsl_include_callbacks_t callbacks;
|
||||
/* User-defined context */
|
||||
void* context;
|
||||
};
|
||||
|
||||
GLSLANG_EXPORT int glslang_initialize_process() { return static_cast<int>(glslang::InitializeProcess()); }
|
||||
|
||||
GLSLANG_EXPORT void glslang_finalize_process() { glslang::FinalizeProcess(); }
|
||||
|
||||
static EShLanguage c_shader_stage(glslang_stage_t stage)
|
||||
{
|
||||
switch (stage) {
|
||||
case GLSLANG_STAGE_VERTEX:
|
||||
return EShLangVertex;
|
||||
case GLSLANG_STAGE_TESSCONTROL:
|
||||
return EShLangTessControl;
|
||||
case GLSLANG_STAGE_TESSEVALUATION:
|
||||
return EShLangTessEvaluation;
|
||||
case GLSLANG_STAGE_GEOMETRY:
|
||||
return EShLangGeometry;
|
||||
case GLSLANG_STAGE_FRAGMENT:
|
||||
return EShLangFragment;
|
||||
case GLSLANG_STAGE_COMPUTE:
|
||||
return EShLangCompute;
|
||||
case GLSLANG_STAGE_RAYGEN_NV:
|
||||
return EShLangRayGen;
|
||||
case GLSLANG_STAGE_INTERSECT_NV:
|
||||
return EShLangIntersect;
|
||||
case GLSLANG_STAGE_ANYHIT_NV:
|
||||
return EShLangAnyHit;
|
||||
case GLSLANG_STAGE_CLOSESTHIT_NV:
|
||||
return EShLangClosestHit;
|
||||
case GLSLANG_STAGE_MISS_NV:
|
||||
return EShLangMiss;
|
||||
case GLSLANG_STAGE_CALLABLE_NV:
|
||||
return EShLangCallable;
|
||||
case GLSLANG_STAGE_TASK_NV:
|
||||
return EShLangTaskNV;
|
||||
case GLSLANG_STAGE_MESH_NV:
|
||||
return EShLangMeshNV;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return EShLangCount;
|
||||
}
|
||||
|
||||
static int c_shader_messages(glslang_messages_t messages)
|
||||
{
|
||||
#define CONVERT_MSG(in, out) \
|
||||
if ((messages & in) == in) \
|
||||
res |= out;
|
||||
|
||||
int res = 0;
|
||||
|
||||
CONVERT_MSG(GLSLANG_MSG_RELAXED_ERRORS_BIT, EShMsgRelaxedErrors);
|
||||
CONVERT_MSG(GLSLANG_MSG_SUPPRESS_WARNINGS_BIT, EShMsgSuppressWarnings);
|
||||
CONVERT_MSG(GLSLANG_MSG_AST_BIT, EShMsgAST);
|
||||
CONVERT_MSG(GLSLANG_MSG_SPV_RULES_BIT, EShMsgSpvRules);
|
||||
CONVERT_MSG(GLSLANG_MSG_VULKAN_RULES_BIT, EShMsgVulkanRules);
|
||||
CONVERT_MSG(GLSLANG_MSG_ONLY_PREPROCESSOR_BIT, EShMsgOnlyPreprocessor);
|
||||
CONVERT_MSG(GLSLANG_MSG_READ_HLSL_BIT, EShMsgReadHlsl);
|
||||
CONVERT_MSG(GLSLANG_MSG_CASCADING_ERRORS_BIT, EShMsgCascadingErrors);
|
||||
CONVERT_MSG(GLSLANG_MSG_KEEP_UNCALLED_BIT, EShMsgKeepUncalled);
|
||||
CONVERT_MSG(GLSLANG_MSG_HLSL_OFFSETS_BIT, EShMsgHlslOffsets);
|
||||
CONVERT_MSG(GLSLANG_MSG_DEBUG_INFO_BIT, EShMsgDebugInfo);
|
||||
CONVERT_MSG(GLSLANG_MSG_HLSL_ENABLE_16BIT_TYPES_BIT, EShMsgHlslEnable16BitTypes);
|
||||
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);
|
||||
return res;
|
||||
#undef CONVERT_MSG
|
||||
}
|
||||
|
||||
static glslang::EShTargetLanguageVersion
|
||||
c_shader_target_language_version(glslang_target_language_version_t target_language_version)
|
||||
{
|
||||
switch (target_language_version) {
|
||||
case GLSLANG_TARGET_SPV_1_0:
|
||||
return glslang::EShTargetSpv_1_0;
|
||||
case GLSLANG_TARGET_SPV_1_1:
|
||||
return glslang::EShTargetSpv_1_1;
|
||||
case GLSLANG_TARGET_SPV_1_2:
|
||||
return glslang::EShTargetSpv_1_2;
|
||||
case GLSLANG_TARGET_SPV_1_3:
|
||||
return glslang::EShTargetSpv_1_3;
|
||||
case GLSLANG_TARGET_SPV_1_4:
|
||||
return glslang::EShTargetSpv_1_4;
|
||||
case GLSLANG_TARGET_SPV_1_5:
|
||||
return glslang::EShTargetSpv_1_5;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return glslang::EShTargetSpv_1_0;
|
||||
}
|
||||
|
||||
static glslang::EShClient c_shader_client(glslang_client_t client)
|
||||
{
|
||||
switch (client) {
|
||||
case GLSLANG_CLIENT_VULKAN:
|
||||
return glslang::EShClientVulkan;
|
||||
case GLSLANG_CLIENT_OPENGL:
|
||||
return glslang::EShClientOpenGL;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return glslang::EShClientNone;
|
||||
}
|
||||
|
||||
static glslang::EShTargetClientVersion c_shader_client_version(glslang_target_client_version_t client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case GLSLANG_TARGET_VULKAN_1_1:
|
||||
return glslang::EShTargetVulkan_1_1;
|
||||
case GLSLANG_TARGET_OPENGL_450:
|
||||
return glslang::EShTargetOpenGL_450;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return glslang::EShTargetVulkan_1_0;
|
||||
}
|
||||
|
||||
static glslang::EShTargetLanguage c_shader_target_language(glslang_target_language_t target_language)
|
||||
{
|
||||
if (target_language == GLSLANG_TARGET_NONE)
|
||||
return glslang::EShTargetNone;
|
||||
|
||||
return glslang::EShTargetSpv;
|
||||
}
|
||||
|
||||
static glslang::EShSource c_shader_source(glslang_source_t source)
|
||||
{
|
||||
switch (source) {
|
||||
case GLSLANG_SOURCE_GLSL:
|
||||
return glslang::EShSourceGlsl;
|
||||
case GLSLANG_SOURCE_HLSL:
|
||||
return glslang::EShSourceHlsl;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return glslang::EShSourceNone;
|
||||
}
|
||||
|
||||
static EProfile c_shader_profile(glslang_profile_t profile)
|
||||
{
|
||||
switch (profile) {
|
||||
case GLSLANG_BAD_PROFILE:
|
||||
return EBadProfile;
|
||||
case GLSLANG_NO_PROFILE:
|
||||
return ENoProfile;
|
||||
case GLSLANG_CORE_PROFILE:
|
||||
return ECoreProfile;
|
||||
case GLSLANG_COMPATIBILITY_PROFILE:
|
||||
return ECompatibilityProfile;
|
||||
case GLSLANG_ES_PROFILE:
|
||||
return EEsProfile;
|
||||
case GLSLANG_PROFILE_COUNT: // Should not use this
|
||||
break;
|
||||
}
|
||||
|
||||
return EProfile();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (input)
|
||||
printf("input->code = %p\n", input->code);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
glslang_shader_t* shader = new glslang_shader_t();
|
||||
|
||||
shader->shader = new glslang::TShader(c_shader_stage(input->stage));
|
||||
shader->shader->setStrings(&input->code, 1);
|
||||
shader->shader->setEnvInput(c_shader_source(input->language), c_shader_stage(input->stage),
|
||||
c_shader_client(input->client), input->default_version);
|
||||
shader->shader->setEnvClient(c_shader_client(input->client), c_shader_client_version(input->client_version));
|
||||
shader->shader->setEnvTarget(c_shader_target_language(input->target_language),
|
||||
c_shader_target_language_version(input->target_language_version));
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t* shader)
|
||||
{
|
||||
return shader->preprocessedGLSL.c_str();
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT int glslang_shader_preprocess(glslang_shader_t* shader, const glslang_input_t* input)
|
||||
{
|
||||
DirStackFileIncluder Includer;
|
||||
/* TODO: use custom callbacks if they are available in 'i->callbacks' */
|
||||
return shader->shader->preprocess(
|
||||
reinterpret_cast<const TBuiltInResource*>(input->resource),
|
||||
input->default_version,
|
||||
c_shader_profile(input->default_profile),
|
||||
input->force_default_version_and_profile != 0,
|
||||
input->forward_compatible != 0,
|
||||
(EShMessages)c_shader_messages(input->messages),
|
||||
&shader->preprocessedGLSL,
|
||||
Includer
|
||||
);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT int glslang_shader_parse(glslang_shader_t* shader, const glslang_input_t* input)
|
||||
{
|
||||
const char* preprocessedCStr = shader->preprocessedGLSL.c_str();
|
||||
shader->shader->setStrings(&preprocessedCStr, 1);
|
||||
|
||||
return shader->shader->parse(
|
||||
reinterpret_cast<const TBuiltInResource*>(input->resource),
|
||||
input->default_version,
|
||||
input->forward_compatible != 0,
|
||||
(EShMessages)c_shader_messages(input->messages)
|
||||
);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT const char* glslang_shader_get_info_log(glslang_shader_t* shader) { return shader->shader->getInfoLog(); }
|
||||
|
||||
GLSLANG_EXPORT const char* glslang_shader_get_info_debug_log(glslang_shader_t* shader) { return shader->shader->getInfoDebugLog(); }
|
||||
|
||||
GLSLANG_EXPORT void glslang_shader_delete(glslang_shader_t* shader)
|
||||
{
|
||||
if (!shader)
|
||||
return;
|
||||
|
||||
delete (shader->shader);
|
||||
delete (shader);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT glslang_program_t* glslang_program_create()
|
||||
{
|
||||
glslang_program_t* p = new glslang_program_t();
|
||||
p->program = new glslang::TProgram();
|
||||
return p;
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_program_delete(glslang_program_t* program)
|
||||
{
|
||||
if (!program)
|
||||
return;
|
||||
|
||||
delete (program->program);
|
||||
delete (program);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT void glslang_program_add_shader(glslang_program_t* program, glslang_shader_t* shader)
|
||||
{
|
||||
program->program->addShader(shader->shader);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT int glslang_program_link(glslang_program_t* program, int messages)
|
||||
{
|
||||
return (int)program->program->link((EShMessages)messages);
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT const char* glslang_program_get_info_log(glslang_program_t* program)
|
||||
{
|
||||
return program->program->getInfoLog();
|
||||
}
|
||||
|
||||
GLSLANG_EXPORT const char* glslang_program_get_info_debug_log(glslang_program_t* program)
|
||||
{
|
||||
return program->program->getInfoDebugLog();
|
||||
}
|
|
@ -65,6 +65,10 @@ enum TBasicType {
|
|||
EbtAccStruct,
|
||||
EbtReference,
|
||||
EbtRayQuery,
|
||||
#ifndef GLSLANG_WEB
|
||||
// SPIR-V type defined by spirv_type
|
||||
EbtSpirvType,
|
||||
#endif
|
||||
|
||||
// HLSL types that live only temporarily.
|
||||
EbtString,
|
||||
|
@ -91,6 +95,9 @@ enum TStorageQualifier {
|
|||
EvqUniform, // read only, shared with app
|
||||
EvqBuffer, // read/write, shared with app
|
||||
EvqShared, // compute shader's read/write 'shared' qualifier
|
||||
#ifndef GLSLANG_WEB
|
||||
EvqSpirvStorageClass, // spirv_storage_class
|
||||
#endif
|
||||
|
||||
EvqPayload,
|
||||
EvqPayloadIn,
|
||||
|
@ -98,6 +105,8 @@ enum TStorageQualifier {
|
|||
EvqCallableData,
|
||||
EvqCallableDataIn,
|
||||
|
||||
EvqtaskPayloadSharedEXT,
|
||||
|
||||
// parameters
|
||||
EvqIn, // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter
|
||||
EvqOut, // also, for 'out' in the grammar before we know if it's a pipeline output or an 'out' parameter
|
||||
|
@ -121,6 +130,7 @@ enum TStorageQualifier {
|
|||
// built-ins written by fragment shader
|
||||
EvqFragColor,
|
||||
EvqFragDepth,
|
||||
EvqFragStencil,
|
||||
|
||||
// end of list
|
||||
EvqLast
|
||||
|
@ -228,6 +238,9 @@ enum TBuiltInVariable {
|
|||
EbvViewIndex,
|
||||
EbvDeviceIndex,
|
||||
|
||||
EbvShadingRateKHR,
|
||||
EbvPrimitiveShadingRateKHR,
|
||||
|
||||
EbvFragSizeEXT,
|
||||
EbvFragInvocationCountEXT,
|
||||
|
||||
|
@ -253,6 +266,7 @@ enum TBuiltInVariable {
|
|||
EbvObjectRayDirection,
|
||||
EbvRayTmin,
|
||||
EbvRayTmax,
|
||||
EbvCullMask,
|
||||
EbvHitT,
|
||||
EbvHitKind,
|
||||
EbvObjectToWorld,
|
||||
|
@ -260,9 +274,12 @@ enum TBuiltInVariable {
|
|||
EbvWorldToObject,
|
||||
EbvWorldToObject3x4,
|
||||
EbvIncomingRayFlags,
|
||||
EbvCurrentRayTimeNV,
|
||||
// barycentrics
|
||||
EbvBaryCoordNV,
|
||||
EbvBaryCoordNoPerspNV,
|
||||
EbvBaryCoordEXT,
|
||||
EbvBaryCoordNoPerspEXT,
|
||||
// mesh shaders
|
||||
EbvTaskCountNV,
|
||||
EbvPrimitiveCountNV,
|
||||
|
@ -272,6 +289,11 @@ enum TBuiltInVariable {
|
|||
EbvLayerPerViewNV,
|
||||
EbvMeshViewCountNV,
|
||||
EbvMeshViewIndicesNV,
|
||||
//GL_EXT_mesh_shader
|
||||
EbvPrimitivePointIndicesEXT,
|
||||
EbvPrimitiveLineIndicesEXT,
|
||||
EbvPrimitiveTriangleIndicesEXT,
|
||||
EbvCullPrimitiveEXT,
|
||||
|
||||
// sm builtins
|
||||
EbvWarpsPerSM,
|
||||
|
@ -318,6 +340,9 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q)
|
|||
case EvqGlobal: return "global"; break;
|
||||
case EvqConst: return "const"; break;
|
||||
case EvqConstReadOnly: return "const (read only)"; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EvqSpirvStorageClass: return "spirv_storage_class"; break;
|
||||
#endif
|
||||
case EvqVaryingIn: return "in"; break;
|
||||
case EvqVaryingOut: return "out"; break;
|
||||
case EvqUniform: return "uniform"; break;
|
||||
|
@ -336,11 +361,13 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q)
|
|||
case EvqPointCoord: return "gl_PointCoord"; break;
|
||||
case EvqFragColor: return "fragColor"; break;
|
||||
case EvqFragDepth: return "gl_FragDepth"; break;
|
||||
case EvqFragStencil: return "gl_FragStencilRefARB"; break;
|
||||
case EvqPayload: return "rayPayloadNV"; break;
|
||||
case EvqPayloadIn: return "rayPayloadInNV"; break;
|
||||
case EvqHitAttr: return "hitAttributeNV"; break;
|
||||
case EvqCallableData: return "callableDataNV"; break;
|
||||
case EvqCallableDataIn: return "callableDataInNV"; break;
|
||||
case EvqtaskPayloadSharedEXT: return "taskPayloadSharedEXT"; break;
|
||||
default: return "unknown qualifier";
|
||||
}
|
||||
}
|
||||
|
@ -462,9 +489,12 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
case EbvIncomingRayFlags: return "IncomingRayFlagsNV";
|
||||
case EbvObjectToWorld: return "ObjectToWorldNV";
|
||||
case EbvWorldToObject: return "WorldToObjectNV";
|
||||
case EbvCurrentRayTimeNV: return "CurrentRayTimeNV";
|
||||
|
||||
case EbvBaryCoordNV: return "BaryCoordNV";
|
||||
case EbvBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
|
||||
case EbvBaryCoordEXT:
|
||||
case EbvBaryCoordNV: return "BaryCoordKHR";
|
||||
case EbvBaryCoordNoPerspEXT:
|
||||
case EbvBaryCoordNoPerspNV: return "BaryCoordNoPerspKHR";
|
||||
|
||||
case EbvTaskCountNV: return "TaskCountNV";
|
||||
case EbvPrimitiveCountNV: return "PrimitiveCountNV";
|
||||
|
@ -474,12 +504,20 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
case EbvLayerPerViewNV: return "LayerPerViewNV";
|
||||
case EbvMeshViewCountNV: return "MeshViewCountNV";
|
||||
case EbvMeshViewIndicesNV: return "MeshViewIndicesNV";
|
||||
// GL_EXT_mesh_shader
|
||||
case EbvPrimitivePointIndicesEXT: return "PrimitivePointIndicesEXT";
|
||||
case EbvPrimitiveLineIndicesEXT: return "PrimitiveLineIndicesEXT";
|
||||
case EbvPrimitiveTriangleIndicesEXT: return "PrimitiveTriangleIndicesEXT";
|
||||
case EbvCullPrimitiveEXT: return "CullPrimitiveEXT";
|
||||
|
||||
case EbvWarpsPerSM: return "WarpsPerSMNV";
|
||||
case EbvSMCount: return "SMCountNV";
|
||||
case EbvWarpID: return "WarpIDNV";
|
||||
case EbvSMID: return "SMIDNV";
|
||||
|
||||
case EbvShadingRateKHR: return "ShadingRateKHR";
|
||||
case EbvPrimitiveShadingRateKHR: return "PrimitiveShadingRateKHR";
|
||||
|
||||
default: return "unknown built-in variable";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#ifdef _MSC_VER
|
||||
#include <cfloat>
|
||||
#else
|
||||
#include <cmath>
|
||||
#endif
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <list>
|
||||
|
@ -61,7 +66,7 @@ std::string to_string(const T& val) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API
|
||||
#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || (defined(MINGW_HAS_SECURE_API) && MINGW_HAS_SECURE_API)
|
||||
#include <basetsd.h>
|
||||
#ifndef snprintf
|
||||
#define snprintf sprintf_s
|
||||
|
@ -194,6 +199,10 @@ template <class K, class D, class HASH = std::hash<K>, class PRED = std::equal_t
|
|||
class TUnorderedMap : public std::unordered_map<K, D, HASH, PRED, pool_allocator<std::pair<K const, D> > > {
|
||||
};
|
||||
|
||||
template <class K, class CMP = std::less<K> >
|
||||
class TSet : public std::set<K, CMP, pool_allocator<K> > {
|
||||
};
|
||||
|
||||
//
|
||||
// Persistent string memory. Should only be used for strings that survive
|
||||
// across compiles/links.
|
||||
|
@ -209,7 +218,7 @@ template <class T> T Max(const T a, const T b) { return a > b ? a : b; }
|
|||
//
|
||||
// Create a TString object from an integer.
|
||||
//
|
||||
#if defined _MSC_VER || defined MINGW_HAS_SECURE_API
|
||||
#if defined(_MSC_VER) || (defined(MINGW_HAS_SECURE_API) && MINGW_HAS_SECURE_API)
|
||||
inline const TString String(const int i, const int base = 10)
|
||||
{
|
||||
char text[16]; // 32 bit ints are at most 10 digits in base 10
|
||||
|
@ -286,6 +295,46 @@ template <class T> bool IsMultipleOfPow2(T number, int powerOf2)
|
|||
return ! (number & (powerOf2 - 1));
|
||||
}
|
||||
|
||||
// Returns log2 of an integer power of 2.
|
||||
// T should be integral.
|
||||
template <class T> int IntLog2(T n)
|
||||
{
|
||||
assert(IsPow2(n));
|
||||
int result = 0;
|
||||
while ((T(1) << result) != n) {
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
inline bool IsInfinity(double x) {
|
||||
#ifdef _MSC_VER
|
||||
switch (_fpclass(x)) {
|
||||
case _FPCLASS_NINF:
|
||||
case _FPCLASS_PINF:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return std::isinf(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool IsNan(double x) {
|
||||
#ifdef _MSC_VER
|
||||
switch (_fpclass(x)) {
|
||||
case _FPCLASS_SNAN:
|
||||
case _FPCLASS_QNAN:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return std::isnan(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _COMMON_INCLUDED_
|
||||
|
|
|
@ -306,6 +306,8 @@ public:
|
|||
|
||||
TPoolAllocator& getAllocator() const { return allocator; }
|
||||
|
||||
pool_allocator select_on_container_copy_construction() const { return pool_allocator{}; }
|
||||
|
||||
protected:
|
||||
pool_allocator& operator=(const pool_allocator&) { return *this; }
|
||||
TPoolAllocator& allocator;
|
||||
|
|
|
@ -142,6 +142,15 @@ struct TBuiltInResource {
|
|||
int maxTaskWorkGroupSizeY_NV;
|
||||
int maxTaskWorkGroupSizeZ_NV;
|
||||
int maxMeshViewCountNV;
|
||||
int maxMeshOutputVerticesEXT;
|
||||
int maxMeshOutputPrimitivesEXT;
|
||||
int maxMeshWorkGroupSizeX_EXT;
|
||||
int maxMeshWorkGroupSizeY_EXT;
|
||||
int maxMeshWorkGroupSizeZ_EXT;
|
||||
int maxTaskWorkGroupSizeX_EXT;
|
||||
int maxTaskWorkGroupSizeY_EXT;
|
||||
int maxTaskWorkGroupSizeZ_EXT;
|
||||
int maxMeshViewCountEXT;
|
||||
int maxDualSourceDrawBuffersEXT;
|
||||
|
||||
TLimits limits;
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
//
|
||||
// Copyright(C) 2021 Advanced Micro Devices, 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 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.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
//
|
||||
// GL_EXT_spirv_intrinsics
|
||||
//
|
||||
#include "Common.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
class TIntermTyped;
|
||||
class TIntermConstantUnion;
|
||||
class TType;
|
||||
|
||||
// SPIR-V requirements
|
||||
struct TSpirvRequirement {
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
// capability = [..]
|
||||
TSet<TString> extensions;
|
||||
// extension = [..]
|
||||
TSet<int> capabilities;
|
||||
};
|
||||
|
||||
// SPIR-V execution modes
|
||||
struct TSpirvExecutionMode {
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
// spirv_execution_mode
|
||||
TMap<int, TVector<const TIntermConstantUnion*>> modes;
|
||||
// spirv_execution_mode_id
|
||||
TMap<int, TVector<const TIntermTyped*> > modeIds;
|
||||
};
|
||||
|
||||
// SPIR-V decorations
|
||||
struct TSpirvDecorate {
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
// spirv_decorate
|
||||
TMap<int, TVector<const TIntermConstantUnion*> > decorates;
|
||||
// spirv_decorate_id
|
||||
TMap<int, TVector<const TIntermTyped*>> decorateIds;
|
||||
// spirv_decorate_string
|
||||
TMap<int, TVector<const TIntermConstantUnion*> > decorateStrings;
|
||||
};
|
||||
|
||||
// SPIR-V instruction
|
||||
struct TSpirvInstruction {
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
TSpirvInstruction() { set = ""; id = -1; }
|
||||
|
||||
bool operator==(const TSpirvInstruction& rhs) const { return set == rhs.set && id == rhs.id; }
|
||||
bool operator!=(const TSpirvInstruction& rhs) const { return !operator==(rhs); }
|
||||
|
||||
// spirv_instruction
|
||||
TString set;
|
||||
int id;
|
||||
};
|
||||
|
||||
// SPIR-V type parameter
|
||||
struct TSpirvTypeParameter {
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
TSpirvTypeParameter(const TIntermConstantUnion* arg) { constant = arg; }
|
||||
|
||||
bool operator==(const TSpirvTypeParameter& rhs) const { return constant == rhs.constant; }
|
||||
bool operator!=(const TSpirvTypeParameter& rhs) const { return !operator==(rhs); }
|
||||
|
||||
const TIntermConstantUnion* constant;
|
||||
};
|
||||
|
||||
typedef TVector<TSpirvTypeParameter> TSpirvTypeParameters;
|
||||
|
||||
// SPIR-V type
|
||||
struct TSpirvType {
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
bool operator==(const TSpirvType& rhs) const
|
||||
{
|
||||
return spirvInst == rhs.spirvInst && typeParams == rhs.typeParams;
|
||||
}
|
||||
bool operator!=(const TSpirvType& rhs) const { return !operator==(rhs); }
|
||||
|
||||
// spirv_type
|
||||
TSpirvInstruction spirvInst;
|
||||
TSpirvTypeParameters typeParams;
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // GLSLANG_WEB
|
File diff suppressed because it is too large
Load Diff
|
@ -148,6 +148,15 @@ typedef struct glslang_resource_s {
|
|||
int max_task_work_group_size_y_nv;
|
||||
int max_task_work_group_size_z_nv;
|
||||
int max_mesh_view_count_nv;
|
||||
int max_mesh_output_vertices_ext;
|
||||
int max_mesh_output_primitives_ext;
|
||||
int max_mesh_work_group_size_x_ext;
|
||||
int max_mesh_work_group_size_y_ext;
|
||||
int max_mesh_work_group_size_z_ext;
|
||||
int max_task_work_group_size_x_ext;
|
||||
int max_task_work_group_size_y_ext;
|
||||
int max_task_work_group_size_z_ext;
|
||||
int max_mesh_view_count_ext;
|
||||
int maxDualSourceDrawBuffersEXT;
|
||||
|
||||
glslang_limits_t limits;
|
||||
|
@ -199,6 +208,18 @@ typedef struct glsl_include_callbacks_s {
|
|||
glsl_free_include_result_func free_include_result;
|
||||
} glsl_include_callbacks_t;
|
||||
|
||||
/* SpvOptions counterpart */
|
||||
typedef struct glslang_spv_options_s {
|
||||
bool generate_debug_info;
|
||||
bool strip_debug_info;
|
||||
bool disable_optimizer;
|
||||
bool optimize_size;
|
||||
bool disassemble;
|
||||
bool validate;
|
||||
bool emit_nonsemantic_shader_debug_info;
|
||||
bool emit_nonsemantic_shader_debug_source;
|
||||
} glslang_spv_options_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -224,6 +245,11 @@ GLSLANG_EXPORT void glslang_finalize_process();
|
|||
|
||||
GLSLANG_EXPORT glslang_shader_t* glslang_shader_create(const glslang_input_t* input);
|
||||
GLSLANG_EXPORT void glslang_shader_delete(glslang_shader_t* shader);
|
||||
GLSLANG_EXPORT void glslang_shader_set_preamble(glslang_shader_t* shader, const char* s);
|
||||
GLSLANG_EXPORT void glslang_shader_shift_binding(glslang_shader_t* shader, glslang_resource_type_t res, unsigned int base);
|
||||
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 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);
|
||||
|
@ -234,7 +260,11 @@ GLSLANG_EXPORT glslang_program_t* glslang_program_create();
|
|||
GLSLANG_EXPORT void glslang_program_delete(glslang_program_t* program);
|
||||
GLSLANG_EXPORT void glslang_program_add_shader(glslang_program_t* program, glslang_shader_t* shader);
|
||||
GLSLANG_EXPORT int glslang_program_link(glslang_program_t* program, int messages); // glslang_messages_t
|
||||
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 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);
|
||||
GLSLANG_EXPORT void glslang_program_SPIRV_get(glslang_program_t* program, unsigned int*);
|
||||
GLSLANG_EXPORT unsigned int* glslang_program_SPIRV_get_ptr(glslang_program_t* program);
|
||||
|
|
|
@ -43,14 +43,22 @@ typedef enum {
|
|||
GLSLANG_STAGE_GEOMETRY,
|
||||
GLSLANG_STAGE_FRAGMENT,
|
||||
GLSLANG_STAGE_COMPUTE,
|
||||
GLSLANG_STAGE_RAYGEN_NV,
|
||||
GLSLANG_STAGE_INTERSECT_NV,
|
||||
GLSLANG_STAGE_ANYHIT_NV,
|
||||
GLSLANG_STAGE_CLOSESTHIT_NV,
|
||||
GLSLANG_STAGE_MISS_NV,
|
||||
GLSLANG_STAGE_CALLABLE_NV,
|
||||
GLSLANG_STAGE_TASK_NV,
|
||||
GLSLANG_STAGE_MESH_NV,
|
||||
GLSLANG_STAGE_RAYGEN,
|
||||
GLSLANG_STAGE_RAYGEN_NV = GLSLANG_STAGE_RAYGEN,
|
||||
GLSLANG_STAGE_INTERSECT,
|
||||
GLSLANG_STAGE_INTERSECT_NV = GLSLANG_STAGE_INTERSECT,
|
||||
GLSLANG_STAGE_ANYHIT,
|
||||
GLSLANG_STAGE_ANYHIT_NV = GLSLANG_STAGE_ANYHIT,
|
||||
GLSLANG_STAGE_CLOSESTHIT,
|
||||
GLSLANG_STAGE_CLOSESTHIT_NV = GLSLANG_STAGE_CLOSESTHIT,
|
||||
GLSLANG_STAGE_MISS,
|
||||
GLSLANG_STAGE_MISS_NV = GLSLANG_STAGE_MISS,
|
||||
GLSLANG_STAGE_CALLABLE,
|
||||
GLSLANG_STAGE_CALLABLE_NV = GLSLANG_STAGE_CALLABLE,
|
||||
GLSLANG_STAGE_TASK,
|
||||
GLSLANG_STAGE_TASK_NV = GLSLANG_STAGE_TASK,
|
||||
GLSLANG_STAGE_MESH,
|
||||
GLSLANG_STAGE_MESH_NV = GLSLANG_STAGE_MESH,
|
||||
LAST_ELEMENT_MARKER(GLSLANG_STAGE_COUNT),
|
||||
} glslang_stage_t; // would be better as stage, but this is ancient now
|
||||
|
||||
|
@ -62,14 +70,22 @@ typedef enum {
|
|||
GLSLANG_STAGE_GEOMETRY_MASK = (1 << GLSLANG_STAGE_GEOMETRY),
|
||||
GLSLANG_STAGE_FRAGMENT_MASK = (1 << GLSLANG_STAGE_FRAGMENT),
|
||||
GLSLANG_STAGE_COMPUTE_MASK = (1 << GLSLANG_STAGE_COMPUTE),
|
||||
GLSLANG_STAGE_RAYGEN_NV_MASK = (1 << GLSLANG_STAGE_RAYGEN_NV),
|
||||
GLSLANG_STAGE_INTERSECT_NV_MASK = (1 << GLSLANG_STAGE_INTERSECT_NV),
|
||||
GLSLANG_STAGE_ANYHIT_NV_MASK = (1 << GLSLANG_STAGE_ANYHIT_NV),
|
||||
GLSLANG_STAGE_CLOSESTHIT_NV_MASK = (1 << GLSLANG_STAGE_CLOSESTHIT_NV),
|
||||
GLSLANG_STAGE_MISS_NV_MASK = (1 << GLSLANG_STAGE_MISS_NV),
|
||||
GLSLANG_STAGE_CALLABLE_NV_MASK = (1 << GLSLANG_STAGE_CALLABLE_NV),
|
||||
GLSLANG_STAGE_TASK_NV_MASK = (1 << GLSLANG_STAGE_TASK_NV),
|
||||
GLSLANG_STAGE_MESH_NV_MASK = (1 << GLSLANG_STAGE_MESH_NV),
|
||||
GLSLANG_STAGE_RAYGEN_MASK = (1 << GLSLANG_STAGE_RAYGEN),
|
||||
GLSLANG_STAGE_RAYGEN_NV_MASK = GLSLANG_STAGE_RAYGEN_MASK,
|
||||
GLSLANG_STAGE_INTERSECT_MASK = (1 << GLSLANG_STAGE_INTERSECT),
|
||||
GLSLANG_STAGE_INTERSECT_NV_MASK = GLSLANG_STAGE_INTERSECT_MASK,
|
||||
GLSLANG_STAGE_ANYHIT_MASK = (1 << GLSLANG_STAGE_ANYHIT),
|
||||
GLSLANG_STAGE_ANYHIT_NV_MASK = GLSLANG_STAGE_ANYHIT_MASK,
|
||||
GLSLANG_STAGE_CLOSESTHIT_MASK = (1 << GLSLANG_STAGE_CLOSESTHIT),
|
||||
GLSLANG_STAGE_CLOSESTHIT_NV_MASK = GLSLANG_STAGE_CLOSESTHIT_MASK,
|
||||
GLSLANG_STAGE_MISS_MASK = (1 << GLSLANG_STAGE_MISS),
|
||||
GLSLANG_STAGE_MISS_NV_MASK = GLSLANG_STAGE_MISS_MASK,
|
||||
GLSLANG_STAGE_CALLABLE_MASK = (1 << GLSLANG_STAGE_CALLABLE),
|
||||
GLSLANG_STAGE_CALLABLE_NV_MASK = GLSLANG_STAGE_CALLABLE_MASK,
|
||||
GLSLANG_STAGE_TASK_MASK = (1 << GLSLANG_STAGE_TASK),
|
||||
GLSLANG_STAGE_TASK_NV_MASK = GLSLANG_STAGE_TASK_MASK,
|
||||
GLSLANG_STAGE_MESH_MASK = (1 << GLSLANG_STAGE_MESH),
|
||||
GLSLANG_STAGE_MESH_NV_MASK = GLSLANG_STAGE_MESH_MASK,
|
||||
LAST_ELEMENT_MARKER(GLSLANG_STAGE_MASK_COUNT),
|
||||
} glslang_stage_mask_t;
|
||||
|
||||
|
@ -100,8 +116,10 @@ typedef enum {
|
|||
typedef enum {
|
||||
GLSLANG_TARGET_VULKAN_1_0 = (1 << 22),
|
||||
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_OPENGL_450 = 450,
|
||||
LAST_ELEMENT_MARKER(GLSLANG_TARGET_CLIENT_VERSION_COUNT),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_TARGET_CLIENT_VERSION_COUNT = 5),
|
||||
} glslang_target_client_version_t;
|
||||
|
||||
/* SH_TARGET_LanguageVersion counterpart */
|
||||
|
@ -112,13 +130,16 @@ typedef enum {
|
|||
GLSLANG_TARGET_SPV_1_3 = (1 << 16) | (3 << 8),
|
||||
GLSLANG_TARGET_SPV_1_4 = (1 << 16) | (4 << 8),
|
||||
GLSLANG_TARGET_SPV_1_5 = (1 << 16) | (5 << 8),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_TARGET_LANGUAGE_VERSION_COUNT),
|
||||
GLSLANG_TARGET_SPV_1_6 = (1 << 16) | (6 << 8),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_TARGET_LANGUAGE_VERSION_COUNT = 7),
|
||||
} glslang_target_language_version_t;
|
||||
|
||||
/* EShExecutable counterpart */
|
||||
typedef enum { GLSLANG_EX_VERTEX_FRAGMENT, GLSLANG_EX_FRAGMENT } glslang_executable_t;
|
||||
|
||||
/* EShOptimizationLevel counterpart */
|
||||
// EShOptimizationLevel counterpart
|
||||
// This enum is not used in the current C interface, but could be added at a later date.
|
||||
// GLSLANG_OPT_NONE is the current default.
|
||||
typedef enum {
|
||||
GLSLANG_OPT_NO_GENERATION,
|
||||
GLSLANG_OPT_NONE,
|
||||
|
@ -152,6 +173,7 @@ typedef enum {
|
|||
GLSLANG_MSG_HLSL_LEGALIZATION_BIT = (1 << 12),
|
||||
GLSLANG_MSG_HLSL_DX9_COMPATIBLE_BIT = (1 << 13),
|
||||
GLSLANG_MSG_BUILTIN_SYMBOL_TABLE_BIT = (1 << 14),
|
||||
GLSLANG_MSG_ENHANCED = (1 << 15),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_MSG_COUNT),
|
||||
} glslang_messages_t;
|
||||
|
||||
|
@ -180,6 +202,26 @@ typedef enum {
|
|||
LAST_ELEMENT_MARKER(GLSLANG_PROFILE_COUNT),
|
||||
} glslang_profile_t;
|
||||
|
||||
/* Shader options */
|
||||
typedef enum {
|
||||
GLSLANG_SHADER_DEFAULT_BIT = 0,
|
||||
GLSLANG_SHADER_AUTO_MAP_BINDINGS = (1 << 0),
|
||||
GLSLANG_SHADER_AUTO_MAP_LOCATIONS = (1 << 1),
|
||||
GLSLANG_SHADER_VULKAN_RULES_RELAXED = (1 << 2),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_SHADER_COUNT),
|
||||
} glslang_shader_options_t;
|
||||
|
||||
/* TResourceType counterpart */
|
||||
typedef enum {
|
||||
GLSLANG_RESOURCE_TYPE_SAMPLER,
|
||||
GLSLANG_RESOURCE_TYPE_TEXTURE,
|
||||
GLSLANG_RESOURCE_TYPE_IMAGE,
|
||||
GLSLANG_RESOURCE_TYPE_UBO,
|
||||
GLSLANG_RESOURCE_TYPE_SSBO,
|
||||
GLSLANG_RESOURCE_TYPE_UAV,
|
||||
LAST_ELEMENT_MARKER(GLSLANG_RESOURCE_TYPE_COUNT),
|
||||
} glslang_resource_type_t;
|
||||
|
||||
#undef LAST_ELEMENT_MARKER
|
||||
|
||||
#endif
|
||||
|
|
|
@ -67,10 +67,14 @@ class TIntermediate;
|
|||
enum TOperator {
|
||||
EOpNull, // if in a node, should only mean a node is still being built
|
||||
EOpSequence, // denotes a list of statements, or parameters, etc.
|
||||
EOpScope, // Used by debugging to denote a scoped list of statements
|
||||
EOpLinkerObjects, // for aggregate node of objects the linker may need, if not reference by the rest of the AST
|
||||
EOpFunctionCall,
|
||||
EOpFunction, // For function definition
|
||||
EOpParameters, // an aggregate listing the parameters to a function
|
||||
#ifndef GLSLANG_WEB
|
||||
EOpSpirvInst,
|
||||
#endif
|
||||
|
||||
//
|
||||
// Unary operators
|
||||
|
@ -88,6 +92,8 @@ enum TOperator {
|
|||
|
||||
EOpCopyObject,
|
||||
|
||||
EOpDeclare, // Used by debugging to force declaration of variable in correct scope
|
||||
|
||||
// (u)int* -> bool
|
||||
EOpConvInt8ToBool,
|
||||
EOpConvUint8ToBool,
|
||||
|
@ -280,6 +286,12 @@ enum TOperator {
|
|||
EOpConvUvec2ToPtr,
|
||||
EOpConvPtrToUvec2,
|
||||
|
||||
// uint64_t -> accelerationStructureEXT
|
||||
EOpConvUint64ToAccStruct,
|
||||
|
||||
// uvec2 -> accelerationStructureEXT
|
||||
EOpConvUvec2ToAccStruct,
|
||||
|
||||
//
|
||||
// binary operations
|
||||
//
|
||||
|
@ -587,6 +599,7 @@ enum TOperator {
|
|||
EOpTime,
|
||||
|
||||
EOpAtomicAdd,
|
||||
EOpAtomicSubtract,
|
||||
EOpAtomicMin,
|
||||
EOpAtomicMax,
|
||||
EOpAtomicAnd,
|
||||
|
@ -628,13 +641,16 @@ enum TOperator {
|
|||
// Branch
|
||||
//
|
||||
|
||||
EOpKill, // Fragment only
|
||||
EOpKill, // Fragment only
|
||||
EOpTerminateInvocation, // Fragment only
|
||||
EOpDemote, // Fragment only
|
||||
EOpTerminateRayKHR, // Any-hit only
|
||||
EOpIgnoreIntersectionKHR, // Any-hit only
|
||||
EOpReturn,
|
||||
EOpBreak,
|
||||
EOpContinue,
|
||||
EOpCase,
|
||||
EOpDefault,
|
||||
EOpDemote, // Fragment only
|
||||
|
||||
//
|
||||
// Constructors
|
||||
|
@ -751,6 +767,7 @@ enum TOperator {
|
|||
EOpConstructNonuniform, // expected to be transformed away, not present in final AST
|
||||
EOpConstructReference,
|
||||
EOpConstructCooperativeMatrix,
|
||||
EOpConstructAccStruct,
|
||||
EOpConstructGuardEnd,
|
||||
|
||||
//
|
||||
|
@ -911,12 +928,17 @@ enum TOperator {
|
|||
EOpAverageRounded,
|
||||
EOpMul32x16,
|
||||
|
||||
EOpTrace,
|
||||
EOpTraceNV,
|
||||
EOpTraceRayMotionNV,
|
||||
EOpTraceKHR,
|
||||
EOpReportIntersection,
|
||||
EOpIgnoreIntersection,
|
||||
EOpTerminateRay,
|
||||
EOpExecuteCallable,
|
||||
EOpIgnoreIntersectionNV,
|
||||
EOpTerminateRayNV,
|
||||
EOpExecuteCallableNV,
|
||||
EOpExecuteCallableKHR,
|
||||
EOpWritePackedPrimitiveIndices4x8NV,
|
||||
EOpEmitMeshTasksEXT,
|
||||
EOpSetMeshOutputsEXT,
|
||||
|
||||
//
|
||||
// GL_EXT_ray_query operations
|
||||
|
@ -1123,6 +1145,8 @@ public:
|
|||
virtual TBasicType getBasicType() const { return type.getBasicType(); }
|
||||
virtual TQualifier& getQualifier() { return type.getQualifier(); }
|
||||
virtual const TQualifier& getQualifier() const { return type.getQualifier(); }
|
||||
virtual TArraySizes* getArraySizes() { return type.getArraySizes(); }
|
||||
virtual const TArraySizes* getArraySizes() const { return type.getArraySizes(); }
|
||||
virtual void propagatePrecision(TPrecisionQualifier);
|
||||
virtual int getVectorSize() const { return type.getVectorSize(); }
|
||||
virtual int getMatrixCols() const { return type.getMatrixCols(); }
|
||||
|
@ -1136,7 +1160,7 @@ public:
|
|||
virtual bool isIntegerDomain() const { return type.isIntegerDomain(); }
|
||||
bool isAtomic() const { return type.isAtomic(); }
|
||||
bool isReference() const { return type.isReference(); }
|
||||
TString getCompleteString() const { return type.getCompleteString(); }
|
||||
TString getCompleteString(bool enhanced = false) const { return type.getCompleteString(enhanced); }
|
||||
|
||||
protected:
|
||||
TIntermTyped& operator=(const TIntermTyped&);
|
||||
|
@ -1263,15 +1287,15 @@ 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(int i, const TString& n, const TType& t)
|
||||
TIntermSymbol(long long i, const TString& n, const TType& t)
|
||||
: TIntermTyped(t), id(i),
|
||||
#ifndef GLSLANG_WEB
|
||||
flattenSubset(-1),
|
||||
#endif
|
||||
constSubtree(nullptr)
|
||||
{ name = n; }
|
||||
virtual int getId() const { return id; }
|
||||
virtual void changeId(int i) { id = i; }
|
||||
virtual long long getId() const { return id; }
|
||||
virtual void changeId(long long i) { id = i; }
|
||||
virtual const TString& getName() const { return name; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
virtual TIntermSymbol* getAsSymbolNode() { return this; }
|
||||
|
@ -1282,15 +1306,17 @@ public:
|
|||
TIntermTyped* getConstSubtree() const { return constSubtree; }
|
||||
#ifndef GLSLANG_WEB
|
||||
void setFlattenSubset(int subset) { flattenSubset = subset; }
|
||||
virtual const TString& getAccessName() const;
|
||||
|
||||
int getFlattenSubset() const { return flattenSubset; } // -1 means full object
|
||||
#endif
|
||||
|
||||
// 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(int newId) { id = newId; }
|
||||
virtual void switchId(long long newId) { id = newId; }
|
||||
|
||||
protected:
|
||||
int id; // the unique id of the symbol this node represents
|
||||
long long id; // the unique id of the symbol this node represents
|
||||
#ifndef GLSLANG_WEB
|
||||
int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced
|
||||
#endif
|
||||
|
@ -1599,8 +1625,15 @@ public:
|
|||
virtual TIntermUnary* getAsUnaryNode() { return this; }
|
||||
virtual const TIntermUnary* getAsUnaryNode() const { return this; }
|
||||
virtual void updatePrecision();
|
||||
#ifndef GLSLANG_WEB
|
||||
void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; }
|
||||
const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; }
|
||||
#endif
|
||||
protected:
|
||||
TIntermTyped* operand;
|
||||
#ifndef GLSLANG_WEB
|
||||
TSpirvInstruction spirvInst;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef TVector<TIntermNode*> TIntermSequence;
|
||||
|
@ -1615,6 +1648,7 @@ public:
|
|||
~TIntermAggregate() { delete pragmaTable; }
|
||||
virtual TIntermAggregate* getAsAggregate() { return this; }
|
||||
virtual const TIntermAggregate* getAsAggregate() const { return this; }
|
||||
virtual void updatePrecision();
|
||||
virtual void setOperator(TOperator o) { op = o; }
|
||||
virtual TIntermSequence& getSequence() { return sequence; }
|
||||
virtual const TIntermSequence& getSequence() const { return sequence; }
|
||||
|
@ -1631,6 +1665,10 @@ public:
|
|||
bool getDebug() const { return debug; }
|
||||
void setPragmaTable(const TPragmaTable& pTable);
|
||||
const TPragmaTable& getPragmaTable() const { return *pragmaTable; }
|
||||
#ifndef GLSLANG_WEB
|
||||
void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; }
|
||||
const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; }
|
||||
#endif
|
||||
protected:
|
||||
TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
|
||||
TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
|
||||
|
@ -1641,6 +1679,9 @@ protected:
|
|||
bool optimize;
|
||||
bool debug;
|
||||
TPragmaTable* pragmaTable;
|
||||
#ifndef GLSLANG_WEB
|
||||
TSpirvInstruction spirvInst;
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -1658,8 +1699,11 @@ public:
|
|||
flatten(false), dontFlatten(false) {}
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
virtual TIntermTyped* getCondition() const { return condition; }
|
||||
virtual void setCondition(TIntermTyped* c) { condition = c; }
|
||||
virtual TIntermNode* getTrueBlock() const { return trueBlock; }
|
||||
virtual void setTrueBlock(TIntermTyped* tb) { trueBlock = tb; }
|
||||
virtual TIntermNode* getFalseBlock() const { return falseBlock; }
|
||||
virtual void setFalseBlock(TIntermTyped* fb) { falseBlock = fb; }
|
||||
virtual TIntermSelection* getAsSelectionNode() { return this; }
|
||||
virtual const TIntermSelection* getAsSelectionNode() const { return this; }
|
||||
|
||||
|
|
|
@ -46,35 +46,6 @@ namespace {
|
|||
|
||||
using namespace glslang;
|
||||
|
||||
typedef union {
|
||||
double d;
|
||||
int i[2];
|
||||
} DoubleIntUnion;
|
||||
|
||||
// Some helper functions
|
||||
|
||||
bool isNan(double x)
|
||||
{
|
||||
DoubleIntUnion u;
|
||||
// tough to find a platform independent library function, do it directly
|
||||
u.d = x;
|
||||
int bitPatternL = u.i[0];
|
||||
int bitPatternH = u.i[1];
|
||||
return (bitPatternH & 0x7ff80000) == 0x7ff80000 &&
|
||||
((bitPatternH & 0xFFFFF) != 0 || bitPatternL != 0);
|
||||
}
|
||||
|
||||
bool isInf(double x)
|
||||
{
|
||||
DoubleIntUnion u;
|
||||
// tough to find a platform independent library function, do it directly
|
||||
u.d = x;
|
||||
int bitPatternL = u.i[0];
|
||||
int bitPatternH = u.i[1];
|
||||
return (bitPatternH & 0x7ff00000) == 0x7ff00000 &&
|
||||
(bitPatternH & 0xFFFFF) == 0 && bitPatternL == 0;
|
||||
}
|
||||
|
||||
const double pi = 3.1415926535897932384626433832795;
|
||||
|
||||
} // end anonymous namespace
|
||||
|
@ -529,7 +500,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
case EbtDouble:
|
||||
case EbtFloat16:
|
||||
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
||||
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
||||
// Note: avoid UBSAN error regarding negating 0x80000000
|
||||
case EbtInt: newConstArray[i].setIConst(
|
||||
static_cast<unsigned int>(unionArray[i].getIConst()) == 0x80000000
|
||||
? -0x7FFFFFFF - 1
|
||||
: -unionArray[i].getIConst());
|
||||
break;
|
||||
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: newConstArray[i].setI8Const(-unionArray[i].getI8Const()); break;
|
||||
|
@ -599,17 +575,11 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
newConstArray[i].setDConst(log(unionArray[i].getDConst()));
|
||||
break;
|
||||
case EOpExp2:
|
||||
{
|
||||
const double inv_log2_e = 0.69314718055994530941723212145818;
|
||||
newConstArray[i].setDConst(exp(unionArray[i].getDConst() * inv_log2_e));
|
||||
break;
|
||||
}
|
||||
newConstArray[i].setDConst(exp2(unionArray[i].getDConst()));
|
||||
break;
|
||||
case EOpLog2:
|
||||
{
|
||||
const double log2_e = 1.4426950408889634073599246810019;
|
||||
newConstArray[i].setDConst(log2_e * log(unionArray[i].getDConst()));
|
||||
break;
|
||||
}
|
||||
newConstArray[i].setDConst(log2(unionArray[i].getDConst()));
|
||||
break;
|
||||
case EOpSqrt:
|
||||
newConstArray[i].setDConst(sqrt(unionArray[i].getDConst()));
|
||||
break;
|
||||
|
@ -664,12 +634,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
|
||||
case EOpIsNan:
|
||||
{
|
||||
newConstArray[i].setBConst(isNan(unionArray[i].getDConst()));
|
||||
newConstArray[i].setBConst(IsNan(unionArray[i].getDConst()));
|
||||
break;
|
||||
}
|
||||
case EOpIsInf:
|
||||
{
|
||||
newConstArray[i].setBConst(isInf(unionArray[i].getDConst()));
|
||||
newConstArray[i].setBConst(IsInfinity(unionArray[i].getDConst()));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -71,6 +71,13 @@ void TIntermConstantUnion::traverse(TIntermTraverser *it)
|
|||
it->visitConstantUnion(this);
|
||||
}
|
||||
|
||||
const TString& TIntermSymbol::getAccessName() const {
|
||||
if (getBasicType() == EbtBlock)
|
||||
return getType().getTypeName();
|
||||
else
|
||||
return getName();
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a binary node.
|
||||
//
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace glslang {
|
|||
// Returns the added node.
|
||||
//
|
||||
|
||||
TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, const TConstUnionArray& constArray,
|
||||
TIntermSymbol* TIntermediate::addSymbol(long long id, const TString& name, const TType& type, const TConstUnionArray& constArray,
|
||||
TIntermTyped* constSubtree, const TSourceLoc& loc)
|
||||
{
|
||||
TIntermSymbol* node = new TIntermSymbol(id, name, type);
|
||||
|
@ -416,20 +416,24 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child,
|
|||
// TODO: but, did this bypass constant folding?
|
||||
//
|
||||
switch (op) {
|
||||
case EOpConstructInt8:
|
||||
case EOpConstructUint8:
|
||||
case EOpConstructInt16:
|
||||
case EOpConstructUint16:
|
||||
case EOpConstructInt:
|
||||
case EOpConstructUint:
|
||||
case EOpConstructInt64:
|
||||
case EOpConstructUint64:
|
||||
case EOpConstructBool:
|
||||
case EOpConstructFloat:
|
||||
case EOpConstructDouble:
|
||||
case EOpConstructFloat16:
|
||||
return child;
|
||||
default: break; // some compilers want this
|
||||
case EOpConstructInt8:
|
||||
case EOpConstructUint8:
|
||||
case EOpConstructInt16:
|
||||
case EOpConstructUint16:
|
||||
case EOpConstructInt:
|
||||
case EOpConstructUint:
|
||||
case EOpConstructInt64:
|
||||
case EOpConstructUint64:
|
||||
case EOpConstructBool:
|
||||
case EOpConstructFloat:
|
||||
case EOpConstructDouble:
|
||||
case EOpConstructFloat16: {
|
||||
TIntermUnary* unary_node = child->getAsUnaryNode();
|
||||
if (unary_node != nullptr)
|
||||
unary_node->updatePrecision();
|
||||
return child;
|
||||
}
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1739,7 +1743,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
case EbtUint:
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
return version >= 400 || getSource() == EShSourceHlsl;
|
||||
return version >= 400 || getSource() == EShSourceHlsl || IsRequestedExtension(E_GL_ARB_gpu_shader5);
|
||||
case EbtBool:
|
||||
return getSource() == EShSourceHlsl;
|
||||
case EbtInt16:
|
||||
|
@ -2298,6 +2302,10 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||
case EbtReference:
|
||||
op = EOpConstructReference;
|
||||
break;
|
||||
|
||||
case EbtAccStruct:
|
||||
op = EOpConstructAccStruct;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
@ -2672,7 +2680,11 @@ TIntermTyped* TIntermediate::addSwizzle(TSwizzleSelectors<selectorType>& selecto
|
|||
// 'swizzleOkay' says whether or not it is okay to consider a swizzle
|
||||
// a valid part of the dereference chain.
|
||||
//
|
||||
const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool swizzleOkay)
|
||||
// 'BufferReferenceOk' says if type is buffer_reference, the routine stop to find the most left node.
|
||||
//
|
||||
//
|
||||
|
||||
const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool swizzleOkay , bool bufferReferenceOk)
|
||||
{
|
||||
do {
|
||||
const TIntermBinary* binary = node->getAsBinaryNode();
|
||||
|
@ -2690,6 +2702,8 @@ const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool
|
|||
return nullptr;
|
||||
}
|
||||
node = node->getAsBinaryNode()->getLeft();
|
||||
if (bufferReferenceOk && node->isReference())
|
||||
return node;
|
||||
} while (true);
|
||||
}
|
||||
|
||||
|
@ -2719,10 +2733,10 @@ TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* init
|
|||
TIntermAggregate* loopSequence = (initializer == nullptr ||
|
||||
initializer->getAsAggregate() == nullptr) ? makeAggregate(initializer, loc)
|
||||
: initializer->getAsAggregate();
|
||||
if (loopSequence != nullptr && loopSequence->getOp() == EOpSequence)
|
||||
if (loopSequence != nullptr && (loopSequence->getOp() == EOpSequence || loopSequence->getOp() == EOpScope))
|
||||
loopSequence->setOp(EOpNull);
|
||||
loopSequence = growAggregate(loopSequence, node);
|
||||
loopSequence->setOperator(EOpSequence);
|
||||
loopSequence->setOperator(getDebugInfo() ? EOpScope : EOpSequence);
|
||||
|
||||
return loopSequence;
|
||||
}
|
||||
|
@ -2752,7 +2766,7 @@ void TIntermBranch::updatePrecision(TPrecisionQualifier parentPrecision)
|
|||
return;
|
||||
|
||||
if (exp->getBasicType() == EbtInt || exp->getBasicType() == EbtUint ||
|
||||
exp->getBasicType() == EbtFloat || exp->getBasicType() == EbtFloat16) {
|
||||
exp->getBasicType() == EbtFloat) {
|
||||
if (parentPrecision != EpqNone && exp->getQualifier().precision == EpqNone) {
|
||||
exp->propagatePrecision(parentPrecision);
|
||||
}
|
||||
|
@ -2866,7 +2880,7 @@ void TIntermediate::addToCallGraph(TInfoSink& /*infoSink*/, const TString& calle
|
|||
return;
|
||||
}
|
||||
|
||||
callGraph.push_front(TCall(caller, callee));
|
||||
callGraph.emplace_front(caller, callee);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3270,7 +3284,7 @@ bool TIntermediate::promoteUnary(TIntermUnary& node)
|
|||
void TIntermUnary::updatePrecision()
|
||||
{
|
||||
if (getBasicType() == EbtInt || getBasicType() == EbtUint ||
|
||||
getBasicType() == EbtFloat || getBasicType() == EbtFloat16) {
|
||||
getBasicType() == EbtFloat) {
|
||||
if (operand->getQualifier().precision > getQualifier().precision)
|
||||
getQualifier().precision = operand->getQualifier().precision;
|
||||
}
|
||||
|
@ -3766,17 +3780,44 @@ bool TIntermediate::promoteAggregate(TIntermAggregate& node)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Propagate precision qualifiers *up* from children to parent, and then
|
||||
// back *down* again to the children's subtrees.
|
||||
void TIntermAggregate::updatePrecision()
|
||||
{
|
||||
if (getBasicType() == EbtInt || getBasicType() == EbtUint ||
|
||||
getBasicType() == EbtFloat) {
|
||||
TPrecisionQualifier maxPrecision = EpqNone;
|
||||
TIntermSequence operands = getSequence();
|
||||
for (unsigned int i = 0; i < operands.size(); ++i) {
|
||||
TIntermTyped* typedNode = operands[i]->getAsTyped();
|
||||
assert(typedNode);
|
||||
maxPrecision = std::max(maxPrecision, typedNode->getQualifier().precision);
|
||||
}
|
||||
getQualifier().precision = maxPrecision;
|
||||
for (unsigned int i = 0; i < operands.size(); ++i) {
|
||||
TIntermTyped* typedNode = operands[i]->getAsTyped();
|
||||
assert(typedNode);
|
||||
typedNode->propagatePrecision(maxPrecision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Propagate precision qualifiers *up* from children to parent, and then
|
||||
// back *down* again to the children's subtrees.
|
||||
void TIntermBinary::updatePrecision()
|
||||
{
|
||||
if (getBasicType() == EbtInt || getBasicType() == EbtUint ||
|
||||
getBasicType() == EbtFloat || getBasicType() == EbtFloat16) {
|
||||
getQualifier().precision = std::max(right->getQualifier().precision, left->getQualifier().precision);
|
||||
if (getQualifier().precision != EpqNone) {
|
||||
left->propagatePrecision(getQualifier().precision);
|
||||
right->propagatePrecision(getQualifier().precision);
|
||||
}
|
||||
getBasicType() == EbtFloat) {
|
||||
if (op == EOpRightShift || op == EOpLeftShift) {
|
||||
// For shifts get precision from left side only and thus no need to propagate
|
||||
getQualifier().precision = left->getQualifier().precision;
|
||||
} else {
|
||||
getQualifier().precision = std::max(right->getQualifier().precision, left->getQualifier().precision);
|
||||
if (getQualifier().precision != EpqNone) {
|
||||
left->propagatePrecision(getQualifier().precision);
|
||||
right->propagatePrecision(getQualifier().precision);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3861,7 +3902,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
case EbtFloat16: PROMOTE(setDConst, double, Get); break; \
|
||||
case EbtFloat: PROMOTE(setDConst, double, Get); break; \
|
||||
case EbtDouble: PROMOTE(setDConst, double, Get); break; \
|
||||
case EbtInt8: PROMOTE(setI8Const, char, Get); break; \
|
||||
case EbtInt8: PROMOTE(setI8Const, signed char, Get); break; \
|
||||
case EbtInt16: PROMOTE(setI16Const, short, Get); break; \
|
||||
case EbtInt: PROMOTE(setIConst, int, Get); break; \
|
||||
case EbtInt64: PROMOTE(setI64Const, long long, Get); break; \
|
||||
|
|
|
@ -74,6 +74,9 @@ void C_DECL TParseContextBase::error(const TSourceLoc& loc, const char* szReason
|
|||
{
|
||||
if (messages & EShMsgOnlyPreprocessor)
|
||||
return;
|
||||
// If enhanced msg readability, only print one error
|
||||
if (messages & EShMsgEnhanced && numErrors > 0)
|
||||
return;
|
||||
va_list args;
|
||||
va_start(args, szExtraInfoFormat);
|
||||
outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixError, args);
|
||||
|
@ -127,22 +130,6 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
|
|||
{
|
||||
TIntermBinary* binaryNode = node->getAsBinaryNode();
|
||||
|
||||
if (binaryNode) {
|
||||
switch(binaryNode->getOp()) {
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect: // fall through
|
||||
case EOpIndexDirectStruct: // fall through
|
||||
case EOpVectorSwizzle:
|
||||
case EOpMatrixSwizzle:
|
||||
return lValueErrorCheck(loc, op, binaryNode->getLeft());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
error(loc, " l-value required", op, "", "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* symbol = nullptr;
|
||||
TIntermSymbol* symNode = node->getAsSymbolNode();
|
||||
if (symNode != nullptr)
|
||||
|
@ -203,15 +190,40 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
|
|||
// Everything else is okay, no error.
|
||||
//
|
||||
if (message == nullptr)
|
||||
{
|
||||
if (binaryNode) {
|
||||
switch (binaryNode->getOp()) {
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect: // fall through
|
||||
case EOpIndexDirectStruct: // fall through
|
||||
case EOpVectorSwizzle:
|
||||
case EOpMatrixSwizzle:
|
||||
return lValueErrorCheck(loc, op, binaryNode->getLeft());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
error(loc, " l-value required", op, "", "");
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// If we get here, we have an error and a message.
|
||||
//
|
||||
const TIntermTyped* leftMostTypeNode = TIntermediate::findLValueBase(node, true);
|
||||
|
||||
if (symNode)
|
||||
error(loc, " l-value required", op, "\"%s\" (%s)", symbol, message);
|
||||
else
|
||||
error(loc, " l-value required", op, "(%s)", message);
|
||||
if (binaryNode && binaryNode->getAsOperator()->getOp() == EOpIndexDirectStruct)
|
||||
if(IsAnonymous(leftMostTypeNode->getAsSymbolNode()->getName()))
|
||||
error(loc, " l-value required", op, "\"%s\" (%s)", leftMostTypeNode->getAsSymbolNode()->getAccessName().c_str(), message);
|
||||
else
|
||||
error(loc, " l-value required", op, "\"%s\" (%s)", leftMostTypeNode->getAsSymbolNode()->getName().c_str(), message);
|
||||
else
|
||||
error(loc, " l-value required", op, "(%s)", message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -219,28 +231,41 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
|
|||
// Test for and give an error if the node can't be read from.
|
||||
void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node)
|
||||
{
|
||||
TIntermBinary* binaryNode = node->getAsBinaryNode();
|
||||
const TIntermSymbol* symNode = node->getAsSymbolNode();
|
||||
|
||||
if (! node)
|
||||
return;
|
||||
|
||||
TIntermBinary* binaryNode = node->getAsBinaryNode();
|
||||
if (binaryNode) {
|
||||
switch(binaryNode->getOp()) {
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect:
|
||||
case EOpIndexDirectStruct:
|
||||
case EOpVectorSwizzle:
|
||||
case EOpMatrixSwizzle:
|
||||
rValueErrorCheck(loc, op, binaryNode->getLeft());
|
||||
default:
|
||||
break;
|
||||
if (node->getQualifier().isWriteOnly()) {
|
||||
const TIntermTyped* leftMostTypeNode = TIntermediate::findLValueBase(node, true);
|
||||
|
||||
if (symNode != nullptr)
|
||||
error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
|
||||
else if (binaryNode &&
|
||||
(binaryNode->getAsOperator()->getOp() == EOpIndexDirectStruct ||
|
||||
binaryNode->getAsOperator()->getOp() == EOpIndexDirect))
|
||||
if(IsAnonymous(leftMostTypeNode->getAsSymbolNode()->getName()))
|
||||
error(loc, "can't read from writeonly object: ", op, leftMostTypeNode->getAsSymbolNode()->getAccessName().c_str());
|
||||
else
|
||||
error(loc, "can't read from writeonly object: ", op, leftMostTypeNode->getAsSymbolNode()->getName().c_str());
|
||||
else
|
||||
error(loc, "can't read from writeonly object: ", op, "");
|
||||
|
||||
} else {
|
||||
if (binaryNode) {
|
||||
switch (binaryNode->getOp()) {
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect:
|
||||
case EOpIndexDirectStruct:
|
||||
case EOpVectorSwizzle:
|
||||
case EOpMatrixSwizzle:
|
||||
rValueErrorCheck(loc, op, binaryNode->getLeft());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
TIntermSymbol* symNode = node->getAsSymbolNode();
|
||||
if (symNode && symNode->getQualifier().isWriteOnly())
|
||||
error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
|
||||
}
|
||||
|
||||
// Add 'symbol' to the list of deferred linkage symbols, which
|
||||
|
@ -579,7 +604,6 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin
|
|||
selector.push_back(0);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
//
|
||||
// Make the passed-in variable information become a member of the
|
||||
// global uniform block. If this doesn't exist yet, make it.
|
||||
|
@ -601,6 +625,19 @@ void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& mem
|
|||
globalUniformBlock->getWritableType().getQualifier().layoutBinding = globalUniformBinding;
|
||||
globalUniformBlock->getWritableType().getQualifier().layoutSet = globalUniformSet;
|
||||
|
||||
// Check for declarations of this default uniform that already exist due to other compilation units.
|
||||
TSymbol* symbol = symbolTable.find(memberName);
|
||||
if (symbol) {
|
||||
if (memberType != symbol->getType()) {
|
||||
TString err;
|
||||
err += "\"" + memberType.getCompleteString() + "\"";
|
||||
err += " versus ";
|
||||
err += "\"" + symbol->getType().getCompleteString() + "\"";
|
||||
error(loc, "Types must match:", memberType.getFieldName().c_str(), err.c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the requested member as a member to the global block.
|
||||
TType* type = new TType;
|
||||
type->shallowCopy(memberType);
|
||||
|
@ -624,7 +661,67 @@ void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& mem
|
|||
|
||||
++firstNewMember;
|
||||
}
|
||||
#endif
|
||||
|
||||
void TParseContextBase::growAtomicCounterBlock(int binding, const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* typeList) {
|
||||
// Make the atomic counter block, if not yet made.
|
||||
const auto &at = atomicCounterBuffers.find(binding);
|
||||
if (at == atomicCounterBuffers.end()) {
|
||||
atomicCounterBuffers.insert({binding, (TVariable*)nullptr });
|
||||
atomicCounterBlockFirstNewMember.insert({binding, 0});
|
||||
}
|
||||
|
||||
TVariable*& atomicCounterBuffer = atomicCounterBuffers[binding];
|
||||
int& bufferNewMember = atomicCounterBlockFirstNewMember[binding];
|
||||
|
||||
if (atomicCounterBuffer == nullptr) {
|
||||
TQualifier blockQualifier;
|
||||
blockQualifier.clear();
|
||||
blockQualifier.storage = EvqBuffer;
|
||||
|
||||
char charBuffer[512];
|
||||
if (binding != TQualifier::layoutBindingEnd) {
|
||||
snprintf(charBuffer, 512, "%s_%d", getAtomicCounterBlockName(), binding);
|
||||
} else {
|
||||
snprintf(charBuffer, 512, "%s_0", getAtomicCounterBlockName());
|
||||
}
|
||||
|
||||
TType blockType(new TTypeList, *NewPoolTString(charBuffer), blockQualifier);
|
||||
setUniformBlockDefaults(blockType);
|
||||
blockType.getQualifier().layoutPacking = ElpStd430;
|
||||
atomicCounterBuffer = new TVariable(NewPoolTString(""), blockType, true);
|
||||
// If we arn't auto mapping bindings then set the block to use the same
|
||||
// binding as what the atomic was set to use
|
||||
if (!intermediate.getAutoMapBindings()) {
|
||||
atomicCounterBuffer->getWritableType().getQualifier().layoutBinding = binding;
|
||||
}
|
||||
bufferNewMember = 0;
|
||||
|
||||
atomicCounterBuffer->getWritableType().getQualifier().layoutSet = atomicCounterBlockSet;
|
||||
}
|
||||
|
||||
// Add the requested member as a member to the global block.
|
||||
TType* type = new TType;
|
||||
type->shallowCopy(memberType);
|
||||
type->setFieldName(memberName);
|
||||
if (typeList)
|
||||
type->setStruct(typeList);
|
||||
TTypeLoc typeLoc = {type, loc};
|
||||
atomicCounterBuffer->getType().getWritableStruct()->push_back(typeLoc);
|
||||
|
||||
// Insert into the symbol table.
|
||||
if (bufferNewMember == 0) {
|
||||
// This is the first request; we need a normal symbol table insert
|
||||
if (symbolTable.insert(*atomicCounterBuffer))
|
||||
trackLinkage(*atomicCounterBuffer);
|
||||
else
|
||||
error(loc, "failed to insert the global constant buffer", "buffer", "");
|
||||
} else {
|
||||
// This is a follow-on request; we need to amend the first insert
|
||||
symbolTable.amend(*atomicCounterBuffer, bufferNewMember);
|
||||
}
|
||||
|
||||
++bufferNewMember;
|
||||
}
|
||||
|
||||
void TParseContextBase::finish()
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -67,7 +67,7 @@ struct TPragma {
|
|||
class TScanContext;
|
||||
class TPpContext;
|
||||
|
||||
typedef std::set<int> TIdSetType;
|
||||
typedef std::set<long long> TIdSetType;
|
||||
typedef std::map<const TTypeList*, std::map<size_t, const TTypeList*>> TStructRecord;
|
||||
|
||||
//
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
: TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages),
|
||||
scopeMangler("::"),
|
||||
symbolTable(symbolTable),
|
||||
statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0),
|
||||
statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), blockNestingLevel(0), controlFlowNestingLevel(0),
|
||||
currentFunctionType(nullptr),
|
||||
postEntryPointReturn(false),
|
||||
contextPragma(true, false),
|
||||
|
@ -92,7 +92,8 @@ public:
|
|||
limits(resources.limits),
|
||||
globalUniformBlock(nullptr),
|
||||
globalUniformBinding(TQualifier::layoutBindingEnd),
|
||||
globalUniformSet(TQualifier::layoutSetEnd)
|
||||
globalUniformSet(TQualifier::layoutSetEnd),
|
||||
atomicCounterBlockSet(TQualifier::layoutSetEnd)
|
||||
{
|
||||
if (entryPoint != nullptr)
|
||||
sourceEntryPointName = *entryPoint;
|
||||
|
@ -154,10 +155,11 @@ public:
|
|||
extensionCallback(line, extension, behavior);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
// Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
|
||||
virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr);
|
||||
#endif
|
||||
|
||||
// Manage global buffer (used for backing atomic counters in GLSL when using relaxed Vulkan semantics)
|
||||
virtual void growAtomicCounterBlock(int binding, const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr);
|
||||
|
||||
// Potentially rename shader entry point function
|
||||
void renameShaderFunction(TString*& name) const
|
||||
|
@ -178,7 +180,8 @@ public:
|
|||
TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile
|
||||
int statementNestingLevel; // 0 if outside all flow control or compound statements
|
||||
int loopNestingLevel; // 0 if outside all loops
|
||||
int structNestingLevel; // 0 if outside blocks and structures
|
||||
int structNestingLevel; // 0 if outside structures
|
||||
int blockNestingLevel; // 0 if outside blocks
|
||||
int controlFlowNestingLevel; // 0 if outside all flow control
|
||||
const TType* currentFunctionType; // the return type of the function that's currently being parsed
|
||||
bool functionReturnsValue; // true if a non-void function has a return
|
||||
|
@ -229,7 +232,25 @@ protected:
|
|||
// override this to set the language-specific name
|
||||
virtual const char* getGlobalUniformBlockName() const { return ""; }
|
||||
virtual void setUniformBlockDefaults(TType&) const { }
|
||||
virtual void finalizeGlobalUniformBlockLayout(TVariable&) { }
|
||||
virtual void finalizeGlobalUniformBlockLayout(TVariable&) {}
|
||||
|
||||
// Manage the atomic counter block (used for atomic_uints with Vulkan-Relaxed)
|
||||
TMap<int, TVariable*> atomicCounterBuffers;
|
||||
unsigned int atomicCounterBlockSet;
|
||||
TMap<int, int> atomicCounterBlockFirstNewMember;
|
||||
// override this to set the language-specific name
|
||||
virtual const char* getAtomicCounterBlockName() const { return ""; }
|
||||
virtual void setAtomicCounterBlockDefaults(TType&) const {}
|
||||
virtual void setInvariant(const TSourceLoc&, const char*) {}
|
||||
virtual void finalizeAtomicCounterBlockLayout(TVariable&) {}
|
||||
bool isAtomicCounterBlock(const TSymbol& symbol) {
|
||||
const TVariable* var = symbol.getAsVariable();
|
||||
if (!var)
|
||||
return false;
|
||||
const auto& at = atomicCounterBuffers.find(var->getType().getQualifier().layoutBinding);
|
||||
return (at != atomicCounterBuffers.end() && (*at).second->getType() == var->getType());
|
||||
}
|
||||
|
||||
virtual void outputMessage(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, TPrefixType prefix,
|
||||
va_list args);
|
||||
|
@ -292,6 +313,9 @@ public:
|
|||
bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) override;
|
||||
void parserError(const char* s); // for bison's yyerror
|
||||
|
||||
virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr) override;
|
||||
virtual void growAtomicCounterBlock(int binding, const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr) override;
|
||||
|
||||
void reservedErrorCheck(const TSourceLoc&, const TString&);
|
||||
void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op) override;
|
||||
bool lineContinuationCheck(const TSourceLoc&, bool endOfComment) override;
|
||||
|
@ -339,6 +363,10 @@ public:
|
|||
void checkPrecisionQualifier(const TSourceLoc&, TPrecisionQualifier);
|
||||
void memorySemanticsCheck(const TSourceLoc&, const TFunction&, const TIntermOperator& callNode);
|
||||
|
||||
TIntermTyped* vkRelaxedRemapFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*);
|
||||
// returns true if the variable was remapped to something else
|
||||
bool vkRelaxedRemapUniformVariable(const TSourceLoc&, TString&, const TPublicType&, TArraySizes*, TIntermTyped*, TType&);
|
||||
|
||||
void assignError(const TSourceLoc&, const char* op, TString left, TString right);
|
||||
void unaryOpError(const TSourceLoc&, const char* op, TString operand);
|
||||
void binaryOpError(const TSourceLoc&, const char* op, TString left, TString right);
|
||||
|
@ -365,7 +393,7 @@ public:
|
|||
void accStructCheck(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&);
|
||||
void globalQualifierFixCheck(const TSourceLoc&, TQualifier&, bool isMemberCheck = false);
|
||||
void globalQualifierTypeCheck(const TSourceLoc&, const TQualifier&, const TPublicType&);
|
||||
bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType);
|
||||
void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force);
|
||||
|
@ -391,7 +419,7 @@ public:
|
|||
void arrayLimitCheck(const TSourceLoc&, const TString&, int size);
|
||||
void limitCheck(const TSourceLoc&, int value, const char* limit, const char* feature);
|
||||
|
||||
void inductiveLoopBodyCheck(TIntermNode*, int loopIndexId, TSymbolTable&);
|
||||
void inductiveLoopBodyCheck(TIntermNode*, long long loopIndexId, TSymbolTable&);
|
||||
void constantIndexExpressionCheck(TIntermNode*);
|
||||
|
||||
void setLayoutQualifier(const TSourceLoc&, TPublicType&, TString&);
|
||||
|
@ -416,6 +444,7 @@ public:
|
|||
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset);
|
||||
void inheritMemoryQualifiers(const TQualifier& from, TQualifier& to);
|
||||
void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0);
|
||||
void blockStorageRemap(const TSourceLoc&, const TString*, TQualifier&);
|
||||
void blockStageIoCheck(const TSourceLoc&, const TQualifier&);
|
||||
void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName);
|
||||
void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation);
|
||||
|
@ -442,6 +471,21 @@ public:
|
|||
void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*);
|
||||
// Determine loop control from attributes
|
||||
void handleLoopAttributes(const TAttributes& attributes, TIntermNode*);
|
||||
// Function attributes
|
||||
void handleFunctionAttributes(const TSourceLoc&, const TAttributes&);
|
||||
|
||||
// GL_EXT_spirv_intrinsics
|
||||
TSpirvRequirement* makeSpirvRequirement(const TSourceLoc& loc, const TString& name,
|
||||
const TIntermAggregate* extensions, const TIntermAggregate* capabilities);
|
||||
TSpirvRequirement* mergeSpirvRequirements(const TSourceLoc& loc, TSpirvRequirement* spirvReq1,
|
||||
TSpirvRequirement* spirvReq2);
|
||||
TSpirvTypeParameters* makeSpirvTypeParameters(const TSourceLoc& loc, const TIntermConstantUnion* constant);
|
||||
TSpirvTypeParameters* mergeSpirvTypeParameters(TSpirvTypeParameters* spirvTypeParams1,
|
||||
TSpirvTypeParameters* spirvTypeParams2);
|
||||
TSpirvInstruction* makeSpirvInstruction(const TSourceLoc& loc, const TString& name, const TString& value);
|
||||
TSpirvInstruction* makeSpirvInstruction(const TSourceLoc& loc, const TString& name, int value);
|
||||
TSpirvInstruction* mergeSpirvInstruction(const TSourceLoc& loc, TSpirvInstruction* spirvInst1,
|
||||
TSpirvInstruction* spirvInst2);
|
||||
#endif
|
||||
|
||||
void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember);
|
||||
|
@ -460,6 +504,15 @@ protected:
|
|||
void finish() override;
|
||||
#endif
|
||||
|
||||
virtual const char* getGlobalUniformBlockName() const override;
|
||||
virtual void finalizeGlobalUniformBlockLayout(TVariable&) override;
|
||||
virtual void setUniformBlockDefaults(TType& block) const override;
|
||||
|
||||
virtual const char* getAtomicCounterBlockName() const override;
|
||||
virtual void finalizeAtomicCounterBlockLayout(TVariable&) override;
|
||||
virtual void setAtomicCounterBlockDefaults(TType& block) const override;
|
||||
virtual void setInvariant(const TSourceLoc& loc, const char* builtin) override;
|
||||
|
||||
public:
|
||||
//
|
||||
// Generally, bison productions, the scanner, and the PP need read/write access to these; just give them direct access
|
||||
|
@ -484,6 +537,7 @@ protected:
|
|||
TQualifier globalUniformDefaults;
|
||||
TQualifier globalInputDefaults;
|
||||
TQualifier globalOutputDefaults;
|
||||
TQualifier globalSharedDefaults;
|
||||
TString currentCaller; // name of last function body entered (not valid when at global scope)
|
||||
#ifndef GLSLANG_WEB
|
||||
int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point
|
||||
|
|
|
@ -365,6 +365,9 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["if"] = IF;
|
||||
(*KeywordMap)["else"] = ELSE;
|
||||
(*KeywordMap)["discard"] = DISCARD;
|
||||
(*KeywordMap)["terminateInvocation"] = TERMINATE_INVOCATION;
|
||||
(*KeywordMap)["terminateRayEXT"] = TERMINATE_RAY;
|
||||
(*KeywordMap)["ignoreIntersectionEXT"] = IGNORE_INTERSECTION;
|
||||
(*KeywordMap)["return"] = RETURN;
|
||||
(*KeywordMap)["void"] = VOID;
|
||||
(*KeywordMap)["bool"] = BOOL;
|
||||
|
@ -471,6 +474,28 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["image2DMSArray"] = IMAGE2DMSARRAY;
|
||||
(*KeywordMap)["iimage2DMSArray"] = IIMAGE2DMSARRAY;
|
||||
(*KeywordMap)["uimage2DMSArray"] = UIMAGE2DMSARRAY;
|
||||
(*KeywordMap)["i64image1D"] = I64IMAGE1D;
|
||||
(*KeywordMap)["u64image1D"] = U64IMAGE1D;
|
||||
(*KeywordMap)["i64image2D"] = I64IMAGE2D;
|
||||
(*KeywordMap)["u64image2D"] = U64IMAGE2D;
|
||||
(*KeywordMap)["i64image3D"] = I64IMAGE3D;
|
||||
(*KeywordMap)["u64image3D"] = U64IMAGE3D;
|
||||
(*KeywordMap)["i64image2DRect"] = I64IMAGE2DRECT;
|
||||
(*KeywordMap)["u64image2DRect"] = U64IMAGE2DRECT;
|
||||
(*KeywordMap)["i64imageCube"] = I64IMAGECUBE;
|
||||
(*KeywordMap)["u64imageCube"] = U64IMAGECUBE;
|
||||
(*KeywordMap)["i64imageBuffer"] = I64IMAGEBUFFER;
|
||||
(*KeywordMap)["u64imageBuffer"] = U64IMAGEBUFFER;
|
||||
(*KeywordMap)["i64image1DArray"] = I64IMAGE1DARRAY;
|
||||
(*KeywordMap)["u64image1DArray"] = U64IMAGE1DARRAY;
|
||||
(*KeywordMap)["i64image2DArray"] = I64IMAGE2DARRAY;
|
||||
(*KeywordMap)["u64image2DArray"] = U64IMAGE2DARRAY;
|
||||
(*KeywordMap)["i64imageCubeArray"] = I64IMAGECUBEARRAY;
|
||||
(*KeywordMap)["u64imageCubeArray"] = U64IMAGECUBEARRAY;
|
||||
(*KeywordMap)["i64image2DMS"] = I64IMAGE2DMS;
|
||||
(*KeywordMap)["u64image2DMS"] = U64IMAGE2DMS;
|
||||
(*KeywordMap)["i64image2DMSArray"] = I64IMAGE2DMSARRAY;
|
||||
(*KeywordMap)["u64image2DMSArray"] = U64IMAGE2DMSARRAY;
|
||||
(*KeywordMap)["double"] = DOUBLE;
|
||||
(*KeywordMap)["dvec2"] = DVEC2;
|
||||
(*KeywordMap)["dvec3"] = DVEC3;
|
||||
|
@ -561,6 +586,18 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["f64mat4x2"] = F64MAT4X2;
|
||||
(*KeywordMap)["f64mat4x3"] = F64MAT4X3;
|
||||
(*KeywordMap)["f64mat4x4"] = F64MAT4X4;
|
||||
|
||||
// GL_EXT_spirv_intrinsics
|
||||
(*KeywordMap)["spirv_instruction"] = SPIRV_INSTRUCTION;
|
||||
(*KeywordMap)["spirv_execution_mode"] = SPIRV_EXECUTION_MODE;
|
||||
(*KeywordMap)["spirv_execution_mode_id"] = SPIRV_EXECUTION_MODE_ID;
|
||||
(*KeywordMap)["spirv_decorate"] = SPIRV_DECORATE;
|
||||
(*KeywordMap)["spirv_decorate_id"] = SPIRV_DECORATE_ID;
|
||||
(*KeywordMap)["spirv_decorate_string"] = SPIRV_DECORATE_STRING;
|
||||
(*KeywordMap)["spirv_type"] = SPIRV_TYPE;
|
||||
(*KeywordMap)["spirv_storage_class"] = SPIRV_STORAGE_CLASS;
|
||||
(*KeywordMap)["spirv_by_reference"] = SPIRV_BY_REFERENCE;
|
||||
(*KeywordMap)["spirv_literal"] = SPIRV_LITERAL;
|
||||
#endif
|
||||
|
||||
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
||||
|
@ -702,6 +739,7 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["f16subpassInputMS"] = F16SUBPASSINPUTMS;
|
||||
(*KeywordMap)["__explicitInterpAMD"] = EXPLICITINTERPAMD;
|
||||
(*KeywordMap)["pervertexNV"] = PERVERTEXNV;
|
||||
(*KeywordMap)["pervertexEXT"] = PERVERTEXEXT;
|
||||
(*KeywordMap)["precise"] = PRECISE;
|
||||
|
||||
(*KeywordMap)["rayPayloadNV"] = PAYLOADNV;
|
||||
|
@ -720,6 +758,8 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["perprimitiveNV"] = PERPRIMITIVENV;
|
||||
(*KeywordMap)["perviewNV"] = PERVIEWNV;
|
||||
(*KeywordMap)["taskNV"] = PERTASKNV;
|
||||
(*KeywordMap)["perprimitiveEXT"] = PERPRIMITIVEEXT;
|
||||
(*KeywordMap)["taskPayloadSharedEXT"] = TASKPAYLOADWORKGROUPEXT;
|
||||
|
||||
(*KeywordMap)["fcoopmatNV"] = FCOOPMATNV;
|
||||
(*KeywordMap)["icoopmatNV"] = ICOOPMATNV;
|
||||
|
@ -914,6 +954,17 @@ int TScanContext::tokenizeIdentifier()
|
|||
case CASE:
|
||||
return keyword;
|
||||
|
||||
case TERMINATE_INVOCATION:
|
||||
if (!parseContext.extensionTurnedOn(E_GL_EXT_terminate_invocation))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case TERMINATE_RAY:
|
||||
case IGNORE_INTERSECTION:
|
||||
if (!parseContext.extensionTurnedOn(E_GL_EXT_ray_tracing))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case BUFFER:
|
||||
afterBuffer = true;
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
|
||||
|
@ -982,7 +1033,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
return keyword;
|
||||
case PACKED:
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 330))
|
||||
(!parseContext.isEsProfile() && parseContext.version < 140))
|
||||
return reservedWord();
|
||||
return identifierOrType();
|
||||
|
||||
|
@ -1147,6 +1198,19 @@ int TScanContext::tokenizeIdentifier()
|
|||
afterType = true;
|
||||
return firstGenerationImage(false);
|
||||
|
||||
case I64IMAGE1D:
|
||||
case U64IMAGE1D:
|
||||
case I64IMAGE1DARRAY:
|
||||
case U64IMAGE1DARRAY:
|
||||
case I64IMAGE2DRECT:
|
||||
case U64IMAGE2DRECT:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_image_int64)) {
|
||||
return firstGenerationImage(false);
|
||||
}
|
||||
return identifierOrType();
|
||||
|
||||
case IMAGEBUFFER:
|
||||
case IIMAGEBUFFER:
|
||||
case UIMAGEBUFFER:
|
||||
|
@ -1156,6 +1220,18 @@ int TScanContext::tokenizeIdentifier()
|
|||
return keyword;
|
||||
return firstGenerationImage(false);
|
||||
|
||||
case I64IMAGEBUFFER:
|
||||
case U64IMAGEBUFFER:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_image_int64)) {
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
return keyword;
|
||||
return firstGenerationImage(false);
|
||||
}
|
||||
return identifierOrType();
|
||||
|
||||
case IMAGE2D:
|
||||
case IIMAGE2D:
|
||||
case UIMAGE2D:
|
||||
|
@ -1171,6 +1247,20 @@ int TScanContext::tokenizeIdentifier()
|
|||
afterType = true;
|
||||
return firstGenerationImage(true);
|
||||
|
||||
case I64IMAGE2D:
|
||||
case U64IMAGE2D:
|
||||
case I64IMAGE3D:
|
||||
case U64IMAGE3D:
|
||||
case I64IMAGECUBE:
|
||||
case U64IMAGECUBE:
|
||||
case I64IMAGE2DARRAY:
|
||||
case U64IMAGE2DARRAY:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_image_int64))
|
||||
return firstGenerationImage(true);
|
||||
return identifierOrType();
|
||||
|
||||
case IMAGECUBEARRAY:
|
||||
case IIMAGECUBEARRAY:
|
||||
case UIMAGECUBEARRAY:
|
||||
|
@ -1180,6 +1270,18 @@ int TScanContext::tokenizeIdentifier()
|
|||
return keyword;
|
||||
return secondGenerationImage();
|
||||
|
||||
case I64IMAGECUBEARRAY:
|
||||
case U64IMAGECUBEARRAY:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_image_int64)) {
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
|
||||
return keyword;
|
||||
return secondGenerationImage();
|
||||
}
|
||||
return identifierOrType();
|
||||
|
||||
case IMAGE2DMS:
|
||||
case IIMAGE2DMS:
|
||||
case UIMAGE2DMS:
|
||||
|
@ -1189,6 +1291,17 @@ int TScanContext::tokenizeIdentifier()
|
|||
afterType = true;
|
||||
return secondGenerationImage();
|
||||
|
||||
case I64IMAGE2DMS:
|
||||
case U64IMAGE2DMS:
|
||||
case I64IMAGE2DMSARRAY:
|
||||
case U64IMAGE2DMSARRAY:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_image_int64)) {
|
||||
return secondGenerationImage();
|
||||
}
|
||||
return identifierOrType();
|
||||
|
||||
case DOUBLE:
|
||||
case DVEC2:
|
||||
case DVEC3:
|
||||
|
@ -1609,6 +1722,12 @@ int TScanContext::tokenizeIdentifier()
|
|||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
case PERVERTEXEXT:
|
||||
if ((!parseContext.isEsProfile() && parseContext.version >= 450) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_fragment_shader_barycentric))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
case PRECISE:
|
||||
if ((parseContext.isEsProfile() &&
|
||||
(parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) ||
|
||||
|
@ -1623,12 +1742,18 @@ int TScanContext::tokenizeIdentifier()
|
|||
case PERPRIMITIVENV:
|
||||
case PERVIEWNV:
|
||||
case PERTASKNV:
|
||||
if ((!parseContext.isEsProfile() && parseContext.version >= 450) ||
|
||||
(parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
parseContext.extensionTurnedOn(E_GL_NV_mesh_shader))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
case PERPRIMITIVEEXT:
|
||||
case TASKPAYLOADWORKGROUPEXT:
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_mesh_shader))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
case FCOOPMATNV:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
|
@ -1649,6 +1774,21 @@ int TScanContext::tokenizeIdentifier()
|
|||
return keyword;
|
||||
else
|
||||
return identifierOrType();
|
||||
|
||||
case SPIRV_INSTRUCTION:
|
||||
case SPIRV_EXECUTION_MODE:
|
||||
case SPIRV_EXECUTION_MODE_ID:
|
||||
case SPIRV_DECORATE:
|
||||
case SPIRV_DECORATE_ID:
|
||||
case SPIRV_DECORATE_STRING:
|
||||
case SPIRV_TYPE:
|
||||
case SPIRV_STORAGE_CLASS:
|
||||
case SPIRV_BY_REFERENCE:
|
||||
case SPIRV_LITERAL:
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_spirv_intrinsics))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -159,7 +159,7 @@ int MapVersionToIndex(int version)
|
|||
return index;
|
||||
}
|
||||
|
||||
const int SpvVersionCount = 3; // index range in MapSpvVersionToIndex
|
||||
const int SpvVersionCount = 4; // index range in MapSpvVersionToIndex
|
||||
|
||||
int MapSpvVersionToIndex(const SpvVersion& spvVersion)
|
||||
{
|
||||
|
@ -167,8 +167,12 @@ int MapSpvVersionToIndex(const SpvVersion& spvVersion)
|
|||
|
||||
if (spvVersion.openGl > 0)
|
||||
index = 1;
|
||||
else if (spvVersion.vulkan > 0)
|
||||
index = 2;
|
||||
else if (spvVersion.vulkan > 0) {
|
||||
if (!spvVersion.vulkanRelaxed)
|
||||
index = 2;
|
||||
else
|
||||
index = 3;
|
||||
}
|
||||
|
||||
assert(index < SpvVersionCount);
|
||||
|
||||
|
@ -387,13 +391,13 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
|||
// check for mesh
|
||||
if ((profile != EEsProfile && version >= 450) ||
|
||||
(profile == EEsProfile && version >= 320))
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangMeshNV, source,
|
||||
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, EShLangTaskNV, source,
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTask, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
#endif // !GLSLANG_ANGLE
|
||||
#endif // !GLSLANG_WEB
|
||||
|
@ -646,8 +650,8 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
|||
version = 460;
|
||||
}
|
||||
break;
|
||||
case EShLangMeshNV:
|
||||
case EShLangTaskNV:
|
||||
case EShLangMesh:
|
||||
case EShLangTask:
|
||||
if ((profile == EEsProfile && version < 320) ||
|
||||
(profile != EEsProfile && version < 450)) {
|
||||
correct = false;
|
||||
|
@ -723,6 +727,7 @@ void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages
|
|||
break;
|
||||
case EShClientVulkan:
|
||||
spvVersion.vulkanGlsl = environment->input.dialectVersion;
|
||||
spvVersion.vulkanRelaxed = environment->input.vulkanRulesRelaxed;
|
||||
break;
|
||||
case EShClientOpenGL:
|
||||
spvVersion.openGl = environment->input.dialectVersion;
|
||||
|
@ -808,6 +813,7 @@ bool ProcessDeferred(
|
|||
// set version/profile to defaultVersion/defaultProfile regardless of the #version
|
||||
// directive in the source code
|
||||
bool forceDefaultVersionAndProfile,
|
||||
int overrideVersion, // overrides version specified by #verison or default version
|
||||
bool forwardCompatible, // give errors for use of deprecated features
|
||||
EShMessages messages, // warnings/errors/AST; things to print out
|
||||
TIntermediate& intermediate, // returned tree, etc.
|
||||
|
@ -895,6 +901,9 @@ bool ProcessDeferred(
|
|||
version = defaultVersion;
|
||||
profile = defaultProfile;
|
||||
}
|
||||
if (source == EShSourceGlsl && overrideVersion != 0) {
|
||||
version = overrideVersion;
|
||||
}
|
||||
|
||||
bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage,
|
||||
versionNotFirst, defaultVersion, source, version, profile, spvVersion);
|
||||
|
@ -949,6 +958,9 @@ bool ProcessDeferred(
|
|||
if (cachedTable)
|
||||
symbolTable->adoptLevels(*cachedTable);
|
||||
|
||||
if (intermediate.getUniqueId() != 0)
|
||||
symbolTable->overwriteUniqueId(intermediate.getUniqueId());
|
||||
|
||||
// Add built-in symbols that are potentially context dependent;
|
||||
// they get popped again further down.
|
||||
if (! AddContextSpecificSymbols(resources, compiler->infoSink, *symbolTable, version, profile, spvVersion,
|
||||
|
@ -1011,6 +1023,7 @@ bool ProcessDeferred(
|
|||
bool success = processingContext(*parseContext, ppContext, fullInput,
|
||||
versionWillBeError, *symbolTable,
|
||||
intermediate, optLevel, messages);
|
||||
intermediate.setUniqueId(symbolTable->getMaxSymbolId());
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -1266,18 +1279,20 @@ bool PreprocessDeferred(
|
|||
int defaultVersion, // use 100 for ES environment, 110 for desktop
|
||||
EProfile defaultProfile,
|
||||
bool forceDefaultVersionAndProfile,
|
||||
int overrideVersion, // use 0 if not overriding GLSL version
|
||||
bool forwardCompatible, // give errors for use of deprecated features
|
||||
EShMessages messages, // warnings/errors/AST; things to print out
|
||||
TShader::Includer& includer,
|
||||
TIntermediate& intermediate, // returned tree, etc.
|
||||
std::string* outputString)
|
||||
std::string* outputString,
|
||||
TEnvironment* environment = nullptr)
|
||||
{
|
||||
DoPreprocessing parser(outputString);
|
||||
return ProcessDeferred(compiler, shaderStrings, numStrings, inputLengths, stringNames,
|
||||
preamble, optLevel, resources, defaultVersion,
|
||||
defaultProfile, forceDefaultVersionAndProfile,
|
||||
defaultProfile, forceDefaultVersionAndProfile, overrideVersion,
|
||||
forwardCompatible, messages, intermediate, parser,
|
||||
false, includer);
|
||||
false, includer, "", environment);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1304,6 +1319,7 @@ bool CompileDeferred(
|
|||
int defaultVersion, // use 100 for ES environment, 110 for desktop
|
||||
EProfile defaultProfile,
|
||||
bool forceDefaultVersionAndProfile,
|
||||
int overrideVersion, // use 0 if not overriding GLSL version
|
||||
bool forwardCompatible, // give errors for use of deprecated features
|
||||
EShMessages messages, // warnings/errors/AST; things to print out
|
||||
TIntermediate& intermediate,// returned tree, etc.
|
||||
|
@ -1314,7 +1330,7 @@ bool CompileDeferred(
|
|||
DoFullParse parser;
|
||||
return ProcessDeferred(compiler, shaderStrings, numStrings, inputLengths, stringNames,
|
||||
preamble, optLevel, resources, defaultVersion,
|
||||
defaultProfile, forceDefaultVersionAndProfile,
|
||||
defaultProfile, forceDefaultVersionAndProfile, overrideVersion,
|
||||
forwardCompatible, messages, intermediate, parser,
|
||||
true, includer, sourceEntryPointName, environment);
|
||||
}
|
||||
|
@ -1333,7 +1349,6 @@ int ShInitialize()
|
|||
|
||||
glslang::GetGlobalLock();
|
||||
++NumberOfClients;
|
||||
glslang::ReleaseGlobalLock();
|
||||
|
||||
if (PerProcessGPA == nullptr)
|
||||
PerProcessGPA = new TPoolAllocator();
|
||||
|
@ -1343,6 +1358,7 @@ int ShInitialize()
|
|||
glslang::HlslScanContext::fillInKeywordMap();
|
||||
#endif
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1405,9 +1421,10 @@ int ShFinalize()
|
|||
--NumberOfClients;
|
||||
assert(NumberOfClients >= 0);
|
||||
bool finalize = NumberOfClients == 0;
|
||||
glslang::ReleaseGlobalLock();
|
||||
if (! finalize)
|
||||
if (! finalize) {
|
||||
glslang::ReleaseGlobalLock();
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int version = 0; version < VersionCount; ++version) {
|
||||
for (int spvVersion = 0; spvVersion < SpvVersionCount; ++spvVersion) {
|
||||
|
@ -1445,6 +1462,7 @@ int ShFinalize()
|
|||
glslang::HlslScanContext::deleteKeywordMap();
|
||||
#endif
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1486,7 +1504,7 @@ int ShCompile(
|
|||
TIntermediate intermediate(compiler->getLanguage());
|
||||
TShader::ForbidIncluder includer;
|
||||
bool success = CompileDeferred(compiler, shaderStrings, numStrings, inputLengths, nullptr,
|
||||
"", optLevel, resources, defaultVersion, ENoProfile, false,
|
||||
"", optLevel, resources, defaultVersion, ENoProfile, false, 0,
|
||||
forwardCompatible, messages, intermediate, includer);
|
||||
|
||||
//
|
||||
|
@ -1747,7 +1765,7 @@ public:
|
|||
};
|
||||
|
||||
TShader::TShader(EShLanguage s)
|
||||
: stage(s), lengths(nullptr), stringNames(nullptr), preamble("")
|
||||
: stage(s), lengths(nullptr), stringNames(nullptr), preamble(""), overrideVersion(0)
|
||||
{
|
||||
pool = new TPoolAllocator;
|
||||
infoSink = new TInfoSink;
|
||||
|
@ -1757,6 +1775,7 @@ TShader::TShader(EShLanguage s)
|
|||
// clear environment (avoid constructors in them for use in a C interface)
|
||||
environment.input.languageFamily = EShSourceNone;
|
||||
environment.input.dialect = EShClientNone;
|
||||
environment.input.vulkanRulesRelaxed = false;
|
||||
environment.client.client = EShClientNone;
|
||||
environment.target.language = EShTargetNone;
|
||||
environment.target.hlslFunctionality1 = false;
|
||||
|
@ -1810,7 +1829,20 @@ void TShader::addProcesses(const std::vector<std::string>& p)
|
|||
intermediate->addProcesses(p);
|
||||
}
|
||||
|
||||
void TShader::setUniqueId(unsigned long long id)
|
||||
{
|
||||
intermediate->setUniqueId(id);
|
||||
}
|
||||
|
||||
void TShader::setOverrideVersion(int version)
|
||||
{
|
||||
overrideVersion = version;
|
||||
}
|
||||
|
||||
void TShader::setDebugInfo(bool debugInfo) { intermediate->setDebugInfo(debugInfo); }
|
||||
void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); }
|
||||
void TShader::setDxPositionW(bool invert) { intermediate->setDxPositionW(invert); }
|
||||
void TShader::setEnhancedMsgs() { intermediate->setEnhancedMsgs(); }
|
||||
void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); }
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
@ -1858,6 +1890,15 @@ void TShader::setResourceSetBinding(const std::vector<std::string>& base) { in
|
|||
void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); }
|
||||
#endif
|
||||
|
||||
void TShader::addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing) { intermediate->addBlockStorageOverride(nameStr, backing); }
|
||||
|
||||
void TShader::setGlobalUniformBlockName(const char* name) { intermediate->setGlobalUniformBlockName(name); }
|
||||
void TShader::setGlobalUniformSet(unsigned int set) { intermediate->setGlobalUniformSet(set); }
|
||||
void TShader::setGlobalUniformBinding(unsigned int binding) { intermediate->setGlobalUniformBinding(binding); }
|
||||
|
||||
void TShader::setAtomicCounterBlockName(const char* name) { intermediate->setAtomicCounterBlockName(name); }
|
||||
void TShader::setAtomicCounterBlockSet(unsigned int set) { intermediate->setAtomicCounterBlockSet(set); }
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
|
||||
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
|
||||
|
@ -1881,7 +1922,7 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
|
|||
|
||||
return CompileDeferred(compiler, strings, numStrings, lengths, stringNames,
|
||||
preamble, EShOptNone, builtInResources, defaultVersion,
|
||||
defaultProfile, forceDefaultVersionAndProfile,
|
||||
defaultProfile, forceDefaultVersionAndProfile, overrideVersion,
|
||||
forwardCompatible, messages, *intermediate, includer, sourceEntryPointName,
|
||||
&environment);
|
||||
}
|
||||
|
@ -1908,8 +1949,9 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources,
|
|||
|
||||
return PreprocessDeferred(compiler, strings, numStrings, lengths, stringNames, preamble,
|
||||
EShOptNone, builtInResources, defaultVersion,
|
||||
defaultProfile, forceDefaultVersionAndProfile,
|
||||
forwardCompatible, message, includer, *intermediate, output_string);
|
||||
defaultProfile, forceDefaultVersionAndProfile, overrideVersion,
|
||||
forwardCompatible, message, includer, *intermediate, output_string,
|
||||
&environment);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1972,7 +2014,10 @@ bool TProgram::link(EShMessages messages)
|
|||
error = true;
|
||||
}
|
||||
|
||||
// TODO: Link: cross-stage error checking
|
||||
if (!error) {
|
||||
if (! crossStageCheck(messages))
|
||||
error = true;
|
||||
}
|
||||
|
||||
return ! error;
|
||||
}
|
||||
|
@ -2016,7 +2061,9 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
|
|||
intermediate[stage] = new TIntermediate(stage,
|
||||
firstIntermediate->getVersion(),
|
||||
firstIntermediate->getProfile());
|
||||
|
||||
intermediate[stage]->setLimits(firstIntermediate->getLimits());
|
||||
if (firstIntermediate->getEnhancedMsgs())
|
||||
intermediate[stage]->setEnhancedMsgs();
|
||||
|
||||
// The new TIntermediate must use the same origin as the original TIntermediates.
|
||||
// Otherwise linking will fail due to different coordinate systems.
|
||||
|
@ -2049,6 +2096,69 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
|
|||
return intermediate[stage]->getNumErrors() == 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Check that there are no errors in linker objects accross stages
|
||||
//
|
||||
// Return true if no errors.
|
||||
//
|
||||
bool TProgram::crossStageCheck(EShMessages) {
|
||||
|
||||
// make temporary intermediates to hold the linkage symbols for each linking interface
|
||||
// while we do the checks
|
||||
// Independent interfaces are:
|
||||
// all uniform variables and blocks
|
||||
// all buffer blocks
|
||||
// all in/out on a stage boundary
|
||||
|
||||
TVector<TIntermediate*> activeStages;
|
||||
for (int s = 0; s < EShLangCount; ++s) {
|
||||
if (intermediate[s])
|
||||
activeStages.push_back(intermediate[s]);
|
||||
}
|
||||
|
||||
// no extra linking if there is only one stage
|
||||
if (! (activeStages.size() > 1))
|
||||
return true;
|
||||
|
||||
// setup temporary tree to hold unfirom objects from different stages
|
||||
TIntermediate* firstIntermediate = activeStages.front();
|
||||
TIntermediate uniforms(EShLangCount,
|
||||
firstIntermediate->getVersion(),
|
||||
firstIntermediate->getProfile());
|
||||
uniforms.setSpv(firstIntermediate->getSpv());
|
||||
|
||||
TIntermAggregate uniformObjects(EOpLinkerObjects);
|
||||
TIntermAggregate root(EOpSequence);
|
||||
root.getSequence().push_back(&uniformObjects);
|
||||
uniforms.setTreeRoot(&root);
|
||||
|
||||
bool error = false;
|
||||
|
||||
// merge uniforms from all stages into a single intermediate
|
||||
for (unsigned int i = 0; i < activeStages.size(); ++i) {
|
||||
uniforms.mergeUniformObjects(*infoSink, *activeStages[i]);
|
||||
}
|
||||
error |= uniforms.getNumErrors() != 0;
|
||||
|
||||
// copy final definition of global block back into each stage
|
||||
for (unsigned int i = 0; i < activeStages.size(); ++i) {
|
||||
// We only want to merge into already existing global uniform blocks.
|
||||
// A stage that doesn't already know about the global doesn't care about it's content.
|
||||
// Otherwise we end up pointing to the same object between different stages
|
||||
// and that will break binding/set remappings
|
||||
bool mergeExistingOnly = true;
|
||||
activeStages[i]->mergeGlobalUniformBlocks(*infoSink, uniforms, mergeExistingOnly);
|
||||
}
|
||||
|
||||
// compare cross stage symbols for each stage boundary
|
||||
for (unsigned int i = 1; i < activeStages.size(); ++i) {
|
||||
activeStages[i - 1]->checkStageIO(*infoSink, *activeStages[i]);
|
||||
error |= (activeStages[i - 1]->getNumErrors() != 0);
|
||||
}
|
||||
|
||||
return !error;
|
||||
}
|
||||
|
||||
const char* TProgram::getInfoLog()
|
||||
{
|
||||
return infoSink->info.c_str();
|
||||
|
|
|
@ -0,0 +1,350 @@
|
|||
//
|
||||
// Copyright(C) 2021 Advanced Micro Devices, 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 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.
|
||||
//
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
//
|
||||
// GL_EXT_spirv_intrinsics
|
||||
//
|
||||
#include "../Include/intermediate.h"
|
||||
#include "../Include/SpirvIntrinsics.h"
|
||||
#include "../Include/Types.h"
|
||||
#include "ParseHelper.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
//
|
||||
// Handle SPIR-V requirements
|
||||
//
|
||||
TSpirvRequirement* TParseContext::makeSpirvRequirement(const TSourceLoc& loc, const TString& name,
|
||||
const TIntermAggregate* extensions,
|
||||
const TIntermAggregate* capabilities)
|
||||
{
|
||||
TSpirvRequirement* spirvReq = new TSpirvRequirement;
|
||||
|
||||
if (name == "extensions") {
|
||||
assert(extensions);
|
||||
for (auto extension : extensions->getSequence()) {
|
||||
assert(extension->getAsConstantUnion());
|
||||
spirvReq->extensions.insert(*extension->getAsConstantUnion()->getConstArray()[0].getSConst());
|
||||
}
|
||||
} else if (name == "capabilities") {
|
||||
assert(capabilities);
|
||||
for (auto capability : capabilities->getSequence()) {
|
||||
assert(capability->getAsConstantUnion());
|
||||
spirvReq->capabilities.insert(capability->getAsConstantUnion()->getConstArray()[0].getIConst());
|
||||
}
|
||||
} else
|
||||
error(loc, "unknow SPIR-V requirement", name.c_str(), "");
|
||||
|
||||
return spirvReq;
|
||||
}
|
||||
|
||||
TSpirvRequirement* TParseContext::mergeSpirvRequirements(const TSourceLoc& loc, TSpirvRequirement* spirvReq1,
|
||||
TSpirvRequirement* spirvReq2)
|
||||
{
|
||||
// Merge the second SPIR-V requirement to the first one
|
||||
if (!spirvReq2->extensions.empty()) {
|
||||
if (spirvReq1->extensions.empty())
|
||||
spirvReq1->extensions = spirvReq2->extensions;
|
||||
else
|
||||
error(loc, "too many SPIR-V requirements", "extensions", "");
|
||||
}
|
||||
|
||||
if (!spirvReq2->capabilities.empty()) {
|
||||
if (spirvReq1->capabilities.empty())
|
||||
spirvReq1->capabilities = spirvReq2->capabilities;
|
||||
else
|
||||
error(loc, "too many SPIR-V requirements", "capabilities", "");
|
||||
}
|
||||
|
||||
return spirvReq1;
|
||||
}
|
||||
|
||||
void TIntermediate::insertSpirvRequirement(const TSpirvRequirement* spirvReq)
|
||||
{
|
||||
if (!spirvRequirement)
|
||||
spirvRequirement = new TSpirvRequirement;
|
||||
|
||||
for (auto extension : spirvReq->extensions)
|
||||
spirvRequirement->extensions.insert(extension);
|
||||
|
||||
for (auto capability : spirvReq->capabilities)
|
||||
spirvRequirement->capabilities.insert(capability);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle SPIR-V execution modes
|
||||
//
|
||||
void TIntermediate::insertSpirvExecutionMode(int executionMode, const TIntermAggregate* args)
|
||||
{
|
||||
if (!spirvExecutionMode)
|
||||
spirvExecutionMode = new TSpirvExecutionMode;
|
||||
|
||||
TVector<const TIntermConstantUnion*> extraOperands;
|
||||
if (args) {
|
||||
for (auto arg : args->getSequence()) {
|
||||
auto extraOperand = arg->getAsConstantUnion();
|
||||
assert(extraOperand != nullptr);
|
||||
extraOperands.push_back(extraOperand);
|
||||
}
|
||||
}
|
||||
spirvExecutionMode->modes[executionMode] = extraOperands;
|
||||
}
|
||||
|
||||
void TIntermediate::insertSpirvExecutionModeId(int executionMode, const TIntermAggregate* args)
|
||||
{
|
||||
if (!spirvExecutionMode)
|
||||
spirvExecutionMode = new TSpirvExecutionMode;
|
||||
|
||||
assert(args);
|
||||
TVector<const TIntermTyped*> extraOperands;
|
||||
|
||||
for (auto arg : args->getSequence()) {
|
||||
auto extraOperand = arg->getAsTyped();
|
||||
assert(extraOperand != nullptr && extraOperand->getQualifier().isConstant());
|
||||
extraOperands.push_back(extraOperand);
|
||||
}
|
||||
spirvExecutionMode->modeIds[executionMode] = extraOperands;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle SPIR-V decorate qualifiers
|
||||
//
|
||||
void TQualifier::setSpirvDecorate(int decoration, const TIntermAggregate* args)
|
||||
{
|
||||
if (!spirvDecorate)
|
||||
spirvDecorate = new TSpirvDecorate;
|
||||
|
||||
TVector<const TIntermConstantUnion*> extraOperands;
|
||||
if (args) {
|
||||
for (auto arg : args->getSequence()) {
|
||||
auto extraOperand = arg->getAsConstantUnion();
|
||||
assert(extraOperand != nullptr);
|
||||
extraOperands.push_back(extraOperand);
|
||||
}
|
||||
}
|
||||
spirvDecorate->decorates[decoration] = extraOperands;
|
||||
}
|
||||
|
||||
void TQualifier::setSpirvDecorateId(int decoration, const TIntermAggregate* args)
|
||||
{
|
||||
if (!spirvDecorate)
|
||||
spirvDecorate = new TSpirvDecorate;
|
||||
|
||||
assert(args);
|
||||
TVector<const TIntermTyped*> extraOperands;
|
||||
for (auto arg : args->getSequence()) {
|
||||
auto extraOperand = arg->getAsTyped();
|
||||
assert(extraOperand != nullptr && extraOperand->getQualifier().isConstant());
|
||||
extraOperands.push_back(extraOperand);
|
||||
}
|
||||
spirvDecorate->decorateIds[decoration] = extraOperands;
|
||||
}
|
||||
|
||||
void TQualifier::setSpirvDecorateString(int decoration, const TIntermAggregate* args)
|
||||
{
|
||||
if (!spirvDecorate)
|
||||
spirvDecorate = new TSpirvDecorate;
|
||||
|
||||
assert(args);
|
||||
TVector<const TIntermConstantUnion*> extraOperands;
|
||||
for (auto arg : args->getSequence()) {
|
||||
auto extraOperand = arg->getAsConstantUnion();
|
||||
assert(extraOperand != nullptr);
|
||||
extraOperands.push_back(extraOperand);
|
||||
}
|
||||
spirvDecorate->decorateStrings[decoration] = extraOperands;
|
||||
}
|
||||
|
||||
TString TQualifier::getSpirvDecorateQualifierString() const
|
||||
{
|
||||
assert(spirvDecorate);
|
||||
|
||||
TString qualifierString;
|
||||
|
||||
const auto appendFloat = [&](float f) { qualifierString.append(std::to_string(f).c_str()); };
|
||||
const auto appendInt = [&](int i) { qualifierString.append(std::to_string(i).c_str()); };
|
||||
const auto appendUint = [&](unsigned int u) { qualifierString.append(std::to_string(u).c_str()); };
|
||||
const auto appendBool = [&](bool b) { qualifierString.append(std::to_string(b).c_str()); };
|
||||
const auto appendStr = [&](const char* s) { qualifierString.append(s); };
|
||||
|
||||
const auto appendDecorate = [&](const TIntermTyped* constant) {
|
||||
auto& constArray = constant->getAsConstantUnion() != nullptr ? constant->getAsConstantUnion()->getConstArray()
|
||||
: constant->getAsSymbolNode()->getConstArray();
|
||||
if (constant->getBasicType() == EbtFloat) {
|
||||
float value = static_cast<float>(constArray[0].getDConst());
|
||||
appendFloat(value);
|
||||
}
|
||||
else if (constant->getBasicType() == EbtInt) {
|
||||
int value = constArray[0].getIConst();
|
||||
appendInt(value);
|
||||
}
|
||||
else if (constant->getBasicType() == EbtUint) {
|
||||
unsigned value = constArray[0].getUConst();
|
||||
appendUint(value);
|
||||
}
|
||||
else if (constant->getBasicType() == EbtBool) {
|
||||
bool value = constArray[0].getBConst();
|
||||
appendBool(value);
|
||||
}
|
||||
else if (constant->getBasicType() == EbtString) {
|
||||
const TString* value = constArray[0].getSConst();
|
||||
appendStr(value->c_str());
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
};
|
||||
|
||||
for (auto& decorate : spirvDecorate->decorates) {
|
||||
appendStr("spirv_decorate(");
|
||||
appendInt(decorate.first);
|
||||
for (auto extraOperand : decorate.second) {
|
||||
appendStr(", ");
|
||||
appendDecorate(extraOperand);
|
||||
}
|
||||
appendStr(") ");
|
||||
}
|
||||
|
||||
for (auto& decorateId : spirvDecorate->decorateIds) {
|
||||
appendStr("spirv_decorate_id(");
|
||||
appendInt(decorateId.first);
|
||||
for (auto extraOperand : decorateId.second) {
|
||||
appendStr(", ");
|
||||
appendDecorate(extraOperand);
|
||||
}
|
||||
appendStr(") ");
|
||||
}
|
||||
|
||||
for (auto& decorateString : spirvDecorate->decorateStrings) {
|
||||
appendStr("spirv_decorate_string(");
|
||||
appendInt(decorateString.first);
|
||||
for (auto extraOperand : decorateString.second) {
|
||||
appendStr(", ");
|
||||
appendDecorate(extraOperand);
|
||||
}
|
||||
appendStr(") ");
|
||||
}
|
||||
|
||||
return qualifierString;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle SPIR-V type specifiers
|
||||
//
|
||||
void TPublicType::setSpirvType(const TSpirvInstruction& spirvInst, const TSpirvTypeParameters* typeParams)
|
||||
{
|
||||
if (!spirvType)
|
||||
spirvType = new TSpirvType;
|
||||
|
||||
basicType = EbtSpirvType;
|
||||
spirvType->spirvInst = spirvInst;
|
||||
if (typeParams)
|
||||
spirvType->typeParams = *typeParams;
|
||||
}
|
||||
|
||||
TSpirvTypeParameters* TParseContext::makeSpirvTypeParameters(const TSourceLoc& loc, const TIntermConstantUnion* constant)
|
||||
{
|
||||
TSpirvTypeParameters* spirvTypeParams = new TSpirvTypeParameters;
|
||||
if (constant->getBasicType() != EbtFloat &&
|
||||
constant->getBasicType() != EbtInt &&
|
||||
constant->getBasicType() != EbtUint &&
|
||||
constant->getBasicType() != EbtBool &&
|
||||
constant->getBasicType() != EbtString)
|
||||
error(loc, "this type not allowed", constant->getType().getBasicString(), "");
|
||||
else {
|
||||
assert(constant);
|
||||
spirvTypeParams->push_back(TSpirvTypeParameter(constant));
|
||||
}
|
||||
|
||||
return spirvTypeParams;
|
||||
}
|
||||
|
||||
TSpirvTypeParameters* TParseContext::mergeSpirvTypeParameters(TSpirvTypeParameters* spirvTypeParams1, TSpirvTypeParameters* spirvTypeParams2)
|
||||
{
|
||||
// Merge SPIR-V type parameters of the second one to the first one
|
||||
for (const auto& spirvTypeParam : *spirvTypeParams2)
|
||||
spirvTypeParams1->push_back(spirvTypeParam);
|
||||
return spirvTypeParams1;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle SPIR-V instruction qualifiers
|
||||
//
|
||||
TSpirvInstruction* TParseContext::makeSpirvInstruction(const TSourceLoc& loc, const TString& name, const TString& value)
|
||||
{
|
||||
TSpirvInstruction* spirvInst = new TSpirvInstruction;
|
||||
if (name == "set")
|
||||
spirvInst->set = value;
|
||||
else
|
||||
error(loc, "unknown SPIR-V instruction qualifier", name.c_str(), "");
|
||||
|
||||
return spirvInst;
|
||||
}
|
||||
|
||||
TSpirvInstruction* TParseContext::makeSpirvInstruction(const TSourceLoc& loc, const TString& name, int value)
|
||||
{
|
||||
TSpirvInstruction* spirvInstuction = new TSpirvInstruction;
|
||||
if (name == "id")
|
||||
spirvInstuction->id = value;
|
||||
else
|
||||
error(loc, "unknown SPIR-V instruction qualifier", name.c_str(), "");
|
||||
|
||||
return spirvInstuction;
|
||||
}
|
||||
|
||||
TSpirvInstruction* TParseContext::mergeSpirvInstruction(const TSourceLoc& loc, TSpirvInstruction* spirvInst1, TSpirvInstruction* spirvInst2)
|
||||
{
|
||||
// Merge qualifiers of the second SPIR-V instruction to those of the first one
|
||||
if (!spirvInst2->set.empty()) {
|
||||
if (spirvInst1->set.empty())
|
||||
spirvInst1->set = spirvInst2->set;
|
||||
else
|
||||
error(loc, "too many SPIR-V instruction qualifiers", "spirv_instruction", "(set)");
|
||||
}
|
||||
|
||||
if (spirvInst2->id != -1) {
|
||||
if (spirvInst1->id == -1)
|
||||
spirvInst1->id = spirvInst2->id;
|
||||
else
|
||||
error(loc, "too many SPIR-V instruction qualifiers", "spirv_instruction", "(id)");
|
||||
}
|
||||
|
||||
return spirvInst1;
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // GLSLANG_WEB
|
|
@ -77,6 +77,7 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
case EbtAtomicUint: mangledName += "au"; break;
|
||||
case EbtAccStruct: mangledName += "as"; break;
|
||||
case EbtRayQuery: mangledName += "rq"; break;
|
||||
case EbtSpirvType: mangledName += "spv-t"; break;
|
||||
#endif
|
||||
case EbtSampler:
|
||||
switch (sampler.type) {
|
||||
|
@ -85,6 +86,8 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
#endif
|
||||
case EbtInt: mangledName += "i"; break;
|
||||
case EbtUint: mangledName += "u"; break;
|
||||
case EbtInt64: mangledName += "i64"; break;
|
||||
case EbtUint64: mangledName += "u64"; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
if (sampler.isImageClass())
|
||||
|
@ -146,6 +149,8 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
if (typeName)
|
||||
mangledName += *typeName;
|
||||
for (unsigned int i = 0; i < structure->size(); ++i) {
|
||||
if ((*structure)[i].type->getBasicType() == EbtVoid)
|
||||
continue;
|
||||
mangledName += '-';
|
||||
(*structure)[i].type->buildMangledName(mangledName);
|
||||
}
|
||||
|
@ -166,7 +171,7 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
for (int i = 0; i < arraySizes->getNumDims(); ++i) {
|
||||
if (arraySizes->getDimNode(i)) {
|
||||
if (arraySizes->getDimNode(i)->getAsSymbolNode())
|
||||
snprintf(buf, maxSize, "s%d", arraySizes->getDimNode(i)->getAsSymbolNode()->getId());
|
||||
snprintf(buf, maxSize, "s%lld", arraySizes->getDimNode(i)->getAsSymbolNode()->getId());
|
||||
else
|
||||
snprintf(buf, maxSize, "s%p", arraySizes->getDimNode(i));
|
||||
} else
|
||||
|
@ -274,8 +279,14 @@ TFunction::~TFunction()
|
|||
//
|
||||
TSymbolTableLevel::~TSymbolTableLevel()
|
||||
{
|
||||
for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
|
||||
delete (*it).second;
|
||||
for (tLevel::iterator it = level.begin(); it != level.end(); ++it) {
|
||||
const TString& name = it->first;
|
||||
auto retargetIter = std::find_if(retargetedSymbols.begin(), retargetedSymbols.end(),
|
||||
[&name](const std::pair<TString, TString>& i) { return i.first == name; });
|
||||
if (retargetIter == retargetedSymbols.end())
|
||||
delete (*it).second;
|
||||
}
|
||||
|
||||
|
||||
delete [] defaultPrecision;
|
||||
}
|
||||
|
@ -372,7 +383,7 @@ TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf)
|
|||
for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {
|
||||
TParameter param;
|
||||
parameters.push_back(param);
|
||||
parameters.back().copyParam(copyOf.parameters[i]);
|
||||
(void)parameters.back().copyParam(copyOf.parameters[i]);
|
||||
}
|
||||
|
||||
extensions = nullptr;
|
||||
|
@ -386,6 +397,9 @@ TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf)
|
|||
implicitThis = copyOf.implicitThis;
|
||||
illegalImplicitThis = copyOf.illegalImplicitThis;
|
||||
defaultParamCount = copyOf.defaultParamCount;
|
||||
#ifndef GLSLANG_WEB
|
||||
spirvInst = copyOf.spirvInst;
|
||||
#endif
|
||||
}
|
||||
|
||||
TFunction* TFunction::clone() const
|
||||
|
@ -410,6 +424,10 @@ TSymbolTableLevel* TSymbolTableLevel::clone() const
|
|||
TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();
|
||||
symTableLevel->anonId = anonId;
|
||||
symTableLevel->thisLevel = thisLevel;
|
||||
symTableLevel->retargetedSymbols.clear();
|
||||
for (auto &s : retargetedSymbols) {
|
||||
symTableLevel->retargetedSymbols.push_back({s.first, s.second});
|
||||
}
|
||||
std::vector<bool> containerCopied(anonId, false);
|
||||
tLevel::const_iterator iter;
|
||||
for (iter = level.begin(); iter != level.end(); ++iter) {
|
||||
|
@ -425,8 +443,21 @@ TSymbolTableLevel* TSymbolTableLevel::clone() const
|
|||
symTableLevel->insert(*container, false);
|
||||
containerCopied[anon->getAnonId()] = true;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
const TString& name = iter->first;
|
||||
auto retargetIter = std::find_if(retargetedSymbols.begin(), retargetedSymbols.end(),
|
||||
[&name](const std::pair<TString, TString>& i) { return i.first == name; });
|
||||
if (retargetIter != retargetedSymbols.end())
|
||||
continue;
|
||||
symTableLevel->insert(*iter->second->clone(), false);
|
||||
}
|
||||
}
|
||||
// Now point retargeted symbols to the newly created versions of them
|
||||
for (auto &s : retargetedSymbols) {
|
||||
TSymbol* sym = symTableLevel->find(s.second);
|
||||
if (!sym)
|
||||
continue;
|
||||
symTableLevel->insert(s.first, sym);
|
||||
}
|
||||
|
||||
return symTableLevel;
|
||||
|
|
|
@ -84,7 +84,7 @@ typedef TVector<const char*> TExtensionList;
|
|||
class TSymbol {
|
||||
public:
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
explicit TSymbol(const TString *n) : name(n), extensions(0), writable(true) { }
|
||||
explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(0), writable(true) { }
|
||||
virtual TSymbol* clone() const = 0;
|
||||
virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool
|
||||
|
||||
|
@ -104,8 +104,8 @@ public:
|
|||
virtual const TAnonMember* getAsAnonMember() const { return 0; }
|
||||
virtual const TType& getType() const = 0;
|
||||
virtual TType& getWritableType() = 0;
|
||||
virtual void setUniqueId(int id) { uniqueId = id; }
|
||||
virtual int getUniqueId() const { return uniqueId; }
|
||||
virtual void setUniqueId(long long id) { uniqueId = id; }
|
||||
virtual long long getUniqueId() const { return uniqueId; }
|
||||
virtual void setExtensions(int numExts, const char* const exts[])
|
||||
{
|
||||
assert(extensions == 0);
|
||||
|
@ -130,7 +130,7 @@ protected:
|
|||
TSymbol& operator=(const TSymbol&);
|
||||
|
||||
const TString *name;
|
||||
unsigned int uniqueId; // For cross-scope comparing during code generation
|
||||
unsigned long long uniqueId; // For cross-scope comparing during code generation
|
||||
|
||||
// For tracking what extensions must be present
|
||||
// (don't use if correct version/profile is present).
|
||||
|
@ -224,7 +224,7 @@ struct TParameter {
|
|||
TString *name;
|
||||
TType* type;
|
||||
TIntermTyped* defaultValue;
|
||||
void copyParam(const TParameter& param)
|
||||
TParameter& copyParam(const TParameter& param)
|
||||
{
|
||||
if (param.name)
|
||||
name = NewPoolTString(param.name->c_str());
|
||||
|
@ -232,6 +232,7 @@ struct TParameter {
|
|||
name = 0;
|
||||
type = param.type->clone();
|
||||
defaultValue = param.defaultValue;
|
||||
return *this;
|
||||
}
|
||||
TBuiltInVariable getDeclaredBuiltIn() const { return type->getQualifier().declaredBuiltIn; }
|
||||
};
|
||||
|
@ -319,6 +320,15 @@ public:
|
|||
virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; }
|
||||
virtual const TParameter& operator[](int i) const { return parameters[i]; }
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
virtual void setSpirvInstruction(const TSpirvInstruction& inst)
|
||||
{
|
||||
relateToOperator(EOpSpirvInst);
|
||||
spirvInst = inst;
|
||||
}
|
||||
virtual const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; }
|
||||
#endif
|
||||
|
||||
#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE)
|
||||
virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
|
||||
#endif
|
||||
|
@ -342,6 +352,10 @@ protected:
|
|||
// This is important for a static member function that has member variables in scope,
|
||||
// but is not allowed to use them, or see hidden symbols instead.
|
||||
int defaultParamCount;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
TSpirvInstruction spirvInst; // SPIR-V instruction qualifiers
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -400,13 +414,20 @@ public:
|
|||
TSymbolTableLevel() : defaultPrecision(0), anonId(0), thisLevel(false) { }
|
||||
~TSymbolTableLevel();
|
||||
|
||||
bool insert(TSymbol& symbol, bool separateNameSpaces)
|
||||
bool insert(const TString& name, TSymbol* symbol) {
|
||||
return level.insert(tLevelPair(name, symbol)).second;
|
||||
}
|
||||
|
||||
bool insert(TSymbol& symbol, bool separateNameSpaces, const TString& forcedKeyName = TString())
|
||||
{
|
||||
//
|
||||
// returning true means symbol was added to the table with no semantic errors
|
||||
//
|
||||
const TString& name = symbol.getName();
|
||||
if (name == "") {
|
||||
if (forcedKeyName.length()) {
|
||||
return level.insert(tLevelPair(forcedKeyName, &symbol)).second;
|
||||
}
|
||||
else if (name == "") {
|
||||
symbol.getAsVariable()->setAnonId(anonId++);
|
||||
// An empty name means an anonymous container, exposing its members to the external scope.
|
||||
// Give it a name and insert its members in the symbol table, pointing to the container.
|
||||
|
@ -458,6 +479,16 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void retargetSymbol(const TString& from, const TString& to) {
|
||||
tLevel::const_iterator fromIt = level.find(from);
|
||||
tLevel::const_iterator toIt = level.find(to);
|
||||
if (fromIt == level.end() || toIt == level.end())
|
||||
return;
|
||||
delete fromIt->second;
|
||||
level[from] = toIt->second;
|
||||
retargetedSymbols.push_back({from, to});
|
||||
}
|
||||
|
||||
TSymbol* find(const TString& name) const
|
||||
{
|
||||
tLevel::const_iterator it = level.find(name);
|
||||
|
@ -570,6 +601,8 @@ protected:
|
|||
|
||||
tLevel level; // named mappings
|
||||
TPrecisionQualifier *defaultPrecision;
|
||||
// pair<FromName, ToName>
|
||||
TVector<std::pair<TString, TString>> retargetedSymbols;
|
||||
int anonId;
|
||||
bool thisLevel; // True if this level of the symbol table is a structure scope containing member function
|
||||
// that are supposed to see anonymous access to member variables.
|
||||
|
@ -612,21 +645,28 @@ public:
|
|||
// 3: user-shader globals
|
||||
//
|
||||
protected:
|
||||
static const uint32_t LevelFlagBitOffset = 56;
|
||||
static const int globalLevel = 3;
|
||||
bool isSharedLevel(int level) { return level <= 1; } // exclude all per-compile levels
|
||||
bool isBuiltInLevel(int level) { return level <= 2; } // exclude user globals
|
||||
bool isGlobalLevel(int level) { return level <= globalLevel; } // include user globals
|
||||
static bool isSharedLevel(int level) { return level <= 1; } // exclude all per-compile levels
|
||||
static bool isBuiltInLevel(int level) { return level <= 2; } // exclude user globals
|
||||
static bool isGlobalLevel(int level) { return level <= globalLevel; } // include user globals
|
||||
public:
|
||||
bool isEmpty() { return table.size() == 0; }
|
||||
bool atBuiltInLevel() { return isBuiltInLevel(currentLevel()); }
|
||||
bool atGlobalLevel() { return isGlobalLevel(currentLevel()); }
|
||||
|
||||
static bool isBuiltInSymbol(long long uniqueId) {
|
||||
int level = static_cast<int>(uniqueId >> LevelFlagBitOffset);
|
||||
return isBuiltInLevel(level);
|
||||
}
|
||||
static constexpr uint64_t uniqueIdMask = (1LL << LevelFlagBitOffset) - 1;
|
||||
static const uint32_t MaxLevelInUniqueID = 127;
|
||||
void setNoBuiltInRedeclarations() { noBuiltInRedeclarations = true; }
|
||||
void setSeparateNameSpaces() { separateNameSpaces = true; }
|
||||
|
||||
void push()
|
||||
{
|
||||
table.push_back(new TSymbolTableLevel);
|
||||
updateUniqueIdLevelFlag();
|
||||
}
|
||||
|
||||
// Make a new symbol-table level to represent the scope introduced by a structure
|
||||
|
@ -639,6 +679,7 @@ public:
|
|||
{
|
||||
assert(thisSymbol.getName().size() == 0);
|
||||
table.push_back(new TSymbolTableLevel);
|
||||
updateUniqueIdLevelFlag();
|
||||
table.back()->setThisLevel();
|
||||
insert(thisSymbol);
|
||||
}
|
||||
|
@ -648,6 +689,7 @@ public:
|
|||
table[currentLevel()]->getPreviousDefaultPrecisions(p);
|
||||
delete table.back();
|
||||
table.pop_back();
|
||||
updateUniqueIdLevelFlag();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -685,6 +727,16 @@ public:
|
|||
return table[currentLevel()]->amend(symbol, firstNewMember);
|
||||
}
|
||||
|
||||
// Update the level info in symbol's unique ID to current level
|
||||
void amendSymbolIdLevel(TSymbol& symbol)
|
||||
{
|
||||
// clamp level to avoid overflow
|
||||
uint64_t level = (uint32_t)currentLevel() > MaxLevelInUniqueID ? MaxLevelInUniqueID : currentLevel();
|
||||
uint64_t symbolId = symbol.getUniqueId();
|
||||
symbolId &= uniqueIdMask;
|
||||
symbolId |= (level << LevelFlagBitOffset);
|
||||
symbol.setUniqueId(symbolId);
|
||||
}
|
||||
//
|
||||
// To allocate an internal temporary, which will need to be uniquely
|
||||
// identified by the consumer of the AST, but never need to
|
||||
|
@ -756,6 +808,12 @@ public:
|
|||
return symbol;
|
||||
}
|
||||
|
||||
void retargetSymbol(const TString& from, const TString& to) {
|
||||
int level = currentLevel();
|
||||
table[level]->retargetSymbol(from, to);
|
||||
}
|
||||
|
||||
|
||||
// Find of a symbol that returns how many layers deep of nested
|
||||
// structures-with-member-functions ('this' scopes) deep the symbol was
|
||||
// found in.
|
||||
|
@ -853,7 +911,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
int getMaxSymbolId() { return uniqueId; }
|
||||
long long getMaxSymbolId() { return uniqueId; }
|
||||
#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE)
|
||||
void dump(TInfoSink& infoSink, bool complete = false) const;
|
||||
#endif
|
||||
|
@ -867,14 +925,27 @@ public:
|
|||
table[level]->readOnly();
|
||||
}
|
||||
|
||||
// Add current level in the high-bits of unique id
|
||||
void updateUniqueIdLevelFlag() {
|
||||
// clamp level to avoid overflow
|
||||
uint64_t level = (uint32_t)currentLevel() > MaxLevelInUniqueID ? MaxLevelInUniqueID : currentLevel();
|
||||
uniqueId &= uniqueIdMask;
|
||||
uniqueId |= (level << LevelFlagBitOffset);
|
||||
}
|
||||
|
||||
void overwriteUniqueId(long long id)
|
||||
{
|
||||
uniqueId = id;
|
||||
updateUniqueIdLevelFlag();
|
||||
}
|
||||
|
||||
protected:
|
||||
TSymbolTable(TSymbolTable&);
|
||||
TSymbolTable& operator=(TSymbolTableLevel&);
|
||||
|
||||
int currentLevel() const { return static_cast<int>(table.size()) - 1; }
|
||||
|
||||
std::vector<TSymbolTableLevel*> table;
|
||||
int uniqueId; // for unique identification in code generation
|
||||
long long uniqueId; // for unique identification in code generation
|
||||
bool noBuiltInRedeclarations;
|
||||
bool separateNameSpaces;
|
||||
unsigned int adoptedLevels;
|
||||
|
|
|
@ -165,12 +165,15 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
EShTargetLanguageVersion minSpvVersion;
|
||||
} extensionData;
|
||||
|
||||
const extensionData exts[] = { {E_GL_EXT_ray_tracing, EShTargetSpv_1_4} };
|
||||
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}
|
||||
};
|
||||
|
||||
for (size_t ii = 0; ii < sizeof(exts) / sizeof(exts[0]); ii++) {
|
||||
// Add only extensions which require > spv1.0 to save space in map
|
||||
if (exts[ii].minSpvVersion > EShTargetSpv_1_0) {
|
||||
extensionMinSpv[E_GL_EXT_ray_tracing] = exts[ii].minSpvVersion;
|
||||
extensionMinSpv[exts[ii].extensionName] = exts[ii].minSpvVersion;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,6 +201,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_ARB_explicit_uniform_location] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_shader_image_load_store] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_shader_atomic_counters] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_shader_atomic_counter_ops] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_shader_draw_parameters] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_shader_group_vote] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_derivative_control] = EBhDisable;
|
||||
|
@ -222,6 +226,9 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_ARB_shading_language_packing] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_texture_query_lod] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_vertex_attrib_64bit] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_draw_instanced] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_fragment_coord_conventions] = EBhDisable;
|
||||
|
||||
|
||||
extensionBehavior[E_GL_KHR_shader_subgroup_basic] = EBhDisable;
|
||||
extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable;
|
||||
|
@ -251,6 +258,9 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
|
||||
extensionBehavior[E_GL_EXT_shader_16bit_storage] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_8bit_storage] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_subgroup_uniform_control_flow] = EBhDisable;
|
||||
|
||||
extensionBehavior[E_GL_EXT_fragment_shader_barycentric] = EBhDisable;
|
||||
|
||||
// #line and #include
|
||||
extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable;
|
||||
|
@ -266,6 +276,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_AMD_shader_image_load_store_lod] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_gpu_shader_half_float_fetch] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_shader_early_and_late_fragment_tests] = EBhDisable;
|
||||
|
||||
extensionBehavior[E_GL_INTEL_shader_integer_functions2] = EBhDisable;
|
||||
|
||||
|
@ -280,6 +291,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_NV_shader_subgroup_partitioned] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_shading_rate_image] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_ray_tracing] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_ray_tracing_motion_blur] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_fragment_shader_barycentric] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable;
|
||||
|
@ -305,6 +317,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_tessellation_point_size] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_texture_buffer] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_texture_cube_map_array] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_null_initializer] = EBhDisable;
|
||||
|
||||
// OES matching AEP
|
||||
extensionBehavior[E_GL_OES_geometry_shader] = EBhDisable;
|
||||
|
@ -325,8 +338,16 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_ray_tracing] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_ray_query] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_ray_flags_primitive_culling] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_ray_cull_mask] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_blend_func_extended] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_implicit_conversions] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_fragment_shading_rate] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_image_int64] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_terminate_invocation] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shared_memory_block] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_spirv_intrinsics] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_mesh_shader] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_opacity_micromap] = EBhDisable;
|
||||
|
||||
// OVR extensions
|
||||
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;
|
||||
|
@ -348,6 +369,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_int64] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_float16] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_atomic_float] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_atomic_float2] = EBhDisable;
|
||||
}
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
@ -371,6 +393,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_EXT_YUV_target 1\n"
|
||||
"#define GL_EXT_shader_texture_lod 1\n"
|
||||
"#define GL_EXT_shadow_samplers 1\n"
|
||||
"#define GL_EXT_fragment_shading_rate 1\n"
|
||||
|
||||
// AEP
|
||||
"#define GL_ANDROID_extension_pack_es31a 1\n"
|
||||
|
@ -404,11 +427,15 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
|
||||
;
|
||||
|
||||
if (isEsProfile() && version >= 300) {
|
||||
if (version >= 300) {
|
||||
preamble += "#define GL_NV_shader_noperspective_interpolation 1\n";
|
||||
}
|
||||
if (version >= 310) {
|
||||
preamble += "#define GL_EXT_null_initializer 1\n";
|
||||
preamble += "#define GL_EXT_subgroup_uniform_control_flow 1\n";
|
||||
}
|
||||
|
||||
} else {
|
||||
} else { // !isEsProfile()
|
||||
preamble =
|
||||
"#define GL_FRAGMENT_PRECISION_HIGH 1\n"
|
||||
"#define GL_ARB_texture_rectangle 1\n"
|
||||
|
@ -448,6 +475,8 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_ARB_shader_storage_buffer_object 1\n"
|
||||
"#define GL_ARB_texture_query_lod 1\n"
|
||||
"#define GL_ARB_vertex_attrib_64bit 1\n"
|
||||
"#define GL_ARB_draw_instanced 1\n"
|
||||
"#define GL_ARB_fragment_coord_conventions 1\n"
|
||||
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
|
||||
"#define GL_EXT_shader_image_load_formatted 1\n"
|
||||
"#define GL_EXT_post_depth_coverage 1\n"
|
||||
|
@ -463,6 +492,9 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_EXT_buffer_reference_uvec2 1\n"
|
||||
"#define GL_EXT_demote_to_helper_invocation 1\n"
|
||||
"#define GL_EXT_debug_printf 1\n"
|
||||
"#define GL_EXT_fragment_shading_rate 1\n"
|
||||
"#define GL_EXT_shared_memory_block 1\n"
|
||||
"#define GL_EXT_shader_integer_mix 1\n"
|
||||
|
||||
// GL_KHR_shader_subgroup
|
||||
"#define GL_KHR_shader_subgroup_basic 1\n"
|
||||
|
@ -474,11 +506,15 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_KHR_shader_subgroup_clustered 1\n"
|
||||
"#define GL_KHR_shader_subgroup_quad 1\n"
|
||||
|
||||
"#define GL_EXT_shader_image_int64 1\n"
|
||||
"#define GL_EXT_shader_atomic_int64 1\n"
|
||||
"#define GL_EXT_shader_realtime_clock 1\n"
|
||||
"#define GL_EXT_ray_tracing 1\n"
|
||||
"#define GL_EXT_ray_query 1\n"
|
||||
"#define GL_EXT_ray_flags_primitive_culling 1\n"
|
||||
"#define GL_EXT_ray_cull_mask 1\n"
|
||||
"#define GL_EXT_spirv_intrinsics 1\n"
|
||||
"#define GL_EXT_mesh_shader 1\n"
|
||||
|
||||
"#define GL_AMD_shader_ballot 1\n"
|
||||
"#define GL_AMD_shader_trinary_minmax 1\n"
|
||||
|
@ -501,6 +537,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_NV_shader_subgroup_partitioned 1\n"
|
||||
"#define GL_NV_shading_rate_image 1\n"
|
||||
"#define GL_NV_ray_tracing 1\n"
|
||||
"#define GL_NV_ray_tracing_motion_blur 1\n"
|
||||
"#define GL_NV_fragment_shader_barycentric 1\n"
|
||||
"#define GL_NV_compute_shader_derivatives 1\n"
|
||||
"#define GL_NV_shader_texture_footprint 1\n"
|
||||
|
@ -523,6 +560,9 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_EXT_shader_subgroup_extended_types_float16 1\n"
|
||||
|
||||
"#define GL_EXT_shader_atomic_float 1\n"
|
||||
"#define GL_EXT_shader_atomic_float2 1\n"
|
||||
|
||||
"#define GL_EXT_fragment_shader_barycentric 1\n"
|
||||
;
|
||||
|
||||
if (version >= 150) {
|
||||
|
@ -532,6 +572,10 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
if (profile == ECompatibilityProfile)
|
||||
preamble += "#define GL_compatibility_profile 1\n";
|
||||
}
|
||||
if (version >= 140) {
|
||||
preamble += "#define GL_EXT_null_initializer 1\n";
|
||||
preamble += "#define GL_EXT_subgroup_uniform_control_flow 1\n";
|
||||
}
|
||||
#endif // GLSLANG_WEB
|
||||
}
|
||||
|
||||
|
@ -558,6 +602,11 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_GOOGLE_include_directive 1\n"
|
||||
"#define GL_KHR_blend_equation_advanced 1\n"
|
||||
;
|
||||
|
||||
// other general extensions
|
||||
preamble +=
|
||||
"#define GL_EXT_terminate_invocation 1\n"
|
||||
;
|
||||
#endif
|
||||
|
||||
// #define VULKAN XXXX
|
||||
|
@ -579,6 +628,29 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
preamble += "\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// GL_EXT_spirv_intrinsics
|
||||
if (!isEsProfile()) {
|
||||
switch (language) {
|
||||
case EShLangVertex: preamble += "#define GL_VERTEX_SHADER 1 \n"; break;
|
||||
case EShLangTessControl: preamble += "#define GL_TESSELLATION_CONTROL_SHADER 1 \n"; break;
|
||||
case EShLangTessEvaluation: preamble += "#define GL_TESSELLATION_EVALUATION_SHADER 1 \n"; break;
|
||||
case EShLangGeometry: preamble += "#define GL_GEOMETRY_SHADER 1 \n"; break;
|
||||
case EShLangFragment: preamble += "#define GL_FRAGMENT_SHADER 1 \n"; break;
|
||||
case EShLangCompute: preamble += "#define GL_COMPUTE_SHADER 1 \n"; break;
|
||||
case EShLangRayGen: preamble += "#define GL_RAY_GENERATION_SHADER_EXT 1 \n"; break;
|
||||
case EShLangIntersect: preamble += "#define GL_INTERSECTION_SHADER_EXT 1 \n"; break;
|
||||
case EShLangAnyHit: preamble += "#define GL_ANY_HIT_SHADER_EXT 1 \n"; break;
|
||||
case EShLangClosestHit: preamble += "#define GL_CLOSEST_HIT_SHADER_EXT 1 \n"; break;
|
||||
case EShLangMiss: preamble += "#define GL_MISS_SHADER_EXT 1 \n"; break;
|
||||
case EShLangCallable: preamble += "#define GL_CALLABLE_SHADER_EXT 1 \n"; break;
|
||||
case EShLangTask: preamble += "#define GL_TASK_SHADER_NV 1 \n"; break;
|
||||
case EShLangMesh: preamble += "#define GL_MESH_SHADER_NV 1 \n"; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -600,8 +672,8 @@ const char* StageName(EShLanguage stage)
|
|||
case EShLangClosestHit: return "closest-hit";
|
||||
case EShLangMiss: return "miss";
|
||||
case EShLangCallable: return "callable";
|
||||
case EShLangMeshNV: return "mesh";
|
||||
case EShLangTaskNV: return "task";
|
||||
case EShLangMesh: return "mesh";
|
||||
case EShLangTask: return "task";
|
||||
#endif
|
||||
default: return "unknown stage";
|
||||
}
|
||||
|
@ -855,7 +927,7 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
|
|||
checkExtensionStage(getCurrentLoc(), extension);
|
||||
|
||||
// check if extension has additional requirements
|
||||
extensionRequires(getCurrentLoc(), extension ,behaviorString);
|
||||
extensionRequires(getCurrentLoc(), extension, behaviorString);
|
||||
|
||||
// update the requested extension
|
||||
updateExtensionBehavior(extension, behavior);
|
||||
|
@ -992,10 +1064,22 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con
|
|||
{
|
||||
// GL_NV_mesh_shader extension is only allowed in task/mesh shaders
|
||||
if (strcmp(extension, "GL_NV_mesh_shader") == 0) {
|
||||
requireStage(loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask | EShLangFragmentMask),
|
||||
requireStage(loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask | EShLangFragmentMask),
|
||||
"#extension GL_NV_mesh_shader");
|
||||
profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader");
|
||||
profileRequires(loc, EEsProfile, 320, 0, "#extension GL_NV_mesh_shader");
|
||||
if (extensionTurnedOn(E_GL_EXT_mesh_shader)) {
|
||||
error(loc, "GL_EXT_mesh_shader is already turned on, and not allowed with", "#extension", extension);
|
||||
}
|
||||
}
|
||||
else if (strcmp(extension, "GL_EXT_mesh_shader") == 0) {
|
||||
requireStage(loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask | EShLangFragmentMask),
|
||||
"#extension GL_EXT_mesh_shader");
|
||||
profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_EXT_mesh_shader");
|
||||
profileRequires(loc, EEsProfile, 320, 0, "#extension GL_EXT_mesh_shader");
|
||||
if (extensionTurnedOn(E_GL_NV_mesh_shader)) {
|
||||
error(loc, "GL_NV_mesh_shader is already turned on, and not allowed with", "#extension", extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1253,7 +1337,7 @@ void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
|
|||
// Call for any operation removed because Vulkan SPIR-V is being generated.
|
||||
void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op)
|
||||
{
|
||||
if (spvVersion.vulkan > 0)
|
||||
if (spvVersion.vulkan > 0 && !spvVersion.vulkanRelaxed)
|
||||
error(loc, "not allowed when using GLSL for Vulkan", op, "");
|
||||
}
|
||||
|
||||
|
|
|
@ -87,11 +87,12 @@ inline const char* ProfileName(EProfile profile)
|
|||
// The union of all requested rule sets will be applied.
|
||||
//
|
||||
struct SpvVersion {
|
||||
SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0) {}
|
||||
SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0), vulkanRelaxed(false) {}
|
||||
unsigned int spv; // the version of SPIR-V to target, as defined by "word 1" of the SPIR-V binary header
|
||||
int vulkanGlsl; // the version of GLSL semantics for Vulkan, from GL_KHR_vulkan_glsl, for "#define VULKAN XXX"
|
||||
int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use
|
||||
int openGl; // the version of GLSL semantics for OpenGL, from GL_ARB_gl_spirv, for "#define GL_SPIRV XXX"
|
||||
bool vulkanRelaxed; // relax changes to GLSL for Vulkan, allowing some GL-specific to be compiled to Vulkan SPIR-V target
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -135,6 +136,7 @@ const char* const E_GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attri
|
|||
const char* const E_GL_ARB_explicit_uniform_location = "GL_ARB_explicit_uniform_location";
|
||||
const char* const E_GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store";
|
||||
const char* const E_GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters";
|
||||
const char* const E_GL_ARB_shader_atomic_counter_ops = "GL_ARB_shader_atomic_counter_ops";
|
||||
const char* const E_GL_ARB_shader_draw_parameters = "GL_ARB_shader_draw_parameters";
|
||||
const char* const E_GL_ARB_shader_group_vote = "GL_ARB_shader_group_vote";
|
||||
const char* const E_GL_ARB_derivative_control = "GL_ARB_derivative_control";
|
||||
|
@ -159,6 +161,8 @@ const char* const E_GL_ARB_shader_storage_buffer_object = "GL_ARB_shader_storage
|
|||
const char* const E_GL_ARB_shading_language_packing = "GL_ARB_shading_language_packing";
|
||||
const char* const E_GL_ARB_texture_query_lod = "GL_ARB_texture_query_lod";
|
||||
const char* const E_GL_ARB_vertex_attrib_64bit = "GL_ARB_vertex_attrib_64bit";
|
||||
const char* const E_GL_ARB_draw_instanced = "GL_ARB_draw_instanced";
|
||||
const char* const E_GL_ARB_fragment_coord_conventions = "GL_ARB_fragment_coord_conventions";
|
||||
|
||||
const char* const E_GL_KHR_shader_subgroup_basic = "GL_KHR_shader_subgroup_basic";
|
||||
const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote";
|
||||
|
@ -197,14 +201,28 @@ const char* const E_GL_EXT_debug_printf = "GL_EXT_debug_prin
|
|||
const char* const E_GL_EXT_ray_tracing = "GL_EXT_ray_tracing";
|
||||
const char* const E_GL_EXT_ray_query = "GL_EXT_ray_query";
|
||||
const char* const E_GL_EXT_ray_flags_primitive_culling = "GL_EXT_ray_flags_primitive_culling";
|
||||
const char* const E_GL_EXT_ray_cull_mask = "GL_EXT_ray_cull_mask";
|
||||
const char* const E_GL_EXT_blend_func_extended = "GL_EXT_blend_func_extended";
|
||||
const char* const E_GL_EXT_shader_implicit_conversions = "GL_EXT_shader_implicit_conversions";
|
||||
const char* const E_GL_EXT_fragment_shading_rate = "GL_EXT_fragment_shading_rate";
|
||||
const char* const E_GL_EXT_shader_image_int64 = "GL_EXT_shader_image_int64";
|
||||
const char* const E_GL_EXT_null_initializer = "GL_EXT_null_initializer";
|
||||
const char* const E_GL_EXT_shared_memory_block = "GL_EXT_shared_memory_block";
|
||||
const char* const E_GL_EXT_subgroup_uniform_control_flow = "GL_EXT_subgroup_uniform_control_flow";
|
||||
const char* const E_GL_EXT_spirv_intrinsics = "GL_EXT_spirv_intrinsics";
|
||||
const char* const E_GL_EXT_fragment_shader_barycentric = "GL_EXT_fragment_shader_barycentric";
|
||||
const char* const E_GL_EXT_mesh_shader = "GL_EXT_mesh_shader";
|
||||
const char* const E_GL_EXT_opacity_micromap = "GL_EXT_opacity_micromap";
|
||||
|
||||
// Arrays of extensions for the above viewportEXTs duplications
|
||||
|
||||
const char* const post_depth_coverageEXTs[] = { E_GL_ARB_post_depth_coverage, E_GL_EXT_post_depth_coverage };
|
||||
const int Num_post_depth_coverageEXTs = sizeof(post_depth_coverageEXTs) / sizeof(post_depth_coverageEXTs[0]);
|
||||
|
||||
// Array of extensions to cover both extensions providing ray tracing capabilities.
|
||||
const char* const ray_tracing_EXTs[] = { E_GL_EXT_ray_query, E_GL_EXT_ray_tracing };
|
||||
const int Num_ray_tracing_EXTs = sizeof(ray_tracing_EXTs) / sizeof(ray_tracing_EXTs[0]);
|
||||
|
||||
// OVR extensions
|
||||
const char* const E_GL_OVR_multiview = "GL_OVR_multiview";
|
||||
const char* const E_GL_OVR_multiview2 = "GL_OVR_multiview2";
|
||||
|
@ -226,6 +244,7 @@ const char* const E_GL_AMD_gpu_shader_int16 = "GL_AMD_gpu_sh
|
|||
const char* const E_GL_AMD_shader_image_load_store_lod = "GL_AMD_shader_image_load_store_lod";
|
||||
const char* const E_GL_AMD_shader_fragment_mask = "GL_AMD_shader_fragment_mask";
|
||||
const char* const E_GL_AMD_gpu_shader_half_float_fetch = "GL_AMD_gpu_shader_half_float_fetch";
|
||||
const char* const E_GL_AMD_shader_early_and_late_fragment_tests = "GL_AMD_shader_early_and_late_fragment_tests";
|
||||
|
||||
const char* const E_GL_INTEL_shader_integer_functions2 = "GL_INTEL_shader_integer_functions2";
|
||||
|
||||
|
@ -240,6 +259,7 @@ const char* const E_GL_NV_shader_noperspective_interpolation = "GL_NV_shader_
|
|||
const char* const E_GL_NV_shader_subgroup_partitioned = "GL_NV_shader_subgroup_partitioned";
|
||||
const char* const E_GL_NV_shading_rate_image = "GL_NV_shading_rate_image";
|
||||
const char* const E_GL_NV_ray_tracing = "GL_NV_ray_tracing";
|
||||
const char* const E_GL_NV_ray_tracing_motion_blur = "GL_NV_ray_tracing_motion_blur";
|
||||
const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragment_shader_barycentric";
|
||||
const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives";
|
||||
const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint";
|
||||
|
@ -297,8 +317,10 @@ const char* const E_GL_EXT_shader_subgroup_extended_types_int8 = "GL_EXT_shad
|
|||
const char* const E_GL_EXT_shader_subgroup_extended_types_int16 = "GL_EXT_shader_subgroup_extended_types_int16";
|
||||
const char* const E_GL_EXT_shader_subgroup_extended_types_int64 = "GL_EXT_shader_subgroup_extended_types_int64";
|
||||
const char* const E_GL_EXT_shader_subgroup_extended_types_float16 = "GL_EXT_shader_subgroup_extended_types_float16";
|
||||
const char* const E_GL_EXT_terminate_invocation = "GL_EXT_terminate_invocation";
|
||||
|
||||
const char* const E_GL_EXT_shader_atomic_float = "GL_EXT_shader_atomic_float";
|
||||
const char* const E_GL_EXT_shader_atomic_float2 = "GL_EXT_shader_atomic_float2";
|
||||
|
||||
// Arrays of extensions for the above AEP duplications
|
||||
|
||||
|
@ -329,6 +351,9 @@ const int Num_AEP_texture_buffer = sizeof(AEP_texture_buffer)/sizeof(AEP_texture
|
|||
const char* const AEP_texture_cube_map_array[] = { E_GL_EXT_texture_cube_map_array, E_GL_OES_texture_cube_map_array };
|
||||
const int Num_AEP_texture_cube_map_array = sizeof(AEP_texture_cube_map_array)/sizeof(AEP_texture_cube_map_array[0]);
|
||||
|
||||
const char* const AEP_mesh_shader[] = { E_GL_NV_mesh_shader, E_GL_EXT_mesh_shader };
|
||||
const int Num_AEP_mesh_shader = sizeof(AEP_mesh_shader)/sizeof(AEP_mesh_shader[0]);
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _VERSIONS_INCLUDED_
|
||||
|
|
|
@ -123,6 +123,8 @@ TAttributeType TParseContext::attributeFromName(const TString& name) const
|
|||
return EatPeelCount;
|
||||
else if (name == "partial_count")
|
||||
return EatPartialCount;
|
||||
else if (name == "subgroup_uniform_control_flow")
|
||||
return EatSubgroupUniformControlFlow;
|
||||
else
|
||||
return EatNone;
|
||||
}
|
||||
|
@ -341,6 +343,29 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Function attributes
|
||||
//
|
||||
void TParseContext::handleFunctionAttributes(const TSourceLoc& loc, const TAttributes& attributes)
|
||||
{
|
||||
for (auto it = attributes.begin(); it != attributes.end(); ++it) {
|
||||
if (it->size() > 0) {
|
||||
warn(loc, "attribute with arguments not recognized, skipping", "", "");
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (it->name) {
|
||||
case EatSubgroupUniformControlFlow:
|
||||
intermediate.setSubgroupUniformControlFlow();
|
||||
break;
|
||||
default:
|
||||
warn(loc, "attribute does not apply to a function", "", "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
|
|
@ -118,7 +118,8 @@ namespace glslang {
|
|||
EatFormatR8ui,
|
||||
EatFormatUnknown,
|
||||
EatNonWritable,
|
||||
EatNonReadable
|
||||
EatNonReadable,
|
||||
EatSubgroupUniformControlFlow,
|
||||
};
|
||||
|
||||
class TIntermAggregate;
|
||||
|
|
|
@ -49,9 +49,9 @@
|
|||
#define GL_INT64_VEC4_ARB 0x8FEB
|
||||
|
||||
#define GL_UNSIGNED_INT64_ARB 0x140F
|
||||
#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FE5
|
||||
#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FE6
|
||||
#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FE7
|
||||
#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5
|
||||
#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6
|
||||
#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7
|
||||
#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
|
||||
#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
|
||||
#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
|
||||
|
|
|
@ -116,6 +116,9 @@ using namespace glslang;
|
|||
glslang::TIntermNodePair nodePair;
|
||||
glslang::TIntermTyped* intermTypedNode;
|
||||
glslang::TAttributes* attributes;
|
||||
glslang::TSpirvRequirement* spirvReq;
|
||||
glslang::TSpirvInstruction* spirvInst;
|
||||
glslang::TSpirvTypeParameters* spirvTypeParams;
|
||||
};
|
||||
union {
|
||||
glslang::TPublicType type;
|
||||
|
@ -148,7 +151,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
|
||||
%parse-param {glslang::TParseContext* pParseContext}
|
||||
%lex-param {parseContext}
|
||||
%pure-parser // enable thread safety
|
||||
%define api.pure // enable thread safety
|
||||
%expect 1 // One shift reduce conflict because of if | else
|
||||
|
||||
%token <lex> CONST BOOL INT UINT FLOAT
|
||||
|
@ -242,6 +245,18 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
|
||||
%token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
|
||||
|
||||
%token <lex> I64IMAGE1D U64IMAGE1D
|
||||
%token <lex> I64IMAGE2D U64IMAGE2D
|
||||
%token <lex> I64IMAGE3D U64IMAGE3D
|
||||
%token <lex> I64IMAGE2DRECT U64IMAGE2DRECT
|
||||
%token <lex> I64IMAGECUBE U64IMAGECUBE
|
||||
%token <lex> I64IMAGEBUFFER U64IMAGEBUFFER
|
||||
%token <lex> I64IMAGE1DARRAY U64IMAGE1DARRAY
|
||||
%token <lex> I64IMAGE2DARRAY U64IMAGE2DARRAY
|
||||
%token <lex> I64IMAGECUBEARRAY U64IMAGECUBEARRAY
|
||||
%token <lex> I64IMAGE2DMS U64IMAGE2DMS
|
||||
%token <lex> I64IMAGE2DMSARRAY U64IMAGE2DMSARRAY
|
||||
|
||||
// texture without sampler
|
||||
%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
|
||||
%token <lex> TEXTURE1D ITEXTURE1D UTEXTURE1D
|
||||
|
@ -259,6 +274,11 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS
|
||||
%token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS
|
||||
|
||||
// spirv intrinsics
|
||||
%token <lex> SPIRV_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID
|
||||
%token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING
|
||||
%token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL
|
||||
|
||||
|
||||
|
||||
%token <lex> LEFT_OP RIGHT_OP
|
||||
|
@ -281,6 +301,8 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> CENTROID IN OUT INOUT
|
||||
%token <lex> STRUCT VOID WHILE
|
||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
|
||||
%token <lex> TERMINATE_INVOCATION
|
||||
%token <lex> TERMINATE_RAY IGNORE_INTERSECTION
|
||||
%token <lex> UNIFORM SHARED BUFFER
|
||||
%token <lex> FLAT SMOOTH LAYOUT
|
||||
|
||||
|
@ -293,7 +315,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> PATCH SAMPLE NONUNIFORM
|
||||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
|
||||
%token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT
|
||||
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
|
||||
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT
|
||||
%token <lex> PRECISE
|
||||
|
||||
|
||||
|
@ -348,6 +370,19 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%type <interm.attributes> attribute attribute_list single_attribute
|
||||
%type <interm.intermNode> demote_statement
|
||||
%type <interm.intermTypedNode> initializer_list
|
||||
%type <interm.spirvReq> spirv_requirements_list spirv_requirements_parameter
|
||||
%type <interm.intermNode> spirv_extension_list spirv_capability_list
|
||||
%type <interm.intermNode> spirv_execution_mode_qualifier
|
||||
%type <interm.intermNode> spirv_execution_mode_parameter_list spirv_execution_mode_parameter spirv_execution_mode_id_parameter_list
|
||||
%type <interm.type> spirv_storage_class_qualifier
|
||||
%type <interm.type> spirv_decorate_qualifier
|
||||
%type <interm.intermNode> spirv_decorate_parameter_list spirv_decorate_parameter
|
||||
%type <interm.intermNode> spirv_decorate_id_parameter_list
|
||||
%type <interm.intermNode> spirv_decorate_string_parameter_list
|
||||
%type <interm.type> spirv_type_specifier
|
||||
%type <interm.spirvTypeParams> spirv_type_parameter_list spirv_type_parameter
|
||||
%type <interm.spirvInst> spirv_instruction_qualifier
|
||||
%type <interm.spirvInst> spirv_instruction_qualifier_list spirv_instruction_qualifier_id
|
||||
|
||||
|
||||
%start translation_unit
|
||||
|
@ -763,7 +798,7 @@ conditional_expression
|
|||
parseContext.rValueErrorCheck($5.loc, ":", $6);
|
||||
$$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc);
|
||||
if ($$ == 0) {
|
||||
parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(), $6->getCompleteString());
|
||||
parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $6->getCompleteString(parseContext.intermediate.getEnhancedMsgs()));
|
||||
$$ = $6;
|
||||
}
|
||||
}
|
||||
|
@ -780,7 +815,7 @@ assignment_expression
|
|||
parseContext.rValueErrorCheck($2.loc, "assign", $3);
|
||||
$$ = parseContext.addAssign($2.loc, $2.op, $1, $3);
|
||||
if ($$ == 0) {
|
||||
parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
|
||||
parseContext.assignError($2.loc, "assign", $1->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $3->getCompleteString(parseContext.intermediate.getEnhancedMsgs()));
|
||||
$$ = $1;
|
||||
}
|
||||
}
|
||||
|
@ -842,7 +877,7 @@ expression
|
|||
parseContext.samplerConstructorLocationCheck($2.loc, ",", $3);
|
||||
$$ = parseContext.intermediate.addComma($1, $3, $2.loc);
|
||||
if ($$ == 0) {
|
||||
parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(), $3->getCompleteString());
|
||||
parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $3->getCompleteString(parseContext.intermediate.getEnhancedMsgs()));
|
||||
$$ = $3;
|
||||
}
|
||||
}
|
||||
|
@ -861,6 +896,20 @@ declaration
|
|||
$$ = 0;
|
||||
// TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
|
||||
}
|
||||
|
||||
| spirv_instruction_qualifier function_prototype SEMICOLON {
|
||||
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier");
|
||||
$2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier
|
||||
parseContext.handleFunctionDeclarator($2.loc, *$2.function, true /* prototype */);
|
||||
$$ = 0;
|
||||
// TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
|
||||
}
|
||||
| spirv_execution_mode_qualifier SEMICOLON {
|
||||
parseContext.globalCheck($2.loc, "SPIR-V execution mode qualifier");
|
||||
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier");
|
||||
$$ = 0;
|
||||
}
|
||||
|
||||
| init_declarator_list SEMICOLON {
|
||||
if ($1.intermNode && $1.intermNode->getAsAggregate())
|
||||
$1.intermNode->getAsAggregate()->setOperator(EOpSequence);
|
||||
|
@ -905,7 +954,7 @@ declaration
|
|||
|
||||
block_structure
|
||||
: type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
|
||||
--parseContext.structNestingLevel;
|
||||
--parseContext.blockNestingLevel;
|
||||
parseContext.blockName = $2.string;
|
||||
parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
|
||||
parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
|
||||
|
@ -930,6 +979,25 @@ function_prototype
|
|||
$$.function = $1;
|
||||
$$.loc = $2.loc;
|
||||
}
|
||||
| function_declarator RIGHT_PAREN attribute {
|
||||
$$.function = $1;
|
||||
$$.loc = $2.loc;
|
||||
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
|
||||
parseContext.handleFunctionAttributes($2.loc, *$3);
|
||||
}
|
||||
| attribute function_declarator RIGHT_PAREN {
|
||||
$$.function = $2;
|
||||
$$.loc = $3.loc;
|
||||
parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
|
||||
parseContext.handleFunctionAttributes($3.loc, *$1);
|
||||
}
|
||||
| attribute function_declarator RIGHT_PAREN attribute {
|
||||
$$.function = $2;
|
||||
$$.loc = $3.loc;
|
||||
parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
|
||||
parseContext.handleFunctionAttributes($3.loc, *$1);
|
||||
parseContext.handleFunctionAttributes($3.loc, *$4);
|
||||
}
|
||||
;
|
||||
|
||||
function_declarator
|
||||
|
@ -1222,27 +1290,45 @@ interpolation_qualifier
|
|||
$$.init($1.loc);
|
||||
$$.qualifier.pervertexNV = true;
|
||||
}
|
||||
| PERVERTEXEXT {
|
||||
parseContext.globalCheck($1.loc, "pervertexEXT");
|
||||
parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
|
||||
parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
|
||||
parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.pervertexEXT = true;
|
||||
}
|
||||
| PERPRIMITIVENV {
|
||||
// No need for profile version or extension check. Shader stage already checks both.
|
||||
parseContext.globalCheck($1.loc, "perprimitiveNV");
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV");
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshMask), "perprimitiveNV");
|
||||
// Fragment shader stage doesn't check for extension. So we explicitly add below extension check.
|
||||
if (parseContext.language == EShLangFragment)
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.perPrimitiveNV = true;
|
||||
}
|
||||
| PERPRIMITIVEEXT {
|
||||
// No need for profile version or extension check. Shader stage already checks both.
|
||||
parseContext.globalCheck($1.loc, "perprimitiveEXT");
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshMask), "perprimitiveEXT");
|
||||
// Fragment shader stage doesn't check for extension. So we explicitly add below extension check.
|
||||
if (parseContext.language == EShLangFragment)
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_mesh_shader, "perprimitiveEXT");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.perPrimitiveNV = true;
|
||||
}
|
||||
| PERVIEWNV {
|
||||
// No need for profile version or extension check. Shader stage already checks both.
|
||||
parseContext.globalCheck($1.loc, "perviewNV");
|
||||
parseContext.requireStage($1.loc, EShLangMeshNV, "perviewNV");
|
||||
parseContext.requireStage($1.loc, EShLangMesh, "perviewNV");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.perViewNV = true;
|
||||
}
|
||||
| PERTASKNV {
|
||||
// No need for profile version or extension check. Shader stage already checks both.
|
||||
parseContext.globalCheck($1.loc, "taskNV");
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV");
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask), "taskNV");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.perTaskNV = true;
|
||||
}
|
||||
|
@ -1333,6 +1419,25 @@ single_type_qualifier
|
|||
| non_uniform_qualifier {
|
||||
$$ = $1;
|
||||
}
|
||||
| spirv_storage_class_qualifier {
|
||||
parseContext.globalCheck($1.loc, "spirv_storage_class");
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V storage class qualifier");
|
||||
$$ = $1;
|
||||
}
|
||||
| spirv_decorate_qualifier {
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V decorate qualifier");
|
||||
$$ = $1;
|
||||
}
|
||||
| SPIRV_BY_REFERENCE {
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_reference");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.setSpirvByReference();
|
||||
}
|
||||
| SPIRV_LITERAL {
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_literal");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.setSpirvLiteral();
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
@ -1374,7 +1479,7 @@ storage_qualifier
|
|||
parseContext.globalCheck($1.loc, "shared");
|
||||
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
|
||||
parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared");
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshMask | EShLangTaskMask), "shared");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqShared;
|
||||
}
|
||||
|
@ -1561,6 +1666,13 @@ storage_qualifier
|
|||
parseContext.unimplemented($1.loc, "subroutine");
|
||||
$$.init($1.loc);
|
||||
}
|
||||
| TASKPAYLOADWORKGROUPEXT {
|
||||
// No need for profile version or extension check. Shader stage already checks both.
|
||||
parseContext.globalCheck($1.loc, "taskPayloadSharedEXT");
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask), "taskPayloadSharedEXT ");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqtaskPayloadSharedEXT;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
@ -3203,6 +3315,116 @@ type_specifier_nonarray
|
|||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint, Esd2D, true, false, true);
|
||||
}
|
||||
| I64IMAGE1D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, Esd1D);
|
||||
}
|
||||
| U64IMAGE1D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, Esd1D);
|
||||
}
|
||||
| I64IMAGE2D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, Esd2D);
|
||||
}
|
||||
| U64IMAGE2D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, Esd2D);
|
||||
}
|
||||
| I64IMAGE3D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, Esd3D);
|
||||
}
|
||||
| U64IMAGE3D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, Esd3D);
|
||||
}
|
||||
| I64IMAGE2DRECT {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, EsdRect);
|
||||
}
|
||||
| U64IMAGE2DRECT {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, EsdRect);
|
||||
}
|
||||
| I64IMAGECUBE {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, EsdCube);
|
||||
}
|
||||
| U64IMAGECUBE {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, EsdCube);
|
||||
}
|
||||
| I64IMAGEBUFFER {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, EsdBuffer);
|
||||
}
|
||||
| U64IMAGEBUFFER {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, EsdBuffer);
|
||||
}
|
||||
| I64IMAGE1DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, Esd1D, true);
|
||||
}
|
||||
| U64IMAGE1DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, Esd1D, true);
|
||||
}
|
||||
| I64IMAGE2DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, Esd2D, true);
|
||||
}
|
||||
| U64IMAGE2DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, Esd2D, true);
|
||||
}
|
||||
| I64IMAGECUBEARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, EsdCube, true);
|
||||
}
|
||||
| U64IMAGECUBEARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, EsdCube, true);
|
||||
}
|
||||
| I64IMAGE2DMS {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, Esd2D, false, false, true);
|
||||
}
|
||||
| U64IMAGE2DMS {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, Esd2D, false, false, true);
|
||||
}
|
||||
| I64IMAGE2DMSARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtInt64, Esd2D, true, false, true);
|
||||
}
|
||||
| U64IMAGE2DMSARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setImage(EbtUint64, Esd2D, true, false, true);
|
||||
}
|
||||
| SAMPLEREXTERNALOES { // GL_OES_EGL_image_external
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
|
@ -3283,6 +3505,10 @@ type_specifier_nonarray
|
|||
$$.basicType = EbtUint;
|
||||
$$.coopmat = true;
|
||||
}
|
||||
| spirv_type_specifier {
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier");
|
||||
$$ = $1;
|
||||
}
|
||||
|
||||
| struct_specifier {
|
||||
$$ = $1;
|
||||
|
@ -3451,6 +3677,12 @@ initializer
|
|||
parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
|
||||
$$ = $2;
|
||||
}
|
||||
| LEFT_BRACE RIGHT_BRACE {
|
||||
const char* initFeature = "empty { } initializer";
|
||||
parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_null_initializer, initFeature);
|
||||
parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature);
|
||||
$$ = parseContext.intermediate.makeAggregate($1.loc);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
@ -3511,7 +3743,7 @@ compound_statement
|
|||
}
|
||||
RIGHT_BRACE {
|
||||
if ($3 && $3->getAsAggregate())
|
||||
$3->getAsAggregate()->setOperator(EOpSequence);
|
||||
$3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
|
||||
$$ = $3;
|
||||
}
|
||||
;
|
||||
|
@ -3583,6 +3815,7 @@ selection_statement
|
|||
}
|
||||
|
||||
| attribute selection_statement_nonattributed {
|
||||
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
|
||||
parseContext.handleSelectionAttributes(*$1, $2);
|
||||
$$ = $2;
|
||||
}
|
||||
|
@ -3630,6 +3863,7 @@ switch_statement
|
|||
}
|
||||
|
||||
| attribute switch_statement_nonattributed {
|
||||
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
|
||||
parseContext.handleSwitchAttributes(*$1, $2);
|
||||
$$ = $2;
|
||||
}
|
||||
|
@ -3694,6 +3928,7 @@ iteration_statement
|
|||
}
|
||||
|
||||
| attribute iteration_statement_nonattributed {
|
||||
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
|
||||
parseContext.handleLoopAttributes(*$1, $2);
|
||||
$$ = $2;
|
||||
}
|
||||
|
@ -3716,6 +3951,7 @@ iteration_statement_nonattributed
|
|||
--parseContext.controlFlowNestingLevel;
|
||||
}
|
||||
| DO {
|
||||
parseContext.symbolTable.push();
|
||||
++parseContext.loopNestingLevel;
|
||||
++parseContext.statementNestingLevel;
|
||||
++parseContext.controlFlowNestingLevel;
|
||||
|
@ -3727,6 +3963,7 @@ iteration_statement_nonattributed
|
|||
parseContext.boolCheck($8.loc, $6);
|
||||
|
||||
$$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc);
|
||||
parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
|
||||
--parseContext.loopNestingLevel;
|
||||
--parseContext.statementNestingLevel;
|
||||
--parseContext.controlFlowNestingLevel;
|
||||
|
@ -3805,6 +4042,20 @@ jump_statement
|
|||
parseContext.requireStage($1.loc, EShLangFragment, "discard");
|
||||
$$ = parseContext.intermediate.addBranch(EOpKill, $1.loc);
|
||||
}
|
||||
| TERMINATE_INVOCATION SEMICOLON {
|
||||
parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation");
|
||||
$$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc);
|
||||
}
|
||||
|
||||
| TERMINATE_RAY SEMICOLON {
|
||||
parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT");
|
||||
$$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc);
|
||||
}
|
||||
| IGNORE_INTERSECTION SEMICOLON {
|
||||
parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT");
|
||||
$$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
// Grammar Note: No 'goto'. Gotos are not supported.
|
||||
|
@ -3883,7 +4134,6 @@ function_definition
|
|||
attribute
|
||||
: LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET {
|
||||
$$ = $3;
|
||||
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_control_flow_attributes, "attribute");
|
||||
}
|
||||
|
||||
attribute_list
|
||||
|
@ -3903,4 +4153,270 @@ single_attribute
|
|||
}
|
||||
|
||||
|
||||
|
||||
spirv_requirements_list
|
||||
: spirv_requirements_parameter {
|
||||
$$ = $1;
|
||||
}
|
||||
| spirv_requirements_list COMMA spirv_requirements_parameter {
|
||||
$$ = parseContext.mergeSpirvRequirements($2.loc, $1, $3);
|
||||
}
|
||||
|
||||
spirv_requirements_parameter
|
||||
: IDENTIFIER EQUAL LEFT_BRACKET spirv_extension_list RIGHT_BRACKET {
|
||||
$$ = parseContext.makeSpirvRequirement($2.loc, *$1.string, $4->getAsAggregate(), nullptr);
|
||||
}
|
||||
| IDENTIFIER EQUAL LEFT_BRACKET spirv_capability_list RIGHT_BRACKET {
|
||||
$$ = parseContext.makeSpirvRequirement($2.loc, *$1.string, nullptr, $4->getAsAggregate());
|
||||
}
|
||||
|
||||
spirv_extension_list
|
||||
: STRING_LITERAL {
|
||||
$$ = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion($1.string, $1.loc, true));
|
||||
}
|
||||
| spirv_extension_list COMMA STRING_LITERAL {
|
||||
$$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.string, $3.loc, true));
|
||||
}
|
||||
|
||||
spirv_capability_list
|
||||
: INTCONSTANT {
|
||||
$$ = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion($1.i, $1.loc, true));
|
||||
}
|
||||
| spirv_capability_list COMMA INTCONSTANT {
|
||||
$$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.i, $3.loc, true));
|
||||
}
|
||||
|
||||
spirv_execution_mode_qualifier
|
||||
: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT RIGHT_PAREN {
|
||||
parseContext.intermediate.insertSpirvExecutionMode($3.i);
|
||||
$$ = 0;
|
||||
}
|
||||
| SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN {
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
parseContext.intermediate.insertSpirvExecutionMode($5.i);
|
||||
$$ = 0;
|
||||
}
|
||||
| SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN {
|
||||
parseContext.intermediate.insertSpirvExecutionMode($3.i, $5->getAsAggregate());
|
||||
$$ = 0;
|
||||
}
|
||||
| SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN {
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
parseContext.intermediate.insertSpirvExecutionMode($5.i, $7->getAsAggregate());
|
||||
$$ = 0;
|
||||
}
|
||||
| SPIRV_EXECUTION_MODE_ID LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN {
|
||||
parseContext.intermediate.insertSpirvExecutionModeId($3.i, $5->getAsAggregate());
|
||||
$$ = 0;
|
||||
}
|
||||
| SPIRV_EXECUTION_MODE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN {
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
parseContext.intermediate.insertSpirvExecutionModeId($5.i, $7->getAsAggregate());
|
||||
$$ = 0;
|
||||
}
|
||||
|
||||
spirv_execution_mode_parameter_list
|
||||
: spirv_execution_mode_parameter {
|
||||
$$ = parseContext.intermediate.makeAggregate($1);
|
||||
}
|
||||
| spirv_execution_mode_parameter_list COMMA spirv_execution_mode_parameter {
|
||||
$$ = parseContext.intermediate.growAggregate($1, $3);
|
||||
}
|
||||
|
||||
spirv_execution_mode_parameter
|
||||
: FLOATCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
|
||||
}
|
||||
| INTCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
|
||||
}
|
||||
| UINTCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
|
||||
}
|
||||
| BOOLCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
|
||||
}
|
||||
| STRING_LITERAL {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true);
|
||||
}
|
||||
|
||||
spirv_execution_mode_id_parameter_list
|
||||
: constant_expression {
|
||||
if ($1->getBasicType() != EbtFloat &&
|
||||
$1->getBasicType() != EbtInt &&
|
||||
$1->getBasicType() != EbtUint &&
|
||||
$1->getBasicType() != EbtBool &&
|
||||
$1->getBasicType() != EbtString)
|
||||
parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), "");
|
||||
$$ = parseContext.intermediate.makeAggregate($1);
|
||||
}
|
||||
| spirv_execution_mode_id_parameter_list COMMA constant_expression {
|
||||
if ($3->getBasicType() != EbtFloat &&
|
||||
$3->getBasicType() != EbtInt &&
|
||||
$3->getBasicType() != EbtUint &&
|
||||
$3->getBasicType() != EbtBool &&
|
||||
$3->getBasicType() != EbtString)
|
||||
parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), "");
|
||||
$$ = parseContext.intermediate.growAggregate($1, $3);
|
||||
}
|
||||
|
||||
spirv_storage_class_qualifier
|
||||
: SPIRV_STORAGE_CLASS LEFT_PAREN INTCONSTANT RIGHT_PAREN {
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqSpirvStorageClass;
|
||||
$$.qualifier.spirvStorageClass = $3.i;
|
||||
}
|
||||
| SPIRV_STORAGE_CLASS LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN {
|
||||
$$.init($1.loc);
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
$$.qualifier.storage = EvqSpirvStorageClass;
|
||||
$$.qualifier.spirvStorageClass = $5.i;
|
||||
}
|
||||
|
||||
spirv_decorate_qualifier
|
||||
: SPIRV_DECORATE LEFT_PAREN INTCONSTANT RIGHT_PAREN{
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.setSpirvDecorate($3.i);
|
||||
}
|
||||
| SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN{
|
||||
$$.init($1.loc);
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
$$.qualifier.setSpirvDecorate($5.i);
|
||||
}
|
||||
| SPIRV_DECORATE LEFT_PAREN INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN {
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.setSpirvDecorate($3.i, $5->getAsAggregate());
|
||||
}
|
||||
| SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN {
|
||||
$$.init($1.loc);
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
$$.qualifier.setSpirvDecorate($5.i, $7->getAsAggregate());
|
||||
}
|
||||
| SPIRV_DECORATE_ID LEFT_PAREN INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN {
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.setSpirvDecorateId($3.i, $5->getAsAggregate());
|
||||
}
|
||||
| SPIRV_DECORATE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN {
|
||||
$$.init($1.loc);
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
$$.qualifier.setSpirvDecorateId($5.i, $7->getAsAggregate());
|
||||
}
|
||||
| SPIRV_DECORATE_STRING LEFT_PAREN INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN {
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.setSpirvDecorateString($3.i, $5->getAsAggregate());
|
||||
}
|
||||
| SPIRV_DECORATE_STRING LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN {
|
||||
$$.init($1.loc);
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
$$.qualifier.setSpirvDecorateString($5.i, $7->getAsAggregate());
|
||||
}
|
||||
|
||||
spirv_decorate_parameter_list
|
||||
: spirv_decorate_parameter {
|
||||
$$ = parseContext.intermediate.makeAggregate($1);
|
||||
}
|
||||
| spirv_decorate_parameter_list COMMA spirv_decorate_parameter {
|
||||
$$ = parseContext.intermediate.growAggregate($1, $3);
|
||||
}
|
||||
|
||||
spirv_decorate_parameter
|
||||
: FLOATCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
|
||||
}
|
||||
| INTCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
|
||||
}
|
||||
| UINTCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
|
||||
}
|
||||
| BOOLCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
|
||||
}
|
||||
|
||||
spirv_decorate_id_parameter_list
|
||||
: constant_expression {
|
||||
if ($1->getBasicType() != EbtFloat &&
|
||||
$1->getBasicType() != EbtInt &&
|
||||
$1->getBasicType() != EbtUint &&
|
||||
$1->getBasicType() != EbtBool)
|
||||
parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), "");
|
||||
$$ = parseContext.intermediate.makeAggregate($1);
|
||||
}
|
||||
| spirv_decorate_id_parameter_list COMMA constant_expression {
|
||||
if ($3->getBasicType() != EbtFloat &&
|
||||
$3->getBasicType() != EbtInt &&
|
||||
$3->getBasicType() != EbtUint &&
|
||||
$3->getBasicType() != EbtBool)
|
||||
parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), "");
|
||||
$$ = parseContext.intermediate.growAggregate($1, $3);
|
||||
}
|
||||
|
||||
spirv_decorate_string_parameter_list
|
||||
: STRING_LITERAL {
|
||||
$$ = parseContext.intermediate.makeAggregate(
|
||||
parseContext.intermediate.addConstantUnion($1.string, $1.loc, true));
|
||||
}
|
||||
| spirv_decorate_string_parameter_list COMMA STRING_LITERAL {
|
||||
$$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.string, $3.loc, true));
|
||||
}
|
||||
|
||||
spirv_type_specifier
|
||||
: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.setSpirvType(*$3, $5);
|
||||
}
|
||||
| SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
$$.setSpirvType(*$5, $7);
|
||||
}
|
||||
| SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.setSpirvType(*$3);
|
||||
}
|
||||
| SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
$$.setSpirvType(*$5);
|
||||
}
|
||||
|
||||
spirv_type_parameter_list
|
||||
: spirv_type_parameter {
|
||||
$$ = $1;
|
||||
}
|
||||
| spirv_type_parameter_list COMMA spirv_type_parameter {
|
||||
$$ = parseContext.mergeSpirvTypeParameters($1, $3);
|
||||
}
|
||||
|
||||
spirv_type_parameter
|
||||
: constant_expression {
|
||||
$$ = parseContext.makeSpirvTypeParameters($1->getLoc(), $1->getAsConstantUnion());
|
||||
}
|
||||
|
||||
spirv_instruction_qualifier
|
||||
: SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN {
|
||||
$$ = $3;
|
||||
}
|
||||
| SPIRV_INSTRUCTION LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN {
|
||||
parseContext.intermediate.insertSpirvRequirement($3);
|
||||
$$ = $5;
|
||||
}
|
||||
|
||||
spirv_instruction_qualifier_list
|
||||
: spirv_instruction_qualifier_id {
|
||||
$$ = $1;
|
||||
}
|
||||
| spirv_instruction_qualifier_list COMMA spirv_instruction_qualifier_id {
|
||||
$$ = parseContext.mergeSpirvInstruction($2.loc, $1, $3);
|
||||
}
|
||||
|
||||
spirv_instruction_qualifier_id
|
||||
: IDENTIFIER EQUAL STRING_LITERAL {
|
||||
$$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, *$3.string);
|
||||
}
|
||||
| IDENTIFIER EQUAL INTCONSTANT {
|
||||
$$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i);
|
||||
}
|
||||
|
||||
|
||||
%%
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,9 @@
|
|||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
/* A Bison parser, made by GNU Bison 3.7.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,6 +31,10 @@
|
|||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
||||
especially those whose name start with YY_ or yy_. They are
|
||||
private implementation details that can be changed or removed. */
|
||||
|
||||
#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
|
@ -40,437 +45,479 @@
|
|||
extern int yydebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
/* Token kinds. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
CONST = 258,
|
||||
BOOL = 259,
|
||||
INT = 260,
|
||||
UINT = 261,
|
||||
FLOAT = 262,
|
||||
BVEC2 = 263,
|
||||
BVEC3 = 264,
|
||||
BVEC4 = 265,
|
||||
IVEC2 = 266,
|
||||
IVEC3 = 267,
|
||||
IVEC4 = 268,
|
||||
UVEC2 = 269,
|
||||
UVEC3 = 270,
|
||||
UVEC4 = 271,
|
||||
VEC2 = 272,
|
||||
VEC3 = 273,
|
||||
VEC4 = 274,
|
||||
MAT2 = 275,
|
||||
MAT3 = 276,
|
||||
MAT4 = 277,
|
||||
MAT2X2 = 278,
|
||||
MAT2X3 = 279,
|
||||
MAT2X4 = 280,
|
||||
MAT3X2 = 281,
|
||||
MAT3X3 = 282,
|
||||
MAT3X4 = 283,
|
||||
MAT4X2 = 284,
|
||||
MAT4X3 = 285,
|
||||
MAT4X4 = 286,
|
||||
SAMPLER2D = 287,
|
||||
SAMPLER3D = 288,
|
||||
SAMPLERCUBE = 289,
|
||||
SAMPLER2DSHADOW = 290,
|
||||
SAMPLERCUBESHADOW = 291,
|
||||
SAMPLER2DARRAY = 292,
|
||||
SAMPLER2DARRAYSHADOW = 293,
|
||||
ISAMPLER2D = 294,
|
||||
ISAMPLER3D = 295,
|
||||
ISAMPLERCUBE = 296,
|
||||
ISAMPLER2DARRAY = 297,
|
||||
USAMPLER2D = 298,
|
||||
USAMPLER3D = 299,
|
||||
USAMPLERCUBE = 300,
|
||||
USAMPLER2DARRAY = 301,
|
||||
SAMPLER = 302,
|
||||
SAMPLERSHADOW = 303,
|
||||
TEXTURE2D = 304,
|
||||
TEXTURE3D = 305,
|
||||
TEXTURECUBE = 306,
|
||||
TEXTURE2DARRAY = 307,
|
||||
ITEXTURE2D = 308,
|
||||
ITEXTURE3D = 309,
|
||||
ITEXTURECUBE = 310,
|
||||
ITEXTURE2DARRAY = 311,
|
||||
UTEXTURE2D = 312,
|
||||
UTEXTURE3D = 313,
|
||||
UTEXTURECUBE = 314,
|
||||
UTEXTURE2DARRAY = 315,
|
||||
ATTRIBUTE = 316,
|
||||
VARYING = 317,
|
||||
FLOAT16_T = 318,
|
||||
FLOAT32_T = 319,
|
||||
DOUBLE = 320,
|
||||
FLOAT64_T = 321,
|
||||
INT64_T = 322,
|
||||
UINT64_T = 323,
|
||||
INT32_T = 324,
|
||||
UINT32_T = 325,
|
||||
INT16_T = 326,
|
||||
UINT16_T = 327,
|
||||
INT8_T = 328,
|
||||
UINT8_T = 329,
|
||||
I64VEC2 = 330,
|
||||
I64VEC3 = 331,
|
||||
I64VEC4 = 332,
|
||||
U64VEC2 = 333,
|
||||
U64VEC3 = 334,
|
||||
U64VEC4 = 335,
|
||||
I32VEC2 = 336,
|
||||
I32VEC3 = 337,
|
||||
I32VEC4 = 338,
|
||||
U32VEC2 = 339,
|
||||
U32VEC3 = 340,
|
||||
U32VEC4 = 341,
|
||||
I16VEC2 = 342,
|
||||
I16VEC3 = 343,
|
||||
I16VEC4 = 344,
|
||||
U16VEC2 = 345,
|
||||
U16VEC3 = 346,
|
||||
U16VEC4 = 347,
|
||||
I8VEC2 = 348,
|
||||
I8VEC3 = 349,
|
||||
I8VEC4 = 350,
|
||||
U8VEC2 = 351,
|
||||
U8VEC3 = 352,
|
||||
U8VEC4 = 353,
|
||||
DVEC2 = 354,
|
||||
DVEC3 = 355,
|
||||
DVEC4 = 356,
|
||||
DMAT2 = 357,
|
||||
DMAT3 = 358,
|
||||
DMAT4 = 359,
|
||||
F16VEC2 = 360,
|
||||
F16VEC3 = 361,
|
||||
F16VEC4 = 362,
|
||||
F16MAT2 = 363,
|
||||
F16MAT3 = 364,
|
||||
F16MAT4 = 365,
|
||||
F32VEC2 = 366,
|
||||
F32VEC3 = 367,
|
||||
F32VEC4 = 368,
|
||||
F32MAT2 = 369,
|
||||
F32MAT3 = 370,
|
||||
F32MAT4 = 371,
|
||||
F64VEC2 = 372,
|
||||
F64VEC3 = 373,
|
||||
F64VEC4 = 374,
|
||||
F64MAT2 = 375,
|
||||
F64MAT3 = 376,
|
||||
F64MAT4 = 377,
|
||||
DMAT2X2 = 378,
|
||||
DMAT2X3 = 379,
|
||||
DMAT2X4 = 380,
|
||||
DMAT3X2 = 381,
|
||||
DMAT3X3 = 382,
|
||||
DMAT3X4 = 383,
|
||||
DMAT4X2 = 384,
|
||||
DMAT4X3 = 385,
|
||||
DMAT4X4 = 386,
|
||||
F16MAT2X2 = 387,
|
||||
F16MAT2X3 = 388,
|
||||
F16MAT2X4 = 389,
|
||||
F16MAT3X2 = 390,
|
||||
F16MAT3X3 = 391,
|
||||
F16MAT3X4 = 392,
|
||||
F16MAT4X2 = 393,
|
||||
F16MAT4X3 = 394,
|
||||
F16MAT4X4 = 395,
|
||||
F32MAT2X2 = 396,
|
||||
F32MAT2X3 = 397,
|
||||
F32MAT2X4 = 398,
|
||||
F32MAT3X2 = 399,
|
||||
F32MAT3X3 = 400,
|
||||
F32MAT3X4 = 401,
|
||||
F32MAT4X2 = 402,
|
||||
F32MAT4X3 = 403,
|
||||
F32MAT4X4 = 404,
|
||||
F64MAT2X2 = 405,
|
||||
F64MAT2X3 = 406,
|
||||
F64MAT2X4 = 407,
|
||||
F64MAT3X2 = 408,
|
||||
F64MAT3X3 = 409,
|
||||
F64MAT3X4 = 410,
|
||||
F64MAT4X2 = 411,
|
||||
F64MAT4X3 = 412,
|
||||
F64MAT4X4 = 413,
|
||||
ATOMIC_UINT = 414,
|
||||
ACCSTRUCTNV = 415,
|
||||
ACCSTRUCTEXT = 416,
|
||||
RAYQUERYEXT = 417,
|
||||
FCOOPMATNV = 418,
|
||||
ICOOPMATNV = 419,
|
||||
UCOOPMATNV = 420,
|
||||
SAMPLERCUBEARRAY = 421,
|
||||
SAMPLERCUBEARRAYSHADOW = 422,
|
||||
ISAMPLERCUBEARRAY = 423,
|
||||
USAMPLERCUBEARRAY = 424,
|
||||
SAMPLER1D = 425,
|
||||
SAMPLER1DARRAY = 426,
|
||||
SAMPLER1DARRAYSHADOW = 427,
|
||||
ISAMPLER1D = 428,
|
||||
SAMPLER1DSHADOW = 429,
|
||||
SAMPLER2DRECT = 430,
|
||||
SAMPLER2DRECTSHADOW = 431,
|
||||
ISAMPLER2DRECT = 432,
|
||||
USAMPLER2DRECT = 433,
|
||||
SAMPLERBUFFER = 434,
|
||||
ISAMPLERBUFFER = 435,
|
||||
USAMPLERBUFFER = 436,
|
||||
SAMPLER2DMS = 437,
|
||||
ISAMPLER2DMS = 438,
|
||||
USAMPLER2DMS = 439,
|
||||
SAMPLER2DMSARRAY = 440,
|
||||
ISAMPLER2DMSARRAY = 441,
|
||||
USAMPLER2DMSARRAY = 442,
|
||||
SAMPLEREXTERNALOES = 443,
|
||||
SAMPLEREXTERNAL2DY2YEXT = 444,
|
||||
ISAMPLER1DARRAY = 445,
|
||||
USAMPLER1D = 446,
|
||||
USAMPLER1DARRAY = 447,
|
||||
F16SAMPLER1D = 448,
|
||||
F16SAMPLER2D = 449,
|
||||
F16SAMPLER3D = 450,
|
||||
F16SAMPLER2DRECT = 451,
|
||||
F16SAMPLERCUBE = 452,
|
||||
F16SAMPLER1DARRAY = 453,
|
||||
F16SAMPLER2DARRAY = 454,
|
||||
F16SAMPLERCUBEARRAY = 455,
|
||||
F16SAMPLERBUFFER = 456,
|
||||
F16SAMPLER2DMS = 457,
|
||||
F16SAMPLER2DMSARRAY = 458,
|
||||
F16SAMPLER1DSHADOW = 459,
|
||||
F16SAMPLER2DSHADOW = 460,
|
||||
F16SAMPLER1DARRAYSHADOW = 461,
|
||||
F16SAMPLER2DARRAYSHADOW = 462,
|
||||
F16SAMPLER2DRECTSHADOW = 463,
|
||||
F16SAMPLERCUBESHADOW = 464,
|
||||
F16SAMPLERCUBEARRAYSHADOW = 465,
|
||||
IMAGE1D = 466,
|
||||
IIMAGE1D = 467,
|
||||
UIMAGE1D = 468,
|
||||
IMAGE2D = 469,
|
||||
IIMAGE2D = 470,
|
||||
UIMAGE2D = 471,
|
||||
IMAGE3D = 472,
|
||||
IIMAGE3D = 473,
|
||||
UIMAGE3D = 474,
|
||||
IMAGE2DRECT = 475,
|
||||
IIMAGE2DRECT = 476,
|
||||
UIMAGE2DRECT = 477,
|
||||
IMAGECUBE = 478,
|
||||
IIMAGECUBE = 479,
|
||||
UIMAGECUBE = 480,
|
||||
IMAGEBUFFER = 481,
|
||||
IIMAGEBUFFER = 482,
|
||||
UIMAGEBUFFER = 483,
|
||||
IMAGE1DARRAY = 484,
|
||||
IIMAGE1DARRAY = 485,
|
||||
UIMAGE1DARRAY = 486,
|
||||
IMAGE2DARRAY = 487,
|
||||
IIMAGE2DARRAY = 488,
|
||||
UIMAGE2DARRAY = 489,
|
||||
IMAGECUBEARRAY = 490,
|
||||
IIMAGECUBEARRAY = 491,
|
||||
UIMAGECUBEARRAY = 492,
|
||||
IMAGE2DMS = 493,
|
||||
IIMAGE2DMS = 494,
|
||||
UIMAGE2DMS = 495,
|
||||
IMAGE2DMSARRAY = 496,
|
||||
IIMAGE2DMSARRAY = 497,
|
||||
UIMAGE2DMSARRAY = 498,
|
||||
F16IMAGE1D = 499,
|
||||
F16IMAGE2D = 500,
|
||||
F16IMAGE3D = 501,
|
||||
F16IMAGE2DRECT = 502,
|
||||
F16IMAGECUBE = 503,
|
||||
F16IMAGE1DARRAY = 504,
|
||||
F16IMAGE2DARRAY = 505,
|
||||
F16IMAGECUBEARRAY = 506,
|
||||
F16IMAGEBUFFER = 507,
|
||||
F16IMAGE2DMS = 508,
|
||||
F16IMAGE2DMSARRAY = 509,
|
||||
TEXTURECUBEARRAY = 510,
|
||||
ITEXTURECUBEARRAY = 511,
|
||||
UTEXTURECUBEARRAY = 512,
|
||||
TEXTURE1D = 513,
|
||||
ITEXTURE1D = 514,
|
||||
UTEXTURE1D = 515,
|
||||
TEXTURE1DARRAY = 516,
|
||||
ITEXTURE1DARRAY = 517,
|
||||
UTEXTURE1DARRAY = 518,
|
||||
TEXTURE2DRECT = 519,
|
||||
ITEXTURE2DRECT = 520,
|
||||
UTEXTURE2DRECT = 521,
|
||||
TEXTUREBUFFER = 522,
|
||||
ITEXTUREBUFFER = 523,
|
||||
UTEXTUREBUFFER = 524,
|
||||
TEXTURE2DMS = 525,
|
||||
ITEXTURE2DMS = 526,
|
||||
UTEXTURE2DMS = 527,
|
||||
TEXTURE2DMSARRAY = 528,
|
||||
ITEXTURE2DMSARRAY = 529,
|
||||
UTEXTURE2DMSARRAY = 530,
|
||||
F16TEXTURE1D = 531,
|
||||
F16TEXTURE2D = 532,
|
||||
F16TEXTURE3D = 533,
|
||||
F16TEXTURE2DRECT = 534,
|
||||
F16TEXTURECUBE = 535,
|
||||
F16TEXTURE1DARRAY = 536,
|
||||
F16TEXTURE2DARRAY = 537,
|
||||
F16TEXTURECUBEARRAY = 538,
|
||||
F16TEXTUREBUFFER = 539,
|
||||
F16TEXTURE2DMS = 540,
|
||||
F16TEXTURE2DMSARRAY = 541,
|
||||
SUBPASSINPUT = 542,
|
||||
SUBPASSINPUTMS = 543,
|
||||
ISUBPASSINPUT = 544,
|
||||
ISUBPASSINPUTMS = 545,
|
||||
USUBPASSINPUT = 546,
|
||||
USUBPASSINPUTMS = 547,
|
||||
F16SUBPASSINPUT = 548,
|
||||
F16SUBPASSINPUTMS = 549,
|
||||
LEFT_OP = 550,
|
||||
RIGHT_OP = 551,
|
||||
INC_OP = 552,
|
||||
DEC_OP = 553,
|
||||
LE_OP = 554,
|
||||
GE_OP = 555,
|
||||
EQ_OP = 556,
|
||||
NE_OP = 557,
|
||||
AND_OP = 558,
|
||||
OR_OP = 559,
|
||||
XOR_OP = 560,
|
||||
MUL_ASSIGN = 561,
|
||||
DIV_ASSIGN = 562,
|
||||
ADD_ASSIGN = 563,
|
||||
MOD_ASSIGN = 564,
|
||||
LEFT_ASSIGN = 565,
|
||||
RIGHT_ASSIGN = 566,
|
||||
AND_ASSIGN = 567,
|
||||
XOR_ASSIGN = 568,
|
||||
OR_ASSIGN = 569,
|
||||
SUB_ASSIGN = 570,
|
||||
STRING_LITERAL = 571,
|
||||
LEFT_PAREN = 572,
|
||||
RIGHT_PAREN = 573,
|
||||
LEFT_BRACKET = 574,
|
||||
RIGHT_BRACKET = 575,
|
||||
LEFT_BRACE = 576,
|
||||
RIGHT_BRACE = 577,
|
||||
DOT = 578,
|
||||
COMMA = 579,
|
||||
COLON = 580,
|
||||
EQUAL = 581,
|
||||
SEMICOLON = 582,
|
||||
BANG = 583,
|
||||
DASH = 584,
|
||||
TILDE = 585,
|
||||
PLUS = 586,
|
||||
STAR = 587,
|
||||
SLASH = 588,
|
||||
PERCENT = 589,
|
||||
LEFT_ANGLE = 590,
|
||||
RIGHT_ANGLE = 591,
|
||||
VERTICAL_BAR = 592,
|
||||
CARET = 593,
|
||||
AMPERSAND = 594,
|
||||
QUESTION = 595,
|
||||
INVARIANT = 596,
|
||||
HIGH_PRECISION = 597,
|
||||
MEDIUM_PRECISION = 598,
|
||||
LOW_PRECISION = 599,
|
||||
PRECISION = 600,
|
||||
PACKED = 601,
|
||||
RESOURCE = 602,
|
||||
SUPERP = 603,
|
||||
FLOATCONSTANT = 604,
|
||||
INTCONSTANT = 605,
|
||||
UINTCONSTANT = 606,
|
||||
BOOLCONSTANT = 607,
|
||||
IDENTIFIER = 608,
|
||||
TYPE_NAME = 609,
|
||||
CENTROID = 610,
|
||||
IN = 611,
|
||||
OUT = 612,
|
||||
INOUT = 613,
|
||||
STRUCT = 614,
|
||||
VOID = 615,
|
||||
WHILE = 616,
|
||||
BREAK = 617,
|
||||
CONTINUE = 618,
|
||||
DO = 619,
|
||||
ELSE = 620,
|
||||
FOR = 621,
|
||||
IF = 622,
|
||||
DISCARD = 623,
|
||||
RETURN = 624,
|
||||
SWITCH = 625,
|
||||
CASE = 626,
|
||||
DEFAULT = 627,
|
||||
UNIFORM = 628,
|
||||
SHARED = 629,
|
||||
BUFFER = 630,
|
||||
FLAT = 631,
|
||||
SMOOTH = 632,
|
||||
LAYOUT = 633,
|
||||
DOUBLECONSTANT = 634,
|
||||
INT16CONSTANT = 635,
|
||||
UINT16CONSTANT = 636,
|
||||
FLOAT16CONSTANT = 637,
|
||||
INT32CONSTANT = 638,
|
||||
UINT32CONSTANT = 639,
|
||||
INT64CONSTANT = 640,
|
||||
UINT64CONSTANT = 641,
|
||||
SUBROUTINE = 642,
|
||||
DEMOTE = 643,
|
||||
PAYLOADNV = 644,
|
||||
PAYLOADINNV = 645,
|
||||
HITATTRNV = 646,
|
||||
CALLDATANV = 647,
|
||||
CALLDATAINNV = 648,
|
||||
PAYLOADEXT = 649,
|
||||
PAYLOADINEXT = 650,
|
||||
HITATTREXT = 651,
|
||||
CALLDATAEXT = 652,
|
||||
CALLDATAINEXT = 653,
|
||||
PATCH = 654,
|
||||
SAMPLE = 655,
|
||||
NONUNIFORM = 656,
|
||||
COHERENT = 657,
|
||||
VOLATILE = 658,
|
||||
RESTRICT = 659,
|
||||
READONLY = 660,
|
||||
WRITEONLY = 661,
|
||||
DEVICECOHERENT = 662,
|
||||
QUEUEFAMILYCOHERENT = 663,
|
||||
WORKGROUPCOHERENT = 664,
|
||||
SUBGROUPCOHERENT = 665,
|
||||
NONPRIVATE = 666,
|
||||
SHADERCALLCOHERENT = 667,
|
||||
NOPERSPECTIVE = 668,
|
||||
EXPLICITINTERPAMD = 669,
|
||||
PERVERTEXNV = 670,
|
||||
PERPRIMITIVENV = 671,
|
||||
PERVIEWNV = 672,
|
||||
PERTASKNV = 673,
|
||||
PRECISE = 674
|
||||
YYEMPTY = -2,
|
||||
YYEOF = 0, /* "end of file" */
|
||||
YYerror = 256, /* error */
|
||||
YYUNDEF = 257, /* "invalid token" */
|
||||
CONST = 258, /* CONST */
|
||||
BOOL = 259, /* BOOL */
|
||||
INT = 260, /* INT */
|
||||
UINT = 261, /* UINT */
|
||||
FLOAT = 262, /* FLOAT */
|
||||
BVEC2 = 263, /* BVEC2 */
|
||||
BVEC3 = 264, /* BVEC3 */
|
||||
BVEC4 = 265, /* BVEC4 */
|
||||
IVEC2 = 266, /* IVEC2 */
|
||||
IVEC3 = 267, /* IVEC3 */
|
||||
IVEC4 = 268, /* IVEC4 */
|
||||
UVEC2 = 269, /* UVEC2 */
|
||||
UVEC3 = 270, /* UVEC3 */
|
||||
UVEC4 = 271, /* UVEC4 */
|
||||
VEC2 = 272, /* VEC2 */
|
||||
VEC3 = 273, /* VEC3 */
|
||||
VEC4 = 274, /* VEC4 */
|
||||
MAT2 = 275, /* MAT2 */
|
||||
MAT3 = 276, /* MAT3 */
|
||||
MAT4 = 277, /* MAT4 */
|
||||
MAT2X2 = 278, /* MAT2X2 */
|
||||
MAT2X3 = 279, /* MAT2X3 */
|
||||
MAT2X4 = 280, /* MAT2X4 */
|
||||
MAT3X2 = 281, /* MAT3X2 */
|
||||
MAT3X3 = 282, /* MAT3X3 */
|
||||
MAT3X4 = 283, /* MAT3X4 */
|
||||
MAT4X2 = 284, /* MAT4X2 */
|
||||
MAT4X3 = 285, /* MAT4X3 */
|
||||
MAT4X4 = 286, /* MAT4X4 */
|
||||
SAMPLER2D = 287, /* SAMPLER2D */
|
||||
SAMPLER3D = 288, /* SAMPLER3D */
|
||||
SAMPLERCUBE = 289, /* SAMPLERCUBE */
|
||||
SAMPLER2DSHADOW = 290, /* SAMPLER2DSHADOW */
|
||||
SAMPLERCUBESHADOW = 291, /* SAMPLERCUBESHADOW */
|
||||
SAMPLER2DARRAY = 292, /* SAMPLER2DARRAY */
|
||||
SAMPLER2DARRAYSHADOW = 293, /* SAMPLER2DARRAYSHADOW */
|
||||
ISAMPLER2D = 294, /* ISAMPLER2D */
|
||||
ISAMPLER3D = 295, /* ISAMPLER3D */
|
||||
ISAMPLERCUBE = 296, /* ISAMPLERCUBE */
|
||||
ISAMPLER2DARRAY = 297, /* ISAMPLER2DARRAY */
|
||||
USAMPLER2D = 298, /* USAMPLER2D */
|
||||
USAMPLER3D = 299, /* USAMPLER3D */
|
||||
USAMPLERCUBE = 300, /* USAMPLERCUBE */
|
||||
USAMPLER2DARRAY = 301, /* USAMPLER2DARRAY */
|
||||
SAMPLER = 302, /* SAMPLER */
|
||||
SAMPLERSHADOW = 303, /* SAMPLERSHADOW */
|
||||
TEXTURE2D = 304, /* TEXTURE2D */
|
||||
TEXTURE3D = 305, /* TEXTURE3D */
|
||||
TEXTURECUBE = 306, /* TEXTURECUBE */
|
||||
TEXTURE2DARRAY = 307, /* TEXTURE2DARRAY */
|
||||
ITEXTURE2D = 308, /* ITEXTURE2D */
|
||||
ITEXTURE3D = 309, /* ITEXTURE3D */
|
||||
ITEXTURECUBE = 310, /* ITEXTURECUBE */
|
||||
ITEXTURE2DARRAY = 311, /* ITEXTURE2DARRAY */
|
||||
UTEXTURE2D = 312, /* UTEXTURE2D */
|
||||
UTEXTURE3D = 313, /* UTEXTURE3D */
|
||||
UTEXTURECUBE = 314, /* UTEXTURECUBE */
|
||||
UTEXTURE2DARRAY = 315, /* UTEXTURE2DARRAY */
|
||||
ATTRIBUTE = 316, /* ATTRIBUTE */
|
||||
VARYING = 317, /* VARYING */
|
||||
FLOAT16_T = 318, /* FLOAT16_T */
|
||||
FLOAT32_T = 319, /* FLOAT32_T */
|
||||
DOUBLE = 320, /* DOUBLE */
|
||||
FLOAT64_T = 321, /* FLOAT64_T */
|
||||
INT64_T = 322, /* INT64_T */
|
||||
UINT64_T = 323, /* UINT64_T */
|
||||
INT32_T = 324, /* INT32_T */
|
||||
UINT32_T = 325, /* UINT32_T */
|
||||
INT16_T = 326, /* INT16_T */
|
||||
UINT16_T = 327, /* UINT16_T */
|
||||
INT8_T = 328, /* INT8_T */
|
||||
UINT8_T = 329, /* UINT8_T */
|
||||
I64VEC2 = 330, /* I64VEC2 */
|
||||
I64VEC3 = 331, /* I64VEC3 */
|
||||
I64VEC4 = 332, /* I64VEC4 */
|
||||
U64VEC2 = 333, /* U64VEC2 */
|
||||
U64VEC3 = 334, /* U64VEC3 */
|
||||
U64VEC4 = 335, /* U64VEC4 */
|
||||
I32VEC2 = 336, /* I32VEC2 */
|
||||
I32VEC3 = 337, /* I32VEC3 */
|
||||
I32VEC4 = 338, /* I32VEC4 */
|
||||
U32VEC2 = 339, /* U32VEC2 */
|
||||
U32VEC3 = 340, /* U32VEC3 */
|
||||
U32VEC4 = 341, /* U32VEC4 */
|
||||
I16VEC2 = 342, /* I16VEC2 */
|
||||
I16VEC3 = 343, /* I16VEC3 */
|
||||
I16VEC4 = 344, /* I16VEC4 */
|
||||
U16VEC2 = 345, /* U16VEC2 */
|
||||
U16VEC3 = 346, /* U16VEC3 */
|
||||
U16VEC4 = 347, /* U16VEC4 */
|
||||
I8VEC2 = 348, /* I8VEC2 */
|
||||
I8VEC3 = 349, /* I8VEC3 */
|
||||
I8VEC4 = 350, /* I8VEC4 */
|
||||
U8VEC2 = 351, /* U8VEC2 */
|
||||
U8VEC3 = 352, /* U8VEC3 */
|
||||
U8VEC4 = 353, /* U8VEC4 */
|
||||
DVEC2 = 354, /* DVEC2 */
|
||||
DVEC3 = 355, /* DVEC3 */
|
||||
DVEC4 = 356, /* DVEC4 */
|
||||
DMAT2 = 357, /* DMAT2 */
|
||||
DMAT3 = 358, /* DMAT3 */
|
||||
DMAT4 = 359, /* DMAT4 */
|
||||
F16VEC2 = 360, /* F16VEC2 */
|
||||
F16VEC3 = 361, /* F16VEC3 */
|
||||
F16VEC4 = 362, /* F16VEC4 */
|
||||
F16MAT2 = 363, /* F16MAT2 */
|
||||
F16MAT3 = 364, /* F16MAT3 */
|
||||
F16MAT4 = 365, /* F16MAT4 */
|
||||
F32VEC2 = 366, /* F32VEC2 */
|
||||
F32VEC3 = 367, /* F32VEC3 */
|
||||
F32VEC4 = 368, /* F32VEC4 */
|
||||
F32MAT2 = 369, /* F32MAT2 */
|
||||
F32MAT3 = 370, /* F32MAT3 */
|
||||
F32MAT4 = 371, /* F32MAT4 */
|
||||
F64VEC2 = 372, /* F64VEC2 */
|
||||
F64VEC3 = 373, /* F64VEC3 */
|
||||
F64VEC4 = 374, /* F64VEC4 */
|
||||
F64MAT2 = 375, /* F64MAT2 */
|
||||
F64MAT3 = 376, /* F64MAT3 */
|
||||
F64MAT4 = 377, /* F64MAT4 */
|
||||
DMAT2X2 = 378, /* DMAT2X2 */
|
||||
DMAT2X3 = 379, /* DMAT2X3 */
|
||||
DMAT2X4 = 380, /* DMAT2X4 */
|
||||
DMAT3X2 = 381, /* DMAT3X2 */
|
||||
DMAT3X3 = 382, /* DMAT3X3 */
|
||||
DMAT3X4 = 383, /* DMAT3X4 */
|
||||
DMAT4X2 = 384, /* DMAT4X2 */
|
||||
DMAT4X3 = 385, /* DMAT4X3 */
|
||||
DMAT4X4 = 386, /* DMAT4X4 */
|
||||
F16MAT2X2 = 387, /* F16MAT2X2 */
|
||||
F16MAT2X3 = 388, /* F16MAT2X3 */
|
||||
F16MAT2X4 = 389, /* F16MAT2X4 */
|
||||
F16MAT3X2 = 390, /* F16MAT3X2 */
|
||||
F16MAT3X3 = 391, /* F16MAT3X3 */
|
||||
F16MAT3X4 = 392, /* F16MAT3X4 */
|
||||
F16MAT4X2 = 393, /* F16MAT4X2 */
|
||||
F16MAT4X3 = 394, /* F16MAT4X3 */
|
||||
F16MAT4X4 = 395, /* F16MAT4X4 */
|
||||
F32MAT2X2 = 396, /* F32MAT2X2 */
|
||||
F32MAT2X3 = 397, /* F32MAT2X3 */
|
||||
F32MAT2X4 = 398, /* F32MAT2X4 */
|
||||
F32MAT3X2 = 399, /* F32MAT3X2 */
|
||||
F32MAT3X3 = 400, /* F32MAT3X3 */
|
||||
F32MAT3X4 = 401, /* F32MAT3X4 */
|
||||
F32MAT4X2 = 402, /* F32MAT4X2 */
|
||||
F32MAT4X3 = 403, /* F32MAT4X3 */
|
||||
F32MAT4X4 = 404, /* F32MAT4X4 */
|
||||
F64MAT2X2 = 405, /* F64MAT2X2 */
|
||||
F64MAT2X3 = 406, /* F64MAT2X3 */
|
||||
F64MAT2X4 = 407, /* F64MAT2X4 */
|
||||
F64MAT3X2 = 408, /* F64MAT3X2 */
|
||||
F64MAT3X3 = 409, /* F64MAT3X3 */
|
||||
F64MAT3X4 = 410, /* F64MAT3X4 */
|
||||
F64MAT4X2 = 411, /* F64MAT4X2 */
|
||||
F64MAT4X3 = 412, /* F64MAT4X3 */
|
||||
F64MAT4X4 = 413, /* F64MAT4X4 */
|
||||
ATOMIC_UINT = 414, /* ATOMIC_UINT */
|
||||
ACCSTRUCTNV = 415, /* ACCSTRUCTNV */
|
||||
ACCSTRUCTEXT = 416, /* ACCSTRUCTEXT */
|
||||
RAYQUERYEXT = 417, /* RAYQUERYEXT */
|
||||
FCOOPMATNV = 418, /* FCOOPMATNV */
|
||||
ICOOPMATNV = 419, /* ICOOPMATNV */
|
||||
UCOOPMATNV = 420, /* UCOOPMATNV */
|
||||
SAMPLERCUBEARRAY = 421, /* SAMPLERCUBEARRAY */
|
||||
SAMPLERCUBEARRAYSHADOW = 422, /* SAMPLERCUBEARRAYSHADOW */
|
||||
ISAMPLERCUBEARRAY = 423, /* ISAMPLERCUBEARRAY */
|
||||
USAMPLERCUBEARRAY = 424, /* USAMPLERCUBEARRAY */
|
||||
SAMPLER1D = 425, /* SAMPLER1D */
|
||||
SAMPLER1DARRAY = 426, /* SAMPLER1DARRAY */
|
||||
SAMPLER1DARRAYSHADOW = 427, /* SAMPLER1DARRAYSHADOW */
|
||||
ISAMPLER1D = 428, /* ISAMPLER1D */
|
||||
SAMPLER1DSHADOW = 429, /* SAMPLER1DSHADOW */
|
||||
SAMPLER2DRECT = 430, /* SAMPLER2DRECT */
|
||||
SAMPLER2DRECTSHADOW = 431, /* SAMPLER2DRECTSHADOW */
|
||||
ISAMPLER2DRECT = 432, /* ISAMPLER2DRECT */
|
||||
USAMPLER2DRECT = 433, /* USAMPLER2DRECT */
|
||||
SAMPLERBUFFER = 434, /* SAMPLERBUFFER */
|
||||
ISAMPLERBUFFER = 435, /* ISAMPLERBUFFER */
|
||||
USAMPLERBUFFER = 436, /* USAMPLERBUFFER */
|
||||
SAMPLER2DMS = 437, /* SAMPLER2DMS */
|
||||
ISAMPLER2DMS = 438, /* ISAMPLER2DMS */
|
||||
USAMPLER2DMS = 439, /* USAMPLER2DMS */
|
||||
SAMPLER2DMSARRAY = 440, /* SAMPLER2DMSARRAY */
|
||||
ISAMPLER2DMSARRAY = 441, /* ISAMPLER2DMSARRAY */
|
||||
USAMPLER2DMSARRAY = 442, /* USAMPLER2DMSARRAY */
|
||||
SAMPLEREXTERNALOES = 443, /* SAMPLEREXTERNALOES */
|
||||
SAMPLEREXTERNAL2DY2YEXT = 444, /* SAMPLEREXTERNAL2DY2YEXT */
|
||||
ISAMPLER1DARRAY = 445, /* ISAMPLER1DARRAY */
|
||||
USAMPLER1D = 446, /* USAMPLER1D */
|
||||
USAMPLER1DARRAY = 447, /* USAMPLER1DARRAY */
|
||||
F16SAMPLER1D = 448, /* F16SAMPLER1D */
|
||||
F16SAMPLER2D = 449, /* F16SAMPLER2D */
|
||||
F16SAMPLER3D = 450, /* F16SAMPLER3D */
|
||||
F16SAMPLER2DRECT = 451, /* F16SAMPLER2DRECT */
|
||||
F16SAMPLERCUBE = 452, /* F16SAMPLERCUBE */
|
||||
F16SAMPLER1DARRAY = 453, /* F16SAMPLER1DARRAY */
|
||||
F16SAMPLER2DARRAY = 454, /* F16SAMPLER2DARRAY */
|
||||
F16SAMPLERCUBEARRAY = 455, /* F16SAMPLERCUBEARRAY */
|
||||
F16SAMPLERBUFFER = 456, /* F16SAMPLERBUFFER */
|
||||
F16SAMPLER2DMS = 457, /* F16SAMPLER2DMS */
|
||||
F16SAMPLER2DMSARRAY = 458, /* F16SAMPLER2DMSARRAY */
|
||||
F16SAMPLER1DSHADOW = 459, /* F16SAMPLER1DSHADOW */
|
||||
F16SAMPLER2DSHADOW = 460, /* F16SAMPLER2DSHADOW */
|
||||
F16SAMPLER1DARRAYSHADOW = 461, /* F16SAMPLER1DARRAYSHADOW */
|
||||
F16SAMPLER2DARRAYSHADOW = 462, /* F16SAMPLER2DARRAYSHADOW */
|
||||
F16SAMPLER2DRECTSHADOW = 463, /* F16SAMPLER2DRECTSHADOW */
|
||||
F16SAMPLERCUBESHADOW = 464, /* F16SAMPLERCUBESHADOW */
|
||||
F16SAMPLERCUBEARRAYSHADOW = 465, /* F16SAMPLERCUBEARRAYSHADOW */
|
||||
IMAGE1D = 466, /* IMAGE1D */
|
||||
IIMAGE1D = 467, /* IIMAGE1D */
|
||||
UIMAGE1D = 468, /* UIMAGE1D */
|
||||
IMAGE2D = 469, /* IMAGE2D */
|
||||
IIMAGE2D = 470, /* IIMAGE2D */
|
||||
UIMAGE2D = 471, /* UIMAGE2D */
|
||||
IMAGE3D = 472, /* IMAGE3D */
|
||||
IIMAGE3D = 473, /* IIMAGE3D */
|
||||
UIMAGE3D = 474, /* UIMAGE3D */
|
||||
IMAGE2DRECT = 475, /* IMAGE2DRECT */
|
||||
IIMAGE2DRECT = 476, /* IIMAGE2DRECT */
|
||||
UIMAGE2DRECT = 477, /* UIMAGE2DRECT */
|
||||
IMAGECUBE = 478, /* IMAGECUBE */
|
||||
IIMAGECUBE = 479, /* IIMAGECUBE */
|
||||
UIMAGECUBE = 480, /* UIMAGECUBE */
|
||||
IMAGEBUFFER = 481, /* IMAGEBUFFER */
|
||||
IIMAGEBUFFER = 482, /* IIMAGEBUFFER */
|
||||
UIMAGEBUFFER = 483, /* UIMAGEBUFFER */
|
||||
IMAGE1DARRAY = 484, /* IMAGE1DARRAY */
|
||||
IIMAGE1DARRAY = 485, /* IIMAGE1DARRAY */
|
||||
UIMAGE1DARRAY = 486, /* UIMAGE1DARRAY */
|
||||
IMAGE2DARRAY = 487, /* IMAGE2DARRAY */
|
||||
IIMAGE2DARRAY = 488, /* IIMAGE2DARRAY */
|
||||
UIMAGE2DARRAY = 489, /* UIMAGE2DARRAY */
|
||||
IMAGECUBEARRAY = 490, /* IMAGECUBEARRAY */
|
||||
IIMAGECUBEARRAY = 491, /* IIMAGECUBEARRAY */
|
||||
UIMAGECUBEARRAY = 492, /* UIMAGECUBEARRAY */
|
||||
IMAGE2DMS = 493, /* IMAGE2DMS */
|
||||
IIMAGE2DMS = 494, /* IIMAGE2DMS */
|
||||
UIMAGE2DMS = 495, /* UIMAGE2DMS */
|
||||
IMAGE2DMSARRAY = 496, /* IMAGE2DMSARRAY */
|
||||
IIMAGE2DMSARRAY = 497, /* IIMAGE2DMSARRAY */
|
||||
UIMAGE2DMSARRAY = 498, /* UIMAGE2DMSARRAY */
|
||||
F16IMAGE1D = 499, /* F16IMAGE1D */
|
||||
F16IMAGE2D = 500, /* F16IMAGE2D */
|
||||
F16IMAGE3D = 501, /* F16IMAGE3D */
|
||||
F16IMAGE2DRECT = 502, /* F16IMAGE2DRECT */
|
||||
F16IMAGECUBE = 503, /* F16IMAGECUBE */
|
||||
F16IMAGE1DARRAY = 504, /* F16IMAGE1DARRAY */
|
||||
F16IMAGE2DARRAY = 505, /* F16IMAGE2DARRAY */
|
||||
F16IMAGECUBEARRAY = 506, /* F16IMAGECUBEARRAY */
|
||||
F16IMAGEBUFFER = 507, /* F16IMAGEBUFFER */
|
||||
F16IMAGE2DMS = 508, /* F16IMAGE2DMS */
|
||||
F16IMAGE2DMSARRAY = 509, /* F16IMAGE2DMSARRAY */
|
||||
I64IMAGE1D = 510, /* I64IMAGE1D */
|
||||
U64IMAGE1D = 511, /* U64IMAGE1D */
|
||||
I64IMAGE2D = 512, /* I64IMAGE2D */
|
||||
U64IMAGE2D = 513, /* U64IMAGE2D */
|
||||
I64IMAGE3D = 514, /* I64IMAGE3D */
|
||||
U64IMAGE3D = 515, /* U64IMAGE3D */
|
||||
I64IMAGE2DRECT = 516, /* I64IMAGE2DRECT */
|
||||
U64IMAGE2DRECT = 517, /* U64IMAGE2DRECT */
|
||||
I64IMAGECUBE = 518, /* I64IMAGECUBE */
|
||||
U64IMAGECUBE = 519, /* U64IMAGECUBE */
|
||||
I64IMAGEBUFFER = 520, /* I64IMAGEBUFFER */
|
||||
U64IMAGEBUFFER = 521, /* U64IMAGEBUFFER */
|
||||
I64IMAGE1DARRAY = 522, /* I64IMAGE1DARRAY */
|
||||
U64IMAGE1DARRAY = 523, /* U64IMAGE1DARRAY */
|
||||
I64IMAGE2DARRAY = 524, /* I64IMAGE2DARRAY */
|
||||
U64IMAGE2DARRAY = 525, /* U64IMAGE2DARRAY */
|
||||
I64IMAGECUBEARRAY = 526, /* I64IMAGECUBEARRAY */
|
||||
U64IMAGECUBEARRAY = 527, /* U64IMAGECUBEARRAY */
|
||||
I64IMAGE2DMS = 528, /* I64IMAGE2DMS */
|
||||
U64IMAGE2DMS = 529, /* U64IMAGE2DMS */
|
||||
I64IMAGE2DMSARRAY = 530, /* I64IMAGE2DMSARRAY */
|
||||
U64IMAGE2DMSARRAY = 531, /* U64IMAGE2DMSARRAY */
|
||||
TEXTURECUBEARRAY = 532, /* TEXTURECUBEARRAY */
|
||||
ITEXTURECUBEARRAY = 533, /* ITEXTURECUBEARRAY */
|
||||
UTEXTURECUBEARRAY = 534, /* UTEXTURECUBEARRAY */
|
||||
TEXTURE1D = 535, /* TEXTURE1D */
|
||||
ITEXTURE1D = 536, /* ITEXTURE1D */
|
||||
UTEXTURE1D = 537, /* UTEXTURE1D */
|
||||
TEXTURE1DARRAY = 538, /* TEXTURE1DARRAY */
|
||||
ITEXTURE1DARRAY = 539, /* ITEXTURE1DARRAY */
|
||||
UTEXTURE1DARRAY = 540, /* UTEXTURE1DARRAY */
|
||||
TEXTURE2DRECT = 541, /* TEXTURE2DRECT */
|
||||
ITEXTURE2DRECT = 542, /* ITEXTURE2DRECT */
|
||||
UTEXTURE2DRECT = 543, /* UTEXTURE2DRECT */
|
||||
TEXTUREBUFFER = 544, /* TEXTUREBUFFER */
|
||||
ITEXTUREBUFFER = 545, /* ITEXTUREBUFFER */
|
||||
UTEXTUREBUFFER = 546, /* UTEXTUREBUFFER */
|
||||
TEXTURE2DMS = 547, /* TEXTURE2DMS */
|
||||
ITEXTURE2DMS = 548, /* ITEXTURE2DMS */
|
||||
UTEXTURE2DMS = 549, /* UTEXTURE2DMS */
|
||||
TEXTURE2DMSARRAY = 550, /* TEXTURE2DMSARRAY */
|
||||
ITEXTURE2DMSARRAY = 551, /* ITEXTURE2DMSARRAY */
|
||||
UTEXTURE2DMSARRAY = 552, /* UTEXTURE2DMSARRAY */
|
||||
F16TEXTURE1D = 553, /* F16TEXTURE1D */
|
||||
F16TEXTURE2D = 554, /* F16TEXTURE2D */
|
||||
F16TEXTURE3D = 555, /* F16TEXTURE3D */
|
||||
F16TEXTURE2DRECT = 556, /* F16TEXTURE2DRECT */
|
||||
F16TEXTURECUBE = 557, /* F16TEXTURECUBE */
|
||||
F16TEXTURE1DARRAY = 558, /* F16TEXTURE1DARRAY */
|
||||
F16TEXTURE2DARRAY = 559, /* F16TEXTURE2DARRAY */
|
||||
F16TEXTURECUBEARRAY = 560, /* F16TEXTURECUBEARRAY */
|
||||
F16TEXTUREBUFFER = 561, /* F16TEXTUREBUFFER */
|
||||
F16TEXTURE2DMS = 562, /* F16TEXTURE2DMS */
|
||||
F16TEXTURE2DMSARRAY = 563, /* F16TEXTURE2DMSARRAY */
|
||||
SUBPASSINPUT = 564, /* SUBPASSINPUT */
|
||||
SUBPASSINPUTMS = 565, /* SUBPASSINPUTMS */
|
||||
ISUBPASSINPUT = 566, /* ISUBPASSINPUT */
|
||||
ISUBPASSINPUTMS = 567, /* ISUBPASSINPUTMS */
|
||||
USUBPASSINPUT = 568, /* USUBPASSINPUT */
|
||||
USUBPASSINPUTMS = 569, /* USUBPASSINPUTMS */
|
||||
F16SUBPASSINPUT = 570, /* F16SUBPASSINPUT */
|
||||
F16SUBPASSINPUTMS = 571, /* F16SUBPASSINPUTMS */
|
||||
SPIRV_INSTRUCTION = 572, /* SPIRV_INSTRUCTION */
|
||||
SPIRV_EXECUTION_MODE = 573, /* SPIRV_EXECUTION_MODE */
|
||||
SPIRV_EXECUTION_MODE_ID = 574, /* SPIRV_EXECUTION_MODE_ID */
|
||||
SPIRV_DECORATE = 575, /* SPIRV_DECORATE */
|
||||
SPIRV_DECORATE_ID = 576, /* SPIRV_DECORATE_ID */
|
||||
SPIRV_DECORATE_STRING = 577, /* SPIRV_DECORATE_STRING */
|
||||
SPIRV_TYPE = 578, /* SPIRV_TYPE */
|
||||
SPIRV_STORAGE_CLASS = 579, /* SPIRV_STORAGE_CLASS */
|
||||
SPIRV_BY_REFERENCE = 580, /* SPIRV_BY_REFERENCE */
|
||||
SPIRV_LITERAL = 581, /* SPIRV_LITERAL */
|
||||
LEFT_OP = 582, /* LEFT_OP */
|
||||
RIGHT_OP = 583, /* RIGHT_OP */
|
||||
INC_OP = 584, /* INC_OP */
|
||||
DEC_OP = 585, /* DEC_OP */
|
||||
LE_OP = 586, /* LE_OP */
|
||||
GE_OP = 587, /* GE_OP */
|
||||
EQ_OP = 588, /* EQ_OP */
|
||||
NE_OP = 589, /* NE_OP */
|
||||
AND_OP = 590, /* AND_OP */
|
||||
OR_OP = 591, /* OR_OP */
|
||||
XOR_OP = 592, /* XOR_OP */
|
||||
MUL_ASSIGN = 593, /* MUL_ASSIGN */
|
||||
DIV_ASSIGN = 594, /* DIV_ASSIGN */
|
||||
ADD_ASSIGN = 595, /* ADD_ASSIGN */
|
||||
MOD_ASSIGN = 596, /* MOD_ASSIGN */
|
||||
LEFT_ASSIGN = 597, /* LEFT_ASSIGN */
|
||||
RIGHT_ASSIGN = 598, /* RIGHT_ASSIGN */
|
||||
AND_ASSIGN = 599, /* AND_ASSIGN */
|
||||
XOR_ASSIGN = 600, /* XOR_ASSIGN */
|
||||
OR_ASSIGN = 601, /* OR_ASSIGN */
|
||||
SUB_ASSIGN = 602, /* SUB_ASSIGN */
|
||||
STRING_LITERAL = 603, /* STRING_LITERAL */
|
||||
LEFT_PAREN = 604, /* LEFT_PAREN */
|
||||
RIGHT_PAREN = 605, /* RIGHT_PAREN */
|
||||
LEFT_BRACKET = 606, /* LEFT_BRACKET */
|
||||
RIGHT_BRACKET = 607, /* RIGHT_BRACKET */
|
||||
LEFT_BRACE = 608, /* LEFT_BRACE */
|
||||
RIGHT_BRACE = 609, /* RIGHT_BRACE */
|
||||
DOT = 610, /* DOT */
|
||||
COMMA = 611, /* COMMA */
|
||||
COLON = 612, /* COLON */
|
||||
EQUAL = 613, /* EQUAL */
|
||||
SEMICOLON = 614, /* SEMICOLON */
|
||||
BANG = 615, /* BANG */
|
||||
DASH = 616, /* DASH */
|
||||
TILDE = 617, /* TILDE */
|
||||
PLUS = 618, /* PLUS */
|
||||
STAR = 619, /* STAR */
|
||||
SLASH = 620, /* SLASH */
|
||||
PERCENT = 621, /* PERCENT */
|
||||
LEFT_ANGLE = 622, /* LEFT_ANGLE */
|
||||
RIGHT_ANGLE = 623, /* RIGHT_ANGLE */
|
||||
VERTICAL_BAR = 624, /* VERTICAL_BAR */
|
||||
CARET = 625, /* CARET */
|
||||
AMPERSAND = 626, /* AMPERSAND */
|
||||
QUESTION = 627, /* QUESTION */
|
||||
INVARIANT = 628, /* INVARIANT */
|
||||
HIGH_PRECISION = 629, /* HIGH_PRECISION */
|
||||
MEDIUM_PRECISION = 630, /* MEDIUM_PRECISION */
|
||||
LOW_PRECISION = 631, /* LOW_PRECISION */
|
||||
PRECISION = 632, /* PRECISION */
|
||||
PACKED = 633, /* PACKED */
|
||||
RESOURCE = 634, /* RESOURCE */
|
||||
SUPERP = 635, /* SUPERP */
|
||||
FLOATCONSTANT = 636, /* FLOATCONSTANT */
|
||||
INTCONSTANT = 637, /* INTCONSTANT */
|
||||
UINTCONSTANT = 638, /* UINTCONSTANT */
|
||||
BOOLCONSTANT = 639, /* BOOLCONSTANT */
|
||||
IDENTIFIER = 640, /* IDENTIFIER */
|
||||
TYPE_NAME = 641, /* TYPE_NAME */
|
||||
CENTROID = 642, /* CENTROID */
|
||||
IN = 643, /* IN */
|
||||
OUT = 644, /* OUT */
|
||||
INOUT = 645, /* INOUT */
|
||||
STRUCT = 646, /* STRUCT */
|
||||
VOID = 647, /* VOID */
|
||||
WHILE = 648, /* WHILE */
|
||||
BREAK = 649, /* BREAK */
|
||||
CONTINUE = 650, /* CONTINUE */
|
||||
DO = 651, /* DO */
|
||||
ELSE = 652, /* ELSE */
|
||||
FOR = 653, /* FOR */
|
||||
IF = 654, /* IF */
|
||||
DISCARD = 655, /* DISCARD */
|
||||
RETURN = 656, /* RETURN */
|
||||
SWITCH = 657, /* SWITCH */
|
||||
CASE = 658, /* CASE */
|
||||
DEFAULT = 659, /* DEFAULT */
|
||||
TERMINATE_INVOCATION = 660, /* TERMINATE_INVOCATION */
|
||||
TERMINATE_RAY = 661, /* TERMINATE_RAY */
|
||||
IGNORE_INTERSECTION = 662, /* IGNORE_INTERSECTION */
|
||||
UNIFORM = 663, /* UNIFORM */
|
||||
SHARED = 664, /* SHARED */
|
||||
BUFFER = 665, /* BUFFER */
|
||||
FLAT = 666, /* FLAT */
|
||||
SMOOTH = 667, /* SMOOTH */
|
||||
LAYOUT = 668, /* LAYOUT */
|
||||
DOUBLECONSTANT = 669, /* DOUBLECONSTANT */
|
||||
INT16CONSTANT = 670, /* INT16CONSTANT */
|
||||
UINT16CONSTANT = 671, /* UINT16CONSTANT */
|
||||
FLOAT16CONSTANT = 672, /* FLOAT16CONSTANT */
|
||||
INT32CONSTANT = 673, /* INT32CONSTANT */
|
||||
UINT32CONSTANT = 674, /* UINT32CONSTANT */
|
||||
INT64CONSTANT = 675, /* INT64CONSTANT */
|
||||
UINT64CONSTANT = 676, /* UINT64CONSTANT */
|
||||
SUBROUTINE = 677, /* SUBROUTINE */
|
||||
DEMOTE = 678, /* DEMOTE */
|
||||
PAYLOADNV = 679, /* PAYLOADNV */
|
||||
PAYLOADINNV = 680, /* PAYLOADINNV */
|
||||
HITATTRNV = 681, /* HITATTRNV */
|
||||
CALLDATANV = 682, /* CALLDATANV */
|
||||
CALLDATAINNV = 683, /* CALLDATAINNV */
|
||||
PAYLOADEXT = 684, /* PAYLOADEXT */
|
||||
PAYLOADINEXT = 685, /* PAYLOADINEXT */
|
||||
HITATTREXT = 686, /* HITATTREXT */
|
||||
CALLDATAEXT = 687, /* CALLDATAEXT */
|
||||
CALLDATAINEXT = 688, /* CALLDATAINEXT */
|
||||
PATCH = 689, /* PATCH */
|
||||
SAMPLE = 690, /* SAMPLE */
|
||||
NONUNIFORM = 691, /* NONUNIFORM */
|
||||
COHERENT = 692, /* COHERENT */
|
||||
VOLATILE = 693, /* VOLATILE */
|
||||
RESTRICT = 694, /* RESTRICT */
|
||||
READONLY = 695, /* READONLY */
|
||||
WRITEONLY = 696, /* WRITEONLY */
|
||||
DEVICECOHERENT = 697, /* DEVICECOHERENT */
|
||||
QUEUEFAMILYCOHERENT = 698, /* QUEUEFAMILYCOHERENT */
|
||||
WORKGROUPCOHERENT = 699, /* WORKGROUPCOHERENT */
|
||||
SUBGROUPCOHERENT = 700, /* SUBGROUPCOHERENT */
|
||||
NONPRIVATE = 701, /* NONPRIVATE */
|
||||
SHADERCALLCOHERENT = 702, /* SHADERCALLCOHERENT */
|
||||
NOPERSPECTIVE = 703, /* NOPERSPECTIVE */
|
||||
EXPLICITINTERPAMD = 704, /* EXPLICITINTERPAMD */
|
||||
PERVERTEXEXT = 705, /* PERVERTEXEXT */
|
||||
PERVERTEXNV = 706, /* PERVERTEXNV */
|
||||
PERPRIMITIVENV = 707, /* PERPRIMITIVENV */
|
||||
PERVIEWNV = 708, /* PERVIEWNV */
|
||||
PERTASKNV = 709, /* PERTASKNV */
|
||||
PERPRIMITIVEEXT = 710, /* PERPRIMITIVEEXT */
|
||||
TASKPAYLOADWORKGROUPEXT = 711, /* TASKPAYLOADWORKGROUPEXT */
|
||||
PRECISE = 712 /* PRECISE */
|
||||
};
|
||||
typedef enum yytokentype yytoken_kind_t;
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 97 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
||||
#line 97 "MachineIndependent/glslang.y"
|
||||
|
||||
struct {
|
||||
glslang::TSourceLoc loc;
|
||||
|
@ -493,6 +540,9 @@ union YYSTYPE
|
|||
glslang::TIntermNodePair nodePair;
|
||||
glslang::TIntermTyped* intermTypedNode;
|
||||
glslang::TAttributes* attributes;
|
||||
glslang::TSpirvRequirement* spirvReq;
|
||||
glslang::TSpirvInstruction* spirvInst;
|
||||
glslang::TSpirvTypeParameters* spirvTypeParams;
|
||||
};
|
||||
union {
|
||||
glslang::TPublicType type;
|
||||
|
@ -506,9 +556,9 @@ union YYSTYPE
|
|||
glslang::TArraySizes* typeParameters;
|
||||
} interm;
|
||||
|
||||
#line 510 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||
};
|
||||
#line 560 "MachineIndependent/glslang_tab.cpp.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
|
|
@ -48,37 +48,6 @@
|
|||
#endif
|
||||
#include <cstdint>
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsInfinity(double x) {
|
||||
#ifdef _MSC_VER
|
||||
switch (_fpclass(x)) {
|
||||
case _FPCLASS_NINF:
|
||||
case _FPCLASS_PINF:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return std::isinf(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsNan(double x) {
|
||||
#ifdef _MSC_VER
|
||||
switch (_fpclass(x)) {
|
||||
case _FPCLASS_SNAN:
|
||||
case _FPCLASS_QNAN:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return std::isnan(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace glslang {
|
||||
|
||||
|
@ -438,6 +407,9 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpConvUint64ToPtr: out.debug << "Convert uint64_t to pointer"; break;
|
||||
case EOpConvPtrToUint64: out.debug << "Convert pointer to uint64_t"; break;
|
||||
|
||||
case EOpConvUint64ToAccStruct: out.debug << "Convert uint64_t to acceleration structure"; break;
|
||||
case EOpConvUvec2ToAccStruct: out.debug << "Convert uvec2 to acceleration strucuture "; break;
|
||||
|
||||
case EOpRadians: out.debug << "radians"; break;
|
||||
case EOpDegrees: out.debug << "degrees"; break;
|
||||
case EOpSin: out.debug << "sine"; break;
|
||||
|
@ -693,6 +665,12 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
|
||||
case EOpConstructReference: out.debug << "Construct reference type"; break;
|
||||
|
||||
case EOpDeclare: out.debug << "Declare"; break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
|
||||
#endif
|
||||
|
||||
default: out.debug.message(EPrefixError, "Bad unary op");
|
||||
}
|
||||
|
||||
|
@ -716,6 +694,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
|
||||
switch (node->getOp()) {
|
||||
case EOpSequence: out.debug << "Sequence\n"; return true;
|
||||
case EOpScope: out.debug << "Scope\n"; return true;
|
||||
case EOpLinkerObjects: out.debug << "Linker Objects\n"; return true;
|
||||
case EOpComma: out.debug << "Comma"; break;
|
||||
case EOpFunction: out.debug << "Function Definition: " << node->getName(); break;
|
||||
|
@ -829,6 +808,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpConstructTextureSampler: out.debug << "Construct combined texture-sampler"; break;
|
||||
case EOpConstructReference: out.debug << "Construct reference"; break;
|
||||
case EOpConstructCooperativeMatrix: out.debug << "Construct cooperative matrix"; break;
|
||||
case EOpConstructAccStruct: out.debug << "Construct acceleration structure"; break;
|
||||
|
||||
case EOpLessThan: out.debug << "Compare Less Than"; break;
|
||||
case EOpGreaterThan: out.debug << "Compare Greater Than"; break;
|
||||
|
@ -882,6 +862,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpTime: out.debug << "time"; break;
|
||||
|
||||
case EOpAtomicAdd: out.debug << "AtomicAdd"; break;
|
||||
case EOpAtomicSubtract: out.debug << "AtomicSubtract"; break;
|
||||
case EOpAtomicMin: out.debug << "AtomicMin"; break;
|
||||
case EOpAtomicMax: out.debug << "AtomicMax"; break;
|
||||
case EOpAtomicAnd: out.debug << "AtomicAnd"; break;
|
||||
|
@ -1079,12 +1060,19 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
||||
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
||||
|
||||
case EOpTrace: out.debug << "traceNV"; break;
|
||||
case EOpTraceNV: out.debug << "traceNV"; break;
|
||||
case EOpTraceRayMotionNV: out.debug << "traceRayMotionNV"; break;
|
||||
case EOpTraceKHR: out.debug << "traceRayKHR"; break;
|
||||
case EOpReportIntersection: out.debug << "reportIntersectionNV"; break;
|
||||
case EOpIgnoreIntersection: out.debug << "ignoreIntersectionNV"; break;
|
||||
case EOpTerminateRay: out.debug << "terminateRayNV"; break;
|
||||
case EOpExecuteCallable: out.debug << "executeCallableNV"; break;
|
||||
case EOpIgnoreIntersectionNV: out.debug << "ignoreIntersectionNV"; break;
|
||||
case EOpIgnoreIntersectionKHR: out.debug << "ignoreIntersectionKHR"; break;
|
||||
case EOpTerminateRayNV: out.debug << "terminateRayNV"; break;
|
||||
case EOpTerminateRayKHR: out.debug << "terminateRayKHR"; break;
|
||||
case EOpExecuteCallableNV: out.debug << "executeCallableNV"; break;
|
||||
case EOpExecuteCallableKHR: out.debug << "executeCallableKHR"; break;
|
||||
case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break;
|
||||
case EOpEmitMeshTasksEXT: out.debug << "EmitMeshTasksEXT"; break;
|
||||
case EOpSetMeshOutputsEXT: out.debug << "SetMeshOutputsEXT"; break;
|
||||
|
||||
case EOpRayQueryInitialize: out.debug << "rayQueryInitializeEXT"; break;
|
||||
case EOpRayQueryTerminate: out.debug << "rayQueryTerminateEXT"; break;
|
||||
|
@ -1117,10 +1105,14 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpIsHelperInvocation: out.debug << "IsHelperInvocation"; break;
|
||||
case EOpDebugPrintf: out.debug << "Debug printf"; break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
|
||||
#endif
|
||||
|
||||
default: out.debug.message(EPrefixError, "Bad aggregation op");
|
||||
}
|
||||
|
||||
if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
|
||||
if (node->getOp() != EOpSequence && node->getOp() != EOpScope && node->getOp() != EOpParameters)
|
||||
out.debug << " (" << node->getCompleteString() << ")";
|
||||
|
||||
out.debug << "\n";
|
||||
|
@ -1321,6 +1313,9 @@ static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const
|
|||
out.debug << buf << "\n";
|
||||
}
|
||||
break;
|
||||
case EbtString:
|
||||
out.debug << "\"" << constUnion[i].getSConst()->c_str() << "\"\n";
|
||||
break;
|
||||
default:
|
||||
out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc());
|
||||
break;
|
||||
|
@ -1406,14 +1401,17 @@ bool TOutputTraverser::visitBranch(TVisit /* visit*/, TIntermBranch* node)
|
|||
OutputTreeText(out, node, depth);
|
||||
|
||||
switch (node->getFlowOp()) {
|
||||
case EOpKill: out.debug << "Branch: Kill"; break;
|
||||
case EOpBreak: out.debug << "Branch: Break"; break;
|
||||
case EOpContinue: out.debug << "Branch: Continue"; break;
|
||||
case EOpReturn: out.debug << "Branch: Return"; break;
|
||||
case EOpCase: out.debug << "case: "; break;
|
||||
case EOpDemote: out.debug << "Demote"; break;
|
||||
case EOpDefault: out.debug << "default: "; break;
|
||||
default: out.debug << "Branch: Unknown Branch"; break;
|
||||
case EOpKill: out.debug << "Branch: Kill"; break;
|
||||
case EOpTerminateInvocation: out.debug << "Branch: TerminateInvocation"; break;
|
||||
case EOpIgnoreIntersectionKHR: out.debug << "Branch: IgnoreIntersectionKHR"; break;
|
||||
case EOpTerminateRayKHR: out.debug << "Branch: TerminateRayKHR"; break;
|
||||
case EOpBreak: out.debug << "Branch: Break"; break;
|
||||
case EOpContinue: out.debug << "Branch: Continue"; break;
|
||||
case EOpReturn: out.debug << "Branch: Return"; break;
|
||||
case EOpCase: out.debug << "case: "; break;
|
||||
case EOpDemote: out.debug << "Demote"; break;
|
||||
case EOpDefault: out.debug << "default: "; break;
|
||||
default: out.debug << "Branch: Unknown Branch"; break;
|
||||
}
|
||||
|
||||
if (node->getExpression()) {
|
||||
|
@ -1472,6 +1470,9 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
|||
if (xfbMode)
|
||||
infoSink.debug << "in xfb mode\n";
|
||||
|
||||
if (getSubgroupUniformControlFlow())
|
||||
infoSink.debug << "subgroup_uniform_control_flow\n";
|
||||
|
||||
switch (language) {
|
||||
case EShLangVertex:
|
||||
break;
|
||||
|
@ -1526,12 +1527,12 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
|||
infoSink.debug << "interlock ordering = " << TQualifier::getInterlockOrderingString(interlockOrdering) << "\n";
|
||||
break;
|
||||
|
||||
case EShLangMeshNV:
|
||||
case EShLangMesh:
|
||||
infoSink.debug << "max_vertices = " << vertices << "\n";
|
||||
infoSink.debug << "max_primitives = " << primitives << "\n";
|
||||
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
|
||||
// Fall through
|
||||
case EShLangTaskNV:
|
||||
case EShLangTask:
|
||||
// Fall through
|
||||
case EShLangCompute:
|
||||
infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n";
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -52,7 +52,7 @@ namespace glslang {
|
|||
|
||||
class TIntermediate;
|
||||
struct TVarEntryInfo {
|
||||
int id;
|
||||
long long id;
|
||||
TIntermSymbol* symbol;
|
||||
bool live;
|
||||
int newBinding;
|
||||
|
@ -61,6 +61,15 @@ struct TVarEntryInfo {
|
|||
int newComponent;
|
||||
int newIndex;
|
||||
EShLanguage stage;
|
||||
|
||||
void clearNewAssignments() {
|
||||
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; }
|
||||
};
|
||||
|
@ -87,6 +96,35 @@ struct TVarEntryInfo {
|
|||
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;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Base class for shared TIoMapResolver services, used by several derivations.
|
||||
|
@ -107,8 +145,8 @@ public:
|
|||
void endCollect(EShLanguage) override {}
|
||||
void reserverResourceSlot(TVarEntryInfo& /*ent*/, TInfoSink& /*infoSink*/) override {}
|
||||
void reserverStorageSlot(TVarEntryInfo& /*ent*/, TInfoSink& /*infoSink*/) override {}
|
||||
int getBaseBinding(TResourceType res, unsigned int set) const;
|
||||
const std::vector<std::string>& getResourceSetBinding() const;
|
||||
int getBaseBinding(EShLanguage stage, TResourceType res, unsigned int set) const;
|
||||
const std::vector<std::string>& getResourceSetBinding(EShLanguage stage) const;
|
||||
virtual TResourceType getResourceType(const glslang::TType& type) = 0;
|
||||
bool doAutoBindingMapping() const;
|
||||
bool doAutoLocationMapping() const;
|
||||
|
@ -122,9 +160,11 @@ public:
|
|||
int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) override;
|
||||
int resolveInOutComponent(EShLanguage /*stage*/, TVarEntryInfo& ent) override;
|
||||
int resolveInOutIndex(EShLanguage /*stage*/, TVarEntryInfo& ent) override;
|
||||
void addStage(EShLanguage stage) override {
|
||||
if (stage < EShLangCount)
|
||||
void addStage(EShLanguage stage, TIntermediate& stageIntermediate) override {
|
||||
if (stage < EShLangCount) {
|
||||
stageMask[stage] = true;
|
||||
stageIntermediates[stage] = &stageIntermediate;
|
||||
}
|
||||
}
|
||||
uint32_t computeTypeLocationSize(const TType& type, EShLanguage stage);
|
||||
|
||||
|
@ -134,11 +174,13 @@ public:
|
|||
protected:
|
||||
TDefaultIoResolverBase(TDefaultIoResolverBase&);
|
||||
TDefaultIoResolverBase& operator=(TDefaultIoResolverBase&);
|
||||
const TIntermediate& intermediate;
|
||||
const TIntermediate& referenceIntermediate;
|
||||
int nextUniformLocation;
|
||||
int nextInputLocation;
|
||||
int nextOutputLocation;
|
||||
bool stageMask[EShLangCount + 1];
|
||||
const TIntermediate* stageIntermediates[EShLangCount];
|
||||
|
||||
// Return descriptor set specific base if there is one, and the generic base otherwise.
|
||||
int selectBaseBinding(int base, int descriptorSetBase) const {
|
||||
return descriptorSetBase != -1 ? descriptorSetBase : base;
|
||||
|
@ -203,7 +245,6 @@ public:
|
|||
void endCollect(EShLanguage) override;
|
||||
void reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& infoSink) override;
|
||||
void reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& infoSink) override;
|
||||
const TString& getAccessName(const TIntermSymbol*);
|
||||
// in/out symbol and uniform symbol are stored in the same resourceSlotMap, the storage key is used to identify each type of symbol.
|
||||
// We use stage and storage qualifier to construct a storage key. it can help us identify the same storage resource used in different stage.
|
||||
// if a resource is a program resource and we don't need know it usage stage, we can use same stage to build storage key.
|
||||
|
@ -259,14 +300,18 @@ public:
|
|||
bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; }
|
||||
};
|
||||
|
||||
// I/O mapper for OpenGL
|
||||
// I/O mapper for GLSL
|
||||
class TGlslIoMapper : public TIoMapper {
|
||||
public:
|
||||
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);
|
||||
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++) {
|
||||
|
@ -286,6 +331,13 @@ public:
|
|||
intermediates[stage] = nullptr;
|
||||
}
|
||||
}
|
||||
// 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) {
|
||||
autoPushConstantBlockName = name;
|
||||
autoPushConstantMaxSize = maxSize;
|
||||
autoPushConstantBlockPacking = packing;
|
||||
}
|
||||
// grow the reflection stage by stage
|
||||
bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*) override;
|
||||
bool doMap(TIoMapResolver*, TInfoSink&) override;
|
||||
|
@ -293,6 +345,13 @@ public:
|
|||
*uniformVarMap[EShLangCount];
|
||||
TIntermediate* intermediates[EShLangCount];
|
||||
bool hadError = false;
|
||||
EProfile profile;
|
||||
int version;
|
||||
|
||||
private:
|
||||
TString autoPushConstantBlockName;
|
||||
unsigned int autoPushConstantMaxSize;
|
||||
TLayoutPacking autoPushConstantBlockPacking;
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
@ -63,14 +63,14 @@ namespace glslang {
|
|||
|
||||
class TInductiveTraverser : public TIntermTraverser {
|
||||
public:
|
||||
TInductiveTraverser(int id, TSymbolTable& st)
|
||||
TInductiveTraverser(long long id, TSymbolTable& st)
|
||||
: loopId(id), symbolTable(st), bad(false) { }
|
||||
|
||||
virtual bool visitBinary(TVisit, TIntermBinary* node);
|
||||
virtual bool visitUnary(TVisit, TIntermUnary* node);
|
||||
virtual bool visitAggregate(TVisit, TIntermAggregate* node);
|
||||
|
||||
int loopId; // unique ID of the symbol that's the loop inductive variable
|
||||
long long loopId; // unique ID of the symbol that's the loop inductive variable
|
||||
TSymbolTable& symbolTable;
|
||||
bool bad;
|
||||
TSourceLoc badLoc;
|
||||
|
@ -129,7 +129,7 @@ bool TInductiveTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* n
|
|||
//
|
||||
// External function to call for loop check.
|
||||
//
|
||||
void TParseContext::inductiveLoopBodyCheck(TIntermNode* body, int loopId, TSymbolTable& symbolTable)
|
||||
void TParseContext::inductiveLoopBodyCheck(TIntermNode* body, long long loopId, TSymbolTable& symbolTable)
|
||||
{
|
||||
TInductiveTraverser it(loopId, symbolTable);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -227,10 +227,10 @@ enum ComputeDerivativeMode {
|
|||
|
||||
class TIdMaps {
|
||||
public:
|
||||
TMap<TString, int>& operator[](int i) { return maps[i]; }
|
||||
const TMap<TString, int>& operator[](int i) const { return maps[i]; }
|
||||
TMap<TString, long long>& operator[](long long i) { return maps[i]; }
|
||||
const TMap<TString, long long>& operator[](long long i) const { return maps[i]; }
|
||||
private:
|
||||
TMap<TString, int> maps[EsiCount];
|
||||
TMap<TString, long long> maps[EsiCount];
|
||||
};
|
||||
|
||||
class TNumericFeatures {
|
||||
|
@ -259,6 +259,23 @@ private:
|
|||
unsigned int features;
|
||||
};
|
||||
|
||||
// MustBeAssigned wraps a T, asserting that it has been assigned with
|
||||
// operator =() before attempting to read with operator T() or operator ->().
|
||||
// Used to catch cases where fields are read before they have been assigned.
|
||||
template<typename T>
|
||||
class MustBeAssigned
|
||||
{
|
||||
public:
|
||||
MustBeAssigned() = default;
|
||||
MustBeAssigned(const T& v) : value(v) {}
|
||||
operator const T&() const { assert(isSet); return value; }
|
||||
const T* operator ->() const { assert(isSet); return &value; }
|
||||
MustBeAssigned& operator = (const T& v) { value = v; isSet = true; return *this; }
|
||||
private:
|
||||
T value;
|
||||
bool isSet = false;
|
||||
};
|
||||
|
||||
//
|
||||
// Set of helper functions to help parse and build the tree.
|
||||
//
|
||||
|
@ -270,11 +287,23 @@ public:
|
|||
profile(p), version(v),
|
||||
#endif
|
||||
treeRoot(0),
|
||||
resources(TBuiltInResource{}),
|
||||
numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false),
|
||||
invertY(false),
|
||||
dxPositionW(false),
|
||||
enhancedMsgs(false),
|
||||
debugInfo(false),
|
||||
useStorageBuffer(false),
|
||||
invariantAll(false),
|
||||
nanMinMaxClamp(false),
|
||||
depthReplacing(false)
|
||||
depthReplacing(false),
|
||||
stencilReplacing(false),
|
||||
uniqueId(0),
|
||||
globalUniformBlockName(""),
|
||||
atomicCounterBlockName(""),
|
||||
globalUniformBlockSet(TQualifier::layoutSetEnd),
|
||||
globalUniformBlockBinding(TQualifier::layoutBindingEnd),
|
||||
atomicCounterBlockSet(TQualifier::layoutSetEnd)
|
||||
#ifndef GLSLANG_WEB
|
||||
,
|
||||
implicitThisName("@this"), implicitCounterName("@count"),
|
||||
|
@ -282,9 +311,9 @@ public:
|
|||
useVulkanMemoryModel(false),
|
||||
invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet),
|
||||
inputPrimitive(ElgNone), outputPrimitive(ElgNone),
|
||||
pixelCenterInteger(false), originUpperLeft(false),
|
||||
pixelCenterInteger(false), originUpperLeft(false),texCoordBuiltinRedeclared(false),
|
||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false),
|
||||
postDepthCoverage(false), depthLayout(EldNone),
|
||||
postDepthCoverage(false), earlyAndLateFragmentTestsAMD(false), depthLayout(EldNone), stencilLayout(ElsNone),
|
||||
hlslFunctionality1(false),
|
||||
blendEquations(0), xfbMode(false), multiStream(false),
|
||||
layoutOverrideCoverage(false),
|
||||
|
@ -294,6 +323,7 @@ public:
|
|||
primitives(TQualifier::layoutNotSet),
|
||||
numTaskNVBlocks(0),
|
||||
layoutPrimitiveCulling(false),
|
||||
numTaskEXTPayloads(0),
|
||||
autoMapBindings(false),
|
||||
autoMapLocations(false),
|
||||
flattenUniformArrays(false),
|
||||
|
@ -304,7 +334,10 @@ public:
|
|||
textureSamplerTransformMode(EShTexSampTransKeep),
|
||||
needToLegalize(false),
|
||||
binaryDoubleOutput(false),
|
||||
subgroupUniformControlFlow(false),
|
||||
usePhysicalStorageBuffer(false),
|
||||
spirvRequirement(nullptr),
|
||||
spirvExecutionMode(nullptr),
|
||||
uniformLocationBase(0)
|
||||
#endif
|
||||
{
|
||||
|
@ -369,6 +402,9 @@ public:
|
|||
case EShTargetSpv_1_5:
|
||||
processes.addProcess("target-env spirv1.5");
|
||||
break;
|
||||
case EShTargetSpv_1_6:
|
||||
processes.addProcess("target-env spirv1.6");
|
||||
break;
|
||||
default:
|
||||
processes.addProcess("target-env spirvUnknown");
|
||||
break;
|
||||
|
@ -387,6 +423,9 @@ public:
|
|||
case EShTargetVulkan_1_2:
|
||||
processes.addProcess("target-env vulkan1.2");
|
||||
break;
|
||||
case EShTargetVulkan_1_3:
|
||||
processes.addProcess("target-env vulkan1.3");
|
||||
break;
|
||||
default:
|
||||
processes.addProcess("target-env vulkanUnknown");
|
||||
break;
|
||||
|
@ -398,6 +437,9 @@ public:
|
|||
EShLanguage getStage() const { return language; }
|
||||
void addRequestedExtension(const char* extension) { requestedExtensions.insert(extension); }
|
||||
const std::set<std::string>& getRequestedExtensions() const { return requestedExtensions; }
|
||||
bool isRayTracingStage() const {
|
||||
return language >= EShLangRayGen && language <= EShLangCallableNV;
|
||||
}
|
||||
|
||||
void setTreeRoot(TIntermNode* r) { treeRoot = r; }
|
||||
TIntermNode* getTreeRoot() const { return treeRoot; }
|
||||
|
@ -406,6 +448,7 @@ public:
|
|||
int getNumErrors() const { return numErrors; }
|
||||
void addPushConstantCount() { ++numPushConstants; }
|
||||
void setLimits(const TBuiltInResource& r) { resources = r; }
|
||||
const TBuiltInResource& getLimits() const { return resources; }
|
||||
|
||||
bool postProcess(TIntermNode*, EShLanguage);
|
||||
void removeTree();
|
||||
|
@ -420,6 +463,12 @@ public:
|
|||
const std::string& getEntryPointName() const { return entryPointName; }
|
||||
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
|
||||
|
||||
void setDebugInfo(bool debuginfo)
|
||||
{
|
||||
debugInfo = debuginfo;
|
||||
}
|
||||
bool getDebugInfo() const { return debugInfo; }
|
||||
|
||||
void setInvertY(bool invert)
|
||||
{
|
||||
invertY = invert;
|
||||
|
@ -428,6 +477,20 @@ public:
|
|||
}
|
||||
bool getInvertY() const { return invertY; }
|
||||
|
||||
void setDxPositionW(bool dxPosW)
|
||||
{
|
||||
dxPositionW = dxPosW;
|
||||
if (dxPositionW)
|
||||
processes.addProcess("dx-position-w");
|
||||
}
|
||||
bool getDxPositionW() const { return dxPositionW; }
|
||||
|
||||
void setEnhancedMsgs()
|
||||
{
|
||||
enhancedMsgs = true;
|
||||
}
|
||||
bool getEnhancedMsgs() const { return enhancedMsgs && getSource() == EShSourceGlsl; }
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
void setSource(EShSource s) { source = s; }
|
||||
EShSource getSource() const { return source; }
|
||||
|
@ -507,16 +570,34 @@ public:
|
|||
TIntermTyped* foldSwizzle(TIntermTyped* node, TSwizzleSelectors<TVectorSelector>& fields, const TSourceLoc&);
|
||||
|
||||
// Tree ops
|
||||
static const TIntermTyped* findLValueBase(const TIntermTyped*, bool swizzleOkay);
|
||||
static const TIntermTyped* findLValueBase(const TIntermTyped*, bool swizzleOkay , bool BufferReferenceOk = false);
|
||||
|
||||
// Linkage related
|
||||
void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
|
||||
void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&);
|
||||
TIntermAggregate* findLinkerObjects() const;
|
||||
|
||||
void setGlobalUniformBlockName(const char* name) { globalUniformBlockName = std::string(name); }
|
||||
const char* getGlobalUniformBlockName() const { return globalUniformBlockName.c_str(); }
|
||||
void setGlobalUniformSet(unsigned int set) { globalUniformBlockSet = set; }
|
||||
unsigned int getGlobalUniformSet() const { return globalUniformBlockSet; }
|
||||
void setGlobalUniformBinding(unsigned int binding) { globalUniformBlockBinding = binding; }
|
||||
unsigned int getGlobalUniformBinding() const { return globalUniformBlockBinding; }
|
||||
|
||||
void setAtomicCounterBlockName(const char* name) { atomicCounterBlockName = std::string(name); }
|
||||
const char* getAtomicCounterBlockName() const { return atomicCounterBlockName.c_str(); }
|
||||
void setAtomicCounterBlockSet(unsigned int set) { atomicCounterBlockSet = set; }
|
||||
unsigned int getAtomicCounterBlockSet() const { return atomicCounterBlockSet; }
|
||||
|
||||
|
||||
void setUseStorageBuffer() { useStorageBuffer = true; }
|
||||
bool usingStorageBuffer() const { return useStorageBuffer; }
|
||||
void setInvariantAll() { invariantAll = true; }
|
||||
bool isInvariantAll() const { return invariantAll; }
|
||||
void setDepthReplacing() { depthReplacing = true; }
|
||||
bool isDepthReplacing() const { return depthReplacing; }
|
||||
void setStencilReplacing() { stencilReplacing = true; }
|
||||
bool isStencilReplacing() const { return stencilReplacing; }
|
||||
bool setLocalSize(int dim, int size)
|
||||
{
|
||||
if (localSizeNotDefault[dim])
|
||||
|
@ -526,6 +607,11 @@ public:
|
|||
return true;
|
||||
}
|
||||
unsigned int getLocalSize(int dim) const { return localSize[dim]; }
|
||||
bool isLocalSizeSet() const
|
||||
{
|
||||
// Return true if any component has been set (i.e. any component is not default).
|
||||
return localSizeNotDefault[0] || localSizeNotDefault[1] || localSizeNotDefault[2];
|
||||
}
|
||||
bool setLocalSizeSpecId(int dim, int id)
|
||||
{
|
||||
if (localSizeSpecId[dim] != TQualifier::layoutNotSet)
|
||||
|
@ -534,6 +620,13 @@ public:
|
|||
return true;
|
||||
}
|
||||
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
|
||||
bool isLocalSizeSpecialized() const
|
||||
{
|
||||
// Return true if any component has been specialized.
|
||||
return localSizeSpecId[0] != TQualifier::layoutNotSet ||
|
||||
localSizeSpecId[1] != TQualifier::layoutNotSet ||
|
||||
localSizeSpecId[2] != TQualifier::layoutNotSet;
|
||||
}
|
||||
#ifdef GLSLANG_WEB
|
||||
void output(TInfoSink&, bool tree) { }
|
||||
|
||||
|
@ -554,6 +647,7 @@ public:
|
|||
int getNumPushConstants() const { return 0; }
|
||||
void addShaderRecordCount() { }
|
||||
void addTaskNVCount() { }
|
||||
void addTaskPayloadEXTCount() { }
|
||||
void setUseVulkanMemoryModel() { }
|
||||
bool usingVulkanMemoryModel() const { return false; }
|
||||
bool usingPhysicalStorageBuffer() const { return false; }
|
||||
|
@ -671,6 +765,7 @@ public:
|
|||
int getNumPushConstants() const { return numPushConstants; }
|
||||
void addShaderRecordCount() { ++numShaderRecordBlocks; }
|
||||
void addTaskNVCount() { ++numTaskNVBlocks; }
|
||||
void addTaskPayloadEXTCount() { ++numTaskEXTPayloads; }
|
||||
|
||||
bool setInvocations(int i)
|
||||
{
|
||||
|
@ -739,7 +834,9 @@ public:
|
|||
void setPostDepthCoverage() { postDepthCoverage = true; }
|
||||
bool getPostDepthCoverage() const { return postDepthCoverage; }
|
||||
void setEarlyFragmentTests() { earlyFragmentTests = true; }
|
||||
void setEarlyAndLateFragmentTestsAMD() { earlyAndLateFragmentTestsAMD = true; }
|
||||
bool getEarlyFragmentTests() const { return earlyFragmentTests; }
|
||||
bool getEarlyAndLateFragmentTestsAMD() const { return earlyAndLateFragmentTestsAMD; }
|
||||
bool setDepth(TLayoutDepth d)
|
||||
{
|
||||
if (depthLayout != EldNone)
|
||||
|
@ -747,11 +844,21 @@ public:
|
|||
depthLayout = d;
|
||||
return true;
|
||||
}
|
||||
bool setStencil(TLayoutStencil s)
|
||||
{
|
||||
if (stencilLayout != ElsNone)
|
||||
return stencilLayout == s;
|
||||
stencilLayout = s;
|
||||
return true;
|
||||
}
|
||||
TLayoutDepth getDepth() const { return depthLayout; }
|
||||
TLayoutStencil getStencil() const { return stencilLayout; }
|
||||
void setOriginUpperLeft() { originUpperLeft = true; }
|
||||
bool getOriginUpperLeft() const { return originUpperLeft; }
|
||||
void setPixelCenterInteger() { pixelCenterInteger = true; }
|
||||
bool getPixelCenterInteger() const { return pixelCenterInteger; }
|
||||
void setTexCoordRedeclared() { texCoordBuiltinRedeclared = true; }
|
||||
bool getTexCoordRedeclared() const { return texCoordBuiltinRedeclared; }
|
||||
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
|
||||
unsigned int getBlendEquations() const { return blendEquations; }
|
||||
bool setXfbBufferStride(int buffer, unsigned stride)
|
||||
|
@ -810,8 +917,34 @@ public:
|
|||
|
||||
void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
|
||||
bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
|
||||
|
||||
void setSubgroupUniformControlFlow() { subgroupUniformControlFlow = true; }
|
||||
bool getSubgroupUniformControlFlow() const { return subgroupUniformControlFlow; }
|
||||
|
||||
// GL_EXT_spirv_intrinsics
|
||||
void insertSpirvRequirement(const TSpirvRequirement* spirvReq);
|
||||
bool hasSpirvRequirement() const { return spirvRequirement != nullptr; }
|
||||
const TSpirvRequirement& getSpirvRequirement() const { return *spirvRequirement; }
|
||||
void insertSpirvExecutionMode(int executionMode, const TIntermAggregate* args = nullptr);
|
||||
void insertSpirvExecutionModeId(int executionMode, const TIntermAggregate* args);
|
||||
bool hasSpirvExecutionMode() const { return spirvExecutionMode != nullptr; }
|
||||
const TSpirvExecutionMode& getSpirvExecutionMode() const { return *spirvExecutionMode; }
|
||||
#endif // GLSLANG_WEB
|
||||
|
||||
void addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing)
|
||||
{
|
||||
std::string name(nameStr);
|
||||
blockBackingOverrides[name] = backing;
|
||||
}
|
||||
TBlockStorageClass getBlockStorageOverride(const char* nameStr) const
|
||||
{
|
||||
std::string name = nameStr;
|
||||
auto pos = blockBackingOverrides.find(name);
|
||||
if (pos == blockBackingOverrides.end())
|
||||
return EbsNone;
|
||||
else
|
||||
return pos->second;
|
||||
}
|
||||
#ifdef ENABLE_HLSL
|
||||
void setHlslFunctionality1() { hlslFunctionality1 = true; }
|
||||
bool getHlslFunctionality1() const { return hlslFunctionality1; }
|
||||
|
@ -835,10 +968,27 @@ public:
|
|||
bool usingHlslIoMapping() { return false; }
|
||||
#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;
|
||||
}
|
||||
|
||||
bool IsRequestedExtension(const char* extension) const
|
||||
{
|
||||
return (requestedExtensions.find(extension) != requestedExtensions.end());
|
||||
}
|
||||
|
||||
void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
|
||||
void merge(TInfoSink&, TIntermediate&);
|
||||
void finalCheck(TInfoSink&, bool keepUncalled);
|
||||
|
||||
void mergeGlobalUniformBlocks(TInfoSink& infoSink, TIntermediate& unit, bool mergeExistingOnly);
|
||||
void mergeUniformObjects(TInfoSink& infoSink, TIntermediate& unit);
|
||||
void checkStageIO(TInfoSink&, TIntermediate&);
|
||||
|
||||
bool buildConvertOp(TBasicType dst, TBasicType src, TOperator& convertOp) const;
|
||||
TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const;
|
||||
|
||||
|
@ -847,6 +997,7 @@ public:
|
|||
|
||||
int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision);
|
||||
int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision);
|
||||
int checkLocationRT(int set, int location);
|
||||
int addUsedOffsets(int binding, int offset, int numOffsets);
|
||||
bool addUsedConstantId(int id);
|
||||
static int computeTypeLocationSize(const TType&, EShLanguage);
|
||||
|
@ -861,6 +1012,8 @@ public:
|
|||
static int getOffset(const TType& type, int index);
|
||||
static int getBlockSize(const TType& blockType);
|
||||
static int computeBufferReferenceTypeSize(const TType&);
|
||||
static bool isIoResizeArray(const TType& type, EShLanguage language);
|
||||
|
||||
bool promote(TIntermOperator*);
|
||||
void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
|
||||
bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
|
||||
|
@ -879,6 +1032,8 @@ public:
|
|||
void addProcess(const std::string& process) { processes.addProcess(process); }
|
||||
void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
|
||||
const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
|
||||
unsigned long long getUniqueId() const { return uniqueId; }
|
||||
void setUniqueId(unsigned long long id) { uniqueId = id; }
|
||||
|
||||
// Certain explicit conversions are allowed conditionally
|
||||
#ifdef GLSLANG_WEB
|
||||
|
@ -907,22 +1062,23 @@ public:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
|
||||
void error(TInfoSink& infoSink, const char*);
|
||||
void warn(TInfoSink& infoSink, const char*);
|
||||
TIntermSymbol* addSymbol(long long Id, 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&);
|
||||
void mergeModes(TInfoSink&, TIntermediate&);
|
||||
void mergeTrees(TInfoSink&, TIntermediate&);
|
||||
void seedIdMap(TIdMaps& idMaps, int& maxId);
|
||||
void remapIds(const TIdMaps& idMaps, int idShift, TIntermediate&);
|
||||
void seedIdMap(TIdMaps& idMaps, long long& IdShift);
|
||||
void remapIds(const TIdMaps& idMaps, long long idShift, TIntermediate&);
|
||||
void mergeBodies(TInfoSink&, TIntermSequence& globals, const TIntermSequence& unitGlobals);
|
||||
void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects);
|
||||
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&, bool crossStage);
|
||||
void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, EShLanguage);
|
||||
void checkCallGraphCycles(TInfoSink&);
|
||||
void checkCallGraphBodies(TInfoSink&, bool keepUncalled);
|
||||
void inOutLocationCheck(TInfoSink&);
|
||||
TIntermAggregate* findLinkerObjects() const;
|
||||
void sharedBlockCheck(TInfoSink&);
|
||||
bool userOutputUsed() const;
|
||||
bool isSpecializationOperation(const TIntermOperator&) const;
|
||||
bool isNonuniformPropagating(TOperator) const;
|
||||
|
@ -955,18 +1111,31 @@ protected:
|
|||
SpvVersion spvVersion;
|
||||
TIntermNode* treeRoot;
|
||||
std::set<std::string> requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them
|
||||
TBuiltInResource resources;
|
||||
MustBeAssigned<TBuiltInResource> resources;
|
||||
int numEntryPoints;
|
||||
int numErrors;
|
||||
int numPushConstants;
|
||||
bool recursive;
|
||||
bool invertY;
|
||||
bool dxPositionW;
|
||||
bool enhancedMsgs;
|
||||
bool debugInfo;
|
||||
bool useStorageBuffer;
|
||||
bool invariantAll;
|
||||
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
|
||||
bool depthReplacing;
|
||||
bool stencilReplacing;
|
||||
int localSize[3];
|
||||
bool localSizeNotDefault[3];
|
||||
int localSizeSpecId[3];
|
||||
unsigned long long uniqueId;
|
||||
|
||||
std::string globalUniformBlockName;
|
||||
std::string atomicCounterBlockName;
|
||||
unsigned int globalUniformBlockSet;
|
||||
unsigned int globalUniformBlockBinding;
|
||||
unsigned int atomicCounterBlockSet;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
public:
|
||||
const char* const implicitThisName;
|
||||
|
@ -980,13 +1149,16 @@ protected:
|
|||
TLayoutGeometry outputPrimitive;
|
||||
bool pixelCenterInteger;
|
||||
bool originUpperLeft;
|
||||
bool texCoordBuiltinRedeclared;
|
||||
TVertexSpacing vertexSpacing;
|
||||
TVertexOrder vertexOrder;
|
||||
TInterlockOrdering interlockOrdering;
|
||||
bool pointMode;
|
||||
bool earlyFragmentTests;
|
||||
bool postDepthCoverage;
|
||||
bool earlyAndLateFragmentTestsAMD;
|
||||
TLayoutDepth depthLayout;
|
||||
TLayoutStencil stencilLayout;
|
||||
bool hlslFunctionality1;
|
||||
int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift
|
||||
bool xfbMode;
|
||||
|
@ -999,6 +1171,7 @@ protected:
|
|||
int primitives;
|
||||
int numTaskNVBlocks;
|
||||
bool layoutPrimitiveCulling;
|
||||
int numTaskEXTPayloads;
|
||||
|
||||
// Base shift values
|
||||
std::array<unsigned int, EResCount> shiftBinding;
|
||||
|
@ -1021,18 +1194,26 @@ protected:
|
|||
|
||||
bool needToLegalize;
|
||||
bool binaryDoubleOutput;
|
||||
bool subgroupUniformControlFlow;
|
||||
bool usePhysicalStorageBuffer;
|
||||
|
||||
TSpirvRequirement* spirvRequirement;
|
||||
TSpirvExecutionMode* spirvExecutionMode;
|
||||
|
||||
std::unordered_map<std::string, int> uniformLocationOverrides;
|
||||
int uniformLocationBase;
|
||||
TNumericFeatures numericFeatures;
|
||||
#endif
|
||||
std::unordered_map<std::string, TBlockStorageClass> blockBackingOverrides;
|
||||
|
||||
std::unordered_set<int> usedConstantId; // specialization constant ids used
|
||||
std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters
|
||||
std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers
|
||||
std::vector<TRange> usedIoRT[2]; // sets of used location, one for rayPayload/rayPayloadIN and other
|
||||
// for callableData/callableDataIn
|
||||
// set of names of statically read/written I/O that might need extra checking
|
||||
std::set<TString> ioAccessed;
|
||||
|
||||
// source code of shader, useful as part of debug information
|
||||
std::string sourceFile;
|
||||
std::string sourceText;
|
||||
|
|
|
@ -166,31 +166,30 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
|
|||
}
|
||||
} else {
|
||||
// matrix from vector or scalar
|
||||
int count = 0;
|
||||
const int startIndex = index;
|
||||
int nodeComps = node->getType().computeNumComponents();
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
if (i >= instanceSize)
|
||||
return;
|
||||
if (nodeComps == 1) {
|
||||
// If there is a single scalar parameter to a matrix
|
||||
// constructor, it is used to initialize all the
|
||||
// components on the matrix's diagonal, with the
|
||||
// remaining components initialized to 0.0.
|
||||
if (i == startIndex || (i - startIndex) % (matrixRows + 1) == 0 )
|
||||
leftUnionArray[i] = rightUnionArray[count];
|
||||
else
|
||||
leftUnionArray[i].setDConst(0.0);
|
||||
} else {
|
||||
if (nodeComps == 1) {
|
||||
for (int c = 0; c < matrixCols; ++c) {
|
||||
for (int r = 0; r < matrixRows; ++r) {
|
||||
if (r == c)
|
||||
leftUnionArray[index] = rightUnionArray[0];
|
||||
else
|
||||
leftUnionArray[index].setDConst(0.0);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int count = 0;
|
||||
for (int i = index; i < endIndex; i++) {
|
||||
if (i >= instanceSize)
|
||||
return;
|
||||
|
||||
// construct the matrix in column-major order, from
|
||||
// the components provided, in order
|
||||
leftUnionArray[i] = rightUnionArray[count];
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (nodeComps > 1)
|
||||
index++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -455,6 +455,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo
|
|||
token = scanToken(ppToken);
|
||||
}
|
||||
} else {
|
||||
token = tokenPaste(token, *ppToken);
|
||||
token = evalToToken(token, shortCircuit, res, err, ppToken);
|
||||
return eval(token, precedence, shortCircuit, res, err, ppToken);
|
||||
}
|
||||
|
|
|
@ -1191,9 +1191,11 @@ int TPpContext::tokenize(TPpToken& ppToken)
|
|||
// HLSL allows string literals.
|
||||
// GLSL allows string literals with GL_EXT_debug_printf.
|
||||
if (ifdepth == 0 && parseContext.intermediate.getSource() != EShSourceHlsl) {
|
||||
parseContext.requireExtensions(ppToken.loc, 1, &E_GL_EXT_debug_printf, "string literal");
|
||||
if (!parseContext.extensionTurnedOn(E_GL_EXT_debug_printf))
|
||||
continue;
|
||||
const char* const string_literal_EXTs[] = { E_GL_EXT_debug_printf, E_GL_EXT_spirv_intrinsics };
|
||||
parseContext.requireExtensions(ppToken.loc, 2, string_literal_EXTs, "string literal");
|
||||
if (!parseContext.extensionTurnedOn(E_GL_EXT_debug_printf) &&
|
||||
!parseContext.extensionTurnedOn(E_GL_EXT_spirv_intrinsics))
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '\'':
|
||||
|
|
|
@ -658,14 +658,17 @@ public:
|
|||
|
||||
blocks.back().numMembers = countAggregateMembers(type);
|
||||
|
||||
EShLanguageMask& stages = blocks.back().stages;
|
||||
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
|
||||
if (updateStageMasks) {
|
||||
EShLanguageMask& stages = blocks.back().stages;
|
||||
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
|
||||
}
|
||||
}
|
||||
else {
|
||||
blockIndex = it->second;
|
||||
|
||||
EShLanguageMask& stages = blocks[blockIndex].stages;
|
||||
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
|
||||
if (updateStageMasks) {
|
||||
EShLanguageMask& stages = blocks[blockIndex].stages;
|
||||
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -904,8 +907,8 @@ public:
|
|||
case EbtFloat16: return GL_FLOAT16_VEC2_NV + offset;
|
||||
case EbtInt: return GL_INT_VEC2 + offset;
|
||||
case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset;
|
||||
case EbtInt64: return GL_INT64_ARB + offset;
|
||||
case EbtUint64: return GL_UNSIGNED_INT64_ARB + offset;
|
||||
case EbtInt64: return GL_INT64_VEC2_ARB + offset;
|
||||
case EbtUint64: return GL_UNSIGNED_INT64_VEC2_ARB + offset;
|
||||
case EbtBool: return GL_BOOL_VEC2 + offset;
|
||||
case EbtAtomicUint: return GL_UNSIGNED_INT_ATOMIC_COUNTER + offset;
|
||||
default: return 0;
|
||||
|
@ -1135,6 +1138,8 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
|
|||
if (index >= 0)
|
||||
indexToUniformBlock[i].counterIndex = index;
|
||||
}
|
||||
#else
|
||||
(void)intermediate;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -56,52 +56,6 @@ namespace glslang {
|
|||
// Thread cleanup
|
||||
//
|
||||
|
||||
//
|
||||
// Wrapper for Linux call to DetachThread. This is required as pthread_cleanup_push() expects
|
||||
// the cleanup routine to return void.
|
||||
//
|
||||
static void DetachThreadLinux(void *)
|
||||
{
|
||||
DetachThread();
|
||||
}
|
||||
|
||||
//
|
||||
// Registers cleanup handler, sets cancel type and state, and executes the thread specific
|
||||
// cleanup handler. This function will be called in the Standalone.cpp for regression
|
||||
// testing. When OpenGL applications are run with the driver code, Linux OS does the
|
||||
// thread cleanup.
|
||||
//
|
||||
void OS_CleanupThreadData(void)
|
||||
{
|
||||
#if defined(__ANDROID__) || defined(__Fuchsia__)
|
||||
DetachThreadLinux(NULL);
|
||||
#else
|
||||
int old_cancel_state, old_cancel_type;
|
||||
void *cleanupArg = NULL;
|
||||
|
||||
//
|
||||
// Set thread cancel state and push cleanup handler.
|
||||
//
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancel_state);
|
||||
pthread_cleanup_push(DetachThreadLinux, (void *) cleanupArg);
|
||||
|
||||
//
|
||||
// Put the thread in deferred cancellation mode.
|
||||
//
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &old_cancel_type);
|
||||
|
||||
//
|
||||
// Pop cleanup handler and execute it prior to unregistering the cleanup handler.
|
||||
//
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
//
|
||||
// Restore the thread's previous cancellation mode.
|
||||
//
|
||||
pthread_setcanceltype(old_cancel_state, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Thread Local Storage Operations
|
||||
//
|
||||
|
@ -172,7 +126,7 @@ namespace {
|
|||
pthread_mutex_t gMutex;
|
||||
}
|
||||
|
||||
void InitGlobalLock()
|
||||
static void InitMutex(void)
|
||||
{
|
||||
pthread_mutexattr_t mutexattr;
|
||||
pthread_mutexattr_init(&mutexattr);
|
||||
|
@ -180,6 +134,12 @@ void InitGlobalLock()
|
|||
pthread_mutex_init(&gMutex, &mutexattr);
|
||||
}
|
||||
|
||||
void InitGlobalLock()
|
||||
{
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
pthread_once(&once, InitMutex);
|
||||
}
|
||||
|
||||
void GetGlobalLock()
|
||||
{
|
||||
pthread_mutex_lock(&gMutex);
|
||||
|
|
|
@ -54,8 +54,6 @@ void ReleaseGlobalLock();
|
|||
|
||||
typedef unsigned int (*TThreadEntrypoint)(void*);
|
||||
|
||||
void OS_CleanupThreadData(void);
|
||||
|
||||
void OS_DumpMemoryCounters();
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
@ -108,8 +108,10 @@ typedef enum {
|
|||
EShLangMissNV = EShLangMiss,
|
||||
EShLangCallable,
|
||||
EShLangCallableNV = EShLangCallable,
|
||||
EShLangTaskNV,
|
||||
EShLangMeshNV,
|
||||
EShLangTask,
|
||||
EShLangTaskNV = EShLangTask,
|
||||
EShLangMesh,
|
||||
EShLangMeshNV = EShLangMesh,
|
||||
LAST_ELEMENT_MARKER(EShLangCount),
|
||||
} EShLanguage; // would be better as stage, but this is ancient now
|
||||
|
||||
|
@ -132,8 +134,10 @@ typedef enum : unsigned {
|
|||
EShLangMissNVMask = EShLangMissMask,
|
||||
EShLangCallableMask = (1 << EShLangCallable),
|
||||
EShLangCallableNVMask = EShLangCallableMask,
|
||||
EShLangTaskNVMask = (1 << EShLangTaskNV),
|
||||
EShLangMeshNVMask = (1 << EShLangMeshNV),
|
||||
EShLangTaskMask = (1 << EShLangTask),
|
||||
EShLangTaskNVMask = EShLangTaskMask,
|
||||
EShLangMeshMask = (1 << EShLangMesh),
|
||||
EShLangMeshNVMask = EShLangMeshMask,
|
||||
LAST_ELEMENT_MARKER(EShLanguageMaskCount),
|
||||
} EShLanguageMask;
|
||||
|
||||
|
@ -150,8 +154,8 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
EShClientNone, // use when there is no client, e.g. for validation
|
||||
EShClientVulkan,
|
||||
EShClientOpenGL,
|
||||
EShClientVulkan, // as GLSL dialect, specifies KHR_vulkan_glsl extension
|
||||
EShClientOpenGL, // as GLSL dialect, specifies ARB_gl_spirv extension
|
||||
LAST_ELEMENT_MARKER(EShClientCount),
|
||||
} EShClient;
|
||||
|
||||
|
@ -166,8 +170,9 @@ typedef enum {
|
|||
EShTargetVulkan_1_0 = (1 << 22), // Vulkan 1.0
|
||||
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
|
||||
EShTargetOpenGL_450 = 450, // OpenGL
|
||||
LAST_ELEMENT_MARKER(EShTargetClientVersionCount),
|
||||
LAST_ELEMENT_MARKER(EShTargetClientVersionCount = 5),
|
||||
} EShTargetClientVersion;
|
||||
|
||||
typedef EShTargetClientVersion EshTargetClientVersion;
|
||||
|
@ -179,7 +184,8 @@ typedef enum {
|
|||
EShTargetSpv_1_3 = (1 << 16) | (3 << 8), // SPIR-V 1.3
|
||||
EShTargetSpv_1_4 = (1 << 16) | (4 << 8), // SPIR-V 1.4
|
||||
EShTargetSpv_1_5 = (1 << 16) | (5 << 8), // SPIR-V 1.5
|
||||
LAST_ELEMENT_MARKER(EShTargetLanguageVersionCount),
|
||||
EShTargetSpv_1_6 = (1 << 16) | (6 << 8), // SPIR-V 1.6
|
||||
LAST_ELEMENT_MARKER(EShTargetLanguageVersionCount = 7),
|
||||
} EShTargetLanguageVersion;
|
||||
|
||||
struct TInputLanguage {
|
||||
|
@ -187,6 +193,7 @@ struct TInputLanguage {
|
|||
EShLanguage stage; // redundant information with other input, this one overrides when not EShSourceNone
|
||||
EShClient dialect;
|
||||
int dialectVersion; // version of client's language definition, not the client (when not EShClientNone)
|
||||
bool vulkanRulesRelaxed;
|
||||
};
|
||||
|
||||
struct TClient {
|
||||
|
@ -261,6 +268,7 @@ enum EShMessages : unsigned {
|
|||
EShMsgHlslLegalization = (1 << 12), // enable HLSL Legalization messages
|
||||
EShMsgHlslDX9Compatible = (1 << 13), // enable HLSL DX9 compatible mode (for samplers and semantics)
|
||||
EShMsgBuiltinSymbolTable = (1 << 14), // print the builtin symbol table
|
||||
EShMsgEnhanced = (1 << 15), // enhanced message readability
|
||||
LAST_ELEMENT_MARKER(EShMsgCount),
|
||||
};
|
||||
|
||||
|
@ -297,7 +305,7 @@ typedef struct {
|
|||
|
||||
//
|
||||
// ShHandle held by but opaque to the driver. It is allocated,
|
||||
// managed, and de-allocated by the compiler/linker. It's contents
|
||||
// managed, and de-allocated by the compiler/linker. Its contents
|
||||
// are defined by and used by the compiler and linker. For example,
|
||||
// symbol table information and object code passed from the compiler
|
||||
// to the linker can be stored where ShHandle points.
|
||||
|
@ -427,6 +435,14 @@ enum TResourceType {
|
|||
EResCount
|
||||
};
|
||||
|
||||
enum TBlockStorageClass
|
||||
{
|
||||
EbsUniform = 0,
|
||||
EbsStorageBuffer,
|
||||
EbsPushConstant,
|
||||
EbsNone, // not a uniform or buffer variable
|
||||
EbsCount,
|
||||
};
|
||||
|
||||
// Make one TShader per shader that you will link into a program. Then
|
||||
// - provide the shader through setStrings() or setStringsWithLengths()
|
||||
|
@ -458,6 +474,9 @@ public:
|
|||
GLSLANG_EXPORT void setEntryPoint(const char* entryPoint);
|
||||
GLSLANG_EXPORT void setSourceEntryPoint(const char* sourceEntryPointName);
|
||||
GLSLANG_EXPORT void addProcesses(const std::vector<std::string>&);
|
||||
GLSLANG_EXPORT void setUniqueId(unsigned long long id);
|
||||
GLSLANG_EXPORT void setOverrideVersion(int version);
|
||||
GLSLANG_EXPORT void setDebugInfo(bool debugInfo);
|
||||
|
||||
// IO resolver binding data: see comments in ShaderLang.cpp
|
||||
GLSLANG_EXPORT void setShiftBinding(TResourceType res, unsigned int base);
|
||||
|
@ -475,6 +494,8 @@ public:
|
|||
GLSLANG_EXPORT void addUniformLocationOverride(const char* name, int loc);
|
||||
GLSLANG_EXPORT void setUniformLocationBase(int base);
|
||||
GLSLANG_EXPORT void setInvertY(bool invert);
|
||||
GLSLANG_EXPORT void setDxPositionW(bool dxPosW);
|
||||
GLSLANG_EXPORT void setEnhancedMsgs();
|
||||
#ifdef ENABLE_HLSL
|
||||
GLSLANG_EXPORT void setHlslIoMapping(bool hlslIoMap);
|
||||
GLSLANG_EXPORT void setFlattenUniformArrays(bool flatten);
|
||||
|
@ -482,6 +503,14 @@ public:
|
|||
GLSLANG_EXPORT void setNoStorageFormat(bool useUnknownFormat);
|
||||
GLSLANG_EXPORT void setNanMinMaxClamp(bool nanMinMaxClamp);
|
||||
GLSLANG_EXPORT void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode);
|
||||
GLSLANG_EXPORT void addBlockStorageOverride(const char* nameStr, glslang::TBlockStorageClass backing);
|
||||
|
||||
GLSLANG_EXPORT void setGlobalUniformBlockName(const char* name);
|
||||
GLSLANG_EXPORT void setAtomicCounterBlockName(const char* name);
|
||||
GLSLANG_EXPORT void setGlobalUniformSet(unsigned int set);
|
||||
GLSLANG_EXPORT void setGlobalUniformBinding(unsigned int binding);
|
||||
GLSLANG_EXPORT void setAtomicCounterBlockSet(unsigned int set);
|
||||
GLSLANG_EXPORT void setAtomicCounterBlockBinding(unsigned int binding);
|
||||
|
||||
// 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
|
||||
|
@ -490,15 +519,18 @@ public:
|
|||
//
|
||||
// setEnvInput: The input source language and stage. If generating code for a
|
||||
// specific client, the input client semantics to use and the
|
||||
// version of the that client's input semantics to use, otherwise
|
||||
// version of that client's input semantics to use, otherwise
|
||||
// use EShClientNone and version of 0, e.g. for validation mode.
|
||||
// Note 'version' does not describe the target environment,
|
||||
// just the version of the source dialect to compile under.
|
||||
// For example, to choose the Vulkan dialect of GLSL defined by
|
||||
// version 100 of the KHR_vulkan_glsl extension: lang = EShSourceGlsl,
|
||||
// dialect = EShClientVulkan, and version = 100.
|
||||
//
|
||||
// See the definitions of TEnvironment, EShSource, EShLanguage,
|
||||
// and EShClient for choices and more detail.
|
||||
//
|
||||
// setEnvClient: The client that will be hosting the execution, and it's version.
|
||||
// setEnvClient: The client that will be hosting the execution, and its version.
|
||||
// Note 'version' is not the version of the languages involved, but
|
||||
// the version of the client environment.
|
||||
// Use EShClientNone and version of 0 if there is no client, e.g.
|
||||
|
@ -538,6 +570,9 @@ public:
|
|||
bool getEnvTargetHlslFunctionality1() const { return false; }
|
||||
#endif
|
||||
|
||||
void setEnvInputVulkanRulesRelaxed() { environment.input.vulkanRulesRelaxed = true; }
|
||||
bool getEnvInputVulkanRulesRelaxed() const { return environment.input.vulkanRulesRelaxed; }
|
||||
|
||||
// Interface to #include handlers.
|
||||
//
|
||||
// To support #include, a client of Glslang does the following:
|
||||
|
@ -682,6 +717,9 @@ protected:
|
|||
// a function in the source string can be renamed FROM this TO the name given in setEntryPoint.
|
||||
std::string sourceEntryPointName;
|
||||
|
||||
// overrides #version in shader source or default version if #version isn't present
|
||||
int overrideVersion;
|
||||
|
||||
TEnvironment environment;
|
||||
|
||||
friend class TProgram;
|
||||
|
@ -701,7 +739,7 @@ class TObjectReflection {
|
|||
public:
|
||||
GLSLANG_EXPORT TObjectReflection(const std::string& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex);
|
||||
|
||||
GLSLANG_EXPORT const TType* getType() const { return type; }
|
||||
const TType* getType() const { return type; }
|
||||
GLSLANG_EXPORT int getBinding() const;
|
||||
GLSLANG_EXPORT void dump() const;
|
||||
static TObjectReflection badReflection() { return TObjectReflection(); }
|
||||
|
@ -805,7 +843,7 @@ public:
|
|||
// Called by TSlotCollector to resolve resource locations or bindings
|
||||
virtual void reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& infoSink) = 0;
|
||||
// Called by mapIO.addStage to set shader stage mask to mark a stage be added to this pipeline
|
||||
virtual void addStage(EShLanguage stage) = 0;
|
||||
virtual void addStage(EShLanguage stage, TIntermediate& stageIntermediate) = 0;
|
||||
};
|
||||
|
||||
#endif // !GLSLANG_WEB && !GLSLANG_ANGLE
|
||||
|
@ -927,6 +965,7 @@ public:
|
|||
|
||||
protected:
|
||||
GLSLANG_EXPORT bool linkStage(EShLanguage, EShMessages);
|
||||
GLSLANG_EXPORT bool crossStageCheck(EShMessages);
|
||||
|
||||
TPoolAllocator* pool;
|
||||
std::list<TShader*> stages[EShLangCount];
|
||||
|
|
|
@ -35,28 +35,28 @@
|
|||
#define GLSLANG_BUILD_INFO
|
||||
|
||||
#define GLSLANG_VERSION_MAJOR 11
|
||||
#define GLSLANG_VERSION_MINOR 0
|
||||
#define GLSLANG_VERSION_MINOR 12
|
||||
#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)))))
|
||||
((GLSLANG_VERSION_MAJOR) > (major) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
((GLSLANG_VERSION_MINOR) > (minor) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
(GLSLANG_VERSION_PATCH) > (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)))))
|
||||
((GLSLANG_VERSION_MAJOR) > (major) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
((GLSLANG_VERSION_MINOR) > (minor) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
(GLSLANG_VERSION_PATCH >= (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)))))
|
||||
((GLSLANG_VERSION_MAJOR) < (major) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
((GLSLANG_VERSION_MINOR) < (minor) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
(GLSLANG_VERSION_PATCH) < (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)))))
|
||||
((GLSLANG_VERSION_MAJOR) < (major) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
((GLSLANG_VERSION_MINOR) < (minor) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
(GLSLANG_VERSION_PATCH <= (patch))))))
|
||||
|
||||
#endif // GLSLANG_BUILD_INFO
|
||||
|
|
Loading…
Reference in New Issue