Update glslang to dbb56a1 (#2232)
This commit is contained in:
16
third_party/glslang/.appveyor.yml
vendored
16
third_party/glslang/.appveyor.yml
vendored
@@ -17,6 +17,20 @@ branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
# changes to these files don't need to trigger testing
|
||||
skip_commits:
|
||||
files:
|
||||
- README.md
|
||||
- README-spirv-remap.txt
|
||||
- LICENSE.txt
|
||||
- CODE_OF_CONDUCT.md
|
||||
- BUILD.*
|
||||
- WORKSPACE
|
||||
- kokoro/*
|
||||
- make-revision
|
||||
- Android.mk
|
||||
- _config.yml
|
||||
|
||||
# Travis advances the master-tot tag to current top of the tree after
|
||||
# each push into the master branch, because it relies on that tag to
|
||||
# upload build artifacts to the master-tot release. This will cause
|
||||
@@ -32,6 +46,7 @@ matrix:
|
||||
# scripts that run after cloning repository
|
||||
install:
|
||||
- C:/Python27/python.exe update_glslang_sources.py
|
||||
- set PATH=C:\ninja;C:\Python36;%PATH%
|
||||
- git clone https://github.com/google/googletest.git External/googletest
|
||||
- cd External/googletest
|
||||
- git checkout 440527a61e1c91188195f7de212c63c77e8f0a45
|
||||
@@ -65,7 +80,6 @@ after_test:
|
||||
bin\glslangValidator.exe
|
||||
bin\spirv-remap.exe
|
||||
include\glslang\*
|
||||
include\SPIRV\*
|
||||
lib\glslang%SUFFIX%.lib
|
||||
lib\HLSL%SUFFIX%.lib
|
||||
lib\OGLCompiler%SUFFIX%.lib
|
||||
|
||||
3
third_party/glslang/.clang-format
vendored
3
third_party/glslang/.clang-format
vendored
@@ -1,7 +1,8 @@
|
||||
Language: Cpp
|
||||
IndentWidth: 4
|
||||
PointerAlignment: Left
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping: { AfterFunction: true, AfterControlStatement: true }
|
||||
BraceWrapping: { AfterFunction: true, AfterControlStatement: false }
|
||||
IndentCaseLabels: false
|
||||
ReflowComments: false
|
||||
ColumnLimit: 120
|
||||
|
||||
14
third_party/glslang/.gitattributes
vendored
14
third_party/glslang/.gitattributes
vendored
@@ -8,10 +8,10 @@
|
||||
*.txt text
|
||||
|
||||
# source code can be native and normalized, but simpler if lf everywhere; will try that way
|
||||
*.h text eof=lf
|
||||
*.c text eof=lf
|
||||
*.cpp text eof=lf
|
||||
*.y text eof=lf
|
||||
*.out text eof=lf
|
||||
*.conf text eof=lf
|
||||
*.err text eof=lf
|
||||
*.h text eol=lf
|
||||
*.c text eol=lf
|
||||
*.cpp text eol=lf
|
||||
*.y text eol=lf
|
||||
*.out text eol=lf
|
||||
*.conf text eol=lf
|
||||
*.err text eol=lf
|
||||
|
||||
1
third_party/glslang/.travis.yml
vendored
1
third_party/glslang/.travis.yml
vendored
@@ -99,7 +99,6 @@ after_success:
|
||||
zip ${TARBALL}
|
||||
bin/glslangValidator
|
||||
include/glslang/*
|
||||
include/SPIRV/*
|
||||
lib/libglslang${SUFFIX}.a
|
||||
lib/libHLSL${SUFFIX}.a
|
||||
lib/libOGLCompiler${SUFFIX}.a
|
||||
|
||||
100
third_party/glslang/Android.mk
vendored
Normal file
100
third_party/glslang/Android.mk
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
GLSLANG_OS_FLAGS := -DGLSLANG_OSINCLUDE_UNIX
|
||||
# AMD and NV extensions are turned on by default in upstream Glslang.
|
||||
GLSLANG_DEFINES:= -DAMD_EXTENSIONS -DNV_EXTENSIONS -DENABLE_HLSL $(GLSLANG_OS_FLAGS)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=OSDependent
|
||||
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
|
||||
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
|
||||
LOCAL_SRC_FILES:=glslang/OSDependent/Unix/ossource.cpp
|
||||
LOCAL_C_INCLUDES:=$(LOCAL_PATH) $(LOCAL_PATH)/glslang/OSDependent/Unix/
|
||||
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/OSDependent/Unix/
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=OGLCompiler
|
||||
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
|
||||
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
|
||||
LOCAL_SRC_FILES:=OGLCompilersDLL/InitializeDll.cpp
|
||||
LOCAL_C_INCLUDES:=$(LOCAL_PATH)/OGLCompiler
|
||||
LOCAL_STATIC_LIBRARIES:=OSDependent
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# Build Glslang's HLSL parser library.
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=HLSL
|
||||
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
|
||||
LOCAL_SRC_FILES:= \
|
||||
hlsl/hlslAttributes.cpp \
|
||||
hlsl/hlslGrammar.cpp \
|
||||
hlsl/hlslOpMap.cpp \
|
||||
hlsl/hlslParseables.cpp \
|
||||
hlsl/hlslParseHelper.cpp \
|
||||
hlsl/hlslScanContext.cpp \
|
||||
hlsl/hlslTokenStream.cpp
|
||||
LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/hlsl
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
GLSLANG_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT)))
|
||||
|
||||
LOCAL_MODULE:=glslang
|
||||
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
|
||||
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
|
||||
LOCAL_SRC_FILES:= \
|
||||
glslang/GenericCodeGen/CodeGen.cpp \
|
||||
glslang/GenericCodeGen/Link.cpp \
|
||||
glslang/MachineIndependent/attribute.cpp \
|
||||
glslang/MachineIndependent/Constant.cpp \
|
||||
glslang/MachineIndependent/glslang_tab.cpp \
|
||||
glslang/MachineIndependent/InfoSink.cpp \
|
||||
glslang/MachineIndependent/Initialize.cpp \
|
||||
glslang/MachineIndependent/Intermediate.cpp \
|
||||
glslang/MachineIndependent/intermOut.cpp \
|
||||
glslang/MachineIndependent/IntermTraverse.cpp \
|
||||
glslang/MachineIndependent/iomapper.cpp \
|
||||
glslang/MachineIndependent/limits.cpp \
|
||||
glslang/MachineIndependent/linkValidate.cpp \
|
||||
glslang/MachineIndependent/parseConst.cpp \
|
||||
glslang/MachineIndependent/ParseContextBase.cpp \
|
||||
glslang/MachineIndependent/ParseHelper.cpp \
|
||||
glslang/MachineIndependent/PoolAlloc.cpp \
|
||||
glslang/MachineIndependent/propagateNoContraction.cpp \
|
||||
glslang/MachineIndependent/reflection.cpp \
|
||||
glslang/MachineIndependent/RemoveTree.cpp \
|
||||
glslang/MachineIndependent/Scan.cpp \
|
||||
glslang/MachineIndependent/ShaderLang.cpp \
|
||||
glslang/MachineIndependent/SymbolTable.cpp \
|
||||
glslang/MachineIndependent/Versions.cpp \
|
||||
glslang/MachineIndependent/preprocessor/PpAtom.cpp \
|
||||
glslang/MachineIndependent/preprocessor/PpContext.cpp \
|
||||
glslang/MachineIndependent/preprocessor/Pp.cpp \
|
||||
glslang/MachineIndependent/preprocessor/PpScanner.cpp \
|
||||
glslang/MachineIndependent/preprocessor/PpTokens.cpp
|
||||
LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/glslang/MachineIndependent \
|
||||
$(GLSLANG_OUT_PATH)
|
||||
LOCAL_STATIC_LIBRARIES:=OSDependent OGLCompiler HLSL
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=SPIRV
|
||||
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror $(GLSLANG_DEFINES)
|
||||
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
|
||||
LOCAL_SRC_FILES:= \
|
||||
SPIRV/GlslangToSpv.cpp \
|
||||
SPIRV/InReadableOrder.cpp \
|
||||
SPIRV/Logger.cpp \
|
||||
SPIRV/SPVRemapper.cpp \
|
||||
SPIRV/SpvBuilder.cpp \
|
||||
SPIRV/SpvPostProcess.cpp \
|
||||
SPIRV/SpvTools.cpp \
|
||||
SPIRV/disassemble.cpp \
|
||||
SPIRV/doc.cpp
|
||||
LOCAL_C_INCLUDES:=$(LOCAL_PATH) $(LOCAL_PATH)/glslang/SPIRV
|
||||
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/SPIRV
|
||||
LOCAL_STATIC_LIBRARIES:=glslang
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
247
third_party/glslang/BUILD.bazel
vendored
Normal file
247
third_party/glslang/BUILD.bazel
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Description:
|
||||
#
|
||||
# Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator.
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files(["LICENSE"])
|
||||
|
||||
COMMON_COPTS = select({
|
||||
"@bazel_tools//src/conditions:windows": [""],
|
||||
"//conditions:default": [
|
||||
"-Wall",
|
||||
"-Wuninitialized",
|
||||
"-Wunused",
|
||||
"-Wunused-local-typedefs",
|
||||
"-Wunused-parameter",
|
||||
"-Wunused-value",
|
||||
"-Wunused-variable",
|
||||
"-Wno-reorder",
|
||||
"-std=c++11",
|
||||
"-fvisibility=hidden",
|
||||
"-fvisibility-inlines-hidden",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
],
|
||||
})
|
||||
|
||||
cc_library(
|
||||
name = "glslang",
|
||||
srcs = glob(
|
||||
[
|
||||
"glslang/GenericCodeGen/*.cpp",
|
||||
"glslang/MachineIndependent/*.cpp",
|
||||
"glslang/MachineIndependent/preprocessor/*.cpp",
|
||||
"hlsl/*.cpp",
|
||||
],
|
||||
exclude = [
|
||||
"glslang/MachineIndependent/pch.cpp",
|
||||
"glslang/MachineIndependent/pch.h",
|
||||
"hlsl/pch.cpp",
|
||||
"hlsl/pch.h",
|
||||
],
|
||||
) + [
|
||||
"OGLCompilersDLL/InitializeDll.cpp",
|
||||
] + select({
|
||||
"@bazel_tools//src/conditions:windows":
|
||||
["glslang/OSDependent/Windows/ossource.cpp"],
|
||||
"//conditions:default":
|
||||
["glslang/OSDependent/Unix/ossource.cpp"],
|
||||
}),
|
||||
hdrs = glob([
|
||||
"glslang/Include/*.h",
|
||||
"glslang/MachineIndependent/*.h",
|
||||
"glslang/MachineIndependent/preprocessor/*.h",
|
||||
"hlsl/*.h",
|
||||
]) + [
|
||||
"OGLCompilersDLL/InitializeDll.h",
|
||||
"StandAlone/DirStackFileIncluder.h",
|
||||
"glslang/OSDependent/osinclude.h",
|
||||
"glslang/Public/ShaderLang.h",
|
||||
],
|
||||
copts = COMMON_COPTS,
|
||||
defines = [
|
||||
"AMD_EXTENSIONS",
|
||||
"ENABLE_HLSL=0",
|
||||
"ENABLE_OPT=0",
|
||||
"NV_EXTENSIONS",
|
||||
],
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [""],
|
||||
"//conditions:default": ["-lm", "-lpthread"],
|
||||
}),
|
||||
linkstatic = 1,
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "export_spirv_headers",
|
||||
srcs = [
|
||||
"SPIRV/GLSL.ext.AMD.h",
|
||||
"SPIRV/GLSL.ext.EXT.h",
|
||||
"SPIRV/GLSL.ext.KHR.h",
|
||||
"SPIRV/GLSL.ext.NV.h",
|
||||
"SPIRV/GLSL.std.450.h",
|
||||
"SPIRV/NonSemanticDebugPrintf.h",
|
||||
"SPIRV/spirv.hpp",
|
||||
],
|
||||
outs = [
|
||||
"include/SPIRV/GLSL.ext.AMD.h",
|
||||
"include/SPIRV/GLSL.ext.EXT.h",
|
||||
"include/SPIRV/GLSL.ext.KHR.h",
|
||||
"include/SPIRV/GLSL.ext.NV.h",
|
||||
"include/SPIRV/GLSL.std.450.h",
|
||||
"include/SPIRV/NonSemanticDebugPrintf.h",
|
||||
"include/SPIRV/spirv.hpp",
|
||||
],
|
||||
cmd = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "SPIRV_headers",
|
||||
hdrs = [":export_spirv_headers"],
|
||||
copts = COMMON_COPTS,
|
||||
includes = [
|
||||
"include",
|
||||
"include/SPIRV",
|
||||
],
|
||||
linkstatic = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "SPIRV",
|
||||
srcs = glob(
|
||||
["SPIRV/*.cpp"],
|
||||
exclude = [
|
||||
"SPIRV/SpvTools.cpp",
|
||||
],
|
||||
),
|
||||
hdrs = [
|
||||
"SPIRV/GlslangToSpv.h",
|
||||
"SPIRV/Logger.h",
|
||||
"SPIRV/SPVRemapper.h",
|
||||
"SPIRV/SpvBuilder.h",
|
||||
"SPIRV/SpvTools.h",
|
||||
"SPIRV/bitutils.h",
|
||||
"SPIRV/disassemble.h",
|
||||
"SPIRV/doc.h",
|
||||
"SPIRV/hex_float.h",
|
||||
"SPIRV/spvIR.h",
|
||||
],
|
||||
copts = COMMON_COPTS,
|
||||
includes = ["SPIRV"],
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [""],
|
||||
"//conditions:default": ["-lm"],
|
||||
}),
|
||||
linkstatic = 1,
|
||||
deps = [
|
||||
":SPIRV_headers",
|
||||
":glslang",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "glslang-default-resource-limits",
|
||||
srcs = ["StandAlone/ResourceLimits.cpp"],
|
||||
hdrs = ["StandAlone/ResourceLimits.h"],
|
||||
copts = COMMON_COPTS,
|
||||
linkstatic = 1,
|
||||
deps = [":glslang"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "glslangValidator",
|
||||
srcs = [
|
||||
"StandAlone/StandAlone.cpp",
|
||||
"StandAlone/Worklist.h",
|
||||
],
|
||||
copts = COMMON_COPTS,
|
||||
deps = [
|
||||
":SPIRV",
|
||||
":glslang",
|
||||
":glslang-default-resource-limits",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "spirv-remap",
|
||||
srcs = ["StandAlone/spirv-remap.cpp"],
|
||||
copts = COMMON_COPTS,
|
||||
deps = [
|
||||
":SPIRV",
|
||||
":glslang",
|
||||
":glslang-default-resource-limits",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "test_files",
|
||||
srcs = glob(
|
||||
["Test/**"],
|
||||
exclude = [
|
||||
"Test/bump",
|
||||
"Test/glslangValidator",
|
||||
"Test/runtests",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "glslang_test_lib",
|
||||
testonly = 1,
|
||||
srcs = [
|
||||
"gtests/HexFloat.cpp",
|
||||
"gtests/Initializer.h",
|
||||
"gtests/Settings.cpp",
|
||||
"gtests/Settings.h",
|
||||
"gtests/TestFixture.cpp",
|
||||
"gtests/TestFixture.h",
|
||||
"gtests/main.cpp",
|
||||
],
|
||||
copts = COMMON_COPTS,
|
||||
data = [":test_files"],
|
||||
defines = select({
|
||||
# Unfortunately we can't use $(location) in cc_library at the moment.
|
||||
# See https://github.com/bazelbuild/bazel/issues/1023
|
||||
# So we'll specify the path manually.
|
||||
"@bazel_tools//src/conditions:windows":
|
||||
["GLSLANG_TEST_DIRECTORY='\"../../../../../Test\"'"],
|
||||
"//conditions:default":
|
||||
["GLSLANG_TEST_DIRECTORY='\"Test\"'"],
|
||||
}),
|
||||
linkstatic = 1,
|
||||
deps = [
|
||||
":SPIRV",
|
||||
":glslang",
|
||||
":glslang-default-resource-limits",
|
||||
"@com_google_googletest//:gtest",
|
||||
],
|
||||
)
|
||||
|
||||
GLSLANG_TESTS = glob(
|
||||
["gtests/*.FromFile.cpp"],
|
||||
# Since we are not building the SPIRV-Tools dependency, the following tests
|
||||
# cannot be performed.
|
||||
exclude = [
|
||||
"gtests/Hlsl.FromFile.cpp",
|
||||
"gtests/Spv.FromFile.cpp",
|
||||
],
|
||||
)
|
||||
|
||||
[cc_test(
|
||||
name = test_file.replace("gtests/", "").replace(".FromFile.cpp", "") + "_test",
|
||||
srcs = [test_file],
|
||||
copts = COMMON_COPTS,
|
||||
data = [
|
||||
":test_files",
|
||||
],
|
||||
deps = [
|
||||
":SPIRV",
|
||||
":glslang",
|
||||
":glslang_test_lib",
|
||||
],
|
||||
) for test_file in GLSLANG_TESTS]
|
||||
103
third_party/glslang/BUILD.gn
vendored
103
third_party/glslang/BUILD.gn
vendored
@@ -33,10 +33,25 @@
|
||||
|
||||
import("//build_overrides/glslang.gni")
|
||||
|
||||
# Both Chromium and Fuchsia use by default a set of warning errors
|
||||
# that is far too strict to compile this project. These are also
|
||||
# typically appended after |cflags|, overriding target-specific
|
||||
# definitions. To work around this, determine which configs to
|
||||
# add and remove in order to succesfully build the project.
|
||||
if (defined(is_fuchsia_tree) && is_fuchsia_tree) {
|
||||
_configs_to_remove = [ "//build/config:default_warnings" ]
|
||||
_configs_to_add = []
|
||||
} else {
|
||||
_configs_to_remove = [ "//build/config/compiler:chromium_code" ]
|
||||
_configs_to_add = [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
spirv_tools_dir = glslang_spirv_tools_dir
|
||||
|
||||
config("glslang_public") {
|
||||
include_dirs = [ "." ]
|
||||
|
||||
defines = [ "ENABLE_HLSL=1" ]
|
||||
}
|
||||
|
||||
source_set("glslang_sources") {
|
||||
@@ -45,19 +60,24 @@ source_set("glslang_sources") {
|
||||
sources = [
|
||||
"OGLCompilersDLL/InitializeDll.cpp",
|
||||
"OGLCompilersDLL/InitializeDll.h",
|
||||
"SPIRV/GLSL.ext.AMD.h",
|
||||
"SPIRV/GLSL.ext.EXT.h",
|
||||
"SPIRV/GLSL.ext.KHR.h",
|
||||
"SPIRV/GLSL.ext.NV.h",
|
||||
"SPIRV/GLSL.std.450.h",
|
||||
"SPIRV/GlslangToSpv.cpp",
|
||||
"SPIRV/GlslangToSpv.h",
|
||||
"SPIRV/InReadableOrder.cpp",
|
||||
"SPIRV/Logger.cpp",
|
||||
"SPIRV/Logger.h",
|
||||
"SPIRV/NonSemanticDebugPrintf.h",
|
||||
"SPIRV/SPVRemapper.cpp",
|
||||
"SPIRV/SPVRemapper.h",
|
||||
"SPIRV/SpvBuilder.cpp",
|
||||
"SPIRV/SpvBuilder.h",
|
||||
"SPIRV/SpvPostProcess.cpp",
|
||||
"SPIRV/SpvTools.cpp",
|
||||
"SPIRV/SpvTools.h",
|
||||
"SPIRV/bitutils.h",
|
||||
"SPIRV/disassemble.cpp",
|
||||
"SPIRV/disassemble.h",
|
||||
@@ -104,7 +124,6 @@ source_set("glslang_sources") {
|
||||
"glslang/MachineIndependent/attribute.cpp",
|
||||
"glslang/MachineIndependent/attribute.h",
|
||||
"glslang/MachineIndependent/gl_types.h",
|
||||
"glslang/MachineIndependent/glslang.y",
|
||||
"glslang/MachineIndependent/glslang_tab.cpp",
|
||||
"glslang/MachineIndependent/glslang_tab.cpp.h",
|
||||
"glslang/MachineIndependent/intermOut.cpp",
|
||||
@@ -128,9 +147,25 @@ source_set("glslang_sources") {
|
||||
"glslang/MachineIndependent/reflection.h",
|
||||
"glslang/OSDependent/osinclude.h",
|
||||
"glslang/Public/ShaderLang.h",
|
||||
"hlsl/hlslAttributes.cpp",
|
||||
"hlsl/hlslAttributes.h",
|
||||
"hlsl/hlslGrammar.cpp",
|
||||
"hlsl/hlslGrammar.h",
|
||||
"hlsl/hlslOpMap.cpp",
|
||||
"hlsl/hlslOpMap.h",
|
||||
"hlsl/hlslParseHelper.cpp",
|
||||
"hlsl/hlslParseHelper.h",
|
||||
"hlsl/hlslParseables.cpp",
|
||||
"hlsl/hlslParseables.h",
|
||||
"hlsl/hlslScanContext.cpp",
|
||||
"hlsl/hlslScanContext.h",
|
||||
"hlsl/hlslTokenStream.cpp",
|
||||
"hlsl/hlslTokenStream.h",
|
||||
"hlsl/hlslTokens.h",
|
||||
]
|
||||
|
||||
defines = []
|
||||
defines = [ "ENABLE_OPT=1" ]
|
||||
|
||||
if (is_win) {
|
||||
sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
|
||||
defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
|
||||
@@ -140,14 +175,74 @@ source_set("glslang_sources") {
|
||||
}
|
||||
|
||||
if (is_clang) {
|
||||
cflags_cc = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
cflags = [
|
||||
"-Wno-extra-semi",
|
||||
"-Wno-ignored-qualifiers",
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-inconsistent-missing-override",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-unused-variable",
|
||||
"-Wno-missing-field-initializers",
|
||||
"-Wno-newline-eof",
|
||||
]
|
||||
}
|
||||
if (is_win && !is_clang) {
|
||||
cflags = [
|
||||
"/wd4018", # signed/unsigned mismatch
|
||||
"/wd4189", # local variable is initialized but not referenced
|
||||
]
|
||||
}
|
||||
|
||||
deps = [
|
||||
"${spirv_tools_dir}:spvtools_opt",
|
||||
"${spirv_tools_dir}:spvtools_val",
|
||||
]
|
||||
|
||||
configs -= _configs_to_remove
|
||||
configs += _configs_to_add
|
||||
}
|
||||
|
||||
source_set("glslang_default_resource_limits_sources") {
|
||||
sources = [
|
||||
"StandAlone/ResourceLimits.cpp",
|
||||
"StandAlone/ResourceLimits.h",
|
||||
]
|
||||
deps = [
|
||||
":glslang_sources",
|
||||
]
|
||||
public_configs = [ ":glslang_public" ]
|
||||
|
||||
configs -= _configs_to_remove
|
||||
configs += _configs_to_add
|
||||
}
|
||||
|
||||
executable("glslang_validator") {
|
||||
sources = [
|
||||
"StandAlone/DirStackFileIncluder.h",
|
||||
"StandAlone/StandAlone.cpp",
|
||||
]
|
||||
if (!is_win) {
|
||||
cflags = [ "-Woverflow" ]
|
||||
}
|
||||
defines = [ "ENABLE_OPT=1" ]
|
||||
deps = [
|
||||
":glslang_default_resource_limits_sources",
|
||||
":glslang_sources",
|
||||
]
|
||||
|
||||
configs -= _configs_to_remove
|
||||
configs += _configs_to_add
|
||||
}
|
||||
|
||||
executable("spirv-remap") {
|
||||
sources = [
|
||||
"StandAlone/spirv-remap.cpp",
|
||||
]
|
||||
defines = [ "ENABLE_OPT=1" ]
|
||||
deps = [
|
||||
":glslang_sources",
|
||||
]
|
||||
|
||||
configs -= _configs_to_remove
|
||||
configs += _configs_to_add
|
||||
}
|
||||
|
||||
123
third_party/glslang/CMakeLists.txt
vendored
123
third_party/glslang/CMakeLists.txt
vendored
@@ -6,10 +6,17 @@ if (POLICY CMP0048)
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# Enable compile commands database
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Adhere to GNU filesystem layout conventions
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Needed for CMAKE_DEPENDENT_OPTION macro
|
||||
include(CMakeDependentOption)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
|
||||
option(BUILD_EXTERNAL "Build external dependencies in /External" ON)
|
||||
|
||||
set(LIB_TYPE STATIC)
|
||||
|
||||
@@ -23,14 +30,36 @@ if(NOT ${SKIP_GLSLANG_INSTALL})
|
||||
endif()
|
||||
option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON)
|
||||
|
||||
option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON)
|
||||
option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON)
|
||||
|
||||
option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
|
||||
option(ENABLE_GLSLANG_JS
|
||||
"If using Emscripten, build glslang.js. Otherwise, builds a sample executable for binary-size testing." OFF)
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_GLSLANG_WEBMIN
|
||||
"Reduces glslang to minimum needed for web use"
|
||||
OFF "ENABLE_GLSLANG_JS"
|
||||
OFF)
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_GLSLANG_WEBMIN_DEVEL
|
||||
"For ENABLE_GLSLANG_WEBMIN builds, enables compilation error messages"
|
||||
OFF "ENABLE_GLSLANG_WEBMIN"
|
||||
OFF)
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_SINGLE_FILE
|
||||
"If using Emscripten, enables SINGLE_FILE build"
|
||||
OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN"
|
||||
OFF)
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
|
||||
"If using Emscripten, builds to run on Node instead of Web"
|
||||
OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN"
|
||||
OFF)
|
||||
|
||||
option(ENABLE_HLSL "Enables HLSL input support" ON)
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_HLSL
|
||||
"Enables HLSL input support"
|
||||
ON "NOT ENABLE_GLSLANG_WEBMIN"
|
||||
OFF)
|
||||
|
||||
option(ENABLE_RTTI "Enables RTTI" OFF)
|
||||
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
|
||||
option(ENABLE_PCH "Enables Precompiled header" ON)
|
||||
option(ENABLE_CTEST "Enables testing" ON)
|
||||
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
|
||||
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE)
|
||||
@@ -46,12 +75,8 @@ endif()
|
||||
|
||||
# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
|
||||
macro(glslang_pch SRCS PCHCPP)
|
||||
if(MSVC)
|
||||
if (CMAKE_GENERATOR MATCHES "^Visual Studio")
|
||||
set(PCH_NAME "$(IntDir)\\pch.pch")
|
||||
else()
|
||||
set(PCH_NAME "${CMAKE_CURRENT_BINARY_DIR}/pch.pch")
|
||||
endif()
|
||||
if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND ENABLE_PCH)
|
||||
set(PCH_NAME "$(IntDir)\\pch.pch")
|
||||
# make source files use/depend on PCH_NAME
|
||||
set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}")
|
||||
# make PCHCPP file compile and generate PCH_NAME
|
||||
@@ -61,23 +86,24 @@ macro(glslang_pch SRCS PCHCPP)
|
||||
endmacro(glslang_pch)
|
||||
|
||||
project(glslang)
|
||||
# make testing optional
|
||||
include(CTest)
|
||||
|
||||
if(ENABLE_AMD_EXTENSIONS)
|
||||
add_definitions(-DAMD_EXTENSIONS)
|
||||
endif(ENABLE_AMD_EXTENSIONS)
|
||||
|
||||
if(ENABLE_NV_EXTENSIONS)
|
||||
add_definitions(-DNV_EXTENSIONS)
|
||||
endif(ENABLE_NV_EXTENSIONS)
|
||||
if(ENABLE_CTEST)
|
||||
include(CTest)
|
||||
endif()
|
||||
|
||||
if(ENABLE_HLSL)
|
||||
add_definitions(-DENABLE_HLSL)
|
||||
endif(ENABLE_HLSL)
|
||||
|
||||
if(ENABLE_GLSLANG_WEBMIN)
|
||||
add_definitions(-DGLSLANG_WEB)
|
||||
if(ENABLE_GLSLANG_WEBMIN_DEVEL)
|
||||
add_definitions(-DGLSLANG_WEB_DEVEL)
|
||||
endif(ENABLE_GLSLANG_WEBMIN_DEVEL)
|
||||
endif(ENABLE_GLSLANG_WEBMIN)
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Adds a postfix for debug-built libraries.")
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
if(MSVC)
|
||||
include(ChooseMSVCCRT.cmake)
|
||||
endif(MSVC)
|
||||
@@ -92,12 +118,34 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
||||
add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
|
||||
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions)
|
||||
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
|
||||
if(NOT ENABLE_RTTI)
|
||||
add_compile_options(-fno-rtti)
|
||||
endif()
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
|
||||
add_compile_options(-Werror=deprecated-copy)
|
||||
endif()
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
|
||||
-Wunused-parameter -Wunused-value -Wunused-variable)
|
||||
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
|
||||
if(NOT ENABLE_RTTI)
|
||||
add_compile_options(-fno-rtti)
|
||||
endif()
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
|
||||
if(NOT ENABLE_RTTI)
|
||||
add_compile_options(/GR-) # Disable RTTI
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_GLSLANG_JS)
|
||||
if(MSVC)
|
||||
add_compile_options(/Os /GR-)
|
||||
else()
|
||||
add_compile_options(-Os -fno-exceptions)
|
||||
add_link_options(-Os)
|
||||
endif()
|
||||
endif(ENABLE_GLSLANG_JS)
|
||||
|
||||
# Request C++11
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.1)
|
||||
# CMake versions before 3.1 do not understand CMAKE_CXX_STANDARD
|
||||
@@ -118,8 +166,14 @@ function(glslang_set_link_args TARGET)
|
||||
endif()
|
||||
endfunction(glslang_set_link_args)
|
||||
|
||||
# We depend on these for later projects, so they should come first.
|
||||
add_subdirectory(External)
|
||||
# CMake needs to find the right version of python, right from the beginning,
|
||||
# otherwise, it will find the wrong version and fail later
|
||||
if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External)
|
||||
find_package(PythonInterp 3 REQUIRED)
|
||||
|
||||
# We depend on these for later projects, so they should come first.
|
||||
add_subdirectory(External)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET SPIRV-Tools-opt)
|
||||
set(ENABLE_OPT OFF)
|
||||
@@ -144,4 +198,29 @@ add_subdirectory(SPIRV)
|
||||
if(ENABLE_HLSL)
|
||||
add_subdirectory(hlsl)
|
||||
endif(ENABLE_HLSL)
|
||||
add_subdirectory(gtests)
|
||||
if(ENABLE_CTEST)
|
||||
add_subdirectory(gtests)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
# glslang-testsuite runs a bash script on Windows.
|
||||
# Make sure to use '-o igncr' flag to ignore carriage returns (\r).
|
||||
set(IGNORE_CR_FLAG "")
|
||||
if(WIN32)
|
||||
set(IGNORE_CR_FLAG -o igncr)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CONFIGURATION_TYPES)
|
||||
set(RESULTS_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/localResults)
|
||||
set(VALIDATOR_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/$<CONFIGURATION>/glslangValidator)
|
||||
set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/$<CONFIGURATION>/spirv-remap)
|
||||
else(CMAKE_CONFIGURATION_TYPES)
|
||||
set(RESULTS_PATH ${CMAKE_CURRENT_BINARY_DIR}/localResults)
|
||||
set(VALIDATOR_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/glslangValidator)
|
||||
set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/spirv-remap)
|
||||
endif(CMAKE_CONFIGURATION_TYPES)
|
||||
|
||||
add_test(NAME glslang-testsuite
|
||||
COMMAND bash ${IGNORE_CR_FLAG} runtests ${RESULTS_PATH} ${VALIDATOR_PATH} ${REMAP_PATH}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Test/)
|
||||
endif(BUILD_TESTING)
|
||||
|
||||
3
third_party/glslang/External/CMakeLists.txt
vendored
3
third_party/glslang/External/CMakeLists.txt
vendored
@@ -10,7 +10,8 @@ if(BUILD_TESTING)
|
||||
if(WIN32)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
endif(WIN32)
|
||||
add_subdirectory(googletest)
|
||||
# EXCLUDE_FROM_ALL keeps the install target from installing GTEST files.
|
||||
add_subdirectory(googletest EXCLUDE_FROM_ALL)
|
||||
set(GTEST_TARGETS
|
||||
gtest
|
||||
gtest_main
|
||||
|
||||
66
third_party/glslang/LICENSE
vendored
66
third_party/glslang/LICENSE
vendored
@@ -1,7 +1,5 @@
|
||||
Copyright (C) 2015-2018 Google, Inc.
|
||||
Copyright (C) 2017 ARM Limited.
|
||||
Copyright (C) 2012-2017 LunarG, Inc.
|
||||
Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
||||
Copyright (C) <various other dates and companies>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -9,17 +7,17 @@ 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 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.
|
||||
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.
|
||||
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
|
||||
@@ -32,4 +30,46 @@ 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.
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Copyright (c) 2002, NVIDIA Corporation.
|
||||
|
||||
NVIDIA Corporation("NVIDIA") supplies this software to you in
|
||||
consideration of your agreement to the following terms, and your use,
|
||||
installation, modification or redistribution of this NVIDIA software
|
||||
constitutes acceptance of these terms. If you do not agree with these
|
||||
terms, please do not use, install, modify or redistribute this NVIDIA
|
||||
software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, NVIDIA grants you a personal, non-exclusive
|
||||
license, under NVIDIA's copyrights in this original NVIDIA software (the
|
||||
"NVIDIA Software"), to use, reproduce, modify and redistribute the
|
||||
NVIDIA Software, with or without modifications, in source and/or binary
|
||||
forms; provided that if you redistribute the NVIDIA Software, you must
|
||||
retain the copyright notice of NVIDIA, this notice and the following
|
||||
text and disclaimers in all such redistributions of the NVIDIA Software.
|
||||
Neither the name, trademarks, service marks nor logos of NVIDIA
|
||||
Corporation may be used to endorse or promote products derived from the
|
||||
NVIDIA Software without specific prior written permission from NVIDIA.
|
||||
Except as expressly stated in this notice, no other rights or licenses
|
||||
express or implied, are granted by NVIDIA herein, including but not
|
||||
limited to any patent rights that may be infringed by your derivative
|
||||
works or by other works in which the NVIDIA Software may be
|
||||
incorporated. No hardware is licensed hereunder.
|
||||
|
||||
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
|
||||
ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
|
||||
PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
|
||||
INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
|
||||
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
|
||||
NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
|
||||
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
|
||||
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
108
third_party/glslang/LICENSE.txt
vendored
Normal file
108
third_party/glslang/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
Here, glslang proper means core GLSL parsing, HLSL parsing, and SPIR-V code
|
||||
generation. Glslang proper requires use of two licenses, one that covers
|
||||
non-preprocessing and an additional one that covers preprocessing.
|
||||
|
||||
Bison was removed long ago. You can build glslang from the source grammar,
|
||||
using tools of your choice, without using bison or any bison files.
|
||||
|
||||
Other parts, outside of glslang proper, include:
|
||||
|
||||
- gl_types.h, only needed for OpenGL-like reflection, and can be left out of
|
||||
a parse and codegen project. See it for its license.
|
||||
|
||||
- update_glslang_sources.py, which is not part of the project proper and does
|
||||
not need to be used.
|
||||
|
||||
- the SPIR-V "remapper", which is optional, but has the same license as
|
||||
glslang proper
|
||||
|
||||
- Google tests and SPIR-V tools, and anything in the external subdirectory
|
||||
are external and optional; see them for their respective licenses.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
The core of glslang-proper, minus the preprocessor is licenced as follows:
|
||||
|
||||
//
|
||||
// Copyright (C) 2015-2018 Google, Inc.
|
||||
// Copyright (C) <various other dates and companies>
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
The preprocessor has the core license stated above, plus an additional licence:
|
||||
|
||||
/****************************************************************************\
|
||||
Copyright (c) 2002, NVIDIA Corporation.
|
||||
|
||||
NVIDIA Corporation("NVIDIA") supplies this software to you in
|
||||
consideration of your agreement to the following terms, and your use,
|
||||
installation, modification or redistribution of this NVIDIA software
|
||||
constitutes acceptance of these terms. If you do not agree with these
|
||||
terms, please do not use, install, modify or redistribute this NVIDIA
|
||||
software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, NVIDIA grants you a personal, non-exclusive
|
||||
license, under NVIDIA's copyrights in this original NVIDIA software (the
|
||||
"NVIDIA Software"), to use, reproduce, modify and redistribute the
|
||||
NVIDIA Software, with or without modifications, in source and/or binary
|
||||
forms; provided that if you redistribute the NVIDIA Software, you must
|
||||
retain the copyright notice of NVIDIA, this notice and the following
|
||||
text and disclaimers in all such redistributions of the NVIDIA Software.
|
||||
Neither the name, trademarks, service marks nor logos of NVIDIA
|
||||
Corporation may be used to endorse or promote products derived from the
|
||||
NVIDIA Software without specific prior written permission from NVIDIA.
|
||||
Except as expressly stated in this notice, no other rights or licenses
|
||||
express or implied, are granted by NVIDIA herein, including but not
|
||||
limited to any patent rights that may be infringed by your derivative
|
||||
works or by other works in which the NVIDIA Software may be
|
||||
incorporated. No hardware is licensed hereunder.
|
||||
|
||||
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
|
||||
ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
|
||||
PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
|
||||
INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
|
||||
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
|
||||
NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
|
||||
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
|
||||
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
\****************************************************************************/
|
||||
@@ -9,6 +9,7 @@ if(WIN32)
|
||||
endif(WIN32)
|
||||
|
||||
if(ENABLE_GLSLANG_INSTALL)
|
||||
install(TARGETS OGLCompiler
|
||||
install(TARGETS OGLCompiler EXPORT OGLCompilerTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(EXPORT OGLCompilerTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
endif(ENABLE_GLSLANG_INSTALL)
|
||||
|
||||
175
third_party/glslang/README.md
vendored
175
third_party/glslang/README.md
vendored
@@ -1,35 +1,70 @@
|
||||
Also see the Khronos landing page for glslang as a reference front end:
|
||||
|
||||
https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
|
||||
|
||||
The above page includes where to get binaries, and is kept up to date
|
||||
regarding the feature level of glslang.
|
||||
|
||||
glslang
|
||||
=======
|
||||
# News
|
||||
|
||||
[](https://travis-ci.org/KhronosGroup/glslang)
|
||||
[](https://ci.appveyor.com/project/Khronoswebmaster/glslang/branch/master)
|
||||
|
||||
An OpenGL and OpenGL ES shader front end and validator.
|
||||
## Planned Deprecations/Removals
|
||||
|
||||
1. **SPIRV Folder, 1-May, 2020.** Glslang, when installed through CMake,
|
||||
will install a `SPIRV` folder into `${CMAKE_INSTALL_INCLUDEDIR}`.
|
||||
This `SPIRV` folder is being moved to `glslang/SPIRV`.
|
||||
During the transition the `SPIRV` folder will be installed into both locations.
|
||||
The old install of `SPIRV/` will be removed as a CMake install target no sooner than May 1, 2020.
|
||||
See issue #1964.
|
||||
|
||||
2. **Visual Studio 2013, 20-July, 2020.** Keeping code compiling for MS Visual Studio 2013 will no longer be
|
||||
a goal as of July 20, 2020, the fifth anniversary of the release of Visual Studio 2015.
|
||||
|
||||
# Glslang Components and Status
|
||||
|
||||
There are several components:
|
||||
|
||||
1. A GLSL/ESSL front-end for reference validation and translation of GLSL/ESSL into an AST.
|
||||
### Reference Validator and GLSL/ESSL -> AST Front End
|
||||
|
||||
2. An HLSL front-end for translation of a broad generic HLL into the AST. See [issue 362](https://github.com/KhronosGroup/glslang/issues/362) and [issue 701](https://github.com/KhronosGroup/glslang/issues/701) for current status.
|
||||
An OpenGL GLSL and OpenGL|ES GLSL (ESSL) front-end for reference validation and translation of GLSL/ESSL into an internal abstract syntax tree (AST).
|
||||
|
||||
3. A SPIR-V back end for translating the AST to SPIR-V.
|
||||
**Status**: Virtually complete, with results carrying similar weight as the specifications.
|
||||
|
||||
4. A standalone wrapper, `glslangValidator`, that can be used as a command-line tool for the above.
|
||||
### HLSL -> AST Front End
|
||||
|
||||
How to add a feature protected by a version/extension/stage/profile: See the
|
||||
comment in `glslang/MachineIndependent/Versions.cpp`.
|
||||
An HLSL front-end for translation of an approximation of HLSL to glslang's AST form.
|
||||
|
||||
**Status**: Partially complete. Semantics are not reference quality and input is not validated.
|
||||
This is in contrast to the [DXC project](https://github.com/Microsoft/DirectXShaderCompiler), which receives a much larger investment and attempts to have definitive/reference-level semantics.
|
||||
|
||||
See [issue 362](https://github.com/KhronosGroup/glslang/issues/362) and [issue 701](https://github.com/KhronosGroup/glslang/issues/701) for current status.
|
||||
|
||||
### AST -> SPIR-V Back End
|
||||
|
||||
Translates glslang's AST to the Khronos-specified SPIR-V intermediate language.
|
||||
|
||||
**Status**: Virtually complete.
|
||||
|
||||
### Reflector
|
||||
|
||||
An API for getting reflection information from the AST, reflection types/variables/etc. from the HLL source (not the SPIR-V).
|
||||
|
||||
**Status**: There is a large amount of functionality present, but no specification/goal to measure completeness against. It is accurate for the input HLL and AST, but only approximate for what would later be emitted for SPIR-V.
|
||||
|
||||
### Standalone Wrapper
|
||||
|
||||
`glslangValidator` is command-line tool for accessing the functionality above.
|
||||
|
||||
Status: Complete.
|
||||
|
||||
Tasks waiting to be done are documented as GitHub issues.
|
||||
|
||||
Execution of Standalone Wrapper
|
||||
-------------------------------
|
||||
## Other References
|
||||
|
||||
Also see the Khronos landing page for glslang as a reference front end:
|
||||
|
||||
https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
|
||||
|
||||
The above page, while not kept up to date, includes additional information regarding glslang as a reference validator.
|
||||
|
||||
# How to Use Glslang
|
||||
|
||||
## Execution of Standalone Wrapper
|
||||
|
||||
To use the standalone binary form, execute `glslangValidator`, and it will print
|
||||
a usage statement. Basic operation is to give it a file containing a shader,
|
||||
@@ -46,8 +81,7 @@ The applied stage-specific rules are based on the file extension:
|
||||
There is also a non-shader extension
|
||||
* `.conf` for a configuration file of limits, see usage statement for example
|
||||
|
||||
Building
|
||||
--------
|
||||
## Building
|
||||
|
||||
Instead of building manually, you can also download the binaries for your
|
||||
platform directly from the [master-tot release][master-tot-release] on GitHub.
|
||||
@@ -61,7 +95,7 @@ branch.
|
||||
(For MSVS: 2015 is recommended, 2013 is fully supported/tested, and 2010 support is attempted, but not tested.)
|
||||
* [CMake][cmake]: for generating compilation targets.
|
||||
* make: _Linux_, ninja is an alternative, if configured.
|
||||
* [Python 2.7][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools.)
|
||||
* [Python 3.x][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools and the 'External' subdirectory does not exist.)
|
||||
* [bison][bison]: _optional_, but needed when changing the grammar (glslang.y).
|
||||
* [googletest][googletest]: _optional_, but should use if making any changes to glslang.
|
||||
|
||||
@@ -70,7 +104,7 @@ branch.
|
||||
The following steps assume a Bash shell. On Windows, that could be the Git Bash
|
||||
shell or some other shell of your choosing.
|
||||
|
||||
#### 1) Check-Out this project
|
||||
#### 1) Check-Out this project
|
||||
|
||||
```bash
|
||||
cd <parent of where you want glslang to be>
|
||||
@@ -94,8 +128,8 @@ cd ../..
|
||||
```
|
||||
|
||||
If you wish to assure that SPIR-V generated from HLSL is legal for Vulkan,
|
||||
or wish to invoke -Os to reduce SPIR-V size from HLSL or GLSL, install
|
||||
spirv-tools with this:
|
||||
wish to invoke -Os to reduce SPIR-V size from HLSL or GLSL, or wish to run the
|
||||
integrated test suite, install spirv-tools with this:
|
||||
|
||||
```bash
|
||||
./update_glslang_sources.py
|
||||
@@ -118,6 +152,14 @@ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE
|
||||
# "Release" (for CMAKE_BUILD_TYPE) could also be "Debug" or "RelWithDebInfo"
|
||||
```
|
||||
|
||||
For building on Android:
|
||||
```bash
|
||||
cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_ROOT/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake
|
||||
# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_ROOT%\prebuilt\windows-x86_64\bin\make.exe
|
||||
# -G is needed for building on Windows
|
||||
# -DANDROID_ABI can also be armeabi-v7a for 32 bit
|
||||
```
|
||||
|
||||
For building on Windows:
|
||||
|
||||
```bash
|
||||
@@ -127,6 +169,9 @@ cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX="$(pwd)/install"
|
||||
|
||||
The CMake GUI also works for Windows (version 3.4.1 tested).
|
||||
|
||||
Also, consider using `git config --global core.fileMode false` (or with `--local`) on Windows
|
||||
to prevent the addition of execution permission on files.
|
||||
|
||||
#### 4) Build and Install
|
||||
|
||||
```bash
|
||||
@@ -152,16 +197,55 @@ changes are quite infrequent. For windows you can get binaries from
|
||||
The command to rebuild is:
|
||||
|
||||
```bash
|
||||
m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
|
||||
bison --defines=MachineIndependent/glslang_tab.cpp.h
|
||||
-t MachineIndependent/glslang.y
|
||||
-o MachineIndependent/glslang_tab.cpp
|
||||
```
|
||||
|
||||
The above command is also available in the bash script at
|
||||
`glslang/updateGrammar`.
|
||||
The above commands are also available in the bash script in `updateGrammar`,
|
||||
when executed from the glslang subdirectory of the glslang repository.
|
||||
With no arguments it builds the full grammar, and with a "web" argument,
|
||||
the web grammar subset (see more about the web subset in the next section).
|
||||
|
||||
Testing
|
||||
-------
|
||||
### Building to WASM for the Web and Node
|
||||
|
||||
Use the steps in [Build Steps](#build-steps), with the following notes/exceptions:
|
||||
* For building the web subset of core glslang:
|
||||
+ execute `updateGrammar web` from the glslang subdirectory
|
||||
(or if using your own scripts, `m4` needs a `-DGLSLANG_WEB` argument)
|
||||
+ set `-DENABLE_HLSL=OFF -DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF`
|
||||
+ turn on `-DENABLE_GLSLANG_JS=ON`
|
||||
+ optionally, for a minimum-size binary, turn on `-DENABLE_GLSLANG_WEBMIN=ON`
|
||||
+ optionally, for GLSL compilation error messages, turn on `-DENABLE_GLSLANG_WEB_DEVEL=ON`
|
||||
* `emsdk` needs to be present in your executable search path, *PATH* for
|
||||
Bash-like environments
|
||||
+ [Instructions located
|
||||
here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install)
|
||||
* Wrap cmake call: `emcmake cmake`
|
||||
* To get a fully minimized build, make sure to use `brotli` to compress the .js
|
||||
and .wasm files
|
||||
|
||||
Example:
|
||||
|
||||
```sh
|
||||
emcmake cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_WEB=ON \
|
||||
-DENABLE_HLSL=OFF -DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF ..
|
||||
```
|
||||
|
||||
## Building glslang - Using vcpkg
|
||||
|
||||
You can download and install glslang using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
./vcpkg install glslang
|
||||
|
||||
The glslang port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
|
||||
## Testing
|
||||
|
||||
Right now, there are two test harnesses existing in glslang: one is [Google
|
||||
Test](gtests/), one is the [`runtests` script](Test/runtests). The former
|
||||
@@ -197,6 +281,11 @@ Running `runtests` script-backed tests:
|
||||
cd $SOURCE_DIR/Test && ./runtests
|
||||
```
|
||||
|
||||
If some tests fail with validation errors, there may be a mismatch between the
|
||||
version of `spirv-val` on the system and the version of glslang. In this
|
||||
case, it is necessary to run `update_glslang_sources.py`. See "Check-Out
|
||||
External Projects" above for more details.
|
||||
|
||||
### Contributing tests
|
||||
|
||||
Test results should always be included with a pull request that modifies
|
||||
@@ -228,8 +317,7 @@ You can add your own private list of tests, not tracked publicly, by using
|
||||
`localtestlist` to list non-tracked tests. This is automatically read
|
||||
by `runtests` and included in the `diff` and `bump` process.
|
||||
|
||||
Programmatic Interfaces
|
||||
-----------------------
|
||||
## Programmatic Interfaces
|
||||
|
||||
Another piece of software can programmatically translate shaders to an AST
|
||||
using one of two different interfaces:
|
||||
@@ -241,7 +329,8 @@ The `main()` in `StandAlone/StandAlone.cpp` shows examples using both styles.
|
||||
### C++ Class Interface (new, preferred)
|
||||
|
||||
This interface is in roughly the last 1/3 of `ShaderLang.h`. It is in the
|
||||
glslang namespace and contains the following.
|
||||
glslang namespace and contains the following, here with suggested calls
|
||||
for generating SPIR-V:
|
||||
|
||||
```cxx
|
||||
const char* GetEsslVersionString();
|
||||
@@ -264,16 +353,25 @@ class TProgram
|
||||
Reflection queries
|
||||
```
|
||||
|
||||
See `ShaderLang.h` and the usage of it in `StandAlone/StandAlone.cpp` for more
|
||||
details.
|
||||
For just validating (not generating code), substitute these calls:
|
||||
|
||||
### C Functional Interface (orignal)
|
||||
```cxx
|
||||
setEnvInput(EShSourceHlsl or EShSourceGlsl, stage, EShClientNone, 0);
|
||||
setEnvClient(EShClientNone, 0);
|
||||
setEnvTarget(EShTargetNone, 0);
|
||||
```
|
||||
|
||||
See `ShaderLang.h` and the usage of it in `StandAlone/StandAlone.cpp` for more
|
||||
details. There is a block comment giving more detail above the calls for
|
||||
`setEnvInput, setEnvClient, and setEnvTarget`.
|
||||
|
||||
### C Functional Interface (original)
|
||||
|
||||
This interface is in roughly the first 2/3 of `ShaderLang.h`, and referred to
|
||||
as the `Sh*()` interface, as all the entry points start `Sh`.
|
||||
|
||||
The `Sh*()` interface takes a "compiler" call-back object, which it calls after
|
||||
building call back that is passed the AST and can then execute a backend on it.
|
||||
building call back that is passed the AST and can then execute a back end on it.
|
||||
|
||||
The following is a simplified resulting run-time call stack:
|
||||
|
||||
@@ -284,8 +382,7 @@ ShCompile(shader, compiler) -> compiler(AST) -> <back end>
|
||||
In practice, `ShCompile()` takes shader strings, default version, and
|
||||
warning/error and other options for controlling compilation.
|
||||
|
||||
Basic Internal Operation
|
||||
------------------------
|
||||
## Basic Internal Operation
|
||||
|
||||
* Initial lexical analysis is done by the preprocessor in
|
||||
`MachineIndependent/Preprocessor`, and then refined by a GLSL scanner
|
||||
@@ -300,7 +397,7 @@ Basic Internal Operation
|
||||
* The intermediate representation is very high-level, and represented
|
||||
as an in-memory tree. This serves to lose no information from the
|
||||
original program, and to have efficient transfer of the result from
|
||||
parsing to the back-end. In the AST, constants are propogated and
|
||||
parsing to the back-end. In the AST, constants are propagated and
|
||||
folded, and a very small amount of dead code is eliminated.
|
||||
|
||||
To aid linking and reflection, the last top-level branch in the AST
|
||||
@@ -332,6 +429,8 @@ Basic Internal Operation
|
||||
- the object does not come from the pool, and you have to do normal
|
||||
C++ memory management of what you `new`
|
||||
|
||||
* Features can be protected by version/extension/stage/profile:
|
||||
See the comment in `glslang/MachineIndependent/Versions.cpp`.
|
||||
|
||||
[cmake]: https://cmake.org/
|
||||
[python]: https://www.python.org/
|
||||
|
||||
43
third_party/glslang/SPIRV/CMakeLists.txt
vendored
43
third_party/glslang/SPIRV/CMakeLists.txt
vendored
@@ -25,28 +25,21 @@ set(HEADERS
|
||||
spvIR.h
|
||||
doc.h
|
||||
SpvTools.h
|
||||
disassemble.h)
|
||||
disassemble.h
|
||||
GLSL.ext.AMD.h
|
||||
GLSL.ext.NV.h
|
||||
NonSemanticDebugPrintf.h)
|
||||
|
||||
set(SPVREMAP_HEADERS
|
||||
SPVRemapper.h
|
||||
doc.h)
|
||||
|
||||
if(ENABLE_AMD_EXTENSIONS)
|
||||
list(APPEND
|
||||
HEADERS
|
||||
GLSL.ext.AMD.h)
|
||||
endif(ENABLE_AMD_EXTENSIONS)
|
||||
|
||||
if(ENABLE_NV_EXTENSIONS)
|
||||
list(APPEND
|
||||
HEADERS
|
||||
GLSL.ext.NV.h)
|
||||
endif(ENABLE_NV_EXTENSIONS)
|
||||
|
||||
add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
|
||||
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
|
||||
set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
target_include_directories(SPIRV PUBLIC ..)
|
||||
target_include_directories(SPIRV PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
|
||||
if (ENABLE_SPVREMAPPER)
|
||||
add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
|
||||
@@ -67,7 +60,9 @@ if(ENABLE_OPT)
|
||||
PRIVATE ${spirv-tools_SOURCE_DIR}/source
|
||||
)
|
||||
target_link_libraries(SPIRV glslang SPIRV-Tools-opt)
|
||||
target_include_directories(SPIRV PUBLIC ../External)
|
||||
target_include_directories(SPIRV PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
|
||||
else()
|
||||
target_link_libraries(SPIRV glslang)
|
||||
endif(ENABLE_OPT)
|
||||
@@ -80,21 +75,29 @@ endif(WIN32)
|
||||
if(ENABLE_GLSLANG_INSTALL)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if (ENABLE_SPVREMAPPER)
|
||||
install(TARGETS SPVRemapper
|
||||
install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
install(TARGETS SPIRV
|
||||
install(TARGETS SPIRV EXPORT SPIRVTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
else()
|
||||
if (ENABLE_SPVREMAPPER)
|
||||
install(TARGETS SPVRemapper
|
||||
install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
install(TARGETS SPIRV
|
||||
install(TARGETS SPIRV EXPORT SPIRVTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
if (ENABLE_SPVREMAPPER)
|
||||
install(EXPORT SPVRemapperTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
endif()
|
||||
|
||||
install(EXPORT SPIRVTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
|
||||
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/)
|
||||
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
|
||||
endif(ENABLE_GLSLANG_INSTALL)
|
||||
|
||||
4
third_party/glslang/SPIRV/GLSL.ext.EXT.h
vendored
4
third_party/glslang/SPIRV/GLSL.ext.EXT.h
vendored
@@ -28,10 +28,12 @@
|
||||
#define GLSLextEXT_H
|
||||
|
||||
static const int GLSLextEXTVersion = 100;
|
||||
static const int GLSLextEXTRevision = 1;
|
||||
static const int GLSLextEXTRevision = 2;
|
||||
|
||||
static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export";
|
||||
static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer";
|
||||
static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered";
|
||||
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";
|
||||
|
||||
#endif // #ifndef GLSLextEXT_H
|
||||
|
||||
5
third_party/glslang/SPIRV/GLSL.ext.KHR.h
vendored
5
third_party/glslang/SPIRV/GLSL.ext.KHR.h
vendored
@@ -40,5 +40,10 @@ static const char* const E_SPV_KHR_8bit_storage = "SPV_KHR_8bit_
|
||||
static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class";
|
||||
static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage";
|
||||
static const char* const E_SPV_KHR_vulkan_memory_model = "SPV_KHR_vulkan_memory_model";
|
||||
static const char* const E_SPV_EXT_physical_storage_buffer = "SPV_EXT_physical_storage_buffer";
|
||||
static const char* const E_SPV_KHR_physical_storage_buffer = "SPV_KHR_physical_storage_buffer";
|
||||
static const char* const E_SPV_EXT_fragment_shader_interlock = "SPV_EXT_fragment_shader_interlock";
|
||||
static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shader_clock";
|
||||
static const char* const E_SPV_KHR_non_semantic_info = "SPV_KHR_non_semantic_info";
|
||||
|
||||
#endif // #ifndef GLSLextKHR_H
|
||||
|
||||
6
third_party/glslang/SPIRV/GLSL.ext.NV.h
vendored
6
third_party/glslang/SPIRV/GLSL.ext.NV.h
vendored
@@ -72,4 +72,10 @@ const char* const E_SPV_NV_ray_tracing = "SPV_NV_ray_tracing";
|
||||
//SPV_NV_shading_rate
|
||||
const char* const E_SPV_NV_shading_rate = "SPV_NV_shading_rate";
|
||||
|
||||
//SPV_NV_cooperative_matrix
|
||||
const char* const E_SPV_NV_cooperative_matrix = "SPV_NV_cooperative_matrix";
|
||||
|
||||
//SPV_NV_shader_sm_builtins
|
||||
const char* const E_SPV_NV_shader_sm_builtins = "SPV_NV_shader_sm_builtins";
|
||||
|
||||
#endif // #ifndef GLSLextNV_H
|
||||
|
||||
2435
third_party/glslang/SPIRV/GlslangToSpv.cpp
vendored
2435
third_party/glslang/SPIRV/GlslangToSpv.cpp
vendored
File diff suppressed because it is too large
Load Diff
3
third_party/glslang/SPIRV/GlslangToSpv.h
vendored
3
third_party/glslang/SPIRV/GlslangToSpv.h
vendored
@@ -1,5 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2014 LunarG, Inc.
|
||||
// Copyright (C) 2015-2018 Google, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -39,7 +40,7 @@
|
||||
#endif
|
||||
|
||||
#include "SpvTools.h"
|
||||
#include "../glslang/Include/intermediate.h"
|
||||
#include "glslang/Include/intermediate.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
44
third_party/glslang/SPIRV/InReadableOrder.cpp
vendored
44
third_party/glslang/SPIRV/InReadableOrder.cpp
vendored
@@ -61,17 +61,22 @@ namespace {
|
||||
// Use by calling visit() on the root block.
|
||||
class ReadableOrderTraverser {
|
||||
public:
|
||||
explicit ReadableOrderTraverser(std::function<void(Block*)> callback) : callback_(callback) {}
|
||||
ReadableOrderTraverser(std::function<void(Block*, spv::ReachReason, Block*)> callback)
|
||||
: callback_(callback) {}
|
||||
// Visits the block if it hasn't been visited already and isn't currently
|
||||
// being delayed. Invokes callback(block), then descends into its
|
||||
// being delayed. Invokes callback(block, why, header), then descends into its
|
||||
// successors. Delays merge-block and continue-block processing until all
|
||||
// the branches have been completed.
|
||||
void visit(Block* block)
|
||||
// the branches have been completed. If |block| is an unreachable merge block or
|
||||
// an unreachable continue target, then |header| is the corresponding header block.
|
||||
void visit(Block* block, spv::ReachReason why, Block* header)
|
||||
{
|
||||
assert(block);
|
||||
if (why == spv::ReachViaControlFlow) {
|
||||
reachableViaControlFlow_.insert(block);
|
||||
}
|
||||
if (visited_.count(block) || delayed_.count(block))
|
||||
return;
|
||||
callback_(block);
|
||||
callback_(block, why, header);
|
||||
visited_.insert(block);
|
||||
Block* mergeBlock = nullptr;
|
||||
Block* continueBlock = nullptr;
|
||||
@@ -87,27 +92,40 @@ public:
|
||||
delayed_.insert(continueBlock);
|
||||
}
|
||||
}
|
||||
const auto successors = block->getSuccessors();
|
||||
for (auto it = successors.cbegin(); it != successors.cend(); ++it)
|
||||
visit(*it);
|
||||
if (why == spv::ReachViaControlFlow) {
|
||||
const auto& successors = block->getSuccessors();
|
||||
for (auto it = successors.cbegin(); it != successors.cend(); ++it)
|
||||
visit(*it, why, nullptr);
|
||||
}
|
||||
if (continueBlock) {
|
||||
const spv::ReachReason continueWhy =
|
||||
(reachableViaControlFlow_.count(continueBlock) > 0)
|
||||
? spv::ReachViaControlFlow
|
||||
: spv::ReachDeadContinue;
|
||||
delayed_.erase(continueBlock);
|
||||
visit(continueBlock);
|
||||
visit(continueBlock, continueWhy, block);
|
||||
}
|
||||
if (mergeBlock) {
|
||||
const spv::ReachReason mergeWhy =
|
||||
(reachableViaControlFlow_.count(mergeBlock) > 0)
|
||||
? spv::ReachViaControlFlow
|
||||
: spv::ReachDeadMerge;
|
||||
delayed_.erase(mergeBlock);
|
||||
visit(mergeBlock);
|
||||
visit(mergeBlock, mergeWhy, block);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::function<void(Block*)> callback_;
|
||||
std::function<void(Block*, spv::ReachReason, Block*)> callback_;
|
||||
// Whether a block has already been visited or is being delayed.
|
||||
std::unordered_set<Block *> visited_, delayed_;
|
||||
|
||||
// The set of blocks that actually are reached via control flow.
|
||||
std::unordered_set<Block *> reachableViaControlFlow_;
|
||||
};
|
||||
}
|
||||
|
||||
void spv::inReadableOrder(Block* root, std::function<void(Block*)> callback)
|
||||
void spv::inReadableOrder(Block* root, std::function<void(Block*, spv::ReachReason, Block*)> callback)
|
||||
{
|
||||
ReadableOrderTraverser(callback).visit(root);
|
||||
ReadableOrderTraverser(callback).visit(root, spv::ReachViaControlFlow, nullptr);
|
||||
}
|
||||
|
||||
4
third_party/glslang/SPIRV/Logger.cpp
vendored
4
third_party/glslang/SPIRV/Logger.cpp
vendored
@@ -32,6 +32,8 @@
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -66,3 +68,5 @@ std::string SpvBuildLogger::getAllMessages() const {
|
||||
}
|
||||
|
||||
} // end spv namespace
|
||||
|
||||
#endif
|
||||
9
third_party/glslang/SPIRV/Logger.h
vendored
9
third_party/glslang/SPIRV/Logger.h
vendored
@@ -46,6 +46,14 @@ class SpvBuildLogger {
|
||||
public:
|
||||
SpvBuildLogger() {}
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
void tbdFunctionality(const std::string& f) { }
|
||||
void missingFunctionality(const std::string& f) { }
|
||||
void warning(const std::string& w) { }
|
||||
void error(const std::string& e) { errors.push_back(e); }
|
||||
std::string getAllMessages() { return ""; }
|
||||
#else
|
||||
|
||||
// Registers a TBD functionality.
|
||||
void tbdFunctionality(const std::string& f);
|
||||
// Registers a missing functionality.
|
||||
@@ -59,6 +67,7 @@ public:
|
||||
// Returns all messages accumulated in the order of:
|
||||
// TBD functionalities, missing functionalities, warnings, errors.
|
||||
std::string getAllMessages() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
SpvBuildLogger(const SpvBuildLogger&);
|
||||
|
||||
50
third_party/glslang/SPIRV/NonSemanticDebugPrintf.h
vendored
Normal file
50
third_party/glslang/SPIRV/NonSemanticDebugPrintf.h
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2020 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_NonSemanticDebugPrintf_H_
|
||||
#define SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
NonSemanticDebugPrintfRevision = 1,
|
||||
NonSemanticDebugPrintfRevision_BitWidthPadding = 0x7fffffff
|
||||
};
|
||||
|
||||
enum NonSemanticDebugPrintfInstructions {
|
||||
NonSemanticDebugPrintfDebugPrintf = 1,
|
||||
NonSemanticDebugPrintfInstructionsMax = 0x7fffffff
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_
|
||||
4
third_party/glslang/SPIRV/SPVRemapper.h
vendored
4
third_party/glslang/SPIRV/SPVRemapper.h
vendored
@@ -45,7 +45,7 @@ namespace spv {
|
||||
|
||||
// MSVC defines __cplusplus as an older value, even when it supports almost all of 11.
|
||||
// We handle that here by making our own symbol.
|
||||
#if __cplusplus >= 201103L || _MSC_VER >= 1700
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
|
||||
# define use_cpp11 1
|
||||
#endif
|
||||
|
||||
@@ -195,7 +195,7 @@ private:
|
||||
// Header access & set methods
|
||||
spirword_t magic() const { return spv[0]; } // return magic number
|
||||
spirword_t bound() const { return spv[3]; } // return Id bound from header
|
||||
spirword_t bound(spirword_t b) { return spv[3] = b; };
|
||||
spirword_t bound(spirword_t b) { return spv[3] = b; }
|
||||
spirword_t genmagic() const { return spv[2]; } // generator magic
|
||||
spirword_t genmagic(spirword_t m) { return spv[2] = m; }
|
||||
spirword_t schemaNum() const { return spv[4]; } // schema number from header
|
||||
|
||||
378
third_party/glslang/SPIRV/SpvBuilder.cpp
vendored
378
third_party/glslang/SPIRV/SpvBuilder.cpp
vendored
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2014-2015 LunarG, Inc.
|
||||
// Copyright (C) 2015-2016 Google, Inc.
|
||||
// Copyright (C) 2015-2018 Google, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -46,7 +46,9 @@
|
||||
|
||||
#include "SpvBuilder.h"
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
#include "hex_float.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <cstdio>
|
||||
@@ -60,6 +62,7 @@ Builder::Builder(unsigned int spvVersion, unsigned int magicNumber, SpvBuildLogg
|
||||
sourceVersion(0),
|
||||
sourceFileStringId(NoResult),
|
||||
currentLine(0),
|
||||
currentFile(nullptr),
|
||||
emitOpLines(false),
|
||||
addressModel(AddressingModelLogical),
|
||||
memoryModel(MemoryModelGLSL450),
|
||||
@@ -87,8 +90,9 @@ Id Builder::import(const char* name)
|
||||
return import->getResultId();
|
||||
}
|
||||
|
||||
// Emit an OpLine if we've been asked to emit OpLines and the line number
|
||||
// has changed since the last time, and is a valid line number.
|
||||
// Emit instruction for non-filename-based #line directives (ie. no filename
|
||||
// seen yet): emit an OpLine if we've been asked to emit OpLines and the line
|
||||
// number has changed since the last time, and is a valid line number.
|
||||
void Builder::setLine(int lineNum)
|
||||
{
|
||||
if (lineNum != 0 && lineNum != currentLine) {
|
||||
@@ -98,6 +102,26 @@ void Builder::setLine(int lineNum)
|
||||
}
|
||||
}
|
||||
|
||||
// If no filename, do non-filename-based #line emit. Else do filename-based emit.
|
||||
// Emit OpLine if we've been asked to emit OpLines and the line number or filename
|
||||
// has changed since the last time, and line number is valid.
|
||||
void Builder::setLine(int lineNum, const char* filename)
|
||||
{
|
||||
if (filename == nullptr) {
|
||||
setLine(lineNum);
|
||||
return;
|
||||
}
|
||||
if ((lineNum != 0 && lineNum != currentLine) || currentFile == nullptr ||
|
||||
strncmp(filename, currentFile, strlen(currentFile) + 1) != 0) {
|
||||
currentLine = lineNum;
|
||||
currentFile = filename;
|
||||
if (emitOpLines) {
|
||||
spv::Id strId = getStringId(filename);
|
||||
addLine(strId, currentLine, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Builder::addLine(Id fileName, int lineNum, int column)
|
||||
{
|
||||
Instruction* line = new Instruction(OpLine);
|
||||
@@ -172,8 +196,47 @@ Id Builder::makePointer(StorageClass storageClass, Id pointee)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeForwardPointer(StorageClass storageClass)
|
||||
{
|
||||
// Caching/uniquifying doesn't work here, because we don't know the
|
||||
// pointee type and there can be multiple forward pointers of the same
|
||||
// storage type. Somebody higher up in the stack must keep track.
|
||||
Instruction* type = new Instruction(getUniqueId(), NoType, OpTypeForwardPointer);
|
||||
type->addImmediateOperand(storageClass);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardPointerType, Id pointee)
|
||||
{
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {
|
||||
type = groupedTypes[OpTypePointer][t];
|
||||
if (type->getImmediateOperand(0) == (unsigned)storageClass &&
|
||||
type->getIdOperand(1) == pointee)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
type = new Instruction(forwardPointerType, NoType, OpTypePointer);
|
||||
type->addImmediateOperand(storageClass);
|
||||
type->addIdOperand(pointee);
|
||||
groupedTypes[OpTypePointer].push_back(type);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeIntegerType(int width, bool hasSign)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(width == 32);
|
||||
width = 32;
|
||||
#endif
|
||||
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) {
|
||||
@@ -209,6 +272,11 @@ Id Builder::makeIntegerType(int width, bool hasSign)
|
||||
|
||||
Id Builder::makeFloatType(int width)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(width == 32);
|
||||
width = 32;
|
||||
#endif
|
||||
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) {
|
||||
@@ -332,6 +400,33 @@ Id Builder::makeMatrixType(Id component, int cols, int rows)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols)
|
||||
{
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypeCooperativeMatrixNV].size(); ++t) {
|
||||
type = groupedTypes[OpTypeCooperativeMatrixNV][t];
|
||||
if (type->getIdOperand(0) == component &&
|
||||
type->getIdOperand(1) == scope &&
|
||||
type->getIdOperand(2) == rows &&
|
||||
type->getIdOperand(3) == cols)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
// not found, make it
|
||||
type = new Instruction(getUniqueId(), NoType, OpTypeCooperativeMatrixNV);
|
||||
type->addIdOperand(component);
|
||||
type->addIdOperand(scope);
|
||||
type->addIdOperand(rows);
|
||||
type->addIdOperand(cols);
|
||||
groupedTypes[OpTypeCooperativeMatrixNV].push_back(type);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
|
||||
// TODO: performance: track arrays per stride
|
||||
// If a stride is supplied (non-zero) make an array.
|
||||
// If no stride (0), reuse previous array types.
|
||||
@@ -401,7 +496,8 @@ Id Builder::makeFunctionType(Id returnType, const std::vector<Id>& paramTypes)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format)
|
||||
Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled,
|
||||
ImageFormat format)
|
||||
{
|
||||
assert(sampled == 1 || sampled == 2);
|
||||
|
||||
@@ -433,6 +529,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// deal with capabilities
|
||||
switch (dim) {
|
||||
case DimBuffer:
|
||||
@@ -478,6 +575,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
||||
addCapability(CapabilityImageMSArray);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
@@ -503,12 +601,13 @@ Id Builder::makeSampledImageType(Id imageType)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
Id Builder::makeAccelerationStructureNVType()
|
||||
{
|
||||
Instruction *type;
|
||||
if (groupedTypes[OpTypeAccelerationStructureNV].size() == 0) {
|
||||
type = new Instruction(getUniqueId(), NoType, OpTypeAccelerationStructureNV);
|
||||
groupedTypes[OpTypeAccelerationStructureNV].push_back(type);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
} else {
|
||||
@@ -518,6 +617,7 @@ Id Builder::makeAccelerationStructureNVType()
|
||||
return type->getResultId();
|
||||
}
|
||||
#endif
|
||||
|
||||
Id Builder::getDerefTypeId(Id resultId) const
|
||||
{
|
||||
Id typeId = getTypeId(resultId);
|
||||
@@ -554,6 +654,7 @@ int Builder::getNumTypeConstituents(Id typeId) const
|
||||
case OpTypeBool:
|
||||
case OpTypeInt:
|
||||
case OpTypeFloat:
|
||||
case OpTypePointer:
|
||||
return 1;
|
||||
case OpTypeVector:
|
||||
case OpTypeMatrix:
|
||||
@@ -565,6 +666,9 @@ int Builder::getNumTypeConstituents(Id typeId) const
|
||||
}
|
||||
case OpTypeStruct:
|
||||
return instr->getNumOperands();
|
||||
case OpTypeCooperativeMatrixNV:
|
||||
// has only one constituent when used with OpCompositeConstruct.
|
||||
return 1;
|
||||
default:
|
||||
assert(0);
|
||||
return 1;
|
||||
@@ -611,6 +715,7 @@ Id Builder::getContainedTypeId(Id typeId, int member) const
|
||||
case OpTypeMatrix:
|
||||
case OpTypeArray:
|
||||
case OpTypeRuntimeArray:
|
||||
case OpTypeCooperativeMatrixNV:
|
||||
return instr->getIdOperand(0);
|
||||
case OpTypePointer:
|
||||
return instr->getIdOperand(1);
|
||||
@@ -647,17 +752,36 @@ bool Builder::containsType(Id typeId, spv::Op typeOp, unsigned int width) const
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case OpTypePointer:
|
||||
return false;
|
||||
case OpTypeVector:
|
||||
case OpTypeMatrix:
|
||||
case OpTypeArray:
|
||||
case OpTypeRuntimeArray:
|
||||
case OpTypePointer:
|
||||
return containsType(getContainedTypeId(typeId), typeOp, width);
|
||||
default:
|
||||
return typeClass == typeOp;
|
||||
}
|
||||
}
|
||||
|
||||
// return true if the type is a pointer to PhysicalStorageBufferEXT or an
|
||||
// array of such pointers. These require restrict/aliased decorations.
|
||||
bool Builder::containsPhysicalStorageBufferOrArray(Id typeId) const
|
||||
{
|
||||
const Instruction& instr = *module.getInstruction(typeId);
|
||||
|
||||
Op typeClass = instr.getOpCode();
|
||||
switch (typeClass)
|
||||
{
|
||||
case OpTypePointer:
|
||||
return getTypeStorageClass(typeId) == StorageClassPhysicalStorageBufferEXT;
|
||||
case OpTypeArray:
|
||||
return containsPhysicalStorageBufferOrArray(getContainedTypeId(typeId));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// See if a scalar constant of this type has already been created, so it
|
||||
// can be reused rather than duplicated. (Required by the specification).
|
||||
Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value)
|
||||
@@ -831,6 +955,10 @@ Id Builder::makeFloatConstant(float f, bool specConstant)
|
||||
|
||||
Id Builder::makeDoubleConstant(double d, bool specConstant)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(0);
|
||||
return NoResult;
|
||||
#else
|
||||
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
||||
Id typeId = makeFloatType(64);
|
||||
union { double db; unsigned long long ull; } u;
|
||||
@@ -855,10 +983,15 @@ Id Builder::makeDoubleConstant(double d, bool specConstant)
|
||||
module.mapInstruction(c);
|
||||
|
||||
return c->getResultId();
|
||||
#endif
|
||||
}
|
||||
|
||||
Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(0);
|
||||
return NoResult;
|
||||
#else
|
||||
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
||||
Id typeId = makeFloatType(16);
|
||||
|
||||
@@ -883,36 +1016,43 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
||||
module.mapInstruction(c);
|
||||
|
||||
return c->getResultId();
|
||||
#endif
|
||||
}
|
||||
|
||||
Id Builder::makeFpConstant(Id type, double d, bool specConstant)
|
||||
{
|
||||
assert(isFloatType(type));
|
||||
#ifdef GLSLANG_WEB
|
||||
const int width = 32;
|
||||
assert(width == getScalarTypeWidth(type));
|
||||
#else
|
||||
const int width = getScalarTypeWidth(type);
|
||||
#endif
|
||||
|
||||
switch (getScalarTypeWidth(type)) {
|
||||
case 16:
|
||||
return makeFloat16Constant((float)d, specConstant);
|
||||
case 32:
|
||||
return makeFloatConstant((float)d, specConstant);
|
||||
case 64:
|
||||
return makeDoubleConstant(d, specConstant);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
assert(isFloatType(type));
|
||||
|
||||
assert(false);
|
||||
return NoResult;
|
||||
switch (width) {
|
||||
case 16:
|
||||
return makeFloat16Constant((float)d, specConstant);
|
||||
case 32:
|
||||
return makeFloatConstant((float)d, specConstant);
|
||||
case 64:
|
||||
return makeDoubleConstant(d, specConstant);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
assert(false);
|
||||
return NoResult;
|
||||
}
|
||||
|
||||
Id Builder::findCompositeConstant(Op typeClass, const std::vector<Id>& comps)
|
||||
Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps)
|
||||
{
|
||||
Instruction* constant = 0;
|
||||
bool found = false;
|
||||
for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) {
|
||||
constant = groupedConstants[typeClass][i];
|
||||
|
||||
// same shape?
|
||||
if (constant->getNumOperands() != (int)comps.size())
|
||||
if (constant->getTypeId() != typeId)
|
||||
continue;
|
||||
|
||||
// same contents?
|
||||
@@ -967,8 +1107,9 @@ Id Builder::makeCompositeConstant(Id typeId, const std::vector<Id>& members, boo
|
||||
case OpTypeVector:
|
||||
case OpTypeArray:
|
||||
case OpTypeMatrix:
|
||||
case OpTypeCooperativeMatrixNV:
|
||||
if (! specConstant) {
|
||||
Id existing = findCompositeConstant(typeClass, members);
|
||||
Id existing = findCompositeConstant(typeClass, typeId, members);
|
||||
if (existing)
|
||||
return existing;
|
||||
}
|
||||
@@ -1130,7 +1271,8 @@ Function* Builder::makeEntryPoint(const char* entryPoint)
|
||||
|
||||
// Comments in header
|
||||
Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const char* name,
|
||||
const std::vector<Id>& paramTypes, const std::vector<std::vector<Decoration>>& decorations, Block **entry)
|
||||
const std::vector<Id>& paramTypes,
|
||||
const std::vector<std::vector<Decoration>>& decorations, Block **entry)
|
||||
{
|
||||
// Make the function and initial instructions in it
|
||||
Id typeId = makeFunctionType(returnType, paramTypes);
|
||||
@@ -1198,11 +1340,13 @@ void Builder::makeDiscard()
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
Id Builder::createVariable(StorageClass storageClass, Id type, const char* name)
|
||||
Id Builder::createVariable(StorageClass storageClass, Id type, const char* name, Id initializer)
|
||||
{
|
||||
Id pointerType = makePointer(storageClass, type);
|
||||
Instruction* inst = new Instruction(getUniqueId(), pointerType, OpVariable);
|
||||
inst->addImmediateOperand(storageClass);
|
||||
if (initializer != NoResult)
|
||||
inst->addIdOperand(initializer);
|
||||
|
||||
switch (storageClass) {
|
||||
case StorageClassFunction:
|
||||
@@ -1230,15 +1374,41 @@ Id Builder::createUndefined(Id type)
|
||||
return inst->getResultId();
|
||||
}
|
||||
|
||||
// av/vis/nonprivate are unnecessary and illegal for some storage classes.
|
||||
spv::MemoryAccessMask Builder::sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc)
|
||||
const
|
||||
{
|
||||
switch (sc) {
|
||||
case spv::StorageClassUniform:
|
||||
case spv::StorageClassWorkgroup:
|
||||
case spv::StorageClassStorageBuffer:
|
||||
case spv::StorageClassPhysicalStorageBufferEXT:
|
||||
break;
|
||||
default:
|
||||
memoryAccess = spv::MemoryAccessMask(memoryAccess &
|
||||
~(spv::MemoryAccessMakePointerAvailableKHRMask |
|
||||
spv::MemoryAccessMakePointerVisibleKHRMask |
|
||||
spv::MemoryAccessNonPrivatePointerKHRMask));
|
||||
break;
|
||||
}
|
||||
return memoryAccess;
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope)
|
||||
void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope,
|
||||
unsigned int alignment)
|
||||
{
|
||||
Instruction* store = new Instruction(OpStore);
|
||||
store->addIdOperand(lValue);
|
||||
store->addIdOperand(rValue);
|
||||
|
||||
memoryAccess = sanitizeMemoryAccessForStorageClass(memoryAccess, getStorageClass(lValue));
|
||||
|
||||
if (memoryAccess != MemoryAccessMaskNone) {
|
||||
store->addImmediateOperand(memoryAccess);
|
||||
if (memoryAccess & spv::MemoryAccessAlignedMask) {
|
||||
store->addImmediateOperand(alignment);
|
||||
}
|
||||
if (memoryAccess & spv::MemoryAccessMakePointerAvailableKHRMask) {
|
||||
store->addIdOperand(makeUintConstant(scope));
|
||||
}
|
||||
@@ -1248,13 +1418,18 @@ void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAcce
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
Id Builder::createLoad(Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope)
|
||||
Id Builder::createLoad(Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
|
||||
{
|
||||
Instruction* load = new Instruction(getUniqueId(), getDerefTypeId(lValue), OpLoad);
|
||||
load->addIdOperand(lValue);
|
||||
|
||||
memoryAccess = sanitizeMemoryAccessForStorageClass(memoryAccess, getStorageClass(lValue));
|
||||
|
||||
if (memoryAccess != MemoryAccessMaskNone) {
|
||||
load->addImmediateOperand(memoryAccess);
|
||||
if (memoryAccess & spv::MemoryAccessAlignedMask) {
|
||||
load->addImmediateOperand(alignment);
|
||||
}
|
||||
if (memoryAccess & spv::MemoryAccessMakePointerVisibleKHRMask) {
|
||||
load->addIdOperand(makeUintConstant(scope));
|
||||
}
|
||||
@@ -1293,7 +1468,7 @@ Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vec
|
||||
|
||||
Id Builder::createArrayLength(Id base, unsigned int member)
|
||||
{
|
||||
spv::Id intType = makeIntType(32);
|
||||
spv::Id intType = makeUintType(32);
|
||||
Instruction* length = new Instruction(getUniqueId(), intType, OpArrayLength);
|
||||
length->addIdOperand(base);
|
||||
length->addImmediateOperand(member);
|
||||
@@ -1302,12 +1477,30 @@ Id Builder::createArrayLength(Id base, unsigned int member)
|
||||
return length->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::createCooperativeMatrixLength(Id type)
|
||||
{
|
||||
spv::Id intType = makeUintType(32);
|
||||
|
||||
// Generate code for spec constants if in spec constant operation
|
||||
// generation mode.
|
||||
if (generatingOpCodeForSpecConst) {
|
||||
return createSpecConstantOp(OpCooperativeMatrixLengthNV, intType, std::vector<Id>(1, type), std::vector<Id>());
|
||||
}
|
||||
|
||||
Instruction* length = new Instruction(getUniqueId(), intType, OpCooperativeMatrixLengthNV);
|
||||
length->addIdOperand(type);
|
||||
buildPoint->addInstruction(std::unique_ptr<Instruction>(length));
|
||||
|
||||
return length->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::createCompositeExtract(Id composite, Id typeId, unsigned index)
|
||||
{
|
||||
// Generate code for spec constants if in spec constant operation
|
||||
// generation mode.
|
||||
if (generatingOpCodeForSpecConst) {
|
||||
return createSpecConstantOp(OpCompositeExtract, typeId, std::vector<Id>(1, composite), std::vector<Id>(1, index));
|
||||
return createSpecConstantOp(OpCompositeExtract, typeId, std::vector<Id>(1, composite),
|
||||
std::vector<Id>(1, index));
|
||||
}
|
||||
Instruction* extract = new Instruction(getUniqueId(), typeId, OpCompositeExtract);
|
||||
extract->addIdOperand(composite);
|
||||
@@ -1509,7 +1702,8 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector<IdImmediate>& opera
|
||||
return op->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector<Id>& operands, const std::vector<unsigned>& literals)
|
||||
Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector<Id>& operands,
|
||||
const std::vector<unsigned>& literals)
|
||||
{
|
||||
Instruction* op = new Instruction(getUniqueId(), typeId, OpSpecConstantOp);
|
||||
op->addImmediateOperand((unsigned) opCode);
|
||||
@@ -1652,7 +1846,7 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, const
|
||||
// Accept all parameters needed to create a texture instruction.
|
||||
// Create the correct instruction based on the inputs, and make the call.
|
||||
Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
|
||||
bool noImplicitLod, const TextureParameters& parameters)
|
||||
bool noImplicitLod, const TextureParameters& parameters, ImageOperandsMask signExtensionMask)
|
||||
{
|
||||
static const int maxTextureArgs = 10;
|
||||
Id texArgs[maxTextureArgs] = {};
|
||||
@@ -1669,7 +1863,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
if (parameters.component != NoResult)
|
||||
texArgs[numArgs++] = parameters.component;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
if (parameters.granularity != NoResult)
|
||||
texArgs[numArgs++] = parameters.granularity;
|
||||
if (parameters.coarse != NoResult)
|
||||
@@ -1679,8 +1873,8 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
//
|
||||
// Set up the optional arguments
|
||||
//
|
||||
int optArgNum = numArgs; // track which operand, if it exists, is the mask of optional arguments
|
||||
++numArgs; // speculatively make room for the mask operand
|
||||
int optArgNum = numArgs; // track which operand, if it exists, is the mask of optional arguments
|
||||
++numArgs; // speculatively make room for the mask operand
|
||||
ImageOperandsMask mask = ImageOperandsMaskNone; // the mask operand
|
||||
if (parameters.bias) {
|
||||
mask = (ImageOperandsMask)(mask | ImageOperandsBiasMask);
|
||||
@@ -1716,6 +1910,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask);
|
||||
texArgs[numArgs++] = parameters.offsets;
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
if (parameters.sample) {
|
||||
mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask);
|
||||
texArgs[numArgs++] = parameters.sample;
|
||||
@@ -1733,6 +1928,8 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
if (parameters.volatil) {
|
||||
mask = mask | ImageOperandsVolatileTexelKHRMask;
|
||||
}
|
||||
#endif
|
||||
mask = mask | signExtensionMask;
|
||||
if (mask == ImageOperandsMaskNone)
|
||||
--numArgs; // undo speculative reservation for the mask argument
|
||||
else
|
||||
@@ -1747,10 +1944,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
opCode = OpImageSparseFetch;
|
||||
else
|
||||
opCode = OpImageFetch;
|
||||
#ifdef NV_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
} else if (parameters.granularity && parameters.coarse) {
|
||||
opCode = OpImageSampleFootprintNV;
|
||||
#endif
|
||||
} else if (gather) {
|
||||
if (parameters.Dref)
|
||||
if (sparse)
|
||||
@@ -1762,6 +1958,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
opCode = OpImageSparseGather;
|
||||
else
|
||||
opCode = OpImageGather;
|
||||
#endif
|
||||
} else if (explicitLod) {
|
||||
if (parameters.Dref) {
|
||||
if (proj)
|
||||
@@ -1910,11 +2107,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
|
||||
break;
|
||||
}
|
||||
case OpImageQueryLod:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
resultType = makeVectorType(getScalarTypeId(getTypeId(parameters.coords)), 2);
|
||||
#else
|
||||
resultType = makeVectorType(makeFloatType(32), 2);
|
||||
#endif
|
||||
break;
|
||||
case OpImageQueryLevels:
|
||||
case OpImageQuerySamples:
|
||||
@@ -1932,6 +2125,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
|
||||
if (parameters.lod)
|
||||
query->addIdOperand(parameters.lod);
|
||||
buildPoint->addInstruction(std::unique_ptr<Instruction>(query));
|
||||
addCapability(CapabilityImageQuery);
|
||||
|
||||
return query->getResultId();
|
||||
}
|
||||
@@ -1999,7 +2193,8 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b
|
||||
if (constituent == 0)
|
||||
resultId = subResultId;
|
||||
else
|
||||
resultId = setPrecision(createBinOp(equal ? OpLogicalAnd : OpLogicalOr, boolType, resultId, subResultId), precision);
|
||||
resultId = setPrecision(createBinOp(equal ? OpLogicalAnd : OpLogicalOr, boolType, resultId, subResultId),
|
||||
precision);
|
||||
}
|
||||
|
||||
return resultId;
|
||||
@@ -2008,7 +2203,8 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b
|
||||
// OpCompositeConstruct
|
||||
Id Builder::createCompositeConstruct(Id typeId, const std::vector<Id>& constituents)
|
||||
{
|
||||
assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 && getNumTypeConstituents(typeId) == (int)constituents.size()));
|
||||
assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 &&
|
||||
getNumTypeConstituents(typeId) == (int)constituents.size()));
|
||||
|
||||
if (generatingOpCodeForSpecConst) {
|
||||
// Sometime, even in spec-constant-op mode, the constant composite to be
|
||||
@@ -2096,7 +2292,8 @@ Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sourc
|
||||
// Go through the source arguments, each one could have either
|
||||
// a single or multiple components to contribute.
|
||||
for (unsigned int i = 0; i < sources.size(); ++i) {
|
||||
if (isScalar(sources[i]))
|
||||
|
||||
if (isScalar(sources[i]) || isPointer(sources[i]))
|
||||
latchResult(sources[i]);
|
||||
else if (isVector(sources[i]))
|
||||
accumulateVectorConstituents(sources[i]);
|
||||
@@ -2124,7 +2321,12 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
|
||||
int numRows = getTypeNumRows(resultTypeId);
|
||||
|
||||
Instruction* instr = module.getInstruction(componentTypeId);
|
||||
unsigned bitCount = instr->getImmediateOperand(0);
|
||||
#ifdef GLSLANG_WEB
|
||||
const unsigned bitCount = 32;
|
||||
assert(bitCount == instr->getImmediateOperand(0));
|
||||
#else
|
||||
const unsigned bitCount = instr->getImmediateOperand(0);
|
||||
#endif
|
||||
|
||||
// Optimize matrix constructed from a bigger matrix
|
||||
if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) {
|
||||
@@ -2411,11 +2613,16 @@ void Builder::clearAccessChain()
|
||||
accessChain.preSwizzleBaseType = NoType;
|
||||
accessChain.isRValue = false;
|
||||
accessChain.coherentFlags.clear();
|
||||
accessChain.alignment = 0;
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType)
|
||||
void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType,
|
||||
AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
|
||||
{
|
||||
accessChain.coherentFlags |= coherentFlags;
|
||||
accessChain.alignment |= alignment;
|
||||
|
||||
// swizzles can be stacked in GLSL, but simplified to a single
|
||||
// one here; the base type doesn't change
|
||||
if (accessChain.preSwizzleBaseType == NoType)
|
||||
@@ -2437,7 +2644,7 @@ void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizz
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, spv::Scope scope)
|
||||
void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
|
||||
{
|
||||
assert(accessChain.isRValue == false);
|
||||
|
||||
@@ -2455,11 +2662,18 @@ void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, sp
|
||||
source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, source, accessChain.swizzle);
|
||||
}
|
||||
|
||||
createStore(source, base, memoryAccess, scope);
|
||||
// take LSB of alignment
|
||||
alignment = alignment & ~(alignment & (alignment-1));
|
||||
if (getStorageClass(base) == StorageClassPhysicalStorageBufferEXT) {
|
||||
memoryAccess = (spv::MemoryAccessMask)(memoryAccess | spv::MemoryAccessAlignedMask);
|
||||
}
|
||||
|
||||
createStore(source, base, memoryAccess, scope, alignment);
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType, spv::MemoryAccessMask memoryAccess, spv::Scope scope)
|
||||
Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType,
|
||||
spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
|
||||
{
|
||||
Id id;
|
||||
|
||||
@@ -2481,15 +2695,22 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
|
||||
}
|
||||
}
|
||||
|
||||
if (constant)
|
||||
if (constant) {
|
||||
id = createCompositeExtract(accessChain.base, swizzleBase, indexes);
|
||||
else {
|
||||
// make a new function variable for this r-value
|
||||
Id lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable");
|
||||
|
||||
// store into it
|
||||
createStore(accessChain.base, lValue);
|
||||
|
||||
} else {
|
||||
Id lValue = NoResult;
|
||||
if (spvVersion >= Spv_1_4) {
|
||||
// make a new function variable for this r-value, using an initializer,
|
||||
// and mark it as NonWritable so that downstream it can be detected as a lookup
|
||||
// table
|
||||
lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable",
|
||||
accessChain.base);
|
||||
addDecoration(lValue, DecorationNonWritable);
|
||||
} else {
|
||||
lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable");
|
||||
// store into it
|
||||
createStore(accessChain.base, lValue);
|
||||
}
|
||||
// move base to the new variable
|
||||
accessChain.base = lValue;
|
||||
accessChain.isRValue = false;
|
||||
@@ -2502,8 +2723,21 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
|
||||
id = accessChain.base; // no precision, it was set when this was defined
|
||||
} else {
|
||||
transferAccessChainSwizzle(true);
|
||||
|
||||
// take LSB of alignment
|
||||
alignment = alignment & ~(alignment & (alignment-1));
|
||||
if (getStorageClass(accessChain.base) == StorageClassPhysicalStorageBufferEXT) {
|
||||
memoryAccess = (spv::MemoryAccessMask)(memoryAccess | spv::MemoryAccessAlignedMask);
|
||||
}
|
||||
|
||||
// load through the access chain
|
||||
id = createLoad(collapseAccessChain(), memoryAccess, scope);
|
||||
id = collapseAccessChain();
|
||||
// Apply nonuniform both to the access chain and the loaded value.
|
||||
// Buffer accesses need the access chain decorated, and this is where
|
||||
// loaded image types get decorated. TODO: This should maybe move to
|
||||
// createImageTextureFunctionCall.
|
||||
addDecoration(id, nonUniform);
|
||||
id = createLoad(id, memoryAccess, scope, alignment);
|
||||
setPrecision(id, precision);
|
||||
addDecoration(id, nonUniform);
|
||||
}
|
||||
@@ -2784,14 +3018,14 @@ void Builder::createSelectionMerge(Block* mergeBlock, unsigned int control)
|
||||
}
|
||||
|
||||
void Builder::createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
|
||||
unsigned int dependencyLength)
|
||||
const std::vector<unsigned int>& operands)
|
||||
{
|
||||
Instruction* merge = new Instruction(OpLoopMerge);
|
||||
merge->addIdOperand(mergeBlock->getId());
|
||||
merge->addIdOperand(continueBlock->getId());
|
||||
merge->addImmediateOperand(control);
|
||||
if ((control & LoopControlDependencyLengthMask) != 0)
|
||||
merge->addImmediateOperand(dependencyLength);
|
||||
for (int op = 0; op < (int)operands.size(); ++op)
|
||||
merge->addImmediateOperand(operands[op]);
|
||||
buildPoint->addInstruction(std::unique_ptr<Instruction>(merge));
|
||||
}
|
||||
|
||||
@@ -2809,7 +3043,8 @@ void Builder::createConditionalBranch(Id condition, Block* thenBlock, Block* els
|
||||
// OpSource
|
||||
// [OpSourceContinued]
|
||||
// ...
|
||||
void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
|
||||
void Builder::dumpSourceInstructions(const spv::Id fileId, const std::string& text,
|
||||
std::vector<unsigned int>& out) const
|
||||
{
|
||||
const int maxWordCount = 0xFFFF;
|
||||
const int opSourceWordCount = 4;
|
||||
@@ -2821,14 +3056,14 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
|
||||
sourceInst.addImmediateOperand(source);
|
||||
sourceInst.addImmediateOperand(sourceVersion);
|
||||
// File operand
|
||||
if (sourceFileStringId != NoResult) {
|
||||
sourceInst.addIdOperand(sourceFileStringId);
|
||||
if (fileId != NoResult) {
|
||||
sourceInst.addIdOperand(fileId);
|
||||
// Source operand
|
||||
if (sourceText.size() > 0) {
|
||||
if (text.size() > 0) {
|
||||
int nextByte = 0;
|
||||
std::string subString;
|
||||
while ((int)sourceText.size() - nextByte > 0) {
|
||||
subString = sourceText.substr(nextByte, nonNullBytesPerInstruction);
|
||||
while ((int)text.size() - nextByte > 0) {
|
||||
subString = text.substr(nextByte, nonNullBytesPerInstruction);
|
||||
if (nextByte == 0) {
|
||||
// OpSource
|
||||
sourceInst.addStringOperand(subString.c_str());
|
||||
@@ -2848,7 +3083,16 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
|
||||
}
|
||||
}
|
||||
|
||||
void Builder::dumpInstructions(std::vector<unsigned int>& out, const std::vector<std::unique_ptr<Instruction> >& instructions) const
|
||||
// Dump an OpSource[Continued] sequence for the source and every include file
|
||||
void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
|
||||
{
|
||||
dumpSourceInstructions(sourceFileStringId, sourceText, out);
|
||||
for (auto iItr = includeFiles.begin(); iItr != includeFiles.end(); ++iItr)
|
||||
dumpSourceInstructions(iItr->first, *iItr->second, out);
|
||||
}
|
||||
|
||||
void Builder::dumpInstructions(std::vector<unsigned int>& out,
|
||||
const std::vector<std::unique_ptr<Instruction> >& instructions) const
|
||||
{
|
||||
for (int i = 0; i < (int)instructions.size(); ++i) {
|
||||
instructions[i]->dump(out);
|
||||
|
||||
222
third_party/glslang/SPIRV/SpvBuilder.h
vendored
222
third_party/glslang/SPIRV/SpvBuilder.h
vendored
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2014-2015 LunarG, Inc.
|
||||
// Copyright (C) 2015-2016 Google, Inc.
|
||||
// Copyright (C) 2015-2020 Google, Inc.
|
||||
// Copyright (C) 2017 ARM Limited.
|
||||
//
|
||||
// All rights reserved.
|
||||
@@ -57,9 +57,19 @@
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
|
||||
namespace spv {
|
||||
|
||||
typedef enum {
|
||||
Spv_1_0 = (1 << 16),
|
||||
Spv_1_1 = (1 << 16) | (1 << 8),
|
||||
Spv_1_2 = (1 << 16) | (2 << 8),
|
||||
Spv_1_3 = (1 << 16) | (3 << 8),
|
||||
Spv_1_4 = (1 << 16) | (4 << 8),
|
||||
Spv_1_5 = (1 << 16) | (5 << 8),
|
||||
} SpvVersion;
|
||||
|
||||
class Builder {
|
||||
public:
|
||||
Builder(unsigned int spvVersion, unsigned int userNumber, SpvBuildLogger* logger);
|
||||
@@ -74,18 +84,48 @@ public:
|
||||
source = lang;
|
||||
sourceVersion = version;
|
||||
}
|
||||
spv::Id getStringId(const std::string& str)
|
||||
{
|
||||
auto sItr = stringIds.find(str);
|
||||
if (sItr != stringIds.end())
|
||||
return sItr->second;
|
||||
spv::Id strId = getUniqueId();
|
||||
Instruction* fileString = new Instruction(strId, NoType, OpString);
|
||||
const char* file_c_str = str.c_str();
|
||||
fileString->addStringOperand(file_c_str);
|
||||
strings.push_back(std::unique_ptr<Instruction>(fileString));
|
||||
module.mapInstruction(fileString);
|
||||
stringIds[file_c_str] = strId;
|
||||
return strId;
|
||||
}
|
||||
void setSourceFile(const std::string& file)
|
||||
{
|
||||
Instruction* fileString = new Instruction(getUniqueId(), NoType, OpString);
|
||||
fileString->addStringOperand(file.c_str());
|
||||
sourceFileStringId = fileString->getResultId();
|
||||
strings.push_back(std::unique_ptr<Instruction>(fileString));
|
||||
sourceFileStringId = getStringId(file);
|
||||
}
|
||||
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 addExtension(const char* ext) { extensions.insert(ext); }
|
||||
void removeExtension(const char* ext)
|
||||
{
|
||||
extensions.erase(ext);
|
||||
}
|
||||
void addIncorporatedExtension(const char* ext, SpvVersion incorporatedVersion)
|
||||
{
|
||||
if (getSpvVersion() < static_cast<unsigned>(incorporatedVersion))
|
||||
addExtension(ext);
|
||||
}
|
||||
void promoteIncorporatedExtension(const char* baseExt, const char* promoExt, SpvVersion incorporatedVersion)
|
||||
{
|
||||
removeExtension(baseExt);
|
||||
addIncorporatedExtension(promoExt, incorporatedVersion);
|
||||
}
|
||||
void addInclude(const std::string& name, const std::string& text)
|
||||
{
|
||||
spv::Id incId = getStringId(name);
|
||||
includeFiles[incId] = &text;
|
||||
}
|
||||
Id import(const char*);
|
||||
void setMemoryModel(spv::AddressingModel addr, spv::MemoryModel mem)
|
||||
{
|
||||
@@ -106,16 +146,25 @@ public:
|
||||
return id;
|
||||
}
|
||||
|
||||
// Log the current line, and if different than the last one,
|
||||
// issue a new OpLine, using the current file name.
|
||||
// Generate OpLine for non-filename-based #line directives (ie no filename
|
||||
// seen yet): Log the current line, and if different than the last one,
|
||||
// issue a new OpLine using the new line and current source file name.
|
||||
void setLine(int line);
|
||||
|
||||
// If filename null, generate OpLine for non-filename-based line directives,
|
||||
// else do filename-based: Log the current line and file, and if different
|
||||
// than the last one, issue a new OpLine using the new line and file
|
||||
// name.
|
||||
void setLine(int line, const char* filename);
|
||||
// Low-level OpLine. See setLine() for a layered helper.
|
||||
void addLine(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 makePointer(StorageClass, Id type);
|
||||
Id makePointer(StorageClass, Id pointee);
|
||||
Id makeForwardPointer(StorageClass);
|
||||
Id makePointerFromForwardPointer(StorageClass, Id forwardPointerType, Id pointee);
|
||||
Id makeIntegerType(int width, bool hasSign); // generic
|
||||
Id makeIntType(int width) { return makeIntegerType(width, true); }
|
||||
Id makeUintType(int width) { return makeIntegerType(width, false); }
|
||||
@@ -130,6 +179,7 @@ public:
|
||||
Id makeImageType(Id sampledType, Dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format);
|
||||
Id makeSamplerType();
|
||||
Id makeSampledImageType(Id imageType);
|
||||
Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols);
|
||||
|
||||
// accelerationStructureNV type
|
||||
Id makeAccelerationStructureNVType();
|
||||
@@ -147,37 +197,52 @@ public:
|
||||
Id getContainedTypeId(Id typeId) const;
|
||||
Id getContainedTypeId(Id typeId, int) const;
|
||||
StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); }
|
||||
ImageFormat getImageTypeFormat(Id typeId) const { return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
|
||||
ImageFormat getImageTypeFormat(Id typeId) const
|
||||
{ return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
|
||||
|
||||
bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
|
||||
bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
|
||||
bool isVector(Id resultId) const { return isVectorType(getTypeId(resultId)); }
|
||||
bool isMatrix(Id resultId) const { return isMatrixType(getTypeId(resultId)); }
|
||||
bool isCooperativeMatrix(Id resultId)const { return isCooperativeMatrixType(getTypeId(resultId)); }
|
||||
bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); }
|
||||
bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); }
|
||||
|
||||
bool isBoolType(Id typeId) { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
|
||||
bool isIntType(Id typeId) const { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) != 0; }
|
||||
bool isUintType(Id typeId) const { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) == 0; }
|
||||
bool isBoolType(Id typeId)
|
||||
{ return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
|
||||
bool isIntType(Id typeId) const
|
||||
{ return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) != 0; }
|
||||
bool isUintType(Id typeId) const
|
||||
{ return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) == 0; }
|
||||
bool isFloatType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat; }
|
||||
bool isPointerType(Id typeId) const { return getTypeClass(typeId) == OpTypePointer; }
|
||||
bool isScalarType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat || getTypeClass(typeId) == OpTypeInt || getTypeClass(typeId) == OpTypeBool; }
|
||||
bool isScalarType(Id typeId) const
|
||||
{ return getTypeClass(typeId) == OpTypeFloat || getTypeClass(typeId) == OpTypeInt ||
|
||||
getTypeClass(typeId) == OpTypeBool; }
|
||||
bool isVectorType(Id typeId) const { return getTypeClass(typeId) == OpTypeVector; }
|
||||
bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; }
|
||||
bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; }
|
||||
bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; }
|
||||
bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId); }
|
||||
#ifdef GLSLANG_WEB
|
||||
bool isCooperativeMatrixType(Id typeId)const { return false; }
|
||||
#else
|
||||
bool isCooperativeMatrixType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeMatrixNV; }
|
||||
#endif
|
||||
bool isAggregateType(Id typeId) const
|
||||
{ return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
|
||||
bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
|
||||
bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; }
|
||||
bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; }
|
||||
bool containsType(Id typeId, Op typeOp, unsigned int width) const;
|
||||
bool containsPhysicalStorageBufferOrArray(Id typeId) const;
|
||||
|
||||
bool isConstantOpCode(Op opcode) const;
|
||||
bool isSpecConstantOpCode(Op opcode) const;
|
||||
bool isConstant(Id resultId) const { return isConstantOpCode(getOpCode(resultId)); }
|
||||
bool isConstantScalar(Id resultId) const { return getOpCode(resultId) == OpConstant; }
|
||||
bool isSpecConstant(Id resultId) const { return isSpecConstantOpCode(getOpCode(resultId)); }
|
||||
unsigned int getConstantScalar(Id resultId) const { return module.getInstruction(resultId)->getImmediateOperand(0); }
|
||||
unsigned int getConstantScalar(Id resultId) const
|
||||
{ return module.getInstruction(resultId)->getImmediateOperand(0); }
|
||||
StorageClass getStorageClass(Id resultId) const { return getTypeStorageClass(getTypeId(resultId)); }
|
||||
|
||||
int getScalarTypeWidth(Id typeId) const
|
||||
@@ -219,14 +284,22 @@ public:
|
||||
|
||||
// For making new constants (will return old constant if the requested one was already made).
|
||||
Id makeBoolConstant(bool b, bool specConstant = false);
|
||||
Id makeInt8Constant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); }
|
||||
Id makeUint8Constant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(8), u, specConstant); }
|
||||
Id makeInt16Constant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(16), (unsigned)i, specConstant); }
|
||||
Id makeUint16Constant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(16), u, specConstant); }
|
||||
Id makeIntConstant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(32), (unsigned)i, specConstant); }
|
||||
Id makeUintConstant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(32), u, specConstant); }
|
||||
Id makeInt64Constant(long long i, bool specConstant = false) { return makeInt64Constant(makeIntType(64), (unsigned long long)i, specConstant); }
|
||||
Id makeUint64Constant(unsigned long long u, bool specConstant = false) { return makeInt64Constant(makeUintType(64), u, specConstant); }
|
||||
Id makeInt8Constant(int i, bool specConstant = false)
|
||||
{ return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); }
|
||||
Id makeUint8Constant(unsigned u, bool specConstant = false)
|
||||
{ return makeIntConstant(makeUintType(8), u, specConstant); }
|
||||
Id makeInt16Constant(int i, bool specConstant = false)
|
||||
{ return makeIntConstant(makeIntType(16), (unsigned)i, specConstant); }
|
||||
Id makeUint16Constant(unsigned u, bool specConstant = false)
|
||||
{ return makeIntConstant(makeUintType(16), u, specConstant); }
|
||||
Id makeIntConstant(int i, bool specConstant = false)
|
||||
{ return makeIntConstant(makeIntType(32), (unsigned)i, specConstant); }
|
||||
Id makeUintConstant(unsigned u, bool specConstant = false)
|
||||
{ return makeIntConstant(makeUintType(32), u, specConstant); }
|
||||
Id makeInt64Constant(long long i, bool specConstant = false)
|
||||
{ return makeInt64Constant(makeIntType(64), (unsigned long long)i, specConstant); }
|
||||
Id makeUint64Constant(unsigned long long u, bool specConstant = false)
|
||||
{ return makeInt64Constant(makeUintType(64), u, specConstant); }
|
||||
Id makeFloatConstant(float f, bool specConstant = false);
|
||||
Id makeDoubleConstant(double d, bool specConstant = false);
|
||||
Id makeFloat16Constant(float f16, bool specConstant = false);
|
||||
@@ -257,8 +330,8 @@ public:
|
||||
// Make a shader-style function, and create its entry block if entry is non-zero.
|
||||
// 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);
|
||||
Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name,
|
||||
const std::vector<Id>& paramTypes, 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.
|
||||
@@ -271,16 +344,18 @@ public:
|
||||
void makeDiscard();
|
||||
|
||||
// Create a global or function local or IO variable.
|
||||
Id createVariable(StorageClass, Id type, const char* name = 0);
|
||||
Id createVariable(StorageClass, Id type, const char* name = 0, Id initializer = NoResult);
|
||||
|
||||
// Create an intermediate with an undefined value.
|
||||
Id createUndefined(Id type);
|
||||
|
||||
// Store into an Id and return the l-value
|
||||
void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax);
|
||||
void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
|
||||
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
|
||||
|
||||
// Load from an Id and return it
|
||||
Id createLoad(Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax);
|
||||
Id createLoad(Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
|
||||
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
|
||||
|
||||
// Create an OpAccessChain instruction
|
||||
Id createAccessChain(StorageClass, Id base, const std::vector<Id>& offsets);
|
||||
@@ -288,6 +363,9 @@ public:
|
||||
// Create an OpArrayLength instruction
|
||||
Id createArrayLength(Id base, unsigned int member);
|
||||
|
||||
// Create an OpCooperativeMatrixLengthNV instruction
|
||||
Id createCooperativeMatrixLength(Id type);
|
||||
|
||||
// Create an OpCompositeExtract instruction
|
||||
Id createCompositeExtract(Id composite, Id typeId, unsigned index);
|
||||
Id createCompositeExtract(Id composite, Id typeId, const std::vector<unsigned>& indexes);
|
||||
@@ -376,7 +454,8 @@ public:
|
||||
};
|
||||
|
||||
// Select the correct texture operation based on all inputs, and emit the correct instruction
|
||||
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, bool noImplicit, const TextureParameters&);
|
||||
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
|
||||
bool noImplicit, const TextureParameters&, ImageOperandsMask);
|
||||
|
||||
// Emit the OpTextureQuery* instruction that was passed in.
|
||||
// Figure out the right return value and type, and return it.
|
||||
@@ -435,7 +514,7 @@ public:
|
||||
// recursion stack can hold the memory for it.
|
||||
//
|
||||
void makeSwitch(Id condition, unsigned int control, int numSegments, const std::vector<int>& caseValues,
|
||||
const std::vector<int>& valueToSegment, int defaultSegment, std::vector<Block*>& segmentBB); // return argument
|
||||
const std::vector<int>& valueToSegment, int defaultSegment, std::vector<Block*>& segmentBB);
|
||||
|
||||
// Add a branch to the innermost switch's merge block.
|
||||
void addSwitchBreak();
|
||||
@@ -452,7 +531,7 @@ public:
|
||||
Block &head, &body, &merge, &continue_target;
|
||||
private:
|
||||
LoopBlocks();
|
||||
LoopBlocks& operator=(const LoopBlocks&);
|
||||
LoopBlocks& operator=(const LoopBlocks&) = delete;
|
||||
};
|
||||
|
||||
// Start a new loop and prepare the builder to generate code for it. Until
|
||||
@@ -509,12 +588,24 @@ public:
|
||||
std::vector<Id> indexChain;
|
||||
Id instr; // cache the instruction that generates this access chain
|
||||
std::vector<unsigned> swizzle; // each std::vector element selects the next GLSL component number
|
||||
Id component; // a dynamic component index, can coexist with a swizzle, done after the swizzle, NoResult if not present
|
||||
Id preSwizzleBaseType; // dereferenced type, before swizzle or component is applied; NoType unless a swizzle or component is present
|
||||
Id component; // a dynamic component index, can coexist with a swizzle,
|
||||
// done after the swizzle, NoResult if not present
|
||||
Id preSwizzleBaseType; // dereferenced type, before swizzle or component is applied;
|
||||
// NoType unless a swizzle or component is present
|
||||
bool isRValue; // true if 'base' is an r-value, otherwise, base is an l-value
|
||||
unsigned int alignment; // bitwise OR of alignment values passed in. Accumulates worst alignment.
|
||||
// Only tracks base and (optional) component selection alignment.
|
||||
|
||||
// Accumulate whether anything in the chain of structures has coherent decorations.
|
||||
struct CoherentFlags {
|
||||
CoherentFlags() { clear(); }
|
||||
#ifdef GLSLANG_WEB
|
||||
void clear() { }
|
||||
bool isVolatile() const { return false; }
|
||||
CoherentFlags operator |=(const CoherentFlags &other) { return *this; }
|
||||
#else
|
||||
bool isVolatile() const { return volatil; }
|
||||
|
||||
unsigned coherent : 1;
|
||||
unsigned devicecoherent : 1;
|
||||
unsigned queuefamilycoherent : 1;
|
||||
@@ -535,7 +626,6 @@ public:
|
||||
isImage = 0;
|
||||
}
|
||||
|
||||
CoherentFlags() { clear(); }
|
||||
CoherentFlags operator |=(const CoherentFlags &other) {
|
||||
coherent |= other.coherent;
|
||||
devicecoherent |= other.devicecoherent;
|
||||
@@ -547,6 +637,7 @@ public:
|
||||
isImage |= other.isImage;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
CoherentFlags coherentFlags;
|
||||
};
|
||||
@@ -578,31 +669,44 @@ public:
|
||||
}
|
||||
|
||||
// push offset onto the end of the chain
|
||||
void accessChainPush(Id offset, AccessChain::CoherentFlags coherentFlags)
|
||||
void accessChainPush(Id offset, AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
|
||||
{
|
||||
accessChain.indexChain.push_back(offset);
|
||||
accessChain.coherentFlags |= coherentFlags;
|
||||
accessChain.alignment |= alignment;
|
||||
}
|
||||
|
||||
// push new swizzle onto the end of any existing swizzle, merging into a single swizzle
|
||||
void accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType);
|
||||
void accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType,
|
||||
AccessChain::CoherentFlags coherentFlags, unsigned int alignment);
|
||||
|
||||
// push a dynamic component selection onto the access chain, only applicable with a
|
||||
// non-trivial swizzle or no swizzle
|
||||
void accessChainPushComponent(Id component, Id preSwizzleBaseType)
|
||||
void accessChainPushComponent(Id component, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags,
|
||||
unsigned int alignment)
|
||||
{
|
||||
if (accessChain.swizzle.size() != 1) {
|
||||
accessChain.component = component;
|
||||
if (accessChain.preSwizzleBaseType == NoType)
|
||||
accessChain.preSwizzleBaseType = preSwizzleBaseType;
|
||||
}
|
||||
accessChain.coherentFlags |= coherentFlags;
|
||||
accessChain.alignment |= alignment;
|
||||
}
|
||||
|
||||
// use accessChain and swizzle to store value
|
||||
void accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax);
|
||||
void accessChainStore(Id rvalue, 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, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax);
|
||||
Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType,
|
||||
spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax,
|
||||
unsigned int alignment = 0);
|
||||
|
||||
// Return whether or not the access chain can be represented in SPIR-V
|
||||
// as an l-value.
|
||||
// E.g., a[3].yx cannot be, while a[3].y and a[3].y[x] can be.
|
||||
bool isSpvLvalue() const { return accessChain.swizzle.size() <= 1; }
|
||||
|
||||
// get the direct pointer for an l-value
|
||||
Id accessChainGetLValue();
|
||||
@@ -611,22 +715,28 @@ public:
|
||||
// based on the type of the base and the chain of dereferences.
|
||||
Id accessChainGetInferredType();
|
||||
|
||||
// Add capabilities, extensions, remove unneeded decorations, etc.,
|
||||
// Add capabilities, extensions, remove unneeded decorations, etc.,
|
||||
// based on the resulting SPIR-V.
|
||||
void postProcess();
|
||||
|
||||
// Prune unreachable blocks in the CFG and remove unneeded decorations.
|
||||
void postProcessCFG();
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Add capabilities, extensions based on instructions in the module.
|
||||
void postProcessFeatures();
|
||||
// Hook to visit each instruction in a block in a function
|
||||
void postProcess(const Instruction&);
|
||||
// Hook to visit each instruction in a reachable block in a function.
|
||||
void postProcessReachable(const Instruction&);
|
||||
void postProcess(Instruction&);
|
||||
// Hook to visit each non-32-bit sized float/int operation in a block.
|
||||
void postProcessType(const Instruction&, spv::Id typeId);
|
||||
#endif
|
||||
|
||||
void dump(std::vector<unsigned int>&) const;
|
||||
|
||||
void createBranch(Block* block);
|
||||
void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
|
||||
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, unsigned int dependencyLength);
|
||||
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
|
||||
const std::vector<unsigned int>& operands);
|
||||
|
||||
// Sets to generate opcode for specialization constants.
|
||||
void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; }
|
||||
@@ -640,7 +750,7 @@ public:
|
||||
Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant);
|
||||
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value);
|
||||
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2);
|
||||
Id findCompositeConstant(Op typeClass, const std::vector<Id>& comps);
|
||||
Id findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps);
|
||||
Id findStructConstant(Id typeId, const std::vector<Id>& comps);
|
||||
Id collapseAccessChain();
|
||||
void remapDynamicSwizzle();
|
||||
@@ -649,8 +759,11 @@ public:
|
||||
void createAndSetNoPredecessorBlock(const char*);
|
||||
void createSelectionMerge(Block* mergeBlock, unsigned int control);
|
||||
void dumpSourceInstructions(std::vector<unsigned int>&) const;
|
||||
void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector<unsigned int>&) const;
|
||||
void dumpInstructions(std::vector<unsigned int>&, const std::vector<std::unique_ptr<Instruction> >&) const;
|
||||
void dumpModuleProcesses(std::vector<unsigned int>&) const;
|
||||
spv::MemoryAccessMask sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc)
|
||||
const;
|
||||
|
||||
unsigned int spvVersion; // the version of SPIR-V to emit in the header
|
||||
SourceLanguage source;
|
||||
@@ -658,6 +771,7 @@ public:
|
||||
spv::Id sourceFileStringId;
|
||||
std::string sourceText;
|
||||
int currentLine;
|
||||
const char* currentFile;
|
||||
bool emitOpLines;
|
||||
std::set<std::string> extensions;
|
||||
std::vector<const char*> sourceExtensions;
|
||||
@@ -684,10 +798,14 @@ public:
|
||||
std::vector<std::unique_ptr<Instruction> > externals;
|
||||
std::vector<std::unique_ptr<Function> > functions;
|
||||
|
||||
// not output, internally used for quick & dirty canonical (unique) creation
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedConstants; // map type opcodes to constant inst.
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedStructConstants; // map struct-id to constant instructions
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedTypes; // map type opcodes to type instructions
|
||||
// not output, internally used for quick & dirty canonical (unique) creation
|
||||
|
||||
// map type opcodes to constant inst.
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedConstants;
|
||||
// map struct-id to constant instructions
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedStructConstants;
|
||||
// map type opcodes to type instructions
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedTypes;
|
||||
|
||||
// stack of switches
|
||||
std::stack<Block*> switchMerges;
|
||||
@@ -695,6 +813,12 @@ public:
|
||||
// Our loop stack.
|
||||
std::stack<LoopBlocks> loops;
|
||||
|
||||
// map from strings to their string ids
|
||||
std::unordered_map<std::string, spv::Id> stringIds;
|
||||
|
||||
// map from include file name ids to their contents
|
||||
std::map<spv::Id, const std::string*> includeFiles;
|
||||
|
||||
// The stream for outputting warnings and errors.
|
||||
SpvBuildLogger* logger;
|
||||
}; // end Builder class
|
||||
|
||||
235
third_party/glslang/SPIRV/SpvPostProcess.cpp
vendored
235
third_party/glslang/SPIRV/SpvPostProcess.cpp
vendored
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2016-2018 Google, Inc.
|
||||
// Copyright (C) 2018 Google, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -51,16 +52,13 @@ namespace spv {
|
||||
#include "GLSL.std.450.h"
|
||||
#include "GLSL.ext.KHR.h"
|
||||
#include "GLSL.ext.EXT.h"
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
#include "GLSL.ext.NV.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace spv {
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Hook to visit each operand type and result type of an instruction.
|
||||
// Will be called multiple times for one instruction, once for each typed
|
||||
// operand and the result.
|
||||
@@ -87,6 +85,7 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||
StorageClass storageClass = getStorageClass(inst.getIdOperand(0));
|
||||
if (width == 8) {
|
||||
switch (storageClass) {
|
||||
case StorageClassPhysicalStorageBufferEXT:
|
||||
case StorageClassUniform:
|
||||
case StorageClassStorageBuffer:
|
||||
case StorageClassPushConstant:
|
||||
@@ -97,6 +96,7 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||
}
|
||||
} else if (width == 16) {
|
||||
switch (storageClass) {
|
||||
case StorageClassPhysicalStorageBufferEXT:
|
||||
case StorageClassUniform:
|
||||
case StorageClassStorageBuffer:
|
||||
case StorageClassPushConstant:
|
||||
@@ -116,12 +116,48 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||
case OpAccessChain:
|
||||
case OpPtrAccessChain:
|
||||
case OpCopyObject:
|
||||
break;
|
||||
case OpFConvert:
|
||||
case OpSConvert:
|
||||
case OpUConvert:
|
||||
// Look for any 8/16-bit storage capabilities. If there are none, assume that
|
||||
// the convert instruction requires the Float16/Int8/16 capability.
|
||||
if (containsType(typeId, OpTypeFloat, 16) || containsType(typeId, OpTypeInt, 16)) {
|
||||
bool foundStorage = false;
|
||||
for (auto it = capabilities.begin(); it != capabilities.end(); ++it) {
|
||||
spv::Capability cap = *it;
|
||||
if (cap == spv::CapabilityStorageInputOutput16 ||
|
||||
cap == spv::CapabilityStoragePushConstant16 ||
|
||||
cap == spv::CapabilityStorageUniformBufferBlock16 ||
|
||||
cap == spv::CapabilityStorageUniform16) {
|
||||
foundStorage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundStorage) {
|
||||
if (containsType(typeId, OpTypeFloat, 16))
|
||||
addCapability(CapabilityFloat16);
|
||||
if (containsType(typeId, OpTypeInt, 16))
|
||||
addCapability(CapabilityInt16);
|
||||
}
|
||||
}
|
||||
if (containsType(typeId, OpTypeInt, 8)) {
|
||||
bool foundStorage = false;
|
||||
for (auto it = capabilities.begin(); it != capabilities.end(); ++it) {
|
||||
spv::Capability cap = *it;
|
||||
if (cap == spv::CapabilityStoragePushConstant8 ||
|
||||
cap == spv::CapabilityUniformAndStorageBuffer8BitAccess ||
|
||||
cap == spv::CapabilityStorageBuffer8BitAccess) {
|
||||
foundStorage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundStorage) {
|
||||
addCapability(CapabilityInt8);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OpExtInst:
|
||||
#if AMD_EXTENSIONS
|
||||
switch (inst.getImmediateOperand(1)) {
|
||||
case GLSLstd450Frexp:
|
||||
case GLSLstd450FrexpStruct:
|
||||
@@ -137,7 +173,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
if (basicTypeOp == OpTypeFloat && width == 16)
|
||||
@@ -151,7 +186,7 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||
}
|
||||
|
||||
// Called for each instruction that resides in a block.
|
||||
void Builder::postProcess(const Instruction& inst)
|
||||
void Builder::postProcess(Instruction& inst)
|
||||
{
|
||||
// Add capabilities based simply on the opcode.
|
||||
switch (inst.getOpCode()) {
|
||||
@@ -183,12 +218,91 @@ void Builder::postProcess(const Instruction& inst)
|
||||
addCapability(CapabilityImageQuery);
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case OpGroupNonUniformPartitionNV:
|
||||
addExtension(E_SPV_NV_shader_subgroup_partitioned);
|
||||
addCapability(CapabilityGroupNonUniformPartitionedNV);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case OpLoad:
|
||||
case OpStore:
|
||||
{
|
||||
// For any load/store to a PhysicalStorageBufferEXT, walk the accesschain
|
||||
// index list to compute the misalignment. The pre-existing alignment value
|
||||
// (set via Builder::AccessChain::alignment) only accounts for the base of
|
||||
// the reference type and any scalar component selection in the accesschain,
|
||||
// and this function computes the rest from the SPIR-V Offset decorations.
|
||||
Instruction *accessChain = module.getInstruction(inst.getIdOperand(0));
|
||||
if (accessChain->getOpCode() == OpAccessChain) {
|
||||
Instruction *base = module.getInstruction(accessChain->getIdOperand(0));
|
||||
// Get the type of the base of the access chain. It must be a pointer type.
|
||||
Id typeId = base->getTypeId();
|
||||
Instruction *type = module.getInstruction(typeId);
|
||||
assert(type->getOpCode() == OpTypePointer);
|
||||
if (type->getImmediateOperand(0) != StorageClassPhysicalStorageBufferEXT) {
|
||||
break;
|
||||
}
|
||||
// Get the pointee type.
|
||||
typeId = type->getIdOperand(1);
|
||||
type = module.getInstruction(typeId);
|
||||
// Walk the index list for the access chain. For each index, find any
|
||||
// misalignment that can apply when accessing the member/element via
|
||||
// Offset/ArrayStride/MatrixStride decorations, and bitwise OR them all
|
||||
// together.
|
||||
int alignment = 0;
|
||||
for (int i = 1; i < accessChain->getNumOperands(); ++i) {
|
||||
Instruction *idx = module.getInstruction(accessChain->getIdOperand(i));
|
||||
if (type->getOpCode() == OpTypeStruct) {
|
||||
assert(idx->getOpCode() == OpConstant);
|
||||
unsigned int c = idx->getImmediateOperand(0);
|
||||
|
||||
const auto function = [&](const std::unique_ptr<Instruction>& decoration) {
|
||||
if (decoration.get()->getOpCode() == OpMemberDecorate &&
|
||||
decoration.get()->getIdOperand(0) == typeId &&
|
||||
decoration.get()->getImmediateOperand(1) == c &&
|
||||
(decoration.get()->getImmediateOperand(2) == DecorationOffset ||
|
||||
decoration.get()->getImmediateOperand(2) == DecorationMatrixStride)) {
|
||||
alignment |= decoration.get()->getImmediateOperand(3);
|
||||
}
|
||||
};
|
||||
std::for_each(decorations.begin(), decorations.end(), function);
|
||||
// get the next member type
|
||||
typeId = type->getIdOperand(c);
|
||||
type = module.getInstruction(typeId);
|
||||
} else if (type->getOpCode() == OpTypeArray ||
|
||||
type->getOpCode() == OpTypeRuntimeArray) {
|
||||
const auto function = [&](const std::unique_ptr<Instruction>& decoration) {
|
||||
if (decoration.get()->getOpCode() == OpDecorate &&
|
||||
decoration.get()->getIdOperand(0) == typeId &&
|
||||
decoration.get()->getImmediateOperand(1) == DecorationArrayStride) {
|
||||
alignment |= decoration.get()->getImmediateOperand(2);
|
||||
}
|
||||
};
|
||||
std::for_each(decorations.begin(), decorations.end(), function);
|
||||
// Get the element type
|
||||
typeId = type->getIdOperand(0);
|
||||
type = module.getInstruction(typeId);
|
||||
} else {
|
||||
// Once we get to any non-aggregate type, we're done.
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(inst.getNumOperands() >= 3);
|
||||
unsigned int memoryAccess = inst.getImmediateOperand((inst.getOpCode() == OpStore) ? 2 : 1);
|
||||
assert(memoryAccess & MemoryAccessAlignedMask);
|
||||
static_cast<void>(memoryAccess);
|
||||
// Compute the index of the alignment operand.
|
||||
int alignmentIdx = 2;
|
||||
if (inst.getOpCode() == OpStore)
|
||||
alignmentIdx++;
|
||||
// Merge new and old (mis)alignment
|
||||
alignment |= inst.getImmediateOperand(alignmentIdx);
|
||||
// Pick the LSB
|
||||
alignment = alignment & ~(alignment & (alignment-1));
|
||||
// update the Aligned operand
|
||||
inst.setImmediateOperand(alignmentIdx, alignment);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -206,17 +320,16 @@ void Builder::postProcess(const Instruction& inst)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called for each instruction in a reachable block.
|
||||
void Builder::postProcessReachable(const Instruction&)
|
||||
{
|
||||
// did have code here, but questionable to do so without deleting the instructions
|
||||
}
|
||||
#endif
|
||||
|
||||
// comment in header
|
||||
void Builder::postProcess()
|
||||
void Builder::postProcessCFG()
|
||||
{
|
||||
// reachableBlocks is the set of blockss reached via control flow, or which are
|
||||
// unreachable continue targert or unreachable merge.
|
||||
std::unordered_set<const Block*> reachableBlocks;
|
||||
std::unordered_map<Block*, Block*> headerForUnreachableContinue;
|
||||
std::unordered_set<Block*> unreachableMerges;
|
||||
std::unordered_set<Id> unreachableDefinitions;
|
||||
// Collect IDs defined in unreachable blocks. For each function, label the
|
||||
// reachable blocks first. Then for each unreachable block, collect the
|
||||
@@ -224,16 +337,41 @@ void Builder::postProcess()
|
||||
for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) {
|
||||
Function* f = *fi;
|
||||
Block* entry = f->getEntryBlock();
|
||||
inReadableOrder(entry, [&reachableBlocks](const Block* b) { reachableBlocks.insert(b); });
|
||||
inReadableOrder(entry,
|
||||
[&reachableBlocks, &unreachableMerges, &headerForUnreachableContinue]
|
||||
(Block* b, ReachReason why, Block* header) {
|
||||
reachableBlocks.insert(b);
|
||||
if (why == ReachDeadContinue) headerForUnreachableContinue[b] = header;
|
||||
if (why == ReachDeadMerge) unreachableMerges.insert(b);
|
||||
});
|
||||
for (auto bi = f->getBlocks().cbegin(); bi != f->getBlocks().cend(); bi++) {
|
||||
Block* b = *bi;
|
||||
if (reachableBlocks.count(b) == 0) {
|
||||
for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++)
|
||||
if (unreachableMerges.count(b) != 0 || headerForUnreachableContinue.count(b) != 0) {
|
||||
auto ii = b->getInstructions().cbegin();
|
||||
++ii; // Keep potential decorations on the label.
|
||||
for (; ii != b->getInstructions().cend(); ++ii)
|
||||
unreachableDefinitions.insert(ii->get()->getResultId());
|
||||
} else if (reachableBlocks.count(b) == 0) {
|
||||
// The normal case for unreachable code. All definitions are considered dead.
|
||||
for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ++ii)
|
||||
unreachableDefinitions.insert(ii->get()->getResultId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Modify unreachable merge blocks and unreachable continue targets.
|
||||
// Delete their contents.
|
||||
for (auto mergeIter = unreachableMerges.begin(); mergeIter != unreachableMerges.end(); ++mergeIter) {
|
||||
(*mergeIter)->rewriteAsCanonicalUnreachableMerge();
|
||||
}
|
||||
for (auto continueIter = headerForUnreachableContinue.begin();
|
||||
continueIter != headerForUnreachableContinue.end();
|
||||
++continueIter) {
|
||||
Block* continue_target = continueIter->first;
|
||||
Block* header = continueIter->second;
|
||||
continue_target->rewriteAsCanonicalUnreachableContinue(header);
|
||||
}
|
||||
|
||||
// Remove unneeded decorations, for unreachable instructions
|
||||
decorations.erase(std::remove_if(decorations.begin(), decorations.end(),
|
||||
[&unreachableDefinitions](std::unique_ptr<Instruction>& I) -> bool {
|
||||
@@ -241,14 +379,29 @@ void Builder::postProcess()
|
||||
return unreachableDefinitions.count(decoration_id) != 0;
|
||||
}),
|
||||
decorations.end());
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// comment in header
|
||||
void Builder::postProcessFeatures() {
|
||||
// Add per-instruction capabilities, extensions, etc.,
|
||||
|
||||
// process all reachable instructions...
|
||||
for (auto bi = reachableBlocks.cbegin(); bi != reachableBlocks.cend(); ++bi) {
|
||||
const Block* block = *bi;
|
||||
const auto function = [this](const std::unique_ptr<Instruction>& inst) { postProcessReachable(*inst.get()); };
|
||||
std::for_each(block->getInstructions().begin(), block->getInstructions().end(), function);
|
||||
// Look for any 8/16 bit type in physical storage buffer class, and set the
|
||||
// appropriate capability. This happens in createSpvVariable for other storage
|
||||
// classes, but there isn't always a variable for physical storage buffer.
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {
|
||||
Instruction* type = groupedTypes[OpTypePointer][t];
|
||||
if (type->getImmediateOperand(0) == (unsigned)StorageClassPhysicalStorageBufferEXT) {
|
||||
if (containsType(type->getIdOperand(1), OpTypeInt, 8)) {
|
||||
addIncorporatedExtension(spv::E_SPV_KHR_8bit_storage, spv::Spv_1_5);
|
||||
addCapability(spv::CapabilityStorageBuffer8BitAccess);
|
||||
}
|
||||
if (containsType(type->getIdOperand(1), OpTypeInt, 16) ||
|
||||
containsType(type->getIdOperand(1), OpTypeFloat, 16)) {
|
||||
addIncorporatedExtension(spv::E_SPV_KHR_16bit_storage, spv::Spv_1_3);
|
||||
addCapability(spv::CapabilityStorageBuffer16BitAccess);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// process all block-contained instructions
|
||||
@@ -258,8 +411,40 @@ void Builder::postProcess()
|
||||
Block* b = *bi;
|
||||
for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++)
|
||||
postProcess(*ii->get());
|
||||
|
||||
// For all local variables that contain pointers to PhysicalStorageBufferEXT, check whether
|
||||
// there is an existing restrict/aliased decoration. If we don't find one, add Aliased as the
|
||||
// default.
|
||||
for (auto vi = b->getLocalVariables().cbegin(); vi != b->getLocalVariables().cend(); vi++) {
|
||||
const Instruction& inst = *vi->get();
|
||||
Id resultId = inst.getResultId();
|
||||
if (containsPhysicalStorageBufferOrArray(getDerefTypeId(resultId))) {
|
||||
bool foundDecoration = false;
|
||||
const auto function = [&](const std::unique_ptr<Instruction>& decoration) {
|
||||
if (decoration.get()->getIdOperand(0) == resultId &&
|
||||
decoration.get()->getOpCode() == OpDecorate &&
|
||||
(decoration.get()->getImmediateOperand(1) == spv::DecorationAliasedPointerEXT ||
|
||||
decoration.get()->getImmediateOperand(1) == spv::DecorationRestrictPointerEXT)) {
|
||||
foundDecoration = true;
|
||||
}
|
||||
};
|
||||
std::for_each(decorations.begin(), decorations.end(), function);
|
||||
if (!foundDecoration) {
|
||||
addDecoration(resultId, spv::DecorationAliasedPointerEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// comment in header
|
||||
void Builder::postProcess() {
|
||||
postProcessCFG();
|
||||
#ifndef GLSLANG_WEB
|
||||
postProcessFeatures();
|
||||
#endif
|
||||
}
|
||||
|
||||
}; // end spv namespace
|
||||
|
||||
46
third_party/glslang/SPIRV/SpvTools.cpp
vendored
46
third_party/glslang/SPIRV/SpvTools.cpp
vendored
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2014-2016 LunarG, Inc.
|
||||
// Copyright (C) 2018 Google, Inc.
|
||||
// Copyright (C) 2018-2020 Google, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -52,8 +52,23 @@ namespace glslang {
|
||||
spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger)
|
||||
{
|
||||
switch (spvVersion.vulkan) {
|
||||
case glslang::EShTargetVulkan_1_0: return spv_target_env::SPV_ENV_VULKAN_1_0;
|
||||
case glslang::EShTargetVulkan_1_1: return spv_target_env::SPV_ENV_VULKAN_1_1;
|
||||
case glslang::EShTargetVulkan_1_0:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_0;
|
||||
case glslang::EShTargetVulkan_1_1:
|
||||
switch (spvVersion.spv) {
|
||||
case EShTargetSpv_1_0:
|
||||
case EShTargetSpv_1_1:
|
||||
case EShTargetSpv_1_2:
|
||||
case EShTargetSpv_1_3:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_1;
|
||||
case EShTargetSpv_1_4:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_1_SPIRV_1_4;
|
||||
default:
|
||||
logger->missingFunctionality("Target version for SPIRV-Tools validator");
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_1;
|
||||
}
|
||||
case glslang::EShTargetVulkan_1_2:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -90,7 +105,7 @@ void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& s
|
||||
|
||||
// Apply the SPIRV-Tools validator to generated SPIR-V.
|
||||
void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger* logger)
|
||||
spv::SpvBuildLogger* logger, bool prelegalization)
|
||||
{
|
||||
// validate
|
||||
spv_context context = spvContextCreate(MapToSpirvToolsEnv(intermediate.getSpv(), logger));
|
||||
@@ -98,6 +113,7 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
|
||||
spv_diagnostic diagnostic = nullptr;
|
||||
spv_validator_options options = spvValidatorOptionsCreate();
|
||||
spvValidatorOptionsSetRelaxBlockLayout(options, intermediate.usingHlslOffsets());
|
||||
spvValidatorOptionsSetBeforeHlslLegalization(options, prelegalization);
|
||||
spvValidateWithOptions(context, options, &binary, &diagnostic);
|
||||
|
||||
// report
|
||||
@@ -114,8 +130,8 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
|
||||
|
||||
// Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of
|
||||
// legalizing HLSL SPIR-V.
|
||||
void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*, const SpvOptions* options)
|
||||
void SpirvToolsLegalize(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger* logger, const SpvOptions* options)
|
||||
{
|
||||
spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2;
|
||||
|
||||
@@ -152,6 +168,14 @@ void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int>
|
||||
out << std::endl;
|
||||
});
|
||||
|
||||
// If debug (specifically source line info) is being generated, propagate
|
||||
// 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());
|
||||
}
|
||||
optimizer.RegisterPass(spvtools::CreateWrapOpKillPass());
|
||||
optimizer.RegisterPass(spvtools::CreateDeadBranchElimPass());
|
||||
optimizer.RegisterPass(spvtools::CreateMergeReturnPass());
|
||||
optimizer.RegisterPass(spvtools::CreateInlineExhaustivePass());
|
||||
@@ -175,13 +199,17 @@ void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int>
|
||||
optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass());
|
||||
if (options->optimizeSize) {
|
||||
optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass());
|
||||
// TODO(greg-lunarg): Add this when AMD driver issues are resolved
|
||||
// optimizer.RegisterPass(CreateCommonUniformElimPass());
|
||||
}
|
||||
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
|
||||
optimizer.RegisterPass(spvtools::CreateCFGCleanupPass());
|
||||
if (options->generateDebugInfo) {
|
||||
optimizer.RegisterPass(spvtools::CreateRedundantLineInfoElimPass());
|
||||
}
|
||||
|
||||
optimizer.Run(spirv.data(), spirv.size(), &spirv);
|
||||
spvtools::OptimizerOptions spvOptOptions;
|
||||
optimizer.SetTargetEnv(MapToSpirvToolsEnv(intermediate.getSpv(), logger));
|
||||
spvOptOptions.set_run_validator(false); // The validator may run as a separate step later on
|
||||
optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
|
||||
}
|
||||
|
||||
}; // end namespace glslang
|
||||
|
||||
12
third_party/glslang/SPIRV/SpvTools.h
vendored
12
third_party/glslang/SPIRV/SpvTools.h
vendored
@@ -41,10 +41,12 @@
|
||||
#ifndef GLSLANG_SPV_TOOLS_H
|
||||
#define GLSLANG_SPV_TOOLS_H
|
||||
|
||||
#ifdef ENABLE_OPT
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#endif
|
||||
|
||||
#include "../glslang/MachineIndependent/localintermediate.h"
|
||||
#include "glslang/MachineIndependent/localintermediate.h"
|
||||
#include "Logger.h"
|
||||
|
||||
namespace glslang {
|
||||
@@ -59,14 +61,14 @@ struct SpvOptions {
|
||||
bool validate;
|
||||
};
|
||||
|
||||
#if ENABLE_OPT
|
||||
#ifdef ENABLE_OPT
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V.
|
||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
|
||||
|
||||
// Apply the SPIRV-Tools validator to generated SPIR-V.
|
||||
void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*);
|
||||
spv::SpvBuildLogger*, bool prelegalization);
|
||||
|
||||
// Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of
|
||||
// legalizing HLSL SPIR-V.
|
||||
@@ -75,6 +77,6 @@ void SpirvToolsLegalize(const glslang::TIntermediate& intermediate, std::vector<
|
||||
|
||||
#endif
|
||||
|
||||
}; // end namespace glslang
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // GLSLANG_SPV_TOOLS_H
|
||||
#endif // GLSLANG_SPV_TOOLS_H
|
||||
|
||||
56
third_party/glslang/SPIRV/disassemble.cpp
vendored
56
third_party/glslang/SPIRV/disassemble.cpp
vendored
@@ -52,26 +52,16 @@ namespace spv {
|
||||
extern "C" {
|
||||
// Include C-based headers that don't have a namespace
|
||||
#include "GLSL.std.450.h"
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
#include "GLSL.ext.NV.h"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
|
||||
|
||||
namespace spv {
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
static const char* GLSLextNVGetDebugNames(const char*, unsigned);
|
||||
#endif
|
||||
|
||||
static void Kill(std::ostream& out, const char* message)
|
||||
{
|
||||
@@ -82,16 +72,10 @@ static void Kill(std::ostream& out, const char* message)
|
||||
// used to identify the extended instruction library imported when printing
|
||||
enum ExtInstSet {
|
||||
GLSL450Inst,
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
GLSLextAMDInst,
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
GLSLextNVInst,
|
||||
#endif
|
||||
|
||||
OpenCLExtInst,
|
||||
NonSemanticDebugPrintfExtInst,
|
||||
};
|
||||
|
||||
// Container class for a single instance of a SPIR-V stream, with methods for disassembly.
|
||||
@@ -499,37 +483,33 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
||||
const char* name = idDescriptor[stream[word - 2]].c_str();
|
||||
if (0 == memcmp("OpenCL", name, 6)) {
|
||||
extInstSet = OpenCLExtInst;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (0 == memcmp("NonSemantic.DebugPrintf", name, 23)) {
|
||||
extInstSet = NonSemanticDebugPrintfExtInst;
|
||||
} else if (strcmp(spv::E_SPV_AMD_shader_ballot, name) == 0 ||
|
||||
strcmp(spv::E_SPV_AMD_shader_trinary_minmax, name) == 0 ||
|
||||
strcmp(spv::E_SPV_AMD_shader_explicit_vertex_parameter, name) == 0 ||
|
||||
strcmp(spv::E_SPV_AMD_gcn_shader, name) == 0) {
|
||||
extInstSet = GLSLextAMDInst;
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
}else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 ||
|
||||
} else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_geometry_shader_passthrough, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_viewport_array2, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_mesh_shader, name) == 0) {
|
||||
extInstSet = GLSLextNVInst;
|
||||
#endif
|
||||
}
|
||||
unsigned entrypoint = stream[word - 1];
|
||||
if (extInstSet == GLSL450Inst) {
|
||||
if (entrypoint < GLSLstd450Count) {
|
||||
out << "(" << GlslStd450DebugNames[entrypoint] << ")";
|
||||
}
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (extInstSet == GLSLextAMDInst) {
|
||||
out << "(" << GLSLextAMDGetDebugNames(name, entrypoint) << ")";
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
}
|
||||
else if (extInstSet == GLSLextNVInst) {
|
||||
out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")";
|
||||
#endif
|
||||
} else if (extInstSet == NonSemanticDebugPrintfExtInst) {
|
||||
out << "(DebugPrintf)";
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -540,6 +520,14 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
||||
case OperandMemoryAccess:
|
||||
outputMask(OperandMemoryAccess, stream[word++]);
|
||||
--numOperands;
|
||||
// Aligned is the only memory access operand that uses an immediate
|
||||
// value, and it is also the first operand that uses a value at all.
|
||||
if (stream[word-1] & MemoryAccessAlignedMask) {
|
||||
disassembleImmediates(1);
|
||||
numOperands--;
|
||||
if (numOperands)
|
||||
out << " ";
|
||||
}
|
||||
disassembleIds(numOperands);
|
||||
return;
|
||||
default:
|
||||
@@ -640,9 +628,11 @@ static void GLSLstd450GetDebugNames(const char** names)
|
||||
names[GLSLstd450InterpolateAtCentroid] = "InterpolateAtCentroid";
|
||||
names[GLSLstd450InterpolateAtSample] = "InterpolateAtSample";
|
||||
names[GLSLstd450InterpolateAtOffset] = "InterpolateAtOffset";
|
||||
names[GLSLstd450NMin] = "NMin";
|
||||
names[GLSLstd450NMax] = "NMax";
|
||||
names[GLSLstd450NClamp] = "NClamp";
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint)
|
||||
{
|
||||
if (strcmp(name, spv::E_SPV_AMD_shader_ballot) == 0) {
|
||||
@@ -684,18 +674,17 @@ static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint
|
||||
|
||||
return "Bad";
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
|
||||
{
|
||||
if (strcmp(name, spv::E_SPV_NV_sample_mask_override_coverage) == 0 ||
|
||||
strcmp(name, spv::E_SPV_NV_geometry_shader_passthrough) == 0 ||
|
||||
strcmp(name, spv::E_ARB_shader_viewport_layer_array) == 0 ||
|
||||
strcmp(name, spv::E_SPV_NV_viewport_array2) == 0 ||
|
||||
strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 ||
|
||||
strcmp(name, spv::E_SPV_NV_mesh_shader) == 0) {
|
||||
strcmp(name, spv::E_SPV_NVX_multiview_per_view_attributes) == 0 ||
|
||||
strcmp(name, spv::E_SPV_NV_fragment_shader_barycentric) == 0 ||
|
||||
strcmp(name, spv::E_SPV_NV_mesh_shader) == 0 ||
|
||||
strcmp(name, spv::E_SPV_NV_shader_image_footprint) == 0) {
|
||||
switch (entrypoint) {
|
||||
// NV builtins
|
||||
case BuiltInViewportMaskNV: return "ViewportMaskNV";
|
||||
@@ -721,6 +710,8 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
|
||||
case CapabilityPerViewAttributesNV: return "PerViewAttributesNV";
|
||||
case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV";
|
||||
case CapabilityMeshShadingNV: return "MeshShadingNV";
|
||||
case CapabilityImageFootprintNV: return "ImageFootprintNV";
|
||||
case CapabilitySampleMaskOverrideCoverageNV:return "SampleMaskOverrideCoverageNV";
|
||||
|
||||
// NV Decorations
|
||||
case DecorationOverrideCoverageNV: return "OverrideCoverageNV";
|
||||
@@ -737,7 +728,6 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
|
||||
}
|
||||
return "Bad";
|
||||
}
|
||||
#endif
|
||||
|
||||
void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
|
||||
{
|
||||
|
||||
2
third_party/glslang/SPIRV/disassemble.h
vendored
2
third_party/glslang/SPIRV/disassemble.h
vendored
@@ -48,6 +48,6 @@ namespace spv {
|
||||
// disassemble with glslang custom disassembler
|
||||
void Disassemble(std::ostream& out, const std::vector<unsigned int>&);
|
||||
|
||||
}; // end namespace spv
|
||||
} // end namespace spv
|
||||
|
||||
#endif // disassembler_H
|
||||
|
||||
187
third_party/glslang/SPIRV/doc.cpp
vendored
187
third_party/glslang/SPIRV/doc.cpp
vendored
@@ -50,12 +50,8 @@ namespace spv {
|
||||
// Include C-based headers that don't have a namespace
|
||||
#include "GLSL.ext.KHR.h"
|
||||
#include "GLSL.ext.EXT.h"
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
#include "GLSL.ext.NV.h"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,22 +94,17 @@ const char* ExecutionModelString(int model)
|
||||
case 4: return "Fragment";
|
||||
case 5: return "GLCompute";
|
||||
case 6: return "Kernel";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case ExecutionModelTaskNV: return "TaskNV";
|
||||
case ExecutionModelMeshNV: return "MeshNV";
|
||||
#endif
|
||||
|
||||
default: return "Bad";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case ExecutionModelRayGenerationNV: return "RayGenerationNV";
|
||||
case ExecutionModelIntersectionNV: return "IntersectionNV";
|
||||
case ExecutionModelAnyHitNV: return "AnyHitNV";
|
||||
case ExecutionModelClosestHitNV: return "ClosestHitNV";
|
||||
case ExecutionModelMissNV: return "MissNV";
|
||||
case ExecutionModelCallableNV: return "CallableNV";
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +115,8 @@ const char* AddressingString(int addr)
|
||||
case 1: return "Physical32";
|
||||
case 2: return "Physical64";
|
||||
|
||||
case AddressingModelPhysicalStorageBuffer64EXT: return "PhysicalStorageBuffer64EXT";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
}
|
||||
@@ -181,13 +174,18 @@ const char* ExecutionModeString(int mode)
|
||||
|
||||
case 4446: return "PostDepthCoverage";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case ExecutionModeOutputLinesNV: return "OutputLinesNV";
|
||||
case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV";
|
||||
case ExecutionModeOutputTrianglesNV: return "OutputTrianglesNV";
|
||||
case ExecutionModeDerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV";
|
||||
case ExecutionModeDerivativeGroupLinearNV: return "DerivativeGroupLinearNV";
|
||||
#endif
|
||||
|
||||
case ExecutionModePixelInterlockOrderedEXT: return "PixelInterlockOrderedEXT";
|
||||
case ExecutionModePixelInterlockUnorderedEXT: return "PixelInterlockUnorderedEXT";
|
||||
case ExecutionModeSampleInterlockOrderedEXT: return "SampleInterlockOrderedEXT";
|
||||
case ExecutionModeSampleInterlockUnorderedEXT: return "SampleInterlockUnorderedEXT";
|
||||
case ExecutionModeShadingRateInterlockOrderedEXT: return "ShadingRateInterlockOrderedEXT";
|
||||
case ExecutionModeShadingRateInterlockUnorderedEXT: return "ShadingRateInterlockUnorderedEXT";
|
||||
|
||||
case ExecutionModeCeiling:
|
||||
default: return "Bad";
|
||||
@@ -211,14 +209,14 @@ const char* StorageClassString(int StorageClass)
|
||||
case 11: return "Image";
|
||||
case 12: return "StorageBuffer";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case StorageClassRayPayloadNV: return "RayPayloadNV";
|
||||
case StorageClassHitAttributeNV: return "HitAttributeNV";
|
||||
case StorageClassIncomingRayPayloadNV: return "IncomingRayPayloadNV";
|
||||
case StorageClassShaderRecordBufferNV: return "ShaderRecordBufferNV";
|
||||
case StorageClassCallableDataNV: return "CallableDataNV";
|
||||
case StorageClassIncomingCallableDataNV: return "IncomingCallableDataNV";
|
||||
#endif
|
||||
|
||||
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
@@ -278,10 +276,7 @@ const char* DecorationString(int decoration)
|
||||
case DecorationCeiling:
|
||||
default: return "Bad";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case DecorationExplicitInterpAMD: return "ExplicitInterpAMD";
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
case DecorationOverrideCoverageNV: return "OverrideCoverageNV";
|
||||
case DecorationPassthroughNV: return "PassthroughNV";
|
||||
case DecorationViewportRelativeNV: return "ViewportRelativeNV";
|
||||
@@ -290,11 +285,12 @@ const char* DecorationString(int decoration)
|
||||
case DecorationPerViewNV: return "PerViewNV";
|
||||
case DecorationPerTaskNV: return "PerTaskNV";
|
||||
case DecorationPerVertexNV: return "PerVertexNV";
|
||||
#endif
|
||||
|
||||
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
|
||||
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
|
||||
case DecorationHlslSemanticGOOGLE: return "DecorationHlslSemanticGOOGLE";
|
||||
case DecorationRestrictPointerEXT: return "DecorationRestrictPointerEXT";
|
||||
case DecorationAliasedPointerEXT: return "DecorationAliasedPointerEXT";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +354,6 @@ const char* BuiltInString(int builtIn)
|
||||
case 4426: return "DrawIndex";
|
||||
case 5014: return "FragStencilRefEXT";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case 4992: return "BaryCoordNoPerspAMD";
|
||||
case 4993: return "BaryCoordNoPerspCentroidAMD";
|
||||
case 4994: return "BaryCoordNoPerspSampleAMD";
|
||||
@@ -366,9 +361,6 @@ const char* BuiltInString(int builtIn)
|
||||
case 4996: return "BaryCoordSmoothCentroidAMD";
|
||||
case 4997: return "BaryCoordSmoothSampleAMD";
|
||||
case 4998: return "BaryCoordPullModelAMD";
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case BuiltInLaunchIdNV: return "LaunchIdNV";
|
||||
case BuiltInLaunchSizeNV: return "LaunchSizeNV";
|
||||
case BuiltInWorldRayOriginNV: return "WorldRayOriginNV";
|
||||
@@ -388,16 +380,16 @@ const char* BuiltInString(int builtIn)
|
||||
case BuiltInSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
|
||||
case BuiltInPositionPerViewNV: return "PositionPerViewNV";
|
||||
case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
|
||||
case BuiltInFragmentSizeNV: return "FragmentSizeNV";
|
||||
case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV";
|
||||
// case BuiltInFragmentSizeNV: return "FragmentSizeNV"; // superseded by BuiltInFragSizeEXT
|
||||
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
|
||||
case BuiltInBaryCoordNV: return "BaryCoordNV";
|
||||
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
|
||||
#endif
|
||||
|
||||
case BuiltInFragSizeEXT: return "FragSizeEXT";
|
||||
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||
|
||||
case 5264: return "FullyCoveredEXT";
|
||||
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case BuiltInTaskCountNV: return "TaskCountNV";
|
||||
case BuiltInPrimitiveCountNV: return "PrimitiveCountNV";
|
||||
case BuiltInPrimitiveIndicesNV: return "PrimitiveIndicesNV";
|
||||
@@ -406,7 +398,10 @@ const char* BuiltInString(int builtIn)
|
||||
case BuiltInLayerPerViewNV: return "LayerPerViewNV";
|
||||
case BuiltInMeshViewCountNV: return "MeshViewCountNV";
|
||||
case BuiltInMeshViewIndicesNV: return "MeshViewIndicesNV";
|
||||
#endif
|
||||
case BuiltInWarpsPerSMNV: return "WarpsPerSMNV";
|
||||
case BuiltInSMCountNV: return "SMCountNV";
|
||||
case BuiltInWarpIDNV: return "WarpIDNV";
|
||||
case BuiltInSMIDNV: return "SMIDNV";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
@@ -566,7 +561,7 @@ const char* ImageChannelDataTypeString(int type)
|
||||
}
|
||||
}
|
||||
|
||||
const int ImageOperandsCeiling = 12;
|
||||
const int ImageOperandsCeiling = 14;
|
||||
|
||||
const char* ImageOperandsString(int format)
|
||||
{
|
||||
@@ -583,6 +578,8 @@ const char* ImageOperandsString(int format)
|
||||
case ImageOperandsMakeTexelVisibleKHRShift: return "MakeTexelVisibleKHR";
|
||||
case ImageOperandsNonPrivateTexelKHRShift: return "NonPrivateTexelKHR";
|
||||
case ImageOperandsVolatileTexelKHRShift: return "VolatileTexelKHR";
|
||||
case ImageOperandsSignExtendShift: return "SignExtend";
|
||||
case ImageOperandsZeroExtendShift: return "ZeroExtend";
|
||||
|
||||
case ImageOperandsCeiling:
|
||||
default:
|
||||
@@ -665,15 +662,20 @@ const char* SelectControlString(int cont)
|
||||
}
|
||||
}
|
||||
|
||||
const int LoopControlCeiling = 4;
|
||||
const int LoopControlCeiling = LoopControlPartialCountShift + 1;
|
||||
|
||||
const char* LoopControlString(int cont)
|
||||
{
|
||||
switch (cont) {
|
||||
case 0: return "Unroll";
|
||||
case 1: return "DontUnroll";
|
||||
case 2: return "DependencyInfinite";
|
||||
case 3: return "DependencyLength";
|
||||
case LoopControlUnrollShift: return "Unroll";
|
||||
case LoopControlDontUnrollShift: return "DontUnroll";
|
||||
case LoopControlDependencyInfiniteShift: return "DependencyInfinite";
|
||||
case LoopControlDependencyLengthShift: return "DependencyLength";
|
||||
case LoopControlMinIterationsShift: return "MinIterations";
|
||||
case LoopControlMaxIterationsShift: return "MaxIterations";
|
||||
case LoopControlIterationMultipleShift: return "IterationMultiple";
|
||||
case LoopControlPeelCountShift: return "PeelCount";
|
||||
case LoopControlPartialCountShift: return "PartialCount";
|
||||
|
||||
case LoopControlCeiling:
|
||||
default: return "Bad";
|
||||
@@ -754,11 +756,9 @@ const char* GroupOperationString(int gop)
|
||||
case GroupOperationInclusiveScan: return "InclusiveScan";
|
||||
case GroupOperationExclusiveScan: return "ExclusiveScan";
|
||||
case GroupOperationClusteredReduce: return "ClusteredReduce";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case GroupOperationPartitionedReduceNV: return "PartitionedReduceNV";
|
||||
case GroupOperationPartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV";
|
||||
case GroupOperationPartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV";
|
||||
#endif
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
@@ -866,26 +866,23 @@ const char* CapabilityString(int info)
|
||||
case CapabilityStoragePushConstant16: return "StoragePushConstant16";
|
||||
case CapabilityStorageInputOutput16: return "StorageInputOutput16";
|
||||
|
||||
case CapabilityStorageBuffer8BitAccess: return "CapabilityStorageBuffer8BitAccess";
|
||||
case CapabilityUniformAndStorageBuffer8BitAccess: return "CapabilityUniformAndStorageBuffer8BitAccess";
|
||||
case CapabilityStoragePushConstant8: return "CapabilityStoragePushConstant8";
|
||||
case CapabilityStorageBuffer8BitAccess: return "StorageBuffer8BitAccess";
|
||||
case CapabilityUniformAndStorageBuffer8BitAccess: return "UniformAndStorageBuffer8BitAccess";
|
||||
case CapabilityStoragePushConstant8: return "StoragePushConstant8";
|
||||
|
||||
case CapabilityDeviceGroup: return "DeviceGroup";
|
||||
case CapabilityMultiView: return "MultiView";
|
||||
|
||||
case CapabilityStencilExportEXT: return "StencilExportEXT";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case CapabilityFloat16ImageAMD: return "Float16ImageAMD";
|
||||
case CapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD";
|
||||
case CapabilityFragmentMaskAMD: return "FragmentMaskAMD";
|
||||
case CapabilityImageReadWriteLodAMD: return "ImageReadWriteLodAMD";
|
||||
#endif
|
||||
|
||||
case CapabilityAtomicStorageOps: return "AtomicStorageOps";
|
||||
|
||||
case CapabilitySampleMaskPostDepthCoverage: return "SampleMaskPostDepthCoverage";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV";
|
||||
case CapabilityShaderViewportIndexLayerNV: return "ShaderViewportIndexLayerNV";
|
||||
case CapabilityShaderViewportMaskNV: return "ShaderViewportMaskNV";
|
||||
@@ -897,26 +894,44 @@ const char* CapabilityString(int info)
|
||||
case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV";
|
||||
case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV";
|
||||
case CapabilityMeshShadingNV: return "MeshShadingNV";
|
||||
case CapabilityShadingRateNV: return "ShadingRateNV";
|
||||
#endif
|
||||
case CapabilityImageFootprintNV: return "ImageFootprintNV";
|
||||
// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT
|
||||
case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV";
|
||||
case CapabilityFragmentDensityEXT: return "FragmentDensityEXT";
|
||||
|
||||
case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT";
|
||||
|
||||
case CapabilityShaderNonUniformEXT: return "CapabilityShaderNonUniformEXT";
|
||||
case CapabilityRuntimeDescriptorArrayEXT: return "CapabilityRuntimeDescriptorArrayEXT";
|
||||
case CapabilityInputAttachmentArrayDynamicIndexingEXT: return "CapabilityInputAttachmentArrayDynamicIndexingEXT";
|
||||
case CapabilityUniformTexelBufferArrayDynamicIndexingEXT: return "CapabilityUniformTexelBufferArrayDynamicIndexingEXT";
|
||||
case CapabilityStorageTexelBufferArrayDynamicIndexingEXT: return "CapabilityStorageTexelBufferArrayDynamicIndexingEXT";
|
||||
case CapabilityUniformBufferArrayNonUniformIndexingEXT: return "CapabilityUniformBufferArrayNonUniformIndexingEXT";
|
||||
case CapabilitySampledImageArrayNonUniformIndexingEXT: return "CapabilitySampledImageArrayNonUniformIndexingEXT";
|
||||
case CapabilityStorageBufferArrayNonUniformIndexingEXT: return "CapabilityStorageBufferArrayNonUniformIndexingEXT";
|
||||
case CapabilityStorageImageArrayNonUniformIndexingEXT: return "CapabilityStorageImageArrayNonUniformIndexingEXT";
|
||||
case CapabilityInputAttachmentArrayNonUniformIndexingEXT: return "CapabilityInputAttachmentArrayNonUniformIndexingEXT";
|
||||
case CapabilityUniformTexelBufferArrayNonUniformIndexingEXT: return "CapabilityUniformTexelBufferArrayNonUniformIndexingEXT";
|
||||
case CapabilityStorageTexelBufferArrayNonUniformIndexingEXT: return "CapabilityStorageTexelBufferArrayNonUniformIndexingEXT";
|
||||
case CapabilityShaderNonUniformEXT: return "ShaderNonUniformEXT";
|
||||
case CapabilityRuntimeDescriptorArrayEXT: return "RuntimeDescriptorArrayEXT";
|
||||
case CapabilityInputAttachmentArrayDynamicIndexingEXT: return "InputAttachmentArrayDynamicIndexingEXT";
|
||||
case CapabilityUniformTexelBufferArrayDynamicIndexingEXT: return "UniformTexelBufferArrayDynamicIndexingEXT";
|
||||
case CapabilityStorageTexelBufferArrayDynamicIndexingEXT: return "StorageTexelBufferArrayDynamicIndexingEXT";
|
||||
case CapabilityUniformBufferArrayNonUniformIndexingEXT: return "UniformBufferArrayNonUniformIndexingEXT";
|
||||
case CapabilitySampledImageArrayNonUniformIndexingEXT: return "SampledImageArrayNonUniformIndexingEXT";
|
||||
case CapabilityStorageBufferArrayNonUniformIndexingEXT: return "StorageBufferArrayNonUniformIndexingEXT";
|
||||
case CapabilityStorageImageArrayNonUniformIndexingEXT: return "StorageImageArrayNonUniformIndexingEXT";
|
||||
case CapabilityInputAttachmentArrayNonUniformIndexingEXT: return "InputAttachmentArrayNonUniformIndexingEXT";
|
||||
case CapabilityUniformTexelBufferArrayNonUniformIndexingEXT: return "UniformTexelBufferArrayNonUniformIndexingEXT";
|
||||
case CapabilityStorageTexelBufferArrayNonUniformIndexingEXT: return "StorageTexelBufferArrayNonUniformIndexingEXT";
|
||||
|
||||
case CapabilityVulkanMemoryModelKHR: return "CapabilityVulkanMemoryModelKHR";
|
||||
case CapabilityVulkanMemoryModelDeviceScopeKHR: return "CapabilityVulkanMemoryModelDeviceScopeKHR";
|
||||
case CapabilityVulkanMemoryModelKHR: return "VulkanMemoryModelKHR";
|
||||
case CapabilityVulkanMemoryModelDeviceScopeKHR: return "VulkanMemoryModelDeviceScopeKHR";
|
||||
|
||||
case CapabilityPhysicalStorageBufferAddressesEXT: return "PhysicalStorageBufferAddressesEXT";
|
||||
|
||||
case CapabilityVariablePointers: return "VariablePointers";
|
||||
|
||||
case CapabilityCooperativeMatrixNV: return "CooperativeMatrixNV";
|
||||
case CapabilityShaderSMBuiltinsNV: return "ShaderSMBuiltinsNV";
|
||||
|
||||
case CapabilityFragmentShaderSampleInterlockEXT: return "CapabilityFragmentShaderSampleInterlockEXT";
|
||||
case CapabilityFragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT";
|
||||
case CapabilityFragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT";
|
||||
|
||||
case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT";
|
||||
case CapabilityShaderClockKHR: return "ShaderClockKHR";
|
||||
|
||||
case CapabilityIntegerFunctions2INTEL: return "CapabilityIntegerFunctions2INTEL";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
@@ -1010,6 +1025,7 @@ const char* OpcodeString(int op)
|
||||
case 82: return "OpCompositeInsert";
|
||||
case 83: return "OpCopyObject";
|
||||
case 84: return "OpTranspose";
|
||||
case OpCopyLogical: return "OpCopyLogical";
|
||||
case 85: return "Bad";
|
||||
case 86: return "OpSampledImage";
|
||||
case 87: return "OpImageSampleImplicitLod";
|
||||
@@ -1292,7 +1308,6 @@ const char* OpcodeString(int op)
|
||||
case 4430: return "OpSubgroupAllEqualKHR";
|
||||
case 4432: return "OpSubgroupReadInvocationKHR";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case 5000: return "OpGroupIAddNonUniformAMD";
|
||||
case 5001: return "OpGroupFAddNonUniformAMD";
|
||||
case 5002: return "OpGroupFMinNonUniformAMD";
|
||||
@@ -1304,12 +1319,12 @@ const char* OpcodeString(int op)
|
||||
|
||||
case 5011: return "OpFragmentMaskFetchAMD";
|
||||
case 5012: return "OpFragmentFetchAMD";
|
||||
#endif
|
||||
|
||||
case OpReadClockKHR: return "OpReadClockKHR";
|
||||
|
||||
case OpDecorateStringGOOGLE: return "OpDecorateStringGOOGLE";
|
||||
case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV";
|
||||
case OpReportIntersectionNV: return "OpReportIntersectionNV";
|
||||
case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV";
|
||||
@@ -1319,7 +1334,17 @@ const char* OpcodeString(int op)
|
||||
case OpExecuteCallableNV: return "OpExecuteCallableNV";
|
||||
case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV";
|
||||
case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV";
|
||||
#endif
|
||||
|
||||
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
|
||||
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
|
||||
case OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV";
|
||||
case OpCooperativeMatrixMulAddNV: return "OpCooperativeMatrixMulAddNV";
|
||||
case OpCooperativeMatrixLengthNV: return "OpCooperativeMatrixLengthNV";
|
||||
case OpDemoteToHelperInvocationEXT: return "OpDemoteToHelperInvocationEXT";
|
||||
case OpIsHelperInvocationEXT: return "OpIsHelperInvocationEXT";
|
||||
|
||||
case OpBeginInvocationInterlockEXT: return "OpBeginInvocationInterlockEXT";
|
||||
case OpEndInvocationInterlockEXT: return "OpEndInvocationInterlockEXT";
|
||||
|
||||
default:
|
||||
return "Bad";
|
||||
@@ -1432,6 +1457,10 @@ void Parameterize()
|
||||
InstructionDesc[OpGroupWaitEvents].setResultAndType(false, false);
|
||||
InstructionDesc[OpAtomicFlagClear].setResultAndType(false, false);
|
||||
InstructionDesc[OpModuleProcessed].setResultAndType(false, false);
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].setResultAndType(true, false);
|
||||
InstructionDesc[OpCooperativeMatrixStoreNV].setResultAndType(false, false);
|
||||
InstructionDesc[OpBeginInvocationInterlockEXT].setResultAndType(false, false);
|
||||
InstructionDesc[OpEndInvocationInterlockEXT].setResultAndType(false, false);
|
||||
|
||||
// Specific additional context-dependent operands
|
||||
|
||||
@@ -1909,6 +1938,8 @@ void Parameterize()
|
||||
|
||||
InstructionDesc[OpTranspose].operands.push(OperandId, "'Matrix'");
|
||||
|
||||
InstructionDesc[OpCopyLogical].operands.push(OperandId, "'Operand'");
|
||||
|
||||
InstructionDesc[OpIsNan].operands.push(OperandId, "'x'");
|
||||
|
||||
InstructionDesc[OpIsInf].operands.push(OperandId, "'x'");
|
||||
@@ -2622,7 +2653,6 @@ void Parameterize()
|
||||
|
||||
InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'");
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'");
|
||||
@@ -2661,9 +2691,7 @@ void Parameterize()
|
||||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'");
|
||||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'");
|
||||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'");
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X");
|
||||
|
||||
InstructionDesc[OpTypeAccelerationStructureNV].setResultAndType(true, false);
|
||||
@@ -2701,7 +2729,36 @@ void Parameterize()
|
||||
|
||||
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'");
|
||||
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'");
|
||||
#endif
|
||||
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'");
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'");
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Rows'");
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Columns'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Stride'");
|
||||
InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Column Major'");
|
||||
InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandMemoryAccess, "'Memory Access'");
|
||||
InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandLiteralNumber, "", true);
|
||||
InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "", true);
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Object'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Stride'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Column Major'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandMemoryAccess, "'Memory Access'");
|
||||
InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandLiteralNumber, "", true);
|
||||
InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "", true);
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'A'");
|
||||
InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'B'");
|
||||
InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'C'");
|
||||
|
||||
InstructionDesc[OpCooperativeMatrixLengthNV].operands.push(OperandId, "'Type'");
|
||||
|
||||
InstructionDesc[OpDemoteToHelperInvocationEXT].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpReadClockKHR].operands.push(OperandScope, "'Scope'");
|
||||
}
|
||||
|
||||
}; // end spv namespace
|
||||
|
||||
2
third_party/glslang/SPIRV/doc.h
vendored
2
third_party/glslang/SPIRV/doc.h
vendored
@@ -255,4 +255,4 @@ const char* AccessQualifierString(int attr);
|
||||
|
||||
void PrintOperands(const OperandParameters& operands, int reservedOperands);
|
||||
|
||||
}; // end namespace spv
|
||||
} // end namespace spv
|
||||
|
||||
797
third_party/glslang/SPIRV/spirv.hpp
vendored
797
third_party/glslang/SPIRV/spirv.hpp
vendored
File diff suppressed because it is too large
Load Diff
61
third_party/glslang/SPIRV/spvIR.h
vendored
61
third_party/glslang/SPIRV/spvIR.h
vendored
@@ -1,5 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2014 LunarG, Inc.
|
||||
// Copyright (C) 2015-2018 Google, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -82,6 +83,7 @@ const MemorySemanticsMask MemorySemanticsAllMemory =
|
||||
struct IdImmediate {
|
||||
bool isId; // true if word is an Id, false if word is an immediate
|
||||
unsigned word;
|
||||
IdImmediate(bool i, unsigned w) : isId(i), word(w) {}
|
||||
};
|
||||
|
||||
//
|
||||
@@ -101,6 +103,11 @@ public:
|
||||
operands.push_back(immediate);
|
||||
idOperand.push_back(false);
|
||||
}
|
||||
void setImmediateOperand(unsigned idx, unsigned int immediate) {
|
||||
assert(!idOperand[idx]);
|
||||
operands[idx] = immediate;
|
||||
}
|
||||
|
||||
void addStringOperand(const char* str)
|
||||
{
|
||||
unsigned int word;
|
||||
@@ -202,6 +209,7 @@ public:
|
||||
const std::vector<std::unique_ptr<Instruction> >& getInstructions() const {
|
||||
return instructions;
|
||||
}
|
||||
const std::vector<std::unique_ptr<Instruction> >& getLocalVariables() const { return localVariables; }
|
||||
void setUnreachable() { unreachable = true; }
|
||||
bool isUnreachable() const { return unreachable; }
|
||||
// Returns the block's merge instruction, if one exists (otherwise null).
|
||||
@@ -218,6 +226,36 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Change this block into a canonical dead merge block. Delete instructions
|
||||
// as necessary. A canonical dead merge block has only an OpLabel and an
|
||||
// OpUnreachable.
|
||||
void rewriteAsCanonicalUnreachableMerge() {
|
||||
assert(localVariables.empty());
|
||||
// Delete all instructions except for the label.
|
||||
assert(instructions.size() > 0);
|
||||
instructions.resize(1);
|
||||
successors.clear();
|
||||
Instruction* unreachable = new Instruction(OpUnreachable);
|
||||
addInstruction(std::unique_ptr<Instruction>(unreachable));
|
||||
}
|
||||
// Change this block into a canonical dead continue target branching to the
|
||||
// given header ID. Delete instructions as necessary. A canonical dead continue
|
||||
// target has only an OpLabel and an unconditional branch back to the corresponding
|
||||
// header.
|
||||
void rewriteAsCanonicalUnreachableContinue(Block* header) {
|
||||
assert(localVariables.empty());
|
||||
// Delete all instructions except for the label.
|
||||
assert(instructions.size() > 0);
|
||||
instructions.resize(1);
|
||||
successors.clear();
|
||||
// Add OpBranch back to the header.
|
||||
assert(header != nullptr);
|
||||
Instruction* branch = new Instruction(OpBranch);
|
||||
branch->addIdOperand(header->getId());
|
||||
addInstruction(std::unique_ptr<Instruction>(branch));
|
||||
successors.push_back(header);
|
||||
}
|
||||
|
||||
bool isTerminated() const
|
||||
{
|
||||
switch (instructions.back()->getOpCode()) {
|
||||
@@ -227,6 +265,7 @@ public:
|
||||
case OpKill:
|
||||
case OpReturn:
|
||||
case OpReturnValue:
|
||||
case OpUnreachable:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -260,10 +299,24 @@ protected:
|
||||
bool unreachable;
|
||||
};
|
||||
|
||||
// The different reasons for reaching a block in the inReadableOrder traversal.
|
||||
enum ReachReason {
|
||||
// Reachable from the entry block via transfers of control, i.e. branches.
|
||||
ReachViaControlFlow = 0,
|
||||
// A continue target that is not reachable via control flow.
|
||||
ReachDeadContinue,
|
||||
// A merge block that is not reachable via control flow.
|
||||
ReachDeadMerge
|
||||
};
|
||||
|
||||
// Traverses the control-flow graph rooted at root in an order suited for
|
||||
// readable code generation. Invokes callback at every node in the traversal
|
||||
// order.
|
||||
void inReadableOrder(Block* root, std::function<void(Block*)> callback);
|
||||
// order. The callback arguments are:
|
||||
// - the block,
|
||||
// - the reason we reached the block,
|
||||
// - if the reason was that block is an unreachable continue or unreachable merge block
|
||||
// then the last parameter is the corresponding header block.
|
||||
void inReadableOrder(Block* root, std::function<void(Block*, ReachReason, Block* header)> callback);
|
||||
|
||||
//
|
||||
// SPIR-V IR Function.
|
||||
@@ -313,7 +366,7 @@ public:
|
||||
parameterInstructions[p]->dump(out);
|
||||
|
||||
// Blocks
|
||||
inReadableOrder(blocks[0], [&out](const Block* b) { b->dump(out); });
|
||||
inReadableOrder(blocks[0], [&out](const Block* b, ReachReason, Block*) { b->dump(out); });
|
||||
Instruction end(0, 0, OpFunctionEnd);
|
||||
end.dump(out);
|
||||
}
|
||||
@@ -428,6 +481,6 @@ __inline void Block::addInstruction(std::unique_ptr<Instruction> inst)
|
||||
parent.getParent().mapInstruction(raw_instruction);
|
||||
}
|
||||
|
||||
}; // end spv namespace
|
||||
} // end spv namespace
|
||||
|
||||
#endif // spvIR_H
|
||||
|
||||
1
third_party/glslang/SPIRV/tnt/CMakeLists.txt
vendored
1
third_party/glslang/SPIRV/tnt/CMakeLists.txt
vendored
@@ -43,6 +43,7 @@ endif(ENABLE_NV_EXTENSIONS)
|
||||
|
||||
add_library(SPIRV STATIC ${SOURCES} ${HEADERS})
|
||||
target_include_directories(SPIRV PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
target_include_directories(SPIRV PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
|
||||
set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
|
||||
43
third_party/glslang/StandAlone/CMakeLists.txt
vendored
43
third_party/glslang/StandAlone/CMakeLists.txt
vendored
@@ -1,28 +1,29 @@
|
||||
add_library(glslang-default-resource-limits
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resource_limits_c.cpp)
|
||||
set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
|
||||
set_property(TARGET glslang-default-resource-limits PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
target_include_directories(glslang-default-resource-limits
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC ${PROJECT_SOURCE_DIR})
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
|
||||
|
||||
|
||||
set(SOURCES StandAlone.cpp DirStackFileIncluder.h)
|
||||
set(REMAPPER_SOURCES spirv-remap.cpp)
|
||||
|
||||
add_executable(glslangValidator ${SOURCES})
|
||||
add_executable(spirv-remap ${REMAPPER_SOURCES})
|
||||
set_property(TARGET glslangValidator PROPERTY FOLDER tools)
|
||||
set_property(TARGET spirv-remap PROPERTY FOLDER tools)
|
||||
glslang_set_link_args(glslangValidator)
|
||||
glslang_set_link_args(spirv-remap)
|
||||
|
||||
set(LIBRARIES
|
||||
glslang
|
||||
SPIRV
|
||||
SPVRemapper
|
||||
glslang-default-resource-limits)
|
||||
|
||||
if(ENABLE_SPVREMAPPER)
|
||||
set(LIBRARIES ${LIBRARIES} SPVRemapper)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(LIBRARIES ${LIBRARIES} psapi)
|
||||
elseif(UNIX)
|
||||
@@ -32,22 +33,36 @@ elseif(UNIX)
|
||||
endif(WIN32)
|
||||
|
||||
target_link_libraries(glslangValidator ${LIBRARIES})
|
||||
target_link_libraries(spirv-remap ${LIBRARIES})
|
||||
target_include_directories(glslangValidator PUBLIC ../External)
|
||||
target_include_directories(glslangValidator PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
|
||||
|
||||
if(ENABLE_SPVREMAPPER)
|
||||
set(REMAPPER_SOURCES spirv-remap.cpp)
|
||||
add_executable(spirv-remap ${REMAPPER_SOURCES})
|
||||
set_property(TARGET spirv-remap PROPERTY FOLDER tools)
|
||||
glslang_set_link_args(spirv-remap)
|
||||
target_link_libraries(spirv-remap ${LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
source_group("Source" FILES ${SOURCES})
|
||||
endif(WIN32)
|
||||
|
||||
if(ENABLE_GLSLANG_INSTALL)
|
||||
install(TARGETS glslangValidator
|
||||
install(TARGETS glslangValidator EXPORT glslangValidatorTargets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(EXPORT glslangValidatorTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
|
||||
install(TARGETS spirv-remap
|
||||
if(ENABLE_SPVREMAPPER)
|
||||
install(TARGETS spirv-remap EXPORT spirv-remapTargets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
install(EXPORT spirv-remapTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS glslang-default-resource-limits
|
||||
install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
endif()
|
||||
endif(ENABLE_GLSLANG_INSTALL)
|
||||
|
||||
@@ -234,7 +234,6 @@ std::string GetDefaultTBuiltInResourceString()
|
||||
<< "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n"
|
||||
<< "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
|
||||
<< "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n"
|
||||
#ifdef NV_EXTENSIONS
|
||||
<< "MaxMeshOutputVerticesNV " << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n"
|
||||
<< "MaxMeshOutputPrimitivesNV " << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n"
|
||||
<< "MaxMeshWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n"
|
||||
@@ -244,7 +243,6 @@ std::string GetDefaultTBuiltInResourceString()
|
||||
<< "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n"
|
||||
<< "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n"
|
||||
<< "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n"
|
||||
#endif
|
||||
<< "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
|
||||
<< "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
|
||||
<< "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
|
||||
@@ -451,7 +449,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
|
||||
resources->maxCombinedClipAndCullDistances = value;
|
||||
else if (tokenStr == "MaxSamples")
|
||||
resources->maxSamples = value;
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (tokenStr == "MaxMeshOutputVerticesNV")
|
||||
resources->maxMeshOutputVerticesNV = value;
|
||||
else if (tokenStr == "MaxMeshOutputPrimitivesNV")
|
||||
@@ -470,7 +467,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
|
||||
resources->maxTaskWorkGroupSizeZ_NV = value;
|
||||
else if (tokenStr == "MaxMeshViewCountNV")
|
||||
resources->maxMeshViewCountNV = value;
|
||||
#endif
|
||||
else if (tokenStr == "nonInductiveForLoops")
|
||||
resources->limits.nonInductiveForLoops = (value != 0);
|
||||
else if (tokenStr == "whileLoops")
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "glslang/Include/ResourceLimits.h"
|
||||
#include "../glslang/Include/ResourceLimits.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
|
||||
194
third_party/glslang/StandAlone/StandAlone.cpp
vendored
194
third_party/glslang/StandAlone/StandAlone.cpp
vendored
@@ -1,6 +1,7 @@
|
||||
//
|
||||
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
||||
// Copyright (C) 2013-2016 LunarG, Inc.
|
||||
// Copyright (C) 2016-2020 Google, Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -104,6 +105,7 @@ enum TOptions {
|
||||
bool targetHlslFunctionality1 = false;
|
||||
bool SpvToolsDisassembler = false;
|
||||
bool SpvToolsValidate = false;
|
||||
bool NaNClamp = false;
|
||||
|
||||
//
|
||||
// Return codes from main/exit().
|
||||
@@ -145,13 +147,16 @@ void ProcessConfigFile()
|
||||
{
|
||||
if (ConfigFile.size() == 0)
|
||||
Resources = glslang::DefaultTBuiltInResource;
|
||||
#ifndef GLSLANG_WEB
|
||||
else {
|
||||
char* configString = ReadFileData(ConfigFile.c_str());
|
||||
glslang::DecodeResourceLimits(&Resources, configString);
|
||||
FreeFileData(configString);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int ReflectOptions = EShReflectionDefault;
|
||||
int Options = 0;
|
||||
const char* ExecutableName = nullptr;
|
||||
const char* binaryFileName = nullptr;
|
||||
@@ -160,6 +165,8 @@ const char* sourceEntryPointName = nullptr;
|
||||
const char* shaderStageName = nullptr;
|
||||
const char* variableName = nullptr;
|
||||
bool HlslEnable16BitTypes = false;
|
||||
bool HlslDX9compatible = false;
|
||||
bool DumpBuiltinSymbols = false;
|
||||
std::vector<std::string> IncludeDirectoryList;
|
||||
|
||||
// Source environment
|
||||
@@ -198,7 +205,7 @@ public:
|
||||
text.append("#define ");
|
||||
fixLine(def);
|
||||
|
||||
Processes.push_back("D");
|
||||
Processes.push_back("define-macro ");
|
||||
Processes.back().append(def);
|
||||
|
||||
// The first "=" needs to turn into a space
|
||||
@@ -216,7 +223,7 @@ public:
|
||||
text.append("#undef ");
|
||||
fixLine(undef);
|
||||
|
||||
Processes.push_back("U");
|
||||
Processes.push_back("undef-macro ");
|
||||
Processes.back().append(undef);
|
||||
|
||||
text.append(undef);
|
||||
@@ -251,7 +258,6 @@ const char* GetBinaryName(EShLanguage stage)
|
||||
case EShLangGeometry: name = "geom.spv"; break;
|
||||
case EShLangFragment: name = "frag.spv"; break;
|
||||
case EShLangCompute: name = "comp.spv"; break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangRayGenNV: name = "rgen.spv"; break;
|
||||
case EShLangIntersectNV: name = "rint.spv"; break;
|
||||
case EShLangAnyHitNV: name = "rahit.spv"; break;
|
||||
@@ -260,7 +266,6 @@ const char* GetBinaryName(EShLanguage stage)
|
||||
case EShLangCallableNV: name = "rcall.spv"; break;
|
||||
case EShLangMeshNV: name = "mesh.spv"; break;
|
||||
case EShLangTaskNV: name = "task.spv"; break;
|
||||
#endif
|
||||
default: name = "unknown"; break;
|
||||
}
|
||||
} else
|
||||
@@ -288,9 +293,12 @@ bool SetConfigFile(const std::string& name)
|
||||
//
|
||||
// Give error and exit with failure code.
|
||||
//
|
||||
void Error(const char* message)
|
||||
void Error(const char* message, const char* detail = nullptr)
|
||||
{
|
||||
fprintf(stderr, "%s: Error %s (use -h for usage)\n", ExecutableName, message);
|
||||
fprintf(stderr, "%s: Error: ", ExecutableName);
|
||||
if (detail != nullptr)
|
||||
fprintf(stderr, "%s: ", detail);
|
||||
fprintf(stderr, "%s (use -h for usage)\n", message);
|
||||
exit(EFailUsage);
|
||||
}
|
||||
|
||||
@@ -478,7 +486,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
Options |= EOptionAutoMapLocations;
|
||||
} else if (lowerword == "uniform-base") {
|
||||
if (argc <= 1)
|
||||
Error("no <base> provided for --uniform-base");
|
||||
Error("no <base> provided", lowerword.c_str());
|
||||
uniformBase = ::strtol(argv[1], NULL, 10);
|
||||
bumpArg();
|
||||
break;
|
||||
@@ -489,13 +497,23 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
else if (strcmp(argv[1], "opengl100") == 0)
|
||||
setOpenGlSpv();
|
||||
else
|
||||
Error("--client expects vulkan100 or opengl100");
|
||||
}
|
||||
Error("expects vulkan100 or opengl100", lowerword.c_str());
|
||||
} else
|
||||
Error("expects vulkan100 or opengl100", lowerword.c_str());
|
||||
bumpArg();
|
||||
} else if (lowerword == "define-macro" ||
|
||||
lowerword == "d") {
|
||||
if (argc > 1)
|
||||
UserPreamble.addDef(argv[1]);
|
||||
else
|
||||
Error("expects <name[=def]>", argv[0]);
|
||||
bumpArg();
|
||||
} else if (lowerword == "dump-builtin-symbols") {
|
||||
DumpBuiltinSymbols = true;
|
||||
} else if (lowerword == "entry-point") {
|
||||
entryPointName = argv[1];
|
||||
if (argc <= 1)
|
||||
Error("no <name> provided for --entry-point");
|
||||
Error("no <name> provided", lowerword.c_str());
|
||||
bumpArg();
|
||||
} else if (lowerword == "flatten-uniform-arrays" || // synonyms
|
||||
lowerword == "flatten-uniform-array" ||
|
||||
@@ -509,17 +527,33 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
Options |= EOptionHlslIoMapping;
|
||||
} else if (lowerword == "hlsl-enable-16bit-types") {
|
||||
HlslEnable16BitTypes = true;
|
||||
} else if (lowerword == "hlsl-dx9-compatible") {
|
||||
HlslDX9compatible = true;
|
||||
} else if (lowerword == "invert-y" || // synonyms
|
||||
lowerword == "iy") {
|
||||
Options |= EOptionInvertY;
|
||||
} else if (lowerword == "keep-uncalled" || // synonyms
|
||||
lowerword == "ku") {
|
||||
Options |= EOptionKeepUncalled;
|
||||
} else if (lowerword == "nan-clamp") {
|
||||
NaNClamp = true;
|
||||
} else if (lowerword == "no-storage-format" || // synonyms
|
||||
lowerword == "nsf") {
|
||||
Options |= EOptionNoStorageFormat;
|
||||
} else if (lowerword == "relaxed-errors") {
|
||||
Options |= EOptionRelaxedErrors;
|
||||
} else if (lowerword == "reflect-strict-array-suffix") {
|
||||
ReflectOptions |= EShReflectionStrictArraySuffix;
|
||||
} else if (lowerword == "reflect-basic-array-suffix") {
|
||||
ReflectOptions |= EShReflectionBasicArraySuffix;
|
||||
} else if (lowerword == "reflect-intermediate-io") {
|
||||
ReflectOptions |= EShReflectionIntermediateIO;
|
||||
} else if (lowerword == "reflect-separate-buffers") {
|
||||
ReflectOptions |= EShReflectionSeparateBuffers;
|
||||
} else if (lowerword == "reflect-all-block-variables") {
|
||||
ReflectOptions |= EShReflectionAllBlockVariables;
|
||||
} else if (lowerword == "reflect-unwrap-io-blocks") {
|
||||
ReflectOptions |= EShReflectionUnwrapIOBlocks;
|
||||
} else if (lowerword == "resource-set-bindings" || // synonyms
|
||||
lowerword == "resource-set-binding" ||
|
||||
lowerword == "rsb") {
|
||||
@@ -554,7 +588,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
} else if (lowerword == "source-entrypoint" || // synonyms
|
||||
lowerword == "sep") {
|
||||
if (argc <= 1)
|
||||
Error("no <entry-point> provided for --source-entrypoint");
|
||||
Error("no <entry-point> provided", lowerword.c_str());
|
||||
sourceEntryPointName = argv[1];
|
||||
bumpArg();
|
||||
break;
|
||||
@@ -575,6 +609,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
} else if (strcmp(argv[1], "vulkan1.1") == 0) {
|
||||
setVulkanSpv();
|
||||
ClientVersion = glslang::EShTargetVulkan_1_1;
|
||||
} else if (strcmp(argv[1], "vulkan1.2") == 0) {
|
||||
setVulkanSpv();
|
||||
ClientVersion = glslang::EShTargetVulkan_1_2;
|
||||
} else if (strcmp(argv[1], "opengl") == 0) {
|
||||
setOpenGlSpv();
|
||||
ClientVersion = glslang::EShTargetOpenGL_450;
|
||||
@@ -593,22 +630,36 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
} else if (strcmp(argv[1], "spirv1.4") == 0) {
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_4;
|
||||
} else if (strcmp(argv[1], "spirv1.5") == 0) {
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_5;
|
||||
} else
|
||||
Error("--target-env expected one of: vulkan1.0, vulkan1.1, opengl, spirv1.0, spirv1.1, spirv1.2, or spirv1.3");
|
||||
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2, opengl,\n"
|
||||
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5");
|
||||
}
|
||||
bumpArg();
|
||||
} else if (lowerword == "undef-macro" ||
|
||||
lowerword == "u") {
|
||||
if (argc > 1)
|
||||
UserPreamble.addUndef(argv[1]);
|
||||
else
|
||||
Error("expects <name>", argv[0]);
|
||||
bumpArg();
|
||||
} else if (lowerword == "variable-name" || // synonyms
|
||||
lowerword == "vn") {
|
||||
Options |= EOptionOutputHexadecimal;
|
||||
if (argc <= 1)
|
||||
Error("no <C-variable-name> provided for --variable-name");
|
||||
Error("no <C-variable-name> provided", lowerword.c_str());
|
||||
variableName = argv[1];
|
||||
bumpArg();
|
||||
break;
|
||||
} else if (lowerword == "version") {
|
||||
Options |= EOptionDumpVersions;
|
||||
} else {
|
||||
} else if (lowerword == "help") {
|
||||
usage();
|
||||
break;
|
||||
} else {
|
||||
Error("unrecognized command-line option", argv[0]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -619,7 +670,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
if (argv[0][2] == 0)
|
||||
Options |= EOptionReadHlsl;
|
||||
else
|
||||
UserPreamble.addDef(getStringOperand("-D<macro> macro name"));
|
||||
UserPreamble.addDef(getStringOperand("-D<name[=def]>"));
|
||||
break;
|
||||
case 'u':
|
||||
uniformLocationOverrides.push_back(getUniformOverride());
|
||||
@@ -662,7 +713,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
bumpArg();
|
||||
break;
|
||||
case 'U':
|
||||
UserPreamble.addUndef(getStringOperand("-U<macro>: macro name"));
|
||||
UserPreamble.addUndef(getStringOperand("-U<name>"));
|
||||
break;
|
||||
case 'V':
|
||||
setVulkanSpv();
|
||||
@@ -734,7 +785,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
Options |= EOptionOutputHexadecimal;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
Error("unrecognized command-line option", argv[0]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -750,8 +801,17 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
Error("must provide -S when --stdin is given");
|
||||
|
||||
// Make sure that -E is not specified alongside linking (which includes SPV generation)
|
||||
if ((Options & EOptionOutputPreprocessed) && (Options & EOptionLinkProgram))
|
||||
Error("can't use -E when linking is selected");
|
||||
// Or things that require linking
|
||||
if (Options & EOptionOutputPreprocessed) {
|
||||
if (Options & EOptionLinkProgram)
|
||||
Error("can't use -E when linking is selected");
|
||||
if (Options & EOptionDumpReflection)
|
||||
Error("reflection requires linking, which can't be used when -E when is selected");
|
||||
}
|
||||
|
||||
// reflection requires linking
|
||||
if ((Options & EOptionDumpReflection) && !(Options & EOptionLinkProgram))
|
||||
Error("reflection requires -l for linking");
|
||||
|
||||
// -o or -x makes no sense if there is no target binary
|
||||
if (binaryFileName && (Options & EOptionSpv) == 0)
|
||||
@@ -772,6 +832,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_3;
|
||||
break;
|
||||
case glslang::EShTargetVulkan_1_2:
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_5;
|
||||
break;
|
||||
case glslang::EShTargetOpenGL_450:
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_0;
|
||||
@@ -815,6 +879,10 @@ void SetMessageOptions(EShMessages& messages)
|
||||
messages = (EShMessages)(messages | EShMsgHlslEnable16BitTypes);
|
||||
if ((Options & EOptionOptimizeDisable) || !ENABLE_OPT)
|
||||
messages = (EShMessages)(messages | EShMsgHlslLegalization);
|
||||
if (HlslDX9compatible)
|
||||
messages = (EShMessages)(messages | EShMsgHlslDX9Compatible);
|
||||
if (DumpBuiltinSymbols)
|
||||
messages = (EShMessages)(messages | EShMsgBuiltinSymbolTable);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -942,42 +1010,47 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
shader->setPreamble(UserPreamble.get());
|
||||
shader->addProcesses(Processes);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Set IO mapper binding shift values
|
||||
for (int r = 0; r < glslang::EResCount; ++r) {
|
||||
const glslang::TResourceType res = glslang::TResourceType(r);
|
||||
|
||||
// Set base bindings
|
||||
shader->setShiftBinding(res, baseBinding[res][compUnit.stage]);
|
||||
|
||||
|
||||
// Set bindings for particular resource sets
|
||||
// TODO: use a range based for loop here, when available in all environments.
|
||||
for (auto i = baseBindingForSet[res][compUnit.stage].begin();
|
||||
i != baseBindingForSet[res][compUnit.stage].end(); ++i)
|
||||
shader->setShiftBindingForSet(res, i->second, i->first);
|
||||
}
|
||||
|
||||
shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
|
||||
shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
|
||||
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
||||
|
||||
if (Options & EOptionHlslIoMapping)
|
||||
shader->setHlslIoMapping(true);
|
||||
|
||||
if (Options & EOptionAutoMapBindings)
|
||||
shader->setAutoMapBindings(true);
|
||||
|
||||
if (Options & EOptionAutoMapLocations)
|
||||
shader->setAutoMapLocations(true);
|
||||
|
||||
if (Options & EOptionInvertY)
|
||||
shader->setInvertY(true);
|
||||
|
||||
for (auto& uniOverride : uniformLocationOverrides) {
|
||||
shader->addUniformLocationOverride(uniOverride.first.c_str(),
|
||||
uniOverride.second);
|
||||
}
|
||||
|
||||
shader->setUniformLocationBase(uniformBase);
|
||||
#endif
|
||||
|
||||
shader->setNanMinMaxClamp(NaNClamp);
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
|
||||
if (Options & EOptionHlslIoMapping)
|
||||
shader->setHlslIoMapping(true);
|
||||
#endif
|
||||
|
||||
if (Options & EOptionInvertY)
|
||||
shader->setInvertY(true);
|
||||
|
||||
// Set up the environment, some subsettings take precedence over earlier
|
||||
// ways of setting things.
|
||||
@@ -987,8 +1060,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
compUnit.stage, Client, ClientInputSemanticsVersion);
|
||||
shader->setEnvClient(Client, ClientVersion);
|
||||
shader->setEnvTarget(TargetLanguage, TargetVersion);
|
||||
#ifdef ENABLE_HLSL
|
||||
if (targetHlslFunctionality1)
|
||||
shader->setEnvTargetHlslFunctionality1();
|
||||
#endif
|
||||
}
|
||||
|
||||
shaders.push_back(shader);
|
||||
@@ -998,6 +1073,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
DirStackFileIncluder includer;
|
||||
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
|
||||
includer.pushExternalLocalDirectory(dir); });
|
||||
#ifndef GLSLANG_WEB
|
||||
if (Options & EOptionOutputPreprocessed) {
|
||||
std::string str;
|
||||
if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, messages, &str, includer)) {
|
||||
@@ -1009,6 +1085,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
StderrIfNonEmpty(shader->getInfoDebugLog());
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! shader->parse(&Resources, defaultVersion, false, messages, includer))
|
||||
CompileFailed = true;
|
||||
@@ -1031,11 +1108,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages))
|
||||
LinkFailed = true;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Map IO
|
||||
if (Options & EOptionSpv) {
|
||||
if (!program.mapIO())
|
||||
LinkFailed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Report
|
||||
if (! (Options & EOptionSuppressInfolog) &&
|
||||
@@ -1044,11 +1123,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
PutsIfNonEmpty(program.getInfoDebugLog());
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Reflect
|
||||
if (Options & EOptionDumpReflection) {
|
||||
program.buildReflection();
|
||||
program.buildReflection(ReflectOptions);
|
||||
program.dumpReflection();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Dump SPIR-V
|
||||
if (Options & EOptionSpv) {
|
||||
@@ -1078,8 +1159,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
} else {
|
||||
glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage));
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv))
|
||||
spv::Disassemble(std::cout, spirv);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1167,11 +1250,13 @@ int singleMain()
|
||||
workList.add(item.get());
|
||||
});
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
if (Options & EOptionDumpConfig) {
|
||||
printf("%s", glslang::GetDefaultTBuiltInResourceString().c_str());
|
||||
if (workList.empty())
|
||||
return ESuccess;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Options & EOptionDumpBareVersion) {
|
||||
printf("%d.%d.%d\n",
|
||||
@@ -1207,7 +1292,7 @@ int singleMain()
|
||||
ProcessConfigFile();
|
||||
|
||||
if ((Options & EOptionReadHlsl) && !((Options & EOptionOutputPreprocessed) || (Options & EOptionSpv)))
|
||||
Error("ERROR: HLSL requires SPIR-V code generation (or preprocessing only)");
|
||||
Error("HLSL requires SPIR-V code generation (or preprocessing only)");
|
||||
|
||||
//
|
||||
// Two modes:
|
||||
@@ -1343,7 +1428,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
|
||||
return EShLangFragment;
|
||||
else if (stageName == "comp")
|
||||
return EShLangCompute;
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (stageName == "rgen")
|
||||
return EShLangRayGenNV;
|
||||
else if (stageName == "rint")
|
||||
@@ -1360,7 +1444,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
|
||||
return EShLangMeshNV;
|
||||
else if (stageName == "task")
|
||||
return EShLangTaskNV;
|
||||
#endif
|
||||
|
||||
usage();
|
||||
return EShLangVertex;
|
||||
@@ -1430,7 +1513,6 @@ void usage()
|
||||
" .geom for a geometry shader\n"
|
||||
" .frag for a fragment shader\n"
|
||||
" .comp for a compute shader\n"
|
||||
#ifdef NV_EXTENSIONS
|
||||
" .mesh for a mesh shader\n"
|
||||
" .task for a task shader\n"
|
||||
" .rgen for a ray generation shader\n"
|
||||
@@ -1439,15 +1521,14 @@ void usage()
|
||||
" .rchit for a ray closest hit shader\n"
|
||||
" .rmiss for a ray miss shader\n"
|
||||
" .rcall for a ray callable shader\n"
|
||||
#endif
|
||||
" .glsl for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n"
|
||||
" .hlsl for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" -C cascading errors; risk crash from accumulation of error recoveries\n"
|
||||
" -D input is HLSL (this is the default when any suffix is .hlsl)\n"
|
||||
" -D<macro=def>\n"
|
||||
" -D<macro> define a pre-processor macro\n"
|
||||
" -D<name[=def]> | --define-macro <name[=def]> | --D <name[=def]>\n"
|
||||
" define a pre-processor macro\n"
|
||||
" -E print pre-processed GLSL; cannot be used with -l;\n"
|
||||
" errors will appear on stderr\n"
|
||||
" -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;\n"
|
||||
@@ -1463,7 +1544,8 @@ void usage()
|
||||
" -Os optimizes SPIR-V to minimize size\n"
|
||||
" -S <stage> uses specified stage rather than parsing the file extension\n"
|
||||
" choices for <stage> are vert, tesc, tese, geom, frag, or comp\n"
|
||||
" -U<macro> undefine a pre-processor macro\n"
|
||||
" -U<name> | --undef-macro <name> | --U <name>\n"
|
||||
" undefine a pre-processor macro\n"
|
||||
" -V[ver] create SPIR-V binary, under Vulkan semantics; turns on -l;\n"
|
||||
" default file name is <stage>.spv (-o overrides this)\n"
|
||||
" 'ver', when present, is the version of the input semantics,\n"
|
||||
@@ -1485,7 +1567,7 @@ void usage()
|
||||
" -l link all input files together to form a single module\n"
|
||||
" -m memory leak mode\n"
|
||||
" -o <file> save binary to <file>, requires a binary option (e.g., -V)\n"
|
||||
" -q dump reflection query database\n"
|
||||
" -q dump reflection query database; requires -l for linking\n"
|
||||
" -r | --relaxed-errors"
|
||||
" relaxed GLSL semantic error-checking mode\n"
|
||||
" -s silence syntax and semantic error reporting\n"
|
||||
@@ -1502,6 +1584,7 @@ void usage()
|
||||
" --auto-map-locations | --aml automatically locate input/output lacking\n"
|
||||
" 'location' (fragile, not cross stage)\n"
|
||||
" --client {vulkan<ver>|opengl<ver>} see -V and -G\n"
|
||||
" --dump-builtin-symbols prints builtin symbol table prior each compile\n"
|
||||
" -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n"
|
||||
" --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n"
|
||||
" scalars\n"
|
||||
@@ -1509,9 +1592,23 @@ void usage()
|
||||
" works independently of source language\n"
|
||||
" --hlsl-iomap perform IO mapping in HLSL register space\n"
|
||||
" --hlsl-enable-16bit-types allow 16-bit types in SPIR-V for HLSL\n"
|
||||
" --hlsl-dx9-compatible interprets sampler declarations as a\n"
|
||||
" texture/sampler combo like DirectX9 would.\n"
|
||||
" --invert-y | --iy invert position.Y output in vertex shader\n"
|
||||
" --keep-uncalled | --ku don't eliminate uncalled functions\n"
|
||||
" --nan-clamp favor non-NaN operand in min, max, and clamp\n"
|
||||
" --no-storage-format | --nsf use Unknown image format\n"
|
||||
" --reflect-strict-array-suffix use strict array suffix rules when\n"
|
||||
" reflecting\n"
|
||||
" --reflect-basic-array-suffix arrays of basic types will have trailing [0]\n"
|
||||
" --reflect-intermediate-io reflection includes inputs/outputs of linked\n"
|
||||
" shaders rather than just vertex/fragment\n"
|
||||
" --reflect-separate-buffers reflect buffer variables and blocks\n"
|
||||
" separately to uniforms\n"
|
||||
" --reflect-all-block-variables reflect all variables in blocks, whether\n"
|
||||
" inactive or active\n"
|
||||
" --reflect-unwrap-io-blocks unwrap input/output blocks the same as\n"
|
||||
" uniform blocks\n"
|
||||
" --resource-set-binding [stage] name set binding\n"
|
||||
" set descriptor set and binding for\n"
|
||||
" individual resources\n"
|
||||
@@ -1554,16 +1651,17 @@ void usage()
|
||||
" --sep synonym for --source-entrypoint\n"
|
||||
" --stdin read from stdin instead of from a file;\n"
|
||||
" requires providing the shader stage using -S\n"
|
||||
" --target-env {vulkan1.0 | vulkan1.1 | opengl | \n"
|
||||
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3}\n"
|
||||
" set execution environment that emitted code\n"
|
||||
" will execute in (versus source language\n"
|
||||
" semantics selected by --client) defaults:\n"
|
||||
" * 'vulkan1.0' under '--client vulkan<ver>'\n"
|
||||
" * 'opengl' under '--client opengl<ver>'\n"
|
||||
" * 'spirv1.0' under --target-env vulkan1.0\n"
|
||||
" * 'spirv1.3' under --target-env vulkan1.1\n"
|
||||
" multiple --targen-env can be specified.\n"
|
||||
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | opengl | \n"
|
||||
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 | spirv1.5}\n"
|
||||
" Set the execution environment that the\n"
|
||||
" generated code will be executed in.\n"
|
||||
" Defaults to:\n"
|
||||
" * vulkan1.0 under --client vulkan<ver>\n"
|
||||
" * opengl under --client opengl<ver>\n"
|
||||
" * spirv1.0 under --target-env vulkan1.0\n"
|
||||
" * spirv1.3 under --target-env vulkan1.1\n"
|
||||
" * spirv1.5 under --target-env vulkan1.2\n"
|
||||
" Multiple --target-env can be specified.\n"
|
||||
" --variable-name <name>\n"
|
||||
" --vn <name> creates a C header file that contains a\n"
|
||||
" uint32_t array named <name>\n"
|
||||
|
||||
51
third_party/glslang/StandAlone/resource_limits_c.cpp
vendored
Normal file
51
third_party/glslang/StandAlone/resource_limits_c.cpp
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2020, Travis Fort
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**/
|
||||
|
||||
#include "resource_limits_c.h"
|
||||
#include "ResourceLimits.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
const glslang_resource_t* glslang_default_resource(void)
|
||||
{
|
||||
return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource);
|
||||
}
|
||||
|
||||
const char* glslang_default_resource_string()
|
||||
{
|
||||
std::string cpp_str = glslang::GetDefaultTBuiltInResourceString();
|
||||
char* c_str = (char*)malloc(cpp_str.length() + 1);
|
||||
strcpy(c_str, cpp_str.c_str());
|
||||
return c_str;
|
||||
}
|
||||
|
||||
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
|
||||
{
|
||||
glslang::DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config);
|
||||
}
|
||||
54
third_party/glslang/StandAlone/resource_limits_c.h
vendored
Normal file
54
third_party/glslang/StandAlone/resource_limits_c.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2020, Travis Fort
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**/
|
||||
|
||||
#ifndef _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
|
||||
#define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
|
||||
|
||||
#include "../glslang/Include/glslang_c_interface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// These are the default resources for TBuiltInResources, used for both
|
||||
// - parsing this string for the case where the user didn't supply one,
|
||||
// - dumping out a template for user construction of a config file.
|
||||
const glslang_resource_t* glslang_default_resource(void);
|
||||
|
||||
// Returns the DefaultTBuiltInResource as a human-readable string.
|
||||
// NOTE: User is responsible for freeing this string.
|
||||
const char* glslang_default_resource_string();
|
||||
|
||||
// Decodes the resource limits from |config| to |resources|.
|
||||
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
|
||||
@@ -227,7 +227,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
else if (arg == "--version" || arg == "-V") {
|
||||
std::cout << basename(argv[0]) << " version 0.97 " << __DATE__ << " " << __TIME__ << std::endl;
|
||||
std::cout << basename(argv[0]) << " version 0.97" << std::endl;
|
||||
exit(0);
|
||||
} else if (arg == "--input" || arg == "-i") {
|
||||
// Collect input files
|
||||
|
||||
28
third_party/glslang/Test/100.conf
vendored
28
third_party/glslang/Test/100.conf
vendored
@@ -1,28 +0,0 @@
|
||||
MaxLights 32
|
||||
MaxClipPlanes 6
|
||||
MaxTextureUnits 32
|
||||
MaxTextureCoords 32
|
||||
MaxVertexAttribs 8
|
||||
MaxVertexUniformComponents 4096
|
||||
MaxVaryingFloats 64
|
||||
MaxVertexTextureImageUnits 0
|
||||
MaxCombinedTextureImageUnits 8
|
||||
MaxTextureImageUnits 8
|
||||
MaxFragmentUniformComponents 4096
|
||||
MaxDrawBuffers 1
|
||||
MaxVertexUniformVectors 16
|
||||
MaxVaryingVectors 8
|
||||
MaxFragmentUniformVectors 16
|
||||
MaxVertexOutputVectors 16
|
||||
MaxFragmentInputVectors 15
|
||||
MinProgramTexelOffset -8
|
||||
MaxProgramTexelOffset 7
|
||||
nonInductiveForLoops 0
|
||||
whileLoops 0
|
||||
doWhileLoops 0
|
||||
generalUniformIndexing 0
|
||||
generalAttributeMatrixVectorIndexing 0
|
||||
generalVaryingIndexing 0
|
||||
generalSamplerIndexing 0
|
||||
generalVariableIndexing 0
|
||||
generalConstantMatrixVectorIndexing 0
|
||||
227
third_party/glslang/Test/100.frag
vendored
227
third_party/glslang/Test/100.frag
vendored
@@ -1,227 +0,0 @@
|
||||
// okay
|
||||
#version 100
|
||||
int a[3] = { 2, 3, 4, }; // ERROR (lots)
|
||||
#version 100
|
||||
int uint;
|
||||
|
||||
attribute vec4 v[3]; // ERROR
|
||||
|
||||
float f = 2; // ERROR
|
||||
|
||||
uniform block { // ERROR
|
||||
int x;
|
||||
};
|
||||
|
||||
void foo(float);
|
||||
|
||||
void main()
|
||||
{
|
||||
foo(3); // ERROR
|
||||
int s = 1 << 4; // ERROR
|
||||
s = 16 >> 2; // ERROR
|
||||
if (a == a); // ERROR
|
||||
int b, c;
|
||||
b = c & 4; // ERROR
|
||||
b = c % 4; // ERROR
|
||||
b = c | 4; // ERROR
|
||||
b >>= 2; // ERROR
|
||||
b <<= 2; // ERROR
|
||||
b %= 3; // ERROR
|
||||
|
||||
struct S {
|
||||
float f;
|
||||
float a[10];
|
||||
} s1, s2;
|
||||
|
||||
s1 = s2; // ERROR
|
||||
if (s1 == s2); // ERROR
|
||||
if (s1 != s2); // ERROR
|
||||
|
||||
switch(b) { // ERROR
|
||||
}
|
||||
}
|
||||
|
||||
invariant gl_FragColor;
|
||||
float fa[]; // ERROR
|
||||
float f13;
|
||||
invariant f13; // ERROR
|
||||
struct S { int a; };
|
||||
invariant S; // ERROR, not an input or output
|
||||
invariant float fi; // ERROR
|
||||
varying vec4 av;
|
||||
invariant av; // okay in v100
|
||||
|
||||
void foo10()
|
||||
{
|
||||
invariant f; // ERROR
|
||||
invariant float f2; // ERROR
|
||||
float f3;
|
||||
invariant f3; // ERROR
|
||||
}
|
||||
|
||||
uniform vec2 uv2;
|
||||
invariant uv2; // ERROR
|
||||
invariant uniform vec3 uv3; // ERROR
|
||||
|
||||
sampler2D glob2D; // ERROR
|
||||
void f11(sampler2D p2d)
|
||||
{
|
||||
sampler2D v2D; // ERROR
|
||||
}
|
||||
varying sampler2D vary2D; // ERROR
|
||||
|
||||
struct sp {
|
||||
highp float f;
|
||||
in float g; // ERROR
|
||||
uniform float h; // ERROR
|
||||
invariant float i; // ERROR
|
||||
};
|
||||
|
||||
uniform sampler3D s3D; // ERROR
|
||||
|
||||
#extension GL_OES_texture_3D : enable
|
||||
|
||||
precision highp sampler3D;
|
||||
uniform sampler3D s3D2;
|
||||
|
||||
void foo234()
|
||||
{
|
||||
texture3D(s3D2, vec3(0.2), 0.2);
|
||||
texture3DProj(s3D2, v[1], 0.4);
|
||||
dFdx(v[0]); // ERROR
|
||||
dFdy(3.2); // ERROR
|
||||
fwidth(f13); // ERROR
|
||||
}
|
||||
|
||||
#extension GL_OES_standard_derivatives : enable
|
||||
|
||||
void foo236()
|
||||
{
|
||||
dFdx(v[0]);
|
||||
dFdy(3.2);
|
||||
fwidth(f13);
|
||||
gl_FragDepth = f13; // ERROR
|
||||
gl_FragDepthEXT = f13; // ERROR
|
||||
}
|
||||
|
||||
#extension GL_EXT_frag_depth : enable
|
||||
|
||||
void foo239()
|
||||
{
|
||||
gl_FragDepth = f13; // ERROR
|
||||
gl_FragDepthEXT = f13;
|
||||
}
|
||||
|
||||
#extension GL_OES_EGL_image_external : enable
|
||||
|
||||
uniform samplerExternalOES sExt;
|
||||
|
||||
void foo245()
|
||||
{
|
||||
texture2D(sExt, vec2(0.2));
|
||||
texture2DProj(sExt, vec3(f13));
|
||||
texture2DProj(sExt, v[2]);
|
||||
}
|
||||
|
||||
precision mediump samplerExternalOES;
|
||||
uniform samplerExternalOES mediumExt;
|
||||
uniform highp samplerExternalOES highExt;
|
||||
|
||||
void foo246()
|
||||
{
|
||||
texture2D(mediumExt, vec2(0.2));
|
||||
texture2DProj(highExt, v[2]);
|
||||
texture3D(sExt, vec3(f13)); // ERROR
|
||||
texture2DProjLod(sExt, vec3(f13), f13); // ERROR
|
||||
int a;
|
||||
~a; // ERROR
|
||||
a | a; // ERROR
|
||||
a & a; // ERROR
|
||||
}
|
||||
|
||||
#extension GL_OES_EGL_image_external : disable
|
||||
uniform sampler2D s2Dg;
|
||||
|
||||
int foo203940(int a, float b, float a) // ERROR, a redefined
|
||||
{
|
||||
texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2); // ERROR, extension not enabled
|
||||
return a;
|
||||
}
|
||||
|
||||
float f123 = 4.0f; // ERROR
|
||||
float f124 = 5e10F; // ERROR
|
||||
|
||||
#extension GL_EXT_shader_texture_lod : enable
|
||||
|
||||
uniform samplerCube sCube;
|
||||
|
||||
void foo323433()
|
||||
{
|
||||
texture2DLodEXT(s2Dg, uv2, f13);
|
||||
texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2);
|
||||
texture2DGradEXT(s2Dg, uv2, uv2, uv2);
|
||||
textureCubeGradEXT(sCube, vec3(f13), vec3(f13), vec3(f13));
|
||||
}
|
||||
|
||||
int fgfg(float f, mediump int i);
|
||||
int fgfg(float f, highp int i) { return 2; } // ERROR, precision qualifier difference
|
||||
|
||||
int fffg(float f);
|
||||
int fffg(float f); // ERROR, can't have multiple prototypes
|
||||
|
||||
int gggf(float f);
|
||||
int gggf(float f) { return 2; }
|
||||
|
||||
int agggf(float f) { return 2; }
|
||||
int agggf(float f);
|
||||
int agggf(float f); // ERROR, second prototype
|
||||
|
||||
varying struct SSS { float f; } s; // ERROR
|
||||
|
||||
int vf(void);
|
||||
int vf2();
|
||||
int vf3(void v); // ERROR
|
||||
int vf4(int, void); // ERROR
|
||||
int vf5(int, void v); // ERROR
|
||||
|
||||
void badswizzle()
|
||||
{
|
||||
vec3 a[5];
|
||||
a.y; // ERROR, no array swizzle
|
||||
a.zy; // ERROR, no array swizzle
|
||||
a.nothing; // ERROR
|
||||
a.length(); // ERROR, not this version
|
||||
a.method(); // ERROR
|
||||
}
|
||||
|
||||
float fooinit();
|
||||
|
||||
float fooinittest()
|
||||
{
|
||||
return fooinit();
|
||||
}
|
||||
|
||||
// Test extra-function initializers
|
||||
const float fi1 = 3.0;
|
||||
const float fi2 = 4.0;
|
||||
const float fi3 = 5.0;
|
||||
|
||||
float fooinit()
|
||||
{
|
||||
return fi1 + fi2 + fi3; // should make a constant of 12.0
|
||||
}
|
||||
|
||||
int init1 = gl_FrontFacing ? 1 : 2; // ERROR, non-const initializer
|
||||
|
||||
#ifdef GL_EXT_shader_non_constant_global_initializers
|
||||
#extension GL_EXT_shader_non_constant_global_initializers : enable
|
||||
#endif
|
||||
|
||||
int init2 = gl_FrontFacing ? 1 : 2;
|
||||
|
||||
#pragma STDGL invariant(all)
|
||||
|
||||
#line 3000
|
||||
#error line of this error should be 3000
|
||||
|
||||
uniform samplerExternalOES badExt; // syntax ERROR
|
||||
76
third_party/glslang/Test/100Limits.vert
vendored
76
third_party/glslang/Test/100Limits.vert
vendored
@@ -1,76 +0,0 @@
|
||||
#version 100
|
||||
|
||||
int ga, gb;
|
||||
float f;
|
||||
|
||||
uniform sampler2D fsa[3];
|
||||
uniform float fua[10];
|
||||
attribute mat3 am3;
|
||||
attribute vec2 av2;
|
||||
varying vec4 va[4];
|
||||
|
||||
const mat2 m2 = mat2(1.0);
|
||||
const vec3 v3 = vec3(2.0);
|
||||
|
||||
void foo(inout float a) {}
|
||||
|
||||
int bar()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
while (ga < gb) { }
|
||||
|
||||
do { } while (false);
|
||||
|
||||
for ( ; ; ); // ERROR
|
||||
for ( ; ga==gb; ); // ERROR
|
||||
for ( ; ; f++); // ERROR
|
||||
for ( ga = 0; ; ); // ERROR
|
||||
for ( bool a = false; ; ); // ERROR
|
||||
for (float a = 0.0; a == sin(f); ); // ERROR
|
||||
for ( int a = 0; a < 10; a *= 2); // ERROR
|
||||
for ( int a = 0; a <= 20; a++) --a; // ERROR
|
||||
for ( int a = 0; a <= 20; a++) { if (ga==0) a = 4; } // ERROR
|
||||
for (float a = 0.0; a <= 20.0; a += 2.0);
|
||||
for (float a = 0.0; a != 20.0; a -= 2.0) { if (ga==0) ga = 4; }
|
||||
for (float a = 0.0; a == 20.0; a--) for (float a = 0.0; a == 20.0; a--); // two different 'a's, everything okay
|
||||
for (float a = 0.0; a <= 20.0; a += 2.0);
|
||||
for (float a = 0.0; a <= 20.0; a += 2.0);
|
||||
for (float a = 0.0; a > 2.0 * 20.0; a += v3.y);
|
||||
for (float a = 0.0; a >= 20.0; a += 2.0) foo(a); // ERROR
|
||||
|
||||
int ia[9];
|
||||
|
||||
fsa[ga]; // ERROR
|
||||
fua[ga];
|
||||
am3[ga]; // ERROR
|
||||
av2[ga]; // ERROR
|
||||
va[2+ga]; // ERROR
|
||||
m2[ga]; // ERROR
|
||||
v3[ga/2]; // ERROR
|
||||
ia[ga]; // ERROR
|
||||
|
||||
for (int a = 3; a >= 0; a--) {
|
||||
fsa[a];
|
||||
fua[a+2];
|
||||
am3[3*a];
|
||||
av2[3*a];
|
||||
va[a-1];
|
||||
m2[a/2];
|
||||
v3[a];
|
||||
ia[a];
|
||||
ia[bar()]; // ERROR
|
||||
}
|
||||
|
||||
fsa[2];
|
||||
fua[3];
|
||||
am3[2];
|
||||
av2[1];
|
||||
va[1];
|
||||
m2[1];
|
||||
v3[1];
|
||||
ia[3];
|
||||
}
|
||||
41
third_party/glslang/Test/100samplerExternal.frag
vendored
41
third_party/glslang/Test/100samplerExternal.frag
vendored
@@ -1,41 +0,0 @@
|
||||
#version 100
|
||||
|
||||
#extension GL_OES_EGL_image_external : enable
|
||||
|
||||
uniform samplerExternalOES sExt;
|
||||
precision mediump samplerExternalOES;
|
||||
uniform samplerExternalOES mediumExt;
|
||||
uniform highp samplerExternalOES highExt;
|
||||
|
||||
void main()
|
||||
{
|
||||
texture2D(sExt, vec2(0.2));
|
||||
texture2D(mediumExt, vec2(0.2));
|
||||
texture2D(highExt, vec2(0.2));
|
||||
texture2DProj(sExt, vec3(0.3));
|
||||
texture2DProj(sExt, vec4(0.3));
|
||||
|
||||
int lod = 0;
|
||||
highp float bias = 0.01;
|
||||
textureSize(sExt, lod); // ERROR
|
||||
texture(sExt, vec2(0.2)); // ERROR
|
||||
texture(sExt, vec2(0.2), bias); // ERROR
|
||||
textureProj(sExt, vec3(0.2)); // ERROR
|
||||
textureProj(sExt, vec3(0.2), bias); // ERROR
|
||||
textureProj(sExt, vec4(0.2)); // ERROR
|
||||
textureProj(sExt, vec4(0.2), bias); // ERROR
|
||||
texelFetch(sExt, ivec2(4), lod); // ERROR
|
||||
|
||||
texture3D(sExt, vec3(0.3)); // ERROR
|
||||
texture2DProjLod(sExt, vec3(0.3), 0.3); // ERROR
|
||||
texture(sExt, vec3(0.3)); // ERROR
|
||||
textureProjLod(sExt, vec3(0.3), 0.3); // ERROR
|
||||
}
|
||||
|
||||
#extension GL_OES_EGL_image_external : disable
|
||||
|
||||
#extension GL_OES_EGL_image_external_essl3 : enable
|
||||
uniform samplerExternalOES badExt; // ERROR
|
||||
#extension GL_OES_EGL_image_external_essl3 : disable
|
||||
|
||||
uniform samplerExternalOES badExt; // ERROR
|
||||
76
third_party/glslang/Test/100scope.vert
vendored
76
third_party/glslang/Test/100scope.vert
vendored
@@ -1,76 +0,0 @@
|
||||
#version 100
|
||||
|
||||
int f(int a, int b, int c)
|
||||
{
|
||||
int a = b; // ERROR, redefinition
|
||||
|
||||
{
|
||||
float a = float(a) + 1.0;
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
int f(int a, int b, int c); // okay to redeclare
|
||||
|
||||
bool b;
|
||||
float b(int a); // ERROR: redefinition
|
||||
|
||||
float c(int a);
|
||||
bool c; // ERROR: redefinition
|
||||
|
||||
float f; // ERROR: redefinition
|
||||
float tan; // okay, built-in is in an outer scope
|
||||
float sin(float x); // ERROR: can't redefine built-in functions
|
||||
float cos(float x) // ERROR: can't redefine built-in functions
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
bool radians(bool x) // okay, can overload built-in functions
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
invariant gl_Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
int g(); // ERROR: no local function declarations
|
||||
g();
|
||||
|
||||
float sin; // okay
|
||||
sin;
|
||||
sin(0.7); // ERROR, use of hidden function
|
||||
f(1,2,3);
|
||||
|
||||
float f; // hides f()
|
||||
f = 3.0;
|
||||
|
||||
gl_Position = vec4(f);
|
||||
|
||||
for (int f = 0; f < 10; ++f)
|
||||
++f;
|
||||
|
||||
int x = 1;
|
||||
{
|
||||
float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
|
||||
int z = z; // ERROR: z not previously defined.
|
||||
}
|
||||
{
|
||||
int x = x; // x is initialized to '1'
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
int x;
|
||||
};
|
||||
{
|
||||
S S = S(0); // 'S' is only visible as a struct and constructor
|
||||
S.x; // 'S' is now visible as a variable
|
||||
}
|
||||
|
||||
int degrees;
|
||||
degrees(3.2); // ERROR, use of hidden built-in function
|
||||
}
|
||||
|
||||
varying struct SSS { float f; } s; // ERROR
|
||||
87
third_party/glslang/Test/110scope.vert
vendored
87
third_party/glslang/Test/110scope.vert
vendored
@@ -1,87 +0,0 @@
|
||||
#version 110
|
||||
|
||||
int f(int a, int b, int c)
|
||||
{
|
||||
int a = b; // ERROR, redefinition
|
||||
|
||||
{
|
||||
float a = float(a) + 1.0; // okay
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
int f(int a, int b, int c); // okay to redeclare
|
||||
|
||||
bool b;
|
||||
float b(int a); // okay, b and b() are different
|
||||
|
||||
float c(int a);
|
||||
bool c; // okay, and c() are different
|
||||
|
||||
float f; // okay f and f() are different
|
||||
float tan; // okay, hides built-in function
|
||||
float sin(float x); // okay, can redefine built-in functions
|
||||
float cos(float x) // okay, can redefine built-in functions
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
bool radians(bool x) // okay, can overload built-in functions
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int gi = f(1,2,3); // ERROR, can't call user-defined function from global scope
|
||||
|
||||
void main()
|
||||
{
|
||||
int g(); // okay
|
||||
g();
|
||||
|
||||
float sin; // okay
|
||||
sin;
|
||||
sin(0.7); // okay
|
||||
f(1,2,3);
|
||||
|
||||
float f;
|
||||
f = 3.0;
|
||||
|
||||
gl_Position = vec4(f);
|
||||
|
||||
for (int f = 0; f < 10; ++f)
|
||||
++f;
|
||||
|
||||
int x = 1;
|
||||
{
|
||||
float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
|
||||
int z = z; // ERROR: z not previously defined.
|
||||
}
|
||||
{
|
||||
int x = x; // x is initialized to '1'
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
int x;
|
||||
};
|
||||
{
|
||||
S S = S(0); // 'S' is only visible as a struct and constructor
|
||||
S.x; // 'S' is now visible as a variable
|
||||
}
|
||||
|
||||
int degrees;
|
||||
degrees(3.2);
|
||||
|
||||
{
|
||||
S s;
|
||||
s.x = 3;
|
||||
struct S { // okay, hides S
|
||||
bool b;
|
||||
};
|
||||
S t;
|
||||
t.b = true;
|
||||
struct S { // ERROR, redefinition of struct S
|
||||
float f;
|
||||
};
|
||||
}
|
||||
}
|
||||
248
third_party/glslang/Test/120.frag
vendored
248
third_party/glslang/Test/120.frag
vendored
@@ -1,248 +0,0 @@
|
||||
#version 120
|
||||
|
||||
float lowp;
|
||||
float mediump;
|
||||
float highp;
|
||||
|
||||
float precision;
|
||||
|
||||
in vec4 i;
|
||||
out vec4 o;
|
||||
|
||||
uniform sampler2D s2D;
|
||||
centroid varying vec2 centTexCoord;
|
||||
|
||||
uniform mat4x2 m;
|
||||
|
||||
struct s {
|
||||
float f;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
mat2x3 m23 = mat2x3(m);
|
||||
|
||||
int a;
|
||||
bool b;
|
||||
s sv = s(a);
|
||||
float[2] ia = float[2](3, i.y);
|
||||
float f1 = 1;
|
||||
float f = a;
|
||||
f = a;
|
||||
ivec3 iv3;
|
||||
vec3 v3 = iv3;
|
||||
f = f + a;
|
||||
f = a - f;
|
||||
f += a;
|
||||
f = a - f;
|
||||
v3 *= iv3;
|
||||
v3 = iv3 / 2.0f;
|
||||
v3 = 3.0 * iv3;
|
||||
v3 = 2 * v3;
|
||||
v3 = v3 - 2;
|
||||
if (f < a ||
|
||||
a <= f ||
|
||||
f > a ||
|
||||
f >= a ||
|
||||
a == f ||
|
||||
f != a);
|
||||
f = b ? a : f;
|
||||
f = b ? f : a;
|
||||
f = b ? a : a;
|
||||
s news = sv;
|
||||
|
||||
i.xy + i.xyz; // ERROR
|
||||
m * i.xyz; // ERROR
|
||||
m + i; // ERROR
|
||||
int aoeu = 1.0; // ERROR
|
||||
f = b; // ERROR
|
||||
f = a + b; // ERROR
|
||||
f = b * a; // ERROR
|
||||
b = a; // ERROR
|
||||
b = b + f; // ERROR
|
||||
f |= b; // ERROR
|
||||
|
||||
gl_FragColor = texture2D(s2D, centTexCoord);
|
||||
|
||||
float flat;
|
||||
float smooth;
|
||||
float noperspective;
|
||||
float uvec2;
|
||||
float uvec3;
|
||||
float uvec4;
|
||||
//packed; // ERROR, reserved word
|
||||
|
||||
{
|
||||
mat4 m;
|
||||
vec4 v;
|
||||
bool b;
|
||||
gl_FragColor += b ? v : m; // ERROR, types don't match around ":"
|
||||
}
|
||||
|
||||
gl_FragColor.xr; // ERROR, swizzlers not from same field space
|
||||
gl_FragColor.xyxyx.xy; // ERROR, cannot make a vec5, even temporarily
|
||||
centTexCoord.z; // ERROR, swizzler out of range
|
||||
(a,b) = true; // ERROR, not an l-value
|
||||
}
|
||||
|
||||
float imageBuffer;
|
||||
float uimage2DRect;
|
||||
|
||||
int main() {} // ERROR
|
||||
void main(int a) {} // ERROR
|
||||
|
||||
const int a; // ERROR
|
||||
|
||||
int foo(in float a);
|
||||
int foo(out float a) // ERROR
|
||||
{
|
||||
return 3.2; // ERROR
|
||||
foo(a); // ERROR
|
||||
}
|
||||
|
||||
bool gen(vec3 v)
|
||||
{
|
||||
if (abs(v[0]) < 1e-4F && abs(v[1]) < 1e-4)
|
||||
return true;
|
||||
}
|
||||
|
||||
void v1()
|
||||
{
|
||||
}
|
||||
|
||||
void v2()
|
||||
{
|
||||
return v1(); // ERROR, no expression allowed, even though void
|
||||
}
|
||||
|
||||
void atest()
|
||||
{
|
||||
vec4 v = gl_TexCoord[1];
|
||||
v += gl_TexCoord[3];
|
||||
}
|
||||
|
||||
varying vec4 gl_TexCoord[6]; // okay, assigning a size
|
||||
varying vec4 gl_TexCoord[5]; // ERROR, changing size
|
||||
|
||||
mat2x2 m22;
|
||||
mat2x3 m23;
|
||||
mat2x4 m24;
|
||||
|
||||
mat3x2 m32;
|
||||
mat3x3 m33;
|
||||
mat3x4 m34;
|
||||
|
||||
mat4x2 m42;
|
||||
mat4x3 m43;
|
||||
mat4x4 m44;
|
||||
|
||||
void foo123()
|
||||
{
|
||||
mat2 r2 = matrixCompMult(m22, m22);
|
||||
mat3 r3 = matrixCompMult(m33, m33);
|
||||
mat4 r4 = matrixCompMult(m44, m44);
|
||||
|
||||
mat2x3 r23 = matrixCompMult(m23, m23);
|
||||
mat2x4 r24 = matrixCompMult(m24, m24);
|
||||
mat3x2 r32 = matrixCompMult(m32, m32);
|
||||
mat3x4 r34 = matrixCompMult(m34, m34);
|
||||
mat4x2 r42 = matrixCompMult(m42, m42);
|
||||
mat4x3 r43 = matrixCompMult(m43, m43);
|
||||
|
||||
mat3x2 rfoo1 = matrixCompMult(m23, m32); // ERROR
|
||||
mat3x4 rfoo2 = matrixCompMult(m34, m44); // ERROR
|
||||
}
|
||||
|
||||
void matConst()
|
||||
{
|
||||
vec2 v2;
|
||||
vec3 v3;
|
||||
mat4 m4b1 = mat4(v2, v3); // ERROR, not enough
|
||||
mat4 m4b2 = mat4(v2, v3, v3, v3, v3, v2, v2); // ERROR, too much
|
||||
mat4 m4g = mat4(v2, v3, v3, v3, v3, v3);
|
||||
mat4 m4 = mat4(v2, v3, v3, v3, v3, v2);
|
||||
mat3 m3 = mat3(m4);
|
||||
mat3 m3b1 = mat3(m4, v2); // ERROR, extra arg
|
||||
mat3 m3b2 = mat3(m4, m4); // ERROR, extra arg
|
||||
mat3x2 m32 = mat3x2(m4);
|
||||
mat4 m4c = mat4(m32);
|
||||
mat3 m3s = mat3(v2.x);
|
||||
|
||||
mat3 m3a1[2] = mat3[2](m3s, m3s);
|
||||
mat3 m3a2[2] = mat3[2](m3s, m3s, m3s); // ERROR, too many args
|
||||
}
|
||||
|
||||
uniform sampler3D s3D;
|
||||
uniform sampler1D s1D;
|
||||
uniform sampler2DShadow s2DS;
|
||||
|
||||
void foo2323()
|
||||
{
|
||||
vec4 v;
|
||||
vec2 v2;
|
||||
float f;
|
||||
v = texture2DLod(s2D, v2, f); // ERROR
|
||||
v = texture3DProjLod(s3D, v, f); // ERROR
|
||||
v = texture1DProjLod(s1D, v, f); // ERROR
|
||||
v = shadow2DProjLod(s2DS, v, f); // ERROR
|
||||
|
||||
v = texture1DGradARB(s1D, f, f, f); // ERROR
|
||||
v = texture2DProjGradARB(s2D, v, v2, v2); // ERROR
|
||||
v = shadow2DProjGradARB(s2DS, v, v2, v2); // ERROR
|
||||
}
|
||||
|
||||
#extension GL_ARB_shader_texture_lod : require
|
||||
|
||||
void foo2324()
|
||||
{
|
||||
vec4 v;
|
||||
vec2 v2;
|
||||
float f;
|
||||
v = texture2DLod(s2D, v2, f);
|
||||
v = texture3DProjLod(s3D, v, f);
|
||||
v = texture1DProjLod(s1D, v, f);
|
||||
v = shadow2DProjLod(s2DS, v, f);
|
||||
|
||||
v = texture1DGradARB(s1D, f, f, f);
|
||||
v = texture2DProjGradARB(s2D, v, v2, v2);
|
||||
v = shadow2DProjGradARB(s2DS, v, v2, v2);
|
||||
v = shadow2DRectProjGradARB(s2DS, v, v2, v2); // ERROR
|
||||
}
|
||||
|
||||
uniform sampler2DRect s2DRbad; // ERROR
|
||||
|
||||
void foo121111()
|
||||
{
|
||||
vec2 v2;
|
||||
vec4 v = texture2DRect(s2DRbad, v2);
|
||||
}
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
uniform sampler2DRect s2DR;
|
||||
uniform sampler2DRectShadow s2DRS;
|
||||
|
||||
void foo12111()
|
||||
{
|
||||
vec2 v2;
|
||||
vec3 v3;
|
||||
vec4 v4;
|
||||
vec4 v;
|
||||
v = texture2DRect(s2DR, v2);
|
||||
v = texture2DRectProj(s2DR, v3);
|
||||
v = texture2DRectProj(s2DR, v4);
|
||||
v = shadow2DRect(s2DRS, v3);
|
||||
v = shadow2DRectProj(s2DRS, v4);
|
||||
|
||||
v = shadow2DRectProjGradARB(s2DRS, v, v2, v2);
|
||||
}
|
||||
|
||||
void voidTernary()
|
||||
{
|
||||
bool b;
|
||||
b ? foo121111() : foo12111();
|
||||
b ? foo121111() : 4; // ERROR
|
||||
b ? 3 : foo12111(); // ERROR
|
||||
}
|
||||
|
||||
float halfFloat1 = 1.0h; // syntax ERROR
|
||||
203
third_party/glslang/Test/120.vert
vendored
203
third_party/glslang/Test/120.vert
vendored
@@ -1,203 +0,0 @@
|
||||
#version 120
|
||||
|
||||
in vec4 i; // ERROR
|
||||
out vec4 o; // ERROR
|
||||
|
||||
attribute vec2 attv2;
|
||||
attribute vec4 attv4;
|
||||
uniform sampler2D s2D;
|
||||
invariant varying vec2 centTexCoord;
|
||||
invariant gl_Position;
|
||||
centroid gl_Position; // ERROR
|
||||
centroid centroid foo; // ERROR
|
||||
invariant gl_Position, gl_PointSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
centTexCoord = attv2;
|
||||
gl_Position = attv4;
|
||||
|
||||
gl_ClipVertex = attv4;
|
||||
gl_ClipDistance[1] = 0.2; // ERROR
|
||||
|
||||
vec3[12] a;
|
||||
vec4[a.length()] b;
|
||||
gl_Position = b[b.length()-1];
|
||||
|
||||
float f[];
|
||||
int a1 = f.length(); // ERROR
|
||||
float f[7];
|
||||
int aa = f.length();
|
||||
int a2 = f.length; // ERROR
|
||||
int a3 = f.length(a); // ERROR
|
||||
int a4 = f.flizbit; // ERROR
|
||||
int a4 = f.flizbit(); // ERROR
|
||||
float md[2][4]; // ERROR
|
||||
float[2] md2[4]; // ERROR
|
||||
float[2][4] md3; // ERROR
|
||||
float md5, md6[2][3]; // ERROR
|
||||
float[2] md4, md7[4]; // ERROR
|
||||
float md9[2][3] = float[2][3](1, 2, 3, 4, 5, 6); // ERROR
|
||||
float md10, md11[2][3] = float[2][3](1, 2, 3, 4, 5, 6); // ERROR
|
||||
|
||||
gl_PointSize = 3.8;
|
||||
}
|
||||
|
||||
uniform float initted = 3.4; // okay
|
||||
|
||||
const float concall = sin(0.3);
|
||||
|
||||
int[2][3] foo( // ERROR
|
||||
float[2][3] a, // ERROR
|
||||
float[2] b[3], // ERROR
|
||||
float c[2][3]); // ERROR
|
||||
|
||||
int overloadA(in float f);
|
||||
int overloadA(out float f); // ERROR, different qualifiers
|
||||
float overloadA(float); // ERROR, different return value for same signature
|
||||
float overloadA(out float f, int);
|
||||
float overloadA(int i);
|
||||
|
||||
void overloadB(float, const in float) { }
|
||||
|
||||
vec2 overloadC(int, int);
|
||||
vec2 overloadC(const in int, float);
|
||||
vec2 overloadC(float, int);
|
||||
vec2 overloadC(vec2, vec2);
|
||||
|
||||
vec3 overloadD(int, float);
|
||||
vec3 overloadD(float, in int);
|
||||
|
||||
vec3 overloadE(float[2]);
|
||||
vec3 overloadE(mat2 m);
|
||||
vec3 overloadE(vec2 v);
|
||||
|
||||
vec3 overloadF(int);
|
||||
vec3 overloadF(float);
|
||||
|
||||
void foo()
|
||||
{
|
||||
float f;
|
||||
int i;
|
||||
|
||||
overloadB(f, f);
|
||||
overloadB(f, 2);
|
||||
overloadB(1, i);
|
||||
|
||||
overloadC(1); // ERROR
|
||||
overloadC(1, i);
|
||||
overloadC(vec2(1), vec2(2));
|
||||
overloadC(f, 3.0); // ERROR, no way
|
||||
overloadC(ivec2(1), vec2(2));
|
||||
|
||||
overloadD(i, f);
|
||||
overloadD(f, i);
|
||||
overloadD(i, i); // ERROR, ambiguous
|
||||
|
||||
int overloadB; // hiding
|
||||
overloadB(1, i); // ERROR
|
||||
|
||||
sin(1);
|
||||
texture2D(s2D, ivec2(0));
|
||||
clamp(attv4, 0, 1);
|
||||
clamp(ivec4(attv4), 0, 1);
|
||||
|
||||
int a[2];
|
||||
overloadC(a, 3); // ERROR
|
||||
overloadE(a); // ERROR
|
||||
overloadE(3.3); // ERROR
|
||||
overloadE(vec2(3.3));
|
||||
overloadE(mat2(0.5));
|
||||
overloadE(ivec4(1)); // ERROR
|
||||
overloadE(ivec2(1));
|
||||
|
||||
float b[2];
|
||||
overloadE(b);
|
||||
|
||||
overloadF(1, 1); // ERROR
|
||||
overloadF(1);
|
||||
}
|
||||
|
||||
varying vec4 gl_TexCoord[35]; // ERROR, size too big
|
||||
|
||||
// tests for output conversions
|
||||
void outFun(in float, out ivec2, in int, out float);
|
||||
int outFunRet(in float, out int, const in int, out ivec4);
|
||||
ivec2 outFunRet(in float, out ivec4, in int, out ivec4);
|
||||
|
||||
void foo2()
|
||||
{
|
||||
vec2 v2;
|
||||
vec4 v4;
|
||||
float f;
|
||||
int i;
|
||||
|
||||
outFun(i, v2, i, f);
|
||||
outFunRet(i, f, i, v4);
|
||||
float ret = outFunRet(i, f, i, v4);
|
||||
vec2 ret2 = outFunRet(i, v4, i, v4);
|
||||
bool b = any(lessThan(v4, attv4)); // tests aggregate arg to unary built-in
|
||||
}
|
||||
|
||||
void noise()
|
||||
{
|
||||
float f1 = noise1(1.0);
|
||||
vec2 f2 = noise2(vec2(1.0));
|
||||
vec3 f3 = noise3(vec3(1.0));
|
||||
vec4 f4 = noise4(vec4(1.0));
|
||||
}
|
||||
|
||||
// version 130 features
|
||||
|
||||
uniform int c;
|
||||
|
||||
attribute ivec2 x;
|
||||
attribute vec2 v2a;
|
||||
attribute float c1D;
|
||||
attribute vec2 c2D;
|
||||
attribute vec3 c3D;
|
||||
|
||||
uniform vec4 v4;
|
||||
|
||||
void foo213()
|
||||
{
|
||||
float f = 3;
|
||||
switch (c) { // ERRORs...
|
||||
case 1:
|
||||
f = sin(f);
|
||||
break;
|
||||
case 2:
|
||||
f = f * f;
|
||||
default:
|
||||
f = 3.0;
|
||||
}
|
||||
|
||||
int i;
|
||||
i << 3 | 0x8A >> 1 & 0xFF; // ERRORs...
|
||||
|
||||
vec3 modfOut, modfIn;
|
||||
vec3 v11 = modf(modfIn, modfOut); // ERRORS...
|
||||
float t = trunc(f);
|
||||
vec2 v12 = round(v2a);
|
||||
vec2 v13 = roundEven(v2a);
|
||||
bvec2 b10 = isnan(v2a);
|
||||
bvec4 b11 = isinf(v4);
|
||||
|
||||
sinh(c1D) + // ERRORS...
|
||||
cosh(c1D) * tanh(c2D);
|
||||
asinh(c4D) + acosh(c4D);
|
||||
atanh(c3D);
|
||||
|
||||
int id = gl_VertexID; // ERROR
|
||||
gl_ClipDistance[1] = 0.3; // ERROR
|
||||
}
|
||||
|
||||
int gl_ModelViewMatrix[] = 0;
|
||||
|
||||
// token pasting (ERRORS...)
|
||||
|
||||
#define mac abc##def
|
||||
int mac;
|
||||
|
||||
#define macr(A,B) A ## B
|
||||
int macr(qrs,tuv);
|
||||
169
third_party/glslang/Test/130.frag
vendored
169
third_party/glslang/Test/130.frag
vendored
@@ -1,169 +0,0 @@
|
||||
#version 130
|
||||
|
||||
lowp vec3 a;
|
||||
mediump float b;
|
||||
highp int c;
|
||||
|
||||
precision highp float;
|
||||
|
||||
in vec4 i;
|
||||
out vec4 o;
|
||||
|
||||
flat in float fflat;
|
||||
smooth in float fsmooth;
|
||||
noperspective in float fnop;
|
||||
|
||||
void main()
|
||||
{
|
||||
float clip = gl_ClipDistance[3];
|
||||
}
|
||||
|
||||
uniform samplerCube sampC;
|
||||
|
||||
void foo()
|
||||
{
|
||||
vec4 s = textureGather(sampC, vec3(0.2));
|
||||
}
|
||||
|
||||
#extension GL_ARB_texture_gather : enable
|
||||
|
||||
void bar()
|
||||
{
|
||||
vec4 s = textureGather(sampC, vec3(0.2));
|
||||
}
|
||||
|
||||
flat in vec3 gl_Color; // ERROR, type
|
||||
in vec4 gl_Color;
|
||||
flat in vec4 gl_Color;
|
||||
flat in vec4 gl_Color[2]; // ERROR, array
|
||||
vec4 gl_Color; // ERROR, storage
|
||||
|
||||
#extension GL_ARB_texture_gather : warn
|
||||
|
||||
void bar2()
|
||||
{
|
||||
vec4 s = textureGather(sampC, vec3(0.2));
|
||||
|
||||
uvec3 uv3;
|
||||
bvec3 b3;
|
||||
b3 = lessThan(uv3, uv3);
|
||||
b3 = equal(uv3, uv3);
|
||||
const bvec2 bl1 = greaterThanEqual(uvec2(2, 3), uvec2(3,3));
|
||||
const bvec2 bl2 = equal(uvec2(2, 3), uvec2(3,3));
|
||||
const bvec2 bl3 = equal(bl1, bl2); // yes, equal
|
||||
int a1[int(bl3.x)];
|
||||
int a2[int(bl3.y)];
|
||||
a1[0]; // size 1
|
||||
a2[0]; // size 1
|
||||
const bvec4 bl4 = notEqual(greaterThan(uvec4(1,2,3,4), uvec4(0,2,0,6)), lessThanEqual(uvec4(7,8,9,10), uvec4(6, 8, 0, 11))); // compare (t,f,t,f) with (f,t,f,t)
|
||||
int a3[int(bl4.x)+int(bl4.y)+int(bl4.z)+int(bl4.w)];
|
||||
a3[3]; // size 4
|
||||
b3 != b3;
|
||||
b3 < b3; // ERROR
|
||||
uv3 > uv3; // ERROR
|
||||
uvec2(2, 3) >= uvec2(3,3); // ERROR
|
||||
int(bl4) <= int(bl4); // true
|
||||
int(bl4.x) > int(bl4.y); // false
|
||||
}
|
||||
|
||||
#extension GL_ARB_texture_gather : enable
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
uniform sampler2D samp2D;
|
||||
uniform sampler2DShadow samp2DS;
|
||||
uniform sampler2DRect samp2DR;
|
||||
uniform sampler2DArray samp2DA;
|
||||
|
||||
void bar23()
|
||||
{
|
||||
vec4 s;
|
||||
s = textureGatherOffset(sampC, vec3(0.3), ivec2(1)); // ERROR
|
||||
s = textureGatherOffset(samp2DR, vec2(0.3), ivec2(1)); // ERROR
|
||||
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1));
|
||||
s = textureGatherOffset(samp2DA, vec3(0.3), ivec2(1));
|
||||
s = textureGatherOffset(samp2DS, vec2(0.3), 1.3, ivec2(1)); // ERROR
|
||||
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1), 2); // ERROR
|
||||
}
|
||||
|
||||
#extension GL_ARB_gpu_shader5 : enable
|
||||
|
||||
void bar234()
|
||||
{
|
||||
vec4 s;
|
||||
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1));
|
||||
s = textureGatherOffset(samp2DA, vec3(0.3), ivec2(1));
|
||||
s = textureGatherOffset(samp2DR, vec2(0.3), ivec2(1));
|
||||
s = textureGatherOffset(samp2DS, vec2(0.3), 1.3, ivec2(1));
|
||||
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1), 2);
|
||||
}
|
||||
|
||||
#extension GL_ARB_texture_cube_map_array : enable
|
||||
|
||||
uniform samplerCubeArray Sca;
|
||||
uniform isamplerCubeArray Isca;
|
||||
uniform usamplerCubeArray Usca;
|
||||
uniform samplerCubeArrayShadow Scas;
|
||||
|
||||
void bar235()
|
||||
{
|
||||
ivec3 a = textureSize(Sca, 3);
|
||||
vec4 b = texture(Sca, i);
|
||||
ivec4 c = texture(Isca, i, 0.7);
|
||||
uvec4 d = texture(Usca, i);
|
||||
|
||||
b = textureLod(Sca, i, 1.7);
|
||||
a = textureSize(Scas, a.x);
|
||||
float f = texture(Scas, i, b.y);
|
||||
c = textureGrad(Isca, i, vec3(0.1), vec3(0.2));
|
||||
}
|
||||
|
||||
int \
|
||||
x; // ERROR until 420pack is turned on
|
||||
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
const int ai[3] = { 10, 23, 32 };
|
||||
layout(binding=0) uniform blockname { int a; } instanceName; // ERROR
|
||||
uniform layout(binding=0) sampler2D bounds;
|
||||
|
||||
void bar23444()
|
||||
{
|
||||
mat4x3 m43; \
|
||||
float a1 = m43[3].y;
|
||||
vec3 v3;
|
||||
int a2 = m43.length();
|
||||
a2 += m43[1].length();
|
||||
a2 += v3.length();
|
||||
const float b = 2 * a1;
|
||||
a.x = gl_MinProgramTexelOffset + gl_MaxProgramTexelOffset;
|
||||
bool boolb;
|
||||
boolb.length(); // ERROR
|
||||
m43[3][1].length(); // ERROR
|
||||
v3.length; // ERROR
|
||||
v3.length(b); // ERROR
|
||||
}
|
||||
|
||||
in float gl_FogFragCoord;
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in float gl_FogFragCoord;
|
||||
in int gl_FogFragCoord; // ERROR
|
||||
|
||||
layout(early_fragment_tests) in; // ERROR
|
||||
layout(r32i) uniform iimage2D iimg2Dbad; // ERROR
|
||||
|
||||
#extension GL_ARB_shader_image_load_store : enable
|
||||
|
||||
layout(early_fragment_tests) in;
|
||||
|
||||
layout(r32i) uniform iimage2D iimg2D;
|
||||
|
||||
void qux2()
|
||||
{
|
||||
int i;
|
||||
imageAtomicCompSwap(iimg2D, ivec2(i,i), i, i);
|
||||
ivec4 pos = imageLoad(iimg2D, ivec2(i,i));
|
||||
}
|
||||
|
||||
layout(early_fragment_tests) out; // ERROR
|
||||
78
third_party/glslang/Test/130.vert
vendored
78
third_party/glslang/Test/130.vert
vendored
@@ -1,78 +0,0 @@
|
||||
#version 130
|
||||
|
||||
uniform int c;
|
||||
uniform usampler2D us2D;
|
||||
|
||||
in ivec2 x;
|
||||
in vec2 v2a;
|
||||
in float c1D;
|
||||
in vec2 c2D;
|
||||
in vec3 c3D;
|
||||
smooth vec4 c4D; // ??
|
||||
|
||||
uniform vec4 v4;
|
||||
|
||||
void main()
|
||||
{
|
||||
float f = 3;
|
||||
switch (c) { // full switch testing in switch.frag
|
||||
case 1:
|
||||
f = sin(f);
|
||||
break;
|
||||
case 2:
|
||||
f = f * f;
|
||||
default:
|
||||
f = 3.0;
|
||||
}
|
||||
|
||||
uint i;
|
||||
i = texture(us2D, x).w; // full uint testing in uint.frag
|
||||
i << 3u | 0x8Au >> 1u & 0xFFu;
|
||||
|
||||
vec3 modfOut, modfIn;
|
||||
vec3 v11 = modf(modfIn, modfOut);
|
||||
float t = trunc(f);
|
||||
vec2 v12 = round(v2a);
|
||||
vec2 v13 = roundEven(v2a);
|
||||
bvec2 b10 = isnan(v2a);
|
||||
bvec4 b11 = isinf(v4);
|
||||
|
||||
sinh(c1D) +
|
||||
cosh(c1D) * tanh(c2D);
|
||||
asinh(c4D) + acosh(c4D);
|
||||
atanh(c3D);
|
||||
|
||||
int id = gl_VertexID;
|
||||
gl_ClipDistance[1] = 0.3;
|
||||
}
|
||||
|
||||
// version 140 features
|
||||
|
||||
//uniform isamplerBuffer sbuf;
|
||||
|
||||
//layout(std140) uniform blockName {
|
||||
// int anonMem;
|
||||
//};
|
||||
|
||||
void foo88()
|
||||
{
|
||||
int id = gl_InstanceID; // ERROR
|
||||
//id += anonMem;
|
||||
id += texelFetch(id, 8);
|
||||
|
||||
gl_ClipVertex; // these are all present...
|
||||
gl_Color;
|
||||
gl_LightSource[0];
|
||||
gl_DepthRange.far;
|
||||
gl_TexCoord;
|
||||
gl_FogFragCoord;
|
||||
gl_FrontColor;
|
||||
}
|
||||
|
||||
// token pasting
|
||||
|
||||
#define mac abc##def
|
||||
int mac;
|
||||
|
||||
#define macr(A,B) A##B
|
||||
int macr(qrs,tuv);
|
||||
53
third_party/glslang/Test/140.frag
vendored
53
third_party/glslang/Test/140.frag
vendored
@@ -1,53 +0,0 @@
|
||||
#version 140
|
||||
|
||||
varying vec4 v;
|
||||
|
||||
in vec4 i;
|
||||
out vec4 o;
|
||||
|
||||
in float gl_ClipDistance[5];
|
||||
|
||||
void main()
|
||||
{
|
||||
float clip = gl_ClipDistance[2];
|
||||
}
|
||||
#ifdef GL_ES
|
||||
#error GL_ES is set
|
||||
#else
|
||||
#error GL_ES is not set
|
||||
#endif
|
||||
|
||||
in struct S { float f; } s; // ERROR
|
||||
|
||||
float patch = 3.1;
|
||||
|
||||
layout(location=3) in vec4 vl; // ERROR
|
||||
|
||||
layout(location = 3) out vec4 factorBad; // ERROR
|
||||
|
||||
#extension GL_ARB_explicit_attrib_location : enable
|
||||
|
||||
layout(location = 5) out vec4 factor;
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
layout(location=4) in vec4 vl2;
|
||||
|
||||
float fooi();
|
||||
|
||||
void foo()
|
||||
{
|
||||
vec2 r1 = modf(v.xy, v.zw); // ERROR, v.zw not l-value
|
||||
vec2 r2 = modf(o.xy, o.zw);
|
||||
o.z = fooi();
|
||||
}
|
||||
|
||||
// Test extra-function initializers
|
||||
|
||||
float i1 = gl_FrontFacing ? -2.0 : 2.0;
|
||||
float i2 = 102;
|
||||
|
||||
float fooi()
|
||||
{
|
||||
return i1 + i2;
|
||||
}
|
||||
79
third_party/glslang/Test/140.vert
vendored
79
third_party/glslang/Test/140.vert
vendored
@@ -1,79 +0,0 @@
|
||||
#version 140
|
||||
|
||||
uniform isamplerBuffer sbuf;
|
||||
|
||||
layout(std140) uniform blockName {
|
||||
int anonMem;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
int id = gl_InstanceID;
|
||||
id += anonMem;
|
||||
id += texelFetch(sbuf, 8).w;
|
||||
gl_ClipVertex; // could be ERROR, but compiling under compatibility profile
|
||||
gl_Color; // could be ERROR, but compiling under compatibility profile
|
||||
gl_LightSource[0]; // could be ERROR, but compiling under compatibility profile
|
||||
gl_DepthRange.far;
|
||||
gl_TexCoord; // could be ERROR, but compiling under compatibility profile
|
||||
gl_FogFragCoord; // could be ERROR, but compiling under compatibility profile
|
||||
gl_FrontColor; // could be ERROR, but compiling under compatibility profile
|
||||
}
|
||||
|
||||
out vec4 gl_Position; // ERROR
|
||||
|
||||
layout(location = 9) in vec4 locBad; // ERROR
|
||||
|
||||
#extension GL_ARB_explicit_attrib_location : enable
|
||||
|
||||
layout(location = 9) in vec4 loc;
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
out vec4 gl_Position;
|
||||
in vec4 gl_Position; // ERROR
|
||||
out vec3 gl_Position; // ERROR
|
||||
|
||||
out float gl_PointSize;
|
||||
out vec4 gl_ClipVertex;
|
||||
out float gl_FogFragCoord;
|
||||
|
||||
uniform sampler2DRect s2dr;
|
||||
uniform sampler2DRectShadow s2drs;
|
||||
in ivec2 itloc2;
|
||||
in vec2 tloc2;
|
||||
in vec3 tloc3;
|
||||
in vec4 tloc4;
|
||||
|
||||
void foo()
|
||||
{
|
||||
vec4 v = texelFetch(s2dr, itloc2);
|
||||
v += texelFetch(s2dr, itloc2, 0.2); // ERROR, no lod
|
||||
v += texture(s2dr, tloc2);
|
||||
v += texture(s2dr, tloc2, 0.3); // ERROR, no bias
|
||||
v += texture(s2drs, tloc3);
|
||||
v += textureProj(s2dr, tloc3);
|
||||
v += textureProj(s2dr, tloc4);
|
||||
v += textureProjGradOffset(s2dr, tloc4, ivec2(0.0), ivec2(0.0), ivec2(1,2));
|
||||
v += textureProjGradOffset(s2drs, tloc4, ivec2(0.0), ivec2(0.0), ivec2(1,2));
|
||||
}
|
||||
|
||||
void devi()
|
||||
{
|
||||
gl_DeviceIndex; // ERROR, no extension
|
||||
gl_ViewIndex; // ERROR, no extension
|
||||
}
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_device_group : enable
|
||||
#endif
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_multiview : enable
|
||||
#endif
|
||||
|
||||
void devie()
|
||||
{
|
||||
gl_DeviceIndex;
|
||||
gl_ViewIndex;
|
||||
}
|
||||
50
third_party/glslang/Test/150.frag
vendored
50
third_party/glslang/Test/150.frag
vendored
@@ -1,50 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec4 gl_FragCoord;
|
||||
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR
|
||||
layout(pixel_center_integer) in vec4 gl_FragCoord; // ERROR
|
||||
layout(origin_upper_left) in vec4 foo; // ERROR
|
||||
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 c = gl_FragCoord;
|
||||
}
|
||||
|
||||
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, declared after use
|
||||
|
||||
in struct S { float f; } s;
|
||||
|
||||
float patch = 3.1;
|
||||
|
||||
uniform sampler2DMS sms;
|
||||
uniform isampler2DMS isms;
|
||||
uniform usampler2DMS usms;
|
||||
uniform sampler2DMSArray smsa;
|
||||
uniform isampler2DMSArray ismsa;
|
||||
uniform usampler2DMSArray usmsa;
|
||||
|
||||
flat in ivec2 p2;
|
||||
flat in ivec3 p3;
|
||||
flat in int samp;
|
||||
|
||||
void barWxyz()
|
||||
{
|
||||
ivec2 t11 = textureSize( sms);
|
||||
ivec2 t12 = textureSize(isms);
|
||||
ivec2 t13 = textureSize(usms);
|
||||
ivec3 t21 = textureSize( smsa);
|
||||
ivec3 t22 = textureSize(ismsa);
|
||||
ivec3 t23 = textureSize(usmsa);
|
||||
vec4 t31 = texelFetch( sms, p2, samp);
|
||||
ivec4 t32 = texelFetch(isms, p2, samp);
|
||||
uvec4 t33 = texelFetch(usms, p2, 3);
|
||||
vec4 t41 = texelFetch( smsa, p3, samp);
|
||||
ivec4 t42 = texelFetch(ismsa, ivec3(2), samp);
|
||||
uvec4 t43 = texelFetch(usmsa, p3, samp);
|
||||
}
|
||||
|
||||
int primitiveID()
|
||||
{
|
||||
return gl_PrimitiveID;
|
||||
}
|
||||
139
third_party/glslang/Test/150.geom
vendored
139
third_party/glslang/Test/150.geom
vendored
@@ -1,139 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in fromVertex {
|
||||
in vec3 color;
|
||||
} fromV[];
|
||||
|
||||
out toFragment {
|
||||
out vec3 color;
|
||||
} toF;
|
||||
|
||||
out fromVertex { // okay to reuse a block name for another block name
|
||||
vec3 color;
|
||||
};
|
||||
|
||||
out fooB {
|
||||
vec2 color;
|
||||
} fromVertex; // ERROR, cannot reuse block name as block instance
|
||||
|
||||
int fromVertex; // ERROR, cannot reuse a block name for something else
|
||||
|
||||
out fooC {
|
||||
vec2 color;
|
||||
} fooC; // ERROR, cannot have same name for block and instance name
|
||||
|
||||
void main()
|
||||
{
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
EmitStreamVertex(1); // ERROR
|
||||
EndStreamPrimitive(0); // ERROR
|
||||
|
||||
color = fromV[0].color;
|
||||
gl_ClipDistance[3] = gl_in[1].gl_ClipDistance[2];
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
gl_PointSize = gl_in[3].gl_PointSize;
|
||||
gl_PrimitiveID = gl_PrimitiveIDIn;
|
||||
gl_Layer = 2;
|
||||
}
|
||||
|
||||
out vec4 ov0; // stream should be 0
|
||||
layout(stream = 4) out vec4 ov4;
|
||||
out vec4 o1v0; // stream should be 0
|
||||
|
||||
layout(stream = 3) uniform; // ERROR
|
||||
layout(stream = 3) in; // ERROR
|
||||
layout(stream = 3) uniform int ua; // ERROR
|
||||
layout(stream = 3) uniform ubb { int ua; } ibb; // ERROR
|
||||
|
||||
layout(line_strip, points, triangle_strip, stream = 3, points, triangle_strip) out; // just means "stream = 3, triangle_strip"
|
||||
layout(stream = 3, triangle_strip) out;
|
||||
out vec4 ov3; // stream should be 3
|
||||
|
||||
layout(stream = 6) out ooutb { vec4 a; } ouuaa6;
|
||||
|
||||
layout(stream = 6) out ooutb2 {
|
||||
layout(stream = 6) vec4 a;
|
||||
} ouua6;
|
||||
|
||||
layout(stream = 7) out ooutb3 {
|
||||
layout(stream = 6) vec4 a; // ERROR
|
||||
} ouua7;
|
||||
|
||||
out vec4 ov2s3; // stream should be 3
|
||||
|
||||
layout(max_vertices = 200) out;
|
||||
layout(max_vertices = 300) out; // ERROR, too big
|
||||
void foo(layout(max_vertices = 4) int a) // ERROR
|
||||
{
|
||||
ouuaa6.a = vec4(1.0);
|
||||
}
|
||||
|
||||
layout(line_strip, points, triangle_strip, stream = 3, points) out; // ERROR, changing output primitive
|
||||
layout(line_strip, points, stream = 3) out; // ERROR, changing output primitive
|
||||
layout(triangle_strip) in; // ERROR, not an input primitive
|
||||
layout(triangle_strip) uniform; // ERROR
|
||||
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
|
||||
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
|
||||
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
|
||||
out outbn2 {
|
||||
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
|
||||
layout(max_vertices = 3) int b; // ERROR, not on a block member
|
||||
layout(triangle_strip) int c; // ERROR, not on a block member
|
||||
} outbi;
|
||||
|
||||
layout(lines) out; // ERROR, not on output
|
||||
layout(lines_adjacency) in;
|
||||
layout(triangles) in; // ERROR, can't change it
|
||||
layout(triangles_adjacency) in; // ERROR, can't change it
|
||||
layout(invocations = 4) in; // ERROR, not until 4.0
|
||||
|
||||
in inbn {
|
||||
layout(stream = 2) int a; // ERROR, stream on input
|
||||
} inbi[];
|
||||
|
||||
in sameName {
|
||||
int a15;
|
||||
} insn[];
|
||||
|
||||
out sameName {
|
||||
float f15;
|
||||
};
|
||||
|
||||
uniform sameName {
|
||||
bool b15;
|
||||
};
|
||||
|
||||
float summ = gl_MaxVertexAttribs +
|
||||
gl_MaxVertexUniformComponents +
|
||||
gl_MaxVaryingFloats +
|
||||
gl_MaxVaryingComponents +
|
||||
gl_MaxVertexOutputComponents +
|
||||
gl_MaxGeometryInputComponents +
|
||||
gl_MaxGeometryOutputComponents +
|
||||
gl_MaxFragmentInputComponents +
|
||||
gl_MaxVertexTextureImageUnits +
|
||||
gl_MaxCombinedTextureImageUnits +
|
||||
gl_MaxTextureImageUnits +
|
||||
gl_MaxFragmentUniformComponents +
|
||||
gl_MaxDrawBuffers +
|
||||
gl_MaxClipDistances +
|
||||
gl_MaxGeometryTextureImageUnits +
|
||||
gl_MaxGeometryOutputVertices +
|
||||
gl_MaxGeometryTotalOutputComponents +
|
||||
gl_MaxGeometryUniformComponents +
|
||||
gl_MaxGeometryVaryingComponents;
|
||||
|
||||
void fooe1()
|
||||
{
|
||||
gl_ViewportIndex = gl_MaxViewports - 1;
|
||||
}
|
||||
|
||||
#extension GL_ARB_viewport_array : enable
|
||||
|
||||
void fooe2()
|
||||
{
|
||||
gl_ViewportIndex = gl_MaxViewports - 1;
|
||||
}
|
||||
|
||||
out int gl_ViewportIndex;
|
||||
34
third_party/glslang/Test/150.tesc
vendored
34
third_party/glslang/Test/150.tesc
vendored
@@ -1,34 +0,0 @@
|
||||
#version 150
|
||||
|
||||
#extension GL_ARB_tessellation_shader : enable
|
||||
|
||||
layout(vertices = 4) out;
|
||||
int outa[gl_out.length()];
|
||||
|
||||
patch out vec4 patchOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier();
|
||||
|
||||
int a = gl_MaxTessControlInputComponents +
|
||||
gl_MaxTessControlOutputComponents +
|
||||
gl_MaxTessControlTextureImageUnits +
|
||||
gl_MaxTessControlUniformComponents +
|
||||
gl_MaxTessControlTotalOutputComponents;
|
||||
|
||||
vec4 p = gl_in[1].gl_Position;
|
||||
float ps = gl_in[1].gl_PointSize;
|
||||
float cd = gl_in[1].gl_ClipDistance[2];
|
||||
|
||||
int pvi = gl_PatchVerticesIn;
|
||||
int pid = gl_PrimitiveID;
|
||||
int iid = gl_InvocationID;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = p;
|
||||
gl_out[gl_InvocationID].gl_PointSize = ps;
|
||||
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd;
|
||||
|
||||
gl_TessLevelOuter[3] = 3.2;
|
||||
gl_TessLevelInner[1] = 1.3;
|
||||
}
|
||||
35
third_party/glslang/Test/150.tese
vendored
35
third_party/glslang/Test/150.tese
vendored
@@ -1,35 +0,0 @@
|
||||
#version 150
|
||||
|
||||
#extension GL_ARB_tessellation_shader : enable
|
||||
|
||||
layout(quads, cw) in;
|
||||
layout(fractional_odd_spacing) in;
|
||||
layout(point_mode) in;
|
||||
patch in vec4 patchIn;
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier(); // ERROR
|
||||
|
||||
int a = gl_MaxTessEvaluationInputComponents +
|
||||
gl_MaxTessEvaluationOutputComponents +
|
||||
gl_MaxTessEvaluationTextureImageUnits +
|
||||
gl_MaxTessEvaluationUniformComponents +
|
||||
gl_MaxTessPatchComponents +
|
||||
gl_MaxPatchVertices +
|
||||
gl_MaxTessGenLevel;
|
||||
|
||||
vec4 p = gl_in[1].gl_Position;
|
||||
float ps = gl_in[1].gl_PointSize;
|
||||
float cd = gl_in[1].gl_ClipDistance[2];
|
||||
|
||||
int pvi = gl_PatchVerticesIn;
|
||||
int pid = gl_PrimitiveID;
|
||||
vec3 tc = gl_TessCoord;
|
||||
float tlo = gl_TessLevelOuter[3];
|
||||
float tli = gl_TessLevelInner[1];
|
||||
|
||||
gl_Position = p;
|
||||
gl_PointSize = ps;
|
||||
gl_ClipDistance[2] = cd;
|
||||
}
|
||||
29
third_party/glslang/Test/150.vert
vendored
29
third_party/glslang/Test/150.vert
vendored
@@ -1,29 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
#ifndef GL_core_profile
|
||||
# error standard macro GL_core_profile not defined
|
||||
#endif
|
||||
|
||||
in vec4 iv4;
|
||||
|
||||
uniform float ps;
|
||||
|
||||
invariant gl_Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = iv4;
|
||||
gl_PointSize = ps;
|
||||
gl_ClipDistance[2] = iv4.x;
|
||||
gl_ClipVertex = iv4;
|
||||
}
|
||||
|
||||
out float gl_ClipDistance[4];
|
||||
|
||||
uniform foob {
|
||||
int a[];
|
||||
};
|
||||
int a[5]; // ERROR, resizing user-block member
|
||||
|
||||
#line 3000
|
||||
#error line of this error should be 3001
|
||||
161
third_party/glslang/Test/300.frag
vendored
161
third_party/glslang/Test/300.frag
vendored
@@ -1,161 +0,0 @@
|
||||
#version 300 es
|
||||
void nodef1(float f); // ERROR, no default precision
|
||||
uniform sampler2D s2D;
|
||||
uniform lowp sampler3D s3D;
|
||||
uniform samplerCube sCube;
|
||||
uniform lowp samplerCubeShadow sCubeShadow;
|
||||
uniform lowp sampler2DShadow s2DShadow;
|
||||
uniform lowp sampler2DArray s2DArray;
|
||||
uniform lowp sampler2DArrayShadow s2DArrayShadow;
|
||||
|
||||
uniform lowp isampler2D is2D;
|
||||
uniform lowp isampler3D is3D;
|
||||
uniform lowp isamplerCube isCube;
|
||||
uniform lowp isampler2DArray is2DArray;
|
||||
|
||||
uniform lowp usampler2D us2D;
|
||||
uniform lowp usampler3D us3D;
|
||||
uniform lowp usamplerCube usCube;
|
||||
uniform lowp usampler2DArray us2DArray;
|
||||
precision lowp float;
|
||||
in float c1D;
|
||||
in vec2 c2D;
|
||||
in vec3 c3D;
|
||||
smooth vec4 c4D;
|
||||
|
||||
flat in int ic1D;
|
||||
flat in ivec2 ic2D;
|
||||
flat in ivec3 ic3D;
|
||||
flat in ivec4 ic4D;
|
||||
noperspective in vec4 badv; // ERROR
|
||||
in sampler2D bads; // ERROR
|
||||
precision lowp uint; // ERROR
|
||||
|
||||
struct s {
|
||||
int i;
|
||||
sampler2D s;
|
||||
};
|
||||
|
||||
in s badout; // ERROR, can't contain a sampler
|
||||
// ERROR, can't have int in struct without flat
|
||||
struct S2 {
|
||||
vec3 c;
|
||||
float f;
|
||||
};
|
||||
|
||||
in S2 s2;
|
||||
|
||||
out vec3 sc;
|
||||
out float sf;
|
||||
|
||||
uniform sampler2D arrayedSampler[5];
|
||||
|
||||
void main()
|
||||
{
|
||||
float f;
|
||||
vec4 v;
|
||||
v = texture(s2D, c2D);
|
||||
v = textureProj(s3D, c4D);
|
||||
v = textureLod(s2DArray, c3D, 1.2);
|
||||
f = textureOffset(s2DShadow, c3D, ic2D, c1D); // ERROR, offset argument not constant
|
||||
v = texelFetch(s3D, ic3D, ic1D);
|
||||
v = texelFetchOffset(arrayedSampler[2], ic2D, 4, ic2D); // ERROR, offset argument not constant
|
||||
f = textureLodOffset(s2DShadow, c3D, c1D, ic2D);
|
||||
v = textureProjLodOffset(s2D, c3D, c1D, ic2D);
|
||||
v = textureGrad(sCube, c3D, c3D, c3D);
|
||||
f = textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D);
|
||||
v = textureProjGrad(s3D, c4D, c3D, c3D);
|
||||
v = textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D);
|
||||
v = texture(arrayedSampler[ic1D], c2D); // ERROR
|
||||
|
||||
ivec4 iv;
|
||||
iv = texture(is2D, c2D);
|
||||
iv = textureProjOffset(is2D, c4D, ic2D);
|
||||
iv = textureProjLod(is2D, c3D, c1D);
|
||||
iv = textureProjGrad(is2D, c3D, c2D, c2D);
|
||||
iv = texture(is3D, c3D, 4.2);
|
||||
iv = textureLod(isCube, c3D, c1D);
|
||||
iv = texelFetch(is2DArray, ic3D, ic1D);
|
||||
|
||||
iv.xy = textureSize(sCubeShadow, 2);
|
||||
|
||||
float precise;
|
||||
double boo; // ERROR
|
||||
dvec2 boo2; // ERROR
|
||||
dvec3 boo3; // ERROR
|
||||
dvec4 boo4; // ERROR
|
||||
|
||||
f += gl_FragCoord.y;
|
||||
gl_FragDepth = f;
|
||||
|
||||
sc = s2.c;
|
||||
sf = s2.f;
|
||||
|
||||
sinh(c1D) +
|
||||
cosh(c1D) * tanh(c2D);
|
||||
asinh(c4D) + acosh(c4D);
|
||||
atanh(c3D);
|
||||
}
|
||||
|
||||
uniform multi {
|
||||
int[2] a[3]; // ERROR
|
||||
int[2][3] b; // ERROR
|
||||
int c[2][3]; // ERROR
|
||||
} multiInst[2][3]; // ERROR
|
||||
|
||||
out vec4 colors[4];
|
||||
|
||||
void foo()
|
||||
{
|
||||
colors[2] = c4D;
|
||||
colors[ic1D] = c4D; // ERROR
|
||||
}
|
||||
|
||||
uniform s st1;
|
||||
uniform s st2;
|
||||
|
||||
void foo13(s inSt2)
|
||||
{
|
||||
if (st1 == st2); // ERROR
|
||||
if (st1 != st2); // ERROR
|
||||
st1.s == st2.s; // ERROR
|
||||
inSt2 = st1; // ERROR
|
||||
inSt2 == st1; // ERROR
|
||||
}
|
||||
|
||||
void foo23()
|
||||
{
|
||||
textureOffset(s2DShadow, c3D, ivec2(-8, 7), c1D);
|
||||
textureOffset(s2DShadow, c3D, ivec2(-9, 8), c1D);
|
||||
}
|
||||
|
||||
void foo324(void)
|
||||
{
|
||||
float p = pow(3.2, 4.6);
|
||||
p += sin(0.4);
|
||||
p += distance(vec2(10.0, 11.0), vec2(13.0, 15.0)); // 5
|
||||
p += dot(vec3(2,3,5), vec3(-2,-1,4)); // 13
|
||||
vec3 c3 = cross(vec3(3,-3,1), vec3(4,9,2)); // (-15, -2, 39)
|
||||
c3 += faceforward(vec3(1,2,3), vec3(2,3,5), vec3(-2,-1,4)); // (-1,-2,-3)
|
||||
c3 += faceforward(vec3(1,2,3), vec3(-2,-3,-5), vec3(-2,-1,4)); // (1,2,3)
|
||||
vec2 c2 = reflect(vec2(1,3), vec2(0,1)); // (1,-3)
|
||||
c2 += refract(vec2(1,3), vec2(0,1), 1.0); // (1,-3)
|
||||
c2 += refract(vec2(1,3), vec2(0,1), 3.0);
|
||||
c2 += refract(vec2(1,0.1), vec2(0,1), 5.0); // (0,0)
|
||||
mat3x2 m32 = outerProduct(vec2(2,3), vec3(5,7,11));// rows: (10, 14, 22), (15, 21, 33)
|
||||
}
|
||||
|
||||
uniform mediump; // ERROR
|
||||
|
||||
layout(early_fragment_tests) in; // ERROR
|
||||
|
||||
#ifndef GL_FRAGMENT_PRECISION_HIGH
|
||||
#error missing GL_FRAGMENT_PRECISION_HIGH
|
||||
#endif
|
||||
|
||||
invariant in; // ERROR
|
||||
invariant in vec4; // ERROR
|
||||
invariant in vec4 fooinv; // ERROR
|
||||
|
||||
float imageBuffer; // ERROR, reserved
|
||||
float uimage2DRect; // ERROR, reserved
|
||||
204
third_party/glslang/Test/300.vert
vendored
204
third_party/glslang/Test/300.vert
vendored
@@ -1,204 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
uniform mat4x3 m43;
|
||||
uniform mat3x3 m33;
|
||||
uniform mat4x4 m44;
|
||||
|
||||
in vec3 v3;
|
||||
varying vec2 v2; // ERROR, varying reserved
|
||||
in vec4 bad[10]; // ERROR, no arrayed inputs
|
||||
highp in vec4 badorder; // ERROR, incorrect qualifier order
|
||||
out invariant vec4 badorder2; // ERROR, incorrect qualifier order
|
||||
in centroid vec4 badorder4; // ERROR, incorrect qualifier order
|
||||
out flat vec4 badorder3; // ERROR, incorrect qualifier order
|
||||
void bar(in const float a); // ERROR, incorrect qualifier order
|
||||
void bar2(highp in float b); // ERROR, incorrect qualifier order
|
||||
smooth flat out vec4 rep; // ERROR, replicating interpolation qualification
|
||||
centroid sample out vec4 rep2; // ERROR, replicating auxiliary qualification
|
||||
in uniform vec4 rep3; // ERROR, replicating storage qualification
|
||||
|
||||
struct S {
|
||||
vec3 c;
|
||||
float f;
|
||||
};
|
||||
|
||||
out S s;
|
||||
|
||||
void main()
|
||||
{
|
||||
int id = gl_VertexID + gl_InstanceID;
|
||||
|
||||
int c0 = gl_MaxVertexAttribs;
|
||||
int c1 = gl_MaxVertexUniformVectors;
|
||||
int c2 = gl_MaxVertexOutputVectors;
|
||||
int c3 = gl_MaxFragmentInputVectors;
|
||||
int c4 = gl_MaxVertexTextureImageUnits;
|
||||
int c5 = gl_MaxCombinedTextureImageUnits;
|
||||
int c6 = gl_MaxTextureImageUnits;
|
||||
int c7 = gl_MaxFragmentUniformVectors;
|
||||
int c8 = gl_MaxDrawBuffers;
|
||||
int c9 = gl_MinProgramTexelOffset;
|
||||
int c10 = gl_MaxProgramTexelOffset;
|
||||
|
||||
mat3x4 tm = transpose(m43);
|
||||
highp float dm = determinant(m44);
|
||||
mat3x3 im = inverse(m33);
|
||||
|
||||
mat3x2 op = outerProduct(v2, v3);
|
||||
|
||||
gl_Position = m44[2];
|
||||
gl_PointSize = v2.y;
|
||||
|
||||
s.c = v3;
|
||||
s.f = dm;
|
||||
|
||||
#ifdef GL_ES
|
||||
#error GL_ES is set
|
||||
#else
|
||||
#error GL_ES is not set
|
||||
#endif
|
||||
}
|
||||
|
||||
float badsize[]; // ERROR
|
||||
float[] badsize2; // ERROR
|
||||
uniform ub {
|
||||
int a[]; // ERROR
|
||||
} ubInst[]; // ERROR
|
||||
void foo(int a[]); // ERROR
|
||||
float okayA[] = float[](3.0f, 4.0F); // Okay
|
||||
|
||||
out vec3 newV;
|
||||
void newVFun()
|
||||
{
|
||||
newV = v3;
|
||||
}
|
||||
|
||||
invariant newV; // ERROR, variable already used
|
||||
in vec4 invIn;
|
||||
invariant invIn; // ERROR, in v300
|
||||
out S s2;
|
||||
invariant s2;
|
||||
invariant out S s3;
|
||||
flat out int;
|
||||
|
||||
uniform ub2 {
|
||||
float f;
|
||||
} a;
|
||||
|
||||
uniform ub2 { // ERROR redeclaration of block name (same instance name)
|
||||
float g;
|
||||
} a;
|
||||
|
||||
uniform ub2 { // ERROR redeclaration of block name (different instance name)
|
||||
float f;
|
||||
} c;
|
||||
|
||||
uniform ub2 { // ERROR redeclaration of block name (no instance name)
|
||||
float f123;
|
||||
};
|
||||
|
||||
uniform ub3 {
|
||||
bool b23;
|
||||
};
|
||||
|
||||
uniform ub3 { // ERROR redeclaration of block name (no instance name in first or declared)
|
||||
bool b234;
|
||||
};
|
||||
|
||||
precision lowp sampler3D;
|
||||
precision lowp sampler2DShadow;
|
||||
precision lowp sampler2DArrayShadow;
|
||||
|
||||
uniform sampler2D s2D;
|
||||
uniform sampler3D s3D;
|
||||
uniform sampler2DShadow s2DS;
|
||||
uniform sampler2DArrayShadow s2DAS;
|
||||
in vec2 c2D;
|
||||
|
||||
void foo23()
|
||||
{
|
||||
ivec2 x1 = textureSize(s2D, 2);
|
||||
textureSize(s2D); // ERROR, no lod
|
||||
ivec3 x3 = textureSize(s2DAS, -1);
|
||||
textureSize(s2DAS); // ERROR, no lod
|
||||
vec4 x4 = texture(s2D, c2D);
|
||||
texture(s2D, c2D, 0.2); // ERROR, bias
|
||||
vec4 x5 = textureProjOffset(s3D, vec4(0.2), ivec3(1));
|
||||
textureProjOffset(s3D, vec4(0.2), ivec3(1), .03); // ERROR, bias
|
||||
float x6 = textureProjGradOffset(s2DS, invIn, vec2(4.2), vec2(5.3), ivec2(1));
|
||||
}
|
||||
|
||||
int fgfg(float f, mediump int i);
|
||||
int fgfg(float f, highp int i); // ERROR, precision qualifier difference
|
||||
|
||||
int fgfgh(float f, const in mediump int i);
|
||||
int fgfgh(float f, in mediump int i); // ERROR, precision qualifier difference
|
||||
|
||||
void foo2349()
|
||||
{
|
||||
float[] x = float[] (1.0, 2.0, 3.0);
|
||||
float[] y = x;
|
||||
float[3] z = x;
|
||||
float[3] w;
|
||||
w = y;
|
||||
}
|
||||
|
||||
int[] foo213234(); // ERROR
|
||||
int foo234234(float[]); // ERROR
|
||||
int foo234235(vec2[] v); // ERROR
|
||||
precision highp float[2]; // ERROR
|
||||
|
||||
int fffg(float f);
|
||||
int fffg(float f);
|
||||
|
||||
int gggf(float f);
|
||||
int gggf(float f) { return 2; }
|
||||
int gggf(float f);
|
||||
|
||||
int agggf(float f) { return 2; }
|
||||
int agggf(float f);
|
||||
|
||||
out struct Ssss { float f; } ssss;
|
||||
|
||||
uniform Bblock {
|
||||
int a;
|
||||
} Binst;
|
||||
int Bfoo;
|
||||
|
||||
layout(std140) Binst; // ERROR
|
||||
layout(std140) Bblock; // ERROR
|
||||
layout(std140) Bfoo; // ERROR
|
||||
|
||||
layout(std430) uniform B430 { int a; } B430i; // ERROR
|
||||
|
||||
struct SNA {
|
||||
int a[]; // ERROR
|
||||
};
|
||||
|
||||
void fooDeeparray()
|
||||
{
|
||||
float[] x = float[] (1.0, 2.0, 3.0),
|
||||
y = float[] (1.0, 2.0, 3.0, 4.0);
|
||||
float xp[3], yp[4];
|
||||
xp = x;
|
||||
yp = y;
|
||||
xp = y; // ERROR, wrong size
|
||||
yp = x; // ERROR, wrong size
|
||||
}
|
||||
|
||||
layout(num_views = 2) in; // ERROR, no extension
|
||||
|
||||
void mwErr()
|
||||
{
|
||||
gl_ViewID_OVR; // ERROR, no extension
|
||||
}
|
||||
|
||||
#extension GL_OVR_multiview : enable
|
||||
|
||||
layout(num_views = 2) uniform float mwUniform; // ERROR, must be global
|
||||
layout(num_views = 2) in; // OK
|
||||
|
||||
void mwOk()
|
||||
{
|
||||
gl_ViewID_OVR;
|
||||
}
|
||||
76
third_party/glslang/Test/300BuiltIns.frag
vendored
76
third_party/glslang/Test/300BuiltIns.frag
vendored
@@ -1,76 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
int imax, imin;
|
||||
uint umax, umin;
|
||||
|
||||
vec3 x, y; // ERROR, needs default precision
|
||||
bvec3 bv;
|
||||
|
||||
uint uy;
|
||||
uvec2 uv2c;
|
||||
uvec2 uv2y;
|
||||
uvec2 uv2x;
|
||||
uvec4 uv4y;
|
||||
|
||||
ivec3 iv3a;
|
||||
ivec3 iv3b;
|
||||
|
||||
ivec4 iv4a;
|
||||
ivec4 iv4b;
|
||||
|
||||
float f;
|
||||
|
||||
vec2 v2a, v2b;
|
||||
vec4 v4;
|
||||
|
||||
void main()
|
||||
{
|
||||
// 1.3 int
|
||||
vec3 v = mix(x, y, bv);
|
||||
ivec4 iv10 = abs(iv4a);
|
||||
ivec4 iv11 = sign(iv4a);
|
||||
ivec4 iv12 = min(iv4a, iv4b);
|
||||
ivec4 iv13 = min(iv4a, imin);
|
||||
uvec2 u = min(uv2x, uv2y);
|
||||
uvec4 uv = min(uv4y, uy);
|
||||
ivec3 iv14 = max(iv3a, iv3b);
|
||||
ivec4 iv15 = max(iv4a, imax);
|
||||
uvec2 u10 = max(uv2x, uv2y);
|
||||
uvec2 u11 = max(uv2x, uy);
|
||||
ivec4 iv16 = clamp(iv4a, iv4a, iv4b);
|
||||
ivec4 iv17 = clamp(iv4a, imin, imax);
|
||||
uvec2 u12 = clamp(uv2x, uv2y, uv2c);
|
||||
uvec4 uv10 = clamp(uv4y, umin, umax);
|
||||
|
||||
// 1.3 float
|
||||
vec3 modfOut;
|
||||
vec3 v11 = modf(x, modfOut);
|
||||
|
||||
float t = trunc(f);
|
||||
vec2 v12 = round(v2a);
|
||||
vec2 v13 = roundEven(v2a);
|
||||
bvec2 b10 = isnan(v2a);
|
||||
bvec4 b11 = isinf(v4);
|
||||
|
||||
// 3.3 float
|
||||
int i = floatBitsToInt(f);
|
||||
uvec4 uv11 = floatBitsToUint(v4);
|
||||
vec4 v14 = intBitsToFloat(iv4a);
|
||||
vec2 v15 = uintBitsToFloat(uv2c);
|
||||
|
||||
// 4.0 pack
|
||||
uint u19 = packSnorm2x16(v2a);
|
||||
vec2 v20 = unpackSnorm2x16(uy);
|
||||
uint u15 = packUnorm2x16(v2a);
|
||||
vec2 v16 = unpackUnorm2x16(uy);
|
||||
uint u17 = packHalf2x16(v2b);
|
||||
vec2 v18 = unpackHalf2x16(uy);
|
||||
|
||||
// not present
|
||||
noise2(v18); // ERROR, not present
|
||||
|
||||
float t__; // ERROR, no __ until revision 310
|
||||
|
||||
// ERROR, no __ until revision 310
|
||||
#define __D
|
||||
}
|
||||
58
third_party/glslang/Test/300block.frag
vendored
58
third_party/glslang/Test/300block.frag
vendored
@@ -1,58 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
|
||||
struct S {
|
||||
vec4 u;
|
||||
uvec4 v;
|
||||
lowp isampler3D sampler;
|
||||
vec3 w;
|
||||
struct T1 { // ERROR
|
||||
int a;
|
||||
} t;
|
||||
};
|
||||
|
||||
uniform S s;
|
||||
|
||||
uniform fooBlock {
|
||||
uvec4 bv;
|
||||
uniform mat2 bm2;
|
||||
lowp isampler2D sampler; // ERROR
|
||||
struct T2 { // ERROR
|
||||
int a;
|
||||
} t;
|
||||
S fbs; // ERROR, contains a sampler
|
||||
};
|
||||
|
||||
uniform barBlock {
|
||||
uvec4 nbv;
|
||||
int ni;
|
||||
} inst;
|
||||
|
||||
uniform barBlockArray {
|
||||
uvec4 nbv;
|
||||
int ni;
|
||||
} insts[4];
|
||||
|
||||
uniform unreferenced {
|
||||
float f;
|
||||
uint u;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
texture(s.sampler, vec3(inst.ni, bv.y, insts[2].nbv.z));
|
||||
insts[s.v.x]; // ERROR
|
||||
fooBlock; // ERROR
|
||||
mat4(s); // ERROR
|
||||
int insts;
|
||||
float barBlock;
|
||||
mat4(barBlock);
|
||||
mat4(unreferenced); // ERROR, bad type
|
||||
++s; // ERROR
|
||||
inst - 1; // ERROR
|
||||
++barBlock;
|
||||
2 * barBlockArray; // ERROR
|
||||
}
|
||||
|
||||
int fooBlock; // ERROR, redef.
|
||||
19
third_party/glslang/Test/300layout.frag
vendored
19
third_party/glslang/Test/300layout.frag
vendored
@@ -1,19 +0,0 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
in vec4 pos;
|
||||
layout (location = 2) in vec4 color; // ERROR
|
||||
|
||||
layout(location = 1) out vec4 c;
|
||||
layout(location = 3) out vec4 p;
|
||||
layout(location = 4) out vec4 q[2];
|
||||
|
||||
void main()
|
||||
{
|
||||
c = color;
|
||||
p = pos;
|
||||
q[1] = pos;
|
||||
}
|
||||
|
||||
layout(location = 40) out float ca[4]; // ERROR, overlap, ERROR too big
|
||||
layout(location = 41) out float cb[2]; // ERROR, overlap, ERROR too big
|
||||
layout(location = 39) out float cc[6]; // ERROR, overlap, ERROR too big
|
||||
57
third_party/glslang/Test/300layout.vert
vendored
57
third_party/glslang/Test/300layout.vert
vendored
@@ -1,57 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
struct s { vec4 v; };
|
||||
|
||||
layout(location = 7) in vec3 c;
|
||||
layout(LocatioN = 3) in vec4 p;
|
||||
layout(LocatioN = 9) in vec4 q[4]; // ERROR, no array
|
||||
layout(LocatioN = 10) in s r[4]; // ERROR, no struct, ERROR, location overlap
|
||||
out vec4 pos;
|
||||
out vec3 color;
|
||||
|
||||
layout(shared, column_major) uniform mat4 badm4; // ERROR
|
||||
layout(shared, column_major, row_major) uniform; // default is now shared and row_major
|
||||
|
||||
layout(std140) uniform Transform { // layout of this block is std140
|
||||
mat4 M1; // row_major
|
||||
layout(column_major) mat4 M2; // column major
|
||||
mat3 N1; // row_major
|
||||
centroid float badf; // ERROR
|
||||
in float badg; // ERROR
|
||||
layout(std140) float bad1;
|
||||
layout(shared) float bad2;
|
||||
layout(packed) float bad3;
|
||||
} tblock;
|
||||
|
||||
uniform T2 { // layout of this block is shared
|
||||
bool b;
|
||||
mat4 t2m;
|
||||
};
|
||||
|
||||
layout(column_major) uniform T3 { // shared and column_major
|
||||
mat4 M3; // column_major
|
||||
layout(row_major) mat4 M4; // row major
|
||||
mat3 N2; // column_major
|
||||
int b; // ERROR, redefinition (needs to be last member of block for testing, following members are skipped)
|
||||
};
|
||||
|
||||
out badout { // ERROR
|
||||
float f;
|
||||
};
|
||||
|
||||
layout (location = 10) out vec4 badoutA; // ERROR
|
||||
|
||||
void main()
|
||||
{
|
||||
pos = p * (tblock.M1 + tblock.M2 + M4 + M3 + t2m);
|
||||
color = c * tblock.N1;
|
||||
}
|
||||
|
||||
shared vec4 compute_only; // ERROR
|
||||
|
||||
layout(packed) uniform;
|
||||
|
||||
layout(packed) uniform float aoeuntaoeu; // ERROR, packed on variable
|
||||
|
||||
layout(location = 40) in float cd;
|
||||
layout(location = 37) in mat4x3 ce; // ERROR, overlap
|
||||
8
third_party/glslang/Test/300link.frag
vendored
8
third_party/glslang/Test/300link.frag
vendored
@@ -1,8 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
precision highp float;
|
||||
|
||||
out vec4 color1;
|
||||
out vec4 color2;
|
||||
|
||||
void main() {}
|
||||
11
third_party/glslang/Test/300link2.frag
vendored
11
third_party/glslang/Test/300link2.frag
vendored
@@ -1,11 +0,0 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
in vec4 pos;
|
||||
|
||||
layout(location = 1) out vec4 c;
|
||||
layout(location = 5) out vec4 p;
|
||||
layout(location = 9) out vec4 q[2];
|
||||
|
||||
void main()
|
||||
{
|
||||
}
|
||||
7
third_party/glslang/Test/300link3.frag
vendored
7
third_party/glslang/Test/300link3.frag
vendored
@@ -1,7 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
precision highp float;
|
||||
|
||||
out vec4 color1;
|
||||
|
||||
void main() {}
|
||||
135
third_party/glslang/Test/300operations.frag
vendored
135
third_party/glslang/Test/300operations.frag
vendored
@@ -1,135 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
uniform block {
|
||||
mediump float f;
|
||||
} instanceName;
|
||||
|
||||
struct S {
|
||||
int i;
|
||||
} s;
|
||||
|
||||
float a[5];
|
||||
|
||||
void main()
|
||||
{
|
||||
bool b;
|
||||
float f;
|
||||
int i;
|
||||
uint u;
|
||||
bvec3 b3;
|
||||
vec3 v3;
|
||||
ivec3 iv3;
|
||||
uvec3 uv3;
|
||||
vec4 v4;
|
||||
ivec4 iv4;
|
||||
uvec4 uv4;
|
||||
mat2 m2;
|
||||
mat4 m4;
|
||||
|
||||
// These are all errors:
|
||||
instanceName + instanceName;
|
||||
s + s;
|
||||
i + f;
|
||||
u + f;
|
||||
u + i;
|
||||
iv3 *= iv4;
|
||||
iv4 / uv4;
|
||||
i - v3;
|
||||
iv3 + uv3;
|
||||
a * a;
|
||||
b / b;
|
||||
|
||||
f % f;
|
||||
i % f;
|
||||
f % u;
|
||||
instanceName++;
|
||||
++s;
|
||||
a--;
|
||||
++b3;
|
||||
|
||||
iv3 < uv3;
|
||||
m2 > m2;
|
||||
m2 != m4;
|
||||
i >= u;
|
||||
a <= a;
|
||||
b > b;
|
||||
|
||||
b && b3;
|
||||
b3 ^^ b3;
|
||||
b3 || b;
|
||||
i && i;
|
||||
u || u;
|
||||
m2 ^^ m2;
|
||||
|
||||
!u;
|
||||
!i;
|
||||
!m2;
|
||||
!v3;
|
||||
!a;
|
||||
|
||||
~f;
|
||||
~m4;
|
||||
~v3;
|
||||
~a;
|
||||
~instanceName;
|
||||
|
||||
i << iv3;
|
||||
u << uv3;
|
||||
i >> f;
|
||||
f >> i;
|
||||
m4 >> i;
|
||||
a >> u;
|
||||
iv3 >> iv4;
|
||||
|
||||
i & u;
|
||||
u &= uv3;
|
||||
i | uv3;
|
||||
u & f;
|
||||
m2 | m2;
|
||||
s ^ s;
|
||||
(f = f) = f;
|
||||
|
||||
// These are all okay:
|
||||
f * v4;
|
||||
u + u;
|
||||
uv4 / u;
|
||||
iv3 -= iv3;
|
||||
|
||||
i %= 3;
|
||||
uv3 % 4u;
|
||||
--m2;
|
||||
iv4++;
|
||||
|
||||
m4 != m4;
|
||||
m2 == m2;
|
||||
i <= i;
|
||||
a == a;
|
||||
s != s;
|
||||
|
||||
b && b;
|
||||
b || b;
|
||||
b ^^ b;
|
||||
|
||||
!b, uv3;
|
||||
|
||||
~i;
|
||||
~u;
|
||||
~uv3;
|
||||
~iv3;
|
||||
|
||||
uv3 <<= i;
|
||||
i >> i;
|
||||
u << u;
|
||||
iv3 >> iv3;
|
||||
|
||||
i & i;
|
||||
u | u;
|
||||
iv3 ^ iv3;
|
||||
u & uv3;
|
||||
uv3 | u;
|
||||
uv3 &= u;
|
||||
int arr[0x222 & 0xf];
|
||||
arr[1]; // size 2
|
||||
int arr2[(uvec2(0, 0x2) | 0x1u).y];
|
||||
arr2[2]; // size 3
|
||||
}
|
||||
41
third_party/glslang/Test/300samplerExternal.frag
vendored
41
third_party/glslang/Test/300samplerExternal.frag
vendored
@@ -1,41 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
#extension GL_OES_EGL_image_external_essl3 : enable
|
||||
|
||||
uniform samplerExternalOES sExt;
|
||||
precision mediump samplerExternalOES;
|
||||
uniform samplerExternalOES mediumExt;
|
||||
uniform highp samplerExternalOES highExt;
|
||||
|
||||
void main()
|
||||
{
|
||||
texture2D(sExt, vec2(0.2)); // ERROR
|
||||
texture2D(mediumExt, vec2(0.2)); // ERROR
|
||||
texture2D(highExt, vec2(0.2)); // ERROR
|
||||
texture2DProj(sExt, vec3(0.3)); // ERROR
|
||||
texture2DProj(sExt, vec4(0.3)); // ERROR
|
||||
|
||||
int lod = 0;
|
||||
highp float bias = 0.01;
|
||||
textureSize(sExt, lod);
|
||||
texture(sExt, vec2(0.2));
|
||||
texture(sExt, vec2(0.2), bias);
|
||||
textureProj(sExt, vec3(0.2));
|
||||
textureProj(sExt, vec3(0.2), bias);
|
||||
textureProj(sExt, vec4(0.2));
|
||||
textureProj(sExt, vec4(0.2), bias);
|
||||
texelFetch(sExt, ivec2(4), lod);
|
||||
|
||||
texture3D(sExt, vec3(0.3)); // ERROR
|
||||
texture2DProjLod(sExt, vec3(0.3), 0.3); // ERROR
|
||||
texture(sExt, vec3(0.3)); // ERROR
|
||||
textureProjLod(sExt, vec3(0.3), 0.3); // ERROR
|
||||
}
|
||||
|
||||
#extension GL_OES_EGL_image_external_essl3 : disable
|
||||
|
||||
#extension GL_OES_EGL_image_external : enable
|
||||
uniform samplerExternalOES badExt; // ERROR
|
||||
#extension GL_OES_EGL_image_external : disable
|
||||
|
||||
uniform samplerExternalOES badExt; // ERROR
|
||||
74
third_party/glslang/Test/300scope.vert
vendored
74
third_party/glslang/Test/300scope.vert
vendored
@@ -1,74 +0,0 @@
|
||||
#version 300 es
|
||||
|
||||
int f(int a, int b, int c)
|
||||
{
|
||||
int a = b; // ERROR, redefinition
|
||||
|
||||
{
|
||||
float a = float(a) + 1.0;
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
int f(int a, int b, int c); // okay to redeclare
|
||||
|
||||
bool b;
|
||||
float b(int a); // ERROR: redefinition
|
||||
|
||||
float c(int a);
|
||||
bool c; // ERROR: redefinition
|
||||
|
||||
float f; // ERROR: redefinition
|
||||
float tan; // ERROR: redefines built-in function
|
||||
float sin(float x); // ERROR: can't redefine built-in functions
|
||||
float cos(float x) // ERROR: can't redefine built-in functions
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
bool radians(bool x) // ERROR: can't overload built-in functions
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
invariant gl_Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
int g(); // ERROR: no local function declarations
|
||||
g();
|
||||
|
||||
float sin; // okay
|
||||
sin;
|
||||
sin(0.7); // ERROR, use of hidden function
|
||||
f(1,2,3);
|
||||
|
||||
float f; // hides f()
|
||||
f = 3.0;
|
||||
|
||||
gl_Position = vec4(f);
|
||||
|
||||
for (int f = 0; f < 10; ++f)
|
||||
++f;
|
||||
|
||||
int x = 1;
|
||||
{
|
||||
float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
|
||||
int z = z; // ERROR: z not previously defined.
|
||||
}
|
||||
{
|
||||
int x = x; // x is initialized to '1'
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
int x;
|
||||
};
|
||||
{
|
||||
S S = S(0); // 'S' is only visible as a struct and constructor
|
||||
S.x; // 'S' is now visible as a variable
|
||||
}
|
||||
|
||||
int degrees;
|
||||
degrees(3.2); // ERROR, use of hidden built-in function
|
||||
}
|
||||
256
third_party/glslang/Test/310.comp
vendored
256
third_party/glslang/Test/310.comp
vendored
@@ -1,256 +0,0 @@
|
||||
#version 310 es
|
||||
|
||||
layout(local_size_x = 2) in;
|
||||
layout(local_size_x = 16) in; // ERROR, changing
|
||||
layout(local_size_z = 4096) in; // ERROR, too large
|
||||
layout(local_size_x = 2) in;
|
||||
layout(local_size_y = 0) in; // ERROR, 0 not allowed
|
||||
const int total = gl_MaxComputeWorkGroupCount.y
|
||||
+ gl_MaxComputeUniformComponents
|
||||
+ gl_MaxComputeTextureImageUnits
|
||||
+ gl_MaxComputeImageUniforms
|
||||
+ gl_MaxComputeAtomicCounters
|
||||
+ gl_MaxComputeAtomicCounterBuffers;
|
||||
|
||||
buffer ShaderStorageBlock
|
||||
{
|
||||
int value;
|
||||
float values[];
|
||||
};
|
||||
|
||||
buffer InvalidShaderStorageBlock
|
||||
{
|
||||
float values[]; // ERROR
|
||||
int value;
|
||||
} invalid;
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier();
|
||||
memoryBarrier();
|
||||
memoryBarrierAtomicCounter();
|
||||
memoryBarrierBuffer();
|
||||
memoryBarrierShared();
|
||||
memoryBarrierImage();
|
||||
groupMemoryBarrier();
|
||||
value = int(values[gl_LocalInvocationIndex]);
|
||||
}
|
||||
|
||||
layout(location = 2) in vec3 v3; // ERROR
|
||||
in float f; // ERROR
|
||||
out float fo; // ERROR
|
||||
|
||||
shared vec4 s;
|
||||
layout(location = 2) shared vec4 sl; // ERROR
|
||||
shared float fs = 4.2; // ERROR
|
||||
|
||||
layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) out; // ERROR
|
||||
|
||||
int arrX[gl_WorkGroupSize.x];
|
||||
int arrY[gl_WorkGroupSize.y];
|
||||
int arrZ[gl_WorkGroupSize.z];
|
||||
|
||||
readonly buffer roblock
|
||||
{
|
||||
int value;
|
||||
float values[];
|
||||
} ro;
|
||||
|
||||
void foo()
|
||||
{
|
||||
ro.values[2] = 4.7; // ERROR, readonly
|
||||
ro.values.length();
|
||||
++s;
|
||||
}
|
||||
|
||||
buffer vec4 v; // ERROR
|
||||
|
||||
uniform usampler2D us2dbad; // ERROR, default precision
|
||||
|
||||
precision highp usampler2D;
|
||||
precision highp iimage2DArray;
|
||||
precision highp iimage2D;
|
||||
|
||||
uniform usampler2D us2d;
|
||||
|
||||
uniform iimage2DArray ii2dabad; // ERROR, not writeonly
|
||||
uniform writeonly iimage2DArray ii2da;
|
||||
|
||||
layout(r32i) uniform iimage2D iimg2D;
|
||||
layout(rgba32i) uniform readonly iimage2D iimg2Drgba;
|
||||
layout(rgba32f) uniform readonly image2D img2Drgba; // ERROR, no default
|
||||
layout(r32ui) uniform uimage2D uimg2D; // ERROR, no default
|
||||
|
||||
void qux()
|
||||
{
|
||||
int i = 4;
|
||||
imageAtomicCompSwap(iimg2D, ivec2(i,i), i, i);// ERROR no longer in 310
|
||||
imageAtomicAdd(uimg2D, ivec2(i,i), uint(i)); // ERROR no longer in 310
|
||||
imageAtomicMin(iimg2Drgba, ivec2(i,i), i); // ERROR no longer in 310 // ERROR iimg2Drgba does not have r32i layout
|
||||
imageAtomicMax(img2Drgba, ivec2(i,i), i); // ERROR no longer in 310 // ERROR img2Drgba is not integer image
|
||||
ivec4 pos = imageLoad(iimg2D, ivec2(i,i));
|
||||
imageStore(ii2da, ivec3(i,i,i), ivec4(0));
|
||||
imageLoad(img2Drgba, ivec2(i,i));
|
||||
imageLoad(ii2da, ivec3(i,i,i)); // ERROR, drops writeonly
|
||||
}
|
||||
|
||||
volatile float vol; // ERROR, not an image
|
||||
readonly int vol2; // ERROR, not an image
|
||||
|
||||
void passr(coherent readonly iimage2D image)
|
||||
{
|
||||
}
|
||||
|
||||
layout(r32i) coherent readonly uniform iimage2D qualim1;
|
||||
layout(r32i) coherent restrict readonly uniform iimage2D qualim2;
|
||||
|
||||
void passrc()
|
||||
{
|
||||
passr(qualim1);
|
||||
passr(qualim2); // ERROR, drops restrict
|
||||
passr(iimg2D);
|
||||
}
|
||||
|
||||
highp layout(rg8i) uniform readonly uimage2D i1bad; // ERROR, type mismatch
|
||||
highp layout(rgba32i) uniform readonly image2D i2bad; // ERROR, type mismatch
|
||||
highp layout(rgba32f) uniform readonly uimage2D i3bad; // ERROR, type mismatch
|
||||
layout(r8_snorm) uniform readonly iimage2D i4bad; // ERROR, type mismatch
|
||||
layout(rgba32ui) uniform readonly iimage2D i5bad; // ERROR, type mismatch
|
||||
layout(r8ui) uniform readonly iimage2D i6bad; // ERROR, type mismatch
|
||||
|
||||
layout(binding = 0) uniform atomic_uint counter;
|
||||
|
||||
uint func(atomic_uint c)
|
||||
{
|
||||
return atomicCounterIncrement(c);
|
||||
}
|
||||
|
||||
uint func2(out atomic_uint c) // ERROR, output
|
||||
{
|
||||
return counter; // ERROR, type mismatch
|
||||
return atomicCounter(counter);
|
||||
}
|
||||
|
||||
void mainAC()
|
||||
{
|
||||
atomic_uint non_uniform_counter; // ERROR
|
||||
uint val = atomicCounter(counter);
|
||||
atomicCounterDecrement(counter);
|
||||
}
|
||||
|
||||
layout(binding = 1) uniform mediump atomic_uint counterBad; // ERROR, not highp
|
||||
|
||||
layout(binding = 2, offset = 4) uniform atomic_uint countArr[4];
|
||||
uniform int i;
|
||||
|
||||
void opac()
|
||||
{
|
||||
int a[3];
|
||||
a[counter]; // ERROR, non-integer
|
||||
countArr[2];
|
||||
countArr[i];
|
||||
}
|
||||
|
||||
shared int atomi;
|
||||
shared uint atomu;
|
||||
|
||||
void atoms()
|
||||
{
|
||||
int origi = atomicAdd(atomi, 3);
|
||||
uint origu = atomicAnd(atomu, 7u);
|
||||
origi = atomicExchange(atomi, 4);
|
||||
origu = atomicCompSwap(atomu, 10u, 8u);
|
||||
}
|
||||
|
||||
precision highp atomic_uint;
|
||||
precision lowp atomic_uint; // ERROR
|
||||
|
||||
precise int pfoo; // ERROR, reserved
|
||||
|
||||
dmat2x4 dm; // ERROR
|
||||
uniform samplerCubeArray sca; // ERROR
|
||||
uniform iimage2DRect i2dr; // ERROR
|
||||
highp uniform image2DMS i2dms; // ERROR
|
||||
uniform uimage2DMSArray u2dmsa; // ERROR
|
||||
|
||||
highp layout(r32f) coherent volatile restrict readonly writeonly uniform image2D okay1;
|
||||
layout(r32i) coherent volatile restrict readonly uniform iimage2D okay2;
|
||||
highp layout(r32ui) coherent volatile restrict writeonly uniform uimage2D okay3;
|
||||
highp layout(r32f) coherent volatile restrict uniform image2D okay4;
|
||||
|
||||
highp layout(rgba32f) coherent volatile restrict uniform image2D badQ1; // ERROR, bad qualifiers
|
||||
layout(rgba8i) coherent volatile restrict uniform iimage2D badQ2; // ERROR, bad qualifiers
|
||||
highp layout(rgba16ui) coherent volatile restrict uniform uimage2D badQ3; // ERROR, bad qualifiers
|
||||
|
||||
writeonly buffer woblock
|
||||
{
|
||||
int value;
|
||||
float values[];
|
||||
} wo;
|
||||
|
||||
void foowo()
|
||||
{
|
||||
float g;
|
||||
g = wo.values[2]; // ERROR, writeonly
|
||||
float f = wo.values[2]; // ERROR, writeonly
|
||||
++wo.values[2]; // ERROR, writeonly
|
||||
wo.values[2]--; // ERROR, writeonly
|
||||
f + wo.values[2]; // ERROR, writeonly
|
||||
wo.values[2] - f; // ERROR, writeonly
|
||||
bool b;
|
||||
b ? f : wo.values[2]; // ERROR, writeonly
|
||||
b ? wo.values[2] : f; // ERROR, writeonly
|
||||
if (f == wo.values[2]) // ERROR, writeonly
|
||||
++f;
|
||||
if (f >= wo.values[2]) // ERROR, writeonly
|
||||
++f;
|
||||
f = vec3(wo.values[2]).x; // ERROR, writeonly
|
||||
~wo.value; // ERROR, writeonly
|
||||
wo.values[2] = 3.4;
|
||||
}
|
||||
|
||||
buffer multioblock
|
||||
{
|
||||
readonly int value;
|
||||
writeonly float values[];
|
||||
} multio;
|
||||
|
||||
void foomultio()
|
||||
{
|
||||
float g;
|
||||
g = wo.values[2]; // ERROR, writeonly
|
||||
~wo.value;
|
||||
wo.values[2] = 3.4;
|
||||
wo.value = 2; // ERROR, readonly
|
||||
}
|
||||
|
||||
in inb { // ERROR
|
||||
int a;
|
||||
} inbi;
|
||||
|
||||
out outb { // ERROR
|
||||
int a;
|
||||
} outbi;
|
||||
|
||||
float t__; // ERROR, no __ until revision 310
|
||||
|
||||
// ERROR, no __ until revision 310
|
||||
#define __D
|
||||
|
||||
shared vec4 arr[2][3][4];
|
||||
|
||||
void devi()
|
||||
{
|
||||
gl_DeviceIndex; // ERROR, no extension
|
||||
gl_ViewIndex; // ERROR, never this stage
|
||||
}
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_device_group : enable
|
||||
#endif
|
||||
|
||||
void devie()
|
||||
{
|
||||
gl_DeviceIndex;
|
||||
gl_ViewIndex; // ERROR, never this stage
|
||||
}
|
||||
451
third_party/glslang/Test/310.frag
vendored
451
third_party/glslang/Test/310.frag
vendored
@@ -1,451 +0,0 @@
|
||||
#version 310 es
|
||||
highp float nodef3(float); // ERROR, no default precision
|
||||
precision mediump float;
|
||||
precision highp usampler2D;
|
||||
precision highp sampler2D;
|
||||
precision highp isampler2DArray;
|
||||
|
||||
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, not supported
|
||||
|
||||
layout(location = 2) in vec3 v3;
|
||||
layout(location = 2) in mat4 yi; // ERROR, locations conflict with xi
|
||||
|
||||
uniform sampler2D arrayedSampler[5];
|
||||
uniform usampler2D usamp2d;
|
||||
uniform usampler2DRect samp2dr; // ERROR, reserved
|
||||
uniform isampler2DArray isamp2DA;
|
||||
|
||||
in vec2 c2D;
|
||||
uniform int i;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 v = texture(arrayedSampler[i], c2D); // ERROR
|
||||
|
||||
ivec2 offsets[4];
|
||||
const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
|
||||
uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2); // ERROR, not supported
|
||||
vec4 v4 = textureGather(arrayedSampler[0], c2D);
|
||||
ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(0.5));
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i)); // ERROR, offset not constant
|
||||
}
|
||||
|
||||
out vec4 outp;
|
||||
void foo23()
|
||||
{
|
||||
const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
|
||||
|
||||
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(c2D)); // ERROR, offset not constant
|
||||
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[1]);
|
||||
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[2]); // ERROR, offset out of range
|
||||
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
|
||||
|
||||
if (gl_HelperInvocation)
|
||||
++outp;
|
||||
|
||||
int sum = gl_MaxVertexImageUniforms +
|
||||
gl_MaxFragmentImageUniforms +
|
||||
gl_MaxComputeImageUniforms +
|
||||
gl_MaxCombinedImageUniforms +
|
||||
gl_MaxCombinedShaderOutputResources;
|
||||
|
||||
bool b1, b2, b3, b;
|
||||
|
||||
b1 = mix(b2, b3, b);
|
||||
uvec3 um3 = mix(uvec3(i), uvec3(i), bvec3(b));
|
||||
ivec4 im4 = mix(ivec4(i), ivec4(i), bvec4(b));
|
||||
}
|
||||
|
||||
layout(binding=3) uniform sampler2D s1;
|
||||
layout(binding=3) uniform sampler2D s2; // ERROR: overlapping bindings? Don't see that in the 310 spec.
|
||||
highp layout(binding=2) uniform writeonly image2D i2D;
|
||||
layout(binding=4) uniform readonly image3D i3D; // ERROR, no default precision
|
||||
layout(binding=5) uniform imageCube iCube; // ERROR, no default precision
|
||||
layout(binding=6) uniform image2DArray i2DA; // ERROR, no default precision
|
||||
layout(binding=6) uniform coherent volatile restrict image2D i2Dqualified; // ERROR, no default precision
|
||||
|
||||
layout(binding = 1) uniform bb {
|
||||
int foo;
|
||||
layout(binding = 2) float f; // ERROR
|
||||
} bbi;
|
||||
|
||||
in centroid vec4 centroidIn;
|
||||
layout(location = 200000) uniform vec4 bigl; // ERROR, location too big
|
||||
|
||||
layout(early_fragment_tests) in;
|
||||
|
||||
layout(location = 40) out vec4 bigout1; // ERROR, too big
|
||||
layout(location = 40) out vec4 bigout2; // ERROR, overlap
|
||||
layout(location = -2) out vec4 neg; // ERROR, negative
|
||||
|
||||
layout(std430) buffer b430 {
|
||||
int i;
|
||||
} b430i;
|
||||
|
||||
layout(shared) uniform bshar {
|
||||
int i;
|
||||
} bshari;
|
||||
|
||||
in smooth vec4 smoothIn;
|
||||
in flat int flatIn;
|
||||
|
||||
uniform sampler2DMS s2dms; // ERROR, no default precision qualifier
|
||||
|
||||
void foots()
|
||||
{
|
||||
highp ivec2 v2 = textureSize(s1, 2);
|
||||
highp ivec3 v3 = textureSize(isamp2DA, 3);
|
||||
v2 = textureSize(s2dms);
|
||||
v2 = imageSize(i2D);
|
||||
v3 = imageSize(i3D);
|
||||
v2 = imageSize(iCube);
|
||||
v3 = imageSize(i2DA);
|
||||
v2 = imageSize(i2Dqualified);
|
||||
}
|
||||
|
||||
out bool bout; // ERROR
|
||||
highp out image2D imageOut; // ERROR
|
||||
out mat2x3 mout; // ERROR
|
||||
|
||||
in bool inb; // ERROR
|
||||
in sampler2D ino; // ERROR
|
||||
in float ina[4];
|
||||
in float inaa[4][2]; // ERROR
|
||||
struct S { float f; };
|
||||
in S ins;
|
||||
in S[4] inasa; // ERROR
|
||||
in S insa[4]; // ERROR
|
||||
struct SA { float f[4]; };
|
||||
in SA inSA; // ERROR
|
||||
struct SS { float f; S s; };
|
||||
in SS inSS; // ERROR
|
||||
|
||||
#ifndef GL_EXT_shader_io_blocks
|
||||
#error GL_EXT_shader_io_blocks not defined
|
||||
#endif
|
||||
|
||||
#extension GL_EXT_shader_io_blocks : enable
|
||||
|
||||
out outbname { int a; } outbinst; // ERROR, not out block in fragment shader
|
||||
|
||||
in inbname {
|
||||
int a;
|
||||
vec4 v;
|
||||
struct { int b; } s; // ERROR, nested struct definition
|
||||
} inbinst;
|
||||
|
||||
in inbname2 {
|
||||
layout(location = 12) int aAnon;
|
||||
layout(location = 13) centroid in vec4 vAnon;
|
||||
};
|
||||
|
||||
in layout(location = 13) vec4 aliased; // ERROR, aliased
|
||||
|
||||
in inbname2 { // ERROR, reuse of block name
|
||||
int aAnon;
|
||||
centroid in vec4 vAnon;
|
||||
};
|
||||
|
||||
in badmember { // ERROR, aAnon already in global scope
|
||||
int aAnon;
|
||||
};
|
||||
|
||||
int inbname; // ERROR, redefinition of block name
|
||||
|
||||
vec4 vAnon; // ERROR, anon in global scope; redefinition
|
||||
|
||||
in arrayed {
|
||||
float f;
|
||||
} arrayedInst[4];
|
||||
|
||||
void fooIO()
|
||||
{
|
||||
vec4 v = inbinst.v + vAnon;
|
||||
v *= arrayedInst[2].f;
|
||||
v *= arrayedInst[i].f;
|
||||
}
|
||||
|
||||
in vec4 gl_FragCoord;
|
||||
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, non-ES
|
||||
|
||||
layout(early_fragment_tests) in;
|
||||
out float gl_FragDepth;
|
||||
layout(depth_any) out float gl_FragDepth; // ERROR, non-ES
|
||||
|
||||
void foo_IO()
|
||||
{
|
||||
gl_FragDepth = 0.2; // ERROR, early_fragment_tests declared
|
||||
gl_Layer; // ERROR, not present
|
||||
gl_PrimitiveID; // ERROR, not present
|
||||
bool f = gl_FrontFacing;
|
||||
}
|
||||
|
||||
out float gl_FragDepth;
|
||||
|
||||
#extension GL_OES_geometry_shader : enable
|
||||
|
||||
void foo_GS()
|
||||
{
|
||||
highp int l = gl_Layer;
|
||||
highp int p = gl_PrimitiveID;
|
||||
}
|
||||
|
||||
in vec2 inf, ing;
|
||||
uniform ivec2 offsets[4];
|
||||
uniform sampler2D sArray[4];
|
||||
uniform int sIndex;
|
||||
layout(binding = 0) uniform atomic_uint auArray[2];
|
||||
uniform ubName { int i; } ubInst[4];
|
||||
buffer bbName { int i; } bbInst[4];
|
||||
highp uniform writeonly image2D iArray[5];
|
||||
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
|
||||
|
||||
void pfooBad()
|
||||
{
|
||||
precise vec2 h; // ERROR reserved
|
||||
h = fma(inf, ing, h); // ERROR, not available
|
||||
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); // ERROR, offset not constant
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); // ERROR, not available
|
||||
}
|
||||
|
||||
#extension GL_OES_gpu_shader5 : enable
|
||||
|
||||
void pfoo()
|
||||
{
|
||||
precise vec2 h;
|
||||
h = fma(inf, ing, h);
|
||||
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
|
||||
}
|
||||
|
||||
#extension GL_EXT_texture_cube_map_array : enable
|
||||
|
||||
precision highp imageCubeArray ;
|
||||
precision highp iimageCubeArray ;
|
||||
precision highp uimageCubeArray ;
|
||||
|
||||
precision highp samplerCubeArray ;
|
||||
precision highp samplerCubeArrayShadow;
|
||||
precision highp isamplerCubeArray ;
|
||||
precision highp usamplerCubeArray ;
|
||||
|
||||
uniform writeonly imageCubeArray CA1;
|
||||
uniform writeonly iimageCubeArray CA2;
|
||||
uniform writeonly uimageCubeArray CA3;
|
||||
|
||||
#ifdef GL_EXT_texture_cube_map_array
|
||||
uniform samplerCubeArray CA4;
|
||||
uniform samplerCubeArrayShadow CA5;
|
||||
uniform isamplerCubeArray CA6;
|
||||
uniform usamplerCubeArray CA7;
|
||||
#endif
|
||||
|
||||
void CAT()
|
||||
{
|
||||
highp vec4 b4 = texture(CA4, vec4(0.5), 0.24);
|
||||
highp ivec4 b6 = texture(CA6, vec4(0.5), 0.26);
|
||||
highp uvec4 b7 = texture(CA7, vec4(0.5), 0.27);
|
||||
}
|
||||
|
||||
void badSample()
|
||||
{
|
||||
lowp int a1 = gl_SampleID; // ERROR, need extension
|
||||
mediump vec2 a2 = gl_SamplePosition; // ERROR, need extension
|
||||
highp int a3 = gl_SampleMaskIn[0]; // ERROR, need extension
|
||||
gl_SampleMask[0] = a3; // ERROR, need extension
|
||||
mediump int n = gl_NumSamples; // ERROR, need extension
|
||||
}
|
||||
|
||||
#ifdef GL_OES_sample_variables
|
||||
#extension GL_OES_sample_variables : enable
|
||||
#endif
|
||||
|
||||
void goodSample()
|
||||
{
|
||||
lowp int a1 = gl_SampleID;
|
||||
mediump vec2 a2 = gl_SamplePosition;
|
||||
highp int a3 = gl_SampleMaskIn[0];
|
||||
gl_SampleMask[0] = a3;
|
||||
mediump int n1 = gl_MaxSamples;
|
||||
mediump int n2 = gl_NumSamples;
|
||||
}
|
||||
|
||||
uniform layout(r32f) highp image2D im2Df;
|
||||
uniform layout(r32ui) highp uimage2D im2Du;
|
||||
uniform layout(r32i) highp iimage2D im2Di;
|
||||
uniform ivec2 P;
|
||||
|
||||
void badImageAtom()
|
||||
{
|
||||
float datf;
|
||||
int dati;
|
||||
uint datu;
|
||||
|
||||
imageAtomicAdd( im2Di, P, dati); // ERROR, need extension
|
||||
imageAtomicAdd( im2Du, P, datu); // ERROR, need extension
|
||||
imageAtomicMin( im2Di, P, dati); // ERROR, need extension
|
||||
imageAtomicMin( im2Du, P, datu); // ERROR, need extension
|
||||
imageAtomicMax( im2Di, P, dati); // ERROR, need extension
|
||||
imageAtomicMax( im2Du, P, datu); // ERROR, need extension
|
||||
imageAtomicAnd( im2Di, P, dati); // ERROR, need extension
|
||||
imageAtomicAnd( im2Du, P, datu); // ERROR, need extension
|
||||
imageAtomicOr( im2Di, P, dati); // ERROR, need extension
|
||||
imageAtomicOr( im2Du, P, datu); // ERROR, need extension
|
||||
imageAtomicXor( im2Di, P, dati); // ERROR, need extension
|
||||
imageAtomicXor( im2Du, P, datu); // ERROR, need extension
|
||||
imageAtomicExchange(im2Di, P, dati); // ERROR, need extension
|
||||
imageAtomicExchange(im2Du, P, datu); // ERROR, need extension
|
||||
imageAtomicExchange(im2Df, P, datf); // ERROR, need extension
|
||||
imageAtomicCompSwap(im2Di, P, 3, dati); // ERROR, need extension
|
||||
imageAtomicCompSwap(im2Du, P, 5u, datu); // ERROR, need extension
|
||||
}
|
||||
|
||||
#ifdef GL_OES_shader_image_atomic
|
||||
#extension GL_OES_shader_image_atomic : enable
|
||||
#endif
|
||||
|
||||
uniform layout(rgba32f) highp image2D badIm2Df; // ERROR, needs readonly or writeonly
|
||||
uniform layout(rgba8ui) highp uimage2D badIm2Du; // ERROR, needs readonly or writeonly
|
||||
uniform layout(rgba16i) highp iimage2D badIm2Di; // ERROR, needs readonly or writeonly
|
||||
|
||||
void goodImageAtom()
|
||||
{
|
||||
float datf;
|
||||
int dati;
|
||||
uint datu;
|
||||
|
||||
imageAtomicAdd( im2Di, P, dati);
|
||||
imageAtomicAdd( im2Du, P, datu);
|
||||
imageAtomicMin( im2Di, P, dati);
|
||||
imageAtomicMin( im2Du, P, datu);
|
||||
imageAtomicMax( im2Di, P, dati);
|
||||
imageAtomicMax( im2Du, P, datu);
|
||||
imageAtomicAnd( im2Di, P, dati);
|
||||
imageAtomicAnd( im2Du, P, datu);
|
||||
imageAtomicOr( im2Di, P, dati);
|
||||
imageAtomicOr( im2Du, P, datu);
|
||||
imageAtomicXor( im2Di, P, dati);
|
||||
imageAtomicXor( im2Du, P, datu);
|
||||
imageAtomicExchange(im2Di, P, dati);
|
||||
imageAtomicExchange(im2Du, P, datu);
|
||||
imageAtomicExchange(im2Df, P, datf);
|
||||
imageAtomicCompSwap(im2Di, P, 3, dati);
|
||||
imageAtomicCompSwap(im2Du, P, 5u, datu);
|
||||
|
||||
imageAtomicMax(badIm2Di, P, dati); // ERROR, not an allowed layout() on the image
|
||||
imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image
|
||||
imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
|
||||
}
|
||||
|
||||
sample in vec4 colorSampInBad; // ERROR, reserved
|
||||
centroid out vec4 colorCentroidBad; // ERROR
|
||||
flat out vec4 colorBadFlat; // ERROR
|
||||
smooth out vec4 colorBadSmooth; // ERROR
|
||||
noperspective out vec4 colorBadNo; // ERROR
|
||||
flat centroid in vec2 colorfc;
|
||||
in float scalarIn;
|
||||
|
||||
void badInterp()
|
||||
{
|
||||
interpolateAtCentroid(colorfc); // ERROR, need extension
|
||||
interpolateAtSample(colorfc, 1); // ERROR, need extension
|
||||
interpolateAtOffset(colorfc, vec2(0.2)); // ERROR, need extension
|
||||
}
|
||||
|
||||
#if defined GL_OES_shader_multisample_interpolation
|
||||
#extension GL_OES_shader_multisample_interpolation : enable
|
||||
#endif
|
||||
|
||||
sample in vec4 colorSampIn;
|
||||
sample out vec4 colorSampleBad; // ERROR
|
||||
flat sample in vec4 colorfsi;
|
||||
sample in vec3 sampInArray[4];
|
||||
|
||||
void interp()
|
||||
{
|
||||
float res;
|
||||
vec2 res2;
|
||||
vec3 res3;
|
||||
vec4 res4;
|
||||
|
||||
res2 = interpolateAtCentroid(colorfc);
|
||||
res4 = interpolateAtCentroid(colorSampIn);
|
||||
res4 = interpolateAtCentroid(colorfsi);
|
||||
res = interpolateAtCentroid(scalarIn);
|
||||
res3 = interpolateAtCentroid(sampInArray); // ERROR
|
||||
res3 = interpolateAtCentroid(sampInArray[2]);
|
||||
res2 = interpolateAtCentroid(sampInArray[2].xy); // ERROR
|
||||
|
||||
res3 = interpolateAtSample(sampInArray, 1); // ERROR
|
||||
res3 = interpolateAtSample(sampInArray[i], 0);
|
||||
res2 = interpolateAtSample(sampInArray[2].xy, 2); // ERROR
|
||||
res = interpolateAtSample(scalarIn, 1);
|
||||
|
||||
res3 = interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
|
||||
res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
|
||||
res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
|
||||
res = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
|
||||
res = interpolateAtOffset(scalarIn, vec2(0.2));
|
||||
|
||||
float f;
|
||||
res = interpolateAtCentroid(f); // ERROR, not interpolant
|
||||
res4 = interpolateAtSample(outp, 0); // ERROR, not interpolant
|
||||
}
|
||||
|
||||
layout(blend_support_softlight) out; // ERROR, need extension
|
||||
|
||||
#ifdef GL_KHR_blend_equation_advanced
|
||||
#extension GL_KHR_blend_equation_advanced : enable
|
||||
#endif
|
||||
|
||||
layout(blend_support_multiply) out;
|
||||
layout(blend_support_screen) out;
|
||||
layout(blend_support_overlay) out;
|
||||
layout(blend_support_darken, blend_support_lighten) out;
|
||||
layout(blend_support_colordodge) layout(blend_support_colorburn) out;
|
||||
layout(blend_support_hardlight) out;
|
||||
layout(blend_support_softlight) out;
|
||||
layout(blend_support_difference) out;
|
||||
layout(blend_support_exclusion) out;
|
||||
layout(blend_support_hsl_hue) out;
|
||||
layout(blend_support_hsl_saturation) out;
|
||||
layout(blend_support_hsl_color) out;
|
||||
layout(blend_support_hsl_luminosity) out;
|
||||
layout(blend_support_all_equations) out;
|
||||
|
||||
layout(blend_support_hsl_luminosity) out; // okay to repeat
|
||||
|
||||
layout(blend_support_hsl_luminosity) in; // ERROR, only on "out"
|
||||
layout(blend_support_hsl_luminosity) out vec4; // ERROR, only on standalone
|
||||
layout(blend_support_hsl_luminosity) out vec4 badout; // ERROR, only on standalone
|
||||
layout(blend_support_hsl_luminosity) struct badS {int i;}; // ERROR, only on standalone
|
||||
layout(blend_support_hsl_luminosity) void blendFoo() { } // ERROR, only on standalone
|
||||
void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on standalone
|
||||
layout(blend_support_flizbit) out; // ERROR, no flizbit
|
||||
|
||||
out vec4 outAA[2][2]; // ERROR
|
||||
|
||||
void devi()
|
||||
{
|
||||
gl_DeviceIndex; // ERROR, no extension
|
||||
gl_ViewIndex; // ERROR, no extension
|
||||
}
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_device_group : enable
|
||||
#endif
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_multiview : enable
|
||||
#endif
|
||||
|
||||
void devie()
|
||||
{
|
||||
gl_DeviceIndex;
|
||||
gl_ViewIndex;
|
||||
}
|
||||
152
third_party/glslang/Test/310.geom
vendored
152
third_party/glslang/Test/310.geom
vendored
@@ -1,152 +0,0 @@
|
||||
#version 310 es
|
||||
|
||||
#ifdef GL_EXT_geometry_shader
|
||||
#extension GL_EXT_geometry_shader : enable
|
||||
#else
|
||||
#error no GL_EXT_geometry_shader
|
||||
#endif
|
||||
|
||||
#ifndef GL_OES_geometry_shader
|
||||
#error no GL_OES_geometry_shader
|
||||
#endif
|
||||
|
||||
precision mediump float;
|
||||
|
||||
in fromVertex {
|
||||
in vec3 color;
|
||||
} fromV[];
|
||||
|
||||
in vec4 nonBlockUnsized[];
|
||||
|
||||
out toFragment {
|
||||
out vec3 color;
|
||||
} toF;
|
||||
|
||||
out fromVertex { // okay to reuse a block name for another block name
|
||||
vec3 color;
|
||||
};
|
||||
|
||||
out fooB { // ERROR, cannot reuse block name as block instance
|
||||
vec2 color;
|
||||
} fromVertex;
|
||||
|
||||
int fromVertex; // ERROR, cannot reuse a block name for something else
|
||||
|
||||
out fooC { // ERROR, cannot have same name for block and instance name
|
||||
vec2 color;
|
||||
} fooC;
|
||||
|
||||
void main()
|
||||
{
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
EmitStreamVertex(1); // ERROR
|
||||
EndStreamPrimitive(0); // ERROR
|
||||
|
||||
color = fromV[0].color;
|
||||
gl_ClipDistance[3] = // ERROR, no ClipDistance
|
||||
gl_in[1].gl_ClipDistance[2]; // ERROR, no ClipDistance
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
|
||||
gl_PrimitiveID = gl_PrimitiveIDIn;
|
||||
gl_Layer = 2;
|
||||
}
|
||||
|
||||
layout(stream = 4) out vec4 ov4; // ERROR, no streams
|
||||
|
||||
layout(line_strip, points, triangle_strip, points, triangle_strip) out; // just means triangle_strip"
|
||||
|
||||
out ooutb { vec4 a; } ouuaa6;
|
||||
|
||||
layout(max_vertices = 200) out;
|
||||
layout(max_vertices = 300) out; // ERROR, too big
|
||||
void foo(layout(max_vertices = 4) int a) // ERROR
|
||||
{
|
||||
ouuaa6.a = vec4(1.0);
|
||||
}
|
||||
|
||||
layout(line_strip, points, triangle_strip, points) out; // ERROR, changing output primitive
|
||||
layout(line_strip, points) out; // ERROR, changing output primitive
|
||||
layout(triangle_strip) in; // ERROR, not an input primitive
|
||||
layout(triangle_strip) uniform; // ERROR
|
||||
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
|
||||
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
|
||||
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
|
||||
out outbn2 {
|
||||
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
|
||||
layout(max_vertices = 3) int b; // ERROR, not on a block member
|
||||
layout(triangle_strip) int c; // ERROR, not on a block member
|
||||
} outbi;
|
||||
|
||||
layout(lines) out; // ERROR, not on output
|
||||
layout(lines_adjacency) in;
|
||||
layout(triangles) in; // ERROR, can't change it
|
||||
layout(triangles_adjacency) in; // ERROR, can't change it
|
||||
layout(invocations = 4) in;
|
||||
|
||||
in sameName {
|
||||
int a15;
|
||||
} insn[];
|
||||
|
||||
out sameName {
|
||||
float f15;
|
||||
};
|
||||
|
||||
uniform sameName {
|
||||
bool b15;
|
||||
};
|
||||
|
||||
const int summ = gl_MaxVertexAttribs +
|
||||
gl_MaxGeometryInputComponents +
|
||||
gl_MaxGeometryOutputComponents +
|
||||
gl_MaxGeometryImageUniforms +
|
||||
gl_MaxGeometryTextureImageUnits +
|
||||
gl_MaxGeometryOutputVertices +
|
||||
gl_MaxGeometryTotalOutputComponents +
|
||||
gl_MaxGeometryUniformComponents +
|
||||
gl_MaxGeometryAtomicCounters +
|
||||
gl_MaxGeometryAtomicCounterBuffers +
|
||||
gl_MaxVertexTextureImageUnits +
|
||||
gl_MaxCombinedTextureImageUnits +
|
||||
gl_MaxTextureImageUnits +
|
||||
gl_MaxDrawBuffers;
|
||||
|
||||
void fooe1()
|
||||
{
|
||||
gl_ViewportIndex; // ERROR, not in ES
|
||||
gl_MaxViewports; // ERROR, not in ES
|
||||
insn.length(); // 4: lines_adjacency
|
||||
int inv = gl_InvocationID;
|
||||
}
|
||||
|
||||
in vec4 explArray[4];
|
||||
in vec4 explArrayBad[5]; // ERROR, wrong size
|
||||
in vec4 nonArrayed; // ERROR, not an array
|
||||
flat out vec3 myColor1;
|
||||
centroid out vec3 myColor2;
|
||||
centroid in vec3 centr[];
|
||||
sample out vec4 perSampleColor; // ERROR without sample extensions
|
||||
|
||||
layout(max_vertices = 200) out; // matching redecl
|
||||
|
||||
layout(location = 7, component = 2) in float comp[]; // ERROR, es has no component
|
||||
|
||||
void notHere()
|
||||
{
|
||||
gl_MaxGeometryVaryingComponents; // ERROR, not in ES
|
||||
gl_VerticesIn; // ERROR, not in ES
|
||||
}
|
||||
|
||||
void pointSize1()
|
||||
{
|
||||
highp float ps = gl_in[3].gl_PointSize; // ERROR, need point_size extension
|
||||
gl_PointSize = ps; // ERROR, need point_size extension
|
||||
}
|
||||
|
||||
#extension GL_OES_geometry_point_size : enable
|
||||
|
||||
void pointSize2()
|
||||
{
|
||||
highp float ps = gl_in[3].gl_PointSize;
|
||||
gl_PointSize = ps;
|
||||
}
|
||||
169
third_party/glslang/Test/310.tesc
vendored
169
third_party/glslang/Test/310.tesc
vendored
@@ -1,169 +0,0 @@
|
||||
#version 310 es
|
||||
|
||||
#extension GL_OES_tessellation_shader : enable
|
||||
|
||||
layout(vertices = 4) out;
|
||||
out int outa[gl_out.length()];
|
||||
|
||||
layout(quads) in; // ERROR
|
||||
layout(ccw) out; // ERROR
|
||||
layout(fractional_even_spacing) in; // ERROR
|
||||
|
||||
patch in vec4 patchIn; // ERROR
|
||||
patch out vec4 patchOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier();
|
||||
|
||||
int a = gl_MaxTessControlInputComponents +
|
||||
gl_MaxTessControlOutputComponents +
|
||||
gl_MaxTessControlTextureImageUnits +
|
||||
gl_MaxTessControlUniformComponents +
|
||||
gl_MaxTessControlTotalOutputComponents;
|
||||
|
||||
vec4 p = gl_in[1].gl_Position;
|
||||
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
|
||||
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
|
||||
|
||||
int pvi = gl_PatchVerticesIn;
|
||||
int pid = gl_PrimitiveID;
|
||||
int iid = gl_InvocationID;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = p;
|
||||
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR, need point_size extension
|
||||
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd; // ERROR, not in ES
|
||||
|
||||
gl_TessLevelOuter[3] = 3.2;
|
||||
gl_TessLevelInner[1] = 1.3;
|
||||
|
||||
if (a > 10)
|
||||
barrier(); // ERROR
|
||||
else
|
||||
barrier(); // ERROR
|
||||
|
||||
barrier();
|
||||
|
||||
do {
|
||||
barrier(); // ERROR
|
||||
} while (a > 10);
|
||||
|
||||
switch (a) {
|
||||
default:
|
||||
barrier(); // ERROR
|
||||
break;
|
||||
}
|
||||
a < 12 ? a : (barrier(), a); // ERROR
|
||||
{
|
||||
barrier();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
barrier(); // ERROR
|
||||
}
|
||||
|
||||
layout(vertices = 4) in; // ERROR, not on in
|
||||
layout(vertices = 5) out; // ERROR, changing #
|
||||
|
||||
void foo()
|
||||
{
|
||||
gl_out[4].gl_Position; // ERROR, out of range
|
||||
|
||||
barrier(); // ERROR, not in main
|
||||
}
|
||||
|
||||
in vec2 ina; // ERROR, not array
|
||||
in vec2 inb[];
|
||||
in vec2 inc[18]; // ERROR, wrong size
|
||||
in vec2 ind[gl_MaxPatchVertices];
|
||||
patch out float implA[]; // ERROR, not sized
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
layout(location = 3) in vec4 ivla[];
|
||||
layout(location = 4) in vec4 ivlb[];
|
||||
layout(location = 4) in vec4 ivlc[]; // ERROR, overlapping
|
||||
|
||||
layout(location = 3) out vec4 ovla[];
|
||||
layout(location = 4) out vec4 ovlb[];
|
||||
layout(location = 4) out vec4 ovlc[]; // ERROR, overlapping
|
||||
|
||||
void foop()
|
||||
{
|
||||
precise float d; // ERROR without gpu_shader5
|
||||
d = fma(d, d, d); // ERROR without gpu_shader5
|
||||
}
|
||||
|
||||
patch out pinbn {
|
||||
int a;
|
||||
} pinbi;
|
||||
|
||||
centroid out vec3 myColor2[];
|
||||
centroid in vec3 centr[];
|
||||
sample out vec4 perSampleColor[]; // ERROR without sample extensions
|
||||
|
||||
layout(vertices = 4) out float badlay[]; // ERROR, not on a variable
|
||||
out float misSized[5]; // ERROR, size doesn't match
|
||||
out float okaySize[4];
|
||||
|
||||
#extension GL_OES_tessellation_point_size : enable
|
||||
|
||||
void pointSize2()
|
||||
{
|
||||
float ps = gl_in[1].gl_PointSize;
|
||||
gl_out[gl_InvocationID].gl_PointSize = ps;
|
||||
}
|
||||
|
||||
#extension GL_OES_gpu_shader5 : enable
|
||||
|
||||
precise vec3 pv3;
|
||||
|
||||
void goodfoop()
|
||||
{
|
||||
precise float d;
|
||||
|
||||
pv3 *= pv3;
|
||||
pv3 = fma(pv3, pv3, pv3);
|
||||
d = fma(d, d, d);
|
||||
}
|
||||
|
||||
void bbBad()
|
||||
{
|
||||
gl_BoundingBoxOES; // ERROR without GL_OES_primitive_bounding_box
|
||||
}
|
||||
|
||||
#extension GL_OES_primitive_bounding_box : enable
|
||||
|
||||
void bb()
|
||||
{
|
||||
gl_BoundingBoxOES[0] = vec4(0.0);
|
||||
gl_BoundingBoxOES[1] = vec4(1.0);
|
||||
gl_BoundingBoxOES[2] = vec4(2.0); // ERROR, overflow
|
||||
}
|
||||
|
||||
out patch badpatchBName { // ERROR, array size required
|
||||
float f;
|
||||
} badpatchIName[];
|
||||
|
||||
out patch patchBName {
|
||||
float f;
|
||||
} patchIName[4];
|
||||
|
||||
void outputtingOutparam(out int a)
|
||||
{
|
||||
a = 2;
|
||||
}
|
||||
|
||||
void outputting()
|
||||
{
|
||||
outa[gl_InvocationID] = 2;
|
||||
outa[1] = 2; // ERROR, not gl_InvocationID
|
||||
gl_out[0].gl_Position = vec4(1.0); // ERROR, not gl_InvocationID
|
||||
outa[1];
|
||||
gl_out[0];
|
||||
outputtingOutparam(outa[0]); // ERROR, not gl_InvocationID
|
||||
outputtingOutparam(outa[gl_InvocationID]);
|
||||
patchIName[1].f = 3.14;
|
||||
outa[(gl_InvocationID)] = 2;
|
||||
}
|
||||
128
third_party/glslang/Test/310.tese
vendored
128
third_party/glslang/Test/310.tese
vendored
@@ -1,128 +0,0 @@
|
||||
#version 310 es
|
||||
|
||||
#extension GL_EXT_tessellation_shader : enable
|
||||
#extension GL_OES_tessellation_shader : enable
|
||||
#extension GL_EXT_tessellation_shader : disable
|
||||
|
||||
layout(vertices = 4) out; // ERROR
|
||||
layout(quads, cw) in;
|
||||
layout(triangles) in; // ERROR
|
||||
layout(isolines) in; // ERROR
|
||||
|
||||
layout(ccw) in; // ERROR
|
||||
layout(cw) in;
|
||||
|
||||
layout(fractional_odd_spacing) in;
|
||||
layout(equal_spacing) in; // ERROR
|
||||
layout(fractional_even_spacing) in; // ERROR
|
||||
|
||||
layout(point_mode) in;
|
||||
|
||||
patch in vec4 patchIn;
|
||||
patch out vec4 patchOut; // ERROR
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier(); // ERROR
|
||||
|
||||
int a = gl_MaxTessEvaluationInputComponents +
|
||||
gl_MaxTessEvaluationOutputComponents +
|
||||
gl_MaxTessEvaluationTextureImageUnits +
|
||||
gl_MaxTessEvaluationUniformComponents +
|
||||
gl_MaxTessPatchComponents +
|
||||
gl_MaxPatchVertices +
|
||||
gl_MaxTessGenLevel;
|
||||
|
||||
vec4 p = gl_in[1].gl_Position;
|
||||
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
|
||||
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
|
||||
|
||||
int pvi = gl_PatchVerticesIn;
|
||||
int pid = gl_PrimitiveID;
|
||||
vec3 tc = gl_TessCoord;
|
||||
float tlo = gl_TessLevelOuter[3];
|
||||
float tli = gl_TessLevelInner[1];
|
||||
|
||||
gl_Position = p;
|
||||
gl_PointSize = ps; // ERROR, need point_size extension
|
||||
gl_ClipDistance[2] = cd; // ERROR, not in ES
|
||||
}
|
||||
|
||||
smooth patch in vec4 badp1; // ERROR
|
||||
flat patch in vec4 badp2; // ERROR
|
||||
noperspective patch in vec4 badp3; // ERROR
|
||||
patch sample in vec3 badp4; // ERROR
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
} gl_in[];
|
||||
|
||||
in gl_PerVertex // ERROR, second redeclaration of gl_in
|
||||
{
|
||||
vec4 gl_Position;
|
||||
} gl_in[];
|
||||
|
||||
layout(quads, cw) out; // ERROR
|
||||
layout(triangles) out; // ERROR
|
||||
layout(isolines) out; // ERROR
|
||||
layout(cw) out; // ERROR
|
||||
layout(fractional_odd_spacing) out; // ERROR
|
||||
layout(equal_spacing) out; // ERROR
|
||||
layout(fractional_even_spacing) out; // ERROR
|
||||
layout(point_mode) out; // ERROR
|
||||
|
||||
in vec2 ina; // ERROR, not array
|
||||
in vec2 inb[];
|
||||
in vec2 inc[18]; // ERROR, wrong size
|
||||
in vec2 ind[gl_MaxPatchVertices];
|
||||
|
||||
in testbla { // ERROR, not array
|
||||
int f;
|
||||
} bla;
|
||||
|
||||
in testblb {
|
||||
int f;
|
||||
} blb[];
|
||||
|
||||
in testblc { // ERROR wrong size
|
||||
int f;
|
||||
} blc[18];
|
||||
|
||||
in testbld {
|
||||
int f;
|
||||
} bld[gl_MaxPatchVertices];
|
||||
|
||||
layout(location = 23) in vec4 ivla[];
|
||||
layout(location = 24) in vec4 ivlb[];
|
||||
layout(location = 24) in vec4 ivlc[]; // ERROR, overlap
|
||||
|
||||
layout(location = 23) out vec4 ovla[2];
|
||||
layout(location = 24) out vec4 ovlb[2]; // ERROR, overlap
|
||||
|
||||
in float gl_TessLevelOuter[4]; // ERROR, can't redeclare
|
||||
|
||||
patch in pinbn {
|
||||
int a;
|
||||
} pinbi;
|
||||
|
||||
centroid out vec3 myColor2;
|
||||
centroid in vec3 centr[];
|
||||
sample out vec4 perSampleColor; // ERROR without sample extensions
|
||||
|
||||
#extension GL_OES_tessellation_point_size : enable
|
||||
|
||||
void pointSize2()
|
||||
{
|
||||
float ps = gl_in[1].gl_PointSize; // ERROR, not in the redeclaration, but no error on use of gl_PointSize
|
||||
gl_PointSize = ps;
|
||||
}
|
||||
|
||||
#extension GL_EXT_primitive_bounding_box : enable
|
||||
|
||||
void bbbad()
|
||||
{
|
||||
gl_BoundingBoxOES; // ERROR, wrong stage
|
||||
}
|
||||
403
third_party/glslang/Test/310.vert
vendored
403
third_party/glslang/Test/310.vert
vendored
@@ -1,403 +0,0 @@
|
||||
#version 310 es
|
||||
|
||||
shared vec4 s; // ERROR
|
||||
layout(local_size_x = 2) out; // ERROR
|
||||
buffer vec4 v; // ERROR
|
||||
in int ini;
|
||||
layout(location = 2) uniform mat4 x;
|
||||
layout(location = 3) uniform mat4 y;
|
||||
layout(location = 2) out mat4 xi;
|
||||
layout(location = 3) out mat4 yi; // ERROR, locations conflict with xi
|
||||
|
||||
void main()
|
||||
{
|
||||
uvec2 u2;
|
||||
u2 = uaddCarry(u2, u2, u2);
|
||||
uint u1;
|
||||
u1 = usubBorrow(u1, u1, u1);
|
||||
uvec4 u4;
|
||||
umulExtended(u4, u4, u4, u4);
|
||||
ivec4 i4;
|
||||
imulExtended(i4, i4, i4, i4);
|
||||
int i1;
|
||||
i1 = bitfieldExtract(i1, 4, 5);
|
||||
uvec3 u3;
|
||||
u3 = bitfieldExtract(u3, 4, 5);
|
||||
ivec3 i3;
|
||||
i3 = bitfieldInsert(i3, i3, 4, 5);
|
||||
u1 = bitfieldInsert(u1, u1, 4, 5);
|
||||
ivec2 i2;
|
||||
i2 = bitfieldReverse(i2);
|
||||
u4 = bitfieldReverse(u4);
|
||||
i1 = bitCount(i1);
|
||||
i3 = bitCount(u3);
|
||||
i2 = findLSB(i2);
|
||||
i4 = findLSB(u4);
|
||||
i1 = findMSB(i1);
|
||||
i2 = findMSB(u2);
|
||||
|
||||
vec3 v3;
|
||||
v3 = frexp(v3, i3);
|
||||
vec2 v2;
|
||||
v2 = ldexp(v2, i2);
|
||||
|
||||
mediump vec4 v4;
|
||||
u1 = packUnorm4x8(v4);
|
||||
u1 = packSnorm4x8(v4);
|
||||
v4 = unpackUnorm4x8(u1);
|
||||
v4 = unpackSnorm4x8(u1);
|
||||
}
|
||||
|
||||
precision highp sampler2DMS;
|
||||
precision highp isampler2DMS;
|
||||
precision highp usampler2DMS;
|
||||
|
||||
uniform sampler2DMS s2dms;
|
||||
uniform isampler2DMS is2dms;
|
||||
uniform usampler2DMS us2dms;
|
||||
uniform usampler2DMSArray us2dmsa; // ERROR
|
||||
|
||||
void foo()
|
||||
{
|
||||
ivec2 v2;
|
||||
v2 = textureSize(s2dms);
|
||||
v2 = textureSize(us2dms);
|
||||
vec4 v4 = texelFetch(s2dms, v2, 2);
|
||||
ivec4 iv4 = texelFetch(is2dms, v2, 2);
|
||||
textureSamples(s2dms); // ERROR
|
||||
float f;
|
||||
frexp(f, ini); // ERROR, i not writable
|
||||
}
|
||||
|
||||
out bool outb; // ERROR
|
||||
out sampler2D outo; // ERROR
|
||||
out float outa[4];
|
||||
out float outaa[4][2]; // ERROR
|
||||
struct S { float f; };
|
||||
out S outs;
|
||||
out S[4] outasa; // ERROR
|
||||
out S outsa[4]; // ERROR
|
||||
struct SA { float f[4]; };
|
||||
out SA outSA; // ERROR
|
||||
struct SS { float f; S s; };
|
||||
out SS outSS; // ERROR
|
||||
|
||||
layout(std430) uniform U430 { int a; } U430i; // ERROR
|
||||
layout(std430) buffer B430 { int a; } B430i;
|
||||
|
||||
#ifndef GL_OES_shader_io_blocks
|
||||
#error GL_OES_shader_io_blocks not defined
|
||||
#endif
|
||||
|
||||
#extension GL_OES_shader_io_blocks : enable
|
||||
|
||||
out outbname {
|
||||
int a;
|
||||
out vec4 v;
|
||||
highp sampler2D s; // ERROR, opaque type
|
||||
} outbinst;
|
||||
|
||||
out outbname2 {
|
||||
layout(location = 12) int aAnon;
|
||||
layout(location = 13) vec4 vAnon;
|
||||
};
|
||||
|
||||
layout(location = 12) out highp int aliased; // ERROR, aliasing location
|
||||
|
||||
in inbname { int a; } inbinst; // ERROR, no in block in vertex shader
|
||||
|
||||
out gl_PerVertex { // ERROR, has extra member
|
||||
highp vec4 gl_Position;
|
||||
highp vec4 t;
|
||||
};
|
||||
|
||||
void foo_IO()
|
||||
{
|
||||
int sum = gl_VertexID +
|
||||
gl_InstanceID;
|
||||
gl_Position = vec4(1.0);
|
||||
gl_PointSize = 2.0; // ERROR, removed by redeclaration
|
||||
}
|
||||
|
||||
out gl_PerVertex { // ERROR, already used and already redeclared
|
||||
highp vec4 gl_Position;
|
||||
highp vec4 t;
|
||||
};
|
||||
|
||||
smooth out smo { // ERROR, no smooth on a block
|
||||
int i;
|
||||
} smon;
|
||||
|
||||
flat out fmo { // ERROR, no flat on a block
|
||||
int i;
|
||||
} fmon;
|
||||
|
||||
centroid out cmo { // ERROR, no centroid on a block
|
||||
int i;
|
||||
} cmon;
|
||||
|
||||
invariant out imo { // ERROR, no invariant on a block
|
||||
int i;
|
||||
} imon;
|
||||
|
||||
in vec2 inf, ing;
|
||||
uniform ivec2 offsets[4];
|
||||
uniform sampler2D sArray[4];
|
||||
uniform int sIndex;
|
||||
layout(binding = 0) uniform atomic_uint auArray[2];
|
||||
uniform ubName { int i; } ubInst[4];
|
||||
buffer bbName { int i; } bbInst[4];
|
||||
highp uniform writeonly image2D iArray[5];
|
||||
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
|
||||
|
||||
void pfooBad()
|
||||
{
|
||||
precise vec2 h; // ERROR reserved
|
||||
h = fma(inf, ing, h); // ERROR, not available
|
||||
sArray[sIndex + 1]; // ERRRO, not supported
|
||||
auArray[sIndex + 1];
|
||||
ubInst[1];
|
||||
bbInst[2];
|
||||
ubInst[sIndex + 1]; // ERROR, not supported
|
||||
bbInst[sIndex]; // ERROR, not supported
|
||||
iArray[2];
|
||||
iArray[sIndex * 2]; // ERROR, not supported
|
||||
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); // ERROR, offset not constant
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); // ERROR, not available
|
||||
}
|
||||
|
||||
#extension GL_OES_gpu_shader5 : enable
|
||||
|
||||
void pfoo()
|
||||
{
|
||||
precise vec2 h;
|
||||
h = fma(inf, ing, h);
|
||||
sArray[sIndex + 1];
|
||||
ubInst[sIndex + 1];
|
||||
bbInst[sIndex - 2]; // ERROR, still not supported
|
||||
iArray[2];
|
||||
iArray[sIndex - 2];
|
||||
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
|
||||
}
|
||||
|
||||
uniform samplerBuffer badSamp1; // ERROR, reserved
|
||||
uniform isamplerBuffer badSamp2; // ERROR, reserved
|
||||
uniform usamplerBuffer badSamp3; // ERROR, reserved
|
||||
uniform writeonly imageBuffer badSamp4; // ERROR, reserved
|
||||
uniform writeonly iimageBuffer badSamp5; // ERROR, reserved
|
||||
uniform writeonly uimageBuffer badSamp6; // ERROR, reserved
|
||||
|
||||
#extension GL_OES_texture_buffer : enable
|
||||
#extension GL_EXT_texture_buffer : enable
|
||||
|
||||
uniform samplerBuffer noPreSamp1; // ERROR, no default precision
|
||||
uniform isamplerBuffer noPreSamp2; // ERROR, no default precision
|
||||
uniform usamplerBuffer noPreSamp3; // ERROR, no default precision
|
||||
uniform writeonly imageBuffer noPreSamp4; // ERROR, no default precision
|
||||
uniform writeonly iimageBuffer noPreSamp5; // ERROR, no default precision
|
||||
uniform writeonly uimageBuffer noPreSamp6; // ERROR, no default precision
|
||||
|
||||
precision highp samplerBuffer;
|
||||
precision highp isamplerBuffer;
|
||||
precision highp usamplerBuffer;
|
||||
precision highp imageBuffer;
|
||||
precision highp iimageBuffer;
|
||||
precision highp uimageBuffer;
|
||||
|
||||
#ifdef GL_OES_texture_buffer
|
||||
uniform samplerBuffer bufSamp1;
|
||||
uniform isamplerBuffer bufSamp2;
|
||||
uniform usamplerBuffer bufSamp3;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture_buffer
|
||||
uniform writeonly imageBuffer bufSamp4;
|
||||
uniform writeonly iimageBuffer bufSamp5;
|
||||
uniform writeonly uimageBuffer bufSamp6;
|
||||
#endif
|
||||
|
||||
void bufferT()
|
||||
{
|
||||
highp int s1 = textureSize(bufSamp1);
|
||||
highp int s2 = textureSize(bufSamp2);
|
||||
highp int s3 = textureSize(bufSamp3);
|
||||
|
||||
highp int s4 = imageSize(bufSamp4);
|
||||
highp int s5 = imageSize(bufSamp5);
|
||||
highp int s6 = imageSize(bufSamp6);
|
||||
|
||||
highp vec4 f1 = texelFetch(bufSamp1, s1);
|
||||
highp ivec4 f2 = texelFetch(bufSamp2, s2);
|
||||
highp uvec4 f3 = texelFetch(bufSamp3, s3);
|
||||
}
|
||||
|
||||
uniform writeonly imageCubeArray badCA1; // ERROR, reserved
|
||||
uniform writeonly iimageCubeArray badCA2; // ERROR, reserved
|
||||
uniform writeonly uimageCubeArray badCA3; // ERROR, reserved
|
||||
|
||||
uniform samplerCubeArray badCA4; // ERROR, reserved
|
||||
uniform samplerCubeArrayShadow badCA5; // ERROR, reserved
|
||||
uniform isamplerCubeArray badCA6; // ERROR, reserved
|
||||
uniform usamplerCubeArray badCA7; // ERROR, reserved
|
||||
|
||||
#extension GL_OES_texture_cube_map_array : enable
|
||||
|
||||
uniform writeonly imageCubeArray noPreCA1; // ERROR, no default precision
|
||||
uniform writeonly iimageCubeArray noPreCA2; // ERROR, no default precision
|
||||
uniform writeonly uimageCubeArray noPreCA3; // ERROR, no default precision
|
||||
|
||||
uniform samplerCubeArray noPreCA4; // ERROR, no default precision
|
||||
uniform samplerCubeArrayShadow noPreCA5; // ERROR, no default precision
|
||||
uniform isamplerCubeArray noPreCA6; // ERROR, no default precision
|
||||
uniform usamplerCubeArray noPreCA7; // ERROR, no default precision
|
||||
|
||||
precision highp imageCubeArray ;
|
||||
precision highp iimageCubeArray ;
|
||||
precision highp uimageCubeArray ;
|
||||
|
||||
precision highp samplerCubeArray ;
|
||||
precision highp samplerCubeArrayShadow;
|
||||
precision highp isamplerCubeArray ;
|
||||
precision highp usamplerCubeArray ;
|
||||
|
||||
uniform writeonly imageCubeArray CA1;
|
||||
uniform writeonly iimageCubeArray CA2;
|
||||
uniform writeonly uimageCubeArray CA3;
|
||||
|
||||
layout(rgba16f) uniform readonly imageCubeArray rCA1;
|
||||
layout(rgba32i) uniform readonly iimageCubeArray rCA2;
|
||||
layout(r32ui) uniform readonly uimageCubeArray rCA3;
|
||||
|
||||
#ifdef GL_OES_texture_cube_map_array
|
||||
uniform samplerCubeArray CA4;
|
||||
uniform samplerCubeArrayShadow CA5;
|
||||
uniform isamplerCubeArray CA6;
|
||||
uniform usamplerCubeArray CA7;
|
||||
#endif
|
||||
|
||||
void CAT()
|
||||
{
|
||||
highp ivec3 s4 = textureSize(CA4, 1);
|
||||
highp ivec3 s5 = textureSize(CA5, 1);
|
||||
highp ivec3 s6 = textureSize(CA6, 1);
|
||||
highp ivec3 s7 = textureSize(CA7, 1);
|
||||
|
||||
highp vec4 t4 = texture(CA4, vec4(0.5));
|
||||
highp float t5 = texture(CA5, vec4(0.5), 3.0);
|
||||
highp ivec4 t6 = texture(CA6, vec4(0.5));
|
||||
highp uvec4 t7 = texture(CA7, vec4(0.5));
|
||||
|
||||
highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24);
|
||||
highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26);
|
||||
highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27);
|
||||
|
||||
highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2));
|
||||
highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2));
|
||||
highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2));
|
||||
|
||||
highp vec4 gath4 = textureGather(CA4, vec4(0.5));
|
||||
highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2);
|
||||
highp ivec4 gath6 = textureGather(CA6, vec4(0.5));
|
||||
highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1);
|
||||
highp uvec4 gath7 = textureGather(CA7, vec4(0.5));
|
||||
highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0);
|
||||
|
||||
highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5);
|
||||
|
||||
highp ivec3 s1 = imageSize(CA1);
|
||||
highp ivec3 s2 = imageSize(CA2);
|
||||
highp ivec3 s3 = imageSize(CA3);
|
||||
|
||||
imageStore(CA1, s3, vec4(1));
|
||||
imageStore(CA2, s3, ivec4(1));
|
||||
imageStore(CA3, s3, uvec4(1));
|
||||
|
||||
highp vec4 cl1 = imageLoad(rCA1, s3);
|
||||
highp ivec4 cl2 = imageLoad(rCA2, s3);
|
||||
highp uvec4 cl3 = imageLoad(rCA3, s3);
|
||||
}
|
||||
|
||||
uniform sampler2DMSArray bad2DMS; // ERROR, reserved
|
||||
uniform isampler2DMSArray bad2DMSi; // ERROR, reserved
|
||||
uniform usampler2DMSArray bad2DMSu; // ERROR, reserved
|
||||
|
||||
#extension GL_OES_texture_storage_multisample_2d_array : enable
|
||||
|
||||
#ifdef GL_OES_texture_storage_multisample_2d_array
|
||||
|
||||
uniform sampler2DMSArray noPrec2DMS; // ERROR, no default
|
||||
uniform isampler2DMSArray noPrec2DMSi; // ERROR, no default
|
||||
uniform usampler2DMSArray noPrec2DMSu; // ERROR, no default
|
||||
|
||||
#endif
|
||||
|
||||
precision highp sampler2DMSArray;
|
||||
precision highp isampler2DMSArray;
|
||||
precision highp usampler2DMSArray;
|
||||
|
||||
uniform sampler2DMSArray samp2DMSA;
|
||||
uniform isampler2DMSArray samp2DMSAi;
|
||||
uniform usampler2DMSArray samp2DMSAu;
|
||||
|
||||
void MSA()
|
||||
{
|
||||
vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2);
|
||||
ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2);
|
||||
uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2);
|
||||
|
||||
ivec3 tfs = textureSize(samp2DMSA);
|
||||
ivec3 tfsi = textureSize(samp2DMSAi);
|
||||
ivec3 tfsb = textureSize(samp2DMSAi, 4); // ERROR, no lod
|
||||
ivec3 tfsu = textureSize(samp2DMSAu);
|
||||
}
|
||||
|
||||
#ifdef GL_OES_shader_image_atomic
|
||||
#extension GL_OES_shader_image_atomic : enable
|
||||
#endif
|
||||
|
||||
uniform layout(r32f) highp image2D im2Df;
|
||||
uniform layout(r32ui) highp uimage2D im2Du;
|
||||
uniform layout(r32i) highp iimage2D im2Di;
|
||||
uniform ivec2 P;
|
||||
|
||||
void goodImageAtom()
|
||||
{
|
||||
float datf;
|
||||
int dati;
|
||||
uint datu;
|
||||
|
||||
imageAtomicAdd( im2Di, P, dati);
|
||||
imageAtomicAdd( im2Du, P, datu);
|
||||
imageAtomicMin( im2Di, P, dati);
|
||||
imageAtomicMin( im2Du, P, datu);
|
||||
imageAtomicMax( im2Di, P, dati);
|
||||
imageAtomicMax( im2Du, P, datu);
|
||||
imageAtomicAnd( im2Di, P, dati);
|
||||
imageAtomicAnd( im2Du, P, datu);
|
||||
imageAtomicOr( im2Di, P, dati);
|
||||
imageAtomicOr( im2Du, P, datu);
|
||||
imageAtomicXor( im2Di, P, dati);
|
||||
imageAtomicXor( im2Du, P, datu);
|
||||
imageAtomicExchange(im2Di, P, dati);
|
||||
imageAtomicExchange(im2Du, P, datu);
|
||||
imageAtomicExchange(im2Df, P, datf);
|
||||
imageAtomicCompSwap(im2Di, P, 3, dati);
|
||||
imageAtomicCompSwap(im2Du, P, 5u, datu);
|
||||
}
|
||||
|
||||
sample out vec4 colorSampInBad; // ERROR, reserved
|
||||
|
||||
#extension GL_OES_shader_multisample_interpolation : enable
|
||||
|
||||
sample out vec4 colorSample;
|
||||
flat sample out vec4 colorfsi;
|
||||
sample out vec3 sampInArray[4];
|
||||
in vec4 inv4;
|
||||
|
||||
void badInterp()
|
||||
{
|
||||
interpolateAtCentroid(inv4); // ERROR, wrong stage
|
||||
interpolateAtSample(inv4, 1); // ERROR, need extension
|
||||
interpolateAtOffset(inv4, vec2(0.2)); // ERROR, need extension
|
||||
}
|
||||
121
third_party/glslang/Test/310AofA.vert
vendored
121
third_party/glslang/Test/310AofA.vert
vendored
@@ -1,121 +0,0 @@
|
||||
#version 310 es
|
||||
|
||||
// Check name mangling of functions with parameters that are multi-dimensional arrays.
|
||||
|
||||
#define NX 2
|
||||
#define NY 3
|
||||
#define NZ 4
|
||||
void f(bool a, float b, uint[4] c, int[NY][NX] d) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
int[NY][NX] d;
|
||||
f(false, 12.1, uint[NZ](uint(0),uint(1),uint(1),uint(2)), d);
|
||||
}
|
||||
|
||||
buffer b {
|
||||
float u[]; // ERROR
|
||||
vec4 v[];
|
||||
} name[3];
|
||||
|
||||
uniform ub {
|
||||
float u;
|
||||
vec4 v[]; // ERROR
|
||||
} uname[3];
|
||||
|
||||
buffer b2 {
|
||||
float u;
|
||||
vec4 v[][]; // ERROR
|
||||
} name2[3];
|
||||
|
||||
buffer b3 {
|
||||
float u;
|
||||
vec4 v[][7];
|
||||
} name3[3];
|
||||
|
||||
// General arrays of arrays
|
||||
|
||||
float[4][5][6] many[1][2][3];
|
||||
|
||||
float gu[][7]; // ERROR, size required
|
||||
float g4[4][7];
|
||||
float g5[5][7];
|
||||
|
||||
float[4][7] foo(float a[5][7])
|
||||
{
|
||||
float r[7];
|
||||
r = a[2];
|
||||
float[](a[0], a[1], r, a[3]); // ERROR, too few dims
|
||||
float[4][7][4](a[0], a[1], r, a[3]); // ERROR, too many dims
|
||||
return float[4][7](a[0], a[1], r, a[3]);
|
||||
return float[][](a[0], a[1], r, a[3]);
|
||||
return float[][7](a[0], a[1], a[2], a[3]);
|
||||
}
|
||||
|
||||
void bar(float[5][7]) {}
|
||||
|
||||
void foo2()
|
||||
{
|
||||
{
|
||||
float gu[3][4][2];
|
||||
|
||||
gu[2][4][1] = 4.0; // ERROR, overflow
|
||||
}
|
||||
vec4 ca4[3][2] = vec4[][](vec4[2](vec4(0.0), vec4(1.0)),
|
||||
vec4[2](vec4(0.0), vec4(1.0)),
|
||||
vec4[2](vec4(0.0), vec4(1.0)));
|
||||
vec4 caim[][2] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
|
||||
vec4[2](vec4(4.0), vec4(2.0)),
|
||||
vec4[2](vec4(4.0), vec4(2.0)));
|
||||
vec4 caim2[][] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
|
||||
vec4[2](vec4(4.0), vec4(2.0)),
|
||||
vec4[2](vec4(4.0), vec4(2.0)));
|
||||
vec4 caim3[3][] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
|
||||
vec4[2](vec4(4.0), vec4(2.0)),
|
||||
vec4[2](vec4(4.0), vec4(2.0)));
|
||||
|
||||
g4 = foo(g5);
|
||||
g5 = g4; // ERROR, wrong types
|
||||
gu = g4; // ERROR, not yet sized
|
||||
|
||||
foo(gu); // ERROR, not yet sized
|
||||
bar(g5);
|
||||
|
||||
if (foo(g5) == g4)
|
||||
;
|
||||
if (foo(g5) == g5) // ERROR, different types
|
||||
;
|
||||
|
||||
float u[5][7];
|
||||
u[5][2] = 5.0; // ERROR
|
||||
foo(u);
|
||||
|
||||
vec4 badAss[3];
|
||||
name[1].v[-1]; // ERROR
|
||||
name[1].v[1] = vec4(4.3);
|
||||
name[1].v = badAss; // ERROR, bad assignemnt
|
||||
|
||||
name3[0].v[1].length(); // 7
|
||||
name3[0].v.length(); // run time
|
||||
}
|
||||
|
||||
struct badS {
|
||||
int sa[]; // ERROR
|
||||
int a[][]; // ERROR
|
||||
int b[][2]; // ERROR
|
||||
int c[2][]; // ERROR
|
||||
int d[][4]; // ERROR
|
||||
};
|
||||
|
||||
in float inArray[2][3]; // ERROR
|
||||
out float outArray[2][3]; // ERROR
|
||||
|
||||
uniform ubaa {
|
||||
int a;
|
||||
} ubaaname[2][3]; // ERROR
|
||||
|
||||
vec3 func(in mat3[2] x[3])
|
||||
{
|
||||
mat3 a0 = x[2][1];
|
||||
return a0[2];
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#version 310 es
|
||||
layout (binding=0) uniform Block {
|
||||
highp int a[];
|
||||
} uni;
|
||||
layout (location=0) out highp int o;
|
||||
void main() {
|
||||
o = uni.a[2];
|
||||
}
|
||||
18
third_party/glslang/Test/310runtimeArray.vert
vendored
18
third_party/glslang/Test/310runtimeArray.vert
vendored
@@ -1,18 +0,0 @@
|
||||
#version 310 es
|
||||
|
||||
precision highp float;
|
||||
layout(location=0) out float o;
|
||||
|
||||
struct S { float f; };
|
||||
buffer b1 { S s[]; };
|
||||
buffer b2 { S s[]; } b2name;
|
||||
buffer b3 { S s[]; } b3name[];
|
||||
buffer b4 { S s[]; } b4name[4];
|
||||
|
||||
void main()
|
||||
{
|
||||
o = s[5].f;
|
||||
o += b2name.s[6].f;
|
||||
o += b3name[3].s[7].f;
|
||||
o += b4name[2].s[8].f;
|
||||
}
|
||||
5
third_party/glslang/Test/320.comp
vendored
5
third_party/glslang/Test/320.comp
vendored
@@ -1,5 +0,0 @@
|
||||
#version 320 es
|
||||
|
||||
void main()
|
||||
{
|
||||
}
|
||||
225
third_party/glslang/Test/320.frag
vendored
225
third_party/glslang/Test/320.frag
vendored
@@ -1,225 +0,0 @@
|
||||
#version 320 es
|
||||
|
||||
out outbname { int a; } outbinst; // ERROR, not out block in fragment shader
|
||||
|
||||
in inbname {
|
||||
int a;
|
||||
vec4 v;
|
||||
struct { int b; } s; // ERROR, nested struct definition
|
||||
} inbinst;
|
||||
|
||||
in inbname2 {
|
||||
layout(location = 12) int aAnon;
|
||||
layout(location = 13) centroid in vec4 vAnon;
|
||||
};
|
||||
|
||||
in layout(location = 13) vec4 aliased; // ERROR, aliased
|
||||
|
||||
in inbname2 { // ERROR, reuse of block name
|
||||
int aAnon;
|
||||
centroid in vec4 vAnon;
|
||||
};
|
||||
|
||||
in badmember { // ERROR, aAnon already in global scope
|
||||
int aAnon;
|
||||
};
|
||||
|
||||
int inbname; // ERROR, redefinition of block name
|
||||
|
||||
vec4 vAnon; // ERROR, anon in global scope; redefinition
|
||||
|
||||
in arrayed {
|
||||
float f;
|
||||
} arrayedInst[4];
|
||||
uniform int i;
|
||||
void fooIO()
|
||||
{
|
||||
vec4 v = inbinst.v + vAnon;
|
||||
v *= arrayedInst[2].f;
|
||||
v *= arrayedInst[i].f;
|
||||
}
|
||||
|
||||
in vec4 gl_FragCoord;
|
||||
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, non-ES
|
||||
|
||||
layout(early_fragment_tests) in;
|
||||
out float gl_FragDepth;
|
||||
layout(depth_any) out float gl_FragDepth; // ERROR, non-ES
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragDepth = 0.2; // ERROR, early_fragment_tests declared
|
||||
bool f = gl_FrontFacing;
|
||||
}
|
||||
|
||||
out float gl_FragDepth;
|
||||
|
||||
void foo_GS()
|
||||
{
|
||||
highp int l = gl_Layer;
|
||||
highp int p = gl_PrimitiveID;
|
||||
}
|
||||
|
||||
in vec2 inf, ing;
|
||||
uniform ivec2 offsets[4];
|
||||
uniform sampler2D sArray[4];
|
||||
uniform int sIndex;
|
||||
layout(binding = 0) uniform atomic_uint auArray[2];
|
||||
uniform ubName { int i; } ubInst[4];
|
||||
buffer bbName { int i; } bbInst[4];
|
||||
highp uniform writeonly image2D iArray[5];
|
||||
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
|
||||
|
||||
void pfoo()
|
||||
{
|
||||
precise vec2 h;
|
||||
h = fma(inf, ing, h);
|
||||
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
|
||||
}
|
||||
|
||||
precision highp imageCubeArray ;
|
||||
precision highp iimageCubeArray ;
|
||||
precision highp uimageCubeArray ;
|
||||
|
||||
precision highp samplerCubeArray ;
|
||||
precision highp samplerCubeArrayShadow;
|
||||
precision highp isamplerCubeArray ;
|
||||
precision highp usamplerCubeArray ;
|
||||
|
||||
uniform writeonly imageCubeArray CA1;
|
||||
uniform writeonly iimageCubeArray CA2;
|
||||
uniform writeonly uimageCubeArray CA3;
|
||||
|
||||
#ifdef GL_EXT_texture_cube_map_array
|
||||
uniform samplerCubeArray CA4;
|
||||
uniform samplerCubeArrayShadow CA5;
|
||||
uniform isamplerCubeArray CA6;
|
||||
uniform usamplerCubeArray CA7;
|
||||
#endif
|
||||
|
||||
void CAT()
|
||||
{
|
||||
highp vec4 b4 = texture(CA4, vec4(0.5), 0.24);
|
||||
highp ivec4 b6 = texture(CA6, vec4(0.5), 0.26);
|
||||
highp uvec4 b7 = texture(CA7, vec4(0.5), 0.27);
|
||||
}
|
||||
|
||||
void goodSample()
|
||||
{
|
||||
lowp int a1 = gl_SampleID;
|
||||
mediump vec2 a2 = gl_SamplePosition;
|
||||
highp int a3 = gl_SampleMaskIn[0];
|
||||
gl_SampleMask[0] = a3;
|
||||
mediump int n1 = gl_MaxSamples;
|
||||
mediump int n2 = gl_NumSamples;
|
||||
}
|
||||
|
||||
uniform layout(r32f) highp image2D im2Df;
|
||||
uniform layout(r32ui) highp uimage2D im2Du;
|
||||
uniform layout(r32i) highp iimage2D im2Di;
|
||||
uniform ivec2 P;
|
||||
|
||||
uniform layout(rgba32f) highp image2D badIm2Df; // ERROR, needs readonly or writeonly
|
||||
uniform layout(rgba8ui) highp uimage2D badIm2Du; // ERROR, needs readonly or writeonly
|
||||
uniform layout(rgba16i) highp iimage2D badIm2Di; // ERROR, needs readonly or writeonly
|
||||
|
||||
void goodImageAtom()
|
||||
{
|
||||
float datf;
|
||||
int dati;
|
||||
uint datu;
|
||||
|
||||
imageAtomicAdd( im2Di, P, dati);
|
||||
imageAtomicAdd( im2Du, P, datu);
|
||||
imageAtomicMin( im2Di, P, dati);
|
||||
imageAtomicMin( im2Du, P, datu);
|
||||
imageAtomicMax( im2Di, P, dati);
|
||||
imageAtomicMax( im2Du, P, datu);
|
||||
imageAtomicAnd( im2Di, P, dati);
|
||||
imageAtomicAnd( im2Du, P, datu);
|
||||
imageAtomicOr( im2Di, P, dati);
|
||||
imageAtomicOr( im2Du, P, datu);
|
||||
imageAtomicXor( im2Di, P, dati);
|
||||
imageAtomicXor( im2Du, P, datu);
|
||||
imageAtomicExchange(im2Di, P, dati);
|
||||
imageAtomicExchange(im2Du, P, datu);
|
||||
imageAtomicExchange(im2Df, P, datf);
|
||||
imageAtomicCompSwap(im2Di, P, 3, dati);
|
||||
imageAtomicCompSwap(im2Du, P, 5u, datu);
|
||||
|
||||
imageAtomicMax(badIm2Di, P, dati); // ERROR, not an allowed layout() on the image
|
||||
imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image
|
||||
imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
|
||||
}
|
||||
|
||||
centroid out vec4 colorCentroidBad; // ERROR
|
||||
flat out vec4 colorBadFlat; // ERROR
|
||||
smooth out vec4 colorBadSmooth; // ERROR
|
||||
noperspective out vec4 colorBadNo; // ERROR
|
||||
flat centroid in vec2 colorfc;
|
||||
in float scalarIn;
|
||||
|
||||
sample in vec4 colorSampIn;
|
||||
sample out vec4 colorSampleBad; // ERROR
|
||||
flat sample in vec4 colorfsi;
|
||||
sample in vec3 sampInArray[4];
|
||||
|
||||
void interp()
|
||||
{
|
||||
float res;
|
||||
vec2 res2;
|
||||
vec3 res3;
|
||||
vec4 res4;
|
||||
|
||||
res2 = interpolateAtCentroid(colorfc);
|
||||
res4 = interpolateAtCentroid(colorSampIn);
|
||||
res4 = interpolateAtCentroid(colorfsi);
|
||||
res = interpolateAtCentroid(scalarIn);
|
||||
res3 = interpolateAtCentroid(sampInArray); // ERROR
|
||||
res3 = interpolateAtCentroid(sampInArray[2]);
|
||||
res2 = interpolateAtCentroid(sampInArray[2].xy); // ERROR
|
||||
|
||||
res3 = interpolateAtSample(sampInArray, 1); // ERROR
|
||||
res3 = interpolateAtSample(sampInArray[i], 0);
|
||||
res2 = interpolateAtSample(sampInArray[2].xy, 2); // ERROR
|
||||
res = interpolateAtSample(scalarIn, 1);
|
||||
|
||||
res3 = interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
|
||||
res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
|
||||
res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
|
||||
res = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
|
||||
res = interpolateAtOffset(scalarIn, vec2(0.2));
|
||||
|
||||
float f;
|
||||
res = interpolateAtCentroid(f); // ERROR, not interpolant
|
||||
res4 = interpolateAtSample(outp, 0); // ERROR, not interpolant
|
||||
}
|
||||
|
||||
layout(blend_support_multiply) out;
|
||||
layout(blend_support_screen) out;
|
||||
layout(blend_support_overlay) out;
|
||||
layout(blend_support_darken, blend_support_lighten) out;
|
||||
layout(blend_support_colordodge) layout(blend_support_colorburn) out;
|
||||
layout(blend_support_hardlight) out;
|
||||
layout(blend_support_softlight) out;
|
||||
layout(blend_support_difference) out;
|
||||
layout(blend_support_exclusion) out;
|
||||
layout(blend_support_hsl_hue) out;
|
||||
layout(blend_support_hsl_saturation) out;
|
||||
layout(blend_support_hsl_color) out;
|
||||
layout(blend_support_hsl_luminosity) out;
|
||||
layout(blend_support_all_equations) out;
|
||||
|
||||
layout(blend_support_hsl_luminosity) out; // okay to repeat
|
||||
|
||||
layout(blend_support_hsl_luminosity) in; // ERROR, only on "out"
|
||||
layout(blend_support_hsl_luminosity) out vec4; // ERROR, only on standalone
|
||||
layout(blend_support_hsl_luminosity) out vec4 badout; // ERROR, only on standalone
|
||||
layout(blend_support_hsl_luminosity) struct badS {int i;}; // ERROR, only on standalone
|
||||
layout(blend_support_hsl_luminosity) void blendFoo() { } // ERROR, only on standalone
|
||||
void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on standalone
|
||||
layout(blend_support_flizbit) out; // ERROR, no flizbit
|
||||
|
||||
out vec4 outAA[2][2]; // ERROR
|
||||
134
third_party/glslang/Test/320.geom
vendored
134
third_party/glslang/Test/320.geom
vendored
@@ -1,134 +0,0 @@
|
||||
#version 320 es
|
||||
|
||||
precision mediump float;
|
||||
|
||||
in fromVertex {
|
||||
in vec3 color;
|
||||
} fromV[];
|
||||
|
||||
in vec4 nonBlockUnsized[];
|
||||
|
||||
out toFragment {
|
||||
out vec3 color;
|
||||
} toF;
|
||||
|
||||
out fromVertex { // okay to reuse a block name for another block name
|
||||
vec3 color;
|
||||
};
|
||||
|
||||
out fooB { // ERROR, cannot reuse block name as block instance
|
||||
vec2 color;
|
||||
} fromVertex;
|
||||
|
||||
int fromVertex; // ERROR, cannot reuse a block name for something else
|
||||
|
||||
out fooC { // ERROR, cannot have same name for block and instance name
|
||||
vec2 color;
|
||||
} fooC;
|
||||
|
||||
void main()
|
||||
{
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
EmitStreamVertex(1); // ERROR
|
||||
EndStreamPrimitive(0); // ERROR
|
||||
|
||||
color = fromV[0].color;
|
||||
gl_ClipDistance[3] = // ERROR, no ClipDistance
|
||||
gl_in[1].gl_ClipDistance[2]; // ERROR, no ClipDistance
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
|
||||
gl_PrimitiveID = gl_PrimitiveIDIn;
|
||||
gl_Layer = 2;
|
||||
}
|
||||
|
||||
layout(stream = 4) out vec4 ov4; // ERROR, no streams
|
||||
|
||||
layout(line_strip, points, triangle_strip, points, triangle_strip) out; // just means triangle_strip"
|
||||
|
||||
out ooutb { vec4 a; } ouuaa6;
|
||||
|
||||
layout(max_vertices = 200) out;
|
||||
layout(max_vertices = 300) out; // ERROR, too big
|
||||
void foo(layout(max_vertices = 4) int a) // ERROR
|
||||
{
|
||||
ouuaa6.a = vec4(1.0);
|
||||
}
|
||||
|
||||
layout(line_strip, points, triangle_strip, points) out; // ERROR, changing output primitive
|
||||
layout(line_strip, points) out; // ERROR, changing output primitive
|
||||
layout(triangle_strip) in; // ERROR, not an input primitive
|
||||
layout(triangle_strip) uniform; // ERROR
|
||||
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
|
||||
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
|
||||
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
|
||||
out outbn2 {
|
||||
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
|
||||
layout(max_vertices = 3) int b; // ERROR, not on a block member
|
||||
layout(triangle_strip) int c; // ERROR, not on a block member
|
||||
} outbi;
|
||||
|
||||
layout(lines) out; // ERROR, not on output
|
||||
layout(lines_adjacency) in;
|
||||
layout(triangles) in; // ERROR, can't change it
|
||||
layout(triangles_adjacency) in; // ERROR, can't change it
|
||||
layout(invocations = 4) in;
|
||||
|
||||
in sameName {
|
||||
int a15;
|
||||
} insn[];
|
||||
|
||||
out sameName {
|
||||
float f15;
|
||||
};
|
||||
|
||||
uniform sameName {
|
||||
bool b15;
|
||||
};
|
||||
|
||||
const int summ = gl_MaxVertexAttribs +
|
||||
gl_MaxGeometryInputComponents +
|
||||
gl_MaxGeometryOutputComponents +
|
||||
gl_MaxGeometryImageUniforms +
|
||||
gl_MaxGeometryTextureImageUnits +
|
||||
gl_MaxGeometryOutputVertices +
|
||||
gl_MaxGeometryTotalOutputComponents +
|
||||
gl_MaxGeometryUniformComponents +
|
||||
gl_MaxGeometryAtomicCounters +
|
||||
gl_MaxGeometryAtomicCounterBuffers +
|
||||
gl_MaxVertexTextureImageUnits +
|
||||
gl_MaxCombinedTextureImageUnits +
|
||||
gl_MaxTextureImageUnits +
|
||||
gl_MaxDrawBuffers;
|
||||
|
||||
void fooe1()
|
||||
{
|
||||
gl_ViewportIndex; // ERROR, not in ES
|
||||
gl_MaxViewports; // ERROR, not in ES
|
||||
insn.length(); // 4: lines_adjacency
|
||||
int inv = gl_InvocationID;
|
||||
}
|
||||
|
||||
in vec4 explArray[4];
|
||||
in vec4 explArrayBad[5]; // ERROR, wrong size
|
||||
in vec4 nonArrayed; // ERROR, not an array
|
||||
flat out vec3 myColor1;
|
||||
centroid out vec3 myColor2;
|
||||
centroid in vec3 centr[];
|
||||
sample out vec4 perSampleColor; // ERROR without sample extensions
|
||||
|
||||
layout(max_vertices = 200) out; // matching redecl
|
||||
|
||||
layout(location = 7, component = 2) in float comp[]; // ERROR, es has no component
|
||||
|
||||
void notHere()
|
||||
{
|
||||
gl_MaxGeometryVaryingComponents; // ERROR, not in ES
|
||||
gl_VerticesIn; // ERROR, not in ES
|
||||
}
|
||||
|
||||
void pointSize2()
|
||||
{
|
||||
highp float ps = gl_in[3].gl_PointSize; // ERROR, need extension
|
||||
gl_PointSize = ps; // ERROR, need extension
|
||||
}
|
||||
150
third_party/glslang/Test/320.tesc
vendored
150
third_party/glslang/Test/320.tesc
vendored
@@ -1,150 +0,0 @@
|
||||
#version 320 es
|
||||
|
||||
layout(vertices = 4) out;
|
||||
out int outa[gl_out.length()];
|
||||
|
||||
layout(quads) in; // ERROR
|
||||
layout(ccw) out; // ERROR
|
||||
layout(fractional_even_spacing) in; // ERROR
|
||||
|
||||
patch in vec4 patchIn; // ERROR
|
||||
patch out vec4 patchOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier();
|
||||
|
||||
int a = gl_MaxTessControlInputComponents +
|
||||
gl_MaxTessControlOutputComponents +
|
||||
gl_MaxTessControlTextureImageUnits +
|
||||
gl_MaxTessControlUniformComponents +
|
||||
gl_MaxTessControlTotalOutputComponents;
|
||||
|
||||
vec4 p = gl_in[1].gl_Position;
|
||||
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
|
||||
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
|
||||
|
||||
int pvi = gl_PatchVerticesIn;
|
||||
int pid = gl_PrimitiveID;
|
||||
int iid = gl_InvocationID;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = p;
|
||||
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR, need point_size extension
|
||||
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd; // ERROR, not in ES
|
||||
|
||||
gl_TessLevelOuter[3] = 3.2;
|
||||
gl_TessLevelInner[1] = 1.3;
|
||||
|
||||
if (a > 10)
|
||||
barrier(); // ERROR
|
||||
else
|
||||
barrier(); // ERROR
|
||||
|
||||
barrier();
|
||||
|
||||
do {
|
||||
barrier(); // ERROR
|
||||
} while (a > 10);
|
||||
|
||||
switch (a) {
|
||||
default:
|
||||
barrier(); // ERROR
|
||||
break;
|
||||
}
|
||||
a < 12 ? a : (barrier(), a); // ERROR
|
||||
{
|
||||
barrier();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
barrier(); // ERROR
|
||||
}
|
||||
|
||||
layout(vertices = 4) in; // ERROR, not on in
|
||||
layout(vertices = 5) out; // ERROR, changing #
|
||||
|
||||
void foo()
|
||||
{
|
||||
gl_out[4].gl_Position; // ERROR, out of range
|
||||
|
||||
barrier(); // ERROR, not in main
|
||||
}
|
||||
|
||||
in vec2 ina; // ERROR, not array
|
||||
in vec2 inb[];
|
||||
in vec2 inc[18]; // ERROR, wrong size
|
||||
in vec2 ind[gl_MaxPatchVertices];
|
||||
patch out float implA[]; // ERROR, not sized
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
layout(location = 3) in vec4 ivla[];
|
||||
layout(location = 4) in vec4 ivlb[];
|
||||
layout(location = 4) in vec4 ivlc[]; // ERROR, overlapping
|
||||
|
||||
layout(location = 3) out vec4 ovla[];
|
||||
layout(location = 4) out vec4 ovlb[];
|
||||
layout(location = 4) out vec4 ovlc[]; // ERROR, overlapping
|
||||
|
||||
patch out pinbn {
|
||||
int a;
|
||||
} pinbi;
|
||||
|
||||
centroid out vec3 myColor2[];
|
||||
centroid in vec3 centr[];
|
||||
sample out vec4 perSampleColor[];
|
||||
|
||||
layout(vertices = 4) out float badlay[]; // ERROR, not on a variable
|
||||
out float misSized[5]; // ERROR, size doesn't match
|
||||
out float okaySize[4];
|
||||
|
||||
void pointSize2()
|
||||
{
|
||||
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
|
||||
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR, need point_size extension
|
||||
}
|
||||
|
||||
precise vec3 pv3;
|
||||
|
||||
void goodfoop()
|
||||
{
|
||||
precise float d;
|
||||
|
||||
pv3 *= pv3;
|
||||
pv3 = fma(pv3, pv3, pv3);
|
||||
d = fma(d, d, d);
|
||||
}
|
||||
|
||||
void bb()
|
||||
{
|
||||
gl_BoundingBoxOES[0] = vec4(0.0);
|
||||
gl_BoundingBoxOES[1] = vec4(1.0);
|
||||
gl_BoundingBoxOES[2] = vec4(2.0); // ERROR, overflow
|
||||
}
|
||||
|
||||
out patch badpatchBName { // ERROR, array size required
|
||||
float f;
|
||||
} badpatchIName[];
|
||||
|
||||
out patch patchBName {
|
||||
float f;
|
||||
} patchIName[4];
|
||||
|
||||
void outputtingOutparam(out int a)
|
||||
{
|
||||
a = 2;
|
||||
}
|
||||
|
||||
void outputting()
|
||||
{
|
||||
outa[gl_InvocationID] = 2;
|
||||
outa[1] = 2; // ERROR, not gl_InvocationID
|
||||
gl_out[0].gl_Position = vec4(1.0); // ERROR, not gl_InvocationID
|
||||
outa[1];
|
||||
gl_out[0];
|
||||
outputtingOutparam(outa[0]); // ERROR, not gl_InvocationID
|
||||
outputtingOutparam(outa[gl_InvocationID]);
|
||||
patchIName[1].f = 3.14;
|
||||
outa[(gl_InvocationID)] = 2;
|
||||
}
|
||||
114
third_party/glslang/Test/320.tese
vendored
114
third_party/glslang/Test/320.tese
vendored
@@ -1,114 +0,0 @@
|
||||
#version 320 es
|
||||
|
||||
layout(vertices = 4) out; // ERROR
|
||||
layout(quads, cw) in;
|
||||
layout(triangles) in; // ERROR
|
||||
layout(isolines) in; // ERROR
|
||||
|
||||
layout(ccw) in; // ERROR
|
||||
layout(cw) in;
|
||||
|
||||
layout(fractional_odd_spacing) in;
|
||||
layout(equal_spacing) in; // ERROR
|
||||
layout(fractional_even_spacing) in; // ERROR
|
||||
|
||||
layout(point_mode) in;
|
||||
|
||||
patch in vec4 patchIn;
|
||||
patch out vec4 patchOut; // ERROR
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier(); // ERROR
|
||||
|
||||
int a = gl_MaxTessEvaluationInputComponents +
|
||||
gl_MaxTessEvaluationOutputComponents +
|
||||
gl_MaxTessEvaluationTextureImageUnits +
|
||||
gl_MaxTessEvaluationUniformComponents +
|
||||
gl_MaxTessPatchComponents +
|
||||
gl_MaxPatchVertices +
|
||||
gl_MaxTessGenLevel;
|
||||
|
||||
vec4 p = gl_in[1].gl_Position;
|
||||
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
|
||||
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
|
||||
|
||||
int pvi = gl_PatchVerticesIn;
|
||||
int pid = gl_PrimitiveID;
|
||||
vec3 tc = gl_TessCoord;
|
||||
float tlo = gl_TessLevelOuter[3];
|
||||
float tli = gl_TessLevelInner[1];
|
||||
|
||||
gl_Position = p;
|
||||
gl_PointSize = ps; // ERROR, need point_size extension
|
||||
gl_ClipDistance[2] = cd; // ERROR, not in ES
|
||||
}
|
||||
|
||||
smooth patch in vec4 badp1; // ERROR
|
||||
flat patch in vec4 badp2; // ERROR
|
||||
noperspective patch in vec4 badp3; // ERROR
|
||||
patch sample in vec3 badp4; // ERROR
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
} gl_in[];
|
||||
|
||||
in gl_PerVertex // ERROR, second redeclaration of gl_in
|
||||
{
|
||||
vec4 gl_Position;
|
||||
} gl_in[];
|
||||
|
||||
layout(quads, cw) out; // ERROR
|
||||
layout(triangles) out; // ERROR
|
||||
layout(isolines) out; // ERROR
|
||||
layout(cw) out; // ERROR
|
||||
layout(fractional_odd_spacing) out; // ERROR
|
||||
layout(equal_spacing) out; // ERROR
|
||||
layout(fractional_even_spacing) out; // ERROR
|
||||
layout(point_mode) out; // ERROR
|
||||
|
||||
in vec2 ina; // ERROR, not array
|
||||
in vec2 inb[];
|
||||
in vec2 inc[18]; // ERROR, wrong size
|
||||
in vec2 ind[gl_MaxPatchVertices];
|
||||
|
||||
in testbla { // ERROR, not array
|
||||
int f;
|
||||
} bla;
|
||||
|
||||
in testblb {
|
||||
int f;
|
||||
} blb[];
|
||||
|
||||
in testblc { // ERROR wrong size
|
||||
int f;
|
||||
} blc[18];
|
||||
|
||||
in testbld {
|
||||
int f;
|
||||
} bld[gl_MaxPatchVertices];
|
||||
|
||||
layout(location = 23) in vec4 ivla[];
|
||||
layout(location = 24) in vec4 ivlb[];
|
||||
layout(location = 24) in vec4 ivlc[]; // ERROR, overlap
|
||||
|
||||
layout(location = 23) out vec4 ovla[2];
|
||||
layout(location = 24) out vec4 ovlb[2]; // ERROR, overlap
|
||||
|
||||
in float gl_TessLevelOuter[4]; // ERROR, can't redeclare
|
||||
|
||||
patch in pinbn {
|
||||
int a;
|
||||
} pinbi;
|
||||
|
||||
centroid out vec3 myColor2;
|
||||
centroid in vec3 centr[];
|
||||
sample out vec4 perSampleColor;
|
||||
|
||||
void bbbad()
|
||||
{
|
||||
gl_BoundingBoxOES; // ERROR, wrong stage
|
||||
}
|
||||
255
third_party/glslang/Test/320.vert
vendored
255
third_party/glslang/Test/320.vert
vendored
@@ -1,255 +0,0 @@
|
||||
#version 320 es
|
||||
|
||||
out outbname {
|
||||
int a;
|
||||
out vec4 v;
|
||||
highp sampler2D s; // ERROR, opaque type
|
||||
} outbinst;
|
||||
|
||||
out outbname2 {
|
||||
layout(location = 12) int aAnon;
|
||||
layout(location = 13) vec4 vAnon;
|
||||
};
|
||||
|
||||
layout(location = 12) out highp int aliased; // ERROR, aliasing location
|
||||
|
||||
in inbname { int a; } inbinst; // ERROR, no in block in vertex shader
|
||||
|
||||
out gl_PerVertex { // ERROR, has extra member
|
||||
highp vec4 gl_Position;
|
||||
highp vec4 t;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
int sum = gl_VertexID +
|
||||
gl_InstanceID;
|
||||
gl_Position = vec4(1.0);
|
||||
gl_PointSize = 2.0; // ERROR, removed by redeclaration
|
||||
}
|
||||
|
||||
out gl_PerVertex { // ERROR, already used and already redeclared
|
||||
highp vec4 gl_Position;
|
||||
highp vec4 t;
|
||||
};
|
||||
|
||||
smooth out smo { // ERROR, no smooth on a block
|
||||
int i;
|
||||
} smon;
|
||||
|
||||
flat out fmo { // ERROR, no flat on a block
|
||||
int i;
|
||||
} fmon;
|
||||
|
||||
centroid out cmo { // ERROR, no centroid on a block
|
||||
int i;
|
||||
} cmon;
|
||||
|
||||
invariant out imo { // ERROR, no invariant on a block
|
||||
int i;
|
||||
} imon;
|
||||
|
||||
in vec2 inf, ing;
|
||||
uniform ivec2 offsets[4];
|
||||
uniform sampler2D sArray[4];
|
||||
uniform int sIndex;
|
||||
layout(binding = 0) uniform atomic_uint auArray[2];
|
||||
uniform ubName { int i; } ubInst[4];
|
||||
buffer bbName { int i; } bbInst[4];
|
||||
highp uniform writeonly image2D iArray[5];
|
||||
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
|
||||
|
||||
void pfoo()
|
||||
{
|
||||
precise vec2 h;
|
||||
h = fma(inf, ing, h);
|
||||
sArray[sIndex + 1];
|
||||
ubInst[sIndex + 1];
|
||||
bbInst[sIndex - 2]; // ERROR, still not supported
|
||||
iArray[2];
|
||||
iArray[sIndex - 2];
|
||||
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
|
||||
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
|
||||
}
|
||||
|
||||
uniform samplerBuffer noPreSamp1; // ERROR, no default precision
|
||||
uniform isamplerBuffer noPreSamp2; // ERROR, no default precision
|
||||
uniform usamplerBuffer noPreSamp3; // ERROR, no default precision
|
||||
uniform writeonly imageBuffer noPreSamp4; // ERROR, no default precision
|
||||
uniform writeonly iimageBuffer noPreSamp5; // ERROR, no default precision
|
||||
uniform writeonly uimageBuffer noPreSamp6; // ERROR, no default precision
|
||||
|
||||
precision highp samplerBuffer;
|
||||
precision highp isamplerBuffer;
|
||||
precision highp usamplerBuffer;
|
||||
precision highp imageBuffer;
|
||||
precision highp iimageBuffer;
|
||||
precision highp uimageBuffer;
|
||||
|
||||
#ifdef GL_OES_texture_buffer
|
||||
uniform samplerBuffer bufSamp1;
|
||||
uniform isamplerBuffer bufSamp2;
|
||||
uniform usamplerBuffer bufSamp3;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture_buffer
|
||||
uniform writeonly imageBuffer bufSamp4;
|
||||
uniform writeonly iimageBuffer bufSamp5;
|
||||
uniform writeonly uimageBuffer bufSamp6;
|
||||
#endif
|
||||
|
||||
void bufferT()
|
||||
{
|
||||
highp int s1 = textureSize(bufSamp1);
|
||||
highp int s2 = textureSize(bufSamp2);
|
||||
highp int s3 = textureSize(bufSamp3);
|
||||
|
||||
highp int s4 = imageSize(bufSamp4);
|
||||
highp int s5 = imageSize(bufSamp5);
|
||||
highp int s6 = imageSize(bufSamp6);
|
||||
|
||||
highp vec4 f1 = texelFetch(bufSamp1, s1);
|
||||
highp ivec4 f2 = texelFetch(bufSamp2, s2);
|
||||
highp uvec4 f3 = texelFetch(bufSamp3, s3);
|
||||
}
|
||||
|
||||
uniform writeonly imageCubeArray noPreCA1; // ERROR, no default precision
|
||||
uniform writeonly iimageCubeArray noPreCA2; // ERROR, no default precision
|
||||
uniform writeonly uimageCubeArray noPreCA3; // ERROR, no default precision
|
||||
|
||||
uniform samplerCubeArray noPreCA4; // ERROR, no default precision
|
||||
uniform samplerCubeArrayShadow noPreCA5; // ERROR, no default precision
|
||||
uniform isamplerCubeArray noPreCA6; // ERROR, no default precision
|
||||
uniform usamplerCubeArray noPreCA7; // ERROR, no default precision
|
||||
|
||||
precision highp imageCubeArray ;
|
||||
precision highp iimageCubeArray ;
|
||||
precision highp uimageCubeArray ;
|
||||
|
||||
precision highp samplerCubeArray ;
|
||||
precision highp samplerCubeArrayShadow;
|
||||
precision highp isamplerCubeArray ;
|
||||
precision highp usamplerCubeArray ;
|
||||
|
||||
uniform writeonly imageCubeArray CA1;
|
||||
uniform writeonly iimageCubeArray CA2;
|
||||
uniform writeonly uimageCubeArray CA3;
|
||||
|
||||
layout(rgba16f) uniform readonly imageCubeArray rCA1;
|
||||
layout(rgba32i) uniform readonly iimageCubeArray rCA2;
|
||||
layout(r32ui) uniform readonly uimageCubeArray rCA3;
|
||||
|
||||
#ifdef GL_OES_texture_cube_map_array
|
||||
uniform samplerCubeArray CA4;
|
||||
uniform samplerCubeArrayShadow CA5;
|
||||
uniform isamplerCubeArray CA6;
|
||||
uniform usamplerCubeArray CA7;
|
||||
#endif
|
||||
|
||||
void CAT()
|
||||
{
|
||||
highp ivec3 s4 = textureSize(CA4, 1);
|
||||
highp ivec3 s5 = textureSize(CA5, 1);
|
||||
highp ivec3 s6 = textureSize(CA6, 1);
|
||||
highp ivec3 s7 = textureSize(CA7, 1);
|
||||
|
||||
highp vec4 t4 = texture(CA4, vec4(0.5));
|
||||
highp float t5 = texture(CA5, vec4(0.5), 3.0);
|
||||
highp ivec4 t6 = texture(CA6, vec4(0.5));
|
||||
highp uvec4 t7 = texture(CA7, vec4(0.5));
|
||||
|
||||
highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24);
|
||||
highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26);
|
||||
highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27);
|
||||
|
||||
highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2));
|
||||
highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2));
|
||||
highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2));
|
||||
|
||||
highp vec4 gath4 = textureGather(CA4, vec4(0.5));
|
||||
highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2);
|
||||
highp ivec4 gath6 = textureGather(CA6, vec4(0.5));
|
||||
highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1);
|
||||
highp uvec4 gath7 = textureGather(CA7, vec4(0.5));
|
||||
highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0);
|
||||
|
||||
highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5);
|
||||
|
||||
highp ivec3 s1 = imageSize(CA1);
|
||||
highp ivec3 s2 = imageSize(CA2);
|
||||
highp ivec3 s3 = imageSize(CA3);
|
||||
|
||||
imageStore(CA1, s3, vec4(1));
|
||||
imageStore(CA2, s3, ivec4(1));
|
||||
imageStore(CA3, s3, uvec4(1));
|
||||
|
||||
highp vec4 cl1 = imageLoad(rCA1, s3);
|
||||
highp ivec4 cl2 = imageLoad(rCA2, s3);
|
||||
highp uvec4 cl3 = imageLoad(rCA3, s3);
|
||||
}
|
||||
|
||||
uniform sampler2DMSArray noPrec2DMS; // ERROR, no default
|
||||
uniform isampler2DMSArray noPrec2DMSi; // ERROR, no default
|
||||
uniform usampler2DMSArray noPrec2DMSu; // ERROR, no default
|
||||
|
||||
precision highp sampler2DMSArray;
|
||||
precision highp isampler2DMSArray;
|
||||
precision highp usampler2DMSArray;
|
||||
|
||||
uniform sampler2DMSArray samp2DMSA;
|
||||
uniform isampler2DMSArray samp2DMSAi;
|
||||
uniform usampler2DMSArray samp2DMSAu;
|
||||
|
||||
void MSA()
|
||||
{
|
||||
vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2);
|
||||
ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2);
|
||||
uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2);
|
||||
|
||||
ivec3 tfs = textureSize(samp2DMSA);
|
||||
ivec3 tfsi = textureSize(samp2DMSAi);
|
||||
ivec3 tfsb = textureSize(samp2DMSAi, 4); // ERROR, no lod
|
||||
ivec3 tfsu = textureSize(samp2DMSAu);
|
||||
}
|
||||
|
||||
uniform layout(r32f) highp image2D im2Df;
|
||||
uniform layout(r32ui) highp uimage2D im2Du;
|
||||
uniform layout(r32i) highp iimage2D im2Di;
|
||||
uniform ivec2 P;
|
||||
|
||||
void goodImageAtom()
|
||||
{
|
||||
float datf;
|
||||
int dati;
|
||||
uint datu;
|
||||
|
||||
imageAtomicAdd( im2Di, P, dati);
|
||||
imageAtomicAdd( im2Du, P, datu);
|
||||
imageAtomicMin( im2Di, P, dati);
|
||||
imageAtomicMin( im2Du, P, datu);
|
||||
imageAtomicMax( im2Di, P, dati);
|
||||
imageAtomicMax( im2Du, P, datu);
|
||||
imageAtomicAnd( im2Di, P, dati);
|
||||
imageAtomicAnd( im2Du, P, datu);
|
||||
imageAtomicOr( im2Di, P, dati);
|
||||
imageAtomicOr( im2Du, P, datu);
|
||||
imageAtomicXor( im2Di, P, dati);
|
||||
imageAtomicXor( im2Du, P, datu);
|
||||
imageAtomicExchange(im2Di, P, dati);
|
||||
imageAtomicExchange(im2Du, P, datu);
|
||||
imageAtomicExchange(im2Df, P, datf);
|
||||
imageAtomicCompSwap(im2Di, P, 3, dati);
|
||||
imageAtomicCompSwap(im2Du, P, 5u, datu);
|
||||
}
|
||||
|
||||
sample out vec4 colorSample;
|
||||
flat sample out vec4 colorfsi;
|
||||
sample out vec3 sampInArray[4];
|
||||
in vec4 inv4;
|
||||
|
||||
void badInterp()
|
||||
{
|
||||
interpolateAtCentroid(inv4); // ERROR, wrong stage
|
||||
interpolateAtSample(inv4, 1); // ERROR, need extension
|
||||
interpolateAtOffset(inv4, vec2(0.2)); // ERROR, need extension
|
||||
}
|
||||
152
third_party/glslang/Test/330.frag
vendored
152
third_party/glslang/Test/330.frag
vendored
@@ -1,152 +0,0 @@
|
||||
#version 330 compatibility
|
||||
|
||||
in vec4 inVar;
|
||||
layout(location=0, index=0) out vec4 outVar;
|
||||
|
||||
varying vec4 varyingVar;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = varyingVar; // link ERROR: user output was used
|
||||
gl_FragData[1] = inVar; // link ERROR: user output was used
|
||||
int buffer = 4;
|
||||
}
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in gl_PerFragment {
|
||||
vec4 gl_Color;
|
||||
};
|
||||
|
||||
void foo()
|
||||
{
|
||||
vec4 c = gl_Color;
|
||||
outVar = inVar;
|
||||
}
|
||||
|
||||
in gl_block { // ERROR
|
||||
int gl_i;
|
||||
} gl_name;
|
||||
|
||||
in myBlock {
|
||||
int gl_i; // ERROR
|
||||
} gl_name; // ERROR
|
||||
|
||||
in gl_PerVertex { // ERROR
|
||||
vec4 gl_FragCoord;
|
||||
} gl_in[];
|
||||
|
||||
in gl_PerVertex { // ERROR
|
||||
vec4 gl_FragCoord;
|
||||
}; // ERROR
|
||||
|
||||
const int start = 6;
|
||||
layout(location = -2) in vec4 v1; // ERROR
|
||||
layout(location = start + 2) in vec4 v2; // ERROR
|
||||
layout(location = 4.7e10) in vec4 v20; // ERROR
|
||||
layout(location = +60) in float v21; // ERROR
|
||||
layout(location = (2)) in float v22; // ERROR
|
||||
|
||||
struct S {
|
||||
float f1;
|
||||
layout(location = 3) float f2; // ERROR
|
||||
};
|
||||
|
||||
layout(location = 1) in inblock { // ERROR
|
||||
float f1;
|
||||
layout(location = 3) float f2; // ERROR
|
||||
};
|
||||
|
||||
layout(location = 1) uniform ublock { // ERROR
|
||||
float f1;
|
||||
layout(location = 3) float f2; // ERROR
|
||||
} uinst;
|
||||
|
||||
#extension GL_ARB_enhanced_layouts : enable
|
||||
|
||||
layout(location = start) in vec4 v3;
|
||||
layout(location = -2) in vec4 v4; // ERROR
|
||||
layout(location = -start) in vec4 v5; // ERROR
|
||||
layout(location = start*start - 2 - 4) in vec4 v6;
|
||||
layout(location = +61) in float v23;
|
||||
layout(location = (62)) in float v24;
|
||||
|
||||
struct S2 {
|
||||
float f1;
|
||||
layout(location = 3) float f2; // ERROR
|
||||
};
|
||||
|
||||
layout(location = 28) in inblock2 {
|
||||
bool b1;
|
||||
float f1;
|
||||
layout(location = 25) float f2;
|
||||
vec4 f3;
|
||||
layout(location = 21) S2 s2;
|
||||
vec4 f4;
|
||||
vec4 f5;
|
||||
} ininst2;
|
||||
|
||||
layout(location = 13) uniform ublock2 { // ERROR
|
||||
float f1;
|
||||
layout(location = 3) float f2; // ERROR
|
||||
} uinst2;
|
||||
|
||||
in inblock3 { // ERROR, mix of location internal with no location external
|
||||
float f1;
|
||||
layout(location = 40) float f2;
|
||||
} in3;
|
||||
|
||||
in ublock4 {
|
||||
layout(location = 50) float f1;
|
||||
layout(location = 51) float f2;
|
||||
} in4;
|
||||
|
||||
layout(location = 33) in struct SS {
|
||||
vec3 a; // gets location 33
|
||||
mat2 b; // gets locations 34 and 35
|
||||
vec4 c[2]; // gets locations 36 and 37
|
||||
layout (location = 38) vec2 A; // ERROR, can't use on struct member
|
||||
} s;
|
||||
|
||||
layout(location = 44) in block {
|
||||
vec4 d; // gets location 44
|
||||
vec4 e; // gets location 45
|
||||
layout(location = 47) vec4 f; // gets location 47
|
||||
vec4 g; // gets location 48
|
||||
layout (location = 41) vec4 h; // gets location 41
|
||||
vec4 i; // gets location 42
|
||||
vec4 j; // gets location 43
|
||||
vec4 k; // ERROR, location 44 already used
|
||||
};
|
||||
|
||||
layout(index=0) out vec4 outVar2; // ERROR: missing explicit location
|
||||
layout(location=0, index=1) out vec4 outVar3; // no error even though location is overlapping
|
||||
layout(location=0, index=1) out vec4 outVar4; // ERROR overlapping
|
||||
layout(location=27, index=0) in vec4 indexIn; // ERROR, not on in
|
||||
layout(location=0, index=0) in; // ERROR, not just on in
|
||||
layout(location=0, index=0) out; // ERROR, need a variable
|
||||
layout(location=26, index=0) out indexBlock { int a; } indexBlockI; // ERROR, not on a block
|
||||
|
||||
uniform sampler1D samp1D;
|
||||
uniform sampler2DShadow samp2Ds;
|
||||
|
||||
void qlod()
|
||||
{
|
||||
vec2 lod;
|
||||
float pf;
|
||||
vec2 pf2;
|
||||
vec3 pf3;
|
||||
|
||||
lod = textureQueryLod(samp1D, pf); // ERROR, not until 400
|
||||
lod = textureQueryLod(samp2Ds, pf2); // ERROR, not until 400
|
||||
}
|
||||
|
||||
int precise; // okay, not a keyword yet
|
||||
struct SKeyMem { int precise; } KeyMem; // okay, not a keyword yet
|
||||
|
||||
void fooKeyMem()
|
||||
{
|
||||
KeyMem.precise;
|
||||
}
|
||||
|
||||
layout(location=28, index=2) out vec4 outIndex2; // ERROR index out of range
|
||||
12
third_party/glslang/Test/330comp.frag
vendored
12
third_party/glslang/Test/330comp.frag
vendored
@@ -1,12 +0,0 @@
|
||||
#version 330 compatibility
|
||||
|
||||
in vec4 inVar;
|
||||
out vec4 outVar;
|
||||
|
||||
varying vec4 varyingVar;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = varyingVar;
|
||||
gl_FragData[1] = inVar * gl_ModelViewMatrix;
|
||||
}
|
||||
201
third_party/glslang/Test/400.frag
vendored
201
third_party/glslang/Test/400.frag
vendored
@@ -1,201 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
in vec2 c2D;
|
||||
flat in int i;
|
||||
out vec4 outp;
|
||||
uniform sampler2D arrayedSampler[5];
|
||||
uniform usampler2DRect samp2dr;
|
||||
uniform isampler2DArray isamp2DA;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 v;
|
||||
v = texture(arrayedSampler[i], c2D);
|
||||
outp.x = gl_ClipDistance[1];
|
||||
|
||||
ivec2 offsets[4];
|
||||
const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
|
||||
uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2); // ERROR, offsets not constant
|
||||
uv4 = textureGatherOffsets(samp2dr, c2D, constOffsets, 2);
|
||||
vec4 v4 = textureGather(arrayedSampler[0], c2D);
|
||||
ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
|
||||
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i));
|
||||
|
||||
vec4 c = gl_FragCoord;
|
||||
}
|
||||
|
||||
layout(location = 4) in vec4 vl; // ERROR, not supported
|
||||
|
||||
#ifdef GL_ARB_separate_shader_objects
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#endif
|
||||
|
||||
layout(location = 6) in vec4 vl2;
|
||||
|
||||
layout(location = 3) uniform vec3 uv3;
|
||||
|
||||
layout(location = 5) in vec4 gl_Color; // ERROR, layout
|
||||
noperspective in float gl_ClipDistance[4]; // ERROR, can't change qualifier
|
||||
|
||||
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, declared after use
|
||||
|
||||
uniform sampler2DRectShadow u2drs;
|
||||
|
||||
void foo23()
|
||||
{
|
||||
const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
|
||||
|
||||
textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), ivec2(c2D)); // ERROR, offset not constant
|
||||
textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), offsets[1]);
|
||||
textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), offsets[2]); // ERROR, offset out of range
|
||||
textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
|
||||
}
|
||||
|
||||
patch in vec4 patchIn; // ERROR
|
||||
patch out vec4 patchOut; // ERROR
|
||||
|
||||
void foo24()
|
||||
{
|
||||
dvec3 df, di;
|
||||
df = modf(dvec3(outp.xyz), di);
|
||||
}
|
||||
|
||||
in float in1;
|
||||
in vec2 in2;
|
||||
in vec3 in3;
|
||||
in vec4 in4;
|
||||
|
||||
void foodc1()
|
||||
{
|
||||
vec2 v2 = dFdxFine(in2); // ERROR
|
||||
vec3 v3 = dFdyCoarse(in3); // ERROR
|
||||
vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4); // ERROR
|
||||
}
|
||||
|
||||
#extension GL_ARB_derivative_control : enable
|
||||
|
||||
void foodc2()
|
||||
{
|
||||
vec2 v2 = dFdxFine(in2);
|
||||
vec3 v3 = dFdyCoarse(in3);
|
||||
vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4);
|
||||
|
||||
uint u1;
|
||||
ivec3 i3;
|
||||
ivec2 i2;
|
||||
v2 = frexp(v2, i2);
|
||||
v3 = ldexp(v3, i3);
|
||||
|
||||
u1 = packUnorm4x8(v4);
|
||||
u1 = packSnorm4x8(v4);
|
||||
v4 = unpackUnorm4x8(u1);
|
||||
v4 = unpackSnorm4x8(u1);
|
||||
|
||||
double d;
|
||||
uvec2 u2;
|
||||
d = packDouble2x32(u2);
|
||||
u2 = unpackDouble2x32(d);
|
||||
}
|
||||
|
||||
sample in vec4 colorSampIn;
|
||||
sample out vec4 colorSampleBad; // ERROR
|
||||
noperspective in vec4 colorfsi;
|
||||
sample in vec3 sampInArray[4];
|
||||
smooth in float scalarIn;
|
||||
flat centroid in vec2 colorfc;
|
||||
|
||||
struct S {
|
||||
float x;
|
||||
};
|
||||
|
||||
in S s1;
|
||||
sample S s2;
|
||||
|
||||
void interp()
|
||||
{
|
||||
interpolateAtCentroid(colorfc);
|
||||
interpolateAtCentroid(colorSampIn);
|
||||
interpolateAtCentroid(colorfsi);
|
||||
interpolateAtCentroid(scalarIn);
|
||||
interpolateAtCentroid(sampInArray); // ERROR
|
||||
interpolateAtCentroid(sampInArray[2]);
|
||||
interpolateAtCentroid(sampInArray[2].xy); // ERROR
|
||||
|
||||
interpolateAtSample(sampInArray, 1); // ERROR
|
||||
interpolateAtSample(sampInArray[i], 0);
|
||||
interpolateAtSample(s1.x, 2);
|
||||
interpolateAtSample(scalarIn, 1);
|
||||
|
||||
interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
|
||||
interpolateAtOffset(sampInArray[2], vec2(0.2));
|
||||
interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
|
||||
interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
|
||||
interpolateAtOffset(s2.x, vec2(0.2)); // ERROR
|
||||
|
||||
float f;
|
||||
interpolateAtCentroid(f); // ERROR, not interpolant
|
||||
interpolateAtSample(outp, 0); // ERROR, not interpolant
|
||||
}
|
||||
|
||||
uniform sampler1D samp1D;
|
||||
uniform isampler2D isamp2D;
|
||||
uniform usampler3D usamp3D;
|
||||
uniform samplerCube sampCube;
|
||||
uniform isampler1DArray isamp1DA;
|
||||
uniform usampler2DArray usamp2DA;
|
||||
uniform isamplerCubeArray isampCubeA;
|
||||
|
||||
uniform sampler1DShadow samp1Ds;
|
||||
uniform sampler2DShadow samp2Ds;
|
||||
uniform samplerCubeShadow sampCubes;
|
||||
uniform sampler1DArrayShadow samp1DAs;
|
||||
uniform sampler2DArrayShadow samp2DAs;
|
||||
uniform samplerCubeArrayShadow sampCubeAs;
|
||||
|
||||
uniform samplerBuffer sampBuf;
|
||||
uniform sampler2DRect sampRect;
|
||||
|
||||
void qlod()
|
||||
{
|
||||
vec2 lod;
|
||||
float pf;
|
||||
vec2 pf2;
|
||||
vec3 pf3;
|
||||
|
||||
lod = textureQueryLod(samp1D, pf);
|
||||
lod = textureQueryLod(isamp2D, pf2);
|
||||
lod = textureQueryLod(usamp3D, pf3);
|
||||
lod = textureQueryLod(sampCube, pf3);
|
||||
lod = textureQueryLod(isamp1DA, pf);
|
||||
lod = textureQueryLod(usamp2DA, pf2);
|
||||
lod = textureQueryLod(isampCubeA, pf3);
|
||||
|
||||
lod = textureQueryLod(samp1Ds, pf);
|
||||
lod = textureQueryLod(samp2Ds, pf2);
|
||||
lod = textureQueryLod(sampCubes, pf3);
|
||||
lod = textureQueryLod(samp1DAs, pf);
|
||||
lod = textureQueryLod(samp2DAs, pf2);
|
||||
lod = textureQueryLod(sampCubeAs, pf3);
|
||||
|
||||
lod = textureQueryLod(sampBuf, pf); // ERROR
|
||||
lod = textureQueryLod(sampRect, pf2); // ERROR
|
||||
}
|
||||
|
||||
uniform uint uu;
|
||||
out uint iout;
|
||||
|
||||
void bitwiseConv()
|
||||
{
|
||||
iout = uu & i;
|
||||
iout += uu ^ i;
|
||||
iout += i | uu;
|
||||
}
|
||||
|
||||
subroutine(subT1, subT2);
|
||||
subroutine float subT1() { return 1.0; }
|
||||
subroutine float subT2() { return 1.0; }
|
||||
|
||||
struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member
|
||||
330
third_party/glslang/Test/400.geom
vendored
330
third_party/glslang/Test/400.geom
vendored
@@ -1,330 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
void main()
|
||||
{
|
||||
EmitStreamVertex(1);
|
||||
EndStreamPrimitive(0);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
int id = gl_InvocationID;
|
||||
}
|
||||
|
||||
layout(invocations = 4) in outbn { int a; } bn[]; // ERROR, not on a block
|
||||
layout(max_vertices = 127) out;
|
||||
layout(invocations = 4) in;
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in gl_PerVertex { // testing input arrays with a block redeclaration, see 420.geom for without
|
||||
vec4 gl_Position;
|
||||
layout(std140, location = 3) patch float gl_PointSize; // ERRORs...
|
||||
} gl_in[];
|
||||
|
||||
void foo()
|
||||
{
|
||||
gl_in.length(); // ERROR
|
||||
gl_in[1].gl_Position;
|
||||
}
|
||||
|
||||
in vec4 color[];
|
||||
in vec4 color2[];
|
||||
in vec4 colorS[3];
|
||||
in vec4 colorBad[4];
|
||||
|
||||
void foo2()
|
||||
{
|
||||
color.length(); // ERROR
|
||||
colorS.length();
|
||||
}
|
||||
|
||||
layout(triangles) in; // give ERROR just for colorBad
|
||||
|
||||
in vec4 color[3];
|
||||
in vec4 color2[3];
|
||||
in vec4 colorbad2[2]; // ERROR
|
||||
|
||||
void foo3()
|
||||
{
|
||||
gl_in.length();
|
||||
color.length();
|
||||
color2.length();
|
||||
colorS.length();
|
||||
}
|
||||
|
||||
layout(location = 4) in vec4 cva[3];
|
||||
layout(location = 5) in vec4 cvb[3];
|
||||
layout(location = 2) in mat3 cmc[3]; // ERROR, collision
|
||||
|
||||
patch in vec4 patchIn[]; // ERROR
|
||||
patch out vec4 patchOut; // ERROR
|
||||
|
||||
in float scalar; // ERROR, no array
|
||||
|
||||
layout(max_vertices = 127, invocations = 4) out; // ERROR
|
||||
layout(invocations = 4, max_vertices = 127) in; // ERROR
|
||||
layout(max_vertices = 127, invocations = 4) uniform; // 2 ERRORs
|
||||
|
||||
in inblockscalar {
|
||||
int a;
|
||||
} inbls; // ERROR, not an array
|
||||
|
||||
in inblocka {
|
||||
int a;
|
||||
} inbla[17]; // ERROR, wrong array size
|
||||
|
||||
void bits()
|
||||
{
|
||||
uvec2 u2;
|
||||
u2 = uaddCarry(u2, u2, u2);
|
||||
uint u1;
|
||||
u1 = usubBorrow(u1, u1, u1);
|
||||
uvec4 u4;
|
||||
umulExtended(u4, u4, u4, u4);
|
||||
ivec4 i4;
|
||||
imulExtended(i4, i4, i4, i4);
|
||||
int i1;
|
||||
i1 = bitfieldExtract(i1, 4, 5);
|
||||
uvec3 u3;
|
||||
u3 = bitfieldExtract(u3, 4, 5);
|
||||
ivec3 i3;
|
||||
i3 = bitfieldInsert(i3, i3, 4, 5);
|
||||
u1 = bitfieldInsert(u1, u1, 4, 5);
|
||||
ivec2 i2;
|
||||
i2 = bitfieldReverse(i2);
|
||||
u4 = bitfieldReverse(u4);
|
||||
i1 = bitCount(i1);
|
||||
i3 = bitCount(u3);
|
||||
i2 = findLSB(i2);
|
||||
i4 = findLSB(u4);
|
||||
i1 = findMSB(i1);
|
||||
i2 = findMSB(u2);
|
||||
}
|
||||
|
||||
layout(location = 7, index = 1) out vec4 indexedOut;
|
||||
|
||||
uniform sampler1D samp1D;
|
||||
uniform sampler2DShadow samp2Ds;
|
||||
|
||||
void qlod()
|
||||
{
|
||||
vec2 lod;
|
||||
float pf;
|
||||
vec2 pf2;
|
||||
vec3 pf3;
|
||||
|
||||
lod = textureQueryLod(samp1D, pf); // ERROR, only in fragment
|
||||
lod = textureQueryLod(samp2Ds, pf2); // ERROR, only in fragment
|
||||
}
|
||||
|
||||
void doubles()
|
||||
{
|
||||
double doublev;
|
||||
dvec2 dvec2v;
|
||||
dvec3 dvec3v;
|
||||
dvec4 dvec4v;
|
||||
|
||||
bool boolv;
|
||||
bvec2 bvec2v;
|
||||
bvec3 bvec3v;
|
||||
bvec4 bvec4v;
|
||||
|
||||
doublev = sqrt(2.9);
|
||||
dvec2v = sqrt(dvec2(2.7));
|
||||
dvec3v = sqrt(dvec3(2.0));
|
||||
dvec4v = sqrt(dvec4(2.1));
|
||||
|
||||
doublev += inversesqrt(doublev);
|
||||
dvec2v += inversesqrt(dvec2v);
|
||||
dvec3v += inversesqrt(dvec3v);
|
||||
dvec4v += inversesqrt(dvec4v);
|
||||
|
||||
doublev += abs(doublev);
|
||||
dvec2v += abs(dvec2v);
|
||||
dvec3v += abs(dvec3v);
|
||||
dvec4v += abs(dvec4v);
|
||||
|
||||
doublev += sign(doublev);
|
||||
dvec2v += sign(dvec2v);
|
||||
dvec3v += sign(dvec3v);
|
||||
dvec4v += sign(dvec4v);
|
||||
|
||||
doublev += floor(doublev);
|
||||
dvec2v += floor(dvec2v);
|
||||
dvec3v += floor(dvec3v);
|
||||
dvec4v += floor(dvec4v);
|
||||
|
||||
doublev += trunc(doublev);
|
||||
dvec2v += trunc(dvec2v);
|
||||
dvec3v += trunc(dvec3v);
|
||||
dvec4v += trunc(dvec4v);
|
||||
|
||||
doublev += round(doublev);
|
||||
dvec2v += round(dvec2v);
|
||||
dvec3v += round(dvec3v);
|
||||
dvec4v += round(dvec4v);
|
||||
|
||||
doublev += roundEven(doublev);
|
||||
dvec2v += roundEven(dvec2v);
|
||||
dvec3v += roundEven(dvec3v);
|
||||
dvec4v += roundEven(dvec4v);
|
||||
|
||||
doublev += ceil(doublev);
|
||||
dvec2v += ceil(dvec2v);
|
||||
dvec3v += ceil(dvec3v);
|
||||
dvec4v += ceil(dvec4v);
|
||||
|
||||
doublev += fract(doublev);
|
||||
dvec2v += fract(dvec2v);
|
||||
dvec3v += fract(dvec3v);
|
||||
dvec4v += fract(dvec4v);
|
||||
|
||||
doublev += mod(doublev, doublev);
|
||||
dvec2v += mod(dvec2v, doublev);
|
||||
dvec3v += mod(dvec3v, doublev);
|
||||
dvec4v += mod(dvec4v, doublev);
|
||||
dvec2v += mod(dvec2v, dvec2v);
|
||||
dvec3v += mod(dvec3v, dvec3v);
|
||||
dvec4v += mod(dvec4v, dvec4v);
|
||||
|
||||
doublev += modf(doublev, doublev);
|
||||
dvec2v += modf(dvec2v, dvec2v);
|
||||
dvec3v += modf(dvec3v, dvec3v);
|
||||
dvec4v += modf(dvec4v, dvec4v);
|
||||
|
||||
doublev += min(doublev, doublev);
|
||||
dvec2v += min(dvec2v, doublev);
|
||||
dvec3v += min(dvec3v, doublev);
|
||||
dvec4v += min(dvec4v, doublev);
|
||||
dvec2v += min(dvec2v, dvec2v);
|
||||
dvec3v += min(dvec3v, dvec3v);
|
||||
dvec4v += min(dvec4v, dvec4v);
|
||||
|
||||
doublev += max(doublev, doublev);
|
||||
dvec2v += max(dvec2v, doublev);
|
||||
dvec3v += max(dvec3v, doublev);
|
||||
dvec4v += max(dvec4v, doublev);
|
||||
dvec2v += max(dvec2v, dvec2v);
|
||||
dvec3v += max(dvec3v, dvec3v);
|
||||
dvec4v += max(dvec4v, dvec4v);
|
||||
|
||||
doublev += clamp(doublev, doublev, doublev);
|
||||
dvec2v += clamp(dvec2v, doublev, doublev);
|
||||
dvec3v += clamp(dvec3v, doublev, doublev);
|
||||
dvec4v += clamp(dvec4v, doublev, doublev);
|
||||
dvec2v += clamp(dvec2v, dvec2v, dvec2v);
|
||||
dvec3v += clamp(dvec3v, dvec3v, dvec3v);
|
||||
dvec4v += clamp(dvec4v, dvec4v, dvec4v);
|
||||
|
||||
doublev += mix(doublev, doublev, doublev);
|
||||
dvec2v += mix(dvec2v, dvec2v, doublev);
|
||||
dvec3v += mix(dvec3v, dvec3v, doublev);
|
||||
dvec4v += mix(dvec4v, dvec4v, doublev);
|
||||
dvec2v += mix(dvec2v, dvec2v, dvec2v);
|
||||
dvec3v += mix(dvec3v, dvec3v, dvec3v);
|
||||
dvec4v += mix(dvec4v, dvec4v, dvec4v);
|
||||
doublev += mix(doublev, doublev, boolv);
|
||||
dvec2v += mix(dvec2v, dvec2v, bvec2v);
|
||||
dvec3v += mix(dvec3v, dvec3v, bvec3v);
|
||||
dvec4v += mix(dvec4v, dvec4v, bvec4v);
|
||||
|
||||
doublev += step(doublev, doublev);
|
||||
dvec2v += step(dvec2v, dvec2v);
|
||||
dvec3v += step(dvec3v, dvec3v);
|
||||
dvec4v += step(dvec4v, dvec4v);
|
||||
dvec2v += step(doublev, dvec2v);
|
||||
dvec3v += step(doublev, dvec3v);
|
||||
dvec4v += step(doublev, dvec4v);
|
||||
|
||||
doublev += smoothstep(doublev, doublev, doublev);
|
||||
dvec2v += smoothstep(dvec2v, dvec2v, dvec2v);
|
||||
dvec3v += smoothstep(dvec3v, dvec3v, dvec3v);
|
||||
dvec4v += smoothstep(dvec4v, dvec4v, dvec4v);
|
||||
dvec2v += smoothstep(doublev, doublev, dvec2v);
|
||||
dvec3v += smoothstep(doublev, doublev, dvec3v);
|
||||
dvec4v += smoothstep(doublev, doublev, dvec4v);
|
||||
|
||||
boolv = isnan(doublev);
|
||||
bvec2v = isnan(dvec2v);
|
||||
bvec3v = isnan(dvec3v);
|
||||
bvec4v = isnan(dvec4v);
|
||||
|
||||
boolv = boolv ? isinf(doublev) : false;
|
||||
bvec2v = boolv ? isinf(dvec2v) : bvec2(false);
|
||||
bvec3v = boolv ? isinf(dvec3v) : bvec3(false);
|
||||
bvec4v = boolv ? isinf(dvec4v) : bvec4(false);
|
||||
|
||||
doublev += length(doublev);
|
||||
doublev += length(dvec2v);
|
||||
doublev += length(dvec3v);
|
||||
doublev += length(dvec4v);
|
||||
|
||||
doublev += distance(doublev, doublev);
|
||||
doublev += distance(dvec2v, dvec2v);
|
||||
doublev += distance(dvec3v, dvec3v);
|
||||
doublev += distance(dvec4v, dvec4v);
|
||||
|
||||
doublev += dot(doublev, doublev);
|
||||
doublev += dot(dvec2v, dvec2v);
|
||||
doublev += dot(dvec3v, dvec3v);
|
||||
doublev += dot(dvec4v, dvec4v);
|
||||
|
||||
dvec3v += cross(dvec3v, dvec3v);
|
||||
|
||||
doublev += normalize(doublev);
|
||||
dvec2v += normalize(dvec2v);
|
||||
dvec3v += normalize(dvec3v);
|
||||
dvec4v += normalize(dvec4v);
|
||||
|
||||
doublev += faceforward(doublev, doublev, doublev);
|
||||
dvec2v += faceforward(dvec2v, dvec2v, dvec2v);
|
||||
dvec3v += faceforward(dvec3v, dvec3v, dvec3v);
|
||||
dvec4v += faceforward(dvec4v, dvec4v, dvec4v);
|
||||
|
||||
doublev += reflect(doublev, doublev);
|
||||
dvec2v += reflect(dvec2v, dvec2v);
|
||||
dvec3v += reflect(dvec3v, dvec3v);
|
||||
dvec4v += reflect(dvec4v, dvec4v);
|
||||
|
||||
doublev += refract(doublev, doublev, doublev);
|
||||
dvec2v += refract(dvec2v, dvec2v, doublev);
|
||||
dvec3v += refract(dvec3v, dvec3v, doublev);
|
||||
dvec4v += refract(dvec4v, dvec4v, doublev);
|
||||
|
||||
dmat2 dmat2v = outerProduct(dvec2v, dvec2v);
|
||||
dmat3 dmat3v = outerProduct(dvec3v, dvec3v);
|
||||
dmat4 dmat4v = outerProduct(dvec4v, dvec4v);
|
||||
dmat2x3 dmat2x3v = outerProduct(dvec3v, dvec2v);
|
||||
dmat3x2 dmat3x2v = outerProduct(dvec2v, dvec3v);
|
||||
dmat2x4 dmat2x4v = outerProduct(dvec4v, dvec2v);
|
||||
dmat4x2 dmat4x2v = outerProduct(dvec2v, dvec4v);
|
||||
dmat3x4 dmat3x4v = outerProduct(dvec4v, dvec3v);
|
||||
dmat4x3 dmat4x3v = outerProduct(dvec3v, dvec4v);
|
||||
|
||||
dmat2v *= matrixCompMult(dmat2v, dmat2v);
|
||||
dmat3v *= matrixCompMult(dmat3v, dmat3v);
|
||||
dmat4v *= matrixCompMult(dmat4v, dmat4v);
|
||||
dmat2x3v = matrixCompMult(dmat2x3v, dmat2x3v);
|
||||
dmat2x4v = matrixCompMult(dmat2x4v, dmat2x4v);
|
||||
dmat3x2v = matrixCompMult(dmat3x2v, dmat3x2v);
|
||||
dmat3x4v = matrixCompMult(dmat3x4v, dmat3x4v);
|
||||
dmat4x2v = matrixCompMult(dmat4x2v, dmat4x2v);
|
||||
dmat4x3v = matrixCompMult(dmat4x3v, dmat4x3v);
|
||||
|
||||
dmat2v *= transpose(dmat2v);
|
||||
dmat3v *= transpose(dmat3v);
|
||||
dmat4v *= transpose(dmat4v);
|
||||
dmat2x3v = transpose(dmat3x2v);
|
||||
dmat3x2v = transpose(dmat2x3v);
|
||||
dmat2x4v = transpose(dmat4x2v);
|
||||
dmat4x2v = transpose(dmat2x4v);
|
||||
dmat3x4v = transpose(dmat4x3v);
|
||||
dmat4x3v = transpose(dmat3x4v);
|
||||
|
||||
doublev += determinant(dmat2v);
|
||||
doublev += determinant(dmat3v);
|
||||
doublev += determinant(dmat4v);
|
||||
|
||||
dmat2v *= inverse(dmat2v);
|
||||
dmat3v *= inverse(dmat3v);
|
||||
dmat4v *= inverse(dmat4v);
|
||||
}
|
||||
125
third_party/glslang/Test/400.tesc
vendored
125
third_party/glslang/Test/400.tesc
vendored
@@ -1,125 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
layout(vertices = 4) out;
|
||||
int outa[gl_out.length()];
|
||||
|
||||
layout(quads) in; // ERROR
|
||||
layout(ccw) out; // ERROR
|
||||
layout(fractional_even_spacing) in; // ERROR
|
||||
|
||||
patch in vec4 patchIn; // ERROR
|
||||
patch out vec4 patchOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier();
|
||||
|
||||
int a = gl_MaxTessControlInputComponents +
|
||||
gl_MaxTessControlOutputComponents +
|
||||
gl_MaxTessControlTextureImageUnits +
|
||||
gl_MaxTessControlUniformComponents +
|
||||
gl_MaxTessControlTotalOutputComponents;
|
||||
|
||||
vec4 p = gl_in[1].gl_Position;
|
||||
float ps = gl_in[1].gl_PointSize;
|
||||
float cd = gl_in[1].gl_ClipDistance[2];
|
||||
|
||||
int pvi = gl_PatchVerticesIn;
|
||||
int pid = gl_PrimitiveID;
|
||||
int iid = gl_InvocationID;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = p;
|
||||
gl_out[gl_InvocationID].gl_PointSize = ps;
|
||||
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd;
|
||||
|
||||
gl_TessLevelOuter[3] = 3.2;
|
||||
gl_TessLevelInner[1] = 1.3;
|
||||
|
||||
if (a > 10)
|
||||
barrier(); // ERROR
|
||||
else
|
||||
barrier(); // ERROR
|
||||
|
||||
barrier();
|
||||
|
||||
do {
|
||||
barrier(); // ERROR
|
||||
} while (a > 10);
|
||||
|
||||
switch (a) {
|
||||
default:
|
||||
barrier(); // ERROR
|
||||
break;
|
||||
}
|
||||
a < 12 ? a : (barrier(), a); // ERROR
|
||||
{
|
||||
barrier();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
barrier(); // ERROR
|
||||
}
|
||||
|
||||
layout(vertices = 4) in; // ERROR
|
||||
layout(vertices = 5) out; // ERROR
|
||||
|
||||
void foo()
|
||||
{
|
||||
gl_out[4].gl_PointSize; // ERROR
|
||||
|
||||
barrier(); // ERROR
|
||||
}
|
||||
|
||||
in vec2 ina; // ERROR, not array
|
||||
in vec2 inb[];
|
||||
in vec2 inc[18]; // ERROR, wrong size
|
||||
in vec2 ind[gl_MaxPatchVertices];
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
layout(location = 3) in vec4 ivla[];
|
||||
layout(location = 4) in vec4 ivlb[];
|
||||
layout(location = 4) in vec4 ivlc[]; // ERROR, overlapping
|
||||
|
||||
layout(location = 3) out vec4 ovla[];
|
||||
layout(location = 4) out vec4 ovlb[];
|
||||
layout(location = 4) out vec4 ovlc[]; // ERROR, overlapping
|
||||
|
||||
precise vec3 pv3;
|
||||
|
||||
void foop()
|
||||
{
|
||||
precise double d;
|
||||
|
||||
pv3 *= pv3;
|
||||
pv3 = fma(pv3, pv3, pv3);
|
||||
d = fma(d, d, d);
|
||||
}
|
||||
|
||||
patch out pinbn {
|
||||
int a;
|
||||
} pinbi;
|
||||
|
||||
invariant precise out vec4 badOrder[]; // ERROR, precise must appear first
|
||||
void badp(out precise float f); // ERROR, precise must appear first
|
||||
|
||||
void devi()
|
||||
{
|
||||
gl_DeviceIndex; // ERROR, no extension
|
||||
gl_ViewIndex; // ERROR, no extension
|
||||
}
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_device_group : enable
|
||||
#endif
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_multiview : enable
|
||||
#endif
|
||||
|
||||
void devie()
|
||||
{
|
||||
gl_DeviceIndex;
|
||||
gl_ViewIndex;
|
||||
}
|
||||
125
third_party/glslang/Test/400.tese
vendored
125
third_party/glslang/Test/400.tese
vendored
@@ -1,125 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
layout(vertices = 4) out; // ERROR
|
||||
layout(quads, cw) in;
|
||||
layout(triangles) in; // ERROR
|
||||
layout(isolines) in; // ERROR
|
||||
|
||||
layout(ccw) in; // ERROR
|
||||
layout(cw) in;
|
||||
|
||||
layout(fractional_odd_spacing) in;
|
||||
layout(equal_spacing) in; // ERROR
|
||||
layout(fractional_even_spacing) in; // ERROR
|
||||
|
||||
layout(point_mode) in;
|
||||
|
||||
patch in vec4 patchIn;
|
||||
patch out vec4 patchOut; // ERROR
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier(); // ERROR
|
||||
|
||||
int a = gl_MaxTessEvaluationInputComponents +
|
||||
gl_MaxTessEvaluationOutputComponents +
|
||||
gl_MaxTessEvaluationTextureImageUnits +
|
||||
gl_MaxTessEvaluationUniformComponents +
|
||||
gl_MaxTessPatchComponents +
|
||||
gl_MaxPatchVertices +
|
||||
gl_MaxTessGenLevel;
|
||||
|
||||
vec4 p = gl_in[1].gl_Position;
|
||||
float ps = gl_in[1].gl_PointSize;
|
||||
float cd = gl_in[1].gl_ClipDistance[2];
|
||||
|
||||
int pvi = gl_PatchVerticesIn;
|
||||
int pid = gl_PrimitiveID;
|
||||
vec3 tc = gl_TessCoord;
|
||||
float tlo = gl_TessLevelOuter[3];
|
||||
float tli = gl_TessLevelInner[1];
|
||||
|
||||
gl_Position = p;
|
||||
gl_PointSize = ps;
|
||||
gl_ClipDistance[2] = cd;
|
||||
}
|
||||
|
||||
smooth patch in vec4 badp1; // ERROR
|
||||
flat patch in vec4 badp2; // ERROR
|
||||
noperspective patch in vec4 badp3; // ERROR
|
||||
patch sample in vec3 badp4; // ERROR
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in gl_PerVertex
|
||||
{
|
||||
float gl_ClipDistance[1];
|
||||
} gl_in[];
|
||||
|
||||
in gl_PerVertex // ERROR, second redeclaration of gl_in
|
||||
{
|
||||
float gl_ClipDistance[1];
|
||||
} gl_in[];
|
||||
|
||||
layout(quads, cw) out; // ERROR
|
||||
layout(triangles) out; // ERROR
|
||||
layout(isolines) out; // ERROR
|
||||
layout(cw) out; // ERROR
|
||||
layout(fractional_odd_spacing) out; // ERROR
|
||||
layout(equal_spacing) out; // ERROR
|
||||
layout(fractional_even_spacing) out; // ERROR
|
||||
layout(point_mode) out; // ERROR
|
||||
|
||||
in vec2 ina; // ERROR, not array
|
||||
in vec2 inb[];
|
||||
in vec2 inc[18]; // ERROR, wrong size
|
||||
in vec2 ind[gl_MaxPatchVertices];
|
||||
|
||||
in testbla {
|
||||
int f;
|
||||
} bla; // ERROR, not array
|
||||
|
||||
in testblb {
|
||||
int f;
|
||||
} blb[];
|
||||
|
||||
in testblc {
|
||||
int f;
|
||||
} blc[18]; // ERROR wrong size
|
||||
|
||||
in testbld {
|
||||
int f;
|
||||
} bld[gl_MaxPatchVertices];
|
||||
|
||||
layout(location = 23) in vec4 ivla[];
|
||||
layout(location = 24) in vec4 ivlb[];
|
||||
layout(location = 24) in vec4 ivlc[]; // ERROR
|
||||
|
||||
layout(location = 23) out vec4 ovla[2];
|
||||
layout(location = 24) out vec4 ovlb[2]; // ERROR
|
||||
|
||||
in float gl_TessLevelOuter[4]; // ERROR, can't redeclare
|
||||
|
||||
patch in pinbn {
|
||||
int a;
|
||||
} pinbi;
|
||||
|
||||
void devi()
|
||||
{
|
||||
gl_DeviceIndex; // ERROR, no extension
|
||||
gl_ViewIndex; // ERROR, no extension
|
||||
}
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_device_group : enable
|
||||
#endif
|
||||
|
||||
#ifdef GL_EXT_device_group
|
||||
#extension GL_EXT_multiview : enable
|
||||
#endif
|
||||
|
||||
void devie()
|
||||
{
|
||||
gl_DeviceIndex;
|
||||
gl_ViewIndex;
|
||||
}
|
||||
106
third_party/glslang/Test/400.vert
vendored
106
third_party/glslang/Test/400.vert
vendored
@@ -1,106 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
in double d; // ERROR, no doubles
|
||||
in dvec3 d3; // ERROR, no doubles
|
||||
in dmat4 dm4; // ERROR, no doubles
|
||||
|
||||
// function selection under type conversion
|
||||
void foo1(double a, uint b) {}
|
||||
void foo1(double a, int b) {}
|
||||
void foo1(double a, float b) {}
|
||||
void foo1(double a, double b){}
|
||||
|
||||
void foo2(double a, float b) {}
|
||||
void foo2(double a, double b){}
|
||||
|
||||
void foo3(double a, float b) {}
|
||||
void foo3(float a, double b) {}
|
||||
|
||||
void ftd( int, float, double) {}
|
||||
void ftd( uint, float, double) {}
|
||||
void ftd(float, double, double) {}
|
||||
|
||||
void main()
|
||||
{
|
||||
double d;
|
||||
uint u;
|
||||
int i;
|
||||
float f;
|
||||
|
||||
foo1(d, d);
|
||||
foo1(d, u);
|
||||
foo1(d, i);
|
||||
foo1(d, f);
|
||||
|
||||
foo1(f, d);
|
||||
foo1(f, u);
|
||||
foo1(f, i);
|
||||
foo1(f, f);
|
||||
|
||||
foo1(u, d);
|
||||
foo1(u, u);
|
||||
foo1(u, i);
|
||||
foo1(u, f);
|
||||
|
||||
foo1(i, d);
|
||||
foo1(i, u);
|
||||
foo1(i, i);
|
||||
foo1(i, f);
|
||||
|
||||
foo2(d, d);
|
||||
foo2(d, u);
|
||||
foo2(d, i);
|
||||
foo2(d, f);
|
||||
|
||||
foo2(f, d);
|
||||
foo2(f, u);
|
||||
foo2(f, i);
|
||||
foo2(f, f);
|
||||
|
||||
foo2(u, d);
|
||||
foo2(u, u);
|
||||
foo2(u, i);
|
||||
foo2(u, f);
|
||||
|
||||
foo2(i, d);
|
||||
foo2(i, u);
|
||||
foo2(i, i);
|
||||
foo2(i, f);
|
||||
|
||||
foo3(d, d); // ERROR, no match
|
||||
foo3(d, u);
|
||||
foo3(d, i);
|
||||
foo3(d, f);
|
||||
|
||||
foo3(f, d);
|
||||
foo3(f, u); // ERROR, ambiguous
|
||||
foo3(f, i); // ERROR, ambiguous
|
||||
foo3(f, f); // ERROR, ambiguous
|
||||
|
||||
foo3(u, d);
|
||||
foo3(u, u); // ERROR, ambiguous
|
||||
foo3(u, i); // ERROR, ambiguous
|
||||
foo3(u, f); // ERROR, ambiguous
|
||||
|
||||
foo3(i, d);
|
||||
foo3(i, u); // ERROR, ambiguous
|
||||
foo3(i, i); // ERROR, ambiguous
|
||||
foo3(i, f); // ERROR, ambiguous
|
||||
|
||||
ftd(i, f, f);
|
||||
ftd(u, f, f);
|
||||
}
|
||||
|
||||
void itf(int, float, int);
|
||||
void itf(int, double, int);
|
||||
|
||||
void tf()
|
||||
{
|
||||
double d;
|
||||
uint u;
|
||||
int i;
|
||||
float f;
|
||||
|
||||
itf(i, i, i);
|
||||
itf(i, u, i);
|
||||
}
|
||||
39
third_party/glslang/Test/410.geom
vendored
39
third_party/glslang/Test/410.geom
vendored
@@ -1,39 +0,0 @@
|
||||
#version 410 core
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_ViewportIndex = 7;
|
||||
}
|
||||
|
||||
in gl_PerVertex {
|
||||
float gl_PointSize;
|
||||
} myIn[]; // ERROR, can't redeclare a different name
|
||||
|
||||
in gl_PerVertex {
|
||||
float gl_PointSize;
|
||||
} gl_myIn[]; // ERROR, can't redeclare a different name
|
||||
|
||||
in gl_PerVertex {
|
||||
float gl_PointSize;
|
||||
} gl_in[];
|
||||
|
||||
in gl_PerVertex {
|
||||
float gl_PointSize;
|
||||
} gl_in[]; // ERROR, can't do it again
|
||||
|
||||
out gl_PerVertex {
|
||||
float gl_PointSize;
|
||||
};
|
||||
|
||||
void foo()
|
||||
{
|
||||
float p = gl_in[1].gl_PointSize; // use of redeclared
|
||||
gl_PointSize = p; // use of redeclared
|
||||
vec4 v = gl_in[1].gl_Position; // ERROR, not included in the redeclaration
|
||||
gl_Position = vec4(1.0); // ERROR, not included in the redeclaration
|
||||
}
|
||||
|
||||
float foo5()
|
||||
{
|
||||
return 4; // implicit conversion of return type
|
||||
}
|
||||
11
third_party/glslang/Test/410.tesc
vendored
11
third_party/glslang/Test/410.tesc
vendored
@@ -1,11 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
// no layout(vertices = ...) out;
|
||||
int outa[gl_out.length()]; // ERROR
|
||||
|
||||
patch out vec4 patchOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
||||
9
third_party/glslang/Test/410.vert
vendored
9
third_party/glslang/Test/410.vert
vendored
@@ -1,9 +0,0 @@
|
||||
#version 410 core
|
||||
|
||||
in double d;
|
||||
in dvec3 d3;
|
||||
in dmat4 dm4;
|
||||
|
||||
void main()
|
||||
{
|
||||
}
|
||||
30
third_party/glslang/Test/420.comp
vendored
30
third_party/glslang/Test/420.comp
vendored
@@ -1,30 +0,0 @@
|
||||
#version 420
|
||||
|
||||
layout(local_size_x = 2) in; // ERROR, no compute
|
||||
|
||||
#extension GL_ARB_compute_shader : enable
|
||||
|
||||
layout(local_size_x = 2, local_size_y = 4, local_size_z = 6) in;
|
||||
|
||||
shared vec3 sfoo;
|
||||
|
||||
void main()
|
||||
{
|
||||
sfoo = vec3(gl_WorkGroupSize.x, gl_WorkGroupSize.y, gl_WorkGroupSize.z);
|
||||
sfoo += gl_WorkGroupSize + gl_NumWorkGroups + gl_WorkGroupID + gl_LocalInvocationID + gl_GlobalInvocationID;
|
||||
sfoo *= gl_LocalInvocationIndex;
|
||||
sfoo += gl_MaxComputeWorkGroupCount + gl_MaxComputeWorkGroupSize;
|
||||
sfoo *= gl_MaxComputeUniformComponents +
|
||||
gl_MaxComputeTextureImageUnits +
|
||||
gl_MaxComputeImageUniforms +
|
||||
gl_MaxComputeAtomicCounters +
|
||||
gl_MaxComputeAtomicCounterBuffers;
|
||||
|
||||
barrier();
|
||||
memoryBarrier();
|
||||
memoryBarrierAtomicCounter();
|
||||
memoryBarrierBuffer();
|
||||
memoryBarrierImage();
|
||||
memoryBarrierShared();
|
||||
groupMemoryBarrier();
|
||||
}
|
||||
14
third_party/glslang/Test/420.frag
vendored
14
third_party/glslang/Test/420.frag
vendored
@@ -1,14 +0,0 @@
|
||||
#version 420 core
|
||||
|
||||
layout(depth_any) out float gl_FragDepth;
|
||||
layout(depth_greater) out float gl_FragDepth; // ERROR: redeclaration with different qualifier
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragDepth = 0.3;
|
||||
}
|
||||
|
||||
layout(depth_less) in float depth; // ERROR: depth_less only applies to gl_FragDepth
|
||||
layout(depth_any) out float gl_FragDepth; // ERROR, done after use
|
||||
|
||||
layout(binding=0) uniform atomic_uint a[];
|
||||
55
third_party/glslang/Test/420.geom
vendored
55
third_party/glslang/Test/420.geom
vendored
@@ -1,55 +0,0 @@
|
||||
#version 420 core
|
||||
|
||||
// testing input arrays without a gl_in[] block redeclaration, see 400.geom for with
|
||||
|
||||
int i;
|
||||
|
||||
void foo()
|
||||
{
|
||||
gl_in.length(); // ERROR
|
||||
gl_in[1].gl_Position;
|
||||
gl_in[i].gl_Position; // ERROR
|
||||
}
|
||||
|
||||
layout(triangles) in;
|
||||
|
||||
in vec4 color3[3];
|
||||
|
||||
void foo3()
|
||||
{
|
||||
gl_in.length();
|
||||
gl_in[i].gl_Position;
|
||||
color3.length();
|
||||
}
|
||||
|
||||
uniform sampler2D s2D;
|
||||
in vec2 coord[];
|
||||
uniform vec4 v4;
|
||||
|
||||
void foo4()
|
||||
{
|
||||
const ivec2 offsets[5] =
|
||||
{
|
||||
ivec2(0,1),
|
||||
ivec2(1,-2),
|
||||
ivec2(0,3),
|
||||
ivec2(-3,0),
|
||||
ivec2(2,1)
|
||||
};
|
||||
|
||||
vec4 v = textureGatherOffset(s2D, coord[0], offsets[i].xy);
|
||||
|
||||
offsets[i].xy = ivec2(3); // ERROR
|
||||
v4.x = 3.2; // ERROR
|
||||
v4.xy; // should have non-uniform type
|
||||
}
|
||||
|
||||
out gl_PerVertex {
|
||||
float gl_PointSize[1]; // ERROR, adding array
|
||||
float gl_ClipDistance; // ERROR, removing array
|
||||
};
|
||||
|
||||
float foo5()
|
||||
{
|
||||
return i; // implicit conversion of return type
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user