GPU: Cleanup definition of shader resources.

Was in the wrong header file, which was a bit confusing.
This commit is contained in:
Unknown W. Brackets 2022-12-27 14:35:49 -08:00
parent 0496ca32ff
commit ec309d55ab
5 changed files with 8 additions and 9 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -162,6 +162,3 @@ enum {
ATTR_COUNT,
};
struct TBuiltInResource;
void init_resources(TBuiltInResource &Resources);