@@ -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
129135These types are generally used by BufferLoad and BufferStore operations, as
130136well 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+
148159Textures
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