D3D compatibility ABI break
parent
f6369b6bce
commit
774028a013
|
@ -1 +1 @@
|
||||||
Subproject commit d844fe56ee16e7e0e0ae4f4ff1814292e499dff7
|
Subproject commit 642313f78041aac9f50a6eb3c73869137c53f113
|
|
@ -147,16 +147,14 @@ namespace MoonWorks.Graphics
|
||||||
public enum FillMode
|
public enum FillMode
|
||||||
{
|
{
|
||||||
Fill,
|
Fill,
|
||||||
Line,
|
Line
|
||||||
Point
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CullMode
|
public enum CullMode
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
Front,
|
Front,
|
||||||
Back,
|
Back
|
||||||
FrontAndBack
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FrontFace
|
public enum FrontFace
|
||||||
|
@ -198,26 +196,6 @@ namespace MoonWorks.Graphics
|
||||||
Max
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum LogicOp
|
|
||||||
{
|
|
||||||
Clear,
|
|
||||||
And,
|
|
||||||
AndReverse,
|
|
||||||
Copy,
|
|
||||||
AndInverted,
|
|
||||||
NoOp,
|
|
||||||
Xor,
|
|
||||||
Or,
|
|
||||||
Nor,
|
|
||||||
Equivalent,
|
|
||||||
Invert,
|
|
||||||
OrReverse,
|
|
||||||
CopyInverted,
|
|
||||||
OrInverted,
|
|
||||||
Nand,
|
|
||||||
Set
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum BlendFactor
|
public enum BlendFactor
|
||||||
{
|
{
|
||||||
Zero,
|
Zero,
|
||||||
|
@ -232,8 +210,6 @@ namespace MoonWorks.Graphics
|
||||||
OneMinusDestinationAlpha,
|
OneMinusDestinationAlpha,
|
||||||
ConstantColor,
|
ConstantColor,
|
||||||
OneMinusConstantColor,
|
OneMinusConstantColor,
|
||||||
ConstantAlpha,
|
|
||||||
OneMinusConstantAlpha,
|
|
||||||
SourceAlphaSaturate,
|
SourceAlphaSaturate,
|
||||||
SourceOneColor,
|
SourceOneColor,
|
||||||
OneMinusSourceOneColor,
|
OneMinusSourceOneColor,
|
||||||
|
@ -264,17 +240,10 @@ namespace MoonWorks.Graphics
|
||||||
None = 0
|
None = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ShaderStageType
|
|
||||||
{
|
|
||||||
Vertex,
|
|
||||||
Fragment
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Filter
|
public enum Filter
|
||||||
{
|
{
|
||||||
Nearest,
|
Nearest,
|
||||||
Linear,
|
Linear
|
||||||
Cubic
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SamplerMipmapMode
|
public enum SamplerMipmapMode
|
||||||
|
|
|
@ -8,38 +8,28 @@ namespace MoonWorks.Graphics
|
||||||
{
|
{
|
||||||
protected override Action<IntPtr, IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyComputePipeline;
|
protected override Action<IntPtr, IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyComputePipeline;
|
||||||
|
|
||||||
public ShaderStageState ComputeShaderState { get; }
|
public ComputeShaderInfo ComputeShaderState { get; }
|
||||||
|
|
||||||
public unsafe ComputePipeline(
|
public unsafe ComputePipeline(
|
||||||
GraphicsDevice device,
|
GraphicsDevice device,
|
||||||
ShaderStageState computeShaderState,
|
ComputeShaderInfo computeShaderInfo
|
||||||
uint bufferBindingCount,
|
|
||||||
uint imageBindingCount
|
|
||||||
) : base(device)
|
) : base(device)
|
||||||
{
|
{
|
||||||
var computePipelineLayoutCreateInfo = new Refresh.ComputePipelineLayoutCreateInfo
|
var refreshComputeShaderInfo = new Refresh.ComputeShaderInfo
|
||||||
{
|
{
|
||||||
bufferBindingCount = bufferBindingCount,
|
entryPointName = computeShaderInfo.EntryPointName,
|
||||||
imageBindingCount = imageBindingCount
|
shaderModule = computeShaderInfo.ShaderModule.Handle,
|
||||||
};
|
uniformBufferSize = computeShaderInfo.UniformBufferSize,
|
||||||
|
bufferBindingCount = computeShaderInfo.bufferBindingCount,
|
||||||
var computePipelineCreateInfo = new Refresh.ComputePipelineCreateInfo
|
imageBindingCount = computeShaderInfo.imageBindingCount
|
||||||
{
|
|
||||||
pipelineLayoutCreateInfo = computePipelineLayoutCreateInfo,
|
|
||||||
computeShaderState = new Refresh.ShaderStageState
|
|
||||||
{
|
|
||||||
entryPointName = computeShaderState.EntryPointName,
|
|
||||||
shaderModule = computeShaderState.ShaderModule.Handle,
|
|
||||||
uniformBufferSize = computeShaderState.UniformBufferSize
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Handle = Refresh.Refresh_CreateComputePipeline(
|
Handle = Refresh.Refresh_CreateComputePipeline(
|
||||||
device.Handle,
|
device.Handle,
|
||||||
computePipelineCreateInfo
|
refreshComputeShaderInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
ComputeShaderState = computeShaderState;
|
ComputeShaderState = computeShaderInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,25 +12,24 @@ namespace MoonWorks.Graphics
|
||||||
{
|
{
|
||||||
protected override Action<IntPtr, IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyGraphicsPipeline;
|
protected override Action<IntPtr, IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyGraphicsPipeline;
|
||||||
|
|
||||||
public ShaderStageState VertexShaderState { get; }
|
public GraphicsShaderInfo VertexShaderState { get; }
|
||||||
public ShaderStageState FragmentShaderState { get; }
|
public GraphicsShaderInfo FragmentShaderState { get; }
|
||||||
|
|
||||||
public unsafe GraphicsPipeline(
|
public unsafe GraphicsPipeline(
|
||||||
GraphicsDevice device,
|
GraphicsDevice device,
|
||||||
in GraphicsPipelineCreateInfo graphicsPipelineCreateInfo
|
in GraphicsPipelineCreateInfo graphicsPipelineCreateInfo
|
||||||
) : base(device)
|
) : base(device)
|
||||||
{
|
{
|
||||||
ColorBlendState colorBlendState = graphicsPipelineCreateInfo.ColorBlendState;
|
|
||||||
DepthStencilState depthStencilState = graphicsPipelineCreateInfo.DepthStencilState;
|
DepthStencilState depthStencilState = graphicsPipelineCreateInfo.DepthStencilState;
|
||||||
ShaderStageState vertexShaderState = graphicsPipelineCreateInfo.VertexShaderState;
|
GraphicsShaderInfo vertexShaderInfo = graphicsPipelineCreateInfo.VertexShaderState;
|
||||||
ShaderStageState fragmentShaderState = graphicsPipelineCreateInfo.FragmentShaderState;
|
GraphicsShaderInfo fragmentShaderInfo = graphicsPipelineCreateInfo.FragmentShaderState;
|
||||||
MultisampleState multisampleState = graphicsPipelineCreateInfo.MultisampleState;
|
MultisampleState multisampleState = graphicsPipelineCreateInfo.MultisampleState;
|
||||||
GraphicsPipelineLayoutInfo pipelineLayoutInfo = graphicsPipelineCreateInfo.PipelineLayoutInfo;
|
|
||||||
RasterizerState rasterizerState = graphicsPipelineCreateInfo.RasterizerState;
|
RasterizerState rasterizerState = graphicsPipelineCreateInfo.RasterizerState;
|
||||||
PrimitiveType primitiveType = graphicsPipelineCreateInfo.PrimitiveType;
|
PrimitiveType primitiveType = graphicsPipelineCreateInfo.PrimitiveType;
|
||||||
VertexInputState vertexInputState = graphicsPipelineCreateInfo.VertexInputState;
|
VertexInputState vertexInputState = graphicsPipelineCreateInfo.VertexInputState;
|
||||||
ViewportState viewportState = graphicsPipelineCreateInfo.ViewportState;
|
ViewportState viewportState = graphicsPipelineCreateInfo.ViewportState;
|
||||||
GraphicsPipelineAttachmentInfo attachmentInfo = graphicsPipelineCreateInfo.AttachmentInfo;
|
GraphicsPipelineAttachmentInfo attachmentInfo = graphicsPipelineCreateInfo.AttachmentInfo;
|
||||||
|
BlendConstants blendConstants = graphicsPipelineCreateInfo.BlendConstants;
|
||||||
|
|
||||||
var vertexAttributesHandle = GCHandle.Alloc(
|
var vertexAttributesHandle = GCHandle.Alloc(
|
||||||
vertexInputState.VertexAttributes,
|
vertexInputState.VertexAttributes,
|
||||||
|
@ -62,12 +61,10 @@ namespace MoonWorks.Graphics
|
||||||
|
|
||||||
Refresh.GraphicsPipelineCreateInfo refreshGraphicsPipelineCreateInfo;
|
Refresh.GraphicsPipelineCreateInfo refreshGraphicsPipelineCreateInfo;
|
||||||
|
|
||||||
refreshGraphicsPipelineCreateInfo.colorBlendState.logicOpEnable = Conversions.BoolToByte(colorBlendState.LogicOpEnable);
|
refreshGraphicsPipelineCreateInfo.blendConstants[0] = blendConstants.R;
|
||||||
refreshGraphicsPipelineCreateInfo.colorBlendState.logicOp = (Refresh.LogicOp) colorBlendState.LogicOp;
|
refreshGraphicsPipelineCreateInfo.blendConstants[1] = blendConstants.G;
|
||||||
refreshGraphicsPipelineCreateInfo.colorBlendState.blendConstants[0] = colorBlendState.BlendConstants.R;
|
refreshGraphicsPipelineCreateInfo.blendConstants[2] = blendConstants.B;
|
||||||
refreshGraphicsPipelineCreateInfo.colorBlendState.blendConstants[1] = colorBlendState.BlendConstants.G;
|
refreshGraphicsPipelineCreateInfo.blendConstants[3] = blendConstants.A;
|
||||||
refreshGraphicsPipelineCreateInfo.colorBlendState.blendConstants[2] = colorBlendState.BlendConstants.B;
|
|
||||||
refreshGraphicsPipelineCreateInfo.colorBlendState.blendConstants[3] = colorBlendState.BlendConstants.A;
|
|
||||||
|
|
||||||
refreshGraphicsPipelineCreateInfo.depthStencilState.backStencilState = depthStencilState.BackStencilState.ToRefresh();
|
refreshGraphicsPipelineCreateInfo.depthStencilState.backStencilState = depthStencilState.BackStencilState.ToRefresh();
|
||||||
refreshGraphicsPipelineCreateInfo.depthStencilState.compareOp = (Refresh.CompareOp) depthStencilState.CompareOp;
|
refreshGraphicsPipelineCreateInfo.depthStencilState.compareOp = (Refresh.CompareOp) depthStencilState.CompareOp;
|
||||||
|
@ -79,20 +76,19 @@ namespace MoonWorks.Graphics
|
||||||
refreshGraphicsPipelineCreateInfo.depthStencilState.minDepthBounds = depthStencilState.MinDepthBounds;
|
refreshGraphicsPipelineCreateInfo.depthStencilState.minDepthBounds = depthStencilState.MinDepthBounds;
|
||||||
refreshGraphicsPipelineCreateInfo.depthStencilState.stencilTestEnable = Conversions.BoolToByte(depthStencilState.StencilTestEnable);
|
refreshGraphicsPipelineCreateInfo.depthStencilState.stencilTestEnable = Conversions.BoolToByte(depthStencilState.StencilTestEnable);
|
||||||
|
|
||||||
refreshGraphicsPipelineCreateInfo.vertexShaderState.entryPointName = vertexShaderState.EntryPointName;
|
refreshGraphicsPipelineCreateInfo.vertexShaderInfo.entryPointName = vertexShaderInfo.EntryPointName;
|
||||||
refreshGraphicsPipelineCreateInfo.vertexShaderState.shaderModule = vertexShaderState.ShaderModule.Handle;
|
refreshGraphicsPipelineCreateInfo.vertexShaderInfo.shaderModule = vertexShaderInfo.ShaderModule.Handle;
|
||||||
refreshGraphicsPipelineCreateInfo.vertexShaderState.uniformBufferSize = vertexShaderState.UniformBufferSize;
|
refreshGraphicsPipelineCreateInfo.vertexShaderInfo.uniformBufferSize = vertexShaderInfo.UniformBufferSize;
|
||||||
|
refreshGraphicsPipelineCreateInfo.vertexShaderInfo.samplerBindingCount = vertexShaderInfo.SamplerBindingCount;
|
||||||
|
|
||||||
refreshGraphicsPipelineCreateInfo.fragmentShaderState.entryPointName = fragmentShaderState.EntryPointName;
|
refreshGraphicsPipelineCreateInfo.fragmentShaderInfo.entryPointName = fragmentShaderInfo.EntryPointName;
|
||||||
refreshGraphicsPipelineCreateInfo.fragmentShaderState.shaderModule = fragmentShaderState.ShaderModule.Handle;
|
refreshGraphicsPipelineCreateInfo.fragmentShaderInfo.shaderModule = fragmentShaderInfo.ShaderModule.Handle;
|
||||||
refreshGraphicsPipelineCreateInfo.fragmentShaderState.uniformBufferSize = fragmentShaderState.UniformBufferSize;
|
refreshGraphicsPipelineCreateInfo.fragmentShaderInfo.uniformBufferSize = fragmentShaderInfo.UniformBufferSize;
|
||||||
|
refreshGraphicsPipelineCreateInfo.fragmentShaderInfo.samplerBindingCount = fragmentShaderInfo.SamplerBindingCount;
|
||||||
|
|
||||||
refreshGraphicsPipelineCreateInfo.multisampleState.multisampleCount = (Refresh.SampleCount) multisampleState.MultisampleCount;
|
refreshGraphicsPipelineCreateInfo.multisampleState.multisampleCount = (Refresh.SampleCount) multisampleState.MultisampleCount;
|
||||||
refreshGraphicsPipelineCreateInfo.multisampleState.sampleMask = multisampleState.SampleMask;
|
refreshGraphicsPipelineCreateInfo.multisampleState.sampleMask = multisampleState.SampleMask;
|
||||||
|
|
||||||
refreshGraphicsPipelineCreateInfo.pipelineLayoutCreateInfo.vertexSamplerBindingCount = pipelineLayoutInfo.VertexSamplerBindingCount;
|
|
||||||
refreshGraphicsPipelineCreateInfo.pipelineLayoutCreateInfo.fragmentSamplerBindingCount = pipelineLayoutInfo.FragmentSamplerBindingCount;
|
|
||||||
|
|
||||||
refreshGraphicsPipelineCreateInfo.rasterizerState.cullMode = (Refresh.CullMode) rasterizerState.CullMode;
|
refreshGraphicsPipelineCreateInfo.rasterizerState.cullMode = (Refresh.CullMode) rasterizerState.CullMode;
|
||||||
refreshGraphicsPipelineCreateInfo.rasterizerState.depthBiasClamp = rasterizerState.DepthBiasClamp;
|
refreshGraphicsPipelineCreateInfo.rasterizerState.depthBiasClamp = rasterizerState.DepthBiasClamp;
|
||||||
refreshGraphicsPipelineCreateInfo.rasterizerState.depthBiasConstantFactor = rasterizerState.DepthBiasConstantFactor;
|
refreshGraphicsPipelineCreateInfo.rasterizerState.depthBiasConstantFactor = rasterizerState.DepthBiasConstantFactor;
|
||||||
|
@ -127,8 +123,8 @@ namespace MoonWorks.Graphics
|
||||||
viewportHandle.Free();
|
viewportHandle.Free();
|
||||||
scissorHandle.Free();
|
scissorHandle.Free();
|
||||||
|
|
||||||
VertexShaderState = vertexShaderState;
|
VertexShaderState = vertexShaderInfo;
|
||||||
FragmentShaderState = fragmentShaderState;
|
FragmentShaderState = fragmentShaderInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
namespace MoonWorks.Graphics
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Describes how the graphics pipeline will blend colors.
|
|
||||||
/// </summary>
|
|
||||||
public unsafe struct ColorBlendState
|
|
||||||
{
|
|
||||||
public bool LogicOpEnable;
|
|
||||||
public LogicOp LogicOp;
|
|
||||||
public BlendConstants BlendConstants;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
namespace MoonWorks.Graphics
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Information that the pipeline needs about a shader.
|
||||||
|
/// </summary>
|
||||||
|
public struct ComputeShaderInfo
|
||||||
|
{
|
||||||
|
public ShaderModule ShaderModule;
|
||||||
|
public string EntryPointName;
|
||||||
|
public uint UniformBufferSize;
|
||||||
|
public uint bufferBindingCount;
|
||||||
|
public uint imageBindingCount;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,16 +2,15 @@
|
||||||
{
|
{
|
||||||
public struct GraphicsPipelineCreateInfo
|
public struct GraphicsPipelineCreateInfo
|
||||||
{
|
{
|
||||||
public ColorBlendState ColorBlendState;
|
|
||||||
public DepthStencilState DepthStencilState;
|
public DepthStencilState DepthStencilState;
|
||||||
public ShaderStageState VertexShaderState;
|
public GraphicsShaderInfo VertexShaderState;
|
||||||
public ShaderStageState FragmentShaderState;
|
public GraphicsShaderInfo FragmentShaderState;
|
||||||
public MultisampleState MultisampleState;
|
public MultisampleState MultisampleState;
|
||||||
public GraphicsPipelineLayoutInfo PipelineLayoutInfo;
|
|
||||||
public RasterizerState RasterizerState;
|
public RasterizerState RasterizerState;
|
||||||
public PrimitiveType PrimitiveType;
|
public PrimitiveType PrimitiveType;
|
||||||
public VertexInputState VertexInputState;
|
public VertexInputState VertexInputState;
|
||||||
public ViewportState ViewportState;
|
public ViewportState ViewportState;
|
||||||
public GraphicsPipelineAttachmentInfo AttachmentInfo;
|
public GraphicsPipelineAttachmentInfo AttachmentInfo;
|
||||||
|
public BlendConstants BlendConstants;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
namespace MoonWorks.Graphics
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Describes how many samplers will be used in each shader stage.
|
|
||||||
/// </summary>
|
|
||||||
public struct GraphicsPipelineLayoutInfo
|
|
||||||
{
|
|
||||||
public uint VertexSamplerBindingCount;
|
|
||||||
public uint FragmentSamplerBindingCount;
|
|
||||||
|
|
||||||
public GraphicsPipelineLayoutInfo(
|
|
||||||
uint vertexSamplerBindingCount,
|
|
||||||
uint fragmentSamplerBindingCount
|
|
||||||
)
|
|
||||||
{
|
|
||||||
VertexSamplerBindingCount = vertexSamplerBindingCount;
|
|
||||||
FragmentSamplerBindingCount = fragmentSamplerBindingCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +1,13 @@
|
||||||
namespace MoonWorks.Graphics
|
namespace MoonWorks.Graphics
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies how the graphics pipeline will make use of a shader.
|
/// Information that the pipeline needs about a shader.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct ShaderStageState
|
public struct GraphicsShaderInfo
|
||||||
{
|
{
|
||||||
public ShaderModule ShaderModule;
|
public ShaderModule ShaderModule;
|
||||||
public string EntryPointName;
|
public string EntryPointName;
|
||||||
public uint UniformBufferSize;
|
public uint UniformBufferSize;
|
||||||
|
public uint SamplerBindingCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue