Skip to content

Commit

Permalink
Documentation fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
csyonghe committed Jan 10, 2025
1 parent defd7ae commit 0666eb5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/proposals/015-descriptor-handle.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ All builtin types that implements `IOpaqueDescriptor` interface provide a conven

- `operator *` to deference the pointer and obatin the actual descriptor handle `T`.
- Implicit conversion to `T` when used in a location that expects `T`.
- When targeting HLSL, GLSL and SPIRV, `DescriptorHandle<T>` can be casted to and from a `uint2` value.
- When targeting HLSL, GLSL and SPIRV, `DescriptorHandle<T>` can be explicitly casted to and from a `uint2` value.
- Equality comparison.

For example:
Expand Down Expand Up @@ -168,7 +168,7 @@ void test(DescriptorHandle<Texture2D> t)
If the descriptor handle value is not uniform and `nonuniform` is not called, the result may be
undefined.

### Combind Texture Samplers
### Combined Texture Samplers

On platforms without native support for combined texture samplers, we will use both components of the
underlying `uint2` value: the `x` component stores the bindless handle for the texture, and the `y` component stores the bindless handle for the sampler.
Expand Down
22 changes: 14 additions & 8 deletions source/slang/hlsl.meta.slang
Original file line number Diff line number Diff line change
Expand Up @@ -20882,20 +20882,24 @@ struct ConstBufferPointer
// new aliased bindings for each distinct cast type.
//

/// Represent the kind of a descriptor type.
enum DescriptorKind
{
Unknown,
Texture,
CombinedTextureSampler,
Buffer,
Sampler,
AccelerationStructure,
Unknown, /// Unknown descriptor kind.
Texture, /// A texture descriptor.
CombinedTextureSampler, /// A combined texture and sampler state descriptor.
Buffer, /// A buffer descriptor.
Sampler, /// A sampler state descriptor.
AccelerationStructure, /// A ray tracing acceleration structure descriptor.
}

/// Represents an opaque descriptor type, such as textures, samplers, and buffers etc,
/// whose size may be undefined and can't be directly accessed as ordinary data.
[sealed]
[builtin]
interface IOpaqueDescriptor
{
/// The kind of the descriptor.
static const DescriptorKind kind;
}

Expand Down Expand Up @@ -21052,8 +21056,8 @@ T __makeCombinedTextureSamplerFromHandle<T, U>(U handle);
__intrinsic_op($(kIROp_CastDescriptorHandleToResource))
T __castDescriptorHandleToResource<T:IOpaqueDescriptor>(DescriptorHandle<T> ptr);

/// The default implementation of `getDescriptorFromHandle`, which converts from a bindless resource handle
/// to a typed resource object.
/// The default implementation of `getDescriptorFromHandle`, which converts from a descriptor handle
/// to a descriptor object.
[ForceInline]
T defaultGetDescriptorFromHandle<T:IOpaqueDescriptor>(DescriptorHandle<T> handleValue)
{
Expand All @@ -21075,6 +21079,8 @@ T defaultGetDescriptorFromHandle<T:IOpaqueDescriptor>(DescriptorHandle<T> handle
}
}

/// Declaration of the `getDescriptorFromHandle` that the user code can provide to customize
/// how a descriptor handle is converted into a actual descriptor.
[ForceInline]
extern T getDescriptorFromHandle<T:IOpaqueDescriptor>(DescriptorHandle<T> handleValue)
{
Expand Down

0 comments on commit 0666eb5

Please sign in to comment.