From 0e7db7d4b241de530e2a3eb175dc55844508bffe Mon Sep 17 00:00:00 2001 From: Shawn Hatori <5499686+shawnhatori@users.noreply.github.com> Date: Sun, 15 Jun 2025 19:33:09 -0400 Subject: [PATCH 1/2] [SPIR-V] Explicitly state which layout rules require scalar block layout --- docs/SPIR-V.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/SPIR-V.rst b/docs/SPIR-V.rst index 771cf0e5a2..0212f01e70 100644 --- a/docs/SPIR-V.rst +++ b/docs/SPIR-V.rst @@ -1011,18 +1011,16 @@ right now: They are the default. 2. DirectX memory layout rules for uniform buffers and storage buffers: they allow packing data on the application side that can be shared with - DirectX. They can be enabled by ``-fvk-use-dx-layout``. + DirectX. They can be enabled by ``-fvk-use-dx-layout``. NOTE: This requires + ``VK_EXT_scalar_block_layout`` to be enabled on the application side. 3. Strict OpenGL ``std140`` for uniform buffers and strict OpenGL ``std430`` for storage buffers: they allow packing data on the application side that can be shared with OpenGL. They can be enabled by ``-fvk-use-gl-layout``. 4. Scalar layout rules introduced via `VK_EXT_scalar_block_layout`, which basically aligns all aggregrate types according to their elements' - natural alignment. They can be enabled by ``-fvk-use-scalar-layout``. - -To use scalar layout, the application side need to request -``VK_EXT_scalar_block_layout``. This is also true for using DirectX memory -layout since there is no dedicated DirectX layout extension for Vulkan -(at least for now). So we must request something more permissive. + natural alignment. They can be enabled by ``-fvk-use-scalar-layout``. NOTE: + This requires ``VK_EXT_scalar_block_layout`` to be enabled on the application + side. In the above, "vector-relaxed OpenGL ``std140``/``std430``" rules mean OpenGL ``std140``/``std430`` rules with the following modification for vector type @@ -1032,7 +1030,7 @@ alignment: 2. If the above causes an `improper straddle `_, the alignment will be set to 16 bytes. -As an exmaple, for the following HLSL definition: +As an example, for the following HLSL definition: .. code:: hlsl From bcf2df0ec8b8d52608b01daa22eb4bd6a98b6854 Mon Sep 17 00:00:00 2001 From: Shawn Hatori <5499686+shawnhatori@users.noreply.github.com> Date: Sun, 15 Jun 2025 19:53:17 -0400 Subject: [PATCH 2/2] move addition to new line --- docs/SPIR-V.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/SPIR-V.rst b/docs/SPIR-V.rst index 0212f01e70..2bcdb99bfe 100644 --- a/docs/SPIR-V.rst +++ b/docs/SPIR-V.rst @@ -1011,16 +1011,19 @@ right now: They are the default. 2. DirectX memory layout rules for uniform buffers and storage buffers: they allow packing data on the application side that can be shared with - DirectX. They can be enabled by ``-fvk-use-dx-layout``. NOTE: This requires - ``VK_EXT_scalar_block_layout`` to be enabled on the application side. + DirectX. They can be enabled by ``-fvk-use-dx-layout``. + + NOTE: This requires ``VK_EXT_scalar_block_layout`` to be enabled on the + application side. 3. Strict OpenGL ``std140`` for uniform buffers and strict OpenGL ``std430`` for storage buffers: they allow packing data on the application side that can be shared with OpenGL. They can be enabled by ``-fvk-use-gl-layout``. 4. Scalar layout rules introduced via `VK_EXT_scalar_block_layout`, which basically aligns all aggregrate types according to their elements' - natural alignment. They can be enabled by ``-fvk-use-scalar-layout``. NOTE: - This requires ``VK_EXT_scalar_block_layout`` to be enabled on the application - side. + natural alignment. They can be enabled by ``-fvk-use-scalar-layout``. + + NOTE: This requires ``VK_EXT_scalar_block_layout`` to be enabled on the + application side. In the above, "vector-relaxed OpenGL ``std140``/``std430``" rules mean OpenGL ``std140``/``std430`` rules with the following modification for vector type