Need a better solution but added compiler flag to change padding of ints in arrays on GLSL

This commit is contained in:
2023-06-19 11:57:59 -07:00
parent 2285914c2e
commit f468ddee50
3 changed files with 6 additions and 4 deletions

View File

@ -14,7 +14,9 @@ namespace Dawn {
struct ShaderParameterBufferArrayInteger { struct ShaderParameterBufferArrayInteger {
int32_t value; int32_t value;
float_t padding[3]; #if _MSC_VER
int32_t padding[3];
#endif
}; };
template<typename T> template<typename T>

View File

@ -26,9 +26,9 @@ void FontShader::compile() {
"};" "};"
"layout (shared) uniform ub_Font {\n" "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_FontTextures[" MACRO_STRINGIFY(FONT_SHADER_PARTS_MAX) "];\n"
"int u_FontQuadMappings[" MACRO_STRINGIFY(FONT_SHADER_QUADS_MAX) "];\n" "int u_FontQuadMappings[" MACRO_STRINGIFY(FONT_SHADER_QUADS_MAX) "];\n"
"vec4 u_FontColors[" MACRO_STRINGIFY(FONT_SHADER_PARTS_MAX) "];\n"
"};\n" "};\n"
"uniform mat4 u_Model;\n" "uniform mat4 u_Model;\n"

View File

@ -7,15 +7,15 @@
#include "UIShader.hpp" #include "UIShader.hpp"
#include "util/macro.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_QUADS_MAX 1024
#define FONT_SHADER_TEXTURE_MAX 4 #define FONT_SHADER_TEXTURE_MAX 4
namespace Dawn { namespace Dawn {
struct FontShaderBufferData { struct FontShaderBufferData {
struct Color colors[FONT_SHADER_PARTS_MAX];
struct ShaderParameterBufferArrayInteger textures[FONT_SHADER_PARTS_MAX]; struct ShaderParameterBufferArrayInteger textures[FONT_SHADER_PARTS_MAX];
struct ShaderParameterBufferArrayInteger quadMappings[FONT_SHADER_QUADS_MAX]; struct ShaderParameterBufferArrayInteger quadMappings[FONT_SHADER_QUADS_MAX];
struct Color colors[FONT_SHADER_PARTS_MAX];
}; };
class FontShaderBuffer : public ShaderParameterBuffer<struct FontShaderBufferData> { class FontShaderBuffer : public ShaderParameterBuffer<struct FontShaderBufferData> {