From 6e20af9ee946f3c033e63f1386558a1e6395001a Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 2 Feb 2013 19:26:29 +0100 Subject: [PATCH] align memory, use pinned memory if available --- Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp index 4df0a3e01d..ac8556c54c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp @@ -19,6 +19,7 @@ #include "Globals.h" #include "GLUtil.h" #include "StreamBuffer.h" +#include "MemoryUtil.h" #ifndef GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD #define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 @@ -28,6 +29,7 @@ namespace OGL { static const u32 SYNC_POINTS = 16; +static const u32 ALGIN_PINNED_MEMORY = 4096; StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType) : m_uploadtype(uploadType), m_buffertype(type), m_size(size) @@ -35,7 +37,12 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType) glGenBuffers(1, &m_buffer); if(m_uploadtype == STREAM_DETECT) - m_uploadtype = MAP_AND_SYNC; + { + if(glewIsSupported("GL_AMD_pinned_memory")) + m_uploadtype = PINNED_MEMORY; + else + m_uploadtype = MAP_AND_SYNC; + } Init(); } @@ -161,7 +168,7 @@ void StreamBuffer::Init() for(u32 i=0; i