From 95aa977d81f3127d4d2bdf89ed2c71861cac79f6 Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 9 Jan 2014 18:52:05 +0100 Subject: [PATCH] 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. --- .../Core/VideoBackends/OGL/StreamBuffer.cpp | 70 +++++++------------ Source/Core/VideoBackends/OGL/StreamBuffer.h | 4 +- 2 files changed, 27 insertions(+), 47 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp index c80dc6e70399..db9c007f8ffd 100644 --- a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp +++ b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp @@ -16,46 +16,40 @@ namespace OGL static const u32 SYNC_POINTS = 16; static const u32 ALIGN_PINNED_MEMORY = 4096; -StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType) -: m_uploadtype(uploadType), m_buffertype(type), m_size(size) +StreamBuffer::StreamBuffer(u32 type, size_t size) +: m_buffertype(type), m_size(size) { glGenBuffers(1, &m_buffer); bool nvidia = !strcmp(g_ogl_config.gl_vendor, "NVIDIA Corporation"); - if(m_uploadtype & STREAM_DETECT) + // TODO: move this to InitBackendInfo + if(g_ActiveConfig.bHackedBufferUpload && DriverDetails::HasBug(DriverDetails::BUG_BROKENHACKEDBUFFER)) { - // TODO: move this to InitBackendInfo - if(g_ActiveConfig.bHackedBufferUpload && DriverDetails::HasBug(DriverDetails::BUG_BROKENHACKEDBUFFER)) - { - OSD::AddMessage("Vertex Streaming Hack isn't supported by your GPU.", 10000); - g_ActiveConfig.bHackedBufferUpload = false; - g_Config.bHackedBufferUpload = false; - } - - if (g_ogl_config.bSupportsGLBufferStorage && - !(DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTORAGE) && type == GL_ARRAY_BUFFER) && - (m_uploadtype & BUFFERSTORAGE)) - m_uploadtype = BUFFERSTORAGE; - else if(!g_ogl_config.bSupportsGLBaseVertex && (m_uploadtype & BUFFERSUBDATA) - && !DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM)) - m_uploadtype = BUFFERSUBDATA; - 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)) - m_uploadtype = MAP_AND_RISK; - else if(g_ogl_config.bSupportsGLSync && g_ogl_config.bSupportsGLPinnedMemory && - !(DriverDetails::HasBug(DriverDetails::BUG_BROKENPINNEDMEMORY) && type == GL_ELEMENT_ARRAY_BUFFER) && - (m_uploadtype & PINNED_MEMORY)) - m_uploadtype = PINNED_MEMORY; - else if(nvidia && (m_uploadtype & BUFFERSUBDATA)) - m_uploadtype = BUFFERSUBDATA; - else if(g_ogl_config.bSupportsGLSync && (m_uploadtype & MAP_AND_SYNC)) - m_uploadtype = MAP_AND_SYNC; - else - m_uploadtype = MAP_AND_ORPHAN; + OSD::AddMessage("Vertex Streaming Hack isn't supported by your GPU.", 10000); + g_ActiveConfig.bHackedBufferUpload = false; + g_Config.bHackedBufferUpload = false; } + if (g_ogl_config.bSupportsGLBufferStorage && + !(DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTORAGE) && type == GL_ARRAY_BUFFER)) + m_uploadtype = BUFFERSTORAGE; + else if(!g_ogl_config.bSupportsGLBaseVertex && !DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM)) + m_uploadtype = BUFFERSUBDATA; + else if(!g_ogl_config.bSupportsGLBaseVertex) + m_uploadtype = BUFFERDATA; + else if(g_ogl_config.bSupportsGLSync && g_ActiveConfig.bHackedBufferUpload) + m_uploadtype = MAP_AND_RISK; + else if(g_ogl_config.bSupportsGLSync && g_ogl_config.bSupportsGLPinnedMemory && + !(DriverDetails::HasBug(DriverDetails::BUG_BROKENPINNEDMEMORY) && type == GL_ELEMENT_ARRAY_BUFFER)) + m_uploadtype = PINNED_MEMORY; + else if(nvidia) + m_uploadtype = BUFFERSUBDATA; + else if(g_ogl_config.bSupportsGLSync) + m_uploadtype = MAP_AND_SYNC; + else + m_uploadtype = MAP_AND_ORPHAN; + Init(); } @@ -133,9 +127,6 @@ void StreamBuffer::Alloc ( size_t size, u32 stride ) case BUFFERDATA: m_iterator_aligned = 0; break; - case STREAM_DETECT: - case DETECT_MASK: // To shutup compiler warnings - break; } m_iterator = m_iterator_aligned; } @@ -165,9 +156,6 @@ size_t StreamBuffer::Upload ( u8* data, size_t size ) case BUFFERDATA: glBufferData(m_buffertype, size, data, GL_STREAM_DRAW); break; - case STREAM_DETECT: - case DETECT_MASK: // To shutup compiler warnings - break; } size_t ret = m_iterator; m_iterator += size; @@ -242,9 +230,6 @@ void StreamBuffer::Init() case BUFFERDATA: glBindBuffer(m_buffertype, m_buffer); break; - case STREAM_DETECT: - case DETECT_MASK: // To shutup compiler warnings - break; } } @@ -271,9 +256,6 @@ void StreamBuffer::Shutdown() glBindBuffer(m_buffertype, 0); glFinish(); // ogl pipeline must be flushed, else this buffer can be in use break; - case STREAM_DETECT: - case DETECT_MASK: // To shutup compiler warnings - break; } } diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.h b/Source/Core/VideoBackends/OGL/StreamBuffer.h index bd503fd067e3..8fc4cef841b3 100644 --- a/Source/Core/VideoBackends/OGL/StreamBuffer.h +++ b/Source/Core/VideoBackends/OGL/StreamBuffer.h @@ -18,8 +18,6 @@ namespace OGL { enum StreamType { - DETECT_MASK = 0xFF, - STREAM_DETECT = (1 << 0), MAP_AND_ORPHAN = (1 << 1), MAP_AND_SYNC = (1 << 2), MAP_AND_RISK = (1 << 3), @@ -32,7 +30,7 @@ enum StreamType { class StreamBuffer { public: - StreamBuffer(u32 type, size_t size, StreamType uploadType = DETECT_MASK); + StreamBuffer(u32 type, size_t size); ~StreamBuffer(); void Alloc(size_t size, u32 stride = 0);