From bc593c655d0d8d2668d6c670853e7e2ddde007dc Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 12 Aug 2019 11:13:00 +0200 Subject: [PATCH] Minor bug fixes --- .../Buffers/Abstract/GraphicsResource.cs | 4 ++-- src/ComputeSharp.Graphics/CommandList.cs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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)