From 9ed093412337861bed6ee3c4edd80c34d0d3e3a3 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Tue, 19 Jan 2016 18:31:36 -0600 Subject: [PATCH] Swap to modern OpenGL for TFB usage. --- src/xenia/gpu/gl4/draw_batcher.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/xenia/gpu/gl4/draw_batcher.cc b/src/xenia/gpu/gl4/draw_batcher.cc index 7faa663a5..478f937b8 100644 --- a/src/xenia/gpu/gl4/draw_batcher.cc +++ b/src/xenia/gpu/gl4/draw_batcher.cc @@ -59,25 +59,23 @@ bool DrawBatcher::Initialize(CircularBuffer* array_data_buffer) { // Initializes a transform feedback object // We use this to capture vertex data straight from the vertex/geometry shader. bool DrawBatcher::InitializeTFB() { - glGenBuffers(1, &tfvbo_); + glCreateBuffers(1, &tfvbo_); if (!tfvbo_) { return false; } - glGenTransformFeedbacks(1, &tfbo_); + glCreateTransformFeedbacks(1, &tfbo_); if (!tfbo_) { return false; } - glGenQueries(1, &tfqo_); + glCreateQueries(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, 1, &tfqo_); if (!tfqo_) { return false; } // TODO(DrChat): Calculate this based on the number of primitives drawn. - glBindBuffer(GL_ARRAY_BUFFER, tfvbo_); - glBufferData(GL_ARRAY_BUFFER, 16384 * 4, nullptr, GL_STATIC_READ); - glBindBuffer(GL_ARRAY_BUFFER, 0); + glNamedBufferData(tfvbo_, 16384 * 4, nullptr, GL_STATIC_READ); return true; } @@ -119,13 +117,9 @@ bool DrawBatcher::ReadbackTFB(void* buffer, size_t size) { return false; } - glBindBuffer(GL_ARRAY_BUFFER, tfvbo_); - void* data = glMapBufferRange(GL_ARRAY_BUFFER, 0, size, GL_MAP_READ_BIT); - + void* data = glMapNamedBufferRange(tfvbo_, 0, size, GL_MAP_READ_BIT); std::memcpy(buffer, data, size); - - glUnmapBuffer(GL_ARRAY_BUFFER); - glBindBuffer(GL_ARRAY_BUFFER, 0); + glUnmapNamedBuffer(tfvbo_); return true; }