backed color target convenience method
parent
cde30b290a
commit
7a98e98fc3
|
@ -13,6 +13,34 @@ namespace Campari
|
|||
|
||||
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyColorTarget;
|
||||
|
||||
public static ColorTarget CreateBackedColorTarget2D(
|
||||
GraphicsDevice device,
|
||||
uint width,
|
||||
uint height,
|
||||
Refresh.ColorFormat format,
|
||||
bool canBeSampled,
|
||||
Refresh.SampleCount sampleCount = Refresh.SampleCount.One,
|
||||
uint levelCount = 1
|
||||
)
|
||||
{
|
||||
var flags = Refresh.TextureUsageFlags.ColorTargetBit;
|
||||
if (canBeSampled) { flags |= Refresh.TextureUsageFlags.SamplerBit; }
|
||||
|
||||
var texture = Texture.CreateTexture2D(
|
||||
device,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
flags,
|
||||
sampleCount,
|
||||
levelCount
|
||||
);
|
||||
|
||||
var textureSlice = new TextureSlice(texture);
|
||||
|
||||
return new ColorTarget(device, sampleCount, ref textureSlice);
|
||||
}
|
||||
|
||||
public ColorTarget(GraphicsDevice device, Refresh.SampleCount sampleCount, ref TextureSlice textureSlice) : base(device)
|
||||
{
|
||||
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();
|
||||
|
|
|
@ -11,7 +11,12 @@ namespace Campari
|
|||
|
||||
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyDepthStencilTarget;
|
||||
|
||||
public DepthStencilTarget(GraphicsDevice device, uint width, uint height, Refresh.DepthFormat depthFormat) : base(device)
|
||||
public DepthStencilTarget(
|
||||
GraphicsDevice device,
|
||||
uint width,
|
||||
uint height,
|
||||
Refresh.DepthFormat depthFormat
|
||||
) : base(device)
|
||||
{
|
||||
Handle = Refresh.Refresh_CreateDepthStencilTarget(device.Handle, width, height, depthFormat);
|
||||
Width = width;
|
||||
|
|
Loading…
Reference in New Issue