add debug exception for binding a null texture

main
cosmonaut 2022-03-17 14:42:43 -07:00
parent 1b5221f2c7
commit 3623e6b07c
1 changed files with 11 additions and 0 deletions

View File

@ -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;
}