From b3c2fc3d8ce79c420e2a74526cff90cc54c4e06b Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 4 Oct 2021 17:47:55 +0800 Subject: [PATCH] added renderContext files. --- CMCore | 2 +- example/Vulkan/DrawText.cpp | 2 +- example/Vulkan/DrawTile.cpp | 2 +- inc/hgl/graph/VKAttachment.h | 13 +++++++++++++ inc/hgl/graph/VKLoadStoreOpInfo.h | 12 ++++++++++++ inc/hgl/graph/VKSubpassInfo.h | 25 +++++++++++++++++++++++++ src/SceneGraph/CMakeLists.txt | 5 +++-- src/SceneGraph/Vulkan/VKSubpass.cpp | 0 8 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 inc/hgl/graph/VKAttachment.h create mode 100644 inc/hgl/graph/VKLoadStoreOpInfo.h create mode 100644 inc/hgl/graph/VKSubpassInfo.h create mode 100644 src/SceneGraph/Vulkan/VKSubpass.cpp diff --git a/CMCore b/CMCore index 6f58d5aa..924d4dab 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 6f58d5aac960a7e00f6e6a350cf0f1f47c0b2216 +Subproject commit 924d4dab342fd3628de2b96319ac0b00a39cd4ae diff --git a/example/Vulkan/DrawText.cpp b/example/Vulkan/DrawText.cpp index a0017fcc..c4a64cf1 100644 --- a/example/Vulkan/DrawText.cpp +++ b/example/Vulkan/DrawText.cpp @@ -59,7 +59,7 @@ private: material_instance=db->CreateMaterialInstance(OS_TEXT("res/material/LumTextureRect2D")); if(!material_instance)return(false); - pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D,Prim::Rectangles); + pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D,Prim::SolidRectangles); if(!pipeline)return(false); sampler=db->CreateSampler(); diff --git a/example/Vulkan/DrawTile.cpp b/example/Vulkan/DrawTile.cpp index 207ce0a0..afe572ec 100644 --- a/example/Vulkan/DrawTile.cpp +++ b/example/Vulkan/DrawTile.cpp @@ -162,7 +162,7 @@ private: if(!material_instance) return(false); - pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D,Prim::Rectangles); + pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D,Prim::SolidRectangles); sampler=db->CreateSampler(); diff --git a/inc/hgl/graph/VKAttachment.h b/inc/hgl/graph/VKAttachment.h new file mode 100644 index 00000000..1a6f40f7 --- /dev/null +++ b/inc/hgl/graph/VKAttachment.h @@ -0,0 +1,13 @@ +#ifndef HGL_VULKAN_ATTACHMENT_INCLUDE +#define HGL_VULKAN_ATTACHMENT_INCLUDE +#include +VK_NAMESPACE_BEGIN +struct Attachment +{ + VkFormat format =VK_FORMAT_UNDEFINED; + VkSampleCountFlagBits samples =VK_SAMPLE_COUNT_1_BIT; + VkImageUsageFlags usage =VK_IMAGE_USAGE_SAMPLED_BIT; + VkImageLayout initial_layout =VK_IMAGE_LAYOUT_UNDEFINED; +};//struct Attachment +VK_NAMESPACE_END +#endif//HGL_VULKAN_ATTACHMENT_INCLUDE diff --git a/inc/hgl/graph/VKLoadStoreOpInfo.h b/inc/hgl/graph/VKLoadStoreOpInfo.h new file mode 100644 index 00000000..59c531e3 --- /dev/null +++ b/inc/hgl/graph/VKLoadStoreOpInfo.h @@ -0,0 +1,12 @@ +#ifndef HGL_VULKAN_LOAD_STORE_OP_INFO_INCLUDE +#define HGL_VULKAN_LOAD_STORE_OP_INFO_INCLUDE + +#include +VK_NAMESPACE_BEGIN +struct LoadStoreInfo +{ + VkAttachmentLoadOp load_op = VK_ATTACHMENT_LOAD_OP_CLEAR; + VkAttachmentStoreOp store_op = VK_ATTACHMENT_STORE_OP_STORE; +}; +VK_NAMESPACE_END +#endif//HGL_VULKAN_LOAD_STORE_OP_INFO_INCLUDE diff --git a/inc/hgl/graph/VKSubpassInfo.h b/inc/hgl/graph/VKSubpassInfo.h new file mode 100644 index 00000000..9ff904c9 --- /dev/null +++ b/inc/hgl/graph/VKSubpassInfo.h @@ -0,0 +1,25 @@ +#ifndef HGL_VULKAN_SUBPASS_INFO_INCLUDE +#define HGL_VULKAN_SUBPASS_INFO_INCLUDE + +#include +#include +VK_NAMESPACE_BEGIN +struct SubpassInfo +{ + List input_attachments; + List output_attachments; + + struct + { + List attachments; + }color; + + struct + { + bool enable; + uint32_t attachment; + VkResolveModeFlagBits mode; + }depth_stencil; +};//struct SubpassInfo +VK_NAMESPACE_END +#endif//HGL_VULKAN_SUBPASS_INFO_INCLUDE diff --git a/src/SceneGraph/CMakeLists.txt b/src/SceneGraph/CMakeLists.txt index d1649c0e..44bd099d 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/SceneGraph/CMakeLists.txt @@ -169,6 +169,7 @@ SOURCE_GROUP("Vulkan\\Material\\Shader" FILES ${VK_SHADER_SOURCE}) SET(VK_RENDER_CONTEXT_SOURCE ${SG_INCLUDE_PATH}/VKRenderContext.h ${SG_INCLUDE_PATH}/VKSubpass.h + Vulkan/VKSubpass.cpp Vulkan/VKRenderContext.cpp) SET(VK_RENDER_PASS_SOURCE ${SG_INCLUDE_PATH}/VKFramebuffer.h @@ -191,7 +192,7 @@ SET(VK_RENDER_PASS_SOURCE ${SG_INCLUDE_PATH}/VKFramebuffer.h Vulkan/VKSwapchain.cpp ) -SOURCE_GROUP("Vulkan\\Render Context\\Render Pass" FILES ${VK_RENDER_PASS_SOURCE}) +SOURCE_GROUP("Vulkan\\Render Pass" FILES ${VK_RENDER_PASS_SOURCE}) SOURCE_GROUP("Vulkan\\Render Context" FILES ${VK_RENDER_CONTEXT_SOURCE}) @@ -233,7 +234,7 @@ SET(VULKAN_RENDER_SOURCE ${VK_RR_SOURCE} ${VK_TEXTURE_SOURCE} ${VK_MATERIAL_SOURCE} ${VK_RENDER_PASS_SOURCE} - ${VK_RENDER_CONTEXT_SOURCE} + #${VK_RENDER_CONTEXT_SOURCE} ${VK_CMD_BUFFER_SOURCE} ${VK_RENDERABLE_SOURCE} ${VK_RENDER_DEVICE_SOURCE}) diff --git a/src/SceneGraph/Vulkan/VKSubpass.cpp b/src/SceneGraph/Vulkan/VKSubpass.cpp new file mode 100644 index 00000000..e69de29b