Removed mempools usage for normal draws.
This commit is contained in:
+4
-14
@@ -17,12 +17,8 @@
|
||||
|
||||
#define PLUGIN_ID 0
|
||||
|
||||
extern uint16_t *gIndices;
|
||||
extern float *gVertexBuffer;
|
||||
extern uint16_t *gIndicesPtr;
|
||||
uint16_t *gIndicesIm2DPtr;
|
||||
uint16_t *gIndicesIm3DPtr;
|
||||
extern float *gVertexBufferPtr;
|
||||
float *gVertexBufferIm2DPtr;
|
||||
float *gVertexBufferIm3DPtr;
|
||||
|
||||
@@ -1162,10 +1158,8 @@ showRaster(Raster *raster, uint32 flags)
|
||||
vglWaitVblankStart(GL_FALSE);
|
||||
vglStopRendering();
|
||||
vglStartRendering();
|
||||
gVertexBuffer = gVertexBufferPtr;
|
||||
gVertexBufferIm2D = gVertexBufferIm2DPtr;
|
||||
gVertexBufferIm3D = gVertexBufferIm3DPtr;
|
||||
gIndices = gIndicesPtr;
|
||||
gIndicesIm2D = gIndicesIm2DPtr;
|
||||
gIndicesIm3D = gIndicesIm3DPtr;
|
||||
#endif
|
||||
@@ -1417,23 +1411,19 @@ initOpenGL(void)
|
||||
|
||||
resetRenderState();
|
||||
|
||||
gVertexBufferPtr = (float*)malloc(0x1800000);
|
||||
gVertexBufferIm2DPtr = (float*)malloc(0x500000);
|
||||
gVertexBufferIm3DPtr = (float*)malloc(0x500000);
|
||||
gIndicesPtr = (uint16_t*)malloc(0x600000);
|
||||
gVertexBufferIm3DPtr = (float*)malloc(0x1800000);
|
||||
gIndicesIm2DPtr = (uint16_t*)malloc(0x600000);
|
||||
gIndicesIm3DPtr = (uint16_t*)malloc(0x600000);
|
||||
gIndicesIm3DPtr = (uint16_t*)malloc(0x1800000);
|
||||
|
||||
gConstIndices = (uint16_t*)malloc(sizeof(uint16_t) * 512);
|
||||
gConstIndices = (uint16_t*)malloc(sizeof(uint16_t) * 0xFFFF);
|
||||
|
||||
gVertexBuffer = gVertexBufferPtr;
|
||||
gVertexBufferIm2D = gVertexBufferIm2DPtr;
|
||||
gVertexBufferIm3D = gVertexBufferIm3DPtr;
|
||||
gIndices = gIndicesPtr;
|
||||
gIndicesIm2D = gIndicesIm2DPtr;
|
||||
gIndicesIm3D = gIndicesIm3DPtr;
|
||||
|
||||
for (uint16_t i = 0; i < 512; i++) {
|
||||
for (uint16_t i = 0; i < 0xFFFF; i++) {
|
||||
gConstIndices[i] = i;
|
||||
}
|
||||
|
||||
|
||||
+15
-16
@@ -104,11 +104,6 @@ im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices)
|
||||
Camera *cam;
|
||||
cam = (Camera*)engine->currentCamera;
|
||||
|
||||
memcpy_neon(gVertexBufferIm2D, vertices, numVertices*sizeof(Im2DVertex));
|
||||
vglVertexAttribPointerMapped(0, gVertexBufferIm2D);
|
||||
vglIndexPointerMapped(gConstIndices);
|
||||
gVertexBufferIm2D += numVertices*(sizeof(Im2DVertex)/sizeof(float));
|
||||
|
||||
xform[0] = 2.0f/cam->frameBuffer->width;
|
||||
xform[1] = -2.0f/cam->frameBuffer->height;
|
||||
xform[2] = -1.0f;
|
||||
@@ -122,6 +117,11 @@ im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices)
|
||||
flushCache();
|
||||
glUniform4fv(currentShader->uniformLocations[u_xform], 1, xform);
|
||||
|
||||
memcpy_neon(gVertexBufferIm2D, vertices, numVertices*sizeof(Im2DVertex));
|
||||
vglVertexAttribPointerMapped(0, gVertexBufferIm2D);
|
||||
vglIndexPointerMapped(gConstIndices);
|
||||
gVertexBufferIm2D += numVertices*(sizeof(Im2DVertex)/sizeof(float));
|
||||
|
||||
vglDrawObjects(primTypeMap[primType], numVertices, GL_FALSE);
|
||||
|
||||
}
|
||||
@@ -135,14 +135,6 @@ im2DRenderIndexedPrimitive(PrimitiveType primType,
|
||||
Camera *cam;
|
||||
cam = (Camera*)engine->currentCamera;
|
||||
|
||||
memcpy_neon(gIndicesIm2D, indices, numIndices * 2);
|
||||
vglIndexPointerMapped(gIndicesIm2D);
|
||||
gIndicesIm2D += numIndices;
|
||||
|
||||
memcpy_neon(gVertexBufferIm2D, vertices, numVertices*sizeof(Im2DVertex));
|
||||
vglVertexAttribPointerMapped(0, gVertexBufferIm2D);
|
||||
gVertexBufferIm2D += numVertices*(sizeof(Im2DVertex)/sizeof(float));
|
||||
|
||||
xform[0] = 2.0f/cam->frameBuffer->width;
|
||||
xform[1] = -2.0f/cam->frameBuffer->height;
|
||||
xform[2] = -1.0f;
|
||||
@@ -156,6 +148,14 @@ im2DRenderIndexedPrimitive(PrimitiveType primType,
|
||||
flushCache();
|
||||
glUniform4fv(currentShader->uniformLocations[u_xform], 1, xform);
|
||||
|
||||
memcpy_neon(gIndicesIm2D, indices, numIndices * 2);
|
||||
vglIndexPointerMapped(gIndicesIm2D);
|
||||
gIndicesIm2D += numIndices;
|
||||
|
||||
memcpy_neon(gVertexBufferIm2D, vertices, numVertices*sizeof(Im2DVertex));
|
||||
vglVertexAttribPointerMapped(0, gVertexBufferIm2D);
|
||||
gVertexBufferIm2D += numVertices*(sizeof(Im2DVertex)/sizeof(float));
|
||||
|
||||
vglDrawObjects(primTypeMap[primType], numIndices, GL_FALSE);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ void
|
||||
im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags)
|
||||
{
|
||||
if(world == nil){
|
||||
Matrix ident;
|
||||
static Matrix ident;
|
||||
ident.setIdentity();
|
||||
world = &ident;
|
||||
}
|
||||
@@ -236,13 +236,12 @@ im3DRenderPrimitive(PrimitiveType primType)
|
||||
void
|
||||
im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices)
|
||||
{
|
||||
flushCache();
|
||||
memcpy_neon(gIndicesIm3D, indices, numIndices * 2);
|
||||
vglIndexPointerMapped(gIndicesIm3D);
|
||||
vglVertexAttribPointerMapped(0, gVertexBufferIm3D);
|
||||
gVertexBufferIm3D += num3DVertices*(sizeof(Im3DVertex)/sizeof(float));
|
||||
gIndicesIm3D += numIndices;
|
||||
|
||||
flushCache();
|
||||
vglDrawObjects(primTypeMap[primType], numIndices, GL_FALSE);
|
||||
}
|
||||
|
||||
|
||||
+10
-7
@@ -33,17 +33,18 @@ static int32 u_colorClamp;
|
||||
void
|
||||
matfxDefaultRender(InstanceDataHeader *header, InstanceData *inst)
|
||||
{
|
||||
Material *m;
|
||||
m = inst->material;
|
||||
Material *m = inst->material;
|
||||
|
||||
defaultShader->use();
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
flushCache();
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
setTexture(0, m->texture);
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
drawInst(header, inst);
|
||||
}
|
||||
|
||||
@@ -90,6 +91,11 @@ matfxEnvRender(InstanceDataHeader *header, InstanceData *inst, MatFX::Env *env)
|
||||
|
||||
envShader->use();
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, 1);
|
||||
rw::SetRenderState(SRCBLEND, BLENDONE);
|
||||
|
||||
flushCache();
|
||||
|
||||
setTexture(0, m->texture);
|
||||
setTexture(1, env->tex);
|
||||
uploadEnvMatrix(env->frame);
|
||||
@@ -109,9 +115,6 @@ matfxEnvRender(InstanceDataHeader *header, InstanceData *inst, MatFX::Env *env)
|
||||
else
|
||||
glUniform4fv(U(u_colorClamp), 1, one);
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, 1);
|
||||
rw::SetRenderState(SRCBLEND, BLENDONE);
|
||||
|
||||
drawInst(header, inst);
|
||||
|
||||
rw::SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
#include "rwgl3.h"
|
||||
#include "rwgl3shader.h"
|
||||
|
||||
extern float *gVertexBuffer;
|
||||
extern uint16_t *gIndices;
|
||||
|
||||
namespace rw {
|
||||
namespace gl3 {
|
||||
|
||||
|
||||
+6
-14
@@ -15,11 +15,6 @@
|
||||
|
||||
#include "rwgl3impl.h"
|
||||
|
||||
extern uint16_t *gIndices;
|
||||
extern float *gVertexBuffer;
|
||||
extern uint16_t *gIndicesPtr;
|
||||
extern float *gVertexBufferPtr;
|
||||
|
||||
namespace rw {
|
||||
namespace gl3 {
|
||||
|
||||
@@ -28,13 +23,8 @@ namespace gl3 {
|
||||
void
|
||||
drawInst_simple(InstanceDataHeader *header, InstanceData *inst)
|
||||
{
|
||||
flushCache();
|
||||
memcpy_neon(gIndices, (uint8_t*)header->indexBuffer + inst->offset, inst->numIndex * 2);
|
||||
vglIndexPointerMapped(gIndices);
|
||||
gIndices += inst->numIndex;
|
||||
memcpy_neon(gVertexBuffer, (uint8_t*)header->vertexBuffer, inst->numVertices * header->attribDesc[0].stride);
|
||||
vglVertexAttribPointerMapped(0, gVertexBuffer);
|
||||
gVertexBuffer += (inst->numVertices * header->attribDesc[0].stride) / sizeof(float);
|
||||
vglIndexPointerMapped(header->indexBuffer + inst->offset);
|
||||
vglVertexAttribPointerMapped(0, header->vertexBuffer);
|
||||
vglDrawObjects(header->primType, inst->numIndex, GL_FALSE);
|
||||
}
|
||||
|
||||
@@ -140,12 +130,14 @@ defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
||||
while(n--){
|
||||
m = inst->material;
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
flushCache();
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
setTexture(0, m->texture);
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
|
||||
+6
-2
@@ -254,16 +254,20 @@ skinRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
||||
|
||||
skinShader->use();
|
||||
|
||||
uploadSkinMatrices(atomic);
|
||||
|
||||
|
||||
while(n--){
|
||||
m = inst->material;
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
flushCache();
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
setTexture(0, m->texture);
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
uploadSkinMatrices(atomic);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
|
||||
@@ -28,11 +28,6 @@
|
||||
|
||||
#define PLUGIN_ID 2
|
||||
|
||||
uint16_t *gIndices;
|
||||
float *gVertexBuffer;
|
||||
uint16_t *gIndicesPtr;
|
||||
float *gVertexBufferPtr;
|
||||
|
||||
namespace rw {
|
||||
namespace wdgl {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user