Fix array drawing mode not rendering properly in non-fast mode.

Also move vertex transform to be done inline in non-fast path, instead of all entirely at the end
This commit is contained in:
UnknownShadow200 2024-10-01 07:13:02 +10:00
parent 75b992f52e
commit d978e3187c

View File

@ -585,12 +585,13 @@ static void _readPositionData(ReadDiffuseFunc func, const GLuint first, const GL
const GLsizei vstride = ATTRIB_POINTERS.vertex.stride; const GLsizei vstride = ATTRIB_POINTERS.vertex.stride;
const GLubyte* vptr = ((GLubyte*) ATTRIB_POINTERS.vertex.ptr + (first * vstride)); const GLubyte* vptr = ((GLubyte*) ATTRIB_POINTERS.vertex.ptr + (first * vstride));
float pos[3]; float pos[3], w = 1.0f;
ITERATE(count) { ITERATE(count) {
PREFETCH(vptr + vstride); PREFETCH(vptr + vstride);
func(vptr, (GLubyte*) pos); func(vptr, (GLubyte*) pos);
it->flags = GPU_CMD_VERTEX; it->flags = GPU_CMD_VERTEX;
TransformVertex(pos, &w, it->xyz, &it->w);
vptr += vstride; vptr += vstride;
++it; ++it;
@ -678,6 +679,7 @@ static void generateElements(
Vertex* output = _glSubmissionTargetStart(target); Vertex* output = _glSubmissionTargetStart(target);
VertexExtra* ve = aligned_vector_at(target->extras, 0); VertexExtra* ve = aligned_vector_at(target->extras, 0);
float pos[3], w = 1.0f;
uint32_t i = first; uint32_t i = first;
uint32_t idx = 0; uint32_t idx = 0;
@ -705,7 +707,8 @@ static void generateElements(
st = (GLubyte*) ATTRIB_POINTERS.st.ptr + (idx * ststride); st = (GLubyte*) ATTRIB_POINTERS.st.ptr + (idx * ststride);
nxyz = (GLubyte*) ATTRIB_POINTERS.normal.ptr + (idx * nstride); nxyz = (GLubyte*) ATTRIB_POINTERS.normal.ptr + (idx * nstride);
pos_func(xyz, (GLubyte*) output->xyz); pos_func(xyz, (GLubyte*) pos);
TransformVertex((const float*) pos, &w, output->xyz, &output->w);
uv_func(uv, (GLubyte*) output->uv); uv_func(uv, (GLubyte*) output->uv);
diffuse_func(bgra, output->bgra); diffuse_func(bgra, output->bgra);
st_func(st, (GLubyte*) ve->st); st_func(st, (GLubyte*) ve->st);
@ -1178,12 +1181,6 @@ GL_FORCE_INLINE void submitVertices(GLenum mode, GLsizei first, GLuint count, GL
/* If we're FAST_PATH_ENABLED, then this will do the transform for us */ /* If we're FAST_PATH_ENABLED, then this will do the transform for us */
generate(target, mode, first, count, (GLubyte*) indices, type); generate(target, mode, first, count, (GLubyte*) indices, type);
/* No fast path, then we have to do another iteration :( */
if(!FAST_PATH_ENABLED) {
/* Multiply by modelview */
transform(target);
}
if(_glIsLightingEnabled()){ if(_glIsLightingEnabled()){
light(target); light(target);