From 134f7c8ffe016f69db735176a92ff0df8e2a34d5 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 20 Nov 2017 18:55:20 +0000 Subject: [PATCH] Enforce python bindings rdcarray instantiations, and add missing ones --- .../Code/pyrenderdoc/container_handling.i | 26 +++++-- qrenderdoc/Code/pyrenderdoc/renderdoc.i | 72 ++++++++++++++++++- renderdoc/api/replay/renderdoc_replay.h | 64 +++++++++-------- 3 files changed, 126 insertions(+), 36 deletions(-) diff --git a/qrenderdoc/Code/pyrenderdoc/container_handling.i b/qrenderdoc/Code/pyrenderdoc/container_handling.i index a7a38c1a7..218ecfc58 100644 --- a/qrenderdoc/Code/pyrenderdoc/container_handling.i +++ b/qrenderdoc/Code/pyrenderdoc/container_handling.i @@ -210,10 +210,7 @@ LIST_MODIFY_IN_PLACE_TYPEMAP(typeName) // passing pure lists that aren't C++ side at all). %header %{ template -void ARRAY_INSTANTIATION_CHECK_NAME(typeName)(typeName *) -{ - // TODO remove this to make it an error to miss the instantiation of this array type -} +void ARRAY_INSTANTIATION_CHECK_NAME(typeName)(typeName *); %} // override these typemaps to instantiate a checking template. @@ -257,3 +254,24 @@ void ARRAY_INSTANTIATION_CHECK_NAME(arrayType)(arrayType *) %} %enddef + +%define TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(arrayType, nspace, innerType) + +ARRAY_ADD_SLOTS(arrayType, arrayType##_of_##nspace##_##innerType) + +// instantiate template +%rename(arrayType##_of_##nspace##_##innerType) arrayType; +%template(arrayType##_of_##nspace##_##innerType) arrayType; + +ARRAY_DEFINE_SLOTS(arrayType, arrayType##_of_##nspace##_##innerType) + +%header %{ + +template<> +void ARRAY_INSTANTIATION_CHECK_NAME(arrayType)(arrayType *) +{ +} + +%} + +%enddef diff --git a/qrenderdoc/Code/pyrenderdoc/renderdoc.i b/qrenderdoc/Code/pyrenderdoc/renderdoc.i index 36918d7a9..28e00c650 100644 --- a/qrenderdoc/Code/pyrenderdoc/renderdoc.i +++ b/qrenderdoc/Code/pyrenderdoc/renderdoc.i @@ -178,8 +178,78 @@ EXTEND_ARRAY_CLASS_METHODS(StructuredBufferList) // If you get an error with add_your_use_of_rdcarray_to_swig_interface missing, add your type here // or in qrenderdoc.i, depending on which one is appropriate TEMPLATE_ARRAY_INSTANTIATE(rdcarray, int) -TEMPLATE_ARRAY_INSTANTIATE(rdcarray, rdcstr) TEMPLATE_ARRAY_INSTANTIATE(rdcarray, float) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, uint32_t) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, uint64_t) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, rdcstr) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, WindowingSystem) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, DrawcallDescription) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, GPUCounter) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, CounterResult) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, APIEvent) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, BindpointMap) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, BufferDescription) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, CaptureFileFormat) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ConstantBlock) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, DebugMessage) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, EnvironmentModification) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, EventUsage) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, PathEntry) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, PixelModification) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ResourceDescription) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ResourceId) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderCompileFlag) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderConstant) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderDebugState) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderResource) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderSampler) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderSourceFile) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderVariable) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, SigParameter) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, TextureDescription) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, Attachment) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, BindingElement) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, Blend) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, DescriptorBinding) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, DescriptorSet) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, ImageData) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, ImageLayout) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, SpecInfo) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, VB) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, VertexAttribute) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, VertexBinding) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, ViewportScissor) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, Blend) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, CBuffer) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, Layout) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, Sampler) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, Scissor) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, SOBind) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, VB) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, View) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, Viewport) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, Blend) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, CBuffer) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, Layout) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, RegisterSpace) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, ResourceData) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, ResourceState) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, Sampler) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, Scissor) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, SOBind) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, VB) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, View) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, Viewport) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, Attachment) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, Blend) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, Buffer) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, ImageLoadStore) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, Sampler) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, Scissor) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, Texture) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, VB) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, VertexAttribute) +TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, Viewport) /////////////////////////////////////////////////////////////////////////////////////////// // declare a function for passing external objects into python diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index 6b7770467..809068224 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -150,37 +150,6 @@ struct XCBWindowData #endif -DOCUMENT(R"(Specifies a windowing system to use for creating an output window. - -.. data:: Unknown - - No windowing data is passed and no native window will be output to. - -.. data:: Win32 - - The windowing data refers to a Win32 ``HWND`` handle. - -.. data:: Xlib - - The windowing data refers to an Xlib pair of ``Display *`` and ``Drawable``. - -.. data:: XCB - - The windowing data refers to an XCB pair of ``xcb_connection_t *`` and ``xcb_window_t``. - -.. data:: Android - - The windowing data refers to an Android ``ANativeWindow *``. -)"); -enum class WindowingSystem : uint32_t -{ - Unknown, - Win32, - Xlib, - XCB, - Android, -}; - DOCUMENT(R"(Internal structure used for initialising environment in a replay application.)"); struct GlobalEnvironment { @@ -338,6 +307,39 @@ inline enum_name operator++(enum_name &a) \ #include "stringise.h" #include "structured_data.h" +DOCUMENT(R"(Specifies a windowing system to use for creating an output window. + +.. data:: Unknown + + No windowing data is passed and no native window will be output to. + +.. data:: Win32 + + The windowing data refers to a Win32 ``HWND`` handle. + +.. data:: Xlib + + The windowing data refers to an Xlib pair of ``Display *`` and ``Drawable``. + +.. data:: XCB + + The windowing data refers to an XCB pair of ``xcb_connection_t *`` and ``xcb_window_t``. + +.. data:: Android + + The windowing data refers to an Android ``ANativeWindow *``. +)"); +enum class WindowingSystem : uint32_t +{ + Unknown, + Win32, + Xlib, + XCB, + Android, +}; + +DECLARE_REFLECTION_ENUM(WindowingSystem); + #ifdef RENDERDOC_EXPORTS struct ResourceId;