mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-23 22:48:07 -05:00
Update swapchain from native method instead of recreating it when video changed (#3562)
Recreating it works fine on Intel GPU, no issues on validation but didnt work on other cards, there is a better way to do this from native without dangling around Fixes https://github.com/Facepunch/sbox-issues/issues/9675
This commit is contained in:
@@ -18,6 +18,7 @@ native static class WidgetUtil Native.WidgetUtil
|
||||
|
||||
static void PaintSetFont( QPainter painter, string fontName, int size, int weight, bool italic, bool heightInPixels );
|
||||
static SwapChainHandle_t CreateSwapChain( QWidget target, RenderMultisampleType_t nMSAAAmount );
|
||||
static bool UpdateSwapChainMSAA( SwapChainHandle_t swapChain, RenderMultisampleType_t nMSAAAmount );
|
||||
|
||||
static void SetWindowNoActivate( QWidget widget );
|
||||
|
||||
|
||||
@@ -207,18 +207,15 @@ public class SceneRenderingWidget : Frame
|
||||
|
||||
internal void HandleVideoChanged()
|
||||
{
|
||||
var oldSwapChain = SwapChain;
|
||||
SwapChain = WidgetUtil.CreateSwapChain( _widget, RenderSettings.Instance.AntiAliasQuality.ToEngine() );
|
||||
var msaaAmount = RenderSettings.Instance.AntiAliasQuality.ToEngine();
|
||||
|
||||
if ( SwapChain == default )
|
||||
{
|
||||
SwapChain = oldSwapChain;
|
||||
SwapChain = WidgetUtil.CreateSwapChain( _widget, msaaAmount );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( oldSwapChain != default )
|
||||
{
|
||||
EngineLoop.DisposeAtFrameEnd( new Sandbox.Utility.DisposeAction( () => g_pRenderDevice.DestroySwapChain( oldSwapChain ) ) );
|
||||
}
|
||||
WidgetUtil.UpdateSwapChainMSAA( SwapChain, msaaAmount );
|
||||
}
|
||||
|
||||
internal static void RenderAll()
|
||||
|
||||
Reference in New Issue
Block a user