Skip to content

Commit 591b5c7

Browse files
committed
two buffer types
1 parent 0e230ca commit 591b5c7

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

llvm/docs/DirectX/DXILResources.rst

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,19 @@ Buffers
118118

119119
.. code-block:: llvm
120120
121-
target("dx.Buffer", ElementType, IsWriteable, IsROV)
121+
target("dx.TypedBuffer", ElementType, IsWriteable, IsROV)
122+
target("dx.RawBuffer", ElementType, IsWriteable, IsROV)
122123
123-
There is only one buffer type. This can represent both UAVs and SRVs via the
124-
``IsWriteable`` field. Since the type that's encoded is an llvm type, it
125-
handles both ``Buffer`` and ``StructuredBuffer`` uniformly. For ``RawBuffer``,
126-
the type is ``i8``, which is unambiguous since ``char`` isn't a legal type in
127-
HLSL.
124+
We need two separate buffer types to account for the differences between the
125+
16-byte `bufferLoad`_ / `bufferStore`_ operations that work on DXIL's
126+
TypedBuffers and the `rawBufferLoad`_ / `rawBufferStore`_ operations that are
127+
used for DXIL's RawBuffers and StructuredBuffers. We call the latter
128+
"RawBuffer" to match the naming of the operations, but it can represent both
129+
the Raw and Structured variants.
130+
131+
For TypedBuffer, the element type must be an integer or floating point type.
132+
For RawBuffer the type can be an integer, floating point, or struct type.
133+
HLSL's ByteAddressBuffer is represented by an `i8` element type.
128134

129135
These types are generally used by BufferLoad and BufferStore operations, as
130136
well as atomics.
@@ -145,6 +151,11 @@ There are a few fields to describe variants of all of these types:
145151
* - IsROV
146152
- Whether the UAV is a rasterizer ordered view. Always ``0`` for SRVs.
147153

154+
.. _bufferLoad: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#bufferload
155+
.. _bufferStore: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#bufferstore
156+
.. _rawBufferLoad: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#rawbufferload
157+
.. _rawBufferStore: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#rawbufferstore
158+
148159
Textures
149160
--------
150161

@@ -403,9 +414,6 @@ intrinsics.
403414
.. note:: TODO: Can we always derive the alignment late, or do we need to
404415
parametrize these ops?
405416

406-
.. _rawBufferLoad: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#rawbufferload
407-
.. _rawBufferStore: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#rawbufferstore
408-
409417
.. note:: TODO: We need to account for `CheckAccessFullyMapped`_ here.
410418

411419
In DXIL the load operations always return an ``i32`` status value, but this

0 commit comments

Comments
 (0)