mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Fixed crash when resizing window
This commit is contained in:
@@ -72,6 +72,8 @@ namespace GlitchyEngine.Renderer
|
||||
{
|
||||
PlatformCreateTexture();
|
||||
}
|
||||
|
||||
SetDebugNames();
|
||||
|
||||
if(_description.DepthStencilFormat != .Unknown)
|
||||
{
|
||||
@@ -131,6 +133,18 @@ namespace GlitchyEngine.Renderer
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDebugNames()
|
||||
{
|
||||
_nativeTexture.SetDebugName(Identifier);
|
||||
_nativeResourceView.SetDebugName(scope $"{Identifier}: SRV");
|
||||
_nativeRenderTargetView.SetDebugName(scope $"{Identifier}: RTV");
|
||||
|
||||
if (_depthStenilTarget != null)
|
||||
{
|
||||
_depthStenilTarget.nativeView.SetDebugName(scope $"{Identifier}: DSV");
|
||||
}
|
||||
}
|
||||
|
||||
protected override TextureViewBinding PlatformGetViewBinding()
|
||||
{
|
||||
return new .(_nativeResourceView, _samplerState?.nativeSamplerState);
|
||||
@@ -255,6 +269,7 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
ID3D11Texture2D* texture = null;
|
||||
var result = NativeDevice.CreateTexture2D(ref desc, null, &texture);
|
||||
texture.SetDebugName(target.DebugName);
|
||||
Log.EngineLogger.Assert(result.Succeeded, "Failed to create RenderTarget2D");
|
||||
|
||||
// TODO: calculate the max mip level
|
||||
|
||||
@@ -116,8 +116,9 @@ namespace GlitchyEngine.Renderer
|
||||
desc.IsSwapchainTarget = true;
|
||||
|
||||
_backBuffer = new RenderTarget2D(desc);
|
||||
_backBuffer.Identifier = "Backbuffer";
|
||||
_backBuffer.Identifier = "Back buffer";
|
||||
_backBuffer.SamplerState = SamplerStateManager.LinearClamp;
|
||||
_backBuffer.ApplyChanges();
|
||||
}
|
||||
|
||||
_backBufferViewport = GlitchyEngine.Renderer.Viewport(0, 0, _width, _height, 0.0f, 1.0f);
|
||||
|
||||
@@ -62,8 +62,6 @@ namespace GlitchyEngine.Renderer
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
_description = description;
|
||||
|
||||
ApplyChanges();
|
||||
}
|
||||
|
||||
/// Recreates the render target using the current description
|
||||
|
||||
Reference in New Issue
Block a user