@@ -274,6 +274,50 @@ Examples:
274
274
@llvm.dx.handle.fromHeap.tdx.RawBuffer_v4f32_1_0(
275
275
i32 2, i1 false)
276
276
277
+ Accessing Resources as Memory
278
+ -----------------------------
279
+
280
+ *relevant types: Buffers, CBuffer, and Textures *
281
+
282
+ Loading and storing from resources is generally represented in LLVM using
283
+ operations on memory that is only accessible via a handle object. Given a
284
+ handle, `llvm.dx.resource.getpointer ` gives a pointer that can be used to read
285
+ and (depending on type) write to the resource.
286
+
287
+ Accesses using `llvm.dx.resource.getpointer ` are replaced with direct load and
288
+ store operations in the `DXILResourceAccess ` pass. These direct loads and
289
+ stores are described later in this document.
290
+
291
+ .. note :: Currently the pointers returned by `dx.resource.getpointer` are in
292
+ the default address space, but that will likely change in the future.
293
+
294
+ .. list-table :: ``@llvm.dx.resource.getpointer``
295
+ :header-rows: 1
296
+
297
+ * - Argument
298
+ -
299
+ - Type
300
+ - Description
301
+ * - Return value
302
+ -
303
+ - Pointer
304
+ - A pointer to an object in the buffer
305
+ * - ``%buffer ``
306
+ - 0
307
+ - ``target(dx.TypedBuffer, ...) ``
308
+ - The buffer to access
309
+ * - ``%index ``
310
+ - 1
311
+ - ``i32 ``
312
+ - Index into the buffer
313
+
314
+ Examples:
315
+
316
+ .. code-block :: llvm
317
+
318
+ %ptr = call ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_v4f32_0_0_0t(
319
+ target("dx.TypedBuffer", <4 x float>, 0, 0, 0) %buffer, i32 %index)
320
+
277
321
16-byte Loads, Samples, and Gathers
278
322
-----------------------------------
279
323
0 commit comments