From ce5bc77185a8a62780c41347d878186791b6a176 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Wed, 10 Jul 2019 21:48:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=BA=E5=88=B6GBUFFER=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/Vulkan/Deferred.cpp | 23 ++++++++++++++--------- inc/hgl/graph/vulkan/VKDevice.h | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/example/Vulkan/Deferred.cpp b/example/Vulkan/Deferred.cpp index a6934167..0a43ed41 100644 --- a/example/Vulkan/Deferred.cpp +++ b/example/Vulkan/Deferred.cpp @@ -147,16 +147,21 @@ private: gbuffer.extent.height =GBUFFER_HEIGHT; //根据候选格式表选择格式 - const VkFormat position_format =GetCandidateFormat(position_candidate_format, sizeof(position_candidate_format)); - const VkFormat color_format =GetCandidateFormat(color_candidate_format, sizeof(color_candidate_format)); - const VkFormat normal_format =GetCandidateFormat(normal_candidate_format, sizeof(normal_candidate_format)); - const VkFormat depth_format =GetDepthCandidateFormat(); + //const VkFormat position_format =GetCandidateFormat(position_candidate_format, sizeof(position_candidate_format)); + //const VkFormat color_format =GetCandidateFormat(color_candidate_format, sizeof(color_candidate_format)); + //const VkFormat normal_format =GetCandidateFormat(normal_candidate_format, sizeof(normal_candidate_format)); + //const VkFormat depth_format =GetDepthCandidateFormat(); - if(position_format ==FMT_UNDEFINED - ||color_format ==FMT_UNDEFINED - ||normal_format ==FMT_UNDEFINED - ||depth_format ==FMT_UNDEFINED) - return(false); + //if(position_format ==FMT_UNDEFINED + // ||color_format ==FMT_UNDEFINED + // ||normal_format ==FMT_UNDEFINED + // ||depth_format ==FMT_UNDEFINED) + // return(false); + + const VkFormat position_format =FMT_RGBA16F; + const VkFormat color_format =FMT_RGBA16F; + const VkFormat normal_format =FMT_RGBA16F; + const VkFormat depth_format =FMT_D16UN; gbuffer.position=device->CreateAttachmentTextureColor(position_format, gbuffer.extent.width,gbuffer.extent.height); gbuffer.color =device->CreateAttachmentTextureColor(color_format, gbuffer.extent.width,gbuffer.extent.height); diff --git a/inc/hgl/graph/vulkan/VKDevice.h b/inc/hgl/graph/vulkan/VKDevice.h index 86575147..ce4932cd 100644 --- a/inc/hgl/graph/vulkan/VKDevice.h +++ b/inc/hgl/graph/vulkan/VKDevice.h @@ -141,7 +141,7 @@ public: //material相关 Texture2D *CreateAttachmentTextureDepth(const VkFormat video_format,uint32_t width,uint32_t height) { return CreateAttachmentTexture( video_format,width,height, - VK_IMAGE_ASPECT_DEPTH_BIT|VK_IMAGE_ASPECT_STENCIL_BIT, + VK_IMAGE_ASPECT_DEPTH_BIT,//|VK_IMAGE_ASPECT_STENCIL_BIT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); }