From ec309d55abd28f51367825928a634e93808ca415 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 27 Dec 2022 14:35:49 -0800 Subject: [PATCH] GPU: Cleanup definition of shader resources. Was in the wrong header file, which was a bit confusing. --- Common/GPU/Shader.cpp | 2 +- Common/GPU/Shader.h | 3 +++ Common/GPU/ShaderTranslation.cpp | 5 ++--- Common/GPU/Vulkan/VulkanContext.cpp | 4 ++-- GPU/Common/ShaderCommon.h | 3 --- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Common/GPU/Shader.cpp b/Common/GPU/Shader.cpp index 1fce76ff66..147db1a1c0 100644 --- a/Common/GPU/Shader.cpp +++ b/Common/GPU/Shader.cpp @@ -118,7 +118,7 @@ void ShaderLanguageDesc::Init(ShaderLanguage lang) { } } -void init_resources(TBuiltInResource &Resources) { +void InitShaderResources(TBuiltInResource &Resources) { Resources.maxLights = 32; Resources.maxClipPlanes = 6; Resources.maxTextureUnits = 32; diff --git a/Common/GPU/Shader.h b/Common/GPU/Shader.h index 6e29445734..43f6f4d38c 100644 --- a/Common/GPU/Shader.h +++ b/Common/GPU/Shader.h @@ -6,6 +6,9 @@ #include "Common/Common.h" +struct TBuiltInResource; +void InitShaderResources(TBuiltInResource &Resources); + // GLSL_1xx and GLSL_3xx each cover a lot of sub variants. All the little quirks // that differ are covered in ShaderLanguageDesc. // Defined as a bitmask so stuff like GetSupportedShaderLanguages can return combinations. diff --git a/Common/GPU/ShaderTranslation.cpp b/Common/GPU/ShaderTranslation.cpp index 9391d1b7da..dc9492b31b 100644 --- a/Common/GPU/ShaderTranslation.cpp +++ b/Common/GPU/ShaderTranslation.cpp @@ -41,6 +41,7 @@ #include "Common/GPU/ShaderTranslation.h" #include "ext/glslang/SPIRV/GlslangToSpv.h" #include "Common/GPU/thin3d.h" +#include "Common/GPU/Shader.h" #include "Common/GPU/OpenGL/GLFeatures.h" #include "ext/SPIRV-Cross/spirv.hpp" @@ -51,8 +52,6 @@ #include "ext/SPIRV-Cross/spirv_hlsl.hpp" #endif -extern void init_resources(TBuiltInResource &Resources); - static EShLanguage GetShLanguageFromStage(const ShaderStage stage) { switch (stage) { case ShaderStage::Vertex: return EShLangVertex; @@ -241,7 +240,7 @@ bool TranslateShader(std::string *dest, ShaderLanguage destLang, const ShaderLan const char *shaderStrings[1]{}; TBuiltInResource Resources{}; - init_resources(Resources); + InitShaderResources(Resources); // Don't enable SPIR-V and Vulkan rules when parsing GLSL. Our postshaders are written in oldschool GLES 2.0. EShMessages messages = EShMessages::EShMsgDefault; diff --git a/Common/GPU/Vulkan/VulkanContext.cpp b/Common/GPU/Vulkan/VulkanContext.cpp index 72bdd3dca9..aa471cfdfa 100644 --- a/Common/GPU/Vulkan/VulkanContext.cpp +++ b/Common/GPU/Vulkan/VulkanContext.cpp @@ -8,9 +8,9 @@ #include "Common/System/System.h" #include "Common/System/Display.h" #include "Common/Log.h" +#include "Common/GPU/Shader.h" #include "Common/GPU/Vulkan/VulkanContext.h" #include "Common/GPU/Vulkan/VulkanDebug.h" -#include "GPU/Common/ShaderCommon.h" #include "Common/StringUtils.h" #include "Core/Config.h" @@ -1317,7 +1317,7 @@ bool GLSLtoSPV(const VkShaderStageFlagBits shader_type, const char *sourceCode, glslang::TProgram program; const char *shaderStrings[1]; TBuiltInResource Resources{}; - init_resources(Resources); + InitShaderResources(Resources); int defaultVersion = 0; EShMessages messages; diff --git a/GPU/Common/ShaderCommon.h b/GPU/Common/ShaderCommon.h index 63e3116014..6a955513cf 100644 --- a/GPU/Common/ShaderCommon.h +++ b/GPU/Common/ShaderCommon.h @@ -162,6 +162,3 @@ enum { ATTR_COUNT, }; - -struct TBuiltInResource; -void init_resources(TBuiltInResource &Resources);