Fixed shader alignment on windows

This commit is contained in:
2023-06-19 11:44:45 -07:00
parent 0917851287
commit 2285914c2e
5 changed files with 24 additions and 11 deletions

View File

@ -11,6 +11,11 @@
namespace Dawn {
typedef GLuint shaderbufferslot_t;
typedef GLuint shaderbufferlocation_t;
struct ShaderParameterBufferArrayInteger {
int32_t value;
float_t padding[3];
};
template<typename T>
class ShaderParameterBuffer : public IShaderParameterBuffer<shaderbufferslot_t> {

View File

@ -26,8 +26,8 @@ void FontShader::compile() {
"};"
"layout (shared) uniform ub_Font {\n"
"int u_FontQuadMappings[" MACRO_STRINGIFY(FONT_SHADER_QUADS_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"

View File

@ -7,18 +7,16 @@
#include "UIShader.hpp"
#include "util/macro.hpp"
#define FONT_SHADER_PARTS_MAX 8
#define FONT_SHADER_PARTS_MAX 4
#define FONT_SHADER_QUADS_MAX 1024
#define FONT_SHADER_TEXTURE_MAX 4
namespace Dawn {
#pragma pack(push, 4)
struct FontShaderBufferData {
int32_t fontQuadMappings[FONT_SHADER_QUADS_MAX];
int32_t textures[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];
};
#pragma pack(pop)
class FontShaderBuffer : public ShaderParameterBuffer<struct FontShaderBufferData> {