From 384a665700f308e46f55142e4ed0113c76acefeb Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 28 Jun 2022 14:30:22 +0200 Subject: [PATCH] [dxvk] Optimize util::pipelineStages --- src/dxvk/dxvk_util.cpp | 19 ------------------- src/dxvk/dxvk_util.h | 7 +++++-- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/dxvk/dxvk_util.cpp b/src/dxvk/dxvk_util.cpp index 4dcf6aca..50868696 100644 --- a/src/dxvk/dxvk_util.cpp +++ b/src/dxvk/dxvk_util.cpp @@ -5,25 +5,6 @@ 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 maxDim = std::max(imageSize.width, imageSize.height); maxDim = std::max(imageSize.depth, maxDim); diff --git a/src/dxvk/dxvk_util.h b/src/dxvk/dxvk_util.h index 4535815e..94fd06dd 100644 --- a/src/dxvk/dxvk_util.h +++ b/src/dxvk/dxvk_util.h @@ -10,8 +10,11 @@ namespace dxvk::util { * \param [in] shaderStages Shader stage flags * \returns Corresponding pipeline stage flags */ - VkPipelineStageFlags pipelineStages( - VkShaderStageFlags shaderStages); + inline VkPipelineStageFlags pipelineStages( + 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