This commit is contained in:
parent
127ed7b483
commit
9a59b24c8d
6 changed files with 11 additions and 14 deletions
|
|
@ -183,7 +183,7 @@ void VulkanExampleBase::prepare()
|
||||||
vulkanDevice,
|
vulkanDevice,
|
||||||
queue,
|
queue,
|
||||||
frameBuffers,
|
frameBuffers,
|
||||||
colorformat,
|
swapChain.colorFormat,
|
||||||
depthFormat,
|
depthFormat,
|
||||||
&width,
|
&width,
|
||||||
&height,
|
&height,
|
||||||
|
|
@ -1466,7 +1466,7 @@ void VulkanExampleBase::setupRenderPass()
|
||||||
{
|
{
|
||||||
std::array<VkAttachmentDescription, 2> attachments = {};
|
std::array<VkAttachmentDescription, 2> attachments = {};
|
||||||
// Color attachment
|
// Color attachment
|
||||||
attachments[0].format = colorformat;
|
attachments[0].format = swapChain.colorFormat;
|
||||||
attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
|
attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||||
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,7 @@ protected:
|
||||||
vk::VulkanDevice *vulkanDevice;
|
vk::VulkanDevice *vulkanDevice;
|
||||||
// Handle to the device graphics queue that command buffers are submitted to
|
// Handle to the device graphics queue that command buffers are submitted to
|
||||||
VkQueue queue;
|
VkQueue queue;
|
||||||
// Color buffer format
|
// Depth buffer format (selected during Vulkan initialization)
|
||||||
VkFormat colorformat = VK_FORMAT_B8G8R8A8_UNORM;
|
|
||||||
// Depth buffer format
|
|
||||||
// Depth format is selected during Vulkan initialization
|
|
||||||
VkFormat depthFormat;
|
VkFormat depthFormat;
|
||||||
// Command buffer pool
|
// Command buffer pool
|
||||||
VkCommandPool cmdPool;
|
VkCommandPool cmdPool;
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ public:
|
||||||
// Color target
|
// Color target
|
||||||
VkImageCreateInfo info = vkTools::initializers::imageCreateInfo();
|
VkImageCreateInfo info = vkTools::initializers::imageCreateInfo();
|
||||||
info.imageType = VK_IMAGE_TYPE_2D;
|
info.imageType = VK_IMAGE_TYPE_2D;
|
||||||
info.format = colorformat;
|
info.format = swapChain.colorFormat;
|
||||||
info.extent.width = width;
|
info.extent.width = width;
|
||||||
info.extent.height = height;
|
info.extent.height = height;
|
||||||
info.extent.depth = 1;
|
info.extent.depth = 1;
|
||||||
|
|
@ -162,7 +162,7 @@ public:
|
||||||
VkImageViewCreateInfo viewInfo = vkTools::initializers::imageViewCreateInfo();
|
VkImageViewCreateInfo viewInfo = vkTools::initializers::imageViewCreateInfo();
|
||||||
viewInfo.image = multisampleTarget.color.image;
|
viewInfo.image = multisampleTarget.color.image;
|
||||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||||
viewInfo.format = colorformat;
|
viewInfo.format = swapChain.colorFormat;
|
||||||
viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
|
viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
|
||||||
viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
|
viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
|
||||||
viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
|
viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
|
||||||
|
|
@ -228,7 +228,7 @@ public:
|
||||||
std::array<VkAttachmentDescription, 4> attachments = {};
|
std::array<VkAttachmentDescription, 4> attachments = {};
|
||||||
|
|
||||||
// Multisampled attachment that we render to
|
// Multisampled attachment that we render to
|
||||||
attachments[0].format = colorformat;
|
attachments[0].format = swapChain.colorFormat;
|
||||||
attachments[0].samples = SAMPLE_COUNT;
|
attachments[0].samples = SAMPLE_COUNT;
|
||||||
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||||
// No longer required after resolve, this may save some bandwidth on certain GPUs
|
// No longer required after resolve, this may save some bandwidth on certain GPUs
|
||||||
|
|
@ -240,7 +240,7 @@ public:
|
||||||
|
|
||||||
// This is the frame buffer attachment to where the multisampled image
|
// This is the frame buffer attachment to where the multisampled image
|
||||||
// will be resolved to and which will be presented to the swapchain
|
// will be resolved to and which will be presented to the swapchain
|
||||||
attachments[1].format = colorformat;
|
attachments[1].format = swapChain.colorFormat;
|
||||||
attachments[1].samples = VK_SAMPLE_COUNT_1_BIT;
|
attachments[1].samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ public:
|
||||||
|
|
||||||
std::array<VkAttachmentDescription, 5> attachments{};
|
std::array<VkAttachmentDescription, 5> attachments{};
|
||||||
// Color attachment
|
// Color attachment
|
||||||
attachments[0].format = colorformat;
|
attachments[0].format = swapChain.colorFormat;
|
||||||
attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
|
attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||||
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||||
|
|
|
||||||
|
|
@ -1147,7 +1147,7 @@ public:
|
||||||
vulkanDevice,
|
vulkanDevice,
|
||||||
queue,
|
queue,
|
||||||
frameBuffers,
|
frameBuffers,
|
||||||
colorformat,
|
swapChain.colorFormat,
|
||||||
depthFormat,
|
depthFormat,
|
||||||
&width,
|
&width,
|
||||||
&height,
|
&height,
|
||||||
|
|
|
||||||
|
|
@ -703,7 +703,7 @@ public:
|
||||||
std::array<VkAttachmentDescription, 2> attachments = {};
|
std::array<VkAttachmentDescription, 2> attachments = {};
|
||||||
|
|
||||||
// Color attachment
|
// Color attachment
|
||||||
attachments[0].format = colorformat;
|
attachments[0].format = swapChain.colorFormat; // Use the color format selected by the swapchain
|
||||||
attachments[0].samples = VK_SAMPLE_COUNT_1_BIT; // We don't use multi sampling in this example
|
attachments[0].samples = VK_SAMPLE_COUNT_1_BIT; // We don't use multi sampling in this example
|
||||||
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; // Clear this attachment at the start of the render pass
|
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; // Clear this attachment at the start of the render pass
|
||||||
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; // Keep it's contents after the render pass is finished (for displaying it)
|
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; // Keep it's contents after the render pass is finished (for displaying it)
|
||||||
|
|
@ -713,7 +713,7 @@ public:
|
||||||
attachments[0].finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; // Layout to which the attachment is transitioned when the render pass is finished
|
attachments[0].finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; // Layout to which the attachment is transitioned when the render pass is finished
|
||||||
// As we want to present the color buffer to the swapchain, we transition to PRESENT_KHR
|
// As we want to present the color buffer to the swapchain, we transition to PRESENT_KHR
|
||||||
// Depth attachment
|
// Depth attachment
|
||||||
attachments[1].format = depthFormat;
|
attachments[1].format = depthFormat; // A proper depth format is selected in the example base
|
||||||
attachments[1].samples = VK_SAMPLE_COUNT_1_BIT;
|
attachments[1].samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; // Clear depth at start of first subpass
|
attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; // Clear depth at start of first subpass
|
||||||
attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; // We don't need depth after render pass has finished (DONT_CARE may result in better performance)
|
attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; // We don't need depth after render pass has finished (DONT_CARE may result in better performance)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue