forked from AerysBat/XNALara
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathResolveBackBuffer.cs
38 lines (34 loc) · 1.41 KB
/
ResolveBackBuffer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Microsoft.Xna.Framework.Graphics;
namespace XNALara
{
public class ResolveBackBuffer
{
private GraphicsDevice graphicsDevice;
private ResolveTexture2D resolveTexture;
private int resolveTextureWidth;
private int resolveTextureHeight;
public ResolveBackBuffer(GraphicsDevice graphicsDevice) {
this.graphicsDevice = graphicsDevice;
resolveTexture = null;
}
public ResolveTexture2D GetTexture() {
PresentationParameters parameters = graphicsDevice.PresentationParameters;
if (resolveTexture == null ||
resolveTextureWidth != parameters.BackBufferWidth ||
resolveTextureHeight != parameters.BackBufferHeight) {
if (resolveTexture != null) {
resolveTexture.Dispose();
}
resolveTexture =
new ResolveTexture2D(graphicsDevice,
parameters.BackBufferWidth,
parameters.BackBufferHeight, 1,
parameters.BackBufferFormat);
resolveTextureWidth = parameters.BackBufferWidth;
resolveTextureHeight = parameters.BackBufferHeight;
}
graphicsDevice.ResolveBackBuffer(resolveTexture);
return resolveTexture;
}
}
}