parent
f5919fc988
commit
97485ab357
6 changed files with 17 additions and 90 deletions
|
|
@ -522,6 +522,7 @@ void VulkanExampleBase::initVulkan(bool enableValidation)
|
||||||
// Get the graphics queue
|
// Get the graphics queue
|
||||||
vkGetDeviceQueue(device, graphicsQueueIndex, 0, &queue);
|
vkGetDeviceQueue(device, graphicsQueueIndex, 0, &queue);
|
||||||
|
|
||||||
|
// Find a suitable depth format
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &depthFormat);
|
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &depthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,25 +286,10 @@ public:
|
||||||
|
|
||||||
VkFormat fbColorFormat = FB_COLOR_FORMAT;
|
VkFormat fbColorFormat = FB_COLOR_FORMAT;
|
||||||
|
|
||||||
// Find supported depth format
|
// Find a suitable depth format
|
||||||
// We prefer 24 bits of depth and 8 bits of stencil, but that may not be supported by all implementations
|
|
||||||
VkFormat fbDepthFormat;
|
VkFormat fbDepthFormat;
|
||||||
std::vector<VkFormat> depthFormats = { VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D16_UNORM };
|
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
bool depthFormatFound = false;
|
assert(validDepthFormat);
|
||||||
for (auto& format : depthFormats)
|
|
||||||
{
|
|
||||||
VkFormatProperties formatProps;
|
|
||||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &formatProps);
|
|
||||||
// Format must support depth stencil attachment for optimal tiling
|
|
||||||
if (formatProps.optimalTilingFeatures && VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
|
||||||
{
|
|
||||||
fbDepthFormat = format;
|
|
||||||
depthFormatFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(depthFormatFound);
|
|
||||||
|
|
||||||
VkResult err;
|
VkResult err;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -388,25 +388,11 @@ public:
|
||||||
&offScreenFrameBuf.albedo);
|
&offScreenFrameBuf.albedo);
|
||||||
|
|
||||||
// Depth attachment
|
// Depth attachment
|
||||||
// Find supported depth format
|
|
||||||
// We prefer 24 bits of depth and 8 bits of stencil, but that may not be supported by all implementations
|
|
||||||
VkFormat attDepthFormat;
|
|
||||||
std::vector<VkFormat> depthFormats = { VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D16_UNORM };
|
|
||||||
bool depthFormatFound = false;
|
|
||||||
for (auto& format : depthFormats)
|
|
||||||
{
|
|
||||||
VkFormatProperties formatProps;
|
|
||||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &formatProps);
|
|
||||||
// Format must support depth stencil attachment for optimal tiling
|
|
||||||
if (formatProps.optimalTilingFeatures && VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
|
||||||
{
|
|
||||||
attDepthFormat = format;
|
|
||||||
depthFormatFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(depthFormatFound);
|
// Find a suitable depth format
|
||||||
|
VkFormat attDepthFormat;
|
||||||
|
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
||||||
|
assert(validDepthFormat);
|
||||||
|
|
||||||
createAttachment(
|
createAttachment(
|
||||||
attDepthFormat,
|
attDepthFormat,
|
||||||
|
|
|
||||||
|
|
@ -271,25 +271,10 @@ public:
|
||||||
|
|
||||||
VkFormat fbColorFormat = FB_COLOR_FORMAT;
|
VkFormat fbColorFormat = FB_COLOR_FORMAT;
|
||||||
|
|
||||||
// Find supported depth format
|
// Find a suitable depth format
|
||||||
// We prefer 24 bits of depth and 8 bits of stencil, but that may not be supported by all implementations
|
|
||||||
VkFormat fbDepthFormat;
|
VkFormat fbDepthFormat;
|
||||||
std::vector<VkFormat> depthFormats = { VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D16_UNORM };
|
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
bool depthFormatFound = false;
|
assert(validDepthFormat);
|
||||||
for (auto& format : depthFormats)
|
|
||||||
{
|
|
||||||
VkFormatProperties formatProps;
|
|
||||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &formatProps);
|
|
||||||
// Format must support depth stencil attachment for optimal tiling
|
|
||||||
if (formatProps.optimalTilingFeatures && VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
|
||||||
{
|
|
||||||
fbDepthFormat = format;
|
|
||||||
depthFormatFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(depthFormatFound);
|
|
||||||
|
|
||||||
VkResult err;
|
VkResult err;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -262,25 +262,10 @@ public:
|
||||||
|
|
||||||
VkFormat fbColorFormat = FB_COLOR_FORMAT;
|
VkFormat fbColorFormat = FB_COLOR_FORMAT;
|
||||||
|
|
||||||
// Find supported depth format
|
// Find a suitable depth format
|
||||||
// We prefer 24 bits of depth and 8 bits of stencil, but that may not be supported by all implementations
|
|
||||||
VkFormat fbDepthFormat;
|
VkFormat fbDepthFormat;
|
||||||
std::vector<VkFormat> depthFormats = { VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D16_UNORM };
|
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
bool depthFormatFound = false;
|
assert(validDepthFormat);
|
||||||
for (auto& format : depthFormats)
|
|
||||||
{
|
|
||||||
VkFormatProperties formatProps;
|
|
||||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &formatProps);
|
|
||||||
// Format must support depth stencil attachment for optimal tiling
|
|
||||||
if (formatProps.optimalTilingFeatures && VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
|
||||||
{
|
|
||||||
fbDepthFormat = format;
|
|
||||||
depthFormatFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(depthFormatFound);
|
|
||||||
|
|
||||||
VkResult err;
|
VkResult err;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -294,25 +294,10 @@ public:
|
||||||
|
|
||||||
VkFormat fbColorFormat = FB_COLOR_FORMAT;
|
VkFormat fbColorFormat = FB_COLOR_FORMAT;
|
||||||
|
|
||||||
// Find supported depth format
|
// Find a suitable depth format
|
||||||
// We prefer 24 bits of depth and 8 bits of stencil, but that may not be supported by all implementations
|
|
||||||
VkFormat fbDepthFormat;
|
VkFormat fbDepthFormat;
|
||||||
std::vector<VkFormat> depthFormats = { VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D16_UNORM };
|
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
bool depthFormatFound = false;
|
assert(validDepthFormat);
|
||||||
for (auto& format : depthFormats)
|
|
||||||
{
|
|
||||||
VkFormatProperties formatProps;
|
|
||||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &formatProps);
|
|
||||||
// Format must support depth stencil attachment for optimal tiling
|
|
||||||
if (formatProps.optimalTilingFeatures && VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
|
||||||
{
|
|
||||||
fbDepthFormat = format;
|
|
||||||
depthFormatFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(depthFormatFound);
|
|
||||||
|
|
||||||
VkResult err;
|
VkResult err;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue