[Mesa-dev] [PATCH v2 12/17] swr/rast: add SwrGetInterface() function to return api

Tim Rowley timothy.o.rowley at intel.com
Wed Apr 26 18:33:13 UTC 2017


---
 src/gallium/drivers/swr/rasterizer/common/os.h  |   6 +
 src/gallium/drivers/swr/rasterizer/core/api.cpp |  48 ++++++++
 src/gallium/drivers/swr/rasterizer/core/api.h   | 141 ++++++++++++++++--------
 3 files changed, 151 insertions(+), 44 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/common/os.h b/src/gallium/drivers/swr/rasterizer/common/os.h
index 38553df..f9b6cca 100644
--- a/src/gallium/drivers/swr/rasterizer/common/os.h
+++ b/src/gallium/drivers/swr/rasterizer/common/os.h
@@ -30,6 +30,7 @@
 #if (defined(FORCE_WINDOWS) || defined(_WIN32)) && !defined(FORCE_LINUX)
 
 #define SWR_API __cdecl
+#define SWR_VISIBLE
 
 #ifndef NOMINMAX
 #define NOMINMAX
@@ -91,6 +92,7 @@ static inline void AlignedFree(void* p)
 #elif defined(__APPLE__) || defined(FORCE_LINUX) || defined(__linux__) || defined(__gnu_linux__)
 
 #define SWR_API
+#define SWR_VISIBLE __attribute__((visibility("default")))
 
 #include <stdlib.h>
 #include <string.h>
@@ -273,6 +275,10 @@ typedef MEGABYTE    GIGABYTE[1024];
 #define ATTR_UNUSED
 #endif
 
+#define SWR_FUNC(_retType, _funcName, /* args */...)   \
+   typedef _retType (SWR_API * PFN##_funcName)(__VA_ARGS__); \
+  _retType SWR_API _funcName(__VA_ARGS__);
+
 // Defined in os.cpp
 void SWR_API SetCurrentThreadName(const char* pThreadName);
 
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp
index dc8f517..4554aaa 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp
@@ -1641,3 +1641,51 @@ void SWR_API SwrEndFrame(
     pContext->frameCount++;
 }
 
+
+void SwrGetInterface(SWR_INTERFACE &out_funcs)
+{
+    out_funcs.pfnSwrCreateContext = SwrCreateContext;
+    out_funcs.pfnSwrDestroyContext = SwrDestroyContext;
+    out_funcs.pfnSwrSaveState = SwrSaveState;
+    out_funcs.pfnSwrRestoreState = SwrRestoreState;
+    out_funcs.pfnSwrSync = SwrSync;
+    out_funcs.pfnSwrWaitForIdle = SwrWaitForIdle;
+    out_funcs.pfnSwrWaitForIdleFE = SwrWaitForIdleFE;
+    out_funcs.pfnSwrSetVertexBuffers = SwrSetVertexBuffers;
+    out_funcs.pfnSwrSetIndexBuffer = SwrSetIndexBuffer;
+    out_funcs.pfnSwrSetFetchFunc = SwrSetFetchFunc;
+    out_funcs.pfnSwrSetSoFunc = SwrSetSoFunc;
+    out_funcs.pfnSwrSetSoState = SwrSetSoState;
+    out_funcs.pfnSwrSetSoBuffers = SwrSetSoBuffers;
+    out_funcs.pfnSwrSetVertexFunc = SwrSetVertexFunc;
+    out_funcs.pfnSwrSetFrontendState = SwrSetFrontendState;
+    out_funcs.pfnSwrSetGsState = SwrSetGsState;
+    out_funcs.pfnSwrSetGsFunc = SwrSetGsFunc;
+    out_funcs.pfnSwrSetCsFunc = SwrSetCsFunc;
+    out_funcs.pfnSwrSetTsState = SwrSetTsState;
+    out_funcs.pfnSwrSetHsFunc = SwrSetHsFunc;
+    out_funcs.pfnSwrSetDsFunc = SwrSetDsFunc;
+    out_funcs.pfnSwrSetDepthStencilState = SwrSetDepthStencilState;
+    out_funcs.pfnSwrSetBackendState = SwrSetBackendState;
+    out_funcs.pfnSwrSetDepthBoundsState = SwrSetDepthBoundsState;
+    out_funcs.pfnSwrSetPixelShaderState = SwrSetPixelShaderState;
+    out_funcs.pfnSwrSetBlendState = SwrSetBlendState;
+    out_funcs.pfnSwrSetBlendFunc = SwrSetBlendFunc;
+    out_funcs.pfnSwrDraw = SwrDraw;
+    out_funcs.pfnSwrDrawInstanced = SwrDrawInstanced;
+    out_funcs.pfnSwrDrawIndexed = SwrDrawIndexed;
+    out_funcs.pfnSwrDrawIndexedInstanced = SwrDrawIndexedInstanced;
+    out_funcs.pfnSwrInvalidateTiles = SwrInvalidateTiles;
+    out_funcs.pfnSwrDiscardRect = SwrDiscardRect;
+    out_funcs.pfnSwrDispatch = SwrDispatch;
+    out_funcs.pfnSwrStoreTiles = SwrStoreTiles;
+    out_funcs.pfnSwrClearRenderTarget = SwrClearRenderTarget;
+    out_funcs.pfnSwrSetRastState = SwrSetRastState;
+    out_funcs.pfnSwrSetViewports = SwrSetViewports;
+    out_funcs.pfnSwrSetScissorRects = SwrSetScissorRects;
+    out_funcs.pfnSwrGetPrivateContextState = SwrGetPrivateContextState;
+    out_funcs.pfnSwrAllocDrawContextMemory = SwrAllocDrawContextMemory;
+    out_funcs.pfnSwrEnableStatsFE = SwrEnableStatsFE;
+    out_funcs.pfnSwrEnableStatsBE = SwrEnableStatsBE;
+    out_funcs.pfnSwrEndFrame = SwrEndFrame;
+}
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.h b/src/gallium/drivers/swr/rasterizer/core/api.h
index 166598a..eacf0a8 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.h
+++ b/src/gallium/drivers/swr/rasterizer/core/api.h
@@ -220,13 +220,13 @@ struct SWR_CREATECONTEXT_INFO
 //////////////////////////////////////////////////////////////////////////
 /// @brief Create SWR Context.
 /// @param pCreateInfo - pointer to creation info.
-HANDLE SWR_API SwrCreateContext(
+SWR_FUNC(HANDLE, SwrCreateContext,
     SWR_CREATECONTEXT_INFO* pCreateInfo);
 
 //////////////////////////////////////////////////////////////////////////
 /// @brief Destroys SWR Context.
 /// @param hContext - Handle passed back from SwrCreateContext
-void SWR_API SwrDestroyContext(
+SWR_FUNC(void, SwrDestroyContext,
     HANDLE hContext);
 
 //////////////////////////////////////////////////////////////////////////
@@ -234,7 +234,7 @@ void SWR_API SwrDestroyContext(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pOutputStateBlock - Memory block to receive API state data
 /// @param memSize - Size of memory pointed to by pOutputStateBlock
-void SWR_API SwrSaveState(
+SWR_FUNC(void, SwrSaveState,
     HANDLE hContext,
     void* pOutputStateBlock,
     size_t memSize);
@@ -244,7 +244,7 @@ void SWR_API SwrSaveState(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pStateBlock - Memory block to read API state data from
 /// @param memSize - Size of memory pointed to by pStateBlock
-void SWR_API SwrRestoreState(
+SWR_FUNC(void, SwrRestoreState,
     HANDLE hContext,
     const void* pStateBlock,
     size_t memSize);
@@ -255,7 +255,7 @@ void SWR_API SwrRestoreState(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pfnFunc - pointer to callback function,
 /// @param userData - user data to pass back 
-void SWR_API SwrSync(
+SWR_FUNC(void, SwrSync,
     HANDLE hContext,
     PFN_CALLBACK_FUNC pfnFunc,
     uint64_t userData,
@@ -265,13 +265,13 @@ void SWR_API SwrSync(
 //////////////////////////////////////////////////////////////////////////
 /// @brief Blocks until all rendering has been completed.
 /// @param hContext - Handle passed back from SwrCreateContext
-void SWR_API SwrWaitForIdle(
+SWR_FUNC(void, SwrWaitForIdle,
     HANDLE hContext);
 
 //////////////////////////////////////////////////////////////////////////
 /// @brief Blocks until all FE rendering has been completed.
 /// @param hContext - Handle passed back from SwrCreateContext
-void SWR_API SwrWaitForIdleFE(
+SWR_FUNC(void, SwrWaitForIdleFE,
     HANDLE hContext);
 
 //////////////////////////////////////////////////////////////////////////
@@ -279,7 +279,7 @@ void SWR_API SwrWaitForIdleFE(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param numBuffers - Number of vertex buffer state descriptors.
 /// @param pVertexBuffers - Array of vertex buffer state descriptors.
-void SWR_API SwrSetVertexBuffers(
+SWR_FUNC(void, SwrSetVertexBuffers,
     HANDLE hContext,
     uint32_t numBuffers,
     const SWR_VERTEX_BUFFER_STATE* pVertexBuffers);
@@ -288,7 +288,7 @@ void SWR_API SwrSetVertexBuffers(
 /// @brief Set index buffer
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pIndexBuffer - Index buffer.
-void SWR_API SwrSetIndexBuffer(
+SWR_FUNC(void, SwrSetIndexBuffer,
     HANDLE hContext,
     const SWR_INDEX_BUFFER_STATE* pIndexBuffer);
 
@@ -296,7 +296,7 @@ void SWR_API SwrSetIndexBuffer(
 /// @brief Set fetch shader pointer.
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pfnFetchFunc - Pointer to shader.
-void SWR_API SwrSetFetchFunc(
+SWR_FUNC(void, SwrSetFetchFunc,
     HANDLE hContext,
     PFN_FETCH_FUNC    pfnFetchFunc);
 
@@ -305,7 +305,7 @@ void SWR_API SwrSetFetchFunc(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pfnSoFunc - Pointer to shader.
 /// @param streamIndex - specifies stream
-void SWR_API SwrSetSoFunc(
+SWR_FUNC(void, SwrSetSoFunc,
     HANDLE hContext,
     PFN_SO_FUNC    pfnSoFunc,
     uint32_t streamIndex);
@@ -314,7 +314,7 @@ void SWR_API SwrSetSoFunc(
 /// @brief Set streamout state
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pSoState - Pointer to streamout state.
-void SWR_API SwrSetSoState(
+SWR_FUNC(void, SwrSetSoState,
     HANDLE hContext,
     SWR_STREAMOUT_STATE* pSoState);
 
@@ -323,7 +323,7 @@ void SWR_API SwrSetSoState(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pSoBuffer - Pointer to streamout buffer.
 /// @param slot - Slot to bind SO buffer to.
-void SWR_API SwrSetSoBuffers(
+SWR_FUNC(void, SwrSetSoBuffers,
     HANDLE hContext,
     SWR_STREAMOUT_BUFFER* pSoBuffer,
     uint32_t slot);
@@ -332,7 +332,7 @@ void SWR_API SwrSetSoBuffers(
 /// @brief Set vertex shader pointer.
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pfnVertexFunc - Pointer to shader.
-void SWR_API SwrSetVertexFunc(
+SWR_FUNC(void, SwrSetVertexFunc,
     HANDLE hContext,
     PFN_VERTEX_FUNC pfnVertexFunc);
 
@@ -340,7 +340,7 @@ void SWR_API SwrSetVertexFunc(
 /// @brief Set frontend state.
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to state
-void SWR_API SwrSetFrontendState(
+SWR_FUNC(void, SwrSetFrontendState,
     HANDLE hContext,
     SWR_FRONTEND_STATE *pState);
 
@@ -348,7 +348,7 @@ void SWR_API SwrSetFrontendState(
 /// @brief Set geometry shader state.
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to state
-void SWR_API SwrSetGsState(
+SWR_FUNC(void, SwrSetGsState,
     HANDLE hContext,
     SWR_GS_STATE *pState);
 
@@ -356,7 +356,7 @@ void SWR_API SwrSetGsState(
 /// @brief Set geometry shader
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to geometry shader function
-void SWR_API SwrSetGsFunc(
+SWR_FUNC(void, SwrSetGsFunc,
     HANDLE hContext,
     PFN_GS_FUNC pfnGsFunc);
 
@@ -368,7 +368,7 @@ void SWR_API SwrSetGsFunc(
 /// @param totalSpillFillSize - size in bytes needed for spill/fill.
 /// @param scratchSpaceSizePerInstance - size of the scratch space needed per simd instance
 /// @param numInstances - number of simd instances that are run per execution of the shader
-void SWR_API SwrSetCsFunc(
+SWR_FUNC(void, SwrSetCsFunc,
     HANDLE hContext,
     PFN_CS_FUNC pfnCsFunc,
     uint32_t totalThreadsInGroup,
@@ -381,7 +381,7 @@ void SWR_API SwrSetCsFunc(
 /// @brief Set tessellation state.
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to state
-void SWR_API SwrSetTsState(
+SWR_FUNC(void, SwrSetTsState,
     HANDLE hContext,
     SWR_TS_STATE *pState);
 
@@ -389,7 +389,7 @@ void SWR_API SwrSetTsState(
 /// @brief Set hull shader
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pfnFunc - Pointer to shader function
-void SWR_API SwrSetHsFunc(
+SWR_FUNC(void, SwrSetHsFunc,
     HANDLE hContext,
     PFN_HS_FUNC pfnFunc);
 
@@ -397,7 +397,7 @@ void SWR_API SwrSetHsFunc(
 /// @brief Set domain shader
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pfnFunc - Pointer to shader function
-void SWR_API SwrSetDsFunc(
+SWR_FUNC(void, SwrSetDsFunc,
     HANDLE hContext,
     PFN_DS_FUNC pfnFunc);
 
@@ -405,7 +405,7 @@ void SWR_API SwrSetDsFunc(
 /// @brief Set depth stencil state
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to state.
-void SWR_API SwrSetDepthStencilState(
+SWR_FUNC(void, SwrSetDepthStencilState,
     HANDLE hContext,
     SWR_DEPTH_STENCIL_STATE *pState);
 
@@ -413,7 +413,7 @@ void SWR_API SwrSetDepthStencilState(
 /// @brief Set backend state
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to state.
-void SWR_API SwrSetBackendState(
+SWR_FUNC(void, SwrSetBackendState,
     HANDLE hContext,
     SWR_BACKEND_STATE *pState);
 
@@ -421,7 +421,7 @@ void SWR_API SwrSetBackendState(
 /// @brief Set depth bounds state
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to state.
-void SWR_API SwrSetDepthBoundsState(
+SWR_FUNC(void, SwrSetDepthBoundsState,
     HANDLE hContext,
     SWR_DEPTH_BOUNDS_STATE *pState);
 
@@ -429,7 +429,7 @@ void SWR_API SwrSetDepthBoundsState(
 /// @brief Set pixel shader state
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to state.
-void SWR_API SwrSetPixelShaderState(
+SWR_FUNC(void, SwrSetPixelShaderState,
     HANDLE hContext,
     SWR_PS_STATE *pState);
 
@@ -437,7 +437,7 @@ void SWR_API SwrSetPixelShaderState(
 /// @brief Set blend state
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pState - Pointer to state.
-void SWR_API SwrSetBlendState(
+SWR_FUNC(void, SwrSetBlendState,
     HANDLE hContext,
     SWR_BLEND_STATE *pState);
 
@@ -446,7 +446,7 @@ void SWR_API SwrSetBlendState(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param renderTarget - render target index
 /// @param pfnBlendFunc - function pointer
-void SWR_API SwrSetBlendFunc(
+SWR_FUNC(void, SwrSetBlendFunc,
     HANDLE hContext,
     uint32_t renderTarget,
     PFN_BLEND_JIT_FUNC pfnBlendFunc);
@@ -457,7 +457,7 @@ void SWR_API SwrSetBlendFunc(
 /// @param topology - Specifies topology for draw.
 /// @param startVertex - Specifies start vertex in vertex buffer for draw.
 /// @param primCount - Number of vertices.
-void SWR_API SwrDraw(
+SWR_FUNC(void, SwrDraw,
     HANDLE hContext,
     PRIMITIVE_TOPOLOGY topology,
     uint32_t startVertex,
@@ -471,7 +471,7 @@ void SWR_API SwrDraw(
 /// @param numInstances - How many instances to render.
 /// @param startVertex - Specifies start vertex for draw. (vertex data)
 /// @param startInstance - Which instance to start sequentially fetching from in each buffer (instanced data)
-void SWR_API SwrDrawInstanced(
+SWR_FUNC(void, SwrDrawInstanced,
     HANDLE hContext,
     PRIMITIVE_TOPOLOGY topology,
     uint32_t numVertsPerInstance,
@@ -486,7 +486,7 @@ void SWR_API SwrDrawInstanced(
 /// @param numIndices - Number of indices to read sequentially from index buffer.
 /// @param indexOffset - Starting index into index buffer.
 /// @param baseVertex - Vertex in vertex buffer to consider as index "0". Note value is signed.
-void SWR_API SwrDrawIndexed(
+SWR_FUNC(void, SwrDrawIndexed,
     HANDLE hContext,
     PRIMITIVE_TOPOLOGY topology,
     uint32_t numIndices,
@@ -502,7 +502,7 @@ void SWR_API SwrDrawIndexed(
 /// @param indexOffset - Starting index into index buffer.
 /// @param baseVertex - Vertex in vertex buffer to consider as index "0". Note value is signed.
 /// @param startInstance - Which instance to start sequentially fetching from in each buffer (instanced data)
-void SWR_API SwrDrawIndexedInstanced(
+SWR_FUNC(void, SwrDrawIndexedInstanced,
     HANDLE hContext,
     PRIMITIVE_TOPOLOGY topology,
     uint32_t numIndices,
@@ -517,7 +517,7 @@ void SWR_API SwrDrawIndexedInstanced(
 /// @param attachmentMask - The mask specifies which surfaces attached to the hottiles to invalidate.
 /// @param invalidateRect - The pixel-coordinate rectangle to invalidate.  This will be expanded to
 ///                         be hottile size-aligned.
-void SWR_API SwrInvalidateTiles(
+SWR_FUNC(void, SwrInvalidateTiles,
     HANDLE hContext,
     uint32_t attachmentMask,
     const SWR_RECT& invalidateRect);
@@ -528,7 +528,7 @@ void SWR_API SwrInvalidateTiles(
 /// @param attachmentMask - The mask specifies which surfaces attached to the hottiles to discard.
 /// @param rect - The pixel-coordinate rectangle to discard.  Only fully-covered hottiles will be
 ///               discarded.
-void SWR_API SwrDiscardRect(
+SWR_FUNC(void, SwrDiscardRect,
     HANDLE hContext,
     uint32_t attachmentMask,
     const SWR_RECT& rect);
@@ -539,7 +539,7 @@ void SWR_API SwrDiscardRect(
 /// @param threadGroupCountX - Number of thread groups dispatched in X direction
 /// @param threadGroupCountY - Number of thread groups dispatched in Y direction
 /// @param threadGroupCountZ - Number of thread groups dispatched in Z direction
-void SWR_API SwrDispatch(
+SWR_FUNC(void, SwrDispatch,
     HANDLE hContext,
     uint32_t threadGroupCountX,
     uint32_t threadGroupCountY,
@@ -554,7 +554,7 @@ enum SWR_TILE_STATE
 };
 
 /// @todo Add a good description for what attachments are and when and why you would use the different SWR_TILE_STATEs.
-void SWR_API SwrStoreTiles(
+SWR_FUNC(void, SwrStoreTiles,
     HANDLE hContext,
     uint32_t attachmentMask,
     SWR_TILE_STATE postStoreTileState,
@@ -570,7 +570,7 @@ void SWR_API SwrStoreTiles(
 /// @param z - depth value use for clearing depth buffer
 /// @param stencil - stencil value used for clearing stencil buffer
 /// @param clearRect - The pixel-coordinate rectangle to clear in all cleared buffers
-void SWR_API SwrClearRenderTarget(
+SWR_FUNC(void, SwrClearRenderTarget,
     HANDLE hContext,
     uint32_t attachmentMask,
     uint32_t renderTargetArrayIndex,
@@ -583,7 +583,7 @@ void SWR_API SwrClearRenderTarget(
 /// @brief SwrSetRastState
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param pRastState - New SWR_RASTSTATE used for SwrDraw* commands
-void SWR_API SwrSetRastState(
+SWR_FUNC(void, SwrSetRastState,
     HANDLE hContext,
     const SWR_RASTSTATE *pRastState);
 
@@ -593,7 +593,7 @@ void SWR_API SwrSetRastState(
 /// @param numViewports - number of viewports passed in
 /// @param pViewports - Specifies extents of viewport.
 /// @param pMatrices - If not specified then SWR computes a default one.
-void SWR_API SwrSetViewports(
+SWR_FUNC(void, SwrSetViewports,
     HANDLE hContext,
     uint32_t numViewports,
     const SWR_VIEWPORT* pViewports,
@@ -604,7 +604,7 @@ void SWR_API SwrSetViewports(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param numScissors - number of scissors passed in
 /// @param pScissors - array of scissors
-void SWR_API SwrSetScissorRects(
+SWR_FUNC(void, SwrSetScissorRects,
     HANDLE hContext,
     uint32_t numScissors,
     const SWR_RECT* pScissors);
@@ -617,7 +617,7 @@ void SWR_API SwrSetScissorRects(
 /// @note  Client needs to resend private state prior to each draw call.
 ///        Also, SWR is responsible for the private state memory.
 /// @param hContext - Handle passed back from SwrCreateContext
-VOID* SWR_API SwrGetPrivateContextState(
+SWR_FUNC(void*, SwrGetPrivateContextState,
     HANDLE hContext);
 
 //////////////////////////////////////////////////////////////////////////
@@ -628,7 +628,7 @@ VOID* SWR_API SwrGetPrivateContextState(
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param size - Size of allocation
 /// @param align - Alignment needed for allocation.
-VOID* SWR_API SwrAllocDrawContextMemory(
+SWR_FUNC(void*, SwrAllocDrawContextMemory,
     HANDLE hContext,
     uint32_t size,
     uint32_t align);
@@ -637,7 +637,7 @@ VOID* SWR_API SwrAllocDrawContextMemory(
 /// @brief Enables stats counting
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param enable - If true then counts are incremented.
-void SWR_API SwrEnableStatsFE(
+SWR_FUNC(void, SwrEnableStatsFE,
     HANDLE hContext,
     bool enable);
 
@@ -645,15 +645,68 @@ void SWR_API SwrEnableStatsFE(
 /// @brief Enables stats counting
 /// @param hContext - Handle passed back from SwrCreateContext
 /// @param enable - If true then counts are incremented.
-void SWR_API SwrEnableStatsBE(
+SWR_FUNC(void, SwrEnableStatsBE,
     HANDLE hContext,
     bool enable);
 
 //////////////////////////////////////////////////////////////////////////
 /// @brief Mark end of frame - used for performance profiling
 /// @param hContext - Handle passed back from SwrCreateContext
-void SWR_API SwrEndFrame(
+SWR_FUNC(void, SwrEndFrame,
     HANDLE hContext);
 
 
+struct SWR_INTERFACE
+{
+    PFNSwrCreateContext pfnSwrCreateContext;
+    PFNSwrDestroyContext pfnSwrDestroyContext;
+    PFNSwrSaveState pfnSwrSaveState;
+    PFNSwrRestoreState pfnSwrRestoreState;
+    PFNSwrSync pfnSwrSync;
+    PFNSwrWaitForIdle pfnSwrWaitForIdle;
+    PFNSwrWaitForIdleFE pfnSwrWaitForIdleFE;
+    PFNSwrSetVertexBuffers pfnSwrSetVertexBuffers;
+    PFNSwrSetIndexBuffer pfnSwrSetIndexBuffer;
+    PFNSwrSetFetchFunc pfnSwrSetFetchFunc;
+    PFNSwrSetSoFunc pfnSwrSetSoFunc;
+    PFNSwrSetSoState pfnSwrSetSoState;
+    PFNSwrSetSoBuffers pfnSwrSetSoBuffers;
+    PFNSwrSetVertexFunc pfnSwrSetVertexFunc;
+    PFNSwrSetFrontendState pfnSwrSetFrontendState;
+    PFNSwrSetGsState pfnSwrSetGsState;
+    PFNSwrSetGsFunc pfnSwrSetGsFunc;
+    PFNSwrSetCsFunc pfnSwrSetCsFunc;
+    PFNSwrSetTsState pfnSwrSetTsState;
+    PFNSwrSetHsFunc pfnSwrSetHsFunc;
+    PFNSwrSetDsFunc pfnSwrSetDsFunc;
+    PFNSwrSetDepthStencilState pfnSwrSetDepthStencilState;
+    PFNSwrSetBackendState pfnSwrSetBackendState;
+    PFNSwrSetDepthBoundsState pfnSwrSetDepthBoundsState;
+    PFNSwrSetPixelShaderState pfnSwrSetPixelShaderState;
+    PFNSwrSetBlendState pfnSwrSetBlendState;
+    PFNSwrSetBlendFunc pfnSwrSetBlendFunc;
+    PFNSwrDraw pfnSwrDraw;
+    PFNSwrDrawInstanced pfnSwrDrawInstanced;
+    PFNSwrDrawIndexed pfnSwrDrawIndexed;
+    PFNSwrDrawIndexedInstanced pfnSwrDrawIndexedInstanced;
+    PFNSwrInvalidateTiles pfnSwrInvalidateTiles;
+    PFNSwrDiscardRect pfnSwrDiscardRect;
+    PFNSwrDispatch pfnSwrDispatch;
+    PFNSwrStoreTiles pfnSwrStoreTiles;
+    PFNSwrClearRenderTarget pfnSwrClearRenderTarget;
+    PFNSwrSetRastState pfnSwrSetRastState;
+    PFNSwrSetViewports pfnSwrSetViewports;
+    PFNSwrSetScissorRects pfnSwrSetScissorRects;
+    PFNSwrGetPrivateContextState pfnSwrGetPrivateContextState;
+    PFNSwrAllocDrawContextMemory pfnSwrAllocDrawContextMemory;
+    PFNSwrEnableStatsFE pfnSwrEnableStatsFE;
+    PFNSwrEnableStatsBE pfnSwrEnableStatsBE;
+    PFNSwrEndFrame pfnSwrEndFrame;
+};
+
+extern "C" {
+typedef void (SWR_API * PFNSwrGetInterface)(SWR_INTERFACE &out_funcs);
+SWR_VISIBLE void SWR_API SwrGetInterface(SWR_INTERFACE &out_funcs);
+}
+
 #endif
-- 
2.7.4



More information about the mesa-dev mailing list