remove more of refresh from the API

pull/14/head
cosmonaut 2021-01-26 17:39:20 -08:00
parent b93945c51b
commit 6ce1ce21b8
7 changed files with 76 additions and 86 deletions

View File

@ -64,20 +64,20 @@ namespace MoonWorks.Graphics
graphicsPipelineCreateInfo.fragmentShaderState.shaderModule = fragmentShaderState.ShaderModule.Handle;
graphicsPipelineCreateInfo.fragmentShaderState.uniformBufferSize = fragmentShaderState.UniformBufferSize;
graphicsPipelineCreateInfo.multisampleState.multisampleCount = multisampleState.MultisampleCount;
graphicsPipelineCreateInfo.multisampleState.multisampleCount = (Refresh.SampleCount)multisampleState.MultisampleCount;
graphicsPipelineCreateInfo.multisampleState.sampleMask = multisampleState.SampleMask;
graphicsPipelineCreateInfo.pipelineLayoutCreateInfo.vertexSamplerBindingCount = pipelineLayoutCreateInfo.VertexSamplerBindingCount;
graphicsPipelineCreateInfo.pipelineLayoutCreateInfo.fragmentSamplerBindingCount = pipelineLayoutCreateInfo.FragmentSamplerBindingCount;
graphicsPipelineCreateInfo.rasterizerState.cullMode = rasterizerState.CullMode;
graphicsPipelineCreateInfo.rasterizerState.cullMode = (Refresh.CullMode)rasterizerState.CullMode;
graphicsPipelineCreateInfo.rasterizerState.depthBiasClamp = rasterizerState.DepthBiasClamp;
graphicsPipelineCreateInfo.rasterizerState.depthBiasConstantFactor = rasterizerState.DepthBiasConstantFactor;
graphicsPipelineCreateInfo.rasterizerState.depthBiasEnable = Conversions.BoolToByte(rasterizerState.DepthBiasEnable);
graphicsPipelineCreateInfo.rasterizerState.depthBiasSlopeFactor = rasterizerState.DepthBiasSlopeFactor;
graphicsPipelineCreateInfo.rasterizerState.depthClampEnable = Conversions.BoolToByte(rasterizerState.DepthClampEnable);
graphicsPipelineCreateInfo.rasterizerState.fillMode = rasterizerState.FillMode;
graphicsPipelineCreateInfo.rasterizerState.frontFace = rasterizerState.FrontFace;
graphicsPipelineCreateInfo.rasterizerState.fillMode = (Refresh.FillMode)rasterizerState.FillMode;
graphicsPipelineCreateInfo.rasterizerState.frontFace = (Refresh.FrontFace)rasterizerState.FrontFace;
graphicsPipelineCreateInfo.rasterizerState.lineWidth = rasterizerState.LineWidth;
graphicsPipelineCreateInfo.vertexInputState.vertexAttributes = vertexAttributesHandle.AddrOfPinnedObject();

View File

