Merge branch 'master' into libktx
# Conflicts: # examples/texturemipmapgen/texturemipmapgen.cpp
This commit is contained in:
commit
3537d2cca2
12 changed files with 122 additions and 106 deletions
|
|
@ -567,5 +567,36 @@ namespace vks
|
|||
return (std::find(supportedExtensions.begin(), supportedExtensions.end(), extension) != supportedExtensions.end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the best-fit depth format for this device from a list of possible depth (and stencil) formats
|
||||
*
|
||||
* @param checkSamplingSupport Check if the format can be sampled from (e.g. for shader reads)
|
||||
*
|
||||
* @return The depth format that best fits for the current device
|
||||
*
|
||||
* @throw Throws an exception if no depth format fits the requirements
|
||||
*/
|
||||
VkFormat getSupportedDepthFormat(bool checkSamplingSupport)
|
||||
{
|
||||
// All depth formats may be optional, so we need to find a suitable depth format to use
|
||||
std::vector<VkFormat> depthFormats = { VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_D32_SFLOAT, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D16_UNORM };
|
||||
for (auto& format : depthFormats)
|
||||
{
|
||||
VkFormatProperties formatProperties;
|
||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &formatProperties);
|
||||
// Format must support depth stencil attachment for optimal tiling
|
||||
if (formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
||||
{
|
||||
if (checkSamplingSupport) {
|
||||
if (!(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return format;
|
||||
}
|
||||
}
|
||||
throw std::runtime_error("Could not find a matching depth format");
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,10 +351,10 @@ namespace vks
|
|||
|
||||
VkBufferCopy copyRegion{};
|
||||
|
||||
copyRegion.size = vertices.size;
|
||||
copyRegion.size = vBufferSize;
|
||||
vkCmdCopyBuffer(copyCmd, vertexStaging.buffer, vertices.buffer, 1, ©Region);
|
||||
|
||||
copyRegion.size = indices.size;
|
||||
copyRegion.size = iBufferSize;
|
||||
vkCmdCopyBuffer(copyCmd, indexStaging.buffer, indices.buffer, 1, ©Region);
|
||||
|
||||
device->flushCommandBuffer(copyCmd, copyQueue);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue