Moved ImplBind implementation from Texture2D to Texture

This commit is contained in:
Simon Lübeß
2021-04-09 19:31:49 +02:00
parent 72cb982b13
commit 5a8499ac43
2 changed files with 12 additions and 10 deletions
@@ -7,10 +7,20 @@ using internal GlitchyEngine.Renderer;
namespace GlitchyEngine.Renderer
{
extension Texture
{
protected internal ID3D11ShaderResourceView* nativeView ~ _?.Release();
protected override void ImplBind(uint32 slot)
{
_context.nativeContext.VertexShader.SetShaderResources(slot, 1, &nativeView);
_context.nativeContext.PixelShader.SetShaderResources(slot, 1, &nativeView);
}
}
extension Texture2D
{
internal ID3D11Texture2D* nativeTexture ~ _?.Release();
internal ID3D11ShaderResourceView* nativeView ~ _?.Release();
internal Texture2DDescription nativeDesc;
public override uint32 Width => nativeDesc.Width;
@@ -38,11 +48,5 @@ namespace GlitchyEngine.Renderer
nativeTexture.GetDescription(out nativeDesc);
}
protected override void ImplBind(uint32 slot)
{
_context.nativeContext.VertexShader.SetShaderResources(slot, 1, &nativeView);
_context.nativeContext.PixelShader.SetShaderResources(slot, 1, &nativeView);
}
}
}