1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add more validation to UBO size and alignment in Compatibility renderer

This commit is contained in:
clayjohn
2024-05-30 12:30:53 -07:00
parent 71699e08c9
commit ea4be9afa6
6 changed files with 19 additions and 5 deletions

View File

@@ -157,6 +157,8 @@ class RasterizerCanvasGLES3 : public RendererCanvasRender {
float atlas_rect[4];
};
static_assert(sizeof(LightUniform) % 16 == 0, "2D light UBO size must be a multiple of 16 bytes");
public:
enum {
BASE_UNIFORM_LOCATION = 0,
@@ -186,6 +188,8 @@ public:
uint32_t pad2;
};
static_assert(sizeof(StateBuffer) % 16 == 0, "2D state UBO size must be a multiple of 16 bytes");
struct PolygonBuffers {
GLuint vertex_buffer = 0;
GLuint vertex_array = 0;
@@ -230,6 +234,8 @@ public:
uint32_t lights[4];
};
static_assert(sizeof(InstanceData) == 128, "2D instance data struct size must be 128 bytes");
struct Data {
GLuint canvas_quad_vertices;
GLuint canvas_quad_array;