From f468ddee50d85d67f9c2264e58065c93ee66a518 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Mon, 19 Jun 2023 11:57:59 -0700 Subject: [PATCH] Need a better solution but added compiler flag to change padding of ints in arrays on GLSL --- src/dawnopengl/display/shader/ShaderParameterBuffer.hpp | 4 +++- src/dawnopengl/display/shader/shaders/FontShader.cpp | 2 +- src/dawnopengl/display/shader/shaders/FontShader.hpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dawnopengl/display/shader/ShaderParameterBuffer.hpp b/src/dawnopengl/display/shader/ShaderParameterBuffer.hpp index 9fdd88a0..1e35066b 100644 --- a/src/dawnopengl/display/shader/ShaderParameterBuffer.hpp +++ b/src/dawnopengl/display/shader/ShaderParameterBuffer.hpp @@ -14,7 +14,9 @@ namespace Dawn { struct ShaderParameterBufferArrayInteger { int32_t value; - float_t padding[3]; + #if _MSC_VER + int32_t padding[3]; + #endif }; template diff --git a/src/dawnopengl/display/shader/shaders/FontShader.cpp b/src/dawnopengl/display/shader/shaders/FontShader.cpp index 4ef00de5..12b59379 100644 --- a/src/dawnopengl/display/shader/shaders/FontShader.cpp +++ b/src/dawnopengl/display/shader/shaders/FontShader.cpp @@ -26,9 +26,9 @@ void FontShader::compile() { "};" "layout (shared) uniform ub_Font {\n" + "vec4 u_FontColors[" MACRO_STRINGIFY(FONT_SHADER_PARTS_MAX) "];\n" "int u_FontTextures[" MACRO_STRINGIFY(FONT_SHADER_PARTS_MAX) "];\n" "int u_FontQuadMappings[" MACRO_STRINGIFY(FONT_SHADER_QUADS_MAX) "];\n" - "vec4 u_FontColors[" MACRO_STRINGIFY(FONT_SHADER_PARTS_MAX) "];\n" "};\n" "uniform mat4 u_Model;\n" diff --git a/src/dawnopengl/display/shader/shaders/FontShader.hpp b/src/dawnopengl/display/shader/shaders/FontShader.hpp index 04b6a812..ad4af40f 100644 --- a/src/dawnopengl/display/shader/shaders/FontShader.hpp +++ b/src/dawnopengl/display/shader/shaders/FontShader.hpp @@ -7,15 +7,15 @@ #include "UIShader.hpp" #include "util/macro.hpp" -#define FONT_SHADER_PARTS_MAX 4 +#define FONT_SHADER_PARTS_MAX 8 #define FONT_SHADER_QUADS_MAX 1024 #define FONT_SHADER_TEXTURE_MAX 4 namespace Dawn { struct FontShaderBufferData { + struct Color colors[FONT_SHADER_PARTS_MAX]; struct ShaderParameterBufferArrayInteger textures[FONT_SHADER_PARTS_MAX]; struct ShaderParameterBufferArrayInteger quadMappings[FONT_SHADER_QUADS_MAX]; - struct Color colors[FONT_SHADER_PARTS_MAX]; }; class FontShaderBuffer : public ShaderParameterBuffer {