aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Lao <cclao@google.com>2024-04-24 14:41:59 -0700
committerAngle LUCI CQ <angle-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-04-29 22:06:45 +0000
commit1064b38d8d7d2079d11ae35aeaf5b46e7e810fb5 (patch)
tree3ebebb0b5c634cbd2d4546d85ae359532699f1d8
parent4929e1df3e20790afdc1f7c39cc74a5c6473a077 (diff)
downloadangle-1064b38d8d7d2079d11ae35aeaf5b46e7e810fb5.tar.gz
Vulkan: Move ImageLayout define to earlier in vk_helpers.h file
This is the preparation for the later CL. Later in the CL I need to define something like "angle::PackedEnumMap<ImageLayout, RefCountedEvent>" to use in CommandBufferHelperCommon. So I need ImageLayout to be defined earlier. No actual changes involved other than moving the code around for easier code review. Bug: b/336844257 Change-Id: I0a2553ef3aebf4b00d1798e2117fe6ed32ac172d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5484675 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
-rw-r--r--src/libANGLE/renderer/vulkan/vk_helpers.h212
1 files changed, 106 insertions, 106 deletions
diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.h b/src/libANGLE/renderer/vulkan/vk_helpers.h
index 7a4c4466a4..d173a106e1 100644
--- a/src/libANGLE/renderer/vulkan/vk_helpers.h
+++ b/src/libANGLE/renderer/vulkan/vk_helpers.h
@@ -61,6 +61,112 @@ using ImageLayerWriteMask = std::bitset<kMaxParallelLayerWrites
using StagingBufferOffsetArray = std::array<VkDeviceSize, 2>;
+// Imagine an image going through a few layout transitions:
+//
+// srcStage 1 dstStage 2 srcStage 2 dstStage 3
+// Layout 1 ------Transition 1-----> Layout 2 ------Transition 2------> Layout 3
+// srcAccess 1 dstAccess 2 srcAccess 2 dstAccess 3
+// \_________________ ___________________/
+// \/
+// A transition
+//
+// Every transition requires 6 pieces of information: from/to layouts, src/dst stage masks and
+// src/dst access masks. At the moment we decide to transition the image to Layout 2 (i.e.
+// Transition 1), we need to have Layout 1, srcStage 1 and srcAccess 1 stored as history of the
+// image. To perform the transition, we need to know Layout 2, dstStage 2 and dstAccess 2.
+// Additionally, we need to know srcStage 2 and srcAccess 2 to retain them for the next transition.
+//
+// That is, with the history kept, on every new transition we need 5 pieces of new information:
+// layout/dstStage/dstAccess to transition into the layout, and srcStage/srcAccess for the future
+// transition out from it. Given the small number of possible combinations of these values, an
+// enum is used were each value encapsulates these 5 pieces of information:
+//
+// +--------------------------------+
+// srcStage 1 | dstStage 2 srcStage 2 | dstStage 3
+// Layout 1 ------Transition 1-----> Layout 2 ------Transition 2------> Layout 3
+// srcAccess 1 |dstAccess 2 srcAccess 2| dstAccess 3
+// +--------------- ---------------+
+// \/
+// One enum value
+//
+// Note that, while generally dstStage for the to-transition and srcStage for the from-transition
+// are the same, they may occasionally be BOTTOM_OF_PIPE and TOP_OF_PIPE respectively.
+enum class ImageLayout
+{
+ Undefined = 0,
+ // Framebuffer attachment layouts are placed first, so they can fit in fewer bits in
+ // PackedAttachmentOpsDesc.
+
+ // Color (Write):
+ ColorWrite,
+ MSRTTEmulationColorUnresolveAndResolve,
+
+ // Depth (Write), Stencil (Write)
+ DepthWriteStencilWrite,
+
+ // Depth (Write), Stencil (Read)
+ DepthWriteStencilRead,
+ DepthWriteStencilReadFragmentShaderStencilRead,
+ DepthWriteStencilReadAllShadersStencilRead,
+
+ // Depth (Read), Stencil (Write)
+ DepthReadStencilWrite,
+ DepthReadStencilWriteFragmentShaderDepthRead,
+ DepthReadStencilWriteAllShadersDepthRead,
+
+ // Depth (Read), Stencil (Read)
+ DepthReadStencilRead,
+ DepthReadStencilReadFragmentShaderRead,
+ DepthReadStencilReadAllShadersRead,
+
+ // The GENERAL layout is used when there's a feedback loop. For depth/stencil it does't matter
+ // which aspect is participating in feedback and whether the other aspect is read-only.
+ ColorWriteFragmentShaderFeedback,
+ ColorWriteAllShadersFeedback,
+ DepthStencilFragmentShaderFeedback,
+ DepthStencilAllShadersFeedback,
+
+ // Depth/stencil resolve is special because it uses the _color_ output stage and mask
+ DepthStencilResolve,
+ MSRTTEmulationDepthStencilUnresolveAndResolve,
+
+ Present,
+ SharedPresent,
+ // The rest of the layouts.
+ ExternalPreInitialized,
+ ExternalShadersReadOnly,
+ ExternalShadersWrite,
+ TransferSrc,
+ TransferDst,
+ TransferSrcDst,
+ // Used when the image is transitioned on the host for use by host image copy
+ HostCopy,
+ VertexShaderReadOnly,
+ VertexShaderWrite,
+ // PreFragment == Vertex, Tessellation and Geometry stages
+ PreFragmentShadersReadOnly,
+ PreFragmentShadersWrite,
+ FragmentShadingRateAttachmentReadOnly,
+ FragmentShaderReadOnly,
+ FragmentShaderWrite,
+ ComputeShaderReadOnly,
+ ComputeShaderWrite,
+ AllGraphicsShadersReadOnly,
+ AllGraphicsShadersWrite,
+ TransferDstAndComputeWrite,
+
+ InvalidEnum,
+ EnumCount = InvalidEnum,
+};
+
+VkImageCreateFlags GetImageCreateFlags(gl::TextureType textureType);
+
+ImageLayout GetImageLayoutFromGLImageLayout(Context *context, GLenum layout);
+
+GLenum ConvertImageLayoutToGLImageLayout(ImageLayout imageLayout);
+
+VkImageLayout ConvertImageLayoutToVkImageLayout(Context *context, ImageLayout imageLayout);
+
// A dynamic buffer is conceptually an infinitely long buffer. Each time you write to the buffer,
// you will always write to a previously unused portion. After a series of writes, you must flush
// the buffer data to the device. Buffer lifetime currently assumes that each new allocation will
@@ -1799,112 +1905,6 @@ class CommandBufferRecycler
std::vector<CommandBufferHelperT *> mCommandBufferHelperFreeList;
};
-// Imagine an image going through a few layout transitions:
-//
-// srcStage 1 dstStage 2 srcStage 2 dstStage 3
-// Layout 1 ------Transition 1-----> Layout 2 ------Transition 2------> Layout 3
-// srcAccess 1 dstAccess 2 srcAccess 2 dstAccess 3
-// \_________________ ___________________/
-// \/
-// A transition
-//
-// Every transition requires 6 pieces of information: from/to layouts, src/dst stage masks and
-// src/dst access masks. At the moment we decide to transition the image to Layout 2 (i.e.
-// Transition 1), we need to have Layout 1, srcStage 1 and srcAccess 1 stored as history of the
-// image. To perform the transition, we need to know Layout 2, dstStage 2 and dstAccess 2.
-// Additionally, we need to know srcStage 2 and srcAccess 2 to retain them for the next transition.
-//
-// That is, with the history kept, on every new transition we need 5 pieces of new information:
-// layout/dstStage/dstAccess to transition into the layout, and srcStage/srcAccess for the future
-// transition out from it. Given the small number of possible combinations of these values, an
-// enum is used were each value encapsulates these 5 pieces of information:
-//
-// +--------------------------------+
-// srcStage 1 | dstStage 2 srcStage 2 | dstStage 3
-// Layout 1 ------Transition 1-----> Layout 2 ------Transition 2------> Layout 3
-// srcAccess 1 |dstAccess 2 srcAccess 2| dstAccess 3
-// +--------------- ---------------+
-// \/
-// One enum value
-//
-// Note that, while generally dstStage for the to-transition and srcStage for the from-transition
-// are the same, they may occasionally be BOTTOM_OF_PIPE and TOP_OF_PIPE respectively.
-enum class ImageLayout
-{
- Undefined = 0,
- // Framebuffer attachment layouts are placed first, so they can fit in fewer bits in
- // PackedAttachmentOpsDesc.
-
- // Color (Write):
- ColorWrite,
- MSRTTEmulationColorUnresolveAndResolve,
-
- // Depth (Write), Stencil (Write)
- DepthWriteStencilWrite,
-
- // Depth (Write), Stencil (Read)
- DepthWriteStencilRead,
- DepthWriteStencilReadFragmentShaderStencilRead,
- DepthWriteStencilReadAllShadersStencilRead,
-
- // Depth (Read), Stencil (Write)
- DepthReadStencilWrite,
- DepthReadStencilWriteFragmentShaderDepthRead,
- DepthReadStencilWriteAllShadersDepthRead,
-
- // Depth (Read), Stencil (Read)
- DepthReadStencilRead,
- DepthReadStencilReadFragmentShaderRead,
- DepthReadStencilReadAllShadersRead,
-
- // The GENERAL layout is used when there's a feedback loop. For depth/stencil it does't matter
- // which aspect is participating in feedback and whether the other aspect is read-only.
- ColorWriteFragmentShaderFeedback,
- ColorWriteAllShadersFeedback,
- DepthStencilFragmentShaderFeedback,
- DepthStencilAllShadersFeedback,
-
- // Depth/stencil resolve is special because it uses the _color_ output stage and mask
- DepthStencilResolve,
- MSRTTEmulationDepthStencilUnresolveAndResolve,
-
- Present,
- SharedPresent,
- // The rest of the layouts.
- ExternalPreInitialized,
- ExternalShadersReadOnly,
- ExternalShadersWrite,
- TransferSrc,
- TransferDst,
- TransferSrcDst,
- // Used when the image is transitioned on the host for use by host image copy
- HostCopy,
- VertexShaderReadOnly,
- VertexShaderWrite,
- // PreFragment == Vertex, Tessellation and Geometry stages
- PreFragmentShadersReadOnly,
- PreFragmentShadersWrite,
- FragmentShadingRateAttachmentReadOnly,
- FragmentShaderReadOnly,
- FragmentShaderWrite,
- ComputeShaderReadOnly,
- ComputeShaderWrite,
- AllGraphicsShadersReadOnly,
- AllGraphicsShadersWrite,
- TransferDstAndComputeWrite,
-
- InvalidEnum,
- EnumCount = InvalidEnum,
-};
-
-VkImageCreateFlags GetImageCreateFlags(gl::TextureType textureType);
-
-ImageLayout GetImageLayoutFromGLImageLayout(Context *context, GLenum layout);
-
-GLenum ConvertImageLayoutToGLImageLayout(ImageLayout imageLayout);
-
-VkImageLayout ConvertImageLayoutToVkImageLayout(Context *context, ImageLayout imageLayout);
-
// The source of update to an ImageHelper
enum class UpdateSource
{