Testing with batched arrays
This commit is contained in:
parent
5a9b7bb37e
commit
e1e3eaf51b
50
GL/draw.c
50
GL/draw.c
|
@ -616,11 +616,10 @@ ReadNormalFunc calcReadNormalFunc() {
|
|||
}
|
||||
}
|
||||
|
||||
void _readPositionData(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 void* vptr = ((GLubyte*) VERTEX_POINTER.ptr + (first * vstride));
|
||||
|
||||
ReadDiffuseFunc func = calcReadPositionFunc();
|
||||
GLubyte* out = (GLubyte*) output[0].xyz;
|
||||
uint32_t* flags;
|
||||
|
||||
|
@ -637,11 +636,10 @@ void _readPositionData(const GLuint first, const GLuint count, const Vertex* out
|
|||
}
|
||||
}
|
||||
|
||||
void _readUVData(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 void* uvptr = ((GLubyte*) UV_POINTER.ptr + (first * uvstride));
|
||||
|
||||
ReadUVFunc func = calcReadUVFunc();
|
||||
GLubyte* out = (GLubyte*) output[0].uv;
|
||||
|
||||
ITERATE(count) {
|
||||
|
@ -651,11 +649,10 @@ void _readUVData(const GLuint first, const GLuint count, const Vertex* output) {
|
|||
}
|
||||
}
|
||||
|
||||
void _readSTData(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 void* stptr = ((GLubyte*) ST_POINTER.ptr + (first * ststride));
|
||||
|
||||
ReadUVFunc func = calcReadSTFunc();
|
||||
GLubyte* out = (GLubyte*) extra[0].st;
|
||||
|
||||
ITERATE(count) {
|
||||
|
@ -665,11 +662,10 @@ void _readSTData(const GLuint first, const GLuint count, const VertexExtra* extr
|
|||
}
|
||||
}
|
||||
|
||||
void _readNormalData(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 void* nptr = ((GLubyte*) NORMAL_POINTER.ptr + (first * nstride));
|
||||
|
||||
ReadNormalFunc func = calcReadNormalFunc();
|
||||
GLubyte* out = (GLubyte*) extra[0].nxyz;
|
||||
|
||||
ITERATE(count) {
|
||||
|
@ -696,12 +692,11 @@ void _readNormalData(const GLuint first, const GLuint count, const VertexExtra*
|
|||
}
|
||||
}
|
||||
|
||||
void _readDiffuseData(const GLuint first, const GLuint count, const Vertex* output) {
|
||||
static void _readDiffuseData(ReadDiffuseFunc func, const GLuint first, const GLuint count, const Vertex* output) {
|
||||
const GLuint size = (DIFFUSE_POINTER.size == GL_BGRA) ? 4 : DIFFUSE_POINTER.size;
|
||||
const GLuint cstride = (DIFFUSE_POINTER.stride) ? DIFFUSE_POINTER.stride : size * byte_size(DIFFUSE_POINTER.type);
|
||||
const GLubyte* cptr = ((GLubyte*) DIFFUSE_POINTER.ptr) + (first * cstride);
|
||||
|
||||
ReadDiffuseFunc func = calcReadDiffuseFunc();
|
||||
GLubyte* out = (GLubyte*) output[0].bgra;
|
||||
|
||||
ITERATE(count) {
|
||||
|
@ -788,19 +783,40 @@ static void generateArraysFastPath(SubmissionTarget* target, const GLsizei first
|
|||
|
||||
VertexExtra* ve = aligned_vector_at(target->extras, 0);
|
||||
|
||||
_readNormalData(first, count, ve);
|
||||
_readSTData(first, count, ve);
|
||||
ReadNormalFunc nfunc = calcReadNormalFunc();
|
||||
ReadUVFunc stfunc = calcReadSTFunc();
|
||||
|
||||
_readNormalData(nfunc, first, count, ve);
|
||||
_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);
|
||||
|
||||
_readPositionData(first, count, start);
|
||||
_readDiffuseData(first, count, start);
|
||||
_readUVData(first, count, start);
|
||||
_readNormalData(first, count, ve);
|
||||
_readSTData(first, count, ve);
|
||||
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);
|
||||
}
|
||||
|
||||
static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei first, const GLuint count,
|
||||
|
|
Loading…
Reference in New Issue
Block a user