Revert batching
This commit is contained in:
parent
e1e3eaf51b
commit
bfca6fd8b6
30
GL/draw.c
30
GL/draw.c
|
@ -618,7 +618,7 @@ ReadNormalFunc calcReadNormalFunc() {
|
||||||
|
|
||||||
static void _readPositionData(ReadDiffuseFunc func, const GLuint first, const GLuint count, const Vertex* output) {
|
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 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;
|
GLubyte* out = (GLubyte*) output[0].xyz;
|
||||||
uint32_t* flags;
|
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) {
|
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 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;
|
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) {
|
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 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;
|
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) {
|
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 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;
|
GLubyte* out = (GLubyte*) extra[0].nxyz;
|
||||||
|
|
||||||
|
@ -790,33 +790,21 @@ static void generateArraysFastPath(SubmissionTarget* target, const GLsizei first
|
||||||
_readSTData(stfunc, first, count, ve);
|
_readSTData(stfunc, first, count, ve);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BATCH_SIZE 32
|
|
||||||
|
|
||||||
static void generateArrays(SubmissionTarget* target, const GLsizei first, const GLuint count) {
|
static void generateArrays(SubmissionTarget* target, const GLsizei first, const GLuint count) {
|
||||||
Vertex* start = _glSubmissionTargetStart(target);
|
Vertex* start = _glSubmissionTargetStart(target);
|
||||||
VertexExtra* ve = aligned_vector_at(target->extras, 0);
|
VertexExtra* ve = aligned_vector_at(target->extras, 0);
|
||||||
|
|
||||||
GLsizei s = first;
|
|
||||||
GLuint e = s + BATCH_SIZE;
|
|
||||||
|
|
||||||
ReadPositionFunc pfunc = calcReadPositionFunc();
|
ReadPositionFunc pfunc = calcReadPositionFunc();
|
||||||
ReadDiffuseFunc dfunc = calcReadDiffuseFunc();
|
ReadDiffuseFunc dfunc = calcReadDiffuseFunc();
|
||||||
ReadUVFunc uvfunc = calcReadUVFunc();
|
ReadUVFunc uvfunc = calcReadUVFunc();
|
||||||
ReadNormalFunc nfunc = calcReadNormalFunc();
|
ReadNormalFunc nfunc = calcReadNormalFunc();
|
||||||
ReadUVFunc stfunc = calcReadSTFunc();
|
ReadUVFunc stfunc = calcReadSTFunc();
|
||||||
|
|
||||||
do {
|
_readPositionData(pfunc, first, count, start);
|
||||||
_readPositionData(pfunc, s, BATCH_SIZE, start);
|
_readDiffuseData(dfunc, first, count, start);
|
||||||
_readDiffuseData(dfunc, s, BATCH_SIZE, start);
|
_readUVData(uvfunc, first, count, start);
|
||||||
_readUVData(uvfunc, s, BATCH_SIZE, start);
|
_readNormalData(nfunc, first, count, ve);
|
||||||
_readNormalData(nfunc, s, BATCH_SIZE, ve);
|
_readSTData(stfunc, first, count, ve);
|
||||||
_readSTData(stfunc, s, BATCH_SIZE, ve);
|
|
||||||
|
|
||||||
s = e;
|
|
||||||
e += BATCH_SIZE;
|
|
||||||
start += BATCH_SIZE;
|
|
||||||
ve += BATCH_SIZE;
|
|
||||||
} while (s < count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei first, const GLuint count,
|
static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei first, const GLuint count,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user