@ -1,5 +1,3 @@
using RefreshCS;
namespace MoonWorks.Graphics
{
public unsafe struct ColorBlendState

View File

@ -5,66 +5,66 @@ namespace MoonWorks.Graphics
public struct ColorTargetBlendState
{
public bool BlendEnable;
public Refresh.BlendOp AlphaBlendOp;
public Refresh.BlendOp ColorBlendOp;
public Refresh.ColorComponentFlags ColorWriteMask;
public Refresh.BlendFactor DestinationAlphaBlendFactor;
public Refresh.BlendFactor DestinationColorBlendFactor;
public Refresh.BlendFactor SourceAlphaBlendFactor;
public Refresh.BlendFactor SourceColorBlendFactor;
public BlendOp AlphaBlendOp;
public BlendOp ColorBlendOp;
public ColorComponentFlags ColorWriteMask;
public BlendFactor DestinationAlphaBlendFactor;
public BlendFactor DestinationColorBlendFactor;
public BlendFactor SourceAlphaBlendFactor;
public BlendFactor SourceColorBlendFactor;
public static readonly ColorTargetBlendState Additive = new ColorTargetBlendState
{
BlendEnable = true,
AlphaBlendOp = Refresh.BlendOp.Add,
ColorBlendOp = Refresh.BlendOp.Add,
ColorWriteMask = Refresh.ColorComponentFlags.RGBA,
SourceColorBlendFactor = Refresh.BlendFactor.SourceAlpha,
SourceAlphaBlendFactor = Refresh.BlendFactor.SourceAlpha,
DestinationColorBlendFactor = Refresh.BlendFactor.One,
DestinationAlphaBlendFactor = Refresh.BlendFactor.One
AlphaBlendOp = BlendOp.Add,
ColorBlendOp = BlendOp.Add,
ColorWriteMask = ColorComponentFlags.RGBA,
SourceColorBlendFactor = BlendFactor.SourceAlpha,
SourceAlphaBlendFactor = BlendFactor.SourceAlpha,
DestinationColorBlendFactor = BlendFactor.One,
DestinationAlphaBlendFactor = BlendFactor.One
};
public static readonly ColorTargetBlendState AlphaBlend = new ColorTargetBlendState
{
BlendEnable = true,
AlphaBlendOp = Refresh.BlendOp.Add,
ColorBlendOp = Refresh.BlendOp.Add,
ColorWriteMask = Refresh.ColorComponentFlags.RGBA,
SourceColorBlendFactor = Refresh.BlendFactor.One,
SourceAlphaBlendFactor = Refresh.BlendFactor.One,
DestinationColorBlendFactor = Refresh.BlendFactor.OneMinusSourceAlpha,
DestinationAlphaBlendFactor = Refresh.BlendFactor.OneMinusSourceAlpha
AlphaBlendOp = BlendOp.Add,
ColorBlendOp = BlendOp.Add,
ColorWriteMask = ColorComponentFlags.RGBA,
SourceColorBlendFactor = BlendFactor.One,
SourceAlphaBlendFactor = BlendFactor.One,
DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha,
DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha
};
public static readonly ColorTargetBlendState NonPremultiplied = new ColorTargetBlendState
{
BlendEnable = true,
AlphaBlendOp = Refresh.BlendOp.Add,
ColorBlendOp = Refresh.BlendOp.Add,
ColorWriteMask = Refresh.ColorComponentFlags.RGBA,
SourceColorBlendFactor = Refresh.BlendFactor.SourceAlpha,
SourceAlphaBlendFactor = Refresh.BlendFactor.SourceAlpha,
DestinationColorBlendFactor = Refresh.BlendFactor.OneMinusSourceAlpha,
DestinationAlphaBlendFactor = Refresh.BlendFactor.OneMinusSourceAlpha
AlphaBlendOp = BlendOp.Add,
ColorBlendOp = BlendOp.Add,
ColorWriteMask = ColorComponentFlags.RGBA,
SourceColorBlendFactor = BlendFactor.SourceAlpha,
SourceAlphaBlendFactor = BlendFactor.SourceAlpha,
DestinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha,
DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha
};
public static readonly ColorTargetBlendState Opaque = new ColorTargetBlendState
{
BlendEnable = true,
AlphaBlendOp = Refresh.BlendOp.Add,
ColorBlendOp = Refresh.BlendOp.Add,
ColorWriteMask = Refresh.ColorComponentFlags.RGBA,
SourceColorBlendFactor = Refresh.BlendFactor.One,
SourceAlphaBlendFactor = Refresh.BlendFactor.One,
DestinationColorBlendFactor = Refresh.BlendFactor.Zero,
DestinationAlphaBlendFactor = Refresh.BlendFactor.Zero
AlphaBlendOp = BlendOp.Add,
ColorBlendOp = BlendOp.Add,
ColorWriteMask = ColorComponentFlags.RGBA,
SourceColorBlendFactor = BlendFactor.One,
SourceAlphaBlendFactor = BlendFactor.One,
DestinationColorBlendFactor = BlendFactor.Zero,
DestinationAlphaBlendFactor = BlendFactor.Zero
};
public static readonly ColorTargetBlendState None = new ColorTargetBlendState
{
BlendEnable = false,
ColorWriteMask = Refresh.ColorComponentFlags.RGBA
ColorWriteMask = ColorComponentFlags.RGBA
};
public Refresh.ColorTargetBlendState ToRefreshColorTargetBlendState()
@ -72,13 +72,13 @@ namespace MoonWorks.Graphics
return new Refresh.ColorTargetBlendState
{
blendEnable = Conversions.BoolToByte(BlendEnable),
alphaBlendOp = AlphaBlendOp,
colorBlendOp = ColorBlendOp,
colorWriteMask = ColorWriteMask,
destinationAlphaBlendFactor = DestinationAlphaBlendFactor,
destinationColorBlendFactor = DestinationColorBlendFactor,
sourceAlphaBlendFactor = SourceAlphaBlendFactor,
sourceColorBlendFactor = SourceColorBlendFactor
alphaBlendOp = (Refresh.BlendOp)AlphaBlendOp,
colorBlendOp = (Refresh.BlendOp)ColorBlendOp,
colorWriteMask = (Refresh.ColorComponentFlags)ColorWriteMask,
destinationAlphaBlendFactor = (Refresh.BlendFactor)DestinationAlphaBlendFactor,
destinationColorBlendFactor = (Refresh.BlendFactor)DestinationColorBlendFactor,
sourceAlphaBlendFactor = (Refresh.BlendFactor)SourceAlphaBlendFactor,
sourceColorBlendFactor = (Refresh.BlendFactor)SourceColorBlendFactor
};
}
}

