Skip to content

Commit 56f7639

Browse files
committed
disable multisampling in render targets
1 parent 2c9c40b commit 56f7639

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

Intersect.Client/MonoGame/Graphics/MonoRenderTexture.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Intersect.Client.Framework.Graphics;
1+
using Intersect.Client.Framework.Graphics;
22

33
using Microsoft.Xna.Framework;
44
using Microsoft.Xna.Framework.Graphics;
@@ -20,9 +20,15 @@ public partial class MonoRenderTexture : GameRenderTexture
2020
public MonoRenderTexture(GraphicsDevice graphicsDevice, int width, int height) : base(width, height)
2121
{
2222
mRenderTexture = new RenderTarget2D(
23-
graphicsDevice, width, height, false, graphicsDevice.PresentationParameters.BackBufferFormat,
24-
graphicsDevice.PresentationParameters.DepthStencilFormat,
25-
graphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents
23+
graphicsDevice,
24+
width,
25+
height,
26+
mipMap: false,
27+
preferredFormat: graphicsDevice.PresentationParameters.BackBufferFormat,
28+
preferredDepthFormat: graphicsDevice.PresentationParameters.DepthStencilFormat,
29+
/* For whatever reason if this isn't zero everything breaks in .NET 7 on MacOS and most Windows devices */
30+
preferredMultiSampleCount: 0, // graphicsDevice.PresentationParameters.MultiSampleCount,
31+
usage: RenderTargetUsage.PreserveContents
2632
);
2733

2834
RenderTextureCount++;

Intersect.Client/MonoGame/Graphics/MonoRenderer.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using MathHelper = Intersect.Utilities.MathHelper;
1919
using XNARectangle = Microsoft.Xna.Framework.Rectangle;
2020
using XNAColor = Microsoft.Xna.Framework.Color;
21-
2221
namespace Intersect.Client.MonoGame.Graphics
2322
{
2423

@@ -929,10 +928,15 @@ public override bool BeginScreenshot()
929928
}
930929

931930
mScreenshotRenderTarget = new RenderTarget2D(
932-
mGraphicsDevice, mScreenWidth, mScreenHeight, false,
933-
mGraphicsDevice.PresentationParameters.BackBufferFormat,
934-
mGraphicsDevice.PresentationParameters.DepthStencilFormat,
935-
mGraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents
931+
mGraphicsDevice,
932+
mScreenWidth,
933+
mScreenHeight,
934+
mipMap: false,
935+
preferredFormat: mGraphicsDevice.PresentationParameters.BackBufferFormat,
936+
preferredDepthFormat: mGraphicsDevice.PresentationParameters.DepthStencilFormat,
937+
/* For whatever reason if this isn't zero everything breaks in .NET 7 on MacOS and most Windows devices */
938+
preferredMultiSampleCount: 0, // mGraphicsDevice.PresentationParameters.MultiSampleCount,
939+
usage: RenderTargetUsage.PreserveContents
936940
);
937941

938942
return true;

Intersect.Client/MonoGame/IntersectGame.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ protected override void Initialize()
159159

160160
if (mUpdater != null)
161161
{
162-
LoadUpdaterContent();
163-
164162
//Set the size of the updater screen before applying graphic changes.
165163
//We need to do this here instead of in the constructor for the size change to apply to Linux
166164
mGraphics.PreferredBackBufferWidth = 800;
@@ -266,6 +264,16 @@ protected override void Update(GameTime gameTime)
266264
base.Update(gameTime);
267265
}
268266

267+
protected override void LoadContent()
268+
{
269+
base.LoadContent();
270+
271+
if (mUpdater != null)
272+
{
273+
LoadUpdaterContent();
274+
}
275+
}
276+
269277
/// <summary>
270278
/// This is called when the game should draw itself.
271279
/// </summary>

0 commit comments

Comments
 (0)