big rendering overhaul (cleaning and api abstraction)

This commit is contained in:
veclavtalica
2025-01-14 23:20:54 +03:00
parent b7cb37c06a
commit 5059802d09
25 changed files with 290 additions and 424 deletions

View File

@ -11,7 +11,7 @@ void finally_render_quads(const Primitive2D primitives[],
{
DeferredCommandDraw command = {0};
GLsizei off = 0, voff = 0, uvoff = 0, coff = 0;
uint32_t off = 0, voff = 0, uvoff = 0, coff = 0;
if (!batch.constant_colored && batch.textured) {
off = offsetof(ElementIndexedQuad, v1);
@ -33,7 +33,7 @@ void finally_render_quads(const Primitive2D primitives[],
command.vertices = (AttributeArrayPointer) {
.arity = 2,
.type = GL_FLOAT,
.type = TWN_FLOAT,
.stride = off,
.offset = voff,
.buffer = buffer
@ -42,7 +42,7 @@ void finally_render_quads(const Primitive2D primitives[],
if (batch.textured)
command.texcoords = (AttributeArrayPointer) {
.arity = 2,
.type = GL_FLOAT,
.type = TWN_FLOAT,
.stride = off,
.offset = uvoff,
.buffer = buffer
@ -51,7 +51,7 @@ void finally_render_quads(const Primitive2D primitives[],
if (!batch.constant_colored) {
command.colors = (AttributeArrayPointer) {
.arity = 4,
.type = GL_UNSIGNED_BYTE,
.type = TWN_UNSIGNED_BYTE,
.stride = off,
.offset = coff,
.buffer = buffer
@ -68,10 +68,14 @@ void finally_render_quads(const Primitive2D primitives[],
}
command.element_buffer = get_quad_element_buffer();
command.element_count = 6 * (GLsizei)batch.size;
command.range_end = 6 * (GLsizei)batch.size;
command.element_count = 6 * (uint32_t)batch.size;
command.range_end = 6 * (uint32_t)batch.size;
use_texture_mode(batch.mode);
command.texture_mode = batch.mode;
command.pipeline = PIPELINE_2D;
command.depth_range_high = depth_range_high;
command.depth_range_low = depth_range_low;
DeferredCommand final_command = {
.type = DEFERRED_COMMAND_TYPE_DRAW,