You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* CUDA support for array of resources.
* * Add support for Texture2DArray on CPU
* Expand texture-simple.slang to test Texture2DArray
* Reorganise CUDAComputeUtil to split out createTextureResource.
* Add TextureCubeArray support for CPU/CUDA targets.
* Pulled out CUDAResource
Renamed derived classes to reflect that change.
* Creation of SurfObject type.
* Functions to return read/write access for simplifying future additions.
* WIP for RWTexture access on CPU/CUDA.
* CUsurfObject cannot have mips.
* Ability to set number of mips on test data.
Preliminary support for CUsurfObj and RWTexture1D on CUDA.
CUDA docs improvements.
* Fix typo.
Copy file name to clipboardexpand all lines: docs/cuda-target.md
+28-3
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,14 @@ These limitations apply to Slang transpiling to CUDA.
16
16
17
17
* Only supports the 'texture object' style binding (The texture object API is only supported on devices of compute capability 3.0 or higher. )
18
18
* Samplers are not separate objects in CUDA - they are combined into a single 'TextureObject'. So samplers are effectively ignored on CUDA targets.
19
-
* Whilst there is tex1Dfetch there are no equivalents for higher dimensions - so such accesses are not currently supported
20
19
* When using a TextureArray (layered texture in CUDA) - the index will be treated as an int, as this is all CUDA allows
21
20
* Care must be used in using `WaveGetLaneIndex` wave intrinsic - it will only give the right results for appopriate launches
21
+
* Surfaces are used for textures which are read/write. CUDA does NOT do format conversion with surfaces.
22
22
23
-
The following are a work in progress or not implmented but are planned to be so in the future
23
+
The following are a work in progress or not implemented but are planned to be so in the future
24
24
25
-
* Resource types including surfaces
25
+
* Some resource types remain unsupported, and not all methods on types are supported
26
+
* Some support for Wave intrinsics
26
27
27
28
# How it works
28
29
@@ -96,6 +97,30 @@ The UniformState and UniformEntryPointParams struct typically vary by shader. Un
96
97
size_t sizeInBytes;
97
98
```
98
99
100
+
## Texture
101
+
102
+
Read only textures will be bound as the opaque CUDA type CUtexObject. This type is the combination of both a texture AND a sampler. This is somewhat different from HLSL, where there can be separate `SamplerState` variables. This allows access of a single texture binding with different types of sampling.
103
+
104
+
If code relys on this behavior it will be necessary to bind multiple CtexObjects with different sampler settings, accessing the same texture data.
105
+
106
+
Slang has some preliminary support for TextureSampler type - a combined Texture and SamplerState. To write Slang code that can target CUDA and other platforms using this mechanism will expose the semantics appropriately within the source.
107
+
108
+
Load is only supported for Texture1D, and the mip map selection argument is ignored. This is because there is tex1Dfetch and no higher dimensional equivalents. CUDA also only allows such access if the backing array is linear memory - meaning the bound texture cannot have mip maps - thus making the mip map parameter superflous anyway. RWTexture does allow Load on other texture types.
109
+
110
+
## RWTexture
111
+
112
+
RWTexture types are converted into CUsurfObject type.
113
+
114
+
In CUDA it is not possible to do a format conversion on an access to a CUsurfObject, so it must be backed by the same data format as is used within the Slang source code.
115
+
116
+
It is also worth noting that CUsurfObjects in CUDA are NOT allowed to have mip maps.
117
+
118
+
By default surface access uses cudaBoundaryModeZero, this can be replaced using the macro SLANG_CUDA_BOUNDARY_MODE in the CUDA prelude.
119
+
120
+
## Sampler
121
+
122
+
Samplers are in effect ignored in CUDA output. Currently we do output a variable `SamplerState`, but this value is never accessed within the kernel and so can be ignored. More discussion on this behavior is in `Texture` section.
123
+
99
124
## Unsized arrays
100
125
101
126
Unsized arrays can be used, which are indicated by an array with no size as in `[]`. For example
0 commit comments