Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2019-02-12 13:52:04 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2019-03-01 10:45:24 +0300
commitbcf74dc487a7fd3d9290073c0b130cadffac5b7f (patch)
tree9a76215f334c83303fd09a68525ec5e698980717 /drape/render_state.cpp
parent5ca3c804107234fa92f226290f80544098864b97 (diff)
[vulkan] Added render state dummies
Diffstat (limited to 'drape/render_state.cpp')
-rw-r--r--drape/render_state.cpp58
1 files changed, 43 insertions, 15 deletions
diff --git a/drape/render_state.cpp b/drape/render_state.cpp
index 77055cb9d2..dbe0844f7b 100644
--- a/drape/render_state.cpp
+++ b/drape/render_state.cpp
@@ -1,9 +1,12 @@
#include "drape/render_state.hpp"
+
#include "drape/drape_global.hpp"
#include "drape/gl_functions.hpp"
#include "drape/gl_gpu_program.hpp"
-#include "base/buffer_vector.hpp"
+#include "drape/vulkan/vulkan_base_context.hpp"
+#include "drape/vulkan/vulkan_gpu_program.hpp"
+#include "drape/vulkan/vulkan_texture.hpp"
namespace dp
{
@@ -225,7 +228,24 @@ void TextureState::ApplyTextures(ref_ptr<GraphicsContext> context, RenderState c
}
else if (apiVersion == dp::ApiVersion::Vulkan)
{
- //TODO(@rokuz, @darina): Implement. Use Bind!
+ ref_ptr<dp::vulkan::VulkanBaseContext> vulkanContext = context;
+ ref_ptr<dp::vulkan::VulkanGpuProgram> p = program;
+ auto const & bindings = p->GetTextureBindings();
+ for (auto const & texture : state.GetTextures())
+ {
+ auto const it = bindings.find(texture.first);
+ CHECK(it != bindings.end(), ("Texture bindings inconsistency."));
+
+ ref_ptr<dp::vulkan::VulkanTexture> t = texture.second->GetHardwareTexture();
+
+ dp::vulkan::ParamDescriptor descriptor;
+ descriptor.m_type = dp::vulkan::ParamDescriptor::Type::Texture;
+ descriptor.m_imageDescriptor.imageView = t->GetTextureView();
+ descriptor.m_imageDescriptor.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ //descriptor.m_imageDescriptor.sampler =; //TODO(@rokuz, @darina): Implement.
+ descriptor.m_textureSlot = it->second;
+ vulkanContext->ApplyParamDescriptor(std::move(descriptor));
+ }
}
else
{
@@ -254,7 +274,9 @@ void ApplyState(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgram> program, R
}
else if (apiVersion == dp::ApiVersion::Vulkan)
{
- //TODO(@rokuz, @darina): Implement.
+ ref_ptr<dp::vulkan::VulkanBaseContext> vulkanContext = context;
+ vulkanContext->SetProgram(program);
+ vulkanContext->SetBlendingEnabled(state.GetBlending().m_isEnabled);
}
else
{
@@ -272,20 +294,26 @@ void ApplyState(ref_ptr<GraphicsContext> context, ref_ptr<GpuProgram> program, R
ApplyDepthStencilStateForMetal(context);
#endif
}
- else if (apiVersion == dp::ApiVersion::Vulkan)
- {
- //TODO(@rokuz, @darina): Implement.
- }
- // Metal does not support line width.
- if (apiVersion == dp::ApiVersion::OpenGLES2 || apiVersion == dp::ApiVersion::OpenGLES3)
+ if (state.GetDrawAsLine())
{
- ASSERT_GREATER_OR_EQUAL(state.GetLineWidth(), 0, ());
- GLFunctions::glLineWidth(static_cast<uint32_t>(state.GetLineWidth()));
- }
- else if (apiVersion == dp::ApiVersion::Vulkan)
- {
- //TODO(@rokuz, @darina): Implement.
+ if (apiVersion == dp::ApiVersion::OpenGLES2 || apiVersion == dp::ApiVersion::OpenGLES3)
+ {
+ ASSERT_GREATER_OR_EQUAL(state.GetLineWidth(), 0, ());
+ GLFunctions::glLineWidth(static_cast<uint32_t>(state.GetLineWidth()));
+ }
+ else if (apiVersion == dp::ApiVersion::Metal)
+ {
+ // Do nothing. Metal does not support line width.
+ }
+ else if (apiVersion == dp::ApiVersion::Vulkan)
+ {
+ ASSERT_GREATER_OR_EQUAL(state.GetLineWidth(), 0, ());
+ ref_ptr<dp::vulkan::VulkanBaseContext> vulkanContext = context;
+ VkCommandBuffer commandBuffer = vulkanContext->GetCurrentCommandBuffer();
+ CHECK(commandBuffer != nullptr, ());
+ vkCmdSetLineWidth(commandBuffer, static_cast<float>(state.GetLineWidth()));
+ }
}
}
} // namespace dp