remove more of refresh from the API

main
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.shaderModule = fragmentShaderState.ShaderModule.Handle;
graphicsPipelineCreateInfo.fragmentShaderState.uniformBufferSize = fragmentShaderState.UniformBufferSize; graphicsPipelineCreateInfo.fragmentShaderState.uniformBufferSize = fragmentShaderState.UniformBufferSize;
graphicsPipelineCreateInfo.multisampleState.multisampleCount = multisampleState.MultisampleCount; graphicsPipelineCreateInfo.multisampleState.multisampleCount = (Refresh.SampleCount)multisampleState.MultisampleCount;
graphicsPipelineCreateInfo.multisampleState.sampleMask = multisampleState.SampleMask; graphicsPipelineCreateInfo.multisampleState.sampleMask = multisampleState.SampleMask;
graphicsPipelineCreateInfo.pipelineLayoutCreateInfo.vertexSamplerBindingCount = pipelineLayoutCreateInfo.VertexSamplerBindingCount; graphicsPipelineCreateInfo.pipelineLayoutCreateInfo.vertexSamplerBindingCount = pipelineLayoutCreateInfo.VertexSamplerBindingCount;
graphicsPipelineCreateInfo.pipelineLayoutCreateInfo.fragmentSamplerBindingCount = pipelineLayoutCreateInfo.FragmentSamplerBindingCount; graphicsPipelineCreateInfo.pipelineLayoutCreateInfo.fragmentSamplerBindingCount = pipelineLayoutCreateInfo.FragmentSamplerBindingCount;
graphicsPipelineCreateInfo.rasterizerState.cullMode = rasterizerState.CullMode; graphicsPipelineCreateInfo.rasterizerState.cullMode = (Refresh.CullMode)rasterizerState.CullMode;
graphicsPipelineCreateInfo.rasterizerState.depthBiasClamp = rasterizerState.DepthBiasClamp; graphicsPipelineCreateInfo.rasterizerState.depthBiasClamp = rasterizerState.DepthBiasClamp;
graphicsPipelineCreateInfo.rasterizerState.depthBiasConstantFactor = rasterizerState.DepthBiasConstantFactor; graphicsPipelineCreateInfo.rasterizerState.depthBiasConstantFactor = rasterizerState.DepthBiasConstantFactor;
graphicsPipelineCreateInfo.rasterizerState.depthBiasEnable = Conversions.BoolToByte(rasterizerState.DepthBiasEnable); graphicsPipelineCreateInfo.rasterizerState.depthBiasEnable = Conversions.BoolToByte(rasterizerState.DepthBiasEnable);
graphicsPipelineCreateInfo.rasterizerState.depthBiasSlopeFactor = rasterizerState.DepthBiasSlopeFactor; graphicsPipelineCreateInfo.rasterizerState.depthBiasSlopeFactor = rasterizerState.DepthBiasSlopeFactor;
graphicsPipelineCreateInfo.rasterizerState.depthClampEnable = Conversions.BoolToByte(rasterizerState.DepthClampEnable); graphicsPipelineCreateInfo.rasterizerState.depthClampEnable = Conversions.BoolToByte(rasterizerState.DepthClampEnable);
graphicsPipelineCreateInfo.rasterizerState.fillMode = rasterizerState.FillMode; graphicsPipelineCreateInfo.rasterizerState.fillMode = (Refresh.FillMode)rasterizerState.FillMode;
graphicsPipelineCreateInfo.rasterizerState.frontFace = rasterizerState.FrontFace; graphicsPipelineCreateInfo.rasterizerState.frontFace = (Refresh.FrontFace)rasterizerState.FrontFace;
graphicsPipelineCreateInfo.rasterizerState.lineWidth = rasterizerState.LineWidth; graphicsPipelineCreateInfo.rasterizerState.lineWidth = rasterizerState.LineWidth;
graphicsPipelineCreateInfo.vertexInputState.vertexAttributes = vertexAttributesHandle.AddrOfPinnedObject(); graphicsPipelineCreateInfo.vertexInputState.vertexAttributes = vertexAttributesHandle.AddrOfPinnedObject();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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