mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 17:36:36 +00:00
Pass vulkan pipeline state along to UI
This commit is contained in:
@@ -34,24 +34,26 @@ namespace renderdocui.Code
|
||||
{
|
||||
private D3D11PipelineState m_D3D11 = null;
|
||||
private GLPipelineState m_GL = null;
|
||||
private VulkanPipelineState m_VK = null;
|
||||
private APIProperties m_APIProps = null;
|
||||
|
||||
public CommonPipelineState()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetStates(APIProperties props, D3D11PipelineState d3d11, GLPipelineState gl)
|
||||
public void SetStates(APIProperties props, D3D11PipelineState d3d11, GLPipelineState gl, VulkanPipelineState vk)
|
||||
{
|
||||
m_APIProps = props;
|
||||
m_D3D11 = d3d11;
|
||||
m_GL = gl;
|
||||
m_VK = vk;
|
||||
}
|
||||
|
||||
private bool LogLoaded
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_D3D11 != null || m_GL != null;
|
||||
return m_D3D11 != null || m_GL != null || m_VK != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +73,14 @@ namespace renderdocui.Code
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsLogVK
|
||||
{
|
||||
get
|
||||
{
|
||||
return LogLoaded && m_APIProps.pipelineType == APIPipelineStateType.Vulkan && m_VK != null;
|
||||
}
|
||||
}
|
||||
|
||||
// add a bunch of generic properties that people can check to save having to see which pipeline state
|
||||
// is valid and look at the appropriate part of it
|
||||
public bool IsTessellationEnabled
|
||||
@@ -84,6 +94,9 @@ namespace renderdocui.Code
|
||||
|
||||
if (IsLogGL)
|
||||
return m_GL != null && m_GL.m_TES.Shader != ResourceId.Null;
|
||||
|
||||
if (IsLogVK)
|
||||
return m_VK != null && m_VK.TES.Shader != ResourceId.Null;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -120,6 +133,18 @@ namespace renderdocui.Code
|
||||
case ShaderStageType.Compute: return m_GL.m_CS.BindpointMapping;
|
||||
}
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
switch (stage)
|
||||
{
|
||||
case ShaderStageType.Vertex: return m_VK.VS.BindpointMapping;
|
||||
case ShaderStageType.Tess_Control: return m_VK.TCS.BindpointMapping;
|
||||
case ShaderStageType.Tess_Eval: return m_VK.TES.BindpointMapping;
|
||||
case ShaderStageType.Geometry: return m_VK.GS.BindpointMapping;
|
||||
case ShaderStageType.Fragment: return m_VK.FS.BindpointMapping;
|
||||
case ShaderStageType.Compute: return m_VK.CS.BindpointMapping;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -153,6 +178,18 @@ namespace renderdocui.Code
|
||||
case ShaderStageType.Compute: return m_GL.m_CS.ShaderDetails;
|
||||
}
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
switch (stage)
|
||||
{
|
||||
case ShaderStageType.Vertex: return m_VK.VS.ShaderDetails;
|
||||
case ShaderStageType.Tess_Control: return m_VK.TCS.ShaderDetails;
|
||||
case ShaderStageType.Tess_Eval: return m_VK.TES.ShaderDetails;
|
||||
case ShaderStageType.Geometry: return m_VK.GS.ShaderDetails;
|
||||
case ShaderStageType.Fragment: return m_VK.FS.ShaderDetails;
|
||||
case ShaderStageType.Compute: return m_VK.CS.ShaderDetails;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -186,6 +223,18 @@ namespace renderdocui.Code
|
||||
case ShaderStageType.Compute: return m_GL.m_CS.Shader;
|
||||
}
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
switch (stage)
|
||||
{
|
||||
case ShaderStageType.Vertex: return m_VK.VS.Shader;
|
||||
case ShaderStageType.Tess_Control: return m_VK.TCS.Shader;
|
||||
case ShaderStageType.Tess_Eval: return m_VK.TES.Shader;
|
||||
case ShaderStageType.Geometry: return m_VK.GS.Shader;
|
||||
case ShaderStageType.Fragment: return m_VK.FS.Shader;
|
||||
case ShaderStageType.Compute: return m_VK.CS.Shader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ResourceId.Null;
|
||||
@@ -219,6 +268,18 @@ namespace renderdocui.Code
|
||||
case ShaderStageType.Compute: return String.Format("Shader {0}", m_GL.m_CS.Shader);
|
||||
}
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
switch (stage)
|
||||
{
|
||||
case ShaderStageType.Vertex: return m_VK.VS.ShaderName;
|
||||
case ShaderStageType.Domain: return m_VK.TCS.ShaderName;
|
||||
case ShaderStageType.Hull: return m_VK.TES.ShaderName;
|
||||
case ShaderStageType.Geometry: return m_VK.GS.ShaderName;
|
||||
case ShaderStageType.Pixel: return m_VK.FS.ShaderName;
|
||||
case ShaderStageType.Compute: return m_VK.CS.ShaderName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
@@ -240,6 +301,14 @@ namespace renderdocui.Code
|
||||
buf = m_GL.m_VtxIn.ibuffer;
|
||||
ByteOffset = 0; // GL only has per-draw index offset
|
||||
|
||||
return;
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
buf = m_VK.IA.ibuffer.buf;
|
||||
// VKTODOLOW maybe increase parameter to ulong and upcast others?
|
||||
ByteOffset = (uint)m_VK.IA.ibuffer.offs;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -261,6 +330,10 @@ namespace renderdocui.Code
|
||||
{
|
||||
return m_GL.m_VtxIn.primitiveRestart;
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
return m_VK.IA.primitiveRestartEnable;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -270,9 +343,9 @@ namespace renderdocui.Code
|
||||
{
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
if (IsLogD3D11 || IsLogVK)
|
||||
{
|
||||
// D3D11 this is always '-1' in whichever size of index we're using
|
||||
// D3D11 or Vulkan this is always '-1' in whichever size of index we're using
|
||||
return indexByteWidth == 2 ? ushort.MaxValue : uint.MaxValue;
|
||||
}
|
||||
else if (IsLogGL)
|
||||
@@ -322,6 +395,19 @@ namespace renderdocui.Code
|
||||
ret[i].ByteStride = m_GL.m_VtxIn.vbuffers[i].Stride;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
VBuffer[] ret = new VBuffer[m_VK.VI.binds.Length];
|
||||
for (int i = 0; i < m_VK.VI.binds.Length; i++)
|
||||
{
|
||||
ret[i].Buffer = m_VK.VI.vbuffers[i].buffer;
|
||||
// VKTODOLOW maybe increase parameter to ulong and upcast others?
|
||||
ret[i].ByteOffset = (uint)m_VK.VI.vbuffers[i].offset;
|
||||
ret[i].ByteStride = m_VK.VI.binds[i].bytestride;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -468,6 +554,42 @@ namespace renderdocui.Code
|
||||
a++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
var attrs = m_VK.VI.attrs;
|
||||
|
||||
int num = 0;
|
||||
for (int i = 0; i < attrs.Length; i++)
|
||||
{
|
||||
int attrib = -1;
|
||||
if (m_VK.VS.BindpointMapping != null && m_VK.VS.ShaderDetails != null)
|
||||
attrib = m_VK.VS.BindpointMapping.InputAttributes[i];
|
||||
else
|
||||
attrib = i;
|
||||
|
||||
if (attrib >= 0)
|
||||
num++;
|
||||
}
|
||||
|
||||
int a = 0;
|
||||
VertexInputAttribute[] ret = new VertexInputAttribute[num];
|
||||
for (int i = 0; i < attrs.Length && a < num; i++)
|
||||
{
|
||||
ret[a].Name = String.Format("attr{0}", i);
|
||||
ret[a].GenericValue = null;
|
||||
ret[a].VertexBuffer = (int)attrs[i].binding;
|
||||
ret[a].RelativeByteOffset = attrs[i].byteoffset;
|
||||
ret[a].PerInstance = m_VK.VI.binds[attrs[i].binding].perInstance;
|
||||
ret[a].InstanceRate = 1;
|
||||
ret[a].Format = attrs[i].format;
|
||||
ret[a].Used = true;
|
||||
|
||||
// VKTODOMED use shader reflection & attrs[i].location to get better name
|
||||
a++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -622,6 +744,10 @@ namespace renderdocui.Code
|
||||
return m_D3D11.m_OM.DepthTarget.Resource;
|
||||
else if (IsLogGL)
|
||||
return m_GL.m_FB.m_DrawFBO.Depth.Obj;
|
||||
else if (IsLogVK)
|
||||
return m_VK.Pass.renderpass.depthstencilAttachment >= 0
|
||||
? m_VK.Pass.framebuffer.attachments[m_VK.Pass.renderpass.depthstencilAttachment].img
|
||||
: ResourceId.Null;
|
||||
}
|
||||
|
||||
return ResourceId.Null;
|
||||
@@ -635,6 +761,10 @@ namespace renderdocui.Code
|
||||
return m_D3D11.m_OM.DepthTarget.Resource;
|
||||
else if (IsLogGL)
|
||||
return m_GL.m_FB.m_DrawFBO.Stencil.Obj;
|
||||
else if (IsLogVK)
|
||||
return m_VK.Pass.renderpass.depthstencilAttachment >= 0
|
||||
? m_VK.Pass.framebuffer.attachments[m_VK.Pass.renderpass.depthstencilAttachment].img
|
||||
: ResourceId.Null;
|
||||
}
|
||||
|
||||
return ResourceId.Null;
|
||||
@@ -662,6 +792,14 @@ namespace renderdocui.Code
|
||||
ret[i] = m_GL.m_FB.m_DrawFBO.Color[db].Obj;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
ResourceId[] ret = new ResourceId[m_VK.Pass.renderpass.colorAttachments.Length];
|
||||
for (int i = 0; i < m_VK.Pass.renderpass.colorAttachments.Length; i++)
|
||||
ret[i] = m_VK.Pass.framebuffer.attachments[m_VK.Pass.renderpass.colorAttachments[i]].img;
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -669,40 +807,6 @@ namespace renderdocui.Code
|
||||
return new ResourceId[0];
|
||||
}
|
||||
|
||||
public ResourceId OutputDepth
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
return m_D3D11.m_OM.DepthTarget.Resource;
|
||||
|
||||
if (IsLogGL)
|
||||
return m_GL.m_FB.m_DrawFBO.Depth.Obj;
|
||||
}
|
||||
|
||||
return ResourceId.Null;
|
||||
}
|
||||
}
|
||||
|
||||
public ResourceId OutputStencil
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
return m_D3D11.m_OM.DepthTarget.Resource;
|
||||
|
||||
if (IsLogGL)
|
||||
return m_GL.m_FB.m_DrawFBO.Stencil.Obj;
|
||||
}
|
||||
|
||||
return ResourceId.Null;
|
||||
}
|
||||
}
|
||||
|
||||
// Still to add:
|
||||
// [ShaderViewer] * {FetchTexture,FetchBuffer} GetFetchBufferOrFetchTexture(ShaderResource)
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ namespace renderdocui.Code
|
||||
|
||||
private D3D11PipelineState m_D3D11PipelineState = null;
|
||||
private GLPipelineState m_GLPipelineState = null;
|
||||
private VulkanPipelineState m_VulkanPipelineState = null;
|
||||
private CommonPipelineState m_PipelineState = new CommonPipelineState();
|
||||
|
||||
private List<ILogViewerForm> m_LogViewers = new List<ILogViewerForm>();
|
||||
@@ -151,6 +152,7 @@ namespace renderdocui.Code
|
||||
// direct access (note that only one of these will be valid for a log, check APIProps.pipelineType)
|
||||
public D3D11PipelineState CurD3D11PipelineState { get { return m_D3D11PipelineState; } }
|
||||
public GLPipelineState CurGLPipelineState { get { return m_GLPipelineState; } }
|
||||
public VulkanPipelineState CurVulkanPipelineState { get { return m_VulkanPipelineState; } }
|
||||
public CommonPipelineState CurPipelineState { get { return m_PipelineState; } }
|
||||
|
||||
#endregion
|
||||
@@ -504,7 +506,8 @@ namespace renderdocui.Code
|
||||
|
||||
m_D3D11PipelineState = r.GetD3D11PipelineState();
|
||||
m_GLPipelineState = r.GetGLPipelineState();
|
||||
m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_GLPipelineState);
|
||||
m_VulkanPipelineState = r.GetVulkanPipelineState();
|
||||
m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_GLPipelineState, m_VulkanPipelineState);
|
||||
|
||||
UnreadMessageCount = 0;
|
||||
AddMessages(m_FrameInfo[0].debugMessages);
|
||||
@@ -603,7 +606,8 @@ namespace renderdocui.Code
|
||||
|
||||
m_D3D11PipelineState = null;
|
||||
m_GLPipelineState = null;
|
||||
m_PipelineState.SetStates(null, null, null);
|
||||
m_VulkanPipelineState = null;
|
||||
m_PipelineState.SetStates(null, null, null, null);
|
||||
|
||||
DebugMessages.Clear();
|
||||
UnreadMessageCount = 0;
|
||||
@@ -812,7 +816,8 @@ namespace renderdocui.Code
|
||||
r.SetFrameEvent(m_FrameID, m_EventID);
|
||||
m_D3D11PipelineState = r.GetD3D11PipelineState();
|
||||
m_GLPipelineState = r.GetGLPipelineState();
|
||||
m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_GLPipelineState);
|
||||
m_VulkanPipelineState = r.GetVulkanPipelineState();
|
||||
m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_GLPipelineState, m_VulkanPipelineState);
|
||||
});
|
||||
|
||||
foreach (var logviewer in m_LogViewers)
|
||||
@@ -841,7 +846,8 @@ namespace renderdocui.Code
|
||||
r.SetFrameEvent(m_FrameID, m_EventID);
|
||||
m_D3D11PipelineState = r.GetD3D11PipelineState();
|
||||
m_GLPipelineState = r.GetGLPipelineState();
|
||||
m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_GLPipelineState);
|
||||
m_VulkanPipelineState = r.GetVulkanPipelineState();
|
||||
m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_GLPipelineState, m_VulkanPipelineState);
|
||||
});
|
||||
|
||||
foreach (var logviewer in m_LogViewers)
|
||||
|
||||
@@ -74,6 +74,20 @@ namespace renderdoc
|
||||
TextureCubeArray,
|
||||
};
|
||||
|
||||
public enum ShaderBindType
|
||||
{
|
||||
Unknown = 0,
|
||||
Sampler,
|
||||
ImageSampler,
|
||||
ReadOnlyImage,
|
||||
ReadWriteImage,
|
||||
ReadOnlyTBuffer,
|
||||
ReadWriteTBuffer,
|
||||
ReadOnlyBuffer,
|
||||
ReadWriteBuffer,
|
||||
InputAttachment,
|
||||
};
|
||||
|
||||
public enum SystemAttribute
|
||||
{
|
||||
None = 0,
|
||||
@@ -190,6 +204,7 @@ namespace renderdoc
|
||||
{
|
||||
D3D11,
|
||||
OpenGL,
|
||||
Vulkan,
|
||||
};
|
||||
|
||||
public enum PrimitiveTopology
|
||||
@@ -279,6 +294,20 @@ namespace renderdoc
|
||||
Compute,
|
||||
};
|
||||
|
||||
[Flags]
|
||||
public enum ShaderStageBits
|
||||
{
|
||||
Vertex = (1 << ShaderStageType.Vertex),
|
||||
Hull = (1 << ShaderStageType.Hull),
|
||||
Tess_Control = (1 << ShaderStageType.Tess_Control),
|
||||
Domain = (1 << ShaderStageType.Domain),
|
||||
Tess_Eval = (1 << ShaderStageType.Tess_Eval),
|
||||
Geometry = (1 << ShaderStageType.Geometry),
|
||||
Pixel = (1 << ShaderStageType.Pixel),
|
||||
Fragment = (1 << ShaderStageType.Fragment),
|
||||
Compute = (1 << ShaderStageType.Compute),
|
||||
};
|
||||
|
||||
public enum DebugMessageSource
|
||||
{
|
||||
API = 0,
|
||||
|
||||
@@ -213,6 +213,8 @@ namespace renderdoc
|
||||
private static extern bool ReplayRenderer_GetD3D11PipelineState(IntPtr real, IntPtr mem);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_GetGLPipelineState(IntPtr real, IntPtr mem);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_GetVulkanPipelineState(IntPtr real, IntPtr mem);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void ReplayRenderer_BuildCustomShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem);
|
||||
@@ -362,6 +364,22 @@ namespace renderdoc
|
||||
return ret;
|
||||
}
|
||||
|
||||
public VulkanPipelineState GetVulkanPipelineState()
|
||||
{
|
||||
IntPtr mem = CustomMarshal.Alloc(typeof(VulkanPipelineState));
|
||||
|
||||
bool success = ReplayRenderer_GetVulkanPipelineState(m_Real, mem);
|
||||
|
||||
VulkanPipelineState ret = null;
|
||||
|
||||
if (success)
|
||||
ret = (VulkanPipelineState)CustomMarshal.PtrToStructure(mem, typeof(VulkanPipelineState), true);
|
||||
|
||||
CustomMarshal.Free(mem);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ResourceId BuildCustomShader(string entry, string source, UInt32 compileFlags, ShaderStageType type, out string errors)
|
||||
{
|
||||
IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));
|
||||
|
||||
@@ -0,0 +1,349 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace renderdoc
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class VulkanPipelineState
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Pipeline
|
||||
{
|
||||
public ResourceId obj;
|
||||
public UInt32 flags;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class DescriptorSet
|
||||
{
|
||||
public ResourceId layout;
|
||||
public ResourceId descset;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class DescriptorBinding
|
||||
{
|
||||
public UInt32 arraySize;
|
||||
public ShaderBindType type;
|
||||
public ShaderStageBits stageFlags;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class BindingElement
|
||||
{
|
||||
public ResourceId view;
|
||||
public ResourceId sampler;
|
||||
public UInt32 offset;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public BindingElement[] binds;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public DescriptorBinding[] bindings;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public DescriptorSet[] DescSets;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public Pipeline compute;
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public Pipeline graphics;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class InputAssembly
|
||||
{
|
||||
public bool primitiveRestartEnable;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class IndexBuffer
|
||||
{
|
||||
public ResourceId buf;
|
||||
public UInt64 offs;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public IndexBuffer ibuffer;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public InputAssembly IA;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class VertexInput
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Attribute
|
||||
{
|
||||
public UInt32 location;
|
||||
public UInt32 binding;
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public ResourceFormat format;
|
||||
public UInt32 byteoffset;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public Attribute[] attrs;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Binding
|
||||
{
|
||||
public UInt32 vbufferBinding;
|
||||
public UInt32 bytestride;
|
||||
public bool perInstance;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public Binding[] binds;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class VertexBuffer
|
||||
{
|
||||
public ResourceId buffer;
|
||||
public UInt64 offset;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public VertexBuffer[] vbuffers;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public VertexInput VI;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class ShaderStage
|
||||
{
|
||||
private void PostMarshal()
|
||||
{
|
||||
if (_ptr_ShaderDetails != IntPtr.Zero)
|
||||
ShaderDetails = (ShaderReflection)CustomMarshal.PtrToStructure(_ptr_ShaderDetails, typeof(ShaderReflection), false);
|
||||
else
|
||||
ShaderDetails = null;
|
||||
|
||||
_ptr_ShaderDetails = IntPtr.Zero;
|
||||
}
|
||||
|
||||
public ResourceId Shader;
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string ShaderName;
|
||||
public bool customName;
|
||||
private IntPtr _ptr_ShaderDetails;
|
||||
[CustomMarshalAs(CustomUnmanagedType.Skip)]
|
||||
public ShaderReflection ShaderDetails;
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public ShaderBindpointMapping BindpointMapping;
|
||||
|
||||
public ShaderStageType stage;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public ShaderStage VS, TCS, TES, GS, FS, CS;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Tessellation
|
||||
{
|
||||
public UInt32 numControlPoints;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public Tessellation Tess;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class ViewState
|
||||
{
|
||||
public ResourceId state;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class ViewportScissor
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Viewport
|
||||
{
|
||||
public float x, y;
|
||||
public float Width, Height;
|
||||
public float MinDepth, MaxDepth;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public Viewport vp;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Scissor
|
||||
{
|
||||
public Int32 x, y, right, bottom;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public Scissor scissor;
|
||||
};
|
||||
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public ViewportScissor[] viewportScissors;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public ViewState VP;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Raster
|
||||
{
|
||||
public bool depthClipEnable;
|
||||
public bool rasterizerDiscardEnable;
|
||||
public bool FrontCCW;
|
||||
public TriangleFillMode FillMode;
|
||||
public TriangleCullMode CullMode;
|
||||
|
||||
// from dynamic state
|
||||
public ResourceId state;
|
||||
public float depthBias;
|
||||
public float depthBiasClamp;
|
||||
public float slopeScaledDepthBias;
|
||||
public float lineWidth;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public Raster RS;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class MultiSample
|
||||
{
|
||||
public UInt32 rasterSamples;
|
||||
public bool sampleShadingEnable;
|
||||
public float minSampleShading;
|
||||
public UInt32 sampleMask;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public MultiSample MSAA;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class ColorBlend
|
||||
{
|
||||
public bool alphaToCoverageEnable;
|
||||
public bool logicOpEnable;
|
||||
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string LogicOp;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Attachment
|
||||
{
|
||||
public bool blendEnable;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class BlendOp
|
||||
{
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string Source;
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string Destination;
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string Operation;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public BlendOp m_Blend, m_AlphaBlend;
|
||||
|
||||
public byte WriteMask;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public Attachment[] attachments;
|
||||
|
||||
public ResourceId state;
|
||||
[CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)]
|
||||
public float[] blendConst;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public ColorBlend CB;
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class DepthStencil
|
||||
{
|
||||
public bool depthTestEnable;
|
||||
public bool depthWriteEnable;
|
||||
public bool depthBoundsEnable;
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string depthCompareOp;
|
||||
|
||||
public bool stencilTestEnable;
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class StencilOp
|
||||
{
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string failOp;
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string depthFailOp;
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string passOp;
|
||||
[CustomMarshalAs(CustomUnmanagedType.UTF8TemplatedString)]
|
||||
public string func;
|
||||
public UInt32 stencilref;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public StencilOp front, back;
|
||||
|
||||
public ResourceId State;
|
||||
public float minDepthBounds;
|
||||
public float maxDepthBounds;
|
||||
public UInt32 StencilReadMask;
|
||||
public UInt32 StencilWriteMask;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public DepthStencil DS;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class CurrentPass
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class RenderPass
|
||||
{
|
||||
public ResourceId obj;
|
||||
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public UInt32[] inputAttachments;
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public UInt32[] colorAttachments;
|
||||
public Int32 depthstencilAttachment;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public RenderPass renderpass;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Framebuffer
|
||||
{
|
||||
public ResourceId obj;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class Attachment
|
||||
{
|
||||
public ResourceId view;
|
||||
public ResourceId img;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.TemplatedArray)]
|
||||
public Attachment[] attachments;
|
||||
|
||||
public UInt32 width, height, layers;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public Framebuffer framebuffer;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class RenderArea
|
||||
{
|
||||
public Int32 x, y, width, height;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public RenderArea renderArea;
|
||||
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public CurrentPass Pass;
|
||||
};
|
||||
}
|
||||
@@ -107,6 +107,7 @@
|
||||
<Compile Include="Code\CommonPipelineState.cs" />
|
||||
<Compile Include="Code\FormatElement.cs" />
|
||||
<Compile Include="Interop\Camera.cs" />
|
||||
<Compile Include="Interop\VulkanPipelineState.cs" />
|
||||
<Compile Include="Interop\Formatter.cs" />
|
||||
<Compile Include="Code\Helpers.cs" />
|
||||
<Compile Include="Code\LogViewerForm.cs" />
|
||||
|
||||
Reference in New Issue
Block a user