diff options
| author | Jason Maskell <[email protected]> | 2016-05-09 10:39:54 +0200 |
|---|---|---|
| committer | Jason Maskell <[email protected]> | 2016-05-09 10:39:54 +0200 |
| commit | 79b3462799c28af8ba586349bd671b1b56e72353 (patch) | |
| tree | 3b06e36c390254c0dc7f3733a0d32af213d87293 /include/restricted | |
| download | archived-waveworks-archive-79b3462799c28af8ba586349bd671b1b56e72353.tar.xz archived-waveworks-archive-79b3462799c28af8ba586349bd671b1b56e72353.zip | |
Initial commit with PS4 and XBone stuff trimmed.
Diffstat (limited to 'include/restricted')
| -rw-r--r-- | include/restricted/GFSDK_WaveWorks_CPU_Scheduler.h | 111 | ||||
| -rw-r--r-- | include/restricted/GFSDK_WaveWorks_GUID_NDA.h | 37 | ||||
| -rw-r--r-- | include/restricted/GFSDK_WaveWorks_Orbis.h | 108 | ||||
| -rw-r--r-- | include/restricted/GFSDK_WaveWorks_Orbis_API_Implementation.h | 211 | ||||
| -rw-r--r-- | include/restricted/GFSDK_WaveWorks_Orbis_API_Interface.h | 137 |
5 files changed, 604 insertions, 0 deletions
diff --git a/include/restricted/GFSDK_WaveWorks_CPU_Scheduler.h b/include/restricted/GFSDK_WaveWorks_CPU_Scheduler.h new file mode 100644 index 0000000..0d0b7f1 --- /dev/null +++ b/include/restricted/GFSDK_WaveWorks_CPU_Scheduler.h @@ -0,0 +1,111 @@ +// This code contains NVIDIA Confidential Information and is disclosed +// under the Mutual Non-Disclosure Agreement. +// +// Notice +// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES +// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. +// +// NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless +// expressly authorized by NVIDIA. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright � 2008- 2013 NVIDIA Corporation. All rights reserved. +// +// NVIDIA Corporation and its licensors retain all intellectual property and proprietary +// rights in and to this software and related documentation and any modifications thereto. +// Any use, reproduction, disclosure or distribution of this software and related +// documentation without an express license agreement from NVIDIA Corporation is +// strictly prohibited. +// + +#ifndef _GFSDK_WAVEWORKS_CPU_SCHEDULER_H +#define _GFSDK_WAVEWORKS_CPU_SCHEDULER_H + +#include <GFSDK_WaveWorks_Common.h> +#include <GFSDK_WaveWorks_Types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Fwd. decls +struct GFSDK_WaveWorks_CPU_Scheduler_Interface; + +// Scheduler-variation entrypoints +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Simulation_CreateD3D11_NDA( const GFSDK_WaveWorks_Simulation_Settings& settings, + const GFSDK_WaveWorks_Simulation_Params& params, + GFSDK_WaveWorks_CPU_Scheduler_Interface* pOptionalScheduler, + ID3D11Device* pD3DDevice, + GFSDK_WaveWorks_SimulationHandle* pResult + ); + +// The scheduler interface +struct GFSDK_WaveWorks_CPU_Scheduler_Interface +{ + /* + * This interface can be used to cause WaveWorks CPU simulation tasks to be handled + * by the client's own scheduler. + * + * First, note that you will need to provide one instance of this interface per + * WaveWorks simulation. The semantics of the interface imply a little bit of + * statefulness which evolves over a simulation cycle, therefore it is necessary + * to have a unique scheduler object per simulation + * + * A single simulation cycle consists of: + * + * 1/ one or more 'push' calls to queue the initial simulation tasks + * + * 2/ a call to 'kick()', which is a signal that the initial tasks are fully + * queued and simulation can commence + * + * 3/ scheduler calls 'taskHandler' for each queued task. This *may* result + * in further 'push' calls to queue further work + * + * 4/ the simulation cycle is complete when a 'taskHandler' call exits and + * there are no tasks left in the queue + * + * 5/ WaveWorks will either poll or wait for the simulation cycle to complete + * via isWorkDone() or waitForWorkDone(), depending on the calls made to + * the WaveWorks API by the client + * + * No more than ONE simulation cycle will be scheduled at a time. WaveWorks will + * wait for the current cycle to complete before attempting to push tasks for a new + * cycle. + */ + + // Queue a single item of work + virtual void push(gfsdk_U32 taskData) = 0; + + // Queue a batch of 'n' items of work + virtual void push(const gfsdk_U32* taskData, int n) = 0; + + // Queue a single item of work but insert at a random location in the existing work + // queue (reason: this gives better perf on some platforms by 'relaxing' the memory bus) + virtual void pushRandom(gfsdk_U32 taskData) = 0; + + // Wait until the current simulation cycle is out of tasks and all handlers have + // returned + virtual void waitForWorkDone() = 0; + + // Test whether the current simulation cycle is out of tasks and all handlers have + // returned + virtual bool isWorkDone() = 0; + + // Signal the scheduler to begin work on a new simulation cycle + typedef void (*ProcessTaskFn)(void* pContext, gfsdk_U32 taskData); + virtual bool kick(ProcessTaskFn taskHandler, void* pContext) = 0; +}; + +#ifdef __cplusplus +}; //extern "C" { +#endif + +#endif // _GFSDK_WAVEWORKS_CPU_SCHEDULER_H diff --git a/include/restricted/GFSDK_WaveWorks_GUID_NDA.h b/include/restricted/GFSDK_WaveWorks_GUID_NDA.h new file mode 100644 index 0000000..79da031 --- /dev/null +++ b/include/restricted/GFSDK_WaveWorks_GUID_NDA.h @@ -0,0 +1,37 @@ +// This code contains NVIDIA Confidential Information and is disclosed +// under the Mutual Non-Disclosure Agreement. +// +// Notice +// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES +// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. +// +// NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless +// expressly authorized by NVIDIA. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright � 2008- 2013 NVIDIA Corporation. All rights reserved. +// +// NVIDIA Corporation and its licensors retain all intellectual property and proprietary +// rights in and to this software and related documentation and any modifications thereto. +// Any use, reproduction, disclosure or distribution of this software and related +// documentation without an express license agreement from NVIDIA Corporation is +// strictly prohibited. +// + +#ifndef _GFSDK_WAVEWORKS_GUID_H +#define _GFSDK_WAVEWORKS_GUID_H + +#include <GFSDK_WaveWorks_Common.h> +#include <GFSDK_WaveWorks_Types.h> + +#define GFSDK_WAVEWORKS_API_GUID GFSDK_WaveWorks_API_GUID(0x8cc7a204, 0x75144563, 0xa43ace52, 0x81bce01d) + +#endif // _GFSDK_WAVEWORKS_GUID_H diff --git a/include/restricted/GFSDK_WaveWorks_Orbis.h b/include/restricted/GFSDK_WaveWorks_Orbis.h new file mode 100644 index 0000000..9ffa32e --- /dev/null +++ b/include/restricted/GFSDK_WaveWorks_Orbis.h @@ -0,0 +1,108 @@ +// This code contains NVIDIA Confidential Information and is disclosed +// under the Mutual Non-Disclosure Agreement. +// +// Notice +// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES +// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. +// +// NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless +// expressly authorized by NVIDIA. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright � 2008- 2013 NVIDIA Corporation. All rights reserved. +// +// NVIDIA Corporation and its licensors retain all intellectual property and proprietary +// rights in and to this software and related documentation and any modifications thereto. +// Any use, reproduction, disclosure or distribution of this software and related +// documentation without an express license agreement from NVIDIA Corporation is +// strictly prohibited. +// + +/* + * This header defines the Orbis-specific parts of the WaveWorks API + */ + +#ifndef _GFSDK_WAVEWORKS_ORBIS_H +#define _GFSDK_WAVEWORKS_ORBIS_H + +#include <GFSDK_WaveWorks_Common.h> +#include <GFSDK_WaveWorks_Types.h> + + +/*=========================================================================== + Orbis-specific malloc hooks (replaces the definition in the generic header) + ===========================================================================*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef GFSDK_WAVEWORKS_MALLOC_HOOKS_DEFINED +#define GFSDK_WAVEWORKS_MALLOC_HOOKS_DEFINED + +typedef void* (GFSDK_WAVEWORKS_CALL_CONV *GFSDK_WAVEWORKS_MALLOC) (size_t size); +typedef void (GFSDK_WAVEWORKS_CALL_CONV *GFSDK_WAVEWORKS_FREE) (void *p); +typedef void* (GFSDK_WAVEWORKS_CALL_CONV *GFSDK_WAVEWORKS_ALIGNED_MALLOC) (size_t size, size_t alignment); +typedef void (GFSDK_WAVEWORKS_CALL_CONV *GFSDK_WAVEWORKS_ALIGNED_FREE) (void *p); + +struct GFSDK_WaveWorks_Malloc_Hooks +{ + GFSDK_WAVEWORKS_ALIGNED_MALLOC pOnionAlloc; + GFSDK_WAVEWORKS_ALIGNED_FREE pOnionFree; + GFSDK_WAVEWORKS_ALIGNED_MALLOC pGarlicAlloc; + GFSDK_WAVEWORKS_ALIGNED_FREE pGarlicFree; +}; + +#endif + +#ifdef __cplusplus +}; //extern "C" { +#endif + + +/*=========================================================================== + The generic public header + ===========================================================================*/ +#include <GFSDK_WaveWorks.h> + + +/*=========================================================================== + Orbis-specifics + ===========================================================================*/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Fwd. decls +namespace sce { namespace Gnmx { class LightweightGfxContext; } } +struct GFSDK_WaveWorks_GnmxWrap; +struct GFSDK_WaveWorks_CPU_Scheduler_Interface; + +// Entrypoints +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_InitGnm(const GFSDK_WaveWorks_Malloc_Hooks* pRequiredMallocHooks, const GFSDK_WaveWorks_API_GUID& apiGUID, GFSDK_WaveWorks_GnmxWrap* pRequiredGnmxWrap); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_ReleaseGnm(); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Simulation_CreateGnm(const GFSDK_WaveWorks_Simulation_Settings& settings, const GFSDK_WaveWorks_Simulation_Params& params, GFSDK_WaveWorks_CPU_Scheduler_Interface* pOptionalScheduler, GFSDK_WaveWorks_SimulationHandle* pResult); +GFSDK_WAVEWORKS_DECL(gfsdk_U32 ) GFSDK_WaveWorks_Simulation_GetShaderInputCountGnm(); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Simulation_GetShaderInputDescGnm(gfsdk_U32 inputIndex, GFSDK_WaveWorks_ShaderInput_Desc* pDesc); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Simulation_SetRenderStateGnm(GFSDK_WaveWorks_SimulationHandle hSim, sce::Gnmx::LightweightGfxContext* pGC, const gfsdk_float4x4& matView, const gfsdk_U32 * pShaderInputRegisterMappings); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Simulation_KickGnm(GFSDK_WaveWorks_SimulationHandle hSim, gfsdk_U64* pKickID, sce::Gnmx::LightweightGfxContext* pGC); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Simulation_AdvanceStagingCursorGnm(GFSDK_WaveWorks_SimulationHandle hSim, bool block, sce::Gnmx::LightweightGfxContext* pGC); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Quadtree_CreateGnm(const GFSDK_WaveWorks_Quadtree_Params& params, GFSDK_WaveWorks_QuadtreeHandle* pResult); +GFSDK_WAVEWORKS_DECL(gfsdk_U32 ) GFSDK_WaveWorks_Quadtree_GetShaderInputCountGnm(); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Quadtree_GetShaderInputDescGnm(gfsdk_U32 inputIndex, GFSDK_WaveWorks_ShaderInput_Desc* pDesc); +GFSDK_WAVEWORKS_DECL(gfsdk_waveworks_result ) GFSDK_WaveWorks_Quadtree_DrawGnm(GFSDK_WaveWorks_QuadtreeHandle hQuadtree, sce::Gnmx::LightweightGfxContext* pGC, const gfsdk_float4x4& matView, const gfsdk_float4x4& matProj, const gfsdk_float2& viewportDims, const gfsdk_U32 * pShaderInputRegisterMappings); + +#ifdef __cplusplus +}; //extern "C" { +#endif + +#endif // _GFSDK_WAVEWORKS_ORBIS_H diff --git a/include/restricted/GFSDK_WaveWorks_Orbis_API_Implementation.h b/include/restricted/GFSDK_WaveWorks_Orbis_API_Implementation.h new file mode 100644 index 0000000..82ca914 --- /dev/null +++ b/include/restricted/GFSDK_WaveWorks_Orbis_API_Implementation.h @@ -0,0 +1,211 @@ +// This code contains NVIDIA Confidential Information and is disclosed +// under the Mutual Non-Disclosure Agreement. +// +// Notice +// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES +// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. +// +// NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless +// expressly authorized by NVIDIA. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright � 2008- 2013 NVIDIA Corporation. All rights reserved. +// +// NVIDIA Corporation and its licensors retain all intellectual property and proprietary +// rights in and to this software and related documentation and any modifications thereto. +// Any use, reproduction, disclosure or distribution of this software and related +// documentation without an express license agreement from NVIDIA Corporation is +// strictly prohibited. +// + +/* + * This header defines a default implementation for GnmxWrap which can be + * trivially #included in the client's compilation space to handle Gnmx calls + */ + +#ifndef _GFSDK_WAVEWORKS_ORBIS_API_IMPLEMENTATION_H +#define _GFSDK_WAVEWORKS_ORBIS_API_IMPLEMENTATION_H + +#include <GFSDK_WaveWorks_Orbis_API_Interface.h> + +#include <gnmx/lwgfxcontext.h> +#include <gnmx/shader_parser.h> + +struct GFSDK_WaveWorks_GnmxWrapImplementation : public GFSDK_WaveWorks_GnmxWrap +{ + virtual void setShaderType(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderType shaderType) + { gfxc.setShaderType(shaderType); } + + virtual void setCsShader(sce::Gnmx::LightweightGfxContext& gfxc, const sce::Gnmx::CsShader *csb, sce::Gnmx::InputResourceOffsets* csros) + { gfxc.setCsShader(csb, csros); } + + virtual void setRwBuffers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Buffer *rwBuffers) + { gfxc.setRwBuffers(stage, startSlot, numSlots, rwBuffers); } + + virtual void setBuffers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Buffer *buffers) + { gfxc.setBuffers(stage, startSlot, numSlots, buffers); } + + virtual void setConstantBuffers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Buffer *buffers) + { gfxc.setConstantBuffers(stage, startSlot, numSlots, buffers); } + + virtual void dispatch(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t threadGroupX, uint32_t threadGroupY, uint32_t threadGroupZ) + { gfxc.dispatch(threadGroupX, threadGroupY, threadGroupZ); } + + virtual void * allocateFromCommandBuffer(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t sizeInBytes, sce::Gnm::EmbeddedDataAlignment alignment) + { return gfxc.allocateFromCommandBuffer(sizeInBytes, alignment); } + + virtual void setVertexBuffers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Buffer *buffers) + { gfxc.setVertexBuffers(stage, startSlot, numSlots, buffers); } + + virtual void setPrimitiveType(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::PrimitiveType primType) + { gfxc.setPrimitiveType(primType); } + + virtual void setIndexSize(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::IndexSize indexSize) + { gfxc.setIndexSize(indexSize); } + + virtual void setIndexCount(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t indexCount) + { gfxc.setIndexCount(indexCount); } + + virtual void setIndexOffset(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t offset) + { gfxc.setIndexOffset(offset); } + + virtual void setIndexBuffer(sce::Gnmx::LightweightGfxContext& gfxc, const void * indexAddr) + { gfxc.setIndexBuffer(indexAddr); } + + virtual void drawIndexOffset(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t indexOffset, uint32_t indexCount) + { gfxc.drawIndexOffset(indexOffset, indexCount); } + + virtual void pushMarker(sce::Gnmx::LightweightGfxContext& gfxc, const char * debugString) + { gfxc.pushMarker(debugString); } + + virtual void popMarker(sce::Gnmx::LightweightGfxContext& gfxc) + { gfxc.popMarker(); } + + virtual void setActiveShaderStages(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ActiveShaderStages activeStages) + { gfxc.setActiveShaderStages(activeStages); } + + virtual void setVsShader(sce::Gnmx::LightweightGfxContext& gfxc, const sce::Gnmx::VsShader *vsb, uint32_t shaderModifier, void *fetchShaderAddr, sce::Gnmx::InputResourceOffsets* vsros) + { gfxc.setVsShader(vsb, shaderModifier, fetchShaderAddr, vsros); } + + virtual void setPsShader(sce::Gnmx::LightweightGfxContext& gfxc, const sce::Gnmx::PsShader *psb, sce::Gnmx::InputResourceOffsets* psros) + { gfxc.setPsShader(psb, psros); } + + virtual void setRenderTarget(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t rtSlot, sce::Gnm::RenderTarget const *target) + { gfxc.setRenderTarget(rtSlot, target); } + + virtual void setDepthRenderTarget(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::DepthRenderTarget const * depthTarget) + { gfxc.setDepthRenderTarget(depthTarget); } + + virtual void setupScreenViewport(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t left, uint32_t top, uint32_t right, uint32_t bottom, float zScale, float zOffset) + { gfxc.setupScreenViewport(left, top, right, bottom, zScale, zOffset); } + + virtual void setTextures(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Texture *textures) + { gfxc.setTextures(stage, startSlot, numSlots, textures); } + + virtual void setSamplers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Sampler *samplers) + { gfxc.setSamplers(stage, startSlot, numSlots, samplers); } + + virtual void setDepthStencilControl(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::DepthStencilControl depthControl) + { gfxc.setDepthStencilControl(depthControl); } + + virtual void setBlendControl(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t rtSlot, sce::Gnm::BlendControl blendControl) + { gfxc.setBlendControl(rtSlot, blendControl); } + + virtual void setPrimitiveSetup(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::PrimitiveSetup reg) + { gfxc.setPrimitiveSetup(reg); } + + virtual void setRenderTargetMask(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t mask) + { gfxc.setRenderTargetMask(mask); } + + virtual void waitForGraphicsWrites(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t baseAddr256, uint32_t sizeIn256ByteBlocks, uint32_t targetMask, sce::Gnm::CacheAction cacheAction, uint32_t extendedCacheMask, sce::Gnm::StallCommandBufferParserMode commandBufferStallMode) + { gfxc.waitForGraphicsWrites(baseAddr256, sizeIn256ByteBlocks, targetMask, cacheAction, extendedCacheMask, commandBufferStallMode); } + + virtual void setRwTextures(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Texture *rwTextures) + { gfxc.setRwTextures(stage, startSlot, numSlots, rwTextures); } + + virtual void generateInputResourceOffsetTable(sce::Gnmx::InputResourceOffsets* outTable, sce::Gnm::ShaderStage shaderStage, const void* gnmxShaderStruct) + { sce::Gnmx::generateInputResourceOffsetTable(outTable, shaderStage, gnmxShaderStruct); } + + virtual void patchShaderGpuAddress(sce::Gnmx::PsShader& psShader, void *gpuAddress) + { psShader.patchShaderGpuAddress(gpuAddress); } + + virtual void patchShaderGpuAddress(sce::Gnmx::CsShader& csShader, void *gpuAddress) + { csShader.patchShaderGpuAddress(gpuAddress); } + + virtual void patchShaderGpuAddress(sce::Gnmx::VsShader& vsShader, void *gpuAddress) + { vsShader.patchShaderGpuAddress(gpuAddress); } + + virtual void applyFetchShaderModifier(sce::Gnmx::VsShader& vsShader, uint32_t shaderModifier) + { vsShader.applyFetchShaderModifier(shaderModifier); } + + virtual const sce::Gnm::PsStageRegisters& getPsStageRegisters(sce::Gnmx::PsShader& psShader) + { return psShader.m_psStageRegisters; } + + virtual const sce::Gnm::CsStageRegisters& getCsStageRegisters(sce::Gnmx::CsShader& csShader) + { return csShader.m_csStageRegisters; } + + virtual const sce::Gnm::VsStageRegisters& getVsStageRegisters(sce::Gnmx::VsShader& vsShader) + { return vsShader.m_vsStageRegisters; } + + virtual uint32_t computeVsFetchShaderSize(const sce::Gnmx::VsShader *vsb) + { return sce::Gnmx::computeVsFetchShaderSize(vsb); } + + virtual void generateVsFetchShader(void *fs, uint32_t* shaderModifier, const sce::Gnmx::VsShader *vsb, const sce::Gnm::FetchShaderInstancingMode *instancingData) + { return sce::Gnmx::generateVsFetchShader(fs, shaderModifier, vsb, instancingData); } + + virtual uint32_t computeSize(sce::Gnmx::PsShader& psShader) + { return psShader.computeSize(); } + + virtual uint32_t computeSize(sce::Gnmx::VsShader& vsShader) + { return vsShader.computeSize(); } + + virtual uint32_t computeSize(sce::Gnmx::CsShader& csShader) + { return csShader.computeSize(); } + + virtual void parseShader(sce::Gnmx::ShaderInfo& shaderInfo, const void* data, int /* deprecated: shaderType*/) + { sce::Gnmx::parseShader(&shaderInfo, data); } + + virtual uint32_t getGpuShaderCodeSize(sce::Gnmx::ShaderInfo& shaderInfo) + { return shaderInfo.m_gpuShaderCodeSize; } + + virtual const uint32_t* getGpuShaderCode(sce::Gnmx::ShaderInfo& shaderInfo) + { return shaderInfo.m_gpuShaderCode; } + + virtual sce::Gnmx::PsShader* getPsShader(sce::Gnmx::ShaderInfo& shaderInfo) + { return shaderInfo.m_psShader; } + + virtual sce::Gnmx::CsShader* getCsShader(sce::Gnmx::ShaderInfo& shaderInfo) + { return shaderInfo.m_csShader; } + + virtual sce::Gnmx::VsShader* getVsShader(sce::Gnmx::ShaderInfo& shaderInfo) + { return shaderInfo.m_vsShader; } + + // Synthesised wrappers/accessors + virtual sce::Gnm::DrawCommandBuffer* getDcb(sce::Gnmx::LightweightGfxContext& gfxc) + { return &gfxc.m_dcb; } + + virtual int getVsShaderType() + { return sce::Gnmx::kVertexShader; } + + virtual int getPsShaderType() + { return sce::Gnmx::kPixelShader; } + + virtual int getCsShaderType() + { return sce::Gnmx::kComputeShader; } + + virtual size_t getSizeofShaderInfo() + { return sizeof(sce::Gnmx::ShaderInfo); } + + virtual size_t getSizeofInputResourceOffsets() + { return sizeof(sce::Gnmx::InputResourceOffsets); } +}; + +#endif // _GFSDK_WAVEWORKS_ORBIS_API_IMPLEMENTATION_H diff --git a/include/restricted/GFSDK_WaveWorks_Orbis_API_Interface.h b/include/restricted/GFSDK_WaveWorks_Orbis_API_Interface.h new file mode 100644 index 0000000..500f3e2 --- /dev/null +++ b/include/restricted/GFSDK_WaveWorks_Orbis_API_Interface.h @@ -0,0 +1,137 @@ +// This code contains NVIDIA Confidential Information and is disclosed +// under the Mutual Non-Disclosure Agreement. +// +// Notice +// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES +// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. +// +// NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. No third party distribution is allowed unless +// expressly authorized by NVIDIA. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright � 2008- 2013 NVIDIA Corporation. All rights reserved. +// +// NVIDIA Corporation and its licensors retain all intellectual property and proprietary +// rights in and to this software and related documentation and any modifications thereto. +// Any use, reproduction, disclosure or distribution of this software and related +// documentation without an express license agreement from NVIDIA Corporation is +// strictly prohibited. +// + +/* + * This header defines ABC's for indirecting WaveWorks access to Gnmx + * The raison d'etre of this header is to avoid generating linkage into Gnmx inside + * WaveWorks. By generating linkage outside of the lib (i.e. in the client app), it + * is possible for clients to use customised versions of Gnmx + */ + +#ifndef _GFSDK_WAVEWORKS_ORBIS_API_INTERFACE_H +#define _GFSDK_WAVEWORKS_ORBIS_API_INTERFACE_H + +#include <GFSDK_WaveWorks_Common.h> +#include <GFSDK_WaveWorks_Types.h> + +#include <gnm/constants.h> + +namespace sce { + namespace Gnmx { + class LightweightGfxContext; + class ShaderInfo; + class CsShader; + class PsShader; + class VsShader; + struct InputResourceOffsets; + } + namespace Gnm { + class Buffer; + class DrawCommandBuffer; + class RenderTarget; + class DepthRenderTarget; + class Texture; + class Sampler; + class DepthStencilControl; + class BlendControl; + class PrimitiveSetup; + class PsStageRegisters; + class CsStageRegisters; + class VsStageRegisters; + } +} + + struct GFSDK_WaveWorks_GnmxWrap + { + // LightweightGfxContext wrappers + virtual void setShaderType(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderType shaderType) = 0; + virtual void setCsShader(sce::Gnmx::LightweightGfxContext& gfxc, const sce::Gnmx::CsShader *csb, sce::Gnmx::InputResourceOffsets* csros) = 0; + virtual void setRwBuffers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Buffer *rwBuffers) = 0; + virtual void setBuffers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Buffer *buffers) = 0; + virtual void setConstantBuffers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Buffer *buffers) = 0; + virtual void dispatch(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t threadGroupX, uint32_t threadGroupY, uint32_t threadGroupZ) = 0; + virtual void * allocateFromCommandBuffer(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t sizeInBytes, sce::Gnm::EmbeddedDataAlignment alignment) = 0; + virtual void setVertexBuffers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Buffer *buffers) = 0; + virtual void setPrimitiveType(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::PrimitiveType primType) = 0; + virtual void setIndexSize(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::IndexSize indexSize) = 0; + virtual void setIndexCount(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t indexCount) = 0; + virtual void setIndexOffset(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t offset) = 0; + virtual void setIndexBuffer(sce::Gnmx::LightweightGfxContext& gfxc, const void * indexAddr) = 0; + virtual void drawIndexOffset(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t indexOffset, uint32_t indexCount) = 0; + virtual void pushMarker(sce::Gnmx::LightweightGfxContext& gfxc, const char * debugString) = 0; + virtual void popMarker(sce::Gnmx::LightweightGfxContext& gfxc) = 0; + virtual void setActiveShaderStages(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ActiveShaderStages activeStages) = 0; + virtual void setVsShader(sce::Gnmx::LightweightGfxContext& gfxc, const sce::Gnmx::VsShader *vsb, uint32_t shaderModifier, void *fetchShaderAddr, sce::Gnmx::InputResourceOffsets* vsros) = 0; + virtual void setPsShader(sce::Gnmx::LightweightGfxContext& gfxc, const sce::Gnmx::PsShader *psb, sce::Gnmx::InputResourceOffsets* psros) = 0; + virtual void setRenderTarget(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t rtSlot, sce::Gnm::RenderTarget const *target) = 0; + virtual void setDepthRenderTarget(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::DepthRenderTarget const * depthTarget) = 0; + virtual void setupScreenViewport(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t left, uint32_t top, uint32_t right, uint32_t bottom, float zScale, float zOffset) = 0; + virtual void setTextures(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Texture *textures) = 0; + virtual void setSamplers(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Sampler *samplers) = 0; + virtual void setDepthStencilControl(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::DepthStencilControl depthControl) = 0; + virtual void setBlendControl(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t rtSlot, sce::Gnm::BlendControl blendControl) = 0; + virtual void setPrimitiveSetup(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::PrimitiveSetup reg) = 0; + virtual void setRenderTargetMask(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t mask) = 0; + virtual void waitForGraphicsWrites(sce::Gnmx::LightweightGfxContext& gfxc, uint32_t baseAddr256, uint32_t sizeIn256ByteBlocks, uint32_t targetMask, sce::Gnm::CacheAction cacheAction, uint32_t extendedCacheMask, sce::Gnm::StallCommandBufferParserMode commandBufferStallMode) = 0; + virtual void setRwTextures(sce::Gnmx::LightweightGfxContext& gfxc, sce::Gnm::ShaderStage stage, uint32_t startSlot, uint32_t numSlots, const sce::Gnm::Texture *rwTextures) = 0; + + // Shader wrappers + virtual void patchShaderGpuAddress(sce::Gnmx::PsShader& psShader, void *gpuAddress) = 0; + virtual void patchShaderGpuAddress(sce::Gnmx::CsShader& csShader, void *gpuAddress) = 0; + virtual void patchShaderGpuAddress(sce::Gnmx::VsShader& vsShader, void *gpuAddress) = 0; + virtual void applyFetchShaderModifier(sce::Gnmx::VsShader& vsShader, uint32_t shaderModifier) = 0; + virtual const sce::Gnm::PsStageRegisters& getPsStageRegisters(sce::Gnmx::PsShader& psShader) = 0; + virtual const sce::Gnm::CsStageRegisters& getCsStageRegisters(sce::Gnmx::CsShader& csShader) = 0; + virtual const sce::Gnm::VsStageRegisters& getVsStageRegisters(sce::Gnmx::VsShader& vsShader) = 0; + virtual uint32_t computeVsFetchShaderSize(const sce::Gnmx::VsShader *vsb) = 0; + virtual void generateVsFetchShader(void *fs, uint32_t* shaderModifier, const sce::Gnmx::VsShader *vsb, const sce::Gnm::FetchShaderInstancingMode *instancingData) = 0; + virtual uint32_t computeSize(sce::Gnmx::PsShader& psShader) = 0; + virtual uint32_t computeSize(sce::Gnmx::VsShader& vsShader) = 0; + virtual uint32_t computeSize(sce::Gnmx::CsShader& csShader) = 0; + + // ShaderInfo wrappers + virtual void parseShader(sce::Gnmx::ShaderInfo& shaderInfo, const void* data, int shaderType) = 0; + virtual uint32_t getGpuShaderCodeSize(sce::Gnmx::ShaderInfo& shaderInfo) = 0; + virtual const uint32_t* getGpuShaderCode(sce::Gnmx::ShaderInfo& shaderInfo) = 0; + virtual sce::Gnmx::PsShader* getPsShader(sce::Gnmx::ShaderInfo& shaderInfo) = 0; + virtual sce::Gnmx::CsShader* getCsShader(sce::Gnmx::ShaderInfo& shaderInfo) = 0; + virtual sce::Gnmx::VsShader* getVsShader(sce::Gnmx::ShaderInfo& shaderInfo) = 0; + + // InputResourceOffsets wrappers + virtual void generateInputResourceOffsetTable(sce::Gnmx::InputResourceOffsets* outTable, sce::Gnm::ShaderStage shaderStage, const void* gnmxShaderStruct) = 0; + + // Synthesised wrappers/accessors + virtual sce::Gnm::DrawCommandBuffer* getDcb(sce::Gnmx::LightweightGfxContext& gfxc) = 0; + virtual int getVsShaderType() = 0; + virtual int getPsShaderType() = 0; + virtual int getCsShaderType() = 0; + virtual size_t getSizeofShaderInfo() = 0; + virtual size_t getSizeofInputResourceOffsets() = 0; + }; + +#endif // _GFSDK_WAVEWORKS_ORBIS_API_INTERFACE_H |