summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-07-24 03:41:58 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-08-02 19:21:35 +0000
commitb35dbd3450904e5300f96f6e650d38964078fca7 (patch)
tree99cc7d8a5401b3296e6a29fce096268ca899ac19 /Graphics/GraphicsEngineVulkan
parentAdded IRenderPassVk interface (diff)
downloadDiligentCore-b35dbd3450904e5300f96f6e650d38964078fca7.tar.gz
DiligentCore-b35dbd3450904e5300f96f6e650d38964078fca7.zip
Implemented RenderPassAttachmentDesc struct; added render pass creation test; WIP implementation of render pass initialization in Vulkan
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp6
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderPassVkImpl.cpp33
-rw-r--r--Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp20
3 files changed, 58 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp b/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp
index 15420ead..c680c22d 100644
--- a/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp
+++ b/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp
@@ -73,4 +73,10 @@ RESOURCE_STATE VkImageLayoutToResourceState(VkImageLayout Layout);
SURFACE_TRANSFORM VkSurfaceTransformFlagToSurfaceTransform(VkSurfaceTransformFlagBitsKHR vkTransformFlag);
VkSurfaceTransformFlagBitsKHR SurfaceTransformToVkSurfaceTransformFlag(SURFACE_TRANSFORM SrfTransform);
+VkAttachmentLoadOp AttachmentLoadOpToVkAttachmentLoadOp(ATTACHMENT_LOAD_OP LoadOp);
+ATTACHMENT_LOAD_OP VkAttachmentLoadOpToAttachmentLoadOp(VkAttachmentLoadOp VkLoadOp);
+
+VkAttachmentStoreOp AttachmentStoreOpToVkAttachmentStoreOp(ATTACHMENT_STORE_OP StoreOp);
+ATTACHMENT_STORE_OP VkAttachmentStoreOpToAttachmentStoreOp(VkAttachmentStoreOp VkStoreOp);
+
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderPassVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderPassVkImpl.cpp
index 7ea5b8b9..4483fcdc 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderPassVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderPassVkImpl.cpp
@@ -26,9 +26,10 @@
*/
#include "pch.h"
+#include <array>
#include "RenderPassVkImpl.hpp"
-#include "EngineMemory.h"
+#include "VulkanTypeConversions.hpp"
namespace Diligent
{
@@ -38,6 +39,36 @@ RenderPassVkImpl::RenderPassVkImpl(IReferenceCounters* pRefCounters,
const RenderPassDesc& Desc) :
TRenderPassBase{pRefCounters, pDevice, Desc}
{
+ VkRenderPassCreateInfo RenderPassCI = {};
+
+ RenderPassCI.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
+ RenderPassCI.pNext = nullptr;
+ RenderPassCI.flags = 0;
+
+ std::array<VkAttachmentDescription, MAX_RENDER_TARGETS + 1> vkAttachments = {};
+ for (Uint32 i = 0; i < m_Desc.AttachmentCount; ++i)
+ {
+ const auto& Attachment = m_Desc.pAttachments[i];
+ auto& vkAttachment = vkAttachments[i];
+ vkAttachment.flags = 0;
+ vkAttachment.format = TexFormatToVkFormat(Attachment.Format);
+ vkAttachment.samples = static_cast<VkSampleCountFlagBits>(0x01 << Attachment.SampleCount);
+ vkAttachment.loadOp = AttachmentLoadOpToVkAttachmentLoadOp(Attachment.LoadOp);
+ vkAttachment.storeOp = AttachmentStoreOpToVkAttachmentStoreOp(Attachment.StoreOp);
+ vkAttachment.stencilLoadOp = AttachmentLoadOpToVkAttachmentLoadOp(Attachment.StencilLoadOp);
+ vkAttachment.stencilStoreOp = AttachmentStoreOpToVkAttachmentStoreOp(Attachment.StencilStoreOp);
+ vkAttachment.initialLayout = ResourceStateToVkImageLayout(Attachment.InitialState);
+ vkAttachment.finalLayout = ResourceStateToVkImageLayout(Attachment.FinalState);
+ }
+ RenderPassCI.attachmentCount = Desc.AttachmentCount;
+ RenderPassCI.pAttachments = vkAttachments.data();
+
+
+ RenderPassCI.subpassCount = Desc.SubpassCount;
+ RenderPassCI.pSubpasses;
+
+ RenderPassCI.dependencyCount = Desc.DependencyCount;
+ RenderPassCI.pDependencies;
}
RenderPassVkImpl::~RenderPassVkImpl()
diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp
index d5e4f48b..592f9522 100644
--- a/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp
@@ -1421,4 +1421,24 @@ VkSurfaceTransformFlagBitsKHR SurfaceTransformToVkSurfaceTransformFlag(SURFACE_T
// clang-format on
}
+VkAttachmentLoadOp AttachmentLoadOpToVkAttachmentLoadOp(ATTACHMENT_LOAD_OP LoadOp)
+{
+ return static_cast<VkAttachmentLoadOp>(LoadOp);
+}
+
+ATTACHMENT_LOAD_OP VkAttachmentLoadOpToAttachmentLoadOp(VkAttachmentLoadOp VkLoadOp)
+{
+ return static_cast<ATTACHMENT_LOAD_OP>(VkLoadOp);
+}
+
+VkAttachmentStoreOp AttachmentStoreOpToVkAttachmentStoreOp(ATTACHMENT_STORE_OP StoreOp)
+{
+ return static_cast<VkAttachmentStoreOp>(StoreOp);
+}
+
+ATTACHMENT_STORE_OP VkAttachmentStoreOpToAttachmentStoreOp(VkAttachmentStoreOp VkStoreOp)
+{
+ return static_cast<ATTACHMENT_STORE_OP>(VkStoreOp);
+}
+
} // namespace Diligent