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