Fix issues with GL_QUADS

This commit is contained in:
Luke Benstead 2023-05-31 18:27:17 +01:00
parent 026bdeff09
commit e7574bca1d
2 changed files with 18 additions and 20 deletions

View File

@ -815,17 +815,15 @@ static void generateElementsFastPath(
#define POLYMODE QUADS #define POLYMODE QUADS
#define PROCESS_VERTEX_FLAGS(it, i) { \ #define PROCESS_VERTEX_FLAGS(it, i) { \
if((i + 1) % 4 == 0) { \ it->flags = GPU_CMD_VERTEX; \
Vertex* prev = ((it) - 1); \ if(((i + 1) % 4) == 0) { \
Vertex t = (*prev); \ Vertex t = *it; \
*(prev) = *((it)); \ *it = *(it - 1); \
*((it)) = t; \ *(it - 1) = t; \
prev->flags = GPU_CMD_VERTEX; \
it->flags = GPU_CMD_VERTEX_EOL; \ it->flags = GPU_CMD_VERTEX_EOL; \
} else { \
it->flags = GPU_CMD_VERTEX; \
} \ } \
} }
#include "draw_fastpath.inc" #include "draw_fastpath.inc"
#undef PROCESS_VERTEX_FLAGS #undef PROCESS_VERTEX_FLAGS
#undef POLYMODE #undef POLYMODE

View File

@ -29,18 +29,6 @@ MAKE_FUNC(POLYMODE)
const int_fast32_t loop = ((min + BATCH_SIZE) > count) ? count - min : BATCH_SIZE; const int_fast32_t loop = ((min + BATCH_SIZE) > count) ? count - min : BATCH_SIZE;
const int offset = (first + min); const int offset = (first + min);
stride = ATTRIB_POINTERS.vertex.stride;
ptr = ATTRIB_POINTERS.vertex.ptr + (offset * stride);
it = (Vertex*) start;
PREFETCH(ptr);
for(int_fast32_t i = 0; i < loop; ++i, ++it) {
PREFETCH(ptr + stride);
TransformVertex((const float*) ptr, &w, it->xyz, &it->w);
PROCESS_VERTEX_FLAGS(it, min + i);
ptr += stride;
}
stride = ATTRIB_POINTERS.uv.stride; stride = ATTRIB_POINTERS.uv.stride;
ptr = (ENABLED_VERTEX_ATTRIBUTES & UV_ENABLED_FLAG) ? ATTRIB_POINTERS.uv.ptr + ((first + min) * stride) : NULL; ptr = (ENABLED_VERTEX_ATTRIBUTES & UV_ENABLED_FLAG) ? ATTRIB_POINTERS.uv.ptr + ((first + min) * stride) : NULL;
it = (Vertex*) start; it = (Vertex*) start;
@ -80,6 +68,18 @@ MAKE_FUNC(POLYMODE)
} }
} }
stride = ATTRIB_POINTERS.vertex.stride;
ptr = ATTRIB_POINTERS.vertex.ptr + (offset * stride);
it = (Vertex*) start;
PREFETCH(ptr);
for(int_fast32_t i = 0; i < loop; ++i, ++it) {
PREFETCH(ptr + stride);
TransformVertex((const float*) ptr, &w, it->xyz, &it->w);
PROCESS_VERTEX_FLAGS(it, min + i);
ptr += stride;
}
start = aligned_vector_at(target->extras, min); start = aligned_vector_at(target->extras, min);
stride = ATTRIB_POINTERS.st.stride; stride = ATTRIB_POINTERS.st.stride;