mirror of
https://github.com/libretro/parallel-gx1.git
synced 2026-11-07 04:26:01 -10:00
Remove glslang and SPIRV-Cross
Every backend compiles its shaders through rslc now: the two submodules, VideoCommon/Spirv.cpp and their build go.
This commit is contained in:
1 parent
9d1e91e8d1
commit
f073fc9448
11 files changed
+9
-471
No files matched your search
@@ -10,10 +10,6 @@
|
||||
path = Externals/libusb/libusb
|
||||
url = https://github.com/libusb/libusb.git
|
||||
shallow = true
|
||||
[submodule "Externals/spirv_cross/SPIRV-Cross"]
|
||||
path = Externals/spirv_cross/SPIRV-Cross
|
||||
url = https://github.com/KhronosGroup/SPIRV-Cross.git
|
||||
shallow = true
|
||||
[submodule "Externals/zlib-ng/zlib-ng"]
|
||||
path = Externals/zlib-ng/zlib-ng
|
||||
url = https://github.com/zlib-ng/zlib-ng.git
|
||||
@@ -82,10 +78,6 @@
|
||||
path = Externals/zstd/zstd
|
||||
url = https://github.com/facebook/zstd.git
|
||||
shallow = true
|
||||
[submodule "Externals/glslang/glslang"]
|
||||
path = Externals/glslang/glslang
|
||||
url = https://github.com/KhronosGroup/glslang.git
|
||||
shallow = true
|
||||
[submodule "Externals/pugixml/pugixml"]
|
||||
path = Externals/pugixml/pugixml
|
||||
url = https://github.com/zeux/pugixml.git
|
||||
|
||||
Vendored
-1
Submodule Externals/glslang/glslang deleted from a57276bf55.
Vendored
-1
Submodule Externals/spirv_cross/SPIRV-Cross deleted from ebe2aa0cd8.
@@ -81,7 +81,6 @@ HAVE_LIBUSB := 0
|
||||
HAVE_HIDAPI := 0
|
||||
HAVE_CPPIPC := 0
|
||||
HAVE_D3D := 0
|
||||
HAVE_SPIRV_CROSS := 0
|
||||
HAVE_BUNDLED_ICONV := 0
|
||||
|
||||
FLAGS :=
|
||||
@@ -129,7 +128,6 @@ else ifeq ($(platform), osx)
|
||||
LDFLAGS += $(TARGET_RULE) -Wl,-dead_strip
|
||||
HAVE_LIBUSB := 1
|
||||
HAVE_HIDAPI := 1
|
||||
HAVE_SPIRV_CROSS := 1
|
||||
HAVE_BUNDLED_ICONV := 1
|
||||
LIBS += -framework AppKit -framework CoreFoundation -framework Foundation \
|
||||
-framework IOKit -framework CoreServices -framework IOBluetooth \
|
||||
@@ -160,7 +158,6 @@ else ifneq (,$(filter ios-arm64 tvos-arm64,$(platform)))
|
||||
CXX = c++ -arch arm64 -isysroot $(IOSSDK)
|
||||
FLAGS += $(MINVER_FLAG) -DIPHONEOS
|
||||
LDFLAGS += $(MINVER_FLAG)
|
||||
HAVE_SPIRV_CROSS := 1
|
||||
HAVE_BUNDLED_ICONV := 1
|
||||
LIBS += -framework CoreFoundation -framework Foundation -framework IOKit -lobjc -lresolv
|
||||
|
||||
|
||||
+3
-115
@@ -6,7 +6,7 @@
|
||||
# OS_WIN / OS_ANDROID / OS_UNIX OS family (OS_UNIX: Linux, webOS)
|
||||
# OS_APPLE, with OS_MACOS or OS_IOS Apple (OS_IOS covers iOS and tvOS)
|
||||
# HAVE_LIBUSB HAVE_HIDAPI HAVE_CPPIPC optional components
|
||||
# HAVE_VULKAN HAVE_D3D HAVE_SPIRV_CROSS
|
||||
# HAVE_VULKAN HAVE_D3D
|
||||
# HAVE_BUNDLED_ICONV Externals/libiconv instead of libc
|
||||
#
|
||||
# Units only the standalone frontends use are left out.
|
||||
@@ -23,7 +23,6 @@ SRC_DIR := $(CORE_DIR)/Source/Core
|
||||
# Externals/<library>/makefile instead.
|
||||
ZLIBNG_DIR := $(EXT_DIR)/zlib-ng/zlib-ng
|
||||
ZLIBNG_GEN_DIR := $(GEN_DIR)/Externals/zlib-ng/zlib-ng
|
||||
GLSLANG_GEN_DIR := $(GEN_DIR)/include/glslang
|
||||
SCMREV_H := $(GEN_DIR)/Source/Core/Common/scmrev.h
|
||||
MGBA_VERSION_C := $(GEN_DIR)/Externals/mGBA/mgba/version.c
|
||||
|
||||
@@ -31,8 +30,7 @@ GEN_HEADERS := \
|
||||
$(SCMREV_H) \
|
||||
$(ZLIBNG_GEN_DIR)/zlib.h \
|
||||
$(ZLIBNG_GEN_DIR)/zconf.h \
|
||||
$(ZLIBNG_GEN_DIR)/zlib_name_mangling.h \
|
||||
$(GLSLANG_GEN_DIR)/build_info.h
|
||||
$(ZLIBNG_GEN_DIR)/zlib_name_mangling.h
|
||||
|
||||
$(ZLIBNG_GEN_DIR)/zlib.h: $(ZLIBNG_DIR)/zlib.h.in
|
||||
@mkdir -p $(@D)
|
||||
@@ -50,15 +48,6 @@ $(ZLIBNG_GEN_DIR)/zlib_name_mangling.h: $(ZLIBNG_DIR)/zlib_name_mangling.h.empty
|
||||
@mkdir -p $(@D)
|
||||
cp $< $@
|
||||
|
||||
GLSLANG_VERSION := $(shell sed -n 's/^\#\# \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \2 \3/p' $(EXT_DIR)/glslang/glslang/CHANGES.md | head -n 1)
|
||||
|
||||
$(GLSLANG_GEN_DIR)/build_info.h: $(EXT_DIR)/glslang/glslang/build_info.h.tmpl $(EXT_DIR)/glslang/glslang/CHANGES.md
|
||||
@mkdir -p $(@D)
|
||||
sed -e 's/@major@/$(word 1,$(GLSLANG_VERSION))/' \
|
||||
-e 's/@minor@/$(word 2,$(GLSLANG_VERSION))/' \
|
||||
-e 's/@patch@/$(word 3,$(GLSLANG_VERSION))/' \
|
||||
-e 's/@flavor@//' $< > $@
|
||||
|
||||
# scmrev.h and mGBA's version.c carry the revision the tree is at, so they
|
||||
# are rewritten at parse time, but only touched when their content changes.
|
||||
HASH := \#
|
||||
@@ -513,62 +502,6 @@ FMT_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Externals/fmt/fmt/src/format.cc \
|
||||
$(CORE_DIR)/Externals/fmt/fmt/src/os.cc
|
||||
|
||||
# GLSLANG
|
||||
GLSLANG_SOURCES_C :=
|
||||
GLSLANG_SOURCES_CXX :=
|
||||
GLSLANG_SOURCES_ASM :=
|
||||
GLSLANG_SOURCES_OBJCXX :=
|
||||
GLSLANG_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/stub.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/CInterface/glslang_c_interface.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/GenericCodeGen/CodeGen.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/GenericCodeGen/Link.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/glslang_tab.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/attribute.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/Constant.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/iomapper.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/InfoSink.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/Initialize.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/IntermTraverse.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/ParseContextBase.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/PoolAlloc.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/RemoveTree.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/Scan.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/SpirvIntrinsics.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/SymbolTable.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/Versions.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/intermOut.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/limits.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/linkValidate.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/parseConst.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/reflection.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/MachineIndependent/propagateNoContraction.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/GlslangToSpv.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/InReadableOrder.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/Logger.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/SpvBuilder.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/SpvPostProcess.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/doc.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/SpvTools.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/disassemble.cpp \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/SPIRV/CInterface/spirv_c_interface.cpp
|
||||
ifneq ($(OS_WIN),1)
|
||||
GLSLANG_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/OSDependent/Unix/ossource.cpp
|
||||
endif
|
||||
ifeq ($(OS_WIN),1)
|
||||
GLSLANG_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Externals/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp
|
||||
endif
|
||||
|
||||
# HIDAPI
|
||||
HIDAPI_SOURCES_C :=
|
||||
HIDAPI_SOURCES_CXX :=
|
||||
@@ -1645,11 +1578,6 @@ ifneq (,$(filter 1,$(OS_UNIX) $(OS_APPLE)))
|
||||
DOLPHIN_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Source/Core/Common/Logging/ConsoleListenerNix.cpp
|
||||
endif
|
||||
# Metal still takes its shaders through glslang and SPIRV-Cross
|
||||
ifeq ($(HAVE_SPIRV_CROSS),1)
|
||||
DOLPHIN_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Source/Core/VideoCommon/Spirv.cpp
|
||||
endif
|
||||
ifeq ($(OS_UNIX),1)
|
||||
DOLPHIN_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Source/Core/Common/MemArenaUnix.cpp
|
||||
@@ -1854,24 +1782,6 @@ CPPIPC_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Externals/cpp-ipc/cpp-ipc/src/libipc/mem/new.cpp \
|
||||
$(CORE_DIR)/Externals/cpp-ipc/cpp-ipc/src/libipc/mem/new_delete_resource.cpp
|
||||
|
||||
# SPIRV_CROSS
|
||||
SPIRV_CROSS_SOURCES_C :=
|
||||
SPIRV_CROSS_SOURCES_CXX :=
|
||||
SPIRV_CROSS_SOURCES_ASM :=
|
||||
SPIRV_CROSS_SOURCES_OBJCXX :=
|
||||
SPIRV_CROSS_SOURCES_CXX += \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_cfg.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_cpp.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_cross.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_cross_c.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_cross_parsed_ir.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_cross_util.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_glsl.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_hlsl.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_msl.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_parser.cpp \
|
||||
$(CORE_DIR)/Externals/spirv_cross/SPIRV-Cross/spirv_reflect.cpp
|
||||
|
||||
# ADRENOTOOLS
|
||||
ADRENOTOOLS_SOURCES_C :=
|
||||
ADRENOTOOLS_SOURCES_CXX :=
|
||||
@@ -1925,16 +1835,6 @@ MBEDTLS_FLAGS := -w -O2 -I$(EXT_DIR)/mbedtls/include -I$(EXT_DIR)/mbedtls/librar
|
||||
|
||||
FMT_FLAGS := -w -I$(EXT_DIR)/fmt/fmt/include
|
||||
|
||||
GLSLANG_FLAGS := -w -DENABLE_OPT=0 -DENABLE_SPIRV \
|
||||
-I$(EXT_DIR)/glslang/glslang -I$(GEN_DIR)/include \
|
||||
-isystem $(EXT_DIR)/glslang/glslang/Public -isystem $(EXT_DIR)/glslang
|
||||
GLSLANG_CXXFLAGS := -std=c++17 -fno-rtti
|
||||
ifeq ($(OS_WIN),1)
|
||||
GLSLANG_FLAGS += -DGLSLANG_OSINCLUDE_WIN32
|
||||
else
|
||||
GLSLANG_FLAGS += -DGLSLANG_OSINCLUDE_UNIX
|
||||
endif
|
||||
|
||||
HIDAPI_FLAGS := -w -I$(EXT_DIR)/hidapi/hidapi-src/hidapi
|
||||
ifeq ($(OS_UNIX),1)
|
||||
HIDAPI_FLAGS += -isystem $(EXT_DIR)/libusb/libusb/libusb
|
||||
@@ -2056,10 +1956,6 @@ CPPIPC_FLAGS := -w -O2 -DUNICODE -D_UNICODE -fexceptions \
|
||||
-I$(EXT_DIR)/cpp-ipc/cpp-ipc/src/libipc/platform/linux
|
||||
CPPIPC_CXXFLAGS := -std=gnu++17
|
||||
|
||||
SPIRV_CROSS_FLAGS := -w -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS \
|
||||
-I$(EXT_DIR)/spirv_cross/SPIRV-Cross/include -I$(EXT_DIR)/spirv_cross/SPIRV-Cross
|
||||
SPIRV_CROSS_CXXFLAGS := -std=c++11
|
||||
|
||||
ADRENOTOOLS_FLAGS := -w -I$(EXT_DIR)/libadrenotools/include -I$(EXT_DIR)/libadrenotools \
|
||||
-I$(EXT_DIR)/libadrenotools/lib/linkernsbypass
|
||||
|
||||
@@ -2079,13 +1975,12 @@ DOLPHIN_FLAGS := \
|
||||
$(ZLIB_INC) $(LZMA_INC) $(ZSTD_INC) $(ICONV_INC) \
|
||||
-I$(EXT_DIR)/SFML/SFML/include -I$(EXT_DIR)/bzip2/bzip2 -I$(EXT_DIR)/expr/include \
|
||||
-I$(EXT_DIR)/hidapi/hidapi-src/hidapi -I$(EXT_DIR)/pugixml/pugixml/src \
|
||||
-I$(EXT_DIR)/glslang/glslang -I$(GEN_DIR)/include $(MGBA_INC) \
|
||||
$(MGBA_INC) \
|
||||
-I$(EXT_DIR)/libspng/libspng/spng -I$(EXT_DIR)/xxhash/xxHash \
|
||||
-I$(EXT_DIR)/tinygltf \
|
||||
-I$(EXT_DIR)/curl/curl/include -I$(EXT_DIR)/FatFs -I$(EXT_DIR)/LZO \
|
||||
-I$(EXT_DIR)/lz4/lz4/lib -I$(EXT_DIR)/Bochs_disasm \
|
||||
-I$(EXT_DIR)/cpp-ipc/cpp-ipc/include \
|
||||
-isystem $(EXT_DIR)/glslang/glslang/Public -isystem $(EXT_DIR)/glslang \
|
||||
-isystem $(EXT_DIR)/libusb/libusb/libusb -isystem $(EXT_DIR)/watcher/watcher/include \
|
||||
-Wall -Wtype-limits -Wsign-compare -Wignored-qualifiers -Wuninitialized -Wshadow \
|
||||
-Winit-self -Wmissing-declarations -Wimplicit-fallthrough -Werror=format -Wno-trigraphs
|
||||
@@ -2099,10 +1994,6 @@ endif
|
||||
ifeq ($(HAVE_HIDAPI),1)
|
||||
DOLPHIN_FLAGS += -DHAVE_HIDAPI=1
|
||||
endif
|
||||
ifeq ($(HAVE_SPIRV_CROSS),1)
|
||||
DOLPHIN_FLAGS += -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS \
|
||||
-I$(EXT_DIR)/spirv_cross/SPIRV-Cross/include -I$(EXT_DIR)/spirv_cross/SPIRV-Cross
|
||||
endif
|
||||
ifeq ($(OS_WIN),1)
|
||||
DOLPHIN_FLAGS += -DNOMINMAX -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN \
|
||||
-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS \
|
||||
@@ -2159,9 +2050,6 @@ endif
|
||||
ifeq ($(HAVE_CPPIPC),1)
|
||||
LIB_GROUPS += CPPIPC
|
||||
endif
|
||||
ifeq ($(HAVE_SPIRV_CROSS),1)
|
||||
LIB_GROUPS += GLSLANG SPIRV_CROSS
|
||||
endif
|
||||
ifeq ($(OS_ANDROID),1)
|
||||
ifeq ($(ARCH_ARM64),1)
|
||||
LIB_GROUPS += ADRENOTOOLS
|
||||
|
||||
@@ -831,7 +831,8 @@ ShaderCode GeneratePixelShaderCode(APIType api_type, const ShaderHostConfig& hos
|
||||
|
||||
if (use_framebuffer_fetch)
|
||||
{
|
||||
// Subpass inputs will be converted to framebuffer fetch by SPIRV-Cross.
|
||||
// A subpass input for the framebuffer read; no backend reports framebuffer fetch
|
||||
// here while rslc has no form of one.
|
||||
out.Write("INPUT_ATTACHMENT_BINDING(0, 0, 0) uniform subpassInput in_ocol0;\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ void GenerateVSOutputMembers(ShaderCode& object, APIType api_type, u32 texgens,
|
||||
const ShaderHostConfig& host_config, std::string_view qualifier,
|
||||
ShaderStage stage)
|
||||
{
|
||||
// SPIRV-Cross names all semantics as "TEXCOORD"
|
||||
// rslc names all semantics as "TEXCOORD", as SPIRV-Cross did
|
||||
// Unfortunately Geometry shaders (which also uses this function)
|
||||
// aren't supported. The output semantic name needs to match
|
||||
// up with the input semantic name for both the next stage (pixel shader)
|
||||
|
||||
@@ -1,302 +0,0 @@
|
||||
// Copyright 2022 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "VideoCommon/Spirv.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <glslang/SPIRV/GlslangToSpv.h>
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/Version.h"
|
||||
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
bool InitializeGlslang()
|
||||
{
|
||||
static bool glslang_initialized = false;
|
||||
if (glslang_initialized)
|
||||
return true;
|
||||
|
||||
if (!glslang::InitializeProcess())
|
||||
{
|
||||
PanicAlertFmt("Failed to initialize glslang shader compiler");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::atexit([] { glslang::FinalizeProcess(); });
|
||||
|
||||
glslang_initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
const TBuiltInResource* GetCompilerResourceLimits()
|
||||
{
|
||||
static const TBuiltInResource default_resource = {
|
||||
/* .MaxLights = */ 32,
|
||||
/* .MaxClipPlanes = */ 6,
|
||||
/* .MaxTextureUnits = */ 32,
|
||||
/* .MaxTextureCoords = */ 32,
|
||||
/* .MaxVertexAttribs = */ 64,
|
||||
/* .MaxVertexUniformComponents = */ 4096,
|
||||
/* .MaxVaryingFloats = */ 64,
|
||||
/* .MaxVertexTextureImageUnits = */ 32,
|
||||
/* .MaxCombinedTextureImageUnits = */ 80,
|
||||
/* .MaxTextureImageUnits = */ 32,
|
||||
/* .MaxFragmentUniformComponents = */ 4096,
|
||||
/* .MaxDrawBuffers = */ 32,
|
||||
/* .MaxVertexUniformVectors = */ 128,
|
||||
/* .MaxVaryingVectors = */ 8,
|
||||
/* .MaxFragmentUniformVectors = */ 16,
|
||||
/* .MaxVertexOutputVectors = */ 16,
|
||||
/* .MaxFragmentInputVectors = */ 15,
|
||||
/* .MinProgramTexelOffset = */ -8,
|
||||
/* .MaxProgramTexelOffset = */ 7,
|
||||
/* .MaxClipDistances = */ 8,
|
||||
/* .MaxComputeWorkGroupCountX = */ 65535,
|
||||
/* .MaxComputeWorkGroupCountY = */ 65535,
|
||||
/* .MaxComputeWorkGroupCountZ = */ 65535,
|
||||
/* .MaxComputeWorkGroupSizeX = */ 1024,
|
||||
/* .MaxComputeWorkGroupSizeY = */ 1024,
|
||||
/* .MaxComputeWorkGroupSizeZ = */ 64,
|
||||
/* .MaxComputeUniformComponents = */ 1024,
|
||||
/* .MaxComputeTextureImageUnits = */ 16,
|
||||
/* .MaxComputeImageUniforms = */ 8,
|
||||
/* .MaxComputeAtomicCounters = */ 8,
|
||||
/* .MaxComputeAtomicCounterBuffers = */ 1,
|
||||
/* .MaxVaryingComponents = */ 60,
|
||||
/* .MaxVertexOutputComponents = */ 64,
|
||||
/* .MaxGeometryInputComponents = */ 64,
|
||||
/* .MaxGeometryOutputComponents = */ 128,
|
||||
/* .MaxFragmentInputComponents = */ 128,
|
||||
/* .MaxImageUnits = */ 8,
|
||||
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
|
||||
/* .MaxCombinedShaderOutputResources = */ 8,
|
||||
/* .MaxImageSamples = */ 0,
|
||||
/* .MaxVertexImageUniforms = */ 0,
|
||||
/* .MaxTessControlImageUniforms = */ 0,
|
||||
/* .MaxTessEvaluationImageUniforms = */ 0,
|
||||
/* .MaxGeometryImageUniforms = */ 0,
|
||||
/* .MaxFragmentImageUniforms = */ 8,
|
||||
/* .MaxCombinedImageUniforms = */ 8,
|
||||
/* .MaxGeometryTextureImageUnits = */ 16,
|
||||
/* .MaxGeometryOutputVertices = */ 256,
|
||||
/* .MaxGeometryTotalOutputComponents = */ 1024,
|
||||
/* .MaxGeometryUniformComponents = */ 1024,
|
||||
/* .MaxGeometryVaryingComponents = */ 64,
|
||||
/* .MaxTessControlInputComponents = */ 128,
|
||||
/* .MaxTessControlOutputComponents = */ 128,
|
||||
/* .MaxTessControlTextureImageUnits = */ 16,
|
||||
/* .MaxTessControlUniformComponents = */ 1024,
|
||||
/* .MaxTessControlTotalOutputComponents = */ 4096,
|
||||
/* .MaxTessEvaluationInputComponents = */ 128,
|
||||
/* .MaxTessEvaluationOutputComponents = */ 128,
|
||||
/* .MaxTessEvaluationTextureImageUnits = */ 16,
|
||||
/* .MaxTessEvaluationUniformComponents = */ 1024,
|
||||
/* .MaxTessPatchComponents = */ 120,
|
||||
/* .MaxPatchVertices = */ 32,
|
||||
/* .MaxTessGenLevel = */ 64,
|
||||
/* .MaxViewports = */ 16,
|
||||
/* .MaxVertexAtomicCounters = */ 0,
|
||||
/* .MaxTessControlAtomicCounters = */ 0,
|
||||
/* .MaxTessEvaluationAtomicCounters = */ 0,
|
||||
/* .MaxGeometryAtomicCounters = */ 0,
|
||||
/* .MaxFragmentAtomicCounters = */ 8,
|
||||
/* .MaxCombinedAtomicCounters = */ 8,
|
||||
/* .MaxAtomicCounterBindings = */ 1,
|
||||
/* .MaxVertexAtomicCounterBuffers = */ 0,
|
||||
/* .MaxTessControlAtomicCounterBuffers = */ 0,
|
||||
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
|
||||
/* .MaxGeometryAtomicCounterBuffers = */ 0,
|
||||
/* .MaxFragmentAtomicCounterBuffers = */ 1,
|
||||
/* .MaxCombinedAtomicCounterBuffers = */ 1,
|
||||
/* .MaxAtomicCounterBufferSize = */ 16384,
|
||||
/* .MaxTransformFeedbackBuffers = */ 4,
|
||||
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
|
||||
/* .MaxCullDistances = */ 8,
|
||||
/* .MaxCombinedClipAndCullDistances = */ 8,
|
||||
/* .MaxSamples = */ 4,
|
||||
/* .maxMeshOutputVerticesNV = */ 256,
|
||||
/* .maxMeshOutputPrimitivesNV = */ 512,
|
||||
/* .maxMeshWorkGroupSizeX_NV = */ 32,
|
||||
/* .maxMeshWorkGroupSizeY_NV = */ 1,
|
||||
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
|
||||
/* .maxTaskWorkGroupSizeX_NV = */ 32,
|
||||
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
||||
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
||||
/* .maxMeshViewCountNV = */ 4,
|
||||
/* .maxMeshOutputVerticesEXT = */ 256,
|
||||
/* .maxMeshOutputPrimitivesEXT = */ 256,
|
||||
/* .maxMeshWorkGroupSizeX_EXT = */ 128,
|
||||
/* .maxMeshWorkGroupSizeY_EXT = */ 128,
|
||||
/* .maxMeshWorkGroupSizeZ_EXT = */ 128,
|
||||
/* .maxTaskWorkGroupSizeX_EXT = */ 128,
|
||||
/* .maxTaskWorkGroupSizeY_EXT = */ 128,
|
||||
/* .maxTaskWorkGroupSizeZ_EXT = */ 128,
|
||||
/* .maxMeshViewCountEXT = */ 4,
|
||||
/* .maxDualSourceDrawBuffersEXT = */ 1,
|
||||
|
||||
/* .limits = */
|
||||
{
|
||||
/* .nonInductiveForLoops = */ 1,
|
||||
/* .whileLoops = */ 1,
|
||||
/* .doWhileLoops = */ 1,
|
||||
/* .generalUniformIndexing = */ 1,
|
||||
/* .generalAttributeMatrixVectorIndexing = */ 1,
|
||||
/* .generalVaryingIndexing = */ 1,
|
||||
/* .generalSamplerIndexing = */ 1,
|
||||
/* .generalVariableIndexing = */ 1,
|
||||
/* .generalConstantMatrixVectorIndexing = */ 1,
|
||||
}};
|
||||
return &default_resource;
|
||||
}
|
||||
|
||||
std::optional<SPIRV::CodeVector>
|
||||
CompileShaderToSPV(EShLanguage stage, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version, const char* stage_filename,
|
||||
std::string_view source)
|
||||
{
|
||||
if (!InitializeGlslang())
|
||||
return std::nullopt;
|
||||
|
||||
std::unique_ptr<glslang::TShader> shader = std::make_unique<glslang::TShader>(stage);
|
||||
std::unique_ptr<glslang::TProgram> program;
|
||||
glslang::TShader::ForbidIncluder forbid_includer;
|
||||
EProfile profile = ECoreProfile;
|
||||
EShMessages messages = static_cast<EShMessages>(EShMsgDefault | EShMsgSpvRules);
|
||||
if (api_type == APIType::Vulkan || api_type == APIType::Metal)
|
||||
messages = static_cast<EShMessages>(messages | EShMsgVulkanRules);
|
||||
int default_version = 450;
|
||||
|
||||
const char* pass_source_code = source.data();
|
||||
int pass_source_code_length = static_cast<int>(source.size());
|
||||
|
||||
shader->setEnvTarget(glslang::EShTargetSpv, language_version);
|
||||
|
||||
shader->setStringsWithLengths(&pass_source_code, &pass_source_code_length, 1);
|
||||
|
||||
auto DumpBadShader = [&](const char* msg) {
|
||||
static int counter = 0;
|
||||
std::string filename = VideoBackendBase::BadShaderFilename(stage_filename, counter++);
|
||||
std::ofstream stream;
|
||||
File::OpenFStream(stream, filename, std::ios_base::out);
|
||||
if (stream.good())
|
||||
{
|
||||
stream << source << std::endl;
|
||||
stream << msg << std::endl;
|
||||
stream << "Shader Info Log:" << std::endl;
|
||||
stream << shader->getInfoLog() << std::endl;
|
||||
stream << shader->getInfoDebugLog() << std::endl;
|
||||
if (program)
|
||||
{
|
||||
stream << "Program Info Log:" << std::endl;
|
||||
stream << program->getInfoLog() << std::endl;
|
||||
stream << program->getInfoDebugLog() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
stream << "\n";
|
||||
stream << "Dolphin Version: " + Common::GetScmRevStr() + "\n";
|
||||
stream << "Video Backend: " + g_video_backend->GetDisplayName();
|
||||
stream.close();
|
||||
|
||||
PanicAlertFmt("{} (written to {})\nDebug info:\n{}", msg, filename, shader->getInfoLog());
|
||||
};
|
||||
|
||||
if (!shader->parse(GetCompilerResourceLimits(), default_version, profile, false, true, messages,
|
||||
forbid_includer))
|
||||
{
|
||||
DumpBadShader("Failed to parse shader");
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// Even though there's only a single shader, we still need to link it to generate SPV
|
||||
program = std::make_unique<glslang::TProgram>();
|
||||
program->addShader(shader.get());
|
||||
if (!program->link(messages))
|
||||
{
|
||||
DumpBadShader("Failed to link program");
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
glslang::TIntermediate* intermediate = program->getIntermediate(stage);
|
||||
if (!intermediate)
|
||||
{
|
||||
DumpBadShader("Failed to generate SPIR-V");
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
SPIRV::CodeVector out_code;
|
||||
spv::SpvBuildLogger logger;
|
||||
glslang::SpvOptions options;
|
||||
|
||||
if (g_ActiveConfig.bEnableValidationLayer)
|
||||
{
|
||||
// Attach the source code to the SPIR-V for tools like RenderDoc.
|
||||
shader->setSourceFile(stage_filename);
|
||||
shader->addSourceText(pass_source_code, pass_source_code_length);
|
||||
|
||||
options.generateDebugInfo = true;
|
||||
options.disableOptimizer = true;
|
||||
options.optimizeSize = false;
|
||||
options.disassemble = false;
|
||||
options.validate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
options.disableOptimizer = false;
|
||||
options.stripDebugInfo = true;
|
||||
}
|
||||
|
||||
glslang::GlslangToSpv(*intermediate, out_code, &logger, &options);
|
||||
|
||||
// Write out messages
|
||||
// Temporary: skip if it contains "Warning, version 450 is not yet complete; most version-specific
|
||||
// features are present, but some are missing."
|
||||
if (strlen(shader->getInfoLog()) > 108)
|
||||
WARN_LOG_FMT(VIDEO, "Shader info log: {}", shader->getInfoLog());
|
||||
if (strlen(shader->getInfoDebugLog()) > 0)
|
||||
WARN_LOG_FMT(VIDEO, "Shader debug info log: {}", shader->getInfoDebugLog());
|
||||
if (strlen(program->getInfoLog()) > 25)
|
||||
WARN_LOG_FMT(VIDEO, "Program info log: {}", program->getInfoLog());
|
||||
if (strlen(program->getInfoDebugLog()) > 0)
|
||||
WARN_LOG_FMT(VIDEO, "Program debug info log: {}", program->getInfoDebugLog());
|
||||
const std::string spv_messages = logger.getAllMessages();
|
||||
if (!spv_messages.empty())
|
||||
WARN_LOG_FMT(VIDEO, "SPIR-V conversion messages: {}", spv_messages);
|
||||
|
||||
return out_code;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace SPIRV
|
||||
{
|
||||
std::optional<CodeVector> CompileVertexShader(std::string_view source_code, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version)
|
||||
{
|
||||
return CompileShaderToSPV(EShLangVertex, api_type, language_version, "vs", source_code);
|
||||
}
|
||||
|
||||
std::optional<CodeVector> CompileGeometryShader(std::string_view source_code, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version)
|
||||
{
|
||||
return CompileShaderToSPV(EShLangGeometry, api_type, language_version, "gs", source_code);
|
||||
}
|
||||
|
||||
std::optional<CodeVector> CompileFragmentShader(std::string_view source_code, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version)
|
||||
{
|
||||
return CompileShaderToSPV(EShLangFragment, api_type, language_version, "ps", source_code);
|
||||
}
|
||||
|
||||
std::optional<CodeVector> CompileComputeShader(std::string_view source_code, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version)
|
||||
{
|
||||
return CompileShaderToSPV(EShLangCompute, api_type, language_version, "cs", source_code);
|
||||
}
|
||||
} // namespace SPIRV
|
||||
@@ -1,37 +0,0 @@
|
||||
// Copyright 2022 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
namespace SPIRV
|
||||
{
|
||||
// SPIR-V compiled code type
|
||||
using CodeType = u32;
|
||||
using CodeVector = std::vector<CodeType>;
|
||||
|
||||
// Compile a vertex shader to SPIR-V.
|
||||
std::optional<CodeVector> CompileVertexShader(std::string_view source_code, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version);
|
||||
|
||||
// Compile a geometry shader to SPIR-V.
|
||||
std::optional<CodeVector> CompileGeometryShader(std::string_view source_code, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version);
|
||||
|
||||
// Compile a fragment shader to SPIR-V.
|
||||
std::optional<CodeVector> CompileFragmentShader(std::string_view source_code, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version);
|
||||
|
||||
// Compile a compute shader to SPIR-V.
|
||||
std::optional<CodeVector> CompileComputeShader(std::string_view source_code, APIType api_type,
|
||||
glslang::EShTargetLanguageVersion language_version);
|
||||
} // namespace SPIRV
|
||||
@@ -98,7 +98,8 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
|
||||
|
||||
if (use_framebuffer_fetch)
|
||||
{
|
||||
// Subpass inputs will be converted to framebuffer fetch by SPIRV-Cross.
|
||||
// A subpass input for the framebuffer read; no backend reports framebuffer fetch
|
||||
// here while rslc has no form of one.
|
||||
out.Write("INPUT_ATTACHMENT_BINDING(0, 0, 0) uniform subpassInput in_ocol0;\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ SSBO_BINDING(1) readonly restrict buffer Vertices {{
|
||||
// Write a function to get an offset into vertex_buffer corresponding to this vertex.
|
||||
// This must be done differently for D3D compared to OpenGL/Vulkan/Metal, as on OpenGL, etc.,
|
||||
// gl_VertexID starts counting at the base vertex specified in glDrawElementsBaseVertex,
|
||||
// while on D3D, SV_VertexID (which spirv-cross translates gl_VertexID into) starts counting
|
||||
// while on D3D, SV_VertexID (which gl_VertexID becomes there) starts counting
|
||||
// at 0 regardless of the BaseVertexLocation value passed to DrawIndexed. In both cases,
|
||||
// offset 0 of vertex_buffer corresponds to index 0 with basevertex set to 0, so we have to
|
||||
// manually apply the basevertex offset for D3D
|
||||
|
||||
Reference in new issue
Block a user