From a9e1beeb003644f4034b9485ad00e273ad52c9f1 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 27 Jan 2020 15:04:29 -0500 Subject: CUDA implement StructuredBuffer/ByteAddressBuffer as pointer/count as is on CPU. (#1182) Allow bounds check to zero index. Update docs. --- docs/cuda-target.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/cuda-target.md b/docs/cuda-target.md index 41fc98790..01803c145 100644 --- a/docs/cuda-target.md +++ b/docs/cuda-target.md @@ -69,7 +69,7 @@ struct UniformState { CUtexObject tex; // This is the combination of a texture and a sampler(!) SamplerState sampler; // This variable exists within the layout, but it's value is not used. - int32_t* outputBuffer; // Currently Structured buffers are converted to pointers - this will likely change in the future (for bounds checking and other reasons) + RWStructuredBuffer outputBuffer; // This is implemented as a template in the CUDA prelude. It's just a pointer, and a size Thing* thing3; // Constant buffers map to pointers }; @@ -81,6 +81,20 @@ With CUDA - the caller specifies how threading is broken up, so `[numthreads]` i The UniformState and UniformEntryPointParams struct typically vary by shader. UniformState holds 'normal' bindings, whereas UniformEntryPointParams hold the uniform entry point parameters. Where specific bindings or parameters are located can be determined by reflection. The structures for the example above would be something like the following... +`StructuredBuffer`,`RWStructuredBuffer` become + +``` + T* data; + size_t count; +``` + +`ByteAddressBuffer`, `RWByteAddressBuffer` become + +``` + uint32_t* data; + size_t sizeInBytes; +``` + ## Unsized arrays WIP: Not implemented yet. -- cgit v1.2.3