Engine barely starts again

This commit is contained in:
Simon Lübeß
2024-11-21 18:16:41 +01:00
parent ad73abd4ea
commit bcf75bf8cb
32 changed files with 299 additions and 161 deletions
@@ -19,7 +19,7 @@ namespace ImGui
ImGui.Image(view, size, uv0, uv1, tint_col, border_col);
textureViewBinding.Release();
textureViewBinding.ReleaseRef();
}
public static override bool ImageButton(char8* id, TextureViewBinding textureViewBinding, Vec2 imageSize, Vec2 uv0 = Vec2.Zero, Vec2 uv1 = Vec2.Ones, Vec4 bg_col = Vec4.Zero, Vec4 tint_col = Vec4.Ones)
@@ -29,7 +29,7 @@ namespace ImGui
bool pressed = ImGui.ImageButton(id, view, imageSize, uv0, uv1, bg_col, tint_col);
textureViewBinding.Release();
textureViewBinding.ReleaseRef();
return pressed;
}
@@ -41,7 +41,7 @@ namespace ImGui
bool pressed = ImGui.ImageButtonEx(id, view, imageSize, uv0, uv1, bg_col, tint_col);
textureViewBinding.Release();
textureViewBinding.ReleaseRef();
return pressed;
}
@@ -123,7 +123,7 @@ namespace GlitchyEngine.Renderer
protected override TextureViewBinding PlatformGetViewBinding()
{
return .(_nativeResourceView, _samplerState.nativeSamplerState);
return new .(_nativeResourceView, _samplerState.nativeSamplerState);
}
protected override void PlatformSneakySwappyTexture(RenderTarget2D otherTexture)
@@ -448,13 +448,13 @@ namespace GlitchyEngine.Renderer
{
if (index == -1)
{
return .(_nativeDepthResourceView, _depthSamplerState.nativeSamplerState);
return new .(_nativeDepthResourceView, _depthSamplerState.nativeSamplerState);
}
else
{
Log.EngineLogger.AssertDebug(index < _nativeResourceViews.Count);
return .(_nativeResourceViews[index], _colorSamplerStates[index].nativeSamplerState);
return new .(_nativeResourceViews[index], _colorSamplerStates[index].nativeSamplerState);
}
}
@@ -92,10 +92,12 @@ namespace GlitchyEngine.Renderer
using (BlendState lastBlendState = _currentBlendState..AddRef())
{
SetBlendState(_nonblendingState);
_clearUintFx.Variables["ClearValue"].SetData(value);
_clearUintFx.ApplyChanges();
_clearUintFx.Bind();
var v = _clearUintFx.Get();
v.Variables["ClearValue"].SetData(value);
v.ApplyChanges();
v.Bind();
FullscreenQuad.Draw();
@@ -291,7 +291,7 @@ namespace GlitchyEngine.Renderer
protected override TextureViewBinding PlatformGetViewBinding()
{
return .(_nativeResourceView, _samplerState?.nativeSamplerState);
return new .(_nativeResourceView, _samplerState?.nativeSamplerState);
}
}
@@ -466,7 +466,7 @@ namespace GlitchyEngine.Renderer
protected override TextureViewBinding PlatformGetViewBinding()
{
return .(_nativeResourceView, _samplerState?.nativeSamplerState);
return new .(_nativeResourceView, _samplerState?.nativeSamplerState);
}
}
}
@@ -12,24 +12,18 @@ namespace GlitchyEngine.Renderer
internal this(ID3D11ShaderResourceView* shaderResourceView, ID3D11SamplerState* samplerState)
{
_nativeShaderResourceView = shaderResourceView;
if ((uint)(void*)_nativeShaderResourceView != 0 && (uint)(void*)_nativeShaderResourceView < 200)
{
}
_nativeShaderResourceView?.AddRef();
_nativeSamplerState = samplerState;
_nativeSamplerState?.AddRef();
}
public override void AddRef()
{
_nativeShaderResourceView?.AddRef();
_nativeSamplerState?.AddRef();
}
public override void Release()
{
_nativeShaderResourceView?.Release();
_nativeSamplerState?.Release();
}
public static override TextureViewBinding CreateDefault() => .(null, null);
public static override TextureViewBinding CreateDefault() => new .(null, null);
}
}