OGL: remove masking from streambuffer

We used this to disable pinned memory for index buffer, but as the detection
was reworked completely, it's just unused code.
This commit is contained in:
degasus
2014-01-09 18:52:05 +01:00
parent eb310cbd1d
commit 95aa977d81
2 changed files with 27 additions and 47 deletions

View File

@ -16,15 +16,13 @@ namespace OGL
static const u32 SYNC_POINTS = 16; static const u32 SYNC_POINTS = 16;
static const u32 ALIGN_PINNED_MEMORY = 4096; static const u32 ALIGN_PINNED_MEMORY = 4096;
StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType) StreamBuffer::StreamBuffer(u32 type, size_t size)
: m_uploadtype(uploadType), m_buffertype(type), m_size(size) : m_buffertype(type), m_size(size)
{ {
glGenBuffers(1, &m_buffer); glGenBuffers(1, &m_buffer);
bool nvidia = !strcmp(g_ogl_config.gl_vendor, "NVIDIA Corporation"); bool nvidia = !strcmp(g_ogl_config.gl_vendor, "NVIDIA Corporation");
if(m_uploadtype & STREAM_DETECT)
{
// TODO: move this to InitBackendInfo // TODO: move this to InitBackendInfo
if(g_ActiveConfig.bHackedBufferUpload && DriverDetails::HasBug(DriverDetails::BUG_BROKENHACKEDBUFFER)) if(g_ActiveConfig.bHackedBufferUpload && DriverDetails::HasBug(DriverDetails::BUG_BROKENHACKEDBUFFER))
{ {
@ -34,27 +32,23 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType)
} }
if (g_ogl_config.bSupportsGLBufferStorage && if (g_ogl_config.bSupportsGLBufferStorage &&
!(DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTORAGE) && type == GL_ARRAY_BUFFER) && !(DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTORAGE) && type == GL_ARRAY_BUFFER))
(m_uploadtype & BUFFERSTORAGE))
m_uploadtype = BUFFERSTORAGE; m_uploadtype = BUFFERSTORAGE;
else if(!g_ogl_config.bSupportsGLBaseVertex && (m_uploadtype & BUFFERSUBDATA) else if(!g_ogl_config.bSupportsGLBaseVertex && !DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM))
&& !DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM))
m_uploadtype = BUFFERSUBDATA; m_uploadtype = BUFFERSUBDATA;
else if(!g_ogl_config.bSupportsGLBaseVertex && (m_uploadtype & BUFFERDATA)) else if(!g_ogl_config.bSupportsGLBaseVertex)
m_uploadtype = BUFFERDATA; m_uploadtype = BUFFERDATA;
else if(g_ogl_config.bSupportsGLSync && g_ActiveConfig.bHackedBufferUpload && (m_uploadtype & MAP_AND_RISK)) else if(g_ogl_config.bSupportsGLSync && g_ActiveConfig.bHackedBufferUpload)
m_uploadtype = MAP_AND_RISK; m_uploadtype = MAP_AND_RISK;
else if(g_ogl_config.bSupportsGLSync && g_ogl_config.bSupportsGLPinnedMemory && else if(g_ogl_config.bSupportsGLSync && g_ogl_config.bSupportsGLPinnedMemory &&
!(DriverDetails::HasBug(DriverDetails::BUG_BROKENPINNEDMEMORY) && type == GL_ELEMENT_ARRAY_BUFFER) && !(DriverDetails::HasBug(DriverDetails::BUG_BROKENPINNEDMEMORY) && type == GL_ELEMENT_ARRAY_BUFFER))
(m_uploadtype & PINNED_MEMORY))
m_uploadtype = PINNED_MEMORY; m_uploadtype = PINNED_MEMORY;
else if(nvidia && (m_uploadtype & BUFFERSUBDATA)) else if(nvidia)
m_uploadtype = BUFFERSUBDATA; m_uploadtype = BUFFERSUBDATA;
else if(g_ogl_config.bSupportsGLSync && (m_uploadtype & MAP_AND_SYNC)) else if(g_ogl_config.bSupportsGLSync)
m_uploadtype = MAP_AND_SYNC; m_uploadtype = MAP_AND_SYNC;
else else
m_uploadtype = MAP_AND_ORPHAN; m_uploadtype = MAP_AND_ORPHAN;
}
Init(); Init();
} }
@ -133,9 +127,6 @@ void StreamBuffer::Alloc ( size_t size, u32 stride )
case BUFFERDATA: case BUFFERDATA:
m_iterator_aligned = 0; m_iterator_aligned = 0;
break; break;
case STREAM_DETECT:
case DETECT_MASK: // To shutup compiler warnings
break;
} }
m_iterator = m_iterator_aligned; m_iterator = m_iterator_aligned;
} }
@ -165,9 +156,6 @@ size_t StreamBuffer::Upload ( u8* data, size_t size )
case BUFFERDATA: case BUFFERDATA:
glBufferData(m_buffertype, size, data, GL_STREAM_DRAW); glBufferData(m_buffertype, size, data, GL_STREAM_DRAW);
break; break;
case STREAM_DETECT:
case DETECT_MASK: // To shutup compiler warnings
break;
} }
size_t ret = m_iterator; size_t ret = m_iterator;
m_iterator += size; m_iterator += size;
@ -242,9 +230,6 @@ void StreamBuffer::Init()
case BUFFERDATA: case BUFFERDATA:
glBindBuffer(m_buffertype, m_buffer); glBindBuffer(m_buffertype, m_buffer);
break; break;
case STREAM_DETECT:
case DETECT_MASK: // To shutup compiler warnings
break;
} }
} }
@ -271,9 +256,6 @@ void StreamBuffer::Shutdown()
glBindBuffer(m_buffertype, 0); glBindBuffer(m_buffertype, 0);
glFinish(); // ogl pipeline must be flushed, else this buffer can be in use glFinish(); // ogl pipeline must be flushed, else this buffer can be in use
break; break;
case STREAM_DETECT:
case DETECT_MASK: // To shutup compiler warnings
break;
} }
} }

View File

@ -18,8 +18,6 @@
namespace OGL namespace OGL
{ {
enum StreamType { enum StreamType {
DETECT_MASK = 0xFF,
STREAM_DETECT = (1 << 0),
MAP_AND_ORPHAN = (1 << 1), MAP_AND_ORPHAN = (1 << 1),
MAP_AND_SYNC = (1 << 2), MAP_AND_SYNC = (1 << 2),
MAP_AND_RISK = (1 << 3), MAP_AND_RISK = (1 << 3),
@ -32,7 +30,7 @@ enum StreamType {
class StreamBuffer { class StreamBuffer {
public: public:
StreamBuffer(u32 type, size_t size, StreamType uploadType = DETECT_MASK); StreamBuffer(u32 type, size_t size);
~StreamBuffer(); ~StreamBuffer();
void Alloc(size_t size, u32 stride = 0); void Alloc(size_t size, u32 stride = 0);