@@ -118,13 +118,19 @@ Buffers
118
118
119
119
.. code-block :: llvm
120
120
121
- target("dx.Buffer", ElementType, IsWriteable, IsROV)
121
+ target("dx.TypedBuffer", ElementType, IsWriteable, IsROV)
122
+ target("dx.RawBuffer", ElementType, IsWriteable, IsROV)
122
123
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.
128
134
129
135
These types are generally used by BufferLoad and BufferStore operations, as
130
136
well as atomics.
@@ -145,6 +151,11 @@ There are a few fields to describe variants of all of these types:
145
151
* - IsROV
146
152
- Whether the UAV is a rasterizer ordered view. Always ``0 `` for SRVs.
147
153
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
+
148
159
Textures
149
160
--------
150
161
@@ -403,9 +414,6 @@ intrinsics.
403
414
.. note :: TODO: Can we always derive the alignment late, or do we need to
404
415
parametrize these ops?
405
416
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
-
409
417
.. note :: TODO: We need to account for `CheckAccessFullyMapped`_ here.
410
418
411
419
In DXIL the load operations always return an ``i32 `` status value, but this
0 commit comments