Implement a fast path for glDrawElements
This commit is contained in:
parent
140eec3d92
commit
cdfb805dd9
55
GL/draw.c
55
GL/draw.c
|
@ -978,28 +978,51 @@ static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei
|
||||||
Vertex* vertices = _glSubmissionTargetStart(target);
|
Vertex* vertices = _glSubmissionTargetStart(target);
|
||||||
VertexExtra* extras = aligned_vector_at(target->extras, 0);
|
VertexExtra* extras = aligned_vector_at(target->extras, 0);
|
||||||
|
|
||||||
ITERATE(count) {
|
if(FAST_PATH_ENABLED) {
|
||||||
j = indexFunc(idx);
|
typedef struct FastPath {
|
||||||
|
float xyz[3];
|
||||||
|
float uv[2];
|
||||||
|
uint32_t argb;
|
||||||
|
} FastPath;
|
||||||
|
|
||||||
_readPositionData(j, 1, vertices);
|
GLboolean readST = doTexture && doMultitexture;
|
||||||
_readDiffuseData(j, 1, vertices);
|
|
||||||
if(doTexture) _readUVData(j, 1, vertices);
|
|
||||||
if(doLighting) _readNormalData(j, 1, extras);
|
|
||||||
if(doTexture && doMultitexture) _readSTData(j, 1, extras);
|
|
||||||
|
|
||||||
++vertices;
|
ITERATE(count) {
|
||||||
++extras;
|
j = indexFunc(idx);
|
||||||
|
|
||||||
idx += istride;
|
vertices->flags = PVR_CMD_VERTEX;
|
||||||
|
|
||||||
|
FastPath* srcV = (FastPath*) ((uint8_t*) VERTEX_POINTER.ptr + (VERTEX_POINTER.stride * j));
|
||||||
|
FastPath* dst = (FastPath*) &vertices->xyz;
|
||||||
|
*dst = *srcV;
|
||||||
|
|
||||||
|
if(doLighting) _readNormalData(j, 1, extras);
|
||||||
|
if(readST) _readSTData(j, 1, extras);
|
||||||
|
|
||||||
|
++vertices;
|
||||||
|
++extras;
|
||||||
|
|
||||||
|
idx += istride;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ITERATE(count) {
|
||||||
|
j = indexFunc(idx);
|
||||||
|
vertices->flags = PVR_CMD_VERTEX;
|
||||||
|
|
||||||
|
_readPositionData(j, 1, vertices);
|
||||||
|
_readDiffuseData(j, 1, vertices);
|
||||||
|
if(doTexture) _readUVData(j, 1, vertices);
|
||||||
|
if(doLighting) _readNormalData(j, 1, extras);
|
||||||
|
if(doTexture && doMultitexture) _readSTData(j, 1, extras);
|
||||||
|
|
||||||
|
++vertices;
|
||||||
|
++extras;
|
||||||
|
|
||||||
|
idx += istride;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex* it = _glSubmissionTargetStart(target);
|
Vertex* it = _glSubmissionTargetStart(target);
|
||||||
const Vertex* end = _glSubmissionTargetEnd(target);
|
|
||||||
while(it < end) {
|
|
||||||
(it++)->flags = PVR_CMD_VERTEX;
|
|
||||||
}
|
|
||||||
|
|
||||||
it = _glSubmissionTargetStart(target);
|
|
||||||
// Drawing arrays
|
// Drawing arrays
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case GL_TRIANGLES:
|
case GL_TRIANGLES:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user