View File

@ -1,15 +1,13 @@
using RefreshCS;
namespace MoonWorks.Graphics
{
public struct MultisampleState
{
public Refresh.SampleCount MultisampleCount;
public SampleCount MultisampleCount;
public uint SampleMask;
public static readonly MultisampleState None = new MultisampleState
{
MultisampleCount = Refresh.SampleCount.One,
MultisampleCount = SampleCount.One,
SampleMask = uint.MaxValue
};
}

View File

@ -1,87 +1,85 @@
using RefreshCS;
namespace MoonWorks.Graphics
{
public struct RasterizerState
{
public Refresh.CullMode CullMode;
public CullMode CullMode;
public float DepthBiasClamp;
public float DepthBiasConstantFactor;
public bool DepthBiasEnable;
public float DepthBiasSlopeFactor;
public bool DepthClampEnable;
public Refresh.FillMode FillMode;
public Refresh.FrontFace FrontFace;
public FillMode FillMode;
public FrontFace FrontFace;
public float LineWidth;
public static readonly RasterizerState CW_CullFront = new RasterizerState
{
CullMode = Refresh.CullMode.Front,
FrontFace = Refresh.FrontFace.Clockwise,
FillMode = Refresh.FillMode.Fill,
CullMode = CullMode.Front,
FrontFace = FrontFace.Clockwise,
FillMode = FillMode.Fill,
DepthBiasEnable = false,
LineWidth = 1f
};
public static readonly RasterizerState CW_CullBack = new RasterizerState
{
CullMode = Refresh.CullMode.Back,
FrontFace = Refresh.FrontFace.Clockwise,
FillMode = Refresh.FillMode.Fill,
CullMode = CullMode.Back,
FrontFace = FrontFace.Clockwise,
FillMode = FillMode.Fill,
DepthBiasEnable = false,
LineWidth = 1f
};
public static readonly RasterizerState CW_CullNone = new RasterizerState
{
CullMode = Refresh.CullMode.None,
FrontFace = Refresh.FrontFace.Clockwise,
FillMode = Refresh.FillMode.Fill,
CullMode = CullMode.None,
FrontFace = FrontFace.Clockwise,
FillMode = FillMode.Fill,
DepthBiasEnable = false,
LineWidth = 1f
};
public static readonly RasterizerState CW_Wireframe = new RasterizerState
{
CullMode = Refresh.CullMode.None,
FrontFace = Refresh.FrontFace.Clockwise,
FillMode = Refresh.FillMode.Fill,
CullMode = CullMode.None,
FrontFace = FrontFace.Clockwise,
FillMode = FillMode.Fill,
DepthBiasEnable = false,
LineWidth = 1f
};
public static readonly RasterizerState CCW_CullFront = new RasterizerState
{
CullMode = Refresh.CullMode.Front,
FrontFace = Refresh.FrontFace.CounterClockwise,
FillMode = Refresh.FillMode.Fill,
CullMode = CullMode.Front,
FrontFace = FrontFace.CounterClockwise,
FillMode = FillMode.Fill,
DepthBiasEnable = false,
LineWidth = 1f
};
public static readonly RasterizerState CCW_CullBack = new RasterizerState
{
CullMode = Refresh.CullMode.Back,
FrontFace = Refresh.FrontFace.CounterClockwise,
FillMode = Refresh.FillMode.Fill,
CullMode = CullMode.Back,
FrontFace = FrontFace.CounterClockwise,
FillMode = FillMode.Fill,
DepthBiasEnable = false,
LineWidth = 1f
};
public static readonly RasterizerState CCW_CullNone = new RasterizerState
{
CullMode = Refresh.CullMode.None,
FrontFace = Refresh.FrontFace.CounterClockwise,
FillMode = Refresh.FillMode.Fill,
CullMode = CullMode.None,
FrontFace = FrontFace.CounterClockwise,
FillMode = FillMode.Fill,
DepthBiasEnable = false,
LineWidth = 1f
};
public static readonly RasterizerState CCW_Wireframe = new RasterizerState
{
CullMode = Refresh.CullMode.None,
FrontFace = Refresh.FrontFace.CounterClockwise,
FillMode = Refresh.FillMode.Fill,
CullMode = CullMode.None,
FrontFace = FrontFace.CounterClockwise,
FillMode = FillMode.Fill,
DepthBiasEnable = false,
LineWidth = 1f
};

View File

@ -1,5 +1,3 @@
using RefreshCS;
namespace MoonWorks.Graphics
{
public struct VertexInputState

View File

@ -1,5 +1,3 @@
using RefreshCS;
namespace MoonWorks.Graphics
{
public struct ViewportState