[opengl] use a single contiguous buffer for the AMD pinned buffer

This commit is contained in:
Geoffrey McRae 2018-05-15 19:23:57 +10:00
parent 3a2d612b41
commit adca879fb9

View File

@ -35,7 +35,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "utils.h" #include "utils.h"
#include "lg-decoders.h" #include "lg-decoders.h"
#define BUFFER_COUNT 2 #define BUFFER_COUNT 4
#define FPS_TEXTURE 0 #define FPS_TEXTURE 0
#define MOUSE_TEXTURE 1 #define MOUSE_TEXTURE 1
@ -649,6 +649,10 @@ static bool configure(struct Inst * this, SDL_Window *window)
if (this->amdPinnedMemSupport) if (this->amdPinnedMemSupport)
{ {
const int pagesize = getpagesize(); const int pagesize = getpagesize();
this->texPixels[0] = memalign(pagesize, this->texSize * BUFFER_COUNT);
for(int i = 1; i < BUFFER_COUNT; ++i)
this->texPixels[i] = this->texPixels[0] + this->texSize;
for(int i = 0; i < BUFFER_COUNT; ++i) for(int i = 0; i < BUFFER_COUNT; ++i)
{ {
glBindBuffer(GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, this->vboID[i]); glBindBuffer(GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, this->vboID[i]);
@ -658,7 +662,6 @@ static bool configure(struct Inst * this, SDL_Window *window)
return false; return false;
} }
this->texPixels[i] = memalign(pagesize, this->texSize);
glBufferData( glBufferData(
GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD,
this->texSize, this->texSize,