summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2016-10-22 20:50:36 +1000
committerStenzek <stenzek@gmail.com>2016-11-03 22:01:54 +1000
commitb066d51dfa03b960028fc6f88c8de133eb6db1da (patch)
treef35267e1877f00694e726e6939a14311f7df35d0 /Source/Core/VideoBackends/Vulkan/BoundingBox.cpp
parentab9f539233172b9266745ec266d345966e8c6207 (diff)
Vulkan: Remove parameters/members of single-instance classes
There's not a lot of point in passing these around or storing them (texture cache/state tracker mainly) as there will only ever be a single instance of the class. Also adds downcast helpers such as Vulkan::Renderer::GetInstance().
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/BoundingBox.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/BoundingBox.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp b/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp
index e9dad9f9d6..5cfc174bf8 100644
--- a/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp
+++ b/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp
@@ -10,6 +10,7 @@
#include "VideoBackends/Vulkan/BoundingBox.h"
#include "VideoBackends/Vulkan/CommandBufferManager.h"
#include "VideoBackends/Vulkan/ObjectCache.h"
+#include "VideoBackends/Vulkan/Renderer.h"
#include "VideoBackends/Vulkan/StagingBuffer.h"
#include "VideoBackends/Vulkan/StateTracker.h"
#include "VideoBackends/Vulkan/Util.h"
@@ -47,7 +48,7 @@ bool BoundingBox::Initialize()
return true;
}
-void BoundingBox::Flush(StateTracker* state_tracker)
+void BoundingBox::Flush()
{
if (m_gpu_buffer == VK_NULL_HANDLE)
return;
@@ -75,7 +76,7 @@ void BoundingBox::Flush(StateTracker* state_tracker)
// However, the writes must be serialized, so we can't put it in the init buffer.
if (!updated_buffer)
{
- state_tracker->EndRenderPass();
+ StateTracker::GetInstance()->EndRenderPass();
// Ensure GPU buffer is in a state where it can be transferred to.
Util::BufferMemoryBarrier(
@@ -104,7 +105,7 @@ void BoundingBox::Flush(StateTracker* state_tracker)
m_valid = true;
}
-void BoundingBox::Invalidate(StateTracker* state_tracker)
+void BoundingBox::Invalidate()
{
if (m_gpu_buffer == VK_NULL_HANDLE)
return;
@@ -112,19 +113,19 @@ void BoundingBox::Invalidate(StateTracker* state_tracker)
m_valid = false;
}
-s32 BoundingBox::Get(StateTracker* state_tracker, size_t index)
+s32 BoundingBox::Get(size_t index)
{
_assert_(index < NUM_VALUES);
if (!m_valid)
- Readback(state_tracker);
+ Readback();
s32 value;
m_readback_buffer->Read(index * sizeof(s32), &value, sizeof(value), false);
return value;
}
-void BoundingBox::Set(StateTracker* state_tracker, size_t index, s32 value)
+void BoundingBox::Set(size_t index, s32 value)
{
_assert_(index < NUM_VALUES);
@@ -212,10 +213,10 @@ bool BoundingBox::CreateReadbackBuffer()
return true;
}
-void BoundingBox::Readback(StateTracker* state_tracker)
+void BoundingBox::Readback()
{
// Can't be done within a render pass.
- state_tracker->EndRenderPass();
+ StateTracker::GetInstance()->EndRenderPass();
// Ensure all writes are completed to the GPU buffer prior to the transfer.
Util::BufferMemoryBarrier(
@@ -240,7 +241,7 @@ void BoundingBox::Readback(StateTracker* state_tracker)
VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
// Wait until these commands complete.
- Util::ExecuteCurrentCommandsAndRestoreState(state_tracker, false, true);
+ Util::ExecuteCurrentCommandsAndRestoreState(false, true);
// Cache is now valid.
m_readback_buffer->InvalidateCPUCache();