diff options
| author | Lioncash <mathew1800@gmail.com> | 2015-12-21 10:06:40 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2015-12-21 10:07:56 -0500 |
| commit | 1eea95a5beca98a840e6725867dbdfabf467e516 (patch) | |
| tree | 3b5895c7198360df6b42ce65919ce91e566c87a3 /Source/Core/VideoBackends | |
| parent | 7b69fec8e71a1540f17a4a94e5f2d4132d5b09b6 (diff) | |
StreamBuffer: Use std::array for fences
Diffstat (limited to 'Source/Core/VideoBackends')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/StreamBuffer.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/OGL/StreamBuffer.h | 5 |
2 files changed, 13 insertions, 12 deletions
diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp index 47dfd14557..705c0b6702 100644 --- a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp +++ b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp @@ -61,20 +61,20 @@ StreamBuffer::~StreamBuffer() void StreamBuffer::CreateFences() { - for (int i=0; i<SYNC_POINTS; i++) + for (int i = 0; i < SYNC_POINTS; i++) { - fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } } void StreamBuffer::DeleteFences() { for (int i = SLOT(m_free_iterator) + 1; i < SYNC_POINTS; i++) { - glDeleteSync(fences[i]); + glDeleteSync(m_fences[i]); } for (int i = 0; i < SLOT(m_iterator); i++) { - glDeleteSync(fences[i]); + glDeleteSync(m_fences[i]); } } void StreamBuffer::AllocMemory(u32 size) @@ -82,15 +82,15 @@ void StreamBuffer::AllocMemory(u32 size) // insert waiting slots for used memory for (int i = SLOT(m_used_iterator); i < SLOT(m_iterator); i++) { - fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } m_used_iterator = m_iterator; // wait for new slots to end of buffer for (int i = SLOT(m_free_iterator) + 1; i <= SLOT(m_iterator + size) && i < SYNC_POINTS; i++) { - glClientWaitSync(fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED); - glDeleteSync(fences[i]); + glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED); + glDeleteSync(m_fences[i]); } m_free_iterator = m_iterator + size; @@ -100,7 +100,7 @@ void StreamBuffer::AllocMemory(u32 size) // insert waiting slots in unused space at the end of the buffer for (int i = SLOT(m_used_iterator); i < SYNC_POINTS; i++) { - fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } // move to the start @@ -109,8 +109,8 @@ void StreamBuffer::AllocMemory(u32 size) // wait for space at the start for (int i = 0; i <= SLOT(m_iterator + size); i++) { - glClientWaitSync(fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED); - glDeleteSync(fences[i]); + glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED); + glDeleteSync(m_fences[i]); } m_free_iterator = m_iterator + size; } diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.h b/Source/Core/VideoBackends/OGL/StreamBuffer.h index ab55fb865b..2271270df8 100644 --- a/Source/Core/VideoBackends/OGL/StreamBuffer.h +++ b/Source/Core/VideoBackends/OGL/StreamBuffer.h @@ -4,6 +4,7 @@ #pragma once +#include <array> #include <utility> #include "Common/GL/GLUtil.h" @@ -59,11 +60,11 @@ protected: u32 m_free_iterator; private: - static const int SYNC_POINTS = 16; + static constexpr int SYNC_POINTS = 16; int SLOT(u32 x) const { return x >> m_bit_per_slot; } const int m_bit_per_slot; - GLsync fences[SYNC_POINTS]; + std::array<GLsync, SYNC_POINTS> m_fences{}; }; } |
