diff --git a/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs b/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs
index e8318b60..46f42eec 100644
--- a/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs
+++ b/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs
@@ -35,12 +35,12 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
///
/// Gets the instance for the current resource
///
- protected internal CpuDescriptorHandle NativeCpuDescriptorHandle { get; protected set; }
+ protected internal CpuDescriptorHandle? NativeCpuDescriptorHandle { get; protected set; }
///
/// Gets the instance for the current resource
///
- protected internal GpuDescriptorHandle NativeGpuDescriptorHandle { get; protected set; }
+ protected internal GpuDescriptorHandle? NativeGpuDescriptorHandle { get; protected set; }
///
/// Maps the current resource to a specified subresource
diff --git a/src/ComputeSharp.Graphics/CommandList.cs b/src/ComputeSharp.Graphics/CommandList.cs
index 99702716..355f1981 100644
--- a/src/ComputeSharp.Graphics/CommandList.cs
+++ b/src/ComputeSharp.Graphics/CommandList.cs
@@ -110,7 +110,8 @@ namespace ComputeSharp.Graphics
public void SetGraphicsRootDescriptorTable(int rootParameterIndex, GraphicsResource resource)
{
- SetGraphicsRootDescriptorTable(rootParameterIndex, resource.NativeGpuDescriptorHandle);
+ if (resource.NativeGpuDescriptorHandle == null) throw new InvalidOperationException("Invalid graphics resource GPU descriptor");
+ SetGraphicsRootDescriptorTable(rootParameterIndex, resource.NativeGpuDescriptorHandle.Value);
}
public void SetGraphicsRootDescriptorTable(int rootParameterIndex, GpuDescriptorHandle baseDescriptor)
@@ -130,7 +131,8 @@ namespace ComputeSharp.Graphics
public void SetComputeRootDescriptorTable(int rootParameterIndex, GraphicsResource resource)
{
- SetComputeRootDescriptorTable(rootParameterIndex, resource.NativeGpuDescriptorHandle);
+ if (resource.NativeGpuDescriptorHandle == null) throw new InvalidOperationException("Invalid graphics resource GPU descriptor");
+ SetComputeRootDescriptorTable(rootParameterIndex, resource.NativeGpuDescriptorHandle.Value);
}
public void SetComputeRootDescriptorTable(int rootParameterIndex, GpuDescriptorHandle baseDescriptor)