Revert batching

This commit is contained in:
Luke Benstead 2021-04-20 19:52:49 +01:00
parent e1e3eaf51b
commit bfca6fd8b6

View File

@ -618,7 +618,7 @@ ReadNormalFunc calcReadNormalFunc() {
static void _readPositionData(ReadDiffuseFunc func, const GLuint first, const GLuint count, const Vertex* output) {
const GLsizei vstride = (VERTEX_POINTER.stride) ? VERTEX_POINTER.stride : VERTEX_POINTER.size * byte_size(VERTEX_POINTER.type);
const void* vptr = ((GLubyte*) VERTEX_POINTER.ptr + (first * vstride));
const GLubyte* vptr = ((GLubyte*) VERTEX_POINTER.ptr + (first * vstride));
GLubyte* out = (GLubyte*) output[0].xyz;
uint32_t* flags;
@ -638,7 +638,7 @@ static void _readPositionData(ReadDiffuseFunc func, const GLuint first, const GL
static void _readUVData(ReadUVFunc func, const GLuint first, const GLuint count, const Vertex* output) {
const GLsizei uvstride = (UV_POINTER.stride) ? UV_POINTER.stride : UV_POINTER.size * byte_size(UV_POINTER.type);
const void* uvptr = ((GLubyte*) UV_POINTER.ptr + (first * uvstride));
const GLubyte* uvptr = ((GLubyte*) UV_POINTER.ptr + (first * uvstride));
GLubyte* out = (GLubyte*) output[0].uv;
@ -651,7 +651,7 @@ static void _readUVData(ReadUVFunc func, const GLuint first, const GLuint count,
static void _readSTData(ReadUVFunc func, const GLuint first, const GLuint count, const VertexExtra* extra) {
const GLsizei ststride = (ST_POINTER.stride) ? ST_POINTER.stride : ST_POINTER.size * byte_size(ST_POINTER.type);
const void* stptr = ((GLubyte*) ST_POINTER.ptr + (first * ststride));
const GLubyte* stptr = ((GLubyte*) ST_POINTER.ptr + (first * ststride));
GLubyte* out = (GLubyte*) extra[0].st;
@ -664,7 +664,7 @@ static void _readSTData(ReadUVFunc func, const GLuint first, const GLuint count,
static void _readNormalData(ReadNormalFunc func, const GLuint first, const GLuint count, const VertexExtra* extra) {
const GLsizei nstride = (NORMAL_POINTER.stride) ? NORMAL_POINTER.stride : NORMAL_POINTER.size * byte_size(NORMAL_POINTER.type);
const void* nptr = ((GLubyte*) NORMAL_POINTER.ptr + (first * nstride));
const GLubyte* nptr = ((GLubyte*) NORMAL_POINTER.ptr + (first * nstride));
GLubyte* out = (GLubyte*) extra[0].nxyz;
@ -790,33 +790,21 @@ static void generateArraysFastPath(SubmissionTarget* target, const GLsizei first
_readSTData(stfunc, first, count, ve);
}
#define BATCH_SIZE 32
static void generateArrays(SubmissionTarget* target, const GLsizei first, const GLuint count) {
Vertex* start = _glSubmissionTargetStart(target);
VertexExtra* ve = aligned_vector_at(target->extras, 0);
GLsizei s = first;
GLuint e = s + BATCH_SIZE;
ReadPositionFunc pfunc = calcReadPositionFunc();
ReadDiffuseFunc dfunc = calcReadDiffuseFunc();
ReadUVFunc uvfunc = calcReadUVFunc();
ReadNormalFunc nfunc = calcReadNormalFunc();
ReadUVFunc stfunc = calcReadSTFunc();
do {
_readPositionData(pfunc, s, BATCH_SIZE, start);
_readDiffuseData(dfunc, s, BATCH_SIZE, start);
_readUVData(uvfunc, s, BATCH_SIZE, start);
_readNormalData(nfunc, s, BATCH_SIZE, ve);
_readSTData(stfunc, s, BATCH_SIZE, ve);
s = e;
e += BATCH_SIZE;
start += BATCH_SIZE;
ve += BATCH_SIZE;
} while (s < count);
_readPositionData(pfunc, first, count, start);
_readDiffuseData(dfunc, first, count, start);
_readUVData(uvfunc, first, count, start);
_readNormalData(nfunc, first, count, ve);
_readSTData(stfunc, first, count, ve);
}
static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei first, const GLuint count,