From 2c987fb2002537936346be95d3a6994d9e2c6576 Mon Sep 17 00:00:00 2001 From: Artem Kharytoniuk Date: Wed, 8 Jan 2025 19:54:44 +0100 Subject: [PATCH] sync: Generate expansion for ALL_TRANSFER stage --- layers/sync/sync_utils.cpp | 7 +++---- layers/vulkan/generated/sync_validation_types.cpp | 4 ++-- layers/vulkan/generated/sync_validation_types.h | 5 +++-- scripts/generators/sync_validation_generator.py | 12 ++++++++---- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/layers/sync/sync_utils.cpp b/layers/sync/sync_utils.cpp index 0a850d9c491..b2a291e0206 100644 --- a/layers/sync/sync_utils.cpp +++ b/layers/sync/sync_utils.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2019-2024 Valve Corporation - * Copyright (c) 2019-2024 LunarG, Inc. + * Copyright (c) 2019-2025 Valve Corporation + * Copyright (c) 2019-2025 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,8 +82,7 @@ VkPipelineStageFlags2 ExpandPipelineStages(VkPipelineStageFlags2 stage_mask, VkQ } if (VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT & stage_mask) { expanded &= ~VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT; - expanded |= VK_PIPELINE_STAGE_2_COPY_BIT | VK_PIPELINE_STAGE_2_RESOLVE_BIT | VK_PIPELINE_STAGE_2_BLIT_BIT | - VK_PIPELINE_STAGE_2_CLEAR_BIT; + expanded |= kAllTransferExpandBits; } if (VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT & stage_mask) { expanded &= ~VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT; diff --git a/layers/vulkan/generated/sync_validation_types.cpp b/layers/vulkan/generated/sync_validation_types.cpp index afbfe482c97..13aeec73061 100644 --- a/layers/vulkan/generated/sync_validation_types.cpp +++ b/layers/vulkan/generated/sync_validation_types.cpp @@ -3,8 +3,8 @@ /*************************************************************************** * - * Copyright (c) 2015-2024 Valve Corporation - * Copyright (c) 2015-2024 LunarG, Inc. + * Copyright (c) 2015-2025 Valve Corporation + * Copyright (c) 2015-2025 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/layers/vulkan/generated/sync_validation_types.h b/layers/vulkan/generated/sync_validation_types.h index bac53209c43..ca9c4ec3a91 100644 --- a/layers/vulkan/generated/sync_validation_types.h +++ b/layers/vulkan/generated/sync_validation_types.h @@ -3,8 +3,8 @@ /*************************************************************************** * - * Copyright (c) 2015-2024 Valve Corporation - * Copyright (c) 2015-2024 LunarG, Inc. + * Copyright (c) 2015-2025 Valve Corporation + * Copyright (c) 2015-2025 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ // clang-format off static constexpr VkAccessFlags2 kShaderReadExpandBits = VK_ACCESS_2_SHADER_SAMPLED_READ_BIT|VK_ACCESS_2_SHADER_STORAGE_READ_BIT|VK_ACCESS_2_SHADER_BINDING_TABLE_READ_BIT_KHR; static constexpr VkAccessFlags2 kShaderWriteExpandBits = VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT; +static constexpr VkPipelineStageFlags2 kAllTransferExpandBits = VK_PIPELINE_STAGE_2_COPY_BIT|VK_PIPELINE_STAGE_2_RESOLVE_BIT|VK_PIPELINE_STAGE_2_BLIT_BIT|VK_PIPELINE_STAGE_2_CLEAR_BIT|VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR; // Fake stages and accesses for acquire present support static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRESENT_ENGINE_BIT_SYNCVAL = 0x0000040000000000ULL; diff --git a/scripts/generators/sync_validation_generator.py b/scripts/generators/sync_validation_generator.py index c94db6ff266..c6f3a637db9 100644 --- a/scripts/generators/sync_validation_generator.py +++ b/scripts/generators/sync_validation_generator.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 -i # -# Copyright (c) 2023-2024 The Khronos Group Inc. -# Copyright (c) 2023-2024 LunarG, Inc. +# Copyright (c) 2023-2025 The Khronos Group Inc. +# Copyright (c) 2023-2025 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,8 +80,8 @@ def generate(self): /*************************************************************************** * - * Copyright (c) 2015-2024 Valve Corporation - * Copyright (c) 2015-2024 LunarG, Inc. + * Copyright (c) 2015-2025 Valve Corporation + * Copyright (c) 2015-2025 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -165,6 +165,10 @@ def generateHeader(self): shader_write_expansion = [e.name for e in shader_write_access.equivalent.accesses] out.append(f'static constexpr VkAccessFlags2 kShaderWriteExpandBits = {"|".join(shader_write_expansion)};\n') + all_transfer_stage = next((s for s in self.vk.syncStage if s.flag.name == 'VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT'), None) + all_transfer_expansion = [e.name for e in all_transfer_stage.equivalent.stages] + out.append(f'static constexpr VkPipelineStageFlags2 kAllTransferExpandBits = {"|".join(all_transfer_expansion)};\n') + out.append(f''' // Fake stages and accesses for acquire present support static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRESENT_ENGINE_BIT_SYNCVAL = 0x{(1 << self.pipelineStagePresentEngine.value):016X}ULL;