TextureSamplerBinding now stores IntPtrs

main
cosmonaut 2022-05-23 19:12:17 -07:00
parent 4756fe2b14
commit 9862bfd0a0
2 changed files with 19 additions and 11 deletions

View File

@ -1,14 +1,22 @@
namespace MoonWorks.Graphics
using System;
namespace MoonWorks.Graphics
{
public struct TextureSamplerBinding
{
public Texture Texture;
public Sampler Sampler;
public IntPtr TextureHandle;
public IntPtr SamplerHandle;
public TextureSamplerBinding(Texture texture, Sampler sampler)
{
Texture = texture;
Sampler = sampler;
TextureHandle = texture.Handle;
SamplerHandle = sampler.Handle;
}
public TextureSamplerBinding(IntPtr textureHandle, IntPtr samplerHandle)
{
TextureHandle = textureHandle;
SamplerHandle = samplerHandle;
}
}
}

View File

@ -425,8 +425,8 @@ namespace MoonWorks.Graphics
for (var i = 0; i < length; i += 1)
{
texturePtrs[i] = textureSamplerBindings[i].Texture.Handle;
samplerPtrs[i] = textureSamplerBindings[i].Sampler.Handle;
texturePtrs[i] = textureSamplerBindings[i].TextureHandle;
samplerPtrs[i] = textureSamplerBindings[i].SamplerHandle;
}
Refresh.Refresh_BindVertexSamplers(
@ -464,18 +464,18 @@ namespace MoonWorks.Graphics
for (var i = 0; i < length; i += 1)
{
#if DEBUG
if (textureSamplerBindings[i].Texture == null)
if (textureSamplerBindings[i].TextureHandle == IntPtr.Zero)
{
throw new NullReferenceException("Texture binding must not be null!");
}
if (textureSamplerBindings[i].Texture == null)
if (textureSamplerBindings[i].TextureHandle == IntPtr.Zero)
{
throw new NullReferenceException("Sampler binding must not be null!");
}
#endif
texturePtrs[i] = textureSamplerBindings[i].Texture.Handle;
samplerPtrs[i] = textureSamplerBindings[i].Sampler.Handle;
texturePtrs[i] = textureSamplerBindings[i].TextureHandle;
samplerPtrs[i] = textureSamplerBindings[i].SamplerHandle;
}
Refresh.Refresh_BindFragmentSamplers(