- some cleanup on the OpenGL interface and its flags.
Most importantly, the separate command line options for switching on the legacy buffer handling have been removed. There's really no need for them anymore, because unlike in earlier versions many of the implementation differences no longer exist - with the exception of where the light and vertex buffer contents are generated. For testing this, -glversion 3 is sufficient.
This commit is contained in:
parent
9253118bdc
commit
5f838d52b9
19 changed files with 39 additions and 62 deletions
|
|
@ -99,9 +99,10 @@ void FSimpleVertexBuffer::set(FSimpleVertex *verts, int count)
|
|||
FFlatVertexBuffer::FFlatVertexBuffer(int width, int height)
|
||||
: FVertexBuffer(true), FFlatVertexGenerator(width, height)
|
||||
{
|
||||
mPersistent = screen->BuffersArePersistent();
|
||||
ibo_id = 0;
|
||||
glGenBuffers(1, &ibo_id);
|
||||
if (gl.buffermethod == BM_PERSISTENT)
|
||||
if (mPersistent)
|
||||
{
|
||||
unsigned int bytesize = BUFFER_SIZE * sizeof(FFlatVertex);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
|
|
@ -165,7 +166,7 @@ void FFlatVertexBuffer::BindVBO()
|
|||
|
||||
void FFlatVertexBuffer::Map()
|
||||
{
|
||||
if (gl.buffermethod == BM_DEFERRED)
|
||||
if (!mPersistent)
|
||||
{
|
||||
unsigned int bytesize = BUFFER_SIZE * sizeof(FFlatVertex);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
|
|
@ -176,7 +177,7 @@ void FFlatVertexBuffer::Map()
|
|||
|
||||
void FFlatVertexBuffer::Unmap()
|
||||
{
|
||||
if (gl.buffermethod == BM_DEFERRED)
|
||||
if (!mPersistent)
|
||||
{
|
||||
unsigned int bytesize = BUFFER_SIZE * sizeof(FFlatVertex);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ class FFlatVertexBuffer : public FVertexBuffer, public FFlatVertexGenerator
|
|||
std::atomic<unsigned int> mCurIndex;
|
||||
std::mutex mBufferMutex;
|
||||
unsigned int mNumReserved;
|
||||
bool mPersistent;
|
||||
|
||||
|
||||
static const unsigned int BUFFER_SIZE = 2000000;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ static const int INITIAL_BUFFER_SIZE = 100; // 100 viewpoints per frame should n
|
|||
|
||||
GLViewpointBuffer::GLViewpointBuffer()
|
||||
{
|
||||
mPersistent = screen->BuffersArePersistent();
|
||||
mBufferSize = INITIAL_BUFFER_SIZE;
|
||||
mBlockAlign = ((sizeof(HWViewpointUniforms) / gl.uniformblockalignment) + 1) * gl.uniformblockalignment;
|
||||
mByteSize = mBufferSize * mBlockAlign;
|
||||
|
|
@ -55,7 +56,7 @@ void GLViewpointBuffer::Allocate()
|
|||
glGenBuffers(1, &mBufferId);
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, VIEWPOINT_BINDINGPOINT, mBufferId);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, mBufferId); // Note: Some older AMD drivers don't do that in glBindBufferBase, as they should.
|
||||
if (gl.flags & RFL_BUFFER_STORAGE)
|
||||
if (mPersistent)
|
||||
{
|
||||
glBufferStorage(GL_UNIFORM_BUFFER, mByteSize, NULL, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
||||
mBufferPointer = glMapBufferRange(GL_UNIFORM_BUFFER, 0, mByteSize, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
||||
|
|
@ -93,7 +94,7 @@ void GLViewpointBuffer::CheckSize()
|
|||
|
||||
void GLViewpointBuffer::Map()
|
||||
{
|
||||
if (!(gl.flags & RFL_BUFFER_STORAGE))
|
||||
if (!mPersistent)
|
||||
{
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, mBufferId);
|
||||
mBufferPointer = (float*)glMapBufferRange(GL_UNIFORM_BUFFER, 0, mByteSize, GL_MAP_WRITE_BIT);
|
||||
|
|
@ -102,7 +103,7 @@ void GLViewpointBuffer::Map()
|
|||
|
||||
void GLViewpointBuffer::Unmap()
|
||||
{
|
||||
if (!(gl.flags & RFL_BUFFER_STORAGE))
|
||||
if (!mPersistent)
|
||||
{
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, mBufferId);
|
||||
glUnmapBuffer(GL_UNIFORM_BUFFER);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class GLViewpointBuffer
|
|||
unsigned int mByteSize;
|
||||
void * mBufferPointer;
|
||||
TArray<bool> mClipPlaneInfo;
|
||||
bool mPersistent;
|
||||
|
||||
unsigned int m2DWidth = ~0u, m2DHeight = ~0u;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue