mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Fixed RenderTargets leaking a texure when it's a Swapchain target
This commit is contained in:
@@ -46,8 +46,6 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
ReleaseAndNullify();
|
||||
|
||||
PlatformCreateTexture();
|
||||
|
||||
if(_description.IsSwapchainTarget)
|
||||
{
|
||||
// TODO: if the engine supports multiple windows it has to support multiple swap chains.
|
||||
@@ -59,6 +57,10 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
CreateViews();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlatformCreateTexture();
|
||||
}
|
||||
|
||||
if(_description.DepthStencilFormat != .None)
|
||||
{
|
||||
@@ -97,11 +99,25 @@ namespace GlitchyEngine.Renderer
|
||||
{
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
var result = NativeDevice.CreateShaderResourceView(_nativeTexture, null, &_nativeResourceView);
|
||||
Log.EngineLogger.Assert(result.Succeeded, "Failed to create resource view");
|
||||
if(_description.IsSwapchainTarget)
|
||||
{
|
||||
var result = NativeDevice.CreateShaderResourceView(_nativeTexture, null, &_nativeResourceView);
|
||||
Log.EngineLogger.Assert(result.Succeeded, "Failed to create resource view");
|
||||
|
||||
result = NativeDevice.CreateRenderTargetView(_nativeTexture, null, &_nativeRenderTargetView);
|
||||
Log.EngineLogger.Assert(result.Succeeded, "Failed to create render target view");
|
||||
// TODO: SRGB...
|
||||
//RenderTargetViewDescription rtvDesc = .(_nativeTexture, .Texture2D, .R8G8B8A8_UNorm_SRGB);
|
||||
//result = NativeDevice.CreateRenderTargetView(_nativeTexture, &rtvDesc, &_nativeRenderTargetView);
|
||||
result = NativeDevice.CreateRenderTargetView(_nativeTexture, null, &_nativeRenderTargetView);
|
||||
Log.EngineLogger.Assert(result.Succeeded, "Failed to create render target view");
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = NativeDevice.CreateShaderResourceView(_nativeTexture, null, &_nativeResourceView);
|
||||
Log.EngineLogger.Assert(result.Succeeded, "Failed to create resource view");
|
||||
|
||||
result = NativeDevice.CreateRenderTargetView(_nativeTexture, null, &_nativeRenderTargetView);
|
||||
Log.EngineLogger.Assert(result.Succeeded, "Failed to create render target view");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user