Revert "map_orphan_and_risk - next try for upload method"

This reverts commit 17747fcfb8.

On orphaning, some gl drivers do heurisitics where to store the buffer.
As the hack may only work on pinned memory, it would be much less deteministic.
This commit is contained in:
degasus 2013-02-19 15:51:48 +01:00
parent 0f2ee45d96
commit 50f4bf114e
2 changed files with 4 additions and 13 deletions

View File

@ -40,8 +40,10 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType)
{ {
if(g_Config.backend_info.bSupportsGLPinnedMemory && g_Config.backend_info.bSupportsGLSync) if(g_Config.backend_info.bSupportsGLPinnedMemory && g_Config.backend_info.bSupportsGLSync)
m_uploadtype = PINNED_MEMORY; m_uploadtype = PINNED_MEMORY;
else if(g_Config.backend_info.bSupportsGLSync)
m_uploadtype = MAP_AND_RISK;
else else
m_uploadtype = MAP_ORPAN_AND_RISK; m_uploadtype = MAP_AND_ORPHAN;
} }
Init(); Init();
@ -71,14 +73,6 @@ void StreamBuffer::Alloc ( size_t size, u32 stride )
m_iterator_aligned = 0; m_iterator_aligned = 0;
} }
break; 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 MAP_AND_SYNC:
case PINNED_MEMORY: case PINNED_MEMORY:
case MAP_AND_RISK: case MAP_AND_RISK:
@ -143,7 +137,6 @@ size_t StreamBuffer::Upload ( u8* data, size_t size )
break; break;
case PINNED_MEMORY: case PINNED_MEMORY:
case MAP_AND_RISK: case MAP_AND_RISK:
case MAP_ORPAN_AND_RISK:
if(pointer) if(pointer)
memcpy(pointer+m_iterator, data, size); memcpy(pointer+m_iterator, data, size);
break; break;
@ -190,7 +183,7 @@ void StreamBuffer::Init()
fences = new GLsync[SYNC_POINTS]; fences = new GLsync[SYNC_POINTS];
for(u32 i=0; i<SYNC_POINTS; i++) for(u32 i=0; i<SYNC_POINTS; i++)
fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
case MAP_ORPAN_AND_RISK:
glBindBuffer(m_buffertype, m_buffer); glBindBuffer(m_buffertype, m_buffer);
glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW); glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW);
pointer = (u8*)glMapBuffer(m_buffertype, GL_WRITE_ONLY); pointer = (u8*)glMapBuffer(m_buffertype, GL_WRITE_ONLY);
@ -214,7 +207,6 @@ void StreamBuffer::Shutdown()
break; break;
case MAP_AND_ORPHAN: case MAP_AND_ORPHAN:
case MAP_ORPAN_AND_RISK:
case BUFFERSUBDATA: case BUFFERSUBDATA:
break; break;
case PINNED_MEMORY: case PINNED_MEMORY:

View File

@ -30,7 +30,6 @@ enum StreamType {
MAP_AND_ORPHAN, MAP_AND_ORPHAN,
MAP_AND_SYNC, MAP_AND_SYNC,
MAP_AND_RISK, MAP_AND_RISK,
MAP_ORPAN_AND_RISK,
PINNED_MEMORY, PINNED_MEMORY,
BUFFERSUBDATA BUFFERSUBDATA
}; };