add some shortcut defaults to structs

pull/17/head
cosmonaut 2022-03-01 23:32:44 -08:00
parent 1fa73f0275
commit ef10be4e9d
1 changed files with 43 additions and 0 deletions

View File

@ -12,6 +12,12 @@ namespace MoonWorks.Graphics
public float Depth;
public uint Stencil;
public DepthStencilValue(float depth, uint stencil)
{
Depth = depth;
Stencil = stencil;
}
// FIXME: can we do an unsafe cast somehow?
public Refresh.DepthStencilValue ToRefresh()
{
@ -157,6 +163,30 @@ namespace MoonWorks.Graphics
public LoadOp LoadOp;
public StoreOp StoreOp;
public ColorAttachmentInfo(Texture texture, Color clearColor, StoreOp storeOp = StoreOp.Store)
{
Texture = texture;
Depth = 0;
Layer = 0;
Level = 0;
SampleCount = SampleCount.One;
ClearColor = clearColor;
LoadOp = LoadOp.Clear;
StoreOp = storeOp;
}
public ColorAttachmentInfo(Texture texture, StoreOp storeOp = StoreOp.Store)
{
Texture = texture;
Depth = 0;
Layer = 0;
Level = 0;
SampleCount = SampleCount.One;
ClearColor = Color.White;
LoadOp = LoadOp.DontCare;
StoreOp = StoreOp.Store;
}
public Refresh.ColorAttachmentInfo ToRefresh()
{
return new Refresh.ColorAttachmentInfo
@ -192,6 +222,19 @@ namespace MoonWorks.Graphics
public LoadOp StencilLoadOp;
public StoreOp StencilStoreOp;
public DepthStencilAttachmentInfo(Texture texture, DepthStencilValue clearValue)
{
Texture = texture;
Depth = 0;
Layer = 0;
Level = 0;
DepthStencilClearValue = clearValue;
LoadOp = LoadOp.Clear;
StoreOp = StoreOp.DontCare;
StencilLoadOp = LoadOp.DontCare;
StencilStoreOp = StoreOp.DontCare;
}
public Refresh.DepthStencilAttachmentInfo ToRefresh()
{
return new Refresh.DepthStencilAttachmentInfo