From 2120dede5dc68ad2893159dc97f2416d736e6c25 Mon Sep 17 00:00:00 2001 From: Nikos Kastellanos Date: Sat, 22 Feb 2025 15:21:12 +0200 Subject: [PATCH] simplify CreateDevice() IsRenderTargetBound is never true on a new Device --- .../.Android/ConcreteGraphicsDeviceManager.cs | 18 ++++++------------ .../ConcreteGraphicsDeviceManager.cs | 18 ++++++------------ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/Platforms/Game/.Android/ConcreteGraphicsDeviceManager.cs b/Platforms/Game/.Android/ConcreteGraphicsDeviceManager.cs index 9b005e9d7bc..df4bbf676f5 100644 --- a/Platforms/Game/.Android/ConcreteGraphicsDeviceManager.cs +++ b/Platforms/Game/.Android/ConcreteGraphicsDeviceManager.cs @@ -119,12 +119,9 @@ public override void CreateDevice() base.GraphicsDevice.PresentationParameters.BackBufferWidth = surfaceView.Width; base.GraphicsDevice.PresentationParameters.BackBufferHeight = surfaceView.Height; - if (!((IPlatformGraphicsContext)((IPlatformGraphicsDevice)base.GraphicsDevice).Strategy.MainContext).Strategy.IsRenderTargetBound) - { - PresentationParameters pp2 = this.GraphicsDevice.PresentationParameters; - base.GraphicsDevice.Viewport = new Viewport(0, 0, pp2.BackBufferWidth, pp2.BackBufferHeight); - base.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, pp2.BackBufferWidth, pp2.BackBufferHeight); - } + PresentationParameters pp2 = this.GraphicsDevice.PresentationParameters; + base.GraphicsDevice.Viewport = new Viewport(0, 0, pp2.BackBufferWidth, pp2.BackBufferHeight); + base.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, pp2.BackBufferWidth, pp2.BackBufferHeight); TouchPanel.DisplayWidth = base.GraphicsDevice.PresentationParameters.BackBufferWidth; TouchPanel.DisplayHeight = base.GraphicsDevice.PresentationParameters.BackBufferHeight; @@ -145,12 +142,9 @@ public override void CreateDevice() base.GraphicsDevice.PresentationParameters.BackBufferWidth = surfaceView.Width; base.GraphicsDevice.PresentationParameters.BackBufferHeight = surfaceView.Height; - if (!((IPlatformGraphicsContext)((IPlatformGraphicsDevice)base.GraphicsDevice).Strategy.MainContext).Strategy.IsRenderTargetBound) - { - PresentationParameters pp3 = this.GraphicsDevice.PresentationParameters; - base.GraphicsDevice.Viewport = new Viewport(0, 0, pp3.BackBufferWidth, pp3.BackBufferHeight); - base.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, pp3.BackBufferWidth, pp3.BackBufferHeight); - } + PresentationParameters pp3 = this.GraphicsDevice.PresentationParameters; + base.GraphicsDevice.Viewport = new Viewport(0, 0, pp3.BackBufferWidth, pp3.BackBufferHeight); + base.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, pp3.BackBufferWidth, pp3.BackBufferHeight); TouchPanel.DisplayWidth = base.GraphicsDevice.PresentationParameters.BackBufferWidth; TouchPanel.DisplayHeight = base.GraphicsDevice.PresentationParameters.BackBufferHeight; diff --git a/Platforms/Game/.CardboardLegacy/ConcreteGraphicsDeviceManager.cs b/Platforms/Game/.CardboardLegacy/ConcreteGraphicsDeviceManager.cs index 7fdd172a744..e379d2652f7 100644 --- a/Platforms/Game/.CardboardLegacy/ConcreteGraphicsDeviceManager.cs +++ b/Platforms/Game/.CardboardLegacy/ConcreteGraphicsDeviceManager.cs @@ -119,12 +119,9 @@ public override void CreateDevice() base.GraphicsDevice.PresentationParameters.BackBufferWidth = surfaceView.Width; base.GraphicsDevice.PresentationParameters.BackBufferHeight = surfaceView.Height; - if (!((IPlatformGraphicsContext)((IPlatformGraphicsDevice)base.GraphicsDevice).Strategy.MainContext).Strategy.IsRenderTargetBound) - { - PresentationParameters pp2 = this.GraphicsDevice.PresentationParameters; - base.GraphicsDevice.Viewport = new Viewport(0, 0, pp2.BackBufferWidth, pp2.BackBufferHeight); - base.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, pp2.BackBufferWidth, pp2.BackBufferHeight); - } + PresentationParameters pp2 = this.GraphicsDevice.PresentationParameters; + base.GraphicsDevice.Viewport = new Viewport(0, 0, pp2.BackBufferWidth, pp2.BackBufferHeight); + base.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, pp2.BackBufferWidth, pp2.BackBufferHeight); TouchPanel.DisplayWidth = base.GraphicsDevice.PresentationParameters.BackBufferWidth; TouchPanel.DisplayHeight = base.GraphicsDevice.PresentationParameters.BackBufferHeight; @@ -145,12 +142,9 @@ public override void CreateDevice() base.GraphicsDevice.PresentationParameters.BackBufferWidth = surfaceView.Width; base.GraphicsDevice.PresentationParameters.BackBufferHeight = surfaceView.Height; - if (!((IPlatformGraphicsContext)((IPlatformGraphicsDevice)base.GraphicsDevice).Strategy.MainContext).Strategy.IsRenderTargetBound) - { - PresentationParameters pp3 = this.GraphicsDevice.PresentationParameters; - base.GraphicsDevice.Viewport = new Viewport(0, 0, pp3.BackBufferWidth, pp3.BackBufferHeight); - base.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, pp3.BackBufferWidth, pp3.BackBufferHeight); - } + PresentationParameters pp3 = this.GraphicsDevice.PresentationParameters; + base.GraphicsDevice.Viewport = new Viewport(0, 0, pp3.BackBufferWidth, pp3.BackBufferHeight); + base.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, pp3.BackBufferWidth, pp3.BackBufferHeight); TouchPanel.DisplayWidth = base.GraphicsDevice.PresentationParameters.BackBufferWidth; TouchPanel.DisplayHeight = base.GraphicsDevice.PresentationParameters.BackBufferHeight;