Align some vertex arrays to page size. It's said to possibly be beneficial.
This commit is contained in:
parent
630c025fd5
commit
366583d34f
5 changed files with 41 additions and 39 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "base/timeutil.h"
|
||||
|
||||
#include "Common/MemoryUtil.h"
|
||||
#include "../../Core/MemMap.h"
|
||||
#include "../../Core/Host.h"
|
||||
#include "../../Core/System.h"
|
||||
|
@ -45,6 +46,12 @@ const GLuint glprim[8] = {
|
|||
GL_TRIANGLES, // With OpenGL ES we have to expand sprites into triangles, tripling the data instead of doubling. sigh. OpenGL ES, Y U NO SUPPORT GL_QUADS?
|
||||
};
|
||||
|
||||
enum {
|
||||
DECODED_VERTEX_BUFFER_SIZE = 65536 * 48,
|
||||
DECODED_INDEX_BUFFER_SIZE = 65536 * 2,
|
||||
TRANSFORMED_VERTEX_BUFFER_SIZE = 65536 * sizeof(TransformedVertex)
|
||||
};
|
||||
|
||||
TransformDrawEngine::TransformDrawEngine()
|
||||
: numDrawCalls(0),
|
||||
collectedVerts(0),
|
||||
|
@ -52,10 +59,13 @@ TransformDrawEngine::TransformDrawEngine()
|
|||
lastVType_(-1),
|
||||
curVbo_(0),
|
||||
shaderManager_(0) {
|
||||
decoded = new u8[65536 * 48];
|
||||
decIndex = new u16[65536];
|
||||
transformed = new TransformedVertex[65536];
|
||||
transformedExpanded = new TransformedVertex[65536 * 3];
|
||||
// Allocate nicely aligned memory. Maybe graphics drivers will
|
||||
// appreciate it.
|
||||
// All this is a LOT of memory, need to see if we can cut down somehow.
|
||||
decoded = (u8 *)AllocateMemoryPages(DECODED_VERTEX_BUFFER_SIZE);
|
||||
decIndex = (u16 *)AllocateMemoryPages(DECODED_INDEX_BUFFER_SIZE);
|
||||
transformed = (TransformedVertex *)AllocateMemoryPages(TRANSFORMED_VERTEX_BUFFER_SIZE);
|
||||
transformedExpanded = (TransformedVertex *)AllocateMemoryPages(3 * TRANSFORMED_VERTEX_BUFFER_SIZE);
|
||||
memset(vbo_, 0, sizeof(vbo_));
|
||||
memset(ebo_, 0, sizeof(ebo_));
|
||||
indexGen.Setup(decIndex);
|
||||
|
@ -65,10 +75,10 @@ TransformDrawEngine::TransformDrawEngine()
|
|||
|
||||
TransformDrawEngine::~TransformDrawEngine() {
|
||||
DestroyDeviceObjects();
|
||||
delete [] decoded;
|
||||
delete [] decIndex;
|
||||
delete [] transformed;
|
||||
delete [] transformedExpanded;
|
||||
FreeMemoryPages(decoded, DECODED_VERTEX_BUFFER_SIZE);
|
||||
FreeMemoryPages(decIndex, DECODED_INDEX_BUFFER_SIZE);
|
||||
FreeMemoryPages(transformed, TRANSFORMED_VERTEX_BUFFER_SIZE);
|
||||
FreeMemoryPages(transformedExpanded, 3 * TRANSFORMED_VERTEX_BUFFER_SIZE);
|
||||
unregister_gl_resource_holder(this);
|
||||
}
|
||||
|
||||
|
@ -293,7 +303,7 @@ struct GlTypeInfo {
|
|||
GLboolean normalized;
|
||||
};
|
||||
|
||||
const GlTypeInfo GLComp[8] = {
|
||||
const GlTypeInfo GLComp[] = {
|
||||
{0}, // DEC_NONE,
|
||||
{GL_FLOAT, 1, GL_FALSE}, // DEC_FLOAT_1,
|
||||
{GL_FLOAT, 2, GL_FALSE}, // DEC_FLOAT_2,
|
||||
|
@ -302,6 +312,7 @@ const GlTypeInfo GLComp[8] = {
|
|||
{GL_BYTE, 4, GL_TRUE}, // DEC_S8_3,
|
||||
{GL_SHORT, 4, GL_TRUE},// DEC_S16_3,
|
||||
{GL_UNSIGNED_BYTE, 4, GL_TRUE},// DEC_U8_4,
|
||||
{GL_UNSIGNED_BYTE, 3, GL_TRUE},// DEC_U8_3,
|
||||
};
|
||||
|
||||
static inline void VertexAttribSetup(int attrib, int fmt, int stride, u8 *ptr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue