mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Expose C++ interface via API headers, for C++ UI
* Since the exported C functions just take an explicit 'this' parameter and call the corresponding function, we can just make it contractual via a virtual interface that the pointer can be dereferenced.
This commit is contained in:
@@ -200,12 +200,12 @@ namespace renderdoc
|
||||
private static extern bool ReplayRenderer_GetGLPipelineState(IntPtr real, IntPtr mem);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_BuildCustomShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem);
|
||||
private static extern void ReplayRenderer_BuildCustomShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_FreeCustomShader(IntPtr real, ResourceId id);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_BuildTargetShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem);
|
||||
private static extern void ReplayRenderer_BuildTargetShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayRenderer_ReplaceResource(IntPtr real, ResourceId from, ResourceId to);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
@@ -353,14 +353,11 @@ namespace renderdoc
|
||||
IntPtr entry_mem = CustomMarshal.MakeUTF8String(entry);
|
||||
IntPtr source_mem = CustomMarshal.MakeUTF8String(source);
|
||||
|
||||
bool success = ReplayRenderer_BuildCustomShader(m_Real, entry_mem, source_mem, compileFlags, type, ref ret, mem);
|
||||
ReplayRenderer_BuildCustomShader(m_Real, entry_mem, source_mem, compileFlags, type, ref ret, mem);
|
||||
|
||||
CustomMarshal.Free(entry_mem);
|
||||
CustomMarshal.Free(source_mem);
|
||||
|
||||
if (!success)
|
||||
ret = ResourceId.Null;
|
||||
|
||||
errors = CustomMarshal.TemplatedArrayToString(mem, true);
|
||||
|
||||
CustomMarshal.Free(mem);
|
||||
@@ -380,14 +377,11 @@ namespace renderdoc
|
||||
IntPtr entry_mem = CustomMarshal.MakeUTF8String(entry);
|
||||
IntPtr source_mem = CustomMarshal.MakeUTF8String(source);
|
||||
|
||||
bool success = ReplayRenderer_BuildTargetShader(m_Real, entry_mem, source_mem, compileFlags, type, ref ret, mem);
|
||||
ReplayRenderer_BuildTargetShader(m_Real, entry_mem, source_mem, compileFlags, type, ref ret, mem);
|
||||
|
||||
CustomMarshal.Free(entry_mem);
|
||||
CustomMarshal.Free(source_mem);
|
||||
|
||||
if (!success)
|
||||
ret = ResourceId.Null;
|
||||
|
||||
errors = CustomMarshal.TemplatedArrayToString(mem, true);
|
||||
|
||||
CustomMarshal.Free(mem);
|
||||
|
||||
Reference in New Issue
Block a user