diff --git a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs
index fd4dea7c..1bc7e9f6 100644
--- a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs
+++ b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs
@@ -76,6 +76,119 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
+ ///
+ /// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
+ ///
+ /// The type of values stored in the input texture.
+ /// The input instance to check.
+ /// The target instance in use.
+ /// The GPU descriptor handle for the texture.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static unsafe ulong ValidateAndGetGpuDescriptorHandle(ReadOnlyTexture1D texture, GraphicsDevice device)
+ where T : unmanaged
+ {
+ Guard.IsNotNull(texture);
+
+ using var _0 = texture.GetReferenceTrackingLease();
+
+ texture.ThrowIfDeviceMismatch(device);
+
+ D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle = texture.D3D12GpuDescriptorHandle;
+
+ return *(ulong*)&d3D12GpuDescriptorHandle;
+ }
+
+ ///
+ /// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
+ ///
+ /// The type of values stored in the input texture.
+ /// The input instance to check.
+ /// The target instance in use.
+ /// The GPU descriptor handle for the texture.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static unsafe ulong ValidateAndGetGpuDescriptorHandle(ReadWriteTexture1D texture, GraphicsDevice device)
+ where T : unmanaged
+ {
+ Guard.IsNotNull(texture);
+
+ using var _0 = texture.GetReferenceTrackingLease();
+
+ texture.ThrowIfDeviceMismatch(device);
+
+ D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle = texture.D3D12GpuDescriptorHandle;
+
+ return *(ulong*)&d3D12GpuDescriptorHandle;
+ }
+
+ ///
+ /// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
+ ///
+ /// The type of values stored in the input texture.
+ /// The input instance to check.
+ /// The target instance in use.
+ /// The GPU descriptor handle for the texture.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadOnlyTexture1D texture, GraphicsDevice device)
+ where T : unmanaged
+ {
+ Guard.IsNotNull(texture);
+
+ if (texture is IGraphicsResource resource)
+ {
+ D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle = resource.ValidateAndGetGpuDescriptorHandle(device);
+
+ return *(ulong*)&d3D12GpuDescriptorHandle;
+ }
+
+ return ThrowHelper.ThrowArgumentException("The input texture is not a valid instance.");
+ }
+
+ ///
+ /// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
+ ///
+ /// The type of normalized values stored in the input texture.
+ /// The input instance to check.
+ /// The target instance in use.
+ /// The GPU descriptor handle for the texture.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadOnlyNormalizedTexture1D texture, GraphicsDevice device)
+ where TPixel : unmanaged
+ {
+ Guard.IsNotNull(texture);
+
+ if (texture is IGraphicsResource resource)
+ {
+ D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle = resource.ValidateAndGetGpuDescriptorHandle(device);
+
+ return *(ulong*)&d3D12GpuDescriptorHandle;
+ }
+
+ return ThrowHelper.ThrowArgumentException("The input texture is not a valid instance.");
+ }
+
+ ///
+ /// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
+ ///
+ /// The type of normalized values stored in the input texture.
+ /// The input instance to check.
+ /// The target instance in use.
+ /// The GPU descriptor handle for the texture.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadWriteNormalizedTexture1D texture, GraphicsDevice device)
+ where TPixel : unmanaged
+ {
+ Guard.IsNotNull(texture);
+
+ if (texture is IGraphicsResource resource)
+ {
+ D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle = resource.ValidateAndGetGpuDescriptorHandle(device);
+
+ return *(ulong*)&d3D12GpuDescriptorHandle;
+ }
+
+ return ThrowHelper.ThrowArgumentException("The input texture is not a valid instance.");
+ }
+
///
/// Validates the given texture for usage with a specified device, and retrieves its GPU descriptor handle.
///