summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/Renderer.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2018-01-24 12:19:53 +0100
committerGitHub <noreply@github.com>2018-01-24 12:19:53 +0100
commitc66156148dd6ced799f10313cfe6c60e5189ac89 (patch)
tree594a3ade77c1484e9b4b899493ffeac0a6a7b358 /Source/Core/VideoBackends/Vulkan/Renderer.cpp
parentc3dc8bf1c0fd8151fed6557a90a72040361ae394 (diff)
parent38e0b6e2ab53374e7335fee94209bb90cb3e9ed2 (diff)
Merge pull request #6317 from stenzek/renderer-bind
AbstractTexture: Move Bind() method to Renderer
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/Renderer.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/Renderer.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp
index a146351007..ea5e310a57 100644
--- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp
+++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp
@@ -8,6 +8,7 @@
#include <string>
#include <tuple>
+#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
@@ -848,6 +849,15 @@ void Renderer::SetBlendingState(const BlendingState& state)
StateTracker::GetInstance()->SetBlendState(state);
}
+void Renderer::SetTexture(u32 index, const AbstractTexture* texture)
+{
+ // Texture should always be in SHADER_READ_ONLY layout prior to use.
+ // This is so we don't need to transition during render passes.
+ auto* tex = texture ? static_cast<const VKTexture*>(texture)->GetRawTexIdentifier() : nullptr;
+ _dbg_assert_(VIDEO, !tex || tex->GetLayout() == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
+ StateTracker::GetInstance()->SetTexture(index, tex ? tex->GetView() : VK_NULL_HANDLE);
+}
+
void Renderer::SetSamplerState(u32 index, const SamplerState& state)
{
// Skip lookup if the state hasn't changed.
@@ -866,6 +876,12 @@ void Renderer::SetSamplerState(u32 index, const SamplerState& state)
m_sampler_states[index].hex = state.hex;
}
+void Renderer::UnbindTexture(const AbstractTexture* texture)
+{
+ StateTracker::GetInstance()->UnbindTexture(
+ static_cast<const VKTexture*>(texture)->GetRawTexIdentifier()->GetView());
+}
+
void Renderer::ResetSamplerStates()
{
// Ensure none of the sampler objects are in use.