diff options
| author | degasus <wickmarkus@web.de> | 2013-02-19 13:18:48 +0100 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2013-02-19 13:18:48 +0100 |
| commit | 17747fcfb8a4f076ea97d8d5781539735ab32f72 (patch) | |
| tree | 4a9ea4def679426dda859d62645f4ed5d4d01791 /Source | |
| parent | fed574d08b0f5457a8903746469754f3bd0149ac (diff) | |
map_orphan_and_risk - next try for upload method
should work around nvidia600 driver issue which will flush gpu on syncing
also increase buffer size by orphaning
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp | 16 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.h | 1 |
2 files changed, 13 insertions, 4 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp index 9ef43f6d53..cfd7eb08bc 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp @@ -40,10 +40,8 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType) { if(g_Config.backend_info.bSupportsGLPinnedMemory && g_Config.backend_info.bSupportsGLSync) m_uploadtype = PINNED_MEMORY; - else if(g_Config.backend_info.bSupportsGLSync) - m_uploadtype = MAP_AND_RISK; else - m_uploadtype = MAP_AND_ORPHAN; + m_uploadtype = MAP_ORPAN_AND_RISK; } Init(); @@ -73,6 +71,14 @@ void StreamBuffer::Alloc ( size_t size, u32 stride ) m_iterator_aligned = 0; } break; + case MAP_ORPAN_AND_RISK: + if(iter_end >= m_size) { + glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW); + m_iterator_aligned = 0; + pointer = (u8*)glMapBufferRange(m_buffertype, 0, m_size, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT); + glUnmapBuffer(m_buffertype); + } + break; case MAP_AND_SYNC: case PINNED_MEMORY: case MAP_AND_RISK: @@ -137,6 +143,7 @@ size_t StreamBuffer::Upload ( u8* data, size_t size ) break; case PINNED_MEMORY: case MAP_AND_RISK: + case MAP_ORPAN_AND_RISK: if(pointer) memcpy(pointer+m_iterator, data, size); break; @@ -183,7 +190,7 @@ void StreamBuffer::Init() fences = new GLsync[SYNC_POINTS]; for(u32 i=0; i<SYNC_POINTS; i++) fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); - + case MAP_ORPAN_AND_RISK: glBindBuffer(m_buffertype, m_buffer); glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW); pointer = (u8*)glMapBuffer(m_buffertype, GL_WRITE_ONLY); @@ -207,6 +214,7 @@ void StreamBuffer::Shutdown() break; case MAP_AND_ORPHAN: + case MAP_ORPAN_AND_RISK: case BUFFERSUBDATA: break; case PINNED_MEMORY: diff --git a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.h b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.h index a7b6403e83..9600f0ff00 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.h @@ -30,6 +30,7 @@ enum StreamType { MAP_AND_ORPHAN, MAP_AND_SYNC, MAP_AND_RISK, + MAP_ORPAN_AND_RISK, PINNED_MEMORY, BUFFERSUBDATA }; |
