From 3623e6b07cbe2b74af1b2e8f01c88e692215ebf0 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 17 Mar 2022 14:42:43 -0700 Subject: [PATCH] add debug exception for binding a null texture --- src/Graphics/CommandBuffer.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Graphics/CommandBuffer.cs b/src/Graphics/CommandBuffer.cs index 03e001cd..a2961454 100644 --- a/src/Graphics/CommandBuffer.cs +++ b/src/Graphics/CommandBuffer.cs @@ -461,6 +461,17 @@ namespace MoonWorks.Graphics for (var i = 0; i < length; i += 1) { + #if DEBUG + if (textureSamplerBindings[i].Texture == null) + { + throw new NullReferenceException("Texture binding must not be null!"); + } + if (textureSamplerBindings[i].Texture == null) + { + throw new NullReferenceException("Sampler binding must not be null!"); + } + #endif + texturePtrs[i] = textureSamplerBindings[i].Texture.Handle; samplerPtrs[i] = textureSamplerBindings[i].Sampler.Handle; }