- use static buffer data and a uniform to handle the texture positioning of the present shader.

That's again one less write access to the buffer. The uniform method was chosen because this way a buffer update can be completely avoided, and setting a single uniform is a lot cheaper and simpler to handle.
This commit is contained in:
Christoph Oelckers 2016-08-08 16:06:02 +02:00
commit 675822004d
7 changed files with 37 additions and 11 deletions

View file

@ -126,7 +126,7 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height)
map = new FFlatVertex[BUFFER_SIZE];
}
mIndex = mCurIndex = 0;
mNumReserved = 8;
mNumReserved = 12;
vbo_shadowdata.Resize(mNumReserved);
// the first quad is reserved for handling coordinates through uniforms.
@ -141,6 +141,12 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height)
vbo_shadowdata[6].Set((float)width, 0, 0, 0, 0);
vbo_shadowdata[7].Set((float)width, (float)height, 0, 0, 0);
// and this is for the postprocessing copy operation
vbo_shadowdata[8].Set(-1.0f, -1.0f, 0, 0.0f, 0.0f);
vbo_shadowdata[9].Set(-1.0f, 1.0f, 0, 0.0f, 1.f);
vbo_shadowdata[10].Set(1.0f, -1.0f, 0, 1.f, 0.0f);
vbo_shadowdata[11].Set(1.0f, 1.0f, 0, 1.f, 1.f);
}
FFlatVertexBuffer::~FFlatVertexBuffer()