1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-13 16:08:50 +01:00

[dxvk] Optimize util::pipelineStages

This commit is contained in:
Philip Rebohle 2022-06-28 14:30:22 +02:00
parent 972de7c9fb
commit 384a665700
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 5 additions and 21 deletions

View File

@ -5,25 +5,6 @@
namespace dxvk::util { namespace dxvk::util {
VkPipelineStageFlags pipelineStages(
VkShaderStageFlags shaderStages) {
VkPipelineStageFlags result = 0;
if (shaderStages & VK_SHADER_STAGE_COMPUTE_BIT)
result |= VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
if (shaderStages & VK_SHADER_STAGE_VERTEX_BIT)
result |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
if (shaderStages & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT)
result |= VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT;
if (shaderStages & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT)
result |= VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT;
if (shaderStages & VK_SHADER_STAGE_GEOMETRY_BIT)
result |= VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT;
if (shaderStages & VK_SHADER_STAGE_FRAGMENT_BIT)
result |= VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
return result;
}
uint32_t computeMipLevelCount(VkExtent3D imageSize) { uint32_t computeMipLevelCount(VkExtent3D imageSize) {
uint32_t maxDim = std::max(imageSize.width, imageSize.height); uint32_t maxDim = std::max(imageSize.width, imageSize.height);
maxDim = std::max(imageSize.depth, maxDim); maxDim = std::max(imageSize.depth, maxDim);

View File

@ -10,8 +10,11 @@ namespace dxvk::util {
* \param [in] shaderStages Shader stage flags * \param [in] shaderStages Shader stage flags
* \returns Corresponding pipeline stage flags * \returns Corresponding pipeline stage flags
*/ */
VkPipelineStageFlags pipelineStages( inline VkPipelineStageFlags pipelineStages(
VkShaderStageFlags shaderStages); VkShaderStageFlags shaderStages) {
return (shaderStages & VK_SHADER_STAGE_ALL_GRAPHICS) << 3
| (shaderStages & VK_SHADER_STAGE_COMPUTE_BIT) << 6;
}
/** /**
* \brief Computes number of mip levels for an image * \brief Computes number of mip levels for an image