diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml new file mode 100644 index 00000000..2afd7e80 --- /dev/null +++ b/.github/workflows/draft-release.yml @@ -0,0 +1,30 @@ +on: + push: + tags: + - v*.*.* + +jobs: + release-on-tag: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v3 + + - uses: jungwinter/split@master + id: split + with: + msg: ${{ github.ref_name }} + separator: "." + + - name: Set environment + run: echo "VERSION=$(echo "${GITHUB_REF_NAME#v}" | sed 's/-LTS//g')" >> $GITHUB_ENV && echo "MINOR_VERSION=${{ steps.split.outputs._0 }}.${{ steps.split.outputs._1 }}" >> $GITHUB_ENV + + - uses: ncipollo/release-action@v1 + with: + draft: true + name: "After Effects Plugin: ${{ github.ref_name }}" + body: "PopcornFX Plugin ${{ github.ref_name }} for After Effects\n\n + You can download the PopcornFX Editor and find the full changelog here:\n + https://wiki.popcornfx.com/index.php?title=PK-Editor_${{ env.MINOR_VERSION }}#Changelog_${{ env.VERSION }}" \ No newline at end of file diff --git a/AE.code-workspace b/AE.code-workspace new file mode 100644 index 00000000..f439dfde --- /dev/null +++ b/AE.code-workspace @@ -0,0 +1,65 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "C_Cpp.default.defines": [ "PK_BUILD_WITH_METAL_SUPPORT=1" ], + "C_Cpp.default.includePath": [ + "../../Runtime", + "../../Runtime/include", + "../../Runtime/include/license/AfterEffects", + "../../Integrations/AfterEffects/PK-AfterEffects__Main/Sources", + "../../Integrations/AfterEffects/PK-AfterEffects__Main/Include", + "../../Integrations/AfterEffects/PK-AfterEffects__Main/Precompiled", + "../../Integrations/AfterEffects/AE_Suites", + "../../Integrations/AfterEffects/External/AE SDK/Util", + "../../Integrations/AfterEffects/External/AE SDK/Resources", + "../../Integrations/AfterEffects/External/AE SDK/Headers", + "../../Integrations/AfterEffects/External/AE SDK/Headers/SP", + "../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk", + "../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/config", + "../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/drawbotsuite", + "../../SDK/Samples/PK-Samples", + "../../SDK/Samples/External/imgui", + "../../SDK/Samples/External/GL/include", + "/usr/local/include/SDL2", + ], + "lldb.launch.env": { + "AEBin": "\"/Applications/Adobe After Effects 2022/Adobe After Effects 2022.app/Contents/MacOS/After Effects\"" + }, + "terminal.integrated.env.osx": { + "AEBin": "\"/Applications/Adobe After Effects 2022/Adobe After Effects 2022.app/Contents/MacOS/After Effects\"" + }, + "files.associations": { + "array": "cpp", + "iterator": "cpp", + "string": "cpp", + "string_view": "cpp", + "vector": "cpp", + "__locale": "cpp" + }, + }, + "launch": { + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(lldb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "/Applications/Adobe After Effects 2022/Adobe After Effects 2022.app/Contents/MacOS/After Effects", + "args": ["--debug"], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "lldb", + "visualizerFile": "${workspaceRoot}/../../../configurations/visual studio/debugger/PopcornFX.natvis", + } + ] + } +} diff --git a/AE_Effect_Attribute/Include/AEAttribute_Main.h b/AE_Effect_Attribute/Include/AEAttribute_Main.h new file mode 100644 index 00000000..e44dc60c --- /dev/null +++ b/AE_Effect_Attribute/Include/AEAttribute_Main.h @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AEATTRIBUTE_MAIN_H__ +#define __FX_AEATTRIBUTE_MAIN_H__ + +#include + +#ifdef AE_OS_WIN + typedef unsigned short PixelType; + #include +#endif + +#include +#include + +#include "PopcornFX_Define.h" + +//---------------------------------------------------------------------------- + +extern "C" { + DllExport + PF_Err + EffectMain( + PF_Cmd cmd, + PF_InData *in_data, + PF_OutData *out_data, + PF_ParamDef *params[], + PF_LayerDef *output, + void *extra); + +} + +//---------------------------------------------------------------------------- + +#endif + diff --git a/AE_Effect_Attribute/Include/AEAttribute_ParamDefine.h b/AE_Effect_Attribute/Include/AEAttribute_ParamDefine.h new file mode 100644 index 00000000..780622ba --- /dev/null +++ b/AE_Effect_Attribute/Include/AEAttribute_ParamDefine.h @@ -0,0 +1,58 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#include +#include + +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +enum EPKParams +{ + ATTRIBUTE_INPUT = 0, + ATTRIBUTE_PARAM, + ATTRIBUTE_NUM_PARAMS +}; + +//---------------------------------------------------------------------------- + +enum EStrIDType +{ + StrID_NONE = 0, + StrID_Name, + StrID_Description, + StrID_Generic_Bool1, + StrID_Generic_Bool2, + StrID_Generic_Bool3, + StrID_Generic_Bool4, + StrID_Generic_Int1, + StrID_Generic_Int2, + StrID_Generic_Int3, + StrID_Generic_Int4, + StrID_Generic_Float1, + StrID_Generic_Float2, + StrID_Generic_Float3, + StrID_Generic_Float4, + StrID_Generic_Quaternion, + + StrID_Generic_Infernal_Uuid, + StrID_Scale_Checkbox, + StrID_Generic_Infernal_Name, + + StrID_Generic_Color_RGB, + StrID_Generic_Color_A, + + StrID_Parameters_Reset, + StrID_Parameters_Reset_Button, + + StrID_NUMTYPES +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END diff --git a/AE_Effect_Attribute/Include/AEAttribute_PluginInterface.h b/AE_Effect_Attribute/Include/AEAttribute_PluginInterface.h new file mode 100644 index 00000000..6adef44b --- /dev/null +++ b/AE_Effect_Attribute/Include/AEAttribute_PluginInterface.h @@ -0,0 +1,99 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_CPluginInterface_H__ +#define __FX_CPluginInterface_H__ + +#include "PopcornFX_Define.h" +#include "PopcornFX_BasePluginInterface.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +__AAEPK_BEGIN + +struct SAAEIOData; +struct SAttributeDesc; +struct SAttributeSequenceDataFlat; + +//---------------------------------------------------------------------------- + +class CPluginInterface : public CBasePluginInterface +{ + struct SAttributeData + { + //Memory Owned by effect + SAttributeDesc *m_DescAttribute; + + bool m_UIVisibility[__Attribute_Parameters_Count]; + bool m_IsDefault; + + SAttributeData() + : m_DescAttribute(nullptr) + , m_IsDefault(true) + { + } + ~SAttributeData() + { + m_DescAttribute = nullptr; + } + }; +public: + ~CPluginInterface(); + static CPluginInterface &Instance(); + + PF_Err About(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err GlobalSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err ParamsSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err GlobalSetdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + + PF_Err SequenceSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceReSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceFlatten(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceShutdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + + PF_Err PreRender(SAAEIOData &AAEData); + PF_Err SmartRender(SAAEIOData &AAEData); + PF_Err UpdateParams(SAAEIOData &AAEData, PF_ParamDef *params[]); + PF_Err UpdateParamsUI(SAAEIOData &AAEData, PF_ParamDef *params[]); + + PF_Err SetDefaultValueIFN(SAAEIOData &AAEData, PF_ParamDef *params[], SAttributeData *AttrData); + + PF_Err HandleDataFromAEGP(SAAEIOData &AAEData, PF_ParamDef *params[]); + + void UpdateBoolAttribute(SAAEIOData &AAEData, SAttributeDesc *descriptor, bool *uiVisibility); + void UpdateIntAttribute(SAAEIOData &AAEData, SAttributeDesc *descriptor, bool *uiVisibility); + void UpdateFloatAttribute(SAAEIOData &AAEData, SAttributeDesc *descriptor, bool *uiVisibility); + +private: + CPluginInterface(); + static CPluginInterface *m_Instance; + static uint32_t m_AttrUID; + + bool _GetAttributeSequenceUID(SAAEIOData &AAEData, std::string &out); + + PF_Err _RegisterAttributeInstancePlugin(SAAEIOData &AAEData, PF_ParamDef *params[], SAttributeSequenceDataFlat *sequenceData, bool setup); + + std::unordered_map m_AttributeData; + + std::thread::id m_MainThreadID; +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#endif diff --git a/AE_Effect_Attribute/Include/AEAttribute_SequenceData.h b/AE_Effect_Attribute/Include/AEAttribute_SequenceData.h new file mode 100644 index 00000000..e74600f2 --- /dev/null +++ b/AE_Effect_Attribute/Include/AEAttribute_SequenceData.h @@ -0,0 +1,52 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEATTRIBUTE_SEQUENCEDATA_H__ +#define __AEATTRIBUTE_SEQUENCEDATA_H__ + +#include +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +namespace SequenceCST +{ + static const size_t MAX_PATH_LEN = 1024; + static const size_t MAX_NAME_LEN = 100; + static const size_t UUID_LEN = 64; +}; + +//---------------------------------------------------------------------------- + +struct SAttributeSequenceDataFlat +{ + bool m_IsFlat = true; + + char m_AttributeUUID[SequenceCST::UUID_LEN]; + size_t m_AttributeUUIDLen; + + char m_AttributeName[SequenceCST::MAX_NAME_LEN]; + size_t m_AttributeNameLen; + + bool m_IsDefault = true; + + A_long m_LayerID; + + void CopyFrom(SAttributeSequenceDataFlat* src); + + void SetIsDefaultValue(bool value); + bool SetUUID(const char *uuid); + bool SetName(const char *name); + bool SetLayerID(bool value); +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#endif // !__AAEFFECT_SEQUENCEDATA_H__ diff --git a/AE_Effect_Attribute/PkgInfo b/AE_Effect_Attribute/PkgInfo new file mode 100644 index 00000000..31cf1f41 --- /dev/null +++ b/AE_Effect_Attribute/PkgInfo @@ -0,0 +1 @@ +eFKTFXTC \ No newline at end of file diff --git a/AE_Effect_Attribute/Precompiled/ae_precompiled.cpp b/AE_Effect_Attribute/Precompiled/ae_precompiled.cpp new file mode 100644 index 00000000..84e52276 --- /dev/null +++ b/AE_Effect_Attribute/Precompiled/ae_precompiled.cpp @@ -0,0 +1 @@ +#include "ae_precompiled.h" diff --git a/AE_Effect_Attribute/Precompiled/ae_precompiled.h b/AE_Effect_Attribute/Precompiled/ae_precompiled.h new file mode 100644 index 00000000..5b1746dd --- /dev/null +++ b/AE_Effect_Attribute/Precompiled/ae_precompiled.h @@ -0,0 +1,13 @@ +#pragma once + +#undef PV_MODULE_NAME +#undef PV_MODULE_SYM +#define PV_MODULE_NAME "AEPlugin" +#define PV_MODULE_SYM AEPlugin + +#include + +#if defined(PK_WINDOWS) +#define WIN32_LEAN_AND_MEAN +#include +#endif diff --git a/AE_Effect_Attribute/Sources/AEAttribute_Main.cpp b/AE_Effect_Attribute/Sources/AEAttribute_Main.cpp new file mode 100644 index 00000000..a442da88 --- /dev/null +++ b/AE_Effect_Attribute/Sources/AEAttribute_Main.cpp @@ -0,0 +1,172 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEAttribute_Main.h" + +#include "AEAttribute_PluginInterface.h" +#include "PopcornFX_Suite.h" + +#include + +#include + +//---------------------------------------------------------------------------- + +extern "C" +{ + DllExport PF_Err PluginDataEntryFunction( PF_PluginDataPtr inPtr, + PF_PluginDataCB inPluginDataCallBackPtr, + SPBasicSuite *inSPBasicSuitePtr, + const char *inHostName, + const char *inHostVersion) + { + (void)inSPBasicSuitePtr; + (void)inHostName; + (void)inHostVersion; + + PF_Err result = PF_Err_INVALID_CALLBACK; + + result = PF_REGISTER_EFFECT( + inPtr, // Infos must match the PopcornFXPiPL.r + inPluginDataCallBackPtr, // + "Attribute", // Name + "ADBE PopcornFX Attribute", // Match Name + "PopcornFX", // Category + AE_RESERVED_INFO); // Reserved Info + return result; + } +} + +//---------------------------------------------------------------------------- + +PF_Err EffectMain( PF_Cmd cmd, + PF_InData *in_data, + PF_OutData *out_data, + PF_ParamDef *params[], + PF_LayerDef *output, + void *extra) +{ + PF_Err result = PF_Err_NONE; + AAePk::CPluginInterface &AEPlugin = AAePk::CPluginInterface::Instance(); + AAePk::SAAEIOData AAEData{ cmd, in_data, out_data, extra, AEPlugin.GetParametersIndexes() }; + +#if _DEBUG + try + { +#endif + + assert(in_data != nullptr); + assert(out_data != nullptr); + if (in_data == nullptr) + return PF_Err_BAD_CALLBACK_PARAM; + //Force Render + //AAEData.m_OutData->out_flags &= PF_OutFlag_FORCE_RERENDER + + if (AAEData.m_InData->appl_id == 'PrMr') + { + //User Tried to load plugin in Premiere Pro. + //There is surely a better way to handle this. + return PF_Err_UNRECOGNIZED_PARAM_TYPE; + } + + switch (cmd) + { + // Called once + case PF_Cmd_ABOUT: + //Mandatory + //Version and General Infos about the plugin + result = AEPlugin.About(AAEData, params, output); + break; + case PF_Cmd_GLOBAL_SETUP: + //Mandatory + //Startup run + result = AEPlugin.GlobalSetup(AAEData, params, output); + break; + case PF_Cmd_PARAMS_SETUP: + //Mandatory + //Setup AAE UI. + result = AEPlugin.ParamsSetup(AAEData, params, output); + break; + case PF_Cmd_GLOBAL_SETDOWN: + //Mandatory + result = AEPlugin.GlobalSetdown(AAEData, params, output); + break; + // Sequence Handling + //UI thread + case PF_Cmd_SEQUENCE_SETUP: + //Each time the user adds the effect to a layer + result = AEPlugin.SequenceSetup(AAEData, params, output); + break; + case PF_Cmd_SEQUENCE_RESETUP: + //Load or Duplicate + //UI/Render thread + result = AEPlugin.SequenceReSetup(AAEData, params, output); + break; + case PF_Cmd_SEQUENCE_FLATTEN: + //Effect Saved, copied, duplicated.. + //UI/Render thread + result = AEPlugin.SequenceFlatten(AAEData, params, output); + break; + case PF_Cmd_SEQUENCE_SETDOWN: + //Effect Deleted + result = AEPlugin.SequenceShutdown(AAEData, params, output); + break; + case PF_Cmd_GET_FLATTENED_SEQUENCE_DATA: + break; + + // Called each Frame + case PF_Cmd_AUDIO_SETUP: + case PF_Cmd_AUDIO_RENDER: + case PF_Cmd_AUDIO_SETDOWN: + break; + case PF_Cmd_FRAME_SETUP: + //Allow resizing of drawing area + break; + case PF_Cmd_SMART_PRE_RENDER: + result = AEPlugin.PreRender(AAEData); + //Can be called several times for one render + break; + case PF_Cmd_SMART_RENDER: + result = AEPlugin.SmartRender(AAEData); + break; + case PF_Cmd_FRAME_SETDOWN: + //Allow resizing of drawing area + break; + + // Messaging + case PF_Cmd_EVENT: + break; + case PF_Cmd_USER_CHANGED_PARAM: + AEPlugin.UpdateParams(AAEData, params); + //If PF_ParamFlag_SUPERVIZE if set when adding param, PF_Cmd_USER_CHANGED_PARAM is called when value change + break; + case PF_Cmd_UPDATE_PARAMS_UI: + result = AEPlugin.UpdateParamsUI(AAEData, params); + break; + case PF_Cmd_ARBITRARY_CALLBACK: + case PF_Cmd_GET_EXTERNAL_DEPENDENCIES: + break; + case PF_Cmd_COMPLETELY_GENERAL: + result = AEPlugin.HandleDataFromAEGP(AAEData, params); + break; + case PF_Cmd_DO_DIALOG: + //Send when user click on Options + //Received if PF_OutFlag_I_DO_DIALOG is set in PF_Cmd_GLOBAL_SETUP + break; + case PF_Cmd_QUERY_DYNAMIC_FLAGS: + break; + default: + break; + } + +#if _DEBUG + } + catch (...) + { + assert(false); + } +#endif + return result; +} diff --git a/AE_Effect_Attribute/Sources/AEAttribute_ParamDefine.cpp b/AE_Effect_Attribute/Sources/AEAttribute_ParamDefine.cpp new file mode 100644 index 00000000..19ba1ce2 --- /dev/null +++ b/AE_Effect_Attribute/Sources/AEAttribute_ParamDefine.cpp @@ -0,0 +1,66 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEAttribute_ParamDefine.h" + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +struct STableString +{ + A_u_long index; + A_char str[256]; +} ; + +//---------------------------------------------------------------------------- + +STableString g_strs[StrID_NUMTYPES] = +{ + { StrID_NONE, "" }, + { StrID_Name, "Attribute" }, + { StrID_Description, "PopcornFX Plugin." }, + { StrID_Generic_Bool1, "Attribute bool" }, + { StrID_Generic_Bool2, "Attribute bool 2" }, + { StrID_Generic_Bool3, "Attribute bool 3" }, + { StrID_Generic_Bool4, "Attribute bool 4" }, + { StrID_Generic_Int1, "Attribute int" }, + { StrID_Generic_Int2, "Attribute int 2" }, + { StrID_Generic_Int3, "Attribute int 3" }, + { StrID_Generic_Int4, "Attribute int 4" }, + { StrID_Generic_Float1, "Attribute float" }, + { StrID_Generic_Float2, "Attribute float 2" }, + { StrID_Generic_Float3, "Attribute float 3" }, + { StrID_Generic_Float4, "Attribute float 4" }, + { StrID_Generic_Quaternion, "Attribute Quaternion" }, + { StrID_Generic_Infernal_Uuid, "AttributeKey" }, + { StrID_Scale_Checkbox, "Affected by scale" }, + { StrID_Generic_Infernal_Name, "AttributeName" }, + { StrID_Generic_Color_RGB, "RGB" }, + { StrID_Generic_Color_A, "Alpha" }, + { StrID_Parameters_Reset, "" }, + { StrID_Parameters_Reset_Button, "Reset Value" }, +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +//---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" +{ +#endif + +A_char *GetStringPtr(int strNum) +{ + return AAePk::g_strs[strNum].str; +} + +#ifdef __cplusplus +} +#endif + diff --git a/AE_Effect_Attribute/Sources/AEAttribute_PluginInterface.cpp b/AE_Effect_Attribute/Sources/AEAttribute_PluginInterface.cpp new file mode 100644 index 00000000..a6ac028b --- /dev/null +++ b/AE_Effect_Attribute/Sources/AEAttribute_PluginInterface.cpp @@ -0,0 +1,928 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEAttribute_PluginInterface.h" +#include "AEAttribute_SequenceData.h" +#include "AEAttribute_ParamDefine.h" + +#include "PopcornFX_UID.h" + +//AE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//AAE Plugin code +#include +#include + +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +CPluginInterface *CPluginInterface::m_Instance = nullptr; +uint32_t CPluginInterface::m_AttrUID = 1; + +//---------------------------------------------------------------------------- + +CPluginInterface::CPluginInterface() +{ +} + +//---------------------------------------------------------------------------- + +CPluginInterface::~CPluginInterface() +{ + for (auto& it : m_AttributeData) + { + delete(it.second); + } + m_AttributeData.clear(); +} + +//---------------------------------------------------------------------------- + +CPluginInterface &CPluginInterface::Instance() +{ + if (CPluginInterface::m_Instance == nullptr) + { + m_Instance = new CPluginInterface(); + } + return *m_Instance; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::About( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + suites.ANSICallbacksSuite1()->sprintf(AAEData.m_OutData->return_msg, + "%s v%d.%d.%d\r%s", + STR(StrID_Name), + AEPOPCORNFX_MAJOR_VERSION, + AEPOPCORNFX_MINOR_VERSION, + AEPOPCORNFX_BUG_VERSION, + STR(StrID_Description)); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::GlobalSetup( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + m_MainThreadID = std::this_thread::get_id(); + + AEFX_SuiteScoper popcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + AAEData.m_OutData, + "PopcornFX suite was not found."); + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + AAEData.m_OutData->my_version = PF_VERSION( AEPOPCORNFX_MAJOR_VERSION, + AEPOPCORNFX_MINOR_VERSION, + AEPOPCORNFX_BUG_VERSION, + AEPOPCORNFX_STAGE_VERSION, + AEPOPCORNFX_BUILD_VERSION); + + //PF_OutFlag_DEEP_COLOR_AWARE -> To support 16bit per chan format. + //PF_OutFlag_I_AM_OBSOLETE -> Do not show in menu. We do not want user to create this effect manually. + //PF_OutFlag_SEND_UPDATE_PARAMS_UI -> To be notified when PF_ParamFlag_SUPERVISE is set on parameters + AAEData.m_OutData->out_flags = PF_OutFlag_DEEP_COLOR_AWARE | PF_OutFlag_I_AM_OBSOLETE | PF_OutFlag_SEND_UPDATE_PARAMS_UI; + //PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS -> To be able to change dynamicly some out_flags. see doc. + //PF_OutFlag2_FLOAT_COLOR_AWARE -> To support 32bit per chan format. Need PF_OutFlag2_SUPPORTS_SMART_RENDER + //PF_OutFlag2_SUPPORTS_SMART_RENDER -> Necessary for new render pipeline. + //PF_OutFlag2_I_USE_3D_CAMERA -> Can query 3D camera information, Not sure if necessery in Attribute or just on Effect. + AAEData.m_OutData->out_flags2 = PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS | PF_OutFlag2_FLOAT_COLOR_AWARE | PF_OutFlag2_SUPPORTS_SMART_RENDER | PF_OutFlag2_I_USE_3D_CAMERA | + PF_OutFlag2_SUPPORTS_THREADED_RENDERING;// | PF_OutFlag2_MUTABLE_RENDER_SEQUENCE_DATA_SLOWER;; + + suites.UtilitySuite3()->AEGP_RegisterWithAEGP(nullptr, STR(StrID_Name), &m_AAEID); + + return popcornFXSuite->InitializePopcornFXIFN(AAEData); +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::ParamsSetup( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEFX_SuiteScoper popcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + AAEData.m_OutData, + "PopcornFX suite was not found."); + PF_Err result = PF_Err_NONE; + //TMP Used in Macros + PF_InData *in_data = AAEData.m_InData; + PF_ParamDef def; + + m_ParametersIndexes = new int[__Attribute_Parameters_Count]; + for (unsigned int i = 0; i < __Attribute_Parameters_Count; ++i) + m_ParametersIndexes[i] = -1; + m_ParametersIndexes[0] = 0; // First Parameter is reserved to AE + + AddCheckBoxParameter(in_data, STR(StrID_Generic_Bool1), Attribute_Parameters_Bool1); + AddCheckBoxParameter(in_data, STR(StrID_Generic_Bool2), Attribute_Parameters_Bool2); + AddCheckBoxParameter(in_data, STR(StrID_Generic_Bool3), Attribute_Parameters_Bool3); + AddCheckBoxParameter(in_data, STR(StrID_Generic_Bool4), Attribute_Parameters_Bool4); + + AddFloatParameterUnbound(in_data, STR(StrID_Generic_Int1), Attribute_Parameters_Int1, 0.0f, PF_ValueDisplayFlag_NONE | PF_ParamFlag_SUPERVISE | PF_ParamFlag_COLLAPSE_TWIRLY); + AddFloatParameterUnbound(in_data, STR(StrID_Generic_Int2), Attribute_Parameters_Int2, 0.0f, PF_ValueDisplayFlag_NONE | PF_ParamFlag_SUPERVISE | PF_ParamFlag_COLLAPSE_TWIRLY); + AddFloatParameterUnbound(in_data, STR(StrID_Generic_Int3), Attribute_Parameters_Int3, 0.0f, PF_ValueDisplayFlag_NONE | PF_ParamFlag_SUPERVISE | PF_ParamFlag_COLLAPSE_TWIRLY); + AddFloatParameterUnbound(in_data, STR(StrID_Generic_Int4), Attribute_Parameters_Int4, 0.0f, PF_ValueDisplayFlag_NONE | PF_ParamFlag_SUPERVISE | PF_ParamFlag_COLLAPSE_TWIRLY); + + AddFloatParameterUnbound(in_data, STR(StrID_Generic_Float1), Attribute_Parameters_Float1, 0.0f, PF_ValueDisplayFlag_NONE | PF_ParamFlag_SUPERVISE | PF_ParamFlag_COLLAPSE_TWIRLY); + AddFloatParameterUnbound(in_data, STR(StrID_Generic_Float2), Attribute_Parameters_Float2, 0.0f, PF_ValueDisplayFlag_NONE | PF_ParamFlag_SUPERVISE | PF_ParamFlag_COLLAPSE_TWIRLY); + AddFloatParameterUnbound(in_data, STR(StrID_Generic_Float3), Attribute_Parameters_Float3, 0.0f, PF_ValueDisplayFlag_NONE | PF_ParamFlag_SUPERVISE | PF_ParamFlag_COLLAPSE_TWIRLY); + AddFloatParameterUnbound(in_data, STR(StrID_Generic_Float4), Attribute_Parameters_Float4, 0.0f, PF_ValueDisplayFlag_NONE | PF_ParamFlag_SUPERVISE | PF_ParamFlag_COLLAPSE_TWIRLY); + + //To do add Quaternion + //PF_ADD_POINT_3D(STR(StrID_Generic_Quaternion), 50, 50, 0, AttributeType_Quaternion) + + AddCheckBoxParameter(in_data, STR(StrID_Generic_Infernal_Uuid), Attribute_Parameters_Infernal_Uuid, false, 0, PF_PUI_INVISIBLE); + + AddCheckBoxParameter(in_data, STR(StrID_Scale_Checkbox), Attribute_Parameters_AffectedByScale, false, PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + + AddCheckBoxParameter(in_data, STR(StrID_Generic_Infernal_Name), Attribute_Parameters_Infernal_Name, false, 0, PF_PUI_INVISIBLE); + + + AEFX_CLR_STRUCT(def); + PF_ADD_COLOR(STR(StrID_Generic_Color_RGB), + (char)(0.0f), + (char)(0.0f), + (char)(0.0f), + Attribute_Parameters_Color_RGB); + m_ParametersIndexes[Attribute_Parameters_Color_RGB] = ++m_CurrentIndex; + + AddPercentParameter(in_data, STR(StrID_Generic_Color_A), Attribute_Parameters_Color_A, 100); + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(STR(StrID_Parameters_Reset), STR(StrID_Parameters_Reset_Button), 0, PF_ParamFlag_SUPERVISE, Attribute_Parameters_Reset); + m_ParametersIndexes[Attribute_Parameters_Reset] = ++m_CurrentIndex; + + AAEData.m_OutData->num_params = __Attribute_Parameters_Count; + + popcornFXSuite->SetParametersIndexes(m_ParametersIndexes, EPKChildPlugins::ATTRIBUTE); + + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::GlobalSetdown( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + AAEData.m_OutData, + "PopcornFX suite was not found."); + + + if (m_ParametersIndexes != nullptr) + delete[] m_ParametersIndexes; + m_ParametersIndexes = nullptr; + for (auto it = m_AttributeData.begin(); it != m_AttributeData.end(); ++it) + { + if (it->second != nullptr) + { + delete (it->second); + it->second = nullptr; + } + } + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + + A_Err result = A_Err_NONE; + SAttributeSequenceDataFlat *sequenceData = nullptr; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Handle sequenceDataHandle = suites.HandleSuite1()->host_new_handle(sizeof(SAttributeSequenceDataFlat)); + + if (!sequenceDataHandle) + return PF_Err_OUT_OF_MEMORY; + sequenceData = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataHandle)); + if (sequenceData != nullptr) + { + AEFX_CLR_STRUCT(*sequenceData); + + sequenceData->m_IsDefault = true; + sequenceData->m_IsFlat = true; + sequenceData->SetUUID(CUUIDGenerator::Get16().data()); + sequenceData->SetName("AttributeName"); + + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + if (result == A_Err_NONE) + sequenceData->SetLayerID(dstID); + + _RegisterAttributeInstancePlugin(AAEData, params, sequenceData, true); + + AAEData.m_OutData->sequence_data = sequenceDataHandle; + suites.HandleSuite1()->host_unlock_handle(sequenceDataHandle); + } + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceReSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Err result = PF_Err_NONE; + + if (AAEData.m_InData->sequence_data) + { + PF_Handle sequenceDataFlatHandle = AAEData.m_InData->sequence_data; + SAttributeSequenceDataFlat *sequenceDataFlat = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataFlatHandle)); + + if (sequenceDataFlat) + { + _RegisterAttributeInstancePlugin(AAEData, params, sequenceDataFlat, false); + AAEData.m_OutData->sequence_data = sequenceDataFlatHandle; + + suites.HandleSuite1()->host_unlock_handle(sequenceDataFlatHandle); + } + } + else + { + result = SequenceSetup(AAEData, params, output); + } + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceFlatten(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Err result = PF_Err_NONE; + + if (!AAEData.m_InData->sequence_data) + return result; + + PF_Handle sequenceDataHandle = AAEData.m_InData->sequence_data; + SAttributeSequenceDataFlat *sequenceData = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataHandle)); + + if (sequenceData) + { + std::string uuid; + //Check Layer ID to determine if its a duplicate. if so, update LayerID and regenerate UUID + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + if (result == A_Err_NONE) + { + if (sequenceData->m_LayerID != dstID) + { + sequenceData->m_LayerID = dstID; + sequenceData->SetUUID(CUUIDGenerator::Get16().data()); + } + } + _RegisterAttributeInstancePlugin(AAEData, params, sequenceData, false); + + if (GetParamsSequenceUID(AAEData, uuid, m_ParametersIndexes[Attribute_Parameters_Infernal_Uuid]) != A_Err_NONE) + return result; + + if (m_AttributeData.count(uuid) == 0) + return result; + + SAttributeDesc *descriptor = m_AttributeData[uuid]->m_DescAttribute; + + if (descriptor == nullptr) + return result; + + sequenceData->m_IsFlat = true; + sequenceData->SetIsDefaultValue(descriptor->m_IsDefaultValue); + sequenceData->SetName(descriptor->GetAttributePKKey().c_str()); + + AAEData.m_OutData->sequence_data = sequenceDataHandle; + suites.HandleSuite1()->host_unlock_handle(sequenceDataHandle); + } + else + result = PF_Err_INTERNAL_STRUCT_DAMAGED; + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceShutdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + if (AAEData.m_InData->sequence_data != nullptr) + { + PF_Handle sequenceDataHandle = AAEData.m_InData->sequence_data; + suites.HandleSuite1()->host_dispose_handle(sequenceDataHandle); + } + AAEData.m_InData->sequence_data = nullptr; + AAEData.m_OutData->sequence_data = nullptr; + + return PF_Err_NONE; + +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::PreRender(SAAEIOData &AAEData) +{ + PF_RenderRequest req = AAEData.m_ExtraData.m_PreRenderData->input->output_request; + PF_CheckoutResult in_result; + + AE_VERIFY(AAEData.m_ExtraData.m_PreRenderData != nullptr); + AE_VERIFY(AAEData.m_ExtraData.m_PreRenderData->cb != nullptr); + + AAEData.m_ExtraData.m_PreRenderData->cb->checkout_layer(AAEData.m_InData->effect_ref, + ATTRIBUTE_INPUT, + ATTRIBUTE_INPUT, + &req, + AAEData.m_InData->current_time, + AAEData.m_InData->local_time_step, + AAEData.m_InData->time_scale, + &in_result); + + UnionLRect(&in_result.result_rect, &AAEData.m_ExtraData.m_PreRenderData->output->result_rect); + UnionLRect(&in_result.max_result_rect, &AAEData.m_ExtraData.m_PreRenderData->output->max_result_rect); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +void CPluginInterface::UpdateBoolAttribute(SAAEIOData &AAEData, SAttributeDesc *descriptor, bool *uiVisibility) +{ + bool value[4]; + + for (uint32_t i = 0; i < 4; ++i) + { + if (uiVisibility[i + Attribute_Parameters_Bool1]) + { + SAAEScopedParams params{ AAEData, i + Attribute_Parameters_Bool1 }; + + value[i] = params.GetCheckBoxValue(); + } + } + descriptor->SetValue(&value); +} + +//---------------------------------------------------------------------------- + +void CPluginInterface::UpdateIntAttribute(SAAEIOData &AAEData, SAttributeDesc *descriptor, bool *uiVisibility) +{ + int value[4]; + + if (descriptor->m_AttributeSemantic == AttributeSemantic_Color) + { + SAAEScopedParams color{ AAEData, Attribute_Parameters_Color_RGB }; + SAAEScopedParams alpha{ AAEData, Attribute_Parameters_Color_A }; + + A_FloatPoint3 AEColor = color.GetColor(); + + value[0] = (int)AEColor.x * 255; + value[1] = (int)AEColor.y * 255; + value[2] = (int)AEColor.z * 255; + value[3] = (int)alpha.GetPercent() *255; + } + else + { + for (uint32_t i = 0; i < 4; ++i) + { + if (uiVisibility[i + Attribute_Parameters_Int1]) + { + SAAEScopedParams params{ AAEData, i + Attribute_Parameters_Int1 }; + + value[i] = params.GetInt(); + } + } + } + descriptor->SetValue(&value); +} + +//---------------------------------------------------------------------------- + +void CPluginInterface::UpdateFloatAttribute(SAAEIOData &AAEData, SAttributeDesc *descriptor, bool *uiVisibility) +{ + float value[4]; + + if (descriptor->m_AttributeSemantic == AttributeSemantic_Color) + { + SAAEScopedParams color{ AAEData, Attribute_Parameters_Color_RGB }; + SAAEScopedParams alpha{ AAEData, Attribute_Parameters_Color_A }; + + A_FloatPoint3 AEColor = color.GetColor(); + + value[0] = (float)AEColor.x; + value[1] = (float)AEColor.y; + value[2] = (float)AEColor.z; + value[3] = alpha.GetPercent(); + } + else + { + for (uint32_t i = 0; i < 4; ++i) + { + if (uiVisibility[i + Attribute_Parameters_Float1]) + { + SAAEScopedParams params{ AAEData, i + Attribute_Parameters_Float1 }; + value[i] = params.GetFloat(); + } + } + } + descriptor->SetValue(&value); +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SmartRender(SAAEIOData &AAEData) +{ + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_EffectWorld *inputWorld = nullptr; + PF_EffectWorld *outputWorld = nullptr; + PF_Err err = PF_Err_NONE; + + std::string uuid; + + AAEData.m_ExtraData.m_SmartRenderData->cb->checkout_layer_pixels(AAEData.m_InData->effect_ref, ATTRIBUTE_INPUT, &inputWorld); + AAEData.m_ExtraData.m_SmartRenderData->cb->checkout_output(AAEData.m_InData->effect_ref, &outputWorld); + + if (inputWorld == nullptr || outputWorld == nullptr) + return PF_Err_BAD_CALLBACK_PARAM; + outputWorld->data = inputWorld->data; + + if (GetParamsSequenceUID(AAEData, uuid, m_ParametersIndexes[Attribute_Parameters_Infernal_Uuid]) != PF_Err_NONE) + return PF_Err_BAD_CALLBACK_PARAM; + if ( m_AttributeData.count(uuid) == 0) + return err; + + SAttributeDesc *descriptor = m_AttributeData[uuid]->m_DescAttribute; + bool *uiVisibility = m_AttributeData[uuid]->m_UIVisibility; + + if (descriptor != nullptr) + { + switch (descriptor->m_Type) + { + case Attribute_Parameters_Bool1: + case Attribute_Parameters_Bool2: + case Attribute_Parameters_Bool3: + case Attribute_Parameters_Bool4: + UpdateBoolAttribute(AAEData, descriptor, uiVisibility); + break; + case Attribute_Parameters_Int1: + case Attribute_Parameters_Int2: + case Attribute_Parameters_Int3: + case Attribute_Parameters_Int4: + UpdateIntAttribute(AAEData, descriptor, uiVisibility); + break; + case Attribute_Parameters_Float1: + case Attribute_Parameters_Float2: + case Attribute_Parameters_Float3: + case Attribute_Parameters_Float4: + UpdateFloatAttribute(AAEData, descriptor, uiVisibility); + break; + } + { + SAAEScopedParams affectedByScale{ AAEData, Attribute_Parameters_AffectedByScale }; + + descriptor->m_IsAffectedByScale = affectedByScale.GetCheckBoxValue(); + } + } + + AAEData.m_ExtraData.m_SmartRenderData->cb->checkin_layer_pixels(AAEData.m_InData->effect_ref, ATTRIBUTE_INPUT); + + return err; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::UpdateParams(SAAEIOData &AAEData, PF_ParamDef *params[]) +{ + (void)AAEData; + (void)params; + + PF_Err result = PF_Err_NONE; +#if 1 + std::string uuid; + + if (GetParamsSequenceUID(AAEData, uuid, m_ParametersIndexes[Attribute_Parameters_Infernal_Uuid]) != A_Err_NONE) + return PF_Err_BAD_CALLBACK_PARAM; + if (m_AttributeData.count(uuid) == 0) + return result; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + SAttributeDesc *descriptor = m_AttributeData[uuid]->m_DescAttribute; + + if (descriptor == nullptr) + return result; + + if (descriptor != nullptr) + { + if (AAEData.m_ExtraData.m_ChangeParamData->param_index == m_ParametersIndexes[Attribute_Parameters_Reset]) + { + descriptor->ResetValues(); + m_AttributeData[uuid]->m_IsDefault = true; + SetDefaultValueIFN(AAEData, params, m_AttributeData[uuid]); + } + } +#endif + return result; +} + +//---------------------------------------------------------------------------- + +bool CPluginInterface::_GetAttributeSequenceUID(SAAEIOData &AAEData, std::string &out) +{ + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEFX_SuiteScoper seqdata_suite = AEFX_SuiteScoper(AAEData.m_InData, kPFEffectSequenceDataSuite, kPFEffectSequenceDataSuiteVersion1, AAEData.m_OutData); + PF_ConstHandle constSeq; + seqdata_suite->PF_GetConstSequenceData(AAEData.m_InData->effect_ref, &constSeq); + + const SAttributeSequenceDataFlat *sequenceDataFlat = static_cast(suites.HandleSuite1()->host_lock_handle((PF_Handle)constSeq)); + + out.clear(); + if (sequenceDataFlat && sequenceDataFlat->m_IsFlat == true) + { + out.append(sequenceDataFlat->m_AttributeUUID, strlen(sequenceDataFlat->m_AttributeUUID)); + suites.HandleSuite1()->host_unlock_handle((PF_Handle)constSeq); + return true; + } + if (sequenceDataFlat) + suites.HandleSuite1()->host_unlock_handle((PF_Handle)constSeq); + return false; +} + +//---------------------------------------------------------------------------- + +bool Debug_IsInterfaceRelevant(EAttributeParameterType current, EAttributeType attribute, EAttributeSemantic semantic) +{ + if (semantic == AttributeSemantic_Color) + { + if (current == Attribute_Parameters_Color_RGB) + return true; + else if (current == Attribute_Parameters_Color_A && + (attribute == AttributeType_Int4 || attribute == AttributeType_Float4)) + return true; + else + return false; + } + if (attribute >= AttributeType_Bool1 && attribute <= AttributeType_Bool4) + { + return (current >= AttributeType_Bool1 && current <= attribute); + } + if (attribute >= AttributeType_Int1 && attribute <= AttributeType_Int4) + { + return (current >= AttributeType_Int1 && current <= attribute); + } + if (attribute >= AttributeType_Float1 && attribute <= AttributeType_Float4) + { + return (current >= AttributeType_Float1 && current <= attribute); + } + return false; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SetDefaultValueIFN(SAAEIOData &AAEData, PF_ParamDef *params[], SAttributeData *AttrData) +{ + (void)params; + + PF_Err err = PF_Err_NONE; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEGP_StreamRefH streamRef = nullptr; + AEGP_EffectRefH effectRef = nullptr; + bool *uiVisibility = AttrData->m_UIVisibility; + SAttributeDesc *desc = AttrData->m_DescAttribute; + + err = suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + if (!AE_VERIFY(err == A_Err_NONE)) + return err; + + for (int i = 1; i < __Attribute_Parameters_Count; ++i) // Start at 1, first params is reserved. + { + if (i == Attribute_Parameters_Infernal_Uuid || + i == Attribute_Parameters_AffectedByScale || + i == Attribute_Parameters_Infernal_Name || + i == Attribute_Parameters_Reset) + continue; + err |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AAEID, effectRef, m_ParametersIndexes[i], &streamRef); + if (!AE_VERIFY(err == A_Err_NONE)) + return err; + + if (Debug_IsInterfaceRelevant((EAttributeParameterType)i, desc->m_Type, desc->m_AttributeSemantic) == false) // Disable + { + uiVisibility[i] = false; + } + else // Enable and Update name + { + uiVisibility[i] = true; + } + // Toggle visibility of parameter + err |= suites.DynamicStreamSuite2()->AEGP_SetDynamicStreamFlag(streamRef, AEGP_DynStreamFlag_HIDDEN, FALSE, !uiVisibility[i]); + + // Set Default Value + if (uiVisibility[i] && AttrData->m_IsDefault) + { + AEGP_StreamValue streamValue; + if (i < __AttributeType_Count) + { + AttrData->m_DescAttribute->GetValueAsStreamValue((EAttributeType)i, &streamValue); + err |= suites.StreamSuite2()->AEGP_SetStreamValue(m_AAEID, streamRef, &streamValue); + } + else if (desc->m_AttributeSemantic == AttributeSemantic_Color) + { + float color[4]; + float mult = 1.0f; + + if (desc->m_Type >= AttributeType_Int1 && desc->m_Type <= AttributeType_Int4) + mult = 255.0f; + + AttrData->m_DescAttribute->GetValue(color); + if (i == Attribute_Parameters_Color_RGB) + { + streamValue.val.color.redF = color[0] / mult; + streamValue.val.color.greenF = color[1] / mult; + streamValue.val.color.blueF = color[2] / mult; + err |= suites.StreamSuite2()->AEGP_SetStreamValue(m_AAEID, streamRef, &streamValue); + } + else if (i == Attribute_Parameters_Color_A) + { + streamValue.val.one_d = color[3] * 100.0f / mult; + err |= suites.StreamSuite2()->AEGP_SetStreamValue(m_AAEID, streamRef, &streamValue); + } + } + } + + err |= suites.StreamSuite2()->AEGP_DisposeStream(streamRef); + streamRef = nullptr; + } + AAEData.m_OutData->out_flags |= PF_OutFlag_REFRESH_UI; + err |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + + if (!AE_VERIFY(err == A_Err_NONE)) + return err; + return err; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::HandleDataFromAEGP(SAAEIOData &AAEData, + PF_ParamDef *params[]) +{ + PF_Err err = PF_Err_NONE; + void *extraData = AAEData.m_ExtraData.m_UndefinedData; + SAttributeDesc *desc = reinterpret_cast(extraData); + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + if (desc != nullptr) + { + if (desc->m_IsDeleted) + { + std::string uuid; + + if (_GetAttributeSequenceUID(AAEData, uuid) == false) + { + AE_VERIFY(false); + return PF_Err_BAD_CALLBACK_PARAM; + } + if (m_AttributeData.count(uuid) == 0) + return PF_Err_BAD_CALLBACK_PARAM; + + SAttributeData *AttrData = m_AttributeData[uuid]; + + if (AttrData) + { + m_AttributeData.erase(uuid); + + AttrData->m_DescAttribute = nullptr; + delete desc; + delete AttrData; + return PF_Err_NONE; + } + } + else + { + m_AttrUID += 1; + + std::string pkKey; + std::string uuid; + SAttributeData *AttrData = nullptr; + + if (_GetAttributeSequenceUID(AAEData, uuid) == false) + { + AE_VERIFY(false); + return PF_Err_BAD_CALLBACK_PARAM; + } + if (m_AttributeData.count(uuid) == 0) + { + AttrData = new SAttributeData{}; + } + AttrData = m_AttributeData[uuid]; + AttrData->m_DescAttribute = desc; + + pkKey = AttrData->m_DescAttribute->GetAttributePKKey(); + + AttrData->m_DescAttribute->m_IsDefaultValue = AttrData->m_IsDefault; + + err |= SetDefaultValueIFN(AAEData, params, AttrData); + + AEGP_EffectRefH effectRef = nullptr; + + err = suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + if (!AE_VERIFY(err == A_Err_NONE)) + return err; + + err |= SetEffectName(AAEData, pkKey, effectRef); + err |= SetParameterStreamName(AAEData, uuid, m_ParametersIndexes[Attribute_Parameters_Infernal_Uuid] , effectRef); + err |= SetParameterStreamName(AAEData, pkKey, m_ParametersIndexes[Attribute_Parameters_Infernal_Name], effectRef); + + params[m_ParametersIndexes[Attribute_Parameters_Infernal_Name]]->ui_flags |= PF_PUI_INVISIBLE; + params[m_ParametersIndexes[Attribute_Parameters_Infernal_Name]]->ui_flags |= PF_PUI_DISABLED; + + err |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + + AAEData.m_OutData->out_flags |= PF_OutFlag_REFRESH_UI; + effectRef = nullptr; + } + } + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER; + AE_VERIFY(err == A_Err_NONE); + return err; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::UpdateParamsUI(SAAEIOData &AAEData, PF_ParamDef *params[]) +{ + std::string uuid; + + if (GetParamsSequenceUID(AAEData, uuid, m_ParametersIndexes[Attribute_Parameters_Infernal_Uuid]) != A_Err_NONE) + return PF_Err_BAD_CALLBACK_PARAM; + if (m_AttributeData.count(uuid) == 0) + return A_Err_NONE; + + PF_Err err = PF_Err_NONE; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + SAttributeDesc *descriptor = m_AttributeData[uuid]->m_DescAttribute; + bool *uiVisibility = m_AttributeData[uuid]->m_UIVisibility; + + if (descriptor == nullptr) + return PF_Err_NONE; + + if (descriptor != nullptr && descriptor->m_IsDeleted) + { + m_AttributeData.erase(uuid); + delete descriptor; + return PF_Err_NONE; + } + PF_ParamDef paramCopy[__Attribute_Parameters_Count]; + + MakeParamCopy(params, paramCopy, __Attribute_Parameters_Count); + for (int i = 1; i < __Attribute_Parameters_Count; ++i) // Start at 1, first params is reserved. + { + if (i == Attribute_Parameters_Infernal_Uuid || + i == Attribute_Parameters_AffectedByScale || + i == Attribute_Parameters_Infernal_Name) + continue; + if (uiVisibility[i] == false) // Disable + { + paramCopy[m_ParametersIndexes[i]].ui_flags |= PF_PUI_DISABLED; + } + else // Enable + { + if ((paramCopy[m_ParametersIndexes[i]].ui_flags & PF_PUI_DISABLED) != 0) + { + paramCopy[m_ParametersIndexes[i]].ui_flags &= ~PF_PUI_DISABLED; + } + //Should set min and max value. + if (paramCopy[m_ParametersIndexes[i]].param_type == PF_Param_FLOAT_SLIDER) + { + float value; + descriptor->GetDefaultValueByType((EAttributeType)i, &value); + paramCopy[m_ParametersIndexes[i]].u.fs_d.dephault = static_cast(value); + + if (descriptor->m_HasMax || descriptor->m_HasMin) + { + if (descriptor->m_HasMin) + { + descriptor->GetMinValueByType((EAttributeType)i, &value); + paramCopy[m_ParametersIndexes[i]].u.fs_d.slider_min = static_cast(value); + } + if (descriptor->m_HasMax) + { + descriptor->GetMaxValueByType((EAttributeType)i, &value); + paramCopy[m_ParametersIndexes[i]].u.fs_d.slider_max = static_cast(value); + } + if ((paramCopy[m_ParametersIndexes[i]].flags & PF_ParamFlag_COLLAPSE_TWIRLY) != 0) + paramCopy[m_ParametersIndexes[i]].flags &= ~PF_ParamFlag_COLLAPSE_TWIRLY; + } + else + { + paramCopy[m_ParametersIndexes[i]].flags |= PF_ParamFlag_COLLAPSE_TWIRLY; + } + + paramCopy[m_ParametersIndexes[i]].uu.change_flags = PF_ChangeFlag_CHANGED_VALUE; + } + } + //Apply Change on param + err |= suites.ParamUtilsSuite3()->PF_UpdateParamUI(AAEData.m_InData->effect_ref, m_ParametersIndexes[i], ¶mCopy[m_ParametersIndexes[i]]); + } + AE_VERIFY(err == A_Err_NONE); + return err; +} + +//---------------------------------------------------------------------------- + +A_Err CPluginInterface::_RegisterAttributeInstancePlugin(SAAEIOData &AAEData, PF_ParamDef *params[], SAttributeSequenceDataFlat *sequenceData, bool setup) +{ + (void)params; + + PF_Err err = PF_Err_NONE; + std::string id; + + if (sequenceData != nullptr) + id = sequenceData->m_AttributeUUID; + else if (_GetAttributeSequenceUID(AAEData, id) == false) + return A_Err_NONE; + + if (m_AttributeData.count(id) == 0) + { + SAttributeData *AttrData = new SAttributeData{}; + + if (!AE_VERIFY(AttrData != nullptr)) + return A_Err_ALLOC; + + if (!setup) + { + if (m_MainThreadID == std::this_thread::get_id()) + { + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEGP_EffectRefH effectRef = nullptr; + + err |= suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + + std::string uuid(sequenceData->m_AttributeUUID); + std::string name(sequenceData->m_AttributeName); + err |= SetParameterStreamName(AAEData, uuid, m_ParametersIndexes[Attribute_Parameters_Infernal_Uuid], effectRef); + err |= SetParameterStreamName(AAEData, name, m_ParametersIndexes[Attribute_Parameters_Infernal_Name], effectRef); + err |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + } + m_AttributeData[id] = AttrData; + } + if (sequenceData != nullptr) + { + m_AttributeData[id]->m_IsDefault = sequenceData->m_IsDefault; + } + return A_Err_NONE;; +} + +//---------------------------------------------------------------------------- + +__AAEPK_END diff --git a/AE_Effect_Attribute/Sources/AEAttribute_SequenceData.cpp b/AE_Effect_Attribute/Sources/AEAttribute_SequenceData.cpp new file mode 100644 index 00000000..3007a780 --- /dev/null +++ b/AE_Effect_Attribute/Sources/AEAttribute_SequenceData.cpp @@ -0,0 +1,59 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEAttribute_SequenceData.h" + +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +void SAttributeSequenceDataFlat::CopyFrom(SAttributeSequenceDataFlat *src) +{ + m_IsFlat = true; + SetUUID(src->m_AttributeUUID); + SetName(src->m_AttributeName); + SetIsDefaultValue(src->m_IsDefault); +} + +//---------------------------------------------------------------------------- + +void SAttributeSequenceDataFlat::SetIsDefaultValue(bool value) +{ + m_IsDefault = value; +} + +//---------------------------------------------------------------------------- + +bool SAttributeSequenceDataFlat::SetUUID(const char *uuid) +{ + m_AttributeUUIDLen = strlen(uuid) + 1; + + strncpy(m_AttributeUUID, uuid, SequenceCST::UUID_LEN); + return true; +} + +//---------------------------------------------------------------------------- + +bool SAttributeSequenceDataFlat::SetName(const char *name) +{ + m_AttributeNameLen = strlen(name) + 1; + + strncpy(m_AttributeName, name, SequenceCST::MAX_NAME_LEN); + return true; +} + +//---------------------------------------------------------------------------- + +bool SAttributeSequenceDataFlat::SetLayerID(bool value) +{ + m_LayerID = value; + return true; +} + +//---------------------------------------------------------------------------- +__AAEPK_END diff --git a/AE_Effect_Attribute/Sources/AE_Effect_Attribute.plugin-Info.plist b/AE_Effect_Attribute/Sources/AE_Effect_Attribute.plugin-Info.plist new file mode 100644 index 00000000..3299ec2f --- /dev/null +++ b/AE_Effect_Attribute/Sources/AE_Effect_Attribute.plugin-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleExecutable + Attribute + CFBundleIdentifier + com.PersistantStudio.PopcornFX.Attribute + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + AE_Effect_Attribute + CFBundlePackageType + eFKT + CFBundleSignature + FXTC + LSRequiresCarbon + + NSAppleScriptEnabled + No + NSHumanReadableCopyright + © PersistantStudio PopcornFX + + diff --git a/AE_Effect_Attribute/Sources/AE_Effect_Attribute_PiPL.r b/AE_Effect_Attribute/Sources/AE_Effect_Attribute_PiPL.r new file mode 100644 index 00000000..0fe45ea0 --- /dev/null +++ b/AE_Effect_Attribute/Sources/AE_Effect_Attribute_PiPL.r @@ -0,0 +1,73 @@ +#include "AEConfig.h" +#include "AE_EffectVers.h" + +#ifndef AE_OS_WIN + #include +#endif + + +#ifdef AE_OS_WIN +#include "../../AE_Suites/PopcornFX_Define_Version.h" +#endif +#ifdef AE_OS_MAC +#include "PopcornFX_Define_Version.h" +#endif + +resource 'PiPL' (16000) { + { /* array properties: 12 elements */ + /* [1] */ + Kind { + AEEffect + }, + /* [2] */ + Name { + "Attribute" + }, + /* [3] */ + Category { + "PopcornFX" + }, +#ifdef AE_OS_WIN + #ifdef AE_PROC_INTELx64 + CodeWin64X86 {"EffectMain"}, + #endif +#else + #ifdef AE_OS_MAC + CodeMacIntel64 {"EffectMain"}, + #endif +#endif + /* [6] */ + AE_PiPL_Version { + 2, + 0 + }, + /* [7] */ + AE_Effect_Spec_Version { + PF_PLUG_IN_VERSION, + PF_PLUG_IN_SUBVERS + }, + /* [8] */ + AE_Effect_Version { + AEPOPCORNFX_PIPL_VERSION + }, + /* [9] */ + AE_Effect_Info_Flags { + 0 + }, + /* [10] */ + AE_Effect_Global_OutFlags { + 0x06200000 + }, + AE_Effect_Global_OutFlags_2 { + 0x08001403 + }, + /* [11] */ + AE_Effect_Match_Name { + "ADBE PopcornFX Attribute" + }, + /* [12] */ + AE_Reserved_Info { + 8 + } + } +}; diff --git a/AE_Effect_AttributeSampler/Include/AEAttributeSampler_Main.h b/AE_Effect_AttributeSampler/Include/AEAttributeSampler_Main.h new file mode 100644 index 00000000..48128c83 --- /dev/null +++ b/AE_Effect_AttributeSampler/Include/AEAttributeSampler_Main.h @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AEATTRIBUTESAMPLER_MAIN_H__ +#define __FX_AEATTRIBUTESAMPLER_MAIN_H__ + +#include + +#ifdef AE_OS_WIN + typedef unsigned short PixelType; + #include +#endif + +#include +#include + +#include "PopcornFX_Define.h" + +//---------------------------------------------------------------------------- + +extern "C" { + DllExport + PF_Err + EffectMain( + PF_Cmd cmd, + PF_InData *in_data, + PF_OutData *out_data, + PF_ParamDef *params[], + PF_LayerDef *output, + void *extra); + +} + +//---------------------------------------------------------------------------- + +#endif + diff --git a/AE_Effect_AttributeSampler/Include/AEAttributeSampler_ParamDefine.h b/AE_Effect_AttributeSampler/Include/AEAttributeSampler_ParamDefine.h new file mode 100644 index 00000000..f47ca41b --- /dev/null +++ b/AE_Effect_AttributeSampler/Include/AEAttributeSampler_ParamDefine.h @@ -0,0 +1,105 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AEATTRIBUTESAMPLER_PARAM_DEFINE_H__ +#define __FX_AEATTRIBUTESAMPLER_PARAM_DEFINE_H__ + +#include +#include + +#include + +__AAEPK_BEGIN + + +//---------------------------------------------------------------------------- + +enum EPKParams +{ + ATTRIBUTESAMPLER_INPUT = 0, + ATTRIBUTESAMPLER_PARAM, + ATTRIBUTESAMPLER_NUM_PARAMS +}; + +//---------------------------------------------------------------------------- + +enum EStrIDType +{ + StrID_NONE = 0, + StrID_Name, + StrID_Description, + StrID_Generic_Infernal_Uuid, + StrID_Generic_Infernal_Name, + StrID_Parameters_Shapes, + StrID_Parameters_Shapes_Combobox, + + StrID_Topic_Shape_Start, + + StrID_Topic_Shape_Box_Start, + StrID_Parameters_Box_Size_X, + StrID_Parameters_Box_Size_Y, + StrID_Parameters_Box_Size_Z, + + StrID_Topic_Shape_Sphere_Start, + StrID_Parameters_Sphere_Radius, + StrID_Parameters_Sphere_InnerRadius, + + StrID_Topic_Shape_Ellipsoid_Start, + StrID_Parameters_Ellipsoid_Radius, + StrID_Parameters_Ellipsoid_InnerRadius, + + StrID_Topic_Shape_Cylinder_Start, + StrID_Parameters_Cylinder_Radius, + StrID_Parameters_Cylinder_Height, + StrID_Parameters_Cylinder_InnerRadius, + + StrID_Topic_Shape_Capsule_Start, + StrID_Parameters_Capsule_Radius, + StrID_Parameters_Capsule_Height, + StrID_Parameters_Capsule_InnerRadius, + + StrID_Topic_Shape_Cone_Start, + StrID_Parameters_Cone_Radius, + StrID_Parameters_Cone_Height, + + StrID_Topic_Shape_Mesh_Start, + StrID_Parameters_Mesh_Scale, + + StrID_Parameters_Mesh_Path, + StrID_Parameters_Mesh_Path_Button, + + StrID_Parameters_Mesh_Bind_Backdrop, + StrID_Parameters_Mesh_Bind_Backdrop_Weight_Enabled, + StrID_Parameters_Mesh_Bind_Backdrop_ColorStreamID, + StrID_Parameters_Mesh_Bind_Backdrop_WeightStreamID, + + StrID_Parameters_Layer_Pick, + + StrID_Parameters_Layer_Sample_Once, + StrID_Parameters_Layer_Sample_Seeking, + + StrID_Parameters_VectorField_Path, + StrID_Parameters_VectorField_Path_Button, + StrID_Parameters_VectorField_Strength, + StrID_Parameters_VectorField_Position, + StrID_Parameters_VectorField_Interpolation, + StrID_Parameters_VectorField_Interpolation_Combobox, + + StrID_Parameters_Layer_Sample_Downsampling_X, + StrID_Parameters_Layer_Sample_Downsampling_Y, + + StrID_NUMTYPES +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +//---------------------------------------------------------------------------- + +bool GetParamsVisibility(int num, AAePk::EAttributeSamplerType type); + +#endif + diff --git a/AE_Effect_AttributeSampler/Include/AEAttributeSampler_PluginInterface.h b/AE_Effect_AttributeSampler/Include/AEAttributeSampler_PluginInterface.h new file mode 100644 index 00000000..9e330073 --- /dev/null +++ b/AE_Effect_AttributeSampler/Include/AEAttributeSampler_PluginInterface.h @@ -0,0 +1,107 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + + +#ifndef __FX_AEATTRIBUTESAMPLER_PLUGIN_INTERFACE_H__ +#define __FX_AEATTRIBUTESAMPLER_PLUGIN_INTERFACE_H__ + + +#include "PopcornFX_Define.h" +#include "PopcornFX_BasePluginInterface.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +struct SAAEIOData; +struct SAttributeSamplerDesc; +struct SAttributeSamplerSequenceDataFlat; + +//---------------------------------------------------------------------------- + +class CPluginInterface : public CBasePluginInterface +{ + struct SAttributeSamplerData + { + //Memory Owned by effect + SAttributeSamplerDesc *m_DescAttribute; + + std::string m_ResourcePath; + bool m_IsDefault; + + SAttributeSamplerData() + : m_DescAttribute(nullptr) + , m_ResourcePath("") + , m_IsDefault(true) + { + } + ~SAttributeSamplerData() + { + m_DescAttribute = nullptr; + } + }; +public: + ~CPluginInterface(); + static CPluginInterface &Instance(); + + PF_Err About(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err GlobalSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err ParamsSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err GlobalSetdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + + PF_Err SequenceSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceReSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceFlatten(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceShutdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + + PF_Err PreRender(SAAEIOData &AAEData); + PF_Err SmartRender(SAAEIOData &AAEData); + PF_Err UpdateParams(SAAEIOData &AAEData, PF_ParamDef *params[]); + PF_Err UpdateParamsUI(SAAEIOData &AAEData, PF_ParamDef *params[]); + + PF_Err HandleDataFromAEGP(SAAEIOData &AAEData, PF_ParamDef *params[]); + +private: + CPluginInterface(); + + PF_Err _UpdateParamsVisibility(SAAEIOData &AAEData, SAttributeSamplerData *AttrData); + + bool _GetAttributeSequenceUID(SAAEIOData &AAEData, std::string &out); + + PF_Err _RegisterAttributeInstancePlugin(SAAEIOData &AAEData, PF_ParamDef *params[], SAttributeSamplerSequenceDataFlat *sequenceData, bool setup); + + + void UpdateSamplerGeometry(SAAEIOData &AAEData, SAttributeSamplerDesc *descriptor); + void UpdateSamplerText(SAAEIOData &AAEData, SAttributeSamplerDesc *descriptor); + void UpdateSamplerImage(SAAEIOData &AAEData, SAttributeSamplerDesc *descriptor); + void UpdateSamplerVectorField(SAAEIOData &AAEData, SAttributeSamplerDesc *descriptor); + + static CPluginInterface *m_Instance; + static uint32_t m_AttrUID; + + std::unordered_map m_AttributeData; + + std::thread::id m_MainThreadID; +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#endif diff --git a/AE_Effect_AttributeSampler/Include/AEAttributeSampler_SequenceData.h b/AE_Effect_AttributeSampler/Include/AEAttributeSampler_SequenceData.h new file mode 100644 index 00000000..7ad1dde2 --- /dev/null +++ b/AE_Effect_AttributeSampler/Include/AEAttributeSampler_SequenceData.h @@ -0,0 +1,52 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEATTRIBUTESAMPLER_SEQUENCEDATA_H__ +#define __AEATTRIBUTESAMPLER_SEQUENCEDATA_H__ + +#include +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +namespace SequenceCST +{ + static const size_t MAX_PATH_LEN = 4096; + static const size_t MAX_NAME_LEN = 100; + static const size_t UUID_LEN = 64; +} + +//---------------------------------------------------------------------------- + +struct SAttributeSamplerSequenceDataFlat +{ + bool m_IsFlat = true; + + char m_AttributeUUID[SequenceCST::UUID_LEN]; + size_t m_AttributeUUIDLen; + + char m_AttributeName[SequenceCST::MAX_NAME_LEN]; + size_t m_AttributeNameLen; + + char m_ResourcePath[SequenceCST::MAX_PATH_LEN]; + size_t m_ResourcePathLen; + + A_long m_LayerID; + + bool SetUUID(const char *uuid); + bool SetName(const char *name); + bool SetResourcePath(const char * path); + bool SetLayerID(A_long id); +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#endif // !__AAEFFECT_SEQUENCEDATA_H__ + diff --git a/AE_Effect_AttributeSampler/PkgInfo b/AE_Effect_AttributeSampler/PkgInfo new file mode 100644 index 00000000..31cf1f41 --- /dev/null +++ b/AE_Effect_AttributeSampler/PkgInfo @@ -0,0 +1 @@ +eFKTFXTC \ No newline at end of file diff --git a/AE_Effect_AttributeSampler/Precompiled/ae_precompiled.cpp b/AE_Effect_AttributeSampler/Precompiled/ae_precompiled.cpp new file mode 100644 index 00000000..84e52276 --- /dev/null +++ b/AE_Effect_AttributeSampler/Precompiled/ae_precompiled.cpp @@ -0,0 +1 @@ +#include "ae_precompiled.h" diff --git a/AE_Effect_AttributeSampler/Precompiled/ae_precompiled.h b/AE_Effect_AttributeSampler/Precompiled/ae_precompiled.h new file mode 100644 index 00000000..ee643f3d --- /dev/null +++ b/AE_Effect_AttributeSampler/Precompiled/ae_precompiled.h @@ -0,0 +1,8 @@ +#pragma once + +#undef PV_MODULE_NAME +#undef PV_MODULE_SYM +#define PV_MODULE_NAME "AEPlugin" +#define PV_MODULE_SYM AEPlugin + +#include diff --git a/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_Main.cpp b/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_Main.cpp new file mode 100644 index 00000000..b4bdd532 --- /dev/null +++ b/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_Main.cpp @@ -0,0 +1,170 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEAttributeSampler_Main.h" + +#include "AEAttributeSampler_PluginInterface.h" +#include "PopcornFX_Suite.h" + +#include + +#include + +//---------------------------------------------------------------------------- + +extern "C" +{ + DllExport PF_Err PluginDataEntryFunction( PF_PluginDataPtr inPtr, + PF_PluginDataCB inPluginDataCallBackPtr, + SPBasicSuite *inSPBasicSuitePtr, + const char *inHostName, + const char *inHostVersion) + { + (void)inSPBasicSuitePtr; + (void)inHostName; + (void)inHostVersion; + + PF_Err result = PF_Err_INVALID_CALLBACK; + + result = PF_REGISTER_EFFECT( + inPtr, // Infos must match the PopcornFXPiPL.r + inPluginDataCallBackPtr, // + "Attribute Sampler", // Name + "ADBE PopcornFX Sampler", // Match Name + "PopcornFX", // Category + AE_RESERVED_INFO); // Reserved Info + return result; + } +} + +//---------------------------------------------------------------------------- + +PF_Err EffectMain( PF_Cmd cmd, + PF_InData *in_data, + PF_OutData *out_data, + PF_ParamDef *params[], + PF_LayerDef *output, + void *extra) +{ + PF_Err result = PF_Err_NONE; + AAePk::CPluginInterface &AEPlugin = AAePk::CPluginInterface::Instance(); + AAePk::SAAEIOData AAEData{ cmd, in_data, out_data, extra, AEPlugin.GetParametersIndexes() }; + +#if _DEBUG + try + { +#endif + + assert(in_data != nullptr); + assert(out_data != nullptr); + if (in_data == nullptr) + return PF_Err_BAD_CALLBACK_PARAM; + + if (AAEData.m_InData->appl_id == 'PrMr') + { + //User Tried to load plugin in Premiere Pro. + //There is surely a better way to handle this. + return PF_Err_UNRECOGNIZED_PARAM_TYPE; + } + + switch (cmd) + { + // Called once + case PF_Cmd_ABOUT: + //Mandatory + //Version and General Infos about the plugin + result = AEPlugin.About(AAEData, params, output); + break; + case PF_Cmd_GLOBAL_SETUP: + //Mandatory + //Startup run + result = AEPlugin.GlobalSetup(AAEData, params, output); + break; + case PF_Cmd_PARAMS_SETUP: + //Mandatory + //Setup AAE UI. + result = AEPlugin.ParamsSetup(AAEData, params, output); + break; + case PF_Cmd_GLOBAL_SETDOWN: + //Mandatory + result = AEPlugin.GlobalSetdown(AAEData, params, output); + break; + // Sequence Handling + //UI thread + case PF_Cmd_SEQUENCE_SETUP: + //Each time the user adds the effect to a layer + result = AEPlugin.SequenceSetup(AAEData, params, output); + break; + case PF_Cmd_SEQUENCE_RESETUP: + //Load or Duplicate + result = AEPlugin.SequenceReSetup(AAEData, params, output); + break; + //UI thread + case PF_Cmd_SEQUENCE_FLATTEN: + //Effect Saved, copied, duplicated.. + result = AEPlugin.SequenceFlatten(AAEData, params, output); + break; + case PF_Cmd_SEQUENCE_SETDOWN: + //Effect Deleted + result = AEPlugin.SequenceShutdown(AAEData, params, output); + break; + case PF_Cmd_GET_FLATTENED_SEQUENCE_DATA: + break; + // Called each Frame + case PF_Cmd_AUDIO_SETUP: + case PF_Cmd_AUDIO_RENDER: + case PF_Cmd_AUDIO_SETDOWN: + break; + case PF_Cmd_FRAME_SETUP: + //Allow resizing of drawing area + break; + case PF_Cmd_SMART_PRE_RENDER: + result = AEPlugin.PreRender(AAEData); + //Can be called several times for one render + break; + case PF_Cmd_SMART_RENDER: + result = AEPlugin.SmartRender(AAEData); + break; + case PF_Cmd_FRAME_SETDOWN: + //Allow resizing of drawing area + break; + // Messaging + case PF_Cmd_EVENT: + break; + case PF_Cmd_USER_CHANGED_PARAM: + AEPlugin.UpdateParams(AAEData, params); + //If PF_ParamFlag_SUPERVIZE if set when adding param, PF_Cmd_USER_CHANGED_PARAM is called when value change + break; + case PF_Cmd_UPDATE_PARAMS_UI: + result = AEPlugin.UpdateParamsUI(AAEData, params); + break; + case PF_Cmd_ARBITRARY_CALLBACK: + case PF_Cmd_GET_EXTERNAL_DEPENDENCIES: + break; + case PF_Cmd_COMPLETELY_GENERAL: + result = AEPlugin.HandleDataFromAEGP(AAEData, params); + break; + case PF_Cmd_DO_DIALOG: + //Send when user click on Options + //Received if PF_OutFlag_I_DO_DIALOG is set in PF_Cmd_GLOBAL_SETUP + break; + case PF_Cmd_QUERY_DYNAMIC_FLAGS: + break; + default: + break; + } + +#if _DEBUG + } + catch (...) + { + assert(false); + } +#endif + return result; +} + +//---------------------------------------------------------------------------- + diff --git a/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_ParamDefine.cpp b/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_ParamDefine.cpp new file mode 100644 index 00000000..2c3b9e3f --- /dev/null +++ b/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_ParamDefine.cpp @@ -0,0 +1,169 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEAttributeSampler_ParamDefine.h" + +#include "PopcornFX_Suite.h" + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +struct STableString +{ + A_u_long index; + A_char str[256]; +} ; + +//---------------------------------------------------------------------------- + +STableString g_strs[StrID_NUMTYPES] = +{ + { StrID_NONE, "" }, + { StrID_Name, "Attribute Sampler" }, + { StrID_Description, "PopcornFX Plugin." }, + { StrID_Generic_Infernal_Uuid, "AttributeKey" }, + { StrID_Generic_Infernal_Name, "AttributeSamplerName" }, + { StrID_Parameters_Shapes, "Geometry" }, + { StrID_Parameters_Shapes_Combobox, "Box|Sphere|Ellipsoid|Cylinder|Capsule|Cone|Mesh" }, + { StrID_Topic_Shape_Start, "Shapes Properties" }, + { StrID_Topic_Shape_Box_Start, "Box" }, + { StrID_Parameters_Box_Size_X, "Width" }, + { StrID_Parameters_Box_Size_Y, "Height" }, + { StrID_Parameters_Box_Size_Z, "Depth" }, + { StrID_Topic_Shape_Sphere_Start, "Sphere" }, + { StrID_Parameters_Sphere_Radius, "Radius" }, + { StrID_Parameters_Sphere_InnerRadius, "Inner Radius" }, + { StrID_Topic_Shape_Ellipsoid_Start, "Complex Ellipsoid" }, + { StrID_Parameters_Ellipsoid_Radius, "Radius" }, + { StrID_Parameters_Ellipsoid_InnerRadius, "Inner Radius" }, + { StrID_Topic_Shape_Cylinder_Start, "Cylinder" }, + { StrID_Parameters_Cylinder_Radius, "Radius" }, + { StrID_Parameters_Cylinder_Height, "Height" }, + { StrID_Parameters_Cylinder_InnerRadius, "Inner Radius" }, + { StrID_Topic_Shape_Capsule_Start, "Capsule" }, + { StrID_Parameters_Capsule_Radius, "Radius" }, + { StrID_Parameters_Capsule_Height, "Height" }, + { StrID_Parameters_Capsule_InnerRadius, "Inner Radius" }, + { StrID_Topic_Shape_Cone_Start, "Cone" }, + { StrID_Parameters_Cone_Radius, "Radius" }, + { StrID_Parameters_Cone_Height, "Height" }, + { StrID_Topic_Shape_Mesh_Start, "Mesh" }, + { StrID_Parameters_Mesh_Scale, "Scale" }, + { StrID_Parameters_Mesh_Path, "Mesh Path" }, + { StrID_Parameters_Mesh_Path_Button, "Browse" }, + { StrID_Parameters_Mesh_Bind_Backdrop, "Bind to Backdrop" }, + { StrID_Parameters_Mesh_Bind_Backdrop_Weight_Enabled, "Weight Sampling" }, + { StrID_Parameters_Mesh_Bind_Backdrop_ColorStreamID, "Color Stream ID" }, + { StrID_Parameters_Mesh_Bind_Backdrop_WeightStreamID, "Weight Stream ID" }, + { StrID_Parameters_Layer_Pick, "Layer" }, + { StrID_Parameters_Layer_Sample_Once, "Sample once" }, + { StrID_Parameters_Layer_Sample_Seeking, "Sample while seeking" }, + { StrID_Parameters_VectorField_Path, "VectorField Path" }, + { StrID_Parameters_VectorField_Path_Button, "Browse" }, + { StrID_Parameters_VectorField_Strength, "Strength" }, + { StrID_Parameters_VectorField_Position, "Position" }, + { StrID_Parameters_VectorField_Interpolation, "Interpolation Type" }, + { StrID_Parameters_VectorField_Interpolation_Combobox, "Point|Trilinear|Quadrilinear" }, + { StrID_Parameters_Layer_Sample_Downsampling_X, "Downsample X" }, + { StrID_Parameters_Layer_Sample_Downsampling_Y, "Downsample Y" }, +}; + +//---------------------------------------------------------------------------- + +struct STableVisibility +{ + A_u_long index; + bool visibility[__AttributeSamplerType_Count]; +}; + +//---------------------------------------------------------------------------- + +STableVisibility g_attributeSamplerParamVisibility[__AttributeSamplerType_Parameters_Count] = +{ + // None , AT , Audio, Curve, Event, Geom , Img , ImgAT, Text , Vector + { 0,/*Padding*/ { false, false, false, false, false, false, false, false, false, false } },/*Padding*/ + { AttributeSamplerType_Parameters_Infernal_Uuid, { false, false, false, false, false, false, false, false, false, false } }, + { AttributeSamplerType_Parameters_Infernal_Name, { false, false, false, false, false, false, false, false, false, false } }, + { AttributeSamplerType_Parameters_Shapes, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Start, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Box_Start, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Box_Size_X, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Box_Size_Y, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Box_Size_Z, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Box_End, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Sphere_Start, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Sphere_Radius, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Sphere_InnerRadius, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Sphere_End, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Ellipsoid_Start, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Ellipsoid_Radius, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Ellipsoid_InnerRadius, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Ellipsoid_End, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Cylinder_Start, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Cylinder_Radius, { false, false, false, false, false, TRUE, false, false, false, false } }, + // None , AT , Audio, Curve, Event, Geom , Img , ImgAT, Text , Vector + { AttributeSamplerType_Parameters_Cylinder_Height, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Cylinder_InnerRadius, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Cylinder_End, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Capsule_Start, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Capsule_Radius, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Capsule_Height, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Capsule_InnerRadius, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Capsule_End, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Cone_Start, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Cone_Radius, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Cone_Height, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Cone_End, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Mesh_Start, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Mesh_Scale, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Mesh_Path, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Mesh_Bind_Backdrop, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_Weighted_Enabled, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_ColorStreamID, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_WeightStreamID, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_Mesh_End, { false, false, false, false, false, TRUE, false, false, false, false } }, + { AttributeSamplerType_Topic_Shape_End, { false, false, false, false, false, TRUE, false, false, false, false } }, + // None , AT , Audio, Curve, Event, Geom , Img , ImgAT, Text , Vector + { AttributeSamplerType_Layer_Pick, { false, false, TRUE, false, false, false, TRUE, false, TRUE, false } }, + { AttributeSamplerType_Layer_Sample_Once, { false, false, false, false, false, false, TRUE, false, TRUE, false } }, + { AttributeSamplerType_Layer_Sample_Seeking, { false, false, TRUE, false, false, false, TRUE, false, TRUE, false } }, + + { AttributeSamplerType_Parameters_VectorField_Path, { false, false, false, false, false, false, false, false, false, TRUE } }, + { AttributeSamplerType_Parameters_VectorField_Strength, { false, false, false, false, false, false, false, false, false, TRUE } }, + { AttributeSamplerType_Parameters_VectorField_Position, { false, false, false, false, false, false, false, false, false, TRUE } }, + { AttributeSamplerType_Parameters_VectorField_Interpolation, { false, false, false, false, false, false, false, false, false, TRUE } }, + + { AttributeSamplerType_Layer_Sample_Downsampling_X, { false, false, false, false, false, false, TRUE, false, false, false } }, + { AttributeSamplerType_Layer_Sample_Downsampling_Y, { false, false, false, false, false, false, TRUE, false, false, false } }, + // None , AT , Audio, Curve, Event, Geom , Img , ImgAT, Text , Vector +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +//---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" +{ +#endif + +A_char *GetStringPtr(int strNum) +{ + return AAePk::g_strs[strNum].str; +} + +#ifdef __cplusplus +} +#endif + +//---------------------------------------------------------------------------- + +bool GetParamsVisibility(int num, AAePk::EAttributeSamplerType type) +{ + return AAePk::g_attributeSamplerParamVisibility[num].visibility[type]; +} diff --git a/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_PluginInterface.cpp b/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_PluginInterface.cpp new file mode 100644 index 00000000..7a85032b --- /dev/null +++ b/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_PluginInterface.cpp @@ -0,0 +1,780 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEAttributeSampler_PluginInterface.h" +#include "AEAttributeSampler_SequenceData.h" +#include "AEAttributeSampler_ParamDefine.h" + +#include "PopcornFX_UID.h" + +//AE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//AAE Plugin code +#include +#include + +#include +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +CPluginInterface *CPluginInterface::m_Instance = nullptr; +uint32_t CPluginInterface::m_AttrUID = 1; + +//---------------------------------------------------------------------------- + +CPluginInterface::CPluginInterface() +{ +} + +//---------------------------------------------------------------------------- + +CPluginInterface::~CPluginInterface() +{ + for (auto& it : m_AttributeData) + { + delete(it.second); + } + m_AttributeData.clear(); +} + +//---------------------------------------------------------------------------- + +CPluginInterface &CPluginInterface::Instance() +{ + if (CPluginInterface::m_Instance == nullptr) + { + m_Instance = new CPluginInterface(); + } + return *m_Instance; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::About( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + suites.ANSICallbacksSuite1()->sprintf(AAEData.m_OutData->return_msg, + "%s v%d.%d.%d\r%s", + STR(StrID_Name), + AEPOPCORNFX_MAJOR_VERSION, + AEPOPCORNFX_MINOR_VERSION, + AEPOPCORNFX_BUG_VERSION, + STR(StrID_Description)); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::GlobalSetup( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + m_MainThreadID = std::this_thread::get_id(); + + AEFX_SuiteScoper popcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + AAEData.m_OutData, + "PopcornFX suite was not found."); + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + AAEData.m_OutData->my_version = PF_VERSION( AEPOPCORNFX_MAJOR_VERSION, + AEPOPCORNFX_MINOR_VERSION, + AEPOPCORNFX_BUG_VERSION, + AEPOPCORNFX_STAGE_VERSION, + AEPOPCORNFX_BUILD_VERSION); + + //PF_OutFlag_DEEP_COLOR_AWARE -> To support 16bit per chan format. + //PF_OutFlag_I_AM_OBSOLETE -> Do not show in menu. We do not want user to create this effect manually. + //PF_OutFlag_SEND_UPDATE_PARAMS_UI -> To be notified when PF_ParamFlag_SUPERVISE is set on parameters + AAEData.m_OutData->out_flags = PF_OutFlag_DEEP_COLOR_AWARE | + PF_OutFlag_I_AM_OBSOLETE | + PF_OutFlag_SEND_UPDATE_PARAMS_UI; + //PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS -> To be able to change dynamicly some out_flags. see doc. + //PF_OutFlag2_FLOAT_COLOR_AWARE -> To support 32bit per chan format. Need PF_OutFlag2_SUPPORTS_SMART_RENDER + //PF_OutFlag2_SUPPORTS_SMART_RENDER -> Necessary for new render pipeline. + //PF_OutFlag2_I_USE_3D_CAMERA -> Can query 3D camera information, Not sure if necessery in Attribute or just on Effect. + AAEData.m_OutData->out_flags2 = PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS | + PF_OutFlag2_FLOAT_COLOR_AWARE | + PF_OutFlag2_SUPPORTS_SMART_RENDER | + PF_OutFlag2_I_USE_3D_CAMERA | + PF_OutFlag2_SUPPORTS_THREADED_RENDERING; + + suites.UtilitySuite3()->AEGP_RegisterWithAEGP(nullptr, STR(StrID_Name), &m_AAEID); + + return popcornFXSuite->InitializePopcornFXIFN(AAEData); +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::ParamsSetup( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEFX_SuiteScoper popcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + AAEData.m_OutData, + "PopcornFX suite was not found."); + PF_Err result = PF_Err_NONE; + PF_InData *in_data = AAEData.m_InData; //Used in AE Macros + PF_ParamDef def; + float minFloat = -100000.0f; //std::numeric_limits::min() crashes AfterFX, smashing his stack to pieces. + float maxFloat = 100000.0f; //same as above. + + m_ParametersIndexes = new int[__AttributeSamplerType_Parameters_Count]; + for (unsigned int i = 0; i < __AttributeSamplerType_Parameters_Count; ++i) + m_ParametersIndexes[i] = -1; + m_ParametersIndexes[0] = 0; // First Parameter is reserved to AE + + CBasePluginInterface::AddCheckBoxParameter(in_data, GetStringPtr(StrID_Generic_Infernal_Uuid), AttributeSamplerType_Parameters_Infernal_Uuid); + CBasePluginInterface::AddCheckBoxParameter(in_data, GetStringPtr(StrID_Generic_Infernal_Name), AttributeSamplerType_Parameters_Infernal_Name, false, 0, PF_PUI_INVISIBLE); + + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_INTERP; + PF_ADD_POPUP( GetStringPtr(StrID_Parameters_Shapes), + __SamplerShapeType_Count, + SamplerShapeType_Box, + GetStringPtr(StrID_Parameters_Shapes_Combobox), + AttributeSamplerType_Parameters_Shapes); + m_ParametersIndexes[AttributeSamplerType_Parameters_Shapes] = ++m_CurrentIndex; + + CBasePluginInterface::StartParameterCategory(in_data, GetStringPtr(StrID_Topic_Shape_Start), AttributeSamplerType_Topic_Shape_Start); + { + CBasePluginInterface::StartParameterCategory(in_data, GetStringPtr(StrID_Topic_Shape_Box_Start), AttributeSamplerType_Topic_Shape_Box_Start); + { + CBasePluginInterface::AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Box_Size_X), AttributeSamplerType_Parameters_Box_Size_X, 0.5f); + CBasePluginInterface::AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Box_Size_Y), AttributeSamplerType_Parameters_Box_Size_Y, 0.5f); + CBasePluginInterface::AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Box_Size_Z), AttributeSamplerType_Parameters_Box_Size_Z, 0.5f); + } + CBasePluginInterface::EndParameterCategory(in_data, AttributeSamplerType_Topic_Shape_Box_End); + + StartParameterCategory(in_data, GetStringPtr(StrID_Topic_Shape_Sphere_Start), AttributeSamplerType_Topic_Shape_Sphere_Start); + { + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Sphere_Radius), AttributeSamplerType_Parameters_Sphere_Radius, 1.0f); + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Sphere_InnerRadius), AttributeSamplerType_Parameters_Sphere_InnerRadius, 0.0f); + } + EndParameterCategory(in_data, AttributeSamplerType_Topic_Shape_Sphere_End); + + StartParameterCategory(in_data, GetStringPtr(StrID_Topic_Shape_Ellipsoid_Start), AttributeSamplerType_Topic_Shape_Ellipsoid_Start); + { + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Ellipsoid_Radius), AttributeSamplerType_Parameters_Ellipsoid_Radius, 1.0f); + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Ellipsoid_InnerRadius), AttributeSamplerType_Parameters_Ellipsoid_InnerRadius, 0.0f); + } + EndParameterCategory(in_data, AttributeSamplerType_Topic_Shape_Ellipsoid_End); + + StartParameterCategory(in_data, GetStringPtr(StrID_Topic_Shape_Cylinder_Start), AttributeSamplerType_Topic_Shape_Cylinder_Start); + { + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Cylinder_Radius), AttributeSamplerType_Parameters_Cylinder_Radius, 1.0f); + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Cylinder_Height), AttributeSamplerType_Parameters_Cylinder_Height, 0.5f); + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Cylinder_InnerRadius), AttributeSamplerType_Parameters_Cylinder_InnerRadius, 0.0f); + } + EndParameterCategory(in_data, AttributeSamplerType_Topic_Shape_Cylinder_End); + + StartParameterCategory(in_data, GetStringPtr(StrID_Topic_Shape_Capsule_Start), AttributeSamplerType_Topic_Shape_Capsule_Start); + { + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Capsule_Radius), AttributeSamplerType_Parameters_Capsule_Radius, 1.0f); + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Capsule_Height), AttributeSamplerType_Parameters_Capsule_Height, 0.5f); + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Capsule_InnerRadius), AttributeSamplerType_Parameters_Capsule_InnerRadius, 0.0f); + } + EndParameterCategory(in_data, AttributeSamplerType_Topic_Shape_Capsule_End); + + StartParameterCategory(in_data, GetStringPtr(StrID_Topic_Shape_Cone_Start), AttributeSamplerType_Topic_Shape_Cone_Start); + { + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Cone_Radius), AttributeSamplerType_Parameters_Cone_Radius, 1.0f); + AddFloatParameterUnbound(in_data, GetStringPtr(StrID_Parameters_Cone_Height), AttributeSamplerType_Parameters_Cone_Height, 0.5f); + } + EndParameterCategory(in_data, AttributeSamplerType_Topic_Shape_Cone_End); + + StartParameterCategory(in_data, GetStringPtr(StrID_Topic_Shape_Mesh_Start), AttributeSamplerType_Topic_Shape_Mesh_Start); + { + AEFX_CLR_STRUCT(def); + PF_ADD_FLOAT_SLIDERX(GetStringPtr(StrID_Parameters_Mesh_Scale), minFloat, maxFloat, minFloat, maxFloat, 1.0f/*default*/, 6, 0, 0, AttributeSamplerType_Parameters_Mesh_Scale); + m_ParametersIndexes[AttributeSamplerType_Parameters_Mesh_Scale] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetStringPtr(StrID_Parameters_Mesh_Path), GetStringPtr(StrID_Parameters_Mesh_Path_Button), 0, PF_ParamFlag_SUPERVISE, AttributeSamplerType_Parameters_Mesh_Path); + m_ParametersIndexes[AttributeSamplerType_Parameters_Mesh_Path] = ++m_CurrentIndex; + + AddCheckBoxParameter(in_data, GetStringPtr(StrID_Parameters_Mesh_Bind_Backdrop), AttributeSamplerType_Parameters_Mesh_Bind_Backdrop); + + AddCheckBoxParameter(in_data, GetStringPtr(StrID_Parameters_Mesh_Bind_Backdrop_Weight_Enabled), AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_Weighted_Enabled); + + AddIntParameter(in_data, GetStringPtr(StrID_Parameters_Mesh_Bind_Backdrop_ColorStreamID), AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_ColorStreamID, 0, 0, 100); + AddIntParameter(in_data, GetStringPtr(StrID_Parameters_Mesh_Bind_Backdrop_WeightStreamID), AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_WeightStreamID, 0, 0, 100); + + } + EndParameterCategory(in_data, AttributeSamplerType_Topic_Shape_Mesh_End); + } + EndParameterCategory(in_data, AttributeSamplerType_Topic_Shape_End); + + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE; + PF_ADD_LAYER(GetStringPtr(StrID_Parameters_Layer_Pick), PF_LayerDefault_NONE, AttributeSamplerType_Layer_Pick); + m_ParametersIndexes[AttributeSamplerType_Layer_Pick] = ++m_CurrentIndex; + + AddCheckBoxParameter(in_data, GetStringPtr(StrID_Parameters_Layer_Sample_Once), AttributeSamplerType_Layer_Sample_Once); + + AddCheckBoxParameter(in_data, GetStringPtr(StrID_Parameters_Layer_Sample_Seeking), AttributeSamplerType_Layer_Sample_Seeking); + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetStringPtr(StrID_Parameters_VectorField_Path), GetStringPtr(StrID_Parameters_Mesh_Path_Button), 0, PF_ParamFlag_SUPERVISE, AttributeSamplerType_Parameters_VectorField_Path); + m_ParametersIndexes[AttributeSamplerType_Parameters_VectorField_Path] = ++m_CurrentIndex; + + AddFloatParameter(in_data, GetStringPtr(StrID_Parameters_VectorField_Strength), AttributeSamplerType_Parameters_VectorField_Strength, 0.1f, 0.0f, 10.0f); + + AEFX_CLR_STRUCT(def); + def.ui_flags = PF_PUI_INVISIBLE; + def.param_type = PF_Param_POINT_3D; + PF_STRCPY(def.name, (GetStringPtr(StrID_Parameters_VectorField_Position))); + def.u.point3d_d.x_value = def.u.point3d_d.x_dephault = 0; + def.u.point3d_d.y_value = def.u.point3d_d.y_dephault = 0; + def.u.point3d_d.z_value = def.u.point3d_d.z_dephault = 0; + def.uu.id = (AttributeSamplerType_Parameters_VectorField_Position); + PF_ADD_PARAM(in_data, -1, &def); + m_ParametersIndexes[AttributeSamplerType_Parameters_VectorField_Position] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE | + PF_ParamFlag_CANNOT_TIME_VARY | + PF_ParamFlag_CANNOT_INTERP; + //def.ui_flags = PF_PUI_STD_CONTROL_ONLY; + PF_ADD_POPUP(GetStringPtr(StrID_Parameters_VectorField_Interpolation), + __EInterpolationType_Count, + EInterpolationType_Point, + GetStringPtr(StrID_Parameters_VectorField_Interpolation_Combobox), + AttributeSamplerType_Parameters_VectorField_Interpolation); + m_ParametersIndexes[AttributeSamplerType_Parameters_VectorField_Interpolation] = ++m_CurrentIndex; + + AddFloatParameter(in_data, GetStringPtr(StrID_Parameters_Layer_Sample_Downsampling_X), AttributeSamplerType_Layer_Sample_Downsampling_X, 1.0f, 1.0f, 100.0f); + AddFloatParameter(in_data, GetStringPtr(StrID_Parameters_Layer_Sample_Downsampling_Y), AttributeSamplerType_Layer_Sample_Downsampling_Y, 1.0f, 1.0f, 100.0f); + + AAEData.m_OutData->num_params = __AttributeSamplerType_Parameters_Count; + + popcornFXSuite->SetParametersIndexes(m_ParametersIndexes, EPKChildPlugins::SAMPLER); + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::GlobalSetdown( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + AAEData.m_OutData, + "PopcornFX suite was not found."); + + if (m_ParametersIndexes != nullptr) + delete[] m_ParametersIndexes; + m_ParametersIndexes = nullptr; + + for (auto it = m_AttributeData.begin(); it != m_AttributeData.end(); ++it) + { + if (it->second != nullptr) + { + delete (it->second); + it->second = nullptr; + } + } + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + + A_Err result = A_Err_NONE; + SAttributeSamplerSequenceDataFlat *sequenceData = nullptr; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Handle sequenceDataHandle = suites.HandleSuite1()->host_new_handle(sizeof(SAttributeSamplerSequenceDataFlat)); + + if (!sequenceDataHandle) + return PF_Err_OUT_OF_MEMORY; + sequenceData = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataHandle)); + if (sequenceData != nullptr) + { + AEFX_CLR_STRUCT(*sequenceData); + + sequenceData->m_IsFlat = true; + + sequenceData->SetUUID(CUUIDGenerator::Get16().data()); + sequenceData->SetName("AttributeSamplerName"); + sequenceData->SetResourcePath(""); + + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + if (result == A_Err_NONE) + sequenceData->SetLayerID(dstID); + + _RegisterAttributeInstancePlugin(AAEData, params, sequenceData, true); + + AAEData.m_OutData->sequence_data = sequenceDataHandle; + suites.HandleSuite1()->host_unlock_handle(sequenceDataHandle); + } + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceReSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Err result = PF_Err_NONE; + + if (AAEData.m_InData->sequence_data) + { + PF_Handle sequenceDataFlatHandle = AAEData.m_InData->sequence_data; + SAttributeSamplerSequenceDataFlat *sequenceDataFlat = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataFlatHandle)); + + if (sequenceDataFlat) + { + _RegisterAttributeInstancePlugin(AAEData, params, sequenceDataFlat, false); + AAEData.m_OutData->sequence_data = sequenceDataFlatHandle; + + suites.HandleSuite1()->host_unlock_handle(sequenceDataFlatHandle); + } + } + else + { + result = SequenceSetup(AAEData, params, output); + } + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceFlatten(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Err result = PF_Err_NONE; + + if (!AAEData.m_InData->sequence_data) + return result; + + PF_Handle sequenceDataHandle = AAEData.m_InData->sequence_data; + SAttributeSamplerSequenceDataFlat *sequenceData = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataHandle)); + + if (sequenceData) + { + std::string uuid; + //Check Layer ID to determine if its a duplicate. if so, update LayerID and regenerate UUID + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + if (result == A_Err_NONE) + { + if (sequenceData->m_LayerID != dstID) + { + sequenceData->m_LayerID = dstID; + sequenceData->SetUUID(CUUIDGenerator::Get16().data()); + } + } + _RegisterAttributeInstancePlugin(AAEData, params, sequenceData, false); + + if (GetParamsSequenceUID(AAEData, uuid, m_ParametersIndexes[AttributeSamplerType_Parameters_Infernal_Uuid]) != PF_Err_NONE) + return result; + + if (m_AttributeData.count(uuid) == 0) + return result; + + SAttributeSamplerDesc *descriptor = m_AttributeData[uuid]->m_DescAttribute; + + if (descriptor == nullptr) + return result; + + sequenceData->m_IsFlat = true; + sequenceData->SetName(descriptor->GetAttributePKKey().c_str()); + sequenceData->SetResourcePath(descriptor->m_ResourcePath.c_str()); + + AAEData.m_OutData->sequence_data = sequenceDataHandle; + suites.HandleSuite1()->host_unlock_handle(sequenceDataHandle); + } + else + result = PF_Err_INTERNAL_STRUCT_DAMAGED; + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceShutdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + if (AAEData.m_InData->sequence_data != nullptr) + { + PF_Handle sequenceDataHandle = AAEData.m_InData->sequence_data; + suites.HandleSuite1()->host_dispose_handle(sequenceDataHandle); + } + AAEData.m_InData->sequence_data = nullptr; + AAEData.m_OutData->sequence_data = nullptr; + + return PF_Err_NONE; + +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::PreRender(SAAEIOData &AAEData) +{ + PF_RenderRequest req = AAEData.m_ExtraData.m_PreRenderData->input->output_request; + PF_CheckoutResult in_result; + + AE_VERIFY(AAEData.m_ExtraData.m_PreRenderData != nullptr); + AE_VERIFY(AAEData.m_ExtraData.m_PreRenderData->cb != nullptr); + + AAEData.m_ExtraData.m_PreRenderData->cb->checkout_layer(AAEData.m_InData->effect_ref, + ATTRIBUTESAMPLER_INPUT, + ATTRIBUTESAMPLER_INPUT, + &req, + AAEData.m_InData->current_time, + AAEData.m_InData->local_time_step, + AAEData.m_InData->time_scale, + &in_result); + + UnionLRect(&in_result.result_rect, &AAEData.m_ExtraData.m_PreRenderData->output->result_rect); + UnionLRect(&in_result.max_result_rect, &AAEData.m_ExtraData.m_PreRenderData->output->max_result_rect); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SmartRender(SAAEIOData &AAEData) +{ + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_EffectWorld *inputWorld = nullptr; + PF_EffectWorld *outputWorld = nullptr; + PF_Err err = PF_Err_NONE; + + std::string uuid; + + AAEData.m_ExtraData.m_SmartRenderData->cb->checkout_layer_pixels(AAEData.m_InData->effect_ref, ATTRIBUTESAMPLER_INPUT, &inputWorld); + AAEData.m_ExtraData.m_SmartRenderData->cb->checkout_output(AAEData.m_InData->effect_ref, &outputWorld); + + if (inputWorld == nullptr || outputWorld == nullptr) + { + return PF_Err_BAD_CALLBACK_PARAM; + } + outputWorld->data = inputWorld->data; + + AAEData.m_ExtraData.m_SmartRenderData->cb->checkin_layer_pixels(AAEData.m_InData->effect_ref, ATTRIBUTESAMPLER_INPUT); + + return err; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::UpdateParams(SAAEIOData &AAEData, PF_ParamDef *params[]) +{ + (void)AAEData; + (void)params; + + PF_Err result = PF_Err_NONE; + std::string uuid; + + if (AAEData.m_InData->appl_id == 'PrMr') + return result; + + if (_GetAttributeSequenceUID(AAEData, uuid) == false) + return PF_Err_BAD_CALLBACK_PARAM; + if (m_AttributeData.count(uuid) == 0) + return result; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + SAttributeSamplerDesc *descriptor = m_AttributeData[uuid]->m_DescAttribute; + + if (descriptor == nullptr) + return result; + + if (descriptor != nullptr) + { + if (m_ParametersIndexes[AttributeSamplerType_Parameters_Mesh_Path] == (AAEData.m_ExtraData.m_ChangeParamData->param_index) || + m_ParametersIndexes[AttributeSamplerType_Parameters_VectorField_Path] == (AAEData.m_ExtraData.m_ChangeParamData->param_index)) + { + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper(AAEData.m_InData, kPopcornFXSuite1, kPopcornFXSuiteVersion1, AAEData.m_OutData, "PopcornFX suite was not found."); + result |= PopcornFXSuite->Display_AttributeSampler_BrowseMeshDialog(AAEData, descriptor); + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER; + } + else if (m_ParametersIndexes[AttributeSamplerType_Layer_Pick] == (AAEData.m_ExtraData.m_ChangeParamData->param_index)) + { + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER; + } + } + return result; +} + +//---------------------------------------------------------------------------- + +bool CPluginInterface::_GetAttributeSequenceUID(SAAEIOData &AAEData, std::string &out) +{ + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Handle sequenceDataHandle = AAEData.m_InData->sequence_data; + SAttributeSamplerSequenceDataFlat *sequenceDataFlat = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataHandle)); + + out.clear(); + if (sequenceDataFlat && sequenceDataFlat->m_IsFlat == true) + { + out.append(sequenceDataFlat->m_AttributeUUID, strlen(sequenceDataFlat->m_AttributeUUID)); + suites.HandleSuite1()->host_unlock_handle(sequenceDataHandle); + return true; + } + return false; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::_UpdateParamsVisibility(SAAEIOData &AAEData, SAttributeSamplerData *AttrData) +{ + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Err err = PF_Err_NONE; + AEGP_EffectRefH effectRef = nullptr; + AEGP_StreamRefH streamRef = nullptr; + + AAEData.m_OutData->out_flags |= PF_OutFlag_REFRESH_UI; + + err = suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + if (!AE_VERIFY(err == A_Err_NONE)) + return err; + + for (int i = 1; i < __AttributeSamplerType_Parameters_Count; ++i) // Start at 1, first params is reserved. + { + err |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AAEID, effectRef, m_ParametersIndexes[i], &streamRef); + if (!AE_VERIFY(err == A_Err_NONE)) + { + err |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return err; + + } + bool visibility = GetParamsVisibility(i, AttrData->m_DescAttribute->m_Type); + + // Toggle visibility of parameter + err |= suites.DynamicStreamSuite2()->AEGP_SetDynamicStreamFlag(streamRef, AEGP_DynStreamFlag_HIDDEN, FALSE, !visibility); + + err |= suites.StreamSuite2()->AEGP_DisposeStream(streamRef); + streamRef = nullptr; + if (!AE_VERIFY(err == A_Err_NONE)) + { + err |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return err; + } + } + err |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return err; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::HandleDataFromAEGP(SAAEIOData &AAEData, + PF_ParamDef *params[]) +{ + (void)params; + + PF_Err err = PF_Err_NONE; + void *extraData = AAEData.m_ExtraData.m_UndefinedData; + SAttributeSamplerDesc *desc = reinterpret_cast(extraData); + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + if (desc != nullptr) + { + if (desc->m_IsDeleted) + { + std::string uuid; + + if (_GetAttributeSequenceUID(AAEData, uuid) == false) + { + AE_VERIFY(false); + return PF_Err_BAD_CALLBACK_PARAM; + } + + if (m_AttributeData.count(uuid) == 0) + return PF_Err_BAD_CALLBACK_PARAM; + + SAttributeSamplerData *AttrData = m_AttributeData[uuid]; + + if (AttrData) + { + m_AttributeData.erase(uuid); + + AttrData->m_DescAttribute = nullptr; + if (desc->m_Descriptor != nullptr) + delete desc->m_Descriptor; + delete desc; + delete AttrData; + return PF_Err_NONE; + } + } + else + { + m_AttrUID += 1; + + std::string pkKey; + std::string uuid; + SAttributeSamplerData *AttrData = nullptr; + + if (_GetAttributeSequenceUID(AAEData, uuid) == false) + { + AE_VERIFY(false); + return PF_Err_BAD_CALLBACK_PARAM; + } + if (m_AttributeData.count(uuid) == 0) + { + AttrData = new SAttributeSamplerData{}; + } + AttrData = m_AttributeData[uuid]; + AttrData->m_DescAttribute = desc; + + pkKey = AttrData->m_DescAttribute->GetAttributePKKey(); + + AttrData->m_DescAttribute->m_IsDefaultValue = AttrData->m_IsDefault; + AttrData->m_DescAttribute->m_ResourcePath = AttrData->m_ResourcePath; + + AEGP_EffectRefH effectRef = nullptr; + + err = suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + if (!AE_VERIFY(err == A_Err_NONE)) + return err; + + err |= SetEffectName(AAEData, pkKey, effectRef); + err |= SetParameterStreamName(AAEData, uuid, m_ParametersIndexes[AttributeSamplerType_Parameters_Infernal_Uuid], effectRef); + err |= SetParameterStreamName(AAEData, pkKey, m_ParametersIndexes[AttributeSamplerType_Parameters_Infernal_Name], effectRef); + err |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + effectRef = nullptr; + + + _UpdateParamsVisibility(AAEData, AttrData); + } + + } + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER; + AE_VERIFY(err == A_Err_NONE); + return err; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::UpdateParamsUI(SAAEIOData &AAEData, PF_ParamDef *params[]) +{ + (void)params; + std::string uuid; + + if (GetParamsSequenceUID(AAEData, uuid, m_ParametersIndexes[AttributeSamplerType_Parameters_Infernal_Uuid]) != PF_Err_NONE) + return PF_Err_BAD_CALLBACK_PARAM; + if (m_AttributeData.count(uuid) == 0) + return A_Err_NONE; + + PF_Err err = PF_Err_NONE; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + SAttributeSamplerDesc *descriptor = m_AttributeData[uuid]->m_DescAttribute; + + if (descriptor == nullptr) + return PF_Err_NONE; + + if (descriptor != nullptr && descriptor->m_IsDeleted) + { + m_AttributeData.erase(uuid); + delete descriptor; + return PF_Err_NONE; + } + return err; +} + +//---------------------------------------------------------------------------- + +A_Err CPluginInterface::_RegisterAttributeInstancePlugin(SAAEIOData &AAEData, PF_ParamDef *params[], SAttributeSamplerSequenceDataFlat *sequenceData, bool setup) +{ + (void)params; + + PF_Err err = PF_Err_NONE; + std::string id; + + if (sequenceData != nullptr) + id = sequenceData->m_AttributeUUID; + else if (_GetAttributeSequenceUID(AAEData, id) == false) + return A_Err_NONE; + + if (m_AttributeData.count(id) == 0) + { + SAttributeSamplerData *AttrData = new SAttributeSamplerData{}; + + if (!AE_VERIFY(AttrData != nullptr)) + return A_Err_ALLOC; + + if (!setup) + { + if (m_MainThreadID == std::this_thread::get_id()) + { + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEGP_EffectRefH effectRef = nullptr; + + err |= suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + + std::string uuid(sequenceData->m_AttributeUUID); + std::string name(sequenceData->m_AttributeName); + + err |= SetParameterStreamName(AAEData, uuid, m_ParametersIndexes[AttributeSamplerType_Parameters_Infernal_Uuid], effectRef); + err |= SetParameterStreamName(AAEData, name, m_ParametersIndexes[AttributeSamplerType_Parameters_Infernal_Name], effectRef); + err |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + } + m_AttributeData[id] = AttrData; + } + if (sequenceData != nullptr) + { + m_AttributeData[id]->m_ResourcePath = sequenceData->m_ResourcePath; + } + AE_VERIFY(err == A_Err_NONE); + return A_Err_NONE;; +} + +//---------------------------------------------------------------------------- + +__AAEPK_END diff --git a/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_SequenceData.cpp b/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_SequenceData.cpp new file mode 100644 index 00000000..4f13f72d --- /dev/null +++ b/AE_Effect_AttributeSampler/Sources/AEAttributeSampler_SequenceData.cpp @@ -0,0 +1,59 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEAttributeSampler_SequenceData.h" + +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +bool SAttributeSamplerSequenceDataFlat::SetUUID(const char *uuid) +{ + m_AttributeUUIDLen = std::min(strlen(uuid) + 1, SequenceCST::UUID_LEN); + if (m_AttributeUUIDLen != 0) + { + strncpy(m_AttributeUUID, uuid, m_AttributeUUIDLen); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool SAttributeSamplerSequenceDataFlat::SetName(const char *name) +{ + m_AttributeNameLen = std::min(strlen(name) + 1, SequenceCST::MAX_NAME_LEN); + if (m_AttributeNameLen != 0) + { + strncpy(m_AttributeName, name, m_AttributeNameLen); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool SAttributeSamplerSequenceDataFlat::SetResourcePath(const char *path) +{ + m_ResourcePathLen = std::min(strlen(path) + 1, SequenceCST::MAX_PATH_LEN); + if (m_ResourcePathLen != 0) + { + strncpy(m_ResourcePath, path, m_ResourcePathLen); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool SAttributeSamplerSequenceDataFlat::SetLayerID(A_long id) +{ + m_LayerID = id; + return true; +} + +//---------------------------------------------------------------------------- + +__AAEPK_END diff --git a/AE_Effect_AttributeSampler/Sources/AE_Effect_AttributeSampler.plugin-Info.plist b/AE_Effect_AttributeSampler/Sources/AE_Effect_AttributeSampler.plugin-Info.plist new file mode 100644 index 00000000..719de26a --- /dev/null +++ b/AE_Effect_AttributeSampler/Sources/AE_Effect_AttributeSampler.plugin-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleExecutable + AttributeSampler + CFBundleIdentifier + com.PersistantStudio.PopcornFX.AttributeSampler + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + PK-AfterEffects_AttributeSampler + CFBundlePackageType + eFKT + CFBundleSignature + FXTC + LSRequiresCarbon + + NSAppleScriptEnabled + No + NSHumanReadableCopyright + © PersistantStudio PopcornFX + + diff --git a/AE_Effect_AttributeSampler/Sources/AE_Effect_AttributeSampler_PiPL.r b/AE_Effect_AttributeSampler/Sources/AE_Effect_AttributeSampler_PiPL.r new file mode 100644 index 00000000..bf73cd01 --- /dev/null +++ b/AE_Effect_AttributeSampler/Sources/AE_Effect_AttributeSampler_PiPL.r @@ -0,0 +1,73 @@ +#include "AEConfig.h" +#include "AE_EffectVers.h" + +#ifndef AE_OS_WIN + #include +#endif + +#ifdef AE_OS_WIN +#include "../../AE_Suites/PopcornFX_Define_Version.h" +#endif +#ifdef AE_OS_MAC +#include "PopcornFX_Define_Version.h" +#endif + +resource 'PiPL' (16000) { + { /* array properties: 12 elements */ + /* [1] */ + Kind { + AEEffect + }, + /* [2] */ + Name { + "Attribute Sampler" + }, + /* [3] */ + Category { + "PopcornFX" + }, +#ifdef AE_OS_WIN + #ifdef AE_PROC_INTELx64 + CodeWin64X86 {"EffectMain"}, + #endif +#else + #ifdef AE_OS_MAC + CodeMacIntel64 {"EffectMain"}, + #endif +#endif + /* [6] */ + AE_PiPL_Version { + 2, + 0 + }, + /* [7] */ + AE_Effect_Spec_Version { + PF_PLUG_IN_VERSION, + PF_PLUG_IN_SUBVERS + }, + /* [8] */ + AE_Effect_Version { + AEPOPCORNFX_PIPL_VERSION + }, + /* [9] */ + AE_Effect_Info_Flags { + 0 + }, + /* [10] */ + AE_Effect_Global_OutFlags { + 0x06200000 + }, + AE_Effect_Global_OutFlags_2 { + 0x08001403 + }, + /* [11] */ + AE_Effect_Match_Name { + "ADBE PopcornFX Sampler" + }, + /* [12] */ + AE_Reserved_Info { + 8 + } + } +}; + diff --git a/AE_Effect_Emitter/Include/AEEffect_Main.h b/AE_Effect_Emitter/Include/AEEffect_Main.h new file mode 100644 index 00000000..dac2331a --- /dev/null +++ b/AE_Effect_Emitter/Include/AEEffect_Main.h @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AEEFFECT_MAIN_H__ +#define __FX_AEEFFECT_MAIN_H__ + +#include + +#ifdef AE_OS_WIN + typedef unsigned short PixelType; + #include +#endif + +#include +#include + +#include "PopcornFX_Define.h" + +//---------------------------------------------------------------------------- + +extern "C" { + DllExport + PF_Err + EffectMain( + PF_Cmd cmd, + PF_InData *in_data, + PF_OutData *out_data, + PF_ParamDef *params[], + PF_LayerDef *output, + void *extra); + +} + +//---------------------------------------------------------------------------- + +#endif + diff --git a/AE_Effect_Emitter/Include/AEEffect_ParamDefine.h b/AE_Effect_Emitter/Include/AEEffect_ParamDefine.h new file mode 100644 index 00000000..86ab0a90 --- /dev/null +++ b/AE_Effect_Emitter/Include/AEEffect_ParamDefine.h @@ -0,0 +1,149 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +enum EStrIDType +{ + StrID_None_Param_Name, + StrID_Name_Param_Name, + StrID_Description_Param_Name, + + StrID_Generic_Infernal_Autorender_Param_Name, + + StrID_Parameters_Path, + StrID_Parameters_Path_Button, + + StrID_Parameters_Path_Reimport, + StrID_Parameters_Path_Reimport_Button, + + StrID_Generic_Infernal_Effect_Path_Hash, + + StrID_Topic_Transform_Start, + StrID_Parameters_Position, + StrID_Parameters_Rotation_X, + StrID_Parameters_Rotation_Y, + StrID_Parameters_Rotation_Z, + + StrID_Parameters_Seed, + + StrID_Topic_Rendering_Start, + + StrID_Parameters_Render_Background_Toggle, + StrID_Parameters_Render_Background_Opacity, + + StrID_Parameters_Render_Type, + StrID_Parameters_Render_Type_Combobox, + + StrID_Topic_Camera_Start, + StrID_Parameters_Camera, + StrID_Parameters_Camera_Combobox, + StrID_Parameters_Camera_Position, + StrID_Parameters_Camera_Rotation_X, + StrID_Parameters_Camera_Rotation_Y, + StrID_Parameters_Camera_Rotation_Z, + StrID_Parameters_Camera_FOV, + StrID_Parameters_Camera_Near, + StrID_Parameters_Camera_Far, + + StrID_Parameters_Receive_Light, + + StrID_Topic_PostFX_Start, + + StrID_Topic_Distortion_Start, + StrID_Parameters_Distortion_Enable, + + StrID_Topic_Bloom_Start, + StrID_Parameters_Bloom_Enable, + StrID_Parameters_Bloom_BrightPassValue, + StrID_Parameters_Bloom_Intensity, + StrID_Parameters_Bloom_Attenuation, + StrID_Parameters_Bloom_GaussianBlur, + StrID_Parameters_Bloom_GaussianBlur_Combobox, + StrID_Parameters_Bloom_RenderPassCount, + + StrID_Topic_ToneMapping_Start, + StrID_Parameters_ToneMapping_Enable, + StrID_Parameters_ToneMapping_Saturation, + StrID_Parameters_ToneMapping_Exposure, + + StrID_Topic_FXAA_Start, + StrID_Parameters_FXAA_Enable, + + StrID_Topic_BackdropMesh_Start, + + StrID_Parameters_BackdropMesh_Enable_Rendering, + StrID_Parameters_BackdropMesh_Enable_Collisions, + StrID_Parameters_BackdropMesh_Path, + StrID_Parameters_BackdropMesh_Path_Button, + + StrID_Parameters_BackdropMesh_Reset, + StrID_Parameters_BackdropMesh_Reset_Button, + + StrID_Topic_BackdropMesh_Transform_Start, + StrID_Parameters_BackdropMesh_Position, + StrID_Parameters_BackdropMesh_Rotation_X, + StrID_Parameters_BackdropMesh_Rotation_Y, + StrID_Parameters_BackdropMesh_Rotation_Z, + StrID_Parameters_BackdropMesh_Scale_X, + StrID_Parameters_BackdropMesh_Scale_Y, + StrID_Parameters_BackdropMesh_Scale_Z, + StrID_Parameters_BackdropMesh_Roughness, + StrID_Parameters_BackdropMesh_Metalness, + + StrID_Topic_BackdropAudio_Start, + StrID_Parameters_Audio, + + StrID_Topic_BackdropEnvMap_Start, + StrID_Parameters_BackdropEnvMap_Enable_Rendering, + StrID_Parameters_BackdropEnvMap_Path, + StrID_Parameters_BackdropEnvMap_Path_Button, + StrID_Parameters_BackdropEnvMap_Reset, + StrID_Parameters_BackdropEnvMap_Reset_Button, + StrID_Parameters_BackdropEnvMap_Intensity, + StrID_Parameters_BackdropEnvMap_Color, + + StrID_Topic_Light_Start, + StrID_Parameters_Light_Category, + StrID_Parameters_Light_Combobox, + StrID_Parameters_Light_Direction, + StrID_Parameters_Light_Intensity, + StrID_Parameters_Light_Color, + StrID_Parameters_Light_Ambient, + + StrID_Parameters_Scale_Factor, + StrID_Parameters_Refresh_Render, + StrID_Parameters_Render_Seeking_Toggle, + StrID_Parameters_Simulation_State, + + StrID_Parameters_BackdropMesh_Enable_Animation, + + StrID_Parameters_Path_Marketplace, + StrID_Parameters_Path_Marketplace_Button, + + StrID_Parameters_TransformType, + StrID_Parameters_TransformType_Combobox, + + StrID_Parameters_Position_2D, + StrID_Parameters_Position_2D_Distance, + + StrID_Parameters_BringEffectIntoView, + StrID_Parameters_BringEffectIntoView_Button, + + StrID_num_types +}; + +//---------------------------------------------------------------------------- + +char *GetParamsStringPtr(int strNum); + +//---------------------------------------------------------------------------- + +__AAEPK_END diff --git a/AE_Effect_Emitter/Include/AEEffect_PluginInterface.h b/AE_Effect_Emitter/Include/AEEffect_PluginInterface.h new file mode 100644 index 00000000..a8f64e06 --- /dev/null +++ b/AE_Effect_Emitter/Include/AEEffect_PluginInterface.h @@ -0,0 +1,98 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_CPluginInterface_H__ +#define __FX_CPluginInterface_H__ + + +#include "PopcornFX_Define.h" +#include "PopcornFX_Suite.h" +#include "PopcornFX_BasePluginInterface.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +struct SEmitterDesc; +struct SEffectSequenceDataFlat; +struct SAAEIOData; + +//---------------------------------------------------------------------------- + +class CPluginInterface : public CBasePluginInterface +{ + struct SEffectData + { + //Memory Owned by effect + SEmitterDesc *m_Desc; + int m_LastRenderTime = -1; + + std::mutex m_Lock; + + SEffectData() + : m_Desc(nullptr) + { + + } + }; +public: + virtual ~CPluginInterface(); + static CPluginInterface &Instance(); + + PF_Err About(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err GlobalSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err ParamsSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err GlobalSetdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + + PF_Err SequenceSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceReSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceFlatten(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + PF_Err SequenceShutdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output); + + PF_Err PreRender(SAAEIOData &AAEData); + PF_Err SmartRender(SAAEIOData &AAEData); + + PF_Err ParamValueChanged(SAAEIOData &AAEData, PF_ParamDef *params[]); + PF_Err UpdateParamsUI(SAAEIOData &AAEData, PF_ParamDef *params[]); + PF_Err HandleDataFromAEGP(SAAEIOData &AAEData, PF_ParamDef *params[]); + PF_Err QueryDynamicFlags(SAAEIOData &AAEData, PF_ParamDef *params[]); + + bool GetEffectSequenceUID(SAAEIOData &AAEData, std::string &out); + + +private: + CPluginInterface(); + static CPluginInterface *m_Instance; + static uint32_t m_AttrUID; + + //void _MakeParamCopy(PF_ParamDef *actual[], PF_ParamDef copy[]); + bool _RegisterEffectInstancePlugin(SAAEIOData &AAEData, PF_ParamDef *params[], SEffectSequenceDataFlat *sequenceData); + bool _UnRegisterEffectInstancePlugin(SAAEIOData &AAEData, PF_ParamDef *params[], SEffectSequenceDataFlat *sequenceData); + + //PF_Err _UpdateEmitterName(SAAEIOData &AAEData, SEmitterDesc* desc); + //PF_Err _UpdateBackdropMeshPath(SAAEIOData &AAEData, SEmitterDesc* desc); + + std::unordered_map m_EffectData; + std::vector m_QueuedEffectData; + +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#endif diff --git a/AE_Effect_Emitter/Include/AEEffect_SequenceData.h b/AE_Effect_Emitter/Include/AEEffect_SequenceData.h new file mode 100644 index 00000000..7867a5be --- /dev/null +++ b/AE_Effect_Emitter/Include/AEEffect_SequenceData.h @@ -0,0 +1,65 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AAEFFECT_SEQUENCEDATA_H__ +#define __AAEFFECT_SEQUENCEDATA_H__ + +#include +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +namespace SequenceCST +{ + static const size_t MAX_PATH_LEN = 1024; + static const size_t MAX_NAME_LEN = 100; + static const size_t UUID_LEN = 32; +} + +//---------------------------------------------------------------------------- + +struct SEffectSequenceDataFlat +{ + //Set is useless, as we do not create directly the struct. Just a friendly reminder. + bool m_IsFlat = true; + + char m_EffectUUID[SequenceCST::UUID_LEN]; + + char m_EffectName[SequenceCST::MAX_NAME_LEN]; + size_t m_EffectNameLen; + + char m_EffectPath[SequenceCST::MAX_PATH_LEN]; + size_t m_EffectPathLen; + + char m_EffectPathSource[SequenceCST::MAX_PATH_LEN]; + size_t m_EffectPathSourceLen; + + char m_EffectBackdropMeshPath[SequenceCST::MAX_PATH_LEN]; + size_t m_EffectBackdropMeshPathLen; + + char m_EffectEnvironmentMapPath[SequenceCST::MAX_PATH_LEN]; + size_t m_EffectEnvironmentMapPathLen; + + A_long m_LayerID; + + bool SetEffectName(const char *name); + bool SetEffectPathSource(const char *name); + bool SetEffectBackdropMeshPath(const char *name); + bool SetEffectEnvironmentMapPath(const char *name); + bool SetUUID(const std::string &uuid); + bool SetUUID(const char *uuid); + void SetLayerID(A_long id); + bool CopyFrom(SEffectSequenceDataFlat *src); +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#endif // !__AAEFFECT_SEQUENCEDATA_H__ + diff --git a/AE_Effect_Emitter/PkgInfo b/AE_Effect_Emitter/PkgInfo new file mode 100644 index 00000000..31cf1f41 --- /dev/null +++ b/AE_Effect_Emitter/PkgInfo @@ -0,0 +1 @@ +eFKTFXTC \ No newline at end of file diff --git a/AE_Effect_Emitter/Precompiled/ae_precompiled.cpp b/AE_Effect_Emitter/Precompiled/ae_precompiled.cpp new file mode 100644 index 00000000..84e52276 --- /dev/null +++ b/AE_Effect_Emitter/Precompiled/ae_precompiled.cpp @@ -0,0 +1 @@ +#include "ae_precompiled.h" diff --git a/AE_Effect_Emitter/Precompiled/ae_precompiled.h b/AE_Effect_Emitter/Precompiled/ae_precompiled.h new file mode 100644 index 00000000..ee643f3d --- /dev/null +++ b/AE_Effect_Emitter/Precompiled/ae_precompiled.h @@ -0,0 +1,8 @@ +#pragma once + +#undef PV_MODULE_NAME +#undef PV_MODULE_SYM +#define PV_MODULE_NAME "AEPlugin" +#define PV_MODULE_SYM AEPlugin + +#include diff --git a/AE_Effect_Emitter/Sources/AEEffect_Main.cpp b/AE_Effect_Emitter/Sources/AEEffect_Main.cpp new file mode 100644 index 00000000..53906ab5 --- /dev/null +++ b/AE_Effect_Emitter/Sources/AEEffect_Main.cpp @@ -0,0 +1,169 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEEffect_Main.h" + +#include "PopcornFX_Suite.h" +#include "AEEffect_PluginInterface.h" +#include "PopcornFX_Define.h" + +#include + +//---------------------------------------------------------------------------- + +extern "C" +{ + DllExport PF_Err PluginDataEntryFunction( PF_PluginDataPtr inPtr, + PF_PluginDataCB inPluginDataCallBackPtr, + SPBasicSuite *inSPBasicSuitePtr, + const char *inHostName, + const char *inHostVersion) + { + (void)inSPBasicSuitePtr; + (void)inHostName; + (void)inHostVersion; + + PF_Err result = PF_Err_INVALID_CALLBACK; + + result = PF_REGISTER_EFFECT( + inPtr, // Infos must match the PopcornFXPiPL.r + inPluginDataCallBackPtr, // + "Emitter", // Name + "ADBE PopcornFX Emitter", // Match Name + "PopcornFX", // Category + AE_RESERVED_INFO); // Reserved Info + return result; + } +} + +//---------------------------------------------------------------------------- + +PF_Err EffectMain( PF_Cmd cmd, + PF_InData *in_data, + PF_OutData *out_data, + PF_ParamDef *params[], + PF_LayerDef *output, + void *extra) +{ + PF_Err result = PF_Err_NONE; + AAePk::CPluginInterface &AEPlugin = AAePk::CPluginInterface::Instance(); + AAePk::SAAEIOData AAEData{ cmd, in_data, out_data, extra, AEPlugin.GetParametersIndexes() }; + + assert(in_data != nullptr); + assert(out_data != nullptr); + +#if _DEBUG + try + { +#endif + + if (AAEData.m_InData->appl_id == 'PrMr') + { + //User Tried to load plugin in Premiere Pro. + //There is surely a better way to handle this. + return PF_Err_UNRECOGNIZED_PARAM_TYPE; + } + + switch (cmd) + { + // Called once + case PF_Cmd_ABOUT: + //Mandatory + //Version and General Infos about the plugin + result = AEPlugin.About(AAEData, params, output); + break; + case PF_Cmd_GLOBAL_SETUP: + //Mandatory + //Startup run + result = AEPlugin.GlobalSetup(AAEData, params, output); + break; + case PF_Cmd_PARAMS_SETUP: + //Mandatory + //Setup AAE UI. + result = AEPlugin.ParamsSetup(AAEData, params, output); + break; + case PF_Cmd_GLOBAL_SETDOWN: + //Mandatory + result = AEPlugin.GlobalSetdown(AAEData, params, output); + break; + // Sequence Handling + //UI thread + case PF_Cmd_SEQUENCE_SETUP: + //Each time the user adds the effect to a layer + result = AEPlugin.SequenceSetup(AAEData, params, output); + break; + case PF_Cmd_SEQUENCE_RESETUP: + //Load or Duplicate + result = AEPlugin.SequenceReSetup(AAEData, params, output); + break; + //UI thread + case PF_Cmd_SEQUENCE_FLATTEN: + //Effect Saved, copied, duplicated.. + result = AEPlugin.SequenceFlatten(AAEData, params, output); + break; + case PF_Cmd_SEQUENCE_SETDOWN: + //Effect Deleted + result = AEPlugin.SequenceShutdown(AAEData, params, output); + break; + case PF_Cmd_GET_FLATTENED_SEQUENCE_DATA: + break; + // Audio + case PF_Cmd_AUDIO_SETUP: + case PF_Cmd_AUDIO_RENDER: + case PF_Cmd_AUDIO_SETDOWN: + break; + case PF_Cmd_SMART_PRE_RENDER: + //Can be called several times for one render + result = AEPlugin.PreRender(AAEData); + break; + case PF_Cmd_SMART_RENDER: + result = AEPlugin.SmartRender(AAEData); + break; + case PF_Cmd_FRAME_SETDOWN: + //Allow resizing of drawing area + break; + // Messaging + case PF_Cmd_EVENT: + break; + case PF_Cmd_USER_CHANGED_PARAM: + result = AEPlugin.ParamValueChanged(AAEData, params); + break; + //UI thread + //If PF_ParamFlag_SUPERVIZE if set when adding param, PF_Cmd_USER_CHANGED_PARAM is called when value change + case PF_Cmd_UPDATE_PARAMS_UI: + result = AEPlugin.UpdateParamsUI(AAEData, params); + break; + case PF_Cmd_ARBITRARY_CALLBACK: + case PF_Cmd_GET_EXTERNAL_DEPENDENCIES: + break; + case PF_Cmd_COMPLETELY_GENERAL: + result = AEPlugin.HandleDataFromAEGP(AAEData, params); + break; + case PF_Cmd_DO_DIALOG: + //UI thread + //Send when user click on Options + //Received if PF_OutFlag_I_DO_DIALOG is set in PF_Cmd_GLOBAL_SETUP + break; + case PF_Cmd_QUERY_DYNAMIC_FLAGS: + result = AEPlugin.QueryDynamicFlags(AAEData, params); + break; + default: + break; + } + +#if _DEBUG + } + catch (...) + { + assert(false); + } +#endif + if (AAEData.m_ReturnCode != PF_Err_NONE) + return AAEData.m_ReturnCode; + return result; +} + +//---------------------------------------------------------------------------- + diff --git a/AE_Effect_Emitter/Sources/AEEffect_ParamDefine.cpp b/AE_Effect_Emitter/Sources/AEEffect_ParamDefine.cpp new file mode 100644 index 00000000..77a65ab4 --- /dev/null +++ b/AE_Effect_Emitter/Sources/AEEffect_ParamDefine.cpp @@ -0,0 +1,155 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEEffect_ParamDefine.h" + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +struct STableString +{ + A_u_long index; + A_char str[256]; +}; + +//---------------------------------------------------------------------------- + +STableString g_strs_params[StrID_num_types] = +{ + { StrID_None_Param_Name, "" }, + { StrID_Name_Param_Name, "Emitter" }, + { StrID_Description_Param_Name, "PopcornFX Emitter plugin" }, + + { StrID_Generic_Infernal_Autorender_Param_Name, "Internal Autorender" }, + + { StrID_Parameters_Path, "" }, + { StrID_Parameters_Path_Button, "Browse local files" }, + + { StrID_Parameters_Path_Reimport, "" }, + { StrID_Parameters_Path_Reimport_Button, "Reimport" }, + + { StrID_Generic_Infernal_Effect_Path_Hash, "Internal - Param Path Hash" }, + + { StrID_Topic_Transform_Start, "Transform" }, + { StrID_Parameters_Position, "Position" }, + { StrID_Parameters_Rotation_X, "Rotation X" }, + { StrID_Parameters_Rotation_Y, "Rotation Y" }, + { StrID_Parameters_Rotation_Z, "Rotation Z" }, + + { StrID_Parameters_Seed, "Seed" }, + + { StrID_Topic_Rendering_Start, "Rendering" }, + + { StrID_Parameters_Render_Background_Toggle, "Override background opacity" }, + { StrID_Parameters_Render_Background_Opacity, "Background opacity" }, + { StrID_Parameters_Render_Type, "Render Output" }, + { StrID_Parameters_Render_Type_Combobox, "Final|Emissive(Not impld)|Albedo(Not impld)|Normal|Depth" }, + + { StrID_Topic_Camera_Start, "Camera Options" }, + { StrID_Parameters_Camera, "Camera" }, + { StrID_Parameters_Camera_Combobox, "Default Composition|Custom Composition(Not impld)" }, + { StrID_Parameters_Camera_Position, "Position" }, + { StrID_Parameters_Camera_Rotation_X, "Rotation X" }, + { StrID_Parameters_Camera_Rotation_Y, "Rotation Y" }, + { StrID_Parameters_Camera_Rotation_Z, "Rotation Z" }, + { StrID_Parameters_Camera_FOV, "FOV" }, + { StrID_Parameters_Camera_Near, "Near" }, + { StrID_Parameters_Camera_Far, "Far" }, + + { StrID_Parameters_Receive_Light, "Receive Light(Not impld)" }, + + { StrID_Topic_PostFX_Start, "Post Effects" }, + + { StrID_Topic_Distortion_Start, "Distortion" }, + { StrID_Parameters_Distortion_Enable, "Enable" }, + + { StrID_Topic_Bloom_Start, "Bloom" }, + { StrID_Parameters_Bloom_Enable, "Enable" }, + { StrID_Parameters_Bloom_BrightPassValue, "Bright Pass Value" }, + { StrID_Parameters_Bloom_Intensity, "Intensity" }, + { StrID_Parameters_Bloom_Attenuation, "Attenuation" }, + { StrID_Parameters_Bloom_GaussianBlur, "Blur Pixel Radius" }, + { StrID_Parameters_Bloom_GaussianBlur_Combobox, "5|9|13" }, + { StrID_Parameters_Bloom_RenderPassCount, "Render Pass Count" }, + + { StrID_Topic_ToneMapping_Start, "Tone Mapping" }, + { StrID_Parameters_ToneMapping_Enable, "Enable" }, + { StrID_Parameters_ToneMapping_Saturation, "Saturation" }, + { StrID_Parameters_ToneMapping_Exposure, "Exposure" }, + + { StrID_Topic_FXAA_Start, "FXAA" }, + { StrID_Parameters_FXAA_Enable, "Enable" }, + + { StrID_Topic_BackdropMesh_Start, "Backdrop Mesh" }, + + { StrID_Parameters_BackdropMesh_Enable_Rendering, "Enable Rendering" }, + { StrID_Parameters_BackdropMesh_Enable_Collisions, "Enable Collisions" }, + { StrID_Parameters_BackdropMesh_Path, "Mesh Path" }, + { StrID_Parameters_BackdropMesh_Path_Button, "Browse" }, + { StrID_Parameters_BackdropMesh_Reset, "" }, + { StrID_Parameters_BackdropMesh_Reset_Button, "Reset" }, + + { StrID_Topic_BackdropMesh_Transform_Start, "Transform" }, + { StrID_Parameters_BackdropMesh_Position, "Position" }, + { StrID_Parameters_BackdropMesh_Rotation_X, "Rotation X" }, + { StrID_Parameters_BackdropMesh_Rotation_Y, "Rotation Y" }, + { StrID_Parameters_BackdropMesh_Rotation_Z, "Rotation Z" }, + { StrID_Parameters_BackdropMesh_Scale_X, "Scale X" }, + { StrID_Parameters_BackdropMesh_Scale_Y, "Scale Y" }, + { StrID_Parameters_BackdropMesh_Scale_Z, "Scale Z" }, + { StrID_Parameters_BackdropMesh_Roughness, "Roughness" }, + { StrID_Parameters_BackdropMesh_Metalness, "Metalness" }, + + { StrID_Topic_BackdropAudio_Start, "Backdrop Audio" }, + { StrID_Parameters_Audio, "Audio Layer" }, + + { StrID_Topic_BackdropEnvMap_Start, "Environment Map" }, + { StrID_Parameters_BackdropEnvMap_Enable_Rendering, "Enable Rendering" }, + { StrID_Parameters_BackdropEnvMap_Path, "Map Path" }, + { StrID_Parameters_BackdropEnvMap_Path_Button, "Browse" }, + { StrID_Parameters_BackdropEnvMap_Reset, "" }, + { StrID_Parameters_BackdropEnvMap_Reset_Button, "Reset" }, + { StrID_Parameters_BackdropEnvMap_Intensity, "Intensity" }, + { StrID_Parameters_BackdropEnvMap_Color, "Color" }, + + { StrID_Topic_Light_Start, "Light" }, + { StrID_Parameters_Light_Category, "Category" }, + { StrID_Parameters_Light_Combobox, "Internal|All in Composition" }, + { StrID_Parameters_Light_Direction, "Direction" }, + { StrID_Parameters_Light_Intensity, "Intensity" }, + { StrID_Parameters_Light_Color, "Color" }, + { StrID_Parameters_Light_Ambient, "Ambient" }, + + { StrID_Parameters_Scale_Factor, "Effect Scale Up Factor" }, + { StrID_Parameters_Refresh_Render, "Internal" }, + { StrID_Parameters_Render_Seeking_Toggle, "Seeking Simulation" }, + { StrID_Parameters_Simulation_State, "Simulation state" }, + + { StrID_Parameters_BackdropMesh_Enable_Animation, "Enable Animations" }, + + { StrID_Parameters_Path_Marketplace, "Emitter Effect" }, + { StrID_Parameters_Path_Marketplace_Button, "Browse Marketplace" }, + + { StrID_Parameters_TransformType, "Transform Type" }, + { StrID_Parameters_TransformType_Combobox, "3D|2D" }, + + { StrID_Parameters_Position_2D, "Position" }, + { StrID_Parameters_Position_2D_Distance, "Distance To camera" }, + + { StrID_Parameters_BringEffectIntoView, "" }, + { StrID_Parameters_BringEffectIntoView_Button, "Bring Effect to view" }, +}; + +//---------------------------------------------------------------------------- + +A_char *GetParamsStringPtr(int strNum) +{ + return AAePk::g_strs_params[strNum].str; +} + +//---------------------------------------------------------------------------- + +__AAEPK_END diff --git a/AE_Effect_Emitter/Sources/AEEffect_PluginInterface.cpp b/AE_Effect_Emitter/Sources/AEEffect_PluginInterface.cpp new file mode 100644 index 00000000..ee91d280 --- /dev/null +++ b/AE_Effect_Emitter/Sources/AEEffect_PluginInterface.cpp @@ -0,0 +1,1304 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEEffect_PluginInterface.h" +#include "AEEffect_ParamDefine.h" +#include "AEEffect_SequenceData.h" + +//AE +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//AAE Plugin code +#include "PopcornFX_Suite.h" +#include "PopcornFX_UID.h" + +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +int SEmitterDesc::s_ID = 0; + +CPluginInterface *CPluginInterface::m_Instance = nullptr; +uint32_t CPluginInterface::m_AttrUID = 1; + +//---------------------------------------------------------------------------- + +CPluginInterface::CPluginInterface() +{ +} + +//---------------------------------------------------------------------------- + +CPluginInterface::~CPluginInterface() +{ +} + +//---------------------------------------------------------------------------- + +CPluginInterface &CPluginInterface::Instance() +{ + if (CPluginInterface::m_Instance == nullptr) + { + m_Instance = new CPluginInterface(); + } + return *m_Instance; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::About( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + suites.ANSICallbacksSuite1()->sprintf(AAEData.m_OutData->return_msg, + "%s v%d.%d.%d\r%s", + GetParamsStringPtr(StrID_Name_Param_Name), + AEPOPCORNFX_MAJOR_VERSION, + AEPOPCORNFX_MINOR_VERSION, + AEPOPCORNFX_BUG_VERSION, + GetParamsStringPtr(StrID_Description_Param_Name)); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::GlobalSetup( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + AAEData.m_OutData, + "PopcornFX suite was not found."); + + AAEData.m_OutData->my_version = PF_VERSION(AEPOPCORNFX_MAJOR_VERSION, AEPOPCORNFX_MINOR_VERSION, AEPOPCORNFX_BUG_VERSION, AEPOPCORNFX_STAGE_VERSION, AEPOPCORNFX_BUILD_VERSION); + + //PF_OutFlag_DEEP_COLOR_AWARE -> To support 16bit per chan format. + //PF_OutFlag_SEND_UPDATE_PARAMS_UI -> To be notified when PF_ParamFlag_SUPERVISE is set on parameters + AAEData.m_OutData->out_flags = PF_OutFlag_DEEP_COLOR_AWARE | + PF_OutFlag_SEND_UPDATE_PARAMS_UI | + PF_OutFlag_I_USE_SHUTTER_ANGLE; + //PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS -> To be able to change dynamicly some out_flags. see doc. + //PF_OutFlag2_FLOAT_COLOR_AWARE -> To support 32bit per chan format. Need PF_OutFlag2_SUPPORTS_SMART_RENDER + //PF_OutFlag2_SUPPORTS_SMART_RENDER -> Necessary for new render pipeline. + //PF_OutFlag2_I_USE_3D_CAMERA -> Can query 3D camera information, Not sure if necessery in Attribute or just on Effect. + //PF_OutFlag2_I_USE_3D_LIGHTS -> Can query 3D LIGHT information, Not sure if necessery in Attribute or just on Effect. + AAEData.m_OutData->out_flags2 = PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS | + PF_OutFlag2_FLOAT_COLOR_AWARE | + PF_OutFlag2_SUPPORTS_SMART_RENDER | + PF_OutFlag2_I_USE_3D_CAMERA | + PF_OutFlag2_I_USE_3D_LIGHTS | + PF_OutFlag2_SUPPORTS_THREADED_RENDERING; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + suites.UtilitySuite3()->AEGP_RegisterWithAEGP(nullptr, GetParamsStringPtr(StrID_Name_Param_Name), &m_AAEID); + + return PopcornFXSuite->InitializePopcornFXIFN(AAEData); +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::ParamsSetup( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + + AEFX_SuiteScoper popcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + AAEData.m_OutData, + "PopcornFX suite was not found."); + + PF_Err result = PF_Err_NONE; + PF_InData *in_data = AAEData.m_InData; + PF_ParamDef def; + + const float minFloat = -1000000.0f;//std::numeric_limits::min() crashes AfterFX, smashing his stack to pieces. + const float maxFloat = 1000000.0f;//same as above. + + m_ParametersIndexes = new int[__Effect_Parameters_Count]; + for (unsigned int i = 0; i < __Effect_Parameters_Count; ++i) + m_ParametersIndexes[i] = -1; + m_ParametersIndexes[0] = 0; // First Parameter is reserved to AE + + AddFloatParameterUnbound(in_data, GetParamsStringPtr(StrID_Generic_Infernal_Autorender_Param_Name), Effect_Parameters_Infernal_Autorender, 0.0f, PF_ValueDisplayFlag_NONE, PF_PUI_INVISIBLE); + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetParamsStringPtr(StrID_Parameters_Path_Marketplace), GetParamsStringPtr(StrID_Parameters_Path_Marketplace_Button), 0, PF_ParamFlag_SUPERVISE, Effect_Parameters_Path_Marketplace); + m_ParametersIndexes[Effect_Parameters_Path_Marketplace] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetParamsStringPtr(StrID_Parameters_Path), GetParamsStringPtr(StrID_Parameters_Path_Button), 0, PF_ParamFlag_SUPERVISE, Effect_Parameters_Path); + m_ParametersIndexes[Effect_Parameters_Path] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetParamsStringPtr(StrID_Parameters_Path_Reimport), GetParamsStringPtr(StrID_Parameters_Path_Reimport_Button), 0, PF_ParamFlag_SUPERVISE, Effect_Parameters_Path_Reimport); + m_ParametersIndexes[Effect_Parameters_Path_Reimport] = ++m_CurrentIndex; + + AddIntParameterUnbound(in_data, GetParamsStringPtr(StrID_Generic_Infernal_Effect_Path_Hash), Effect_Parameters_Infernal_Effect_Path_Hash, 0, PF_ValueDisplayFlag_NONE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP, PF_PUI_INVISIBLE); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_Transform_Start), Effect_Topic_Transform_Start); + { + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE | + PF_ParamFlag_CANNOT_TIME_VARY | + PF_ParamFlag_CANNOT_INTERP; + //def.ui_flags = PF_PUI_STD_CONTROL_ONLY; + PF_ADD_POPUP(GetParamsStringPtr(StrID_Parameters_TransformType), + __ETransformType_Count, + ETransformType_3D, + GetParamsStringPtr(StrID_Parameters_TransformType_Combobox), + Effect_Parameters_TransformType); + m_ParametersIndexes[Effect_Parameters_TransformType] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + def.param_type = PF_Param_POINT_3D; + PF_STRCPY(def.name, (GetParamsStringPtr(StrID_Parameters_Position))); + def.u.point3d_d.x_value = def.u.point3d_d.x_dephault = 50; + def.u.point3d_d.y_value = def.u.point3d_d.y_dephault = 50; + def.u.point3d_d.z_value = def.u.point3d_d.z_dephault = 0; + def.uu.id = (Effect_Parameters_Position); + PF_ADD_PARAM(in_data, -1, &def); + m_ParametersIndexes[Effect_Parameters_Position] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + def.param_type = PF_Param_POINT; + PF_STRCPY(def.name, (GetParamsStringPtr(StrID_Parameters_Position_2D))); + def.u.td.x_value = def.u.td.x_dephault = 50; + def.u.td.y_value = def.u.td.y_dephault = 50; + def.uu.id = (Effect_Parameters_Position_2D); + PF_ADD_PARAM(in_data, -1, &def); + m_ParametersIndexes[Effect_Parameters_Position_2D] = ++m_CurrentIndex; + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Position_2D_Distance), Effect_Parameters_Position_2D_Distance, 1.0f, -10.f, 500.0f, NULL); + + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_Rotation_X), Effect_Parameters_Rotation_X, 0.0f); + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_Rotation_Y), Effect_Parameters_Rotation_Y, 0.0f); + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_Rotation_Z), Effect_Parameters_Rotation_Z, 0.0f); + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Scale_Factor), Effect_Parameters_Scale_Factor, 1.0f, 0.001f, 10000.0f, PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetParamsStringPtr(StrID_Parameters_BringEffectIntoView), GetParamsStringPtr(StrID_Parameters_BringEffectIntoView_Button), 0, PF_ParamFlag_SUPERVISE, Effect_Parameters_BringEffectIntoView); + m_ParametersIndexes[Effect_Parameters_BringEffectIntoView] = ++m_CurrentIndex; + + } + EndParameterCategory(in_data, Effect_Topic_Transform_End); + + AddIntParameterUnbound(in_data, GetParamsStringPtr(StrID_Parameters_Seed), Effect_Parameters_Seed, 0, PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_Simulation_State), Effect_Parameters_Simulation_State, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_INTERP); + + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_Render_Seeking_Toggle), Effect_Parameters_Seeking_Toggle, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP, PF_PUI_INVISIBLE); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_Rendering_Start), Effect_Topic_Rendering_Start); + { + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_Render_Background_Toggle), Effect_Parameters_Background_Toggle); + + AddPercentParameter(in_data, GetParamsStringPtr(StrID_Parameters_Render_Background_Opacity), Effect_Parameters_Background_Opacity, 0); + + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE | + PF_ParamFlag_CANNOT_TIME_VARY | + PF_ParamFlag_CANNOT_INTERP; + //def.ui_flags = PF_PUI_STD_CONTROL_ONLY; + PF_ADD_POPUP(GetParamsStringPtr(StrID_Parameters_Render_Type), + __RenderType_Count, + RenderType_FinalCompositing, + GetParamsStringPtr(StrID_Parameters_Render_Type_Combobox), + Effect_Parameters_Render_Type); + m_ParametersIndexes[Effect_Parameters_Render_Type] = ++m_CurrentIndex; + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_Camera_Start), Effect_Topic_Camera_Start); + { + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE | + PF_ParamFlag_CANNOT_TIME_VARY | + PF_ParamFlag_CANNOT_INTERP; + //def.ui_flags = PF_PUI_STD_CONTROL_ONLY; + PF_ADD_POPUP(GetParamsStringPtr(StrID_Parameters_Camera), + __ECameraType_Count, + ECameraType_Compo_Default, + GetParamsStringPtr(StrID_Parameters_Camera_Combobox), + Effect_Parameters_Camera); + m_ParametersIndexes[Effect_Parameters_Camera] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + def.ui_flags = PF_PUI_INVISIBLE; + def.param_type = PF_Param_POINT_3D; + PF_STRCPY(def.name, (GetParamsStringPtr(StrID_Parameters_Camera_Position))); + def.u.point3d_d.x_value = def.u.point3d_d.x_dephault = 50; + def.u.point3d_d.y_value = def.u.point3d_d.y_dephault = 50; + def.u.point3d_d.z_value = def.u.point3d_d.z_dephault = 1; + def.uu.id = (Effect_Parameters_Camera_Position); + PF_ADD_PARAM(in_data, -1, &def); + m_ParametersIndexes[Effect_Parameters_Camera_Position] = ++m_CurrentIndex; + + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_Camera_Rotation_X), Effect_Parameters_Camera_Rotation_X, 0, 0, PF_PUI_INVISIBLE); + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_Camera_Rotation_Y), Effect_Parameters_Camera_Rotation_Y, 0, 0, PF_PUI_INVISIBLE); + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_Camera_Rotation_Z), Effect_Parameters_Camera_Rotation_Z, 0, 0, PF_PUI_INVISIBLE); + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Camera_FOV), Effect_Parameters_Camera_FOV, 90.0f, 1.0f, 179.0f, 0, PF_PUI_INVISIBLE); + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Camera_Near), Effect_Parameters_Camera_Near, 0.01f, 0.0001f, 1.0f); + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Camera_Far), Effect_Parameters_Camera_Far, 1000.0f, 1.0f, 100000.0f); + } + EndParameterCategory(in_data, Effect_Topic_Camera_End); + + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_Receive_Light), Effect_Parameters_Receive_Light, false, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP, PF_PUI_DISABLED | PF_PUI_INVISIBLE); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_PostFX_Start), Effect_Topic_PostFX_Start); + { + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_Distortion_Start), Effect_Topic_Distortion_Start); + { + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_Distortion_Enable), Effect_Parameters_Distortion_Enable, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + } + EndParameterCategory(in_data, Effect_Topic_Distortion_End); + + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_Bloom_Start), Effect_Topic_Bloom_Start); + { + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_Bloom_Enable), Effect_Parameters_Bloom_Enable, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Bloom_BrightPassValue), Effect_Parameters_Bloom_BrightPassValue, 1.0f, 0.0f, 20.0f); + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Bloom_Intensity), Effect_Parameters_Bloom_Intensity, 0.75f, 0.0f, 20.0f); + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Bloom_Attenuation), Effect_Parameters_Bloom_Attenuation, 0.5f, 0.0f, 1.0f); + + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE | + PF_ParamFlag_CANNOT_TIME_VARY | + PF_ParamFlag_CANNOT_INTERP; + PF_ADD_POPUP(GetParamsStringPtr(StrID_Parameters_Bloom_GaussianBlur), + __GaussianBlurPixelRadius_Count, + GaussianBlurPixelRadius_5, + GetParamsStringPtr(StrID_Parameters_Bloom_GaussianBlur_Combobox), + Effect_Parameters_Bloom_GaussianBlur); + m_ParametersIndexes[Effect_Parameters_Bloom_GaussianBlur] = ++m_CurrentIndex; + + AddIntParameter(in_data, GetParamsStringPtr(StrID_Parameters_Bloom_RenderPassCount), Effect_Parameters_Bloom_RenderPassCount, 6, 0, 13, PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + } + EndParameterCategory(in_data, Effect_Topic_Bloom_End); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_ToneMapping_Start), Effect_Topic_ToneMapping_Start); + { + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_ToneMapping_Enable), Effect_Parameters_ToneMapping_Enable, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_ToneMapping_Saturation), Effect_Parameters_ToneMapping_Saturation, 1.0f, 0.0f, 2.0f); + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_ToneMapping_Exposure), Effect_Parameters_ToneMapping_Exposure, 0.0f, -5.0f, 5.0f); + } + EndParameterCategory(in_data, Effect_Topic_ToneMapping_End); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_FXAA_Start), Effect_Topic_FXAA_Start); + { + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_FXAA_Enable), Effect_Parameters_FXAA_Enable, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + } + EndParameterCategory(in_data, Effect_Topic_FXAA_End); + } + EndParameterCategory(in_data, Effect_Topic_PostFX_End); + } + EndParameterCategory(in_data, Effect_Topic_Rendering_End); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_BackdropMesh_Start), Effect_Topic_BackdropMesh_Start); + { + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Enable_Rendering), Effect_Parameters_BackdropMesh_Enable_Rendering, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Enable_Collisions), Effect_Parameters_BackdropMesh_Enable_Collisions, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Enable_Animation), Effect_Parameters_BackdropMesh_Enable_Animation, true, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP); + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetParamsStringPtr(StrID_Parameters_BackdropMesh_Path), GetParamsStringPtr(StrID_Parameters_BackdropMesh_Path_Button), 0, PF_ParamFlag_SUPERVISE, Effect_Parameters_BackdropMesh_Path); + m_ParametersIndexes[Effect_Parameters_BackdropMesh_Path] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetParamsStringPtr(StrID_Parameters_BackdropMesh_Reset), GetParamsStringPtr(StrID_Parameters_BackdropMesh_Reset_Button), 0, PF_ParamFlag_SUPERVISE, Effect_Parameters_BackdropMesh_Reset); + m_ParametersIndexes[Effect_Parameters_BackdropMesh_Reset] = ++m_CurrentIndex; + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_BackdropMesh_Transform_Start), Effect_Topic_BackdropMesh_Transform_Start); + { + AEFX_CLR_STRUCT(def); + PF_ADD_POINT_3D(GetParamsStringPtr(StrID_Parameters_BackdropMesh_Position), 0, 0, 0, Effect_Parameters_BackdropMesh_Position); + m_ParametersIndexes[Effect_Parameters_BackdropMesh_Position] = ++m_CurrentIndex; + + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Rotation_X), Effect_Parameters_BackdropMesh_Rotation_X, 0); + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Rotation_Y), Effect_Parameters_BackdropMesh_Rotation_Y, 0); + AddAngleParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Rotation_Z), Effect_Parameters_BackdropMesh_Rotation_Z, 0); + + AddFloatParameterUnbound(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Scale_X), Effect_Parameters_BackdropMesh_Scale_X, 1.0f); + AddFloatParameterUnbound(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Scale_Y), Effect_Parameters_BackdropMesh_Scale_Y, 1.0f); + AddFloatParameterUnbound(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Scale_Z), Effect_Parameters_BackdropMesh_Scale_Z, 1.0f); + } + EndParameterCategory(in_data, Effect_Topic_BackdropMesh_Transform_End); + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Roughness), Effect_Parameters_BackdropMesh_Roughness, 1.0f, 0.0f, 1.0f); + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropMesh_Metalness), Effect_Parameters_BackdropMesh_Metalness, 0.0f, 0.0f, 1.0f); + } + EndParameterCategory(in_data, Effect_Topic_BackdropMesh_End); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_BackdropAudio_Start), Effect_Topic_BackdropAudio_Start); + { + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE; + PF_ADD_LAYER(GetParamsStringPtr(StrID_Parameters_Audio), PF_LayerDefault_NONE, Effect_Parameters_Audio); + m_ParametersIndexes[Effect_Parameters_Audio] = ++m_CurrentIndex; + } + EndParameterCategory(in_data, Effect_Topic_BackdropAudio_End); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_BackdropEnvMap_Start), Effect_Topic_BackdropEnvMap_Start); + { + AddCheckBoxParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropEnvMap_Enable_Rendering), Effect_Parameters_BackdropEnvMap_Enable_Rendering); + + PF_ADD_BUTTON(GetParamsStringPtr(StrID_Parameters_BackdropEnvMap_Path), GetParamsStringPtr(StrID_Parameters_BackdropEnvMap_Path_Button), 0, PF_ParamFlag_SUPERVISE, Effect_Parameters_BackdropEnvMap_Path); + m_ParametersIndexes[Effect_Parameters_BackdropEnvMap_Path] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + PF_ADD_BUTTON(GetParamsStringPtr(StrID_Parameters_BackdropEnvMap_Reset), GetParamsStringPtr(StrID_Parameters_BackdropEnvMap_Reset_Button), 0, PF_ParamFlag_SUPERVISE, Effect_Parameters_BackdropEnvMap_Reset); + m_ParametersIndexes[Effect_Parameters_BackdropEnvMap_Reset] = ++m_CurrentIndex; + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_BackdropEnvMap_Intensity), Effect_Parameters_BackdropEnvMap_Intensity, 1.0f, 0.0f, 10.0f); + + AEFX_CLR_STRUCT(def); + PF_ADD_COLOR(GetParamsStringPtr(StrID_Parameters_BackdropEnvMap_Color), 51, 51, 51, Effect_Parameters_BackdropEnvMap_Color); + m_ParametersIndexes[Effect_Parameters_BackdropEnvMap_Color] = ++m_CurrentIndex; + } + EndParameterCategory(in_data, Effect_Topic_BackdropEnvMap_End); + + StartParameterCategory(in_data, GetParamsStringPtr(StrID_Topic_Light_Start), Effect_Topic_Light_Start); + { + AEFX_CLR_STRUCT(def); + def.flags = PF_ParamFlag_SUPERVISE | + PF_ParamFlag_CANNOT_TIME_VARY | + PF_ParamFlag_CANNOT_INTERP; + PF_ADD_POPUP(GetParamsStringPtr(StrID_Parameters_Light_Category), + __ELightCategory_Count, + ELightCategory_Debug_Default, + GetParamsStringPtr(StrID_Parameters_Light_Combobox), + Effect_Parameters_Light_Category); + m_ParametersIndexes[Effect_Parameters_Light_Category] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + //def.ui_flags = PF_PUI_INVISIBLE; + def.param_type = PF_Param_POINT_3D; + PF_STRCPY(def.name, (GetParamsStringPtr(StrID_Parameters_Light_Direction))); + def.u.point3d_d.x_value = def.u.point3d_d.x_dephault = 0; + def.u.point3d_d.y_value = def.u.point3d_d.y_dephault = 1; + def.u.point3d_d.z_value = def.u.point3d_d.z_dephault = 0; + def.uu.id = (Effect_Parameters_Light_Direction); + PF_ADD_PARAM(in_data, -1, &def); + m_ParametersIndexes[Effect_Parameters_Light_Direction] = ++m_CurrentIndex; + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Light_Intensity), Effect_Parameters_Light_Intensity, 1.0f, -100.0f, 100.0f); + + AEFX_CLR_STRUCT(def); + PF_ADD_COLOR(GetParamsStringPtr(StrID_Parameters_Light_Color), 51, 51, 51, Effect_Parameters_Light_Color); + m_ParametersIndexes[Effect_Parameters_Light_Color] = ++m_CurrentIndex; + + AEFX_CLR_STRUCT(def); + PF_ADD_COLOR(GetParamsStringPtr(StrID_Parameters_Light_Ambient), 51, 51, 51, Effect_Parameters_Light_Ambient); + m_ParametersIndexes[Effect_Parameters_Light_Ambient] = ++m_CurrentIndex; + } + EndParameterCategory(in_data, Effect_Topic_Light_End); + + AddFloatParameter(in_data, GetParamsStringPtr(StrID_Parameters_Refresh_Render), Effect_Parameters_Refresh_Render, 0.0f, 0.0f, 10000.0f, 0, PF_PUI_INVISIBLE | PF_PUI_DISABLED); + + AAEData.m_OutData->num_params = __Effect_Parameters_Count; + + popcornFXSuite->SetParametersIndexes(m_ParametersIndexes, EPKChildPlugins::EMITTER); + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::GlobalSetdown( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)AAEData; + (void)output; + (void)params; + + if (m_ParametersIndexes != nullptr) + delete[] m_ParametersIndexes; + m_ParametersIndexes = nullptr; + for (auto it = m_QueuedEffectData.begin(); it != m_QueuedEffectData.end(); ++it) + { + if (*it != nullptr) + { + if ((*it)->m_Desc != nullptr) + { + delete ((*it)->m_Desc); + (*it)->m_Desc = nullptr; + } + delete (*it); + } + } + + for (auto it = m_EffectData.begin(); it != m_EffectData.end(); ++it) + { + if (it->second != nullptr) + { + if (it->second->m_Desc != nullptr) + { + delete (it->second->m_Desc); + it->second->m_Desc = nullptr; + } + delete (it->second); + it->second = nullptr; + } + } + m_EffectData.clear(); + + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +bool CPluginInterface::GetEffectSequenceUID(SAAEIOData &AAEData, std::string &out) +{ + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEFX_SuiteScoper seqdata_suite = AEFX_SuiteScoper(AAEData.m_InData, kPFEffectSequenceDataSuite, kPFEffectSequenceDataSuiteVersion1, AAEData.m_OutData); + + PF_ConstHandle constSeq; + seqdata_suite->PF_GetConstSequenceData(AAEData.m_InData->effect_ref, &constSeq); + + const SEffectSequenceDataFlat *sequenceDataFlat = static_cast(suites.HandleSuite1()->host_lock_handle((PF_Handle)constSeq)); + + out.clear(); + if (sequenceDataFlat && sequenceDataFlat->m_IsFlat == true) + { + out.append(sequenceDataFlat->m_EffectUUID, strlen(sequenceDataFlat->m_EffectUUID)); + suites.HandleSuite1()->host_unlock_handle((PF_Handle)constSeq); + return true; + } + if (sequenceDataFlat) + suites.HandleSuite1()->host_unlock_handle((PF_Handle)constSeq); + return false; +} + +//---------------------------------------------------------------------------- + +//Called when creating an effect only. +PF_Err CPluginInterface::SequenceSetup( SAAEIOData &AAEData, + PF_ParamDef *params[], + PF_LayerDef *output) +{ + (void)output; + (void)params; + + A_Err result = A_Err_NONE; + SEffectSequenceDataFlat *sequenceData = nullptr; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Handle sequenceDataHandle = suites.HandleSuite1()->host_new_handle(sizeof(SEffectSequenceDataFlat)); + + if (!sequenceDataHandle) + return PF_Err_OUT_OF_MEMORY; + sequenceData = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataHandle)); + if (sequenceData != nullptr) + { + AEFX_CLR_STRUCT(*sequenceData); + + sequenceData->m_IsFlat = true; + + sequenceData->SetEffectPathSource(""); + sequenceData->SetEffectBackdropMeshPath(""); + sequenceData->SetEffectName(""); + + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + if (result == A_Err_NONE) + sequenceData->SetLayerID(dstID); + + sequenceData->SetUUID(std::to_string(dstID)); + + AAEData.m_OutData->sequence_data = sequenceDataHandle; + suites.HandleSuite1()->host_unlock_handle(sequenceDataHandle); + } + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceReSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Err result = PF_Err_NONE; + + if (AAEData.m_InData->sequence_data) + { + PF_Handle sequenceDataFlatHandle = AAEData.m_InData->sequence_data; + SEffectSequenceDataFlat *sequenceDataFlat = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataFlatHandle)); + + if (sequenceDataFlat) + { + //Check Layer ID to determine if its a duplicate. if so, update LayerID and regenerate UUID + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + if (result == A_Err_NONE) + { + if (sequenceDataFlat->m_LayerID != dstID) + { + sequenceDataFlat->m_LayerID = dstID; + sequenceDataFlat->SetUUID(std::to_string(dstID).c_str()); + } + } + _RegisterEffectInstancePlugin(AAEData, params, sequenceDataFlat); + + AAEData.m_OutData->sequence_data = sequenceDataFlatHandle; + suites.HandleSuite1()->host_unlock_handle(sequenceDataFlatHandle); + } + } + else + { + result = SequenceSetup(AAEData, params, output); + } + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceFlatten(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Err result = PF_Err_NONE; + + if (!AAEData.m_InData->sequence_data) + return result; + + PF_Handle sequenceDataHandle = AAEData.m_InData->sequence_data; + SEffectSequenceDataFlat *sequenceData = static_cast(suites.HandleSuite1()->host_lock_handle(sequenceDataHandle)); + + if (sequenceData) + { + //First Update sequence Data to reflect RT information + std::string uuid; + + if (GetEffectSequenceUID(AAEData, uuid) == false) + return false; + if (m_EffectData.count(uuid) == 0) + return false; + SEffectData *data = m_EffectData[uuid]; + if (data->m_Desc != nullptr) + { + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + size_t extensionIdx = data->m_Desc->m_Name.find_last_of('.'); + if (extensionIdx != std::string::npos) + data->m_Desc->m_Name = data->m_Desc->m_Name.substr(0, extensionIdx) + ".pkfx"; + + sequenceData->SetEffectName(data->m_Desc->m_Name.data()); + sequenceData->SetEffectPathSource(data->m_Desc->m_PathSource.data()); + sequenceData->SetEffectBackdropMeshPath(data->m_Desc->m_BackdropMesh.m_Path.data()); + sequenceData->SetEffectEnvironmentMapPath(data->m_Desc->m_BackdropEnvironmentMap.m_Path.data()); + sequenceData->SetLayerID(dstID); + sequenceData->SetUUID(std::to_string(dstID)); + } + AAEData.m_OutData->sequence_data = sequenceDataHandle; + suites.HandleSuite1()->host_unlock_handle(sequenceDataHandle); + } + else + result = PF_Err_INTERNAL_STRUCT_DAMAGED; + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SequenceShutdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) +{ + (void)output; + (void)params; + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + if (AAEData.m_InData->sequence_data != nullptr) + { + PF_Handle sequenceDataHandle = AAEData.m_InData->sequence_data; + + _UnRegisterEffectInstancePlugin(AAEData, params, nullptr); + + suites.HandleSuite1()->host_dispose_handle(sequenceDataHandle); + } + AAEData.m_InData->sequence_data = nullptr; + AAEData.m_OutData->sequence_data = nullptr; + + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::QueryDynamicFlags(SAAEIOData &AAEData, PF_ParamDef *params[]) +{ + (void)params; + (void)AAEData; + + PF_Err result = PF_Err_NONE; + + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::PreRender(SAAEIOData &AAEData) +{ + PF_Err result = PF_Err_NONE; + PF_RenderRequest req = AAEData.m_ExtraData.m_PreRenderData->input->output_request; + PF_CheckoutResult in_result; + + req.preserve_rgb_of_zero_alpha = TRUE; + AAEData.m_ExtraData.m_PreRenderData->output->solid = false; + + result = AAEData.m_ExtraData.m_PreRenderData->cb->checkout_layer( AAEData.m_InData->effect_ref, + Effect_Parameters_InputReserved, + Effect_Parameters_InputReserved, + &req, + AAEData.m_InData->current_time, + AAEData.m_InData->local_time_step, + AAEData.m_InData->time_scale, + &in_result); + + UnionLRect(&in_result.result_rect, &AAEData.m_ExtraData.m_PreRenderData->output->result_rect); + UnionLRect(&in_result.max_result_rect, &AAEData.m_ExtraData.m_PreRenderData->output->max_result_rect); + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::SmartRender(SAAEIOData &AAEData) +{ + PF_Err result = PF_Err_NONE; + std::string uuid; + + if (GetEffectSequenceUID(AAEData, uuid) == false) + return PF_Err_NONE; + if (m_EffectData.count(uuid) == 0) + return PF_Err_NONE; + + SEffectData *data = m_EffectData[uuid]; + SEmitterDesc *emitterDesc = data->m_Desc; + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper(AAEData.m_InData, kPopcornFXSuite1, kPopcornFXSuiteVersion1, AAEData.m_OutData, "PopcornFX suite was not found."); + + if (emitterDesc == nullptr || !PopcornFXSuite->CheckEmitterValidity(AAEData, data->m_Desc)) + { + return PF_Interrupt_CANCEL; + } + // With multi-frame rendering, multiple threads can execute this at the same time even with just one emitter per layer: + data->m_Lock.lock(); + { + SAAEScopedParams emitterTransformType { AAEData, Effect_Parameters_TransformType }; + + SAAEScopedParams emitterPosition { AAEData, Effect_Parameters_Position }; + + SAAEScopedParams emitterPosition2D { AAEData, Effect_Parameters_Position_2D }; + SAAEScopedParams emitterPosition2DDist { AAEData, Effect_Parameters_Position_2D_Distance }; + + SAAEScopedParams emitterRotationX { AAEData, Effect_Parameters_Rotation_X }; + SAAEScopedParams emitterRotationY { AAEData, Effect_Parameters_Rotation_Y }; + SAAEScopedParams emitterRotationZ { AAEData, Effect_Parameters_Rotation_Z }; + SAAEScopedParams emitterSeed { AAEData, Effect_Parameters_Seed }; + + SAAEScopedParams emitterSimulationState { AAEData, Effect_Parameters_Simulation_State }; + + emitterDesc->m_TransformType = (ETransformType)emitterTransformType.GetComboBoxValue(); + if (emitterDesc->m_TransformType == ETransformType_3D) + emitterDesc->m_Position = emitterPosition.GetPoint3D(); + else + { + A_FloatPoint xy = emitterPosition2D.GetPoint2D(); + emitterDesc->m_Position.x = xy.x; + emitterDesc->m_Position.y = xy.y; + emitterDesc->m_Position.z = emitterPosition2DDist.GetFloat(); + } + emitterDesc->m_Rotation.x = emitterRotationX.GetAngle(); + emitterDesc->m_Rotation.y = emitterRotationY.GetAngle(); + emitterDesc->m_Rotation.z = emitterRotationZ.GetAngle(); + emitterDesc->m_Seed = emitterSeed.GetInt(); + + {//Camera + SAAEScopedParams emitterCameraType{ AAEData, Effect_Parameters_Camera }; + emitterDesc->m_Camera.m_Internal = false; + + SAAEScopedParams cameraPosition{ AAEData, Effect_Parameters_Camera_Position }; + SAAEScopedParams cameraRotationX{ AAEData, Effect_Parameters_Camera_Rotation_X }; + SAAEScopedParams cameraRotationY{ AAEData, Effect_Parameters_Camera_Rotation_Y }; + SAAEScopedParams cameraRotationZ{ AAEData, Effect_Parameters_Camera_Rotation_Z }; + SAAEScopedParams cameraFOV{ AAEData, Effect_Parameters_Camera_FOV }; + + emitterDesc->m_Camera.m_Position = cameraPosition.GetPoint3D(); + emitterDesc->m_Camera.m_Rotation.x = cameraRotationX.GetAngle(); + emitterDesc->m_Camera.m_Rotation.y = cameraRotationY.GetAngle(); + emitterDesc->m_Camera.m_Rotation.z = cameraRotationZ.GetAngle(); + emitterDesc->m_Camera.m_FOV = cameraFOV.GetFloat(); + + SAAEScopedParams cameraNear { AAEData, Effect_Parameters_Camera_Near }; + SAAEScopedParams cameraFar { AAEData, Effect_Parameters_Camera_Far }; + + emitterDesc->m_Camera.m_Near = cameraNear.GetFloat(); + emitterDesc->m_Camera.m_Far = cameraFar.GetFloat(); + } + {//Rendering + SAAEScopedParams renderingType { AAEData, Effect_Parameters_Render_Type }; + SAAEScopedParams renderingReceiveLight { AAEData, Effect_Parameters_Receive_Light }; + SAAEScopedParams renderingDistortionEnable { AAEData, Effect_Parameters_Distortion_Enable }; + SAAEScopedParams renderingBloomEnable { AAEData, Effect_Parameters_Bloom_Enable }; + SAAEScopedParams renderingBloomBrightPass { AAEData, Effect_Parameters_Bloom_BrightPassValue }; + SAAEScopedParams renderingBloomIntensity { AAEData, Effect_Parameters_Bloom_Intensity }; + SAAEScopedParams renderingBloomAttenuation { AAEData, Effect_Parameters_Bloom_Attenuation }; + SAAEScopedParams renderingBloomGaussianBlur { AAEData, Effect_Parameters_Bloom_GaussianBlur }; + SAAEScopedParams renderingBloomRenderPassCount { AAEData, Effect_Parameters_Bloom_RenderPassCount }; + SAAEScopedParams renderingToneMappingEnable { AAEData, Effect_Parameters_ToneMapping_Enable }; + SAAEScopedParams renderingToneMappingSaturation { AAEData, Effect_Parameters_ToneMapping_Saturation }; + SAAEScopedParams renderingToneMappingExposure { AAEData, Effect_Parameters_ToneMapping_Exposure }; + SAAEScopedParams renderingFXAAEnable { AAEData, Effect_Parameters_FXAA_Enable }; + + SAAEScopedParams renderingAlphaOverride { AAEData, Effect_Parameters_Background_Toggle }; + SAAEScopedParams renderingAlphaOverrideValue { AAEData, Effect_Parameters_Background_Opacity }; + + + emitterDesc->m_Rendering.m_Type = (ERenderType)renderingType.GetComboBoxValue(); + emitterDesc->m_Rendering.m_ReceiveLight = renderingReceiveLight.GetCheckBoxValue(); + + emitterDesc->m_Rendering.m_Distortion.m_Enable = renderingDistortionEnable.GetCheckBoxValue(); + + emitterDesc->m_Rendering.m_Bloom.m_Enable = renderingBloomEnable.GetCheckBoxValue(); + emitterDesc->m_Rendering.m_Bloom.m_BrightPassValue = renderingBloomBrightPass.GetFloat(); + emitterDesc->m_Rendering.m_Bloom.m_Intensity = renderingBloomIntensity.GetFloat(); + emitterDesc->m_Rendering.m_Bloom.m_Attenuation = renderingBloomAttenuation.GetFloat(); + emitterDesc->m_Rendering.m_Bloom.m_GaussianBlur = (EGaussianBlurPixelRadius)renderingBloomGaussianBlur.GetComboBoxValue(); + emitterDesc->m_Rendering.m_Bloom.m_RenderPassCount = renderingBloomRenderPassCount.GetInt(); + + emitterDesc->m_Rendering.m_ToneMapping.m_Enable = renderingToneMappingEnable.GetCheckBoxValue(); + emitterDesc->m_Rendering.m_ToneMapping.m_Saturation = renderingToneMappingSaturation.GetFloat(); + emitterDesc->m_Rendering.m_ToneMapping.m_Exposure = renderingToneMappingExposure.GetFloat(); + + emitterDesc->m_Rendering.m_FXAA.m_Enable = renderingFXAAEnable.GetCheckBoxValue(); + + emitterDesc->m_IsAlphaBGOverride = renderingAlphaOverride.GetCheckBoxValue(); + emitterDesc->m_AlphaBGOverride = renderingAlphaOverrideValue.GetPercent(); + } + {//BackdropMesh + SAAEScopedParams backdropMeshEnableRendering { AAEData, Effect_Parameters_BackdropMesh_Enable_Rendering }; + SAAEScopedParams backdropMeshEnableCollisions { AAEData, Effect_Parameters_BackdropMesh_Enable_Collisions }; + SAAEScopedParams backdropMeshEnableAnimation { AAEData, Effect_Parameters_BackdropMesh_Enable_Animation }; + SAAEScopedParams backdropMeshPosition { AAEData, Effect_Parameters_BackdropMesh_Position }; + SAAEScopedParams backdropMeshRotationX { AAEData, Effect_Parameters_BackdropMesh_Rotation_X }; + SAAEScopedParams backdropMeshRotationY { AAEData, Effect_Parameters_BackdropMesh_Rotation_Y }; + SAAEScopedParams backdropMeshRotationZ { AAEData, Effect_Parameters_BackdropMesh_Rotation_Z }; + SAAEScopedParams backdropMeshScaleX { AAEData, Effect_Parameters_BackdropMesh_Scale_X }; + SAAEScopedParams backdropMeshScaleY { AAEData, Effect_Parameters_BackdropMesh_Scale_Y }; + SAAEScopedParams backdropMeshScaleZ { AAEData, Effect_Parameters_BackdropMesh_Scale_Z }; + SAAEScopedParams backdropMeshRoughness { AAEData, Effect_Parameters_BackdropMesh_Roughness }; + SAAEScopedParams backdropMeshMetalness { AAEData, Effect_Parameters_BackdropMesh_Metalness }; + + emitterDesc->m_BackdropMesh.m_EnableRendering = backdropMeshEnableRendering.GetCheckBoxValue(); + emitterDesc->m_BackdropMesh.m_EnableCollisions = backdropMeshEnableCollisions.GetCheckBoxValue(); + emitterDesc->m_BackdropMesh.m_EnableAnimations = backdropMeshEnableAnimation.GetCheckBoxValue(); + + emitterDesc->m_BackdropMesh.m_Position = backdropMeshPosition.GetPoint3D(); + emitterDesc->m_BackdropMesh.m_Rotation.x = DegToRad(backdropMeshRotationX.GetAngle()); + emitterDesc->m_BackdropMesh.m_Rotation.y = DegToRad(backdropMeshRotationY.GetAngle()); + emitterDesc->m_BackdropMesh.m_Rotation.z = DegToRad(backdropMeshRotationZ.GetAngle()); + emitterDesc->m_BackdropMesh.m_Scale = A_FloatPoint3{ backdropMeshScaleX.GetFloat(), backdropMeshScaleY.GetFloat(), backdropMeshScaleZ.GetFloat() }; + + emitterDesc->m_BackdropMesh.m_Roughness = backdropMeshRoughness.GetFloat(); + emitterDesc->m_BackdropMesh.m_Metalness = backdropMeshMetalness.GetFloat(); + + } + {//Backdrop Environment + SAAEScopedParams backdropEnvMapEnableRendering { AAEData, Effect_Parameters_BackdropEnvMap_Enable_Rendering }; + SAAEScopedParams backdropEnvMapIntensity { AAEData, Effect_Parameters_BackdropEnvMap_Intensity }; + SAAEScopedParams backdropEnvMapColor { AAEData, Effect_Parameters_BackdropEnvMap_Color }; + + emitterDesc->m_BackdropEnvironmentMap.m_EnableRendering = backdropEnvMapEnableRendering.GetCheckBoxValue(); + emitterDesc->m_BackdropEnvironmentMap.m_Intensity = backdropEnvMapIntensity.GetFloat(); + emitterDesc->m_BackdropEnvironmentMap.m_Color = backdropEnvMapColor.GetColor(); + } + + {//Light + SAAEScopedParams LightCategory{ AAEData, Effect_Parameters_Light_Category }; + SAAEScopedParams LightDirection{ AAEData, Effect_Parameters_Light_Direction }; + SAAEScopedParams LightIntensity{ AAEData, Effect_Parameters_Light_Intensity }; + SAAEScopedParams LightColor{ AAEData, Effect_Parameters_Light_Color }; + SAAEScopedParams LightAmbient{ AAEData, Effect_Parameters_Light_Ambient }; + + if (LightCategory.GetComboBoxValue() == ELightCategory_Debug_Default) + { + emitterDesc->m_Light.m_Internal = true; + } + else + { + emitterDesc->m_Light.m_Internal = false; + } + emitterDesc->m_Light.m_Category = (ELightCategory)LightCategory.GetComboBoxValue(); + emitterDesc->m_Light.m_Direction = LightDirection.GetPoint3D(); + emitterDesc->m_Light.m_Intensity = LightIntensity.GetFloat(); + emitterDesc->m_Light.m_Color = LightColor.GetColor(); + emitterDesc->m_Light.m_Ambient = LightAmbient.GetColor(); + } + { + SAAEScopedParams scaleFactor{ AAEData, Effect_Parameters_Scale_Factor }; + + emitterDesc->m_ScaleFactor = scaleFactor.GetFloat(); + } + } + +#if defined(PK_SCALE_DOWN) + emitterDesc->m_Position.x = emitterDesc->m_Position.x / emitterDesc->m_ScaleFactor; + emitterDesc->m_Position.y = emitterDesc->m_Position.y / emitterDesc->m_ScaleFactor; + emitterDesc->m_Position.z = emitterDesc->m_Position.z / emitterDesc->m_ScaleFactor; + + emitterDesc->m_BackdropMesh.m_Position.x = emitterDesc->m_BackdropMesh.m_Position.x / emitterDesc->m_ScaleFactor; + emitterDesc->m_BackdropMesh.m_Position.y = emitterDesc->m_BackdropMesh.m_Position.y / emitterDesc->m_ScaleFactor; + emitterDesc->m_BackdropMesh.m_Position.z = emitterDesc->m_BackdropMesh.m_Position.z / emitterDesc->m_ScaleFactor; + + emitterDesc->m_Camera.m_Position.x = emitterDesc->m_Camera.m_Position.x / emitterDesc->m_ScaleFactor; + emitterDesc->m_Camera.m_Position.y = emitterDesc->m_Camera.m_Position.y / emitterDesc->m_ScaleFactor; + emitterDesc->m_Camera.m_Position.z = emitterDesc->m_Camera.m_Position.z / emitterDesc->m_ScaleFactor; +#endif + + PF_EffectWorld *input_worldP = nullptr; + result |= AAEData.m_ExtraData.m_SmartRenderData->cb->checkout_layer_pixels(AAEData.m_InData->effect_ref, 0/*POPCORN_INPUT*/, &input_worldP); + if (input_worldP == nullptr) + { + data->m_Lock.unlock(); + return result; + } + + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + emitterDesc->m_UUID = std::to_string(dstID); + emitterDesc->m_LayerID = dstID; + + PopcornFXSuite->UpdateScene(AAEData, emitterDesc); + + result = PF_ABORT(AAEData.m_InData); + if (result) + { + AAEData.m_ExtraData.m_SmartRenderData->cb->checkin_layer_pixels(AAEData.m_InData->effect_ref, 0); + data->m_Lock.unlock(); + return result; + } + + AAEData.m_ExtraData.m_SmartRenderData->cb->checkin_layer_pixels(AAEData.m_InData->effect_ref, 0); + data->m_LastRenderTime = AAEData.m_InData->current_time; + + data->m_Lock.unlock(); + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::ParamValueChanged(SAAEIOData &AAEData, PF_ParamDef *params[]) +{ + (void)params; + + std::string id; + PF_Err result = PF_Err_NONE; + + if (GetEffectSequenceUID(AAEData, id) == false) + return false; + if (m_EffectData.count(id) == 0) + return false; + + // this block must be in this function, if not, it will fail. + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + A_Time AETime; + AEGP_LayerH cameraLayer = nullptr; + AETime.scale = AAEData.m_InData->time_scale; + AETime.value = AAEData.m_InData->current_time; + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectCamera(AAEData.m_InData->effect_ref, &AETime, &cameraLayer); + if (cameraLayer == nullptr) + { + A_FloatPoint center; + AEGP_CompH effectComp = nullptr; + + center.x = AAEData.m_InData->width / 2.0f; + center.y = AAEData.m_InData->height / 2.0f; + + A_UTF16Char name[64]; + CopyCharToUTF16("PopcornFX Camera", name); + + AEGP_LayerH layerH = nullptr; + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite5()->AEGP_GetLayerParentComp(layerH, &effectComp); + result |= suites.CompSuite11()->AEGP_CreateCameraInComp(name, center, effectComp, &cameraLayer); + if (result != A_Err_NONE) + return false; + + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper(AAEData.m_InData, kPopcornFXSuite1, kPopcornFXSuiteVersion1, AAEData.m_OutData, "PopcornFX suite was not found."); + PopcornFXSuite->SetDefaultLayerPosition(AAEData, cameraLayer); + + } + SEffectData *data = m_EffectData[id]; + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper(AAEData.m_InData, kPopcornFXSuite1, kPopcornFXSuiteVersion1, AAEData.m_OutData, "PopcornFX suite was not found."); + + if (data->m_Desc != nullptr) + { + if (data->m_Desc->m_IsDeleted) + { + m_EffectData.erase(id); + delete data->m_Desc; + delete data; + return PF_Err_NONE; + } + if (m_ParametersIndexes[Effect_Parameters_Path] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + if (PopcornFXSuite->DisplayBrowseEffectPanel(AAEData, (data->m_Desc)) != A_Err_NONE) + { + strcpy(AAEData.m_OutData->return_msg, "PopcornFX Error: Unable to load effect"); + AAEData.m_OutData->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + } + else + { + SetParameterStreamName(AAEData, data->m_Desc->m_Name, m_ParametersIndexes[Effect_Parameters_Path]); //_UpdateEmitterName(AAEData, desc); + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + } + } + else if (m_ParametersIndexes[Effect_Parameters_Path_Marketplace] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + if (PopcornFXSuite->DisplayMarketplacePanel(AAEData, (data->m_Desc)) != A_Err_NONE) + { + strcpy(AAEData.m_OutData->return_msg, "PopcornFX Error: Unable to load effect"); + AAEData.m_OutData->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + } + } + else if (m_ParametersIndexes[Effect_Parameters_Path_Reimport] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + PopcornFXSuite->ReimportEffect(AAEData, (data->m_Desc)); + + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + } + else if (m_ParametersIndexes[Effect_Parameters_BackdropMesh_Path] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + if (PopcornFXSuite->DisplayBrowseMeshDialog(AAEData, (data->m_Desc)) != A_Err_NONE) + { + strcpy(AAEData.m_OutData->return_msg, "PopcornFX Error: Unable to load mesh"); + AAEData.m_OutData->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + } + else + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + } + else if (m_ParametersIndexes[Effect_Parameters_BackdropEnvMap_Path] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + if (PopcornFXSuite->DisplayBrowseEnvironmentMapDialog(AAEData, (data->m_Desc)) != A_Err_NONE) + { + strcpy(AAEData.m_OutData->return_msg, "PopcornFX Error: Unable to load Env Map"); + AAEData.m_OutData->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + } + else + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + } + else if (m_ParametersIndexes[Effect_Parameters_BackdropEnvMap_Reset] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + data->m_Desc->m_BackdropEnvironmentMap.m_Path = ""; + data->m_Desc->m_Update = true; + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + } + else if (m_ParametersIndexes[Effect_Parameters_BackdropMesh_Reset] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + data->m_Desc->m_BackdropMesh.m_Path = ""; + data->m_Desc->m_Update = true; + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + } + else if (m_ParametersIndexes[Effect_Parameters_Audio] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + } + else if (m_ParametersIndexes[Effect_Parameters_BringEffectIntoView] == AAEData.m_ExtraData.m_ChangeParamData->param_index) + { + PopcornFXSuite->MoveEffectIntoCurrentView(AAEData, (data->m_Desc)); + + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + } + } + return result; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::UpdateParamsUI(SAAEIOData &AAEData, PF_ParamDef *params[]) +{ + (void)AAEData; + (void)params; + + PF_Err err = PF_Err_NONE; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + std::string id; + + if (GetEffectSequenceUID(AAEData, id) == false) + return false; + + // PK to AE + if (m_EffectData.count(id) != 0) + { + SEffectData *effectData = m_EffectData[id]; + SEmitterDesc *desc = effectData->m_Desc; + + if (desc) + { + if (desc->m_IsDeleted) + { + m_EffectData.erase(id); + delete desc; + delete effectData; + return PF_Err_NONE; + } + + if (desc->m_Update) + { + desc->m_Update = false; + err |= SetParameterStreamName(AAEData, desc->m_Name, m_ParametersIndexes[Effect_Parameters_Path]); //_UpdateEmitterName(AAEData, desc); + err |= SetParameterStreamName(AAEData, desc->m_BackdropMesh.m_Path, m_ParametersIndexes[Effect_Parameters_BackdropMesh_Path]); //_UpdateBackdropMeshPath(AAEData, desc); + } + } + } + PF_ParamDef paramCopy[__Effect_Parameters_Count]; + std::map indexChanged; + + MakeParamCopy(params, paramCopy, __Effect_Parameters_Count); + + if (params[m_ParametersIndexes[Effect_Parameters_TransformType]]->u.pd.value == ETransformType_3D) + { + indexChanged.insert({ { m_ParametersIndexes[Effect_Parameters_Position], paramCopy[m_ParametersIndexes[Effect_Parameters_Position]].ui_flags &= ~(PF_PUI_DISABLED | PF_PUI_INVISIBLE) }, + { m_ParametersIndexes[Effect_Parameters_Position_2D], paramCopy[m_ParametersIndexes[Effect_Parameters_Position_2D]].ui_flags |= PF_PUI_DISABLED | PF_PUI_INVISIBLE }, + { m_ParametersIndexes[Effect_Parameters_Position_2D_Distance], paramCopy[m_ParametersIndexes[Effect_Parameters_Position_2D_Distance]].ui_flags |= PF_PUI_DISABLED | PF_PUI_INVISIBLE }, + }); + + } + else if (params[m_ParametersIndexes[Effect_Parameters_TransformType]]->u.pd.value == ETransformType_2D) + { + indexChanged.insert({ { m_ParametersIndexes[Effect_Parameters_Position], paramCopy[m_ParametersIndexes[Effect_Parameters_Position]].ui_flags |= PF_PUI_DISABLED | PF_PUI_INVISIBLE }, + { m_ParametersIndexes[Effect_Parameters_Position_2D], paramCopy[m_ParametersIndexes[Effect_Parameters_Position_2D]].ui_flags &= ~(PF_PUI_DISABLED | PF_PUI_INVISIBLE) }, + { m_ParametersIndexes[Effect_Parameters_Position_2D_Distance], paramCopy[m_ParametersIndexes[Effect_Parameters_Position_2D_Distance]].ui_flags &= ~(PF_PUI_DISABLED | PF_PUI_INVISIBLE) }, + }); + } + //Apply Change on param + AEGP_EffectRefH effectHandle = nullptr; + err |= suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectHandle); + if (err != A_Err_NONE) + return err; + for (auto it = indexChanged.begin(); it != indexChanged.end(); ++it) + { + AEGP_StreamRefH streamHandle = nullptr; + // Toggle visibility of parameter + err |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AAEID, effectHandle, it->first, &streamHandle); + + bool visibility = false; + if ((it->second & PF_PUI_INVISIBLE) != 0) + visibility = true; + err |= suites.DynamicStreamSuite2()->AEGP_SetDynamicStreamFlag(streamHandle, AEGP_DynStreamFlag_HIDDEN, FALSE, visibility); + err |= suites.StreamSuite2()->AEGP_DisposeStream(streamHandle); + + paramCopy[it->first].ui_flags = it->second; + err |= suites.ParamUtilsSuite3()->PF_UpdateParamUI(AAEData.m_InData->effect_ref, it->first, ¶mCopy[it->first]); + } + + if (effectHandle) + err |= suites.EffectSuite2()->AEGP_DisposeEffect(effectHandle); + return err; +} + +//---------------------------------------------------------------------------- + +PF_Err CPluginInterface::HandleDataFromAEGP(SAAEIOData &AAEData, PF_ParamDef *params[]) +{ + (void)params; + + PF_Err result = PF_Err_NONE; + std::string id; + void *extraData = AAEData.m_ExtraData.m_UndefinedData; + + const EEmitterEffectGenericCall *extraDataType = (EEmitterEffectGenericCall*)(extraData); + + if (*extraDataType == EEmitterEffectGenericCall::EmitterDesc) + { + SEmitterDesc *desc = reinterpret_cast(extraData); + + if (desc) + { + if (desc->m_IsDeleted) + { + if (GetEffectSequenceUID(AAEData, id) == false) + return false; + if (m_EffectData.count(id) != 0) + { + SEffectData *effectData = m_EffectData[id]; + delete effectData; + m_EffectData.erase(id); + } + delete desc; + return PF_Err_NONE; + } + else + { + desc->m_Update = false; + + + size_t extensionIdx = desc->m_Name.find_last_of('.'); + if (extensionIdx != std::string::npos) + desc->m_Name = desc->m_Name.substr(0, extensionIdx) + ".pkfx"; + result |= SetParameterStreamName(AAEData, desc->m_Name, m_ParametersIndexes[Effect_Parameters_Path]); //_UpdateEmitterName(AAEData, desc); + result |= SetParameterStreamName(AAEData, desc->m_BackdropMesh.m_Path, m_ParametersIndexes[Effect_Parameters_BackdropMesh_Path]); //_UpdateBackdropMeshPath(AAEData, desc); + } + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER; + AAEData.m_OutData->out_flags |= PF_OutFlag_REFRESH_UI; + } + } + else if (*extraDataType == EEmitterEffectGenericCall::GetEmitterInfos) + { + SGetEmitterInfos *infoToFill = reinterpret_cast(extraData); + + if (GetEffectSequenceUID(AAEData, id) == false) + return false; + if (m_EffectData.count(id) != 0) + { + strncpy(infoToFill->m_Name, m_EffectData[id]->m_Desc->m_Name.c_str(), 1023); + infoToFill->m_Name[1023] = '\0'; + strncpy(infoToFill->m_PathSource, m_EffectData[id]->m_Desc->m_PathSource.c_str(), 1023); + infoToFill->m_PathSource[1023] = '\0'; + } + } + return result; +} + +//---------------------------------------------------------------------------- + +bool CPluginInterface::_RegisterEffectInstancePlugin(SAAEIOData &AAEData, PF_ParamDef *params[], SEffectSequenceDataFlat *sequenceData) +{ + (void)params; + + std::string id; + + if (sequenceData != nullptr) + id = sequenceData->m_EffectUUID; + else if (GetEffectSequenceUID(AAEData, id) == false) + return false; + + if (m_EffectData.count(id) == 0) + { + //Check if effect is valid + { + PF_Err result = PF_Err_NONE; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEGP_EffectRefH effectHandle = nullptr; + AEGP_LayerH layerH; + bool discard = false; + + result |= suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectHandle); + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + + if (result != PF_Err_NONE || effectHandle == nullptr || layerH == nullptr) + discard = true; + if (effectHandle) + result |= suites.EffectSuite2()->AEGP_DisposeEffect(effectHandle); + if (discard == true) + return false; + } + SEffectData *effectData = new SEffectData{}; + effectData->m_Desc = new SEmitterDesc{}; + m_EffectData[id] = effectData; + + if (sequenceData != nullptr) + { + PF_Err result = PF_Err_NONE; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEGP_LayerH layerH; + A_long dstID = 0; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + effectData->m_Desc->m_UUID = std::to_string(dstID); + effectData->m_Desc->m_LayerID = dstID; + if (sequenceData->m_EffectName) + effectData->m_Desc->m_Name = sequenceData->m_EffectName; + if (sequenceData->m_EffectPathSource) + effectData->m_Desc->m_PathSource = sequenceData->m_EffectPathSource; + if (sequenceData->m_EffectBackdropMeshPath) + effectData->m_Desc->m_BackdropMesh.m_Path = sequenceData->m_EffectBackdropMeshPath; + if (sequenceData->m_EffectEnvironmentMapPath) + effectData->m_Desc->m_BackdropEnvironmentMap.m_Path = sequenceData->m_EffectEnvironmentMapPath; + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper( AAEData.m_InData, kPopcornFXSuite1, kPopcornFXSuiteVersion1, AAEData.m_OutData, "PopcornFX suite was not found."); + PopcornFXSuite->HandleNewEmitterEvent(AAEData, effectData->m_Desc); + + AAEData.m_OutData->out_flags |= PF_OutFlag_REFRESH_UI; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPluginInterface::_UnRegisterEffectInstancePlugin(SAAEIOData &AAEData, PF_ParamDef *params[], SEffectSequenceDataFlat *sequenceData) +{ + (void)params; + + std::string id; + + if (sequenceData != nullptr) + id = sequenceData->m_EffectUUID; + else if (GetEffectSequenceUID(AAEData, id) == false) + return false; + + if (m_EffectData.count(id) != 0) + { + SEffectData *effectData = m_EffectData[id]; + + AEFX_SuiteScoper PopcornFXSuite = AEFX_SuiteScoper(AAEData.m_InData, kPopcornFXSuite1, kPopcornFXSuiteVersion1, AAEData.m_OutData, "PopcornFX suite was not found."); + PopcornFXSuite->HandleDeleteEmitterEvent(AAEData, effectData->m_Desc); + + delete effectData->m_Desc; + delete effectData; + + m_EffectData.erase(id); + } + return true; +} + +//---------------------------------------------------------------------------- + +__AAEPK_END diff --git a/AE_Effect_Emitter/Sources/AEEffect_SequenceData.cpp b/AE_Effect_Emitter/Sources/AEEffect_SequenceData.cpp new file mode 100644 index 00000000..2f8c40e0 --- /dev/null +++ b/AE_Effect_Emitter/Sources/AEEffect_SequenceData.cpp @@ -0,0 +1,88 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEEffect_SequenceData.h" + +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +bool SEffectSequenceDataFlat::SetEffectName(const char* name) +{ + strncpy(m_EffectName, name, SequenceCST::MAX_NAME_LEN); + + m_EffectNameLen = strlen(name) + 1; + return true; +} + +//---------------------------------------------------------------------------- + +bool SEffectSequenceDataFlat::SetEffectPathSource(const char *path) +{ + m_EffectPathSourceLen = strlen(path) + 1; + strncpy(m_EffectPathSource, path, SequenceCST::MAX_PATH_LEN); + return true; +} + +//---------------------------------------------------------------------------- + +bool SEffectSequenceDataFlat::SetEffectBackdropMeshPath(const char *path) +{ + m_EffectBackdropMeshPathLen = strlen(path) + 1; + strncpy(m_EffectBackdropMeshPath, path, SequenceCST::MAX_PATH_LEN); + return true; +} + +//---------------------------------------------------------------------------- + +bool SEffectSequenceDataFlat::SetEffectEnvironmentMapPath(const char *path) +{ + m_EffectEnvironmentMapPathLen = strlen(path) + 1; + strncpy(m_EffectEnvironmentMapPath, path, SequenceCST::MAX_PATH_LEN); + return true; +} + +//---------------------------------------------------------------------------- + +bool SEffectSequenceDataFlat::SetUUID(const char *uuid) +{ + strncpy(m_EffectUUID, uuid, SequenceCST::UUID_LEN); + return true; +} + +//---------------------------------------------------------------------------- + +bool SEffectSequenceDataFlat::SetUUID(const std::string &uuid) +{ + strncpy(m_EffectUUID, uuid.c_str(), SequenceCST::UUID_LEN); + return true; +} + +//---------------------------------------------------------------------------- + +void SEffectSequenceDataFlat::SetLayerID(A_long id) +{ + m_LayerID = id; +} + +//---------------------------------------------------------------------------- + +bool SEffectSequenceDataFlat::CopyFrom(SEffectSequenceDataFlat *src) +{ + SetEffectName(src->m_EffectName); + SetEffectPathSource(src->m_EffectPathSource); + SetEffectBackdropMeshPath(src->m_EffectBackdropMeshPath); + SetEffectEnvironmentMapPath(src->m_EffectEnvironmentMapPath); + SetUUID(src->m_EffectUUID); + SetLayerID(src->m_LayerID); + return true; +} + +//---------------------------------------------------------------------------- +__AAEPK_END + diff --git a/AE_Effect_Emitter/Sources/AE_Effect_Emitter.plugin-Info.plist b/AE_Effect_Emitter/Sources/AE_Effect_Emitter.plugin-Info.plist new file mode 100644 index 00000000..2f07e012 --- /dev/null +++ b/AE_Effect_Emitter/Sources/AE_Effect_Emitter.plugin-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleExecutable + Emitter + CFBundleIdentifier + com.PersistantStudio.PopcornFX.Emitter + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + AE_Effect_Emitter + CFBundlePackageType + eFKT + CFBundleSignature + FXTC + LSRequiresCarbon + + NSAppleScriptEnabled + No + NSHumanReadableCopyright + © PersistantStudio PopcornFX + + diff --git a/AE_Effect_Emitter/Sources/AE_Effect_Emitter_PiPL.r b/AE_Effect_Emitter/Sources/AE_Effect_Emitter_PiPL.r new file mode 100644 index 00000000..7ef877b3 --- /dev/null +++ b/AE_Effect_Emitter/Sources/AE_Effect_Emitter_PiPL.r @@ -0,0 +1,73 @@ +#include "AEConfig.h" +#include "AE_EffectVers.h" + +#ifndef AE_OS_WIN + #include +#endif + +#ifdef AE_OS_WIN +#include "../../AE_Suites/PopcornFX_Define_Version.h" +#endif +#ifdef AE_OS_MAC +#include "PopcornFX_Define_Version.h" +#endif + +resource 'PiPL' (16000) { + { /* array properties: 12 elements */ + /* [1] */ + Kind { + AEEffect + }, + /* [2] */ + Name { + "Emitter" + }, + /* [3] */ + Category { + "PopcornFX" + }, +#ifdef AE_OS_WIN + #ifdef AE_PROC_INTELx64 + CodeWin64X86 {"EffectMain"}, + #endif +#else + #ifdef AE_OS_MAC + CodeMacIntel64 {"EffectMain"}, + #endif +#endif + /* [6] */ + AE_PiPL_Version { + 2, + 0 + }, + /* [7] */ + AE_Effect_Spec_Version { + PF_PLUG_IN_VERSION, + PF_PLUG_IN_SUBVERS + }, + /* [8] */ + AE_Effect_Version { + AEPOPCORNFX_PIPL_VERSION + }, + /* [9] */ + AE_Effect_Info_Flags { + 0 + }, + /* [10] */ + AE_Effect_Global_OutFlags { + 101187584 + }, + AE_Effect_Global_OutFlags_2 { + 134222855 + }, + /* [11] */ + AE_Effect_Match_Name { + "ADBE PopcornFX Emitter" + }, + /* [12] */ + AE_Reserved_Info { + 8 + } + } +}; + diff --git a/AE_GeneralPlugin/GeneralPlugin.manifest b/AE_GeneralPlugin/GeneralPlugin.manifest new file mode 100644 index 00000000..ad87fd43 --- /dev/null +++ b/AE_GeneralPlugin/GeneralPlugin.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AE_GeneralPlugin/Include/AEGP_AEPKConversion.h b/AE_GeneralPlugin/Include/AEGP_AEPKConversion.h new file mode 100644 index 00000000..a965359d --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_AEPKConversion.h @@ -0,0 +1,77 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AECONVERSION_H__ +#define __FX_AECONVERSION_H__ + +#include "AEGP_Define.h" + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +RHI::EPixelFormat AAEToPK(PF_PixelFormat format); +PF_PixelFormat PKToAAE(RHI::EPixelFormat format); +u32 GetPixelSizeFromPixelFormat(RHI::EPixelFormat format); + +void AAEToPK(A_Matrix4 &in, CFloat4x4 &out); +void AAEToPK(A_Matrix4 &in, CFloat4x4 *out); + +CFloat3 AAEToPK(A_FloatPoint3 &in); +A_FloatPoint3 PKToAAE(CFloat3 &in); + +CFloat3 AngleAAEToPK(A_FloatPoint3 &in); +A_FloatPoint3 AnglePKToAAE(CFloat3 &in); + +EAttributeSemantic AttributePKToAAE(EDataSemantic value); + +EAttributeType AttributePKToAAE(EBaseTypeID value); +EBaseTypeID AttributeAAEToPK(EAttributeType value); + +EAttributeSamplerType AttributeSamplerPKToAAE(SParticleDeclaration::SSampler::ESamplerType type); + +void AAEToPK(SPostFXBloomDesc &in, PKSample::SParticleSceneOptions::SBloom &out); +void AAEToPK(SPostFXDistortionDesc &in, PKSample::SParticleSceneOptions::SDistortion &out); +void AAEToPK(SPostFXToneMappingDesc &in, PKSample::SParticleSceneOptions::SToneMapping &out); +void AAEToPK(SRenderingDesc &in, PKSample::SParticleSceneOptions &out); + +CUbyte3 ConvertSRGBToLinear(CUbyte3 v); +CUbyte3 ConvertLinearToSRGB(CUbyte3 v); + +EApiValue RHIApiToAEApi(RHI::EGraphicalApi value); +RHI::EGraphicalApi AEApiToRHIApi(EApiValue value); + +PKSample::CRHIParticleSceneRenderHelper::ERenderTargetDebug AAEToPK(ERenderType format); +CParticleSamplerDescriptor_VectorField_Grid::EInterpolation AAEToPK(EInterpolationType &value); + +//---------------------------------------------------------------------------- + +inline void WCharToCString(aechar_t *input, CString *destination) +{ + CStringUnicode tmp = CStringUnicode::FromUTF16(input); + destination->Append(tmp.ToUTF8()); +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif // !__FX_AECONVERSION_H__ diff --git a/AE_GeneralPlugin/Include/AEGP_AssetBaker.h b/AE_GeneralPlugin/Include/AEGP_AssetBaker.h new file mode 100644 index 00000000..c2b50a73 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_AssetBaker.h @@ -0,0 +1,222 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_ASSET_BAKER_H__ +#define __AEGP_ASSET_BAKER_H__ + +#include "AEGP_Define.h" + +#include "pk_base_object/include/hbo_object.h" +#include "pk_kernel/include/kr_threads.h" +#include "pk_kernel/include/kr_timers.h" +#include "pk_kernel/include/kr_resources.h" +#include "pk_kernel/include/kr_file_directory_walker.h" +#include + +//---------------------------------------------------------------------------- + +__PK_API_BEGIN + +class CResourceHandlerMesh; +class CResourceHandlerImage; +class CResourceHandlerRectangleList; +class CResourceHandlerFontMetrics; +class CResourceHandlerVectorField; +class CResourceManager; +class CCookery; +namespace HBO { + class CContext; +} + +__PK_API_END + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +class CResourceHandlerDummy : public IResourceHandler +{ +public: + CResourceHandlerDummy() { } + virtual ~CResourceHandlerDummy() { } + virtual void *Load(const CResourceManager *resourceManager, u32 resourceTypeID, const CString &resourcePath, bool pathNotVirtual, const SResourceLoadCtl &loadCtl, CMessageStream &loadReport, SAsyncLoadStatus *asyncLoadStatus) override + { + (void)resourceManager; (void)resourceTypeID; (void)resourcePath; (void)pathNotVirtual; (void)loadCtl; (void)loadReport; (void)asyncLoadStatus; + return null; + } + virtual void *Load(const CResourceManager *resourceManager, u32 resourceTypeID, const CFilePackPath &resourcePath, const SResourceLoadCtl &loadCtl, CMessageStream &loadReport, SAsyncLoadStatus *asyncLoadStatus) override + { + (void)resourceManager; (void)resourceTypeID; (void)resourcePath; (void)loadCtl; (void)loadReport; (void)asyncLoadStatus; + return null; + } + + virtual void Unload(const CResourceManager *, u32, void *) override { } + virtual void AppendDependencies(const CResourceManager *, u32, void *, TArray &) const override { } + virtual void AppendDependencies(const CResourceManager *, u32, const CString &, bool, TArray &) const override { } + virtual void AppendDependencies(const CResourceManager *, u32, const CFilePackPath &, TArray &) const override { } + virtual void BroadcastResourceChanged(const CResourceManager *, const CFilePackPath &) override { } +}; + +class CProjectSettingsFinder : public CFileDirectoryWalker +{ +public: + CProjectSettingsFinder(const CString &rootDir, IFileSystem *controller = null); + + virtual void FileNotifier(const CFilePack *pack, const char *fullPath, u32 fileFirstCharPos) override; + virtual bool DirectoryNotifier(const CFilePack *pack, const char *fullPath, u32 directoryFirstCharPos) override; + const CString &ProjectSettingsPath() const; + +private: + static bool ProjectSettingsPathValidator(const char *filePath); + +private: + CString m_ProjectSettingsPath; +}; + +//---------------------------------------------------------------------------- + +class SBakeContext +{ +public: + SBakeContext(); + ~SBakeContext(); + + IResourceHandler *m_BakeResourceMeshHandler; + IResourceHandler *m_BakeResourceImageHandler; + IResourceHandler *m_BakeResourceRectangleListHandler; + IResourceHandler *m_BakeResourceFontMetricsHandler; + IResourceHandler *m_BakeResourceVectorFieldHandler; + + IFileSystem *m_BakeFSController; + CResourceManager *m_BakeResourceManager; + HBO::CContext *m_BakeContext; + + bool m_Initialized; + + bool Init(); + + static bool _RemapPath(CString &path); + static CString _RemapFX(const CString &path); +}; + +//---------------------------------------------------------------------------- + +enum EAssetChangesType : int +{ + Undefined = 0, + Add, + Remove, + Update, + Rename +}; + +//---------------------------------------------------------------------------- + +class HBO_CLASS(CEditorAssetEffect), public CBaseObject +{ +private: + // Camera + HBO_FIELD(CFloat3, StartCameraPosition); + HBO_FIELD(CFloat3, StartCameraOrientation); +public: + CEditorAssetEffect(); + virtual ~CEditorAssetEffect(); + + void CopyFrom(CEditorAssetEffect *other); + + HBO_CLASS_DECLARATION(); +}; +PK_DECLARE_REFPTRCLASS(EditorAssetEffect); + +//---------------------------------------------------------------------------- + +class CEffectBaker : public CRefCountedObject +{ +private: + struct SAssetChange + { + CString m_EffectPath; + CString m_EffectPathOld; + EAssetChangesType m_Type; + }; + + struct SDirectoryValidator + { + const CStringView m_LibraryDir; + const CStringView m_EditorCacheDir; + const CStringView m_TemplatesDir; + + bool cmp(const char *rawPath) + { + const CStringView path = CStringView::FromNullTerminatedString(rawPath); + return !path.Contains(m_LibraryDir) && !path.Contains(m_EditorCacheDir) && !path.Contains(m_TemplatesDir); + } + + SDirectoryValidator(const CString &library, const CString &editor, const CString &templat) + : m_LibraryDir(library) + , m_EditorCacheDir(editor) + , m_TemplatesDir(templat) + { + } + }; + +public: + CEffectBaker(); + ~CEffectBaker(); + + void FileAdded(const CString &path); + void FileRemoved(const CString &path); + void FileChanged(const CString &path); + void FileChangedRelativePath(const CString &path); + void FileRenamed(const CString &oldPath, const CString &newPath); + + void Initialize(const CString &srcPack, const CString &dstPack, const CString &pkprojPath); + void LoadProjectSettings(const CString &pkprojPath); + void Clear(); + + void Lock(); + void Unlock(); + + void CancelAllFileChanges(); + int PopFileChanges(); + bool IsChangeRegistered(const CString &path, EAssetChangesType type); + void ReimportAssets(TArray &paths, bool importPkri = true); + void ReimportAllAssets(bool refesh); + void GetAllAssetPath(); + const CString &GetSourcePackRootPath() const { return m_RootDir; } + bool BakeAssetOrAddToRetryStack(SAssetChange &path); + bool LoadAndBrowseEffect(const CString &path); + bool BakeAsset(const CString &path, bool bakeDependencies = true); + + SBakeContext &GetBakeContextData() { return m_BakeContext; } + + void ClearBakedPaths() { m_BakedPaths.Clear(); } +private: + + bool m_Initialized; + + TArray m_ToBake; + TArray m_BakedPaths; + CString m_DstPackPath; + CString m_SrcPackPath; + PFilePack m_SrcPack; + PFilePack m_DstPack; + + SBakeContext m_BakeContext; + CCookery m_Cookery; + Threads::CCriticalSection m_Lock; + + CString m_RootDir; + CString m_LibraryDir; + CString m_EditorCacheDir; + CString m_PresetsDir; +}; +PK_DECLARE_REFPTRCLASS(EffectBaker); + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_Attribute.h b/AE_GeneralPlugin/Include/AEGP_Attribute.h new file mode 100644 index 00000000..760d8e8d --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_Attribute.h @@ -0,0 +1,216 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AAEATTRIBUTE_H__ +#define __FX_AAEATTRIBUTE_H__ + +#include "AEGP_Define.h" + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +//---------------------------------------------------------------------------- + +namespace PopcornFX +{ + PK_FORWARD_DECLARE(ParticleSamplerDescriptor); + PK_FORWARD_DECLARE(ShapeDescriptor); + PK_FORWARD_DECLARE(ImageSampler); + PK_FORWARD_DECLARE(ResourceMeshBatch); + PK_FORWARD_DECLARE(ResourceMesh); + + class CMeshSurfaceSamplerStructuresRandom; + class CMeshSurfaceSamplerStructuresFromUV; + class CMeshKdTree; + class CMeshVolumeSamplerStructuresRandom; + class CMeshProjection; + + struct SDensitySamplerData; +} + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +struct SSamplerBase +{ + PParticleSamplerDescriptor m_SamplerDescriptor; + bool m_Dirty = true; + + SSamplerBase(); + virtual ~SSamplerBase(); +}; + +//---------------------------------------------------------------------------- + +struct SSamplerShape : public SSamplerBase +{ + ESamplerShapeType m_Type; + + PShapeDescriptor m_ShapeDesc; + + + PResourceMeshBatch m_MeshBatch; + + // Acceleration structures are now owned by the integration: +#if (PK_GEOMETRICS_BUILD_MESH_SAMPLER_SURFACE != 0) + CMeshSurfaceSamplerStructuresRandom *m_SurfaceSamplingStructs; + CMeshSurfaceSamplerStructuresFromUV *m_SurfaceUVSamplingStructs; + + bool CreateSurfaceSamplingStructs(const PResourceMeshBatch mesh); + bool CreateSurfaceUVSamplingStructs(const PResourceMeshBatch mesh); +#endif + +#if (PK_GEOMETRICS_BUILD_MESH_SAMPLER_VOLUME != 0) + CMeshVolumeSamplerStructuresRandom *m_VolumeSamplingStructs; + + bool CreateVolumeSamplingStructs(const PResourceMeshBatch mesh); +#endif + +#if (PK_GEOMETRICS_BUILD_MESH_PROJECTION != 0) && 0 + CMeshProjection *m_ProjectionStructs; + + bool CreateProjectionStructs(const PResourceMeshBatch mesh); +#endif + +#if (PK_GEOMETRICS_BUILD_KDTREE != 0) + CMeshKdTree *m_KdTree; + + bool CreateKdTree(const PResourceMeshBatch mesh); +#endif + + SSamplerShape(); + virtual ~SSamplerShape(); + bool UpdateShape(SShapeSamplerDescriptor *aeShapeDesc); +}; + +//---------------------------------------------------------------------------- + +struct SSamplerImage : public SSamplerBase +{ + PRefCountedMemoryBuffer m_TextureData; + u32 m_Width; + u32 m_Height; + u32 m_SizeInBytes; + CImage::EFormat m_PixelFormat; + + int m_WrapMode; + + CImageSampler *m_ImageDesc = null; + SDensitySamplerData *m_DensitySampler = null; + + SSamplerImage(); + virtual ~SSamplerImage(); + bool UpdateImage(SImageSamplerDescriptor *aeTextDesc); +}; + +//---------------------------------------------------------------------------- + +struct SSamplerText : public SSamplerBase +{ + CString m_Data; + + SSamplerText(); + virtual ~SSamplerText(); + bool UpdateText(STextSamplerDescriptor *aeTextDesc); +}; + +//---------------------------------------------------------------------------- + +struct SSamplerAudio : public SSamplerBase +{ + enum SamplingType + { + SamplingType_Unknown = 0, + SamplingType_WaveForm, + SamplingType_Spectrum, + }; + + float *m_Waveform; + u32 m_InputSampleCount; + u32 m_SampleCount; + + AEGP_SoundDataH m_SoundData; + + SamplingType m_SamplingType; + float *m_WaveformData; + TArray m_WaveformPyramid; + + CStringId m_Name; + + Threads::CCriticalSection m_Lock; + bool m_BuiltThisFrame; + + SSamplerAudio(); + virtual ~SSamplerAudio(); + bool UpdateSound(SAudioSamplerDescriptor *aeTextDesc); + + bool CleanAudioPyramid(); + bool BuildAudioPyramidIFN(); + + bool ReleaseAEResources(); +}; + +//---------------------------------------------------------------------------- + +struct SSamplerVectorField : public SSamplerBase +{ + SSamplerVectorField(); + virtual ~SSamplerVectorField(); + bool UpdateVectorField(SVectorFieldSamplerDescriptor *aeShapeDesc); +}; + +//---------------------------------------------------------------------------- + +struct SPendingAttribute +{ + PF_ProgPtr m_ParentEffectPtr; + + SAttributeBaseDesc *m_Desc; + + SSamplerBase *m_PKDesc; + + AEGP_EffectRefH m_AttributeEffectRef; + + bool m_Deleted = false; + + SPendingAttribute(PF_ProgPtr parent = null, SAttributeBaseDesc *desc = null, AEGP_EffectRefH effectRef = null) + : m_ParentEffectPtr(parent) + , m_Desc(desc) + , m_PKDesc(null) + , m_AttributeEffectRef(effectRef) + {}; + + SPendingAttribute(const SPendingAttribute &other) + : m_ParentEffectPtr(other.m_ParentEffectPtr) + , m_Desc(other.m_Desc) + , m_PKDesc(other.m_PKDesc) + , m_AttributeEffectRef(other.m_AttributeEffectRef) + {}; + + ~SPendingAttribute() + { + PK_ASSERT(!m_AttributeEffectRef); + }; + +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_Define.h b/AE_GeneralPlugin/Include/AEGP_Define.h new file mode 100644 index 00000000..68347847 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_Define.h @@ -0,0 +1,41 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AEGP_DEFINE_H__ +#define __FX_AEGP_DEFINE_H__ + +#include + +#include + +//---------------------------------------------------------------------------- + +#define __AEGP_PK_BEGIN namespace AEGPPk { +#define __AEGP_PK_END } + +#define ASSERT_AE_ERR(result, value) PK_ASSERT(value != A_Err_NONE); result |= value; + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +using namespace PK_NAMESPACE; +using namespace AAePk; + +//---------------------------------------------------------------------------- + +enum EApiValue //Do not reorder/change values +{ + D3D11 = 1, + D3D12, + Metal, + Size, +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif // !__FX_AEGP_DEFINE_H__ diff --git a/AE_GeneralPlugin/Include/AEGP_FileDialog.h b/AE_GeneralPlugin/Include/AEGP_FileDialog.h new file mode 100644 index 00000000..d57aa9c1 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_FileDialog.h @@ -0,0 +1,82 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_FILEDIALOG_H__ +#define __AEGP_FILEDIALOG_H__ + +#include "AEGP_Define.h" +#if defined (PK_MACOSX) +#include "AEGP_FileDialogMac.h" +#endif +#if defined (PK_WINDOWS) +#include "AEGP_WinFileDialog.h" +#endif +#include + +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +#if defined(PK_MACOSX) + +//---------------------------------------------------------------------------- + +struct SMacFileDialogFilterData +{ + CString m_Desc; + CString m_Type; + + SMacFileDialogFilterData(const CString desc, const CString type); +}; + +//---------------------------------------------------------------------------- + +struct SMacFileOpenData +{ + TArray m_Filters; + PopcornFX::FastDelegate m_Cb; + + SMacFileOpenData(); + + ~SMacFileOpenData(); + + bool AddFilter(const CString &desc, const CString &type); +}; + +//---------------------------------------------------------------------------- + +bool MacBasicFileOpen(SMacFileOpenData &data); + +//---------------------------------------------------------------------------- +#endif + +//---------------------------------------------------------------------------- + +struct SFileDialog +{ +#if defined(PK_WINDOWS) + SWinFileOpenData m_Data; +#elif defined (PK_MACOSX) + SMacFileOpenData m_Data; +#endif + bool m_Cancel; + + SFileDialog(); + + bool AddFilter(const CString &desc, const CString &type); + void SetCallback(FastDelegate cb) { m_Data.m_Cb = cb; }; + bool BasicFileOpen(); + + bool IsCancelled(); + +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_FileDialogMac.h b/AE_GeneralPlugin/Include/AEGP_FileDialogMac.h new file mode 100644 index 00000000..68a5dcab --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_FileDialogMac.h @@ -0,0 +1,23 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#ifndef __AEGP_FILEDIALOGMAC_H__ +#define __AEGP_FILEDIALOGMAC_H__ + +#include "AEGP_Define.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +#if defined(PK_MACOSX) + +CString OpenFileDialogMac(const TArray &filters, const CString &defaultPathAndFile = CString()); + +#endif + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_FileWatcher.h b/AE_GeneralPlugin/Include/AEGP_FileWatcher.h new file mode 100644 index 00000000..c9989506 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_FileWatcher.h @@ -0,0 +1,43 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_FILE_WATCHER_H__ +#define __AEGP_FILE_WATCHER_H__ + +#include "AEGP_Define.h" + +#include + +__AEGP_PK_BEGIN +//---------------------------------------------------------------------------- + +class CFileWatcher : public CRefCountedObject +{ +private: + PFileSystemWatcher m_FileWatcher; + CString m_PathToWatch; + + bool CreateWatcherIFN(); + void RemoveWatchIFN(); + +public: + CFileWatcher(); + ~CFileWatcher(); + + void PauseFileWatcher(); + void RestartFileWatcher(); + + bool SetWatchPack(const CString &pathToWatch); + void SetNotifierAdd(void(*callback)(const CString &filePath)); + void SetNotifierRemove(void(*callback)(const CString &filePath)); + void SetNotifierModify(void(*callback)(const CString &filePath)); + void SetNotifierRename(void(*callback)(const CString &oldFilePath, const CString &newFilePath)); +}; +PK_DECLARE_REFPTRCLASS(FileWatcher); + +//---------------------------------------------------------------------------- +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_FrameCollector.h b/AE_GeneralPlugin/Include/AEGP_FrameCollector.h new file mode 100644 index 00000000..866c148d --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_FrameCollector.h @@ -0,0 +1,46 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#include "PK-SampleLib/PKSample.h" + +#include +#include + +#include + +#include "AEGP_Define.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- +// +// Frame collector +// +//---------------------------------------------------------------------------- + +// CFrameCollector is specialized with our policy to work with RHI. +// Create your own policy to use it in your custom engine. +class CFrameCollector : public TFrameCollector +{ +public: + CFrameCollector(); + virtual ~CFrameCollector(); + + // Views to cull against (setup from update thread) + TMemoryView m_CullingFrustums; + +private: + // Early Cull: Culls an entire medium on the update thread (when collecting the frame) + virtual bool EarlyCull(const PopcornFX::CAABB &bbox) const override; + + // Late Cull: Cull draw requests or individual pages on the render thread (when collecting draw calls) + // You can use this method if you don't have render thread views available from the update thread + // Ideally, cull in EarlyCull, but you should implement both methods + // Late cull also allows for finer culling (per draw request / per page) + virtual bool LateCull(const PopcornFX::CAABB &bbox) const override { return EarlyCull(bbox); } +}; + +//---------------------------------------------------------------------------- +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Include/AEGP_LayerHolder.h b/AE_GeneralPlugin/Include/AEGP_LayerHolder.h new file mode 100644 index 00000000..4d2556ae --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_LayerHolder.h @@ -0,0 +1,152 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once +#include "AEGP_Define.h" + +#include "AEGP_Attribute.h" + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +namespace AAePk +{ + struct SAAEIOData; + struct SAttributeDesc; + struct SAttributeSamplerDesc; + struct SEmitterDesc; +}; + +__AEGP_PK_BEGIN + +PK_FORWARD_DECLARE(AAEScene); +PK_FORWARD_DECLARE(RendererProperties); + +//---------------------------------------------------------------------------- + +class HBO_CLASS(CGraphicOverride), public CBaseObject +{ +public: + HBO_FIELD(u32, RendererID); + HBO_FIELD(u32, PropertyID); + + HBO_FIELD(CString, Value); +public: + CGraphicOverride(); + ~CGraphicOverride(); + + bool operator==(const CGraphicOverride &other); + + HBO_CLASS_DECLARATION(); +}; +PK_DECLARE_REFPTRCLASS(GraphicOverride); + +//---------------------------------------------------------------------------- + +class HBO_CLASS(CLayerProperty), public CBaseObject +{ +public: + HBO_FIELD(CString, CompName); + HBO_FIELD(u32, ID); + HBO_FIELD(TArray, RendererProperties); + +public: + CLayerProperty(); + ~CLayerProperty(); + + HBO_CLASS_DECLARATION(); +}; +PK_DECLARE_REFPTRCLASS(LayerProperty); + +//---------------------------------------------------------------------------- + +struct SPendingEmitter +{ + PF_ProgPtr m_EffectHandle; + + //Data Owned by AEEffect. Do not free in AEGP + SEmitterDesc *m_Desc; + + SPendingEmitter(PF_ProgPtr ptr = null, SEmitterDesc *desc = null) + : m_EffectHandle(ptr) + , m_Desc(desc) + { + + } + + SPendingEmitter(const SPendingEmitter& other) + { + m_EffectHandle = other.m_EffectHandle; + m_Desc = other.m_Desc; + } + + ~SPendingEmitter() + { + m_EffectHandle = null; + m_Desc = null; + } +}; + +//---------------------------------------------------------------------------- + +struct SLayerHolder +{ + u32 ID = 0; + + u32 m_TimeScale = 0; + u32 m_TimeStep = 0; + u32 m_CurrentTime = 0; + CFloat4x4 m_ViewMatrix = CFloat4x4::IDENTITY; + CFloat4 m_CameraPos = CFloat4::ZERO; + + AEGP_LayerH m_EffectLayer = null; + AEGP_LayerH m_CameraLayer = null; + PAAEScene m_Scene = null; + + TArray m_SPendingEmitters; + SPendingEmitter m_SpawnedEmitter; + + TArray m_SPendingAttributes; + THashMap m_DeletedAttributes; + THashMap m_SpawnedAttributes; + + THashMap m_DeletedAttributesSampler; + THashMap m_SpawnedAttributesSampler; + + SSamplerAudio *m_BackdropAudioWaveform = null; + SSamplerAudio *m_BackdropAudioSpectrum = null; + + float m_ScaleFactor = 1; + bool m_ForceRender = false; + bool m_Deleted = false; + + Threads::CCriticalSection m_LayerLock; + + CString m_SourcePackPath; + PFilePack m_BakedPack = null; + + CString m_LayerName; + CString m_CompositionName; + PLayerProperty m_LayerProperty = null; + + SLayerHolder(); + ~SLayerHolder(); + + bool Clear(SPBasicSuite* suite); +}; + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Include/AEGP_Log.h b/AE_GeneralPlugin/Include/AEGP_Log.h new file mode 100644 index 00000000..2778c891 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_Log.h @@ -0,0 +1,51 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AEGP_LOG_H__ +#define __FX_AEGP_LOG_H__ + +#include + +#include +#include +#include +#include +#include +#include + +#include "AEGP_Define.h" + +//---------------------------------------------------------------------------- +namespace AAePk +{ + struct SAAEIOData; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_BEGIN + +class CAELog +{ + static bool s_PKState; + static SAAEIOData *s_IOData; +public: + static bool LogErrorWindows(SAAEIOData *AAEData, const CString errorStr); + + static bool SetIOData(SAAEIOData *AAEData); + static void ClearIOData(); + static bool TryLogErrorWindows(const CString errorStr); + static void SetPKLogState(bool state); + + + static bool TryLogInfoWindows(const CString infoStr); +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif + diff --git a/AE_GeneralPlugin/Include/AEGP_Main.h b/AE_GeneralPlugin/Include/AEGP_Main.h new file mode 100644 index 00000000..8f3086d9 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_Main.h @@ -0,0 +1,30 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AEGP_MAIN_H__ +#define __FX_AEGP_MAIN_H__ + +#include + +#include +#include +#include +#include +#include +#include + +#ifdef AE_OS_WIN + typedef unsigned short PixelType; + #include +#endif + +//---------------------------------------------------------------------------- +// This entry point is exported through the PiPL (.r file) +extern "C" DllExport AEGP_PluginInitFuncPrototype EntryPointFunc; + +//---------------------------------------------------------------------------- + +#endif + diff --git a/AE_GeneralPlugin/Include/AEGP_PackExplorer.h b/AE_GeneralPlugin/Include/AEGP_PackExplorer.h new file mode 100644 index 00000000..5e777cd4 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_PackExplorer.h @@ -0,0 +1,61 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_PACK_EXPLORER_H__ +#define __FX_PACK_EXPLORER_H__ + +#include "AEGP_Define.h" + +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +class CPackExplorer : public CFileDirectoryWalker, public CRefCountedObject +{ +protected: + CString m_Pack; + TArray m_EffectPaths; + + virtual bool DirectoryNotifier(const CFilePack *pack, const char *fullPath, u32 directoryFirstCharPos) override; + virtual void FileNotifier(const CFilePack *pack, const char *fullPath, u32 fileFirstCharPos) override; + +public: + CPackExplorer(const CString &pack, IFileSystem *fileSystem = null); + virtual ~CPackExplorer(); + + void Explore(); // will start scanning + + const CString &Pack() const { return m_Pack; } + TMemoryView EffectPaths() const { return m_EffectPaths; } +}; + +//---------------------------------------------------------------------------- + +class CBakedPackExplorer : public CFileDirectoryWalker, public CRefCountedObject +{ +protected: + CString m_Pack; + TArray m_EffectPaths; + + virtual bool DirectoryNotifier(const CFilePack *pack, const char *fullPath, u32 directoryFirstCharPos) override; + virtual void FileNotifier(const CFilePack *pack, const char *fullPath, u32 fileFirstCharPos) override; + +public: + CBakedPackExplorer(const CString &pack, IFileSystem *fileSystem = null); + virtual ~CBakedPackExplorer(); + + void Explore(); // will start scanning + + const CString &Pack() const { return m_Pack; } + TMemoryView EffectPaths() const { return m_EffectPaths; } +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif // __FX_PACK_EXPLORER_H__ diff --git a/AE_GeneralPlugin/Include/AEGP_ParticleScene.h b/AE_GeneralPlugin/Include/AEGP_ParticleScene.h new file mode 100644 index 00000000..52206183 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_ParticleScene.h @@ -0,0 +1,54 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AAEPARTICLESCENE_H__ +#define __FX_AAEPARTICLESCENE_H__ + +#include "AEGP_Define.h" + +#include + +#include +#include +#include + +#include + +__AEGP_PK_BEGIN + +class CAAEScene; + +//---------------------------------------------------------------------------- + +class CAAEParticleScene : public IParticleScene +{ +public: + CAAEParticleScene() {} + virtual ~CAAEParticleScene() {} + + virtual void RayTracePacket( const Colliders::STraceFilter &traceFilter, + const Colliders::SRayPacket &packet, + const Colliders::STracePacket &results) override; + + void ClearBackdropMesh(); + void SetBackdropMeshTransform(const CFloat4x4 &transforms); + void SetBackdropMesh(const TResourcePtr &resourceMesh, const CFloat4x4 &transforms); + const CFloat4x4 &BackdropMeshTransforms() const { return m_BackdropMeshTransforms; } + + virtual TMemoryView GetAudioSpectrum(CStringId channelGroup, u32 &outBaseCount) const override; + virtual TMemoryView GetAudioWaveform(CStringId channelGroup, u32 &outBaseCount) const override; + + CAAEScene *m_Parent = null; +private: + // Mesh backdrop + TArray m_BackdropMeshes; + CFloat4x4 m_BackdropMeshTransforms = CFloat4x4::IDENTITY; +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_PopcornFXPlugins.h b/AE_GeneralPlugin/Include/AEGP_PopcornFXPlugins.h new file mode 100644 index 00000000..eeda0a43 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_PopcornFXPlugins.h @@ -0,0 +1,55 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_POPCORNPLUGINS_H__ +#define __FX_POPCORNPLUGINS_H__ + +#include "AEGP_Define.h" + +__AEGP_PK_BEGIN +//---------------------------------------------------------------------------- + +enum ERuntimePlugin +{ + EPlugin_ImageCodecDDS = 1 << 0, + EPlugin_ImageCodecPNG = 1 << 1, + EPlugin_ImageCodecJPG = 1 << 2, + EPlugin_ImageCodecTGA = 1 << 3, + EPlugin_ImageCodecTIFF = 1 << 4, + EPlugin_ImageCodecPKM = 1 << 5, + EPlugin_ImageCodecPVR = 1 << 6, + EPlugin_ImageCodecHDR = 1 << 7, + EPlugin_ImageCodecEXR = 1 << 8, + + EPlugin_MeshCodecFBX = 1 << 16, + EPlugin_MeshCodecGranny = 1 << 17, + + EPlugin_CompilerBackendVM = 1 << 20, + EPlugin_CompilerBackendISPC = 1 << 21, + EPlugin_CompilerBackendD3D = 1 << 22, + EPlugin_CompilerBackendPSSLC = 1 << 23, + + // All "base" plugins + EPlugin_Default = EPlugin_CompilerBackendVM | + EPlugin_CompilerBackendD3D | + EPlugin_ImageCodecDDS | + EPlugin_ImageCodecPNG | + EPlugin_ImageCodecJPG | + EPlugin_ImageCodecTGA | + EPlugin_ImageCodecHDR, +}; + +//---------------------------------------------------------------------------- + +// loads selected plugins. set 'selected' to a bitwise combinations of the above plugin flags. must be matched by a call to 'UnregisterPlugins' +bool PopcornRegisterPlugins(u32 selected = 0); + +// unloads all previously loaded plugins +void PopcornUnregisterPlugins(); + +//---------------------------------------------------------------------------- +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_RenderContext.h b/AE_GeneralPlugin/Include/AEGP_RenderContext.h new file mode 100644 index 00000000..9fb4ebc5 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_RenderContext.h @@ -0,0 +1,120 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_RENDERCONTEXT_H__ +#define __FX_RENDERCONTEXT_H__ + +#include "AEGP_Define.h" + +#include +#include +#include + +#include + +#include +#include + +//---------------------------------------------------------------------------- + +namespace AAePk +{ + struct SAAEIOData; +} + +__AEGP_PK_BEGIN + +class CAAEBaseContext; +PK_FORWARD_DECLARE(AAERenderContext); + +//---------------------------------------------------------------------------- + +class CAAERenderContext : public CRefCountedObject +{ +public: + CAAERenderContext(); + ~CAAERenderContext(); + + bool InitializeIFN(RHI::EGraphicalApi api, const CString &className); + bool InitGraphicContext(RHI::EPixelFormat rhiformat, u32 width, u32 height); + bool Destroy(); + + CAAEBaseContext *GetAEGraphicContext(); + + PKSample::CRHIParticleSceneRenderHelper *GetCurrentSceneRenderer(); + CUint2 GetViewportSize() const; + void *GetWindowHandle() { return m_WindowHandle; } + + void LogGraphicsErrors(); + + void SetShaderLoader(PKSample::CShaderLoader *sl); + PKSample::CShaderLoader *GetShaderLoader(); + void SetPostFXOptions(PKSample::SParticleSceneOptions &so); + + bool SetAsCurrentContext(); + + void SetBackgroundOptions(bool isOverride, float alphaValue) { m_IsOverride = isOverride; m_AlphaValue = alphaValue; } + void SetGamma(float gamma) { m_Gamma = gamma; } + + bool RenderFrameBegin(u32 width, u32 height); + bool RenderFrameEnd(); + + bool AERenderFrameBegin (SAAEIOData &AAEData, bool getBackground = true); + bool AERenderFrameEnd (SAAEIOData &AAEData); + bool RenderToSAAEWorld (SAAEIOData &AAEData, AEGP_SuiteHandler &suiteHandler, PF_EffectWorld *inputWorld, PF_EffectWorld *effectWorld, PF_PixelFormat format); + bool GetCompositingBuffer(SAAEIOData &AAEData, AEGP_SuiteHandler &suiteHandler, PF_EffectWorld *inputWorld, PF_EffectWorld *effectWorld, PF_PixelFormat format); + + CUint2 GetContextSize(); + +private: + bool CreateInternalWindowIFN(const CString& className); + + void *m_WindowHandle; + void *m_DeviceContext; + + u32 m_Width; + u32 m_Height; + + RHI::EGraphicalApi m_API; + + static Threads::CCriticalSection m_AEGraphicContextLock; + static CAAEBaseContext *m_AEGraphicContext; + + RHI::EPixelFormat m_Format; + PF_PixelFormat m_AAEFormat; + + bool m_Initialized; + + float m_Gamma = 1.0f; + bool m_IsOverride = false; + float m_AlphaValue = 1.0f; + + PKSample::CRHIParticleSceneRenderHelper *m_RHIRendering; + + //Shared between rendercontexts + PKSample::CShaderLoader *m_ShaderLoader; + + PKSample::SParticleSceneOptions m_SceneOptions; + + PRefCountedMemoryBuffer m_UploadBuffer = null; + u32 m_UploadBufferSize = 0; + + PRefCountedMemoryBuffer m_DownloadBuffer = null; + u32 m_DownloadBufferSize = 0; + +private: + void ResetCheckedOutWorlds(SAAEIOData &AAEData); + + PF_EffectWorld *m_InputWorld = null; + PF_EffectWorld *m_OutputWorld = null; + +}; +PK_DECLARE_REFPTRCLASS(AAERenderContext); + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_Scene.h b/AE_GeneralPlugin/Include/AEGP_Scene.h new file mode 100644 index 00000000..d43adcb7 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_Scene.h @@ -0,0 +1,316 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AAESCENE_H__ +#define __FX_AAESCENE_H__ + +#include "AEGP_Define.h" + +#include "AEGP_RenderContext.h" +#include "AEGP_FrameCollector.h" + +#include + +#include + +#include + +#include +#include +#include + +#include "AEGP_Attribute.h" +#include "AEGP_ParticleScene.h" + +#include + +//---------------------------------------------------------------------------- + +__PK_API_BEGIN +PK_FORWARD_DECLARE(SkeletonState); +__PK_API_END + +__AAEPK_BEGIN + +struct SEmitterDesc; + +__AAEPK_END + + +__AEGP_PK_BEGIN + +PK_FORWARD_DECLARE(AAERenderContext); +PK_FORWARD_DECLARE(SkinnedMeshInstance); + +// Forward declare our simple scene definition +struct SSimpleSceneDef; +struct SLayerHolder; + +struct SSamplerAudio; +struct SPendingAttribute; + +//---------------------------------------------------------------------------- + +struct SAAEWorld +{ + CFloat3 m_WorldOrigin; + float m_WorldWidth = -1.0f; + float m_WorldHeight = -1.0f; +}; + +//---------------------------------------------------------------------------- + +struct SRendererProperties +{ + CString m_Name; + CString m_Value; + + CString m_EffectLayerName; + u32 m_EffectLayerUID; + + CStringId m_LayerID; + + u32 m_RendererUID; + u32 m_PropertyUID; + + + SRendererProperties(const CString &name, const CString &value, const CString &effectLayerName, u32 effectLayerUID, CStringId layerID, u32 rdrUID, u32 propUID) + : m_Name(name) + , m_Value(value) + , m_EffectLayerName(effectLayerName) + , m_EffectLayerUID(effectLayerUID) + , m_LayerID(layerID) + , m_RendererUID(rdrUID) + , m_PropertyUID(propUID) + { + + } +}; + +PK_FORWARD_DECLARE(AAEScene); + +//---------------------------------------------------------------------------- + +class CAAEScene : public CRefCountedObject +{ +public: + + struct SSkinnedDataSimple + { + struct SSkinnedDataSubMesh + { + u32 m_SubMeshID; + TStridedMemoryView m_Positions; + TStridedMemoryView m_Normals; + SSkinnedDataSubMesh() : m_SubMeshID(0) {} + }; + + bool m_Valid; + TSemiDynamicArray m_SubMeshes; + + SSkinnedDataSimple() : m_Valid(false) {} + }; +public: + static u32 s_SceneID; + u32 m_ID; +public: + CAAEScene(); + virtual ~CAAEScene(); + + bool Init(SAAEIOData &AAEData); + bool Quit(); + static void ShutdownPopcornFX(); + + bool Update(SAAEIOData &AAEData); + bool UpdateLight(SLayerHolder *layer); + bool UpdateAttributes(SLayerHolder *layer); + + void UpdateBackdropTransform(SEmitterDesc *desc); + bool UpdateBackdrop(SLayerHolder *layer, SEmitterDesc *desc); + bool Render(SAAEIOData &AAEData); + + bool ResetEffect(bool unload); + + TArray &GetRenderers() { return m_OverridableProperties; } + HBO::CContext *GetContext() { return m_HBOContext; } + bool GetEmitterBounds(CAABB &bounds); + + void SetLayerHolder(SLayerHolder *parent); + void SetCameraViewMatrix(const CFloat4x4 &viewMatrix, const CFloat4 &pos, const float cameraZoom); + + void SetWorldSize(SAAEIOData &AAEData); + void SetEmitterPosition(const CFloat3 &position, ETransformType type); + void SetEmitterRotation(const CFloat3 &rotation); + void SetEmitterTeleport(bool teleport = true); + + bool SetupScene(bool seeking, bool refresh); + + //Pack&Effect Management + bool SetPack(PFilePack pack, bool unload); + bool SetSelectedEffect(CString name, bool refresh); + + void SetEffectDescriptor(SEmitterDesc* desc); + + bool RefreshAssetList(); + + SSamplerAudio *GetAudioSamplerDescriptor(CStringId name, SSamplerAudio::SamplingType type); + + void SetSeeking(bool seekingEnabled) { m_SeekingEnabled = seekingEnabled; } + void SetSkinnedBackdropParams(bool enabled, bool weightedSampling, u32 colorStreamID, u32 weightStreamID); + +protected: + bool _LateInitializeIFN(); + bool _SetupMediumCollection(); + void _FastForwardSimulation(SAAEIOData &AAEData, float timeTarget); + bool _UpdateShapeSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc* descriptor); + bool _UpdateTextSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc* descriptor); + bool _UpdateImageSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc* descriptor); + bool _UpdateAudioSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc* descriptor); + bool _UpdateVectorFieldSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc* descriptor); + bool _SeekingUpdateEffect(float dt, float elapsedTime, float timeTarget, u32 curUpdateIdx, u32 totalUpdatesCount); + void _SeekingLoadAndRunEffect(CParticleMediumCollection *mediumCollection, + const CParticleEffect *effect, + const CFloat4x4 &transform, + float timeFromStartOfFrame, + float timeToEndOfFrame, + float elapsedTime); + bool _SeekingWaitForUpdateFence(CTimer *waitTimer, float customMaxUpdateTime = -1.0f); + u32 _PickNewEffectSeed(); + + // Scene + bool _LoadScene(const SSimpleSceneDef &fxPath); + void _CollectCurrentFrame(); + void _RenderLastCollectedFrame(); + + void _UpdateEmitter(float dt); + void _UpdateCamera(); + void _UpdateMediumCollectionView(); + + void _OnUpdateComplete(CParticleMediumCollection *collection); + + // Effects + bool _LoadEffectIFN(const SSimpleSceneDef &sceneDef); + PParticleEffectInstance _InstantiateEffect(); + PParticleEffectInstance _InstantiateEffect(float timeFromStartOfFrame, float timeToEndOfFrame); + void _OnInstanceDeath(const PParticleEffectInstance &instance); + + bool _RebuildAttributes(const SSimpleSceneDef &sceneDef); + + void _ExtractAEFrameInfo(SAAEIOData &AAEData); + bool _CheckRenderAbort(SAAEIOData *AAEData); + // Camera + void _SetProj(float fovxDegrees, const CFloat2 &winDimPixel, float zNear, float zFar); + + void _FillAdditionnalDataForRender(); +public: + // GPU Sim +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0 || PK_PARTICLES_UPDATER_USE_D3D11 != 0) + static bool SimDispatchMask(const PopcornFX::CParticleDescriptor *descriptor, PopcornFX::SSimDispatchHint &outHint); + void D3D12_EnqueueTask(const PopcornFX::PParticleUpdaterTaskD3D12 &task); +#endif + +protected: + //World + SAAEWorld m_SAAEWorldData; + PF_ProgPtr m_EffectRef; + SEmitterDesc *m_EffectDesc; + + SLayerHolder *m_LayerHolder; + + CFloat3 m_EmitterDefaultPosition; + CFloat3 m_EmitterDefaultOrientation; + + ETransformType m_EmitterTransformType; + CFloat4x4 m_EmitterTransformsCurrent; + CFloat4x4 m_EmitterTransformsPrevious; + CFloat3 m_EmitterVelCurrent; + CFloat3 m_EmitterVelPrevious; + + CUint2 m_OriginViewport; + + bool m_Paused; + + //AE Interface + CFloat3 m_AEEmitterPosition; + CFloat3 m_AEEmitterRotation; + u32 m_AEEmitterSeed; + + CFloat4x4 m_AEViewMatrix; + CFloat4 m_AECameraPos; + float m_AECameraZoom; + bool m_TeleportEmitter; + + u32 m_FrameNumber; + float m_DT; + float m_PreviousTimeSec; + float m_CurrentTimeSec; + + bool m_Initialized; + bool m_SeekingEnabled; + + A_Err m_FrameAbortedDuringSeeking; + + PKSample::SCamera m_Camera; + + PParticleEffect m_Effect; + + PBaseObjectFile m_EffectFile; + CString m_EffectPath; + PParticleEffectInstance m_EffectLastInstance; + + PParticleAttributeList m_AttributesList; + + TArray m_ActiveAudioSamplers; + + CFloat4 m_EmitterPositionNormalized_Debug; + CFloat4x4 m_LastInstanceXForms; + float m_ElapsedTimeSinceLastSpawn; + + PKSample::CRHIParticleRenderDataFactory m_ParticleRenderDataFactory; + CFrameCollector m_FrameCollector; + PKSample::SRHIDrawOutputs m_DrawOutputs; + EDrawCallSortMethod m_DCSortMethod; + + PKSample::SSceneInfoData m_SceneInfoData; + RHI::PConstantSet m_SceneInfoConstantSet; + RHI::PGpuBuffer m_SceneInfoConstantBuffer; + + CString m_SelectedEffect; + + PFilePack m_LoadedPack; + + HBO::CContext *m_HBOContext; + CAAEParticleScene *m_ParticleScene; + CParticleMediumCollection *m_ParticleMediumCollection; + float m_Stats_SimulationTime; + + CGuid m_ViewSlotInMediumCollection; + PKSample::SBackdropsData m_BackdropData; + + TResourcePtr m_ResourceMesh; + PSkinnedMeshInstance m_SkinnedMeshInstance; + PSkeletonState m_SkeletonState; + TArray m_FXInstancesSkinnedData; + + CResourceManager *m_ResourceManager; + + //Skinned Mesh Sampling + bool m_HasBoundBackdrop; + bool m_IsWeightedSampling; + u32 m_ColorStreamID; + u32 m_WeightStreamID; + SAAEIOData *m_AAEDataForSeeking; + +private: + TArray m_OverridableProperties; + bool m_ForceRestartSeeking; +}; +PK_DECLARE_REFPTRCLASS(AAEScene); + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_SkinnedMesh.h b/AE_GeneralPlugin/Include/AEGP_SkinnedMesh.h new file mode 100644 index 00000000..529b6509 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_SkinnedMesh.h @@ -0,0 +1,122 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_SKINNEDMESH_H__ +#define __AEGP_SKINNEDMESH_H__ + +#include "AEGP_Define.h" + +#include +#include + +// For skinned mesh backdrops +#include +#include +#include + +//---------------------------------------------------------------------------- + +namespace PopcornFX +{ + PK_FORWARD_DECLARE(SkeletonState); + PK_FORWARD_DECLARE(ResourceMeshBatch); +} + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +enum EMeshChannels +{ + Channel_Position = 0x1, + Channel_Normal = 0x2, + Channel_Tangent = 0x4, + Channel_Velocity = 0x8, +}; + +//---------------------------------------------------------------------------- + +class CSkinnedMesh : public CRefCountedObject +{ +protected: + PSkeletonState m_SkeletonState; + CTimeline m_Timeline; + + struct SSubMesh + { + PCResourceMeshBatch m_SkeletalMesh; + PSkeletonState m_SkeletonState; + CSkinAsyncContext m_SkinUpdateContext; + SSamplerSourceOverride m_SampleSourceOverride; + void *m_RawSkinnedData = null; + u32 m_RawSkinnedDataElementCount = 0; + TStridedMemoryView m_Positions; // view inside 'm_RawSkinnedData' + TStridedMemoryView m_Normals; // view inside 'm_RawSkinnedData' + TStridedMemoryView m_Tangents; // view inside 'm_RawSkinnedData' + TStridedMemoryView m_OldPositions; // view inside 'm_RawSkinnedData' + TStridedMemoryView m_Velocities; // view inside 'm_RawSkinnedData' + float m_SkinDt; // accessed by skinning jobs + bool m_FirstFrame; + + ~SSubMesh() + { + PK_FREE(m_RawSkinnedData); + } + + bool Empty() const { return m_SkeletalMesh == null; } + + void Skin_PreProcess(u32 vertexStart, u32 vertexCount, const SSkinContext &ctx); + void Skin_PostProcess(u32 vertexStart, u32 vertexCount, const SSkinContext &ctx); + }; + + TArray m_SubMeshes; + + float m_SkinDt; // accessed by skinning jobs + bool m_FirstFrame; + u32 m_SamplingChannels; + + bool _Init_Impl(const TResourcePtr &meshResource, u32 samplingChannels, const PSkeletonState &srcSkeletonState); + +public: + CSkinnedMesh(); + ~CSkinnedMesh(); + + void Reset(); + bool Init(const TResourcePtr &meshResource, u32 samplingChannels, const PSkeletonState &srcSkeletonState); + bool Play(const PSkeletonAnimationInstance &animInstance); + void Stop(); + void Update(float dt); + bool Valid() const { return m_SkeletonState != null; } + // void Render(); + void StartAsyncUpdateSkin(float dt); + bool WaitAsyncUpdateSkin(); + void ClearVelocities(); + + u32 SubMeshCount() const { return m_SubMeshes.Count(); } + TStridedMemoryView Positions(u32 batchId) const { return m_SubMeshes[batchId].m_Positions; } + TStridedMemoryView Normals(u32 batchId) const { return m_SubMeshes[batchId].m_Normals; } + + u32 SamplingChannels() const { return m_SamplingChannels; } + + // CMeshAnimRenderer &Renderer() { return m_Renderer; } + PSkeletonState SkeletonState() { return m_SkeletonState; } + bool HasGeometry() const + { + for (const auto &mesh : m_SubMeshes) + { + if (mesh.m_SkeletalMesh != null && mesh.m_SkeletalMesh->RawMesh() != null && !mesh.m_SkeletalMesh->RawMesh()->TriangleBatch().Empty()) + return true;; + } + return false; + } + SSamplerSourceOverride *SamplerSourceOverride(u32 batchId) { return &m_SubMeshes[batchId].m_SampleSourceOverride; } +}; +PK_DECLARE_REFPTRCLASS(SkinnedMesh); + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_SkinnedMeshInstance.h b/AE_GeneralPlugin/Include/AEGP_SkinnedMeshInstance.h new file mode 100644 index 00000000..1df464a7 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_SkinnedMeshInstance.h @@ -0,0 +1,82 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_SKINNEDMESHINSTANCE_H__ +#define __AEGP_SKINNEDMESHINSTANCE_H__ + +#include "AEGP_Define.h" + +#include + +#include +#include +#include +#include + +//---------------------------------------------------------------------------- + +__PK_API_BEGIN + +PK_FORWARD_DECLARE(SkeletonAnimationInstance); +PK_FORWARD_DECLARE(ParticleSamplerDescriptor_Shape); +PK_FORWARD_DECLARE(MeshSurfaceSamplerStructuresRandom); +PK_FORWARD_DECLARE(MeshVolumeSamplerStructuresRandom); +PK_FORWARD_DECLARE(ResourceMesh); + +namespace HBO { + class CContext; +} +__PK_API_END + +__AEGP_PK_BEGIN + +PK_FORWARD_DECLARE(SkinnedMesh); + +//---------------------------------------------------------------------------- + +class CSkinnedMeshInstance : public CRefCountedObject +{ +public: + PSkeletonAnimationInstance m_SkeletonAnimationInstance; + CString m_CurrentAnimationPath; + PSkinnedMesh m_SkinnedMesh; + PParticleSamplerDescriptor_Shape m_ShapeDescOverride; + + CMeshSurfaceSamplerStructuresRandom *m_SurfaceSamplingStruct = null; + CMeshVolumeSamplerStructuresRandom *m_VolumeSamplingStruct = null; + + CFloat4x4 m_CurMeshTransformScaled; + CFloat4x4 m_CurMeshTransform; + CFloat4x4 m_PrevMeshTransform; + +public: + CSkinnedMeshInstance(); + ~CSkinnedMeshInstance(); + + CSkinnedMeshInstance &operator = (const CSkinnedMeshInstance &other); + + + void ResetXForms(const CFloat4x4 &backdropXForm); + void SetBackdropXForms(const CFloat4x4 &backdropXForm); + + CFloat3 PredictVelocity(float dt); + + void ResetAnimationCursor(); + + void Update(float dt); + void StartAsyncUpdateSkin(float dt); + bool WaitAsyncUpdateSkin(); + + void ClearSkinnedMesh(); + bool LoadSkinnedMeshIFN(const TResourcePtr &meshResource, u32 samplingChannels, const PSkeletonState &scrSkeletonState); + bool LoadAnimationIFN(HBO::CContext *context, const CString &pksaPath, bool forceReload); + bool SetupAttributeSampler(CMeshNew *srcMesh, bool weightedSampling, u32 weightedSamplingColorStreamId, u32 weightedSamplingChannelId); +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_System.h b/AE_GeneralPlugin/Include/AEGP_System.h new file mode 100644 index 00000000..63a3c71d --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_System.h @@ -0,0 +1,60 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once +#include "AEGP_Define.h" + +#include +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +struct SEditorExecutable +{ + CString m_BinaryPathUninstall; + CString m_BinaryPath; + SEngineVersion m_Version; + + SEditorExecutable() {} + SEditorExecutable(const CString &path, const CString &uninstallerPath, const SEngineVersion &version) + : m_BinaryPathUninstall(uninstallerPath) + , m_BinaryPath(path) + , m_Version(version) + { + + } + + bool operator < (const SEditorExecutable &other) const { return m_Version < other.m_Version; } +}; + +//---------------------------------------------------------------------------- + +class CSystemHelper +{ +public: // Get Hardware ID + static const CString GetUniqueHardwareID(); + static const CString GetUniqueHardwareIDForHuman(); + + static bool LaunchEditorAsPopup(); + +private: + static u16 *_ComputeSystemUniqueId(); + + static void _Smear(u16 *id); + static void _Unsmear(u16 *id); + + static u16 _GetMacHash(); + + static u16 _GetCPUHash(); + static const char *_GetMachineName(); + +private: + CSystemHelper() = delete; + ~CSystemHelper() = delete; +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Include/AEGP_UpdateAEState.h b/AE_GeneralPlugin/Include/AEGP_UpdateAEState.h new file mode 100644 index 00000000..8e2d7dcc --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_UpdateAEState.h @@ -0,0 +1,90 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_UPDATEAESTATE_H__ +#define __AEGP_UPDATEAESTATE_H__ + +#include "AEGP_Define.h" +#include "PopcornFX_Suite.h" + +#include "AEGP_World.h" + +#include +#include +#include +#include +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +struct SLayerHolder; +struct SPendingAttribute; + +//---------------------------------------------------------------------------- + +class CAEUpdater +{ +public: + static A_Err UpdateLayerAtTime(SLayerHolder *targetLayer, float time, bool isSeeking); + + static bool GetLightsAtTime(SLayerHolder *layer, A_Time &AETime, TArray &lights); + static bool GetCameraViewMatrixAtTime(SLayerHolder *layer, CFloat4x4 &view, CFloat4 &pos, A_Time &AETime, float &cameraZoom); + + static int s_AttributeIndexes[__Attribute_Parameters_Count]; + static int s_EmitterIndexes[__Effect_Parameters_Count]; + static int s_SamplerIndexes[__AttributeSamplerType_Parameters_Count]; +private: + CAEUpdater(); + ~CAEUpdater(); + + static A_Err _UpdateLayerAtTime(SLayerHolder *targetLayer, A_Time &AETime, bool isSeeking); + + static A_Err _UpdateSamplerAtTime(SLayerHolder *targetLayer, SPendingAttribute *sampler, AEGP_EffectRefH effect, A_Time &AETime, bool isSeeking); + static A_Err _UpdateAttributeAtTime(SLayerHolder *targetLayer, SPendingAttribute *attribute, AEGP_EffectRefH effect, A_Time &AETime, bool isSeeking); + static A_Err _UpdateEmitterAtTime(SLayerHolder *layer, AEGP_EffectRefH effectRef, A_Time &AETime, bool isSeeking); + static bool _SetupAudioSampler(SLayerHolder *targetLayer, AEGP_LayerIDVal layerID, A_Time &AETime, SSamplerAudio *samplerAudio, bool isSeeking); + + template + static A_Err _GetParamsStreamValueAtTime(s32 idx, AEGP_EffectRefH effectRef, A_Time &AETime, T &out) + { + A_Err result = A_Err_NONE; + CPopcornFXWorld &PKFXWorld = CPopcornFXWorld::Instance(); + AEGP_SuiteHandler suites(PKFXWorld.GetAESuites()); + AEGP_StreamRefH streamHandler; + AEGP_StreamValue2 value; + AEGP_StreamType stream_type; + + result |= suites.StreamSuite5()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, idx, &streamHandler); + + AEFX_CLR_STRUCT(value); + if (!PK_VERIFY(streamHandler != null)) + return result; + + result |= suites.StreamSuite5()->AEGP_GetStreamType(streamHandler, &stream_type); + if (AEGP_StreamType_NO_DATA == stream_type) + { + PK_ASSERT_NOT_REACHED(); + result |= suites.StreamSuite5()->AEGP_DisposeStream(streamHandler); + return result; + } + result |= suites.StreamSuite5()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + + out = *reinterpret_cast(&value.val.one_d); + + result |= suites.StreamSuite5()->AEGP_DisposeStreamValue(&value); + result |= suites.StreamSuite5()->AEGP_DisposeStream(streamHandler); + + return result; + } +}; + +//---------------------------------------------------------------------------- + + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_VaultHandler.h b/AE_GeneralPlugin/Include/AEGP_VaultHandler.h new file mode 100644 index 00000000..78103e2d --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_VaultHandler.h @@ -0,0 +1,99 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_VAULHANDLER_H__ +#define __AEGP_VAULHANDLER_H__ + +#include + +#include "AEGP_Define.h" +#include "AEGP_FileWatcher.h" + +#include +#include + +//---------------------------------------------------------------------------- + +namespace AAePk +{ + struct SAttributeSamplerDesc; +} + +__AEGP_PK_BEGIN + +PK_DECLARE_REFPTRCLASS(LogListenerFile); + +//---------------------------------------------------------------------------- + +struct SResourceBakeConfig +{ + bool m_StraightCopy = false; + bool m_IsAnimTrack = false; + bool m_IsSkeletalAnim = false; +}; + +//---------------------------------------------------------------------------- + +class CVaultHandler +{ +public: + CVaultHandler(); + ~CVaultHandler(); + + bool InitializeIFN(); + bool ShutdownIFN(); + //func ptr callback for the file watcher + static void FileAdded(const CString &path); + static void FileRemoved(const CString &path); + static void FileChanged(const CString &path); + static void FileChangedRelativePath(const CString &path); + static void FileRenamed(const CString &oldPath, const CString &newPath); + + bool IsBakedAssetLatestVersion(const CString &srcPath, const CString &dstPath); + bool LoadEffectIntoVault(const CString &packPath, CString &effectPath, const CString &pkprojPath, bool &refresh); + CString ImportResource(const CString resourcePath); + + CString CopyResource(const CString resourcePath); + + CString BakeVectorField(const CString resourcePath, const CString targetPath, const SResourceBakeConfig &config); + CString BakeMesh(const CString resourcePath, const CString targetPath, const SResourceBakeConfig &config); + CString BakeResource(const CString resourcePath, const SResourceBakeConfig &config); + + PFilePack GetVaultPackFromPath(CString path); + + const CString VaultPathRoot() const { return m_VaultPathRoot; }; + const CString VaultPathAssets() const { return m_VaultPathAssets; }; + const CString VaultPathCache() const { return m_VaultPathCache; }; + const CString VaultPathLog() const { return m_VaultPathLogs; }; + PFilePack InternalPack() const { return m_InternalPack; }; +private: + + bool _SetupVault(); +private: + + bool m_Initialized = false; + + PFileWatcher m_FileWatcher = null; + + PLogListenerFile m_AELogFileListener = null; + + PFilePack m_InternalPack = null; + + CString m_VaultPathRoot = ""; + CString m_VaultPathAssets = ""; + CString m_VaultPathCache = ""; + CString m_VaultPathLogs = ""; + + static const char *k_VaultFolderMainName; + static const char *k_VaultFolderAssetsName; + static const char *k_VaultFolderCacheName; + static const char *k_VaultFolderLogsName; +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_WinFileDialog.h b/AE_GeneralPlugin/Include/AEGP_WinFileDialog.h new file mode 100644 index 00000000..46c22aa2 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_WinFileDialog.h @@ -0,0 +1,111 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#if defined(PK_WINDOWS) + +#include +#include + +using namespace PopcornFX; + +//---------------------------------------------------------------------------- + +struct SWinFileDialogFilterData +{ + wchar_t *m_Desc; + wchar_t *m_Type; + + COMDLG_FILTERSPEC m_Spec; + + SWinFileDialogFilterData(const CString desc, const CString type) + : m_Desc(null) + , m_Type(null) + { + convert(&m_Desc, desc); + convert(&m_Type, type); + + m_Spec.pszName = m_Desc; + m_Spec.pszSpec = m_Type; + } + + // Simple move assignment operator + SWinFileDialogFilterData(SWinFileDialogFilterData&& other) + { + m_Desc = other.m_Desc; + m_Type = other.m_Type; + + m_Spec.pszName = m_Desc; + m_Spec.pszSpec = m_Type; + + other.m_Desc = null; + other.m_Type = null; + } + + SWinFileDialogFilterData& operator=(SWinFileDialogFilterData&& other) + { + m_Desc = other.m_Desc; + m_Type = other.m_Type; + + m_Spec.pszName = m_Desc; + m_Spec.pszSpec = m_Type; + + other.m_Desc = null; + other.m_Type = null; + return *this; + } + + ~SWinFileDialogFilterData() + { + if (m_Desc != null) + PK_FREE(m_Desc); + if (m_Type != null) + PK_FREE(m_Type); + } + + void convert(wchar_t **dst, const CString& desc) + { + const int wideStringLength = ::MultiByteToWideChar(CP_UTF8, 0, desc.Data(), -1, NULL, 0); + if (!PK_VERIFY(wideStringLength >= 0)) + return; + *dst = PK_TALLOC(wideStringLength); + if (!PK_VERIFY(*dst != null)) + return; + + ::MultiByteToWideChar(CP_UTF8, 0, desc.Data(), -1, *dst, wideStringLength); + } +}; + +//---------------------------------------------------------------------------- + +struct SWinFileOpenData +{ + TArray m_Filters; + PopcornFX::FastDelegate m_Cb; + + SWinFileOpenData() + { + } + + + ~SWinFileOpenData() + { + } + + bool AddFilter(const CString &desc, const CString &type) + { + //SWinFileDialogFilterData filterData(desc, type); + if (!PK_VERIFY(m_Filters.PushBack(SWinFileDialogFilterData(desc, type)).Valid())) + return false; + return true; + } +}; + +//---------------------------------------------------------------------------- + +HRESULT WinBasicFileOpen(SWinFileOpenData& data); + +//---------------------------------------------------------------------------- + +#endif diff --git a/AE_GeneralPlugin/Include/AEGP_WinSystem.h b/AE_GeneralPlugin/Include/AEGP_WinSystem.h new file mode 100644 index 00000000..61616ccc --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_WinSystem.h @@ -0,0 +1,34 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once +#include "AEGP_Define.h" +#include "AEGP_System.h" + +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +#if defined(PK_WINDOWS) + +class CWinSystemHelper +{ +private: + CWinSystemHelper() = delete; + ~CWinSystemHelper() = delete; +public: + static CString GetLastErrorAsString(); + static CString GetLastErrorAsString(TArray &ignore); + static CString _GetWindowsInstallDir(); + static TArray _FindInstalledVersions(const CString &baseSearchPath); + + static SEditorExecutable GetMatchingEditor(const SEngineVersion &version); +}; + +#endif + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Include/AEGP_World.h b/AE_GeneralPlugin/Include/AEGP_World.h new file mode 100644 index 00000000..5ac41b71 --- /dev/null +++ b/AE_GeneralPlugin/Include/AEGP_World.h @@ -0,0 +1,322 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_WORLD_H__ +#define __FX_WORLD_H__ + +#include + +#include +#if defined(PK_MACOSX) +# include +#endif +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + + +#include "AEGP_Define.h" +#include "AEGP_Attribute.h" +#include "AEGP_Scene.h" +#include "AEGP_LayerHolder.h" +#include "AEGP_VaultHandler.h" + +#include + +#include + +//---------------------------------------------------------------------------- + +namespace AAePk +{ + struct SAAEIOData; + struct SAttributeDesc; + struct SAttributeSamplerDesc; + struct SEmitterDesc; +} + +namespace PopcornFX +{ + PK_FORWARD_DECLARE(LogListenerFile); +} + + +__AEGP_PK_BEGIN +//---------------------------------------------------------------------------- + +PK_FORWARD_DECLARE(EffectBaker); +PK_FORWARD_DECLARE(AAERenderContext); + +class CPanelBaseGUI; + +//---------------------------------------------------------------------------- + +struct SUIEvent +{ + virtual ~SUIEvent() {}; + virtual bool Exec() = 0; +}; + +//---------------------------------------------------------------------------- + +struct SUIEventString : public SUIEvent +{ + SLayerHolder *m_TargetLayer; + CString m_Data; + PopcornFX::FastDelegate m_Cb; + + virtual bool Exec() override + { + return m_Cb(m_TargetLayer, m_Data); + } +}; + +//---------------------------------------------------------------------------- + +struct SAEPreferenciesKeys +{ + static constexpr const char *kSection = "AEPocornFX"; + static constexpr const char *kApi = "Api"; + + static constexpr const EApiValue kSupportedAPIs[] = + { +#if PK_BUILD_WITH_D3D12_SUPPORT != 0 + EApiValue::D3D11, +#endif +#if PK_BUILD_WITH_D3D11_SUPPORT != 0 + EApiValue::D3D12, +#endif +#if PK_BUILD_WITH_METAL_SUPPORT != 0 + EApiValue::Metal, +#endif + }; + static constexpr const char *kApiNames[EApiValue::Size] = { "Unknown", "DirectX 11", "DirectX 12", "Metal" }; + + static const char *GetGraphicsApiAsCharPtr(EApiValue value); + static const char *GetGraphicsApiAsCharPtr(RHI::EGraphicalApi value); +}; + +//---------------------------------------------------------------------------- + +class HBO_CLASS(CAEPProjectProperties), public CBaseObject +{ +public: + HBO_FIELD(CString, ProjectName); + HBO_FIELD(TArray, LayerProperties); + +public: + CAEPProjectProperties(); + ~CAEPProjectProperties(); + + HBO_CLASS_DECLARATION(); +}; +PK_DECLARE_REFPTRCLASS(AEPProjectProperties); + +//---------------------------------------------------------------------------- + +class CPopcornFXWorld +{ +public: + ~CPopcornFXWorld(); + static CPopcornFXWorld &Instance(); + + bool Setup(SPBasicSuite *pica_basicP, AEGP_PluginID id); + bool SetCommandHandle(AEGP_Command &command, const char *name); + + AEGP_PluginID GetPluginID(); + SPBasicSuite *GetAESuites(); + + bool FetchAEProject(); + + RHI::EGraphicalApi GetRenderApi(); + void SetRenderApi(EApiValue AEGraphicsApi); + + bool IdleUpdate(); + bool HandleNewAttributeEvent(PF_ProgPtr &effectRef, SAttributeDesc *desc, bool asyncMerge = true, SLayerHolder *layer = null); + bool HandleNewAttributeSamplerEvent(PF_ProgPtr &effectRef, SAttributeSamplerDesc *desc, bool asyncMerge = true, SLayerHolder *layer = null); + bool HandleNewAttributes(TArray &attributes, PF_ProgPtr &effectRef, SLayerHolder *layer, bool asyncMerge = true); + + void CreatePanel(AEGP_PlatformViewRef container, AEGP_PanelH panelH, AEGP_PanelFunctions1 *outFunctionTable, AEGP_PanelRefcon *outRefcon); + void Command(AEGP_Command command, AEGP_HookPriority hookPriority, A_Boolean alreadyHandled, A_Boolean *handledPB); + void UpdateMenu(AEGP_WindowType activeWindow); + + void ClearAttributesAndSamplers(SLayerHolder *layer); + + CStringId GetAEEffectID(AEGP_EffectRefH &effect, s32 paramIdx); + + CStringId GetAttributeID(AEGP_EffectRefH &effect); + CStringId GetAttributeID(SAttributeBaseDesc *desc); + + CStringId GetAttributeSamplerID(AEGP_EffectRefH &effect); + + s32 _ExecSPendingEmitters(SLayerHolder *layer); + + s32 _ExecSPendingAttributes(SLayerHolder *layer); + s32 _ExecClearAttributes(SLayerHolder *layer); + + bool _ExecDeleteAttribute(SPendingAttribute *attribute, AEGP_EffectRefH &effectRef); + bool _ExecDeleteAttributeSampler(SPendingAttribute *attribute, AEGP_EffectRefH &effectRef); + + bool _SetupAutoRender(AEGP_EffectRefH &effect); + + bool _GetAEPath(AEGP_GetPathTypes type, CString &dst); + + //Pack Management + bool SetDestinationPackFromPath(SLayerHolder &layer, const CString &packPath); + + CString GetPluginInstallationPath(); + CString GetInternalPackPath(); + CString GetResourcesPath(); + + CString GetPluginVersion() const; + AEGP_InstalledEffectKey GetPluginEffectKey(EPKChildPlugins type) const; + + void SetWorkerCount(u32 count) { m_WorkerCount = count; } + u32 GetWorkerCount() const { return m_WorkerCount; } + + CVaultHandler &GetVaultHandler() { return m_VaultHandler; } + + void RefreshAssetList(); + + TArray &GetLayers() { return m_Layers; } + SLayerHolder *GetLayerForSEmitterDesc(SEmitterDesc *desc); + SLayerHolder *GetLayerForSEmitterDescID(CStringId id); + + bool SetSelectedEffectAsync(SLayerHolder *targetLayer, CString &name); + bool SetSelectedEffectFromPath(SEmitterDesc *desc, CString path, bool forceReload = false); + bool SetSelectedEffect(SLayerHolder *layer, CString &name); + bool SetEffectDefaultTransform(SLayerHolder *layer, const CFloat3 &pos, const CFloat3 &rot); + bool SetBackdropMeshDefaultTransform(SLayerHolder *layer); + + bool SetPanelInstance(CPanelBaseGUI *panel); + + //Suite + bool InitializeIFN(SAAEIOData &AAEData); + bool HandleNewEmitterEvent(AAePk::SAAEIOData &AAEData, SEmitterDesc *desc); + bool HandleDeleteEmitterEvent(AAePk::SAAEIOData &AAEData, SEmitterDesc *desc); + + bool CheckEmitterValidity(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor); + bool UpdateScene(SAAEIOData &AAEData, SEmitterDesc *desc); + bool UpdateEmitter(SAAEIOData &AAEData, SEmitterDesc *desc); + + bool InvalidateEmitterRender(SLayerHolder *layer, AEGP_EffectRefH effectRef); + bool InvalidateEmitterRender(SAAEIOData &AAEData, SEmitterDesc *desc); + + bool LaunchEditorAsPopup(AAePk::SAAEIOData &AAEData, SEmitterDesc *desc); + + bool ShutdownIFN(); + + void SetProfilingState(bool state); + + void SetParametersIndexes(const int *indexes, EPKChildPlugins plugin); + bool SetDefaultLayerPosition(SAAEIOData& AAEData, AEGP_LayerH layer); + bool MoveEffectIntoCurrentView(SAAEIOData &AAEData, SEmitterDesc *descriptor); + + PAAERenderContext GetCurrentRenderContext(); + + void OnEndSetupScene(); + + bool GetMostRecentCompName(CString &compName); + bool SetLayerName(SLayerHolder *layer); + bool SetLayerCompName(SLayerHolder *layer); + + const PBaseObjectFile &GetProjectConfFile(); + bool CreateLayerPropertyIFP(SLayerHolder *layer); + + bool SetResourceOverride(CStringId layerID, u32 rdrID, u32 propID, const CString &value); + bool WriteProjectFileModification(); + + //HOOK + static A_Err DeathHook(AEGP_GlobalRefcon pluginRefCon, AEGP_DeathRefcon refCon); + static A_Err IdleHook(AEGP_GlobalRefcon pluginRefCon, AEGP_IdleRefcon refCon, A_long *maxSleep); + + static A_Err CreatePanelHook(AEGP_GlobalRefcon pluginRefconP, + AEGP_CreatePanelRefcon refconP, + AEGP_PlatformViewRef container, + AEGP_PanelH panelH, + AEGP_PanelFunctions1 *outFunctionTable, + AEGP_PanelRefcon *outRefcon); + + static A_Err CommandHook( AEGP_GlobalRefcon plugin_refconP, + AEGP_CommandRefcon refconP, + AEGP_Command command, + AEGP_HookPriority hook_priority, + A_Boolean already_handledB, + A_Boolean *handledPB); + + static A_Err UpdateMenuHook( AEGP_GlobalRefcon plugin_refconP, + AEGP_UpdateMenuRefcon refconP, + AEGP_WindowType active_window); + + Threads::CCriticalSection &GetRenderLock() { return m_RenderLock; } + +private: + CPopcornFXWorld(); + + + static CPopcornFXWorld *m_Instance; + + bool m_Initialized; + + CString m_ClassName; + + TArray m_AAETreadID; + u32 m_WorkerCount; + + TArray m_Layers; + + Threads::CCriticalSection m_Lock; + + CPanelBaseGUI *m_Panel = null; + + SPBasicSuite *m_Suites; + AEGP_PluginID m_AEGPID; + AEGP_InstalledEffectKey m_PKInstalledPluginKeys[_PLUGIN_COUNT]; + + AEGP_Command m_Command = 42; + CString m_CommandName; + + RHI::EGraphicalApi m_GraphicsApi; + + CVaultHandler m_VaultHandler; + + //Developpement + float m_CameraZoom = 2000.0; + + PFilePack m_ProjectPack = null; + PBaseObjectFile m_ProjectConfFile = null; + PAEPProjectProperties m_ProjectProperty = null; + CString m_AEProjectFilename; + CString m_AEProjectPath; + PLogListenerFile m_AELogFileListener; + + CString m_PluginPath; + CString m_UserPluginPath; + CString m_AllUserPluginPath; + CString m_AEPath; + CString m_MostRecentCompName; + + + Threads::CCriticalSection m_UIEventLock; + TArray m_UIEvents; + + Threads::CCriticalSection m_RenderLock; +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif //!__FX_WORLD_H__ + diff --git a/AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h b/AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h new file mode 100644 index 00000000..e064ad6a --- /dev/null +++ b/AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h @@ -0,0 +1,163 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_GRAPHICALRESOURCESTREEMODEL_H__ +#define __AEGP_GRAPHICALRESOURCESTREEMODEL_H__ + +#include "AEGP_Define.h" + +#include "pk_kernel/include/kr_string_id.h" + +#include +#include +#include +#include +#include +#include + +//---------------------------------------------------------------------------- + +__AEGP_PK_BEGIN + +struct SRendererProperties; + +//---------------------------------------------------------------------------- + +class CGraphicResetButtonView +{ +public: + explicit CGraphicResetButtonView(); + + void paint(QPainter *painter, const QRect &rect, const QPalette &palette, bool hover) const; + QSize sizeHint() const; + + QPixmap m_Pixmap; +}; + +//---------------------------------------------------------------------------- + +class CGraphicResourceView +{ +public: + enum class ViewType { ViewType_Effect, ViewType_PathResource, ViewType_Layer }; + + explicit CGraphicResourceView(); + explicit CGraphicResourceView(ViewType type); + explicit CGraphicResourceView(ViewType type, const QPixmap &pixmap); + + void paint(QPainter *painter, const QRect &rect, const QPalette &palette, bool hover) const; + QSize sizeHint() const; + + ViewType Type() const { return m_Type; } +private: + ViewType m_Type; + QPixmap m_Pixmap; +}; + +//---------------------------------------------------------------------------- + +class CGraphicResourceDelegate : public QStyledItemDelegate +{ + Q_OBJECT +public: + using QStyledItemDelegate::QStyledItemDelegate; + + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; +}; + +//---------------------------------------------------------------------------- + +class CGraphicalResourcesTreeItem +{ +public: + explicit CGraphicalResourcesTreeItem(); + explicit CGraphicalResourcesTreeItem(const QVector &data, CGraphicalResourcesTreeItem *parentItem = nullptr); + ~CGraphicalResourcesTreeItem(); + + void AppendChild(CGraphicalResourcesTreeItem *child); + void InsertChild(CGraphicalResourcesTreeItem *child, int index); + CGraphicalResourcesTreeItem *Child(int row); + int ChildCount() const; + int ColumnCount() const; + QVariant Data(int column) const; + int Row() const; + CGraphicalResourcesTreeItem *ParentItem(); + void ClearChildren(); + void RemoveChild(int index); + void RemoveChildren(int from, int count); + + void SetData(int column, const QVariant &data); + + u32 GetID() const { return m_UID; } + bool GetUpdated() { return m_Updated; } + void SetID(u32 id) { m_UID = id; } + void SetUpdated(bool updated) { m_Updated = updated; } + + CStringId GetLayerID() const { return m_LayerUID; } + u32 GetRendererID() const { return m_RendererUID; } + void SetLayerID(CStringId id) { m_LayerUID = id; } + void SetRendererID(u32 id) { m_RendererUID = id; } +private: + QVector m_ChildItems; + QVector m_ItemData; + CGraphicalResourcesTreeItem *m_ParentItem = null; + + u32 m_UID; + bool m_Updated; + + CStringId m_LayerUID; + u32 m_RendererUID; +}; + +//---------------------------------------------------------------------------- + +class CGraphicalResourcesTreeModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + explicit CGraphicalResourcesTreeModel(QObject *parent = nullptr); + ~CGraphicalResourcesTreeModel(); + + QVariant data(const QModelIndex &index, int role) const override; + Qt::ItemFlags flags(const QModelIndex &index) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &index) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + + CGraphicalResourcesTreeItem *Item(const QModelIndex &index) const; + QModelIndex Index(CGraphicalResourcesTreeItem *item) const; + + void UpdateModel(); +private: + void _UpdateModel(); + void _ResetModel(); + + CGraphicalResourcesTreeItem *_CreateEffect(const QString &layerName, const QString &emitterName, u32 uid); + CGraphicalResourcesTreeItem *_CreateEffectLayer(const QString &layerName, u32 uid, CGraphicalResourcesTreeItem *effect); + CGraphicalResourcesTreeItem *_CreateRenderer(SRendererProperties *renderer, CGraphicalResourcesTreeItem *layer); + + CGraphicalResourcesTreeItem *_FindChild(CGraphicalResourcesTreeItem *parent, u32 childId); + void _UnflagUpdated(CGraphicalResourcesTreeItem *parent); + void _RemoveOldItems(CGraphicalResourcesTreeItem *parent); + + bool _LoadImageThumbnail(const CString &path, QPixmap *outThumbnail); + + CGraphicalResourcesTreeItem *m_RootItem = null; + CString m_CompositionName; +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +Q_DECLARE_METATYPE(AEGPPk::CGraphicResetButtonView) +Q_DECLARE_METATYPE(AEGPPk::CGraphicResourceView) +Q_DECLARE_METATYPE(AEGPPk::CGraphicalResourcesTreeItem) + +#endif //!__AEGP_GRAPHICALRESOURCESTREEMODEL_H__ diff --git a/AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h b/AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h new file mode 100644 index 00000000..0a100011 --- /dev/null +++ b/AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h @@ -0,0 +1,201 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_PANELQT_H__ +#define __FX_PANELQT_H__ + +#include "AEGP_Define.h" + +#include +#include + +#include +#include + +#include +#include + +//---------------------------------------------------------------------------- + +struct SPBasicSuite; + +__AEGP_PK_BEGIN + +class CGraphicalResourcesTreeModel; + +//---------------------------------------------------------------------------- + +class QPanelAppSignalSink : public QObject +{ + Q_OBJECT +public: + QPanelAppSignalSink(QApplication *app, QObject *parent = null); + + Q_SIGNAL void OnWindowHandlerChanged(WId wid); + Q_SIGNAL void OnWindowSizeChanged(const QRect &rect); + Q_SIGNAL void OnRenderersChanged(); + Q_SIGNAL void OnExit(); + + void DoExit(); + +private: + QApplication *m_App = null; +}; + +//---------------------------------------------------------------------------- + +class QPanel : public QObject +{ + Q_OBJECT +public: + QPanel(QPanelAppSignalSink* appSignal, QApplication *application, QObject *parent = null); + ~QPanel(); + +private: + void _CreateWindowContent(); + + void _SetWindow(WId wid); + void _SetGeometry(const QRect &windowRect); + void _UpdateModel(); + + + CGraphicalResourcesTreeModel *m_TreeModel = null; + + QPanelAppSignalSink *m_AppSignal = null; + QApplication *m_App = null; + + QWindow *m_Window = null; + QWidget *m_Widget = null; + + WId m_PendingWindowHandle = 0; +}; + +//---------------------------------------------------------------------------- + +class CPanelApp +{ +public: + CPanelApp(); + ~CPanelApp(); + + bool Startup(); + void LaunchApp(); + void Shutdown(); + + void OnWindowHandlerChanged(WId wid); + void OnWindowSizeChanged(const QRect &rect); + void OnRenderersChanged(); + void OnExit(); + +private: + QApplication *m_QApp = null; +#if defined(PK_MACOSX) + QEventLoop *m_EventLoop = null; +#endif + QPanelAppSignalSink *m_AppSignalSink = null; + + QPanel *m_Panel = null; +}; + +//---------------------------------------------------------------------------- + +#if !defined(PK_MACOSX) +class CAsynchronousJob_QtThread : public CAsynchronousJob +{ +public: + CAsynchronousJob_QtThread(); + ~CAsynchronousJob_QtThread(); + virtual void _OnRefptrDestruct() override {} + + +protected: + virtual void _VirtualLaunch(Threads::SThreadContext &) override { ImmediateExecute(); } + +public: + void ImmediateExecute(); + + CPanelApp &App() { return m_App; } + + // Waited for by the main thread: + Threads::CEvent m_Initialized; + Threads::CEvent m_Exited; + +private: + CPanelApp m_App; +}; +PK_DECLARE_REFPTRCLASS(AsynchronousJob_QtThread); +#endif + +//---------------------------------------------------------------------------- + +class CPanelBaseGUI +{ + static CPanelBaseGUI *m_Instance; + + CPanelBaseGUI(); + virtual ~CPanelBaseGUI(); + +public: + static CPanelBaseGUI *GetInstance(); + static bool DestroyInstance(); + + + bool InitializeIFN(); +#if defined(PK_MACOSX) + void IdleUpdate(); +#endif + bool CreatePanel(SPBasicSuite *spbP, AEGP_PanelH panelH, AEGP_PlatformViewRef platformWindowRef, AEGP_PanelFunctions1 *outFunctionTable); + void SetGeometry(const QRect &rect); + void UpdateScenesModel(); + +protected: + //Base AE Commands + void operator=(const CPanelBaseGUI&) = delete; + CPanelBaseGUI(const CPanelBaseGUI&) = delete; + + AEGP_PanelH m_PanelHandle; + + virtual void GetSnapSizes(A_LPoint *snapSizes, A_long *numSizesP); + virtual void PopulateFlyout(AEGP_FlyoutMenuItem *itemsP, A_long *in_out_numItemsP); + virtual void DoFlyoutCommand(AEGP_FlyoutMenuCmdID commandID); + +private: + + static A_Err _GetSnapSizes(AEGP_PanelRefcon refcon, A_LPoint *snapSizes, A_long *numSizesP); + static A_Err _PopulateFlyout(AEGP_PanelRefcon refcon, AEGP_FlyoutMenuItem *itemsP, A_long *in_out_numItemsP); + static A_Err _DoFlyoutCommand(AEGP_PanelRefcon refcon, AEGP_FlyoutMenuCmdID commandID); + + SPBasicSuite *m_BasicSuite = null; + +#if !defined(PK_MACOSX) + PAsynchronousJob_QtThread m_Task; +#else + CPanelApp m_App; +#endif + + bool m_Initialized = false; + +#if defined(PK_WINDOWS) +public: + + static LRESULT CALLBACK StaticOSWindowWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + LRESULT OSWindowWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +private: + typedef LRESULT(CALLBACK* WindowProc)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + + Threads::CCriticalSection m_HandleLock; + HWND m_WindowHandle; + WindowProc m_WindowProc; + + void _SetWindowHandle(HWND hwnd); +#endif +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif //!__FX_PANELQT_H__ diff --git a/AE_GeneralPlugin/Include/RenderApi/AEGP_BaseContext.h b/AE_GeneralPlugin/Include/RenderApi/AEGP_BaseContext.h new file mode 100644 index 00000000..491062eb --- /dev/null +++ b/AE_GeneralPlugin/Include/RenderApi/AEGP_BaseContext.h @@ -0,0 +1,68 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_BASECONTEXT_H__ +#define __FX_BASECONTEXT_H__ + +#include "AEGP_Define.h" +#include +#include "AEGP_RenderContext.h" + +namespace AAePk { + struct SAAEIOData; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_BEGIN + +PK_FORWARD_DECLARE(Texture); + +//---------------------------------------------------------------------------- + +class CAAEBaseContext +{ +public: + static CAAEBaseContext *GetInstance() { return null; } + + CAAEBaseContext(); + virtual ~CAAEBaseContext(); + + virtual bool BeginFrame() { return false; }; + virtual bool EndFrame() { return m_ApiManager->EndFrame(); }; + + virtual void LogApiError() { return; }; + + virtual bool InitIFN() { return true; }; + + virtual bool CreatePlatformContext(void *winHandle, void *deviceContext) { (void)winHandle; (void)deviceContext; return false; }; + virtual bool CreateRenderTarget(RHI::EPixelFormat format, CUint3 size) { (void)format; (void)size; return false; }; + + virtual TMemoryView GetCurrentSwapChain() { return TMemoryView(); }; + + virtual bool SetAsCurrent(void *deviceContext) { (void)deviceContext; return false; }; + + virtual bool FillRenderBuffer(PRefCountedMemoryBuffer dstBuffer, RHI::PFrameBuffer srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) { (void)dstBuffer; (void)srcBuffer; (void)format; (void)width; (void)height; (void)rowLength; return false; }; + + virtual bool FillCompositingTexture(void* srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) { (void)srcBuffer; (void)format; (void)width; (void)height; (void)rowLength; return false; }; + + RHI::PApiManager GetApiManager(); + RHI::SApiContext *GetApiContext(); + RHI::PTexture GetCompositingTexture(); + +protected: + bool m_Initialized = false; + RHI::PApiManager m_ApiManager; + RHI::SApiContext *m_ApiContext; + + RHI::PTexture m_CompositingTexture; +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + + +#endif // ! diff --git a/AE_GeneralPlugin/Include/RenderApi/AEGP_CopyPixels.h b/AE_GeneralPlugin/Include/RenderApi/AEGP_CopyPixels.h new file mode 100644 index 00000000..f9bf91b9 --- /dev/null +++ b/AE_GeneralPlugin/Include/RenderApi/AEGP_CopyPixels.h @@ -0,0 +1,45 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_COPYPIXELS_H__ +#define __FX_COPYPIXELS_H__ + +#include "AEGP_Define.h" + +#include + +namespace PopcornFX +{ + PK_FORWARD_DECLARE(RefCountedMemoryBuffer); +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_BEGIN + +struct SCopyPixel { + PRefCountedMemoryBuffer m_BufferPtr; + PF_EffectWorld *m_InputWorld; + double m_Gamma; + + bool m_IsAlphaOverride; + double m_AlphaOverrideValue; +}; + +//---------------------------------------------------------------------------- + +PF_Err CopyPixelIn32(void *refcon, A_long x, A_long y, PF_Pixel32 *inP, PF_Pixel32 *); +PF_Err CopyPixelIn16(void *refcon, A_long x, A_long y, PF_Pixel16 *inP, PF_Pixel16 *); +PF_Err CopyPixelIn8(void *refcon, A_long x, A_long y, PF_Pixel8 *inP, PF_Pixel8 *); + +PF_Err CopyPixelOut32(void *refcon, A_long x, A_long y, PF_Pixel32 *, PF_Pixel32 *outP); +PF_Err CopyPixelOut16(void *refcon, A_long x, A_long y, PF_Pixel16 *, PF_Pixel16 *outP); +PF_Err CopyPixelOut8(void *refcon, A_long x, A_long y, PF_Pixel8 *, PF_Pixel8 *outP); + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Include/RenderApi/AEGP_CopyTask.h b/AE_GeneralPlugin/Include/RenderApi/AEGP_CopyTask.h new file mode 100644 index 00000000..f9d9ba7b --- /dev/null +++ b/AE_GeneralPlugin/Include/RenderApi/AEGP_CopyTask.h @@ -0,0 +1,70 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_AEGP_COPYTASK_H__ +#define __FX_AEGP_COPYTASK_H__ + +#include "AEGP_Define.h" + +#include "RenderApi/AEGP_BaseContext.h" + +#include "pk_render_helpers/include/draw_requests/rh_tasks.h" // Task::CBase +#include "pk_render_helpers/include/draw_requests/rh_job_pools.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +class CAsynchronousJob_CopyTextureTask : public CAsynchronousJob +{ +public: + TAtomic *m_Counter; + Threads::CEvent *m_EndCB; + + u32 m_TargetCount; + + // data + u32 m_Height; + u32 m_StartOffset; + + BYTE *m_DestinationPtr; + BYTE *m_SourcePtr; + + u32 m_WidthSize; + u32 m_RowPitch; + +public: + CAsynchronousJob_CopyTextureTask() { } + ~CAsynchronousJob_CopyTextureTask() { } + +protected: + virtual void _VirtualLaunch(Threads::SThreadContext &) override { ImmediateExecute(); } + +public: + bool Setup() { return true; } + void ImmediateExecute() + { + PK_NAMEDSCOPEDPROFILE("Copy Task"); + + //Loop + for (u32 i = 0; i < m_Height; ++i) + { + memcpy(m_DestinationPtr + (m_StartOffset + i) * m_WidthSize, m_SourcePtr + (m_StartOffset + i) * m_RowPitch, m_WidthSize); + } + + u32 value = m_Counter->Inc(); + + if (value == m_TargetCount) + m_EndCB->Trigger(); + } +}; +PK_DECLARE_REFPTRCLASS(AsynchronousJob_CopyTextureTask); + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + + +#endif __FX_AEGP_COPYTASK_H__ diff --git a/AE_GeneralPlugin/Include/RenderApi/AEGP_D3D11Context.h b/AE_GeneralPlugin/Include/RenderApi/AEGP_D3D11Context.h new file mode 100644 index 00000000..083debe2 --- /dev/null +++ b/AE_GeneralPlugin/Include/RenderApi/AEGP_D3D11Context.h @@ -0,0 +1,77 @@ +#pragma once + +#ifndef __FX_D3D11CONTEXT_H__ +#define __FX_D3D11CONTEXT_H__ + +#if (PK_BUILD_WITH_D3D11_SUPPORT != 0) + +#include "AEGP_Define.h" + +#include "RenderApi/AEGP_BaseContext.h" + +#include + +namespace AAePk { + struct SAAEIOData; +} + +PK_FORWARD_DECLARE(CD3D11ApiManager); + +__AEGP_PK_BEGIN + +PK_FORWARD_DECLARE(AsynchronousJob_CopyTextureTask); + +struct SD3D11PlatformContext; + +class CAAED3D11Context : public CAAEBaseContext +{ +public: + static CAAEBaseContext *GetInstance() + { + return PK_NEW(CAAED3D11Context); + } + + CAAED3D11Context(); + virtual ~CAAED3D11Context(); + + virtual bool BeginFrame() override; + virtual bool EndFrame() override; + virtual void LogApiError() override; + + + virtual bool InitIFN() override; + virtual bool CreatePlatformContext(void *winHandle, void *deviceContext) override; + virtual bool CreateRenderTarget(RHI::EPixelFormat format, CUint3 size) override; + + virtual bool SetAsCurrent(void *deviceContext) override; + + virtual bool FillRenderBuffer(PRefCountedMemoryBuffer dstBuffer, RHI::PFrameBuffer srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) override; + + virtual bool FillCompositingTexture(void* srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) override; + + virtual TMemoryView GetCurrentSwapChain() override; + + RHI::SD3D11BasicContext *m_D3D11Context = null; +private: + bool _LoadDynamicLibrary(); + bool _CreateDevice(); + bool _PickHardwareAdapter(); + + RHI::CD3D11ApiManager *m_D3D11Manager = null; + SD3D11PlatformContext *m_Context = null; + + ID3D11Texture2D *m_Texture = null; + ID3D11Texture2D *m_StagingTexture = null; + RHI::PD3D11RenderTarget m_SwapChainRenderTarget; + + + TArray m_Tasks; + u32 m_WorkerCount; + +}; + +__AEGP_PK_END + +#endif + +#endif // __FX_D3D11CONTEXT_H__! diff --git a/AE_GeneralPlugin/Include/RenderApi/AEGP_D3D12Context.h b/AE_GeneralPlugin/Include/RenderApi/AEGP_D3D12Context.h new file mode 100644 index 00000000..15566f4a --- /dev/null +++ b/AE_GeneralPlugin/Include/RenderApi/AEGP_D3D12Context.h @@ -0,0 +1,105 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_D3D12CONTEXT_H__ +#define __FX_D3D12CONTEXT_H__ + +#if (PK_BUILD_WITH_D3D12_SUPPORT != 0) + +#include "AEGP_Define.h" + +#include "RenderApi/AEGP_BaseContext.h" + +#include + +//---------------------------------------------------------------------------- + +namespace AAePk { + struct SAAEIOData; +} + +PK_FORWARD_DECLARE(CD3D12ApiManager); + +__AEGP_PK_BEGIN + +PK_FORWARD_DECLARE(AsynchronousJob_CopyTextureTask); +struct SD3D12PlatformContext; + +//---------------------------------------------------------------------------- + +class CAAED3D12Context : public CAAEBaseContext +{ + + static bool m_Once; + static CAAED3D12Context *m_Instance; +public: + static CAAEBaseContext *GetInstance() + { + if (m_Instance == null) + m_Instance = PK_NEW(CAAED3D12Context); + return m_Instance; + } + + CAAED3D12Context(); + virtual ~CAAED3D12Context(); + + CAAED3D12Context(CAAED3D12Context &) = delete; + CAAED3D12Context &operator=(CAAED3D12Context &) = delete; + + virtual bool BeginFrame() override; + virtual bool EndFrame() override; + virtual void LogApiError() override; + + + virtual bool InitIFN() override; + virtual bool CreatePlatformContext(void *winHandle, void *deviceContext) override; + virtual bool CreateRenderTarget(RHI::EPixelFormat format, CUint3 size) override; + + + virtual bool SetAsCurrent(void *deviceContext) override; + + virtual bool FillRenderBuffer(PRefCountedMemoryBuffer dstBuffer, RHI::PFrameBuffer srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) override; + + virtual bool FillCompositingTexture(void* srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) override; + + bool CreateCommandQueue(); + + + virtual TMemoryView GetCurrentSwapChain() override; + + RHI::SD3D12BasicContext *m_D3D12Context; + + //Don't iterate over the different RT yet; + static const u32 kFrameCount = 1; +private: + bool LoadDynamicLibrary(); + bool CreateDevice(); + bool PickHardwareAdapter(); + bool CreateDescriptorAllocator(); + PRefCountedMemoryBuffer CreateBufferFromReadBackTexture(RHI::PCReadBackTexture readBackTexture) const; + void ClearContextSwapchainsRT(); + + RHI::CD3D12ApiManager *m_D3D12Manager; + SD3D12PlatformContext *m_Context; + RHI::PD3D12Fence m_Fence; + u64 m_FrameCount = 0; + + + ID3D12Resource *m_Resources[CAAED3D12Context::kFrameCount]; + RHI::PD3D12RenderTarget m_SwapChainRenderTarget; + + + TArray m_Tasks; + u32 m_WorkerCount = 0; + +}; + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif + +#endif // __FX_D3D12CONTEXT_H__! diff --git a/AE_GeneralPlugin/Include/RenderApi/AEGP_MetalContext.h b/AE_GeneralPlugin/Include/RenderApi/AEGP_MetalContext.h new file mode 100644 index 00000000..c2fd2208 --- /dev/null +++ b/AE_GeneralPlugin/Include/RenderApi/AEGP_MetalContext.h @@ -0,0 +1,90 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __AEGP_METALCONTEXT_H__ +#define __AEGP_METALCONTEXT_H__ + +#if defined (PK_MACOSX) + + +#include "AEGP_Define.h" +#include "RenderApi/AEGP_BaseContext.h" + +#include "pk_render_helpers/include/draw_requests/rh_tasks.h" // Task::CBase +#include "pk_render_helpers/include/draw_requests/rh_job_pools.h" + +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_METAL_SUPPORT != 0) + +namespace AAePk { + struct SAAEIOData; +} + +__PK_RHI_API_BEGIN + struct SMetalBasicContext; + struct SWaitAllSwapChains; + class CMetalApiManager; +__PK_RHI_API_END + +PK_FORWARD_DECLARE(CMetalApiManager); + +__AEGP_PK_BEGIN + struct SMetalPlatformContext; +__AEGP_PK_END + + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +class CAAEMetalContext : public CAAEBaseContext +{ +public: + static CAAEMetalContext *GetInstance() + { + if (m_Instance == null) + m_Instance = PK_NEW(CAAEMetalContext); + return m_Instance; + } + + CAAEMetalContext(); + virtual ~CAAEMetalContext(); + + virtual bool BeginFrame() override; + virtual bool EndFrame() override; + virtual void LogApiError() override; + + + virtual bool InitIFN() override; + + virtual bool SetAsCurrent(void *deviceContext) { (void)deviceContext; return true; }; + + virtual bool CreateRenderTarget(RHI::EPixelFormat format, CUint3 size) override; + + virtual bool FillRenderBuffer(PRefCountedMemoryBuffer dstBuffer, RHI::PFrameBuffer srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) override; + + virtual bool FillCompositingTexture(void *srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) override; + + virtual TMemoryView GetCurrentSwapChain() override; + + virtual bool CreatePlatformContext(void *winHandle, void *deviceContext) override; + +private: + SMetalPlatformContext *m_Data; + bool m_Parented; + static CAAEMetalContext *m_Instance; + RHI::SWaitAllSwapChains *m_LastFrameSyncInfo = null; +}; + +__AEGP_PK_END + +//---------------------------------------------------------------------------- + +#endif //PK_BUILD_WITH_METAL_SUPPORT != 0 + +#endif //PK_MACOSX + +#endif //__AEGP_METALCONTEXT_H__ diff --git a/AE_GeneralPlugin/PkgInfo b/AE_GeneralPlugin/PkgInfo new file mode 100644 index 00000000..62f1eddb --- /dev/null +++ b/AE_GeneralPlugin/PkgInfo @@ -0,0 +1 @@ +AEgxFXTC \ No newline at end of file diff --git a/AE_GeneralPlugin/Precompiled/ae_precompiled.cpp b/AE_GeneralPlugin/Precompiled/ae_precompiled.cpp new file mode 100644 index 00000000..84e52276 --- /dev/null +++ b/AE_GeneralPlugin/Precompiled/ae_precompiled.cpp @@ -0,0 +1 @@ +#include "ae_precompiled.h" diff --git a/AE_GeneralPlugin/Precompiled/ae_precompiled.h b/AE_GeneralPlugin/Precompiled/ae_precompiled.h new file mode 100644 index 00000000..b6bb494c --- /dev/null +++ b/AE_GeneralPlugin/Precompiled/ae_precompiled.h @@ -0,0 +1,28 @@ +#pragma once + +#ifndef __AE_PRECOMPILED_H__ +#define __AE_PRECOMPILED_H__ + +#undef PV_MODULE_NAME +#undef PV_MODULE_SYM +#define PV_MODULE_NAME "AEPlugin" +#define PV_MODULE_SYM AEPlugin + +#include + +PK_LOG_MODULE_DEFINE(); + +#include + + + +#ifdef PK_NULL_AS_VARIABLE +using PopcornFX::null; +#endif + +#if defined(PK_WINDOWS) +#define WIN32_LEAN_AND_MEAN +#include +#endif + +#endif //__AE_PRECOMPILED_H__ diff --git a/AE_GeneralPlugin/Sources/AEGP_AEPKConversion.cpp b/AE_GeneralPlugin/Sources/AEGP_AEPKConversion.cpp new file mode 100644 index 00000000..a2f51712 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_AEPKConversion.cpp @@ -0,0 +1,492 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_AEPKConversion.h" +#include "AEGP_World.h" + +#include +#include + + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +RHI::EPixelFormat AAEToPK(PF_PixelFormat format) +{ + RHI::EPixelFormat result = RHI::EPixelFormat::FormatUnknown; + switch (format) + { + case PF_PixelFormat_ARGB32: + result = RHI::EPixelFormat::FormatUnorm8RGBA; + break; + case PF_PixelFormat_ARGB64: + result = RHI::EPixelFormat::FormatUnorm16RGBA; + break; + case PF_PixelFormat_ARGB128: + result = RHI::EPixelFormat::FormatFloat32RGBA; + break; + default: + //PF_PixelFormat_INVALID 1717854562 + PK_ASSERT_MESSAGE(false, "Unknown conversion of pixel format between PopcornFX and AfterEffects."); + break; + } + return result; +} + +//---------------------------------------------------------------------------- + +PF_PixelFormat PKToAAE(RHI::EPixelFormat format) +{ + PF_PixelFormat result = PF_PixelFormat_INVALID; + switch (format) + { + case RHI::EPixelFormat::FormatUnorm8RGBA: + result = PF_PixelFormat_ARGB32; + break; + case RHI::EPixelFormat::FormatUnorm16RGBA: + result = PF_PixelFormat_ARGB64; + break; + case RHI::EPixelFormat::FormatFloat32RGBA: + result = PF_PixelFormat_ARGB128; + break; + default: + PK_ASSERT_MESSAGE(false, "Unknown conversion of pixel format between PopcornFX and AfterEffects."); + break; + } + return result; +} + +//---------------------------------------------------------------------------- + +u32 GetPixelSizeFromPixelFormat(RHI::EPixelFormat format) +{ + u32 result = 0; + + switch (format) + { + case RHI::EPixelFormat::FormatUnorm8RGBA: + return sizeof(PF_Pixel8); + break; + case RHI::EPixelFormat::FormatUnorm16RGBA: + return sizeof(PF_Pixel16); + break; + case RHI::EPixelFormat::FormatFloat32RGBA: + return sizeof(PF_PixelFloat); + break; + default: + PK_ASSERT_MESSAGE(false, "Unknown conversion of pixel format between PopcornFX and AfterEffects."); + break; + } + return result; +} + +//---------------------------------------------------------------------------- + +void AAEToPK(A_Matrix4 &in, CFloat4x4 &out) +{ + out.XAxis() = CFloat4((float)in.mat[0][0], (float)in.mat[0][1], (float)in.mat[0][2], (float)in.mat[0][3]); + out.YAxis() = CFloat4((float)in.mat[1][0], (float)in.mat[1][1], (float)in.mat[1][2], (float)in.mat[1][3]); + out.ZAxis() = CFloat4((float)in.mat[2][0], (float)in.mat[2][1], (float)in.mat[2][2], (float)in.mat[2][3]); + out.WAxis() = CFloat4((float)in.mat[3][0], (float)in.mat[3][1], (float)in.mat[3][2], (float)in.mat[3][3]); +} + +//---------------------------------------------------------------------------- + +void AAEToPK(A_Matrix4 &in, CFloat4x4 *out) +{ + AAEToPK(in, *out); +} + +//---------------------------------------------------------------------------- + +CFloat3 AAEToPK(A_FloatPoint3 &in) +{ + CFloat3 res((float)in.x, (float)in.y, (float)in.z); + return res; +} + +//---------------------------------------------------------------------------- + +A_FloatPoint3 PKToAAE(CFloat3 &in) +{ + A_FloatPoint3 res; + res.x = in.x(); + res.y = in.y(); + res.z = in.z(); + return res; +} + +//---------------------------------------------------------------------------- + +CFloat3 AngleAAEToPK(A_FloatPoint3 &in) +{ + return CFloat3(DegToRad((float)in.x), DegToRad((float)in.y), DegToRad((float)in.z)); +} + +//---------------------------------------------------------------------------- + +A_FloatPoint3 AnglePKToAAE(CFloat3 &in) +{ + CFloat3 degree(RadToDeg(in.x()), RadToDeg(in.y()), RadToDeg(in.z())); + return PKToAAE(degree); +} + +//---------------------------------------------------------------------------- + +EAttributeSemantic AttributePKToAAE(EDataSemantic value) +{ + PK_STATIC_ASSERT((int)EDataSemantic::DataSemantic_None == (int)EAttributeSemantic::AttributeSemantic_None); + PK_STATIC_ASSERT((int)EDataSemantic::DataSemantic_3DCoordinate == (int)EAttributeSemantic::AttributeSemantic_Coordinate); + PK_STATIC_ASSERT((int)EDataSemantic::DataSemantic_3DScale == (int)EAttributeSemantic::AttributeSemantic_Scale); + PK_STATIC_ASSERT((int)EDataSemantic::DataSemantic_Color == (int)EAttributeSemantic::AttributeSemantic_Color); + + return (EAttributeSemantic)value; +} + +//---------------------------------------------------------------------------- + +EAttributeType AttributePKToAAE(EBaseTypeID value) +{ + EAttributeType res = AttributeType_None; + switch(value) + { + case (BaseType_Bool): + res = AttributeType_Bool1; + break; + case (BaseType_Bool2): + res = AttributeType_Bool2; + break; + case (BaseType_Bool3): + res = AttributeType_Bool3; + break; + case (BaseType_Bool4): + res = AttributeType_Bool4; + break; + case (BaseType_I32): + res = AttributeType_Int1; + break; + case (BaseType_Int2): + res = AttributeType_Int2; + break; + case (BaseType_Int3): + res = AttributeType_Int3; + break; + case (BaseType_Int4): + res = AttributeType_Int4; + break; + case (BaseType_Float): + res = AttributeType_Float1; + break; + case (BaseType_Float2): + res = AttributeType_Float2; + break; + case (BaseType_Float3): + res = AttributeType_Float3; + break; + case (BaseType_Float4): + res = AttributeType_Float4; + break; + default: + PK_ASSERT_NOT_REACHED_MESSAGE("Attribute Type missmatch !"); + } + return res; +} + +//---------------------------------------------------------------------------- + +EAttributeSamplerType AttributeSamplerPKToAAE(SParticleDeclaration::SSampler::ESamplerType type) +{ + EAttributeSamplerType res = AttributeSamplerType_None; + switch (type) + { + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_Animtrack): + res = AttributeSamplerType_Animtrack; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_Audio): + res = AttributeSamplerType_Audio; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_Curve): + res = AttributeSamplerType_Curve; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_EventStream): + res = AttributeSamplerType_EventStream; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_Geometry): + res = AttributeSamplerType_Geometry; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_Image): + res = AttributeSamplerType_Image; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_Grid): + res = AttributeSamplerType_Grid; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_ImageAtlas): + res = AttributeSamplerType_ImageAtlas; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_Text): + res = AttributeSamplerType_Text; + break; + case (SParticleDeclaration::SSampler::ESamplerType::Sampler_VectorField): + res = AttributeSamplerType_VectorField; + break; + default: + PK_ASSERT_NOT_REACHED_MESSAGE("Attribute Sampler Type missmatch !"); + break; + } + return res; +} + +//---------------------------------------------------------------------------- + +EBaseTypeID AttributeAAEToPK(EAttributeType value) +{ + EBaseTypeID res = BaseType_Evolved; + switch (value) + { + case (AttributeType_Bool1): + res = BaseType_Bool; + break; + case (AttributeType_Bool2): + res = BaseType_Bool2; + break; + case (AttributeType_Bool3): + res = BaseType_Bool3; + break; + case (AttributeType_Bool4): + res = BaseType_Bool4; + break; + case (AttributeType_Int1): + res = BaseType_I32; + break; + case (AttributeType_Int2): + res = BaseType_Int2; + break; + case (AttributeType_Int3): + res = BaseType_Int3; + break; + case (AttributeType_Int4): + res = BaseType_Int4; + break; + case (AttributeType_Float1): + res = BaseType_Float; + break; + case (AttributeType_Float2): + res = BaseType_Float2; + break; + case (AttributeType_Float3): + res = BaseType_Float3; + break; + case (AttributeType_Float4): + res = BaseType_Float4; + break; + default: + PK_ASSERT_NOT_REACHED_MESSAGE("Attribute Type missmatch !"); + } + return res; +} + +//---------------------------------------------------------------------------- + +PKSample::CRHIParticleSceneRenderHelper::ERenderTargetDebug AAEToPK(ERenderType value) +{ + PKSample::CRHIParticleSceneRenderHelper::ERenderTargetDebug res = PKSample::CRHIParticleSceneRenderHelper::RenderTargetDebug_NoDebug; + switch (value) + { + case (RenderType_FinalCompositing): + res = PKSample::CRHIParticleSceneRenderHelper::RenderTargetDebug_NoDebug; + break; + case (RenderType_Emissive): + res = PKSample::CRHIParticleSceneRenderHelper::RenderTargetDebug_NoDebug; + break; + case (RenderType_Albedo): + res = PKSample::CRHIParticleSceneRenderHelper::RenderTargetDebug_Diffuse; + break; + case (RenderType_Normal): + res = PKSample::CRHIParticleSceneRenderHelper::RenderTargetDebug_NormalUnpacked; + break; + case (RenderType_Depth): + res = PKSample::CRHIParticleSceneRenderHelper::RenderTargetDebug_Depth; + break; + default: + PK_ASSERT_NOT_REACHED_MESSAGE("Render Type missmatch !"); + + } + return res; +} + +//---------------------------------------------------------------------------- + +void AAEToPK(SPostFXBloomDesc &in, PKSample::SParticleSceneOptions::SBloom &out) +{ + out.m_Enable = in.m_Enable; + out.m_BrightPassValue = in.m_BrightPassValue; + out.m_Intensity = in.m_Intensity; + out.m_Attenuation = in.m_Attenuation; + + switch (in.m_GaussianBlur) + { + case (GaussianBlurPixelRadius_5): + out.m_BlurTap = PKSample::GaussianBlurCombination_5_Tap; + break; + case (GaussianBlurPixelRadius_9): + out.m_BlurTap = PKSample::GaussianBlurCombination_9_Tap; + break; + case (GaussianBlurPixelRadius_13): + out.m_BlurTap = PKSample::GaussianBlurCombination_13_Tap; + break; + } + out.m_RenderPassCount = in.m_RenderPassCount; +} + +//---------------------------------------------------------------------------- + +void AAEToPK(SPostFXDistortionDesc &in, PKSample::SParticleSceneOptions::SDistortion &out) +{ + out.m_Enable = in.m_Enable; +} + +//---------------------------------------------------------------------------- + +void AAEToPK(SPostFXToneMappingDesc &in, PKSample::SParticleSceneOptions::SToneMapping &out) +{ + out.m_Saturation = in.m_Saturation; + out.m_Enable = in.m_Enable; + out.m_Exposure = in.m_Exposure; +} + +//---------------------------------------------------------------------------- + +void AAEToPK(SPostFXAADesc &in, PKSample::SParticleSceneOptions::SFXAA &out) +{ + out.m_Enable = in.m_Enable; +} + +//---------------------------------------------------------------------------- + +void AAEToPK(SRenderingDesc &in, PKSample::SParticleSceneOptions &out) +{ + AAEToPK(in.m_Bloom, out.m_Bloom); + AAEToPK(in.m_Distortion, out.m_Distortion); + AAEToPK(in.m_ToneMapping, out.m_ToneMapping); + AAEToPK(in.m_FXAA, out.m_FXAA); +} + +//---------------------------------------------------------------------------- + +CParticleSamplerDescriptor_VectorField_Grid::EInterpolation AAEToPK(EInterpolationType &value) +{ + CParticleSamplerDescriptor_VectorField_Grid::EInterpolation res = CParticleSamplerDescriptor_VectorField_Grid::EInterpolation::__MaxInterpolations; + switch (value) + { + case EInterpolationType::EInterpolationType_Point: + res = CParticleSamplerDescriptor_VectorField_Grid::EInterpolation::Interpolation_Point; + break; + case EInterpolationType::EInterpolationType_Trilinear: + res = CParticleSamplerDescriptor_VectorField_Grid::EInterpolation::Interpolation_Trilinear; + break; + case EInterpolationType::EInterpolationType_Quadrilinear: + res = CParticleSamplerDescriptor_VectorField_Grid::EInterpolation::Interpolation_Quadrilinear; + break; + default: + PK_ASSERT_NOT_REACHED_MESSAGE("Render Type missmatch !"); + break; + } + return res; +} + +//---------------------------------------------------------------------------- + +CUbyte3 ConvertSRGBToLinear(CUbyte3 v) +{ + CFloat3 vf(v.x() / 255.0f, v.y() / 255.0f, v.z() / 255.0f); + + CFloat3 vfl = PKSample::ConvertSRGBToLinear(vf); + return CUbyte3(static_cast(vfl.x() * 255.0f), static_cast(vfl.y() * 255.0f), static_cast(vfl.z() * 255.0f)); +} + +//---------------------------------------------------------------------------- + +CUbyte3 ConvertLinearToSRGB(CUbyte3 v) +{ + CFloat3 vf(v.x() / 255.0f, v.y() / 255.0f, v.z() / 255.0f); + + CFloat3 vfl = PKSample::ConvertLinearToSRGB(vf); + return CUbyte3(static_cast(vfl.x() * 255.0f), static_cast(vfl.y() * 255.0f), static_cast(vfl.z() * 255.0f)); +} + +//---------------------------------------------------------------------------- + +EApiValue RHIApiToAEApi(RHI::EGraphicalApi value) +{ + EApiValue ret; + switch (value) + { +#if PK_BUILD_WITH_D3D12_SUPPORT != 0 + case RHI::EGraphicalApi::GApi_D3D12: + ret = EApiValue::D3D12; + break; +#endif +#if PK_BUILD_WITH_D3D11_SUPPORT != 0 + case RHI::EGraphicalApi::GApi_D3D11: + ret = EApiValue::D3D11; + break; +#endif +#if PK_BUILD_WITH_METAL_SUPPORT != 0 + case RHI::EGraphicalApi::GApi_Metal: + ret = EApiValue::Metal; + break; +#endif + default: +#if defined(PK_WINDOWS) && PK_BUILD_WITH_D3D11_SUPPORT != 0 + ret = EApiValue::D3D11; +#elif defined(PK_MACOSX) && PK_BUILD_WITH_METAL_SUPPORT != 0 + ret = EApiValue::Metal; +#else + PK_ASSERT_NOT_REACHED_MESSAGE("Cannot choose a compatible default API for the current platform"); +#endif + break; + } + return ret; +} + +//---------------------------------------------------------------------------- + +RHI::EGraphicalApi AEApiToRHIApi(EApiValue value) +{ + RHI::EGraphicalApi ret; + switch (value) + { +#if PK_BUILD_WITH_D3D12_SUPPORT != 0 + case EApiValue::D3D12: + ret = RHI::EGraphicalApi::GApi_D3D12; + break; +#endif +#if PK_BUILD_WITH_D3D11_SUPPORT != 0 + case EApiValue::D3D11: + ret = RHI::EGraphicalApi::GApi_D3D11; + break; +#endif +#if PK_BUILD_WITH_METAL_SUPPORT != 0 + case EApiValue::Metal: + ret = RHI::EGraphicalApi::GApi_Metal; + break; +#endif + default: +#if defined(PK_WINDOWS) && PK_BUILD_WITH_D3D11_SUPPORT != 0 + ret = RHI::EGraphicalApi::GApi_D3D11; +#elif defined(PK_MACOSX) && PK_BUILD_WITH_METAL_SUPPORT != 0 + ret = RHI::EGraphicalApi::GApi_Metal; +#else + PK_ASSERT_NOT_REACHED_MESSAGE("Cannot choose a compatible default API for the current platform"); +#endif + break; + } + return ret; + +} + +//---------------------------------------------------------------------------- +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_AssetBaker.cpp b/AE_GeneralPlugin/Sources/AEGP_AssetBaker.cpp new file mode 100644 index 00000000..4880ba38 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_AssetBaker.cpp @@ -0,0 +1,799 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" +#include "AEGP_AssetBaker.h" + +#include "AEGP_World.h" + +#include "AEGP_PopcornFXPlugins.h" + +#include "AEGP_PackExplorer.h" +#include "AEGP_FileWatcher.h" +#include "pk_kernel/include/kr_log_listeners_file.h" + +//Baking +#include "pk_imaging/include/im_resource.h" +#include "pk_geometrics/include/ge_mesh_resource_handler.h" +#include "pk_geometrics/include/ge_rectangle_list.h" +#include "pk_particles/include/ps_font_metrics_resource.h" +#include "pk_particles/include/ps_vectorfield_resource.h" +#include "pk_base_object/include/hbo_context.h" + +#include "PK-AssetBakerLib/AssetBaker_Oven.h" +#include "PK-AssetBakerLib/AssetBaker_Oven_HBO.h" +#include "PK-AssetBakerLib/AssetBaker_Oven_Mesh.h" +#include "PK-AssetBakerLib/AssetBaker_Oven_VectorField.h" +#include "PK-AssetBakerLib/AssetBaker_Oven_Texture.h" +#include "PK-AssetBakerLib/AssetBaker_Oven_StraightCopy.h" + +#include "AEGP_Log.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +static const CStringView kPopcornProjectExtension = "pkproj"; + +//---------------------------------------------------------------------------- + +HBO_CLASS_DEFINITION_BEGIN(CEditorAssetEffect) +.HBO_FIELD_DEFINITION(StartCameraPosition) +[ + HBO::Properties::DefaultValue(CFloat3(0.0f, 0.0f, 5.0f)), + HBO::Properties::AlwaysSerialize(), + HBO::Properties::Caracs(HBO::FieldCaracs::Caracs_3DCoordinateDistance), + HBO::Properties::Description("Initial position of the camera when opening the effect") +] +.HBO_FIELD_DEFINITION(StartCameraOrientation) +[ + HBO::Properties::DefaultValue(CFloat3::ZERO), + HBO::Properties::AlwaysSerialize(), + HBO::Properties::Caracs(HBO::Caracs_3DCoordinate), + HBO::Properties::Description("Initial euler orientation of the camera when opening the effect") +] +HBO_CLASS_DEFINITION_END + +//---------------------------------------------------------------------------- + +CEditorAssetEffect::CEditorAssetEffect() + :HBO_CONSTRUCT(CEditorAssetEffect) +{ + +} + +//---------------------------------------------------------------------------- + +CEditorAssetEffect::~CEditorAssetEffect() +{ + +} + +//---------------------------------------------------------------------------- + +void CEditorAssetEffect::CopyFrom(CEditorAssetEffect *other) +{ + SetStartCameraPosition(other->StartCameraPosition()); + SetStartCameraOrientation(other->StartCameraOrientation()); +} + +//---------------------------------------------------------------------------- + +CProjectSettingsFinder::CProjectSettingsFinder(const CString &rootDir, IFileSystem *controller) + : CFileDirectoryWalker(rootDir, IgnoreVirtualFS, controller) +{ + SetFilePathValidator(ProjectSettingsPathValidator); +} + +//---------------------------------------------------------------------------- + +void CProjectSettingsFinder::FileNotifier(const CFilePack *pack, const char *fullPath, u32 fileFirstCharPos) +{ + (void)pack; + (void)fileFirstCharPos; + + PK_ASSERT(CFilePath::IsPure(fullPath)); + PK_ASSERT(kPopcornProjectExtension == CFilePath::ExtractExtension(fullPath)); + + if (!PK_VERIFY(m_ProjectSettingsPath == null)) + { + CLog::Log(PK_ERROR, "Multiple pkproj found in RootDir (\"%s\").", fullPath); + } + else + { + m_ProjectSettingsPath = fullPath; + } +} + +//---------------------------------------------------------------------------- + +bool CProjectSettingsFinder::DirectoryNotifier(const CFilePack *pack, const char *fullPath, u32 directoryFirstCharPos) +{ + (void)pack; + (void)fullPath; + (void)directoryFirstCharPos; + return true; // Recursive search +} + +//---------------------------------------------------------------------------- + +const CString &CProjectSettingsFinder::ProjectSettingsPath() const +{ + return m_ProjectSettingsPath; +} + +//---------------------------------------------------------------------------- + +bool CProjectSettingsFinder::ProjectSettingsPathValidator(const char *filePath) +{ + return kPopcornProjectExtension == CFilePath::ExtractExtension(filePath); +} + +//---------------------------------------------------------------------------- +// SBakeContext +//---------------------------------------------------------------------------- + +SBakeContext::SBakeContext() + : m_BakeResourceMeshHandler(null) + , m_BakeResourceImageHandler(null) + , m_BakeResourceRectangleListHandler(null) + , m_BakeResourceFontMetricsHandler(null) + , m_BakeResourceVectorFieldHandler(null) + , m_BakeFSController(null) + , m_BakeResourceManager(null) + , m_Initialized(false) +{ +} + +//---------------------------------------------------------------------------- + +SBakeContext::~SBakeContext() +{ + if (!m_Initialized) + return; + + CCookeryLogger::Shutdown(); + + if (m_BakeResourceManager != null) + { + PK_ASSERT(m_BakeResourceMeshHandler != null); + PK_ASSERT(m_BakeResourceImageHandler != null); + PK_ASSERT(m_BakeResourceVectorFieldHandler != null); + PK_ASSERT(m_BakeResourceFontMetricsHandler != null); + PK_ASSERT(m_BakeResourceRectangleListHandler != null); + + m_BakeResourceManager->UnregisterHandler(m_BakeResourceMeshHandler); + m_BakeResourceManager->UnregisterHandler(m_BakeResourceImageHandler); + m_BakeResourceManager->UnregisterHandler(m_BakeResourceRectangleListHandler); + m_BakeResourceManager->UnregisterHandler(m_BakeResourceFontMetricsHandler); + m_BakeResourceManager->UnregisterHandler(m_BakeResourceVectorFieldHandler); + } + PK_SAFE_DELETE(m_BakeResourceMeshHandler); + PK_SAFE_DELETE(m_BakeResourceImageHandler); + PK_SAFE_DELETE(m_BakeResourceVectorFieldHandler); + PK_SAFE_DELETE(m_BakeResourceFontMetricsHandler); + PK_SAFE_DELETE(m_BakeResourceRectangleListHandler); + PK_SAFE_DELETE(m_BakeContext); + PK_SAFE_DELETE(m_BakeFSController); + PK_SAFE_DELETE(m_BakeResourceManager); + + // unregister the oven's HBO bake-config classes: + COvenBakeConfig_Audio::UnregisterHandler(); + COvenBakeConfig_StraightCopy::UnregisterHandler(); + COvenBakeConfig_Particle::UnregisterHandler(); + COvenBakeConfig_ParticleCompiler::UnregisterHandler(); + COvenBakeConfig_VectorField::UnregisterHandler(); + COvenBakeConfig_TextureAtlas::UnregisterHandler(); + COvenBakeConfig_Texture::UnregisterHandler(); + COvenBakeConfig_Mesh::UnregisterHandler(); + COvenBakeConfig_HBO::UnregisterHandler(); + COvenBakeConfig_Base::UnregisterHandler(); +} + +//---------------------------------------------------------------------------- + +bool SBakeContext::Init() +{ + PK_ASSERT(m_BakeResourceMeshHandler == null); + PK_ASSERT(m_BakeResourceImageHandler == null); + PK_ASSERT(m_BakeResourceVectorFieldHandler == null); + PK_ASSERT(m_BakeResourceFontMetricsHandler == null); + PK_ASSERT(m_BakeResourceRectangleListHandler == null); + PK_ASSERT(m_BakeFSController == null); + PK_ASSERT(m_BakeResourceManager == null); + + // We do not constant fold the images because we do not want to link with all the image codecs: + m_BakeResourceImageHandler = PK_NEW(CResourceHandlerDummy); + m_BakeResourceVectorFieldHandler = PK_NEW(CResourceHandlerDummy); + // Keep this updated with all PopcornFX resource types + m_BakeResourceMeshHandler = PK_NEW(PopcornFX::CResourceHandlerMesh); + m_BakeResourceRectangleListHandler = PK_NEW(PopcornFX::CResourceHandlerRectangleList); + m_BakeResourceFontMetricsHandler = PK_NEW(PopcornFX::CResourceHandlerFontMetrics); + + if (!PK_VERIFY(m_BakeResourceMeshHandler != null) || + !PK_VERIFY(m_BakeResourceImageHandler != null) || + !PK_VERIFY(m_BakeResourceRectangleListHandler != null) || + !PK_VERIFY(m_BakeResourceFontMetricsHandler != null) || + !PK_VERIFY(m_BakeResourceVectorFieldHandler != null)) + return false; + + m_BakeFSController = File::NewInternalFileSystem(); + if (!PK_VERIFY(m_BakeFSController != null)) + return false; + + m_BakeResourceManager = PK_NEW(PopcornFX::CResourceManager(m_BakeFSController)); + if (!PK_VERIFY(m_BakeResourceManager != null)) + return false; + m_BakeResourceManager->RegisterHandler(m_BakeResourceMeshHandler); + m_BakeResourceManager->RegisterHandler(m_BakeResourceImageHandler); + m_BakeResourceManager->RegisterHandler(m_BakeResourceRectangleListHandler); + m_BakeResourceManager->RegisterHandler(m_BakeResourceFontMetricsHandler); + m_BakeResourceManager->RegisterHandler(m_BakeResourceVectorFieldHandler); + + m_BakeContext = PK_NEW(PopcornFX::HBO::CContext(m_BakeResourceManager)); + if (!PK_VERIFY(m_BakeContext != null)) + return false; + + // register the oven's HBO bake-config classes: + COvenBakeConfig_Base::RegisterHandler(); + COvenBakeConfig_HBO::RegisterHandler(); + COvenBakeConfig_Mesh::RegisterHandler(); + COvenBakeConfig_Texture::RegisterHandler(); + COvenBakeConfig_TextureAtlas::RegisterHandler(); + COvenBakeConfig_VectorField::RegisterHandler(); + COvenBakeConfig_ParticleCompiler::RegisterHandler(); + COvenBakeConfig_Particle::RegisterHandler(); + COvenBakeConfig_StraightCopy::RegisterHandler(); + COvenBakeConfig_Audio::RegisterHandler(); + + const CVaultHandler &vault = CPopcornFXWorld::Instance().GetVaultHandler(); + + const CString vaultlogs = vault.VaultPathLog(); + + if (!PK_VERIFY(CCookeryLogger::Startup(vaultlogs / "AssetBakerLogs", true))) + return false; + + m_Initialized = true; + return true; +} + +//---------------------------------------------------------------------------- + +bool SBakeContext::_RemapPath(CString &path) +{ + CString extension = CFilePath::ExtractExtension(path.Data()); + + if (extension.Compare("fbx", CaseInsensitive)) + path = CFilePath::StripExtension(path) + ".pkmm"; + if (extension.Compare("fga", CaseInsensitive)) + path = CFilePath::StripExtension(path) + ".pkvf"; + if (extension.Compare("pkfx", CaseInsensitive)) + path = CFilePath::StripExtension(path) + ".pkb"; + + return true; +} + +CString SBakeContext::_RemapFX(const CString &path) +{ + CString extension = CFilePath::ExtractExtension(path.Data()); + + if (extension.Compare("pkfx", CaseInsensitive)) + return CFilePath::StripExtension(path) + ".pkb"; + return null; +} + +//---------------------------------------------------------------------------- + +CEffectBaker::CEffectBaker() + : m_Initialized(false) + , m_SrcPack(null) + , m_DstPack(null) +{ + m_BakeContext.Init(); +} + +//---------------------------------------------------------------------------- + +CEffectBaker::~CEffectBaker() +{ + Clear(); + m_Initialized = false; +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::FileAdded(const CString &path) +{ + if (path.EndsWith(".pkfx") == true || path.EndsWith(".pkri")) + { + SAssetChange effect; + + if (IsChangeRegistered(path, EAssetChangesType::Add) == true) + return; + CString cleanPath = path.Extract(m_SrcPackPath.SlashAppended().Length(), path.Length()); + CFilePath::Purify(cleanPath); + effect.m_EffectPath = cleanPath; + effect.m_Type = EAssetChangesType::Add; + + PK_SCOPEDLOCK(m_Lock); + m_ToBake.PushBack(effect); + } +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::FileRemoved(const CString &path) +{ + (void)path; +#if 0 //User isn't supposed to remove content of the vault during play ? + if (path.EndsWith(".pkfx") == true || path.EndsWith(".pkri")) + { + SAssetChange effect; + + if (IsChangeRegistered(path, EAssetChangesType::Remove) == true) + return; + CString cleanPath = path.Extract(m_SrcPackPath.SlashAppended().Length(), path.Length()); + CFilePath::Purify(cleanPath); + effect.m_EffectPath = cleanPath; + effect.m_Type = EAssetChangesType::Remove; + + PK_SCOPEDLOCK(m_Lock); + } +#endif +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::FileChanged(const CString &path) +{ + if (path.EndsWith(".pkfx") == true || path.EndsWith(".pkri")) + { + SAssetChange effect; + + if (IsChangeRegistered(path, EAssetChangesType::Update) == true) + return; + CString cleanPath = path.Extract(m_SrcPackPath.SlashAppended().Length(), path.Length()); + CFilePath::Purify(cleanPath); + + CEffectBaker::FileChangedRelativePath(cleanPath); + } +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::FileChangedRelativePath(const CString &path) +{ + SAssetChange effect; + + effect.m_EffectPath = path; + effect.m_Type = EAssetChangesType::Update; + + PK_SCOPEDLOCK(m_Lock); + m_ToBake.PushBack(effect); +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::FileRenamed(const CString &oldPath, const CString &newPath) +{ + if (newPath.EndsWith(".pkfx") == true) + { + SAssetChange effect; + + if (IsChangeRegistered(newPath, EAssetChangesType::Rename) == true) + return; + + CString cleanPath = newPath.Extract(m_SrcPackPath.SlashAppended().Length(), newPath.Length()); + CString cleanOldPath = oldPath.Extract(m_SrcPackPath.SlashAppended().Length(), oldPath.Length()); + + CFilePath::Purify(cleanPath); + CFilePath::Purify(cleanOldPath); + + effect.m_EffectPath = cleanPath; + effect.m_EffectPathOld = cleanOldPath; + effect.m_Type = EAssetChangesType::Rename; + + PK_SCOPEDLOCK(m_Lock); + m_ToBake.PushBack(effect); + } +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::Initialize(const CString &srcPack, const CString &dstPack, const CString &pkprojPath) +{ + m_RootDir = ""; + if (!pkprojPath.Empty()) + LoadProjectSettings(pkprojPath); + + m_SrcPackPath = srcPack / m_RootDir; + m_DstPackPath = dstPack; + + if (m_SrcPackPath == m_DstPackPath) + { + CAELog::TryLogErrorWindows("Bake Error: Trying to bake into the source pack, aborting"); + return; + } + CLog::Log(PK_INFO, "Setting up cookery with source pack: \"%s\" and destination path: \"%s\"", m_SrcPackPath.Data(), m_DstPackPath.Data()); + m_BakeContext.m_BakeFSController->UnmountAllPacks(); + + m_SrcPack = m_BakeContext.m_BakeFSController->MountPack(m_SrcPackPath); + + // Initialize the cookery: + if (!m_Initialized) + { + Mem::Reinit(m_Cookery); + + m_Cookery.SetHBOContext(m_BakeContext.m_BakeContext); + if (!m_Cookery.TurnOn()) + { + CLog::Log(PK_WARN, "Couldn't initialize the cookery, TurnOn Failed."); + return; + } + + const CGuid ovenIdHBO = m_Cookery.RegisterOven(PK_NEW(COven_HBO)); + const CGuid ovenIdMesh = m_Cookery.RegisterOven(PK_NEW(COven_Mesh)); + const CGuid ovenIdTexture = m_Cookery.RegisterOven(PK_NEW(COven_Texture)); + const CGuid ovenIdTextureAtlas = m_Cookery.RegisterOven(PK_NEW(COven_TextureAtlas)); + const CGuid ovenIdVectorField = m_Cookery.RegisterOven(PK_NEW(COven_VectorField)); + + COven_Particle *ovenParticle = PK_NEW(COven_Particle); + ovenParticle->SetExternalPathRemapper(FastDelegate(SBakeContext::_RemapPath)); + const CGuid ovenIdParticle = m_Cookery.RegisterOven(ovenParticle); + + const CGuid ovenIdStraightCopy = m_Cookery.RegisterOven(PK_NEW(COven_StraightCopy)); + const CGuid ovenIdAudio = m_Cookery.RegisterOven(PK_NEW(COven_Audio)); + + if (!ovenIdHBO.Valid() || !ovenIdMesh.Valid() || !ovenIdTexture.Valid() || !ovenIdTextureAtlas.Valid() || + !ovenIdVectorField.Valid() || !ovenIdParticle.Valid() || !ovenIdStraightCopy.Valid() || + !ovenIdAudio.Valid()) + { + CLog::Log(PK_WARN, "Couldn't initialize the cookery, RegisterOven Failed."); + return; + } + + m_Cookery.MapOven("pkri", ovenIdStraightCopy); // Editor Material + m_Cookery.MapOven("pkma", ovenIdStraightCopy); // Editor Material + // map all known extensions to the appropriate oven: + m_Cookery.MapOven("fbx", ovenIdMesh); // FBX mesh + m_Cookery.MapOven("pkmm", ovenIdMesh); // PopcornFX multi-mesh + m_Cookery.MapOven("dds", ovenIdTexture); // dds image + m_Cookery.MapOven("png", ovenIdTexture); // png image + m_Cookery.MapOven("jpg", ovenIdTexture); // jpg image + m_Cookery.MapOven("jpeg", ovenIdTexture); // jpg image + m_Cookery.MapOven("tga", ovenIdTexture); // tga image + m_Cookery.MapOven("tif", ovenIdTexture); // tiff image + m_Cookery.MapOven("tiff", ovenIdTexture); // tiff image + m_Cookery.MapOven("pkm", ovenIdTexture); // pkm image + m_Cookery.MapOven("pvr", ovenIdTexture); // pvrtc image + //m_Cookery.MapOven("exr", ovenIdTexture); // exr image ------------- Collide with FBX + m_Cookery.MapOven("hdr", ovenIdTexture); // hdr image + m_Cookery.MapOven("txt", ovenIdStraightCopy); // misc + m_Cookery.MapOven("fga", ovenIdVectorField); // FGA vector-field + m_Cookery.MapOven("pkfm", ovenIdStraightCopy); // PopcornFX font + m_Cookery.MapOven("pkvf", ovenIdStraightCopy); // PopcornFX vector-field + m_Cookery.MapOven("pkat", ovenIdTextureAtlas); // PopcornFX atlas definition + m_Cookery.MapOven("pksc", ovenIdStraightCopy); // PopcornFX simulation cache + m_Cookery.MapOven("pkbo", ovenIdHBO); // PopcornFX base object + m_Cookery.MapOven("pkan", ovenIdHBO); // PopcornFX Animation + m_Cookery.MapOven("pksa", ovenIdHBO); // PopcornFX Skeletal Animation + m_Cookery.MapOven("mp3", ovenIdAudio); // mp3 sound + m_Cookery.MapOven("wav", ovenIdAudio); // wav sound + m_Cookery.MapOven("ogg", ovenIdAudio); // ogg sound + m_Cookery.MapOven("pkfx", ovenIdParticle, FastDelegate(SBakeContext::_RemapFX)); // PopcornFX Effect + + m_Cookery.AddOvenFlags(PopcornFX::COven::Flags_BakeMemoryVersion); + AEGPPk::CPopcornFXWorld &world = AEGPPk::CPopcornFXWorld::Instance(); + CString installPath = world.GetPluginInstallationPath(); + CString SrcPackPath = srcPack.Replace('/', '\\'); + + PopcornFX::PBaseObjectFile configFile = m_Cookery.m_BaseConfigFile; + PK_FOREACH(it, configFile->ObjectList()) + { + PopcornFX::COvenBakeConfig_Particle *config = PopcornFX::HBO::Cast(*it); + if (config != null) + { + config->SetCompile(true); + config->SetSourceConfig(Bake_NoSource); + config->SetRemoveEditorNodes(true); + config->SetBakeMode(PopcornFX::COvenBakeConfig_HBO::Bake_SaveAsBinary); + + COvenBakeConfig_Particle::_TypeOfBackendCompilers backendCompilers; + +#if (PK_COMPILER_BUILD_COMPILER_D3D12 != 0) + if (world.GetRenderApi() == RHI::GApi_D3D12) + { + //BakeBytecodeCommandLine_Windows = "\"{DXC}\" -T cs_6_0 -E main -WX -Ges -O3 -nologo -all_resources_bound -Fo \"$(TargetPath)\" \"$(InputPath)\""; + const CString cmdLine_D3D12 = "\"" + installPath + "fxc.exe\"" + " -T cs_5_1 -E main -WX -Ges -O3 -all_resources_bound -Fo \"$(TargetPath)\" \"$(InputPath)\""; + POvenBakeConfig_ParticleCompiler backendCompiler = m_Cookery.HBOContext()->NewObject(configFile.Get()); + if (!PK_VERIFY(backendCompiler != null) || + !PK_VERIFY(backendCompilers.PushBack(backendCompiler).Valid())) + return; + backendCompiler->SetTarget(BackendTarget_D3D12); + backendCompiler->SetBakeBytecodeCommandLine_Windows(cmdLine_D3D12); + } +#endif +#if (PK_COMPILER_BUILD_COMPILER_D3D11 != 0) + if (world.GetRenderApi() == RHI::GApi_D3D11) + { + const CString cmdLine_D3D11 = "\"" + installPath + "fxc.exe\"" + " -T cs_5_0 -E main -WX -Ges -O3 -Fo \"$(TargetPath)\" \"$(InputPath)\""; + POvenBakeConfig_ParticleCompiler backendCompiler = m_Cookery.HBOContext()->NewObject(configFile.Get()); + if (!PK_VERIFY(backendCompiler != null) || + !PK_VERIFY(backendCompilers.PushBack(backendCompiler).Valid())) + return; + backendCompiler->SetTarget(BackendTarget_D3D11); + backendCompiler->SetBakeBytecodeCommandLine_Windows(cmdLine_D3D11); + } +#endif + config->SetBackendCompilers(backendCompilers); + + config->SetCompilerSwitches("--determinism"); + config->SetCommandLine_Windows( "\"" + installPath + "PK-ShaderTool_r.exe\" -v -k false -O \"$(TargetPath)\"" + " -P \"" + SrcPackPath + "\" " + + "-api d3d " + "-c \"\\\"" + installPath + "fxc.exe\\\" -T ##ShortStage##_5_0 ##InputPath## -Fo ##OutputPath## -nologo -O3\" \"$(InputPath)\""); + config->SetCommandLine_MacOsX( "\"" + installPath + "AE_GeneralPlugin.plugin/Contents/MacOs/PK-ShaderTool_r\" -v -k false -O \"$(TargetPath)\"" + " -P \"" + SrcPackPath + "\" " + + "-api metal -c \"xcrun -sdk macosx metal -mmacosx-version-min=10.14 -std=macos-metal2.1 ##InputPath## -o ##OutputPath##\" \"$(InputPath)\""); + continue; + } + PopcornFX::COvenBakeConfig_Base *configBase = PopcornFX::HBO::Cast(*it); + if (configBase != null) + continue; + } + m_Initialized = true; + } + const PopcornFX::SBakeTarget defaultTarget("AfterEffect_Generic", m_DstPackPath); + + m_Cookery.m_DstPackPaths.PushBack(defaultTarget); + +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::Clear() +{ + PK_SCOPEDLOCK(m_Lock); + + m_BakeContext.m_BakeFSController->UnmountAllPacks(); +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::Lock() +{ + m_Lock.Lock(); +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::Unlock() +{ + m_Lock.Unlock(); +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::CancelAllFileChanges() +{ + m_ToBake.Clear(); +} + +//---------------------------------------------------------------------------- + +int CEffectBaker::PopFileChanges() +{ + if (m_ToBake.Count() != 0) + { + SAssetChange effect = m_ToBake.Pop(); + + BakeAssetOrAddToRetryStack(effect); + } + return m_ToBake.Count(); +} + +//---------------------------------------------------------------------------- + +bool CEffectBaker::IsChangeRegistered(const CString &path, EAssetChangesType type) +{ + for (u32 i = 0; i < m_ToBake.Count(); ++i) + { + if (m_ToBake[i].m_Type == type && path.Compare(m_ToBake[i].m_EffectPath)) + return true; + } + return false; +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::ReimportAssets(TArray &paths, bool importPkri /*=true*/) +{ + for (u32 i = 0; i < paths.Count(); ++i) + { + FileChangedRelativePath(paths[i]); + } + if (importPkri) + FileChangedRelativePath(m_LibraryDir + "/PopcornFXCore/Materials/Interface/Editor.pkri"); +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::ReimportAllAssets(bool refresh) +{ + (void)refresh; + + CPackExplorer packExplorer(m_SrcPack->Path(), m_BakeContext.m_BakeFSController); + packExplorer.Explore(); + + TMemoryView path = packExplorer.EffectPaths(); + + for (u32 i = 0; i < path.Count(); ++i) + { + FileChangedRelativePath(path[i]); + } +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::LoadProjectSettings(const CString &pkprojPath) +{ + CString projectSettingsFilePath; + HBO::CContext context; + if (pkprojPath.Empty()) + { + CProjectSettingsFinder finder(m_SrcPack->Path(), m_BakeContext.m_BakeFSController); + + finder.Walk(); + + projectSettingsFilePath = finder.ProjectSettingsPath(); + } + else + projectSettingsFilePath = pkprojPath; + + if (projectSettingsFilePath.Empty() || + !m_BakeContext.m_BakeFSController->Exists(projectSettingsFilePath, true)) + { + CLog::Log(PK_ERROR, "Could not find Project Settings in pack \"%s\"", m_SrcPack->Path().Data()); + return; + } + + const CString fileBuffer = m_BakeContext.m_BakeFSController->BufferizeToString(projectSettingsFilePath, true); + if (fileBuffer == null) + { + CLog::Log(PK_ERROR, "Failed to read project settings file at \"%s\"", projectSettingsFilePath.Data()); + return; + } + + CConstMemoryStream stream(fileBuffer.Data(), fileBuffer.Length()); + PProjectSettings projectSettings = CProjectSettings::LoadFromStream(stream, &context); + if (projectSettings == null) + { + CLog::Log(PK_ERROR, "Failed to load project settings file at \"%s\"", projectSettingsFilePath.Data()); + return; + } + + PProjectSettingsGeneral general = projectSettings->General(); + m_RootDir = general->RootDir(); + m_LibraryDir = general->LibraryDir(); + m_EditorCacheDir = general->EditorCacheDir(); + m_PresetsDir = general->PresetsDir(); +} + +//---------------------------------------------------------------------------- + +void CEffectBaker::GetAllAssetPath() +{ + CPackExplorer packExplorer(m_SrcPack->Path(), m_BakeContext.m_BakeFSController); + SDirectoryValidator directoryValidator(m_LibraryDir, m_EditorCacheDir, m_PresetsDir); + CPackExplorer::PathValidator directoryPathValidator = CPackExplorer::PathValidator(&(directoryValidator), &SDirectoryValidator::cmp); + + packExplorer.SetDirectoryPathValidator(directoryPathValidator); + packExplorer.Explore(); + + TMemoryView paths = packExplorer.EffectPaths(); + TArray pathChar(paths.Count()); + for (u32 i = 0; i < paths.Count(); ++i) + { + pathChar[i] = paths[i].Data(); + } +} + +//---------------------------------------------------------------------------- + +bool CEffectBaker::BakeAssetOrAddToRetryStack(SAssetChange &assetInfo) +{ + CLog::Log(PK_INFO, "Baking asset '%s' and its dependencies...", assetInfo.m_EffectPath.Data()); + if (!BakeAsset(assetInfo.m_EffectPath)) + { + CString errorLog = "Bake Error: " + assetInfo.m_EffectPath + " failed to bake"; + CAELog::TryLogErrorWindows(errorLog); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CEffectBaker::LoadAndBrowseEffect(const CString &path) +{ + PBaseObjectFile file = m_BakeContext.m_BakeContext->LoadFile(path); + + if (!PK_VERIFY(file != null)) + { + CLog::Log(PK_ERROR, "Could not load the effect file for '%s'", path.Data()); + return false; + } + + PEditorAssetEffect editorAssetEffect = file->FindFirstOf(); + if (!PK_VERIFY(editorAssetEffect != null)) + { + CLog::Log(PK_ERROR, "Could not find the CEditorAssetEffect object in file for '%s'", path.Data()); + return false; + } + CString pkboPath = CFilePath::StripExtension(path) + ".pkbo"; + IFileSystem *fileSystem = File::DefaultFileSystem(); + PFilePack dstPack = fileSystem->MountPack(m_DstPackPath); + + fileSystem->SetForcedFileCreationPack(dstPack); + PBaseObjectFile pkboFile = HBO::g_Context->LoadFile_AndCreateIFN_Pure(pkboPath.View(), false); + + + PEditorAssetEffect editorProp = pkboFile->FindFirstOf(); + if (editorProp == null) + { + editorProp = HBO::g_Context->NewObject(pkboFile.Get()); + } + editorProp->CopyFrom(editorAssetEffect.Get()); + + if (!PK_VERIFY(HBO::g_Context->WriteFile(pkboFile.Get(), pkboFile->Path()))) + { + return false; + } + fileSystem->SetForcedFileCreationPack(null); + editorAssetEffect = null; + file->Unload(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CEffectBaker::BakeAsset(const CString &path, bool bakeDependencies) +{ + if (m_BakedPaths.Contains(path)) + return true; + + m_BakedPaths.PushBack(path); + + if (bakeDependencies) + { + TArray dependencies; + + m_Cookery.GetAssetDependencies(path, dependencies); + for (u32 i = 0; i < dependencies.Count(); i++) + { + const CString &dependency = (dependencies[i]); + if (dependency == null || + dependency.EndsWith(".pkfx") || + dependency.EndsWith(".pkbo")) + continue; + if (BakeAsset(dependency, true) == false) + { + CLog::Log(PK_ERROR, "Asset Dependency of '%s' failed baking: '%s'", path.Data(), dependency.Data()); + return false; + } + } + } + PopcornFX::CMessageStream bakerErrors; + if (!m_Cookery.BakeAsset(path, m_Cookery.m_BaseConfigFile, bakerErrors)) + { + CLog::Log(PK_ERROR, "Couldn't bake effect '%s':", path.Data()); + bakerErrors.Log(); + return false; + } + if (path.EndsWith(".pkfx")) + { + LoadAndBrowseEffect(path); + } + return true; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_Attribute.cpp b/AE_GeneralPlugin/Sources/AEGP_Attribute.cpp new file mode 100644 index 00000000..22f0060e --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_Attribute.cpp @@ -0,0 +1,758 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_Attribute.h" +#include "AEGP_AEPKConversion.h" + +#include +#include + +#include "AEGP_FileWatcher.h" +#include "pk_kernel/include/kr_log_listeners_file.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "AEGP_World.h" + +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +SSamplerBase::SSamplerBase() + : m_SamplerDescriptor(null) +{ + +} + +//---------------------------------------------------------------------------- + +SSamplerBase::~SSamplerBase() +{ + m_SamplerDescriptor = null; +} + +//---------------------------------------------------------------------------- + +SSamplerShape::SSamplerShape() + : m_Type(SamplerShapeType_None) + , m_ShapeDesc(null) + , m_MeshBatch(null) +{ + +} + +//---------------------------------------------------------------------------- + +SSamplerShape::~SSamplerShape() +{ + m_ShapeDesc = null; + +} + +//---------------------------------------------------------------------------- + +#if (PK_GEOMETRICS_BUILD_MESH_SAMPLER_SURFACE != 0) + +bool SSamplerShape::CreateSurfaceSamplingStructs(const PResourceMeshBatch mesh) +{ + m_SurfaceSamplingStructs = PK_NEW(CMeshSurfaceSamplerStructuresRandom); + if (!PK_VERIFY(m_SurfaceSamplingStructs != null)) + return false; + return m_SurfaceSamplingStructs->Build(mesh->RawMesh()->TriangleBatch().m_IStream, mesh->RawMesh()->TriangleBatch().m_VStream.Positions()); +} + +//---------------------------------------------------------------------------- + +bool SSamplerShape::CreateSurfaceUVSamplingStructs(const PResourceMeshBatch mesh) +{ + m_SurfaceUVSamplingStructs = PK_NEW(CMeshSurfaceSamplerStructuresFromUV); + if (!PK_VERIFY(m_SurfaceUVSamplingStructs != null)) + return false; + return m_SurfaceUVSamplingStructs->Build(SMeshUV2PCBuildConfig(), mesh->RawMesh()->TriangleBatch().m_VStream, mesh->RawMesh()->TriangleBatch().m_IStream); +} + +#endif + +//---------------------------------------------------------------------------- + +#if (PK_GEOMETRICS_BUILD_MESH_SAMPLER_VOLUME != 0) +bool SSamplerShape::CreateVolumeSamplingStructs(const PResourceMeshBatch mesh) +{ + m_VolumeSamplingStructs = PK_NEW(CMeshVolumeSamplerStructuresRandom); + if (!PK_VERIFY(m_VolumeSamplingStructs != null)) + return false; + + if (!mesh->RawMesh()->HasTetrahedralMeshing()) + return false; + + return m_VolumeSamplingStructs->Build(mesh->RawMesh()->TriangleBatch().m_VStream.Positions(), mesh->RawMesh()->TetrahedralOtherPositions(), mesh->RawMesh()->TetrahedralIndices(), mesh->RawMesh()->TetrahedralIndicesCount()); +} +#endif + +//---------------------------------------------------------------------------- + +#if (PK_GEOMETRICS_BUILD_MESH_PROJECTION) && 0 +bool SSamplerShape::CreateProjectionStructs(const PResourceMeshBatch mesh) +{ + m_ProjectionStructs = PK_NEW(CMeshProjection); + if (!PK_VERIFY(m_ProjectionStructs != null)) + return false; + return m_ProjectionStructs->Build(mesh->RawMesh()->TriangleBatch()); +} +#endif + +//---------------------------------------------------------------------------- + +#if (PK_GEOMETRICS_BUILD_KDTREE != 0) +bool SSamplerShape::CreateKdTree(const PResourceMeshBatch mesh) +{ + m_KdTree = PK_NEW(CMeshKdTree); + if (!PK_VERIFY(m_KdTree != null)) + return false; + SMeshKdTreeBuildConfig buildConfig; + buildConfig.m_Flags |= SMeshKdTreeBuildConfig::LowQualityButFasterBuild; + return m_KdTree->Build(mesh->RawMesh()->TriangleBatch(), buildConfig); +} +#endif + +//---------------------------------------------------------------------------- + +bool SSamplerShape::UpdateShape(SShapeSamplerDescriptor *aeShapeDesc) +{ + CParticleSamplerDescriptor_Shape_Default *desc = static_cast(m_SamplerDescriptor.Get()); + + if (m_ShapeDesc == null || + m_Type != aeShapeDesc->m_Type) + { + m_Type = aeShapeDesc->m_Type; + // Create new shape descriptor: + switch (m_Type) + { + case SamplerShapeType_Box: + m_ShapeDesc = PK_NEW(CShapeDescriptor_Box(CFloat3(aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[1], aeShapeDesc->m_Dimension[2]))); + break; + case SamplerShapeType_Sphere: + m_ShapeDesc = PK_NEW(CShapeDescriptor_Sphere(aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[1])); + break; + case SamplerShapeType_Ellipsoid: + m_ShapeDesc = PK_NEW(CShapeDescriptor_Ellipsoid(aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[1])); + break; + case SamplerShapeType_Cylinder: + m_ShapeDesc = PK_NEW(CShapeDescriptor_Cylinder(aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[1], aeShapeDesc->m_Dimension[2])); + break; + case SamplerShapeType_Capsule: + m_ShapeDesc = PK_NEW(CShapeDescriptor_Capsule(aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[1], aeShapeDesc->m_Dimension[2])); + break; + case SamplerShapeType_Cone: + m_ShapeDesc = PK_NEW(CShapeDescriptor_Cone(aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[1])); + break; + case SamplerShapeType_Mesh: + m_ShapeDesc = PK_NEW(CShapeDescriptor_Mesh()); + break; + default: + break; + } + } + if (aeShapeDesc->m_Type == m_Type) + { + // Update shape descriptor: + if (m_Type == SamplerShapeType_Box) + { + static_cast(m_ShapeDesc.Get())->SetDimensions(CFloat3(aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[1], aeShapeDesc->m_Dimension[2])); + } + else if (m_Type == SamplerShapeType_Sphere) + { + CShapeDescriptor_Sphere *sphereDesc = static_cast(m_ShapeDesc.Get()); + sphereDesc->SetRadius(aeShapeDesc->m_Dimension[0]); + sphereDesc->SetInnerRadius(aeShapeDesc->m_Dimension[1]); + } + else if (m_Type == SamplerShapeType_Ellipsoid) + { + CShapeDescriptor_Ellipsoid *ellipsoidDesc = static_cast(m_ShapeDesc.Get()); + ellipsoidDesc->SetRadius(aeShapeDesc->m_Dimension[0]); + ellipsoidDesc->SetInnerRadius(aeShapeDesc->m_Dimension[1]); + } + else if (m_Type == SamplerShapeType_Cylinder) + { + CShapeDescriptor_Cylinder *cylinderDesc = static_cast(m_ShapeDesc.Get()); + cylinderDesc->SetRadius(aeShapeDesc->m_Dimension[0]); + cylinderDesc->SetHeight(aeShapeDesc->m_Dimension[1]); + cylinderDesc->SetInnerRadius(aeShapeDesc->m_Dimension[2]); + } + else if (m_Type == SamplerShapeType_Capsule) + { + CShapeDescriptor_Capsule *capsuleDesc = static_cast(m_ShapeDesc.Get()); + capsuleDesc->SetRadius(aeShapeDesc->m_Dimension[0]); + capsuleDesc->SetHeight(aeShapeDesc->m_Dimension[1]); + capsuleDesc->SetInnerRadius(aeShapeDesc->m_Dimension[2]); + } + else if (m_Type == SamplerShapeType_Cone) + { + CShapeDescriptor_Cone *coneDesc = static_cast(m_ShapeDesc.Get()); + coneDesc->SetRadius(aeShapeDesc->m_Dimension[0]); + coneDesc->SetHeight(aeShapeDesc->m_Dimension[1]); + } + else if (m_Type == SamplerShapeType_Mesh) + { + CShapeDescriptor_Mesh *meshDesc = static_cast(m_ShapeDesc.Get()); + + if (aeShapeDesc->m_Path.length() == 0) + return true; + + //Todo do it with the resource manager + CFilePackPath filePackPath = CFilePackPath::FromPhysicalPath(aeShapeDesc->m_Path.data(), File::DefaultFileSystem()); + + if (!filePackPath.Empty()) + { + CMessageStream loadReport; + PResourceMesh mesh = CResourceMesh::Load(File::DefaultFileSystem(), filePackPath, loadReport); + loadReport.Log(); + if (!PK_VERIFY(mesh != null)) + { + CLog::Log(PK_ERROR, "Fail loading the CMeshResource from the pkmm content"); + return false; + } + const u32 uSubMeshId = static_cast(0); + const u32 batchCount = mesh->BatchList().Count(); + if (!PK_VERIFY(uSubMeshId < batchCount)) + { + CLog::Log(PK_ERROR, "Cannot use the submesh ID %d: the mesh only has %d submeshes", uSubMeshId, batchCount); + return false; + } + m_MeshBatch = mesh->BatchList()[uSubMeshId]; + + // ------------------------------------------ + // Build KD Tree IFN + if ((aeShapeDesc->m_UsageFlags & SParticleDeclaration::SSampler::UsageFlags_Mesh_Intersect) != 0 || + (aeShapeDesc->m_UsageFlags & SParticleDeclaration::SSampler::UsageFlags_Mesh_Project) != 0 || + (aeShapeDesc->m_UsageFlags & SParticleDeclaration::SSampler::UsageFlags_Mesh_Contains) != 0 || + (aeShapeDesc->m_UsageFlags & SParticleDeclaration::SSampler::UsageFlags_Mesh_DistanceField) != 0) + { +#if (PK_GEOMETRICS_BUILD_KDTREE != 0) + if (!CreateKdTree(m_MeshBatch)) + CLog::Log(PK_WARN, "Failed building mesh kdTree acceleration structure"); + else + meshDesc->SetKdTree(m_KdTree); +#endif + } + +#if (PK_GEOMETRICS_BUILD_MESH_SAMPLER_SURFACE != 0) + // Build sampling info IFN + if ((aeShapeDesc->m_UsageFlags & SParticleDeclaration::SSampler::UsageFlags_Mesh_Sample) != 0) + { + if (!CreateSurfaceSamplingStructs(m_MeshBatch)) + CLog::Log(PK_WARN, "Failed building mesh surface-sampling acceleration structure"); + else + meshDesc->SetSamplingStructs(m_SurfaceSamplingStructs, null); + } + + // Build UV 2 PCoords info IFN + if ((aeShapeDesc->m_UsageFlags & SParticleDeclaration::SSampler::UsageFlags_Mesh_SampleFromUV) != 0) + { + if (!CreateSurfaceUVSamplingStructs(m_MeshBatch)) + CLog::Log(PK_WARN, "Failed building mesh uv-to-pcoords acceleration structure"); + else + meshDesc->SetUVSamplingStructs(m_SurfaceUVSamplingStructs, 0); + } +#endif +#if (PK_GEOMETRICS_BUILD_MESH_SAMPLER_VOLUME) + if ((aeShapeDesc->m_UsageFlags & SParticleDeclaration::SSampler::UsageFlags_Mesh_Sample) != 0) + { + if (!CreateVolumeSamplingStructs(m_MeshBatch)) + CLog::Log(PK_WARN, "Failed building mesh surface-sampling acceleration structure"); + } +#endif + meshDesc->SetMesh(m_MeshBatch->RawMesh()); + meshDesc->SetScale(CFloat3(aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[0], aeShapeDesc->m_Dimension[0])); + } + } + } + + if (desc == null && m_ShapeDesc != null) + { + desc = PK_NEW(CParticleSamplerDescriptor_Shape_Default(m_ShapeDesc.Get())); + m_SamplerDescriptor = desc; + } + else if (m_ShapeDesc != null) + { + desc->m_Shape = m_ShapeDesc.Get(); + } + + return true; +} + +//---------------------------------------------------------------------------- + +SSamplerImage::SSamplerImage() + : m_ImageDesc(null) + , m_TextureData(null) + , m_Width(0) + , m_Height(0) + , m_SizeInBytes(0) + , m_PixelFormat(CImage::EFormat::Format_Invalid) + , m_DensitySampler(null) + +{ +} + +//---------------------------------------------------------------------------- + +SSamplerImage::~SSamplerImage() +{ + PK_SAFE_DELETE(m_DensitySampler); + PK_SAFE_DELETE(m_ImageDesc); +} + +//---------------------------------------------------------------------------- + +bool SSamplerImage::UpdateImage(SImageSamplerDescriptor *aeImageDesc) +{ + const u32 width = m_Width; + const u32 height = m_Height; + const u32 sizeInBytes = m_SizeInBytes; + const CImage::EFormat format = m_PixelFormat; + + CParticleSamplerDescriptor_Image_Default *desc = static_cast(m_SamplerDescriptor.Get()); + + if (width == 0 || height == 0) + return false; + + CImageMap map; + + map.m_RawBuffer = m_TextureData; + map.m_Dimensions = CUint3(width, height, 1); + + CImageSampler *imageDesc = m_ImageDesc; + CImageSurface surface(map, format); + + if (imageDesc == null) + { + imageDesc = PK_NEW(CImageSamplerBilinear); + m_ImageDesc = imageDesc; + } + + if (!PK_VERIFY(m_ImageDesc != null)) + { + CLog::Log(PK_ERROR, "Could not create the image sampler"); + return false; + } + + if (!imageDesc->SetupFromSurface(surface)) + { + surface.Convert(CImage::Format_BGRA8); + if (!PK_VERIFY(imageDesc->SetupFromSurface(surface))) + { + CLog::Log(PK_ERROR, "Could not setup the image sampler"); + return false; + } + } + + if (desc == null) + { + desc = PK_NEW(CParticleSamplerDescriptor_Image_Default(m_ImageDesc)); + m_SamplerDescriptor = desc; + } + else + { + desc->m_Sampler = m_ImageDesc; + desc->m_ImageDimensions = m_ImageDesc->Dimensions(); + } + + if (aeImageDesc->m_UsageFlags & SParticleDeclaration::SSampler::UsageFlags_Image_Density) + { + if (m_DensitySampler == null) + { + m_DensitySampler = PK_NEW(SDensitySamplerData); + + PK_ASSERT(m_DensitySampler != null); + } + SDensitySamplerBuildSettings densityBuildSettings; + + if (!m_DensitySampler->Build(surface, densityBuildSettings)) + { + CLog::Log(PK_ERROR, "Could not build the density sampler"); + return false; + } + if (!desc->SetupDensity(m_DensitySampler)) + { + CLog::Log(PK_ERROR, "Could not setup the density image sampler"); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +SSamplerText::SSamplerText() +{ +} + +//---------------------------------------------------------------------------- + +SSamplerText::~SSamplerText() +{ +} + +//---------------------------------------------------------------------------- + +bool SSamplerText::UpdateText(STextSamplerDescriptor *aeTextDesc) +{ + m_Data = aeTextDesc->m_Data.c_str(); + + CParticleSamplerDescriptor_Text_Default *desc = static_cast(m_SamplerDescriptor.Get()); + + const CFontMetrics *fontKerning = null; + bool useKerning = false; + + if (desc == null) + { + desc = PK_NEW(CParticleSamplerDescriptor_Text_Default()); + m_SamplerDescriptor = desc; + } + if (desc != null) + { + if (!desc->_Setup(m_Data, fontKerning, useKerning)) + { + CLog::Log(PK_ERROR, "Could not setup the text descriptor"); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +SSamplerAudio::SSamplerAudio() + : m_Waveform(null) + , m_InputSampleCount(0) + , m_SampleCount(0) + , m_Name(null) + , m_SoundData(null) + , m_SamplingType(SamplingType_Unknown) + , m_WaveformData(null) + , m_BuiltThisFrame(false) +{ +} + +//---------------------------------------------------------------------------- + +SSamplerAudio::~SSamplerAudio() +{ + CleanAudioPyramid(); +} + +//---------------------------------------------------------------------------- + +bool SSamplerAudio::UpdateSound(SAudioSamplerDescriptor *aeSoundDesc) +{ + (void)aeSoundDesc; + CParticleSamplerDescriptor_Audio_Default *desc = static_cast(m_SamplerDescriptor.Get()); + + if (desc == null) + { + desc = PK_NEW(CParticleSamplerDescriptor_Audio_Default()); + m_SamplerDescriptor = desc; + } + m_Name = desc->m_ChannelGroupNameID; + return true; +} + +//---------------------------------------------------------------------------- + +bool SSamplerAudio::CleanAudioPyramid() +{ + for (u32 i = 0; i < m_WaveformPyramid.Count(); i++) + { + PK_FREE(m_WaveformPyramid[i]); + } + m_WaveformPyramid.Clean(); + return true; +} + +//---------------------------------------------------------------------------- + +unsigned int BitReverse(u32 x, int log2n) +{ + return IntegerTools::ReverseBits(x) >> (32 - log2n); +} + +void BasicFFT(std::complex *inputs, std::complex *outputs, int log2n) +{ + const float kPI = 3.1415926536f; + const std::complex kImag(0, 1); + u32 n = 1 << log2n; + for (u32 i = 0; i < n; ++i) + { + outputs[BitReverse(i, log2n)] = inputs[i]; + } + for (s32 s = 1; s <= log2n; ++s) + { + u32 m = 1 << s; + u32 m2 = m >> 1; + std::complex w(1, 0); + std::complex wm = exp(-kImag * (kPI / m2)); + for (u32 j = 0; j < m2; ++j) + { + for (u32 k = j; k < n; k += m) + { + std::complex t = w * outputs[k + m2]; + std::complex u = outputs[k]; + outputs[k] = u + t; + outputs[k + m2] = u - t; + } + w *= wm; + } + } +} + +//---------------------------------------------------------------------------- + +bool SSamplerAudio::BuildAudioPyramidIFN() +{ + PK_SCOPEDLOCK(m_Lock); + + if (m_InputSampleCount == 0 || + m_Waveform == null) + return false; + + m_SampleCount = 1024; + PK_ASSERT(m_InputSampleCount >= m_SampleCount); + if (m_SamplingType == SamplingType_Spectrum) + { + const u32 frequencyCount = m_SampleCount * 2; + PK_ASSERT(m_InputSampleCount >= frequencyCount); + TArray > inData; + TArray > outData; + + if (!PK_VERIFY(inData.Resize(m_InputSampleCount) && outData.Resize(frequencyCount))) + return false; + + for (u32 i = 0; i < m_InputSampleCount; ++i) + { + inData[i].real(m_Waveform[i]); + inData[i].imag(0); + } + BasicFFT(inData.RawDataPointer(), outData.RawDataPointer(), IntegerTools::Log2(frequencyCount)); + for (u32 j = 0; j < m_SampleCount; ++j) + { + m_Waveform[j] = std::sqrt(PKSquared(outData[j].real()) + PKSquared(outData[j].imag())) / static_cast(m_SampleCount); + } + } + + // lazy-allocation + if (m_WaveformData == null) + { + CleanAudioPyramid(); + + const u32 baseAllocSize = m_SampleCount; + // allocate two double borders to avoid checking for overflow during sampling w/ Cubic or Linear filters + const u32 baseByteCount = (2 + baseAllocSize + 2) * sizeof(*m_WaveformData); + m_WaveformData = (float*)PK_MALLOC_ALIGNED(baseByteCount, 0x80); + if (m_WaveformData == null) + return false; + Mem::Clear(m_WaveformData, baseByteCount); + + bool success = true; + const u32 pyramidSize = IntegerTools::Log2(m_SampleCount) + 1; + if (m_WaveformPyramid.Resize(pyramidSize)) + { + u32 currentCount = m_SampleCount; + for (u32 i = 1; i < pyramidSize; i++) + { + currentCount >>= 1; + PK_ASSERT(currentCount != 0); + const u32 mipByteCount = (2 + currentCount + 2) * sizeof(float); + m_WaveformPyramid[i] = (float*)PK_MALLOC_ALIGNED(mipByteCount, 0x10); + if (m_WaveformPyramid[i] != null) + Mem::Clear(m_WaveformPyramid[i], mipByteCount); + success &= (m_WaveformPyramid[i] != null); + } + } + m_WaveformPyramid[0] = m_WaveformData; + + if (!success) + { + m_WaveformData = null; + CleanAudioPyramid(); + return false; + } + } + + PK_ASSERT(m_WaveformData != null); + float *realDataPtr = m_WaveformData + 2; // ptr to the first real element, skipping the two-element border + memcpy(realDataPtr, m_Waveform, m_SampleCount * sizeof(*m_WaveformData)); + + { + const float firstEntry = realDataPtr[0]; + const float lastEntry = realDataPtr[m_SampleCount - 1]; + realDataPtr[-1] = firstEntry; // duplicate the first entry in the two start borders + realDataPtr[-2] = firstEntry; + realDataPtr[m_SampleCount + 0] = lastEntry; // duplicate the last entry in the two end borders + realDataPtr[m_SampleCount + 1] = lastEntry; + } + + // right, rebuild the spectrum pyramid: + if (!m_WaveformPyramid.Empty()) + { + u32 currentCount = m_SampleCount; + for (u32 i = 1; i < m_WaveformPyramid.Count(); i++) + { + const float * __restrict src = 2 + m_WaveformPyramid[i - 1]; + float * __restrict dst = 2 + m_WaveformPyramid[i]; + + currentCount >>= 1; + + // downsample + for (u32 j = 0; j < currentCount; j++) + { + dst[j] = 0.5f * (src[j * 2 + 0] + src[j * 2 + 1]); + } + + const float firstEntry = dst[0]; + const float lastEntry = dst[currentCount - 1]; + dst[-1] = firstEntry; // duplicate the first entry in the two start borders + dst[-2] = firstEntry; + dst[currentCount + 0] = lastEntry; // duplicate the last entry in the two end borders + dst[currentCount + 1] = lastEntry; + } + } + m_BuiltThisFrame = true; + return true; +} + +//---------------------------------------------------------------------------- + +bool SSamplerAudio::ReleaseAEResources() +{ + m_Waveform = null; + if (m_SoundData != null) + { + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(instance.GetAESuites()); + + result |= suites.SoundDataSuite1()->AEGP_UnlockSoundDataSamples(m_SoundData); + result |= suites.SoundDataSuite1()->AEGP_DisposeSoundData(m_SoundData); + + m_SoundData = null; + if (result != A_Err_NONE) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +SSamplerVectorField::SSamplerVectorField() +{ +} + +//---------------------------------------------------------------------------- + +SSamplerVectorField::~SSamplerVectorField() +{ +} + +//---------------------------------------------------------------------------- + +bool SSamplerVectorField::UpdateVectorField(SVectorFieldSamplerDescriptor * aeTurbulenceDesc) +{ + CParticleSamplerDescriptor_VectorField_Grid *desc = static_cast(m_SamplerDescriptor.Get()); + + if (m_Dirty == false) + return true; + + m_Dirty = false; + + if (desc == null) + { + desc = PK_NEW(CParticleSamplerDescriptor_VectorField_Grid()); + m_SamplerDescriptor = desc; + } + + + if (aeTurbulenceDesc->m_ResourceUpdate) + { + if (aeTurbulenceDesc->m_Path.length() == 0) + return true; + + CFilePackPath filePackPath = CFilePackPath::FromPhysicalPath(aeTurbulenceDesc->m_Path.data(), File::DefaultFileSystem()); + TResourcePtr rscVf = Resource::DefaultManager()->Load(filePackPath); + + CParticleSamplerDescriptor_VectorField_Grid::EDataType dataType = CParticleSamplerDescriptor_VectorField_Grid::DataType_Void; + switch (rscVf->m_DataType) + { + case VFDataType_Fp32: + dataType = CParticleSamplerDescriptor_VectorField_Grid::DataType_Fp32; + break; + case VFDataType_Fp16: + dataType = CParticleSamplerDescriptor_VectorField_Grid::DataType_Fp16; + break; + case VFDataType_U8SN: + dataType = CParticleSamplerDescriptor_VectorField_Grid::DataType_U8SN; + break; + default: + break; + } + CFloat4x4 transform = CFloat4x4::IDENTITY; + + transform.StrippedTranslations() = AAEToPK(aeTurbulenceDesc->m_Position); + + if (!(desc->Setup( rscVf->m_Dimensions, + rscVf->m_IntensityMultiplier, + rscVf->m_BoundsMin, + rscVf->m_BoundsMax, + rscVf->m_Data, + dataType, + aeTurbulenceDesc->m_Strength, //Strength + transform, //Xforms + 0, //Flags + AAEToPK(aeTurbulenceDesc->m_Interpolation)))) + return false; + } + else + { + CFloat4x4 transform = CFloat4x4::IDENTITY; + + transform.StrippedTranslations() = AAEToPK(aeTurbulenceDesc->m_Position); + + desc->SetTransforms(transform); + desc->SetStrength(aeTurbulenceDesc->m_Strength); + } + return true; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + diff --git a/AE_GeneralPlugin/Sources/AEGP_FileDialog.cpp b/AE_GeneralPlugin/Sources/AEGP_FileDialog.cpp new file mode 100644 index 00000000..0b0e4856 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_FileDialog.cpp @@ -0,0 +1,107 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include + +#include "AEGP_FileDialog.h" + +#include "AEGP_World.h" + +#include +#include + +__AEGP_PK_BEGIN + +#if defined(PK_MACOSX) + +//---------------------------------------------------------------------------- + +SMacFileDialogFilterData::SMacFileDialogFilterData(const CString desc, const CString type) + : m_Desc(desc) + , m_Type(type) +{ +} + +//---------------------------------------------------------------------------- + +SMacFileOpenData::SMacFileOpenData() +{ +} + +//---------------------------------------------------------------------------- + +SMacFileOpenData::~SMacFileOpenData() +{ +} + +//---------------------------------------------------------------------------- + +bool SMacFileOpenData::AddFilter(const CString &desc, const CString &type) +{ + if (!PK_VERIFY(m_Filters.PushBack(SMacFileDialogFilterData(desc, type)).Valid())) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool MacBasicFileOpen(SMacFileOpenData &data) +{ + TArray filters; + + for (u32 i = 0; i < data.m_Filters.Count(); ++i) + filters.PushBack(CFilePath::ExtractExtension(data.m_Filters[i].m_Type)); + + CString stringResult = OpenFileDialogMac(filters); + + if (!stringResult.Empty()) + { + data.m_Cb(stringResult); + return true; + } + return false; +} + +//---------------------------------------------------------------------------- + +#endif + +SFileDialog::SFileDialog() +{ + +} + +//---------------------------------------------------------------------------- + +bool SFileDialog::AddFilter(const CString &desc, const CString &type) +{ + if (!PK_VERIFY(m_Data.AddFilter(desc, type))) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool SFileDialog::IsCancelled() +{ + return m_Cancel; +} + +//---------------------------------------------------------------------------- + +bool SFileDialog::BasicFileOpen() +{ + m_Cancel = false; +#if defined(PK_WINDOWS) + HRESULT hr = WinBasicFileOpen(m_Data); + if (HRESULT_CODE(hr) == ERROR_CANCELLED) + m_Cancel = true; + return SUCCEEDED(hr); +#elif defined(PK_MACOSX) + return MacBasicFileOpen(m_Data); +#endif +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_FileDialogMac.mm b/AE_GeneralPlugin/Sources/AEGP_FileDialogMac.mm new file mode 100644 index 00000000..f6c45179 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_FileDialogMac.mm @@ -0,0 +1,66 @@ +#include "ae_precompiled.h" +#include "AEGP_FileDialogMac.h" + +#if defined(PK_OS_MACOSX) +#import + +#import +#import + +#include +#endif + +#include +#include + +__AEGP_PK_BEGIN + +#if defined(PK_OS_MACOSX) + +CString OpenFileDialogMac(const TArray &filters, const CString &defaultPathAndFile) +{ + TArray fileList; + + // Create a File Open Dialog class. + NSOpenPanel* openDlg = [NSOpenPanel openPanel]; + [openDlg setLevel:CGShieldingWindowLevel()]; + + // Set array of file types + NSMutableArray * fileTypesArray = [NSMutableArray array]; + for (unsigned int i = 0; i < filters.Count(); i++) + { + NSString * filt =[NSString stringWithUTF8String:filters[i].Data()]; + [fileTypesArray addObject:filt]; + } + + // Enable options in the dialog. + [openDlg setCanChooseFiles:YES]; + [openDlg setAllowedFileTypes:fileTypesArray]; + [openDlg setAllowsMultipleSelection:TRUE]; + + if (!defaultPathAndFile.Empty()) + { + [openDlg setDirectoryURL:[NSURL URLWithString:[NSString stringWithUTF8String:defaultPathAndFile.Data() ] ] ]; + } + + // Display the dialog box. If the OK pressed, + // process the files. + if ( [openDlg runModal] == NSModalResponseOK ) + { + // Gets list of all files selected + NSArray *files = [openDlg URLs]; + // Loop through the files and process them. + for (unsigned int i = 0; i < [files count]; i++ ) + { + // Do something with the filename. + fileList.PushBack(CString([[[files objectAtIndex:i] path] UTF8String])); + } + } + if (fileList.Empty()) + return CString(); + return fileList[0]; +} +#endif + + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_FileWatcher.cpp b/AE_GeneralPlugin/Sources/AEGP_FileWatcher.cpp new file mode 100644 index 00000000..f41c98f4 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_FileWatcher.cpp @@ -0,0 +1,113 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" +#include "AEGP_FileWatcher.h" + +__AEGP_PK_BEGIN +//---------------------------------------------------------------------------- + +bool CFileWatcher::CreateWatcherIFN() +{ + if (m_FileWatcher == null) + { + m_FileWatcher = CFileSystemWatcher::NewWatcher(); + if (!PK_VERIFY(m_FileWatcher != null)) + { + CLog::Log(PK_ERROR, "Could not create the file watcher"); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +void CFileWatcher::RemoveWatchIFN() +{ + if (m_FileWatcher != null) + m_FileWatcher->RemoveWatch(m_PathToWatch); +} + +//---------------------------------------------------------------------------- + +CFileWatcher::CFileWatcher() +{ +} + +//---------------------------------------------------------------------------- + +CFileWatcher::~CFileWatcher() +{ + RemoveWatchIFN(); + m_FileWatcher = null; +} + +//---------------------------------------------------------------------------- + +void CFileWatcher::PauseFileWatcher() +{ + RemoveWatchIFN(); +} + +//---------------------------------------------------------------------------- + +void CFileWatcher::RestartFileWatcher() +{ + SetWatchPack(m_PathToWatch); +} + +//---------------------------------------------------------------------------- + +bool CFileWatcher::SetWatchPack(const CString &pathToWatch) +{ + CString purifiedPath = pathToWatch; + CFilePath::Purify(purifiedPath); + purifiedPath.AppendSlash(); + + RemoveWatchIFN(); + CreateWatcherIFN(); + + m_PathToWatch = pathToWatch; + m_FileWatcher->AddWatch(m_PathToWatch); + return true; +} + +//---------------------------------------------------------------------------- + +void CFileWatcher::SetNotifierAdd(void(*callback)(const CString &filePath)) +{ + CreateWatcherIFN(); + m_FileWatcher->m_NotifierAdd.Clear(); + m_FileWatcher->m_NotifierAdd += callback; +} + +//---------------------------------------------------------------------------- + +void CFileWatcher::SetNotifierRemove(void(*callback)(const CString &filePath)) +{ + CreateWatcherIFN(); + m_FileWatcher->m_NotifierRemove.Clear(); + m_FileWatcher->m_NotifierRemove += callback; +} + +//---------------------------------------------------------------------------- + +void CFileWatcher::SetNotifierModify(void(*callback)(const CString &filePath)) +{ + CreateWatcherIFN(); + m_FileWatcher->m_NotifierModify.Clear(); + m_FileWatcher->m_NotifierModify += callback; +} + +//---------------------------------------------------------------------------- + +void CFileWatcher::SetNotifierRename(void(*callback)(const CString &oldFilePath, const CString &newFilePath)) +{ + CreateWatcherIFN(); + m_FileWatcher->m_NotifierRename.Clear(); + m_FileWatcher->m_NotifierRename += callback; +} + +//---------------------------------------------------------------------------- +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_FrameCollector.cpp b/AE_GeneralPlugin/Sources/AEGP_FrameCollector.cpp new file mode 100644 index 00000000..b977c768 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_FrameCollector.cpp @@ -0,0 +1,45 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_FrameCollector.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +CFrameCollector::CFrameCollector() +{ +} + +//---------------------------------------------------------------------------- + +CFrameCollector::~CFrameCollector() +{ +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::EarlyCull(const CAABB &bbox) const +{ + // Can happen if bounds are not active + if (!bbox.IsFinite() || + !bbox.Valid()) + return false; + + if (m_CullingFrustums.Empty()) + return false; + + const u32 viewCount = m_CullingFrustums.Count(); + for (u32 iView = 0; iView < viewCount; ++iView) + { + if (m_CullingFrustums[iView].Touches(bbox)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_LayerHolder.cpp b/AE_GeneralPlugin/Sources/AEGP_LayerHolder.cpp new file mode 100644 index 00000000..77cfd4ac --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_LayerHolder.cpp @@ -0,0 +1,155 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include +#include "AEGP_LayerHolder.h" + +#include "AEGP_Scene.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +HBO_CLASS_DEFINITION_BEGIN(CGraphicOverride) + .HBO_FIELD_DEFINITION(RendererID) + .HBO_FIELD_DEFINITION(PropertyID) + .HBO_FIELD_DEFINITION(Value) +HBO_CLASS_DEFINITION_END + +CGraphicOverride::CGraphicOverride() + : HBO_CONSTRUCT(CGraphicOverride) + +{ +} + +//---------------------------------------------------------------------------- + +CGraphicOverride::~CGraphicOverride() +{ +} + +//---------------------------------------------------------------------------- + +bool CGraphicOverride::operator==(const CGraphicOverride &other) +{ + if (other.m_RendererID == m_RendererID && + other.m_PropertyID == m_PropertyID) + return true; + return false; +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +HBO_CLASS_DEFINITION_BEGIN(CLayerProperty) + .HBO_FIELD_DEFINITION(CompName) + .HBO_FIELD_DEFINITION(ID) + .HBO_FIELD_DEFINITION(RendererProperties) +HBO_CLASS_DEFINITION_END + +CLayerProperty::CLayerProperty() + : HBO_CONSTRUCT(CLayerProperty) +{ +} + +//---------------------------------------------------------------------------- + +CLayerProperty::~CLayerProperty() +{ +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +SLayerHolder::SLayerHolder() +{ + +} + +//---------------------------------------------------------------------------- + +SLayerHolder::~SLayerHolder() +{ + + +} +//---------------------------------------------------------------------------- + +bool SLayerHolder::Clear(SPBasicSuite* suite) +{ + AEGP_SuiteHandler suites(suite); + + bool result = true; + if (m_Scene->Quit() == false) + result = false; + m_Scene = null; + + for (s32 i = m_SPendingAttributes.Count() - 1; i >= 0; --i) + { + if (m_SPendingAttributes[i].m_AttributeEffectRef != null) + suites.EffectSuite4()->AEGP_DisposeEffect(m_SPendingAttributes[i].m_AttributeEffectRef); + m_SPendingAttributes[i].m_AttributeEffectRef = null; + m_SPendingAttributes[i].m_Desc->m_IsDeleted = true; + m_SPendingAttributes[i].m_Desc = null; + } + m_SPendingAttributes.Clear(); + + for (auto &it : m_DeletedAttributes) + { + if (it.m_AttributeEffectRef != null) + suites.EffectSuite4()->AEGP_DisposeEffect(it.m_AttributeEffectRef); + it.m_AttributeEffectRef = null; + it.m_Desc->m_IsDeleted = true; + it.m_Desc = null; + } + m_DeletedAttributes.Clear(); + + for (auto &it : m_SpawnedAttributes) + { + if (it.m_AttributeEffectRef != null) + suites.EffectSuite4()->AEGP_DisposeEffect(it.m_AttributeEffectRef); + it.m_AttributeEffectRef = null; + it.m_Desc->m_IsDeleted = true; + it.m_Desc = null; + } + m_SpawnedAttributes.Clear(); + + for (auto &it : m_SpawnedAttributesSampler) + { + if (it.m_AttributeEffectRef != null) + suites.EffectSuite4()->AEGP_DisposeEffect(it.m_AttributeEffectRef); + it.m_AttributeEffectRef = null; + it.m_Desc->m_IsDeleted = true; + it.m_Desc = null; + } + m_SpawnedAttributes.Clear(); + + for (auto &it : m_SPendingEmitters) + { + if (it.m_EffectHandle) + it.m_EffectHandle = null; + it.m_Desc->m_IsDeleted = true; + it.m_Desc = null; + } + m_SPendingEmitters.Clear(); + + if (m_SpawnedEmitter.m_EffectHandle) + m_SpawnedEmitter.m_EffectHandle = null; + m_SpawnedEmitter.m_Desc->m_IsDeleted = true; + m_SpawnedEmitter.m_Desc = null; + + m_EffectLayer = null; + m_CameraLayer = null; + + PK_SAFE_DELETE(m_BackdropAudioWaveform); + PK_SAFE_DELETE(m_BackdropAudioSpectrum); + return result; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_Log.cpp b/AE_GeneralPlugin/Sources/AEGP_Log.cpp new file mode 100644 index 00000000..f09a78db --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_Log.cpp @@ -0,0 +1,108 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_Log.h" +#include "AEGP_World.h" + +//Suite +#include +#include + +//AE +#include +#include +#include + +__AEGP_PK_BEGIN +//---------------------------------------------------------------------------- + +bool CAELog::s_PKState = false; +SAAEIOData *CAELog::s_IOData = null; + +//---------------------------------------------------------------------------- + +bool CAELog::LogErrorWindows(SAAEIOData *AAEData, const CString errorStr) +{ + PK_ASSERT(errorStr.Length() < 256); + + if (s_PKState) + CLog::Log(PK_ERROR, errorStr); + if (AAEData == null || AAEData->m_OutData == null) + return false; + AAEData->m_OutData->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + sprintf(AAEData->m_OutData->return_msg, "%s", errorStr.Data()); + + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + SPBasicSuite *basicSuite = instance.GetAESuites(); + + if (basicSuite) + { + AEGP_SuiteHandler suites(basicSuite); + + suites.UtilitySuite6()->AEGP_WriteToDebugLog("PopcornFX Plugin", "Error", errorStr.Data()); + suites.AdvAppSuite2()->PF_InfoDrawText("PopcornFX Plugin [ERROR]", errorStr.Data()); + } + return false; +} + +//---------------------------------------------------------------------------- + +bool CAELog::SetIOData(SAAEIOData *AAEData) +{ + s_IOData = AAEData; + return true; +} + +//---------------------------------------------------------------------------- + +void CAELog::ClearIOData() +{ + s_IOData = null; +} + +//---------------------------------------------------------------------------- + +bool CAELog::TryLogErrorWindows(const CString errorStr) +{ + if (s_IOData == null) + return false; + LogErrorWindows(s_IOData, errorStr); + return false; +} + +//---------------------------------------------------------------------------- + +void CAELog::SetPKLogState(bool state) +{ + s_PKState = state; +} + +//---------------------------------------------------------------------------- + +bool CAELog::TryLogInfoWindows(const CString infoStr) +{ + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + + if (s_PKState) + CLog::Log(PK_INFO, infoStr); + + SPBasicSuite *basicSuite = instance.GetAESuites(); + + if (basicSuite) + { + AEGP_SuiteHandler suites(basicSuite); + + suites.UtilitySuite6()->AEGP_ReportInfo(instance.GetPluginID(), infoStr.Data()); + + suites.UtilitySuite6()->AEGP_WriteToDebugLog("PopcornFX Plugin", "Info", infoStr.Data()); + + suites.AdvAppSuite2()->PF_InfoDrawText("PopcornFX Plugin [INFO]", infoStr.Data()); + } + return true; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_Main.cpp b/AE_GeneralPlugin/Sources/AEGP_Main.cpp new file mode 100644 index 00000000..1dcb2410 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_Main.cpp @@ -0,0 +1,475 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_Main.h" +#include "AEGP_World.h" +#include "AEGP_FileDialog.h" +#include "AEGP_PopcornFXPlugins.h" +#include "AEGP_Scene.h" +#include "AEGP_AEPKConversion.h" +#include "AEGP_Log.h" +#include "AEGP_VaultHandler.h" +#include + +//AE +#include +#include + +#include + +#include + +using namespace PopcornFX; +//---------------------------------------------------------------------------- + +static SPAPI A_Err InitializePopcornFXIFN(AAePk::SAAEIOData& AAEData) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + if (AEGPPk::CPopcornFXWorld::Instance().InitializeIFN(AAEData) == false) + { + AEGPPk::CAELog::ClearIOData(); + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err HandleNewEmitterEvent(AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + if (AEGPPk::CPopcornFXWorld::Instance().HandleNewEmitterEvent(AAEData, descriptor) == false) + { + AEGPPk::CAELog::ClearIOData(); + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err HandleDeleteEmitterEvent(AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + if (AEGPPk::CPopcornFXWorld::Instance().HandleDeleteEmitterEvent(AAEData, descriptor) == false) + { + AEGPPk::CAELog::ClearIOData(); + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI bool CheckEmitterValidity(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + bool ret = AEGPPk::CPopcornFXWorld::Instance().CheckEmitterValidity(AAEData, descriptor); + AEGPPk::CAELog::ClearIOData(); + return ret; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err UpdateScene(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + if (AEGPPk::CPopcornFXWorld::Instance().UpdateScene(AAEData, descriptor) == false) + { + AEGPPk::CAELog::ClearIOData(); + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err UpdateEmitter(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + if (AEGPPk::CPopcornFXWorld::Instance().UpdateEmitter(AAEData, descriptor) == false) + { + AEGPPk::CAELog::ClearIOData(); + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err DisplayMarketplacePanel(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + + AEGPPk::CPopcornFXWorld::Instance().LaunchEditorAsPopup(AAEData, descriptor); + + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err DisplayBrowseEffectPanel(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + + AEGPPk::SFileDialog cbData; + + cbData.AddFilter("PopcornFX effect file (*.pkfx)", "*.pkfx"); + + struct SFunctor + { + void Function(const PopcornFX::CString path) + { + AEGPPk::CPopcornFXWorld::Instance().SetSelectedEffectFromPath(m_Descriptor, path); + } + + AAePk::SEmitterDesc *m_Descriptor = null; + }; + + static SFunctor functor; + + functor.m_Descriptor = descriptor; + cbData.SetCallback(PopcornFX::FastDelegate(&functor, &SFunctor::Function)); + + if (!cbData.BasicFileOpen()) + { + AEGPPk::CAELog::ClearIOData(); + if (cbData.IsCancelled()) + return A_Err_NONE; + return A_Err_GENERIC; + } + AEGPPk::CAELog::ClearIOData(); + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err DisplayBrowseMeshDialog(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + + AEGPPk::SFileDialog cbData; + + cbData.AddFilter("Baked Mesh file (*.fbx)", "*.fbx"); + + struct SFunctor + { + void Function(const CString path) + { + if (m_Descriptor != null) + { + AEGPPk::CPopcornFXWorld &world = AEGPPk::CPopcornFXWorld::Instance(); + AEGPPk::SResourceBakeConfig bakeConfig; + + m_Descriptor->m_BackdropMesh.m_Path = world.GetVaultHandler().BakeResource(path, bakeConfig).Data(); + bakeConfig.m_IsSkeletalAnim = true; + world.GetVaultHandler().BakeResource(path, bakeConfig).Data(); + m_Descriptor->m_LoadBackdrop = true; + m_Descriptor->m_UpdateBackdrop = true; + } + } + + AAePk::SEmitterDesc* m_Descriptor = null; + }; + + static SFunctor functor; + + functor.m_Descriptor = descriptor; + cbData.SetCallback(PopcornFX::FastDelegate(&functor, &SFunctor::Function)); + + + AEGPPk::CPopcornFXWorld &world = AEGPPk::CPopcornFXWorld::Instance(); + AEGPPk::SLayerHolder *layer = world.GetLayerForSEmitterDesc(descriptor); + + if (layer) + { + AEGP_LayerH layerH = null; + AEGP_SuiteHandler suites(world.GetAESuites()); + PF_Err result = A_Err_NONE; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + if (!PK_VERIFY(result == A_Err_NONE)) + return A_Err_GENERIC; + if (layerH != null) + layer->m_EffectLayer = layerH; + if (!cbData.BasicFileOpen()) + { + AEGPPk::CAELog::ClearIOData(); + if (cbData.IsCancelled()) + return A_Err_NONE; + return A_Err_GENERIC; + } + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err DisplayBrowseEnvironmentMapDialog(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + AEGPPk::SFileDialog cbData; + cbData.AddFilter("Image file", "*.*"); + + struct SFunctor + { + void Function(const CString path) + { + if (m_Descriptor != null) + { + AEGPPk::CPopcornFXWorld &world = AEGPPk::CPopcornFXWorld::Instance(); + AEGPPk::SResourceBakeConfig bakeConfig; + + bakeConfig.m_StraightCopy = true; + m_Descriptor->m_BackdropEnvironmentMap.m_Path = world.GetVaultHandler().BakeResource(path, bakeConfig).Data(); + m_Descriptor->m_Update = true; + } + } + AAePk::SEmitterDesc* m_Descriptor = null; + }; + + static SFunctor functor; + + functor.m_Descriptor = descriptor; + cbData.SetCallback(PopcornFX::FastDelegate(&functor, &SFunctor::Function)); + + if (!cbData.BasicFileOpen()) + { + AEGPPk::CAELog::ClearIOData(); + if (cbData.IsCancelled()) + return A_Err_NONE; + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err ReimportEffect(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + if (descriptor == null || descriptor->m_PathSource.empty()) + return A_Err_NONE; + + AEGPPk::CAELog::SetIOData(&AAEData); + + PopcornFX::CString path = PopcornFX::CString(descriptor->m_PathSource.c_str()) / PopcornFX::CString(descriptor->m_Name.c_str()); + + path = CFilePath::StripExtension(path) + ".pkfx"; + + AEGPPk::CPopcornFXWorld::Instance().SetSelectedEffectFromPath(descriptor, path, true); + + AEGPPk::CPopcornFXWorld::Instance().InvalidateEmitterRender(AAEData, descriptor); + + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err Display_AttributeSampler_BrowseMeshDialog(AAePk::SAAEIOData &AAEData, AAePk::SAttributeSamplerDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + AEGPPk::SFileDialog cbData; + + if (descriptor->m_Type == AAePk::AttributeSamplerType_Geometry) + { + cbData.AddFilter("Mesh file (*.fbx)", "*.fbx"); + } + else if (descriptor->m_Type == AAePk::AttributeSamplerType_VectorField) + { + cbData.AddFilter("Baked Mesh file (*.fga)", "*.fga"); + } + else + return A_Err_NONE; + + struct SFunctor + { + AAePk::SAttributeSamplerDesc* m_Descriptor = null; + + void Function(const CString path) + { + if (m_Descriptor != null) + { + AEGPPk::SResourceBakeConfig bakeConfig; + + if (m_Descriptor->m_Type == AEGPPk::AttributeSamplerType_Animtrack) + { + bakeConfig.m_IsAnimTrack = true; + } + + AEGPPk::CPopcornFXWorld &world = AEGPPk::CPopcornFXWorld::Instance(); + m_Descriptor->m_ResourcePath = world.GetVaultHandler().BakeResource(path, bakeConfig).Data(); + + } + } + }; + + static SFunctor functor; + + functor.m_Descriptor = descriptor; + cbData.SetCallback(PopcornFX::FastDelegate(&functor, &SFunctor::Function)); + + if (!cbData.BasicFileOpen()) + { + AEGPPk::CAELog::ClearIOData(); + if (cbData.IsCancelled()) + return A_Err_NONE; + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err SetParametersIndexes(const int *indexes, AAePk::EPKChildPlugins plugin) +{ + AEGPPk::CPopcornFXWorld::Instance().SetParametersIndexes(indexes, plugin); + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err ShutdownPopcornFXIFN(AAePk::SAAEIOData &AAEData) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + if (AEGPPk::CPopcornFXWorld::Instance().ShutdownIFN() == false) + { + AEGPPk::CAELog::ClearIOData(); + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err SetDefaultLayerPosition(AAePk::SAAEIOData& AAEData, AEGP_LayerH layer) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + if (AEGPPk::CPopcornFXWorld::Instance().SetDefaultLayerPosition(AAEData, layer) == false) + { + AEGPPk::CAELog::ClearIOData(); + return A_Err_GENERIC; + } + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static SPAPI A_Err MoveEffectIntoCurrentView(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + AEGPPk::CAELog::SetIOData(&AAEData); + if (AEGPPk::CPopcornFXWorld::Instance().MoveEffectIntoCurrentView(AAEData, descriptor) == false) + { + AEGPPk::CAELog::ClearIOData(); + return A_Err_GENERIC; + } + AEGPPk::CPopcornFXWorld::Instance().InvalidateEmitterRender(AAEData, descriptor); + AAEData.m_OutData->out_flags |= PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI; + + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +static PopcornFXSuite1 g_PopcornFXSuite = +{ + InitializePopcornFXIFN, + HandleNewEmitterEvent, + HandleDeleteEmitterEvent, + CheckEmitterValidity, + UpdateScene, + UpdateEmitter, + DisplayMarketplacePanel, + DisplayBrowseEffectPanel, + DisplayBrowseMeshDialog, + DisplayBrowseEnvironmentMapDialog, + ReimportEffect, + Display_AttributeSampler_BrowseMeshDialog, + ShutdownPopcornFXIFN, + SetParametersIndexes, + SetDefaultLayerPosition, + MoveEffectIntoCurrentView, +}; + +//---------------------------------------------------------------------------- + +A_Err EntryPointFunc( struct SPBasicSuite *pica_basicP, /* >> */ + A_long major_versionL, /* >> */ + A_long minor_versionL, /* >> */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_GlobalRefcon *global_refconP) /* << */ +{ + (void)global_refconP; + (void)minor_versionL; + (void)major_versionL; + + A_Err err = A_Err_NONE; + SPSuiteRef my_ref = 0; + AEGP_SuiteHandler suites(pica_basicP); + SuiteHelper panelSuite(pica_basicP); + SPSuitesSuite *suitesOfSuite = nullptr; + AEGP_Command command; + const A_u_char *commandName = (const A_u_char*)"PopcornFX"; + AEGPPk::CPopcornFXWorld &PKWorld = AEGPPk::CPopcornFXWorld::Instance(); + + *global_refconP = (AEGP_GlobalRefcon)&PKWorld; + + if (!PKWorld.Setup(pica_basicP, aegp_plugin_id)) + return A_Err_GENERIC; + + AEGP_RegisterSuite5 *registerSuite = suites.RegisterSuite5(); + if (registerSuite != NULL) + { + err |= registerSuite->AEGP_RegisterDeathHook(aegp_plugin_id, AEGPPk::CPopcornFXWorld::DeathHook, 0); + err |= registerSuite->AEGP_RegisterIdleHook(aegp_plugin_id, AEGPPk::CPopcornFXWorld::IdleHook, 0); + } + else + return A_Err_MISSING_SUITE; + + AEGP_CommandSuite1 *commandSuite = suites.CommandSuite1(); + if (commandSuite != NULL) + { + err |= commandSuite->AEGP_GetUniqueCommand(&command); + if (command != 0) + { + PKWorld.SetCommandHandle(command, (const char*)commandName); + err |= commandSuite->AEGP_InsertMenuCommand(command, (const A_char*)commandName, AEGP_Menu_WINDOW, AEGP_MENU_INSERT_SORTED); + } + } + else + return A_Err_MISSING_SUITE; + + err |= registerSuite->AEGP_RegisterCommandHook( aegp_plugin_id, + AEGP_HP_BeforeAE, + command, + &AEGPPk::CPopcornFXWorld::CommandHook, + (AEGP_CommandRefcon)(&PKWorld)); + err |= registerSuite->AEGP_RegisterUpdateMenuHook( aegp_plugin_id, + &AEGPPk::CPopcornFXWorld::UpdateMenuHook, + null); + err |= panelSuite->AEGP_RegisterCreatePanelHook( aegp_plugin_id, + commandName, + &AEGPPk::CPopcornFXWorld::CreatePanelHook, + (AEGP_CreatePanelRefcon)&PKWorld, + true); + + err |= pica_basicP->AcquireSuite(kSPSuitesSuite, kSPSuitesSuiteVersion, (const void **)&suitesOfSuite); + if (err == A_Err_NONE && suitesOfSuite) + { + err |= suitesOfSuite->AddSuite( kSPRuntimeSuiteList, + 0, + kPopcornFXSuite1, + kPopcornFXSuiteVersion1, + 1, + &g_PopcornFXSuite, + &my_ref); + err |= pica_basicP->ReleaseSuite(kSPSuitesSuite, kSPSuitesSuiteVersion); + } + return err; +} + +//---------------------------------------------------------------------------- diff --git a/AE_GeneralPlugin/Sources/AEGP_PackExplorer.cpp b/AE_GeneralPlugin/Sources/AEGP_PackExplorer.cpp new file mode 100644 index 00000000..5e7a3b0c --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_PackExplorer.cpp @@ -0,0 +1,124 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_PackExplorer.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +CPackExplorer::CPackExplorer(const CString &pack, IFileSystem *fileSystem) + : CFileDirectoryWalker(pack, IgnoreVirtualFS, fileSystem) + , m_Pack(pack) +{ +} + +//---------------------------------------------------------------------------- + +CPackExplorer::~CPackExplorer() +{ + m_Pack = null; +} + +//---------------------------------------------------------------------------- + +void CPackExplorer::Explore() +{ + if (!m_Pack.Empty()) + { + Walk(); + } +} + +//---------------------------------------------------------------------------- + +bool CPackExplorer::DirectoryNotifier(const CFilePack *pack, const char *fullPath, u32 directoryFirstCharPos) +{ + (void)directoryFirstCharPos; + (void)pack; + + const CString filename = CFilePath::ExtractFilename(fullPath); + + // go full recursive unless a hidden directory somehow ended up in the pack + return filename[0] != '.'; +} + +//---------------------------------------------------------------------------- + +void CPackExplorer::FileNotifier(const CFilePack *pack, const char *fullPath, u32 fileFirstCharPos) +{ + (void)fileFirstCharPos; + (void)pack; + + const char *extension = CFilePath::ExtractExtension(fullPath); + + // add the effect to the list + if (extension != null && !strcasecmp(extension, "pkfx")) + { + const CString effectPath = CFilePath::Relativize(m_Pack.Data(), fullPath); + + m_EffectPaths.PushBack(effectPath); + } +} + +//---------------------------------------------------------------------------- + +CBakedPackExplorer::CBakedPackExplorer(const CString &pack, IFileSystem *fileSystem) + : CFileDirectoryWalker(pack, IgnoreVirtualFS, fileSystem) + , m_Pack(pack) +{ +} + +//---------------------------------------------------------------------------- + +CBakedPackExplorer::~CBakedPackExplorer() +{ + m_Pack = null; +} + +//---------------------------------------------------------------------------- + +void CBakedPackExplorer::Explore() +{ + if (!m_Pack.Empty()) + { + Walk(); + } +} + +//---------------------------------------------------------------------------- + +bool CBakedPackExplorer::DirectoryNotifier(const CFilePack *pack, const char *fullPath, u32 directoryFirstCharPos) +{ + (void)directoryFirstCharPos; + (void)pack; + + const CString filename = CFilePath::ExtractFilename(fullPath); + + // go full recursive unless a hidden directory somehow ended up in the pack + return filename[0] != '.'; +} + +//---------------------------------------------------------------------------- + +void CBakedPackExplorer::FileNotifier(const CFilePack *pack, const char *fullPath, u32 fileFirstCharPos) +{ + (void)fileFirstCharPos; + (void)pack; + + const char *extension = CFilePath::ExtractExtension(fullPath); + + // add the effect to the list + if (extension != null && !strcasecmp(extension, "pkb")) + { + const CString effectPath = CFilePath::Relativize(m_Pack.Data(), fullPath); + + m_EffectPaths.PushBack(effectPath); + } +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_ParticleScene.cpp b/AE_GeneralPlugin/Sources/AEGP_ParticleScene.cpp new file mode 100644 index 00000000..ea69af9c --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_ParticleScene.cpp @@ -0,0 +1,134 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_ParticleScene.h" + +#include + +#include "AEGP_Scene.h" +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +void CAAEParticleScene::RayTracePacket( const Colliders::STraceFilter &traceFilter, + const Colliders::SRayPacket &packet, + const Colliders::STracePacket &results) +{ + (void)traceFilter; + PK_NAMEDSCOPEDPROFILE_C("CParticleSceneInterface: RayTracePacket", CFloat3(0.0f, 0.6f, 1.0f)); + // pre-conditions + PK_ASSERT(packet.m_RayOrigins_Aligned16.Count() == packet.m_RayDirectionsAndLengths_Aligned16.Count()); + PK_ASSERT(results.Count() == packet.m_RayOrigins_Aligned16.Count()); + + const s32 kMaskTrue = -1; + TStridedMemoryView enableMasks = packet.m_RayMasks_Aligned16; + if (enableMasks.Empty()) + enableMasks = TStridedMemoryView(&kMaskTrue, results.Count(), 0); + + if (!m_BackdropMeshes.Empty()) + { + // we've got a mesh to collide against. Store the previous ray lengths so we may + // detect which rays intersect the mesh: + PK_STACKALIGNEDMEMORYVIEW(float, prevHitTimes, results.Count(), 0x10); + Mem::Copy(prevHitTimes.Data(), results.m_HitTimes_Aligned16, results.Count() * sizeof(float)); + + const CFloat4x4 &meshXForms = m_BackdropMeshTransforms; + const CFloat4x4 meshXFormsInv = meshXForms.Inverse(); + + for (u32 i = 0; i < m_BackdropMeshes.Count(); ++i) + { + // trace the mesh: + m_BackdropMeshes[i]->TracePacket(CMeshNew::STraceFlags(), packet, results, &meshXForms, &meshXFormsInv); + + if (results.m_ContactObjects_Aligned16 != null) // the caller wants us to report contact objects + { + for (u32 j = 0; j < results.Count(); j++) + { + PK_ASSERT(results.m_HitTimes_Aligned16[j] <= prevHitTimes[j]); + + // if the hit time is different from the original hit-time, + // this ray has hit the mesh, set the contact object: + if (results.m_HitTimes_Aligned16[j] != prevHitTimes[j]) + results.m_ContactObjects_Aligned16[j] = CollidableObject::DEFAULT; + } + } + } + } +} + +//---------------------------------------------------------------------------- + +void CAAEParticleScene::ClearBackdropMesh() +{ + m_BackdropMeshes.Clear(); +} + +//---------------------------------------------------------------------------- + +void CAAEParticleScene::SetBackdropMeshTransform(const CFloat4x4 &transforms) +{ + m_BackdropMeshTransforms = transforms; +} + +//---------------------------------------------------------------------------- + +void CAAEParticleScene::SetBackdropMesh(const TResourcePtr &resourceMesh, const CFloat4x4 &transforms) +{ + m_BackdropMeshes.Clear(); + if (resourceMesh == null || resourceMesh->Empty()) + return; + for (const auto &staticBatch : resourceMesh->BatchList()) + { + m_BackdropMeshes.PushBack(staticBatch->RawMesh()); + } + m_BackdropMeshTransforms = transforms; +} + +//---------------------------------------------------------------------------- + +TMemoryView CAAEParticleScene::GetAudioSpectrum(CStringId channelGroup, u32 &outBaseCount) const +{ + PK_ASSERT(m_Parent != null); + SSamplerAudio *samplerAudio = m_Parent->GetAudioSamplerDescriptor(channelGroup, SSamplerAudio::SamplingType_Spectrum); + + if (samplerAudio == null) + return TMemoryView(); + + samplerAudio->m_SamplingType = SSamplerAudio::SamplingType_Spectrum; + + samplerAudio->BuildAudioPyramidIFN(); + + outBaseCount = samplerAudio->m_SampleCount; + if (samplerAudio->m_SampleCount == 0) + return TMemoryView(); + return TMemoryView(samplerAudio->m_WaveformPyramid.RawDataPointer(), samplerAudio->m_WaveformPyramid.Count()); +} + +//---------------------------------------------------------------------------- + +TMemoryView CAAEParticleScene::GetAudioWaveform(CStringId channelGroup, u32 &outBaseCount) const +{ + PK_ASSERT(m_Parent != null); + SSamplerAudio *samplerAudio = m_Parent->GetAudioSamplerDescriptor(channelGroup, SSamplerAudio::SamplingType_WaveForm); + + if (samplerAudio == null) + return TMemoryView(); + + samplerAudio->m_SamplingType = SSamplerAudio::SamplingType_WaveForm; + + samplerAudio->BuildAudioPyramidIFN(); + + outBaseCount = samplerAudio->m_SampleCount; + if (samplerAudio->m_SampleCount == 0) + return TMemoryView(); + return TMemoryView(samplerAudio->m_WaveformPyramid.RawDataPointer(), samplerAudio->m_WaveformPyramid.Count()); + +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_PopcornFXPlugins.cpp b/AE_GeneralPlugin/Sources/AEGP_PopcornFXPlugins.cpp new file mode 100644 index 00000000..c3efb2d3 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_PopcornFXPlugins.cpp @@ -0,0 +1,282 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_PopcornFXPlugins.h" + +#include +#include + +#define USE_COMPILER_BACKEND +#define USE_IMAGE_PLUGINS +#define USE_IMAGE_PLUGIN_TIFF +#define USE_IMAGE_PLUGIN_PKM +#define USE_IMAGE_PLUGIN_PVR +#define USE_FBXIMPORTER + +//------------------------------------------------------------------------------ +// +// toolkit to load/unload PKFX runtime plugins +// +//------------------------------------------------------------------------------ + +#ifdef PK_PLUGINS_STATIC +# if defined(USE_COMPILER_BACKEND) +PK_PLUGIN_DECLARE(CCompilerBackendCPU_VM); +# if defined(PK_PARTICLES_UPDATER_USE_D3D12) || defined(PK_PARTICLES_UPDATER_USE_D3D11) +PK_PLUGIN_DECLARE(CCompilerBackendGPU_D3D); +# endif +# endif + + +# if defined(USE_IMAGE_PLUGINS) +PK_PLUGIN_DECLARE(CImageDDSCodec); +PK_PLUGIN_DECLARE(CImagePNGCodec); +PK_PLUGIN_DECLARE(CImageTGACodec); +PK_PLUGIN_DECLARE(CImageJPEGCodec); +PK_PLUGIN_DECLARE(CImageHDRCodec); +# if defined(USE_IMAGE_PLUGIN_TIFF) +PK_PLUGIN_DECLARE(CImageTIFFCodec); +# endif +# if defined(USE_IMAGE_PLUGIN_PKM) +PK_PLUGIN_DECLARE(CImagePKMCodec); +# endif +# if defined(USE_IMAGE_PLUGIN_PVR) +PK_PLUGIN_DECLARE(CImagePVRCodec); +# endif +# endif + +# if defined(USE_FBXIMPORTER) +PK_PLUGIN_DECLARE(CMeshCodecFBX); +# endif + +# if defined(PK_DEBUG) +# define PK_PLUGIN_POSTFIX_BUILD "_D" +# else +# define PK_PLUGIN_POSTFIX_BUILD "" +# endif +# if defined(PK_WINDOWS) +# define PK_PLUGIN_POSTFIX_EXT ".dll" +# else +# define PK_PLUGIN_POSTFIX_EXT "" +# endif +#endif + +__AEGP_PK_BEGIN +//------------------------------------------------------------------------------ + +static u32 g_LoadedPlugins = 0; + +//----------------------------------------------------------------------------- +// +// Loads selected plugins +// +//----------------------------------------------------------------------------- + +bool PopcornRegisterPlugins(u32 selected /*= 0*/) +{ + PK_ASSERT(g_LoadedPlugins == 0); + + bool success = true; +#ifndef PK_PLUGINS_STATIC + // plugins are .dll + PopcornFX::CPluginManager::RegisterDirectory("Plugins", false); + +#else + // plugins are linked statically + if (selected & EPlugin_CompilerBackendVM) + { + const char *backendPath = "Plugins/CBCPU_VM" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *backend = StartupPlugin_CCompilerBackendCPU_VM(); + success &= (backend != null && PopcornFX::CPluginManager::PluginRegister(backend, true, backendPath)); + } +# if (PK_PARTICLES_UPDATER_USE_D3D12 != 0 || PK_PARTICLES_UPDATER_USE_D3D11 != 0) + if (selected & EPlugin_CompilerBackendD3D) + { + const char *backendPath = "Plugins/CBGPU_D3D" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *backend = StartupPlugin_CCompilerBackendGPU_D3D(); + success &= (backend != null && CPluginManager::PluginRegister(backend, true, backendPath)); + } +# endif +# ifdef USE_IMAGE_PLUGINS + if (selected & EPlugin_ImageCodecDDS) + { + const char *codecPathDDS = "Plugins/image_codec_dds" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codecDDS = StartupPlugin_CImageDDSCodec(); + success &= (codecDDS != null && PopcornFX::CPluginManager::PluginRegister(codecDDS, true, codecPathDDS)); + } + + if (selected & EPlugin_ImageCodecPNG) + { + const char *codecPathPNG = "Plugins/image_codec_png" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codecPNG = StartupPlugin_CImagePNGCodec(); + success &= (codecPNG != null && PopcornFX::CPluginManager::PluginRegister(codecPNG, true, codecPathPNG)); + } + + if (selected & EPlugin_ImageCodecJPG) + { + const char *codecPathJPG = "Plugins/image_codec_jpeg" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codecJPG = StartupPlugin_CImageJPEGCodec(); + success &= (codecJPG != null && PopcornFX::CPluginManager::PluginRegister(codecJPG, true, codecPathJPG)); + } + + if (selected & EPlugin_ImageCodecTGA) + { + const char *codecPathTGA = "Plugins/image_codec_tga" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codecTGA = StartupPlugin_CImageTGACodec(); + success &= (codecTGA != null && PopcornFX::CPluginManager::PluginRegister(codecTGA, true, codecPathTGA)); + } + + if (selected & EPlugin_ImageCodecHDR) + { + const char *codecPathHDR = "Plugins/image_codec_hdr" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codecHDR = StartupPlugin_CImageHDRCodec(); + success &= (codecHDR != null && PopcornFX::CPluginManager::PluginRegister(codecHDR, true, codecPathHDR)); + } +# endif + +# if defined(USE_IMAGE_PLUGIN_TIFF) + if (selected & EPlugin_ImageCodecTIFF) + { + const char *codecPathTIFF = "Plugins/image_codec_tiff" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codecTIFF = StartupPlugin_CImageTIFFCodec(); + success &= (codecTIFF != null && PopcornFX::CPluginManager::PluginRegister(codecTIFF, true, codecPathTIFF)); + } +# endif + +# if defined(USE_IMAGE_PLUGIN_PKM) + if (selected & EPlugin_ImageCodecPKM) + { + const char *codecPathPKM = "Plugins/image_codec_pkm" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codecPKM = StartupPlugin_CImagePKMCodec(); + success &= (codecPKM != null && PopcornFX::CPluginManager::PluginRegister(codecPKM, true, codecPathPKM)); + } +# endif + +# if defined(USE_IMAGE_PLUGIN_PVR) + if (selected & EPlugin_ImageCodecPVR) + { + const char *codecPathPVR = "Plugins/image_codec_pvr" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codecPVR = StartupPlugin_CImagePVRCodec(); + success &= (codecPVR != null && PopcornFX::CPluginManager::PluginRegister(codecPVR, true, codecPathPVR)); + } +# endif + +# if defined(USE_FBXIMPORTER) + if (selected & EPlugin_MeshCodecFBX) + { + const char *codecPath = "Plugins/MeshCodecFBX" PK_PLUGIN_POSTFIX_BUILD PK_PLUGIN_POSTFIX_EXT; + IPluginModule *codec = StartupPlugin_CMeshCodecFBX(); + success &= (codec != null && PopcornFX::CPluginManager::PluginRegister(codec, true, codecPath)); + } +# endif +#endif + + g_LoadedPlugins = selected; + return success; +} + +//----------------------------------------------------------------------------- +// +// Unloads all plugins +// +//----------------------------------------------------------------------------- + +void PopcornUnregisterPlugins() +{ + // unregister plugins: +#ifdef PK_PLUGINS_STATIC + if (g_LoadedPlugins & EPlugin_CompilerBackendVM) + { + IPluginModule *backend = GetPlugin_CCompilerBackendCPU_VM(); + (backend != null && PopcornFX::CPluginManager::PluginRelease(backend)); + ShutdownPlugin_CCompilerBackendCPU_VM(); + } + +# if (PK_PARTICLES_UPDATER_USE_D3D12 != 0 || PK_PARTICLES_UPDATER_USE_D3D11 != 0) + if (g_LoadedPlugins & EPlugin_CompilerBackendD3D) + { + IPluginModule *backend = GetPlugin_CCompilerBackendGPU_D3D(); + (backend != null && PopcornFX::CPluginManager::PluginRelease(backend)); + ShutdownPlugin_CCompilerBackendGPU_D3D(); + } +# endif +# ifdef USE_IMAGE_PLUGINS + if (g_LoadedPlugins & EPlugin_ImageCodecDDS) + { + IPluginModule *codecDDS = GetPlugin_CImageDDSCodec(); + (codecDDS != null && PopcornFX::CPluginManager::PluginRelease(codecDDS)); + ShutdownPlugin_CImageDDSCodec(); + } + + if (g_LoadedPlugins & EPlugin_ImageCodecPNG) + { + IPluginModule *codecPNG = GetPlugin_CImagePNGCodec(); + (codecPNG != null && PopcornFX::CPluginManager::PluginRelease(codecPNG)); + ShutdownPlugin_CImagePNGCodec(); + } + + if (g_LoadedPlugins & EPlugin_ImageCodecJPG) + { + IPluginModule *codecJPG = GetPlugin_CImageJPEGCodec(); + (codecJPG != null && PopcornFX::CPluginManager::PluginRelease(codecJPG)); + ShutdownPlugin_CImageJPEGCodec(); + } + + if (g_LoadedPlugins & EPlugin_ImageCodecTGA) + { + IPluginModule *codecTGA = GetPlugin_CImageTGACodec(); + (codecTGA != null && PopcornFX::CPluginManager::PluginRelease(codecTGA)); + ShutdownPlugin_CImageTGACodec(); + } + + if (g_LoadedPlugins & EPlugin_ImageCodecHDR) + { + IPluginModule *codecHDR = GetPlugin_CImageHDRCodec(); + (codecHDR != null && PopcornFX::CPluginManager::PluginRelease(codecHDR)); + ShutdownPlugin_CImageHDRCodec(); + } +# endif + +# if defined(USE_IMAGE_PLUGIN_TIFF) + if (g_LoadedPlugins & EPlugin_ImageCodecTIFF) + { + IPluginModule *codecTIFF = GetPlugin_CImageTIFFCodec(); + (codecTIFF != null && PopcornFX::CPluginManager::PluginRelease(codecTIFF)); + ShutdownPlugin_CImageTIFFCodec(); + } +# endif + +# if defined(USE_IMAGE_PLUGIN_PKM) + if (g_LoadedPlugins & EPlugin_ImageCodecPKM) + { + IPluginModule *codecPKM = GetPlugin_CImagePKMCodec(); + (codecPKM != null && PopcornFX::CPluginManager::PluginRelease(codecPKM)); + ShutdownPlugin_CImagePKMCodec(); + } +# endif + +# if defined(USE_IMAGE_PLUGIN_PVR) + if (g_LoadedPlugins & EPlugin_ImageCodecPVR) + { + IPluginModule *codecPVR = GetPlugin_CImagePVRCodec(); + (codecPVR != null && PopcornFX::CPluginManager::PluginRelease(codecPVR)); + ShutdownPlugin_CImagePVRCodec(); + } +# endif + +# if defined(USE_FBXIMPORTER) + if (g_LoadedPlugins & EPlugin_MeshCodecFBX) + { + IPluginModule *codec = GetPlugin_CMeshCodecFBX(); + (codec != null && PopcornFX::CPluginManager::PluginRelease(codec)); + ShutdownPlugin_CMeshCodecFBX(); + } +# endif +#endif + g_LoadedPlugins = 0; +} + +//------------------------------------------------------------------------------ +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_RenderContext.cpp b/AE_GeneralPlugin/Sources/AEGP_RenderContext.cpp new file mode 100644 index 00000000..e5558e55 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_RenderContext.cpp @@ -0,0 +1,703 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_RenderContext.h" +#include "AEGP_AEPKConversion.h" + +#include "PopcornFX_Suite.h" + +//AAE +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//CreateInternalWindow +#if defined(PK_MACOSX) +# include +# include +# include +#else +# include +# include +#endif + +#include +#include +//RHI +#include +#include + +//D3D11 +#if (PK_BUILD_WITH_D3D11_SUPPORT != 0) +#include "RenderApi/AEGP_D3D11Context.h" +#endif +//D3D12 +#if (PK_BUILD_WITH_D3D12_SUPPORT != 0) +#include "RenderApi/AEGP_D3D12Context.h" +#endif +#if (PK_BUILD_WITH_METAL_SUPPORT != 0) +#include "RenderApi/AEGP_MetalContext.h" +#endif + +#include "RenderApi/AEGP_CopyPixels.h" + +//Samples +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +CAAEBaseContext *CAAERenderContext::m_AEGraphicContext = null; +Threads::CCriticalSection CAAERenderContext::m_AEGraphicContextLock; + +//---------------------------------------------------------------------------- + +CAAERenderContext::CAAERenderContext() +: m_WindowHandle(null) +, m_DeviceContext(null) +, m_Width(0) +, m_Height(0) +, m_Initialized(false) +, m_RHIRendering(null) +, m_ShaderLoader(null) +{ +} + +//---------------------------------------------------------------------------- + +CAAERenderContext::~CAAERenderContext() +{ + PKSample::SPassDescription::s_PassDescriptions.Clean(); +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::InitializeIFN(RHI::EGraphicalApi api, const CString &className) +{ + if (m_Initialized == true) + { + return true; + } + m_API = api; + + if (!CreateInternalWindowIFN(className)) + return false; + + PK_SCOPEDLOCK(m_AEGraphicContextLock); + if (m_AEGraphicContext == null) + { + switch (m_API) + { + #if (PK_BUILD_WITH_METAL_SUPPORT != 0) + case (RHI::GApi_Metal): + m_AEGraphicContext = PK_NEW(CAAEMetalContext); + break; + #endif + #if (PK_BUILD_WITH_D3D11_SUPPORT != 0) + case (RHI::GApi_D3D11): + m_AEGraphicContext = PK_NEW(CAAED3D11Context); + break; + #endif + #if (PK_BUILD_WITH_D3D12_SUPPORT != 0) + case (RHI::GApi_D3D12): + m_AEGraphicContext = PK_NEW(CAAED3D12Context); + break; + #endif + default: + CLog::Log(PK_ERROR, "No compatible API context could be created"); + PK_ASSERT_NOT_REACHED(); + return false; + break; + } + if (!PK_VERIFY(m_AEGraphicContext != null)) + return false; + if (!PK_VERIFY(m_AEGraphicContext->CreatePlatformContext(m_WindowHandle, m_DeviceContext))) + { + CLog::Log(PK_ERROR, "CreatePlatformContext failed"); + return false; + } + if (!PK_VERIFY(m_AEGraphicContext->InitIFN())) + { + CLog::Log(PK_ERROR, "Graphic context initialization failed"); + return false; + } + } + m_Initialized = true; + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::Destroy() +{ + PK_SAFE_DELETE(m_RHIRendering); + PK_SAFE_DELETE(m_AEGraphicContext); + m_Initialized = false; + return true; +} + +//---------------------------------------------------------------------------- +// GETTER +//---------------------------------------------------------------------------- + +PKSample::CRHIParticleSceneRenderHelper *CAAERenderContext::GetCurrentSceneRenderer() +{ + PK_ASSERT(m_RHIRendering != null); + return m_RHIRendering; +} + +//---------------------------------------------------------------------------- + +CUint2 CAAERenderContext::GetViewportSize() const +{ + return CUint2{ m_Width, m_Height }; +} + +//---------------------------------------------------------------------------- + +void CAAERenderContext::LogGraphicsErrors() +{ + m_AEGraphicContext->LogApiError(); +} + +//---------------------------------------------------------------------------- + +CAAEBaseContext *CAAERenderContext::GetAEGraphicContext() +{ + return m_AEGraphicContext; +} + +//---------------------------------------------------------------------------- +// Setter +//---------------------------------------------------------------------------- + +void CAAERenderContext::SetShaderLoader(PKSample::CShaderLoader *shaderLoader) +{ + m_ShaderLoader = shaderLoader; +} + +//---------------------------------------------------------------------------- + +PKSample::CShaderLoader *CAAERenderContext::GetShaderLoader() +{ + return m_ShaderLoader; +} + +//---------------------------------------------------------------------------- + +void CAAERenderContext::SetPostFXOptions(PKSample::SParticleSceneOptions &postFXOptions) +{ + m_SceneOptions = postFXOptions; +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::SetAsCurrentContext() +{ + PK_ASSERT(m_DeviceContext != null); + + return m_AEGraphicContext->SetAsCurrent(m_DeviceContext); +} + +//---------------------------------------------------------------------------- + +//Used for IMGUI Context +bool CAAERenderContext::RenderFrameBegin(u32 width, u32 height) +{ + if (!PK_VERIFY(SetAsCurrentContext())) + return false; + if (m_Width != width || m_Height != height) + { + if (InitGraphicContext(m_Format, width, height) == false) + return false; + } + //Frame + return m_AEGraphicContext->BeginFrame(); +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::RenderFrameEnd() +{ + return m_AEGraphicContext->EndFrame(); +} + +//---------------------------------------------------------------------------- +// AEE Interface +//---------------------------------------------------------------------------- + +bool CAAERenderContext::InitGraphicContext(RHI::EPixelFormat rhiformat, u32 width, u32 height) +{ + PK_SCOPEDPROFILE(); + + // Force the format to 32bpc for precision issues: + rhiformat = RHI::EPixelFormat::FormatFloat32RGBA; + + bool updateRHISize = false; + if (m_Format != rhiformat || m_Width != width || m_Height != height) + updateRHISize = true; + m_Format = rhiformat; + m_Width = width; + m_Height = height; + + RHI::PApiManager apiManager = m_AEGraphicContext->GetApiManager(); + + if (!m_AEGraphicContext->CreateRenderTarget(m_Format, CUint3{ m_Width, m_Height, 1 })) + { + CLog::Log(PK_ERROR, "Graphic context CreateRenderTarget failed"); + return false; + } + + bool newRHIRendering = false; + if (m_RHIRendering == null) + { + m_RHIRendering = PK_NEW(PKSample::CRHIParticleSceneRenderHelper); + if (!PK_VERIFY(m_RHIRendering != null)) + return false; + if (!PK_VERIFY(m_ShaderLoader != null)) + { + CLog::Log(PK_ERROR, "Shader loader was not properly set on the render context"); + return false; + } + + if (!m_RHIRendering->Init( apiManager, m_ShaderLoader, Resource::DefaultManager(), + PKSample::CRHIParticleSceneRenderHelper::InitRP_All)) + { + CLog::Log(PK_ERROR, "RHIRendering Initialisation failed"); + return false; + } + newRHIRendering = true; + } + if (updateRHISize || newRHIRendering) + { + if (!m_RHIRendering->Resize(m_AEGraphicContext->GetCurrentSwapChain())) + { + CLog::Log(PK_ERROR, "Particle render scene Resize failed"); + return false; + } + if (!m_RHIRendering->SetupPostFX_Distortion(m_SceneOptions.m_Distortion, newRHIRendering)) + { + CLog::Log(PK_ERROR, "Particle render scene SetupPostFX_Distortion failed"); + return false; + } + if (!m_RHIRendering->SetupPostFX_ToneMapping(m_SceneOptions.m_ToneMapping, m_SceneOptions.m_Vignetting, true /*dithering*/, newRHIRendering, false)) + { + CLog::Log(PK_ERROR, "Particle render scene SetupPostFX_ToneMapping failed"); + return false; + } + if (!m_RHIRendering->SetupPostFX_Bloom(m_SceneOptions.m_Bloom, newRHIRendering, true)) + { + CLog::Log(PK_ERROR, "Particle render scene SetupPostFX_Bloom failed"); + return false; + } + if (!m_RHIRendering->SetupPostFX_FXAA(m_SceneOptions.m_FXAA, newRHIRendering, false)) + { + CLog::Log(PK_ERROR, "Particle render scene SetupPostFX_FXAA failed"); + return false; + } + if (!m_RHIRendering->SetupShadows()) + { + CLog::Log(PK_ERROR, "Particle render scene SetupShadows failed"); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::AERenderFrameBegin(SAAEIOData &AAEData, bool getBackground /*=true*/) +{ + PK_SCOPEDPROFILE(); + PF_PixelFormat format = PF_PixelFormat_INVALID; + RHI::EPixelFormat rhiFormat = RHI::EPixelFormat::FormatUnknown; + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + PK_ASSERT(m_AEGraphicContext != null); + m_AEGraphicContext->SetAsCurrent(m_DeviceContext); + { + PK_NAMEDSCOPEDPROFILE("checkout_layer_pixels"); + AAEData.m_ExtraData.m_SmartRenderData->cb->checkout_layer_pixels(AAEData.m_InData->effect_ref, 0, &m_InputWorld); + if (!PK_VERIFY(m_InputWorld != null)) + { + CLog::Log(PK_ERROR, "Checkout AE input world failed"); + return false; + } + AAEData.m_ExtraData.m_SmartRenderData->cb->checkout_output(AAEData.m_InData->effect_ref, &m_OutputWorld); + if (!PK_VERIFY(m_OutputWorld != null)) + { + CLog::Log(PK_ERROR, "Checkout AE output world failed"); + ResetCheckedOutWorlds(AAEData); + return false; + } + } + + AAEData.m_WorldSuite->PF_GetPixelFormat(m_InputWorld, &format); + + rhiFormat = AAEToPK(format); + + u32 width = (u32)m_InputWorld->width; + u32 height = (u32)m_InputWorld->height; + + m_AAEFormat = format; + + if (m_Width != width || m_Height != height) + { + if (InitGraphicContext(rhiFormat, width, height) == false) + { + CLog::Log(PK_ERROR, "InitGraphicContext failed"); + ResetCheckedOutWorlds(AAEData); + return false; + } + } + + //Frame + if (!PK_VERIFY(m_AEGraphicContext->BeginFrame())) + { + CLog::Log(PK_ERROR, "Graphic context BeginFrame failed"); + ResetCheckedOutWorlds(AAEData); + return false; + } + + if (getBackground) + { + if (!GetCompositingBuffer(AAEData, suites, m_InputWorld, m_OutputWorld, format)) + { + CLog::Log(PK_ERROR, "GetCompositingBuffer failed"); + ResetCheckedOutWorlds(AAEData); + m_AEGraphicContext->EndFrame(); + return false; + } + } + else + m_RHIRendering->SetBackGroundTexture(null); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::AERenderFrameEnd(SAAEIOData &AAEData) +{ + PK_SCOPEDPROFILE(); + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + + m_AEGraphicContext->EndFrame(); + + if (m_InputWorld == null || m_OutputWorld == null) + { + ResetCheckedOutWorlds(AAEData); + return false; + } + RenderToSAAEWorld(AAEData, suites, m_InputWorld, m_OutputWorld, m_AAEFormat); + ResetCheckedOutWorlds(AAEData); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::RenderToSAAEWorld(SAAEIOData &AAEData, AEGP_SuiteHandler &suiteHandler, PF_EffectWorld *inputWorld, PF_EffectWorld *effectWorld, PF_PixelFormat format) +{ + PK_SCOPEDPROFILE(); + + u32 requiredBufferSize = GetPixelSizeFromPixelFormat(m_Format) * inputWorld->width * inputWorld->height; + if (m_DownloadBuffer == null || m_DownloadBufferSize < requiredBufferSize) + { + m_DownloadBufferSize = requiredBufferSize; + if (m_DownloadBuffer != null) + m_DownloadBuffer = null; + m_DownloadBuffer = CRefCountedMemoryBuffer::Alloc(requiredBufferSize); + PK_ASSERT(m_DownloadBuffer != null); + } + + if (!m_AEGraphicContext->FillRenderBuffer(m_DownloadBuffer, m_RHIRendering->GetFinalFrameBuffers(0), m_Format, m_Width, m_Height, m_Width)) + { + CLog::Log(PK_ERROR, "FillRenderBuffer failed"); + return false; + } + + + PF_Err res = PF_Err_NONE; + + switch (format) + { + case PF_PixelFormat_ARGB128: + { + PK_NAMEDSCOPEDPROFILE("CopyPixelOut32"); + SCopyPixel refcon = { m_DownloadBuffer, inputWorld, m_Gamma, m_IsOverride, m_AlphaValue }; + + res = suiteHandler.IterateFloatSuite1()->iterate( AAEData.m_InData, + 0, + inputWorld->height, + inputWorld, + null, + reinterpret_cast(&refcon), + CopyPixelOut32, + effectWorld); + break; + } + case PF_PixelFormat_ARGB64: + { + PK_NAMEDSCOPEDPROFILE("CopyPixelOut16"); + SCopyPixel refcon = { m_DownloadBuffer, inputWorld, m_Gamma, m_IsOverride, m_AlphaValue }; + + res = suiteHandler.Iterate16Suite1()->iterate( AAEData.m_InData, + 0, + inputWorld->height, + inputWorld, + null, + reinterpret_cast(&refcon), + CopyPixelOut16, + effectWorld); + break; + } + + case PF_PixelFormat_ARGB32: + { + PK_NAMEDSCOPEDPROFILE("CopyPixelOut8"); + SCopyPixel refcon = { m_DownloadBuffer, inputWorld, m_Gamma, m_IsOverride, m_AlphaValue }; + + res = suiteHandler.Iterate8Suite1()->iterate( AAEData.m_InData, + 0, + inputWorld->height, + inputWorld, + null, + reinterpret_cast(&refcon), + CopyPixelOut8, + effectWorld); + break; + } + default: + PK_ASSERT(true); + break; + } + + if (res != PF_Err_NONE) + { + AAEData.m_ReturnCode = res; + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::GetCompositingBuffer(SAAEIOData &AAEData, AEGP_SuiteHandler &suiteHandler, PF_EffectWorld *inputWorld, PF_EffectWorld *effectWorld, PF_PixelFormat format) +{ + PK_SCOPEDPROFILE(); + PF_Err res = PF_Err_NONE; + RHI::EPixelFormat rhiFormat = RHI::FormatFloat32RGBA; + + PF_Rect rect = inputWorld->extent_hint; + PF_Point origin; + + origin.h = (A_short)(AAEData.m_InData->output_origin_x); + origin.v = (A_short)(AAEData.m_InData->output_origin_y); + + // We always copy the pixels in 32 bpc + u32 requiredBufferSize = sizeof(CFloat4) * inputWorld->width * inputWorld->height; + if (m_UploadBuffer == null || m_UploadBufferSize < requiredBufferSize) + { + m_UploadBufferSize = requiredBufferSize; + m_UploadBuffer = CRefCountedMemoryBuffer::Alloc(requiredBufferSize); + PK_ASSERT(m_UploadBuffer != null); + } + void *srcBuffer = m_UploadBuffer->Data(); + + switch (format) + { + case PF_PixelFormat_ARGB128: + { + PK_NAMEDSCOPEDPROFILE("CopyPixelIn32_TryCatch"); + SCopyPixel refcon = { m_UploadBuffer, inputWorld, m_Gamma, m_IsOverride, m_AlphaValue }; + + try + { + PK_NAMEDSCOPEDPROFILE("CopyPixelIn32"); + res = suiteHandler.IterateFloatSuite1()->iterate_origin_non_clip_src(AAEData.m_InData, 0, inputWorld->height, inputWorld, &rect, &origin, + reinterpret_cast(&refcon), CopyPixelIn32, effectWorld); + } + catch (PF_Err& thrownErr) + { + res = thrownErr; + } + catch (...) + { + res = PF_Err_OUT_OF_MEMORY; + } + if (res == A_Err_NONE) + { + if (!m_AEGraphicContext->FillCompositingTexture(srcBuffer, rhiFormat, inputWorld->width, inputWorld->height, inputWorld->rowbytes / sizeof(PF_Pixel32))) + res = A_Err_GENERIC; + } + break; + } + case PF_PixelFormat_ARGB64: + { + PK_NAMEDSCOPEDPROFILE("CopyPixelIn16_TryCatch"); + SCopyPixel refcon = { m_UploadBuffer, inputWorld, m_Gamma, m_IsOverride, m_AlphaValue }; + + try + { + PK_NAMEDSCOPEDPROFILE("CopyPixelIn16"); + res = suiteHandler.Iterate16Suite1()->iterate_origin_non_clip_src(AAEData.m_InData, 0, inputWorld->height, inputWorld, &rect, &origin, + reinterpret_cast(&refcon), CopyPixelIn16, effectWorld); + } + catch (PF_Err& thrownErr) + { + res = thrownErr; + } + catch (...) + { + res = PF_Err_OUT_OF_MEMORY; + } + if (res == A_Err_NONE) + { + if (!m_AEGraphicContext->FillCompositingTexture(srcBuffer, rhiFormat, inputWorld->width, inputWorld->height, inputWorld->rowbytes / sizeof(PF_Pixel32))) + res = A_Err_GENERIC; + } + break; + } + + case PF_PixelFormat_ARGB32: + { + PK_NAMEDSCOPEDPROFILE("CopyPixelIn8_TryCatch"); + SCopyPixel refcon = { m_UploadBuffer, inputWorld, m_Gamma, m_IsOverride, m_AlphaValue }; + + try + { + PK_NAMEDSCOPEDPROFILE("CopyPixelIn8"); + res = suiteHandler.Iterate8Suite1()->iterate_origin_non_clip_src(AAEData.m_InData, 0, inputWorld->height, inputWorld, &rect, &origin, + reinterpret_cast(&refcon), CopyPixelIn8, effectWorld); + } + catch (PF_Err& thrownErr) + { + res = thrownErr; + } + catch (...) + { + res = PF_Err_OUT_OF_MEMORY; + } + if (res == A_Err_NONE) + { + if (!m_AEGraphicContext->FillCompositingTexture(srcBuffer, rhiFormat, inputWorld->width, inputWorld->height, inputWorld->rowbytes / sizeof(PF_Pixel32))) + res = A_Err_GENERIC; + } + break; + } + default: + break; + } + if (res) + { + AAEData.m_ReturnCode = res; + if (res == PF_Interrupt_CANCEL) + return false; + CLog::Log(PK_WARN, "Unknown error"); + return false; + } + + if (res == A_Err_NONE) + m_RHIRendering->SetBackGroundTexture(m_AEGraphicContext->GetCompositingTexture()); + + if (res != PF_Err_NONE) + { + AAEData.m_ReturnCode = res; + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +CUint2 CAAERenderContext::GetContextSize() +{ + return CUint2(m_Width, m_Height); +} + +//---------------------------------------------------------------------------- + +void CAAERenderContext::ResetCheckedOutWorlds(SAAEIOData &AAEData) +{ + AAEData.m_ExtraData.m_SmartRenderData->cb->checkin_layer_pixels(AAEData.m_InData->effect_ref, 0); + m_InputWorld = null; + m_OutputWorld = null; +} + +//---------------------------------------------------------------------------- + +bool CAAERenderContext::CreateInternalWindowIFN(const CString& className) +{ + if (m_WindowHandle != null) + return true; +#if defined(PK_MACOSX) + (void)className; + NSRect frameRect = NSMakeRect(100, 100 , 256, 256); + NSView *view = [[NSView alloc] initWithFrame:frameRect]; + [view setHidden:NO]; + [view setNeedsDisplay:YES]; + + NSWindow *myWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(100,100,256,256) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO]; + [myWindow setContentView:view]; + //[myWindow makeKeyAndOrderFront:self]; + + m_WindowHandle = (void*)myWindow; + m_DeviceContext = null; + return m_WindowHandle != null; +#else + MSG uMsg; + + ::memset(&uMsg, 0, sizeof(uMsg)); + + // tricky, windows needs a unique class name for each window instance + // to derive a unique name, a pointer to "this" is used + static std::atomic_int S_cnt; + std::stringstream ss; + + ss << " PK_Win_Class" << S_cnt.load(); + S_cnt++; + CString name = className + CString(ss.str().c_str()); + + WNDCLASSEX winClass; + ::memset(&winClass, 0, sizeof(winClass)); + winClass.lpszClassName = name.Data(); + winClass.cbSize = sizeof(WNDCLASSEX); + winClass.style = CS_HREDRAW | CS_VREDRAW; + winClass.lpfnWndProc = ::DefWindowProc; + winClass.hInstance = GetModuleHandle(null); + winClass.hCursor = ::LoadCursor(null, IDC_ARROW); + winClass.hbrBackground = (HBRUSH)::GetStockObject(BLACK_BRUSH); + + if (!(::RegisterClassEx(&winClass))) + { + return false; + } + + HWND hwnd = ::CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, + name.Data(), + "PopcornFX context", + 0, 0, + 0, 8, 8, + null, + null, + null, + null); + + PK_ASSERT(hwnd != null); + m_WindowHandle = (void*)hwnd; + m_DeviceContext = (void*)::GetDC(hwnd); + return m_WindowHandle != null && m_DeviceContext != null; +#endif +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_Scene.cpp b/AE_GeneralPlugin/Sources/AEGP_Scene.cpp new file mode 100644 index 00000000..76c71799 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_Scene.cpp @@ -0,0 +1,2057 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_Scene.h" + +#include "AEGP_World.h" +#include "AEGP_AEPKConversion.h" + +#include "AEGP_RenderContext.h" +#include "RenderApi/AEGP_BaseContext.h" +#include "RenderApi/AEGP_D3D12Context.h" +#include "RenderApi/AEGP_D3D11Context.h" + +#include "AEGP_Attribute.h" +#include "AEGP_Log.h" +#include "AEGP_PackExplorer.h" + +#include "AEGP_Main.h" +#include "AEGP_Attribute.h" + +#include "AEGP_AssetBaker.h" +#include "AEGP_SkinnedMeshInstance.h" +#include "AEGP_SkinnedMesh.h" + +#include + + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include // for Random::DefaultGenerator() +#include // for PRNG +#include // for CPlane in CParticleSceneBasic + +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +struct SSimpleSceneDef +{ + CString m_EffectPath; + CString m_BackdropMeshPath; + + CUint3 m_SpawnGridResolution; // defined in side-up-forward coordinates + float m_SpawnGridRange; + + float m_RespawnDelay; + + bool m_Seeking = false; + bool m_Refresh = false; + struct + { + float m_Distance; + CFloat3 m_Angles; // { pitch, yaw, roll } + float m_Height; + } m_CameraStartParameters; +}; + +//---------------------------------------------------------------------------- + + +u32 CAAEScene::s_SceneID = 0; + +//---------------------------------------------------------------------------- + +CAAEScene::CAAEScene() +: m_EffectRef(null) +, m_EffectDesc(null) +, m_LayerHolder(null) +, m_EmitterDefaultPosition(CFloat3::ZERO) +, m_EmitterDefaultOrientation(CFloat3::ZERO) +, m_EmitterTransformType(ETransformType::ETransformType_3D) +, m_EmitterTransformsCurrent(CFloat4x4::IDENTITY) +, m_EmitterTransformsPrevious(CFloat4x4::IDENTITY) +, m_EmitterVelCurrent(CFloat3::ZERO) +, m_EmitterVelPrevious(CFloat3::ZERO) +, m_OriginViewport(CUint2::ZERO) +, m_Paused(false) +, m_AEEmitterPosition(CFloat3::ZERO) +, m_AEEmitterRotation(CFloat3::ZERO) +, m_AEEmitterSeed(0) +, m_AEViewMatrix(CFloat4x4::IDENTITY) +, m_AECameraPos(CFloat4::ZERO) +, m_AECameraZoom(1.0f) +, m_TeleportEmitter(false) +, m_FrameNumber(0) +, m_DT(0.0f) +, m_PreviousTimeSec(0.0f) +, m_CurrentTimeSec(0.0f) +, m_Initialized(false) +, m_FrameAbortedDuringSeeking(A_Err_NONE) +, m_Effect(null) +, m_EffectFile(null) +, m_EffectLastInstance(null) +, m_AttributesList(null) +, m_EmitterPositionNormalized_Debug(CFloat4::ZERO) +, m_LastInstanceXForms(CFloat4x4::IDENTITY) +, m_DCSortMethod(EDrawCallSortMethod::Sort_DrawCalls) +, m_SceneInfoConstantSet(null) +, m_SceneInfoConstantBuffer(null) +, m_LoadedPack(null) +, m_HBOContext(null) +, m_ParticleScene(null) +, m_ParticleMediumCollection(null) +, m_Stats_SimulationTime(0.0f) +, m_ViewSlotInMediumCollection(CGuid::INVALID) +, m_SkinnedMeshInstance(null) +, m_SkeletonState(null) +, m_ResourceManager(null) +, m_HasBoundBackdrop(false) +, m_IsWeightedSampling(false) +, m_ColorStreamID(0) +, m_WeightStreamID(0) +, m_ForceRestartSeeking(true) +{ + m_ID = s_SceneID++; +} + +//---------------------------------------------------------------------------- + +CAAEScene::~CAAEScene() +{ + Quit(); +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::Init(SAAEIOData &AAEData) +{ + if (AAEData.m_InData) + m_EffectRef = AAEData.m_InData->effect_ref; + else + m_EffectRef = null; + + m_ResourceManager = Resource::DefaultManager(); + if (!PK_VERIFY(m_ResourceManager != null)) + return CAELog::LogErrorWindows(&AAEData, "Could not allocate PopcornFX ResourceManager"); + if (m_HBOContext != null) + PK_SAFE_DELETE(m_HBOContext); + m_HBOContext = PK_NEW(HBO::CContext); + if (m_ParticleScene != null) + PK_SAFE_DELETE(m_ParticleScene); + m_ParticleScene = PK_NEW(CAAEParticleScene); + if (!PK_VERIFY(m_ParticleScene != null)) + return false; + m_ParticleScene->m_Parent = this; + //AAE INFO + SetWorldSize(AAEData); + // Medium collection + if (m_ParticleMediumCollection == null) + { + if (_SetupMediumCollection() == false) + return false; + } + + return true; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::SetWorldSize(SAAEIOData &AAEData) +{ + if (AAEData.m_InData) + { + m_SAAEWorldData.m_WorldWidth = (float)AAEData.m_InData->width; + m_SAAEWorldData.m_WorldHeight = (float)AAEData.m_InData->height; + m_SAAEWorldData.m_WorldOrigin = CFloat3{ m_SAAEWorldData.m_WorldWidth / 2, m_SAAEWorldData.m_WorldHeight / 2, 0 }; + } +} + +//---------------------------------------------------------------------------- + +void CAAEScene::SetEmitterPosition(const CFloat3 &position, ETransformType type) +{ + m_EmitterTransformType = type; + m_AEEmitterPosition = position; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::SetEmitterRotation(const CFloat3 &rotation) +{ + m_AEEmitterRotation = rotation; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::SetEmitterTeleport(bool teleport) +{ + m_TeleportEmitter = teleport; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::SetLayerHolder(SLayerHolder *parent) +{ + m_LayerHolder = parent; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::SetCameraViewMatrix(const CFloat4x4 &viewMatrix, const CFloat4 &pos, const float cameraZoom) +{ + m_AECameraZoom = cameraZoom; + m_AECameraPos = pos; + m_AEViewMatrix = viewMatrix; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::RefreshAssetList() +{ + m_LoadedPack = null; + PK_ASSERT(m_LayerHolder != null); + + if (m_LayerHolder->m_BakedPack == null) + return false; + + m_LoadedPack = m_LayerHolder->m_BakedPack; + return true; +} + +//---------------------------------------------------------------------------- + +SSamplerAudio *CAAEScene::GetAudioSamplerDescriptor(CStringId name, SSamplerAudio::SamplingType type) +{ + if (!name.Valid() || name.Empty()) + return null; + + for (u32 i = 0; i < m_ActiveAudioSamplers.Count(); ++i) + { + if (name == m_ActiveAudioSamplers[i]->m_Name && type == m_ActiveAudioSamplers[i]->m_SamplingType) + { + return m_ActiveAudioSamplers[i]; + } + } + for (u32 i = 0; i < m_ActiveAudioSamplers.Count(); ++i) + { + if (name == m_ActiveAudioSamplers[i]->m_Name && m_ActiveAudioSamplers[i]->m_SamplingType == SSamplerAudio::SamplingType::SamplingType_Unknown) + { + return m_ActiveAudioSamplers[i]; + } + } + for (u32 i = 0; i < m_ActiveAudioSamplers.Count(); ++i) + { + if (!m_ActiveAudioSamplers[i]->m_Name.Valid() || m_ActiveAudioSamplers[i]->m_Name.Empty()) + { + m_ActiveAudioSamplers[i]->m_Name = name; + return m_ActiveAudioSamplers[i]; + } + } + return null; +} +//---------------------------------------------------------------------------- + +bool CAAEScene::GetEmitterBounds(CAABB &bounds) +{ + if (m_EffectLastInstance == null) + return false; + const CParticleMediumCollection::SEffectMediums *mediums = m_ParticleMediumCollection->MapEffectMediumLookup(m_Effect.Get()); + + for (auto medium : mediums->m_Mediums) + { + bounds.Add(medium->ExactBounds()); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::SetPack(PFilePack pack, bool unload) +{ + if (pack == null) + return false; + + ResetEffect(unload); + + m_LoadedPack = pack; + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::SetSelectedEffect(CString name, bool refresh) +{ + if (name == null || name.Empty()) + return false; + CBakedPackExplorer packExplorer(m_LoadedPack->Path(), File::DefaultFileSystem()); + CString bakedName = CFilePath::StripExtension(name); + + bakedName += ".pkb"; + + packExplorer.Explore(); + TMemoryView effectPaths = packExplorer.EffectPaths(); + + if (effectPaths.IndexOf(bakedName).Valid()) + { + m_SelectedEffect = bakedName; + return SetupScene(false, refresh); + } + else + { + CAELog::TryLogInfoWindows("Trying to load " + bakedName + " Missing file in " + m_LoadedPack->Path() + " Reimport effect"); + } + return false; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::SetEffectDescriptor(SEmitterDesc *desc) +{ + m_EffectDesc = desc; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::SetupScene(bool seeking, bool refresh) +{ + m_PreviousTimeSec = 0.0f; + m_CurrentTimeSec = 0.0f; + m_DT = 0.0f; + + PK_ASSERT(m_ParticleMediumCollection != null); + m_ParticleMediumCollection->Clear(); + + SetEmitterTeleport(); + + SSimpleSceneDef def; + def.m_Seeking = seeking; + def.m_Refresh = refresh; + if (m_SelectedEffect == null) + { + if (!m_LayerHolder->m_SpawnedEmitter.m_Desc->m_PathSource.empty()) + CPopcornFXWorld::Instance().SetDestinationPackFromPath(*m_LayerHolder, CString(m_LayerHolder->m_SpawnedEmitter.m_Desc->m_PathSource.c_str())); + SetPack(m_LayerHolder->m_BakedPack, true); + SetEffectDescriptor(m_LayerHolder->m_SpawnedEmitter.m_Desc); + SetSelectedEffect(CString(m_LayerHolder->m_SpawnedEmitter.m_Desc->m_Name.c_str()), false); + } + def.m_EffectPath = m_SelectedEffect; + + if (!_LoadScene(def)) + return false; + CPopcornFXWorld::Instance().OnEndSetupScene(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::Quit() +{ + m_EffectRef = null; + m_EffectDesc = null; + + m_LayerHolder = null; + if (m_EffectLastInstance != null) + { + // Not strictly necessary to -= the callback, the instance is getting destroyed anyway. + m_EffectLastInstance->m_DeathNotifier -= FastDelegate(this, &CAAEScene::_OnInstanceDeath); + //m_EffectLastInstance->KillImmediate(); + m_EffectLastInstance = null; + } + m_AttributesList = null; + + m_EffectPath = null; + if (m_Effect != null) + m_Effect = null; + if (m_EffectFile != null) + { + m_EffectFile->Unload(); + m_EffectFile = null; + } + + m_ActiveAudioSamplers.Clear(); + + m_ParticleRenderDataFactory.UpdateThread_Release(); + + if (m_SkinnedMeshInstance != null) + { + m_SkinnedMeshInstance->WaitAsyncUpdateSkin(); + m_SkinnedMeshInstance->ClearSkinnedMesh(); + } + m_SkinnedMeshInstance = null; + + m_DrawOutputs.Clear(); + m_SceneInfoConstantSet = null; + m_SceneInfoConstantBuffer = null; + + m_LoadedPack = null; + + PK_SAFE_DELETE(m_ParticleScene); + + if (m_Initialized) + { + m_FrameCollector.UpdateThread_UninstallFromMediumCollection(m_ParticleMediumCollection); + if (m_ParticleMediumCollection) + { + m_ParticleMediumCollection->Clear(); + PK_SAFE_DELETE(m_ParticleMediumCollection); + } + m_FrameCollector.DestroyBillboardingBatches(); + m_FrameCollector.UpdateThread_Destroy(); + } + + m_ResourceManager = null; + + for (u32 i = 0; i < m_OverridableProperties.Count(); ++i) + PK_SAFE_DELETE(m_OverridableProperties[i]); + m_OverridableProperties.Clean(); + + PK_SAFE_DELETE(m_HBOContext); + + m_Initialized = false; + return true; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::ShutdownPopcornFX() +{ + +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::Update(SAAEIOData &AAEData) +{ + PK_SCOPEDPROFILE(); + + if (m_LayerHolder == null || m_EffectDesc == null) //Waiting for AE to process new effects + return true; + + SetWorldSize(AAEData); + if (!PK_VERIFY(_LateInitializeIFN())) + return false; + + m_EffectRef = AAEData.m_InData->effect_ref; + + if (!m_Paused) + { + if (m_EffectLastInstance == null) + { + if (!SetupScene(false, false)) + return false; + } + } + /// Update ------------------------------------------------------------------------------------------ + if (!m_Paused) + { + PK_NAMEDSCOPEDPROFILE("Scene Update"); + _ExtractAEFrameInfo(AAEData); + m_FrameCollector.ReleaseRenderedFrame(); + m_FrameAbortedDuringSeeking = A_Err_NONE; + _FastForwardSimulation(AAEData, m_CurrentTimeSec + m_DT); + if (m_FrameAbortedDuringSeeking != A_Err_NONE) + { + AAEData.m_ReturnCode = m_FrameAbortedDuringSeeking; + m_ParticleMediumCollection->Clear(); + return true; + } + if (_CheckRenderAbort(&AAEData)) + { + m_ParticleMediumCollection->Clear(); + return true; + } + _CollectCurrentFrame(); + } + + _FillAdditionnalDataForRender(); + +#if _DEBUG + auto v = m_ParticleMediumCollection->Stats(); +#endif + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::UpdateAttributes(SLayerHolder *layer) +{ + PK_SCOPEDPROFILE(); + if (m_EffectLastInstance == null || layer == null) + return true; + + for (auto it = layer->m_SpawnedAttributes.Begin(); it != layer->m_SpawnedAttributes.End(); ++it) + { + SAttributeDesc *descriptor = static_cast(it->m_Desc); + if (descriptor == null) // Corrupt attribute on AE Side + it->m_Deleted = true; + else if (descriptor->m_IsDirty) + { + //Update Attributes Values +#if defined(PK_SCALE_DOWN) + if (descriptor->m_IsAffectedByScale) + { + void *attributeValue = descriptor->GetRawValue(); + CInt4 *intData = null; + CFloat4 *floatData = null; + + switch (descriptor->m_Type) + { + case (AttributeType_Int1): + case (AttributeType_Int2): + case (AttributeType_Int3): + case (AttributeType_Int4): + intData = static_cast(attributeValue); + *((CFloat4*)intData) /= layer->m_ScaleFactor; + break; + case (AttributeType_Float1): + case (AttributeType_Float2): + case (AttributeType_Float3): + case (AttributeType_Float4): + floatData = static_cast(attributeValue); + *floatData /= layer->m_ScaleFactor; + break; + default: + break; + } + if (!PK_VERIFY(m_EffectLastInstance->SetRawAttribute(descriptor->m_Name.data(), AttributeAAEToPK(descriptor->m_Type), attributeValue))) + return false; + } + else + { + if (!PK_VERIFY(m_EffectLastInstance->SetRawAttribute(descriptor->m_Name.data(), AttributeAAEToPK(descriptor->m_Type), descriptor->GetRawValue()))) + return false; + } +#else + if (!PK_VERIFY(m_EffectLastInstance->SetRawAttribute(descriptor->m_Name.data(), AttributeAAEToPK(descriptor->m_Type), descriptor->GetRawValue()))) + return false; +#endif + descriptor->m_IsDirty = false; + } + } + for (auto it = layer->m_SpawnedAttributesSampler.Begin(); it != layer->m_SpawnedAttributesSampler.End(); ++it) + { + SAttributeSamplerDesc *descriptor = static_cast(it->m_Desc); + if (descriptor == null) // Corrupt attribute on AE Side + it->m_Deleted = true; + + switch (descriptor->m_Type) + { + case AttributeSamplerType_Geometry: + _UpdateShapeSampler(*it, descriptor); + break; + case AttributeSamplerType_Text: + _UpdateTextSampler(*it, descriptor); + break; + case AttributeSamplerType_Image: + _UpdateImageSampler(*it, descriptor); + break; + case AttributeSamplerType_Audio: + _UpdateAudioSampler(*it, descriptor); + break; + case AttributeSamplerType_VectorField: + _UpdateVectorFieldSampler(*it, descriptor); + break; + default: + break; + } + if ((*it).m_PKDesc != null) + (*it).m_PKDesc->m_Dirty = false; + } + if (layer->m_BackdropAudioWaveform != null) + { + layer->m_BackdropAudioWaveform->m_BuiltThisFrame = false; + if (!PK_VERIFY(m_ActiveAudioSamplers.PushBack(layer->m_BackdropAudioWaveform).Valid())) + return false; + layer->m_BackdropAudioWaveform->m_Dirty = false; + } + if (layer->m_BackdropAudioSpectrum != null) + { + layer->m_BackdropAudioSpectrum->m_BuiltThisFrame = false; + if (!PK_VERIFY(m_ActiveAudioSamplers.PushBack(layer->m_BackdropAudioSpectrum).Valid())) + return false; + layer->m_BackdropAudioSpectrum->m_Dirty = false; + } + return true; +} + +//---------------------------------------------------------------------------- + +static CString _GetAnimPathFromMesh(const CResourceManager *resourceManager, const CString &meshPath) +{ + PK_ASSERT(resourceManager != null); + if (meshPath.Empty()) + return null; + + CString remappedPath = meshPath; + bool remappedPathNotVirtual = false; + resourceManager->RemapAndPurifyPathIFN(remappedPath, remappedPathNotVirtual); + PK_ASSERT(!remappedPathNotVirtual); + return CFilePath::StripExtension(remappedPath) + ".pksa"; +} + +//---------------------------------------------------------------------------- + +static bool _PreloadMeshResource(CResourceManager *resourceManager, const CString &path, TResourcePtr &dstMeshResource, PSkeletonState &dstBindPose) +{ + dstMeshResource = resourceManager->Load(path, false, SResourceLoadCtl(false, true)); + if (dstMeshResource == null) + { + CLog::Log(PK_ERROR, "Failed loading mesh resource \"%s\"", path.Data()); + return false; + } + + for (const auto &batch : dstMeshResource->BatchList()) + { + batch->RawMesh()->BuildTangentsIFN(); + } + + PSkeleton skeleton = dstMeshResource->Skeleton(); + if (skeleton != null) + { + dstBindPose = PK_NEW(CSkeletonState(skeleton)); + if (dstBindPose == null) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::UpdateBackdropTransform(SEmitterDesc *desc) +{ + const CQuaternion quat = Transforms::Quaternion::FromEuler(CFloat3((float)desc->m_BackdropMesh.m_Rotation.x, (float)desc->m_BackdropMesh.m_Rotation.y, (float)desc->m_BackdropMesh.m_Rotation.z)); + const CFloat3 pos((float)desc->m_BackdropMesh.m_Position.x, (float)desc->m_BackdropMesh.m_Position.y, (float)desc->m_BackdropMesh.m_Position.z); + const CFloat4 scale((float)desc->m_BackdropMesh.m_Scale.x, (float)desc->m_BackdropMesh.m_Scale.y, (float)desc->m_BackdropMesh.m_Scale.z, 1.0f); + + m_BackdropData.m_MeshBackdropTransforms = Transforms::Matrix::FromQuaternion(quat, CFloat4(pos, 1.0f)); + m_BackdropData.m_MeshBackdropTransforms.Scale(scale); + if (desc->m_BackdropMesh.m_EnableCollisions) + m_ParticleScene->SetBackdropMeshTransform(m_BackdropData.m_MeshBackdropTransforms); +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::UpdateBackdrop(SLayerHolder *layer,SEmitterDesc *desc) +{ + if (!desc->m_BackdropMesh.m_Path.empty()) + { + const CQuaternion quat = Transforms::Quaternion::FromEuler(CFloat3((float)desc->m_BackdropMesh.m_Rotation.x, (float)desc->m_BackdropMesh.m_Rotation.y, (float)desc->m_BackdropMesh.m_Rotation.z)); + const CFloat3 pos((float)desc->m_BackdropMesh.m_Position.x, (float)desc->m_BackdropMesh.m_Position.y, (float)desc->m_BackdropMesh.m_Position.z); + const CFloat4 scale((float)desc->m_BackdropMesh.m_Scale.x, (float)desc->m_BackdropMesh.m_Scale.y, (float)desc->m_BackdropMesh.m_Scale.z, 1.0f); + + m_BackdropData.m_MeshBackdropTransforms = Transforms::Matrix::FromQuaternion(quat, CFloat4(pos, 1.0f)); + m_BackdropData.m_MeshBackdropTransforms.Scale(scale); + if (m_BackdropData.m_MeshBackdropTransforms == CFloat4x4::IDENTITY && desc->m_LoadBackdrop) + { + CPopcornFXWorld &pkfxWorld = CPopcornFXWorld::Instance(); + m_BackdropData.m_MeshBackdropTransforms = m_EmitterTransformsCurrent; + pkfxWorld.SetBackdropMeshDefaultTransform(layer); + } + + m_BackdropData.m_MeshMetalness = desc->m_BackdropMesh.m_Metalness; + m_BackdropData.m_MeshRoughness = desc->m_BackdropMesh.m_Roughness; + + m_BackdropData.m_ShowMesh = desc->m_BackdropMesh.m_EnableRendering; + } + if (!desc->m_BackdropEnvironmentMap.m_Path.empty()) + { + CFilePackPath filePackPath = CFilePackPath::FromPhysicalPath(desc->m_BackdropEnvironmentMap.m_Path.data(), File::DefaultFileSystem()); + + m_BackdropData.m_EnvironmentMapPath = filePackPath.Path(); + m_BackdropData.m_EnvironmentMapColor = CFloat3((float)desc->m_BackdropEnvironmentMap.m_Color.x, (float)desc->m_BackdropEnvironmentMap.m_Color.y, (float)desc->m_BackdropEnvironmentMap.m_Color.z); + m_BackdropData.m_EnvironmentMapIntensity = desc->m_BackdropEnvironmentMap.m_Intensity; + m_BackdropData.m_BackgroundUsesEnvironmentMap = desc->m_BackdropEnvironmentMap.m_EnableRendering; + m_BackdropData.m_EnvironmentMapAffectsAmbient = true; + } + else + { + m_BackdropData.m_EnvironmentMapPath = null; + } + + if (!desc->m_UpdateBackdrop && !desc->m_LoadBackdrop) + return true; + + desc->m_LoadBackdrop = false; + desc->m_UpdateBackdrop = false; + if (!desc->m_BackdropMesh.m_Path.empty()) + { + CFilePackPath filePackPath = CFilePackPath::FromPhysicalPath(desc->m_BackdropMesh.m_Path.data(), File::DefaultFileSystem()); + + m_BackdropData.m_MeshPath = filePackPath.Path(); + + _PreloadMeshResource(m_ResourceManager, m_BackdropData.m_MeshPath, m_ResourceMesh, m_SkeletonState); + + if (desc->m_BackdropMesh.m_EnableCollisions) + m_ParticleScene->SetBackdropMesh(m_ResourceMesh, m_BackdropData.m_MeshBackdropTransforms); + else + m_ParticleScene->ClearBackdropMesh(); + if (desc->m_BackdropMesh.m_EnableAnimations) + { + const CString animPath = (!m_BackdropData.m_MeshPath.Empty()) ? _GetAnimPathFromMesh(m_ResourceManager, m_BackdropData.m_MeshPath) : CString::EmptyString; + m_SkinnedMeshInstance = PK_NEW(CSkinnedMeshInstance); + if (!m_SkinnedMeshInstance->LoadSkinnedMeshIFN(m_ResourceMesh, EMeshChannels::Channel_Tangent | EMeshChannels::Channel_Velocity | EMeshChannels::Channel_Normal | EMeshChannels::Channel_Position, m_SkeletonState) || + !m_SkinnedMeshInstance->LoadAnimationIFN(m_HBOContext, animPath, false)) + m_SkinnedMeshInstance = null; + } + } + else + { + m_SkinnedMeshInstance = null; + m_SkeletonState = null; + m_BackdropData.m_MeshPath = ""; + m_ParticleScene->ClearBackdropMesh(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::Render(SAAEIOData &AAEData) +{ + if (_CheckRenderAbort(&AAEData)) + return true; + + CPopcornFXWorld &pkfxWorld = CPopcornFXWorld::Instance(); + + // our render specific context (one per thread) + PAAERenderContext currentRenderContext = pkfxWorld.GetCurrentRenderContext(); + if (!PK_VERIFY(currentRenderContext != null)) + return false; + + RHI::PApiManager apiManager = currentRenderContext->GetAEGraphicContext()->GetApiManager(); + + if (_CheckRenderAbort(&AAEData)) + return true; + + if (!(currentRenderContext->AERenderFrameBegin(AAEData, !m_BackdropData.m_BackgroundUsesEnvironmentMap))) + return true; + + if (_CheckRenderAbort(&AAEData)) + { + PK_VERIFY(currentRenderContext->AERenderFrameEnd(AAEData)); + return true; + } + + _RenderLastCollectedFrame(); + + // Update scene info + { + PKSample::Utils::SetupSceneInfoData(m_SceneInfoData, m_Camera, CCoordinateFrame::GlobalFrame()); + if (!PK_VERIFY(currentRenderContext->GetCurrentSceneRenderer()->SetSceneInfo(m_SceneInfoData, CCoordinateFrame::GlobalFrame()))) + { + PK_VERIFY(currentRenderContext->AERenderFrameEnd(AAEData)); + return false; + } + } + + //// Flush all graphical resources + PKSample::CRendererCacheInstance_UpdateThread::RenderThread_FlushAllResources(); + + PKSample::SParticleSceneOptions sceneOptions; + + AAEToPK(m_EffectDesc->m_Rendering, sceneOptions); + currentRenderContext->SetPostFXOptions(sceneOptions); + + currentRenderContext->SetBackgroundOptions(m_EffectDesc->m_IsAlphaBGOverride, m_EffectDesc->m_AlphaBGOverride); + + // Render ------------------------------------------------------------------------------------------ + { + PKSample::CRHIParticleSceneRenderHelper *renderHelper = currentRenderContext->GetCurrentSceneRenderer(); + CUint2 vpSize = currentRenderContext->GetViewportSize(); + // + PK_ASSERT(renderHelper != null); + PK_ASSERT(vpSize.x() != 0 || vpSize.y() != 0); + + RHI::PCommandBuffer preRenderCmdBuff = apiManager->CreateCommandBuffer(RHI::SRHIResourceInfos("PK-RHI Pre Render command buffer")); + RHI::PCommandBuffer postRenderCmdBuff = apiManager->CreateCommandBuffer(RHI::SRHIResourceInfos("PK-RHI Post Render command buffer")); + + renderHelper->SetupPostFX_Bloom(sceneOptions.m_Bloom, false, false); + renderHelper->SetupPostFX_Distortion(sceneOptions.m_Distortion, false); + renderHelper->SetupPostFX_ToneMapping(sceneOptions.m_ToneMapping, sceneOptions.m_Vignetting, sceneOptions.m_Dithering, false, false); + renderHelper->SetupPostFX_FXAA(sceneOptions.m_FXAA, false, false); + renderHelper->SetupShadows(); + renderHelper->SetCurrentPackResourceManager(m_ResourceManager); + renderHelper->SetBackdropInfo(m_BackdropData, ECoordinateFrame::Frame_User1); + + // Fill the command buffer + preRenderCmdBuff->Start(); + + if (!m_BackdropData.m_EnvironmentMapPath.Empty()) + { + renderHelper->GetEnvironmentMap().GenerateCubemap(preRenderCmdBuff); + + PKSample::SBackdropsData &data = renderHelper->GetBackDropsData(); + data.m_BackgroundUsesEnvironmentMap = m_BackdropData.m_BackgroundUsesEnvironmentMap; + data.m_EnvironmentMapAffectsAmbient = true; + } + + // Copy the particle count for the indirect draws: + PK_FOREACH(copy, m_DrawOutputs.m_CopyCommands) + { + if (!PK_VERIFY(preRenderCmdBuff->CopyBuffer(copy->m_SrcBuffer, copy->m_DstBuffer, copy->m_SrcOffset, copy->m_DstOffset, copy->m_SizeToCopy))) + { + CLog::Log(PK_ERROR, "preRenderCmdBuff->CopyBuffer() failed."); + PK_VERIFY(currentRenderContext->AERenderFrameEnd(AAEData)); + return false; + } + } + preRenderCmdBuff->SetViewport({ 0, 0 }, vpSize, { 0, 1 }); + preRenderCmdBuff->SetScissor({ 0, 0 }, vpSize); + + preRenderCmdBuff->Stop(); + apiManager->SubmitCommandBufferDirect(preRenderCmdBuff); + postRenderCmdBuff->Start(); + if (!PK_VERIFY(renderHelper->RenderScene(AAEToPK(m_EffectDesc->m_Rendering.m_Type), m_DrawOutputs, 0))) + { + CLog::Log(PK_ERROR, "renderHelper->RenderScene() failed."); + PK_VERIFY(currentRenderContext->AERenderFrameEnd(AAEData)); + return false; + } + + if (!PK_VERIFY(postRenderCmdBuff->Stop())) + { + CLog::Log(PK_ERROR, "postRenderCmdBuff->Stop() failed."); + PK_VERIFY(currentRenderContext->AERenderFrameEnd(AAEData)); + return false; + } + apiManager->SubmitCommandBufferDirect(postRenderCmdBuff); + if (!PK_VERIFY(currentRenderContext->AERenderFrameEnd(AAEData))) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::ResetEffect(bool unload) +{ + bool hasUnloaded = false; + + m_EffectLastInstance = null; + if (m_ParticleMediumCollection != null) + m_ParticleMediumCollection->Clear(); + m_Effect = null; + if (unload && m_EffectFile != null) + { + m_EffectFile->Unload(); + hasUnloaded = true; + m_EffectFile = null; + } + return hasUnloaded; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::SetSkinnedBackdropParams(bool enabled, bool weightedSampling, u32 colorStreamID, u32 weightStreamID) +{ + bool update = false; + if (m_HasBoundBackdrop != enabled || m_IsWeightedSampling != weightedSampling || m_ColorStreamID != colorStreamID || m_WeightStreamID != weightStreamID) + update = true; + m_HasBoundBackdrop = enabled; + m_IsWeightedSampling = weightedSampling; + m_ColorStreamID = colorStreamID; + m_WeightStreamID = weightStreamID; + + if (update && m_SkinnedMeshInstance != null && m_ResourceMesh != null && m_ResourceMesh->BatchList().Count() > 0) + { + m_SkinnedMeshInstance->WaitAsyncUpdateSkin(); + + m_SkinnedMeshInstance->SetupAttributeSampler(m_ResourceMesh->BatchList()[0]->RawMesh(), + m_IsWeightedSampling, + m_ColorStreamID, + m_WeightStreamID); + } + +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::UpdateLight(SLayerHolder *layer) +{ + PK_ASSERT(layer != null); + PK_ASSERT(layer->m_SpawnedEmitter.m_Desc != null); + + SLightDesc &light = layer->m_SpawnedEmitter.m_Desc->m_Light; + + if (light.m_Internal) + { + if (m_BackdropData.m_Lights.Count() == 0) + { + m_BackdropData.m_Lights.Resize(2); + } + m_BackdropData.m_Lights[0].SetAmbient(AAEToPK(light.m_Ambient), light.m_Intensity); + m_BackdropData.m_Lights[1].SetDirectional(AAEToPK(light.m_Direction), AAEToPK(light.m_Color), light.m_Intensity); + } + if (!light.m_Internal) + { + TArray lights; + A_Time time; + + time.value = layer->m_CurrentTime; + time.scale = layer->m_TimeScale; + if (!CAEUpdater::GetLightsAtTime(layer, time, lights)) + return false; + + if (lights.Count() != m_BackdropData.m_Lights.Count()) + m_BackdropData.m_Lights.Resize(lights.Count()); + for (u32 i = 0; i < lights.Count(); ++i) + { + if (lights[i].m_Type == AEGP_LightType_PARALLEL) + { + m_BackdropData.m_Lights[i].SetDirectional(AAEToPK(lights[i].m_Direction), AAEToPK(lights[i].m_Color), lights[i].m_Intensity); + } + else if (lights[i].m_Type == AEGP_LightType_AMBIENT) + { + m_BackdropData.m_Lights[i].SetAmbient(AAEToPK(lights[i].m_Color), lights[i].m_Intensity); + } + else if (lights[i].m_Type == AEGP_LightType_SPOT) + { + m_BackdropData.m_Lights[i].SetSpot(AAEToPK(lights[i].m_Position), AAEToPK(lights[i].m_Direction), lights[i].m_Angle, lights[i].m_Feather, AAEToPK(lights[i].m_Color), lights[i].m_Intensity); + } + else if (lights[i].m_Type == AEGP_LightType_POINT) + { + m_BackdropData.m_Lights[i].SetPoint(AAEToPK(lights[i].m_Position), AAEToPK(lights[i].m_Color), lights[i].m_Intensity); + } + } + } + + return false; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_LateInitializeIFN() +{ + if (m_Initialized == true) + return true; + // Medium collection + if (m_ParticleMediumCollection == null) + { + if (_SetupMediumCollection() == false) + return false; + } + // Render data factory + { + CPopcornFXWorld &pkfxWorld = CPopcornFXWorld::Instance(); + + PK_SCOPEDLOCK(pkfxWorld.GetRenderLock()); + RHI::PApiManager apiManager = pkfxWorld.GetCurrentRenderContext()->GetAEGraphicContext()->GetApiManager(); + const RHI::SGPUCaps &caps = apiManager->GetApiContext()->m_GPUCaps; // We get the GPU caps to know what is supported by the GPU and fallback IFN + m_ParticleRenderDataFactory.UpdateThread_Initialize(apiManager->ApiName(), m_HBOContext, caps, Drawers::BillboardingLocation_CPU); + } + // Frame collector + { + const u32 enabledRenderers = (1U << ERendererClass::Renderer_Billboard) | (1U << ERendererClass::Renderer_Ribbon) | (1U << ERendererClass::Renderer_Mesh) | (1U << ERendererClass::Renderer_Light) | (1U << ERendererClass::Renderer_Triangle); + + // Initialize the frame collector with the factory and required renderers (see CPopcornScene::CollectCurrentFrame() for more detail) + CFrameCollector::SFrameCollectorInit init(&m_ParticleRenderDataFactory, enabledRenderers); + if (!m_FrameCollector.UpdateThread_Initialize(init)) + { + return CAELog::TryLogErrorWindows("Failed to initialize the frame collector."); + } + // Hook this frame collector to the medium collection. It will "listen" to each medium insertion (see rh_frame_collector.inl) + m_FrameCollector.UpdateThread_InstallToMediumCollection(m_ParticleMediumCollection); + + m_FrameCollector.SetDrawCallsSortMethod(m_DCSortMethod); + } + m_Initialized = true; + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_SetupMediumCollection() +{ + PK_ASSERT(m_ParticleMediumCollection == null); + + CPopcornFXWorld &pkfxWorld = CPopcornFXWorld::Instance(); + + PK_SCOPEDLOCK(pkfxWorld.GetRenderLock()); + + PAAERenderContext renderContext = pkfxWorld.GetCurrentRenderContext(); + + CParticleUpdateManager_Auto *updateManager = null; + +#if PK_PARTICLES_UPDATER_USE_D3D12 != 0 + if (pkfxWorld.GetRenderApi() == RHI::GApi_D3D12) + updateManager = PopcornFX::CParticleUpdateManager_Auto::New(EGPUContext::ContextD3D12); +#endif + +#if PK_PARTICLES_UPDATER_USE_D3D11 != 0 + if (pkfxWorld.GetRenderApi() == RHI::GApi_D3D11) + updateManager = PopcornFX::CParticleUpdateManager_Auto::New(EGPUContext::ContextD3D11); +#endif + + m_ParticleMediumCollection = PK_NEW(CParticleMediumCollection(m_ParticleScene, updateManager)); + if (!PK_VERIFY(m_ParticleMediumCollection != null)) + return false; + + m_ViewSlotInMediumCollection = m_ParticleMediumCollection->RegisterView(); + if (!PK_VERIFY(m_ViewSlotInMediumCollection.Valid())) + return false; + + m_ParticleMediumCollection->m_OnUpdateComplete += FastDelegate(this, &CAAEScene::_OnUpdateComplete); + + m_ParticleMediumCollection->EnableBounds(true); + m_ParticleMediumCollection->EnableLocalizedPages(true, false); + +#if 0 +#if PK_PARTICLES_UPDATER_USE_D3D12 != 0 + if (pkfxWorld.GetRenderApi() == RHI::GApi_D3D12) + { + CAAED3D12Context *D3D12Context = static_cast(renderContext->GetAEGraphicContext()); + + if (D3D12Context != null) + { + m_OriginViewport = renderContext->GetContextSize(); + // Small struct describing the D3D12 device used to build command lists, the root signature and the callback for submitting tasks to the engine + // g_D3D12SerializeRootSignature is PFN_D3D12_SERIALIZE_ROOT_SIGNATURE + PopcornFX::SD3D12Context context(D3D12Context->m_D3D12Context->m_Device, D3D12Context->m_D3D12Context->m_SerializeRootSignatureFunc, PopcornFX::CParticleUpdateManager_D3D12::CbEnqueueTask(this, &CAAEScene::D3D12_EnqueueTask), D3D12_COMMAND_LIST_TYPE_DIRECT); + + if (updateManager->GetUpdateManager_GPU()->BindContext(context)) + { + // Enables GPU simulation but does not force it + + m_ParticleMediumCollection->SetSimDispatchMaskCallback(CParticleMediumCollection::CbSimDispatchMask(&SimDispatchMask)); + } + } + } +#endif + +#if PK_PARTICLES_UPDATER_USE_D3D11 != 0 + if (pkfxWorld.GetRenderApi() == RHI::GApi_D3D11) + { + CAAED3D11Context *D3D11Context = static_cast(renderContext->GetAEGraphicContext()); + + if (D3D11Context != null) + { + m_OriginViewport = renderContext->GetContextSize(); + PopcornFX::SD3D11Context context(D3D11Context->m_D3D11Context->m_Device, D3D11Context->m_D3D11Context->m_ImmediateDeviceContext); + + CParticleUpdateManager_D3D11 *updateManagerD3D11 = checked_cast(updateManager->GetUpdateManager_GPU()); + if (updateManagerD3D11) + { + updateManagerD3D11->SetOwner(m_ParticleMediumCollection); + if (!updateManagerD3D11->BindContext(context)) + { + return false; + } + } + } + } +#endif +#endif + return true; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_FastForwardSimulation(SAAEIOData &AAEData, float timeTarget) +{ + (void)AAEData; + + if (m_Effect == null) + { + m_FrameAbortedDuringSeeking = A_Err_GENERIC; + return; + } + if (!PK_VERIFY(m_ParticleMediumCollection != null)) + return; + + CTimer updateTimer; + + updateTimer.Start(); + + const float maxUpdateTime = 30.0f; + + if (!PK_VERIFY(m_Effect->FeatureFlagsAll() & SParticleDeclaration::FeatureFlag_Determinism)) // if at least one layer doesn't have the flag, fail. + CAELog::TryLogErrorWindows("Effect is baked with Determinism disabled."); + + ParticleToolbox::SSeekingContextNew seekingCtx(timeTarget, m_DT, m_DT, maxUpdateTime, 0.0f, m_Effect.Get(), m_EmitterTransformsCurrent); + + ParticleToolbox::SSeekingContextNew::SInstanceInfo instInfo; + PK_ASSERT(m_Effect != null); + instInfo.m_Effect = m_Effect.Get(); + instInfo.m_CurTransforms = m_EmitterTransformsCurrent; + instInfo.m_SpawnTime = 0.0f; + PK_VERIFY(seekingCtx.m_InstancesToSpawn.PushBack(instInfo).Valid()); + + seekingCtx.m_LoadAndRunEffectDelegate = FastDelegate(this, &CAAEScene::_SeekingLoadAndRunEffect); + seekingCtx.m_UpdateEffectDelegate = FastDelegate(this, &CAAEScene::_SeekingUpdateEffect); + seekingCtx.m_WaitForUpdateFenceDelegate = FastDelegate(this, &CAAEScene::_SeekingWaitForUpdateFence); + + seekingCtx.m_PrecisionEpsilon = m_DT / 10.0f; // Arbitrary value for precision issues + seekingCtx.m_ForceRestartWhenNoUpdateNeeded = true; // Restarts when the elapsed time is equal to the target time + seekingCtx.m_ForceRestartFromZero = m_ForceRestartSeeking; + + m_AAEDataForSeeking = &AAEData; + PF_PROGRESS(m_AAEDataForSeeking->m_InData, 0, 1000); + ParticleToolbox::SSeekingContextNew::SeekToTargetTime(seekingCtx, m_ParticleMediumCollection); + m_AAEDataForSeeking = null; + m_Stats_SimulationTime = (float)updateTimer.Stop(); +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_SeekingLoadAndRunEffect( CParticleMediumCollection *mediumCollection, + const CParticleEffect *effect, + const CFloat4x4 &transform, + float timeFromStartOfFrame, + float timeToEndOfFrame, + float elapsedTime) +{ + (void)timeFromStartOfFrame; + (void)timeToEndOfFrame; + (void)transform; + (void)effect; + (void)mediumCollection; + m_FrameAbortedDuringSeeking |= CAEUpdater::UpdateLayerAtTime(m_LayerHolder, elapsedTime, true); + SetupScene(true, false); + m_FrameAbortedDuringSeeking |= CAEUpdater::UpdateLayerAtTime(m_LayerHolder, elapsedTime, true); +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_SeekingUpdateEffect(float dt, float elapsedTime, float timeTarget, u32 curUpdateIdx, u32 totalUpdatesCount) +{ + (void)dt; + (void)elapsedTime; + (void)timeTarget; + + if (totalUpdatesCount != 0) + { + PF_Err res = PF_Err_NONE; + res = PF_PROGRESS(m_AAEDataForSeeking->m_InData, curUpdateIdx, totalUpdatesCount); + if (res != PF_Err_NONE) + { + m_AAEDataForSeeking->m_ReturnCode = res; + return false; + } + } + m_FrameAbortedDuringSeeking |= CAEUpdater::UpdateLayerAtTime(m_LayerHolder, elapsedTime, curUpdateIdx != totalUpdatesCount); + + if (m_SkinnedMeshInstance != null) + { + if (elapsedTime == 0.0f) + m_SkinnedMeshInstance->ResetAnimationCursor(); + const CFloat4x4 &backdropTransforms = (m_ParticleScene != null) ? m_ParticleScene->BackdropMeshTransforms() : CFloat4x4::IDENTITY; + m_SkinnedMeshInstance->SetBackdropXForms(backdropTransforms); + m_SkinnedMeshInstance->Update(dt); + m_SkinnedMeshInstance->StartAsyncUpdateSkin(dt); + m_SkinnedMeshInstance->WaitAsyncUpdateSkin(); + } + _UpdateCamera(); + _UpdateEmitter(dt); + _UpdateMediumCollectionView(); + return m_FrameAbortedDuringSeeking == A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_SeekingWaitForUpdateFence(CTimer *waitTimer, float customMaxUpdateTime) +{ + (void)waitTimer; + + const u32 kMaxWaitTimeMs = 100;//ms max wait time + const float kMaxUpdateTimeSecsSetting = 1000;//ms + bool updateInProgress = true; + float maxUpdateTimeSecs = customMaxUpdateTime >= 0.0f ? customMaxUpdateTime : kMaxUpdateTimeSecsSetting; + CTimer ignoreTimer; + + ignoreTimer.Start(); + ignoreTimer.Pause(); + while (updateInProgress) + { + updateInProgress = m_ParticleMediumCollection->UpdateFence(kMaxWaitTimeMs); + if (updateInProgress || maxUpdateTimeSecs <= 0.0f) + { + } + } + return true; +} + +//---------------------------------------------------------------------------- + +u32 CAAEScene::_PickNewEffectSeed() +{ + return (u32)m_AEEmitterSeed; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_UpdateShapeSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc *descriptor) +{ + if (!PK_VERIFY(descriptor != null) || + !PK_VERIFY(samplerData.m_PKDesc != null)) + return false; + + SSamplerShape *pkDesc = static_cast(samplerData.m_PKDesc); + SShapeSamplerDescriptor *aeDesc = static_cast(descriptor->m_Descriptor); + + if (aeDesc == null) + return false; + + pkDesc->UpdateShape(aeDesc); + + CParticleSamplerDescriptor_Shape_Default *shapeSmpDesc = null; + if (aeDesc->m_BindToBackdrop && m_SkinnedMeshInstance != null && m_SkinnedMeshInstance->m_ShapeDescOverride != null) + shapeSmpDesc = static_cast(m_SkinnedMeshInstance->m_ShapeDescOverride.Get()); + else + shapeSmpDesc = static_cast(pkDesc->m_SamplerDescriptor.Get()); + m_EffectLastInstance->SetAttributeSampler(descriptor->m_Name.data(), shapeSmpDesc); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_UpdateTextSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc *descriptor) +{ + if (!PK_VERIFY(descriptor != null) || + !PK_VERIFY(samplerData.m_PKDesc != null)) + return false; + SSamplerText *pkDesc = static_cast(samplerData.m_PKDesc); + STextSamplerDescriptor *aeDesc = static_cast(descriptor->m_Descriptor); + + if (aeDesc == null) + return false; + + pkDesc->UpdateText(aeDesc); + + CParticleSamplerDescriptor_Text_Default *textSmpDesc = static_cast(pkDesc->m_SamplerDescriptor.Get()); + + if (!PK_VERIFY(m_EffectLastInstance->SetAttributeSampler(descriptor->m_Name.data(), textSmpDesc))) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_UpdateImageSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc *descriptor) +{ + if (!PK_VERIFY(descriptor != null) || + !PK_VERIFY(samplerData.m_PKDesc != null)) + return false; + SSamplerImage *pkDesc = static_cast(samplerData.m_PKDesc); + SImageSamplerDescriptor *aeDesc = static_cast(descriptor->m_Descriptor); + + if (aeDesc == null) + return false; + if (pkDesc->m_Dirty) + { + pkDesc->UpdateImage(aeDesc); + } + + CParticleSamplerDescriptor_Image_Default *imageSmpDesc = static_cast(pkDesc->m_SamplerDescriptor.Get()); + + if (!PK_VERIFY(m_EffectLastInstance->SetAttributeSampler(descriptor->m_Name.data(), imageSmpDesc))) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_UpdateAudioSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc *descriptor) +{ + if (!PK_VERIFY(descriptor != null) || + !PK_VERIFY(samplerData.m_PKDesc != null)) + return false; + + SSamplerAudio *pkDesc = static_cast(samplerData.m_PKDesc); + + pkDesc->m_BuiltThisFrame = false; + m_ActiveAudioSamplers.PushBack(pkDesc); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_UpdateVectorFieldSampler(SPendingAttribute &samplerData, SAttributeSamplerDesc *descriptor) +{ + if (!PK_VERIFY(descriptor != null) || + !PK_VERIFY(samplerData.m_PKDesc != null)) + return false; + + SSamplerVectorField *pkDesc = static_cast(samplerData.m_PKDesc); + SVectorFieldSamplerDescriptor *aeDesc = static_cast(descriptor->m_Descriptor); + + if (aeDesc == null) + return false; + pkDesc->UpdateVectorField(aeDesc); + + CParticleSamplerDescriptor_VectorField_Grid *turbulenceSmpDesc = static_cast(pkDesc->m_SamplerDescriptor.Get()); + + if (!PK_VERIFY(m_EffectLastInstance->SetAttributeSampler(descriptor->m_Name.data(), turbulenceSmpDesc))) + return false; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_LoadScene(const SSimpleSceneDef &sceneDef) +{ + m_EffectLastInstance = null; + + if (!_LoadEffectIFN(sceneDef)) + return false; + + m_EffectLastInstance = _InstantiateEffect(); + PK_ASSERT(m_EffectLastInstance != null); + if (m_EffectLastInstance == null) // failed instantiating + return false; + m_EffectDesc->m_Name = sceneDef.m_EffectPath.Data(); + if (sceneDef.m_BackdropMeshPath.Data() != null) + m_EffectDesc->m_BackdropMesh.m_Path = sceneDef.m_BackdropMeshPath.Data(); + + if (m_SkinnedMeshInstance != null) + { + m_SkinnedMeshInstance->Update(0.0f); + m_SkinnedMeshInstance->StartAsyncUpdateSkin(0.0f); + m_SkinnedMeshInstance->WaitAsyncUpdateSkin(); + + m_SkinnedMeshInstance->SetupAttributeSampler(m_ResourceMesh->BatchList()[0]->RawMesh(), + m_IsWeightedSampling, + m_ColorStreamID, + m_WeightStreamID); + } + return true; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_CollectCurrentFrame() +{ + PK_SCOPEDPROFILE(); + m_FrameCollector.m_CullingFrustums = TMemoryView(m_Camera.ViewFrustum()); + + if (m_FrameCollector.UpdateThread_BeginCollectFrame()) + { + m_FrameCollector.UpdateThread_CollectFrame(m_ParticleMediumCollection); + } +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_RenderLastCollectedFrame() +{ + TSceneView view; + + CFloat4x4 matW2P = m_Camera.m_ViewInv;//AE Axis System + + matW2P.Axis(1) *= -1; //AE Y-down to PopcornFX Y-up + matW2P.Axis(2) *= -1; //AE Z-foward to PopcornFX Z-backward + view.m_InvViewMatrix = matW2P; + view.m_NeedsSortedIndices = true; + + m_FrameCollector.BuildNewFrame(m_FrameCollector.UpdateThread_GetLastCollectedFrame()); + m_DrawOutputs.Clear(); + + // Build necessary renderer caches + CPopcornFXWorld &pkfxWorld = CPopcornFXWorld::Instance(); + PAAERenderContext currentRenderContext = pkfxWorld.GetCurrentRenderContext(); + + m_ParticleRenderDataFactory.RenderThread_BuildPendingCaches(currentRenderContext->GetAEGraphicContext()->GetApiManager()); + + // Do not release last collected frame when billboarding is finished + // We release frame before updating the medium collection (avoids handling of special cases when sim is paused) + const bool releaseLastCollectedFrame = false; + + PKSample::SRenderContext context(PKSample::SRenderContext::EPass_RenderThread, currentRenderContext->GetAEGraphicContext()->GetApiManager()); + + if (m_FrameCollector.BeginCollectingDrawCalls(context, TMemoryView(view))) + m_FrameCollector.EndCollectingDrawCalls(context, m_DrawOutputs, releaseLastCollectedFrame); +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_UpdateEmitter(float dt) +{ + CQuaternion quat = Transforms::Quaternion::FromEuler(m_AEEmitterRotation); + + if (m_EmitterTransformType == ETransformType_2D) //If project coordinate to match 2D Widget + { + //normalize to -1;1 + const CFloat2 viewportDimensions = CFloat2(m_SAAEWorldData.m_WorldWidth, m_SAAEWorldData.m_WorldHeight); + const CFloat2 normalizedViewportCoords = (m_AEEmitterPosition.xy() / CFloat2(viewportDimensions)) * CFloat2(2, 2) - 1; + + const CFloat4x4 viewProj = m_Camera.m_View * m_Camera.m_Proj; + const CFloat4x4 viewProjInv = viewProj.Inverse(); + + const CFloat4 clipPos = CFloat4(normalizedViewportCoords, 0, 1); + const CFloat4 worldPosOnNearPlaneH = viewProjInv.TransformVector(clipPos); + const CFloat3 worldPosOnNearPlane = worldPosOnNearPlaneH.xyz() / worldPosOnNearPlaneH.w(); + const CFloat3 worldOrigin = m_Camera.m_View.Inverse().StrippedTranslations(); + const CFloat3 worldDirection = (worldPosOnNearPlane - worldOrigin).Normalized(); + + m_EmitterTransformsPrevious = m_EmitterTransformsCurrent; + m_EmitterTransformsCurrent = Transforms::Matrix::FromQuaternion(quat, CFloat4(worldOrigin + worldDirection * m_AEEmitterPosition.z(), 1.0f)); + } + else + { + CFloat3 pos(m_AEEmitterPosition.x(), m_AEEmitterPosition.y(), m_AEEmitterPosition.z()); + + m_EmitterTransformsPrevious = m_EmitterTransformsCurrent; + m_EmitterTransformsCurrent = Transforms::Matrix::FromQuaternion(quat, CFloat4(pos, 1.0f)); + } + if (m_TeleportEmitter == true) + { + m_EmitterTransformsPrevious = m_EmitterTransformsCurrent; + m_TeleportEmitter = false; + } + + m_EmitterVelPrevious = m_EmitterVelCurrent; + if (dt > 1.0e-6f) + { + const float invDt = PKRcp(dt); + const CFloat3 posDelta = m_EmitterTransformsCurrent.StrippedTranslations() - m_EmitterTransformsPrevious.StrippedTranslations(); + m_EmitterVelCurrent = posDelta * invDt; + } + + if (m_LayerHolder->m_SpawnedEmitter.m_Desc->m_SimStatePrev != m_LayerHolder->m_SpawnedEmitter.m_Desc->m_SimState) + { + if (m_LayerHolder->m_SpawnedEmitter.m_Desc->m_SimState) + m_EffectLastInstance = _InstantiateEffect(0, 0); + else if (m_EffectLastInstance != null) + m_EffectLastInstance->Stop(); + } +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_UpdateCamera() +{ + CFloat4 cameraPos = m_AECameraPos; + + m_Camera.m_View = m_AEViewMatrix ; + if (m_EmitterTransformType == ETransformType_2D)//If project coordinate to match 2D Widget + { + { + //normalize to -1;1 + m_EmitterPositionNormalized_Debug = CFloat4(cameraPos.x() - (m_SAAEWorldData.m_WorldWidth / 2.0f), + cameraPos.y() - (m_SAAEWorldData.m_WorldHeight / 2.0f), + cameraPos.z(), + 1.0f); + m_Camera.m_Position = m_EmitterPositionNormalized_Debug.xyz(); + } + + m_Camera.m_View.WAxis() = CFloat4(m_Camera.m_Position.x(), m_Camera.m_Position.y(), m_Camera.m_Position.z(), 1.0f); + } + else + m_Camera.m_Position = cameraPos.xyz(); + + if (m_SAAEWorldData.m_WorldWidth > 0 && m_SAAEWorldData.m_WorldHeight > 0) + { + if (m_EmitterTransformType == ETransformType_2D) + { + float ratio = Units::DegreesToRadians((((m_AECameraZoom) * 2.0f) / (m_SAAEWorldData.m_WorldWidth))); + float HFov = 2.0f * (1.0f / tan(ratio)); + + _SetProj(HFov, CFloat2(m_SAAEWorldData.m_WorldWidth, m_SAAEWorldData.m_WorldHeight), m_EffectDesc->m_Camera.m_Near, m_EffectDesc->m_Camera.m_Far); + } + else + { + double tanTheta = (((double)m_SAAEWorldData.m_WorldHeight) / (double)(2.0 * m_AECameraZoom)); + double halfFOV = Units::RadiansToDegrees(atan(tanTheta)); + float FOVDeg = (float)(halfFOV * 2.0); + + _SetProj(FOVDeg, CFloat2(m_SAAEWorldData.m_WorldWidth, m_SAAEWorldData.m_WorldHeight), m_EffectDesc->m_Camera.m_Near, m_EffectDesc->m_Camera.m_Far); + } + } + else + { + PK_ASSERT_NOT_REACHED(); + } + m_Camera.Update(); +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_UpdateMediumCollectionView() +{ + const CFloat4x4 matW2V = m_Camera.m_View; //AE Axis system + const CFloat4x4 matW2P = matW2V * m_Camera.m_Proj; //RHYUP + + PK_ASSERT(m_ViewSlotInMediumCollection.Valid()); + m_ParticleMediumCollection->UpdateView(m_ViewSlotInMediumCollection, matW2V, matW2P, m_Camera.m_WinSize); +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_OnUpdateComplete(CParticleMediumCollection *collection) +{ + (void)collection; + for (u32 i = 0; i < m_ActiveAudioSamplers.Count(); ++i) + { + m_ActiveAudioSamplers[i]->ReleaseAEResources(); + } + m_ActiveAudioSamplers.Clear(); +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_LoadEffectIFN(const SSimpleSceneDef &sceneDef) +{ + CPopcornFXWorld &world = CPopcornFXWorld::Instance(); + + if (m_LayerHolder->m_LayerProperty == null) + world.CreateLayerPropertyIFP(m_LayerHolder); + + if (m_Effect != null && sceneDef.m_Refresh == false) + return true; + + for (u32 i = 0; i < m_OverridableProperties.Count(); ++i) + PK_SAFE_DELETE(m_OverridableProperties[i]); + m_OverridableProperties.Clean(); + if (sceneDef.m_EffectPath == null) + { + CLog::Log(PK_ERROR, "empty effect path."); + return false; + } + + CLog::Log(PK_INFO, "Loading Effect : %s", sceneDef.m_EffectPath.Data()); + + IFileSystem *fileSystem = File::DefaultFileSystem(); + + // Method #1 for loading: Pass down your own memory buffer to the load function + u32 rawFileSize = 0; // will be filled by 'Bufferize' call below + u8 *rawFileBuffer = fileSystem->Bufferize(m_LoadedPack->Path() / sceneDef.m_EffectPath, &rawFileSize, true); + if (rawFileBuffer != null) + { + CConstMemoryStream memoryFileView(rawFileBuffer, rawFileSize); + + PBaseObjectFile objFile = m_HBOContext->LoadFileFromStream(memoryFileView, sceneDef.m_EffectPath); + + if (!PK_VERIFY(objFile != null)) + { + CLog::Log(PK_ERROR, "Loading file from stream failed: %s", sceneDef.m_EffectPath.Data()); + return false; + } + + if (m_LayerHolder->m_LayerProperty != null) + { + for (auto obj : objFile->ObjectList()) + { + PLayerCompileCache srcLayer = HBO::Cast(obj.Get()); + + if (srcLayer != null) + { + for (auto &srcRenderer : srcLayer->Renderers()) + { + for (u32 pidx = 0; pidx < srcRenderer->Properties().Count(); ++pidx) + { + CLayerCompileCacheRendererProperty *srcProp = srcRenderer->Properties()[pidx]; + + if (srcProp->PropertyType() == PropertyType_TexturePath) + { + SRendererProperties *prop = PK_NEW(SRendererProperties(srcProp->PropertyName(), srcProp->PropertyValueStr(), srcLayer->LayerName(), srcLayer->UID(), CStringId(m_EffectDesc->m_UUID.c_str()), srcRenderer->UID(), srcProp->UID())); + if (!PK_VERIFY(m_OverridableProperties.PushBack(prop).Valid())) + return false; + + for (u32 i = 0; i < m_LayerHolder->m_LayerProperty->RendererProperties().Count(); ++i) + { + if (srcRenderer->UID() == m_LayerHolder->m_LayerProperty->RendererProperties()[i]->RendererID() && + srcProp->UID() == m_LayerHolder->m_LayerProperty->RendererProperties()[i]->PropertyID()) + { + srcProp->SetPropertyValueStr(m_LayerHolder->m_LayerProperty->RendererProperties()[i]->Value()); + prop->m_Value = srcProp->PropertyValueStr(); + } + } + } + } + } + } + } + + if (m_EffectFile != null) + { + m_Effect = null; + m_EffectFile->Unload(); + m_EffectFile = null; + } + } + if (m_Effect == null) + m_Effect = CParticleEffect::Load(objFile); + + PK_FREE(rawFileBuffer); + + if (!PK_VERIFY(m_Effect != null)) + { + CLog::Log(PK_ERROR, "Failed loading effect \"%s\"", sceneDef.m_EffectPath.Data()); + return false; + } + if (!m_Effect->Install(m_ParticleMediumCollection)) + { + CLog::Log(PK_ERROR, "Failed Install effect \"%s\"", sceneDef.m_EffectPath.Data()); + return false; + } + m_AttributesList = m_Effect->AttributeFlatList().Get(); + if (!PK_VERIFY(m_AttributesList != null)) + { + CLog::Log(PK_WARN, "no attributes descriptor"); + return false; + } + if (!_RebuildAttributes(sceneDef)) + { + CLog::Log(PK_ERROR, "_RebuildAttributes failed"); + return false; + } + m_AttributesList = null; + } + + m_EffectPath = sceneDef.m_EffectPath; + return true; +} + +//---------------------------------------------------------------------------- + +PParticleEffectInstance CAAEScene::_InstantiateEffect() +{ + _UpdateCamera(); + _UpdateEmitter(m_DT); + return _InstantiateEffect(0, 0); +} + +//---------------------------------------------------------------------------- +// This version if 'InstantiateEffect' takes two time arguments to pinpoint with accuracy +// where during the frame the instantiation happened. If you don't care, just pass zero in both parameters. + +PParticleEffectInstance CAAEScene::_InstantiateEffect(float timeFromStartOfFrame, float timeToEndOfFrame) +{ + PK_ASSERT(m_Effect != null); + PK_ASSERT(timeFromStartOfFrame >= 0.0f); + PK_ASSERT(timeToEndOfFrame >= 0.0f); + + // CParticleEffect::Instantiate() returns an effect instance, registered into the specified medium collection + PParticleEffectInstance instance = m_Effect->Instantiate_AlreadyInstalled(m_ParticleMediumCollection); + + if (instance != null) + { + // The death notifier will be called as soon as the instance dies. See the comment above the 'm_DeathNotifier' member in + instance->m_DeathNotifier += FastDelegate(this, &CAAEScene::_OnInstanceDeath); + + instance->EnableSeed(true); + instance->Seed(m_LayerHolder->m_SpawnedEmitter.m_Desc->m_Seed); + + SEffectStartCtl effectStartCtl; + effectStartCtl.m_TimeFromStartOfFrame = timeFromStartOfFrame; + effectStartCtl.m_TimeToEndOfFrame = timeToEndOfFrame; + effectStartCtl.m_SpawnTransformsPack.m_WorldTr_Current = &m_EmitterTransformsCurrent; + effectStartCtl.m_SpawnTransformsPack.m_WorldTr_Previous = &m_EmitterTransformsPrevious; + effectStartCtl.m_SpawnTransformsPack.m_WorldVel_Current = &m_EmitterVelCurrent; + effectStartCtl.m_SpawnTransformsPack.m_WorldVel_Previous = &m_EmitterVelPrevious; + + // Start the instance. (Frame start/end times are optional, you can call 'instance->Start(xforms)' if you don't care) + instance->Start(effectStartCtl); + } + + return instance; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_OnInstanceDeath(const PParticleEffectInstance &instance) +{ + PK_ASSERT(instance != null); + // This callback will be called from worker threads + + // Not strictly necessary to -= the callback, the instance is getting destroyed anyway. + instance->m_DeathNotifier -= FastDelegate(this, &CAAEScene::_OnInstanceDeath); + if (instance == m_EffectLastInstance) + { + instance->KillImmediate(); + m_EffectLastInstance = null; + } +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_RebuildAttributes(const SSimpleSceneDef &sceneDef) +{ + (void)sceneDef; + + auto &attributeList = m_AttributesList->AttributeList(); + auto &samplerList = m_AttributesList->SamplerList(); + const u32 samplerCount = samplerList.Count(); + const u32 attrCount = attributeList.Count(); + + TArray attrOrder; + + for (u32 i = 0; i < attrCount; ++i) + { + CParticleAttributeDeclaration *attrDecl = attributeList[i]; + + PK_ASSERT(attrDecl != null); + + CString category = attrDecl->CategoryName().MapENG().ToAscii(); + SAttributeDesc *attrDesc = new SAttributeDesc(attrDecl->ExportedName().Data(), (const char*)category.Data(), AttributePKToAAE((EBaseTypeID)attrDecl->ExportedType()), AttributePKToAAE(attrDecl->GetEffectiveDataSemantic())); + + SAttributesContainer_SAttrib value = attrDecl->GetDefaultValue(); + SAttributesContainer_SAttrib valueMin = attrDecl->GetMinValue(); + SAttributesContainer_SAttrib valueMax = attrDecl->GetMaxValue(); + + attrDesc->m_HasMax = attrDecl->HasMax(); + attrDesc->m_HasMin = attrDecl->HasMin(); + EAttributeType type = attrDesc->m_Type; + if (type >= AttributeType_Bool1 && type <= AttributeType_Bool4) + { + attrDesc->SetValue(value.Get()); + attrDesc->SetDefaultValue(value.Get()); + attrDesc->SetMinValue(valueMin.Get()); + attrDesc->SetMaxValue(valueMax.Get()); + } + if (type >= AttributeType_Int1 && type <= AttributeType_Int4) + { + attrDesc->SetValue(value.Get()); + attrDesc->SetDefaultValue(value.Get()); + attrDesc->SetMinValue(valueMin.Get()); + attrDesc->SetMaxValue(valueMax.Get()); + } + if (type >= AttributeType_Float1 && type <= AttributeType_Float4) + { + attrDesc->SetValue(value.Get()); + attrDesc->SetDefaultValue(value.Get()); + attrDesc->SetMinValue(valueMin.Get()); + attrDesc->SetMaxValue(valueMax.Get()); + } + attrDesc->m_IsDefaultValue = true; + + if (!PK_VERIFY(attrOrder.PushBack(attrDesc).Valid())) + return false; + } + + for (u32 i = 0; i < samplerCount; ++i) + { + CParticleAttributeSamplerDeclaration *samplerDecl = samplerList[i]; + PK_ASSERT(samplerDecl != null); + + CString category = samplerDecl->CategoryName().MapENG().ToAscii(); + SAttributeSamplerDesc *smplrDesc = new SAttributeSamplerDesc(samplerDecl->ExportedName().Data(), (const char*)category.Data(), AttributeSamplerPKToAAE((SParticleDeclaration::SSampler::ESamplerType)samplerDecl->ExportedType())); + + switch (smplrDesc->m_Type) + { + case AttributeSamplerType_Geometry: + smplrDesc->m_Descriptor = new SShapeSamplerDescriptor(); + break; + case AttributeSamplerType_Text: + smplrDesc->m_Descriptor = new STextSamplerDescriptor(); + break; + case AttributeSamplerType_Image: + smplrDesc->m_Descriptor = new SImageSamplerDescriptor(); + break; + case AttributeSamplerType_Audio: + { + smplrDesc->m_Descriptor = new SAudioSamplerDescriptor(); + + CResourceDescriptor_Audio *nodeSamplerData = HBO::Cast(samplerDecl->AttribSamplerDefaultValue().Get()); + if (PK_VERIFY(nodeSamplerData != null)) + ((SAudioSamplerDescriptor*)smplrDesc->m_Descriptor)->m_ChannelGroup = nodeSamplerData->ChannelGroup().Data(); + break; + } + case AttributeSamplerType_VectorField: + smplrDesc->m_Descriptor = new SVectorFieldSamplerDescriptor(); + break; + default: + smplrDesc->m_Descriptor = null; + break; + } + if (smplrDesc->m_Descriptor) + smplrDesc->m_Descriptor->m_UsageFlags = samplerDecl->UsageFlags(); + + if (!PK_VERIFY(attrOrder.PushBack(smplrDesc).Valid())) + return false; + } + + typedef TArray::Iterator attrDescIt; + + struct SSortAttributesPolicy + { + PK_FORCEINLINE static bool Less(const attrDescIt &it0, const attrDescIt &it1) + { + int cmpCategoryRes = (*it0)->m_CategoryName.compare((*it1)->m_CategoryName); + + if (cmpCategoryRes < 0) + return true; + if (cmpCategoryRes > 0) + return false; + if (cmpCategoryRes == 0) + { + if ((*it0)->m_Name.compare((*it1)->m_Name) < 0) + return true; + else + return false; + } + return false; + } + + PK_FORCEINLINE static bool Equal(const attrDescIt &it0, const attrDescIt &it1) + { + int cmpCategoryRes = (*it0)->m_CategoryName.compare((*it1)->m_CategoryName); + int cmpNameRes = (*it0)->m_Name.compare((*it1)->m_Name); + return cmpCategoryRes == 0 && cmpNameRes == 0; + } + }; + + QuickSort(attrOrder.Begin(), attrOrder.End()); + + CPopcornFXWorld::Instance().HandleNewAttributes(attrOrder, m_EffectRef, m_LayerHolder, false); + return true; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_ExtractAEFrameInfo(SAAEIOData &AAEData) +{ + u32 targetFrame = AAEData.m_InData->current_time / AAEData.m_InData->local_time_step; + if (m_FrameNumber + 1 != targetFrame) + m_ForceRestartSeeking = true; + else + m_ForceRestartSeeking = false; + m_FrameNumber = targetFrame; + + m_DT = (float)((double)AAEData.m_InData->local_time_step / (double)AAEData.m_InData->time_scale); + m_PreviousTimeSec = m_CurrentTimeSec; + m_CurrentTimeSec = (float)((double)AAEData.m_InData->current_time / (double)AAEData.m_InData->time_scale); +} + +//---------------------------------------------------------------------------- + +bool CAAEScene::_CheckRenderAbort(SAAEIOData *AAEData) +{ + if (AAEData == null) + { + CLog::Log(PK_INFO, "RenderAbort"); + return true; + } + PF_Err res = PF_Err_NONE; + res = PF_ABORT(AAEData->m_InData); + if (res != PF_Err_NONE) + { + AAEData->m_ReturnCode = res; + CLog::Log(PK_INFO, "RenderAbort"); + return true; + } + return false; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_SetProj(float fovydegree, const CFloat2 &winDimPixel, float zNear, float zFar) +{ + float fX, fY; + + m_Camera.m_ProjNear = zNear; + m_Camera.m_ProjFar = zFar; + m_Camera.m_WinSize = winDimPixel; + if (m_EmitterTransformType == ETransformType_2D) + { + const float aspect = winDimPixel.y() / winDimPixel.x(); + fX = 1.f / tanf(Units::DegreesToRadians(fovydegree) * 0.5f); + fY = fX / aspect; + } + else + { + m_Camera.m_ProjFovy = fovydegree; + const float aspect = winDimPixel.x() / winDimPixel.y(); + fY = 1.f / tanf(Units::DegreesToRadians(fovydegree * 0.5f)); + fX = fY / aspect; + } + + const float kRcpRange = 1.0f / (zNear - zFar); + const float kA = (zFar + zNear) * kRcpRange; + const float kB = (zFar * zNear) * kRcpRange; + + RHI::EGraphicalApi api = CPopcornFXWorld::Instance().GetRenderApi(); + if (api == RHI::GApi_D3D11 || api == RHI::GApi_D3D12 || api == RHI::GApi_Metal) + { + // GApi_D3D11: GApi_D3D12 + m_Camera.m_Proj = CFloat4x4(fX, 0, 0, 0, + 0, -fY, 0, 0, + 0, 0, 0.5f * kA - 0.5f, -1, + 0, 0, kB, 0); + } + else + { + PK_ASSERT_NOT_REACHED_MESSAGE("No projection matrix for this API"); + } + + CFloat4x4 current2RHYUp = CFloat4x4::IDENTITY; + CCoordinateFrame::BuildTransitionFrame(CCoordinateFrame::GlobalFrame(), Frame_RightHand_Y_Up, current2RHYUp); + + m_Camera.m_Proj = current2RHYUp * m_Camera.m_Proj; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::_FillAdditionnalDataForRender() +{ + TArray &outSkinnedDatas = m_FXInstancesSkinnedData; + + outSkinnedDatas.Clear(); + + const PSkinnedMeshInstance instance = m_SkinnedMeshInstance; + if (instance == null) + return; + if (!PK_VERIFY(outSkinnedDatas.PushBack().Valid())) + { + outSkinnedDatas.Clear(); + return; + } + + SSkinnedDataSimple &skinnedDataSimple = outSkinnedDatas.Last(); + + skinnedDataSimple.m_Valid = (instance->m_SkinnedMesh != null && instance->m_SkinnedMesh->Valid() && instance->m_SkinnedMesh->HasGeometry()); + if (skinnedDataSimple.m_Valid) + { + if (!PK_VERIFY(skinnedDataSimple.m_SubMeshes.Resize(instance->m_SkinnedMesh->SubMeshCount()))) + { + skinnedDataSimple.m_SubMeshes.Clear(); + return; + } + for (u32 smidx = 0, smCount = instance->m_SkinnedMesh->SubMeshCount(); smidx < smCount; smidx++) + { + auto &submesh = skinnedDataSimple.m_SubMeshes[smidx]; + submesh.m_SubMeshID = smidx; + submesh.m_Positions = instance->m_SkinnedMesh->Positions(smidx); + submesh.m_Normals = instance->m_SkinnedMesh->Normals(smidx); + } + for (u32 smidx = 0; smidx < skinnedDataSimple.m_SubMeshes.Count(); smidx++) + { + auto &submesh = skinnedDataSimple.m_SubMeshes[smidx]; + if (submesh.m_Positions.Empty() && + submesh.m_Normals.Empty()) + skinnedDataSimple.m_SubMeshes.Remove(smidx--); + } + } + + if (!PK_VERIFY(m_BackdropData.m_FXInstancesSkinnedDatas.Resize(1))) + return; + + for (u32 iInstance = 0; iInstance < 1; ++iInstance) + { + const SSkinnedDataSimple &skinnedData = m_FXInstancesSkinnedData[iInstance]; + PKSample::SSkinnedMeshData &skinnedDataForRender = m_BackdropData.m_FXInstancesSkinnedDatas[iInstance]; + + skinnedDataForRender.m_Valid = false; + + if (!skinnedData.m_Valid || + skinnedData.m_SubMeshes.Empty() || + !PK_VERIFY(skinnedDataForRender.m_SubMeshes.Resize(skinnedData.m_SubMeshes.Count()))) + { + skinnedDataForRender.m_SubMeshes.Clear(); + continue; + } + + skinnedDataForRender.m_Valid = skinnedData.m_Valid; + + for (u32 smidx = 0; smidx < skinnedData.m_SubMeshes.Count(); smidx++) + { + const auto &submesh = skinnedData.m_SubMeshes[smidx]; + auto &submeshForRender = skinnedDataForRender.m_SubMeshes[smidx]; + + submeshForRender.m_SubMeshID = submesh.m_SubMeshID; + + // skinned data is 0x10 aligned, submeshForRender has same alignment as final vb so we can memcpy + const u32 posCount = submesh.m_Positions.Count(); + const u32 pnStride = sizeof(CFloat3); + const u32 posSizeInBytes = posCount * pnStride; + const u32 totalSizeInBytes = posSizeInBytes + submesh.m_Normals.Count() * pnStride; + PK_ASSERT(totalSizeInBytes > 0); + PK_ASSERT(posCount == submesh.m_Normals.Count() || submesh.m_Normals.Empty()); + if (!PK_VERIFY(submeshForRender.m_RawData.Resize(totalSizeInBytes))) + { + submeshForRender.m_RawData.Clear(); + continue; + } + + CFloat3 *dstData = reinterpret_cast(submeshForRender.m_RawData.RawDataPointer()); + TStridedMemoryView dstPositions(dstData, posCount, pnStride); + TStridedMemoryView dstNormals(dstData + posCount, posCount, pnStride); + + Mem::CopyStreamToStream(dstPositions, submesh.m_Positions); + Mem::CopyStreamToStream(dstNormals, submesh.m_Normals); + } + } +} + +//---------------------------------------------------------------------------- + +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0 || PK_PARTICLES_UPDATER_USE_D3D11 != 0) +bool CAAEScene::SimDispatchMask(const PopcornFX::CParticleDescriptor *descriptor, PopcornFX::SSimDispatchHint &outHint) +{ + const PopcornFX::SParticleDeclaration &decl = descriptor->ParticleDeclaration(); + // Tell PopcornFX Runtime that our code does not handle any of the following renderers on GPU: + // if a particle layer contain any of those, even if the simulation graph has compute shader bytecodes, it will fallback on CPU. + if (!decl.m_LightRenderers.Empty() || + !decl.m_SoundRenderers.Empty() || + !decl.m_RibbonRenderers.Empty() || + !decl.m_TriangleRenderers.Empty() || + !decl.m_DecalRenderers.Empty()) + { + outHint.m_AllowedDispatchMask &= ~(1 << PopcornFX::SSimDispatchHint::Location_GPU); // can't draw any of these on the GPU + } + // if we are allowed on GPU, prefer GPU, otherwise prefer CPU: + if (outHint.m_AllowedDispatchMask & (1 << PopcornFX::SSimDispatchHint::Location_GPU)) + outHint.m_PreferredDispatchMask = (1 << PopcornFX::SSimDispatchHint::Location_GPU); + else + outHint.m_PreferredDispatchMask = (1 << PopcornFX::SSimDispatchHint::Location_CPU); + return true; +} + +//---------------------------------------------------------------------------- + +void CAAEScene::D3D12_EnqueueTask(const PopcornFX::PParticleUpdaterTaskD3D12 &task) +{ + CPopcornFXWorld &pkfxWorld = CPopcornFXWorld::Instance(); + PAAERenderContext renderContext = pkfxWorld.GetCurrentRenderContext(); + CAAED3D12Context *D3D12Context = static_cast(renderContext->GetAEGraphicContext()); + + if (D3D12Context != null && D3D12Context->m_D3D12Context->m_CommandQueue != null) // Your ID3D12CommandQueue (can be D3D12_COMMAND_LIST_TYPE_DIRECT or D3D12_COMMAND_LIST_TYPE_COMPUTE) + task->Execute(D3D12Context->m_D3D12Context->m_CommandQueue); // Internally calls commandQueue->ExecuteCommandLists and fences +} +#endif + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_SkinnedMesh.cpp b/AE_GeneralPlugin/Sources/AEGP_SkinnedMesh.cpp new file mode 100644 index 00000000..74a3c7d1 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_SkinnedMesh.cpp @@ -0,0 +1,451 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" +#include "AEGP_SkinnedMesh.h" + +#include // for random XForms tests +#include // for 'Skin_PostProcess' +#include // for CMeshSurfaceSamplerStructuresRandom && CMeshVolumeSamplerStructuresRandom + +// For skinned mesh backdrops +#include +#include +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- +// +// Skinned mesh instance wrapper implementation +// +//---------------------------------------------------------------------------- + +CSkinnedMesh::CSkinnedMesh() + : m_SkinDt(0) + , m_FirstFrame(false) + , m_SamplingChannels(0) +{ +} + +//---------------------------------------------------------------------------- + +CSkinnedMesh::~CSkinnedMesh() +{ + Reset(); +} + +//---------------------------------------------------------------------------- + +void CSkinnedMesh::Reset() +{ + WaitAsyncUpdateSkin(); + + m_SubMeshes.Clear(); + + m_SkinDt = 0; + m_FirstFrame = 0; + m_SamplingChannels = 0; + + m_Timeline = CTimeline(); // must reset before clearing m_SkeletonState + m_SkeletonState = null; +} + +//---------------------------------------------------------------------------- + +bool CSkinnedMesh::Init(const TResourcePtr &meshResource, u32 samplingChannels, const PSkeletonState &srcSkeletonState) +{ + const bool success = _Init_Impl(meshResource, samplingChannels, srcSkeletonState); + if (!success) + Reset(); + return success; +} + +//---------------------------------------------------------------------------- + +bool CSkinnedMesh::_Init_Impl(const TResourcePtr &meshResource, u32 samplingChannels, const PSkeletonState &srcSkeletonState) +{ + WaitAsyncUpdateSkin(); + + m_FirstFrame = true; + m_SamplingChannels = samplingChannels; + + if (meshResource == null || srcSkeletonState == null) + return false; + + for (auto &mesh : m_SubMeshes) + { + mesh.m_SkeletalMesh = null; + mesh.m_SkeletonState = null; + } + + m_Timeline = CTimeline(); // must reset before clearing m_SkeletonState + m_SkeletonState = null; + + // create and copy skeleton state if necessary: + if (m_SkeletonState == null) + { + m_SkeletonState = PK_NEW(CSkeletonState); + if (m_SkeletonState == null) + return false; + } + + if (!m_SkeletonState->DeepCopy(*srcSkeletonState)) + return false; + + m_SkeletonState->SetTimeline(&m_Timeline); + + const u32 kLodLevel = 0; + TMemoryView batchList = meshResource->BatchList(kLodLevel); + if (!PK_VERIFY(m_SubMeshes.Resize(batchList.Count()))) + return false; + + for (u32 batchId = 0; batchId < m_SubMeshes.Count(); batchId++) + { + SSubMesh &mesh = m_SubMeshes[batchId]; + + // grab the desired skeletal mesh: + mesh.m_SkeletalMesh = batchList[batchId].Get(); + if (!PK_VERIFY(mesh.m_SkeletalMesh != null)) + return false; + + // FIXME: Handle when some submeshes aren't skinned + if (!mesh.m_SkeletalMesh->IsSkinned()) + { + mesh.m_SkeletalMesh = null; + mesh.m_SkeletonState = null; + continue; + } + + mesh.m_SkeletonState = m_SkeletonState; + + // grab the raw geometry: + const CMeshTriangleBatch &srcGeomBatch = mesh.m_SkeletalMesh->RawMesh()->TriangleBatch(); + const CMeshVStream &srcVStream = srcGeomBatch.m_VStream; + if (srcVStream.Empty()) + return false; + + // do we need to create or resize our locally skinned vertex streams? + if (mesh.m_RawSkinnedDataElementCount != srcVStream.VertexCount()) + { + // nedds initial alloc, or resize + const u32 vertexCount = srcVStream.VertexCount(); + const u32 offsetPos = 0; + const u32 offsetNor = Mem::Align(offsetPos + vertexCount * u32(sizeof(CFloat4))); // pad Positions & Normals to Float4 for fast aligned SIMD processing + const u32 offsetTan = Mem::Align(offsetNor + vertexCount * u32(sizeof(CFloat4))); + const u32 offsetOld = Mem::Align(offsetTan + vertexCount * u32(sizeof(CFloat4))); + const u32 offsetVel = Mem::Align(offsetOld + vertexCount * u32(sizeof(CFloat4))); + const u32 offsetEnd = Mem::Align(offsetVel + vertexCount * u32(sizeof(CFloat4))); + + const u32 totalStreamsFootprint = offsetEnd; + void *rawDataPtr = PK_REALLOC_ALIGNED(mesh.m_RawSkinnedData, totalStreamsFootprint, Memory::CacheLineSize); // alloc or grow existing buffer + if (rawDataPtr == null) + { + PK_FREE(mesh.m_RawSkinnedData); + mesh.m_RawSkinnedData = null; + mesh.m_Positions = TStridedMemoryView(); + mesh.m_Normals = TStridedMemoryView(); + mesh.m_Tangents = TStridedMemoryView(); + mesh.m_OldPositions = TStridedMemoryView(); + mesh.m_Velocities = TStridedMemoryView(); + return false; + } + + mesh.m_RawSkinnedDataElementCount = vertexCount; + mesh.m_RawSkinnedData = rawDataPtr; + + // build views into the memory we just (re)allocated: + mesh.m_Positions = TStridedMemoryView(static_cast(Mem::AdvanceRawPointer(mesh.m_RawSkinnedData, offsetPos)), vertexCount, sizeof(CFloat4)); + mesh.m_Normals = TStridedMemoryView(static_cast(Mem::AdvanceRawPointer(mesh.m_RawSkinnedData, offsetNor)), vertexCount, sizeof(CFloat4)); + mesh.m_Tangents = TStridedMemoryView(static_cast(Mem::AdvanceRawPointer(mesh.m_RawSkinnedData, offsetTan)), vertexCount, sizeof(CFloat4)); + mesh.m_OldPositions = TStridedMemoryView(static_cast(Mem::AdvanceRawPointer(mesh.m_RawSkinnedData, offsetOld)), vertexCount, sizeof(CFloat4)); + mesh.m_Velocities = TStridedMemoryView(static_cast(Mem::AdvanceRawPointer(mesh.m_RawSkinnedData, offsetVel)), vertexCount, sizeof(CFloat4)); + + mesh.m_SampleSourceOverride.m_PositionsOverride = TStridedMemoryView(); + mesh.m_SampleSourceOverride.m_NormalsOverride = TStridedMemoryView(); + mesh.m_SampleSourceOverride.m_TangentsOverride = TStridedMemoryView(); + mesh.m_SampleSourceOverride.m_VelocitiesOverride = TStridedMemoryView(); + } + + if (samplingChannels & Channel_Position) + mesh.m_SampleSourceOverride.m_PositionsOverride = mesh.m_Positions; + + if (samplingChannels & Channel_Velocity) + mesh.m_SampleSourceOverride.m_VelocitiesOverride = mesh.m_Velocities; + + if (samplingChannels & Channel_Normal) + mesh.m_SampleSourceOverride.m_NormalsOverride = mesh.m_Normals; + + if (samplingChannels & Channel_Tangent) + mesh.m_SampleSourceOverride.m_TangentsOverride = mesh.m_Tangents; + + PK_ASSERT(mesh.m_RawSkinnedData != null); + + // copy source vertex-buffer streams to dst + // Note: here we only copy the tangents. the 'w' components of the tangents will not be touched by the skinner, and have to be valid in the dst streams + // (this might change in the future, where no initial copy necessary at all) +#ifdef PK_SAMPLE_SKIN_TANGENTS + TStridedMemoryView srcVbTangents = srcVStream.Tangents(); + PK_ASSERT(srcVbTangents.Count() == srcVStream.VertexCount()); + PK_ASSERT(srcVbTangents.Count() == mesh.m_RawSkinnedDataElementCount); + PK_ASSERT(mesh.m_Tangents.Stride() == sizeof(CFloat4)); + + if (srcVbTangents.Stride() == mesh.m_Tangents.Stride()) + { + // common-case fast-path + Mem::Copy(mesh.m_Tangents.Data(), srcVbTangents.Data(), mesh.m_RawSkinnedDataElementCount * sizeof(CFloat4)); + } + else + { + // do a slow copy (should not happen, except if we've got AOS VBs (we shouldn't, skinner will take a monstruous perf hit) + for (u32 i = 0; i < mesh.m_RawSkinnedDataElementCount; i++) + mesh.m_Tangents[i] = srcVbTangents[i]; + } +#endif + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CSkinnedMesh::Play(const PSkeletonAnimationInstance &animInstance) +{ + if (m_SkeletonState != null) + { + if (m_SkeletonState->__TMP_GORE_PlayAnim(animInstance) == null) // FIXME: gore + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +void CSkinnedMesh::Stop() +{ + if (m_SkeletonState != null) + m_SkeletonState->__TMP_GORE_StopAnim(); // FIXME: gore +} + +//---------------------------------------------------------------------------- + +void CSkinnedMesh::Update(float dt) +{ + m_Timeline.Update(dt); + if (m_SkeletonState != null) + m_SkeletonState->Update(dt); +} + +//---------------------------------------------------------------------------- + +#if 0 +void CSkinnedMesh::Render() +{ + m_Renderer.AnimMesh(m_Positions); + m_Renderer.Render(); +} +#endif + +//---------------------------------------------------------------------------- + +void CSkinnedMesh::StartAsyncUpdateSkin(float dt) +{ + if (m_SkeletonState == null) + return; + + const u32 samplingChannels = SamplingChannels(); + if (samplingChannels & Channel_Velocity) + m_SkinDt = dt; + + for (auto &mesh : m_SubMeshes) + { + if (mesh.Empty()) + continue; + + SSkinContext asyncSkinContext; + + const CMeshVStream *vStream = &mesh.m_SkeletalMesh->RawMesh()->TriangleBatch().m_VStream; + + asyncSkinContext.m_SkinningStreams = mesh.m_SkeletalMesh->m_OptimizedStreams; + + // Skinner always expects positions, even if the effect won't be sampling them + asyncSkinContext.m_SrcPositions = vStream->Positions(); + asyncSkinContext.m_DstPositions = mesh.m_Positions; + + // The rendering may need normals (in fact, the most of the cases) + //if (samplingChannels & Channel_Normal) + { + asyncSkinContext.m_SrcNormals = vStream->Normals(); + asyncSkinContext.m_DstNormals = mesh.m_Normals; + } + + // The rendering may need tangents (not for now, as skined mesh does not have normal-map) + // for tangents, they are in fact a CFloat4 stream, with the 'w' component containing a sign telling if the tangent basis is mirrored. + // we are only interested in skinning the float3 part, and we need to keep the 'w' component intact for correct tangent-space reconstruction in the shaders. + if (samplingChannels & Channel_Tangent) + { + asyncSkinContext.m_SrcTangents = vStream->Tangents(); + asyncSkinContext.m_DstTangents = mesh.m_Tangents; + } + + if (samplingChannels & Channel_Velocity) + { + // hook our pre-skin callback where we'll copy the positions to m_OldPositions so that the skin job can correctly + // differentiate the two and compute the instantaneous mesh surface velocities using 'asyncSkinContext.m_SrcDt' + asyncSkinContext.m_CustomProcess_PreSkin = SSkinContext::CbCustomProcess(&mesh, &SSubMesh::Skin_PreProcess); + asyncSkinContext.m_CustomProcess_PostSkin = SSkinContext::CbCustomProcess(&mesh, &SSubMesh::Skin_PostProcess); + } + + asyncSkinContext.m_SkinFlags = SkinFlags_UseMultipassSkinning; + // If you handle unskinned verts in the PostSkin pass, you can set the following flag, + // it'll avoid unnecessary copies in the skinner jobs: +// asyncSkinContext.m_SkinFlags = SkinFlags_DontCopyUnskinnedVerts; + + mesh.m_SkinDt = m_SkinDt; + mesh.m_FirstFrame = m_FirstFrame; + + CSkeletalSkinnerSimple::AsyncSkinStart(mesh.m_SkinUpdateContext, m_SkeletonState->View(), asyncSkinContext); + } +} + +//---------------------------------------------------------------------------- + +void CSkinnedMesh::SSubMesh::Skin_PreProcess(u32 vertexStart, u32 vertexCount, const SSkinContext &ctx) +{ + (void)ctx; + if (m_SkeletonState == null) + return; + + TStridedMemoryView src = m_Positions.Slice(vertexStart, vertexCount); + TStridedMemoryView dst = m_OldPositions.Slice(vertexStart, vertexCount); + + PK_ASSERT(src.Stride() == 0x10 && dst.Stride() == 0x10); + Mem::Copy(dst.Data(), src.Data(), dst.Count() * dst.Stride()); +} + +//---------------------------------------------------------------------------- + +void CSkinnedMesh::SSubMesh::Skin_PostProcess(u32 vertexStart, u32 vertexCount, const SSkinContext &ctx) +{ + if (m_SkeletonState == null) + return; + + PK_SCOPEDPROFILE(); // record this function in the visual profiler + + // compute instantaneous surface velocities IFN: + TStridedMemoryView vel = m_Velocities.Slice(vertexStart, vertexCount); + TStridedMemoryView posCur = ctx.m_DstPositions.Slice(vertexStart, vertexCount); + TStridedMemoryView posOld = m_OldPositions.Slice(vertexStart, vertexCount); + const float dt = m_SkinDt; + + const bool continuousAnim = true;//(m_Skeleton != null) && (m_Skeleton->LastUpdateFrameID() == m_LastSkinnedSkeletonFrameID + 1); + if ((m_FirstFrame || !continuousAnim) && !vel.Empty()) + { + Mem::Clear(vel.Data(), vel.CoveredBytes()); + + PK_ASSERT(posCur.Stride() == posOld.Stride()); + PK_ASSERT(posCur.Count() == posOld.Count()); + PK_ASSERT(posCur.CoveredBytes() == posOld.CoveredBytes()); + if (m_FirstFrame) + { + // Avoid glitches during the first frame: our old positions will be the bindpose, + // we don't want particles to lerp between bindpose and first real frame + Mem::Copy((void*)posOld.Data(), posCur.Data(), posOld.CoveredBytes()); + } + } + else if (!posCur.Empty() && !posOld.Empty() && !vel.Empty()) + { + PK_ASSERT(posCur.Stride() == 0x10); + PK_ASSERT(posOld.Stride() == 0x10); + PK_ASSERT(vel.Stride() == 0x10); + + CFloat3 * __restrict dstVel = vel.Data(); + const CFloat3 *dstVelEnd = Mem::AdvanceRawPointer(dstVel, vertexCount * 0x10); + const CFloat3 *srcPosCur = posCur.Data(); + const CFloat3 *srcPosOld = posOld.Data(); + + PK_ASSERT(Mem::IsAligned<0x10>(dstVel)); + PK_ASSERT(Mem::IsAligned<0x10>(dstVelEnd)); + PK_ASSERT(Mem::IsAligned<0x10>(srcPosCur)); + PK_ASSERT(Mem::IsAligned<0x10>(srcPosOld)); + + const SIMD::Float4 invDt = SIMD::Float4(1.0f / dt); + dstVelEnd = Mem::AdvanceRawPointer(dstVelEnd, -0x40); + while (dstVel < dstVelEnd) + { + const SIMD::Float4 pA0 = SIMD::Float4::LoadAligned16(srcPosOld, 0x00); + const SIMD::Float4 pA1 = SIMD::Float4::LoadAligned16(srcPosOld, 0x10); + const SIMD::Float4 pA2 = SIMD::Float4::LoadAligned16(srcPosOld, 0x20); + const SIMD::Float4 pA3 = SIMD::Float4::LoadAligned16(srcPosOld, 0x30); + const SIMD::Float4 pB0 = SIMD::Float4::LoadAligned16(srcPosCur, 0x00); + const SIMD::Float4 pB1 = SIMD::Float4::LoadAligned16(srcPosCur, 0x10); + const SIMD::Float4 pB2 = SIMD::Float4::LoadAligned16(srcPosCur, 0x20); + const SIMD::Float4 pB3 = SIMD::Float4::LoadAligned16(srcPosCur, 0x30); + const SIMD::Float4 v0 = (pB0 - pA0) * invDt; + const SIMD::Float4 v1 = (pB1 - pA1) * invDt; + const SIMD::Float4 v2 = (pB2 - pA2) * invDt; + const SIMD::Float4 v3 = (pB3 - pA3) * invDt; + v0.StoreAligned16(dstVel, 0x00); + v1.StoreAligned16(dstVel, 0x10); + v2.StoreAligned16(dstVel, 0x20); + v3.StoreAligned16(dstVel, 0x30); + + dstVel = Mem::AdvanceRawPointer(dstVel, 0x40); + srcPosCur = Mem::AdvanceRawPointer(srcPosCur, 0x40); + srcPosOld = Mem::AdvanceRawPointer(srcPosOld, 0x40); + } + dstVelEnd = Mem::AdvanceRawPointer(dstVelEnd, +0x40); + + while (dstVel < dstVelEnd) + { + const SIMD::Float4 pA = SIMD::Float4::LoadAligned16(srcPosOld); + const SIMD::Float4 pB = SIMD::Float4::LoadAligned16(srcPosCur); + const SIMD::Float4 v = (pB - pA) * invDt; + v.StoreAligned16(dstVel); + + dstVel = Mem::AdvanceRawPointer(dstVel, 0x10); + srcPosCur = Mem::AdvanceRawPointer(srcPosCur, 0x10); + srcPosOld = Mem::AdvanceRawPointer(srcPosOld, 0x10); + } + } +} + +//---------------------------------------------------------------------------- + +bool CSkinnedMesh::WaitAsyncUpdateSkin() +{ + if (m_SkeletonState == null) + return true; + + for (auto &mesh : m_SubMeshes) + { + if (mesh.Empty()) + continue; + CAABB dummy; + if (!CSkeletalSkinnerSimple::AsyncSkinWait(mesh.m_SkinUpdateContext, &dummy, true)) + return false; + + if (mesh.m_FirstFrame && !mesh.m_Velocities.Empty()) + Mem::Clear(mesh.m_Velocities.Data(), mesh.m_Velocities.CoveredBytes()); + + mesh.m_FirstFrame = false; + } + + m_FirstFrame = false; + return true; +} + +//---------------------------------------------------------------------------- + +void CSkinnedMesh::ClearVelocities() +{ + for (auto &mesh : m_SubMeshes) + { + if (!mesh.Empty()) + Mem::Clear(mesh.m_Velocities.Data(), mesh.m_Velocities.CoveredBytes()); + } +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_SkinnedMeshInstance.cpp b/AE_GeneralPlugin/Sources/AEGP_SkinnedMeshInstance.cpp new file mode 100644 index 00000000..a2cb4370 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_SkinnedMeshInstance.cpp @@ -0,0 +1,261 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_SkinnedMeshInstance.h" +#include "AEGP_SkinnedMesh.h" + +#include +#include +#include +#include // for random XForms tests +#include // for 'Skin_PostProcess' +#include // for CMeshSurfaceSamplerStructuresRandom && CMeshVolumeSamplerStructuresRandom +// For skinned mesh backdrops +#include +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +CSkinnedMeshInstance::CSkinnedMeshInstance() + : m_SkeletonAnimationInstance(null) + , m_CurrentAnimationPath(CString::EmptyString) + , m_SkinnedMesh(null) + , m_CurMeshTransformScaled(CFloat4x4::IDENTITY) + , m_CurMeshTransform(CFloat4x4::IDENTITY) + , m_PrevMeshTransform(CFloat4x4::IDENTITY) +{ + +} + +//---------------------------------------------------------------------------- + +CSkinnedMeshInstance::~CSkinnedMeshInstance() +{ + if (m_SurfaceSamplingStruct != null) + PK_DELETE(m_SurfaceSamplingStruct); + if (m_VolumeSamplingStruct != null) + PK_DELETE(m_VolumeSamplingStruct); + + // order matters + m_SkeletonAnimationInstance = null; + m_SkinnedMesh = null; + +} + +//---------------------------------------------------------------------------- + +CSkinnedMeshInstance &CSkinnedMeshInstance::operator=(const CSkinnedMeshInstance &other) +{ + if (m_SurfaceSamplingStruct != null) + PK_SAFE_DELETE(m_SurfaceSamplingStruct); + if (m_VolumeSamplingStruct != null) + PK_SAFE_DELETE(m_VolumeSamplingStruct); + + m_CurrentAnimationPath = other.m_CurrentAnimationPath; + m_SkinnedMesh = other.m_SkinnedMesh; + m_ShapeDescOverride = other.m_ShapeDescOverride; + + m_CurMeshTransformScaled = other.m_CurMeshTransformScaled; + m_CurMeshTransform = other.m_CurMeshTransform; + m_PrevMeshTransform = other.m_PrevMeshTransform; + + PK_ASSERT(other.m_SurfaceSamplingStruct == null && + other.m_VolumeSamplingStruct == null); + return *this; +} + +//---------------------------------------------------------------------------- + +void CSkinnedMeshInstance::ResetXForms(const CFloat4x4 &backdropXForm) +{ + SetBackdropXForms(backdropXForm); + +} + +//---------------------------------------------------------------------------- + +void CSkinnedMeshInstance::SetBackdropXForms(const CFloat4x4 &backdropXForm) +{ + m_CurMeshTransform = backdropXForm; + m_PrevMeshTransform = backdropXForm; + m_CurMeshTransformScaled = m_CurMeshTransform; + + // Fix #5336: Scaled mesh backdrops also scale their sampled normals. Should not + // Here we need to remove the scale of the transforms and instead apply it in the mesh descriptor with 'SetScale' + const CFloat3 scale = m_CurMeshTransform.ScalingFactors(); + m_CurMeshTransform.RemoveScale(); + m_PrevMeshTransform.RemoveScale(); + + // Apply scale + if (m_ShapeDescOverride != null) + { + CParticleSamplerDescriptor_Shape_Default *def = checked_cast(m_ShapeDescOverride.Get()); + if (PK_VERIFY(def->m_Shape != null && def->m_Shape->ShapeType() == CShapeDescriptor::ShapeMesh)) + { + CShapeDescriptor_Mesh *shapeDescMesh = const_cast(checked_cast(def->m_Shape.Get())); + if (PK_VERIFY(shapeDescMesh != null)) + shapeDescMesh->SetScale(scale); + } + } +} + +//---------------------------------------------------------------------------- + +void CSkinnedMeshInstance::ResetAnimationCursor() +{ + if (m_SkeletonAnimationInstance != null) + m_SkeletonAnimationInstance->SeekTo(0.0f); +} + +//---------------------------------------------------------------------------- + +void CSkinnedMeshInstance::Update(float dt) +{ + if (m_SkinnedMesh != null) + m_SkinnedMesh->Update(dt); +} + +//---------------------------------------------------------------------------- + +void CSkinnedMeshInstance::StartAsyncUpdateSkin(float dt) +{ + if (m_SkinnedMesh != null) + m_SkinnedMesh->StartAsyncUpdateSkin(dt); +} + +//---------------------------------------------------------------------------- + +bool CSkinnedMeshInstance::WaitAsyncUpdateSkin() +{ + if (m_SkinnedMesh != null) + return m_SkinnedMesh->WaitAsyncUpdateSkin(); + return true; +} + +//---------------------------------------------------------------------------- + +void CSkinnedMeshInstance::ClearSkinnedMesh() +{ + m_SkeletonAnimationInstance = null; + if (m_SkinnedMesh != null) + m_SkinnedMesh->Reset(); +} + +//---------------------------------------------------------------------------- + +bool CSkinnedMeshInstance::LoadSkinnedMeshIFN(const TResourcePtr &meshResource, u32 samplingChannels, const PSkeletonState &scrSkeletonState) +{ + m_SkeletonAnimationInstance = null; + if (meshResource == null) + { + if (m_SkinnedMesh != null) + m_SkinnedMesh->Reset(); + return true; + } + + if (m_SkinnedMesh == null) + { + m_SkinnedMesh = PK_NEW(CSkinnedMesh); + if (m_SkinnedMesh == null) + return false; + } + + if (!m_SkinnedMesh->Init(meshResource, samplingChannels, scrSkeletonState)) + { + m_SkinnedMesh->Reset(); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CSkinnedMeshInstance::LoadAnimationIFN(HBO::CContext *context, const CString &pksaPath, bool forceReload) +{ + m_SkeletonAnimationInstance = null; + if (m_SkinnedMesh == null || !m_SkinnedMesh->HasGeometry()) + return true; + + if (pksaPath.Empty()) + { + m_SkeletonAnimationInstance = null; + m_CurrentAnimationPath = null; + m_SkinnedMesh->Stop(); + return true; + } + + if (m_SkeletonAnimationInstance == null || m_CurrentAnimationPath != pksaPath) // if not already loaded or different anim + { + m_SkeletonAnimationInstance = CSkeletonAnimationInstance::NewInstance(context, pksaPath, m_SkinnedMesh->SkeletonState().Get(), forceReload); + if (m_SkeletonAnimationInstance == null) + { + CLog::Log(PK_ERROR, "failed loading animation"); + m_SkinnedMesh->Stop(); + return false; + } + + m_CurrentAnimationPath = pksaPath; + } + + // reset playback parameters + m_SkeletonAnimationInstance->SetPlaybackMode(CSkeletonAnimationInstance::Playback_Loop); + m_SkeletonAnimationInstance->SeekTo(0.0f); + m_SkeletonAnimationInstance->SetSpeed(1.0f); + m_SkinnedMesh->Play(m_SkeletonAnimationInstance); + return true; +} + +//---------------------------------------------------------------------------- + +bool CSkinnedMeshInstance::SetupAttributeSampler(CMeshNew *srcMesh, bool weightedSampling, u32 weightedSamplingColorStreamId, u32 weightedSamplingChannelId) +{ + PK_ASSERT(m_SkinnedMesh != null); + CShapeDescriptor_Mesh *shapeDescMesh = PK_NEW(CShapeDescriptor_Mesh); + if (!PK_VERIFY(shapeDescMesh != null)) + return false; + + SSamplerSourceOverride *samplerSourceOverride = null; + const u32 samplingSubMeshId = 0; + if (samplingSubMeshId < m_SkinnedMesh->SubMeshCount()) + samplerSourceOverride = m_SkinnedMesh->SamplerSourceOverride(samplingSubMeshId); + shapeDescMesh->SetMesh(srcMesh, samplerSourceOverride); + + shapeDescMesh->SetScale(m_CurMeshTransformScaled.ScalingFactors()); + + if (weightedSampling) + { + if (m_SurfaceSamplingStruct == null) + m_SurfaceSamplingStruct = PK_NEW(CMeshSurfaceSamplerStructuresRandom); + if (m_SurfaceSamplingStruct != null) + srcMesh->SetupSurfaceSamplingAccelStructs(weightedSamplingColorStreamId, weightedSamplingChannelId, *m_SurfaceSamplingStruct); + + if (m_VolumeSamplingStruct == null) + m_VolumeSamplingStruct = PK_NEW(CMeshVolumeSamplerStructuresRandom); + if (m_VolumeSamplingStruct != null) + srcMesh->SetupVolumeSamplingAccelStructs(*m_VolumeSamplingStruct); + + shapeDescMesh->SetSamplingStructs(m_SurfaceSamplingStruct, m_VolumeSamplingStruct); + } + + PParticleSamplerDescriptor_Shape_Default desc = PK_NEW(CParticleSamplerDescriptor_Shape_Default(shapeDescMesh)); + if (!PK_VERIFY(desc != null)) + { + PK_DELETE(shapeDescMesh); + return false; + } + desc->m_Angular_Velocity = &CFloat3::ZERO; + desc->m_Linear_Velocity = &CFloat3::ZERO; + desc->m_WorldTr_Current = &m_CurMeshTransform; + desc->m_WorldTr_Previous = &m_PrevMeshTransform; + m_ShapeDescOverride = desc; + return true; + +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_System.cpp b/AE_GeneralPlugin/Sources/AEGP_System.cpp new file mode 100644 index 00000000..5c3291c4 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_System.cpp @@ -0,0 +1,276 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- + +#include "ae_precompiled.h" +#include "AEGP_System.h" +#include "AEGP_Define.h" + +#if defined(PK_WINDOWS) +#include "AEGP_WinSystem.h" +#endif + +#include "pk_toolkit/include/pk_toolkit_process.h" + +#if defined(PK_WINDOWS) +# include + +#elif defined(PK_LINUX) || defined(PK_MACOSX) +# include +# include +# include +#endif + +#if defined(PK_LINUX) +# include +#elif defined(PK_MACOSX) +# include +#endif + +#include "AEGP_Log.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- +// HardwareID +//---------------------------------------------------------------------------- + +u16 CSystemHelper::_GetMacHash() +{ + u16 hash = 0; + + //for (const QNetworkInterface &interface : QNetworkInterface::allInterfaces()) + //{ + // if (interface.isValid() && !interface.flags().testFlag(QNetworkInterface::IsLoopBack)) + // { + // const QStringList macAddr = interface.hardwareAddress().split(":"); + // + // for (int i = 0; i < macAddr.length(); ++i) + // hash += (macAddr[i].toInt() << ((i & 1) * 8)); + // } + //} + + return hash; +} + +//---------------------------------------------------------------------------- + +#if defined(PK_LINUX) +static void _getCpuid(u32 *p, u32 ax) +{ + __asm __volatile + ("movl %%ebx, %%esi\n\t" + "cpuid\n\t" + "xchgl %%ebx, %%esi" + : "=a" (p[0]), "=S" (p[1]), + "=c" (p[2]), "=d" (p[3]) + : "0" (ax) + ); +} +#endif + +//---------------------------------------------------------------------------- + +u16 CSystemHelper::_GetCPUHash() +{ + u16 hash = 0; + +#if defined(PK_WINDOWS) + int cpuinfo[4] = { 0, 0, 0, 0 }; + + __cpuid(cpuinfo, 0); + + u16 *ptr = (u16*)(&cpuinfo[0]); + for (u32 i = 0; i < 8; i++) + hash += ptr[i]; + +#elif defined(PK_LINUX) + + u32 cpuinfo[4] = { 0, 0, 0, 0 }; + + _getCpuid(cpuinfo, 0); + + u32 *ptr = (&cpuinfo[0]); + + for (u32 i = 0; i < 4; i++) + hash += (ptr[i] & 0xFFFF) + (ptr[i] >> 16); + +#elif defined(PK_MACOSX) + + const NXArchInfo *info = NXGetLocalArchInfo(); + + hash += u16(info->cputype); + hash += u16(info->cpusubtype); + +#else + PK_ASSERT_NOT_REACHED(); +#endif + + return hash; +} + +//---------------------------------------------------------------------------- + +const char *CSystemHelper::_GetMachineName() +{ +#if defined(PK_WINDOWS) + static char computerName[1024]; + DWORD size = 1024; + + GetComputerName(computerName, &size); + + return computerName; + +#elif defined(PK_LINUX) || defined(PK_MACOSX) + static struct utsname u; + + if (uname(&u) < 0) + return "unknown"; + + return u.nodename; +#else + PK_ASSERT_NOT_REACHED(); +#endif +} + +//---------------------------------------------------------------------------- + +static const u16 kSmearMask[3] = { 0x4e25, 0xf4a1, 0x5437 }; + +//---------------------------------------------------------------------------- + +void CSystemHelper::_Smear(u16 *id) +{ + for (u32 i = 0; i < 3; i++) + { + for (u32 j = i; j < 3; j++) + { + if (i != j) + id[i] ^= id[j]; + } + } + + for (u32 i = 0; i < 3; i++) + id[i] ^= kSmearMask[i]; +} + +//---------------------------------------------------------------------------- + +void CSystemHelper::_Unsmear(u16 *id) +{ + for (u32 i = 0; i < 3; i++) + id[i] ^= kSmearMask[i]; + + for (u32 i = 0; i < 3; i++) + { + for (u32 j = 0; j < i; j++) + { + if (i != j) + id[2 - i] ^= id[2 - j]; + } + } +} + +//---------------------------------------------------------------------------- + +u16 *CSystemHelper::_ComputeSystemUniqueId() +{ + static u16 id[3]; + static bool computed = false; + + if (!computed) + { + id[0] = _GetCPUHash(); + id[2] = _GetMacHash(); + id[1] = id[0] + id[2]; + + _Smear(id); + + computed = true; + } + + return id; +} + +//---------------------------------------------------------------------------- + +const CString CSystemHelper::GetUniqueHardwareID() +{ + CString hId; + + u16 *id = _ComputeSystemUniqueId(); + for (u32 i = 0; i < 3; i++) + hId += CString::Format("%04x", id[i]); + + return hId.ToUppercase(); +} + +//---------------------------------------------------------------------------- + +const CString CSystemHelper::GetUniqueHardwareIDForHuman() +{ + CString hId = _GetMachineName(); + + u16 *id = _ComputeSystemUniqueId(); + for (u32 i = 0; i < 3; i++) + hId += CString::Format("-%04x", id[i]); + + return hId.ToUppercase(); +} + +bool CSystemHelper::LaunchEditorAsPopup() +{ + SEngineVersion version{ PK_VERSION_MAJOR, PK_VERSION_MINOR, PK_VERSION_PATCH, PK_VERSION_REVID }; +#if defined(PK_WINDOWS) + SEditorExecutable application = CWinSystemHelper::GetMatchingEditor(version); +#else + SEditorExecutable application; +#endif + if (application.m_BinaryPath.Empty()) + { + return CAELog::TryLogErrorWindows("No installed versions of the PopcornFX editor were found\nPlease visit: https://auth.popcornfx.com/ws/latest?channel=pkfx-stable&v=2 and download the latest PopcornFX editor"); + } + + CProcess process; + + TArray commandline; + + if (!commandline.PushBack("--aeass").Valid()) + return false; + if (!commandline.PushBack("toto").Valid()) + return false; + if (!process.Start(application.m_BinaryPath, commandline, true)) + { + return CAELog::TryLogErrorWindows("No installed versions of the PopcornFX editor were found\nPlease visit: https://auth.popcornfx.com/ws/latest?channel=pkfx-stable&v=2 and download the latest PopcornFX editor"); + } + CString output; + +#if defined(PK_WINDOWS) + TArray errorIgnoreList; + errorIgnoreList.PushBack(ERROR_NO_MORE_FILES); +#endif + + process.WaitForExit(); + + output = process.GetProcessStandardOutput(); + if (output != null && !output.Empty()) + { + CLog::Log(PK_INFO, "%s", output.Data()); + output.Clear(); + } + else + { +#if defined(PK_WINDOWS) + CString errorstr = CWinSystemHelper::GetLastErrorAsString(errorIgnoreList); + if (!errorstr.Empty()) + { + CLog::Log(PK_INFO, "%s", errorstr.Data()); + return false; + } +#endif + } + return true; +} + +//---------------------------------------------------------------------------- +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_UpdateAEState.cpp b/AE_GeneralPlugin/Sources/AEGP_UpdateAEState.cpp new file mode 100644 index 00000000..392d0dac --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_UpdateAEState.cpp @@ -0,0 +1,1233 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_UpdateAEState.h" + +#include "AEGP_World.h" +#include "AEGP_LayerHolder.h" +#include "AEGP_AEPKConversion.h" + +#include + +#include + +__AEGP_PK_BEGIN + + +int CAEUpdater::s_AttributeIndexes[__Attribute_Parameters_Count]; +int CAEUpdater::s_EmitterIndexes[__Effect_Parameters_Count]; +int CAEUpdater::s_SamplerIndexes[__AttributeSamplerType_Parameters_Count]; + +//---------------------------------------------------------------------------- + +CAEUpdater::CAEUpdater() +{ +} + +//---------------------------------------------------------------------------- + +CAEUpdater::~CAEUpdater() +{ +} + +//---------------------------------------------------------------------------- + +A_Err CAEUpdater::UpdateLayerAtTime(SLayerHolder *targetLayer, float time, bool isSeeking /*=false*/) +{ + s32 targetTime = (s32)(time * (float)targetLayer->m_TimeScale); + s32 toEndOfFrame = targetTime % targetLayer->m_TimeStep; + A_Time AETime; + + if (targetTime < 0) + AETime.value = 0; + else if ((u32)toEndOfFrame > (targetLayer->m_TimeStep / 2)) + AETime.value = targetTime + (targetLayer->m_TimeStep - toEndOfFrame); // Round to next frame + else + AETime.value = targetTime - toEndOfFrame; // Round to previous frame + AETime.scale = targetLayer->m_TimeScale; + return _UpdateLayerAtTime(targetLayer, AETime, isSeeking); +} + +//---------------------------------------------------------------------------- + +A_Err CAEUpdater::_UpdateLayerAtTime(SLayerHolder *targetLayer, A_Time &AETime, bool isSeeking /*=false*/) +{ + PK_ASSERT(targetLayer != null); + + PK_SCOPEDPROFILE(); + + A_Err frameAborted = A_Err_NONE; + CFloat4x4 viewMatrix; + CFloat4 cameraPos; + CPopcornFXWorld &PKFXWorld = CPopcornFXWorld::Instance(); + AEGP_SuiteHandler suites(PKFXWorld.GetAESuites()); + + float cameraZoom = 0.f; + GetCameraViewMatrixAtTime(targetLayer, viewMatrix, cameraPos, AETime, cameraZoom); + targetLayer->m_Scene->SetCameraViewMatrix(viewMatrix, cameraPos, cameraZoom); + + A_long effectCount = 0; + + frameAborted |= suites.EffectSuite4()->AEGP_GetLayerNumEffects(targetLayer->m_EffectLayer, &effectCount); + + for (A_long j = effectCount - 1; j >= 0; --j) + { + AEGP_EffectRefH effectRef = null; + AEGP_InstalledEffectKey installedKey; + + frameAborted |= suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(PKFXWorld.GetPluginID(), targetLayer->m_EffectLayer, j, &effectRef); + frameAborted |= suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(effectRef, &installedKey); + + if (installedKey == PKFXWorld.GetPluginEffectKey(EPKChildPlugins::EMITTER)) + { + frameAborted |= _UpdateEmitterAtTime(targetLayer, effectRef, AETime, isSeeking); + if (frameAborted != A_Err_NONE) + return frameAborted; + } + else if (installedKey == PKFXWorld.GetPluginEffectKey(EPKChildPlugins::ATTRIBUTE)) + { + CStringId id = PKFXWorld.GetAttributeID(effectRef); + if (targetLayer->m_SpawnedAttributes.Contains(id)) + { + SPendingAttribute *attribute = targetLayer->m_SpawnedAttributes[id]; + + PK_ASSERT(attribute != null); + frameAborted |= _UpdateAttributeAtTime(targetLayer, attribute, effectRef, AETime, isSeeking); + if (frameAborted != A_Err_NONE) + return frameAborted; + } + } + else if (installedKey == PKFXWorld.GetPluginEffectKey(EPKChildPlugins::SAMPLER)) + { + CStringId id = PKFXWorld.GetAttributeSamplerID(effectRef); + if (targetLayer->m_SpawnedAttributesSampler.Contains(id)) + { + SPendingAttribute *smplr = targetLayer->m_SpawnedAttributesSampler[id]; + + PK_ASSERT(smplr != null); + PK_ASSERT(smplr->m_Desc != null); + + SAttributeSamplerDesc *samplerDescriptor = static_cast(smplr->m_Desc); + + if (smplr->m_PKDesc == null) + { + switch (samplerDescriptor->m_Type) + { + case AttributeSamplerType_Geometry: + smplr->m_PKDesc = PK_NEW(SSamplerShape); + break; + case AttributeSamplerType_Text: + smplr->m_PKDesc = PK_NEW(SSamplerText); + break; + case AttributeSamplerType_Image: + smplr->m_PKDesc = PK_NEW(SSamplerImage); + break; + case AttributeSamplerType_Audio: + { + SSamplerAudio *sampler = PK_NEW(SSamplerAudio); + smplr->m_PKDesc = sampler; + sampler->m_Name = CStringId(((SAudioSamplerDescriptor*)samplerDescriptor->m_Descriptor)->m_ChannelGroup.c_str()); + break; + } + case AttributeSamplerType_VectorField: + smplr->m_PKDesc = PK_NEW(SSamplerVectorField); + break; + default: + break; + } + } + PK_ASSERT(smplr->m_PKDesc != null); + frameAborted |= _UpdateSamplerAtTime(targetLayer, smplr, effectRef, AETime, isSeeking); + if (frameAborted != A_Err_NONE) + return frameAborted; + } + } + frameAborted |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + if (!PK_VERIFY(frameAborted == A_Err_NONE)) + return frameAborted; + if (!targetLayer->m_Scene->UpdateAttributes(targetLayer)) + return A_Err_GENERIC; + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +bool CAEUpdater::GetCameraViewMatrixAtTime(SLayerHolder *layer, CFloat4x4 &view, CFloat4 &pos, A_Time &AETime, float &cameraZoom) +{ + PK_SCOPEDPROFILE(); + + CPopcornFXWorld &PKFXWorld = CPopcornFXWorld::Instance(); + AEGP_SuiteHandler suites(PKFXWorld.GetAESuites()); + AEGP_LayerH camera_layerH = null; + A_Matrix4 matrix; + PF_Err result = A_Err_NONE; + CFloat4x4 viewMatrix = CFloat4x4::IDENTITY; + SEmitterDesc *emitter = layer->m_SpawnedEmitter.m_Desc; + + camera_layerH = layer->m_CameraLayer; + if (!result && camera_layerH) + { + result |= suites.LayerSuite5()->AEGP_GetLayerToWorldXform(camera_layerH, &AETime, &matrix); + if (!result) + { + emitter->m_Camera.m_AECameraPresent = true; + AEGP_StreamVal stream_val; + AEFX_CLR_STRUCT(stream_val); + + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(camera_layerH, + AEGP_LayerStream_ZOOM, + AEGP_LTimeMode_CompTime, + &AETime, + FALSE, + &stream_val, + null); + cameraZoom = (float)stream_val.one_d; + AAEToPK(matrix, viewMatrix); + + pos = viewMatrix.WAxis(); +#if defined(PK_SCALE_DOWN) + pos.xyz() = pos.xyz() / layer->m_ScaleFactor; + viewMatrix.WAxis() = pos; +#endif + viewMatrix.Invert(); + view = viewMatrix; + } + } + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CAEUpdater::_SetupAudioSampler(SLayerHolder *targetLayer, AEGP_LayerIDVal layerID, A_Time &AETime, SSamplerAudio *samplerAudio, bool isSeeking) +{ + (void)isSeeking; + CPopcornFXWorld &PKFXWorld = CPopcornFXWorld::Instance(); + AEGP_SuiteHandler suites(PKFXWorld.GetAESuites()); + A_Err frameAborted = A_Err_NONE; + + if (layerID != AEGP_LayerIDVal_NONE) + { + AEGP_LayerH layer; + AEGP_CompH compH; + AEGP_ItemH layerItem = null; + AEGP_SoundDataFormat soundFormat; + AEGP_SoundDataH soundData = null; + A_Time duration; + A_Time layerTime; + + frameAborted |= suites.LayerSuite5()->AEGP_GetLayerParentComp(targetLayer->m_EffectLayer, &compH); + frameAborted |= suites.LayerSuite7()->AEGP_GetLayerFromLayerID(compH, layerID, &layer); + frameAborted |= suites.LayerSuite5()->AEGP_GetLayerSourceItem(layer, &layerItem); + frameAborted |= suites.LayerSuite5()->AEGP_ConvertCompToLayerTime(layer, &AETime, &layerTime); + + if (layerItem == null) + return false; + + soundFormat.encoding = AEGP_SoundEncoding_FLOAT; + soundFormat.num_channelsL = 1; + soundFormat.sample_rateF = 48000.0; + + // We compute the expected timestep to get 2048 values (We are using 2x the number of samples in the PopcornFX editor to get proper spectrum analysis): + A_FpLong secondsToSample = 2048.0 / soundFormat.sample_rateF; + + duration.value = static_cast(secondsToSample * static_cast(targetLayer->m_TimeScale)) + 1; + duration.scale = targetLayer->m_TimeScale; + frameAborted |= suites.RenderSuite5()->AEGP_RenderNewItemSoundData(layerItem, &layerTime, &duration, &soundFormat, null, null, &soundData); + + if (soundData != null) + { + void *audioSamples; + A_long numSamples = 0; + + frameAborted |= suites.SoundDataSuite1()->AEGP_LockSoundDataSamples(soundData, &audioSamples); + frameAborted |= suites.SoundDataSuite1()->AEGP_GetNumSamples(soundData, &numSamples); + + if (!PK_VERIFY(frameAborted == A_Err_NONE)) + { + frameAborted |= suites.SoundDataSuite1()->AEGP_UnlockSoundDataSamples(soundData); + frameAborted |= suites.SoundDataSuite1()->AEGP_DisposeSoundData(soundData); + } + else + { + samplerAudio->m_SoundData = soundData; + // Align to the previous power of 2: + const int alignedSampleCount = 1 << IntegerTools::Log2(numSamples); + samplerAudio->m_InputSampleCount = alignedSampleCount; + samplerAudio->m_Waveform = (float*)audioSamples; + samplerAudio->m_Dirty = true; + return true; + } + } + } + samplerAudio->m_SoundData = null; + samplerAudio->m_InputSampleCount = 0; + samplerAudio->m_Waveform = null; + return false; +} + +//---------------------------------------------------------------------------- + +A_Err CAEUpdater::_UpdateSamplerAtTime(SLayerHolder *targetLayer, SPendingAttribute *sampler, AEGP_EffectRefH effectRef, A_Time &AETime, bool isSeeking /*=false*/) +{ + if (sampler == null || sampler->m_Desc == null) + return A_Err_NONE; + PK_SCOPEDPROFILE(); + A_Err frameAborted = A_Err_NONE; + CPopcornFXWorld &PKFXWorld = CPopcornFXWorld::Instance(); + AEGP_SuiteHandler suites(PKFXWorld.GetAESuites()); + SAttributeSamplerDesc *samplerDescriptor = static_cast(sampler->m_Desc); + SBaseSamplerDescriptor *AEdescriptor = samplerDescriptor->m_Descriptor; + SSamplerBase *PKdescriptor = sampler->m_PKDesc; + + if (!PK_VERIFY(AEdescriptor != null)) + return A_Err_GENERIC; + + switch (samplerDescriptor->m_Type) + { + case AttributeSamplerType_Geometry: + { + SShapeSamplerDescriptor *shapeDescriptor = static_cast(AEdescriptor); + ESamplerShapeType shapeType; + double value; + double dimension[3] = { 0.0, 0.0, 0.0 }; + + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Shapes, effectRef, AETime, value); + shapeType = (ESamplerShapeType)(int)(value - 1); // Because AE Popup are weird. + + if (shapeType == SamplerShapeType_Box) + { + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Box_Size_X, effectRef, AETime, dimension[0]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Box_Size_Y, effectRef, AETime, dimension[1]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Box_Size_Z, effectRef, AETime, dimension[2]); + } + else if (shapeType == SamplerShapeType_Sphere) + { + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Sphere_Radius, effectRef, AETime, dimension[0]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Sphere_InnerRadius, effectRef, AETime, dimension[1]); + } + else if (shapeType == SamplerShapeType_Ellipsoid) + { + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Ellipsoid_Radius, effectRef, AETime, dimension[0]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Ellipsoid_InnerRadius, effectRef, AETime, dimension[1]); + } + else if (shapeType == SamplerShapeType_Cylinder) + { + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Cylinder_Radius, effectRef, AETime, dimension[0]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Cylinder_Height, effectRef, AETime, dimension[1]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Cylinder_InnerRadius, effectRef, AETime, dimension[2]); + } + else if (shapeType == SamplerShapeType_Capsule) + { + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Capsule_Radius, effectRef, AETime, dimension[0]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Capsule_Height, effectRef, AETime, dimension[1]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Capsule_InnerRadius, effectRef, AETime, dimension[2]); + } + else if (shapeType == SamplerShapeType_Cone) + { + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Cone_Radius, effectRef, AETime, dimension[0]); + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Cone_Height, effectRef, AETime, dimension[1]); + } + else if (shapeType == SamplerShapeType_Mesh) + { + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Mesh_Scale, effectRef, AETime, dimension[0]); + } + shapeDescriptor->m_Type = shapeType; + shapeDescriptor->m_Dimension[0] = (float)dimension[0]; + shapeDescriptor->m_Dimension[1] = (float)dimension[1]; + shapeDescriptor->m_Dimension[2] = (float)dimension[2]; + if (shapeType == SamplerShapeType_Mesh) + { + if (shapeDescriptor->m_Path.compare(samplerDescriptor->m_ResourcePath)) + { + shapeDescriptor->m_Path = samplerDescriptor->m_ResourcePath; + PKdescriptor->m_Dirty = true; + } + + double doubleValue; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Mesh_Bind_Backdrop, effectRef, AETime, doubleValue); + shapeDescriptor->m_BindToBackdrop = (bool)doubleValue; + if (shapeDescriptor->m_BindToBackdrop) + { + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_Weighted_Enabled, effectRef, AETime, doubleValue); + shapeDescriptor->m_WeightedSampling = (bool)doubleValue; + + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_ColorStreamID, effectRef, AETime, doubleValue); + shapeDescriptor->m_ColorStreamID = (unsigned int)doubleValue; + + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_WeightStreamID, effectRef, AETime, doubleValue); + shapeDescriptor->m_WeightStreamID = (unsigned int)doubleValue; + } + targetLayer->m_Scene->SetSkinnedBackdropParams(shapeDescriptor->m_BindToBackdrop, shapeDescriptor->m_WeightedSampling, shapeDescriptor->m_ColorStreamID, shapeDescriptor->m_WeightStreamID); + + } + else + PKdescriptor->m_Dirty = true; + break; + } + case AttributeSamplerType_Text: + { + STextSamplerDescriptor *textDesc = static_cast(AEdescriptor); + + AEGP_LayerIDVal layerID; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Layer_Pick, effectRef, AETime, layerID); + + if (layerID != AEGP_LayerIDVal_NONE) + { + AEGP_LayerH textLayer; + AEGP_CompH compH; + + frameAborted |= suites.LayerSuite5()->AEGP_GetLayerParentComp(targetLayer->m_EffectLayer, &compH); + frameAborted |= suites.LayerSuite7()->AEGP_GetLayerFromLayerID(compH, layerID, &textLayer); + + AEGP_StreamValue2 streamValue; + AEGP_StreamType streamType; + AEGP_ObjectType layerType; + AEGP_StreamRefH textStream = null; + + frameAborted |= suites.LayerSuite8()->AEGP_GetLayerObjectType(textLayer, &layerType); + if (!PK_VERIFY(frameAborted == A_Err_NONE) || layerType != AEGP_ObjectType_TEXT) + break; + + frameAborted |= suites.StreamSuite5()->AEGP_GetNewLayerStream(PKFXWorld.GetPluginID(), textLayer, AEGP_LayerStream_SOURCE_TEXT, &textStream); + frameAborted |= suites.StreamSuite5()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), textStream, AEGP_LTimeMode_LayerTime, &AETime, TRUE, &streamValue); + frameAborted |= suites.StreamSuite2()->AEGP_GetStreamType(textStream, &streamType); + if (!PK_VERIFY(frameAborted == A_Err_NONE) || streamType != AEGP_StreamType_TEXT_DOCUMENT) + break; + + AEGP_MemHandle textHandle = null; + frameAborted |= suites.TextDocumentSuite1()->AEGP_GetNewText(PKFXWorld.GetPluginID(), streamValue.val.text_documentH, &textHandle); + + aechar_t *retrievedText; + CString text = ""; + + if (textHandle != null) + { + frameAborted |= suites.MemorySuite1()->AEGP_LockMemHandle(textHandle, reinterpret_cast(&retrievedText)); + + WCharToCString(retrievedText, &text); + + frameAborted |= suites.MemorySuite1()->AEGP_UnlockMemHandle(textHandle); + frameAborted |= suites.MemorySuite1()->AEGP_FreeMemHandle(textHandle); + + textDesc->m_Data = text.Data(); + PKdescriptor->m_Dirty = true; + } + frameAborted |= suites.StreamSuite5()->AEGP_DisposeStreamValue(&streamValue); + frameAborted |= suites.StreamSuite5()->AEGP_DisposeStream(textStream); + } + else + textDesc->m_Data = ""; + break; + } + case AttributeSamplerType_Image: + { + SSamplerImage *pkImageDesc = static_cast(PKdescriptor); + + if (!PK_VERIFY(pkImageDesc != null)) + break; + + double boolValue; + bool sampleOnSeek = false, sampleOnce = false; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Layer_Sample_Once, effectRef, AETime, boolValue); + sampleOnce = (bool)boolValue; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Layer_Sample_Seeking, effectRef, AETime, boolValue); + sampleOnSeek = (bool)boolValue; + + double intValue; + int downSampleX; + int downSampleY; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Layer_Sample_Downsampling_X, effectRef, AETime, intValue); + downSampleX = (int)intValue; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Layer_Sample_Downsampling_Y, effectRef, AETime, intValue); + downSampleY = (int)intValue; + + if ((!sampleOnSeek && isSeeking) || + (sampleOnce && pkImageDesc->m_TextureData != null && pkImageDesc->m_TextureData->DataSizeInBytes() != 0)) + { + pkImageDesc->m_Dirty = false; + break; + } + + AEGP_LayerIDVal layerID; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Layer_Pick, effectRef, AETime, layerID); + + if (layerID != AEGP_LayerIDVal_NONE) + { + AEGP_LayerH imageLayer; + AEGP_CompH compH; + AEGP_LayerRenderOptionsH renderOptions = null; + AEGP_WorldType worldType = AEGP_WorldType_NONE; + AEGP_FrameReceiptH inputFrame = null; + AEGP_WorldH inputworld = null; + A_Time layerDuration, layerInPoint; + + frameAborted |= suites.LayerSuite5()->AEGP_GetLayerParentComp(targetLayer->m_EffectLayer, &compH); + frameAborted |= suites.LayerSuite7()->AEGP_GetLayerFromLayerID(compH, layerID, &imageLayer); + + frameAborted |= suites.LayerSuite8()->AEGP_GetLayerInPoint(imageLayer, AEGP_LTimeMode_CompTime, &layerInPoint); + frameAborted |= suites.LayerSuite8()->AEGP_GetLayerDuration(imageLayer, AEGP_LTimeMode_CompTime, &layerDuration); + + if (!PK_VERIFY(frameAborted == A_Err_NONE)) + return frameAborted; + + double aeTime = (double)AETime.value / (double)AETime.scale; + double layInPtTime = (double)layerInPoint.value / (double)layerInPoint.scale; + double layDurTime = (double)layerDuration.value / (double)layerDuration.scale; + + if ((aeTime >= layInPtTime) && + (aeTime < (layInPtTime + layDurTime))) + { + A_Time layerTime; + + layerTime.scale = AETime.scale; + layerTime.value = AETime.value - layerInPoint.value; + frameAborted |= suites.LayerRenderOptionsSuite2()->AEGP_NewFromLayer(PKFXWorld.GetPluginID(), imageLayer, &renderOptions); + frameAborted |= suites.LayerRenderOptionsSuite2()->AEGP_GetWorldType(renderOptions, &worldType); + + frameAborted |= suites.LayerRenderOptionsSuite2()->AEGP_SetTime(renderOptions, layerTime); + + frameAborted |= suites.LayerRenderOptionsSuite2()->AEGP_SetDownsampleFactor(renderOptions, (A_short)downSampleX, (A_short)downSampleY); + + if (frameAborted != A_Err_NONE) + return frameAborted; + + // This fails if the frame is cancelled: + frameAborted |= suites.RenderSuite5()->AEGP_RenderAndCheckoutLayerFrame(renderOptions, null, null, &inputFrame); + + if (frameAborted != A_Err_NONE) + return frameAborted; + + frameAborted |= suites.RenderSuite5()->AEGP_GetReceiptWorld(inputFrame, &inputworld); + if (inputworld != null) + { + A_long width, height; + A_u_long rowbyte; + + frameAborted |= suites.WorldSuite3()->AEGP_GetSize(inputworld, &width, &height); + frameAborted |= suites.WorldSuite3()->AEGP_GetRowBytes(inputworld, &rowbyte); + + if (worldType == AEGP_WorldType_32) + { + PF_Pixel32 *worldData = null; + + pkImageDesc->m_PixelFormat = CImage::EFormat::Format_Fp32RGBA; + pkImageDesc->m_Width = width; + pkImageDesc->m_Height = height; + pkImageDesc->m_SizeInBytes = width * height * sizeof(PF_Pixel32); + pkImageDesc->m_TextureData = CRefCountedMemoryBuffer::AllocAligned(pkImageDesc->m_SizeInBytes, 0x10); + + frameAborted |= suites.WorldSuite3()->AEGP_GetBaseAddr32(inputworld, &worldData); + + if (worldData != null) + { + //input is ARGB; + u8 *sptr = (u8*)worldData; + u8 *dptr = (u8*)pkImageDesc->m_TextureData->Data(); + + for (s32 i = 0; i < height; ++i) + { + for (s32 j = 0; j < width; ++j) + { + PF_Pixel32 *dst = (PF_Pixel32*)&(dptr[j * sizeof(PF_Pixel32) + i * width * sizeof(PF_Pixel32)]); + PF_Pixel32 *src = (PF_Pixel32*)&(sptr[j * sizeof(PF_Pixel32) + i * rowbyte]); + + CFloat4 value = CFloat4(PKSample::ConvertSRGBToLinear(CFloat3(src->red, src->green, src->blue)), src->alpha); + + value = PKSaturate(value); + + /*0*/dst->alpha = value.x(); + /*1*/dst->red = value.y(); + /*2*/dst->green = value.z(); + /*3*/dst->blue = value.w(); + } + } + } + } + else if (worldType == AEGP_WorldType_16) + { + PF_Pixel16 *worldData = null; + + pkImageDesc->m_PixelFormat = CImage::EFormat::Format_Fp16RGBA; + pkImageDesc->m_Width = width; + pkImageDesc->m_Height = height; + pkImageDesc->m_SizeInBytes = width * height * sizeof(PF_Pixel16); + pkImageDesc->m_TextureData = CRefCountedMemoryBuffer::AllocAligned(pkImageDesc->m_SizeInBytes, 0x10); + + frameAborted |= suites.WorldSuite3()->AEGP_GetBaseAddr16(inputworld, &worldData); + + if (worldData != null) + { + //input is ARGB; + u8 *sptr = (u8*)worldData; + u8 *dptr = (u8*)pkImageDesc->m_TextureData->Data(); + + for (s32 i = 0; i < height; ++i) + { + for (s32 j = 0; j < width; ++j) + { + PF_Pixel16 *dst = (PF_Pixel16*)&(dptr[j * sizeof(PF_Pixel16) + i * width * sizeof(PF_Pixel16)]); + PF_Pixel16 *src = (PF_Pixel16*)&(sptr[j * sizeof(PF_Pixel16) + i * rowbyte]); + + CFloat4 value = CFloat4(PKSample::ConvertSRGBToLinear(CFloat3(src->red, src->green, src->blue)), src->alpha); + + value = PKSaturate(value); + /*0*/dst->alpha = (A_u_short)value.x(); + /*1*/dst->red = (A_u_short)value.y(); + /*2*/dst->green = (A_u_short)value.z(); + /*3*/dst->blue = (A_u_short)value.w(); + } + } + } + } + else if (worldType == AEGP_WorldType_8) + { + PF_Pixel8 *worldData = null; + + pkImageDesc->m_PixelFormat = CImage::EFormat::Format_BGRA8; + pkImageDesc->m_Width = width; + pkImageDesc->m_Height = height; + pkImageDesc->m_SizeInBytes = width * height * sizeof(PF_Pixel8); + pkImageDesc->m_TextureData = CRefCountedMemoryBuffer::AllocAligned(pkImageDesc->m_SizeInBytes, 0x10); + + frameAborted |= suites.WorldSuite3()->AEGP_GetBaseAddr8(inputworld, &worldData); + + if (worldData != null) + { + //input is ARGB; + u8 *sptr = (u8*)worldData; + u8 *dptr = (u8*)pkImageDesc->m_TextureData->Data(); + + for (s32 i = 0; i < height; ++i) + { + for (s32 j = 0; j < width; ++j) + { + PF_Pixel8 *dst = (PF_Pixel8*)&(dptr[j * sizeof(PF_Pixel8) + i * width * sizeof(PF_Pixel8)]); + PF_Pixel8 *src = (PF_Pixel8*)&(sptr[j * sizeof(PF_Pixel8) + i * rowbyte]); + + CUbyte4 value = CUbyte4(/*PKSample::ConvertSRGBToLinear*/(CUbyte3(src->blue, src->green, src->red)), src->alpha); + + value = PKClamp(value, CUbyte4::ZERO, CUbyte4(255)); + /*0*/dst->alpha = value.x(); + /*1*/dst->red = value.y(); + /*2*/dst->green = value.z(); + /*3*/dst->blue = value.w(); + } + } + } + } + } + + frameAborted |= suites.RenderSuite5()->AEGP_CheckinFrame(inputFrame); + frameAborted |= suites.LayerRenderOptionsSuite2()->AEGP_Dispose(renderOptions); + } + else if (pkImageDesc->m_Width != 1 || pkImageDesc->m_Height != 1) + { + pkImageDesc->m_PixelFormat = CImage::EFormat::Format_BGRA8; + pkImageDesc->m_Width = 1; + pkImageDesc->m_Height = 1; + pkImageDesc->m_SizeInBytes = sizeof(PF_Pixel8); + pkImageDesc->m_TextureData = CRefCountedMemoryBuffer::AllocAligned(pkImageDesc->m_SizeInBytes, 0x10); + + u8 *dptr = (u8*)pkImageDesc->m_TextureData->Data(); + PF_Pixel8 *dst = (PF_Pixel8*)&(dptr[0]); + /*0*/dst->alpha = 0; + /*1*/dst->red = 0; + /*2*/dst->green = 0; + /*3*/dst->blue = 0; + } + + if (!PK_VERIFY(frameAborted == A_Err_NONE)) + break; + pkImageDesc->m_Dirty = true; + } + else if (pkImageDesc->m_Width != 1 || pkImageDesc->m_Height != 1) + { + pkImageDesc->m_PixelFormat = CImage::EFormat::Format_BGRA8; + pkImageDesc->m_Width = 1; + pkImageDesc->m_Height = 1; + pkImageDesc->m_SizeInBytes = sizeof(PF_Pixel8); + pkImageDesc->m_TextureData = CRefCountedMemoryBuffer::AllocAligned(pkImageDesc->m_SizeInBytes, 0x10); + + u8 *dptr = (u8*)pkImageDesc->m_TextureData->Data(); + PF_Pixel8 *dst = (PF_Pixel8*)&(dptr[0]); + /*0*/dst->alpha = 0; + /*1*/dst->red = 0; + /*2*/dst->green = 0; + /*3*/dst->blue = 0; + + pkImageDesc->m_Dirty = true; + } + break; + } + case AttributeSamplerType_Audio: + { + SSamplerAudio *pkAudioDesc = static_cast(PKdescriptor); + + if (!PK_VERIFY(pkAudioDesc != null)) + break; + + double value; + bool sampleOnSeek = false; + + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Layer_Sample_Seeking, effectRef, AETime, value); + sampleOnSeek = (bool)value; + + if ((!sampleOnSeek && isSeeking)) + { + pkAudioDesc->m_Dirty = false; + break; + } + AEGP_LayerIDVal layerID; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Layer_Pick, effectRef, AETime, layerID); + _SetupAudioSampler(targetLayer, layerID, AETime, pkAudioDesc, isSeeking); + break; + } + case AttributeSamplerType_VectorField: + { + SVectorFieldSamplerDescriptor *vfDescriptor = static_cast(AEdescriptor); + { + AEGP_StreamRefH streamHandler; + AEGP_StreamValue2 value; + + frameAborted |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, AttributeSamplerType_Parameters_VectorField_Position, &streamHandler); + AEFX_CLR_STRUCT(value); + frameAborted |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + vfDescriptor->m_Position = A_FloatPoint3{ value.val.three_d.x, value.val.three_d.y, value.val.three_d.z }; + frameAborted |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + frameAborted |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + } + double value; + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_VectorField_Strength, effectRef, AETime, value); + vfDescriptor->m_Strength = (float)value; + + frameAborted |= _GetParamsStreamValueAtTime(AttributeSamplerType_Parameters_VectorField_Interpolation, effectRef, AETime, value); + EInterpolationType interpolation = (EInterpolationType)(int)value; + if (vfDescriptor->m_Interpolation != interpolation) + { + vfDescriptor->m_Interpolation = interpolation; + vfDescriptor->m_ResourceUpdate = true; + } + + std::string vectorfieldPath = samplerDescriptor->m_ResourcePath.c_str(); + if (vectorfieldPath != vfDescriptor->m_Path) + vfDescriptor->m_Path = vectorfieldPath; + PKdescriptor->m_Dirty = true; + break; + } + default: + break; + } + return frameAborted; +} + +//---------------------------------------------------------------------------- + +A_Err CAEUpdater::_UpdateAttributeAtTime(SLayerHolder *targetLayer, SPendingAttribute *attribute, AEGP_EffectRefH effectRef, A_Time &AETime, bool isSeeking /*=false*/) +{ + PK_SCOPEDPROFILE(); + (void)targetLayer; + (void)isSeeking; + + A_Err result = A_Err_NONE; + CPopcornFXWorld &PKFXWorld = CPopcornFXWorld::Instance(); + AEGP_SuiteHandler suites(PKFXWorld.GetAESuites()); + + if (attribute->m_Desc && attribute->m_Desc->m_IsAttribute) + { + SAttributeDesc *desc = static_cast(attribute->m_Desc); + if (desc->m_AttributeSemantic == AttributeSemantic_Color) + { + float floatValues[4]; + + AEGP_StreamRefH streamHandler; + AEGP_StreamValue2 value; + + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, Attribute_Parameters_Color_RGB, &streamHandler); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + floatValues[0] = (float)value.val.color.redF; + floatValues[1] = (float)value.val.color.greenF; + floatValues[2] = (float)value.val.color.blueF; + + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + + if (desc->m_Type == AttributeType_Float4 || + desc->m_Type == AttributeType_Int4) + { + double floatValue; + result |= _GetParamsStreamValueAtTime(Attribute_Parameters_Color_A, effectRef, AETime, floatValue); + floatValues[3] = (float)(floatValue / 100.0f); + } + if (desc->m_Type >= AttributeType_Int1 && desc->m_Type <= AttributeType_Int4) + { + for (u32 i = 0; i < 4; ++i) + floatValues[i] *= 255; + } + desc->SetValue(&floatValues); + } + else + { + switch (desc->m_Type) + { + case AttributeType_Bool1: + case AttributeType_Bool2: + case AttributeType_Bool3: + case AttributeType_Bool4: + { + bool boolValues[4]; + for (s32 i = 0; i < (desc->m_Type + 1) - AttributeType_Bool1; ++i) + { + double boolValue; + + result |= _GetParamsStreamValueAtTime(AttributeType_Bool1 + i, effectRef, AETime, boolValue); + boolValues[i] = (bool)boolValue; + } + desc->SetValue(&boolValues); + break; + } + case AttributeType_Int1: + case AttributeType_Int2: + case AttributeType_Int3: + case AttributeType_Int4: + { + int intValues[4]; + for (s32 i = 0; i < (desc->m_Type + 1) - AttributeType_Int1; ++i) + { + double intValue; + + result |= _GetParamsStreamValueAtTime(AttributeType_Int1 + i, effectRef, AETime, intValue); + intValues[i] = (int)intValue; + } + desc->SetValue(&intValues); + break; + } + case AttributeType_Float1: + case AttributeType_Float2: + case AttributeType_Float3: + case AttributeType_Float4: + { + float floatValues[4]; + for (s32 i = 0; i < (desc->m_Type + 1) - AttributeType_Float1; ++i) + { + double floatValue; + + result |= _GetParamsStreamValueAtTime(AttributeType_Float1 + i, effectRef, AETime, floatValue); + floatValues[i] = (float)floatValue; + } + desc->SetValue(&floatValues); + break; + } + default: + break; + } + } + } + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return result; +} + + +//---------------------------------------------------------------------------- + +A_Err CAEUpdater::_UpdateEmitterAtTime(SLayerHolder *layer, AEGP_EffectRefH effectRef, A_Time &AETime, bool isSeeking) +{ + PK_SCOPEDPROFILE(); + (void)isSeeking; + CPopcornFXWorld &PKFXWorld = CPopcornFXWorld::Instance(); + AEGP_SuiteHandler suites(PKFXWorld.GetAESuites()); + A_Err result = A_Err_NONE; + AEGP_StreamRefH streamHandler; + AEGP_StreamValue2 value; + SPendingEmitter &emitter = layer->m_SpawnedEmitter; + + if (!PK_VERIFY(effectRef != null)) + { + return A_Err_GENERIC; + } + { //Emitter + { + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_TransformType], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_TransformType = ((ETransformType)(int)value.val.one_d); + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + + if (emitter.m_Desc->m_TransformType == ETransformType_3D) + { + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Position], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_Position = A_FloatPoint3{ value.val.three_d.x, value.val.three_d.y, value.val.three_d.z }; +#if defined(PK_SCALE_DOWN) + emitter.m_Desc->m_Position.x = emitter.m_Desc->m_Position.x / layer->m_ScaleFactor; + emitter.m_Desc->m_Position.y = emitter.m_Desc->m_Position.y / layer->m_ScaleFactor; + emitter.m_Desc->m_Position.z = emitter.m_Desc->m_Position.z / layer->m_ScaleFactor; +#endif + layer->m_Scene->SetEmitterPosition(AAEToPK(emitter.m_Desc->m_Position), emitter.m_Desc->m_TransformType); + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + } + else if (emitter.m_Desc->m_TransformType == ETransformType_2D) + { + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Position_2D], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + + emitter.m_Desc->m_Position.x = value.val.two_d.x; + emitter.m_Desc->m_Position.y = value.val.two_d.y; + + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Position_2D_Distance], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + + emitter.m_Desc->m_Position.z = value.val.one_d; + layer->m_Scene->SetEmitterPosition(AAEToPK(emitter.m_Desc->m_Position), emitter.m_Desc->m_TransformType); + } + } + { + float rotation[3]; + for (u32 i = 0; i < 3; ++i) + { + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Rotation_X + i], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + rotation[i] = (float)value.val.one_d; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + } + emitter.m_Desc->m_Rotation = A_FloatPoint3{ rotation[0], rotation[1], rotation[2] }; + layer->m_Scene->SetEmitterRotation(AngleAAEToPK(emitter.m_Desc->m_Rotation)); + } + } + + { //Camera + + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Camera], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Camera_Near], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_Camera.m_Near = (float)value.val.one_d; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Camera_Far], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_Camera.m_Far = (float)value.val.one_d; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + } + + //Background Override + { + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Background_Toggle], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_IsAlphaBGOverride = (bool)value.val.one_d; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Background_Opacity], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_AlphaBGOverride = (float)value.val.one_d / 100.0f; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + } + { //BackdropMesh + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_BackdropMesh_Enable_Rendering], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_BackdropMesh.m_EnableRendering = (int)value.val.one_d; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_BackdropMesh_Enable_Collisions], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_BackdropMesh.m_EnableCollisions = (int)value.val.one_d; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_BackdropMesh_Enable_Animation], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_BackdropMesh.m_EnableAnimations = (int)value.val.one_d; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + + if (emitter.m_Desc->m_BackdropMesh.m_EnableCollisions) + { + { + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_BackdropMesh_Position], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_BackdropMesh.m_Position = A_FloatPoint3{ value.val.three_d.x, value.val.three_d.y, value.val.three_d.z }; +#if defined(PK_SCALE_DOWN) + emitter.m_Desc->m_BackdropMesh.m_Position.x = emitter.m_Desc->m_BackdropMesh.m_Position.x / layer->m_ScaleFactor; + emitter.m_Desc->m_BackdropMesh.m_Position.y = emitter.m_Desc->m_BackdropMesh.m_Position.y / layer->m_ScaleFactor; + emitter.m_Desc->m_BackdropMesh.m_Position.z = emitter.m_Desc->m_BackdropMesh.m_Position.z / layer->m_ScaleFactor; +#endif + layer->m_Scene->UpdateBackdropTransform(emitter.m_Desc); + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + } + { + float rotation[3]; + for (u32 i = 0; i < 3; ++i) + { + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_BackdropMesh_Rotation_X + i], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + rotation[i] = DegToRad((float)value.val.one_d); + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + } + emitter.m_Desc->m_BackdropMesh.m_Rotation = A_FloatPoint3{ rotation[0], rotation[1], rotation[2] }; + } + { + float scale[3]; + for (u32 i = 0; i < 3; ++i) + { + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_BackdropMesh_Scale_X + i], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, true, &value); + PK_ASSERT(result == A_Err_NONE); + scale[i] = (float)value.val.one_d; + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + } + emitter.m_Desc->m_BackdropMesh.m_Scale = A_FloatPoint3{ scale[0], scale[1], scale[2] }; + } + } + result |= suites.StreamSuite3()->AEGP_GetNewEffectStreamByIndex(PKFXWorld.GetPluginID(), effectRef, s_EmitterIndexes[Effect_Parameters_Simulation_State], &streamHandler); + PK_ASSERT(result == A_Err_NONE); + AEFX_CLR_STRUCT(value); + result |= suites.StreamSuite3()->AEGP_GetNewStreamValue(PKFXWorld.GetPluginID(), streamHandler, AEGP_LTimeMode_CompTime, &AETime, false, &value); + PK_ASSERT(result == A_Err_NONE); + emitter.m_Desc->m_SimStatePrev = emitter.m_Desc->m_SimState; + emitter.m_Desc->m_SimState = (int)value.val.one_d; + + result |= suites.StreamSuite3()->AEGP_DisposeStreamValue(&value); + PK_ASSERT(result == A_Err_NONE); + result |= suites.StreamSuite3()->AEGP_DisposeStream(streamHandler); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE) + return result; + } + + // Update audio backdrop: + AEGP_LayerIDVal layerID; + CAEUpdater::_GetParamsStreamValueAtTime(s_EmitterIndexes[Effect_Parameters_Audio], effectRef, AETime, layerID); + + if (layer->m_BackdropAudioSpectrum == null) + layer->m_BackdropAudioSpectrum = PK_NEW(SSamplerAudio); + if (layer->m_BackdropAudioWaveform == null) + layer->m_BackdropAudioWaveform = PK_NEW(SSamplerAudio); + + if (!_SetupAudioSampler(layer, layerID, AETime, layer->m_BackdropAudioSpectrum, isSeeking)) + PK_SAFE_DELETE(layer->m_BackdropAudioSpectrum); + if (!_SetupAudioSampler(layer, layerID, AETime, layer->m_BackdropAudioWaveform, isSeeking)) + PK_SAFE_DELETE(layer->m_BackdropAudioWaveform); + if (!PK_VERIFY(result == A_Err_NONE)) + return result; + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +bool CAEUpdater::GetLightsAtTime(SLayerHolder *layer, A_Time &AETime, TArray &lights) +{ + CPopcornFXWorld &PKFXWorld = CPopcornFXWorld::Instance(); + AEGP_SuiteHandler suites(PKFXWorld.GetAESuites()); + A_Err result = A_Err_NONE; + AEGP_CompH compH = null; + AEGP_LayerH layerH = null; + A_long layerNbr = 0; + + A_Boolean layerActive = false; + + result |= suites.LayerSuite5()->AEGP_GetLayerParentComp(layer->m_EffectLayer, &compH); + result |= suites.LayerSuite5()->AEGP_GetCompNumLayers(compH, &layerNbr); + + for (s32 i = 0; i < layerNbr; ++i) + { + AEGP_ObjectType layerType = AEGP_ObjectType_NONE; + + result |= suites.LayerSuite5()->AEGP_GetCompLayerByIndex(compH, i, &layerH); + result |= suites.LayerSuite5()->AEGP_GetLayerObjectType(layerH, &layerType); + + result |= suites.LayerSuite5()->AEGP_IsVideoActive(layerH, AEGP_LTimeMode_CompTime, &AETime, &layerActive); + if (layerType == AEGP_ObjectType_LIGHT && layerActive == (A_Boolean)TRUE) + { + SLightDesc light; + AEGP_LightType type; + AEGP_StreamVal streamValColor, streamValIntensity; + + result |= suites.LightSuite2()->AEGP_GetLightType(layerH, &type); + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_COLOR, AEGP_LTimeMode_CompTime, &AETime, false, &streamValColor, null); + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_INTENSITY, AEGP_LTimeMode_CompTime, &AETime, false, &streamValIntensity, null); + + light.m_Type = type; + light.m_Color.x = streamValColor.color.redF; + light.m_Color.y = streamValColor.color.greenF; + light.m_Color.z = streamValColor.color.blueF; + light.m_Intensity = (float)(streamValIntensity.one_d) / 100.0f; + + if (light.m_Type == AEGP_LightType_PARALLEL) + { + AEGP_StreamVal streamValPos, streamValAnchor; + + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_POSITION, AEGP_LTimeMode_CompTime, &AETime, false, &streamValPos, null); + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_ANCHORPOINT, AEGP_LTimeMode_CompTime, &AETime, false, &streamValAnchor, null); + + CFloat3 direction = { (float)(streamValAnchor.three_d.x - streamValPos.three_d.x), (float)(streamValAnchor.three_d.y - streamValPos.three_d.y), (float)(streamValAnchor.three_d.z - streamValPos.three_d.z) }; + direction.Normalize(); + light.m_Direction = PKToAAE(direction); + } + else if (light.m_Type == AEGP_LightType_SPOT) + { + AEGP_StreamVal streamValPos, streamValAnchor, streamValConeAngle, streamValConeFeather; + + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_POSITION, AEGP_LTimeMode_CompTime, &AETime, false, &streamValPos, null); + CFloat3 position = { (float)(streamValPos.three_d.x), (float)(streamValPos.three_d.y), (float)(streamValPos.three_d.z) }; + light.m_Position = PKToAAE(position); +#if defined(PK_SCALE_DOWN) + light.m_Position.x = light.m_Position.x / layer->m_ScaleFactor; + light.m_Position.y = light.m_Position.y / layer->m_ScaleFactor; + light.m_Position.z = light.m_Position.z / layer->m_ScaleFactor; +#endif + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_ANCHORPOINT, AEGP_LTimeMode_CompTime, &AETime, false, &streamValAnchor, null); + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_CONE_ANGLE, AEGP_LTimeMode_CompTime, &AETime, false, &streamValConeAngle, null); + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_CONE_FEATHER, AEGP_LTimeMode_CompTime, &AETime, false, &streamValConeFeather, null); + + CFloat3 direction = { (float)(streamValAnchor.three_d.x - streamValPos.three_d.x), (float)(streamValAnchor.three_d.y - streamValPos.three_d.y), (float)(streamValAnchor.three_d.z - streamValPos.three_d.z) }; + direction.Normalize(); + light.m_Direction = PKToAAE(direction); + + light.m_Angle = (float)streamValConeAngle.one_d; + light.m_Feather = (float)(streamValConeFeather.one_d / 100.0f); + } + else if (light.m_Type == AEGP_LightType_POINT) + { + AEGP_StreamVal streamValPos; + result |= suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH, AEGP_LayerStream_POSITION, AEGP_LTimeMode_CompTime, &AETime, false, &streamValPos, null); + + CFloat3 position = { (float)(streamValPos.three_d.x), (float)(streamValPos.three_d.y), (float)(streamValPos.three_d.z) }; + light.m_Position = PKToAAE(position); +#if defined(PK_SCALE_DOWN) + light.m_Position.x = light.m_Position.x / layer->m_ScaleFactor; + light.m_Position.y = light.m_Position.y / layer->m_ScaleFactor; + light.m_Position.z = light.m_Position.z / layer->m_ScaleFactor; +#endif + } + if (!lights.PushBack(light).Valid()) + return false; + } + } + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return true; +} + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_VaultHandler.cpp b/AE_GeneralPlugin/Sources/AEGP_VaultHandler.cpp new file mode 100644 index 00000000..896827c6 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_VaultHandler.cpp @@ -0,0 +1,492 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_VaultHandler.h" + +#include "AEGP_FileWatcher.h" +#include "AEGP_World.h" +#include "AEGP_AEPKConversion.h" +#include "AEGP_Log.h" + +#include "AEGP_AssetBaker.h" + +#if defined(PK_WINDOWS) +# include +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +__AEGP_PK_BEGIN +//---------------------------------------------------------------------------- + +const char *CVaultHandler::k_VaultFolderMainName = "Persistant Studios/AfterEffects/Vault"; +const char *CVaultHandler::k_VaultFolderAssetsName = "Assets"; +const char *CVaultHandler::k_VaultFolderCacheName = "Cache"; +const char *CVaultHandler::k_VaultFolderLogsName = "Logs"; + +//---------------------------------------------------------------------------- + +CVaultHandler::CVaultHandler() +{ +} + +//---------------------------------------------------------------------------- + +CVaultHandler::~CVaultHandler() +{ +} + +//---------------------------------------------------------------------------- + +bool CVaultHandler::InitializeIFN() +{ + if (m_Initialized == true) + return true; + m_Initialized = true; + + m_InternalPack = File::DefaultFileSystem()->MountPack(CPopcornFXWorld::Instance().GetInternalPackPath()); + + if (!PK_VERIFY(_SetupVault())) + return false; + + CString logPath = m_VaultPathLogs / "popcorn.htm"; + + m_AELogFileListener = PK_NEW(CLogListenerFile(logPath.Data(), "popcorn-engine logfile"); + CLog::AddGlobalListener(m_AELogFileListener)); + +#if 0 + m_FileWatcher = PK_NEW(CFileWatcher()); + if (!PK_VERIFY(m_FileWatcher != null)) + return false; + m_FileWatcher->SetNotifierAdd(&CVaultHandler::FileAdded); + m_FileWatcher->SetNotifierRemove(&CVaultHandler::FileRemoved); + m_FileWatcher->SetNotifierModify(&CVaultHandler::FileChanged); + m_FileWatcher->SetNotifierRename(&CVaultHandler::FileRenamed); + + bool watchPackSucceed = m_FileWatcher->SetWatchPack(""); + + if (!watchPackSucceed) + return false; +#endif + return false; +} + +//---------------------------------------------------------------------------- + +bool CVaultHandler::ShutdownIFN() +{ + if (m_Initialized == false) + return true; + if (m_AELogFileListener != null) + { + CLog::RemoveGlobalListener(m_AELogFileListener); + m_AELogFileListener = null; + } + + return true; +} + +//---------------------------------------------------------------------------- + +void CVaultHandler::FileAdded(const CString &path) +{ + (void)path; +} + +//---------------------------------------------------------------------------- + +void CVaultHandler::FileRemoved(const CString &path) +{ + (void)path; +} + +//---------------------------------------------------------------------------- + +void CVaultHandler::FileChanged(const CString &path) +{ + (void)path; +} + +//---------------------------------------------------------------------------- + +void CVaultHandler::FileChangedRelativePath(const CString &path) +{ + (void)path; +} + +//---------------------------------------------------------------------------- + +void CVaultHandler::FileRenamed(const CString &oldPath, const CString &newPath) +{ + (void)oldPath; + (void)newPath; +} + +//---------------------------------------------------------------------------- + +bool CVaultHandler::IsBakedAssetLatestVersion(const CString &srcPath, const CString &dstPath) +{ + IFileSystem *fs = File::DefaultFileSystem(); + + if (!fs->Exists(dstPath, true)) + return false; + + SFileTimes srcTimes, dstTimes; + + fs->Timestamps(srcPath, srcTimes, true); + fs->Timestamps(dstPath, dstTimes, true); + + if (srcTimes.m_LastWriteTime > dstTimes.m_LastWriteTime) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CVaultHandler::LoadEffectIntoVault(const CString &srcPackPath, CString &effectPath, const CString &pkprojPath, bool &refresh) +{ + IFileSystem *fs = File::DefaultFileSystem(); + //Check if pack exist in cache + + PFilePack dstPack = GetVaultPackFromPath(srcPackPath); + CString dstPackPath = dstPack->Path(); + CString bakedName = CFilePath::StripExtension(effectPath) + ".pkb"; + CString sourceName = CFilePath::StripExtension(effectPath) + ".pkfx"; + CString sourcePath = srcPackPath / sourceName; + + if (!fs->Exists(dstPackPath, true)) + { + if (!fs->CreateDirectoryChainIFN(dstPackPath, true)) + return false; + } + if (!refresh) + { + if (IsBakedAssetLatestVersion(sourcePath, dstPackPath / bakedName)) + return true; + } + + TArray effectsPath; + + CEffectBaker baker; + + baker.Initialize(srcPackPath, dstPackPath, pkprojPath); + + CString rootDir = baker.GetSourcePackRootPath(); + if (!rootDir.Empty() && sourceName.StartsWith(rootDir)) + { + sourceName = sourceName.Extract(rootDir.Length() + 1, sourceName.Length()); + effectPath = sourceName; + } + effectsPath.PushBack(sourceName); + + baker.ReimportAssets(effectsPath); + baker.ClearBakedPaths(); + + while (baker.PopFileChanges() != 0) + { + } + baker.Clear(); + refresh = true; + return true; +} + +//---------------------------------------------------------------------------- + +CString CVaultHandler::ImportResource(const CString resourcePath) +{ + IFileSystem *fs = File::DefaultFileSystem(); + CString filename = CFilePath::ExtractFilename(resourcePath); + CString sourcePath = resourcePath; + CString targetPath = m_VaultPathAssets / filename; + + if (IsBakedAssetLatestVersion(resourcePath, targetPath)) + return targetPath; + CFilePath::Purify(sourcePath); + if (!PK_VERIFY(fs->FileCopy(sourcePath, targetPath, true))) + return null; + return targetPath; +} + +//---------------------------------------------------------------------------- + +CString CVaultHandler::BakeVectorField(const CString resourcePath, const CString targetPath, const SResourceBakeConfig &config) +{ + (void)config; + IFileSystem *fs = File::DefaultFileSystem(); + CFilePackPath filePackPath = CFilePackPath::FromPhysicalPath(resourcePath, fs); + + PFilePack srcPack = null; + if (filePackPath.Empty()) + { + srcPack = fs->MountPack(CFilePath::StripFilename(resourcePath)); + filePackPath = CFilePackPath::FromPhysicalPath(resourcePath, fs); + } + if (!filePackPath.Empty()) + { + TArray effectsPath; + + effectsPath.PushBack(CFilePath::ExtractFilename(resourcePath)); + + CEffectBaker baker; + + baker.Initialize(filePackPath.Pack()->Path(), m_VaultPathAssets, ""); + baker.ReimportAssets(effectsPath, false); + baker.ClearBakedPaths(); + + while (baker.PopFileChanges() != 0) + { + } + baker.Clear(); + } + if (srcPack != null) + fs->UnmountPack(srcPack.Get()); + return targetPath; +} + +//---------------------------------------------------------------------------- + +CString CVaultHandler::BakeMesh(const CString resourcePath, const CString targetPath, const SResourceBakeConfig &config) +{ + IFileSystem *fs = File::DefaultFileSystem(); + CFilePackPath filePackPath = CFilePackPath::FromPhysicalPath(resourcePath, fs); + bool unload = false; + CString targetExtension = ".pkmm"; + + PFilePack srcPack = null; + if (filePackPath.Empty()) + { + srcPack = fs->MountPack(CFilePath::StripFilename(resourcePath)); + filePackPath = CFilePackPath::FromPhysicalPath(resourcePath, fs); + unload = true; + } + if (!filePackPath.Empty()) + { + class CMeshCodecMessageStreamBaker : public CMeshCodecMessageStream + { + virtual void NotifyProgressMessage(const CString &msg) override // called from time to time to tell what's being loaded + { + (void)msg; +#ifdef PK_DEBUG + printf(" Mesh Importer log: %s\n", msg.Data()); // only display these in debug +#endif + }; + virtual void NotifyError(const CString &msg) override { printf(" Mesh Importer ERROR: %s\n", msg.Data()); } + virtual void NotifyWarning(const CString &msg) override { printf(" Mesh Importer WARNING: %s\n", msg.Data()); } + }; + CMessageStream outBakeReport; + CMeshCodecMessageStreamBaker notifier; + SMeshImportSettings importSettings; + + importSettings.m_ImportGeometry = true; + + importSettings.m_ImportSkeleton = true; + if (config.m_IsAnimTrack) + { + importSettings.m_ImportAnimation = true; + importSettings.m_ImportSkeleton = false; + targetExtension = ".pkan"; + } + if (config.m_IsSkeletalAnim) + { + importSettings.m_ImportAnimation = true; + importSettings.m_ImportSkeleton = true; + targetExtension = ".pksa"; + } + importSettings.m_WriteAccelSampling = true; + importSettings.m_WriteAccelUV2PC = true; + importSettings.m_WriteKdTree = true; + importSettings.m_Positions = SVStreamCode::Type_F32; + importSettings.m_Normals = SVStreamCode::Type_F32; + importSettings.m_Tangents = SVStreamCode::Type_F32; + importSettings.m_Texcoords = SVStreamCode::Type_F32; + + importSettings.m_RemapToZero = true; + + importSettings.m_ResourcePath = filePackPath.Path(); + importSettings.m_ResourceManager = Resource::DefaultManager(); + + PMeshImportOut outFbxImport = CResourceMesh::ImportFromFile(notifier, outBakeReport, &importSettings); + + if (outFbxImport != null) + { + if (!outFbxImport->Write(fs, targetPath + ".pkmm", targetPath + ".pkan", targetPath + ".pksa", outBakeReport)) + CLog::Log(PK_ERROR, "The fbx import failed"); + } + } + if (unload) + fs->UnmountPack(srcPack.Get()); + return targetPath + targetExtension; +} + +//---------------------------------------------------------------------------- + +CString CVaultHandler::CopyResource(const CString resourcePath) +{ + IFileSystem *fs = File::DefaultFileSystem(); + CString filename = CFilePath::ExtractFilename(resourcePath); + CString extension = CFilePath::ExtractExtension(filename); + CString targetPath = m_VaultPathAssets / filename;; + CString sourcePath = resourcePath; + + + if (IsBakedAssetLatestVersion(resourcePath, targetPath)) + return targetPath; + CFilePath::Purify(sourcePath); + if (!PK_VERIFY(fs->FileCopy(sourcePath, targetPath, true))) + return null; + return targetPath; +} + +//---------------------------------------------------------------------------- + +CString CVaultHandler::BakeResource(const CString resourcePath, const SResourceBakeConfig &config) +{ + IFileSystem *fs = File::DefaultFileSystem(); + CString filename = CFilePath::ExtractFilename(resourcePath); + CString extension = CFilePath::ExtractExtension(filename); + CString sourcePath = resourcePath; + + CFilePath::StripExtensionInPlace(filename); + + CString targetPath = m_VaultPathAssets / filename; + + if (!config.m_StraightCopy && extension.Compare("fbx", CaseInsensitive)) + { + CString targetExt = ".pkmm"; + if (config.m_IsAnimTrack) + targetExt = ".pkan"; + if (config.m_IsSkeletalAnim) + targetExt = ".pksa"; + if (IsBakedAssetLatestVersion(resourcePath, targetPath + targetExt)) + return targetPath + targetExt; + + return BakeMesh(resourcePath, targetPath, config); + } + if (!config.m_StraightCopy && extension.Compare("fga", CaseInsensitive)) + { + targetPath += ".pkvf"; + if (IsBakedAssetLatestVersion(resourcePath, targetPath)) + return targetPath; + + return BakeVectorField(resourcePath, targetPath, config); + } + else //Wildcard + { + targetPath += "." + extension; + + if (IsBakedAssetLatestVersion(resourcePath, targetPath)) + return targetPath; + CFilePath::Purify(sourcePath); + if (!PK_VERIFY(fs->FileCopy(sourcePath, targetPath, true))) + return null; + } + return targetPath; +} + +//---------------------------------------------------------------------------- + +PFilePack CVaultHandler::GetVaultPackFromPath(CString path) +{ + PK_ASSERT(path != null); + PK_ASSERT(!path.Empty()); + + IFileSystem *fs = File::DefaultFileSystem(); + + CString packName = CFilePath::ExtractFilename(path); + + u32 pathHash = (u32)std::hash{}(path.Data()); + CString vaultPath = m_VaultPathCache / packName + CString::Format("_%u", pathHash); + + if (fs->Exists(vaultPath, true)) + { + return fs->MountPack(vaultPath); + } + + fs->CreateDirectoryChainIFN(vaultPath, true); + + return fs->MountPack(vaultPath); +} + +//---------------------------------------------------------------------------- + +bool CVaultHandler::_SetupVault() +{ + CString localPathString; +#if defined(PK_WINDOWS) + + aechar_t *userFolder = null; + HRESULT result = 0; + + result = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, (PWSTR*)&userFolder); + if (FAILED(result)) + return false; + WCharToCString(userFolder, &localPathString); + CoTaskMemFree(static_cast(userFolder)); + +#elif defined(PK_MACOSX) + const char *homeFolder = getenv("HOME"); + if (!PK_VERIFY(homeFolder != null)) + return false; + localPathString = CString(homeFolder) / "Library" / "Application Support"; +#endif + CFilePath::Purify(localPathString); + + IFileSystem *fs = File::DefaultFileSystem(); + + m_VaultPathRoot = localPathString + "/"+ k_VaultFolderMainName; + m_VaultPathAssets = m_VaultPathRoot + "/" + k_VaultFolderAssetsName; + m_VaultPathCache = m_VaultPathRoot + "/" + k_VaultFolderCacheName; + m_VaultPathLogs = m_VaultPathRoot + "/" + k_VaultFolderLogsName; + + if (!fs->CreateDirectoryChainIFN(m_VaultPathRoot, true) || + !fs->CreateDirectoryChainIFN(m_VaultPathAssets, true) || + !fs->CreateDirectoryChainIFN(m_VaultPathCache, true) || + !fs->CreateDirectoryChainIFN(m_VaultPathLogs, true)) + return false; + + class CPKFolderWalker : public CFileDirectoryWalker + { + public: + TArray m_Folders; + + CPKFolderWalker(const CString &rootDir) + : CFileDirectoryWalker(rootDir, IgnoreVirtualFS) + { + } + + virtual bool DirectoryNotifier(const CFilePack *, const char *fullPath, u32 ) override + { + m_Folders.PushBack(fullPath); + return false; + } + + }; + + CPKFolderWalker walker(m_VaultPathCache); + + walker.Walk(); + + for (u32 i = 0; i < walker.m_Folders.Count(); ++i) + { + fs->MountPack(walker.m_Folders[i]); + } + + fs->MountPack(m_VaultPathAssets); + return true; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AEGP_WinFileDialog.cpp b/AE_GeneralPlugin/Sources/AEGP_WinFileDialog.cpp new file mode 100644 index 00000000..3c79070c --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_WinFileDialog.cpp @@ -0,0 +1,183 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include + +#if defined(PK_WINDOWS) + +#include "AEGP_WinFileDialog.h" + +#include +#include + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include "AEGP_World.h" + +//---------------------------------------------------------------------------- + +class CDialogEventHandler : public IFileDialogEvents, + public IFileDialogControlEvents +{ +public: + // IUnknown methods + IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) + { +#pragma warning(disable:4838) + static const QITAB qit[] = { + QITABENT(CDialogEventHandler, IFileDialogEvents), + QITABENT(CDialogEventHandler, IFileDialogControlEvents), + { 0 }, + }; + return QISearch(this, qit, riid, ppv); + +#pragma warning(default:4838) + } + + IFACEMETHODIMP_(ULONG) AddRef() + { + return InterlockedIncrement(&_cRef); + } + + IFACEMETHODIMP_(ULONG) Release() + { + long cRef = InterlockedDecrement(&_cRef); + if (!cRef) + delete this; + return cRef; + } + + // IFileDialogEvents methods + IFACEMETHODIMP OnFileOk(IFileDialog *) { return S_OK; }; + IFACEMETHODIMP OnFolderChange(IFileDialog *) { return S_OK; }; + IFACEMETHODIMP OnFolderChanging(IFileDialog *, IShellItem *) { return S_OK; }; + IFACEMETHODIMP OnHelp(IFileDialog *) { return S_OK; }; + IFACEMETHODIMP OnSelectionChange(IFileDialog *) { return S_OK; }; + IFACEMETHODIMP OnShareViolation(IFileDialog *, IShellItem *, FDE_SHAREVIOLATION_RESPONSE *) { return S_OK; }; + IFACEMETHODIMP OnTypeChange(IFileDialog *) { return S_OK; }; + IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) { return S_OK; }; + + // IFileDialogControlEvents methods + IFACEMETHODIMP OnItemSelected(IFileDialogCustomize *, DWORD, DWORD) { return S_OK; }; + IFACEMETHODIMP OnButtonClicked(IFileDialogCustomize *, DWORD) { return S_OK; }; + IFACEMETHODIMP OnCheckButtonToggled(IFileDialogCustomize *, DWORD, BOOL) { return S_OK; }; + IFACEMETHODIMP OnControlActivating(IFileDialogCustomize *, DWORD) { return S_OK; }; + + CDialogEventHandler() : _cRef(1) { }; +private: + ~CDialogEventHandler() { }; + long _cRef; +}; + +//---------------------------------------------------------------------------- + +// Instance creation helper +HRESULT CDialogEventHandler_CreateInstance(REFIID riid, void **ppv) +{ + *ppv = NULL; + CDialogEventHandler *pDialogEventHandler = new (std::nothrow) CDialogEventHandler(); + HRESULT hr = pDialogEventHandler ? S_OK : E_OUTOFMEMORY; + if (SUCCEEDED(hr)) + { + hr = pDialogEventHandler->QueryInterface(riid, ppv); + pDialogEventHandler->Release(); + } + return hr; +} + +//---------------------------------------------------------------------------- + +HRESULT WinBasicFileOpen(SWinFileOpenData &data) +{ + IFileDialog *pfd = NULL; + AEGP_SuiteHandler suites(AEGPPk::CPopcornFXWorld::Instance().GetAESuites()); + HWND winHandle = null; + + suites.UtilitySuite6()->AEGP_GetMainHWND(&winHandle); + + HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, + NULL, + CLSCTX_INPROC_SERVER, + IID_PPV_ARGS(&pfd)); + if (SUCCEEDED(hr)) + { + IFileDialogEvents *pfde = NULL; + hr = CDialogEventHandler_CreateInstance(IID_PPV_ARGS(&pfde)); + if (SUCCEEDED(hr)) + { + DWORD dwCookie; + hr = pfd->Advise(pfde, &dwCookie); + if (SUCCEEDED(hr)) + { + DWORD dwFlags; + hr = pfd->GetOptions(&dwFlags); + if (SUCCEEDED(hr)) + { + hr = pfd->SetOptions(dwFlags | FOS_FORCEFILESYSTEM); + if (SUCCEEDED(hr)) + { + TArray filters; + for (u32 i = 0; i < data.m_Filters.Count(); i++) + filters.PushBack(data.m_Filters[i].m_Spec); + + hr = pfd->SetFileTypes(filters.Count(), filters.RawDataPointer()); + if (SUCCEEDED(hr)) + { + hr = pfd->SetFileTypeIndex(0); + if (SUCCEEDED(hr)) + { + hr = pfd->SetDefaultExtension(L"*.pkproj"); + if (SUCCEEDED(hr)) + { + hr = pfd->Show(winHandle); + if (SUCCEEDED(hr)) + { + IShellItem *psiResult; + hr = pfd->GetResult(&psiResult); + if (SUCCEEDED(hr)) + { + wchar_t *pszFilePath = NULL; + hr = psiResult->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath); + if (SUCCEEDED(hr)) + { + char result[1024]; + CString stringResult; + wcstombs(result, pszFilePath, 1024); + stringResult = result; + + data.m_Cb(stringResult); + } + psiResult->Release(); + } + } + } + } + } + } + } + pfd->Unadvise(dwCookie); + } + pfde->Release(); + } + pfd->Release(); + } + return hr; +} + +//---------------------------------------------------------------------------- + +#endif diff --git a/AE_GeneralPlugin/Sources/AEGP_WinSystem.cpp b/AE_GeneralPlugin/Sources/AEGP_WinSystem.cpp new file mode 100644 index 00000000..3f44a946 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_WinSystem.cpp @@ -0,0 +1,216 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include + +#include "AEGP_WinSystem.h" +#include "PopcornFX_Suite.h" + +#include "AEGP_System.h" + +#include + +#if defined(PK_WINDOWS) + +#include +#include +#include +#include +#include +#include +#include +#include + + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +CString CWinSystemHelper::GetLastErrorAsString() +{ + TArray error; + return GetLastErrorAsString(error); +} + +//---------------------------------------------------------------------------- + +CString CWinSystemHelper::GetLastErrorAsString(TArray &ignore) +{ + //Get the error message ID, if any. + DWORD errorMessageID = ::GetLastError(); + if (errorMessageID == 0 || ignore.Contains(errorMessageID)) + return CString(); + + LPSTR messageBuffer = nullptr; + + //Ask Win32 to give us the string version of that message ID. + //The parameters we pass in, tell Win32 to create the buffer that holds the message for us (because we don't yet know how long the message string will be). + size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL); + + //Copy the error message into a std::string. + CString message(messageBuffer, (u32)size); + + //Free the Win32's string's buffer. + LocalFree(messageBuffer); + + return message; +} + +//---------------------------------------------------------------------------- + +CString CWinSystemHelper::_GetWindowsInstallDir() +{ + CString appFolderPath; + + aechar_t dstPath[MAX_PATH]; + if (::ExpandEnvironmentStringsW(L"%ProgramW6432%", (LPWSTR)dstPath, PK_ARRAY_COUNT(dstPath)) != 0) + { + std::string dest; + dstPath[PK_ARRAY_COUNT(dstPath) - 1] = 0; + WCharToString(dstPath, &dest); + appFolderPath = dest.c_str(); + appFolderPath = appFolderPath + (appFolderPath.EndsWith("/") ? "" : "/") + "Persistant Studios/"; + } + return appFolderPath; +} + +//---------------------------------------------------------------------------- + +TArray CWinSystemHelper::_FindInstalledVersions(const CString &baseSearchPath) +{ + WIN32_FIND_DATA ffd; + TCHAR szDir[MAX_PATH]; + HANDLE hFind = INVALID_HANDLE_VALUE; + DWORD dwError = 0; + + // we expect 'baseSearchPath' to be the root 'Persistant Studios' install dir, + // inside which are located PopcornFX editor executables of the form 'PopcornFX-X.Y/Binaries_Release/PK-Editor.exe' + TArray paths; + + // Prepare string for use with FindFile functions. First, copy the + // string to a buffer, then append '\*' to the directory name. + StringCchCopy(szDir, MAX_PATH, baseSearchPath.Data()); + StringCchCat(szDir, MAX_PATH, TEXT("\\*")); + + // Find the first file in the directory. + hFind = FindFirstFile(szDir, &ffd); + + if (INVALID_HANDLE_VALUE == hFind) + { + CString error = GetLastErrorAsString(); + CLog::Log(PK_ERROR, "%s", error.Data()); + return paths; + } + + // List all the files in the directory with some info about them. + do + { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + const CString entryName = ffd.cFileName; + if (entryName.StartsWith("PopcornFX-")) + { + const CString editorVersionDir = baseSearchPath + entryName; + const CString editorExecPathV2 = editorVersionDir + "/bin/PK-Editor.exe"; + const CString editorExecPathUn = editorVersionDir + "/Uninstall.exe"; + + DWORD dwAttrib = GetFileAttributes(TEXT(editorExecPathV2.Data())); + if (dwAttrib != INVALID_FILE_ATTRIBUTES) + { + const SDllVersion version = PKTKGetFileVersionInfo(editorExecPathV2.Data()); + if (!paths.PushBack(SEditorExecutable(editorExecPathV2, "", SEngineVersion(version.Major, version.Minor, version.Patch, version.RevID))).Valid()) + { + CLog::Log(PK_ERROR, "TArray Alloc Failed"); + return paths; + } + + } + } + } + } while (FindNextFile(hFind, &ffd) != 0); + + dwError = GetLastError(); + if (dwError != ERROR_NO_MORE_FILES) + { + CString error = GetLastErrorAsString(); + CLog::Log(PK_ERROR, "%s", error.Data()); + } + + FindClose(hFind); + return paths; +} + +//---------------------------------------------------------------------------- + +SEditorExecutable CWinSystemHelper::GetMatchingEditor(const SEngineVersion &version) +{ + PK_ASSERT(version.Major() == 2); + + CGuid bestVerPatch; + CGuid bestVer; + + TArray execList = _FindInstalledVersions(_GetWindowsInstallDir()); + for (u32 i = 0; i < execList.Count(); i++) + { + const SEditorExecutable &execVer = execList[i]; + + if (execVer.m_Version.Equal_IgnoreRevID(version)) + { + // Exact version, always the best option. + // This assumes there's always a single version installed at the same patch, + // and there can't be multiple versions with the same major.minor.patch version. + // Otherwise, when there are multiple similar versions installed, + // it'll take the first one in the list. Do we care? + // Do we want to handle that better and actually return the one with + // the closest revid ? + CLog::Log(PK_INFO, "Running exact match editor : %s", execVer.m_BinaryPath.Data()); + return execVer; // Exact version + } + if (execVer.m_Version.Equal_IgnorePatch(version)) + { + // Within the same minor version, this is the best candidate + if (!bestVerPatch.Valid()) + bestVerPatch = i; + else + { + const u32 patchPrev = execList[bestVerPatch].m_Version.Patch(); + const u32 patchNew = execVer.m_Version.Patch(); + { + if (patchNew >= patchPrev) + bestVerPatch = i; + } + } + } + else if (execVer.m_Version >= version) + { + // Minor version higher than project + if (!bestVer.Valid()) + bestVer = i; + else + { + if (execVer.m_Version < execList[bestVer].m_Version) // if it's closer to the target project version + bestVer = i; + } + } + } + if (bestVerPatch.Valid()) + return execList[bestVerPatch]; + if (bestVer.Valid()) + return execList[bestVer]; + + SEditorExecutable ret; +#if _DEBUG + ret.m_BinaryPath = "%PK_SDK_ROOT%\\Tools\\Poped\\build_vs2019\\PK-Editor_d.exe"; +#else + ret.m_BinaryPath = "%PK_SDK_ROOT%\\Tools\\Poped\\build_vs2019\\PK-Editor_r.exe"; +#endif + CLog::Log(PK_INFO, "Running default path dev: %s", ret.m_BinaryPath.Data()); + return ret; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif // PK_WINDOWS diff --git a/AE_GeneralPlugin/Sources/AEGP_World.cpp b/AE_GeneralPlugin/Sources/AEGP_World.cpp new file mode 100644 index 00000000..2786e0ae --- /dev/null +++ b/AE_GeneralPlugin/Sources/AEGP_World.cpp @@ -0,0 +1,2674 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" + +#include "AEGP_World.h" + +#include "AEGP_PopcornFXPlugins.h" +#include "AEGP_Scene.h" +#include "AEGP_AEPKConversion.h" + +#include "AEGP_AssetBaker.h" +#include "AEGP_Log.h" + +//Suite +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +//StartUp Runtime +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // for PRNG +#include // for CPlane in CParticleSceneBasic + +#include +#include + +//RHI +#include +#include +#include +//Sample +#include +#include + +#include + +//AE +#include +#include + +#include "AEGP_LayerHolder.h" +#include "AEGP_UpdateAEState.h" + +#include "Panels/AEGP_PanelQT.h" + +#include "AEGP_System.h" + +#include +#include + +#include + +//---------------------------------------------------------------------------- + +PK_LOG_MODULE_DECLARE(); + +template <> +const A_char* SuiteTraits::i_name = kAEGPPanelSuite; +template <> +const int32_t SuiteTraits::i_version = kAEGPPanelSuiteVersion1; + +template <> +const A_char* SuiteTraits::i_name = kPFAppSuite; +template <> +const int32_t SuiteTraits::i_version = kPFAppSuiteVersion4; + +//---------------------------------------------------------------------------- + +__AEGP_PK_BEGIN + +//TODO OS Specific code +static PAAERenderContext s_AAEThreadRenderContexts = null; +static PKSample::CShaderLoader *s_ShaderLoader = null; + +//---------------------------------------------------------------------------- + +const char *SAEPreferenciesKeys::GetGraphicsApiAsCharPtr(EApiValue value) +{ + return kApiNames[value]; + +} + +//---------------------------------------------------------------------------- + +const char *SAEPreferenciesKeys::GetGraphicsApiAsCharPtr(RHI::EGraphicalApi value) +{ + return GetGraphicsApiAsCharPtr(RHIApiToAEApi(value)); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +HBO_CLASS_DEFINITION_BEGIN(CAEPProjectProperties) + .HBO_FIELD_DEFINITION(ProjectName) + .HBO_FIELD_DEFINITION(LayerProperties) +HBO_CLASS_DEFINITION_END + +CAEPProjectProperties::CAEPProjectProperties() + : HBO_CONSTRUCT(CAEPProjectProperties) +{ +} + +//---------------------------------------------------------------------------- + +CAEPProjectProperties::~CAEPProjectProperties() +{ +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +CPopcornFXWorld *CPopcornFXWorld::m_Instance = null; + +CPopcornFXWorld::CPopcornFXWorld() + : m_Initialized(false) + , m_AAETreadID(0) + , m_GraphicsApi(RHI::GApi_Null) + , m_AELogFileListener(null) +{ +} + +//---------------------------------------------------------------------------- + +CPopcornFXWorld::~CPopcornFXWorld() +{ + if (s_AAEThreadRenderContexts != null) + { + s_AAEThreadRenderContexts->Destroy(); + s_AAEThreadRenderContexts = null; + } + PK_SAFE_DELETE(s_ShaderLoader); +} + +//---------------------------------------------------------------------------- + +CPopcornFXWorld &CPopcornFXWorld::Instance() +{ + if (CPopcornFXWorld::m_Instance == null) + { + m_Instance = new CPopcornFXWorld(); + } + return *m_Instance; +} + +//---------------------------------------------------------------------------- + +static Threads::PAbstractPool _CreateCustomThreadPool() +{ + bool success = true; + CThreadManager::EPriority workersPriority = CThreadManager::Priority_High; + PWorkerThreadPool pool = PK_NEW(CWorkerThreadPool); + + if (PK_VERIFY(pool != null)) + { + // Let the OS shedule our workers + // leave 2 core for main thread and render thread + u32 processorCount = PKMin(PKMax(CPU::Caps().ProcessAffinity().NumBitsSet(), (u32)4) - (u32)3, (u32)12); + + CPopcornFXWorld::Instance().SetWorkerCount(processorCount); + success = pool->AddFullAffinityWorkers(processorCount, CPU::Caps().ProcessAffinity(), workersPriority); + + if (!success) + return null; + + pool->StartWorkers(); + } + return pool; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::Setup(SPBasicSuite *pica_basicP, AEGP_PluginID id) +{ + PK_SCOPEDLOCK(m_Lock); + m_AEGPID = id; + m_Suites = pica_basicP; + + AEGP_SuiteHandler suites(m_Suites); + A_Err err = A_Err_NONE; + // AE SETUP + { + AEGP_InstalledEffectKey key = AEGP_InstalledEffectKey_NONE; + u32 effectInstalled; + A_char effectName[AEGP_MAX_EFFECT_MATCH_NAME_SIZE] = { '\0' }; + u32 pluginsFound = 0; + + suites.EffectSuite4()->AEGP_GetNumInstalledEffects((A_long*)&effectInstalled); + + for (u32 i = 0; i < effectInstalled; ++i) + { + suites.EffectSuite4()->AEGP_GetNextInstalledEffect(key, &key); + suites.EffectSuite4()->AEGP_GetEffectMatchName(key, effectName); + + if (strcmp(effectName, "ADBE PopcornFX Emitter") == 0) + { + m_PKInstalledPluginKeys[EPKChildPlugins::EMITTER] = key; + ++pluginsFound; + } + else if (strcmp(effectName, "ADBE PopcornFX Attribute") == 0) + { + m_PKInstalledPluginKeys[EPKChildPlugins::ATTRIBUTE] = key; + ++pluginsFound; + } + else if (strcmp(effectName, "ADBE PopcornFX Sampler") == 0) + { + m_PKInstalledPluginKeys[EPKChildPlugins::SAMPLER] = key; + ++pluginsFound; + } + + if (pluginsFound == EPKChildPlugins::_PLUGIN_COUNT) + break; + } + PK_RELEASE_ASSERT(pluginsFound == EPKChildPlugins::_PLUGIN_COUNT); + } + + //POPCORN FX INIT + SDllVersion engineVersion; + CPKKernel::Config configKernel; + + configKernel.m_CreateThreadPool = &_CreateCustomThreadPool; + + if (engineVersion.Major != PK_VERSION_MAJOR || engineVersion.Minor != PK_VERSION_MINOR) + { + PK_ASSERT_NOT_REACHED(); + } + + if (!CPKKernel::Startup(engineVersion, configKernel) || + !CPKBaseObject::Startup(engineVersion, CPKBaseObject::Config()) || + !CPKEngineUtils::Startup(engineVersion, CPKEngineUtils::Config()) || + !CPKCompiler::Startup(engineVersion, CPKCompiler::Config()) || + !CPKGeometrics::Startup(engineVersion, CPKGeometrics::Config()) || + !CPKImaging::Startup(engineVersion, CPKImaging::Config()) || + !CPKParticles::Startup(engineVersion, CPKParticles::Config()) || + !ParticleToolbox::Startup() || + !CPKRHI::Startup(engineVersion, CPKRHI::Config()) || + !CPKRenderHelpers::Startup(engineVersion, CPKRenderHelpers::Config()) || + !CPKSample::Startup(engineVersion, CPKSample::Config()) || // Only necessary if your engine links/relies on PKSample + !PK_VERIFY(Kernel::CheckStaticConfigFlags(Kernel::g_BaseStaticConfig, SKernelConfigFlags()))) + { + return false; + } + + PK_LOG_MODULE_INIT_START; + + CAEPProjectProperties::RegisterHandler(); + CLayerProperty::RegisterHandler(); + CGraphicOverride::RegisterHandler(); + CEditorAssetEffect::RegisterHandler(); + + PK_LOG_MODULE_INIT_END; + + CAELog::SetPKLogState(true); + +#if 0 + _GetAEPath(AEGP_GetPathTypes_PLUGIN, m_PluginPath); < --Not implemented by AE +#endif + if (!PK_VERIFY(_GetAEPath(AEGP_GetPathTypes_USER_PLUGIN, m_UserPluginPath)) || + !PK_VERIFY(_GetAEPath(AEGP_GetPathTypes_ALLUSER_PLUGIN, m_AllUserPluginPath)) || + !PK_VERIFY(_GetAEPath(AEGP_GetPathTypes_APP, m_AEPath))) + return false; + + CFilePath::Purify(m_AEPath); + + CCoordinateFrame::SetupFrame(ECoordinateFrame::Frame_User1, EAbsoluteAxis::Axis_Right, EAbsoluteAxis::Axis_Down, EAbsoluteAxis::Axis_Forward); + CCoordinateFrame::SetGlobalFrame(ECoordinateFrame::Frame_User1); + + if (!PK_VERIFY(PopcornRegisterPlugins(EPlugin_Default | EPlugin_MeshCodecFBX) == true)) + return CAELog::TryLogErrorWindows("Could not load PopcornFX plugins"); + + AEGP_PersistentBlobH blobH = NULL; + AEGP_PersistentDataSuite4 *persistentDataSuite = suites.PersistentDataSuite4(); + + if (persistentDataSuite != null) + { + err |= persistentDataSuite->AEGP_GetApplicationBlob(AEGP_PersistentType_MACHINE_SPECIFIC, &blobH); + if (err == A_Err_NONE && blobH != null) + { + u32 targetApi; +#if defined(PK_WINDOWS) + A_long defaultApi = EApiValue::D3D11; +#elif defined(PK_MACOSX) + A_long defaultApi = EApiValue::Metal; +#endif + err |= persistentDataSuite->AEGP_GetLong(blobH, + SAEPreferenciesKeys::kSection, + SAEPreferenciesKeys::kApi, + defaultApi, + (A_long*)&targetApi); + if (err == A_Err_NONE) + { + m_GraphicsApi = AEApiToRHIApi(static_cast(targetApi)); + } + } + } + if (!PK_VERIFY(err == A_Err_NONE)) + return false; + + CPanelBaseGUI *panel = CPanelBaseGUI::GetInstance(); + if (!PK_VERIFY(panel->InitializeIFN())) + return false; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::FetchAEProject() +{ + AEGP_SuiteHandler suites(m_Suites); + A_Err err = A_Err_NONE; + A_long numProj = 0; + + err |= suites.ProjSuite6()->AEGP_GetNumProjects(&numProj); + + if (numProj > 0) + { + AEGP_ProjectH projPH; + + err |= suites.ProjSuite6()->AEGP_GetProjectByIndex(0, &projPH); + + if (err == A_Err_NONE && projPH != null) + { + AEGP_MemHandle handle; + aechar_t *retrievedPath; + CString path = ""; + + err |= suites.ProjSuite6()->AEGP_GetProjectPath(projPH, &handle); + err |= suites.MemorySuite1()->AEGP_LockMemHandle(handle, reinterpret_cast(&retrievedPath)); + + WCharToCString(retrievedPath, &path); + + err |= suites.MemorySuite1()->AEGP_UnlockMemHandle(handle); + err |= suites.MemorySuite1()->AEGP_FreeMemHandle(handle); + if (path != null) + { + m_AEProjectFilename = CFilePath::ExtractFilename(path.Data()); + CFilePath::StripExtensionInPlace(m_AEProjectFilename); + path = CFilePath::StripFilename(path.Data()); + CFilePath::Purify(path); + bool newPath = false; + + //Create log file in AEP directory + if (m_AEProjectPath != path) + { + newPath = true; + m_AEProjectPath = path; + + CString logPath = path / "popcorn.htm"; + + if (m_AELogFileListener != null) + { + CLog::RemoveGlobalListener(m_AELogFileListener); + m_AELogFileListener = null; + } + m_AELogFileListener = PK_NEW(CLogListenerFile(path.Data(), "popcorn-engine logfile"); + CLog::AddGlobalListener(m_AELogFileListener)); + } + //CreateINF Project conf file or reload it if AEP changed + if (m_ProjectConfFile == null || newPath) + { + IFileSystem *fileSystem = File::DefaultFileSystem(); + + if (m_ProjectPack != null) + fileSystem->UnmountPack(m_ProjectPack.Get()); + if (m_ProjectConfFile != null) + { + m_ProjectConfFile->Unload(); + for (auto *layers : m_Layers) + layers->m_LayerProperty = null; + } + + CString projectPropFilename = m_AEProjectFilename + ".pkbo"; + + m_ProjectPack = fileSystem->MountPack(path); + m_ProjectConfFile = HBO::g_Context->LoadFile_AndCreateIFN_Pure(projectPropFilename.View(), false); + + } + if (m_ProjectConfFile != null) + { + PAEPProjectProperties projectProp = m_ProjectConfFile->FindFirstOf(); + + if (projectProp != null) + { + if (!projectProp->ProjectName().Compare(m_AEProjectFilename))//project change: unload file and let the next frame recreate it + { + m_ProjectConfFile->Unload(); + m_ProjectConfFile = null; + } + } + else //or a new project + { + projectProp = HBO::g_Context->NewObject(m_ProjectConfFile.Get()); + projectProp->SetProjectName(m_AEProjectFilename); + + WriteProjectFileModification(); + } + m_ProjectProperty = projectProp; + } + } + } + } + if (!PK_VERIFY(err == A_Err_NONE)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::_GetAEPath(AEGP_GetPathTypes type, CString &dst) +{ + AEGP_MemHandle handle; + A_Err err = A_Err_NONE; + aechar_t *retrievedPath; + AEGP_SuiteHandler suites(m_Suites); + + err = suites.UtilitySuite6()->AEGP_GetPluginPaths(m_AEGPID, type, &handle); + if (!PK_VERIFY(err == A_Err_NONE)) + return false; + suites.MemorySuite1()->AEGP_LockMemHandle(handle, reinterpret_cast(&retrievedPath)); + + dst.Clear(); + WCharToCString(retrievedPath, &dst); + + err |= suites.MemorySuite1()->AEGP_UnlockMemHandle(handle); + err |= suites.MemorySuite1()->AEGP_FreeMemHandle(handle); + + if (!PK_VERIFY(err == A_Err_NONE)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetCommandHandle(AEGP_Command &command, const char *name) +{ + m_CommandName = name; + m_Command = command; + return true; +} + +//---------------------------------------------------------------------------- + +AEGP_PluginID CPopcornFXWorld::GetPluginID() +{ + return m_AEGPID; +} + +//---------------------------------------------------------------------------- + +SPBasicSuite *CPopcornFXWorld::GetAESuites() +{ + return m_Suites; +} + +//---------------------------------------------------------------------------- + +RHI::EGraphicalApi CPopcornFXWorld::GetRenderApi() +{ + PK_ASSERT(m_GraphicsApi != RHI::GApi_Null); + return m_GraphicsApi; +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::SetRenderApi(EApiValue AEGraphicsApi) +{ + A_Err err = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + AEGP_PersistentBlobH blobH = NULL; + AEGP_PersistentDataSuite4 *persistentDataSuite = suites.PersistentDataSuite4(); + + if (persistentDataSuite != null) + { + err |= persistentDataSuite->AEGP_GetApplicationBlob(AEGP_PersistentType_MACHINE_SPECIFIC, &blobH); + if (err == A_Err_NONE && blobH != null) + { + err |= persistentDataSuite->AEGP_SetLong(blobH, + SAEPreferenciesKeys::kSection, + SAEPreferenciesKeys::kApi, + (A_long)AEGraphicsApi); + PK_ASSERT(err == A_Err_NONE); + } + } + CAELog::TryLogInfoWindows("Graphics Api changed, restart After Effects to apply change."); +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::InitializeIFN(SAAEIOData &AAEData) +{ + (void)AAEData; + FetchAEProject(); + if (m_Initialized == true) + return true; + PK_SCOPEDLOCK(m_Lock); + + m_ClassName = "PKPluginInterface"; + + m_VaultHandler.InitializeIFN(); + m_Initialized = true; + for (u32 i = 0; i < __Effect_Parameters_Count; ++i) + CAEUpdater::s_EmitterIndexes[i] = i; + for (u32 i = 0; i < __Attribute_Parameters_Count; ++i) + CAEUpdater::s_AttributeIndexes[i] = i; + for (u32 i = 0; i < __AttributeSamplerType_Parameters_Count; ++i) + CAEUpdater::s_SamplerIndexes[i] = i; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::ShutdownIFN() +{ + bool result = true; + + m_VaultHandler.ShutdownIFN(); + { + PK_SCOPEDLOCK(m_Lock); + if (m_Panel) + { + m_Panel->DestroyInstance(); + m_Panel = null; + } + + for (s32 j = m_Layers.Count() - 1; j >= 0; --j) + { + SLayerHolder &layer = *m_Layers[j]; + + result = layer.Clear(m_Suites); + PK_ASSERT(result); + PK_DELETE(m_Layers[j]); + } + m_Layers.Clear(); + HBO::g_Context->UnloadAllFiles(); + + CAAEScene::ShutdownPopcornFX(); + m_Suites = null; + if (m_AAETreadID.Count() != 0) + { + for (u32 i = 0; i < m_AAETreadID.Count(); ++i) + { + PopcornFX::CThreadManager::UnsafeUnregisterUserThread(m_AAETreadID[i]); + } + m_AAETreadID.Clear(); + } + if (m_AELogFileListener != null) + { + CLog::RemoveGlobalListener(m_AELogFileListener); + m_AELogFileListener = null; + } + IFileSystem *fileSystem = File::DefaultFileSystem(); + if (PK_VERIFY(fileSystem != null)) + fileSystem->UnmountAllPacks(); + m_Initialized = false; + } + delete m_Instance; + + PopcornUnregisterPlugins(); + CAELog::SetPKLogState(false); + + PK_LOG_MODULE_RELEASE_START; + + CAEPProjectProperties::UnregisterHandler(); + CLayerProperty::UnregisterHandler(); + CGraphicOverride::UnregisterHandler(); + CEditorAssetEffect::UnregisterHandler(); + + PK_LOG_MODULE_RELEASE_END; + + CPKSample::Shutdown(); + CPKRenderHelpers::Shutdown(); + CPKRHI::Shutdown(); + ParticleToolbox::Shutdown(); + CPKParticles::Shutdown(); + CPKImaging::Shutdown(); + CPKGeometrics::Shutdown(); + CPKCompiler::Shutdown(); + CPKEngineUtils::Shutdown(); + CPKBaseObject::Shutdown(); + CPKKernel::Shutdown(); + return result; +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::SetProfilingState(bool state) +{ +#if (KR_PROFILER_ENABLED != 0) + Profiler::CProfiler *profiler = Profiler::MainEngineProfiler(); + if (profiler == null) + return; + profiler->GrabCallstacks(false); + profiler->Activate(state); + profiler->Reset(); + + if (!state) + { + CString path = m_VaultHandler.VaultPathRoot() / "profilerReport.pkpr"; + CDynamicMemoryStream stream = CDynamicMemoryStream(); + Profiler::CProfilerReport report; + profiler->BuildReport(&report); + Profiler::WriteProfileReport(report, stream); + FILE *f = fopen(path.Data(), "wb"); + if (f != null) + { + u32 size = 0; + u8 *buffer = stream.ExportDataAndClose(size); + fwrite(buffer, size, 1, f); + fclose(f); + PK_FREE(buffer); + } + else + CLog::Log(PK_ERROR, "Failed to write profile report to %s", path.Data()); + stream.Close(); + } +#endif +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::SetParametersIndexes(const int *indexes, EPKChildPlugins plugin) +{ + if (plugin == EPKChildPlugins::EMITTER) + { + for (u32 i = 0; i < __Effect_Parameters_Count; ++i) + { + CAEUpdater::s_EmitterIndexes[i] = indexes[i]; + PK_ASSERT(CAEUpdater::s_EmitterIndexes[i] >= 0); + } + } + else if (plugin == EPKChildPlugins::ATTRIBUTE) + { + for (u32 i = 0; i < __Attribute_Parameters_Count; ++i) + { + CAEUpdater::s_AttributeIndexes[i] = indexes[i]; + PK_ASSERT(CAEUpdater::s_AttributeIndexes[i] >= 0); + } + } + else if (plugin == EPKChildPlugins::SAMPLER) + { + for (u32 i = 0; i < __AttributeSamplerType_Parameters_Count; ++i) + { + CAEUpdater::s_SamplerIndexes[i] = indexes[i]; + PK_ASSERT(CAEUpdater::s_SamplerIndexes[i] >= 0); + } + } +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetDefaultLayerPosition(SAAEIOData& AAEData, AEGP_LayerH layer) +{ + if (layer == null) + return false; + + AEGP_SuiteHandler suites(m_Suites); + A_Err result = A_Err_NONE; + AEGP_StreamRefH stream = null; + A_Time time; + + time.value = AAEData.m_InData->current_time; + time.scale = AAEData.m_InData->time_scale; + + result |= suites.StreamSuite2()->AEGP_GetNewLayerStream(m_AEGPID, layer, AEGP_LayerStream_POSITION, &stream); + if (result != A_Err_NONE || stream == null) + return false; + + AEGP_StreamValue value; + + result |= suites.StreamSuite2()->AEGP_GetNewStreamValue(m_AEGPID, stream, AEGP_LTimeMode_LayerTime, &time, false, &value); + if (result != A_Err_NONE) + return false; + value.val.three_d.x = AAEData.m_InData->width / 2.0f; + value.val.three_d.y = AAEData.m_InData->height / 2.0f; + + result |= suites.StreamSuite2()->AEGP_SetStreamValue(m_AEGPID, stream, &value); + if (result != A_Err_NONE) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::MoveEffectIntoCurrentView(SAAEIOData &AAEData, SEmitterDesc *descriptor) +{ + SLayerHolder *layer = GetLayerForSEmitterDesc(descriptor); + + if (layer == null && layer->m_SpawnedEmitter.m_Desc == null) + return false; + + CAABB bounds; + CFloat4x4 view; + CFloat4 pos; + float zoom; + A_Time AETime; + + AETime.scale = AAEData.m_InData->time_scale; + AETime.value = AAEData.m_InData->current_time; + if (!layer->m_Scene->GetEmitterBounds(bounds) || + !CAEUpdater::GetCameraViewMatrixAtTime(layer, view, pos, AETime, zoom)) + return false; + + + CFloat3 forward = view.Inverse().StrippedZAxis().Normalized(); + + float extends = bounds.Extent().HighestComponent(); + CFloat3 newPos = pos.xyz() + forward * (extends * 2.0f); + + AEGP_SuiteHandler suites(m_Suites); + A_Err result = A_Err_NONE; + AEGP_StreamRefH streamPos = null; + AEGP_EffectRefH effectRef = null; + + result = suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AEGPID, AAEData.m_InData->effect_ref, &effectRef); + if (result != A_Err_NONE || effectRef == null) + return false; + + result |= suites.StreamSuite5()->AEGP_GetNewEffectStreamByIndex(m_AEGPID, effectRef, CAEUpdater::s_EmitterIndexes[Effect_Parameters_Position], &streamPos); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE || streamPos == null) + { + return false; + } + AEGP_StreamValue2 value; + result |= suites.StreamSuite5()->AEGP_GetNewStreamValue(m_AEGPID, streamPos, AEGP_LTimeMode_LayerTime, &AETime, false, &value); + if (result != A_Err_NONE) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return false; + } + value.val.three_d.x = newPos.x(); + value.val.three_d.y = newPos.y(); + value.val.three_d.z = newPos.z(); + result |= suites.StreamSuite5()->AEGP_SetStreamValue(m_AEGPID, streamPos, &value); + if (result != A_Err_NONE) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return false; + } + result |= suites.StreamSuite5()->AEGP_DisposeStreamValue(&value); + result |= suites.StreamSuite5()->AEGP_DisposeStream(streamPos); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::IdleUpdate() +{ + if (m_Initialized == false) + return false; + + PK_SCOPEDPROFILE(); + + AEGP_SuiteHandler suites(m_Suites); + AEGP_EffectSuite4 *effectSuite = suites.EffectSuite4(); + A_Err result = A_Err_NONE; + bool updateEmitterPanel = false; + + if (effectSuite == null) + return false; + + CAELog::ClearIOData(); + FetchAEProject(); + + CString compositionName; + + GetMostRecentCompName(compositionName); + if (m_MostRecentCompName != compositionName) + { + if (m_Panel) + m_Panel->UpdateScenesModel(); + m_MostRecentCompName = compositionName; + } + for (s32 l = m_Layers.Count() - 1; l >= 0; --l) + { + SLayerHolder &layer = *m_Layers[l]; + + if (!layer.m_LayerLock.TryLock()) + continue; + + A_long count = 0; + u32 emitterCount = 0; + + if (layer.m_SpawnedEmitter.m_Desc != null) + { + result = effectSuite->AEGP_GetLayerNumEffects(layer.m_EffectLayer, &count); + if (result != A_Err_NONE) + { + CLog::Log(PK_INFO, "AEGP_GetLayerNumEffects failed"); + layer.m_LayerLock.Unlock(); + continue; + } + + //Start the fuckery to handle Layer deletion + AEGP_CompH compH; + AEGP_LayerIDVal layerID; + AEGP_LayerH layerFromComp; + result = suites.LayerSuite5()->AEGP_GetLayerParentComp(layer.m_EffectLayer, &compH); + if (result != A_Err_NONE) + { + CLog::Log(PK_INFO, "AEGP_GetLayerNumEffects failed"); + layer.m_LayerLock.Unlock(); + continue; + } + result = suites.LayerSuite7()->AEGP_GetLayerID(layer.m_EffectLayer, &layerID); + result = suites.LayerSuite7()->AEGP_GetLayerFromLayerID(compH, layerID, &layerFromComp); + if (result != A_Err_NONE) //Layer is deleted but still on the undo stack + { + updateEmitterPanel = layer.m_Deleted != true ? true : updateEmitterPanel; + layer.m_Deleted = true; + } + else + { + updateEmitterPanel = layer.m_Deleted != false ? true : updateEmitterPanel; + layer.m_Deleted = false; + } + + for (A_long j = count - 1; j >= 0; --j) + { + AEGP_EffectRefH effectRef = null; + AEGP_InstalledEffectKey installedKey; + + result = suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(m_AEGPID, layer.m_EffectLayer, j, &effectRef); + result = suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(effectRef, &installedKey); + + if (!PK_VERIFY(result == A_Err_NONE)) + { + CLog::Log(PK_INFO, "AEGP_GetLayerEffectByIndex failed"); + layer.m_LayerLock.Unlock(); + continue; + } + if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::ATTRIBUTE]) + { + } + else if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::EMITTER]) + { + emitterCount += 1; + if (layer.m_ForceRender) + { + layer.m_ForceRender = false; + if (!InvalidateEmitterRender(&layer, effectRef)) + { + layer.m_LayerLock.Unlock(); + return false; + } + } + } + result = suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + if (emitterCount == 0) + { + layer.Clear(m_Suites); + m_Layers.RemoveElement(&layer); + layer.m_LayerLock.Unlock(); + PK_DELETE(&layer); + updateEmitterPanel = true; + continue; + } + } + if (_ExecClearAttributes(&layer) != 0) //Clear attribute did work, give time to AE to reorder internals. + { + layer.m_LayerLock.Unlock(); + continue; + } + + if (_ExecSPendingEmitters(&layer) < 0) + { + updateEmitterPanel = true; + layer.m_LayerLock.Unlock(); + continue; + } + + if (_ExecSPendingAttributes(&layer) < 0) + { + layer.m_LayerLock.Unlock(); + continue; + } + + layer.m_LayerLock.Unlock(); + } + { + PK_SCOPEDLOCK(m_UIEventLock); + for (u32 i = 0; i < m_UIEvents.Count(); ++i) + { + SUIEvent *event = m_UIEvents[i]; + + event->Exec(); + PK_DELETE(event); + } + m_UIEvents.Clear(); + } + if (m_Panel != null) + { + if (updateEmitterPanel) + m_Panel->UpdateScenesModel(); + } +#if defined(PK_MACOSX) + if (m_Panel != null) + m_Panel->IdleUpdate(); +#endif + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::HandleNewEmitterEvent(AAePk::SAAEIOData &AAEData, SEmitterDesc *desc) +{ + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + AEGP_LayerH layerH; + A_long dstID = 0, existingID; + s32 existingLayerID = -1; + + FetchAEProject(); + PK_SCOPEDLOCK(m_Lock); + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + result |= suites.LayerSuite8()->AEGP_GetLayerID(layerH, &dstID); + + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + + for (u32 i = 0; i < m_Layers.Count(); ++i) + { + result |= suites.LayerSuite8()->AEGP_GetLayerID(m_Layers[i]->m_EffectLayer, &existingID); + if (dstID == existingID) + { + existingLayerID = i; + break; + } + } + SLayerHolder *layerHolder = null; + + if (existingLayerID >= 0) + { + layerHolder = m_Layers[existingLayerID]; + layerHolder->m_Scene->Quit(); + layerHolder->m_Scene = null; + } + else + { + layerHolder = PK_NEW(SLayerHolder); + if (!PK_VERIFY(m_Layers.PushBack(layerHolder).Valid())) + return false; + existingLayerID = m_Layers.Count() - 1; + } + if (!PK_VERIFY(layerHolder != null)) + return false; + + layerHolder->m_EffectLayer = layerH; + layerHolder->ID = existingLayerID; + + if (!SetLayerName(layerHolder)) + return false; + if (!SetLayerCompName(layerHolder)) + return false; + CreateLayerPropertyIFP(layerHolder); + + layerHolder->m_Scene = PK_NEW(CAAEScene); + if (!PK_VERIFY(layerHolder->m_Scene != null)) + return false; + layerHolder->m_Scene->SetLayerHolder(layerHolder); + layerHolder->m_ViewMatrix = CFloat4x4::IDENTITY; + layerHolder->m_CameraPos = CFloat4::ZERO; + layerHolder->m_CurrentTime = AAEData.m_InData->current_time; + layerHolder->m_TimeScale = AAEData.m_InData->time_scale; + layerHolder->m_TimeStep = AAEData.m_InData->local_time_step; + + if (layerHolder->m_Scene->Init(AAEData) == false) + return false; + layerHolder->m_Scene->SetEffectDescriptor(desc); + if (layerHolder->m_SpawnedEmitter.m_Desc != null) + { + layerHolder->m_SpawnedEmitter.m_EffectHandle = AAEData.m_InData->effect_ref; + layerHolder->m_SpawnedEmitter.m_Desc = desc; + } + else + { + if (!layerHolder->m_SPendingEmitters.PushBack(SPendingEmitter{ AAEData.m_InData->effect_ref, desc }).Valid()) + return false; + } + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::HandleDeleteEmitterEvent(AAePk::SAAEIOData &AAEData, SEmitterDesc *desc) +{ + (void)AAEData; + + SLayerHolder *layer = GetLayerForSEmitterDesc(desc); + + if (layer) + { + layer->Clear(m_Suites); + + u32 idx = m_Layers.IndexOf(layer); + m_Layers.Remove(idx); + + PK_DELETE(layer); + if (m_Panel != null) + m_Panel->UpdateScenesModel(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::HandleNewAttributeEvent(PF_ProgPtr &effectRef, SAttributeDesc *desc, bool asyncMerge /*= true*/, SLayerHolder *layer /*=null*/) +{ + (void)asyncMerge; + AEGP_SuiteHandler suites(m_Suites); + + PK_SCOPEDLOCK(m_Lock); + + if (layer == null) + { + PK_ASSERT(false); + return false; + } + if (layer != null) + { + CStringId id = GetAttributeID(desc); + if (layer->m_SpawnedAttributes.Contains(id)) + { + SPendingAttribute *attr = layer->m_SpawnedAttributes[id]; + attr->m_ParentEffectPtr = effectRef; + + if (attr->m_Desc != null) + { + *(attr->m_Desc) = *desc; + delete (desc); + } + else + { + attr->m_Desc = desc; + } + } + else //Not yet spawned in AE, must do an async merge due to SDK limitations. + { + if (!PK_VERIFY(layer->m_SPendingAttributes.PushBack(SPendingAttribute(effectRef, desc, null)).Valid())) + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::HandleNewAttributeSamplerEvent(PF_ProgPtr &effectRef, SAttributeSamplerDesc *desc, bool asyncMerge, SLayerHolder *layer) +{ + (void)asyncMerge; + AEGP_SuiteHandler suites(m_Suites); + + PK_SCOPEDLOCK(m_Lock); + + if (layer == null) + { + PK_ASSERT(false); + return false; + } + + if (layer != null) + { + CStringId id = GetAttributeID(desc); + if (layer->m_SpawnedAttributesSampler.Contains(id)) + { + SPendingAttribute *attr = layer->m_SpawnedAttributesSampler[id]; + attr->m_ParentEffectPtr = effectRef; + if (attr->m_Desc != null) + { + SAttributeSamplerDesc *descriptor = static_cast(attr->m_Desc); + if (descriptor->m_Descriptor != null) + { + delete(descriptor->m_Descriptor); + descriptor->m_Descriptor = null; + attr->m_Desc->m_IsDeleted = true; + } + *(static_cast(attr->m_Desc)) = *(static_cast(desc)); + delete (desc); + } + else + { + attr->m_Desc = desc; + } + } + else //Not yet spawned in AE, must do an async merge due to SDK limitations. + { + if (!PK_VERIFY(layer->m_SPendingAttributes.PushBack(SPendingAttribute(effectRef, desc, null)).Valid())) + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::HandleNewAttributes(TArray &attributes, PF_ProgPtr &effectRef, SLayerHolder *layer, bool asyncMerge) +{ + for (u32 i = 0; i < attributes.Count(); ++i) + { + attributes[i]->m_Order = attributes.Count() - i - 1; + if (attributes[i]->m_IsAttribute == true) + HandleNewAttributeEvent(effectRef, static_cast(attributes[i]), asyncMerge, layer); + else + HandleNewAttributeSamplerEvent(effectRef, static_cast(attributes[i]), asyncMerge, layer); + + } + return true; +} + +//---------------------------------------------------------------------------- + +SLayerHolder *CPopcornFXWorld::GetLayerForSEmitterDesc(SEmitterDesc *desc) +{ + return GetLayerForSEmitterDescID(CStringId(desc->m_UUID.c_str())); +} + +//---------------------------------------------------------------------------- + +SLayerHolder *CPopcornFXWorld::GetLayerForSEmitterDescID(CStringId id) +{ + for (u32 i = 0; i < m_Layers.Count(); ++i) + { + SLayerHolder &layer = *m_Layers[i]; + if (layer.m_SpawnedEmitter.m_Desc && CStringId(layer.m_SpawnedEmitter.m_Desc->m_UUID.c_str()) == id) + { + return &layer; + } + } + return null; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::CheckEmitterValidity(AAePk::SAAEIOData &AAEData, AAePk::SEmitterDesc *descriptor) +{ + (void)AAEData; + SLayerHolder *layer = GetLayerForSEmitterDesc(descriptor); + + if (layer == null) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::UpdateScene(SAAEIOData &AAEData, SEmitterDesc *desc) +{ + PK_SCOPEDPROFILE(); + if (!InitializeIFN(AAEData)) + return false; + if (m_Layers.Count() == 0) + return true; + if (!PopcornFX::CCurrentThread::IsRegistered()) + { + if (!m_AAETreadID.PushBack(PopcornFX::CCurrentThread::RegisterUserThread()).Valid()) + return false; + } + + SLayerHolder *layer = GetLayerForSEmitterDesc(desc); + AEGP_SuiteHandler suites(m_Suites); + PF_Err result = A_Err_NONE; + A_Time AETime; + + if (layer == null) + return true; + + PK_SCOPEDLOCK(layer->m_LayerLock); + + layer->m_CurrentTime = AAEData.m_InData->current_time; + layer->m_TimeScale = AAEData.m_InData->time_scale; + //Sync Params with current frame + result |= suites.PFInterfaceSuite1()->AEGP_ConvertEffectToCompTime(AAEData.m_InData->effect_ref, layer->m_CurrentTime, layer->m_TimeScale, &AETime); + + AEGP_LayerH cameraLayer = null; + + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectCamera(AAEData.m_InData->effect_ref, &AETime, &cameraLayer); + layer->m_CameraLayer = cameraLayer; + if (desc->m_Name.empty()) + return true; + + A_long dstID = 0; + result |= suites.LayerSuite8()->AEGP_GetLayerID(layer->m_EffectLayer, &dstID); + +#if 1 // Fix for copy paste break everything... + + if (desc->m_LayerID != dstID) + { + AEGP_LayerH layerH = null; + result |= suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(AAEData.m_InData->effect_ref, &layerH); + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + + if (layerH != null) + { + desc->m_LayerID = dstID; + layer->m_EffectLayer = layerH; + + A_long count = 0; + result |= suites.EffectSuite4()->AEGP_GetLayerNumEffects(layer->m_EffectLayer, &count); + + for (A_long j = count - 1; j >= 0; --j) + { + bool disposeEffect = true; + AEGP_EffectRefH effectRef = null; + AEGP_InstalledEffectKey installedKey; + + result |= suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(m_AEGPID, layer->m_EffectLayer, j, &effectRef); + result |= suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(effectRef, &installedKey); + + if (!PK_VERIFY(result == A_Err_NONE)) + { + return false; + } + if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::ATTRIBUTE]) + { + CStringId id = GetAttributeID(effectRef); + if (layer->m_SpawnedAttributes.Contains(id)) + { + SPendingAttribute *attribute = layer->m_SpawnedAttributes[id]; + + result |= suites.EffectSuite4()->AEGP_DisposeEffect(attribute->m_AttributeEffectRef); + attribute->m_AttributeEffectRef = effectRef; + disposeEffect = false; + } + } + else if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::SAMPLER]) + { + CStringId id = GetAttributeSamplerID(effectRef); + if (layer->m_SpawnedAttributesSampler.Contains(id)) + { + SPendingAttribute *sampler = layer->m_SpawnedAttributesSampler[id]; + + result |= suites.EffectSuite4()->AEGP_DisposeEffect(sampler->m_AttributeEffectRef); + sampler->m_AttributeEffectRef = effectRef; + disposeEffect = false; + } + } + else if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::EMITTER]) + { + if (m_Panel) + { + m_Panel->UpdateScenesModel(); + } + } + if (disposeEffect) + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + } + } +#endif + layer->m_SpawnedEmitter.m_EffectHandle = AAEData.m_InData->effect_ref; + +#if TEST_COLOR_PROFILE & 0 + AEGP_CompH compH; + AEGP_ColorProfileP colorProfile; + A_FpShort gamma; + + result |= suites.LayerSuite5()->AEGP_GetLayerParentComp(layer->m_EffectLayer, &compH); + result |= suites.ColorSettingsSuite2()->AEGP_GetNewWorkingSpaceColorProfile(m_AEGPID, compH, &colorProfile); + result |= suites.ColorSettingsSuite2()->AEGP_GetColorProfileApproximateGamma(colorProfile, &gamma); + + //AEGP_MemHandle iccProfile = null; + //result |= suites.ColorSettingsSuite2()->AEGP_GetNewICCProfileFromColorProfile(m_AEGPID, colorProfile, &iccProfile); + //result |= suites.MemorySuite1()->AEGP_FreeMemHandle(iccProfile); + result |= suites.ColorSettingsSuite2()->AEGP_DisposeColorProfile(colorProfile); + +#endif + PAAEScene scene = layer->m_Scene; + + scene->SetLayerHolder(layer); +#if defined (PK_SCALE_DOWN) + layer->m_ScaleFactor = desc->m_ScaleFactor; +#endif + scene->UpdateLight(layer); + scene->UpdateBackdrop(layer, desc); + { + PK_SCOPEDLOCK(GetRenderLock()); + scene->Update(AAEData); + if (AAEData.m_ReturnCode == A_Err_NONE) + { + scene->Render(AAEData); + } + } + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::UpdateEmitter(SAAEIOData &AAEData, SEmitterDesc *desc) +{ + (void)AAEData; + (void)desc; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::InvalidateEmitterRender(SLayerHolder *layer , AEGP_EffectRefH effectRef) +{ + if (layer == null) + return false; + + A_Err result = A_Err_NONE; + + AEGP_SuiteHandler suites(m_Suites); + AEGP_StreamRefH streamRef = null; + + A_Time AETime; + + AETime.scale = layer->m_TimeScale; + AETime.value = 0; + + result |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AEGPID, effectRef, CAEUpdater::s_EmitterIndexes[Effect_Parameters_Refresh_Render], &streamRef); + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + + AEGP_StreamValue value; + + result |= suites.StreamSuite2()->AEGP_GetNewStreamValue(m_AEGPID, streamRef, AEGP_LTimeMode_LayerTime, &AETime, TRUE, &value); + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + + value.val.one_d = (int)(value.val.one_d + 1) % 100; + + result |= suites.StreamSuite2()->AEGP_SetStreamValue(m_AEGPID, streamRef, &value); + result |= suites.StreamSuite2()->AEGP_DisposeStream(streamRef); + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::InvalidateEmitterRender(SAAEIOData &AAEData, SEmitterDesc *desc) +{ + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + AEGP_EffectRefH effectRef = null; + + result = suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AEGPID, AAEData.m_InData->effect_ref, &effectRef); + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + bool ret = InvalidateEmitterRender(GetLayerForSEmitterDesc(desc) , effectRef); + + result = suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return ret; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::LaunchEditorAsPopup(AAePk::SAAEIOData &AAEData, SEmitterDesc *desc) +{ + (void)AAEData; + (void)desc; + return CSystemHelper::LaunchEditorAsPopup(); +} + +//---------------------------------------------------------------------------- + +A_Err CPopcornFXWorld::DeathHook(AEGP_GlobalRefcon pluginRefCon, AEGP_DeathRefcon refCon) +{ + (void)refCon; + (void)pluginRefCon; + + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + const A_u_char *commandName = (const A_u_char*)"PopcornFX"; + A_Err result = PF_Err_NONE; + SuiteHelper panelSuite(instance.m_Suites); + + result |= panelSuite->AEGP_UnRegisterCreatePanelHook(commandName); + + instance.ShutdownIFN(); + + if (!PK_VERIFY(result == A_Err_NONE)) + return result; + return result; +} + +//---------------------------------------------------------------------------- + +A_Err CPopcornFXWorld::IdleHook(AEGP_GlobalRefcon pluginRefCon, AEGP_IdleRefcon refCon, A_long *maxSleep) +{ + (void)maxSleep; + (void)refCon; + (void)pluginRefCon; + + A_Err err = A_Err_NONE; + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + + instance.IdleUpdate(); + return err; +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::CreatePanel(AEGP_PlatformViewRef container, AEGP_PanelH panelH, AEGP_PanelFunctions1 *outFunctionTable, AEGP_PanelRefcon *outRefcon) +{ + (void)container; + (void)panelH; + (void)outFunctionTable; + (void)outRefcon; + + CPanelBaseGUI *panel = CPanelBaseGUI::GetInstance(); + + panel->CreatePanel(m_Suites, panelH, container, outFunctionTable); + *outRefcon = reinterpret_cast(panel); +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::Command( AEGP_Command command, + AEGP_HookPriority hookPriority, + A_Boolean alreadyHandled, + A_Boolean *handledP) +{ + (void)handledP; + (void)alreadyHandled; + (void)hookPriority; + + if (command == m_Command) + { + SuiteHelper panelSuites(m_Suites); + + A_Boolean shown = false; + A_Boolean topLevel = false; + + panelSuites->AEGP_IsShown((const A_u_char*)m_CommandName.Data(), &shown, &topLevel); + if (!shown || !topLevel) + panelSuites->AEGP_ToggleVisibility((const A_u_char*)m_CommandName.Data()); + *handledP = true; + } +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::UpdateMenu(AEGP_WindowType activeWindow) +{ + (void)activeWindow; + + SuiteHelper panelSuites(m_Suites); + AEGP_SuiteHandler suites(m_Suites); + + suites.CommandSuite1()->AEGP_EnableCommand(m_Command); + + A_Boolean thumbIsShown = false; + A_Boolean panelIsFront = false; + + panelSuites->AEGP_IsShown((const A_u_char*)m_CommandName.Data(), &thumbIsShown, &panelIsFront); + suites.CommandSuite1()->AEGP_CheckMarkMenuCommand(m_Command, thumbIsShown && panelIsFront); +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::ClearAttributesAndSamplers(SLayerHolder *layer) +{ + PK_ASSERT(layer != null); + + AEGP_SuiteHandler suites(m_Suites); + + for (auto it = layer->m_SpawnedAttributes.Begin(); it != layer->m_SpawnedAttributes.End(); ++it) + { + layer->m_DeletedAttributes.Insert(it.Key(), *it); + it->m_AttributeEffectRef = null; + } + layer->m_SpawnedAttributes.Clear(); + for (auto it = layer->m_SpawnedAttributesSampler.Begin(); it != layer->m_SpawnedAttributesSampler.End(); ++it) + { + layer->m_DeletedAttributesSampler.Insert(it.Key(), *it); + it->m_AttributeEffectRef = null; + } + layer->m_SpawnedAttributesSampler.Clear(); +} + +//---------------------------------------------------------------------------- + +CStringId CPopcornFXWorld::GetAEEffectID(AEGP_EffectRefH &effect, s32 paramIdx) +{ + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + AEGP_StreamRefH streamRef = null; + AEGP_MemHandle nameHandle; + + result |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AEGPID, effect, paramIdx, &streamRef); + if (!PK_VERIFY(result == A_Err_NONE)) + return CStringId::Null; + + result |= suites.StreamSuite5()->AEGP_GetStreamName(m_AEGPID, streamRef, false, &nameHandle); + if (!PK_VERIFY(result == A_Err_NONE)) + return CStringId::Null; + result |= suites.StreamSuite2()->AEGP_DisposeStream(streamRef); + if (!PK_VERIFY(result == A_Err_NONE)) + return CStringId::Null; + streamRef = null; + + aechar_t *wname; + CString name; + + result |= suites.MemorySuite1()->AEGP_LockMemHandle(nameHandle, reinterpret_cast(&wname)); + if (!PK_VERIFY(result == A_Err_NONE)) + return CStringId::Null; + WCharToCString(wname, &name); + + result |= suites.MemorySuite1()->AEGP_UnlockMemHandle(nameHandle); + result |= suites.MemorySuite1()->AEGP_FreeMemHandle(nameHandle); + + if (!PK_VERIFY(result == A_Err_NONE)) + return CStringId::Null; + if (!PK_VERIFY(name.Length() != 0)) + return CStringId::Null; + return CStringId(name.Data()); +} + +//---------------------------------------------------------------------------- + +CStringId CPopcornFXWorld::GetAttributeID(AEGP_EffectRefH &effect) +{ + return GetAEEffectID(effect, Attribute_Parameters_Infernal_Name); +} + +//---------------------------------------------------------------------------- + +CStringId CPopcornFXWorld::GetAttributeSamplerID(AEGP_EffectRefH &effect) +{ + return GetAEEffectID(effect, AttributeSamplerType_Parameters_Infernal_Name); +} + +//---------------------------------------------------------------------------- + +CStringId CPopcornFXWorld::GetAttributeID(SAttributeBaseDesc *desc) +{ + return CStringId(desc->GetAttributePKKey().data()); +} + +//---------------------------------------------------------------------------- + +s32 CPopcornFXWorld::_ExecSPendingEmitters(SLayerHolder *layer) +{ + PK_SCOPEDPROFILE(); + s32 emittersCount = 0; + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + + for (s32 i = layer->m_SPendingEmitters.Count() - 1; i >= 0; --i) + { + A_long count; + SPendingEmitter &emitter = layer->m_SPendingEmitters[i]; + AEGP_LayerFlags flags = AEGP_LayerFlag_NONE; + + result |= suites.LayerSuite8()->AEGP_GetLayerFlags(layer->m_EffectLayer, &flags); + if ((flags & AEGP_LayerFlag_LOCKED) != AEGP_LayerFlag_NONE) + continue; + + result |= suites.EffectSuite4()->AEGP_GetLayerNumEffects(layer->m_EffectLayer, &count); + + for (A_long j = count - 1; j >= 0; --j) + { + AEGP_EffectRefH effectRef = null; + AEGP_InstalledEffectKey installedKey; + PAAEScene scene = layer->m_Scene; + A_Time fake_timeT = { 0, 100 }; + bool releaseEffectHandle = true; + + result |= suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(m_AEGPID, layer->m_EffectLayer, j, &effectRef); + result |= suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(effectRef, &installedKey); + + if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::EMITTER]) + { + if (_SetupAutoRender(effectRef) == false) + return -1; + + layer->m_SpawnedEmitter = emitter; + scene->SetEmitterTeleport(); + scene->SetEmitterPosition(AAEToPK(emitter.m_Desc->m_Position), emitter.m_Desc->m_TransformType); + scene->SetEmitterRotation(AngleAAEToPK(emitter.m_Desc->m_Rotation)); + + if (!emitter.m_Desc->m_PathSource.empty()) + SetDestinationPackFromPath(*layer, CString(emitter.m_Desc->m_PathSource.c_str())); + + bool forceRefresh = false; + if (!emitter.m_Desc->m_PathSource.empty()) + { + CString sourcePackPath(emitter.m_Desc->m_PathSource.data()); + if (!CFilePath::IsAbsolute(emitter.m_Desc->m_PathSource.data())) + sourcePackPath = m_AEProjectPath / sourcePackPath; + + CFilePath::Purify(sourcePackPath); + CProjectSettingsFinder walker(sourcePackPath); + walker.Walk(); + + CString effectName = emitter.m_Desc->m_Name.data(); + if (!m_VaultHandler.LoadEffectIntoVault(sourcePackPath, effectName, walker.ProjectSettingsPath(), forceRefresh)) + return false; + emitter.m_Desc->m_Name = effectName.Data(); + } + scene->RefreshAssetList(); + scene->SetLayerHolder(layer); + scene->SetPack(layer->m_BakedPack, forceRefresh); + scene->SetSelectedEffect(CString(emitter.m_Desc->m_Name.c_str()), forceRefresh); + result |= suites.EffectSuite4()->AEGP_EffectCallGeneric(m_AEGPID, effectRef, &fake_timeT, PF_Cmd_COMPLETELY_GENERAL, emitter.m_Desc); + + SGetEmitterInfos infos; + + result |= suites.EffectSuite4()->AEGP_EffectCallGeneric(m_AEGPID, effectRef, &fake_timeT, PF_Cmd_COMPLETELY_GENERAL, &infos); + + CLog::Log(PK_INFO, "%s", infos.m_PathSource); + } + if (releaseEffectHandle) + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + ++emittersCount; + } + layer->m_SPendingEmitters.Clear(); + + if (!PK_VERIFY(result == A_Err_NONE)) + return -1; + return emittersCount; +} + +//---------------------------------------------------------------------------- + +s32 CPopcornFXWorld::_ExecClearAttributes(SLayerHolder *layer) +{ + PK_SCOPEDPROFILE(); + s32 count = 0; + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + A_long effectCount = 0; + + PK_ASSERT(layer->m_EffectLayer != null); + + result |= suites.EffectSuite4()->AEGP_GetLayerNumEffects(layer->m_EffectLayer, &effectCount); + + for (A_long j = effectCount - 1; j >= 0; --j) + { + AEGP_EffectRefH effectRef = null; + AEGP_InstalledEffectKey installedKey; + + result |= suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(m_AEGPID, layer->m_EffectLayer, j, &effectRef); + result |= suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(effectRef, &installedKey); + + if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::ATTRIBUTE]) + { + CStringId id = GetAttributeID(effectRef); + + if (layer->m_DeletedAttributes.Contains(id)) + { + SPendingAttribute *attr = layer->m_DeletedAttributes[id]; + + if (!_ExecDeleteAttribute(attr, effectRef)) + result |= A_Err_GENERIC; + ++count; + } + else if (layer->m_SpawnedAttributes.Contains(id)) + { + SPendingAttribute *attr = layer->m_SpawnedAttributes[id]; + + if (attr->m_Deleted) + { + if (!_ExecDeleteAttribute(attr, effectRef)) + result |= A_Err_GENERIC; + layer->m_SpawnedAttributes.Remove(id); + } + } + } + else if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::SAMPLER]) + { + CStringId id = GetAttributeSamplerID(effectRef); + + if (layer->m_DeletedAttributesSampler.Contains(id)) + { + SPendingAttribute *attr = layer->m_DeletedAttributesSampler[id]; + + if (!_ExecDeleteAttributeSampler(attr, effectRef)) + result |= A_Err_GENERIC; + ++count; + } + else if (layer->m_SpawnedAttributesSampler.Contains(id)) + { + SPendingAttribute *attr = layer->m_SpawnedAttributesSampler[id]; + + if (attr->m_Deleted) + { + if (!_ExecDeleteAttributeSampler(attr, effectRef)) + result |= A_Err_GENERIC; + layer->m_SpawnedAttributesSampler.Remove(id); + } + } + } + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + layer->m_DeletedAttributes.Clear(); + layer->m_DeletedAttributesSampler.Clear(); + + if (!PK_VERIFY(result == A_Err_NONE)) + return -1; + return count; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::_ExecDeleteAttribute(SPendingAttribute *attribute, AEGP_EffectRefH &effectRef) +{ + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + + if (attribute->m_Desc) + attribute->m_Desc->m_IsDeleted = true; + + if (attribute->m_AttributeEffectRef != null) + { + A_Time fake_timeT = { 0, 100 }; + result |= suites.EffectSuite4()->AEGP_EffectCallGeneric(m_AEGPID, attribute->m_AttributeEffectRef, &fake_timeT, PF_Cmd_COMPLETELY_GENERAL, attribute->m_Desc); + result |= suites.EffectSuite4()->AEGP_DisposeEffect(attribute->m_AttributeEffectRef); + attribute->m_AttributeEffectRef = null; + } + result |= suites.EffectSuite4()->AEGP_DeleteLayerEffect(effectRef); + + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return result == A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::_ExecDeleteAttributeSampler(SPendingAttribute *attribute, AEGP_EffectRefH &effectRef) +{ + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + + if (attribute->m_Desc) + attribute->m_Desc->m_IsDeleted = true; + + if (attribute->m_AttributeEffectRef != null) + { + A_Time fake_timeT = { 0, 100 }; + result |= suites.EffectSuite4()->AEGP_EffectCallGeneric(m_AEGPID, attribute->m_AttributeEffectRef, &fake_timeT, PF_Cmd_COMPLETELY_GENERAL, attribute->m_Desc); + result |= suites.EffectSuite4()->AEGP_DisposeEffect(attribute->m_AttributeEffectRef); + attribute->m_AttributeEffectRef = null; + PK_SAFE_DELETE(attribute->m_PKDesc); + } + result |= suites.EffectSuite4()->AEGP_DeleteLayerEffect(effectRef); + + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return result == A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +s32 CPopcornFXWorld::_ExecSPendingAttributes(SLayerHolder *layer) +{ + PK_SCOPEDPROFILE(); + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + A_Time fake_timeT = { 0, 100 }; + u32 spawned = 0; + + PK_ASSERT(layer != null); + + for (s32 i = layer->m_SPendingAttributes.Count() - 1; i >= 0 ; --i) + { + SPendingAttribute &attribute = layer->m_SPendingAttributes[i]; + CStringId id = GetAttributeID(layer->m_SPendingAttributes[i].m_Desc); + A_long count; + bool allreadySpawned = false; + + result |= suites.EffectSuite4()->AEGP_GetLayerNumEffects(layer->m_EffectLayer, &count); + + for (A_long j = count - 1; j >= 0; --j) + { + AEGP_EffectRefH attributeRef = null; + AEGP_InstalledEffectKey installedKey; + PAAEScene scene = layer->m_Scene; + + result |= suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(m_AEGPID, layer->m_EffectLayer, j, &attributeRef); + result |= suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(attributeRef, &installedKey); + + if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::ATTRIBUTE]) + { + CStringId spawnedID = GetAttributeID(attributeRef); + + if (spawnedID.ToString() == "AttributeName") //Default value, leave time to after effects to get its thing together. + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(attributeRef); + return 0; + } + if (spawnedID == id) + { + attribute.m_AttributeEffectRef = attributeRef; + + if (layer->m_SpawnedAttributes.Contains(id)) + { + if (layer->m_SpawnedAttributes[id]->m_AttributeEffectRef) + result |= suites.EffectSuite4()->AEGP_DisposeEffect(attributeRef); + if (layer->m_SpawnedAttributes[id]->m_Desc) + delete layer->m_SpawnedAttributes[id]->m_Desc; + layer->m_SpawnedAttributes[id]->m_Desc = attribute.m_Desc; + } + else + layer->m_SpawnedAttributes.Insert(id, attribute); + layer->m_SPendingAttributes[i].m_AttributeEffectRef = null; + PK_ASSERT(attribute.m_Desc != null); + + result |= suites.EffectSuite4()->AEGP_EffectCallGeneric(m_AEGPID, layer->m_SpawnedAttributes[id]->m_AttributeEffectRef, &fake_timeT, PF_Cmd_COMPLETELY_GENERAL, attribute.m_Desc); + + layer->m_SPendingAttributes.Remove(i); + allreadySpawned = true; + break; + } + } + else if (installedKey == m_PKInstalledPluginKeys[EPKChildPlugins::SAMPLER]) + { + CStringId spawnedID = GetAttributeSamplerID(attributeRef); + + if (spawnedID.ToString() == "AttributeSamplerName") //Default value, leave time to after effects to get it's thing together. + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(attributeRef); + return 0; + } + if (spawnedID == id) + { + attribute.m_AttributeEffectRef = attributeRef; + + if (layer->m_SpawnedAttributesSampler.Contains(id)) + { + if (layer->m_SpawnedAttributesSampler[id]->m_AttributeEffectRef) + result |= suites.EffectSuite4()->AEGP_DisposeEffect(attributeRef); + if (layer->m_SpawnedAttributesSampler[id]->m_Desc) + delete layer->m_SpawnedAttributesSampler[id]->m_Desc; + layer->m_SpawnedAttributesSampler[id]->m_Desc = attribute.m_Desc; + } + else + layer->m_SpawnedAttributesSampler.Insert(id, attribute); + layer->m_SPendingAttributes[i].m_AttributeEffectRef = null; + + PK_ASSERT(attribute.m_Desc != null); + + result |= suites.EffectSuite4()->AEGP_EffectCallGeneric(m_AEGPID, layer->m_SpawnedAttributesSampler[id]->m_AttributeEffectRef, &fake_timeT, PF_Cmd_COMPLETELY_GENERAL, attribute.m_Desc); + allreadySpawned = true; + layer->m_SPendingAttributes.Remove(i); + break; + } + } + result |= suites.EffectSuite4()->AEGP_DisposeEffect(attributeRef); + } + if (allreadySpawned) + continue; + + + if ((attribute.m_Desc->m_IsAttribute && layer->m_SpawnedAttributes.Contains(id)) || + (!attribute.m_Desc->m_IsAttribute && layer->m_SpawnedAttributesSampler.Contains(id))) + continue; + + AEGP_EffectRefH effectRef = null; + + AEGP_LayerFlags flags = AEGP_LayerFlag_NONE; + result |= suites.LayerSuite8()->AEGP_GetLayerFlags(layer->m_EffectLayer, &flags); + + if (attribute.m_Desc->m_IsAttribute) + result |= suites.EffectSuite4()->AEGP_ApplyEffect(m_AEGPID, layer->m_EffectLayer, m_PKInstalledPluginKeys[EPKChildPlugins::ATTRIBUTE], &effectRef); + else + result |= suites.EffectSuite4()->AEGP_ApplyEffect(m_AEGPID, layer->m_EffectLayer, m_PKInstalledPluginKeys[EPKChildPlugins::SAMPLER], &effectRef); + if (result != A_Err_NONE || effectRef == null) + return count; + result |= suites.EffectSuite4()->AEGP_ReorderEffect(effectRef, layer->m_SPendingAttributes[i].m_Desc->m_Order); + result |= suites.EffectSuite4()->AEGP_EffectCallGeneric(m_AEGPID, effectRef, &fake_timeT, PF_Cmd_COMPLETELY_GENERAL, layer->m_SPendingAttributes[i].m_Desc); + attribute.m_AttributeEffectRef = effectRef; + + if (attribute.m_Desc->m_IsAttribute) + layer->m_SpawnedAttributes.Insert(id, attribute); + else + layer->m_SpawnedAttributesSampler.Insert(id, attribute); + attribute.m_AttributeEffectRef = null; + spawned += 1; + } +#if _DEBUG + for (u32 i = 0; i < layer->m_SPendingAttributes.Count(); ++i) + { + PK_ASSERT(!layer->m_SPendingAttributes[i].m_AttributeEffectRef); + } +#endif + layer->m_SPendingAttributes.Clear(); + + if (!PK_VERIFY(result == A_Err_NONE)) + return -1; + return spawned; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::_SetupAutoRender(AEGP_EffectRefH &effect) +{ + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + AEGP_StreamRefH streamRef = null; + AEGP_AddKeyframesInfoH KeyFrameOperationHandle; + A_Time start, end; + A_long outIndex; + AEGP_StreamValue2 keyValue; + + result |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AEGPID, effect, CAEUpdater::s_EmitterIndexes[Effect_Parameters_Infernal_Autorender], &streamRef); + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + start.value = 0; + start.scale = 1; + PK_TODO("Handle Max time correctly"); + end.value = 1000; + end.scale = 1; + + result |= suites.KeyframeSuite4()->AEGP_StartAddKeyframes(streamRef, &KeyFrameOperationHandle); + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + if (KeyFrameOperationHandle) + { + //Start + result |= suites.KeyframeSuite4()->AEGP_AddKeyframes(KeyFrameOperationHandle, AEGP_LTimeMode_CompTime, &start, &outIndex); + //End + result |= suites.KeyframeSuite4()->AEGP_AddKeyframes(KeyFrameOperationHandle, AEGP_LTimeMode_CompTime, &end, &outIndex); + result |= suites.KeyframeSuite4()->AEGP_EndAddKeyframes(true, KeyFrameOperationHandle); + } + keyValue.streamH = streamRef; + keyValue.val.one_d = 0; + result |= suites.KeyframeSuite4()->AEGP_SetKeyframeValue(streamRef, 0, &keyValue); + keyValue.val.one_d = 1000; + result |= suites.KeyframeSuite4()->AEGP_SetKeyframeValue(streamRef, 1, &keyValue); + result |= suites.StreamSuite2()->AEGP_DisposeStream(streamRef); + streamRef = null; + if (!PK_VERIFY(result == A_Err_NONE)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetDestinationPackFromPath(SLayerHolder &layer, const CString &packPath) +{ + if (packPath.Empty()) + return false; + CString absolutePath = packPath; + if (!CFilePath::IsAbsolute(packPath)) + { + absolutePath = m_AEProjectPath / absolutePath; + CFilePath::Purify(absolutePath); + } + + layer.m_BakedPack = m_VaultHandler.GetVaultPackFromPath(absolutePath); + PK_ASSERT(layer.m_BakedPack != null); + return true; +} + +//---------------------------------------------------------------------------- + +CString CPopcornFXWorld::GetInternalPackPath() +{ + return GetResourcesPath() + "PopcornFXInternals"; +} + +//---------------------------------------------------------------------------- + +CString CPopcornFXWorld::GetResourcesPath() +{ +#if defined(PK_WINDOWS) + return GetPluginInstallationPath(); +#elif defined(PK_MACOSX) + return GetPluginInstallationPath() + "AE_GeneralPlugin.plugin/Contents/Resources/"; +#endif +} + +//---------------------------------------------------------------------------- + +CString CPopcornFXWorld::GetPluginVersion() const +{ + CString version = PK_VERSION_CURRENT_STRING; + return version; +} + +//---------------------------------------------------------------------------- + +AEGP_InstalledEffectKey CPopcornFXWorld::GetPluginEffectKey(EPKChildPlugins type) const +{ + return m_PKInstalledPluginKeys[type]; +} + +//---------------------------------------------------------------------------- + +CString CPopcornFXWorld::GetPluginInstallationPath() +{ + return m_AEPath / "Plug-ins/PopcornFX/"; +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::RefreshAssetList() +{ + for (u32 i = 0; i < m_Layers.Count(); ++i) + { + PAAEScene scene = m_Layers[i]->m_Scene; + scene->RefreshAssetList(); + } +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetSelectedEffectFromPath(SEmitterDesc *desc, CString path, bool forceReload) +{ + CFilePath::Purify(path); + + //Doesn't work with absolute path + //if (!CFilePath::IsValidPath(path)) + // return false; + + CString root = CFilePath::StripFilename(path); + CString pkprojPath = ""; + + if (!CFilePath::IsAbsolute(root)) + { + root = m_AEProjectPath / root; + CFilePath::Purify(root); + } + if (!CFilePath::IsAbsolute(path)) + { + path = m_AEProjectPath / path; + CFilePath::Purify(path); + } + + while (root != "") + { + CProjectSettingsFinder walker(root); + + walker.Walk(); + + if (!walker.ProjectSettingsPath().Empty()) + { + pkprojPath = walker.ProjectSettingsPath(); + + root = CFilePath::StripFilename(pkprojPath); + CLog::Log(PK_INFO, "Pkproj found"); + break; + } + CFilePath::StripFilenameInPlace(root); + } + if (!root.Empty()) + { + CString effectPath; + + effectPath = CFilePath::Relativize(root.Data(), path.Data()); + + TArray unload; + bool needUnload = true; + for (u32 i = 0; i < m_Layers.Count(); ++i) + { + if (m_Layers[i]->m_SpawnedEmitter.m_Desc == null) + continue; + if (effectPath.Compare(m_Layers[i]->m_SpawnedEmitter.m_Desc->m_Name.c_str(), CaseInsensitive) == true) + { + if (!PK_VERIFY(unload.PushBack(m_Layers[i]).Valid())) + return false; + PK_SCOPEDLOCK(m_Layers[i]->m_LayerLock); + needUnload = m_Layers[i]->m_Scene->ResetEffect(needUnload); + } + } + PK_ASSERT(effectPath != null); + bool needRefresh = forceReload; + if (!m_VaultHandler.LoadEffectIntoVault(root, effectPath, pkprojPath, needRefresh)) + return false; + + CString pathDest = (m_VaultHandler.VaultPathCache() / CFilePath::ExtractFilename(root)).Data(); + + for (u32 i = 0; i < unload.Count(); ++i) + { + SLayerHolder *layer = unload[i]; + + if (layer != null) + { + CString relativeSrcPath = CFilePath::Relativize(m_AEProjectPath.Data(), root.Data()); + + desc->m_PathSource = !relativeSrcPath.Empty() ? relativeSrcPath.Data() : root.Data(); + desc->m_ReloadEffect = forceReload; + SetSelectedEffect(layer, effectPath); + } + } + SLayerHolder *layer = GetLayerForSEmitterDesc(desc); + if (layer != null && !unload.Contains(layer)) + { + if (layer != null) + { + CString relativeSrcPath = CFilePath::Relativize(m_AEProjectPath.Data(), root.Data()); + + desc->m_PathSource = !relativeSrcPath.Empty() ? relativeSrcPath.Data() : root.Data(); + desc->m_ReloadEffect = forceReload; + SetSelectedEffect(layer, effectPath); + } + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetSelectedEffectAsync(SLayerHolder *targetLayer, CString &name) +{ + PK_ASSERT(targetLayer != null); + + PK_SCOPEDLOCK(m_UIEventLock); + + SUIEventString *event = PK_NEW(SUIEventString); + + event->m_TargetLayer = targetLayer; + event->m_Cb = FastDelegate(this, &CPopcornFXWorld::SetSelectedEffect); + event->m_Data = name; + + return m_UIEvents.PushBack(event).Valid(); +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetEffectDefaultTransform(SLayerHolder *layer, const CFloat3 &position, const CFloat3 &rotation) +{ + (void)rotation; + if (layer == null) + return false; + + AEGP_SuiteHandler suites(m_Suites); + A_Err result = A_Err_NONE; + A_Time time; + + time.value = 0; + time.scale = layer->m_TimeScale; + + A_long effectCount = 0; + result |= suites.EffectSuite4()->AEGP_GetLayerNumEffects(layer->m_EffectLayer, &effectCount); + + for (A_long j = effectCount - 1; j >= 0; --j) + { + AEGP_EffectRefH effectRef = null; + AEGP_InstalledEffectKey installedKey; + + result |= suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(m_AEGPID, layer->m_EffectLayer, j, &effectRef); + result |= suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(effectRef, &installedKey); + + if (installedKey == GetPluginEffectKey(EPKChildPlugins::EMITTER)) + { + CFloat4x4 viewMatrix; + CFloat4 cameraPos; + float cameraZoom = 0.f; + + CAEUpdater::GetCameraViewMatrixAtTime(layer, viewMatrix, cameraPos, time, cameraZoom); + + CFloat3 forward = viewMatrix.Inverse().StrippedZAxis().Normalized(); + + CFloat3 emitterPos = cameraPos.xyz() + forward * position.Length(); + + AEGP_StreamRefH streamPos = null; + result |= suites.StreamSuite5()->AEGP_GetNewEffectStreamByIndex(m_AEGPID, effectRef, CAEUpdater::s_EmitterIndexes[Effect_Parameters_Position], &streamPos); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE || streamPos == null) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return false; + } + AEGP_StreamValue2 value; + result |= suites.StreamSuite5()->AEGP_GetNewStreamValue(m_AEGPID, streamPos, AEGP_LTimeMode_LayerTime, &time, false, &value); + if (result != A_Err_NONE) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return false; + } + value.val.three_d.x = emitterPos.x(); + value.val.three_d.y = emitterPos.y(); + value.val.three_d.z = emitterPos.z(); + result |= suites.StreamSuite5()->AEGP_SetStreamValue(m_AEGPID, streamPos, &value); + if (result != A_Err_NONE) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return false; + } + result |= suites.StreamSuite5()->AEGP_DisposeStreamValue(&value); + result |= suites.StreamSuite5()->AEGP_DisposeStream(streamPos); + } + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + + } + return true; +} + + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetBackdropMeshDefaultTransform(SLayerHolder *layer) +{ + if (layer == null) + return false; + + AEGP_SuiteHandler suites(m_Suites); + A_Err result = A_Err_NONE; + A_Time time; + + time.value = 0; + time.scale = layer->m_TimeScale; + + A_long effectCount = 0; + result |= suites.EffectSuite4()->AEGP_GetLayerNumEffects(layer->m_EffectLayer, &effectCount); + + for (A_long j = effectCount - 1; j >= 0; --j) + { + AEGP_EffectRefH effectRef = null; + AEGP_InstalledEffectKey installedKey; + + result |= suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(m_AEGPID, layer->m_EffectLayer, j, &effectRef); + result |= suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(effectRef, &installedKey); + + if (installedKey == GetPluginEffectKey(EPKChildPlugins::EMITTER)) + { + A_FloatPoint3 emitterPos = layer->m_SpawnedEmitter.m_Desc->m_Position; + + AEGP_StreamRefH streamPos = null; + result |= suites.StreamSuite5()->AEGP_GetNewEffectStreamByIndex(m_AEGPID, effectRef, CAEUpdater::s_EmitterIndexes[Effect_Parameters_BackdropMesh_Position], &streamPos); + PK_ASSERT(result == A_Err_NONE); + if (result != A_Err_NONE || streamPos == null) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return false; + } + AEGP_StreamValue2 value; + result |= suites.StreamSuite5()->AEGP_GetNewStreamValue(m_AEGPID, streamPos, AEGP_LTimeMode_LayerTime, &time, false, &value); + if (result != A_Err_NONE) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return false; + } + value.val.three_d.x = emitterPos.x; + value.val.three_d.y = emitterPos.y; + value.val.three_d.z = emitterPos.z; + result |= suites.StreamSuite5()->AEGP_SetStreamValue(m_AEGPID, streamPos, &value); + if (result != A_Err_NONE) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + return false; + } + result |= suites.StreamSuite5()->AEGP_DisposeStreamValue(&value); + result |= suites.StreamSuite5()->AEGP_DisposeStream(streamPos); + } + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetSelectedEffect(SLayerHolder *layer, CString &fileName) +{ + if (layer != null) + { + PK_SCOPEDLOCK(layer->m_LayerLock); + SEmitterDesc *desc = layer->m_SpawnedEmitter.m_Desc; + CString name = CFilePath::StripExtension(fileName); + if (desc) + { + bool setTransform = false; + CString oldName = CFilePath::StripExtension(CString(desc->m_Name.c_str())); + if (!name.Compare(oldName)) + { + setTransform = true; + ClearAttributesAndSamplers(layer); + if (layer->m_LayerProperty != null) + { + CLayerProperty::_TypeOfRendererProperties overrides = layer->m_LayerProperty->RendererProperties(); + + overrides.Clear(); + layer->m_LayerProperty->SetRendererProperties(overrides); + } + } + + SetDestinationPackFromPath(*layer, layer->m_SpawnedEmitter.m_Desc->m_PathSource.data()); + if (!layer->m_Scene->SetPack(layer->m_BakedPack, desc->m_ReloadEffect)) + return false; + + //Set Default Effect position according to the Editor + { + //Load Editor information into the effect + if (setTransform) + { + IFileSystem *fileSystem = File::DefaultFileSystem(); + CString pkboPath = layer->m_BakedPack->Path() / name + ".pkbo"; + u32 rawFileSize = 0; + u8 *rawFileBuffer = fileSystem->Bufferize(pkboPath, &rawFileSize, true); + if (rawFileBuffer != null) + { + CConstMemoryStream memoryFileView(rawFileBuffer, rawFileSize); + + PBaseObjectFile pkboFile = layer->m_Scene->GetContext()->LoadFileFromStream(memoryFileView, pkboPath); + PEditorAssetEffect editorProp = pkboFile->FindFirstOf(); + + CFloat3 emitterDefaultPosition = -editorProp->StartCameraPosition(); + CFloat3 emitterDefaultOrientation = -editorProp->StartCameraOrientation(); + + SetEffectDefaultTransform(layer, emitterDefaultPosition, emitterDefaultOrientation); + } + } + } + + + if (!layer->m_Scene->SetSelectedEffect(fileName, desc->m_ReloadEffect)) + return false; + + desc->m_Name = fileName.Data(); + desc->m_Update = true; + return true; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +// - OpenGL resources are restricted per thread, mimicking the OGL driver +// - The filter will eliminate all TLS (Thread Local Storage) at PF_Cmd_GLOBAL_SETDOWN +PAAERenderContext CPopcornFXWorld::GetCurrentRenderContext() +{ + // Lazy init: + if (s_AAEThreadRenderContexts == null) + { + s_AAEThreadRenderContexts = PK_NEW(CAAERenderContext); + s_ShaderLoader = PK_NEW(PKSample::CShaderLoader); + + if (!PK_VERIFY(s_AAEThreadRenderContexts != null && s_ShaderLoader != null)) + return null; + + s_AAEThreadRenderContexts->SetShaderLoader(s_ShaderLoader); + + if (!PK_VERIFY(s_AAEThreadRenderContexts->InitializeIFN(GetRenderApi(), CString::Format("PopcornFXRendering")))) + return null; + } + return s_AAEThreadRenderContexts; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetPanelInstance(CPanelBaseGUI *panel) +{ + m_Panel = panel; + return true; +} + +//---------------------------------------------------------------------------- + +A_Err CPopcornFXWorld::CreatePanelHook( AEGP_GlobalRefcon pluginRefconP, + AEGP_CreatePanelRefcon refconP, + AEGP_PlatformViewRef container, + AEGP_PanelH panelH, + AEGP_PanelFunctions1 *outFunctionTable, + AEGP_PanelRefcon *outRefcon) +{ + (void)pluginRefconP; + (void)refconP; + + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + + instance.CreatePanel(container, panelH, outFunctionTable, outRefcon); + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +A_Err CPopcornFXWorld::CommandHook( AEGP_GlobalRefcon plugin_refconP, + AEGP_CommandRefcon refconP, + AEGP_Command command, + AEGP_HookPriority hook_priority, + A_Boolean already_handledB, + A_Boolean *handledPB) +{ + (void)refconP; + (void)plugin_refconP; + + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + + instance.Command(command, hook_priority, already_handledB, handledPB); + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +A_Err CPopcornFXWorld::UpdateMenuHook(AEGP_GlobalRefcon pluginRefconP, + AEGP_UpdateMenuRefcon refconP, + AEGP_WindowType activeWindow) +{ + (void)refconP; + (void)pluginRefconP; + + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + + instance.UpdateMenu(activeWindow); + return A_Err_NONE; +} + +//---------------------------------------------------------------------------- + +void CPopcornFXWorld::OnEndSetupScene() +{ + if (m_Panel) + { + m_Panel->UpdateScenesModel(); + } +} + +const PBaseObjectFile &CPopcornFXWorld::GetProjectConfFile() +{ + return m_ProjectConfFile; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::GetMostRecentCompName(CString &compName) +{ + AEGP_SuiteHandler suites(m_Suites); + AEGP_CompH compH = null; + AEGP_ItemH itemH = null; + AEGP_MemHandle memH = null; + aechar_t *compositionNameAE = null; + CString compositionName = ""; + PF_Err result = A_Err_NONE; + result |= suites.CompSuite11()->AEGP_GetMostRecentlyUsedComp(&compH); + if (result != A_Err_NONE) + return false; + if (compH != null) + { + result |= suites.CompSuite11()->AEGP_GetItemFromComp(compH, &itemH); + if (result != A_Err_NONE) + return false; + result |= suites.ItemSuite9()->AEGP_GetItemName(m_AEGPID, itemH, &memH); + + result |= suites.MemorySuite1()->AEGP_LockMemHandle(memH, reinterpret_cast(&compositionNameAE)); + + WCharToCString(compositionNameAE, &compositionName); + + result |= suites.MemorySuite1()->AEGP_UnlockMemHandle(memH); + result |= suites.MemorySuite1()->AEGP_FreeMemHandle(memH); + + compName = compositionName; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetLayerName(SLayerHolder *layer) +{ + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + AEGP_ItemH itemH = null; + AEGP_MemHandle memH = null; + aechar_t *layerNameAE = null; + CString layerName = ""; + + result |= suites.LayerSuite8()->AEGP_GetLayerSourceItem(layer->m_EffectLayer, &itemH); + if (result != A_Err_NONE) + return false; + + result |= suites.ItemSuite9()->AEGP_GetItemName(m_AEGPID, itemH, &memH); + if (result != A_Err_NONE) + return false; + + result |= suites.MemorySuite1()->AEGP_LockMemHandle(memH, reinterpret_cast(&layerNameAE)); + if (result != A_Err_NONE) + return false; + + WCharToCString(layerNameAE, &layerName); + + result |= suites.MemorySuite1()->AEGP_UnlockMemHandle(memH); + if (result != A_Err_NONE) + return false; + result |= suites.MemorySuite1()->AEGP_FreeMemHandle(memH); + if (result != A_Err_NONE) + return false; + + layer->m_LayerName = layerName; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetLayerCompName(SLayerHolder *layer) +{ + A_Err result = A_Err_NONE; + AEGP_SuiteHandler suites(m_Suites); + AEGP_CompH compH = null; + AEGP_ItemH itemH = null; + AEGP_MemHandle memH = null; + aechar_t *compositionNameAE = null; + CString compositionName = ""; + result |= suites.LayerSuite5()->AEGP_GetLayerParentComp(layer->m_EffectLayer, &compH); + if (result != A_Err_NONE) + return false; + result |= suites.CompSuite11()->AEGP_GetItemFromComp(compH, &itemH); + if (result != A_Err_NONE) + return false; + result |= suites.ItemSuite9()->AEGP_GetItemName(m_AEGPID, itemH, &memH); + if (result != A_Err_NONE) + return false; + result |= suites.MemorySuite1()->AEGP_LockMemHandle(memH, reinterpret_cast(&compositionNameAE)); + if (result != A_Err_NONE) + return false; + WCharToCString(compositionNameAE, &compositionName); + + result |= suites.MemorySuite1()->AEGP_UnlockMemHandle(memH); + if (result != A_Err_NONE) + return false; + result |= suites.MemorySuite1()->AEGP_FreeMemHandle(memH); + if (result != A_Err_NONE) + return false; + layer->m_CompositionName = compositionName; + if (m_MostRecentCompName != compositionName) + { + if (m_Panel) + m_Panel->UpdateScenesModel(); + m_MostRecentCompName = compositionName; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::CreateLayerPropertyIFP(SLayerHolder *layer) +{ + if (m_ProjectProperty == null) + return false; + + // Go through all objects in file: + for (const auto &obj : m_ProjectProperty->LayerProperties()) + { + if (obj->ID() == layer->ID && + obj->CompName() == layer->m_CompositionName) + layer->m_LayerProperty = obj.Get(); + + } + if (layer->m_LayerProperty == null) + { + CAEPProjectProperties::_TypeOfLayerProperties LayerProps = m_ProjectProperty->LayerProperties(); + PLayerProperty prop = m_ProjectProperty->File()->Context()->NewObject(m_ProjectConfFile.Get()); + + if (!LayerProps.PushBack(prop).Valid()) + return false; + layer->m_LayerProperty = prop; + + prop->SetCompName(layer->m_CompositionName); // Useless ? + prop->SetID(layer->ID); + + m_ProjectProperty->SetLayerProperties(LayerProps); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::SetResourceOverride(CStringId layerID, u32 rdrID, u32 propID, const CString &value) +{ + IFileSystem *fileSystem = File::DefaultFileSystem(); + SLayerHolder *layerHolder = GetLayerForSEmitterDescID(layerID); + + if (layerHolder == null || layerHolder->m_LayerProperty == null) + return false; + + PK_SCOPEDLOCK(layerHolder->m_LayerLock); + CLayerProperty::_TypeOfRendererProperties overrides = layerHolder->m_LayerProperty->RendererProperties(); + CGraphicOverride *existingOverride = null; + bool updated = false; + for (const auto &entry : overrides) + { + if (entry->RendererID() == rdrID && entry->PropertyID() == propID) + { + existingOverride = entry.Get(); + if (value.Empty()) + { + overrides.RemoveElementFromRawPointerInArray_AndKeepOrder(&entry); + layerHolder->m_LayerProperty->SetRendererProperties(overrides); + updated = true; + } + break; + } + } + + if (!value.Empty()) + { + AEGPPk::SResourceBakeConfig bakeConfig; + bakeConfig.m_StraightCopy = true; + CString virtualPath = fileSystem->PhysicalToVirtual(value); + if (virtualPath == null) //Not in loaded packs, bake into resources folder + { + virtualPath = fileSystem->PhysicalToVirtual(GetVaultHandler().BakeResource(value, bakeConfig)); + } + if (existingOverride != null) + { + if (!existingOverride->Value().Compare(virtualPath)) + { + existingOverride->SetValue(virtualPath); + updated = true; + } + } + else + { + PGraphicOverride prop = m_ProjectProperty->File()->Context()->NewObject(m_ProjectConfFile.Get()); + + prop->SetRendererID(rdrID); + prop->SetPropertyID(propID); + prop->SetValue(virtualPath); + + if (!overrides.PushBack(prop).Valid()) + return false; + + layerHolder->m_LayerProperty->SetRendererProperties(overrides); + updated = true; + } + } + if (updated) + { + layerHolder->m_ForceRender = true; + WriteProjectFileModification(); + layerHolder->m_Scene->SetupScene(true, true); + + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPopcornFXWorld::WriteProjectFileModification() +{ + if (m_ProjectConfFile == null) + return false; + IFileSystem *fs = File::DefaultFileSystem(); + + if (fs->Exists(m_AEProjectPath, true)) + { + if (!PK_VERIFY(HBO::g_Context->WriteFile(m_ProjectConfFile.Get(), m_ProjectConfFile->Path()))) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/AE_GeneralPlugin.plugin-Info.plist b/AE_GeneralPlugin/Sources/AE_GeneralPlugin.plugin-Info.plist new file mode 100644 index 00000000..129eef34 --- /dev/null +++ b/AE_GeneralPlugin/Sources/AE_GeneralPlugin.plugin-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleExecutable + Main + CFBundleIdentifier + com.PersistantStudio.PopcornFX.Main + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + AE_GeneralPlugin + CFBundlePackageType + AEgx + CFBundleSignature + FXTC + LSRequiresCarbon + + NSAppleScriptEnabled + No + NSHumanReadableCopyright + © PersistantStudio PopcornFX + + diff --git a/AE_GeneralPlugin/Sources/AE_GeneralPlugin_PiPL.r b/AE_GeneralPlugin/Sources/AE_GeneralPlugin_PiPL.r new file mode 100644 index 00000000..bb8ce5ab --- /dev/null +++ b/AE_GeneralPlugin/Sources/AE_GeneralPlugin_PiPL.r @@ -0,0 +1,41 @@ +#include "AEConfig.h" +#include "AE_EffectVers.h" + +#ifndef AE_OS_WIN + #include +#endif + +resource 'PiPL' (16000) { + { /* array properties: 7 elements */ + /* [1] */ + Kind { + AEGP + }, + /* [2] */ + Name { + "PopcornFX" + }, + /* [3] */ + Category { + "Particle Plugin" + }, + /* [4] */ + Version { + 65536 + }, + /* [5] */ +#ifdef AE_OS_WIN + #ifdef AE_PROC_INTELx64 + CodeWin64X86 {"EntryPointFunc"}, + #else + CodeWin32X86 {"EntryPointFunc"}, + #endif +#else + #ifdef AE_OS_MAC + CodeMachOPowerPC {"EntryPointFunc"}, + CodeMacIntel32 {"EntryPointFunc"}, + CodeMacIntel64 {"EntryPointFunc"}, + #endif +#endif + } +}; diff --git a/AE_GeneralPlugin/Sources/Panels/AEGP_GraphicalResourcesTreeModel.cpp b/AE_GeneralPlugin/Sources/Panels/AEGP_GraphicalResourcesTreeModel.cpp new file mode 100644 index 00000000..fa26bb72 --- /dev/null +++ b/AE_GeneralPlugin/Sources/Panels/AEGP_GraphicalResourcesTreeModel.cpp @@ -0,0 +1,931 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include + +#include "Panels/AEGP_GraphicalResourcesTreeModel.h" +#include "AEGP_World.h" +#include "AEGP_Scene.h" +#include "AEGP_LayerHolder.h" +#include "AEGP_AEPKConversion.h" + +#include + +#include + +//---------------------------------------------------------------------------- + +__AEGP_PK_BEGIN + +const QSize kGraphicResourceThumbSize = QSize(35, 35); +const QSize kResetButtonSize = QSize(16, 16); + +//---------------------------------------------------------------------------- + +CGraphicResetButtonView::CGraphicResetButtonView() +{ + m_Pixmap = QPixmap(":/icons/reset.png"); +} + +//---------------------------------------------------------------------------- + +void CGraphicResetButtonView::paint(QPainter *painter, const QRect &rect, const QPalette &palette, bool hover) const +{ + (void)palette; + (void)hover; + const QRect displayRect = QRect(QPoint(rect.x(), rect.y()), sizeHint()).adjusted(1, 1, -1, -1); + painter->drawPixmap(displayRect, m_Pixmap); +} + +//---------------------------------------------------------------------------- + +QSize CGraphicResetButtonView::sizeHint() const +{ + return kResetButtonSize + QSize(2, 2); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +CGraphicResourceView::CGraphicResourceView() + : m_Type(CGraphicResourceView::ViewType::ViewType_Effect) +{ + +} + +//---------------------------------------------------------------------------- + +CGraphicResourceView::CGraphicResourceView(CGraphicResourceView::ViewType type) + : m_Type(type) +{ + +} + +//---------------------------------------------------------------------------- + +CGraphicResourceView::CGraphicResourceView(CGraphicResourceView::ViewType type, const QPixmap &pixmap) + : m_Type(type) + , m_Pixmap(pixmap) +{ + +} + +//---------------------------------------------------------------------------- + +static s32 _Align(s32 v, s32 alignment) +{ + return v - v % alignment; +} + +//---------------------------------------------------------------------------- + +static void _DrawCheckerboard( QPainter &painter, const QRect &displayRect, const QRect &visibleRect, + const QColor &baseColor, const QColor &alternateColor, s32 patternSize) +{ + PK_ASSERT(patternSize > 0); + const s32 offsetX = displayRect.left(); + const s32 offsetY = displayRect.top(); + for (s32 py = visibleRect.top(), stopY = visibleRect.bottom(); py <= stopY; ) + { + const s32 startY = py; + const s32 endY = PKMin(stopY + 1, _Align(startY - offsetY + patternSize, patternSize) + offsetY); + for (s32 px = visibleRect.left(), stopX = visibleRect.right(); px <= stopX; ) + { + const s32 startX = px; + const s32 endX = PKMin(stopX + 1, _Align(startX - offsetX + patternSize, patternSize) + offsetX); + + const s32 tileIdX = (px - offsetX) / patternSize; + const s32 tileIdY = (py - offsetY) / patternSize; + const bool evenTile = ((tileIdX ^ tileIdY) & 1) != 0; + + const QRect tileRect(startX, startY, endX - startX, endY - startY); + const QColor tileColor = evenTile ? baseColor : alternateColor; + painter.fillRect(tileRect, tileColor); + + px = endX; + } + py = endY; + } +} + +void CGraphicResourceView::paint(QPainter *painter, const QRect &rect, const QPalette &palette, bool hover) const +{ + (void)palette; + + if (m_Type == ViewType::ViewType_PathResource) + { + if (hover) + { + QPixmap pix = QPixmap(sizeHint()); + pix.fill(QColor(255, 255, 255, 128)); + const QRect displayRect = QRect(QPoint(rect.x(), rect.y()), sizeHint()); + painter->drawPixmap(displayRect, pix); + } + + // Display a checkerboard background + const QColor chkColorA = QColor(0x30, 0x30, 0x30, 0xFF); + const QColor chkColorB = QColor(0x40, 0x40, 0x40, 0xFF); + const QRect displayRect = QRect(QPoint(rect.x(), rect.y()), sizeHint()).adjusted(1, 1, -1, -1); + const QRect visibleRect = displayRect & rect; + + _DrawCheckerboard(*painter, displayRect, visibleRect, chkColorA, chkColorB, 5); + + painter->drawPixmap(displayRect, m_Pixmap); + } +} + +//---------------------------------------------------------------------------- + +QSize CGraphicResourceView::sizeHint() const +{ + if (m_Type == ViewType::ViewType_PathResource) + return kGraphicResourceThumbSize + QSize(2, 2); + + return 0.1f/*PaintingScaleFactor*/ * QSize(1, 1); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +void CGraphicResourceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + if (index.data().canConvert()) + { + CGraphicResourceView item = qvariant_cast(index.data()); + item.paint(painter, option.rect, option.palette, option.state & QStyle::State_MouseOver); + } + if (index.data().canConvert()) + { + CGraphicResetButtonView item = qvariant_cast(index.data()); + item.paint(painter, option.rect, option.palette, option.state & QStyle::State_MouseOver); + } + else + { + //Remove Selected and MouseOver state for visual + QStyleOptionViewItem modifiedOption = option; + modifiedOption.state &= ~QStyle::State_Selected; + modifiedOption.state &= ~QStyle::State_MouseOver; + modifiedOption.state &= ~QStyle::State_HasFocus; + + QStyledItemDelegate::paint(painter, modifiedOption, index); + } +} + +//---------------------------------------------------------------------------- + +QSize CGraphicResourceDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + if (index.data().canConvert()) + { + CGraphicResourceView item = qvariant_cast(index.data()); + return item.sizeHint(); + } + return QStyledItemDelegate::sizeHint(option, index); +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem::CGraphicalResourcesTreeItem() + : m_ParentItem(null) +{ +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem::CGraphicalResourcesTreeItem(const QVector &data, CGraphicalResourcesTreeItem *parentItem) + : m_ItemData(data) + , m_ParentItem(parentItem) +{ +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem::~CGraphicalResourcesTreeItem() +{ + qDeleteAll(m_ChildItems); +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeItem::AppendChild(CGraphicalResourcesTreeItem *child) +{ + m_ChildItems.append(child); +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeItem::InsertChild(CGraphicalResourcesTreeItem *child, int index) +{ + m_ChildItems.insert(index, child); +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem *CGraphicalResourcesTreeItem::Child(int row) +{ + if (row < 0 || row >= m_ChildItems.size()) + return nullptr; + return m_ChildItems.at(row); +} + +//---------------------------------------------------------------------------- + +int CGraphicalResourcesTreeItem::ChildCount() const +{ + return m_ChildItems.count(); +} + +//---------------------------------------------------------------------------- + +int CGraphicalResourcesTreeItem::ColumnCount() const +{ + return m_ItemData.count(); +} + +//---------------------------------------------------------------------------- + +QVariant CGraphicalResourcesTreeItem::Data(int column) const +{ + //Crash on close + if (column < 0 || column >= m_ItemData.size()) + return QVariant(); + return m_ItemData.at(column); +} + +//---------------------------------------------------------------------------- + +int CGraphicalResourcesTreeItem::Row() const +{ + if (m_ParentItem) + return m_ParentItem->m_ChildItems.indexOf(const_cast(this)); // yuck, ugly + + return 0; +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem *CGraphicalResourcesTreeItem::ParentItem() +{ + return m_ParentItem; +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeItem::ClearChildren() +{ + qDeleteAll(m_ChildItems); + m_ChildItems.clear(); +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeItem::RemoveChild(int index) +{ + delete m_ChildItems[index]; + m_ChildItems.remove(index); +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeItem::RemoveChildren(int from, int count) +{ + for (int i = from; i < from + count; ++i) + delete m_ChildItems[i]; + m_ChildItems.remove(from, count); +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeItem::SetData(int column, const QVariant &data) +{ + if (column < 0 || column >= m_ItemData.size()) + return; + m_ItemData[column] = data; +} + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeModel::CGraphicalResourcesTreeModel(QObject *parent) + : QAbstractItemModel(parent) + , m_RootItem(null) +{ + m_RootItem = new CGraphicalResourcesTreeItem({ tr("Layer"), tr("Path"), QVariant::fromValue(CGraphicResourceView(CGraphicResourceView::ViewType::ViewType_Effect)), tr("") }); +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeModel::~CGraphicalResourcesTreeModel() +{ + if (m_RootItem) + delete m_RootItem; +} + +//---------------------------------------------------------------------------- + +QVariant CGraphicalResourcesTreeModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (role != Qt::DisplayRole) + return QVariant(); + + CGraphicalResourcesTreeItem *item = static_cast(index.internalPointer()); + + return item->Data(index.column()); +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem *CGraphicalResourcesTreeModel::Item(const QModelIndex &index) const +{ + if (!index.isValid()) + return null; + + CGraphicalResourcesTreeItem *item = static_cast(index.internalPointer()); + + return item; +} + +//---------------------------------------------------------------------------- + +QModelIndex CGraphicalResourcesTreeModel::Index(CGraphicalResourcesTreeItem *item) const +{ + if (item == m_RootItem) + return QModelIndex(); + + return index(item->Row(), 0, Index(item->ParentItem())); +} + +//---------------------------------------------------------------------------- + +Qt::ItemFlags CGraphicalResourcesTreeModel::flags(const QModelIndex &index) const +{ + if (!index.isValid()) + return Qt::NoItemFlags; + + return QAbstractItemModel::flags(index); +} + +//---------------------------------------------------------------------------- + +QVariant CGraphicalResourcesTreeModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) + return m_RootItem->Data(section); + + return QVariant(); +} + +//---------------------------------------------------------------------------- + +QModelIndex CGraphicalResourcesTreeModel::index(int row, int column, const QModelIndex &parent) const +{ + if (!hasIndex(row, column, parent)) + return QModelIndex(); + + CGraphicalResourcesTreeItem *parentItem; + + if (!parent.isValid()) + parentItem = m_RootItem; + else + parentItem = static_cast(parent.internalPointer()); + + CGraphicalResourcesTreeItem *childItem = parentItem->Child(row); + if (childItem) + return createIndex(row, column, childItem); + return QModelIndex(); +} + +//---------------------------------------------------------------------------- + +QModelIndex CGraphicalResourcesTreeModel::parent(const QModelIndex &index) const +{ + if (!index.isValid()) + return QModelIndex(); + + CGraphicalResourcesTreeItem *childItem = static_cast(index.internalPointer()); + if (childItem == m_RootItem) + return QModelIndex(); + + CGraphicalResourcesTreeItem *parentItem = childItem->ParentItem(); + + if (parentItem == m_RootItem) + return QModelIndex(); + + return createIndex(parentItem->Row(), 0, parentItem); +} + +//---------------------------------------------------------------------------- + +int CGraphicalResourcesTreeModel::rowCount(const QModelIndex &parent) const +{ + CGraphicalResourcesTreeItem *parentItem; + if (parent.column() > 0) + return 0; + + if (!parent.isValid()) + parentItem = m_RootItem; + else + parentItem = static_cast(parent.internalPointer()); + + return parentItem->ChildCount(); +} + +//---------------------------------------------------------------------------- + +int CGraphicalResourcesTreeModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return static_cast(parent.internalPointer())->ColumnCount(); + return m_RootItem->ColumnCount(); +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeModel::UpdateModel() +{ + if (m_RootItem == null) + return; + + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + CString compositionName = ""; + + if (!instance.GetMostRecentCompName(compositionName)) + return; + + const bool reset = compositionName != m_CompositionName; + + m_CompositionName = compositionName; + if (!reset) + _UpdateModel(); + else + _ResetModel(); +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeModel::_UpdateModel() +{ + _UnflagUpdated(m_RootItem); + + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + TArray &layers = instance.GetLayers(); + u32 effectCount = 0; + + for (u32 i = 0; i < layers.Count(); ++i) + { + PK_SCOPEDLOCK(layers[i]->m_LayerLock); + + if (layers[i]->m_Deleted == true) + continue; + if (layers[i]->m_SpawnedEmitter.m_Desc != null) + { + if (layers[i]->m_CompositionName != m_CompositionName) + continue; + + const QString layerName(layers[i]->m_LayerName.Data()); + const QString emitterName(layers[i]->m_SpawnedEmitter.m_Desc->m_Name.c_str()); + const CStringId emitterUID = CStringId(layers[i]->m_SpawnedEmitter.m_Desc->m_UUID.c_str()); + + if (emitterName.isEmpty()) + continue; + + // Find effect or create it + CGraphicalResourcesTreeItem *effect = _FindChild(m_RootItem, emitterUID.Id()); + + if (effect == null) + { + beginInsertRows(Index(m_RootItem), effectCount, effectCount); + effect = _CreateEffect(layerName, emitterName, emitterUID.Id()); + m_RootItem->InsertChild(effect, effectCount); + endInsertRows(); + } + else + { + // Update effect data + effect->SetData(0, layerName); + effect->SetData(1, emitterName); + } + effect->SetUpdated(true); + effectCount++; + + // Add properties + TArray &renderers = layers[i]->m_Scene->GetRenderers(); + THashMap effectLayers; + + for (u32 iRenderer = 0; iRenderer < renderers.Count(); ++iRenderer) + { + // Find effect layer or create it + const QString effectLayerName = renderers[iRenderer]->m_EffectLayerName.Data(); + const u32 effectLayerUID = renderers[iRenderer]->m_EffectLayerUID; + CGraphicalResourcesTreeItem *effectLayer = _FindChild(effect, effectLayerUID); + + if (effectLayer == null) + { + beginInsertRows(Index(effect), effectLayers.Count(), effectLayers.Count()); + effectLayer = _CreateEffectLayer(effectLayerName, effectLayerUID, effect); + effect->InsertChild(effectLayer, effectLayers.Count()); + endInsertRows(); + } + else + { + // Update effect layer data + effectLayer->SetData(0, effectLayerName); + } + effectLayer->SetUpdated(true); + + u32* propertyCount = effectLayers.Find(effectLayer); + if (propertyCount == null) + propertyCount = effectLayers.Insert(effectLayer, u32(0)); + + // Find renderer property or create it + const u32 propertyUID = renderers[iRenderer]->m_PropertyUID; + CGraphicalResourcesTreeItem *property = _FindChild(effectLayer, propertyUID); + + if (property == null) + { + beginInsertRows(Index(effectLayer), *propertyCount, *propertyCount); + property = _CreateRenderer(renderers[iRenderer], effectLayer); + effectLayer->InsertChild(property, *propertyCount); + endInsertRows(); + } + else + { + // Update property data + property->SetData(0, QString(renderers[iRenderer]->m_Name.Data())); + + const QString newPath = renderers[iRenderer]->m_Value.Data(); + if (property->Data(1) != newPath) + { + QPixmap pix; + if (!_LoadImageThumbnail(renderers[iRenderer]->m_Value, &pix)) + { + pix = QPixmap(kGraphicResourceThumbSize); + pix.fill(QColor(255, 0, 0, 128)); + + } + + property->SetData(1, newPath); + property->SetData(2, QVariant::fromValue(CGraphicResourceView(CGraphicResourceView::ViewType::ViewType_PathResource, pix))); + } + property->SetLayerID(renderers[iRenderer]->m_LayerID); + property->SetRendererID(renderers[iRenderer]->m_RendererUID); + } + property->SetUpdated(true); + *propertyCount++; + } + } + } + + _RemoveOldItems(m_RootItem); +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeModel::_ResetModel() +{ + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + TArray &layers = instance.GetLayers(); + + beginResetModel(); + + if (m_RootItem->ChildCount() != 0) + m_RootItem->ClearChildren(); + + for (u32 i = 0; i < layers.Count(); ++i) + { + PK_SCOPEDLOCK(layers[i]->m_LayerLock); + + if (layers[i]->m_SpawnedEmitter.m_Desc != null) + { + if (layers[i]->m_CompositionName != m_CompositionName) + continue; + + const QString layerName(layers[i]->m_LayerName.Data()); + const QString emitterName(layers[i]->m_SpawnedEmitter.m_Desc->m_Name.c_str()); + const CStringId emitterUID = CStringId(layers[i]->m_SpawnedEmitter.m_Desc->m_UUID.c_str()); + + if (emitterName.isEmpty()) + continue; + + CGraphicalResourcesTreeItem *effect = _CreateEffect(layerName, emitterName, emitterUID.Id()); + + m_RootItem->AppendChild(effect); + + TArray &renderers = layers[i]->m_Scene->GetRenderers(); + for (u32 iRenderer = 0; iRenderer < renderers.Count(); ++iRenderer) + { + const QString effectLayerName = renderers[iRenderer]->m_EffectLayerName.Data(); + const u32 effectLayerUID = renderers[iRenderer]->m_EffectLayerUID; + CGraphicalResourcesTreeItem *effectLayer = _FindChild(effect, effectLayerUID); + + if (effectLayer == null) + { + effectLayer = _CreateEffectLayer(effectLayerName, effectLayerUID, effect); + effect->AppendChild(effectLayer); + } + + CGraphicalResourcesTreeItem *rdr = _CreateRenderer(renderers[iRenderer], effectLayer); + effectLayer->AppendChild(rdr); + } + } + } + endResetModel(); + +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem *CGraphicalResourcesTreeModel::_CreateEffect(const QString &layerName, const QString &emitterName, u32 uid) +{ + QVector effectData; + effectData.append(layerName); + effectData.append(emitterName); + effectData.append(QVariant::fromValue(CGraphicResourceView(CGraphicResourceView::ViewType::ViewType_Effect))); + effectData.append(QString("")); + + CGraphicalResourcesTreeItem *effect = new CGraphicalResourcesTreeItem(effectData, m_RootItem); + + effect->SetID(uid); + + return effect; +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem *CGraphicalResourcesTreeModel::_CreateEffectLayer(const QString &layerName, u32 uid, CGraphicalResourcesTreeItem *effect) +{ + QVector effectData; + effectData.append(layerName); + effectData.append(QString("")); + effectData.append(QVariant::fromValue(CGraphicResourceView(CGraphicResourceView::ViewType::ViewType_Layer))); + effectData.append(QString("")); + + CGraphicalResourcesTreeItem *layer = new CGraphicalResourcesTreeItem(effectData, effect); + + layer->SetID(uid); + + return layer; +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem *CGraphicalResourcesTreeModel::_CreateRenderer(SRendererProperties *renderer, CGraphicalResourcesTreeItem *layer) +{ + QPixmap pix; + + if (!_LoadImageThumbnail(renderer->m_Value, &pix)) + { + pix = QPixmap(kGraphicResourceThumbSize); + pix.fill(QColor(255, 0, 0, 128)); + } + + QVector rdrData; + rdrData << QString(renderer->m_Name.Data()); + rdrData << QString(renderer->m_Value.Data()); + rdrData << QVariant::fromValue(CGraphicResourceView(CGraphicResourceView::ViewType::ViewType_PathResource, pix)); + rdrData << QVariant::fromValue(CGraphicResetButtonView()); + + CGraphicalResourcesTreeItem *rdr = new CGraphicalResourcesTreeItem(rdrData, layer); + + rdr->SetLayerID(renderer->m_LayerID); + rdr->SetRendererID(renderer->m_RendererUID); + rdr->SetID(renderer->m_PropertyUID); + + return rdr; +} + +//---------------------------------------------------------------------------- + +CGraphicalResourcesTreeItem *CGraphicalResourcesTreeModel::_FindChild(CGraphicalResourcesTreeItem *parent, u32 childId) +{ + for (int i = 0; i < parent->ChildCount(); ++i) + { + CGraphicalResourcesTreeItem *item = parent->Child(i); + if (item->GetID() == childId) + return item; + } + return null; +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeModel::_UnflagUpdated(CGraphicalResourcesTreeItem* parent) +{ + + for (int i = 0; i < parent->ChildCount(); ++i) + { + CGraphicalResourcesTreeItem *item = parent->Child(i); + item->SetUpdated(false); + _UnflagUpdated(item); + } +} + +//---------------------------------------------------------------------------- + +void CGraphicalResourcesTreeModel::_RemoveOldItems(CGraphicalResourcesTreeItem* parent) +{ + QModelIndex parentIndex = Index(parent); + + for (int i = 0; i < parent->ChildCount(); ) + { + CGraphicalResourcesTreeItem *item = parent->Child(i); + if (!item->GetUpdated()) + { + beginRemoveRows(parentIndex, i, i); + parent->RemoveChild(i); + endRemoveRows(); + } + else + { + _RemoveOldItems(item); + ++i; + } + } +} + +//---------------------------------------------------------------------------- + +bool CGraphicalResourcesTreeModel::_LoadImageThumbnail(const CString &path, QPixmap *outThumbnail) +{ + const float dpr = 1.0f;// : MaxDevicePixelRatio(); + const QSize size = kGraphicResourceThumbSize * dpr; + + CResourceManager *resourceManager = Resource::DefaultManager(); + + if (!PK_VERIFY(outThumbnail != null)) + return false; + + if (!resourceManager->FileController()->Exists(path, false)) + return false; + + PImage resource; + const TResourcePtr resourcePtr = resourceManager->Load(path, false, SResourceLoadCtl(false, true)); + if (resourcePtr == null || resourcePtr->Empty()) + return false; + resource = resourcePtr.operator->(); + + if (resource == null) + return false; + + PK_ASSERT(!resource->m_Frames.Empty()); + const CImageFrame &frame = resource->m_Frames.First(); + PK_ASSERT(!frame.m_Mipmaps.Empty()); + const CImageMap &map = frame.m_Mipmaps.First(); + + CImageSurface surface(map, resource->m_Format); + QImage::Format targetFormat; + + switch (surface.m_Format) + { + case CImage::Format_BGR8: + targetFormat = QImage::Format_RGB888; + break; + case CImage::Format_BGRA8: + targetFormat = QImage::Format_RGBA8888; + break; + default: + targetFormat = QImage::Format_RGBA8888; + if (!PK_VERIFY(surface.Convert(CImage::Format_BGRA8))) + return false; + break; + } + + // Note: we do this analysis & alpha-patching before downscaling, as Qt will + // trash the RGB colors when downscaling with an alpha set to zero, for some reason... + if (targetFormat == QImage::Format_RGBA8888) + { + bool isFullyTransparent = false; + { + CUbyte4 *texels = surface.m_RawBuffer->Data(); + const CUbyte4 *texelsStop = texels + surface.m_Dimensions.x() * surface.m_Dimensions.y(); + + SIMD::Float4 texelORx4 = SIMD::Float4::Zero(); + texelsStop -= 4; + while (texels <= texelsStop) + { + texelORx4 |= SIMD::Float4::LoadAligned16(texels); + texels += 4; + } + texelsStop += 4; + + const u32 texelOR32 = texelORx4.x().AsUint() | texelORx4.y().AsUint() | texelORx4.z().AsUint() | texelORx4.w().AsUint(); + CUbyte4 texelOR = *reinterpret_cast(&texelOR32); + while (texels < texelsStop) + { + texelOR |= *texels; + texels++; + } + + isFullyTransparent = (texelOR.w() == 0); + } + + // Fix #3945: Editor propertygrid: Some cubemaps do not show-up in asset-picker preview + // Fix #4133: Content browser: Some cubemap thumbnails do not appear + if (isFullyTransparent || + (resource->m_Flags & CImage::Flag_Cubemap)) + { + // When it's a cubemap, we're only displaying part of it, and in perhaps 99+% of cases, even if the + // image format has alpha, we don't want to display alpha. (envmaps, cubemap backdrops) + // And in practise there are quite a bit of cubemaps grabbed from the web that have a BGRA8 format + // with zero alpha. Here, for preview purposes & practical reasons, force the alpha channel to 0xFF: + + CUbyte4 *texels = surface.m_RawBuffer->Data(); + const CUbyte4 *texelsStop = texels + surface.m_Dimensions.x() * surface.m_Dimensions.y(); + + const SIMD::Float4 kFullAlpha = SIMD::Float4::FromConstInt<0xFF000000>(); + texelsStop -= 4; + while (texels <= texelsStop) + { + (SIMD::Float4::LoadAligned16(texels) | kFullAlpha).StoreAligned16(texels); + texels += 4; + } + texelsStop += 4; + while (texels < texelsStop) + { + texels->w() = 0xFF; + texels++; + } + } + } + + const CUint3 &dim = surface.m_Dimensions; + const u32 channelCount = CImage::GetFormatChannelCount(surface.m_Format); + if (!PK_VERIFY(QImage::toPixelFormat(targetFormat).channelCount() == channelCount) || + !PK_VERIFY(dim.AxialProduct() * channelCount * sizeof(uchar) <= surface.m_RawBuffer->DataSizeInBytes())) + return false; + + QImage dstImage; + if (PK_VERIFY(All(dim > CUint3(0)))) + { + const u32 bytesPerLine = dim.x() * channelCount; + QImage srcImage = QImage(surface.m_RawBuffer->Data(), dim.x(), dim.y(), bytesPerLine, targetFormat).rgbSwapped(); + + const u64 fixedPoint = dim.y() * u64(size.height()); + const u64 fixedPointRatioSrc = (dim.x() * fixedPoint) / dim.y(); + const u64 fixedPointRatioDst = (size.width() * fixedPoint) / size.height(); + + if (fixedPointRatioSrc == fixedPointRatioDst) + { + dstImage = srcImage.scaled(size.width(), size.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + } + else if (fixedPointRatioSrc != fixedPointRatioDst) + { + if (dim.y() == 1) + { + // We have a 1D texture, probably a gradient + dstImage = srcImage.scaled(size.width(), size.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + } + else + { + u32 dstPadW = 0; + u32 dstPadH = 0; + u32 dstW = 0; + u32 dstH = 0; + + // fixedPointRatioSrc > fixedPointRatioDst : pad along y (top & bottom) + // fixedPointRatioSrc < fixedPointRatioDst : pad along x (left & right) + + if (fixedPointRatioSrc > fixedPointRatioDst) + { + dstW = size.width(); // dim.x() * size.width() / dim.x(); + dstH = PKMax(1U, dim.y() * size.height() / dim.x()); + dstPadH = (size.height() - dstH) / 2; + } + else + { + dstW = PKMax(1U, dim.x() * size.width() / dim.y()); + dstH = size.height(); // dim.y() * size.height() / dim.y(); + dstPadW = (size.width() - dstW) / 2; + } + + // First do a smooth downscale. QPainter::drawImage() does a fast downscale. + // We want the higher quality box-scale for proper thumbnail display: + QImage scaledImage = srcImage.scaled(dstW, dstH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + + dstImage = QImage(size.width(), size.height(), srcImage.format()); + dstImage.fill(Qt::transparent); + + QPainter p(&dstImage); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.drawImage(QRect(dstPadW, dstPadH, dstW, dstH), scaledImage); + } + } + } + + *outThumbnail = QPixmap::fromImage(dstImage); + outThumbnail->setDevicePixelRatio(dpr); + + return true; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/Panels/AEGP_PanelQT.cpp b/AE_GeneralPlugin/Sources/Panels/AEGP_PanelQT.cpp new file mode 100644 index 00000000..71e60b95 --- /dev/null +++ b/AE_GeneralPlugin/Sources/Panels/AEGP_PanelQT.cpp @@ -0,0 +1,736 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include + +#include "Panels/AEGP_PanelQT.h" + +#include "RenderApi/AEGP_BaseContext.h" +#include "AEGP_RenderContext.h" + +#include "AEGP_World.h" +#include "AEGP_Scene.h" +#include "AEGP_PackExplorer.h" + +#include "AEGP_AssetBaker.h" + +#include "AEGP_Log.h" +//Suite +#include + +//AE +#include +#include + +#include +#include + +#include "Panels/AEGP_GraphicalResourcesTreeModel.h" +#include "AEGP_AEPKConversion.h" + +#include "AEGP_FileDialog.h" + +#if defined(PK_WINDOWS) +#include +#include +#endif + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +template +PK_FORCEINLINE void safe_delete(_Type * & ptr) +{ + if (ptr != null) + { + delete ptr; + ptr = null; + } +} + +//---------------------------------------------------------------------------- + +#if defined(PK_WINDOWS) +const char OSWndObjectProperty[] = "CPanelPopcornFX_PlatPtr"; +#endif + +CPanelBaseGUI *CPanelBaseGUI::m_Instance = null; + +//---------------------------------------------------------------------------- + +QPanelAppSignalSink::QPanelAppSignalSink(QApplication *app, QObject *parent) + : QObject(parent) + , m_App(app) +{ +} + +//---------------------------------------------------------------------------- + +void QPanelAppSignalSink::DoExit() +{ + m_App->exit(); +} + +//---------------------------------------------------------------------------- + +QPanel::QPanel(QPanelAppSignalSink* appSignal, QApplication *application, QObject *parent /*= null*/) + : QObject(parent) + , m_AppSignal(appSignal) + , m_App(application) +{ + m_TreeModel = new CGraphicalResourcesTreeModel(); + m_TreeModel->UpdateModel(); + + QObject::connect(appSignal, &QPanelAppSignalSink::OnWindowHandlerChanged, this, &QPanel::_SetWindow); + QObject::connect(appSignal, &QPanelAppSignalSink::OnWindowSizeChanged, this, &QPanel::_SetGeometry); + QObject::connect(appSignal, &QPanelAppSignalSink::OnRenderersChanged, this, &QPanel::_UpdateModel); +} + +//---------------------------------------------------------------------------- + +QPanel::~QPanel() +{ + safe_delete(m_TreeModel); + safe_delete(m_Widget); + safe_delete(m_Window); +} + +//---------------------------------------------------------------------------- + +void QPanel::_CreateWindowContent() +{ + QVBoxLayout *container = new QVBoxLayout(); + container->setMargin(0); + m_Widget->setLayout(container); + + QTabWidget *tab = new QTabWidget(); + container->addWidget(tab); + + QWidget *rendererTab = new QWidget(); + { + QVBoxLayout *layout = new QVBoxLayout(); + layout->setMargin(0); + + QTreeView *view = new QTreeView(); + + view->setItemDelegate(new CGraphicResourceDelegate()); + + // this line cause the error "QObject::~QObject: Timers cannot be stopped from another thread" when the application quit. + // this is a known issue + // see here : https://forum.qt.io/topic/128256/timers-cannot-be-stopped-from-a-different-thread/6 + // and here : https://lists.qt-project.org/pipermail/development/2021-May/041517.html + view->setModel(m_TreeModel); + view->setColumnWidth(2, 35); + + QObject::connect(view, &QTreeView::clicked, m_TreeModel, [this](const QModelIndex &index) + { + QModelIndex targetIndex; + targetIndex = index; + + QVariant variant = this->m_TreeModel->data(targetIndex, Qt::DisplayRole); + + if (variant.canConvert()) + { + CGraphicalResourcesTreeItem *item = this->m_TreeModel->Item(targetIndex); + CGraphicResourceView view = qvariant_cast(variant); + if (view.Type() == CGraphicResourceView::ViewType::ViewType_PathResource) + { + AEGPPk::SFileDialog cbData; + +#if !defined(PK_MACOSX) + // Filter *.* not working on MacOS + cbData.AddFilter("Image file (*.*)", "*.*"); +#endif + struct SFunctor + { + void Function(const CString path) + { + if (m_Item != null) + { + m_Item->SetData(1, QString(path.Data())); + + AEGPPk::CPopcornFXWorld &world = AEGPPk::CPopcornFXWorld::Instance(); + if (!world.SetResourceOverride(m_Item->GetLayerID(), m_Item->GetRendererID(), m_Item->GetID(), path)) + { + CLog::Log(PK_ERROR, "Set resource override failed"); + return; + } + } + } + + CGraphicalResourcesTreeItem* m_Item = null; + }; + + static SFunctor functor; + + functor.m_Item = item; + cbData.SetCallback(FastDelegate(&functor, &SFunctor::Function)); + + cbData.BasicFileOpen(); + } + } + else if (variant.canConvert()) + { + CGraphicalResourcesTreeItem *item = this->m_TreeModel->Item(targetIndex); + + AEGPPk::CPopcornFXWorld &world = AEGPPk::CPopcornFXWorld::Instance(); + world.SetResourceOverride(item->GetLayerID(), item->GetRendererID(), item->GetID(), ""); + } + }); + + layout->addWidget(view); + + rendererTab->setLayout(layout); + } + tab->addTab(rendererTab, "Renderers"); + + QWidget *settingsTab = new QWidget(tab); + { + QVBoxLayout *layout = new QVBoxLayout(); + + QGridLayout *Glayout = new QGridLayout(); + Glayout->setColumnStretch(0, 1); + { + QString message = "Graphical API"; + QLabel *label = new QLabel(message); + Glayout->addWidget(label, 0, 0); + + QComboBox *graphicCombo = new QComboBox(); + + RHI::EGraphicalApi currentApi = AEGPPk::CPopcornFXWorld::Instance().GetRenderApi(); + EApiValue selectedAPI = RHIApiToAEApi(currentApi); + u32 selectedAPIIndex = 0; + for (u32 i = 0; i < PK_ARRAY_COUNT(SAEPreferenciesKeys::kSupportedAPIs); ++i) + { + if (selectedAPI == SAEPreferenciesKeys::kSupportedAPIs[i]) + selectedAPIIndex = i; + const char *apiStr = SAEPreferenciesKeys::GetGraphicsApiAsCharPtr(SAEPreferenciesKeys::kSupportedAPIs[i]); + graphicCombo->insertItem(i, apiStr); + } + graphicCombo->setCurrentIndex(selectedAPIIndex); + QObject::connect(graphicCombo, QOverload::of(&QComboBox::currentIndexChanged), [](int value) { AEGPPk::CPopcornFXWorld::Instance().SetRenderApi(SAEPreferenciesKeys::kSupportedAPIs[value]); }); + Glayout->addWidget(graphicCombo, 0, 1); + } + layout->addLayout(Glayout); + +#if defined(PK_DEBUG) + { + QString messageButton = "Reload CSS"; + QPushButton *button = new QPushButton(messageButton); + QObject::connect(button, &QPushButton::released, [this]() + { + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + QString path = instance.GetPluginInstallationPath().Data() + QString("/Stylesheet.qss"); + QFile file(path); + + if (!file.open(QFile::ReadOnly)) + return false; + QString styleSheet = QLatin1String(file.readAll()); + m_App->setStyleSheet(styleSheet); + return true; + }); + layout->addWidget(button); + } + + { + QString messageButton = "Profile"; + QCheckBox *button = new QCheckBox(messageButton); + QObject::connect(button, &QCheckBox::stateChanged, [this](int state) + { + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + + instance.SetProfilingState(state != 0); + }); + layout->addWidget(button); + } +#endif + + settingsTab->setLayout(layout); + } + tab->addTab(settingsTab, "Settings"); +} + +//---------------------------------------------------------------------------- + +void QPanel::_SetWindow(WId wid) +{ + m_PendingWindowHandle = wid; +} + +//---------------------------------------------------------------------------- + +void QPanel::_SetGeometry(const QRect &windowRect) +{ + if (m_PendingWindowHandle != 0) + { + safe_delete(m_Widget); + safe_delete(m_Window); + + m_Widget = new QWidget(null, Qt::FramelessWindowHint); + + _CreateWindowContent(); +#if defined(PK_WINDOWS) + m_Widget->setProperty("_q_embedded_native_parent_handle", QVariant(m_PendingWindowHandle)); +#else + //Create internal window + m_Widget->winId(); + m_Window = QWindow::fromWinId(m_PendingWindowHandle); + m_Widget->windowHandle()->setParent(m_Window); +#endif + } + +#if defined(PK_MACOSX) + (void)windowRect; + if (m_Window != null) + { + // In the Qt documentation of QWindow::fromWinId this is not advised to observe state changes like this + // Do it like this for mac anyway since it's working but this should be changed + // https://doc.qt.io/qt-5/qwindow.html#fromWinId + QRect newRect = QRect(0, 0, m_Window->geometry().width(), m_Window->geometry().height()); + if (m_Widget != null && m_Widget->geometry() != newRect) + m_Widget->setGeometry(newRect); + } +#else + if (m_Widget != null && m_Widget->geometry() != windowRect) + m_Widget->setGeometry(windowRect); +#endif + + if (m_PendingWindowHandle != 0) + { + m_Widget->show(); + m_PendingWindowHandle = 0; + } +} + +//---------------------------------------------------------------------------- + +void QPanel::_UpdateModel() +{ + if (m_TreeModel != null) + m_TreeModel->UpdateModel(); +} + +//---------------------------------------------------------------------------- + +CPanelApp::CPanelApp() +{ +} + +//---------------------------------------------------------------------------- + +CPanelApp::~CPanelApp() +{ + PK_ASSERT(m_QApp == null); + PK_ASSERT(m_AppSignalSink == null); + PK_ASSERT(m_Panel == null); +} + +//---------------------------------------------------------------------------- + +bool CPanelApp::Startup() +{ + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + +#if defined(PK_MACOSX) + QApplication::setAttribute(Qt::AA_MacPluginApplication, true); + CString QTPath = instance.GetPluginInstallationPath() / "AE_GeneralPlugin.plugin/Contents/PlugIns"; +#else + CString QTPath = instance.GetPluginInstallationPath() / "popcornfx.qt"; +#endif + + CLog::Log(PK_INFO, "path: %s", QTPath.Data()); + + char *argv[] = { (char *)"", (char *)"-platformpluginpath", QTPath.RawDataForWriting(), null }; + int argc = sizeof(argv) / sizeof(char*) - 1; + + m_QApp = new QApplication(argc, argv); + if (!PK_VERIFY(m_QApp != null)) + { + CLog::Log(PK_ERROR, "Could not initialize Qt"); + return false; + } + +#if defined(PK_MACOSX) + m_EventLoop = new QEventLoop(); + if (!PK_VERIFY(m_EventLoop != null)) + { + CLog::Log(PK_ERROR, "Could not initialize Qt Event Loop"); + return false; + } +#endif + + qRegisterMetaType("WId"); + + m_AppSignalSink = new QPanelAppSignalSink(m_QApp); + if (m_AppSignalSink == null) + { + CLog::Log(PK_ERROR, "Could not initialize Qt signal sink"); + Shutdown(); + return false; + } + QObject::connect(m_AppSignalSink, &QPanelAppSignalSink::OnExit, m_AppSignalSink, &QPanelAppSignalSink::DoExit, Qt::QueuedConnection); + + if (!QResource::registerResource(QString(instance.GetResourcesPath().Data()) + "Resources.rcc")) + { + CLog::Log(PK_ERROR, "Could not load Resources.rcc"); + PK_ASSERT_NOT_REACHED(); + } + + QFile stylesheetFile(QString(instance.GetResourcesPath().Data()) + "/Stylesheet.qss"); + if (!stylesheetFile.open(QFile::ReadOnly)) + { + CLog::Log(PK_ERROR, "Could not load Stylesheet.qss"); + PK_ASSERT_NOT_REACHED(); + } + + QString styleSheet = QLatin1String(stylesheetFile.readAll()); + m_QApp->setStyleSheet(styleSheet); + + m_Panel = new QPanel(m_AppSignalSink, m_QApp); + if (!PK_VERIFY(m_Panel != null)) + { + CLog::Log(PK_ERROR, "Could not initialize Qt panel"); + Shutdown(); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +void CPanelApp::LaunchApp() +{ +#if defined(PK_WINDOWS) + m_QApp->exec(); +#else + OnWindowSizeChanged(QRect(0, 0, 0, 0)); + m_EventLoop->processEvents(); +#endif +} + +//---------------------------------------------------------------------------- + +void CPanelApp::Shutdown() +{ +#if defined(PK_MACOSX) + if (m_QApp != null) + m_QApp->quit(); + safe_delete(m_EventLoop); +#endif + safe_delete(m_Panel); + safe_delete(m_AppSignalSink); + safe_delete(m_QApp); +} + +//---------------------------------------------------------------------------- + +void CPanelApp::OnWindowHandlerChanged(WId wid) +{ + if (PK_VERIFY(m_AppSignalSink != null)) + Q_EMIT m_AppSignalSink->OnWindowHandlerChanged(wid); +} + +//---------------------------------------------------------------------------- + +void CPanelApp::OnWindowSizeChanged(const QRect &rect) +{ + if (PK_VERIFY(m_AppSignalSink != null)) + Q_EMIT m_AppSignalSink->OnWindowSizeChanged(rect); +} + +//---------------------------------------------------------------------------- + +void CPanelApp::OnRenderersChanged() +{ + if (PK_VERIFY(m_AppSignalSink != null)) + Q_EMIT m_AppSignalSink->OnRenderersChanged(); +} + +//---------------------------------------------------------------------------- + +void CPanelApp::OnExit() +{ + if (PK_VERIFY(m_AppSignalSink != null)) + Q_EMIT m_AppSignalSink->OnExit(); +} + +//---------------------------------------------------------------------------- +#if defined(PK_WINDOWS) + +CAsynchronousJob_QtThread::CAsynchronousJob_QtThread() +{ +} + +//---------------------------------------------------------------------------- + +CAsynchronousJob_QtThread::~CAsynchronousJob_QtThread() +{ +} + +//---------------------------------------------------------------------------- + +void CAsynchronousJob_QtThread::ImmediateExecute() +{ + if (!m_App.Startup()) + { + m_Initialized.Trigger(); + m_Exited.Trigger(); + return; + } + + m_Initialized.Trigger(); + + m_App.LaunchApp(); + + // VMN: Locking operation on my pc. + //m_App.Shutdown(); + + m_Exited.Trigger(); +} + +#endif +//---------------------------------------------------------------------------- + +CPanelBaseGUI::CPanelBaseGUI() +#if defined(PK_WINDOWS) + : m_Task(null) +#endif +{ +} + +//---------------------------------------------------------------------------- + +CPanelBaseGUI::~CPanelBaseGUI() +{ +#if defined(PK_WINDOWS) + if (m_Task != null) + { + m_Task->App().OnExit(); + m_Task->m_Exited.Wait(); + } +#else + m_App.Shutdown(); +#endif +} + +//---------------------------------------------------------------------------- + +CPanelBaseGUI *CPanelBaseGUI::GetInstance() +{ + if (m_Instance == null) + { + m_Instance = new CPanelBaseGUI(); + } + return m_Instance; +} + +//---------------------------------------------------------------------------- + +bool CPanelBaseGUI::DestroyInstance() +{ + if (m_Instance) + delete m_Instance; + m_Instance = null; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPanelBaseGUI::InitializeIFN() +{ + if (!m_Initialized) + { + AAePk::SAAEIOData AAEData{ PF_Cmd_ABOUT, null, null, null, null }; + CPopcornFXWorld &instance = AEGPPk::CPopcornFXWorld::Instance(); + if (!instance.InitializeIFN(AAEData)) + return false; + instance.SetPanelInstance(this); + +#if defined(PK_WINDOWS) + m_Task = PK_NEW(CAsynchronousJob_QtThread()); + if (!PK_VERIFY(m_Task != null)) + return false; + m_Task->AddToPool(Scheduler::ThreadPool()); + Scheduler::ThreadPool()->KickTasks(true); + m_Task->m_Initialized.Wait(); +#else + m_App.Startup(); +#endif + + m_Initialized = true; + } + return true; +} + +//---------------------------------------------------------------------------- +#if defined(PK_MACOSX) +void CPanelBaseGUI::IdleUpdate() +{ + PK_ASSERT(m_Initialized); + + m_App.LaunchApp(); +} +#endif +//---------------------------------------------------------------------------- + +bool CPanelBaseGUI::CreatePanel(SPBasicSuite *spbP, AEGP_PanelH panelH, AEGP_PlatformViewRef platformWindowRef, AEGP_PanelFunctions1 *outFunctionTable) +{ + PK_ASSERT(m_Initialized); + + m_BasicSuite = spbP; + (void)panelH; + outFunctionTable->DoFlyoutCommand = _DoFlyoutCommand; + outFunctionTable->GetSnapSizes = _GetSnapSizes; + outFunctionTable->PopulateFlyout = _PopulateFlyout; + + { +#if defined(PK_WINDOWS) + m_Task->App().OnWindowHandlerChanged((WId)platformWindowRef); +#else + m_App.OnWindowHandlerChanged((WId)platformWindowRef); +#endif + +#if defined(PK_WINDOWS) + _SetWindowHandle((HWND)platformWindowRef); +#endif + } + return true; +} + +//---------------------------------------------------------------------------- + +void CPanelBaseGUI::SetGeometry(const QRect &rect) +{ + PK_ASSERT(m_Initialized); +#if defined(PK_WINDOWS) + m_Task->App().OnWindowSizeChanged(rect); +#else + m_App.OnWindowSizeChanged(rect); +#endif +} + +//---------------------------------------------------------------------------- + +void CPanelBaseGUI::UpdateScenesModel() +{ + PK_ASSERT(m_Initialized); +#if defined(PK_WINDOWS) + m_Task->App().OnRenderersChanged(); +#else + m_App.OnRenderersChanged(); +#endif +} + +//---------------------------------------------------------------------------- + +void CPanelBaseGUI::GetSnapSizes(A_LPoint *snapSizes, A_long *numSizesP) +{ + snapSizes[0].x = 100; + snapSizes[0].y = 100; + snapSizes[1].x = 200; + snapSizes[1].y = 400; + *numSizesP = 2; +} + +//---------------------------------------------------------------------------- + +void CPanelBaseGUI::PopulateFlyout(AEGP_FlyoutMenuItem *itemsP, A_long *in_out_numItemsP) +{ + (void)itemsP; + (void)in_out_numItemsP; +} + +//---------------------------------------------------------------------------- + +void CPanelBaseGUI::DoFlyoutCommand(AEGP_FlyoutMenuCmdID commandID) +{ + (void)commandID; +} + +//---------------------------------------------------------------------------- + +A_Err CPanelBaseGUI::_GetSnapSizes(AEGP_PanelRefcon refcon, A_LPoint *snapSizes, A_long *numSizesP) +{ + reinterpret_cast(refcon)->GetSnapSizes(snapSizes, numSizesP); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +A_Err CPanelBaseGUI::_PopulateFlyout(AEGP_PanelRefcon refcon, AEGP_FlyoutMenuItem *itemsP, A_long * in_out_numItemsP) +{ + reinterpret_cast(refcon)->PopulateFlyout(itemsP, in_out_numItemsP); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +A_Err CPanelBaseGUI::_DoFlyoutCommand(AEGP_PanelRefcon refcon, AEGP_FlyoutMenuCmdID commandID) +{ + reinterpret_cast(refcon)->DoFlyoutCommand(commandID); + return PF_Err_NONE; +} + +#if defined(PK_WINDOWS) + +LRESULT CALLBACK CPanelBaseGUI::StaticOSWindowWndProc( HWND hWnd, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + CPanelBaseGUI* platPtr = reinterpret_cast(::GetProp(hWnd, OSWndObjectProperty)); + if (platPtr) + { + return platPtr->OSWindowWndProc(hWnd, message, wParam, lParam); + } + else + { + return DefWindowProc(hWnd, message, wParam, lParam); + } +} + +//---------------------------------------------------------------------------- + +LRESULT CPanelBaseGUI::OSWindowWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + PK_SCOPEDLOCK(m_HandleLock); + + bool eventHandled = false; + + if (m_WindowHandle == hwnd) // Filter events that are not for our window + { + RECT rect; + GetClientRect(hwnd, &rect); + + u32 width = rect.right - rect.left; + u32 height = rect.bottom - rect.top; + + SetGeometry(QRect(rect.left, rect.top, width, height)); + + eventHandled = true; + } + + if (m_WindowProc && !eventHandled) + return CallWindowProc(m_WindowProc, hwnd, message, wParam, lParam); + else + return DefWindowProc(hwnd, message, wParam, lParam); +} + +//---------------------------------------------------------------------------- + +void CPanelBaseGUI::_SetWindowHandle(HWND hwnd) +{ + PK_SCOPEDLOCK(m_HandleLock); + + m_WindowHandle = hwnd; + m_WindowProc = (WindowProc)GetWindowLongPtrA(m_WindowHandle, GWLP_WNDPROC); + SetWindowLongPtrA(m_WindowHandle, GWLP_WNDPROC, (LONG_PTR)CPanelBaseGUI::StaticOSWindowWndProc); + ::SetProp(m_WindowHandle, OSWndObjectProperty, (HANDLE)this); +} + +#endif // defined(PK_WINDOWS) + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/RenderApi/AEGP_BaseContext.cpp b/AE_GeneralPlugin/Sources/RenderApi/AEGP_BaseContext.cpp new file mode 100644 index 00000000..24801ae2 --- /dev/null +++ b/AE_GeneralPlugin/Sources/RenderApi/AEGP_BaseContext.cpp @@ -0,0 +1,54 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" +#include "RenderApi/AEGP_BaseContext.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +CAAEBaseContext::CAAEBaseContext() + : m_ApiManager(null) + , m_ApiContext(null) + , m_CompositingTexture(null) +{ + +} + +//---------------------------------------------------------------------------- + +CAAEBaseContext::~CAAEBaseContext() +{ + PK_SAFE_DELETE(m_ApiContext); + m_ApiManager = null; + m_CompositingTexture = null; +} + +//---------------------------------------------------------------------------- + +RHI::PApiManager CAAEBaseContext::GetApiManager() +{ + PK_ASSERT(m_ApiManager != null); + return m_ApiManager; +} + +//---------------------------------------------------------------------------- + +RHI::SApiContext *CAAEBaseContext::GetApiContext() +{ + PK_ASSERT(m_ApiContext != null); + return m_ApiContext; +} + +//---------------------------------------------------------------------------- + +RHI::PTexture CAAEBaseContext::GetCompositingTexture() +{ + PK_ASSERT(m_CompositingTexture != null); + return m_CompositingTexture; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END diff --git a/AE_GeneralPlugin/Sources/RenderApi/AEGP_CopyPixels.cpp b/AE_GeneralPlugin/Sources/RenderApi/AEGP_CopyPixels.cpp new file mode 100644 index 00000000..62a1b9de --- /dev/null +++ b/AE_GeneralPlugin/Sources/RenderApi/AEGP_CopyPixels.cpp @@ -0,0 +1,193 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" +#include "RenderApi/AEGP_CopyPixels.h" + +//Samples +#include +#include + +#include "AEGP_AEPKConversion.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +CFloat4 Pixel32ToCFloat4(const PF_Pixel32 &pxl) +{ + return CFloat4(pxl.red, pxl.green, pxl.blue, pxl.alpha); +} + +//---------------------------------------------------------------------------- + +CFloat4 Pixel16ToCFloat4(const PF_Pixel16 &pxl) +{ + CFloat4 pxlValue( static_cast(pxl.red), + static_cast(pxl.green), + static_cast(pxl.blue), + static_cast(pxl.alpha)); + return pxlValue / CFloat4(static_cast(0x7FFF)); +} + +//---------------------------------------------------------------------------- + +CFloat4 Pixel8ToCFloat4(const PF_Pixel8 &pxl) +{ + CFloat4 pxlValue( static_cast(pxl.red), + static_cast(pxl.green), + static_cast(pxl.blue), + static_cast(pxl.alpha)); + return pxlValue / CFloat4(static_cast(0xFF)); +} + +//---------------------------------------------------------------------------- + +PF_Pixel32 CFloat4ToPixel32(const CFloat4 &pxl) +{ + PF_Pixel32 out = {}; + out.red = pxl.x(); + out.green = pxl.y(); + out.blue = pxl.z(); + out.alpha = pxl.w(); + return out; +} + +//---------------------------------------------------------------------------- + +PF_Pixel16 CFloat4ToPixel16(const CFloat4 &pxl) +{ + PF_Pixel16 out = {}; + out.red = static_cast(pxl.x() * static_cast(0x7FFF)); + out.green = static_cast(pxl.y() * static_cast(0x7FFF)); + out.blue = static_cast(pxl.z() * static_cast(0x7FFF)); + out.alpha = static_cast(pxl.w() * static_cast(0x7FFF)); + return out; +} + +//---------------------------------------------------------------------------- + +PF_Pixel8 CFloat4ToPixel8(const CFloat4 &pxl) +{ + PF_Pixel8 out = {}; + out.red = static_cast(pxl.x() * static_cast(0xFF)); + out.green = static_cast(pxl.y() * static_cast(0xFF)); + out.blue = static_cast(pxl.z() * static_cast(0xFF)); + out.alpha = static_cast(pxl.w() * static_cast(0xFF)); + return out; +} + +//---------------------------------------------------------------------------- + +PF_Err CopyPixelIn32( void *refcon, + A_long x, + A_long y, + PF_Pixel32 *inP, + PF_Pixel32 *) +{ + SCopyPixel *thiS = reinterpret_cast(refcon); + CFloat4 *outP = Mem::AdvanceRawPointer(thiS->m_BufferPtr->Data(), sizeof(CFloat4) * y * thiS->m_InputWorld->width + x * sizeof(CFloat4)); + CFloat4 value = Pixel32ToCFloat4(*inP); + + value.xyz() = PKSample::ConvertSRGBToLinear(value.xyz()); + value = PKSaturate(value); + *outP = value; + if (thiS->m_IsAlphaOverride) + outP->w() = static_cast(thiS->m_AlphaOverrideValue); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CopyPixelIn16( void *refcon, + A_long x, + A_long y, + PF_Pixel16 *inP, + PF_Pixel16 *) +{ + SCopyPixel *thiS = reinterpret_cast(refcon); + CFloat4 *outP = Mem::AdvanceRawPointer(thiS->m_BufferPtr->Data(), sizeof(CFloat4) * y * thiS->m_InputWorld->width + x * sizeof(CFloat4)); + CFloat4 value = Pixel16ToCFloat4(*inP); + + value.xyz() = PKSample::ConvertSRGBToLinear(value.xyz()); + value = PKSaturate(value); + *outP = value; + if (thiS->m_IsAlphaOverride) + outP->w() = static_cast(thiS->m_AlphaOverrideValue); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CopyPixelIn8( void *refcon, + A_long x, + A_long y, + PF_Pixel8 *inP, + PF_Pixel8 *) +{ + SCopyPixel *thiS = reinterpret_cast(refcon); + CFloat4 *outP = Mem::AdvanceRawPointer(thiS->m_BufferPtr->Data(), sizeof(CFloat4) * y * thiS->m_InputWorld->width + x * sizeof(CFloat4)); + CFloat4 value = Pixel8ToCFloat4(*inP); + + value.xyz() = PKSample::ConvertSRGBToLinear(value.xyz()); + value = PKSaturate(value); + *outP = value; + if (thiS->m_IsAlphaOverride) + outP->w() = static_cast(thiS->m_AlphaOverrideValue); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CopyPixelOut32( void *refcon, + A_long x, + A_long y, + PF_Pixel32 *, + PF_Pixel32 *outP) +{ + SCopyPixel *thiS = reinterpret_cast(refcon); + const u32 size = sizeof(CFloat4); + const CFloat4 *inP = Mem::AdvanceRawPointer(thiS->m_BufferPtr->Data(), size * y * thiS->m_InputWorld->width + x * size); + CFloat4 value = CFloat4(PKSample::ConvertLinearToSRGB(inP->xyz()), inP->w()); + value = PKSaturate(value); + *outP = CFloat4ToPixel32(value); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CopyPixelOut16( void *refcon, + A_long x, + A_long y, + PF_Pixel16 *, + PF_Pixel16 *outP) +{ + SCopyPixel *thiS = reinterpret_cast(refcon); + const u32 size = sizeof(CFloat4); + const CFloat4 *inP = Mem::AdvanceRawPointer(thiS->m_BufferPtr->Data(), size * y * thiS->m_InputWorld->width + x * size); + CFloat4 value = CFloat4(PKSample::ConvertLinearToSRGB(inP->xyz()), inP->w()); + value = PKSaturate(value); + *outP = CFloat4ToPixel16(value); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- + +PF_Err CopyPixelOut8( void *refcon, + A_long x, + A_long y, + PF_Pixel8 *, + PF_Pixel8 *outP) +{ + SCopyPixel *thiS = reinterpret_cast(refcon); + const u32 size = sizeof(CFloat4); + const CFloat4 *inP = Mem::AdvanceRawPointer(thiS->m_BufferPtr->Data(), size * y * thiS->m_InputWorld->width + x * size); + CFloat4 value = CFloat4(PKSample::ConvertLinearToSRGB(inP->xyz()), inP->w()); + value = PKSaturate(value); + *outP = CFloat4ToPixel8(value); + return PF_Err_NONE; +} + +//---------------------------------------------------------------------------- +__AEGP_PK_END + diff --git a/AE_GeneralPlugin/Sources/RenderApi/AEGP_D3D11Context.cpp b/AE_GeneralPlugin/Sources/RenderApi/AEGP_D3D11Context.cpp new file mode 100644 index 00000000..f86b54c6 --- /dev/null +++ b/AE_GeneralPlugin/Sources/RenderApi/AEGP_D3D11Context.cpp @@ -0,0 +1,506 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" +#include "RenderApi/AEGP_D3D11Context.h" + +#if (PK_BUILD_WITH_D3D11_SUPPORT != 0) + +#include +#include +#include +#include + +#include + +#include + +#include + +#include "AEGP_World.h" +#include "RenderApi/AEGP_CopyTask.h" + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +struct SD3D11PlatformContext +{ + IDXGIFactory1 *m_Factory; + IDXGIAdapter1 *m_HardwareAdapter; + + TArray m_SwapChains; + +#if USE_DEBUG_DXGI + IDXGIDebug *m_Debug; +#endif + + PFN_D3D11_CREATE_DEVICE m_CreateDeviceFunc; + HMODULE m_D3DModule; + HMODULE m_DXGIModule; + + bool m_Initialized = false; + + SD3D11PlatformContext() + : m_Factory(null) + , m_HardwareAdapter(null) +#if USE_DEBUG_DXGI + , m_Debug(null) +#endif + , m_D3DModule(0) + , m_DXGIModule(0) + { + } + + ~SD3D11PlatformContext() + { + if (m_Factory != null) + m_Factory->Release(); + if (m_HardwareAdapter != null) + m_HardwareAdapter->Release(); + PK_FOREACH(swapChain, m_SwapChains) + { + if (PK_VERIFY(*swapChain != null)) + (*swapChain)->Release(); + } +#if USE_DEBUG_DXGI + if (m_Debug) + { + m_Debug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL); + m_Debug->Release(); + } +#endif + if (m_D3DModule != null) + FreeLibrary(m_D3DModule); + if (m_DXGIModule != null) + FreeLibrary(m_DXGIModule); + } +}; + +//---------------------------------------------------------------------------- + +CAAED3D11Context::CAAED3D11Context() + : m_Texture(null) + , m_StagingTexture(null) +{ + m_D3D11Manager = PK_NEW(RHI::CD3D11ApiManager); + m_D3D11Context = PK_NEW(RHI::SD3D11BasicContext); + m_ApiManager = m_D3D11Manager; + m_ApiContext = m_D3D11Context; + + if (m_Context == null) + m_Context = (PK_NEW(SD3D11PlatformContext)); +} + +//---------------------------------------------------------------------------- + +CAAED3D11Context::~CAAED3D11Context() +{ + if (m_Texture != null) + { + m_Texture->Release(); + m_Texture = null; + } + if (m_StagingTexture != null) + { + m_StagingTexture->Release(); + m_StagingTexture = null; + } + m_D3D11Context->m_SwapChainRenderTargets.Clear(); + if (m_D3D11Context->m_ImmediateDeviceContext != null) + { + m_D3D11Context->m_ImmediateDeviceContext->Release(); + m_D3D11Context->m_ImmediateDeviceContext = null; + } + if (m_D3D11Context->m_Device != null) + { + m_D3D11Context->m_Device->Release(); + m_D3D11Context->m_Device = null; + } + + PK_SAFE_DELETE(m_Context); + PK_SAFE_DELETE(m_D3D11Context); + + m_D3D11Manager = null; + m_ApiContext = null; + m_ApiManager = null; + + m_Tasks.Clear(); + +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::InitIFN() +{ + if (m_Initialized) + return true; + m_Initialized = true; + + m_WorkerCount = CPopcornFXWorld::Instance().GetWorkerCount() + 1; + m_Tasks.Resize(m_WorkerCount); + + m_ApiManager->InitApi(m_ApiContext); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::BeginFrame() +{ + m_ApiManager->BeginFrame(0); + LogApiError(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::EndFrame() +{ + LogApiError(); + + m_ApiManager->EndFrame(); + + HRESULT hr = 0; + if (m_Context->m_SwapChains.Count() > 0) + { + hr = m_Context->m_SwapChains[0]->Present(0, 0); + if (FAILED(hr)) + return false; + if (hr == DXGI_ERROR_DEVICE_RESET || + hr == DXGI_ERROR_DEVICE_REMOVED) + return false; + if (hr == DXGI_STATUS_OCCLUDED) + return true; + } + return PK_D3D11_OK(hr); +} + +//---------------------------------------------------------------------------- + +void CAAED3D11Context::LogApiError() +{ +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::CreatePlatformContext(void *winHandle, void *deviceContext) +{ + (void)winHandle; + + HDC hdc = (HDC)deviceContext; + + int PixelFormat; + PIXELFORMATDESCRIPTOR pfd; + + ::ZeroMemory(&pfd, sizeof(pfd)); + + pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW; // | PFD_DOUBLEBUFFER; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.cColorBits = 32; + pfd.cDepthBits = 8; + + PixelFormat = ChoosePixelFormat(hdc, &pfd); + if (PixelFormat == 0) + return false; + if (!SetPixelFormat(hdc, PixelFormat, &pfd)) + return false; + + if (m_Context == null) + return false; + if (m_Context->m_Initialized) + return true; + + m_D3D11Context->m_Api = RHI::GApi_D3D11; + m_D3D11Context->m_SwapChainCount = 0; + + if (!_LoadDynamicLibrary()) + return false; + + // try grabbing CreateDXGIFactory1: + typedef HRESULT(WINAPI *FnCreateDXGIFactory1)(REFIID riid, _COM_Outptr_ void **ppFactory); + + FnCreateDXGIFactory1 fnCreateDXGIFactory1 = (FnCreateDXGIFactory1)::GetProcAddress(m_Context->m_DXGIModule, "CreateDXGIFactory1"); + // if not found, this is not fatal, it will fallback (ie: on vista & xp) + if (fnCreateDXGIFactory1 == null) + { + CLog::Log(PK_INFO, "DXGI API 'CreateDXGIFactory1' not found, cannot create D3D11 context."); + return false; + } + m_Context->m_Initialized = true; + return PK_D3D11_OK(fnCreateDXGIFactory1(IID_PPV_ARGS(&m_Context->m_Factory))) && _CreateDevice(); +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::CreateRenderTarget(RHI::EPixelFormat format, CUint3 size) +{ + RHI::PD3D11RenderTarget rt = PK_NEW(RHI::CD3D11RenderTarget(RHI::SRHIResourceInfos("Render Target"))); + ID3D11Texture2D *texture2D = null; + D3D11_TEXTURE2D_DESC texDesc = {}; + + texDesc.Width = size.x(); + texDesc.Height = size.y(); + texDesc.MipLevels = 1; + texDesc.ArraySize = 1; + texDesc.Format = RHI::D3DConversion::PopcornToD3DPixelFormat(format); + texDesc.SampleDesc.Count = 1; + texDesc.Usage = D3D11_USAGE_DEFAULT; + texDesc.BindFlags = D3D11_BIND_RENDER_TARGET; + + if (PK_D3D11_FAILED(m_D3D11Context->m_Device->CreateTexture2D(&texDesc, null, &texture2D))) + return false; + texture2D->AddRef(); + rt->D3D11SetRenderTarget(texture2D, format, size.xy(), true, null, RHI::SampleCount1); + + if (m_Texture != null) + { + m_Texture->Release(); + m_Texture = null; + } + + m_Texture = texture2D; + + if (m_D3D11Context->m_SwapChainCount != 0) + { + m_D3D11Context->m_SwapChainRenderTargets.Clear(); + m_D3D11Manager->SwapChainRemoved(0); + } + + m_D3D11Context->m_SwapChainRenderTargets.PushBack(rt); + m_D3D11Context->m_SwapChainCount = 1; + + m_D3D11Manager->SwapChainAdded(); + + ID3D11Texture2D *tex = null; + D3D11_TEXTURE2D_DESC textureStagingDesc = {}; + + textureStagingDesc.Width = size.x(); + textureStagingDesc.Height = size.y(); + textureStagingDesc.MipLevels = 1; + textureStagingDesc.ArraySize = 1; + textureStagingDesc.Format = RHI::D3DConversion::PopcornToD3DPixelFormat(format); + textureStagingDesc.SampleDesc.Count = 1; + textureStagingDesc.Usage = D3D11_USAGE_STAGING; + textureStagingDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; + if (textureStagingDesc.Format == DXGI_FORMAT_UNKNOWN || + PK_D3D11_FAILED(m_D3D11Context->m_Device->CreateTexture2D(&textureStagingDesc, null, &tex))) + return false; + + if (m_StagingTexture != null) + { + m_StagingTexture->Release(); + m_StagingTexture = null; + } + m_StagingTexture = tex; + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::SetAsCurrent(void *deviceContext) +{ + (void)deviceContext; + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::FillRenderBuffer(PRefCountedMemoryBuffer dstBuffer, RHI::PFrameBuffer srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) +{ + (void)rowLength; + + PK_SCOPEDPROFILE(); + + m_D3D11Context->m_ImmediateDeviceContext->CopyResource(m_StagingTexture, m_Texture); + // Copy GPU Resource to CPU + D3D11_TEXTURE2D_DESC desc; + D3D11_MAPPED_SUBRESOURCE resource; + UINT subresource = D3D11CalcSubresource(0, 0, 0); + + m_StagingTexture->GetDesc(&desc); + //Locking Map + HRESULT hr = m_D3D11Context->m_ImmediateDeviceContext->Map(m_StagingTexture, subresource, D3D11_MAP_READ, 0, &resource); + if (FAILED(hr)) + { + CLog::Log(PK_ERROR, "D3D11Context map failure"); + return false; + } + + BYTE *sptr = reinterpret_cast(resource.pData); + BYTE *dptr = (BYTE*)dstBuffer->Data(); + + const u32 formatSize = RHI::PixelFormatHelpers::PixelFormatToPixelByteSize(format); + const u32 widthSize = (formatSize * width); + + PK_ASSERT(resource.RowPitch >= widthSize); + + u32 taskRowNumbers = height / m_WorkerCount; + u32 reminder = height % m_WorkerCount; + TAtomic counter = 0; + Threads::CEvent event; + + for (u32 i = 0; i < m_WorkerCount;++i) + { + m_Tasks[i] = PK_NEW(CAsynchronousJob_CopyTextureTask); + m_Tasks[i]->m_TargetCount = m_WorkerCount; + + m_Tasks[i]->m_Counter = &counter; + m_Tasks[i]->m_EndCB = &event; + + if (i == (m_WorkerCount - 1)) + m_Tasks[i]->m_Height = taskRowNumbers + reminder; + else + m_Tasks[i]->m_Height = taskRowNumbers; + m_Tasks[i]->m_StartOffset = i * taskRowNumbers; + m_Tasks[i]->m_DestinationPtr = dptr; + m_Tasks[i]->m_SourcePtr = sptr; + m_Tasks[i]->m_WidthSize = widthSize; + m_Tasks[i]->m_RowPitch = resource.RowPitch; + } + + for (u32 i = 1; i < m_WorkerCount; ++i) + { + m_Tasks[i]->AddToPool(Scheduler::ThreadPool()); + } + Scheduler::ThreadPool()->KickTasks(true); + + m_Tasks[0]->ImmediateExecute(); + { + PK_SCOPEDLOGGEDPROFILE("WaitMergeTask"); + + event.Wait(); + + for (u32 i = 0; i < m_WorkerCount; ++i) + { + if (!m_Tasks[i]->Done()) + i = 0; + } + } + + m_D3D11Context->m_ImmediateDeviceContext->Unmap(m_StagingTexture, subresource); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::FillCompositingTexture(void *srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) +{ + (void)rowLength; + + PK_SCOPEDPROFILE(); + + CImageMap image(CUint3(width, height, 1), srcBuffer, RHI::PixelFormatHelpers::PixelFormatToPixelByteSize(format) * width * height); + + PK_TODO("Optim: Use GPU Swizzle instead of CPU"); + + RHI::PTexture textureSrc = m_D3D11Manager->CreateTexture(RHI::SRHIResourceInfos("CompositingTexture"), TMemoryView(image), format); + + m_CompositingTexture = textureSrc; + return true; +} + +//---------------------------------------------------------------------------- + +TMemoryView CAAED3D11Context::GetCurrentSwapChain() +{ + return m_D3D11Context->m_SwapChainRenderTargets; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::_LoadDynamicLibrary() +{ + if (m_Initialized) + return true; + PK_ASSERT(m_Context != null); + m_Context->m_D3DModule = ::LoadLibraryA("d3d11.dll"); + if (m_Context->m_D3DModule == null) + return false; + m_Context->m_DXGIModule = ::LoadLibraryA("dxgi.dll"); + if (m_Context->m_DXGIModule == null) + return false; + m_Context->m_CreateDeviceFunc = (PFN_D3D11_CREATE_DEVICE)::GetProcAddress(m_Context->m_D3DModule, "D3D11CreateDevice"); + + return m_Context->m_CreateDeviceFunc != null; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::_CreateDevice() +{ + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + }; + if (!_PickHardwareAdapter()) + { + return false; + } + +#if defined(PK_DEBUG) + UINT deviceFlags = (D3D11_CREATE_DEVICE_DEBUG); +#else + UINT deviceFlags = 0; +#endif + + if (!PK_D3D11_OK(m_Context->m_CreateDeviceFunc( m_Context->m_HardwareAdapter, + D3D_DRIVER_TYPE_UNKNOWN, + null, + deviceFlags, + featureLevels, + _countof(featureLevels), + D3D11_SDK_VERSION, + &m_D3D11Context->m_Device, + &m_D3D11Context->m_FeatureLevel, + &m_D3D11Context->m_ImmediateDeviceContext))) + { + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D11Context::_PickHardwareAdapter() +{ + IDXGIFactory1 *&factory = m_Context->m_Factory; + IDXGIAdapter1 *&adapter = m_Context->m_HardwareAdapter; + + adapter = 0; + for (u32 idx = 0; factory->EnumAdapters1(idx, &adapter) != DXGI_ERROR_NOT_FOUND; ++idx) + { + DXGI_ADAPTER_DESC1 desc; + adapter->GetDesc1(&desc); + + if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) + { + // Don't select the Basic Render Driver adapter. + // If you want a software adapter, pass in "/warp" on the command line. + continue; + } + + // Check to see if the adapter supports Direct3D 12, but don't create the + // actual device yet. + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + }; + if (SUCCEEDED(m_Context->m_CreateDeviceFunc(adapter, D3D_DRIVER_TYPE_UNKNOWN, null, 0, featureLevels, _countof(featureLevels), D3D11_SDK_VERSION, null, null, null))) + { + return true; + } + } + adapter = 0; + return false; +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Sources/RenderApi/AEGP_D3D12Context.cpp b/AE_GeneralPlugin/Sources/RenderApi/AEGP_D3D12Context.cpp new file mode 100644 index 00000000..f1cbfb89 --- /dev/null +++ b/AE_GeneralPlugin/Sources/RenderApi/AEGP_D3D12Context.cpp @@ -0,0 +1,712 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#include "ae_precompiled.h" +#include "RenderApi/AEGP_D3D12Context.h" + +#if (PK_BUILD_WITH_D3D12_SUPPORT != 0) + +#include +#include +#include +#include +#include +#include "pk_rhi/include/D3D12/D3D12ReadBackTexture.h" + +#include + +#include + +#include + +#include "AEGP_World.h" +#include "RenderApi/AEGP_CopyTask.h" + +#include + +#include +#include + +__AEGP_PK_BEGIN + +//---------------------------------------------------------------------------- + +class CD3D12SwapChainRT : public RHI::ID3D12SwapChain +{ +public: + CGuid m_BufferIndex; + + RHI::PD3D12RenderTarget m_RenderTargets[CAAED3D12Context::kFrameCount]; + RHI::PD3D12ReadBackTexture m_ReadbackTextures[CAAED3D12Context::kFrameCount]; + + + CD3D12SwapChainRT() + : m_BufferIndex(0) + { + } + + ~CD3D12SwapChainRT() + { + m_BufferIndex = 0; + } + + CGuid BeginFrame() + { + m_BufferIndex = (m_BufferIndex + 1) % CAAED3D12Context::kFrameCount; + return m_BufferIndex; + } + + virtual TMemoryView GetD3D12RenderTargets() const + { + return TMemoryView(m_RenderTargets); + } + + virtual TMemoryView GetRenderTargets() const + { + return TMemoryView(GetD3D12RenderTargets()); + } +}; + +//---------------------------------------------------------------------------- + +class CD3D12SwapChain : public RHI::ID3D12SwapChain +{ +public: + IDXGISwapChain3 *m_SwapChain; + CGuid m_BufferIndex; + RHI::PD3D12RenderTarget m_RenderTargets[CAAED3D12Context::kFrameCount]; + + CD3D12SwapChain() + : m_SwapChain(null) + { + } + + ~CD3D12SwapChain() + { + if (m_SwapChain != null) + m_SwapChain->Release(); + } + + CGuid BeginFrame() + { + m_BufferIndex = m_SwapChain->GetCurrentBackBufferIndex(); + return m_BufferIndex; + } + + virtual TMemoryView GetD3D12RenderTargets() const + { + return TMemoryView(m_RenderTargets); + } + + virtual TMemoryView GetRenderTargets() const + { + return TMemoryView(GetD3D12RenderTargets()); + } +}; + +//---------------------------------------------------------------------------- + +struct SD3D12PlatformContext +{ + IDXGIFactory4 *m_Factory; + IDXGIAdapter1 *m_HardwareAdapter; + + TArray m_SwapChainsRTs; + + + PFN_D3D12_CREATE_DEVICE m_CreateDeviceFunc; + PFN_D3D12_GET_DEBUG_INTERFACE m_GetDebugInterfaceFunc; + + HMODULE m_D3DModule; + HMODULE m_DXGIModule; + + SD3D12PlatformContext() + : m_Factory(null) + , m_HardwareAdapter(null) +#if USE_DEBUG_DXGI + , m_Debug(null) +#endif + , m_D3DModule(0) + , m_DXGIModule(0) + { + } + + ~SD3D12PlatformContext() + { + if (m_Factory != null) + m_Factory->Release(); + if (m_HardwareAdapter != null) + m_HardwareAdapter->Release(); + if (m_D3DModule != null) + FreeLibrary(m_D3DModule); + if (m_DXGIModule != null) + FreeLibrary(m_DXGIModule); + } +}; + +//---------------------------------------------------------------------------- + +CAAED3D12Context *CAAED3D12Context::m_Instance = null; +bool CAAED3D12Context::m_Once = false; + +//---------------------------------------------------------------------------- + +CAAED3D12Context::CAAED3D12Context() + : m_Context(PK_NEW(SD3D12PlatformContext)) +{ + for (u32 i = 0; i < kFrameCount; ++i) + { + m_Resources[i] = null; + } + m_D3D12Manager = PK_NEW(RHI::CD3D12ApiManager); + m_D3D12Context = PK_NEW(RHI::SD3D12BasicContext); + + m_ApiContext = m_D3D12Context; + m_ApiManager = m_D3D12Manager; +} + +//---------------------------------------------------------------------------- + +CAAED3D12Context::~CAAED3D12Context() +{ + ClearContextSwapchainsRT(); + m_D3D12Manager->SwapChainRemoved(0); + + m_D3D12Manager = null; + m_ApiManager = null; + + if (m_D3D12Context->m_Device != null) + m_D3D12Context->m_Device->Release(); + PK_SAFE_DELETE(m_Context); + m_ApiContext = null; + PK_SAFE_DELETE(m_D3D12Context); + m_Tasks.Clear(); +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::InitIFN() +{ + if (m_Initialized || m_Once) + return true; + m_Initialized = true; + m_Once = true; + + m_WorkerCount = CPopcornFXWorld::Instance().GetWorkerCount() + 1; + m_Tasks.Resize(m_WorkerCount); + + m_ApiManager->InitApi(m_ApiContext); + m_Fence = m_D3D12Manager->CreateFence(RHI::SRHIResourceInfos("Fence")); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::BeginFrame() +{ + if (m_Context->m_SwapChainsRTs.Count() > 0) + m_ApiManager->BeginFrame(m_Context->m_SwapChainsRTs[0]->BeginFrame()); + else + return false; + LogApiError(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::EndFrame() +{ + LogApiError(); + + m_FrameCount += 1; + if (m_Context->m_SwapChainsRTs.Count() > 0) + { + RHI::PCommandBuffer cmdBuff = m_ApiManager->CreateCommandBuffer(RHI::SRHIResourceInfos("Command Buffer"), true); + + if (cmdBuff != null) + { + cmdBuff->Start(); + + cmdBuff->ReadBackRenderTarget(m_Context->m_SwapChainsRTs[0]->m_RenderTargets[m_Context->m_SwapChainsRTs[0]->m_BufferIndex], + m_Context->m_SwapChainsRTs[0]->m_ReadbackTextures[m_Context->m_SwapChainsRTs[0]->m_BufferIndex]); + + cmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(cmdBuff); + } + else + CLog::Log(PK_ERROR, "D3D12: Create command buffer failed"); + } + m_ApiManager->EndFrame(); + //Keep that after the endframe; + m_Fence->Signal(m_FrameCount, m_D3D12Context->m_CommandQueue); + return true; +} + +//---------------------------------------------------------------------------- + +void CAAED3D12Context::LogApiError() +{ +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::CreateDescriptorAllocator() +{ + // Create allocators if not exists or missing + TArray & allocators = m_D3D12Context->m_DescriptorAllocators; + u32 count = allocators.Count(); + if (count < D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES) + { + if (!allocators.Resize(D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES)) + return false; + for (u32 i = 0; i < D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES; ++i) + { + u32 batchCount = (i >= D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER) ? 64u : 8192u; + allocators[i] = PK_NEW(RHI::CD3D12DescriptorAllocator(m_D3D12Context->m_Device, static_cast(i), batchCount)); + if (allocators[i] == null) + return false; + } + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::LoadDynamicLibrary() +{ + PK_ASSERT(m_Context != null); + m_Context->m_D3DModule = ::LoadLibraryA("d3d12.dll"); + if (m_Context->m_D3DModule == null) + return false; + m_Context->m_DXGIModule = ::LoadLibraryA("dxgi.dll"); + if (m_Context->m_DXGIModule == null) + return false; + m_Context->m_CreateDeviceFunc = (PFN_D3D12_CREATE_DEVICE)::GetProcAddress(m_Context->m_D3DModule, "D3D12CreateDevice"); + m_D3D12Context->m_SerializeRootSignatureFunc = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)::GetProcAddress(m_Context->m_D3DModule, "D3D12SerializeRootSignature"); + + return m_Context->m_CreateDeviceFunc != null && + m_D3D12Context->m_SerializeRootSignatureFunc != null; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::CreateDevice() +{ + if (!PickHardwareAdapter()) + return false; + if (!PK_D3D_OK(m_Context->m_CreateDeviceFunc(m_Context->m_HardwareAdapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_D3D12Context->m_Device)))) + { + CLog::Log(PK_ERROR, "D3D12: Couldn't create device"); + return false; + } + + D3D12_FEATURE_DATA_FEATURE_LEVELS levelFeature = {}; + const D3D_FEATURE_LEVEL levels[] = + { + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_12_0, + D3D_FEATURE_LEVEL_12_1 + }; + levelFeature.NumFeatureLevels = PK_ARRAY_COUNT(levels); + levelFeature.pFeatureLevelsRequested = levels; + m_D3D12Context->m_Device->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &levelFeature, sizeof(levelFeature)); + + if (levelFeature.MaxSupportedFeatureLevel > D3D_FEATURE_LEVEL_11_0) + { + m_D3D12Context->m_Device->Release(); + m_D3D12Context->m_Device = null; + if (!PK_D3D_OK(m_Context->m_CreateDeviceFunc(m_Context->m_HardwareAdapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_D3D12Context->m_Device)))) + { + PK_ASSERT_NOT_REACHED_MESSAGE("Internal error when creating d3d12 device."); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +//Duplicate of PK-Samples\PK-SampleLib\ApiContext\D3D\D3D12Context.h::PickHardwareAdapter +bool CAAED3D12Context::PickHardwareAdapter() +{ + IDXGIFactory4 *&factory = m_Context->m_Factory; + IDXGIAdapter1 *&adapter = m_Context->m_HardwareAdapter; + adapter = 0; + HRESULT hres; + for (u32 idx = 0; (hres = factory->EnumAdapters1(idx, &adapter)) != DXGI_ERROR_NOT_FOUND; ++idx) + { + DXGI_ADAPTER_DESC1 desc; + adapter->GetDesc1(&desc); + + if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) + { + // Don't select the Basic Render Driver adapter. + // If you want a software adapter, pass in "/warp" on the command line. + continue; + } + + // Check to see if the adapter supports Direct3D 12, but don't create the + // actual device yet. + HRESULT hr = m_Context->m_CreateDeviceFunc(adapter, D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), null); + if (SUCCEEDED(hr)) + { + return true; + } + } + PK_ASSERT_NOT_REACHED(); + adapter = 0; + return false; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::CreatePlatformContext(void *winHandle, void *deviceContext) +{ + (void)winHandle; + if (m_Once) + return true; + + HDC hdc = (HDC)deviceContext; + + int PixelFormat; + PIXELFORMATDESCRIPTOR pfd; + + ::ZeroMemory(&pfd, sizeof(pfd)); + + pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW; // | PFD_DOUBLEBUFFER; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.cColorBits = 32; + pfd.cDepthBits = 8; + + PixelFormat = ChoosePixelFormat(hdc, &pfd); + if (PixelFormat == 0) + return false; + if (!SetPixelFormat(hdc, PixelFormat, &pfd)) + return false; + + if (m_Context == null) + return false; + m_D3D12Context->m_Api = RHI::GApi_D3D12; + m_D3D12Context->m_SwapChainCount = 0; + + if (!LoadDynamicLibrary()) + return false; + // If you want to develop with the debug layer on: + // -with DirectX Control panel(accessible via visual studio Debug->Graphics->DirectX Control panel) + // - Click on Scope->Edit List...->Add : AfterFX.exe + // - Then Direct3D / DXGI Debug Layer : Choose the `Force On` Option and voila !You got your debug logs. + +#if 0 + Microsoft::WRL::ComPtr debugController; + + m_Context->m_GetDebugInterfaceFunc = (PFN_D3D12_GET_DEBUG_INTERFACE)::GetProcAddress(m_Context->m_D3DModule, "D3D12GetDebugInterface"); + if (PK_D3D_FAILED(m_Context->m_GetDebugInterfaceFunc(IID_PPV_ARGS(&debugController)))) + return false; + debugController->EnableDebugLayer(); +#endif + + // try grabbing CreateDXGIFactory1: + typedef HRESULT(WINAPI *FnCreateDXGIFactory2)(UINT Flags, REFIID riid, _COM_Outptr_ void **ppFactory); + + FnCreateDXGIFactory2 CreateDXGIFactory2 = (FnCreateDXGIFactory2)::GetProcAddress(m_Context->m_DXGIModule, "CreateDXGIFactory2"); + // if not found, this is not fatal, it will fallback (ie: on vista & xp) + if (CreateDXGIFactory2 == null) + { + CLog::Log(PK_INFO, "DXGI API 'FnCreateDXGIFactory2' not found, cannot create D3D12 context."); + return false; + } + + UINT flags = 0; + if (!PK_D3D_OK(CreateDXGIFactory2(flags, IID_PPV_ARGS(&m_Context->m_Factory)))) + return false; + + if (!CreateDevice()) + return false; + + return CreateCommandQueue() && + CreateDescriptorAllocator();; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::CreateCommandQueue() +{ + D3D12_COMMAND_QUEUE_DESC graphicsCmdQueueDesc = {}; + graphicsCmdQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; + graphicsCmdQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT; // Disable TDR for compute + graphicsCmdQueueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL; + + D3D12_COMMAND_QUEUE_DESC copyCmdQueueDesc = {}; + copyCmdQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_COPY; + copyCmdQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT; // Disable TDR for compute + copyCmdQueueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL; + + D3D12_COMMAND_QUEUE_DESC computeCmdQueueDesc = {}; + computeCmdQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_COMPUTE; + computeCmdQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT; // Disable TDR for compute + computeCmdQueueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL; + + return PK_D3D_OK(m_D3D12Context->m_Device->CreateCommandQueue(&graphicsCmdQueueDesc, IID_PPV_ARGS(&m_D3D12Context->m_CommandQueue))) && + PK_D3D_OK(m_D3D12Context->m_Device->CreateCommandQueue(©CmdQueueDesc, IID_PPV_ARGS(&m_D3D12Context->m_CopyCommandQueue))) && + PK_D3D_OK(m_D3D12Context->m_Device->CreateCommandQueue(&computeCmdQueueDesc, IID_PPV_ARGS(&m_D3D12Context->m_ComputeCommandQueue))); +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::CreateRenderTarget(RHI::EPixelFormat format, CUint3 size) +{ + if (m_Context->m_SwapChainsRTs.Count() != 0) + { + ClearContextSwapchainsRT(); + m_D3D12Manager->SwapChainRemoved(0); + } + + CD3D12SwapChainRT *swapchainRT = PK_NEW(CD3D12SwapChainRT()); + const CGuid idx = m_Context->m_SwapChainsRTs.PushBack(swapchainRT); + if (!PK_VERIFY(idx.Valid())) + { + PK_DELETE(swapchainRT); + return false; + } + m_D3D12Context->m_SwapChainCount = 1; + m_D3D12Context->m_SwapChains = TMemoryView(m_Context->m_SwapChainsRTs.ViewForWriting()); + + for (u32 i = 0; i < CAAED3D12Context::kFrameCount; ++i) + { + RHI::PD3D12RenderTarget rt = PK_NEW(RHI::CD3D12RenderTarget(RHI::SRHIResourceInfos("Render Target"))); + if (rt == null) + { + CLog::Log(PK_ERROR, "D3D12Context: CD3D12RenderTarget creation failure"); + return false; + } + ID3D12Resource *resource = null; + D3D12_HEAP_PROPERTIES heapProps = { D3D12_HEAP_TYPE_DEFAULT }; + D3D12_RESOURCE_DESC resDesc = {}; + D3D12_RESOURCE_STATES initialState = (PKRHI_D3D12_SHADER_RESOURCE_STATE); + D3D12_CLEAR_VALUE defaultClearValue; + + resDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + resDesc.Alignment = 0; + resDesc.Width = size.x(); + resDesc.Height = size.y(); + resDesc.DepthOrArraySize = 1; + resDesc.MipLevels = 1; + resDesc.Format = RHI::D3DConversion::PopcornToD3DPixelFormat(format); + resDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + resDesc.SampleDesc.Count = 1; + resDesc.SampleDesc.Quality = 0; + + defaultClearValue.Format = RHI::D3DConversion::PopcornToD3DPixelFormat(format); + for (u32 c = 0; c < 4; ++c) + defaultClearValue.Color[c] = 0.0f; + + if (PK_D3D_FAILED(m_D3D12Context->m_Device->CreateCommittedResource(&heapProps, D3D12_HEAP_FLAG_NONE, &resDesc, initialState, null, PK_RHI_IID_PPV_ARGS(&resource)))) + { + CLog::Log(PK_ERROR, "D3D12Context: CreateCommittedResource failure"); + m_D3D12Context->m_SwapChainCount = 0; + m_D3D12Context->m_SwapChains = TMemoryView(); + ClearContextSwapchainsRT(); + return false; + } + rt->D3D12SetRenderTarget(resource, format, size.xy(), true, null, RHI::SampleCount1); + m_Resources[i] = resource; + + RHI::PReadBackTexture readbackTex = m_D3D12Manager->CreateReadBackTexture(RHI::SRHIResourceInfos("readback Texture"), rt); + + if (readbackTex == null) + { + CLog::Log(PK_ERROR, "D3D12Context: CreateReadBackTexture failure"); + return false; + } + m_Context->m_SwapChainsRTs[0]->m_RenderTargets[i] = rt; + m_Context->m_SwapChainsRTs[0]->m_ReadbackTextures[i] = CastD3D12(readbackTex); + } + m_D3D12Manager->SwapChainAdded(); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::SetAsCurrent(void *deviceContext) +{ + (void)deviceContext; + return true; +} + +//---------------------------------------------------------------------------- + +PRefCountedMemoryBuffer CAAED3D12Context::CreateBufferFromReadBackTexture(RHI::PCReadBackTexture readBackTexture) const +{ + PK_SCOPEDPROFILE(); + + u32 size = RHI::PixelFormatHelpers::PixelFormatToPixelByteSize(readBackTexture->GetFormat()) * readBackTexture->GetSize().x() * readBackTexture->GetSize().y(); + PRefCountedMemoryBuffer rawBuffer = CRefCountedMemoryBuffer::AllocAligned(size); + + if (rawBuffer == null) + { + CLog::Log(PK_ERROR, "D3D12Context: CreateBufferFromReadBackTexture alloc failure"); + return null; + } + + RHI::PCD3D12ReadBackTexture d3dReadBackTex = CastD3D12(readBackTexture); + ID3D12Resource *d3dResource = d3dReadBackTex->D3D12GetResource(); + void *mappedData; + + if (PK_D3D_FAILED(d3dResource->Map(0, null, &mappedData))) + { + CLog::Log(PK_ERROR, "D3D12Context: map failure"); + return null; + } + + const u32 rowcount = d3dReadBackTex->D3D12GetFootprint().m_RowCount; + const u32 rowpitch = d3dReadBackTex->D3D12GetFootprint().m_Footprint.Footprint.RowPitch; + const u64 rowsize = d3dReadBackTex->D3D12GetFootprint().m_RowSizeInBytes; + + for (u32 r = 0; r < rowcount; ++r) + { + Mem::Copy(Mem::AdvanceRawPointer(rawBuffer->Data(), r * rowsize), Mem::AdvanceRawPointer(mappedData, r * rowpitch), rowsize); + } + + d3dResource->Unmap(0, null); + return rawBuffer; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::FillRenderBuffer(PRefCountedMemoryBuffer dstBuffer, RHI::PFrameBuffer srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) +{ + (void)rowLength; + + PK_SCOPEDPROFILE(); + + { + PK_NAMEDSCOPEDPROFILE("m_Fence->Wait"); + m_Fence->Wait(m_FrameCount); + } + RHI::PReadBackTexture rbTexture = m_Context->m_SwapChainsRTs[0]->m_ReadbackTextures[m_Context->m_SwapChainsRTs[0]->m_BufferIndex]; + if (rbTexture == null) + { + CLog::Log(PK_ERROR, "D3D12Context: No readback texture in swap chain"); + return false; + } + + + { + PK_NAMEDSCOPEDPROFILE("Copy Task Creation And Kick"); + + PRefCountedMemoryBuffer buffer = CreateBufferFromReadBackTexture(rbTexture); + + if (buffer == null) + { + CLog::Log(PK_ERROR, "D3D12Context: Create buffer from readback texture failed"); + return false; + } + + BYTE *sptr = buffer->Data< BYTE>(); + BYTE *dptr = (BYTE*)dstBuffer->Data(); + + const u32 formatSize = RHI::PixelFormatHelpers::PixelFormatToPixelByteSize(format); + const u32 widthSize = (formatSize * width); + u32 taskRowNumbers = height / m_WorkerCount; + u32 reminder = height % m_WorkerCount; + TAtomic counter = 0; + Threads::CEvent event; + + for (u32 i = 0; i < m_WorkerCount; ++i) + { + m_Tasks[i] = PK_NEW(CAsynchronousJob_CopyTextureTask); + if (m_Tasks[i] == null) + { + + CLog::Log(PK_ERROR, "D3D12Context: Create task copy texture failed"); + return false; + } + m_Tasks[i]->m_TargetCount = m_WorkerCount; + + m_Tasks[i]->m_Counter = &counter; + m_Tasks[i]->m_EndCB = &event; + + if (i == (m_WorkerCount - 1)) + m_Tasks[i]->m_Height = taskRowNumbers + reminder; + else + m_Tasks[i]->m_Height = taskRowNumbers; + m_Tasks[i]->m_StartOffset = i * taskRowNumbers; + m_Tasks[i]->m_DestinationPtr = dptr; + m_Tasks[i]->m_SourcePtr = sptr; + m_Tasks[i]->m_WidthSize = widthSize; + m_Tasks[i]->m_RowPitch = formatSize * width; + } + + for (u32 i = 1; i < m_WorkerCount; ++i) + { + m_Tasks[i]->AddToPool(Scheduler::ThreadPool()); + } + + Scheduler::ThreadPool()->KickTasks(true); + + m_Tasks[0]->ImmediateExecute(); + + { + PK_NAMEDSCOPEDPROFILE("WaitMergeTask"); + + event.Wait(); + + for (u32 i = 0; i < m_WorkerCount; ++i) + { + if (!m_Tasks[i]->Done()) + i = 0; + } + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CAAED3D12Context::FillCompositingTexture(void *srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) +{ + (void)rowLength; + + PK_SCOPEDPROFILE(); + + CImageMap image(CUint3(width, height, 1), srcBuffer, RHI::PixelFormatHelpers::PixelFormatToPixelByteSize(format) * width * height); + + PK_TODO("Optim: Use GPU Swizzle instead of CPU"); + + RHI::PTexture textureSrc = m_D3D12Manager->CreateTexture(RHI::SRHIResourceInfos("CompositingTexture"), TMemoryView(image), format); + + m_CompositingTexture = textureSrc; + return true; +} + +//---------------------------------------------------------------------------- + +TMemoryView CAAED3D12Context::GetCurrentSwapChain() +{ + if (PK_VERIFY(!m_D3D12Context->m_SwapChains.Empty())) + return m_D3D12Context->m_SwapChains[0]->GetRenderTargets(); + + return TMemoryView(); +} + +//---------------------------------------------------------------------------- + +void CAAED3D12Context::ClearContextSwapchainsRT() +{ + for (u32 i = 0; i < m_Context->m_SwapChainsRTs.Count(); ++i) + { + PK_DELETE(m_Context->m_SwapChainsRTs[i]); + } + m_Context->m_SwapChainsRTs.Clear(); +} + +//---------------------------------------------------------------------------- + +__AEGP_PK_END + +#endif diff --git a/AE_GeneralPlugin/Sources/RenderApi/AEGP_MetalContext.mm b/AE_GeneralPlugin/Sources/RenderApi/AEGP_MetalContext.mm new file mode 100644 index 00000000..0feeda65 --- /dev/null +++ b/AE_GeneralPlugin/Sources/RenderApi/AEGP_MetalContext.mm @@ -0,0 +1,188 @@ +#include "ae_precompiled.h" +#include "RenderApi/AEGP_MetalContext.h" + +#if defined(PK_MACOSX) +#if (PK_BUILD_WITH_METAL_SUPPORT != 0) + +#include "AEGP_World.h" + +#include +#include +#include +#include + +#include + +#include + +#include + +__AEGP_PK_BEGIN + +CAAEMetalContext *CAAEMetalContext::m_Instance = null; + +struct SMetalPlatformContext +{ + RHI::SMetalBasicContext *m_MetalContext; + RHI::CMetalApiManager *m_MetalManager; + RHI::PMetalRenderTarget m_MetalFinalRT; + PKSample::CMetalContext::SFinalBlit m_FinalBlit; + + SMetalPlatformContext() + { + } + + ~SMetalPlatformContext() + { + m_MetalContext = null; + m_MetalManager = null; + } +}; + +CAAEMetalContext::CAAEMetalContext() +: m_Data(null) +{ + m_ApiManager = PK_NEW(RHI::CMetalApiManager); + m_ApiContext = PK_NEW(RHI::SMetalBasicContext); + m_Data = PK_NEW(SMetalPlatformContext); + m_Data->m_MetalContext = static_cast(m_ApiContext); + m_Data->m_MetalManager = static_cast(m_ApiManager.Get()); +} + +CAAEMetalContext::~CAAEMetalContext() +{ + PK_SAFE_DELETE(m_Data); + PK_SAFE_DELETE(m_ApiContext); + m_ApiManager = null; +} + +bool CAAEMetalContext::BeginFrame() +{ + m_ApiManager->BeginFrame(0); + LogApiError(); + return true; +} + +bool CAAEMetalContext::EndFrame() +{ + void *syncRenderData = m_ApiManager->EndFrame(); + if (syncRenderData == null) + return false; + m_LastFrameSyncInfo = reinterpret_cast(syncRenderData); + PKSample::CMetalContext::EndFrame( m_Data->m_MetalContext->m_Queue, + m_Data->m_MetalContext->m_SwapChains, + m_Data->m_FinalBlit, + m_LastFrameSyncInfo, + true, + m_Data->m_MetalFinalRT); + return false; + return true; +} + +void CAAEMetalContext::LogApiError() +{ +} + +bool CAAEMetalContext::InitIFN() +{ + if (m_Initialized) + return true; + m_Initialized = true; + m_ApiContext->m_Api = RHI::GApi_Metal; + id device = MTLCreateSystemDefaultDevice(); + if (!PK_VERIFY(device != null)) + return false; + id queue = [device newCommandQueue]; + if (!PK_VERIFY(queue != null)) + return false; + m_Data->m_MetalContext->m_Device = device; + m_Data->m_MetalContext->m_Queue = queue; + if (!m_Data->m_MetalManager->InitApi(m_Data->m_MetalContext)) + return false; + if (!PKSample::CMetalContext::CreateFinalBlitData(device, m_Data->m_FinalBlit, RHI::FormatFloat32RGBA)) + return false; + return true; +} + +bool CAAEMetalContext::CreateRenderTarget(RHI::EPixelFormat format, CUint3 size) +{ + RHI::PMetalRenderTarget mtlRt = PK_NEW(RHI::CMetalRenderTarget(RHI::SRHIResourceInfos("Render Target"), null)); + + if (!PK_VERIFY(mtlRt != null)) + return false; + if (!PK_VERIFY(mtlRt->MetalCreateRenderTarget(size.xy(), format, true, RHI::SampleCount1, m_Data->m_MetalContext->m_Device))) + return false; + + m_Data->m_MetalFinalRT = PKSample::CMetalContext::MetalCreateRenderTarget(m_Data->m_MetalContext->m_Device, size.xy(), RHI::FormatFloat32RGBA, true); + + if (m_Data->m_MetalContext->m_SwapChainCount != 0) + { + m_Data->m_MetalContext->m_SwapChains.Clear(); + m_Data->m_MetalManager->SwapChainRemoved(0); + } + m_Data->m_MetalContext->m_SwapChains.PushBack().Valid(); + m_Data->m_MetalContext->m_SwapChains.Last().m_RenderTarget = mtlRt; + m_Data->m_MetalContext->m_SwapChainCount = 1; + + if (!m_Data->m_MetalManager->SwapChainAdded()) + return false; + return true; +} + +bool CAAEMetalContext::FillRenderBuffer(PRefCountedMemoryBuffer dstBuffer, RHI::PFrameBuffer srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) +{ + (void)rowLength; + (void)srcBuffer; + if (!PK_VERIFY(m_LastFrameSyncInfo != null)) + return false; + + const u32 formatSize = RHI::PixelFormatHelpers::PixelFormatToPixelByteSize(format); + const u32 widthSize = (formatSize * width); + const u32 bytesPerImage = RHI::PixelFormatHelpers::GetTextureBufferSize(format, CUint2(width, height)); + u8 *dstBuffBytes = (u8*)dstBuffer->Data(); + id mtlTexture = m_Data->m_MetalFinalRT->MetalGetTexture(); + + PK_ASSERT(dstBuffer->DataSizeInBytes() >= bytesPerImage); + + // Synchronize the command buffer: + { + PK_SCOPEDLOCK(m_LastFrameSyncInfo->m_SwapChainDoneCountLock); + if (m_LastFrameSyncInfo->m_SwapChainDoneCount < m_LastFrameSyncInfo->m_SwapChainToWait) + m_LastFrameSyncInfo->m_CondVar.Wait(m_LastFrameSyncInfo->m_SwapChainDoneCountLock); + m_LastFrameSyncInfo->m_SwapChainDoneCount = 0; + m_LastFrameSyncInfo->m_SwapChainToWait = 0; + } + + [mtlTexture getBytes:dstBuffBytes bytesPerRow:widthSize bytesPerImage:bytesPerImage fromRegion:MTLRegionMake2D(0, 0, width, height) mipmapLevel:0 slice:0]; + return true; +} + +bool CAAEMetalContext::FillCompositingTexture(void *srcBuffer, RHI::EPixelFormat format, u32 width, u32 height, u32 rowLength) +{ + (void)rowLength; + PK_SCOPEDPROFILE(); + + CImageMap image(CUint3(width, height, 1), srcBuffer, RHI::PixelFormatHelpers::PixelFormatToPixelByteSize(format) * width * height); + + RHI::PTexture textureSrc = m_Data->m_MetalManager->CreateTexture(RHI::SRHIResourceInfos("Texture"), TMemoryView(image), format); + + m_CompositingTexture = textureSrc; + return true; +} + +TMemoryView CAAEMetalContext::GetCurrentSwapChain() +{ + return TMemoryView(m_Data->m_MetalContext->m_SwapChains.Last().m_RenderTarget); +} + +bool CAAEMetalContext::CreatePlatformContext(void *window, void *deviceContext) +{ + (void)window; (void)deviceContext; + return true; +} + +__AEGP_PK_END + + +#endif //PK_BUILD_WITH_METAL_SUPPORT != 0 +#endif //PK_MACOSX \ No newline at end of file diff --git a/AE_Suites/PopcornFX_BasePluginInterface.h b/AE_Suites/PopcornFX_BasePluginInterface.h new file mode 100644 index 00000000..c588f829 --- /dev/null +++ b/AE_Suites/PopcornFX_BasePluginInterface.h @@ -0,0 +1,293 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __FX_BASEPLUGININTERFACE_H__ +#define __FX_BASEPLUGININTERFACE_H__ + +#include "PopcornFX_Define.h" +#include "PopcornFX_Suite.h" + +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +const float k_MinFloat = -100000.0f; +const float k_MaxFloat = 100000.0f; + +//---------------------------------------------------------------------------- + +class CBasePluginInterface +{ +public: + virtual ~CBasePluginInterface() { } + +#if defined(PK_WINDOWS) +#pragma warning( push ) +#pragma warning( disable : 4100 ) //Disable unused parameters +#endif + + virtual PF_Err About(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) { (void)AAEData; (void)params; (void)output; return A_Err_NONE; }; + virtual PF_Err GlobalSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) { (void)AAEData; (void)params; (void)output; return A_Err_NONE; }; + virtual PF_Err ParamsSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) { (void)AAEData; (void)params; (void)output; return A_Err_NONE; }; + virtual PF_Err GlobalSetdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) { (void)AAEData; (void)params; (void)output; return A_Err_NONE; }; + virtual PF_Err SequenceSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) { (void)AAEData; (void)params; (void)output; return A_Err_NONE; }; + virtual PF_Err SequenceReSetup(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) { (void)AAEData; (void)params; (void)output; return A_Err_NONE; }; + virtual PF_Err SequenceFlatten(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) { (void)AAEData; (void)params; (void)output; return A_Err_NONE; }; + virtual PF_Err SequenceShutdown(SAAEIOData &AAEData, PF_ParamDef *params[], PF_LayerDef *output) { (void)AAEData; (void)params; (void)output; return A_Err_NONE; }; + virtual PF_Err PreRender(SAAEIOData &AAEData) { (void)AAEData; return A_Err_NONE; }; + virtual PF_Err SmartRender(SAAEIOData &AAEData) { (void)AAEData; return A_Err_NONE; }; + virtual PF_Err ParamValueChanged(SAAEIOData &AAEData, PF_ParamDef *params[]) { (void)AAEData; (void)params; return A_Err_NONE; }; + virtual PF_Err UpdateParamsUI(SAAEIOData &AAEData, PF_ParamDef *params[]) { (void)AAEData; (void)params; return A_Err_NONE; }; + virtual PF_Err HandleDataFromAEGP(SAAEIOData &AAEData, PF_ParamDef *params[]) { (void)AAEData; (void)params; return A_Err_NONE; }; + virtual PF_Err QueryDynamicFlags(SAAEIOData &AAEData, PF_ParamDef *params[]) { (void)AAEData; (void)params; return A_Err_NONE; }; + +#if defined(PK_WINDOWS) +#pragma warning( pop ) +#endif + const int *GetParametersIndexes() + { + return m_ParametersIndexes; + }; + + PF_Err SetEffectName(SAAEIOData &AAEData, std::string &name, AEGP_EffectRefH effect = nullptr) + { + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEGP_EffectRefH effectRef = effect; + A_UTF16Char nameUTF[64]; + AEGP_StreamRefH streamRef = nullptr; + AEGP_StreamRefH effectStreamRef = nullptr; + PF_Err result = A_Err_NONE; + + AE_VERIFY(name.size() < 64); + if (effectRef == nullptr) + { + result = suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + if (!AE_VERIFY(result == A_Err_NONE)) + return result; + } + + result |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AAEID, effectRef, 1, &streamRef); + if (!AE_VERIFY(result == A_Err_NONE)) + return result; + CopyCharToUTF16(name.data(), nameUTF); + + result |= suites.DynamicStreamSuite4()->AEGP_GetNewParentStreamRef(m_AAEID, streamRef, &effectStreamRef); + result |= suites.StreamSuite2()->AEGP_DisposeStream(streamRef); + streamRef = nullptr; + if (!AE_VERIFY(result == A_Err_NONE)) + return result; + result |= suites.DynamicStreamSuite4()->AEGP_SetStreamName(effectStreamRef, nameUTF); + result |= suites.StreamSuite2()->AEGP_DisposeStream(effectStreamRef); + + effectStreamRef = nullptr; + if (effect == nullptr) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + return result; + } + + PF_Err SetParameterStreamName(SAAEIOData &AAEData, std::string &str, unsigned int index, AEGP_EffectRefH effect = nullptr) + { + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + PF_Err result = PF_Err_NONE; + A_UTF16Char strUTF[256]; + AEGP_StreamRefH streamRef = nullptr; + AEGP_EffectRefH effectRef = effect; + + AE_VERIFY(str.size() < 256); + if (effectRef == nullptr) + { + result = suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + if (!AE_VERIFY(result == A_Err_NONE)) + return result; + } + CopyCharToUTF16(str.data(), strUTF); + + result |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AAEID, effectRef, index, &streamRef); + result |= suites.DynamicStreamSuite4()->AEGP_SetStreamName(streamRef, strUTF); + result |= suites.StreamSuite2()->AEGP_DisposeStream(streamRef); + + AAEData.m_OutData->out_flags |= PF_OutFlag_REFRESH_UI; + if (effect == nullptr) + { + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + } + return result; + } + + PF_Err GetParamsSequenceUID(SAAEIOData &AAEData, std::string &out, unsigned int index, AEGP_EffectRefH effect = nullptr) + { + AEGP_SuiteHandler suites(AAEData.m_InData->pica_basicP); + AEGP_StreamRefH streamRef = nullptr; + AEGP_EffectRefH effectRef = effect; + PF_Err result = PF_Err_NONE; + + AEGP_MemHandle nameHandle; + aechar_t *wname; + + out.clear(); + if (effectRef == nullptr) + { + result |= suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(m_AAEID, AAEData.m_InData->effect_ref, &effectRef); + if (!AE_VERIFY(result == A_Err_NONE)) + return result; + } + result |= suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(m_AAEID, effectRef, index, &streamRef); + + result |= suites.StreamSuite5()->AEGP_GetStreamName(m_AAEID, streamRef, false, &nameHandle); + result |= suites.StreamSuite2()->AEGP_DisposeStream(streamRef); + streamRef = nullptr; + + result |= suites.MemorySuite1()->AEGP_LockMemHandle(nameHandle, reinterpret_cast(&wname)); + + WCharToString(wname, &out); + + result |= suites.MemorySuite1()->AEGP_UnlockMemHandle(nameHandle); + result |= suites.MemorySuite1()->AEGP_FreeMemHandle(nameHandle); + + if (effect == nullptr) + result |= suites.EffectSuite4()->AEGP_DisposeEffect(effectRef); + effectRef = nullptr; + return result; + } + + void MakeParamCopy(PF_ParamDef *actual[], PF_ParamDef copy[], A_short arraySize) + { + for (A_short iS = 0; iS < arraySize; ++iS) { + AEFX_CLR_STRUCT(copy[iS]); + copy[iS] = *actual[iS]; + } + } + + PF_Err AddAngleParameter(PF_InData *in_data, const char *name, unsigned int id, float defaultValue = 0.0f, PF_ParamFlags flags = 0, PF_ParamUIFlags uiFlags = 0) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + def.flags = flags; + def.ui_flags = uiFlags; + PF_ADD_ANGLE(name, defaultValue, id); + + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + + PF_Err AddPercentParameter(PF_InData *in_data, const char *name, unsigned int id, int defaultValue = 0, PF_ParamFlags flags = 0, PF_ParamUIFlags uiFlags = 0) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + def.flags = flags; + def.ui_flags = uiFlags; + PF_ADD_PERCENT(name, defaultValue, id); + + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + + PF_Err AddCheckBoxParameter(PF_InData *in_data, const char *name, unsigned int id, bool defaultValue = false, PF_ParamFlags flags = 0, PF_ParamUIFlags uiFlags = 0) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + def.flags = flags; + def.ui_flags = uiFlags; + PF_ADD_CHECKBOX(name, "", defaultValue, flags, id); + + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + + PF_Err AddFloatParameter(PF_InData *in_data, const char *name, unsigned int id, float defaultValue = 0.0f, float min = 0.0f, float max = 0.0f, PF_ParamFlags flags = 0, PF_ParamUIFlags uiFlags = 0) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + def.flags = flags; + def.ui_flags = uiFlags; + PF_ADD_FLOAT_SLIDER(name, min, max, min, max, + 0/*Curve tolerance*/, defaultValue, 2/*float*/, 0/*display_flags*/, 0/*want phase*/, id); + + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + + PF_Err AddFloatParameterUnbound(PF_InData *in_data, const char *name, unsigned int id, float defaultValue = 0.0f, PF_ParamFlags flags = 0, PF_ParamUIFlags uiFlags = 0) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + def.flags = flags; + def.ui_flags = uiFlags; + PF_ADD_FLOAT_SLIDER(name, k_MinFloat, k_MaxFloat, k_MinFloat, k_MaxFloat, + 0/*Curve tolerance*/, defaultValue, 2/*float*/, 0/*display_flags*/, 0/*want phase*/, id); + + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + + PF_Err AddIntParameter(PF_InData *in_data, const char *name, unsigned int id, int defaultValue = 0, int min = 0, int max = 0, PF_ParamFlags flags = 0, PF_ParamUIFlags uiFlags = 0) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + def.flags = flags; + def.ui_flags = uiFlags; + PF_ADD_FLOAT_SLIDER(name, (PF_FpShort)min, (PF_FpShort)max, (PF_FpShort)min, (PF_FpShort)max, + 0/*Curve tolerance*/, defaultValue, 0/*int*/, 0/*display_flags*/, 0/*want phase*/, id); + + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + + PF_Err AddIntParameterUnbound(PF_InData *in_data, const char *name, unsigned int id, int defaultValue = 0, PF_ParamFlags flags = 0, PF_ParamUIFlags uiFlags = 0) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + def.flags = flags; + def.ui_flags = uiFlags; + PF_ADD_FLOAT_SLIDER(name, k_MinFloat, k_MaxFloat, k_MinFloat, k_MaxFloat, + 0/*Curve tolerance*/, defaultValue, 0/*int*/, 0/*display_flags*/, 0/*want phase*/, id); + + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + + PF_Err StartParameterCategory(PF_InData *in_data, const char *name, unsigned int id) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + PF_ADD_TOPIC(name, id); + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + + PF_Err EndParameterCategory(PF_InData *in_data, unsigned int id) + { + PF_ParamDef def; + + AEFX_CLR_STRUCT(def); + PF_END_TOPIC(id); + m_ParametersIndexes[id] = ++m_CurrentIndex; + return PF_Err_NONE; + } + +protected: + AEGP_PluginID m_AAEID; + int *m_ParametersIndexes = nullptr; + int m_CurrentIndex = 0; +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#endif + diff --git a/AE_Suites/PopcornFX_Define.h b/AE_Suites/PopcornFX_Define.h new file mode 100644 index 00000000..1ceae62c --- /dev/null +++ b/AE_Suites/PopcornFX_Define.h @@ -0,0 +1,90 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#include + +//---------------------------------------------------------------------------- + +#if (defined(MACOSX) || defined(__APPLE__) || defined(__apple__) || defined(macosx) || defined(MACOS_X)) && !defined(PK_MACOSX) +# define PK_MACOSX +#elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__win32__)) && !defined(PK_WINDOWS) +# define PK_WINDOWS +#endif + +//---------------------------------------------------------------------------- + +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned short u_int16; +typedef unsigned long u_long; +typedef short int int16; +typedef float fpshort; + +//---------------------------------------------------------------------------- + +#define __AAEPK_BEGIN namespace AAePk { +#define __AAEPK_END } + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +#define PK_SCALE_DOWN 1 + +#define TEST_COLOR_PROFILE 1 + +#define PF_TABLE_BITS 12 + +#define PF_DEEP_COLOR_AWARE 1 // make sure we get 16bpc pixels; + +#define A_INTERNAL_TEST_ONE 0 + +inline bool ae_verify(bool condition) +{ +#if defined(PK_WINDOWS) + // Only breaks on windows for now + // should add a raise(SIGTRAP) for macos + if (condition == false) + __debugbreak(); +#endif + return condition; +} + +#ifndef AE_STRINGIFY +# define AE_STRINGIFY(s) __AE_STRINGIFY(s) +# define __AE_STRINGIFY(s) # s // don't directly use this one +#endif // !PK_STRINGIFY + +#define AE_MESSAGE(__msg) __pragma(message(__msg)) +#define AE_TODO(__msg) AE_MESSAGE(__FILE__ "(" AE_STRINGIFY(__LINE__) ") /!\\/!\\/!\\/!\\ TODO /!\\/!\\/!\\/!\\ " __msg) + +#define AE_VERIFY(__condition) ae_verify(__condition) + +// sub (shared) context +#ifndef WGL_CONTEXT_MAJOR_VERSION_ARB +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#endif + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#include + +/* Versioning information */ +#define AEPOPCORNFX_MAJOR_VERSION PK_VERSION_MAJOR +#define AEPOPCORNFX_MINOR_VERSION PK_VERSION_MINOR +#define AEPOPCORNFX_BUG_VERSION PK_VERSION_PATCH +#define AEPOPCORNFX_STAGE_VERSION PF_Stage_DEVELOP +#include "PopcornFX_Define_Version.h" + +typedef char16_t aechar_t; + +//---------------------------------------------------------------------------- diff --git a/AE_Suites/PopcornFX_Define_Version.h b/AE_Suites/PopcornFX_Define_Version.h new file mode 100644 index 00000000..94579e4b --- /dev/null +++ b/AE_Suites/PopcornFX_Define_Version.h @@ -0,0 +1,9 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +//---------------------------------------------------------------------------- + +#define AEPOPCORNFX_BUILD_VERSION 1 +#define AEPOPCORNFX_PIPL_VERSION 1148929 //AEPOPCORNFX_MAJOR_VERSION * 524288 + AEPOPCORNFX_MINOR_VERSION * 32768 + AEPOPCORNFX_BUG_VERSION * 2048 + AEPOPCORNFX_STAGE_VERSION * 512 + AEPOPCORNFX_BUILD_VERSION - 1 diff --git a/AE_Suites/PopcornFX_Suite.h b/AE_Suites/PopcornFX_Suite.h new file mode 100644 index 00000000..251df69d --- /dev/null +++ b/AE_Suites/PopcornFX_Suite.h @@ -0,0 +1,1407 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __POPCORNFX_SUITE_H__ +#define __POPCORNFX_SUITE_H__ + +#include "A.h" +#include + +#ifdef AE_OS_WIN +#include +#endif + +#include + +//AE +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PopcornFX_Define.h" + +#include +#include +#include + +//---------------------------------------------------------------------------- + +#define kPopcornFXSuite1 "AEGP PopcornFX Suite" +#define kPopcornFXSuiteVersion1 1 + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +enum EPKChildPlugins +{ + EMITTER = 0, + ATTRIBUTE, + SAMPLER, + _PLUGIN_COUNT +}; + +#pragma region Emitter + +//---------------------------------------------------------------------------- + +enum EGaussianBlurPixelRadius +{ + GaussianBlurPixelRadius_5 = 1, + GaussianBlurPixelRadius_9, + GaussianBlurPixelRadius_13, + __GaussianBlurPixelRadius_Count = GaussianBlurPixelRadius_13 +}; + +//---------------------------------------------------------------------------- + +enum ELightCategory +{ + ELightCategory_Debug_Default = 1, + ELightCategory_Compo_Default, + ELightCategory_Compo_Custom, + __ELightCategory_Count = ELightCategory_Compo_Custom +}; + +//---------------------------------------------------------------------------- + +enum ETransformType +{ + ETransformType_3D = 1, + ETransformType_2D, + __ETransformType_Count = ETransformType_2D +}; + +//---------------------------------------------------------------------------- + +enum ECameraType +{ + ECameraType_Compo_Default = 1, + ECameraType_Compo_Custom, + __ECameraType_Count = ECameraType_Compo_Custom +}; + +//---------------------------------------------------------------------------- + +enum ERenderType +{ + RenderType_FinalCompositing = 1, + RenderType_Emissive, + RenderType_Albedo, + RenderType_Normal, + RenderType_Depth, + __RenderType_Count = RenderType_Depth +}; + +//---------------------------------------------------------------------------- + +enum EInterpolationType +{ + EInterpolationType_Point = 1, + EInterpolationType_Trilinear, + EInterpolationType_Quadrilinear, + __EInterpolationType_Count = EInterpolationType_Quadrilinear +}; + +//---------------------------------------------------------------------------- + +// Add new effect parameters at the end of this enum +enum EEffectParameterType +{ + Effect_Parameters_InputReserved = 0, + + Effect_Parameters_Infernal_Autorender, + + Effect_Parameters_Path, + Effect_Parameters_Path_Reimport, + + Effect_Parameters_Infernal_Effect_Path_Hash, + + Effect_Topic_Transform_Start, + Effect_Parameters_Position, + Effect_Parameters_Rotation_X, + Effect_Parameters_Rotation_Y, + Effect_Parameters_Rotation_Z, + Effect_Topic_Transform_End, + + Effect_Parameters_Seed, + + + Effect_Topic_Rendering_Start, + + Effect_Parameters_Background_Toggle, + Effect_Parameters_Background_Opacity, + + Effect_Parameters_Render_Type, // PF_ParamFlag_CANNOT_TIME_VARY | PF_ParamFlag_CANNOT_INTERP + + Effect_Topic_Camera_Start, + Effect_Parameters_Camera, + Effect_Parameters_Camera_Position, + Effect_Parameters_Camera_Rotation_X, + Effect_Parameters_Camera_Rotation_Y, + Effect_Parameters_Camera_Rotation_Z, + Effect_Parameters_Camera_FOV, + Effect_Parameters_Camera_Near, + Effect_Parameters_Camera_Far, + Effect_Topic_Camera_End, + + Effect_Parameters_Receive_Light, // PF_ParamFlag_CANNOT_TIME_VARY || PF_ParamFlag_CANNOT_INTERP + + Effect_Topic_PostFX_Start, + Effect_Topic_Distortion_Start, + Effect_Parameters_Distortion_Enable, // PF_ParamFlag_CANNOT_TIME_VARY || PF_ParamFlag_CANNOT_INTERP + Effect_Topic_Distortion_End, + + Effect_Topic_Bloom_Start, + Effect_Parameters_Bloom_Enable, // PF_ParamFlag_CANNOT_TIME_VARY || PF_ParamFlag_CANNOT_INTERP + Effect_Parameters_Bloom_BrightPassValue, + Effect_Parameters_Bloom_Intensity, + Effect_Parameters_Bloom_Attenuation, + Effect_Parameters_Bloom_GaussianBlur, // PF_ParamFlag_CANNOT_TIME_VARY || PF_ParamFlag_CANNOT_INTERP + Effect_Parameters_Bloom_RenderPassCount, // PF_ParamFlag_CANNOT_TIME_VARY || PF_ParamFlag_CANNOT_INTERP + Effect_Topic_Bloom_End, + + Effect_Topic_ToneMapping_Start, + Effect_Parameters_ToneMapping_Enable, // PF_ParamFlag_CANNOT_TIME_VARY || PF_ParamFlag_CANNOT_INTERP + Effect_Parameters_ToneMapping_Saturation, + Effect_Parameters_ToneMapping_Exposure, + Effect_Topic_ToneMapping_End, + Effect_Topic_PostFX_End, + + Effect_Topic_Rendering_End, + + Effect_Topic_BackdropMesh_Start, + Effect_Parameters_BackdropMesh_Enable_Rendering, + Effect_Parameters_BackdropMesh_Enable_Collisions, + Effect_Parameters_BackdropMesh_Path, + Effect_Parameters_BackdropMesh_Reset, + + Effect_Topic_BackdropMesh_Transform_Start, + Effect_Parameters_BackdropMesh_Position, + Effect_Parameters_BackdropMesh_Rotation_X, + Effect_Parameters_BackdropMesh_Rotation_Y, + Effect_Parameters_BackdropMesh_Rotation_Z, + Effect_Parameters_BackdropMesh_Scale_X, + Effect_Parameters_BackdropMesh_Scale_Y, + Effect_Parameters_BackdropMesh_Scale_Z, + Effect_Topic_BackdropMesh_Transform_End, + Effect_Parameters_BackdropMesh_Roughness, + Effect_Parameters_BackdropMesh_Metalness, + Effect_Topic_BackdropMesh_End, + + Effect_Topic_BackdropEnvMap_Start, + Effect_Parameters_BackdropEnvMap_Enable_Rendering, + Effect_Parameters_BackdropEnvMap_Path, + Effect_Parameters_BackdropEnvMap_Reset, + Effect_Parameters_BackdropEnvMap_Intensity, + Effect_Parameters_BackdropEnvMap_Color, + Effect_Topic_BackdropEnvMap_End, + + Effect_Topic_Light_Start, + Effect_Parameters_Light_Category, + Effect_Parameters_Light_Direction, + Effect_Parameters_Light_Intensity, + Effect_Parameters_Light_Color, + Effect_Parameters_Light_Ambient, + Effect_Topic_Light_End, + + Effect_Parameters_Scale_Factor, + Effect_Parameters_Refresh_Render, + + Effect_Parameters_Seeking_Toggle, + Effect_Parameters_Simulation_State, + + Effect_Parameters_BackdropMesh_Enable_Animation, + + Effect_Topic_FXAA_Start, + Effect_Parameters_FXAA_Enable, // PF_ParamFlag_CANNOT_TIME_VARY || PF_ParamFlag_CANNOT_INTERP + Effect_Topic_FXAA_End, + + Effect_Parameters_Path_Marketplace, + + Effect_Parameters_TransformType, + Effect_Parameters_Position_2D, + Effect_Parameters_Position_2D_Distance, + + Effect_Topic_BackdropAudio_Start, + Effect_Parameters_Audio, + Effect_Topic_BackdropAudio_End, + + Effect_Parameters_BringEffectIntoView, + __Effect_Parameters_Count +}; + +//---------------------------------------------------------------------------- + +struct SPostFXDistortionDesc +{ + bool m_Enable; +}; + +//---------------------------------------------------------------------------- + +struct SPostFXBloomDesc +{ + bool m_Enable; + float m_BrightPassValue; + float m_Intensity; + float m_Attenuation; + EGaussianBlurPixelRadius m_GaussianBlur; + int m_RenderPassCount; +}; + +//---------------------------------------------------------------------------- + +struct SPostFXToneMappingDesc +{ + bool m_Enable; + + float m_Saturation; + float m_Exposure; +}; + +//---------------------------------------------------------------------------- + +struct SPostFXAADesc +{ + bool m_Enable; +}; + +//---------------------------------------------------------------------------- + +struct SRenderingDesc +{ + ERenderType m_Type; + bool m_ReceiveLight; + + SPostFXDistortionDesc m_Distortion; + SPostFXBloomDesc m_Bloom; + SPostFXToneMappingDesc m_ToneMapping; + SPostFXAADesc m_FXAA; +}; + +//---------------------------------------------------------------------------- + +struct SLightDesc +{ + bool m_Internal = true; + ELightCategory m_Category; + + A_FloatPoint3 m_Direction; + A_FloatPoint3 m_Position; + A_FloatPoint3 m_Color; + A_FloatPoint3 m_Ambient; + float m_Intensity; + float m_Angle; + float m_Feather; + + AEGP_LightType m_Type; +}; + +//---------------------------------------------------------------------------- + +struct SCameraDesc +{ + bool m_Internal = false; + bool m_AECameraPresent = false; + + A_FloatPoint3 m_Position; + A_FloatPoint3 m_Rotation; + + float m_FOV; + float m_Near = 0.1f; + float m_Far = 1000; + +}; + +//---------------------------------------------------------------------------- + +struct SBackdropMesh +{ + std::string m_Path; + + bool m_EnableRendering; + bool m_EnableCollisions; + bool m_EnableAnimations; + + A_FloatPoint3 m_Position; + A_FloatPoint3 m_Rotation; + A_FloatPoint3 m_Scale; + + float m_Roughness; + float m_Metalness; +}; + +//---------------------------------------------------------------------------- + +struct SBackdropEnvironmentMap +{ + std::string m_Path; + + bool m_EnableRendering = false; + + float m_Intensity; + A_FloatPoint3 m_Color; + +}; + +//---------------------------------------------------------------------------- + +enum EEmitterEffectGenericCall : int +{ + EmitterDesc = 0, + GetEmitterInfos +}; + + +//---------------------------------------------------------------------------- + +struct SGetEmitterInfos +{ + const EEmitterEffectGenericCall m_Type = EEmitterEffectGenericCall::GetEmitterInfos; + char m_Name[1024]; + char m_PathSource[1024]; +}; + +//---------------------------------------------------------------------------- + +struct SEmitterDesc +{ + const EEmitterEffectGenericCall m_Type = EEmitterEffectGenericCall::EmitterDesc; + static int s_ID; +public: + std::string m_Name; + std::string m_PathSource; + std::string m_UUID; + + ETransformType m_TransformType; + A_FloatPoint3 m_Position; + A_FloatPoint3 m_Rotation; + + bool m_IsAlphaBGOverride; + float m_AlphaBGOverride; + + int m_Seed = 0; + + SCameraDesc m_Camera; + SRenderingDesc m_Rendering; + + SBackdropMesh m_BackdropMesh; + SBackdropEnvironmentMap m_BackdropEnvironmentMap; + + SLightDesc m_Light; + + float m_ScaleFactor = 1; + + bool m_Update; + bool m_UpdateBackdrop = true; + bool m_LoadBackdrop = false; + int m_DebugID; + + A_long m_LayerID; + bool m_IsDeleted = false; + bool m_ReloadEffect = false; + + bool m_SimStatePrev = true; + bool m_SimState = true; + + SEmitterDesc() + { + SEmitterDesc::s_ID++; + m_DebugID = SEmitterDesc::s_ID; + m_Position.x = 0; + m_Position.y = 0; + m_Position.z = 0; + + m_Rotation.x = 0; + m_Rotation.y = 0; + m_Rotation.z = 0; + + m_IsAlphaBGOverride = false; + m_AlphaBGOverride = 1.0f; + m_LayerID = 0; + } +}; + +//---------------------------------------------------------------------------- + +#pragma region AttributeSampler + +enum ESamplerShapeType : int +{ + SamplerShapeType_Box = 0, + SamplerShapeType_Sphere, + SamplerShapeType_Ellipsoid, + SamplerShapeType_Cylinder, + SamplerShapeType_Capsule, + SamplerShapeType_Cone, + SamplerShapeType_Mesh, + + SamplerShapeType_None, + __SamplerShapeType_Count = SamplerShapeType_Mesh +}; + +//---------------------------------------------------------------------------- + +struct SBaseSamplerDescriptor +{ + uint32_t m_UsageFlags = 0; +}; + +//---------------------------------------------------------------------------- + +struct SShapeSamplerDescriptor : public SBaseSamplerDescriptor +{ + ESamplerShapeType m_Type; + + float m_Dimension[3]; + + std::string m_Path; + + //Skinned Backdrop + bool m_BindToBackdrop; + bool m_WeightedSampling; + unsigned int m_ColorStreamID; + unsigned int m_WeightStreamID; + + SShapeSamplerDescriptor() + : m_Type(SamplerShapeType_None) + , m_BindToBackdrop(false) + , m_WeightedSampling(false) + , m_ColorStreamID(0) + , m_WeightStreamID(0) + + { + m_Dimension[0] = 1.0f; + m_Dimension[1] = 1.0f; + m_Dimension[2] = 1.0f; + } +}; + +//---------------------------------------------------------------------------- + +struct STextSamplerDescriptor : public SBaseSamplerDescriptor +{ + AEGP_LayerIDVal m_LayerID = AEGP_LayerIDVal_NONE; + std::string m_Data; +}; + +//---------------------------------------------------------------------------- + +struct SAudioSamplerDescriptor : public SBaseSamplerDescriptor +{ + AEGP_LayerIDVal m_LayerID = AEGP_LayerIDVal_NONE; + + std::string m_ChannelGroup = ""; +}; + +//---------------------------------------------------------------------------- + +struct SImageSamplerDescriptor : public SBaseSamplerDescriptor +{ + AEGP_LayerIDVal m_LayerID = AEGP_LayerIDVal_NONE; +}; + +//---------------------------------------------------------------------------- + +struct SVectorFieldSamplerDescriptor : public SBaseSamplerDescriptor +{ + std::string m_Path; + + EInterpolationType m_Interpolation; + float m_Strength; + A_FloatPoint3 m_Position; + + bool m_ResourceUpdate; +}; + +//---------------------------------------------------------------------------- + +enum EAttributeSamplerType : int +{ + AttributeSamplerType_None = 0, + AttributeSamplerType_Animtrack, + AttributeSamplerType_Audio, + AttributeSamplerType_Curve, + AttributeSamplerType_EventStream, + AttributeSamplerType_Geometry, + AttributeSamplerType_Image, + AttributeSamplerType_ImageAtlas, + AttributeSamplerType_Grid, + AttributeSamplerType_Text, + AttributeSamplerType_VectorField, + __AttributeSamplerType_Count, +}; + +//---------------------------------------------------------------------------- + +enum EAttributeSamplerParameterType : int +{ + AttributeSamplerType_Parameters_Infernal_Uuid = 1, + AttributeSamplerType_Parameters_Infernal_Name, + AttributeSamplerType_Parameters_Shapes, + + AttributeSamplerType_Topic_Shape_Start, + + AttributeSamplerType_Topic_Shape_Box_Start, + AttributeSamplerType_Parameters_Box_Size_X, + AttributeSamplerType_Parameters_Box_Size_Y, + AttributeSamplerType_Parameters_Box_Size_Z, + AttributeSamplerType_Topic_Shape_Box_End, + + AttributeSamplerType_Topic_Shape_Sphere_Start, + AttributeSamplerType_Parameters_Sphere_Radius, + AttributeSamplerType_Parameters_Sphere_InnerRadius, + AttributeSamplerType_Topic_Shape_Sphere_End, + + AttributeSamplerType_Topic_Shape_Ellipsoid_Start, + AttributeSamplerType_Parameters_Ellipsoid_Radius, + AttributeSamplerType_Parameters_Ellipsoid_InnerRadius, + AttributeSamplerType_Topic_Shape_Ellipsoid_End, + + AttributeSamplerType_Topic_Shape_Cylinder_Start, + AttributeSamplerType_Parameters_Cylinder_Radius, + AttributeSamplerType_Parameters_Cylinder_Height, + AttributeSamplerType_Parameters_Cylinder_InnerRadius, + AttributeSamplerType_Topic_Shape_Cylinder_End, + + AttributeSamplerType_Topic_Shape_Capsule_Start, + AttributeSamplerType_Parameters_Capsule_Radius, + AttributeSamplerType_Parameters_Capsule_Height, + AttributeSamplerType_Parameters_Capsule_InnerRadius, + AttributeSamplerType_Topic_Shape_Capsule_End, + + AttributeSamplerType_Topic_Shape_Cone_Start, + AttributeSamplerType_Parameters_Cone_Radius, + AttributeSamplerType_Parameters_Cone_Height, + AttributeSamplerType_Topic_Shape_Cone_End, + + AttributeSamplerType_Topic_Shape_Mesh_Start, + AttributeSamplerType_Parameters_Mesh_Scale, + AttributeSamplerType_Parameters_Mesh_Path, + AttributeSamplerType_Parameters_Mesh_Bind_Backdrop, + AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_Weighted_Enabled, + AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_ColorStreamID, + AttributeSamplerType_Parameters_Mesh_Bind_Backdrop_WeightStreamID, + AttributeSamplerType_Topic_Shape_Mesh_End, + + AttributeSamplerType_Topic_Shape_End, + + AttributeSamplerType_Layer_Pick, + + AttributeSamplerType_Layer_Sample_Once, + AttributeSamplerType_Layer_Sample_Seeking, + + AttributeSamplerType_Parameters_VectorField_Path, + AttributeSamplerType_Parameters_VectorField_Strength, + AttributeSamplerType_Parameters_VectorField_Position, + AttributeSamplerType_Parameters_VectorField_Interpolation, + + AttributeSamplerType_Layer_Sample_Downsampling_X, + AttributeSamplerType_Layer_Sample_Downsampling_Y, + + __AttributeSamplerType_Parameters_Count +}; + +//---------------------------------------------------------------------------- + +struct SAttributeBaseDesc +{ + unsigned int m_Order; + bool m_IsAttribute; + + std::string m_Name; + std::string m_CategoryName; + + bool m_IsDeleted = false; + + SAttributeBaseDesc() + : m_Order(0) + , m_IsAttribute(false) + , m_Name("") + , m_CategoryName("") + { + + } + + SAttributeBaseDesc(const SAttributeBaseDesc &other) + : m_Order(other.m_Order) + , m_Name(other.m_Name) + , m_CategoryName(other.m_CategoryName) + , m_IsDeleted(other.m_IsDeleted) + { + } + + SAttributeBaseDesc &operator=(const SAttributeBaseDesc &other) + { + m_Name = other.m_Name; + m_CategoryName = other.m_CategoryName; + + return *this; + } + + std::string GetAttributePKKey() + { + std::string key = ""; + if (m_CategoryName.length() != 0) + { + key += m_CategoryName; + key += ":"; + } + key += m_Name; + return key; + } +}; + +//---------------------------------------------------------------------------- + +struct SAttributeSamplerDesc : public SAttributeBaseDesc +{ +public: + EAttributeSamplerType m_Type; + SBaseSamplerDescriptor *m_Descriptor = nullptr; + std::string m_ResourcePath = ""; + bool m_IsDefaultValue = true; + + SAttributeSamplerDesc(const char* name = nullptr, const char* category = nullptr, EAttributeSamplerType type = AttributeSamplerType_None) + : m_Type(type) + { + m_Name = name == nullptr ? "" : name; + m_CategoryName = category == nullptr ? "" : category; + } + + SAttributeSamplerDesc(const SAttributeSamplerDesc &other) + : SAttributeBaseDesc(other) + , m_Type(other.m_Type) + , m_Descriptor(other.m_Descriptor) + , m_IsDefaultValue(other.m_IsDefaultValue) + { + if(m_ResourcePath.length() == 0) + m_ResourcePath = (other.m_ResourcePath); + } + + SAttributeSamplerDesc &operator=(const SAttributeSamplerDesc &other) + { + m_Name = other.m_Name; + m_CategoryName = other.m_CategoryName; + m_Type = other.m_Type; + m_Descriptor = other.m_Descriptor; + m_IsDeleted = other.m_IsDeleted; + m_IsDefaultValue = other.m_IsDefaultValue; + + if (m_ResourcePath.length() == 0) + m_ResourcePath = (other.m_ResourcePath); + + return *this; + } +}; + +#pragma endregion + +//---------------------------------------------------------------------------- +#pragma region Attribute + +enum EAttributeType : int +{ + AttributeType_None = 0, + AttributeType_Bool1, + AttributeType_Bool2, + AttributeType_Bool3, + AttributeType_Bool4, + AttributeType_Int1, + AttributeType_Int2, + AttributeType_Int3, + AttributeType_Int4, + AttributeType_Float1, + AttributeType_Float2, + AttributeType_Float3, + AttributeType_Float4, + __AttributeType_Count, +}; + +//---------------------------------------------------------------------------- + +enum EAttributeParameterType : int +{ + Attribute_Parameters_Bool1 = 1, + Attribute_Parameters_Bool2, + Attribute_Parameters_Bool3, + Attribute_Parameters_Bool4, + Attribute_Parameters_Int1, + Attribute_Parameters_Int2, + Attribute_Parameters_Int3, + Attribute_Parameters_Int4, + Attribute_Parameters_Float1, + Attribute_Parameters_Float2, + Attribute_Parameters_Float3, + Attribute_Parameters_Float4, + Attribute_Parameters_Infernal_Uuid, + Attribute_Parameters_AffectedByScale, + Attribute_Parameters_Infernal_Name, + Attribute_Parameters_Color_RGB, + Attribute_Parameters_Color_A, + Attribute_Parameters_Reset, + __Attribute_Parameters_Count +}; + +//---------------------------------------------------------------------------- + +enum EAttributeSemantic : int +{ + AttributeSemantic_None = 0, + AttributeSemantic_Coordinate, + AttributeSemantic_Scale, + AttributeSemantic_Color, + __AttributeSemantic_Count +}; + +//---------------------------------------------------------------------------- + +union UAttributeValue +{ + void *m_Invalid; + bool m_Bool4[4]; + int m_Int4[4]; + float m_Float4[4]; + float m_Angles[3]; +}; + +//---------------------------------------------------------------------------- + +struct SAttributeDesc : public SAttributeBaseDesc +{ +public: + EAttributeType m_Type; + EAttributeSemantic m_AttributeSemantic; + + UAttributeValue m_DefaultValue; + + UAttributeValue m_MinValue; + UAttributeValue m_MaxValue; + + bool m_HasMax = false; + bool m_HasMin = false; + + UAttributeValue m_Value; + bool m_IsValid; + bool m_IsDirty; + + std::mutex m_Lock; +public: + bool m_IsDefaultValue = true; + bool m_IsAffectedByScale = false; + + SAttributeDesc(const char* name = nullptr, const char* category = nullptr, EAttributeType type = AttributeType_None, EAttributeSemantic semantic = EAttributeSemantic::AttributeSemantic_None) + : m_Type(type) + , m_AttributeSemantic(semantic) + , m_DefaultValue() + , m_MinValue() + , m_MaxValue() + , m_Value() + , m_IsValid(true) + , m_IsDirty(true) + { + m_IsAttribute = true; + m_Name = name == nullptr ? "" : name; + m_CategoryName = category == nullptr ? "" : category; + } + + SAttributeDesc(const SAttributeDesc &other) + : SAttributeBaseDesc(other) + , m_Type(other.m_Type) + , m_AttributeSemantic(other.m_AttributeSemantic) + , m_DefaultValue(other.m_DefaultValue) + , m_MinValue(other.m_MinValue) + , m_MaxValue(other.m_MaxValue) + , m_HasMax(other.m_HasMax) + , m_HasMin(other.m_HasMin) + , m_Value(other.m_Value) + , m_IsValid(other.m_IsValid) + , m_IsDirty(true) + , m_IsDefaultValue(other.m_IsDefaultValue) + { + + } + + ~SAttributeDesc() + { + + } + + SAttributeDesc& operator=(const SAttributeDesc &other) + { + m_Name = other.m_Name; + m_CategoryName = other.m_CategoryName; + m_Type = other.m_Type; + m_AttributeSemantic = other.m_AttributeSemantic; + + m_HasMin = other.m_HasMin; + m_HasMax = other.m_HasMax; + + m_MinValue = other.m_MinValue; + m_MaxValue = other.m_MaxValue; + + if (m_IsDefaultValue == true) + { + m_Value = other.m_Value; + m_IsDefaultValue = other.m_IsDefaultValue; + } + m_DefaultValue = other.m_DefaultValue; + m_IsDirty = true; + m_IsValid = other.m_IsValid; + m_IsDeleted = other.m_IsDeleted; + return *this; + } + + void Invalidate() + { + m_IsValid = false; + } + + bool isValid() + { + return m_IsValid; + } + + bool ResetValues() + { + m_Lock.lock(); + memcpy(&m_Value, &m_DefaultValue, sizeof(UAttributeValue)); + m_IsDirty = true; + m_IsDefaultValue = true; + m_Lock.unlock(); + + return true; + } + + template + void SetDefaultValue(T *value) + { + return _SetValueImpl(value, m_DefaultValue, true); + } + + template + void GetDefaultValue(T *value) + { + return _GetValueImpl(value, m_DefaultValue); + } + + template + void GetDefaultValueByType(EAttributeType type, T *value) + { + _GetValueByTypeImpl(type, value, m_DefaultValue); + } + + template + void SetValue(T *value) + { + return _SetValueImpl(value, m_Value); + } + + template + void GetValue(T *value) + { + return _GetValueImpl(value, m_Value); + } + + template + void GetValueByType(EAttributeType type, T *value) + { + _GetValueByTypeImpl(type, value, m_Value); + } + + void *GetRawValue() + { + return _GetRawValueImpl(m_Value); + } + + void GetValueAsStreamValue(EAttributeType type, AEGP_StreamValue *value) + { + _GetValueAsStreamValueImpl(type, value, m_Value); + } + + template + void SetMinValue(T *value) + { + return _SetValueImpl(value, m_MinValue); + } + + template + void GetMinValueByType(EAttributeType type, T *value) + { + _GetValueByTypeImpl(type, value, m_MinValue); + } + + template + void SetMaxValue(T *value) + { + return _SetValueImpl(value, m_MaxValue); + } + + template + void GetMaxValueByType(EAttributeType type, T *value) + { + _GetValueByTypeImpl(type, value, m_MaxValue); + } + + void Reset() + { + m_IsDirty = true; + m_IsValid = false; + m_Value = {}; + m_Name = ""; + m_CategoryName = ""; + m_Type = AttributeType_None; + m_AttributeSemantic = EAttributeSemantic::AttributeSemantic_None; + } +private: + template + void _SetValueImpl(T *value, UAttributeValue &field, bool isDefault = false) + { + m_Lock.lock(); + switch (m_Type) + { + case AttributeType_Bool4: + case AttributeType_Bool3: + case AttributeType_Bool2: + case AttributeType_Bool1: + memcpy(field.m_Bool4, value, sizeof(bool) * 4); + break; + case AttributeType_Int4: + case AttributeType_Int3: + case AttributeType_Int2: + case AttributeType_Int1: + memcpy(field.m_Int4, value, sizeof(int) * 4); + break; + case AttributeType_Float4: + case AttributeType_Float3: + case AttributeType_Float2: + case AttributeType_Float1: + memcpy(field.m_Float4, value, sizeof(float) * 4); + break; + default: + m_IsValid = false; + AE_VERIFY(false); + break; + } + m_IsDirty = true; + m_IsDefaultValue = isDefault; + m_Lock.unlock(); + } + + template + void _GetValueByTypeImpl(EAttributeType type, T *value, UAttributeValue &field) + { + m_Lock.lock(); + switch (type) + { + case AttributeType_Bool4: + *value = (T)field.m_Bool4[3]; + break; + case AttributeType_Bool3: + *value = (T)field.m_Bool4[2]; + break; + case AttributeType_Bool2: + *value = (T)field.m_Bool4[1]; + break; + case AttributeType_Bool1: + *value = (T)field.m_Bool4[0]; + break; + case AttributeType_Int4: + *value = (T)field.m_Int4[3]; + break; + case AttributeType_Int3: + *value = (T)field.m_Int4[2]; + break; + case AttributeType_Int2: + *value = (T)field.m_Int4[1]; + break; + case AttributeType_Int1: + *value = (T)field.m_Int4[0]; + break; + case AttributeType_Float4: + *value = (T)field.m_Float4[3]; + break; + case AttributeType_Float3: + *value = (T)field.m_Float4[2]; + break; + case AttributeType_Float2: + *value = (T)field.m_Float4[1]; + break; + case AttributeType_Float1: + *value= (T)field.m_Float4[0]; + break; + default: + m_IsValid = false; + AE_VERIFY(false); + break; + } + m_Lock.unlock(); + } + + void _GetValueAsStreamValueImpl(EAttributeType type, AEGP_StreamValue *value, UAttributeValue &field) + { + m_Lock.lock(); + switch (type) + { + case AttributeType_Bool4: + value->val.one_d = field.m_Bool4[3]; + break; + case AttributeType_Bool3: + value->val.one_d = field.m_Bool4[2]; + break; + case AttributeType_Bool2: + value->val.one_d = field.m_Bool4[1]; + break; + case AttributeType_Bool1: + value->val.one_d = field.m_Bool4[0]; + break; + case AttributeType_Int4: + value->val.one_d = field.m_Int4[3]; + break; + case AttributeType_Int3: + value->val.one_d = field.m_Int4[2]; + break; + case AttributeType_Int2: + value->val.one_d = field.m_Int4[1]; + break; + case AttributeType_Int1: + value->val.one_d = field.m_Int4[0]; + break; + case AttributeType_Float4: + value->val.one_d = field.m_Float4[3]; + break; + case AttributeType_Float3: + value->val.one_d = field.m_Float4[2]; + break; + case AttributeType_Float2: + value->val.one_d = field.m_Float4[1]; + break; + case AttributeType_Float1: + value->val.one_d = field.m_Float4[0]; + break; + default: + m_IsValid = false; + AE_VERIFY(false); + break; + } + m_Lock.unlock(); + } + + template + void _GetValueImpl(T *value, UAttributeValue &field) + { + m_Lock.lock(); + switch (m_Type) + { + case AttributeType_Bool4: + value[3] = field.m_Bool4[3]; + case AttributeType_Bool3: + value[2] = field.m_Bool4[2]; + case AttributeType_Bool2: + value[1] = field.m_Bool4[1]; + case AttributeType_Bool1: + value[0] = field.m_Bool4[0]; + break; + case AttributeType_Int4: + value[3] = (T)field.m_Int4[3]; + case AttributeType_Int3: + value[2] = (T)field.m_Int4[2]; + case AttributeType_Int2: + value[1] = (T)field.m_Int4[1]; + case AttributeType_Int1: + value[0] = (T)field.m_Int4[0]; + break; + case AttributeType_Float4: + value[3] = field.m_Float4[3]; + case AttributeType_Float3: + value[2] = field.m_Float4[2]; + case AttributeType_Float2: + value[1] = field.m_Float4[1]; + case AttributeType_Float1: + value[0] = field.m_Float4[0]; + break; + default: + m_IsValid = false; + AE_VERIFY(false); + break; + } + m_Lock.unlock(); + } + + void *_GetRawValueImpl(UAttributeValue &field) + { + m_Lock.lock(); + + void* result = nullptr; + switch (m_Type) + { + case AttributeType_Bool4: + case AttributeType_Bool3: + case AttributeType_Bool2: + case AttributeType_Bool1: + result = (void*)&field.m_Bool4; + break; + case AttributeType_Int4: + case AttributeType_Int3: + case AttributeType_Int2: + case AttributeType_Int1: + result = (void*)&field.m_Int4; + break; + case AttributeType_Float4: + case AttributeType_Float3: + case AttributeType_Float2: + case AttributeType_Float1: + result = (void*)&field.m_Float4; + break; + default: + AE_VERIFY(false); + break; + } + m_Lock.unlock(); + return result; + } +}; + +#pragma endregion + +//---------------------------------------------------------------------------- + +union SAAEExtraData +{ + SAAEExtraData(PF_Cmd Cmd, void *data) + { + switch (Cmd) + { + case PF_Cmd_SMART_PRE_RENDER: + m_PreRenderData = reinterpret_cast(data); + break; + case PF_Cmd_SMART_RENDER: + m_SmartRenderData = reinterpret_cast(data); + break; + case PF_Cmd_USER_CHANGED_PARAM: + m_ChangeParamData = reinterpret_cast(data); + break; + default: + m_UndefinedData = data; + break; + } + } + PF_SmartRenderExtra *m_SmartRenderData; + PF_PreRenderExtra *m_PreRenderData; + PF_UserChangedParamExtra *m_ChangeParamData; + void *m_UndefinedData; +}; + +//---------------------------------------------------------------------------- + +struct SAAEIOData +{ + SAAEIOData(PF_Cmd Cmd, PF_InData *InData, PF_OutData *OutData, void *data, const int *paramIndexes) + : m_Cmd(Cmd) + , m_InData(InData) + , m_OutData(OutData) + , m_ExtraData(Cmd, data) + , m_WorldSuite(nullptr) + , m_ReturnCode(PF_Err_NONE) + , m_ParametersIndexes(paramIndexes) + { + if (m_InData && m_OutData) + { + AEFX_AcquireSuite( m_InData, + m_OutData, + kPFWorldSuite, + kPFWorldSuiteVersion2, + "Couldn't load suite.", + (void**)&m_WorldSuite); + } + }; + ~SAAEIOData() + { + if (m_InData && m_OutData) + { + AEFX_ReleaseSuite( m_InData, + m_OutData, + kPFWorldSuite, + kPFWorldSuiteVersion2, + "Couldn't release suite."); + } + m_WorldSuite = nullptr; + }; + + PF_Cmd m_Cmd; + + PF_InData *m_InData; + PF_OutData *m_OutData; + + SAAEExtraData m_ExtraData; + + PF_WorldSuite2 *m_WorldSuite; + + PF_Err m_ReturnCode; + + const int *m_ParametersIndexes; +}; + +//---------------------------------------------------------------------------- + +struct SAAEScopedParams +{ + PF_ParamDef m_ParamData; + PF_InData *m_InData; + + SAAEScopedParams(SAAEIOData& AAEData, A_u_long type) : + m_InData(AAEData.m_InData) + { + AEFX_CLR_STRUCT(m_ParamData); + int idx = (AAEData.m_ParametersIndexes != nullptr) ? AAEData.m_ParametersIndexes[type] : type; + PF_CHECKOUT_PARAM( m_InData, + idx, + m_InData->current_time, + m_InData->time_step, + m_InData->time_scale, + &m_ParamData); + } + ~SAAEScopedParams() + { + PF_CHECKIN_PARAM(m_InData, &m_ParamData); + m_InData = nullptr; + } + + PF_ParamDef &GetRawParam() { return m_ParamData; } + float GetAngle() const { return (float)m_ParamData.u.ad.value / 65536.0f; } + float GetFloat() const { return (float)m_ParamData.u.fs_d.value; } + float GetPercent() const { return (float)m_ParamData.u.fd.value / (float)m_ParamData.u.fd.valid_max; } + int GetInt() const { return (int)m_ParamData.u.fs_d.value; } + int GetComboBoxValue() const { return (int)m_ParamData.u.pd.value; } + bool GetCheckBoxValue() const { return (bool)m_ParamData.u.bd.value; } + PF_LayerDef GetLayer() const { return (PF_LayerDef)m_ParamData.u.ld; } + A_FloatPoint3 GetPoint3D() const + { + A_FloatPoint3 position = {(float)m_ParamData.u.point3d_d.x_value * m_InData->downsample_x.den, + (float)m_ParamData.u.point3d_d.y_value * m_InData->downsample_y.den, + (float)m_ParamData.u.point3d_d.z_value * ::sqrt(m_InData->downsample_x.den * m_InData->downsample_y.den)}; + return position; + } + A_FloatPoint GetPoint2D() const + { + A_FloatPoint position = { (float)m_ParamData.u.td.x_value * m_InData->downsample_x.den, + (float)m_ParamData.u.td.y_value * m_InData->downsample_y.den }; + return position; + } + A_FloatPoint3 GetColor() const + { + const PF_UnionablePixel &color = m_ParamData.u.cd.value; + return A_FloatPoint3{ color.red / 255.0f, color.green / 255.0f, color.blue / 255.0f }; + } +}; + +//---------------------------------------------------------------------------- + +struct SAAECamera +{ + float m_YFov; +}; + +//---------------------------------------------------------------------------- + +inline void CopyCharToUTF16(const char *input, + A_UTF16Char *destination) +{ + std::string basicStr(input); + std::u16string ws; + + ws.append(basicStr.begin(), basicStr.end()); + memcpy(destination, ws.data(), (ws.length() + 1) * sizeof(char16_t)); +} + +//---------------------------------------------------------------------------- + +inline void WCharToString(aechar_t *input, std::string *destination) +{ + std::u16string ws(input); + destination->append(ws.begin(), ws.end()); +} + +//---------------------------------------------------------------------------- + +inline unsigned int hashString(const char *str) +{ + unsigned int hash = 5381; + int c; + + while ((c = *str++)) + hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + + return hash; +} + +//---------------------------------------------------------------------------- + +inline float RadToDeg(const float angle) +{ + return angle * 180.f / 3.141592f; +} + +//---------------------------------------------------------------------------- + +inline float DegToRad(const float angle) +{ + return angle * 3.141592f / 180.f; +} + +//---------------------------------------------------------------------------- + +__AAEPK_END + +//---------------------------------------------------------------------------- + +struct PopcornFXSuite1 +{ + SPAPI A_Err (*InitializePopcornFXIFN) (AAePk::SAAEIOData& AAEData); + + SPAPI A_Err (*HandleNewEmitterEvent) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc *descriptor); + + SPAPI A_Err (*HandleDeleteEmitterEvent) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc *descriptor); + + SPAPI bool (*CheckEmitterValidity) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc *descriptor); + + SPAPI A_Err (*UpdateScene) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc* descriptor); + + SPAPI A_Err (*UpdateEmitter) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc* descriptor); + + SPAPI A_Err (*DisplayMarketplacePanel) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc* descriptor); + + SPAPI A_Err (*DisplayBrowseEffectPanel) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc* descriptor); + + SPAPI A_Err (*DisplayBrowseMeshDialog) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc* descriptor); + + SPAPI A_Err (*DisplayBrowseEnvironmentMapDialog) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc* descriptor); + + SPAPI A_Err (*ReimportEffect) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc* descriptor); + + SPAPI A_Err (*Display_AttributeSampler_BrowseMeshDialog) (AAePk::SAAEIOData& AAEData, AAePk::SAttributeSamplerDesc* descriptor); + + SPAPI A_Err (*ShutdownPopcornFXIFN) (AAePk::SAAEIOData& AAEData); + + SPAPI A_Err (*SetParametersIndexes) (const int *indexes, AAePk::EPKChildPlugins plugin); + + SPAPI A_Err (*SetDefaultLayerPosition) (AAePk::SAAEIOData& AAEData, AEGP_LayerH layer); + + SPAPI A_Err (*MoveEffectIntoCurrentView) (AAePk::SAAEIOData& AAEData, AAePk::SEmitterDesc* descriptor); + +}; + +//---------------------------------------------------------------------------- + +#endif // !__POPCORNFX_SUITE_H__ + + diff --git a/AE_Suites/PopcornFX_UID.h b/AE_Suites/PopcornFX_UID.h new file mode 100644 index 00000000..e7ac9d64 --- /dev/null +++ b/AE_Suites/PopcornFX_UID.h @@ -0,0 +1,67 @@ +//---------------------------------------------------------------------------- +// Copyright Persistant Studios, SARL. All Rights Reserved. https://www.popcornfx.com/terms-and-conditions/ +//---------------------------------------------------------------------------- +#pragma once + +#ifndef __POPCORNFX_UID_H__ +#define __POPCORNFX_UID_H__ + +#include "PopcornFX_Define.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +__AAEPK_BEGIN + +//---------------------------------------------------------------------------- + +class CUUIDGenerator +{ +private: + CUUIDGenerator() {} + + static unsigned char _RandomChar() + { + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> dis(0, 255); + return static_cast(dis(gen)); + } + + static std::string _GenerateHex(const unsigned int len) + { + std::stringstream ss; + + for (unsigned int i = 0; i < len; i++) + { + unsigned char rc = _RandomChar(); + std::stringstream hexstream; + + hexstream << std::hex << int(rc); + + std::string hex = hexstream.str(); + + ss << (hex.length() < 2 ? '0' + hex : hex); + } + return ss.str(); + } +public: + ~CUUIDGenerator() {}; + + static std::string Get32() { return _GenerateHex(32); } + static std::string Get16() { return _GenerateHex(16); } + static std::string Get8() { return _GenerateHex(8); } + +}; + +//---------------------------------------------------------------------------- + +__AAEPK_END + +#endif diff --git a/CopyQTDllsForAE.py b/CopyQTDllsForAE.py new file mode 100644 index 00000000..d86ade92 --- /dev/null +++ b/CopyQTDllsForAE.py @@ -0,0 +1,105 @@ +import os +import shutil +import sys +import subprocess +import pathlib + +# Check if file's relative location is as expected +script_dir = pathlib.Path(os.path.abspath(__file__)).parent +assert script_dir.match("*/source_tree/Integrations/AfterEffects") + +sys.path.append(str(script_dir / "../../SDK/Python")) +from Libs.pk_tools_locate import get_qt_bin_path + +#SETUP +#============ +QT_BIN_PATH_OVERRIDE="" # e.g. "E:\\SDK\\Qt\\Qt5.15.2\\5.15.2\\msvc2019_64\\bin" + +assembly_folder = "External/popcornfx.qt" +debug_dlls = False #Set this to True to add debug dlls in the private assembly +qt_dll_override_manifest = "qtoverride.dll.manifest" +win_kit_bin_path = "C:\\Program Files (x86)\\Windows Kits\\10\\bin" + +# [0] path: str +# [1] addInAssembly: bool +# [2] patchWithManifest: bool +dlls_to_copy = [ + ("Qt5Core.dll", True, False), #The first one must be Qt5Core + ("Qt5Gui.dll", True, True), + ("Qt5Widgets.dll", True, True), + ("../plugins/platforms/qwindows.dll", False, True), + ] +#============ + +def FindMtExe(): + versions_list = [name for name in os.listdir(win_kit_bin_path) if os.path.isdir(os.path.join(win_kit_bin_path, name)) and name.startswith("10.")] + versions_list.sort(reverse=True) + for version in versions_list: + mt_exe_path = os.path.join(win_kit_bin_path, version + "\\x64\\mt.exe") + if (os.path.exists(mt_exe_path)): + return mt_exe_path + return "" + +def CopyDll(dll, debug, path_qt_folder, mt_exe_path, f): + dll_path = dll[0] #path + if debug: + split_path = os.path.splitext(dll_path) + dll_path = split_path[0] + "d" + split_path[1] + src_fpath = os.path.join(path_qt_folder, dll_path) + file = os.path.basename(dll_path) + dest_fpath = os.path.join(assembly_folder, file) + print("Copying: " + file) + shutil.copy(src_fpath, dest_fpath) + if dll[1]: #addInAssembly + f.write(" \n") + if dll[2]: #patchWithManifest + cmd = [mt_exe_path, "-manifest", "qtoverride.dll.manifest", "-outputresource:" + assembly_folder + "/" + file + ";#2"] + process = subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL) + process.check_returncode() + +def main(): + mt_exe_path = FindMtExe() + if not mt_exe_path: + print("Error: Could not found mt.exe") + sys.exit(1) + + if not os.path.exists(qt_dll_override_manifest): + print("Error: Could not found:" + qt_dll_override_manifest) + sys.exit(1) + + path_qt_folder = QT_BIN_PATH_OVERRIDE if QT_BIN_PATH_OVERRIDE else str(get_qt_bin_path(True)) + if not os.path.exists(path_qt_folder): + print("Error: Could not found Qt folder: " + path_qt_folder) + sys.exit(1) + print("Found Qt directory at: " + path_qt_folder) + + if not path_qt_folder: + print("Error: Could not found Qt directory in PATH") + sys.exit(1) + + if os.path.isdir(assembly_folder): + shutil.rmtree(assembly_folder) + os.mkdir(assembly_folder) + f = open(assembly_folder + "/popcornfx.qt.manifest", "w") + if not f: + print("Error: Could not open to write:" + assembly_folder + "/popcornfx.qt.manifest") + sys.exit(1) + + f.write("\n") + f.write("\"\n") + f.write("\n") + f.write(" \n") + + for dll in dlls_to_copy: + CopyDll(dll, False, path_qt_folder, mt_exe_path, f) + if debug_dlls: + CopyDll(dll, True, path_qt_folder, mt_exe_path, f) + + f.write("\n") + f.write("") + f.close() + + sys.exit(0) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/External/AE SDK/Headers/A.h b/External/AE SDK/Headers/A.h new file mode 100644 index 00000000..b0ba6616 --- /dev/null +++ b/External/AE SDK/Headers/A.h @@ -0,0 +1,196 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +/** A.h + + Adobe-standard (hopefully one day) types to promote plug-in sharing. + +**/ +#ifndef _H_A +#define _H_A + +#ifdef A_INTERNAL + + #include + +#else + #include "stdint.h" + + typedef int32_t A_long; + typedef uint32_t A_u_long; + typedef char A_char; + typedef double A_FpLong; + typedef float A_FpShort; + typedef A_long A_Err; + typedef void * A_Handle; + typedef A_long A_Fixed; + typedef A_u_long A_UFixed; + + #if defined( __MWERKS__) || defined (__GNUC__) // metrowerks codewarrior and XCode/GCC + typedef int16_t A_short; + typedef uint16_t A_u_short; + typedef uint8_t A_u_char; + typedef uint8_t A_Boolean; + typedef intptr_t A_intptr_t; + #else // windows + typedef short A_short; + typedef unsigned short A_u_short; + typedef unsigned char A_u_char; + typedef unsigned char A_Boolean; + #ifdef _WIN64 + typedef __int64 A_intptr_t; + #else + typedef int32_t A_intptr_t; + #endif + #endif + +#ifdef _MSC_VER // visual c++ + typedef unsigned __int64 A_u_longlong; +#endif + +#if defined( __MWERKS__) || defined (__GNUC__) // metrowerks codewarrior and XCode/GCC + typedef uint64_t A_u_longlong; +#endif + + +#include + + + typedef struct { + A_long value; + A_u_long scale; + } A_Time; + + typedef struct { + A_long num; /* numerator */ + A_u_long den; /* denominator */ + } A_Ratio; + + typedef struct { + A_FpLong x, y; + } A_FloatPoint; + + typedef struct { + A_FpLong x, y, z; + } A_FloatPoint3; + + typedef struct { + A_FpLong left, top, right, bottom; + } A_FloatRect; + + typedef struct { + A_FpLong mat[3][3]; + } A_Matrix3; + + typedef struct { + A_FpLong mat[4][4]; + } A_Matrix4; + + typedef struct { + A_short top, left, bottom, right; + } A_LegacyRect; + + typedef struct { + A_long left, top, right, bottom; + } A_LRect; + + typedef A_LRect A_Rect; + + typedef struct { + A_long x, y; + } A_LPoint; + + typedef struct { + A_FpLong radius, angle; + } A_FloatPolar; + + typedef A_u_longlong A_HandleSize; + +#include + + + + +#endif + + +#include + +typedef struct { + A_FpLong alpha; + A_FpLong red; + A_FpLong green; + A_FpLong blue; + +} A_Color; + +#include + + + + + +#define A_THROW(ERR) throw ((A_long) ERR) + +enum { + A_Err_NONE = 0, + A_Err_GENERIC, + A_Err_STRUCT, + A_Err_PARAMETER, + A_Err_ALLOC, + A_Err_WRONG_THREAD, // Some calls can only be used on UI (Main) or Render threads. Also, calls back to AE can only be made from the same thread AE called you on + A_Err_CONST_PROJECT_MODIFICATION, // An attempt was made to write to a read only copy of an AE project. Project changes must originate in the UI/Main thread. + A_Err_RESERVED_7, + A_Err_RESERVED_8, + A_Err_RESERVED_9, + A_Err_RESERVED_10, + A_Err_RESERVED_11, + A_Err_RESERVED_12, + A_Err_MISSING_SUITE = 13, // acquire suite failed on a required suite + A_Err_RESERVED_14, + A_Err_RESERVED_15, + A_Err_RESERVED_16, + A_Err_RESERVED_17, + A_Err_RESERVED_18, + A_Err_RESERVED_19, + A_Err_RESERVED_20, + A_Err_RESERVED_21, + A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING, + + A_Err_LAST +}; + +typedef struct { + A_short majorS; + A_short minorS; +} A_Version; + +typedef struct _Up_OpaqueMem **AEGP_MemHandle; + +typedef A_u_short A_UTF16Char; + +#if defined( __MWERKS__) || defined (__GNUC__) // metrowerks codewarrior and XCode/GCC + typedef A_char A_LegacyEnumType; +#else // windows + typedef A_long A_LegacyEnumType; +#endif + +#endif diff --git a/External/AE SDK/Headers/AEConfig.h b/External/AE SDK/Headers/AEConfig.h new file mode 100644 index 00000000..c1b36982 --- /dev/null +++ b/External/AE SDK/Headers/AEConfig.h @@ -0,0 +1,102 @@ +#ifndef AECONFIG_H +#define AECONFIG_H + +/* +Usage guidelines for these defines. 4/12/2006 + +Always use the most specific kind for your problem. Try and use +the form + +#ifdef AE_XXXXX (i.e. AE_OS_MAC) + +#elif defined(AE_NOT_XXXX) (i.e. AE_OS_WIN) + +#else + #error "unknown" +#endif + +when creating conditionally compiled blocks. + +AE_OS_MAC | AE_OS_WIN + +are used to select between the most popular version of the operating +system API's. As of this writing AE_OS_MAC implies 10.4.4u SDK, and +AE_OS_WIN implies the platform SDK shipped with VS8 and _WIN32. + + +AE_PROC_PPC | AE_PROC_INTEL + +are used for code that will only execute on one processor family or +the other. Essentially should only be used for asm, or asm based +intrinsics. Note: we do not currently have a define for things +like SSE or SSE3 as we don't build the whole code base targetted +for different instances of processors. You'll need to do runtime checks for SSE3 +(though our minimum requirement is Pentium4 so SSE2 can be assumed). + + +AE_BIG_ENDIAN | AE_LITTLE_ENDIAN + +PowerPC on Mac was BIG endian (as is network byte order). +x86 is a little endian architecture. + +Try and avoid writing new code that uses this. Use XML or dva::filesupport +for writing things to disk. + +These defines should be seldom used, instead use the byte swapping macro's +already defined in U which will be a no-op on platforms that don't need it. + +For the record, our file format is stored big endian. + + +*/ +//Define our OS defines +#if defined(_WIN32) + #define AE_OS_WIN +#elif defined(__GNUC__) && defined(__MACH__) + #include "TargetConditionals.h" // defines the nesting of TARGET_OS_* + #if TARGET_OS_MAC + #if TARGET_OS_IPHONE + // Older SDKs ( before TV, WATCH ) do not have TARGET_OS_IOS defined. + #if TARGET_OS_IOS || !defined(TARGET_OS_IOS) + #define AE_OS_IOS + #endif + #else + #define AE_OS_MAC + #endif // TARGET_OS_IPHONE + + #if TARGET_OS_SIMULATOR + #define AE_OS_APPLE_SIM + #endif + #endif // TARGET_OS_MAC +#elif Rez + #define AE_OS_MAC +#elif defined(__ANDROID__) + #define AE_OS_ANDROID +#else + #error "unrecognized AE platform" +#endif + +//Define our Processor defines +#if defined(__i386__) || defined(_M_IX86) + #define AE_PROC_INTEL +#elif defined(_M_X64) || defined(__amd64__) || defined(__x86_64__) + #define AE_PROC_INTELx64 +#elif defined(__arm64__) || defined(__aarch64__) + #define AE_PROC_ARM64 +#else + #error "unrecognized AE processor" +#endif + +#if defined(AE_OS_MAC) && defined(AE_PROC_ARM64) +// This is used to enable/disable features that are still being +// ported/tested to run on Mac arm64based M1 processors, aka Apple Silicon. +// It is intended for Adobe internal use, and will be going away once the mac +// arm64 work is completed. +#define AE_MAC_ARM64_PROTOTYPE_TODO +#endif + +//Define our Byte order +#define AE_LITTLE_ENDIAN + + +#endif diff --git a/External/AE SDK/Headers/AEFX_ArbParseHelper.c b/External/AE SDK/Headers/AEFX_ArbParseHelper.c new file mode 100644 index 00000000..789f269b --- /dev/null +++ b/External/AE SDK/Headers/AEFX_ArbParseHelper.c @@ -0,0 +1,171 @@ +// AEFX_ArbParseHelper.c +// + + + +#include "AEFX_ArbParseHelper.h" + +#include +#include +#include +#include +#include + +PF_Err +AEFX_AppendText( A_char *srcAC, /* >> */ + const A_u_long dest_sizeL, /* >> */ + A_char *destAC, /* <> */ + A_u_long *current_indexPLu) /* <> */ +{ + PF_Err err = PF_Err_NONE; + + A_u_long new_strlenLu = (A_u_long) strlen(srcAC) + *current_indexPLu; + + + if (new_strlenLu <= dest_sizeL) { + destAC[*current_indexPLu] = 0x00; + + strcat(destAC, srcAC); + *current_indexPLu = new_strlenLu; + } else { + err = AEFX_ParseError_APPEND_ERROR; + } + + return err; +} + + + + +PF_Err +AEFX_ParseCell( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + A_char *bufAC) /* << AEFX_CELL_SIZE */ +{ + PF_Err err = PF_Err_NONE; + A_char c; + A_char buf[AEFX_CELL_SIZE]; + A_char *scan; + A_short count; + + if (startPC[*current_indexPL] == AEFX_Char_EOL) { + err = AEFX_ParseError_EXPECTING_MORE_DATA; + } else if (startPC[*current_indexPL] == 0) { + err = AEFX_ParseError_EXPECTING_MORE_DATA; + } else { + count = 0; + scan = buf; + while ((c = startPC[(*current_indexPL)++]) != 0) { + if (c == AEFX_Char_TAB) + break; + if (c == AEFX_Char_EOL) { + (*current_indexPL)--; + break; + } + + *scan++ = c; + + if (++count >= AEFX_CELL_SIZE) + break; + } + *scan = 0; + + // trim spaces from head + scan = buf; + while (isspace(*scan)) + scan++; + + strcpy(bufAC, scan); + + // trim spaces from end (guaranteed not to scan past start of string, because + // if the string were all spaces, it would be trimmed down to nothing in the + // head-trim step above + if (*bufAC) { + scan = bufAC + strlen(bufAC) - 1; + while (*scan == AEFX_Char_SPACE) { + *scan-- = 0; + } + } + } + + return err; + +} + + +/** AEFX_ParseFpLong + + Reads in the next cell in the input stream and converts it to a double. + The first non-space character must be numeric. + +**/ +PF_Err +AEFX_ParseFpLong( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + PF_FpLong *dPF) /* << */ +{ + PF_Err err = PF_Err_NONE; + A_char c; + A_char *end_ptr; + A_char buf[AEFX_CELL_SIZE]; + + err = AEFX_ParseCell(in_data, out_data, startPC, current_indexPL, buf); + + if (!err) { + c = buf[0]; + + if (!isdigit(c) && c != '.' && c != '-') { + err = AEFX_ParseError_EXPECTING_A_NUMBER; + } else { + errno = 0; + *dPF = strtod(buf, &end_ptr); + } + } + + return err; +} + + + +PF_Err +AEFX_MatchCell( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *strPC, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + PF_Boolean *matchPB0) /* << */ +{ + PF_Err err = PF_Err_NONE; + A_char buf[AEFX_CELL_SIZE]; + A_u_long origLu = *current_indexPL; + PF_Boolean found = 0; + + if (startPC[*current_indexPL] == AEFX_Char_EOL) { + found = 0; + err = AEFX_ParseError_EXPECTING_MORE_DATA; + } else { + err = AEFX_ParseCell(in_data, out_data, startPC, current_indexPL, buf); + + if (!err) { + found = STR_EQUAL(buf, strPC); + + if (!found) + *current_indexPL = origLu; + } + } + + if (!err && !found && matchPB0 == NULL) { + err = AEFX_ParseError_MATCH_ERROR; + } + + if (matchPB0) + *matchPB0 = found; + + return err; +} + + diff --git a/External/AE SDK/Headers/AEFX_ArbParseHelper.h b/External/AE SDK/Headers/AEFX_ArbParseHelper.h new file mode 100644 index 00000000..fa79fa3e --- /dev/null +++ b/External/AE SDK/Headers/AEFX_ArbParseHelper.h @@ -0,0 +1,75 @@ +// AEFX_ArbParseHelper.h +// + +// This file has no header, and is designed to by #included as necessary. -jja 9/30/98 + + +#ifndef _H_AEFX_ArbParseHelper +#define _H_AEFX_ArbParseHelper + +#include + +#define AEFX_Char_TAB '\t' +#define AEFX_Char_EOL '\r' +#define AEFX_Char_SPACE ' ' + +#ifndef AEFX_CELL_SIZE +#define AEFX_CELL_SIZE 256 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +enum { + AEFX_ParseError_EXPECTING_MORE_DATA = 0x00FEBE00, + AEFX_ParseError_APPEND_ERROR, + AEFX_ParseError_EXPECTING_A_NUMBER, + AEFX_ParseError_MATCH_ERROR +}; +typedef A_long AEFX_ParseErrors; + + + +#ifndef STR_EQUAL + #define STR_EQUAL(A, B) (strcmp((A),(B)) == 0) +#endif + + +PF_Err +AEFX_AppendText( A_char *srcAC, /* >> */ + const A_u_long dest_sizeL, /* >> */ + A_char *destAC, /* <> */ + A_u_long *current_indexPLu); /* <> */ + + +PF_Err +AEFX_ParseFpLong( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + PF_FpLong *dPF); /* << */ + + +PF_Err +AEFX_MatchCell( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *strPC, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + PF_Boolean *matchPB0); /* << */ + +PF_Err +AEFX_ParseCell( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + A_char *bufAC); /* << AEFX_CELL_SIZE */ + + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/External/AE SDK/Headers/AEFX_ChannelDepthTpl.h b/External/AE SDK/Headers/AEFX_ChannelDepthTpl.h new file mode 100644 index 00000000..55c0546d --- /dev/null +++ b/External/AE SDK/Headers/AEFX_ChannelDepthTpl.h @@ -0,0 +1,59 @@ +#ifndef _H_AEFX_CHANNELDEPTHTPL +#define _H_AEFX_CHANNELDEPTHTPL + +/** AEFX_ChannelDepthTpl.h + + (c) 2005 Adobe Systems Incorporated + +**/ + +// Basic pixel traits structure. This structure is never used per se, merely overidden -- see below. +template +struct PixelTraits { + typedef int PixType; + typedef int DataType; + static DataType + LutFunc(DataType input, const DataType *map); + + enum {max_value = 0 }; +}; + + +// 8 bit pixel types, constants, and functions +template <> +struct PixelTraits{ + typedef PF_Pixel8 PixType; + typedef u_char DataType; + static DataType + LutFunc(DataType input, const DataType *map){return map[input];} + enum {max_value = PF_MAX_CHAN8}; +}; + +// 16 bit pixel types, constants, and functions +template <> +struct PixelTraits{ + typedef PF_Pixel16 PixType; + typedef u_short DataType; + static u_short + LutFunc(u_short input, const u_short *map); + enum {max_value = PF_MAX_CHAN16}; +}; + + +inline u_short +PixelTraits::LutFunc(u_short input, + const u_short *map) +{ + u_short index = input >> (15 - PF_TABLE_BITS); + uint32_t fract = input & ((1 << (15 - PF_TABLE_BITS)) - 1); + A_long result = map [index]; + + if (fract) { + result += ((((A_long) map [index + 1] - result) * fract) + + (1 << (14 - PF_TABLE_BITS))) >> (15 - PF_TABLE_BITS); + } + return (u_short) result; + +} + +#endif //_H_AEFX_CHANNELDEPTHTPL \ No newline at end of file diff --git a/External/AE SDK/Headers/AEFX_SuiteHandlerTemplate.h b/External/AE SDK/Headers/AEFX_SuiteHandlerTemplate.h new file mode 100644 index 00000000..b51cf18e --- /dev/null +++ b/External/AE SDK/Headers/AEFX_SuiteHandlerTemplate.h @@ -0,0 +1,63 @@ +#ifndef _H_AEFX_SUITE_HELPER_TEMPLATE +#define _H_AEFX_SUITE_HELPER_TEMPLATE + +#include +#include +#include +#include + + +#ifdef __cplusplus + +// Throws A_Err_MISSING_SUITE if acquisition fails and the second template argument, ALLOW_NO_SUITE, is set to false +template +class AEFX_SuiteScoper +{ +public: + AEFX_SuiteScoper(const PF_InData *in_data, const char *suite_name, int32_t suite_versionL, PF_OutData *out_dataP0 = 0, const char *err_stringZ0 = 0) + { + i_suite_name = suite_name; + i_suite_versionL = suite_versionL; + i_basic_suiteP = in_data->pica_basicP; + + const void *suiteP; + SPErr err = i_basic_suiteP->AcquireSuite(i_suite_name, i_suite_versionL, &suiteP); + + if (err != kSPNoError) { + if (ALLOW_NO_SUITE) { + suiteP = NULL; + } + else { + if (out_dataP0) { + const char *error_stringPC = err_stringZ0 ? err_stringZ0 : "Not able to acquire AEFX Suite."; + out_dataP0->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + (*in_data->utils->ansi.sprintf)(out_dataP0->return_msg, error_stringPC); + } + A_THROW(A_Err_MISSING_SUITE); + } + } + + i_suiteP = reinterpret_cast(suiteP); + } + + ~AEFX_SuiteScoper() + { + if (i_suiteP) { + i_basic_suiteP->ReleaseSuite(i_suite_name, i_suite_versionL); // ignore error, nothing we can do in dtor + } + } + + const SUITETYPE* operator->() const { return i_suiteP; } + const SUITETYPE* get() const { return i_suiteP; } + +private: + mutable const SUITETYPE *i_suiteP; + SPBasicSuite *i_basic_suiteP; + const char *i_suite_name; + int32_t i_suite_versionL; +}; + + +#endif // __cplusplus + +#endif // _H diff --git a/External/AE SDK/Headers/AEFX_SuiteHelper.c b/External/AE SDK/Headers/AEFX_SuiteHelper.c new file mode 100644 index 00000000..9ddd9b2a --- /dev/null +++ b/External/AE SDK/Headers/AEFX_SuiteHelper.c @@ -0,0 +1,139 @@ +/************************************************************************** +* +* ADOBE CONFIDENTIAL +* ___________________ +* +* Copyright 2009 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains the property of +* Adobe Systems Incorporated and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe Systems +* Incorporated and its suppliers and may be covered by U.S. and Foreign +* Patents,patents in process,and are protected by trade secret or copyright +* law. Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained from +* Adobe Systems Incorporated. +**************************************************************************/ + + +/** AEFX_SuiteHelper.c + + Contains helper routines for acquiring/releasing suites. + +**/ + +#include "AEFX_SuiteHelper.h" +#include + +PF_Err AEFX_AcquireSuite( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version, /* >> */ + const char *error_stringPC0, /* >> */ + void **suite) /* << */ +{ + PF_Err err = PF_Err_NONE; + SPBasicSuite *bsuite; + + bsuite = in_data->pica_basicP; + + if (bsuite) { + (*bsuite->AcquireSuite)((char*)name, version, (const void**)suite); + + if (!*suite) { + err = PF_Err_BAD_CALLBACK_PARAM; + } + } else { + err = PF_Err_BAD_CALLBACK_PARAM; + } + + if (err) { + const char *error_stringPC = error_stringPC0 ? error_stringPC0 : "Not able to acquire AEFX Suite."; + + out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + + PF_SPRINTF(out_data->return_msg, error_stringPC); + } + + return err; +} + + + +PF_Err AEFX_ReleaseSuite( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version, /* >> */ + const char *error_stringPC0) /* >> */ +{ + PF_Err err = PF_Err_NONE; + SPBasicSuite *bsuite; + + bsuite = in_data->pica_basicP; + + if (bsuite) { + (*bsuite->ReleaseSuite)((char*)name, version); + } else { + err = PF_Err_BAD_CALLBACK_PARAM; + } + + if (err) { + const char *error_stringPC = error_stringPC0 ? error_stringPC0 : "Not able to release AEFX Suite."; + + out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + + PF_SPRINTF(out_data->return_msg, error_stringPC); + } + + return err; +} + + +PF_Err AEFX_AcquireDrawbotSuites( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + DRAWBOT_Suites *suitesP) /* << */ +{ + PF_Err err = PF_Err_NONE; + + if (suitesP == NULL) { + out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + + PF_SPRINTF(out_data->return_msg, "NULL suite pointer passed to AEFX_AcquireDrawbotSuites"); + + err = PF_Err_UNRECOGNIZED_PARAM_TYPE; + } + + if (!err) { + err = AEFX_AcquireSuite(in_data, out_data, kDRAWBOT_DrawSuite, kDRAWBOT_DrawSuite_VersionCurrent, NULL, (void **)&suitesP->drawbot_suiteP); + } + if (!err) { + err = AEFX_AcquireSuite(in_data, out_data, kDRAWBOT_SupplierSuite, kDRAWBOT_SupplierSuite_VersionCurrent, NULL, (void **)&suitesP->supplier_suiteP); + } + if (!err) { + err = AEFX_AcquireSuite(in_data, out_data, kDRAWBOT_SurfaceSuite, kDRAWBOT_SurfaceSuite_VersionCurrent, NULL, (void **)&suitesP->surface_suiteP); + } + if (!err) { + err = AEFX_AcquireSuite(in_data, out_data, kDRAWBOT_PathSuite, kDRAWBOT_PathSuite_VersionCurrent, NULL, (void **)&suitesP->path_suiteP); + } + + return err; +} + + +PF_Err AEFX_ReleaseDrawbotSuites( PF_InData *in_data, /* >> */ + PF_OutData *out_data) /* >> */ +{ + PF_Err err = PF_Err_NONE; + + AEFX_ReleaseSuite(in_data, out_data, kDRAWBOT_DrawSuite, kDRAWBOT_DrawSuite_VersionCurrent, NULL); + AEFX_ReleaseSuite(in_data, out_data, kDRAWBOT_SupplierSuite, kDRAWBOT_SupplierSuite_VersionCurrent, NULL); + AEFX_ReleaseSuite(in_data, out_data, kDRAWBOT_SurfaceSuite, kDRAWBOT_SurfaceSuite_VersionCurrent, NULL); + AEFX_ReleaseSuite(in_data, out_data, kDRAWBOT_PathSuite, kDRAWBOT_PathSuite_VersionCurrent, NULL); + + return err; +} + + + + diff --git a/External/AE SDK/Headers/AEFX_SuiteHelper.h b/External/AE SDK/Headers/AEFX_SuiteHelper.h new file mode 100644 index 00000000..2ede44c8 --- /dev/null +++ b/External/AE SDK/Headers/AEFX_SuiteHelper.h @@ -0,0 +1,157 @@ +/************************************************************************** +* +* ADOBE CONFIDENTIAL +* ___________________ +* +* Copyright 2009 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains the property of +* Adobe Systems Incorporated and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe Systems +* Incorporated and its suppliers and may be covered by U.S. and Foreign +* Patents,patents in process,and are protected by trade secret or copyright +* law. Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained from +* Adobe Systems Incorporated. +**************************************************************************/ + +#ifndef AEFX_SUITE_HELPER_H +#define AEFX_SUITE_HELPER_H + + +/** AEFX_SuiteHelper.h + + Contains helper routines for acquiring/releasing suites. + + NOTE: If you're writing C++ plug-ins that support exceptions, use the AEGP_SuiteHandler class or AEFX_SuiteScoper. + +**/ + +#include +#include +#include +#include + + + +#ifdef __cplusplus + extern "C" { +#endif + +PF_Err AEFX_AcquireSuite( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version, /* >> */ + const char *error_stringPC0, /* >> */ + void **suite); /* << */ + + +PF_Err AEFX_ReleaseSuite( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version, /* >> */ + const char *error_stringPC0); /* >> */ + + +PF_Err AEFX_AcquireDrawbotSuites( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + DRAWBOT_Suites *suiteP); /* << */ + + +PF_Err AEFX_ReleaseDrawbotSuites( PF_InData *in_data, /* >> */ + PF_OutData *out_data); /* >> */ + + +#ifdef __cplusplus + } +#endif + + +#ifdef __cplusplus + + template + class AEFX_SuiteHelperT + { + public: + AEFX_SuiteHelperT( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version) : /* >> */ + mInDataP(in_data), mOutDataP(out_data), mSuiteName(name), mSuiteVersion(version), mSuiteP(NULL) + { + void *suiteP(NULL); + + PF_Err err = AEFX_AcquireSuite(mInDataP, mOutDataP, mSuiteName, mSuiteVersion, NULL, &suiteP); + + if (err) { + A_THROW(err); + } + + mSuiteP = reinterpret_cast(suiteP); + } + + ~AEFX_SuiteHelperT() + { + (void)AEFX_ReleaseSuite(mInDataP, mOutDataP, mSuiteName, mSuiteVersion, NULL); + } + + const SuiteType* operator->() const + { + return mSuiteP; + } + + SuiteType* get() const + { + return mSuiteP; + } + + private: + + PF_InData *mInDataP; + PF_OutData *mOutDataP; + const char *mSuiteName; + int32_t mSuiteVersion; + SuiteType *mSuiteP; + }; + + + +// clients of this class probably should just be using the regular template +// instead + +class AEFX_DrawbotSuitesScoper +{ +public: + AEFX_DrawbotSuitesScoper(PF_InData *in_data, PF_OutData *out_data) + : + i_in_data(in_data), + i_out_data(out_data) + { + PF_Err err = AEFX_AcquireDrawbotSuites(in_data, out_data, &i_suites); + + if (err) { + A_THROW(err); + } + } + + inline DRAWBOT_Suites* Get() + { + return &i_suites; + } + + ~AEFX_DrawbotSuitesScoper() + { + AEFX_ReleaseDrawbotSuites(i_in_data, i_out_data); + } + +private: + DRAWBOT_Suites i_suites; + PF_InData *i_in_data; + PF_OutData *i_out_data; +}; + +#endif + + +#endif // AEFX_SUITE_HELPER_H diff --git a/External/AE SDK/Headers/AEGP_SuiteHandler.cpp b/External/AE SDK/Headers/AEGP_SuiteHandler.cpp new file mode 100644 index 00000000..146a5f5e --- /dev/null +++ b/External/AE SDK/Headers/AEGP_SuiteHandler.cpp @@ -0,0 +1,66 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +/** AEGP_SuiteHandler.cpp + + Implementation of AEGP_SuiteHandler non-inlines. See AEGP_SuiteHandler.h for usage. + + created 9/11/2000 jms +**/ + + +#include +#include + +AEGP_SuiteHandler::AEGP_SuiteHandler(const SPBasicSuite *pica_basicP) : + i_pica_basicP(pica_basicP) +{ + AEFX_CLR_STRUCT(i_suites); + + if (!i_pica_basicP) { //can't construct w/out basic suite, everything else is demand loaded + MissingSuiteError(); + } +} + +AEGP_SuiteHandler::~AEGP_SuiteHandler() +{ + ReleaseAllSuites(); +} + +// Had to go to the header file to be inlined to please CW mach-o target +/*void *AEGP_SuiteHandler::pLoadSuite(A_char *nameZ, A_long versionL) const +{ + const void *suiteP; + A_long err = i_pica_basicP->AcquireSuite(nameZ, versionL, &suiteP); + + if (err || !suiteP) { + MissingSuiteError(); + } + + return (void*)suiteP; +}*/ + +// Free a particular suite. Ignore errors, because, what is there to be done if release fails? +void AEGP_SuiteHandler::ReleaseSuite(const A_char *nameZ, A_long versionL) +{ + i_pica_basicP->ReleaseSuite(nameZ, versionL); +} + diff --git a/External/AE SDK/Headers/AEGP_SuiteHandler.h b/External/AE SDK/Headers/AEGP_SuiteHandler.h new file mode 100644 index 00000000..59bc043b --- /dev/null +++ b/External/AE SDK/Headers/AEGP_SuiteHandler.h @@ -0,0 +1,601 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + + +/** AEGP_SuiteHandler.h + + DEPRECATED: + This way of doing things is out of date. See AEFX_SuiteHandlerTemplate.h for the + new way of doing things. + + -kjw 2/28/2014 + + A very helpful class that manages demand loading and automatic, exception-safe freeing + of AEGP suites. + + USAGE INSTRUCTIONS: + + The accompanying file, AEGP_SuiteHandler.cpp, is designed to be compiled right into + the client application or plug-in. + + You'll get a link error. + + This is because AEGP_SuiteHandler.cpp lacks a definition for the MissingSuiteError() + method. You must provide one to define the error handling behaviour of the class. + This function may or may not display an error message etc. but it must end + by throwing an exception. It cannot return. + + Other than that, usage is pretty trivial. Construct with a pointer to the PICA + basic suite, and then call the public method to obtain lazily loaded pointers + to other AEGP suites. Upon desctruction, all loaded suites are freed (so this class + is really handy for writing exception-safe AEGP code.) + + NOTE!!! If you need to upgrade a suite, DO NOT SIMPLY UPDATE THE VERSION NUMBER. + You should: + 1. Add a new member to the Suites structure for that suite. + 2. Add the boiler plate macro to release the suite in ReleaseAllSuites (AEGP_SUITE_RELEASE_BOILERPLATE). + 3. Add the boiler plate macro to define the suite. (AEGP_SUITE_ACCESS_BOILERPLATE) + + If you have any questions, ask me. -jja 5/7/2004 + + If you'll be using ADM suites, #define I_NEED_ADM_SUPPORT before #including AEGP_SuiteHandler.h. + + -bbb 9/16/2004 +**/ + +#ifndef _H_AEGP_SUITEHANDLER +#define _H_AEGP_SUITEHANDLER + +#include +#include +#include +#include +#include +#include +#include + +#ifdef I_NEED_ADM_SUPPORT +#include +#include +#include +#include +#include +#include +#include +#endif + +// Suite registration and handling object +class AEGP_SuiteHandler { + +private: + // forbid copy construct + AEGP_SuiteHandler(const AEGP_SuiteHandler&) {} + AEGP_SuiteHandler& operator=(const AEGP_SuiteHandler&) { return *this; } + + // basic suite pointer + const SPBasicSuite *i_pica_basicP; + + // Suites we can register. These are mutable because they are demand loaded using a const object. + + struct Suites { + AEGP_KeyframeSuite4 *keyframe_suite4P; + AEGP_StreamSuite3 *stream_suite3P; + AEGP_StreamSuite4 *stream_suite4P; + AEGP_StreamSuite5 *stream_suite5P; + AEGP_MarkerSuite1 *marker_suite1P; + AEGP_MarkerSuite2 *marker_suite2P; + AEGP_MarkerSuite3 *marker_suite3P; + AEGP_CompSuite4 *comp_suite4P; + AEGP_CompSuite5 *comp_suite5P; + AEGP_CompSuite6 *comp_suite6P; + AEGP_CompSuite7 *comp_suite7P; + AEGP_CompSuite8 *comp_suite8P; + AEGP_CompSuite9 *comp_suite9P; + AEGP_CompSuite10 *comp_suite10P; + AEGP_CompSuite11 *comp_suite11P; + AEGP_LayerSuite3 *layer_suite3P; + AEGP_LayerSuite4 *layer_suite4P; + AEGP_StreamSuite2 *stream_suite2P; + AEGP_DynamicStreamSuite2 *dynamic_stream_suite2P; + AEGP_DynamicStreamSuite3 *dynamic_stream_suite3P; + AEGP_DynamicStreamSuite4 *dynamic_stream_suite4P; + AEGP_KeyframeSuite3 *keyframe_suite3P; + AEGP_CanvasSuite5 *canvas_suite5P; + AEGP_CanvasSuite6 *canvas_suite6P; + AEGP_CanvasSuite7 *canvas_suite7P; + AEGP_CanvasSuite8 *canvas_suite8P; + AEGP_CameraSuite2 *camera_suite2P; + AEGP_RegisterSuite5 *register_suite5P; + AEGP_MemorySuite1 *memory_suite1P; + AEGP_ItemViewSuite1 *item_view_suite1P; + AEGP_ItemSuite9 *item_suite9P; + AEGP_ItemSuite8 *item_suite8P; + AEGP_ItemSuite7 *item_suite7P; + AEGP_ItemSuite6 *item_suite6P; + AEGP_ItemSuite5 *item_suite5P; + AEGP_ItemSuite1 *item_suite1P; + AEGP_LightSuite1 *light_suite1P; + AEGP_LightSuite2 *light_suite2P; + AEGP_EffectSuite1 *effect_suite1P; + AEGP_EffectSuite2 *effect_suite2P; + AEGP_EffectSuite3 *effect_suite3P; + AEGP_EffectSuite4 *effect_suite4P; + AEGP_MaskSuite4 *mask_suite4P; + AEGP_MaskOutlineSuite1 *mask_outline_suite1P; + AEGP_MaskOutlineSuite2 *mask_outline_suite2P; + AEGP_MaskOutlineSuite3 *mask_outline_suite3P; + AEGP_CommandSuite1 *command_suite1P; + AEGP_UtilitySuite3 *utility_suite3P; + AEGP_RenderSuite1 *render_suite1P; + AEGP_RenderSuite2 *render_suite2P; + AEGP_RenderSuite3 *render_suite3P; + AEGP_RenderSuite4 *render_suite4P; + AEGP_RenderSuite5 *render_suite5P; + PF_ANSICallbacksSuite1 *ansi_callbacks_suite1P; + PF_HandleSuite1 *handle_suite1P; + PF_FillMatteSuite2 *fill_matte_suite2P; + PF_WorldTransformSuite1 *world_transform_suite1P; + AEGP_QueryXformSuite2 *query_xform_suite2P; + AEGP_CompositeSuite2 *composite_suite2P; + PF_WorldSuite1 *world_suite1P; + AEGP_PFInterfaceSuite1 *pf_interface_suite1P; + AEGP_MathSuite1 *math_suite1P; + PF_AdvTimeSuite4 *adv_time_suite4P; + PF_PathQuerySuite1 *path_query_suite1P; + PF_PathDataSuite1 *path_data_suite1P; + PF_ParamUtilsSuite3 *param_utils_suite3P; + PFAppSuite4 *app_suite4P; + PFAppSuite5 *app_suite5P; + PFAppSuite6 *app_suite6P; + PF_AdvAppSuite2 *adv_app_suite2P; + AEGP_IOInSuite4 *io_in_suite4P; + AEGP_IOOutSuite4 *io_out_suite4P; + AEGP_PersistentDataSuite3 *persistent_data_suite3P; + AEGP_PersistentDataSuite4 *persistent_data_suite4P; + AEGP_RenderQueueSuite1 *render_queue_suite1P; + AEGP_RQItemSuite2 *rq_item_suite2P; + AEGP_OutputModuleSuite4 *output_module_suite4P; + AEGP_FIMSuite3 *fim_suite3P; + PF_Sampling8Suite1 *sampling_8_suite1P; + PF_Sampling16Suite1 *sampling_16_suite1P; + PF_Iterate8Suite1 *iterate_8_suite1P; + PF_iterate16Suite1 *iterate_16_suite1P; + PF_iterateFloatSuite1 *iterate_float_suite1P; + PF_Iterate8Suite2 *iterate_8_suite2P; + PF_iterate16Suite2 *iterate_16_suite2P; + PF_iterateFloatSuite2 *iterate_float_suite2P; + AEGP_CollectionSuite2 *collection_suite2P; + AEGP_TextDocumentSuite1 *text_document_suite1P; + AEGP_SoundDataSuite1 *sound_data_suite1P; + AEGP_IterateSuite1 *aegp_iterate_suite1P; + AEGP_IterateSuite2 *aegp_iterate_suite2P; + AEGP_TextLayerSuite1 *text_layer_suite1P; + AEGP_ArtisanUtilSuite1 *artisan_util_suite1P; + AEGP_WorldSuite2 *aegp_world_suite_2P; + AEGP_WorldSuite3 *aegp_world_suite_3P; + AEGP_RenderOptionsSuite1 *render_options_suite_1P; + AEGP_LayerRenderOptionsSuite1 *layer_render_options_suite_1P; + AEGP_LayerRenderOptionsSuite2 *layer_render_options_suite_2P; + AEGP_RenderAsyncManagerSuite1 *async_manager_suite_1P; + AEGP_TrackerSuite1 *tracker_suite_1P; + AEGP_TrackerUtilitySuite1 *tracker_utility_suite_1P; + PF_HelperSuite2 *helper_suite_2P; + AEGP_LayerSuite5 *layer_suite_5P; + AEGP_LayerSuite6 *layer_suite_6P; + AEGP_LayerSuite7 *layer_suite_7P; + AEGP_LayerSuite8 *layer_suite_8P; + +#ifdef I_NEED_ADM_SUPPORT + ADMBasicSuite8 *adm_basic_suite_8P; + ADMDialogSuite8 *adm_dialog_suite_8P; + ADMDialogGroupSuite3 *adm_dialog_group_suite_3P; + ADMItemSuite8 *adm_item_suite_8P; + ADMListSuite3 *adm_list_suite_3P; + ADMEntrySuite5 *adm_entry_suite_5P; + ADMNotifierSuite2 *adm_notifier_suite_2P; +#endif + AEGP_LayerSuite1 *layer_suite_1P; + AEGP_MaskSuite1 *mask_suite_1P; + AEGP_MaskSuite5 *mask_suite_5P; + AEGP_MaskSuite6 *mask_suite_6P; + AEGP_StreamSuite1 *stream_suite_1P; + AEGP_CompSuite1 *comp_suite_1P; + AEGP_CollectionSuite1 *collection_suite_1P; + AEGP_KeyframeSuite1 *keyframe_suite_1P; + PF_AdvAppSuite1 *adv_app_suite_1P; + AEGP_UtilitySuite1 *utility_suite_1P; + AEGP_RenderOptionsSuite2 *render_options_suite_2P; + AEGP_ProjSuite5 *proj_suite_5P; + AEGP_ProjSuite6 *proj_suite_6P; + AEGP_FootageSuite5 *footage_suite_5P; + AEGP_RQItemSuite3 *rq_item_suite_3P; + AEGP_UtilitySuite4 *utility_suite_4P; + AEGP_ColorSettingsSuite3 *color_settings_suite_3P; + AEGP_ColorSettingsSuite2 *color_settings_suite_2P; + AEGP_ColorSettingsSuite1 *color_settings_suite_1P; + PF_AdvItemSuite1 *adv_item_suite_1P; + AEGP_RenderOptionsSuite3 *render_options_suite_3P; + PF_ColorParamSuite1 *color_param_suite_1P; + PF_SamplingFloatSuite1 *sampling_float_suite_1P; + AEGP_UtilitySuite5 *utility_suite_5P; + AEGP_UtilitySuite6 *utility_suite_6P; + PF_EffectCustomUISuite1 *custom_ui_suite1P; + PF_EffectCustomUISuite2 *custom_ui_suite2P; + PF_EffectCustomUIOverlayThemeSuite1 *custom_ui_theme_suite1P; + + //Drawbot Suites + DRAWBOT_DrawbotSuiteCurrent *drawing_suite_currentP; + DRAWBOT_SupplierSuiteCurrent *drawbot_supplier_suite_currentP; + DRAWBOT_SurfaceSuiteCurrent *drawbot_surface_suite_currentP; + DRAWBOT_PathSuiteCurrent *drawbot_path_suite_currentP; + + SPSuitesSuite *suites_suite_2P; + }; + + mutable Suites i_suites; + + // private methods + // I had to make this inline by moving the definition from the .cpp file + // CW mach-o target was freaking otherwise when seeing the call to this + // function in inlined public suite accessors below + + void *LoadSuite(const A_char *nameZ, A_long versionL) const + { + const void *suiteP; + A_long err = i_pica_basicP->AcquireSuite(nameZ, versionL, &suiteP); + + if (err || !suiteP) { + MissingSuiteError(); + } + + return (void*)suiteP; + } + + void ReleaseSuite(const A_char *nameZ, A_long versionL); + void ReleaseAllSuites() + { + #define AEGP_SUITE_RELEASE_BOILERPLATE(MEMBER_NAME, kSUITE_NAME, kVERSION_NAME) \ + if (i_suites.MEMBER_NAME) { \ + ReleaseSuite(kSUITE_NAME, kVERSION_NAME); \ + } + + AEGP_SUITE_RELEASE_BOILERPLATE(marker_suite1P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(marker_suite2P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(marker_suite3P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite3P, kAEGPLayerSuite, kAEGPLayerSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite4P, kAEGPLayerSuite, kAEGPLayerSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite5P, kAEGPStreamSuite, kAEGPStreamSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite4P, kAEGPStreamSuite, kAEGPStreamSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite3P, kAEGPStreamSuite, kAEGPStreamSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite2P, kAEGPStreamSuite, kAEGPStreamSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite_1P, kAEGPStreamSuite, kAEGPStreamSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(dynamic_stream_suite2P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(dynamic_stream_suite3P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(dynamic_stream_suite4P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(keyframe_suite4P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(keyframe_suite3P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(keyframe_suite_1P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite4P, kAEGPCompSuite, kAEGPCompSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite5P, kAEGPCompSuite, kAEGPCompSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite6P, kAEGPCompSuite, kAEGPCompSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite7P, kAEGPCompSuite, kAEGPCompSuiteVersion7); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite8P, kAEGPCompSuite, kAEGPCompSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite9P, kAEGPCompSuite, kAEGPCompSuiteVersion9); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite10P, kAEGPCompSuite, kAEGPCompSuiteVersion10); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite11P, kAEGPCompSuite, kAEGPCompSuiteVersion11); + AEGP_SUITE_RELEASE_BOILERPLATE(canvas_suite5P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(canvas_suite6P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(canvas_suite7P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion7); + AEGP_SUITE_RELEASE_BOILERPLATE(canvas_suite8P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(camera_suite2P, kAEGPCameraSuite, kAEGPCameraSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(register_suite5P, kAEGPRegisterSuite, kAEGPRegisterSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(item_view_suite1P, kAEGPItemViewSuite, kAEGPItemViewSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite8P, kAEGPItemSuite, kAEGPItemSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite7P, kAEGPItemSuite, kAEGPItemSuiteVersion7); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite6P, kAEGPItemSuite, kAEGPItemSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite5P, kAEGPItemSuite, kAEGPItemSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite1P, kAEGPItemSuite, kAEGPItemSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(pf_interface_suite1P, kAEGPPFInterfaceSuite, kAEGPPFInterfaceSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(math_suite1P, kAEGPMathSuite, kAEGPMathSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_time_suite4P, kPFAdvTimeSuite, kPFAdvTimeSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(path_query_suite1P, kPFPathQuerySuite, kPFPathQuerySuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(memory_suite1P, kAEGPMemorySuite, kAEGPMemorySuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(path_data_suite1P, kPFPathDataSuite, kPFPathDataSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(param_utils_suite3P, kPFParamUtilsSuite, kPFParamUtilsSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(app_suite4P, kPFAppSuite, kPFAppSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(app_suite5P, kPFAppSuite, kPFAppSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(app_suite6P, kPFAppSuite, kPFAppSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_app_suite2P, kPFAdvAppSuite, kPFAdvAppSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(light_suite1P, kAEGPLightSuite, kAEGPLightSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(light_suite2P, kAEGPLightSuite, kAEGPLightSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(effect_suite1P, kAEGPEffectSuite, kAEGPEffectSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(effect_suite2P, kAEGPEffectSuite, kAEGPEffectSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(effect_suite3P, kAEGPEffectSuite, kAEGPEffectSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(effect_suite4P, kAEGPEffectSuite, kAEGPEffectSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_suite4P, kAEGPMaskSuite, kAEGPMaskSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_outline_suite1P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_outline_suite2P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_outline_suite3P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(command_suite1P, kAEGPCommandSuite, kAEGPCommandSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite3P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite1P, kAEGPRenderSuite, kAEGPRenderSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite2P, kAEGPRenderSuite, kAEGPRenderSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite3P, kAEGPRenderSuite, kAEGPRenderSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite4P, kAEGPRenderSuite, kAEGPRenderSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite5P, kAEGPRenderSuite, kAEGPRenderSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(ansi_callbacks_suite1P, kPFANSISuite, kPFANSISuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(handle_suite1P, kPFHandleSuite, kPFHandleSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(fill_matte_suite2P, kPFFillMatteSuite, kPFFillMatteSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(world_transform_suite1P, kPFWorldTransformSuite, kPFWorldTransformSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(query_xform_suite2P, kAEGPQueryXformSuite, kAEGPQueryXformSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(composite_suite2P, kAEGPCompositeSuite, kAEGPCompositeSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(world_suite1P, kPFWorldSuite, kPFWorldSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(io_in_suite4P, kAEGPIOInSuite, kAEGPIOInSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(io_out_suite4P, kAEGPIOOutSuite, kAEGPIOOutSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(render_queue_suite1P, kAEGPRenderQueueSuite, kAEGPRenderQueueSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(rq_item_suite2P, kAEGPRQItemSuite, kAEGPRQItemSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(output_module_suite4P, kAEGPOutputModuleSuite, kAEGPOutputModuleSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(fim_suite3P, kAEGPFIMSuite, kAEGPFIMSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(math_suite1P, kAEGPMathSuite, kAEGPMathSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_time_suite4P, kPFAdvTimeSuite, kPFAdvTimeSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(sampling_8_suite1P, kPFSampling8Suite, kPFSampling8SuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(sampling_16_suite1P, kPFSampling16Suite, kPFSampling16SuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_8_suite1P, kPFIterate8Suite, kPFIterate8SuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_16_suite1P, kPFIterate16Suite, kPFIterate16SuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_float_suite1P, kPFIterateFloatSuite, kPFIterateFloatSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_8_suite2P, kPFIterate8Suite, kPFIterate8SuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_16_suite2P, kPFIterate16Suite, kPFIterate16SuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_float_suite2P, kPFIterateFloatSuite, kPFIterateFloatSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(collection_suite2P, kAEGPCollectionSuite, kAEGPCollectionSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(text_document_suite1P, kAEGPTextDocumentSuite, kAEGPTextDocumentSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(sound_data_suite1P, kAEGPSoundDataSuite, kAEGPSoundDataVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(text_layer_suite1P, kAEGPTextLayerSuite, kAEGPTextLayerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(artisan_util_suite1P, kAEGPArtisanUtilSuite, kAEGPArtisanUtilSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(aegp_world_suite_2P, kAEGPWorldSuite, kAEGPWorldSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(aegp_world_suite_3P, kAEGPWorldSuite, kAEGPWorldSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(render_options_suite_1P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(tracker_suite_1P, kAEGPTrackerSuite, kAEGPTrackerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(tracker_utility_suite_1P, kAEGPTrackerUtilitySuite, kAEGPTrackerUtilitySuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(helper_suite_2P, kPFHelperSuite2, kPFHelperSuite2Version2); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_5P, kAEGPLayerSuite, kAEGPLayerSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_6P, kAEGPLayerSuite, kAEGPLayerSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_7P, kAEGPLayerSuite, kAEGPLayerSuiteVersion7); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_8P, kAEGPLayerSuite, kAEGPLayerSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_item_suite_1P, kPFAdvItemSuite, kPFAdvItemSuiteVersion1); +#ifdef I_NEED_ADM_SUPPORT + AEGP_SUITE_RELEASE_BOILERPLATE(adm_basic_suite_8P, kADMBasicSuite, kADMBasicSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_dialog_suite_8P, kADMDialogSuite, kADMDialogSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_dialog_group_suite_3P, kADMDialogGroupSuite, kADMDialogGroupSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_item_suite_8P, kADMItemSuite, kADMItemSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_list_suite_3P, kADMListSuite, kADMListSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_entry_suite_5P, kADMEntrySuite, kADMEntrySuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_notifier_suite_2P, kADMNotifierSuite, kADMNotifierSuiteVersion2); +#endif + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_1P, kAEGPLayerSuite, kAEGPLayerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_suite_1P, kAEGPMaskSuite, kAEGPMaskSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_suite_5P, kAEGPMaskSuite, kAEGPMaskSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_suite_6P, kAEGPMaskSuite, kAEGPMaskSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite_1P, kAEGPCompSuite, kAEGPCompSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(collection_suite_1P, kAEGPCollectionSuite, kAEGPCollectionSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_app_suite_1P, kPFAdvAppSuite, kPFAdvAppSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite_1P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(render_options_suite_2P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_render_options_suite_1P, kAEGPLayerRenderOptionsSuite, kAEGPLayerRenderOptionsSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_render_options_suite_2P, kAEGPLayerRenderOptionsSuite, kAEGPLayerRenderOptionsSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(async_manager_suite_1P, kAEGPRenderAsyncManagerSuite, kAEGPRenderAsyncManagerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(proj_suite_5P, kAEGPProjSuite, kAEGPProjSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(proj_suite_6P, kAEGPProjSuite, kAEGPProjSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(footage_suite_5P, kAEGPFootageSuite, kAEGPFootageSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(rq_item_suite_3P, kAEGPRQItemSuite, kAEGPRQItemSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite_4P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(persistent_data_suite4P, kAEGPPersistentDataSuite, kAEGPPersistentDataSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(persistent_data_suite3P, kAEGPPersistentDataSuite, kAEGPPersistentDataSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(color_settings_suite_3P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(color_settings_suite_2P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(color_settings_suite_1P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(color_param_suite_1P, kPFColorParamSuite, kPFColorParamSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(sampling_float_suite_1P, kPFSamplingFloatSuite, kPFSamplingFloatSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite_5P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite_6P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(custom_ui_suite1P, kPFEffectCustomUISuite, kPFEffectCustomUISuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(custom_ui_suite2P, kPFEffectCustomUISuite, kPFEffectCustomUISuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(custom_ui_theme_suite1P, kPFEffectCustomUIOverlayThemeSuite, kPFEffectCustomUIOverlayThemeSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(drawing_suite_currentP, kDRAWBOT_DrawSuite, kDRAWBOT_DrawSuite_VersionCurrent); + AEGP_SUITE_RELEASE_BOILERPLATE(drawbot_supplier_suite_currentP, kDRAWBOT_SupplierSuite, kDRAWBOT_SupplierSuite_VersionCurrent); + AEGP_SUITE_RELEASE_BOILERPLATE(drawbot_surface_suite_currentP, kDRAWBOT_SurfaceSuite, kDRAWBOT_SurfaceSuite_VersionCurrent); + AEGP_SUITE_RELEASE_BOILERPLATE(drawbot_path_suite_currentP, kDRAWBOT_PathSuite, kDRAWBOT_PathSuite_VersionCurrent); + AEGP_SUITE_RELEASE_BOILERPLATE(suites_suite_2P, kSPSuitesSuite, kSPSuitesSuiteVersion); +} + + // Here is the error handling function which must be defined. + // It must exit by throwing an exception, it cannot return. + void MissingSuiteError() const; + +public: + // To construct, pass pica_basicP + AEGP_SuiteHandler(const SPBasicSuite *pica_basicP); + ~AEGP_SuiteHandler(); + + const SPBasicSuite *Pica() const { return i_pica_basicP; } + + #define AEGP_SUITE_ACCESS_BOILERPLATE(SUITE_NAME, VERSION_NUMBER, SUITE_PREFIX, MEMBER_NAME, kSUITE_NAME, kVERSION_NAME) \ + SUITE_PREFIX##SUITE_NAME##VERSION_NUMBER *SUITE_NAME##VERSION_NUMBER() const \ + { \ + if (i_suites.MEMBER_NAME == NULL) { \ + i_suites.MEMBER_NAME = (SUITE_PREFIX##SUITE_NAME##VERSION_NUMBER*) \ + LoadSuite(kSUITE_NAME, kVERSION_NAME); \ + } \ + return i_suites.MEMBER_NAME; \ + } + + AEGP_SUITE_ACCESS_BOILERPLATE(MarkerSuite, 1, AEGP_, marker_suite1P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MarkerSuite, 2, AEGP_, marker_suite2P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(MarkerSuite, 3, AEGP_, marker_suite3P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 3, AEGP_, layer_suite3P, kAEGPLayerSuite, kAEGPLayerSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 4, AEGP_, layer_suite4P, kAEGPLayerSuite, kAEGPLayerSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 5, AEGP_, stream_suite5P, kAEGPStreamSuite, kAEGPStreamSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 4, AEGP_, stream_suite4P, kAEGPStreamSuite, kAEGPStreamSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 3, AEGP_, stream_suite3P, kAEGPStreamSuite, kAEGPStreamSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 2, AEGP_, stream_suite2P, kAEGPStreamSuite, kAEGPStreamSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 1, AEGP_, stream_suite_1P, kAEGPStreamSuite, kAEGPStreamSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(DynamicStreamSuite, 2, AEGP_, dynamic_stream_suite2P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(DynamicStreamSuite, 3, AEGP_, dynamic_stream_suite3P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(DynamicStreamSuite, 4, AEGP_, dynamic_stream_suite4P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(KeyframeSuite, 4, AEGP_, keyframe_suite4P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(KeyframeSuite, 3, AEGP_, keyframe_suite3P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(KeyframeSuite, 1, AEGP_, keyframe_suite_1P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 4, AEGP_, comp_suite4P, kAEGPCompSuite, kAEGPCompSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 5, AEGP_, comp_suite5P, kAEGPCompSuite, kAEGPCompSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 6, AEGP_, comp_suite6P, kAEGPCompSuite, kAEGPCompSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 7, AEGP_, comp_suite7P, kAEGPCompSuite, kAEGPCompSuiteVersion7); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 8, AEGP_, comp_suite8P, kAEGPCompSuite, kAEGPCompSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 9, AEGP_, comp_suite9P, kAEGPCompSuite, kAEGPCompSuiteVersion9); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 10, AEGP_, comp_suite10P, kAEGPCompSuite, kAEGPCompSuiteVersion10); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 11, AEGP_, comp_suite11P, kAEGPCompSuite, kAEGPCompSuiteVersion11); + AEGP_SUITE_ACCESS_BOILERPLATE(CanvasSuite, 5, AEGP_, canvas_suite5P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(CanvasSuite, 6, AEGP_, canvas_suite6P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(CanvasSuite, 7, AEGP_, canvas_suite7P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion7); + AEGP_SUITE_ACCESS_BOILERPLATE(CanvasSuite, 8, AEGP_, canvas_suite8P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(CameraSuite, 2, AEGP_, camera_suite2P, kAEGPCameraSuite, kAEGPCameraSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(RegisterSuite, 5, AEGP_, register_suite5P, kAEGPRegisterSuite, kAEGPRegisterSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(MemorySuite, 1, AEGP_, memory_suite1P, kAEGPMemorySuite, kAEGPMemorySuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemViewSuite, 1, AEGP_, item_view_suite1P, kAEGPItemViewSuite, kAEGPItemViewSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 9, AEGP_, item_suite9P, kAEGPItemSuite, kAEGPItemSuiteVersion9); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 8, AEGP_, item_suite8P, kAEGPItemSuite, kAEGPItemSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 7, AEGP_, item_suite7P, kAEGPItemSuite, kAEGPItemSuiteVersion7); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 6, AEGP_, item_suite6P, kAEGPItemSuite, kAEGPItemSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 5, AEGP_, item_suite5P, kAEGPItemSuite, kAEGPItemSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 1, AEGP_, item_suite1P, kAEGPItemSuite, kAEGPItemSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(PFInterfaceSuite, 1, AEGP_, pf_interface_suite1P, kAEGPPFInterfaceSuite, kAEGPPFInterfaceSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MathSuite, 1, AEGP_, math_suite1P, kAEGPMathSuite, kAEGPMathSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(AdvTimeSuite, 4, PF_, adv_time_suite4P, kPFAdvTimeSuite, kPFAdvTimeSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(PathQuerySuite, 1, PF_, path_query_suite1P, kPFPathQuerySuite, kPFPathQuerySuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(PathDataSuite, 1, PF_, path_data_suite1P, kPFPathDataSuite, kPFPathDataSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ParamUtilsSuite, 3, PF_, param_utils_suite3P, kPFParamUtilsSuite, kPFParamUtilsSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(AppSuite, 4, PF, app_suite4P, kPFAppSuite, kPFAppSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(AppSuite, 5, PF, app_suite5P, kPFAppSuite, kPFAppSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(AppSuite, 6, PF, app_suite6P, kPFAppSuite, kPFAppSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(AdvAppSuite, 2, PF_, adv_app_suite2P, kPFAdvAppSuite, kPFAdvAppSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(LightSuite, 1, AEGP_, light_suite1P, kAEGPLightSuite, kAEGPLightSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(LightSuite, 2, AEGP_, light_suite2P, kAEGPLightSuite, kAEGPLightSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectSuite, 1, AEGP_, effect_suite1P, kAEGPEffectSuite, kAEGPEffectSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectSuite, 2, AEGP_, effect_suite2P, kAEGPEffectSuite, kAEGPEffectSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectSuite, 3, AEGP_, effect_suite3P, kAEGPEffectSuite, kAEGPEffectSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectSuite, 4, AEGP_, effect_suite4P, kAEGPEffectSuite, kAEGPEffectSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskSuite, 4, AEGP_, mask_suite4P, kAEGPMaskSuite, kAEGPMaskSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskOutlineSuite, 1, AEGP_, mask_outline_suite1P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskOutlineSuite, 2, AEGP_, mask_outline_suite2P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskOutlineSuite, 3, AEGP_, mask_outline_suite3P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(CommandSuite, 1, AEGP_, command_suite1P, kAEGPCommandSuite, kAEGPCommandSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 3, AEGP_, utility_suite3P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 1, AEGP_, render_suite1P, kAEGPRenderSuite, kAEGPRenderSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 2, AEGP_, render_suite2P, kAEGPRenderSuite, kAEGPRenderSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 3, AEGP_, render_suite3P, kAEGPRenderSuite, kAEGPRenderSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 4, AEGP_, render_suite4P, kAEGPRenderSuite, kAEGPRenderSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 5, AEGP_, render_suite5P, kAEGPRenderSuite, kAEGPRenderSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(ANSICallbacksSuite, 1, PF_, ansi_callbacks_suite1P, kPFANSISuite, kPFANSISuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(HandleSuite, 1, PF_, handle_suite1P, kPFHandleSuite, kPFHandleSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(FillMatteSuite, 2, PF_, fill_matte_suite2P, kPFFillMatteSuite, kPFFillMatteSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(WorldTransformSuite, 1, PF_, world_transform_suite1P, kPFWorldTransformSuite, kPFWorldTransformSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(QueryXformSuite, 2, AEGP_, query_xform_suite2P, kAEGPQueryXformSuite, kAEGPQueryXformSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(CompositeSuite, 2, AEGP_, composite_suite2P, kAEGPCompositeSuite, kAEGPCompositeSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(WorldSuite, 1, PF_, world_suite1P, kPFWorldSuite, kPFWorldSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(IOInSuite, 4, AEGP_, io_in_suite4P, kAEGPIOInSuite, kAEGPIOInSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(IOOutSuite, 4, AEGP_, io_out_suite4P, kAEGPIOOutSuite, kAEGPIOOutSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderQueueSuite, 1, AEGP_, render_queue_suite1P, kAEGPRenderQueueSuite, kAEGPRenderQueueSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(RQItemSuite, 2, AEGP_, rq_item_suite2P, kAEGPRQItemSuite, kAEGPRQItemSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(OutputModuleSuite, 4, AEGP_, output_module_suite4P, kAEGPOutputModuleSuite, kAEGPOutputModuleSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(FIMSuite, 3, AEGP_, fim_suite3P, kAEGPFIMSuite, kAEGPFIMSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(Sampling8Suite, 1, PF_, sampling_8_suite1P, kPFSampling8Suite, kPFSampling8SuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(Sampling16Suite, 1, PF_, sampling_16_suite1P, kPFSampling16Suite, kPFSampling16SuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(Iterate8Suite, 1, PF_, iterate_8_suite1P, kPFIterate8Suite, kPFIterate8SuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(Iterate16Suite, 1, PF_, iterate_16_suite1P, kPFIterate16Suite, kPFIterate16SuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(IterateFloatSuite, 1, PF_, iterate_float_suite1P, kPFIterateFloatSuite, kPFIterateFloatSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(Iterate8Suite, 2, PF_, iterate_8_suite2P, kPFIterate8Suite, kPFIterate8SuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(Iterate16Suite, 2, PF_, iterate_16_suite2P, kPFIterate16Suite, kPFIterate16SuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(IterateFloatSuite, 2, PF_, iterate_float_suite2P, kPFIterateFloatSuite, kPFIterateFloatSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(CollectionSuite, 2, AEGP_, collection_suite2P, kAEGPCollectionSuite, kAEGPCollectionSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(TextDocumentSuite, 1, AEGP_, text_document_suite1P, kAEGPTextDocumentSuite, kAEGPTextDocumentSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(SoundDataSuite, 1, AEGP_, sound_data_suite1P, kAEGPSoundDataSuite, kAEGPSoundDataVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(IterateSuite, 1, AEGP_, aegp_iterate_suite1P, kAEGPIterateSuite, kAEGPIterateSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(IterateSuite, 2, AEGP_, aegp_iterate_suite2P, kAEGPIterateSuite, kAEGPIterateSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(TextLayerSuite, 1, AEGP_, text_layer_suite1P, kAEGPTextLayerSuite, kAEGPTextLayerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ArtisanUtilSuite, 1, AEGP_, artisan_util_suite1P, kAEGPArtisanUtilSuite, kAEGPArtisanUtilSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(WorldSuite, 2, AEGP_, aegp_world_suite_2P, kAEGPWorldSuite, kAEGPWorldSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(WorldSuite, 3, AEGP_, aegp_world_suite_3P, kAEGPWorldSuite, kAEGPWorldSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderOptionsSuite, 1, AEGP_, render_options_suite_1P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(TrackerSuite, 1, AEGP_, tracker_suite_1P, kAEGPTrackerSuite, kAEGPTrackerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(TrackerUtilitySuite, 1, AEGP_, tracker_utility_suite_1P, kAEGPTrackerUtilitySuite, kAEGPTrackerUtilitySuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(HelperSuite, 2, PF_, helper_suite_2P, kPFHelperSuite2, kPFHelperSuite2Version2); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 5, AEGP_, layer_suite_5P, kAEGPLayerSuite, kAEGPLayerSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 6, AEGP_, layer_suite_6P, kAEGPLayerSuite, kAEGPLayerSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 7, AEGP_, layer_suite_7P, kAEGPLayerSuite, kAEGPLayerSuiteVersion7); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 8, AEGP_, layer_suite_8P, kAEGPLayerSuite, kAEGPLayerSuiteVersion8); +#ifdef I_NEED_ADM_SUPPORT + AEGP_SUITE_ACCESS_BOILERPLATE(BasicSuite, 8, ADM, adm_basic_suite_8P, kADMBasicSuite, kADMBasicSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(DialogSuite, 8, ADM, adm_dialog_suite_8P, kADMDialogSuite, kADMDialogSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(DialogGroupSuite, 3, ADM, adm_dialog_group_suite_3P, kADMDialogGroupSuite, kADMDialogGroupSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 8, ADM, adm_item_suite_8P, kADMItemSuite, kADMItemSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(ListSuite, 3, ADM, adm_list_suite_3P, kADMListSuite, kADMListSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(EntrySuite, 5, ADM, adm_entry_suite_5P, kADMEntrySuite, kADMEntrySuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(NotifierSuite, 2, ADM, adm_notifier_suite_2P, kADMNotifierSuite, kADMNotifierSuiteVersion2); +#endif + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 1, AEGP_, layer_suite_1P, kAEGPLayerSuite, kAEGPLayerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(AdvItemSuite, 1, PF_, adv_item_suite_1P, kPFAdvItemSuite, kPFAdvItemSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskSuite, 1, AEGP_, mask_suite_1P, kAEGPMaskSuite, kAEGPMaskSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskSuite, 5, AEGP_, mask_suite_5P, kAEGPMaskSuite, kAEGPMaskSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskSuite, 6, AEGP_, mask_suite_6P, kAEGPMaskSuite, kAEGPMaskSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 1, AEGP_, comp_suite_1P, kAEGPCompSuite, kAEGPCompSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(CollectionSuite, 1, AEGP_, collection_suite_1P, kAEGPCollectionSuite, kAEGPCollectionSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(AdvAppSuite, 1, PF_, adv_app_suite_1P, kPFAdvAppSuite, kPFAdvAppSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 1, AEGP_, utility_suite_1P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderOptionsSuite, 2, AEGP_, render_options_suite_2P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderOptionsSuite, 3, AEGP_, render_options_suite_3P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerRenderOptionsSuite, 1, AEGP_, layer_render_options_suite_1P, kAEGPLayerRenderOptionsSuite, kAEGPLayerRenderOptionsSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerRenderOptionsSuite, 2, AEGP_, layer_render_options_suite_2P, kAEGPLayerRenderOptionsSuite, kAEGPLayerRenderOptionsSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderAsyncManagerSuite, 1, AEGP_, async_manager_suite_1P, kAEGPRenderAsyncManagerSuite, kAEGPRenderAsyncManagerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ProjSuite, 5, AEGP_, proj_suite_5P, kAEGPProjSuite, kAEGPProjSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(ProjSuite, 6, AEGP_, proj_suite_6P, kAEGPProjSuite, kAEGPProjSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(FootageSuite, 5, AEGP_, footage_suite_5P, kAEGPFootageSuite, kAEGPFootageSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(RQItemSuite, 3, AEGP_, rq_item_suite_3P, kAEGPRQItemSuite, kAEGPRQItemSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 4, AEGP_, utility_suite_4P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(ColorSettingsSuite, 3, AEGP_, color_settings_suite_3P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(ColorSettingsSuite, 2, AEGP_, color_settings_suite_2P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(ColorSettingsSuite, 1, AEGP_, color_settings_suite_1P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ColorParamSuite, 1, PF_, color_param_suite_1P, kPFColorParamSuite, kPFColorParamSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(PersistentDataSuite, 4, AEGP_, persistent_data_suite4P, kAEGPPersistentDataSuite, kAEGPPersistentDataSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(PersistentDataSuite, 3, AEGP_, persistent_data_suite3P, kAEGPPersistentDataSuite, kAEGPPersistentDataSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(SamplingFloatSuite, 1, PF_, sampling_float_suite_1P, kPFSamplingFloatSuite, kPFSamplingFloatSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 5, AEGP_, utility_suite_5P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 6, AEGP_, utility_suite_6P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectCustomUISuite, 1, PF_, custom_ui_suite1P, kPFEffectCustomUISuite, kPFEffectCustomUISuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectCustomUISuite, 2, PF_, custom_ui_suite2P, kPFEffectCustomUISuite, kPFEffectCustomUISuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectCustomUIOverlayThemeSuite, 1, PF_, custom_ui_theme_suite1P, kPFEffectCustomUIOverlayThemeSuite, kPFEffectCustomUIOverlayThemeSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(DrawbotSuite, Current, DRAWBOT_, drawing_suite_currentP, kDRAWBOT_DrawSuite, kDRAWBOT_DrawSuite_VersionCurrent); + AEGP_SUITE_ACCESS_BOILERPLATE(SupplierSuite, Current, DRAWBOT_, drawbot_supplier_suite_currentP, kDRAWBOT_SupplierSuite, kDRAWBOT_SupplierSuite_VersionCurrent); + AEGP_SUITE_ACCESS_BOILERPLATE(SurfaceSuite, Current, DRAWBOT_, drawbot_surface_suite_currentP, kDRAWBOT_SurfaceSuite, kDRAWBOT_SurfaceSuite_VersionCurrent); + AEGP_SUITE_ACCESS_BOILERPLATE(PathSuite, Current, DRAWBOT_, drawbot_path_suite_currentP, kDRAWBOT_PathSuite, kDRAWBOT_PathSuite_VersionCurrent); + + AEGP_SUITE_ACCESS_BOILERPLATE(SuitesSuite, , SP, suites_suite_2P, kSPSuitesSuite, kSPSuitesSuiteVersion); +}; + +#endif diff --git a/External/AE SDK/Headers/AEGP_Utils.cpp b/External/AE SDK/Headers/AEGP_Utils.cpp new file mode 100644 index 00000000..8b598074 --- /dev/null +++ b/External/AE SDK/Headers/AEGP_Utils.cpp @@ -0,0 +1,37 @@ +#include "AEGP_Utils.h" + + +A_Err GetNewFirstLayerInFirstComp( + SPBasicSuite *sP, + AEGP_LayerH *first_layerPH) +{ + A_Err err = A_Err_NONE; + + AEGP_ItemH itemH = NULL; + AEGP_ItemType type = AEGP_ItemType_NONE; + AEGP_CompH compH = NULL; + AEGP_ProjectH projH = NULL; + A_long num_projectsL = 0, + num_layersL = 0; + + AEGP_SuiteHandler suites(sP); + + ERR(suites.ProjSuite5()->AEGP_GetProjectByIndex(0, &projH)); + ERR(suites.ItemSuite8()->AEGP_GetFirstProjItem(projH, &itemH)); + ERR(suites.ItemSuite6()->AEGP_GetItemType(itemH, &type)); + + while ((itemH != NULL) && (type != AEGP_ItemType_COMP)){ + ERR(suites.ItemSuite6()->AEGP_GetNextProjItem(projH, itemH, &itemH)); + ERR(suites.ItemSuite6()->AEGP_GetItemType(itemH, &type)); + } + if (!err && (type == AEGP_ItemType_COMP)){ + err = suites.CompSuite4()->AEGP_GetCompFromItem(itemH, &compH); + } + if (!err && compH) { + err = suites.LayerSuite5()->AEGP_GetCompNumLayers(compH, &num_layersL); + } + if (!err && num_layersL){ + err = suites.LayerSuite5()->AEGP_GetCompLayerByIndex(compH, 0, first_layerPH); + } + return err; +} \ No newline at end of file diff --git a/External/AE SDK/Headers/AEGP_Utils.h b/External/AE SDK/Headers/AEGP_Utils.h new file mode 100644 index 00000000..a2f2b06f --- /dev/null +++ b/External/AE SDK/Headers/AEGP_Utils.h @@ -0,0 +1,9 @@ +#include "A.h" +#include "AE_GeneralPlug.h" +#include "AEGP_SuiteHandler.h" +#include "AE_Macros.h" + +A_Err GetNewFirstLayerInFirstComp( + SPBasicSuite *sP, + AEGP_LayerH *first_layerPH); + diff --git a/External/AE SDK/Headers/AE_AdvEffectSuites.h b/External/AE SDK/Headers/AE_AdvEffectSuites.h new file mode 100644 index 00000000..5ea6901d --- /dev/null +++ b/External/AE SDK/Headers/AE_AdvEffectSuites.h @@ -0,0 +1,343 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef _H_AE_AdvEffectSuites +#define _H_AE_AdvEffectSuites + +#include +#include +#include + +#include + +#ifdef __cplusplus + extern "C" { +#endif + + +#define kPFAdvAppSuite "PF AE Adv App Suite" +#define kPFAdvAppSuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_AdvAppSuite1 { + + SPAPI PF_Err (*PF_SetProjectDirty)(void); + + SPAPI PF_Err (*PF_SaveProject)(void); + + SPAPI PF_Err (*PF_SaveBackgroundState)(void); + + SPAPI PF_Err (*PF_ForceForeground)(void); + + SPAPI PF_Err (*PF_RestoreBackgroundState)(void); + + SPAPI PF_Err (*PF_RefreshAllWindows)(void); + + // 2 lines of text, same as calling PF_InfoDrawText3( line1Z0, line2Z0, NULL) + SPAPI PF_Err (*PF_InfoDrawText)( + const A_char *line1Z0, + const A_char *line2Z0); + + SPAPI PF_Err (*PF_InfoDrawColor)( + PF_Pixel color); + + // 3 lines of text + SPAPI PF_Err (*PF_InfoDrawText3)( + const A_char *line1Z0, + const A_char *line2Z0, + const A_char *line3Z0); + + // 3 lines, with two lines including formatting for right and left justification + SPAPI PF_Err (*PF_InfoDrawText3Plus)( + const A_char *line1Z0, + const A_char *line2_jrZ0, + const A_char *line2_jlZ0, + const A_char *line3_jrZ0, + const A_char *line3_jlZ0); + +} PF_AdvAppSuite1; + + + + + +#define kPFAdvAppSuiteVersion2 2/* to be frozen in AE 6.0 */ + +typedef struct PF_AdvAppSuite2 { + + SPAPI PF_Err (*PF_SetProjectDirty)(void); + + SPAPI PF_Err (*PF_SaveProject)(void); + + SPAPI PF_Err (*PF_SaveBackgroundState)(void); + + SPAPI PF_Err (*PF_ForceForeground)(void); + + SPAPI PF_Err (*PF_RestoreBackgroundState)(void); + + SPAPI PF_Err (*PF_RefreshAllWindows)(void); + + // 2 lines of text, same as calling PF_InfoDrawText3( line1Z0, line2Z0, NULL) + SPAPI PF_Err (*PF_InfoDrawText)( + const A_char *line1Z0, + const A_char *line2Z0); + + SPAPI PF_Err (*PF_InfoDrawColor)( + PF_Pixel color); + + // 3 lines of text + SPAPI PF_Err (*PF_InfoDrawText3)( + const A_char *line1Z0, + const A_char *line2Z0, + const A_char *line3Z0); + + // 3 lines, with two lines including formatting for right and left justification + SPAPI PF_Err (*PF_InfoDrawText3Plus)( + const A_char *line1Z0, + const A_char *line2_jrZ0, + const A_char *line2_jlZ0, + const A_char *line3_jrZ0, + const A_char *line3_jlZ0); + + // append a line of text to top line for so many ticks + SPAPI PF_Err (*PF_AppendInfoText)( + const A_char *appendZ0); + + +} PF_AdvAppSuite2; + + + +#define PF_MAX_TIME_LEN 31 + +enum { + PF_Step_FORWARD, + PF_Step_BACKWARD +}; +typedef A_LegacyEnumType PF_Step; + +enum { + PF_TimeDisplayFormatTimecode, + PF_TimeDisplayFormatFrames, + PF_TimeDisplayFormatFeetFrames // OBSOLETE: returned only by kPFAdvTimeSuiteVersion1 +}; + +typedef struct { + A_char display_mode; + A_long framemax; + A_long frames_per_foot; + A_char frames_start; + A_Boolean nondrop30B; + A_Boolean honor_source_timecodeB; + A_Boolean use_feet_framesB; +} PF_TimeDisplayPrefVersion3; + + + +#define kPFAdvTimeSuite "PF AE Adv Time Suite" +#define kPFAdvTimeSuiteVersion4 4 //frozen for ae15.0 + +typedef struct PF_AdvTimeSuite4 { + + SPAPI PF_Err (*PF_FormatTimeActiveItem)( A_long time_valueUL, // time is value/scale in seconds + A_u_long time_scaleL, + PF_Boolean durationB, // is the time value a duration or time? + A_char *time_buf); // allocate as PF_MAX_TIME_LEN + 1 + + SPAPI PF_Err (*PF_FormatTime)( PF_InData *in_data, + PF_EffectWorld *world, + A_long time_valueUL, + A_u_long time_scaleL, + PF_Boolean durationB, + A_char *time_buf); + + SPAPI PF_Err (*PF_FormatTimePlus)( PF_InData *in_data, + PF_EffectWorld *world, + A_long time_valueUL, + A_u_long time_scaleL, + PF_Boolean comp_timeB, + PF_Boolean durationB, + A_char *time_buf); + + SPAPI PF_Err (*PF_GetTimeDisplayPref)( PF_TimeDisplayPrefVersion3 *tdp, + A_long *starting_frame_num); + + SPAPI PF_Err (*PF_TimeCountFrames)( const A_Time* start_timeTP, + const A_Time* time_stepTP, + A_Boolean include_partial_frameB, + A_long* frame_countL); + +} PF_AdvTimeSuite4; + + +#define kPFAdvTimeSuite "PF AE Adv Time Suite" +#define kPFAdvTimeSuiteVersion3 3 //frozen for ae14.2 + +typedef struct PF_AdvTimeSuite3 { + + SPAPI PF_Err (*PF_FormatTimeActiveItem)( A_long time_valueUL, // time is value/scale in seconds + A_u_long time_scaleL, + PF_Boolean durationB, // is the time value a duration or time? + A_char *time_buf); // allocate as PF_MAX_TIME_LEN + 1 + + SPAPI PF_Err (*PF_FormatTime)( PF_InData *in_data, + PF_EffectWorld *world, + A_long time_valueUL, + A_u_long time_scaleL, + PF_Boolean durationB, + A_char *time_buf); + + SPAPI PF_Err (*PF_FormatTimePlus)( PF_InData *in_data, + PF_EffectWorld *world, + A_long time_valueUL, + A_u_long time_scaleL, + PF_Boolean comp_timeB, + PF_Boolean durationB, + A_char *time_buf); + + SPAPI PF_Err (*PF_GetTimeDisplayPref)( PF_TimeDisplayPrefVersion3 *tdp, + A_long *starting_frame_num); + +} PF_AdvTimeSuite3; + + +#define kPFAdvTimeSuiteVersion2 2 + +typedef struct { + A_char display_mode; + A_char framemax; + A_char frames_per_foot; + A_char frames_start; + A_Boolean nondrop30B; + A_Boolean honor_source_timecodeB; + A_Boolean use_feet_framesB; +} PF_TimeDisplayPrefVersion2; + +typedef struct PF_AdvTimeSuite2 { + + SPAPI PF_Err (*PF_FormatTimeActiveItem)( A_long time_valueUL, // time is value/scale in seconds + A_u_long time_scaleL, + PF_Boolean durationB, // is the time value a duration or time? + A_char *time_buf); // allocate as PF_MAX_TIME_LEN + 1 + + SPAPI PF_Err (*PF_FormatTime)( PF_InData *in_data, + PF_EffectWorld *world, + A_long time_valueUL, + A_u_long time_scaleL, + PF_Boolean durationB, + A_char *time_buf); + + SPAPI PF_Err (*PF_FormatTimePlus)( PF_InData *in_data, + PF_EffectWorld *world, + A_long time_valueUL, + A_u_long time_scaleL, + PF_Boolean comp_timeB, + PF_Boolean durationB, + A_char *time_buf); + + + SPAPI PF_Err (*PF_GetTimeDisplayPref)( PF_TimeDisplayPrefVersion2 *tdp, + A_long *starting_frame_num); + + + +} PF_AdvTimeSuite2; + + + +#define kPFAdvTimeSuiteVersion1 1 /* frozen in AE 5.0 */ + +typedef struct { + A_char time_display_format; + A_char framemax; + A_char nondrop30; + A_char frames_per_foot; +} PF_TimeDisplayPref; + +typedef struct PF_AdvTimeSuite1 { + + SPAPI PF_Err (*PF_FormatTimeActiveItem)( A_long time_valueUL, // time is value/scale in seconds + A_u_long time_scaleL, + PF_Boolean durationB, // is the time value a duration or time? + A_char *time_buf); // allocate as PF_MAX_TIME_LEN + 1 + + SPAPI PF_Err (*PF_FormatTime)( PF_InData *in_data, + PF_EffectWorld *world, + A_long time_valueUL, + A_u_long time_scaleL, + PF_Boolean durationB, + A_char *time_buf); + + SPAPI PF_Err (*PF_FormatTimePlus)( PF_InData *in_data, + PF_EffectWorld *world, + A_long time_valueUL, + A_u_long time_scaleL, + PF_Boolean comp_timeB, + PF_Boolean durationB, + A_char *time_buf); + + + SPAPI PF_Err (*PF_GetTimeDisplayPref)( PF_TimeDisplayPref *tdp, + A_long *starting_frame_num); + +} PF_AdvTimeSuite1; + + + +#define kPFAdvItemSuite "PF AE Adv Item Suite" +#define kPFAdvItemSuiteVersion1 1 /* frozen in AE 5.0 */ + + + +typedef struct PF_AdvItemSuite1 { + + SPAPI PF_Err (*PF_MoveTimeStep)( PF_InData *in_data, + PF_EffectWorld *world, + PF_Step time_dir, + A_long num_stepsL); + + SPAPI PF_Err (*PF_MoveTimeStepActiveItem) ( PF_Step time_dir, + A_long num_stepsL); + + + SPAPI PF_Err (*PF_TouchActiveItem) (void); + + + SPAPI PF_Err (*PF_ForceRerender)( PF_InData *in_data, + PF_EffectWorld *world); + + + SPAPI PF_Err (*PF_EffectIsActiveOrEnabled)( PF_ContextH contextH, + PF_Boolean *enabledPB); + + +} PF_AdvItemSuite1; + + + +#ifdef __cplusplus +} +#endif + +#include + + +#endif diff --git a/External/AE SDK/Headers/AE_CacheOnLoadSuite.h b/External/AE SDK/Headers/AE_CacheOnLoadSuite.h new file mode 100644 index 00000000..3572ce71 --- /dev/null +++ b/External/AE SDK/Headers/AE_CacheOnLoadSuite.h @@ -0,0 +1,39 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2003 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef AECACHEONLOADSUITE +#define AECACHEONLOADSUITE + +/** +** CacheOnLoadSuite, used to signal whether or not the plugin needs to load from +** disk every time on startup. +*/ +#define kPFCacheOnLoadSuite "PF Cache On Load Suite" +#define kPFCacheOnLoadSuiteVersion1 1 + +typedef struct PF_CacheOnLoadSuite1 { + + SPAPI PF_Err (*PF_SetNoCacheOnLoad)( PF_ProgPtr effect_ref, + long effectAvailable); + +} PF_CacheOnLoadSuite1; + +#endif // AECACHEONLOADSUITE \ No newline at end of file diff --git a/External/AE SDK/Headers/AE_ChannelSuites.h b/External/AE SDK/Headers/AE_ChannelSuites.h new file mode 100644 index 00000000..3ce87f56 --- /dev/null +++ b/External/AE SDK/Headers/AE_ChannelSuites.h @@ -0,0 +1,509 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + +#ifndef _H_AE_ChannelSuites +#define _H_AE_ChannelSuites + +#include +#include + +#include + + +#ifdef __cplusplus + extern "C" { +#endif + + +/** PF_ChannelSuite + + PF_GetLayerChannelCount + use this to find the number of channels associated with a given source layer + Most likely use is to get number of channels for iteration purposes. + + -param_index is the parameter index of the layer whose source you wish to interrogate + -num_paramsL is the number of "auxillary" channels + + + PF_GetLayerIndexedChannelRefAndDesc + Given a channel index return the opaque channelRef and a channel description + channel index must lie between 0 and num_channels-1 + you will use the channelRef in all subsequent calls + + PF_GetLayerTypedChannelRefAndDesc + Given a type retrieve the channelRef and ChannelDescription + + PF_CheckoutLayerChannel + given the time parameters and a channel reference, get the data + The data chunk is allocated is of the type requested. + The data is in chunky format. + + + + PF_ProgPtr effect_ref, >> + PF_ChannelRefPtr channel_refP, >> + A_long what_time, >> + A_long duration, >> + A_u_long time_scale, >> + PF_DataType data_type, >> + PF_ChannelData *channel_chunkP) <<------ + + PF_CheckinLayerChannel + The checked out channel must be checked in to avoid memory leaks. + PF_ProgPtr effect_ref, + PF_ChannelRefPtr channel_refP, + PF_ChannelDataPtr channel_data_chunkP + +**/ + +#define PF_CHANNEL_DEPTH_INFINITY 1e7 + +#define kPFChannelSuite1 "PF AE Channel Suite" +#define kPFChannelSuiteVersion1 1 /* frozen in AE 5.0 */ + + + + +/** + ** channel data access macros with a check for the type + **/ + +#define PF_GET_CHANNEL_FLOAT_DATA( CHUNK, FLOAT_PTR) \ + do { \ + if ( (CHUNK).data_type == PF_DataType_FLOAT) { \ + FLOAT_PTR = (A_FpShort *) (CHUNK).dataPV; \ + } else { \ + FLOAT_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_DOUBLE_DATA( CHUNK, DOUBLE_PTR) \ + do { \ + if ((CHUNK).data_type == PF_DataType_DOUBLE) { \ + DOUBLE_PTR = (A_FpLong *) (CHUNK).dataPV; \ + } else { \ + DOUBLE_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_LONG_DATA( CHUNK, LONG_PTR) \ + do { \ + if ((CHUNK).data_type == PF_DataType_LONG) { \ + LONG_PTR = (A_long *) (CHUNK).dataPV; \ + } else { \ + LONG_PTR = NULL; \ + } \ + } while(0) + + + +#define PF_GET_CHANNEL_SHORT_DATA( CHUNK, SHORT_PTR) \ + do { \ + if ((CHUNK).data_type == PF_DataType_SHORT) { \ + SHORT_PTR = (A_short *) (CHUNK).dataPV; \ + } else { \ + SHORT_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_FIXED_DATA( CHUNK, FIXED_PTR) \ + do { \ + if ((CHUNK).data_type == PF_DataType_FIXED_16_16) { \ + FIXED_PTR = (A_long *) (CHUNK).dataPV; \ + } else { \ + FIXED_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_CHAR_DATA( CHUNK, CHAR_PTR) \ + do { \ + if ((CHUNK).data_type == PF_DataType_CHAR) { \ + CHAR_PTR = (A_char *) (CHUNK).dataPV; \ + } else { \ + CHAR_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_U_BYTE_DATA( CHUNK, BYTE_PTR) \ + do { \ + if ((CHUNK).data_type == PF_DataType_U_BYTE) { \ + BYTE_PTR = (A_u_char *) (CHUNK).dataPV; \ + } else { \ + BYTE_PTR = NULL; \ + } \ + } while(0) + + + + + +#define PF_GET_CHANNEL_U_SHORT_DATA( CHUNK, U_SHORT_PTR) \ + do { \ + if ((CHUNK).data_type == PF_DataType_U_SHORT) { \ + U_SHORT_PTR = (A_u_short *) (CHUNK).dataPV;\ + } else { \ + U_SHORT_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_U_FIXED_DATA( CHUNK, U_FIXED_PTR) \ + do { \ + if ((CHUNK).data_type == PF_DataType_U_FIXED_16_16) { \ + U_FIXED_PTR = (A_u_long) (CHUNK).dataPV; \ + } else { \ + U_FIXED_PTR = NULL; \ + } \ + } while(0) + + + + +/** + ** get a row of the chunk data + **/ +#define PF_GET_CHANNEL_ROW_FLOAT_DATA( CHUNK, ROW, FLOAT_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_FLOAT) && ((ROW) < (CHUNK).heightL)) { \ + FLOAT_PTR = (A_FpShort *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + FLOAT_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_ROW_DOUBLE_DATA( CHUNK, ROW, DOUBLE_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_DOUBLE) && ((ROW) < (CHUNK).heightL)) { \ + DOUBLE_PTR = (A_FpLong *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + DOUBLE_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_ROW_LONG_DATA( CHUNK, ROW, LONG_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_LONG) && ((ROW) < (CHUNK).heightL)) { \ + LONG_PTR = (A_long *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + LONG_PTR = NULL; \ + } \ + } while(0) + + + +#define PF_GET_CHANNEL_ROW_SHORT_DATA( CHUNK, ROW, SHORT_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_SHORT) && ((ROW) < (CHUNK).heightL)) { \ + SHORT_PTR = (A_short *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + SHORT_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_ROW_FIXED_DATA( CHUNK, ROW, FIXED_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_FIXED_16_16) && ((ROW) < (CHUNK).heightL)) { \ + FIXED_PTR = (A_long *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + FIXED_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_ROW_CHAR_DATA( CHUNK, ROW, CHAR_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_CHAR) && ((ROW) < (CHUNK).heightL)) { \ + CHAR_PTR = (A_char *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + CHAR_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_ROW_U_BYTE_DATA( CHUNK, ROW, BYTE_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_U_BYTE) && ((ROW) < (CHUNK).heightL)) { \ + BYTE_PTR = (A_u_char *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + BYTE_PTR = NULL; \ + } \ + } while(0) + + + + + +#define PF_GET_CHANNEL_ROW_U_SHORT_DATA( CHUNK, ROW, U_SHORT_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_U_SHORT) && ((ROW) < (CHUNK).heightL)) { \ + U_SHORT_PTR = (A_u_short *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + U_SHORT_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_ROW_U_FIXED_DATA( CHUNK, ROW, U_FIXED_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_U_FIXED_16_16) && ((ROW) < (CHUNK).heightL)) { \ + U_FIXED_PTR = (A_u_long) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + } else { \ + U_FIXED_PTR = NULL; \ + } \ + } while(0) + + + + + + +/** + ** get a item from the chunk data + **/ +#define PF_GET_CHANNEL_ROW_COL_FLOAT_DATA( CHUNK, ROW, COL, FLOAT_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_FLOAT) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + FLOAT_PTR = (A_FpShort *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + FLOAT_PTR = (A_FpShort *)FLOAT_PTR + (COL) * (CHUNK).dimensionL; \ + } else { \ + FLOAT_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_ROW_COL_DOUBLE_DATA( CHUNK, ROW, COL, DOUBLE_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_DOUBLE) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + DOUBLE_PTR = (A_FpLong *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + DOUBLE_PTR = (A_FpLong *)DOUBLE_PTR + (COL) * (CHUNK).dimensionL; \ + } else { \ + DOUBLE_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_ROW_COL_LONG_DATA( CHUNK, ROW, COL, LONG_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_LONG) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + LONG_PTR = (A_long *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + LONG_PTR = (A_long *) LONG_PTR + (COL) * (CHUNK).dimensionL; \ + } else { \ + LONG_PTR = NULL; \ + } \ + } while(0) + + + +#define PF_GET_CHANNEL_ROW_COL_SHORT_DATA( CHUNK, ROW, COL, SHORT_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_SHORT) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + SHORT_PTR = (A_short *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + SHORT_PTR = (A_short *) SHORT_PTR + (COL) * (CHUNK).dimensionL;\ + } else { \ + SHORT_PTR = NULL; \ + } \ + } while(0) + + +#define PF_GET_CHANNEL_ROW_COL_FIXED_DATA( CHUNK, ROW, COL, FIXED_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_FIXED_16_16) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + FIXED_PTR = (A_long *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + FIXED_PTR = (A_long *) FIXED_PTR + (COL) * (CHUNK).dimensionL; \ + } else { \ + FIXED_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_ROW_COL_CHAR_DATA( CHUNK, ROW, COL, CHAR_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_CHAR) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + CHAR_PTR = (A_char *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + CHAR_PTR = (A_char *) CHAR_PTR + (COL) * (CHUNK).dimensionL; \ + } else { \ + CHAR_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_ROW_COL_U_BYTE_DATA( CHUNK, ROW, COL, BYTE_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_U_BYTE) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + BYTE_PTR = (A_u_char *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + BYTE_PTR = (A_u_char *) BYTE_PTR + (COL) * (CHUNK).dimensionL; \ + } else { \ + BYTE_PTR = NULL; \ + } \ + } while(0) + + + + + +#define PF_GET_CHANNEL_ROW_COL_U_SHORT_DATA( CHUNK, ROW, COL, U_SHORT_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_U_SHORT) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + U_SHORT_PTR = (A_u_short *) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + U_SHORT_PTR = (A_u_short *) U_SHORT_PTR + (COL) * (CHUNK).dimensionL; \ + } else { \ + U_SHORT_PTR = NULL; \ + } \ + } while(0) + + + + +#define PF_GET_CHANNEL_ROW_COL_U_FIXED_DATA( CHUNK, ROW, COL, U_FIXED_PTR) \ + do { \ + if (((CHUNK).data_type == PF_DataType_U_FIXED_16_16) && \ + ((ROW) >= 0) && \ + ((COL) >= 0) && \ + ((ROW) < (CHUNK).heightL) && \ + ((COL) < (CHUNK).widthL)) { \ + U_FIXED_PTR = (A_u_long) ((A_char *)(CHUNK).dataPV + (ROW) * (CHUNK).row_bytesL); \ + U_FIXED_PTR = (A_u_long) U_FIXED_PTR + (COL) * (CHUNK).dimensionL; \ + } else { \ + U_FIXED_PTR = NULL; \ + } \ + } while(0) + + + + + + +/** + ** the suite functions + **/ + +typedef struct PF_ChannelSuite1 { /* frozen in AE 5.0 */ + + SPAPI PF_Err (*PF_GetLayerChannelCount)( + PF_ProgPtr effect_ref, /* >> */ + PF_ParamIndex param_index, /* >> */ + A_long *num_channelsPL); /* << */ + + SPAPI PF_Err (*PF_GetLayerChannelIndexedRefAndDesc)( + PF_ProgPtr effect_ref, /* >> */ + PF_ParamIndex param_index, /* >> */ + PF_ChannelIndex channel_index, /* >> */ + PF_Boolean *foundPB, /* << */ + PF_ChannelRef *channel_refP, /* << */ + PF_ChannelDesc *channel_descP); /* << */ + + + SPAPI PF_Err (*PF_GetLayerChannelTypedRefAndDesc)( + PF_ProgPtr effect_ref, /* >> */ + PF_ParamIndex param_index, /* >> */ + PF_ChannelType channel_type, /* >> */ + PF_Boolean *foundPB, /* << */ + PF_ChannelRef *channel_refP, /* << */ + PF_ChannelDesc *channel_descP); /* << */ + + SPAPI PF_Err (*PF_CheckoutLayerChannel)( + PF_ProgPtr effect_ref, /* >> */ + PF_ChannelRefPtr channel_refP, /* >> */ + A_long what_time, /* >> */ + A_long duration, /* >> */ + A_u_long time_scale, /* >> */ + PF_DataType data_type, /* << */ + PF_ChannelChunk *channel_chunkP); /* << */ + + + SPAPI PF_Err (*PF_CheckinLayerChannel)( + PF_ProgPtr effect_ref, /* >> */ + PF_ChannelRefPtr channel_refP, /* >> */ + PF_ChannelChunk *channel_chunkP); /* << */ + + +} PF_ChannelSuite1; + + + + + +#ifdef __cplusplus + } // end extern "C" +#endif + + +#include + + +#endif diff --git a/External/AE SDK/Headers/AE_ComputeCacheSuite.h b/External/AE SDK/Headers/AE_ComputeCacheSuite.h new file mode 100644 index 00000000..e11481d5 --- /dev/null +++ b/External/AE SDK/Headers/AE_ComputeCacheSuite.h @@ -0,0 +1,175 @@ +/******************************************************************** +* ADOBE CONFIDENTIAL +* __________________ +* +* Copyright 2020 Adobe Inc. +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains +* the property of Adobe and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe +* and its suppliers and are protected by all applicable intellectual +* property laws, including trade secret and copyright laws. +* Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained +* from Adobe. +********************************************************************/ + +#ifndef _H_AE_ComputeCacheSuite +#define _H_AE_ComputeCacheSuite + +#include +#include + +#ifdef AEGP_INTERNAL + #include +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +///////////////////////////////////// MC Compute -- plugin registration of cached computations + +// Globally unique identifier for the compute class, such as "adobe.ae.effect.test_effect.cache_v_1" +typedef const char *AEGP_CCComputeClassIdP; + +typedef void *AEGP_CCComputeOptionsRefconP; // opaque content provided by plugin for generating key and value. Input to the compute. +typedef void *AEGP_CCComputeValueRefconP; // opaque compute result from the plugin + + +// GUID used as the cache key. +typedef struct AEGP_GUID { + A_long bytes[4]; +} AEGP_GUID; + +typedef AEGP_GUID AEGP_CCComputeKey; +typedef AEGP_CCComputeKey *AEGP_CCComputeKeyP; + +typedef void *AEGP_CCCheckoutReceiptP; + +// +// The effect supplies implementations of these callbacks. +// +typedef struct AEGP_ComputeCacheCallbacks { + // Cache key. Called when creating a cache entry and when doing a cache lookup. Should be fast to compute. All of the inputs + // needed to uniquely address the cache entry must be hashed into the key. If a layer checkout is needed to calculate the cache + // value, such as with a histogram, then the hash of that input must be included. See PF_ParamUtilsSuite::PF_GetCurrentState + // to get the hash for a layer param. Note this is the hash of the inputs needed to generate the frame, not a hash the pixels + // in the frame, thus a render is not triggered when making this call. + A_Err (*generate_key)( + AEGP_CCComputeOptionsRefconP optionsP, + AEGP_CCComputeKeyP out_keyP); + + // The expensive call. Generate the cache data from the input parameters. + A_Err (*compute)( + AEGP_CCComputeOptionsRefconP optionsP, + AEGP_CCComputeValueRefconP *out_valuePP); + + // The computed value may not be a flat data structure. This should return the total memory footprint. The size is an input + // to the cache purging heuristic. + size_t (*approx_size_value)( + AEGP_CCComputeValueRefconP valueP); + + // The computed value lives in the cache. This is called to free the value when the cached is to be purged. All resources + // owned by the cache value must be freed here. + void (*delete_compute_value)( + AEGP_CCComputeValueRefconP valueP); +} AEGP_ComputeCacheCallbacks; + + + +#define kAEGPComputeCacheSuite "AEGP Compute Cache" +#define kAEGPComputeCacheSuiteVersion1 1 /* frozen in AE 18.2 */ + +typedef struct AEGP_ComputeCacheSuite1 { + + // Register a cache type. + SPAPI A_Err (*AEGP_ClassRegister)( + AEGP_CCComputeClassIdP compute_classP, + const AEGP_ComputeCacheCallbacks *callbacksP); + + // Unregister a cache type. Note that all cached values will be purged at this time since the delete_compute_value callback + // is how cache entries are deleted, and delete_compute_value is not available after unregister. + SPAPI A_Err (*AEGP_ClassUnregister)( + AEGP_CCComputeClassIdP compute_classP); + + + // This is the main checkout call. + // + // When adding cache support one of the first questions to answer is if a single render call needs to checkout more than one + // cache value. If more than one cache value is needed then the multi-checkout pattern, below, can be applied to concurrently + // calculate the caches across multiple render calls and thus avoid serialization of the compute. + // + // SINGLE CACHE VALUE + // If a render call only needs one cache value then set wait_for_other_threadB to true. The checkout call will return a receipt, + // possibly calling the compute callback to populate the cache; or waiting on another thread that had already started the + // needed computation. + // + // MULTI-CHECKOUT + // If a render call needs multiple cache values then this pattern can be used to keep the render threads utilized and thus + // avoid serializing the compute. + // Render() + // { + // bool first_err = AEGP_ComputeIfNeededAndCheckout(first_options, do_not_wait); + // bool second_err = AEGP_ComputeIfNeededAndCheckout(second_options, do_not_wait); + // // Add as many additional do_not_wait checkout calls here as needed. + // + // if(first_err == A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING) { + // AEGP_ComputeIfNeededAndCheckout(wait); + // } + // if(second_err == A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING) { + // AEGP_ComputeIfNeededAndCheckout(wait); + // } + // // Add as many additional waiting checkout calls here as needed + // } + // + // wait_for_other_threadB + // CACHE STATE || FALSE TRUE | + // ================++========================+========================+ + // No cache || Compute and checkout | Compute and checkout | + // ----------------++------------------------+------------------------+ + // Being computed || Return error, see | Wait for the other | + // by another thread || below. | thread and checkout | + // ----------------++------------------------+------------------------+ + // Cached || Checkout | Checkout | + // ----------------++------------------------+------------------------+ + // + // Returns A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING if wait_for_other_threadB is false and another thread is currently computing + // the cache value. Note that the host will not notify the user of this error; it will be silent to the user. + // + // Must call AEGP_CheckinComputeReceipt on success. Check-in must be done before returning to the host. + SPAPI A_Err (*AEGP_ComputeIfNeededAndCheckout)( + AEGP_CCComputeClassIdP compute_classP, + AEGP_CCComputeOptionsRefconP opaque_optionsP, + bool wait_for_other_threadB, + AEGP_CCCheckoutReceiptP *compute_receiptPP); + + // This call does a cache check, and thus should return always quickly. It does not do compute nor does it wait for another + // thread that is populating the cache. + // This call could be used to implement a polling pattern where another piece of code is expected to populate the cache. For + // example, a UI thread could poll the cache regularly for a histogram that is generated on a render thread. + // + // Either returns cache value or A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING if cache miss. + // Must call AEGP_CheckinComputeReceipt on success. Check-in must be done before returning to the host. + SPAPI A_Err (*AEGP_CheckoutCached)( + AEGP_CCComputeClassIdP compute_classP, + AEGP_CCComputeOptionsRefconP opaque_optionsP, + AEGP_CCCheckoutReceiptP *compute_receiptPP); + + // Get the cache value from a checkout receipt. + SPAPI A_Err (*AEGP_GetReceiptComputeValue)( + const AEGP_CCCheckoutReceiptP compute_receiptP, + AEGP_CCComputeValueRefconP *compute_valuePP); + + // Check-in a receipt. + SPAPI A_Err (*AEGP_CheckinComputeReceipt)( + AEGP_CCCheckoutReceiptP compute_receiptP ); + +} AEGP_ComputeCacheSuite1; + +#ifdef __cplusplus + } // end extern "C" +#endif + +#endif diff --git a/External/AE SDK/Headers/AE_CreatorInfo.h b/External/AE SDK/Headers/AE_CreatorInfo.h new file mode 100644 index 00000000..2867c1a0 --- /dev/null +++ b/External/AE SDK/Headers/AE_CreatorInfo.h @@ -0,0 +1 @@ +/*******************************************************************/ /* */ /* ADOBE CONFIDENTIAL */ /* _ _ _ _ _ _ _ _ _ _ _ _ _ */ /* */ /* Copyright 2007 Adobe Systems Incorporated */ /* All Rights Reserved. */ /* */ /* NOTICE: All information contained herein is, and remains the */ /* property of Adobe Systems Incorporated and its suppliers, if */ /* any. The intellectual and technical concepts contained */ /* herein are proprietary to Adobe Systems Incorporated and its */ /* suppliers and may be covered by U.S. and Foreign Patents, */ /* patents in process, and are protected by trade secret or */ /* copyright law. Dissemination of this information or */ /* reproduction of this material is strictly forbidden unless */ /* prior written permission is obtained from Adobe Systems */ /* Incorporated. */ /* */ /*******************************************************************/ /* If you'd like After Effects to open files created by your application IN your application, embed this structure in that file. Data must be in Motorola byte order. Your application must then respond to the appleEvent (mac) or the command line flags (win) that are specified in the structure. */ #define ADBE_CREATOR_ATOM_TYPE 'Cr8r' #define CR8R_MAGIC 0xBEEFCAFE #define ADBE_CREATOR_ATOM_VERS_MAJOR 1 #define ADBE_CREATOR_ATOM_VERS_MINOR 0 typedef struct adbe_creator_atom { unsigned long magicLu; // set to CR8R_MAGIC long atom_sizeL; // size of this structure (sizeof(CR8R_CreatorAtom)) short atom_vers_majorS; // set to ADBE_CREATOR_ATOM_VERS_MAJOR short atom_vers_minorS; // set to ADBE_CREATOR_ATOM_VERS_MINOR // mac unsigned long creator_codeLu; // application code on MacOS unsigned long creator_eventLu; // invocation appleEvent // windows char creator_extAC[16]; // extension allowing registry search to app char creator_flagAC[16]; // flag passed to app at invocation time char creator_nameAC[32]; // name of the creator application } CR8R_CreatorAtom, **CR8R_CreatorAtomHandle; \ No newline at end of file diff --git a/External/AE SDK/Headers/AE_Effect.h b/External/AE SDK/Headers/AE_Effect.h new file mode 100644 index 00000000..bb1107b2 --- /dev/null +++ b/External/AE SDK/Headers/AE_Effect.h @@ -0,0 +1,3049 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + +/** AE_Effect.h + + Part of the After Effects SDK + + CONTENTS + Version Information + Constants And Enumerations + Output Flags + Input Flags + Command Selectors + Simple Types + Pixel Access Macros + Effect Parameter Description Structures + Interaction Callbacks + Effect Parameter Blocks + Effect Prototype + + NOTES + It may be easiest to start reading this file at the bottom + and work your way, section by section, to the top. Of course, + the best thing to do is start with the sample filter and the + work your way from that back through the goodies in this file. + + All strings in this spec are NULL-terminated (C strings). + +**/ + +// This stuff is a test to make sure that no code is including +// this file with contradictory settings of A_INTERNAL. It must +// come *before* the _H_AE_Effect "include once" test. +// You can define A_SUPPRESS_A_INTERNAL_WARNING if you have a plugin +// that breaks this rule innocently. +#ifdef A_INTERNAL + #define A_INTERNAL_TEST_ONE 1 +#else + #define A_INTERNAL_TEST_TWO 1 +#endif + +#if (A_INTERNAL_TEST_ONE && A_INTERNAL_TEST_TWO) + #ifndef A_SUPPRESS_A_INTERNAL_WARNING + #pragma message("Warning: You have included AE_Effect.h once with A_INTERNAL set and once without.") + #endif +#endif + +// End of A_INTERNAL consistency check. + + +#ifndef _H_AE_Effect +#define _H_AE_Effect + +#ifdef A_INTERNAL + #include "PF_Private.h" +#endif + +#include "A.h" +#if defined(__APPLE__) +#include +#endif +#include + + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef __cplusplus + #if defined(__ANDROID__) + #include + #endif +#endif + +/** -------------------- Version Information ---------------------------------- + ** + ** Please use these macros for designating the version information + ** of your plug-ins. Should After Effects encounter more than one version + ** of a specific plug-in when it starts up, it will use this information + ** to decide which plug-in to honor. The plug-in version information + ** (field 'my_version' in the PF_OutData) should be set at GLOBAL_SETUP + ** time. + ** + ** This version information is meant for your version control, and should + ** not be confused with the min_version and desired_version fields in the + ** PF_OutData structure, which refer to the version of the PF specification. + ** + **/ + +#define PF_Vers_BUILD_BITS 0x1ffL +#define PF_Vers_BUILD_SHIFT 0 +#define PF_Vers_STAGE_BITS 0x3L +#define PF_Vers_STAGE_SHIFT 9 +#define PF_Vers_BUGFIX_BITS 0xfL +#define PF_Vers_BUGFIX_SHIFT 11 +#define PF_Vers_SUBVERS_BITS 0xfL +#define PF_Vers_SUBVERS_SHIFT 15 +#define PF_Vers_VERS_BITS 0x7L // incomplete without high bits, below +#define PF_Vers_VERS_SHIFT 19 +// skipping these bits for similarity to Up_Vers_ARCH_*, currently unused in PF +#define PF_Vers_VERS_HIGH_BITS 0xfL // expand version max from 7 to 127 +#define PF_Vers_VERS_HIGH_SHIFT 26 + +// b/c we are stripping the stand alone vers value for two fields +#define PF_Vers_VERS_LOW_SHIFT 3 +#define PF_Vers_VERS_HIGH(vers) ((vers)>>PF_Vers_VERS_LOW_SHIFT) + +#define PF_VERSION(vers, subvers, bugvers, stage, build) \ + (A_u_long)( \ + ((((A_u_long)PF_Vers_VERS_HIGH(vers)) & PF_Vers_VERS_HIGH_BITS) << PF_Vers_VERS_HIGH_SHIFT) | \ + ((((A_u_long)(vers)) & PF_Vers_VERS_BITS) << PF_Vers_VERS_SHIFT) | \ + ((((A_u_long)(subvers)) & PF_Vers_SUBVERS_BITS)<> PF_Vers_VERS_SHIFT) & PF_Vers_VERS_BITS) + (((vers >> PF_Vers_VERS_HIGH_SHIFT) & PF_Vers_VERS_HIGH_BITS) << PF_Vers_VERS_LOW_SHIFT)) + +#define PF_Version_SUBVERS(vers) \ + ((((A_u_long) vers) >> PF_Vers_SUBVERS_SHIFT) & PF_Vers_SUBVERS_BITS) + +#define PF_Version_BUGFIX(vers) \ + ((((A_u_long) vers) >> PF_Vers_BUGFIX_SHIFT) & PF_Vers_BUGFIX_BITS) + +#define PF_Version_STAGE(vers) \ + ((((A_u_long) vers) >> PF_Vers_STAGE_SHIFT) & PF_Vers_STAGE_BITS) + +#define PF_Version_BUILD(vers) \ + ((((A_u_long) vers) >> PF_Vers_BUILD_SHIFT) & PF_Vers_BUILD_BITS) + + +enum { + PF_Stage_DEVELOP, + PF_Stage_ALPHA, + PF_Stage_BETA, + PF_Stage_RELEASE +}; +typedef A_long PF_Stage; + + + + + + +/** -------------------- Constants And Enumerations -------------------- + + These version numbers refer to the PF_AE_PLUG_IN_VERSION & SUBVERSION of all releases of AE, and, correspondingly, + the API used by each plug-in (i.e. the SDK that the plug-in is compiled against). The plug-in can check this number + (PF_SpecVersion version field in in_data) to see which API the host supports, and the host can check to see what API + the plug-in is expecting (as listed in the plug-in's PiPL). + +**/ + +//CC +#define PF_AE220_PLUG_IN_VERSION 13 // manually set for SDK changes to allow more than 32 max threads for PF_Iterate +#define PF_AE220_PLUG_IN_SUBVERS 27 // manually set for SDK changes to allow more than 32 max threads for PF_Iterate + +#define PF_AE184_PLUG_IN_VERSION 13 // manually set for mid-cycle SDK drop +#define PF_AE184_PLUG_IN_SUBVERS 26 // manually set for mid-cycle SDK drop + +#define PF_AE182_PLUG_IN_VERSION 13 // manually set for mid-cycle SDK drop +#define PF_AE182_PLUG_IN_SUBVERS 25 // manually set for mid-cycle SDK drop + +#define PF_AE180_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE180_PLUG_IN_SUBVERS 24 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE177_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE177_PLUG_IN_SUBVERS 23 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE176_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE176_PLUG_IN_SUBVERS 22 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE175_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE175_PLUG_IN_SUBVERS 21 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE171_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE171_PLUG_IN_SUBVERS 20 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE170_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE170_PLUG_IN_SUBVERS 18 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE161_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE161_PLUG_IN_SUBVERS 17 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE160_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE160_PLUG_IN_SUBVERS 16 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE151_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE151_PLUG_IN_SUBVERS 15 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE150_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE150_PLUG_IN_SUBVERS 15 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE142_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE142_PLUG_IN_SUBVERS 14 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE140_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE140_PLUG_IN_SUBVERS 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE138_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE138_PLUG_IN_SUBVERS 11 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +// AE137 is same plugin version as AE136, below + +#define PF_AE136_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE136_PLUG_IN_SUBVERS 10 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +#define PF_AE135_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_AE135_PLUG_IN_SUBVERS 9 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay + +// AE131 and AE132 are the same plugin version as AE130, below + +#define PF_AE130_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit okay +#define PF_AE130_PLUG_IN_SUBVERS 7 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit okay + +#define PF_AE122_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit okay +#define PF_AE122_PLUG_IN_SUBVERS 6 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit okay + +#define PF_AE121_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit okay +#define PF_AE121_PLUG_IN_SUBVERS 5 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit okay + +#define PF_AE120_PLUG_IN_VERSION 13 +#define PF_AE120_PLUG_IN_SUBVERS 4 + +//CS6.0.1 +//Plugins have to make dummy checkout (hack) to fix W3163764 in CS6. The bug has been fixed in CS6.0.1 so increase SDK minor version +//so that plugins can constrain the hack only for CS6. +#define PF_AE1101_PLUG_IN_VERSION 13 +#define PF_AE1101_PLUG_IN_SUBVERS 3 + +#define PF_AE110_PLUG_IN_VERSION 13 +#define PF_AE110_PLUG_IN_SUBVERS 2 + +#define PF_AE105_PLUG_IN_VERSION 13 +#define PF_AE105_PLUG_IN_SUBVERS 1 + +#define PF_AE100_PLUG_IN_VERSION 13 +#define PF_AE100_PLUG_IN_SUBVERS 0 + +#define PF_AE90_PLUG_IN_VERSION 12 +#define PF_AE90_PLUG_IN_SUBVERS 14 + +#define PF_AE80_PLUG_IN_VERSION 12 +#define PF_AE80_PLUG_IN_SUBVERS 13 + +#define PF_AE70_PLUG_IN_VERSION 12 +#define PF_AE70_PLUG_IN_SUBVERS 12 + +#define PF_AE65_PLUG_IN_VERSION 12 +#define PF_AE65_PLUG_IN_SUBVERS 11 + +#define PF_AE41_PLUG_IN_VERSION 12 +#define PF_AE41_PLUG_IN_SUBVERS 2 + +#define PF_AE40_PLUG_IN_VERSION 12 +#define PF_AE40_PLUG_IN_SUBVERS 1 + +#define PF_AE31_PLUG_IN_VERSION 11 +#define PF_AE31_PLUG_IN_SUBVERS 6 +#define PF_AE31_PLUG_IN_SUBVERS_STRICTIFY 8 + +#define PF_AE_PLUG_IN_VERSION PF_AE220_PLUG_IN_VERSION // manually set for SDK changes to allow more than 32 max threads for PF_Iterate +#define PF_AE_PLUG_IN_SUBVERS PF_AE220_PLUG_IN_SUBVERS // manually set for SDK changes to allow more than 32 max threads for PF_Iterate + +/* Note: AE3.1 will drive any v11.x plugin + AE4.0 will drive any v11.x or v12.x plugin + AE4.1 will drive any v11.x or v12.x plugin, changed current version from 12.1 -> 12.2 + + If you use PF_AE31_PLUG_IN_VERSION, PF_AE31_PLUG_IN_SUBVERS_STRICTIFY + or later (e.g. 11.8 or 12.0) AE4.0 will enforce new stricter rules and + report more plug-in errors. +*/ + + +#define PF_MAX_EFFECT_NAME_LEN 31 +#define PF_MAX_EFFECT_CATEGORY_NAME_LEN 31 +#define PF_MAX_EFFECT_PARAM_NAME_LEN 31 +#define PF_MAX_PARAM_DESCRIPTION_LEN 31 +#define PF_MAX_PARAM_VALUE_LEN 31 +#define PF_MAX_EFFECT_MSG_LEN 255 + +// Through AE6.5, effects could only have this many parameters. Now the number is unlimited. +#define PF_AE65_AND_EARLIER_MAX_NUM_EFFECT_PARAMS 127 + +#define PF_MAX_WORLD_WIDTH 30000 +#define PF_MAX_WORLD_HEIGHT 30000 + +#define PF_FIRST_ERR 512 + + +/* Standard effect categories for After Effects effects modules. + * These need to be set in the PiPL. + */ +#define PF_Category_BLUR_AND_SHARPEN "Blur & Sharpen" +#define PF_Category_CHANNEL "Channel" +#define PF_Category_DISTORT "Distort" +#define PF_Category_IMAGE_CONTROL "Image Control" +#define PF_Category_KEYING "Keying" +#define PF_Category_PERSPECTIVE "Perspective" +#define PF_Category_STYLIZE "Stylize" +#define PF_Category_TEXT "Text" +#define PF_Category_VIDEO "Video" +#define PF_Category_TRANSITION "Transition" +#define PF_Category_AUDIO "Audio" +#define PF_Category_OTHER "Other" + +enum { + PF_Quality_DRAWING_AUDIO = -1, // only used to inform audio plugins that the output + // will be used to draw the waveform; the plugin should + // not perform any filtering operations that may weaken + // the amplitude when rendering at low sampling rates + + PF_Quality_LO = 0, // LO & HI are sent to both audio & visual effects + PF_Quality_HI +}; +typedef A_long PF_Quality; + +enum { + PF_MF_Alpha_PREMUL = 0, + PF_MF_Alpha_STRAIGHT = (1L << 0) +}; +typedef A_long PF_ModeFlags; + +#define PF_ALPHA_PREMUL(F) (((F) & 0x00000001) == 0) +#define PF_ALPHA_STRAIGHT(F) (((F) & 0x00000001)) + +enum { + PF_Field_FRAME = 0L, + PF_Field_UPPER = 1L, + PF_Field_LOWER = 2L +}; +typedef A_long PF_Field; + + + +/* PF_ParamType + */ +enum { + PF_Param_RESERVED = -1, + PF_Param_LAYER = 0, + PF_Param_SLIDER, /* obsolete, use PF_Param_FLOAT_SLIDER */ + PF_Param_FIX_SLIDER,/* obsolete, use PF_Param_FLOAT_SLIDER */ + PF_Param_ANGLE, + PF_Param_CHECKBOX, + PF_Param_COLOR, + PF_Param_POINT, + PF_Param_POPUP, + PF_Param_CUSTOM, /* obsolete */ + PF_Param_NO_DATA, /* used for CustomUI in Effect window controls, with NO data stream */ + PF_Param_FLOAT_SLIDER, + PF_Param_ARBITRARY_DATA, // in AE: must combine with either PF_PUI_TOPIC/PF_PUI_CONTROL or PF_PUI_NO_ECW + // in PPro starting with 8.0: it's OK to set none of those flags, which allows you to + // see the parameter's keyframe track on the right side of Effect Controls + // without creating a custom control + PF_Param_PATH, + PF_Param_GROUP_START, + PF_Param_GROUP_END, + PF_Param_BUTTON, // must combine with PF_ParamFlag_SUPERVISE + PF_Param_RESERVED2, + PF_Param_RESERVED3, + PF_Param_POINT_3D // only supported by AE, not PPro +}; +typedef A_long PF_ParamType; + + +/* PF_ParamFlags + + These flags are passed when adding a param (using PF_ADD_PARAM) to specify + some details about how the param can be used. The flags + are: + + PF_ParamFlag_CANNOT_TIME_VARY + If this is passed, the parameter will not be allowed to vary + over time -- no keyframe controller will appear at the right. + + PF_ParamFlag_CANNOT_INTERP + If this is passed, parameter values are not interpolated + between. You can still use no interp and discontinuous interp. + + PF_ParamFlag_COLLAPSE_TWIRLY / PF_ParamFlag_START_COLLAPSED + Set this flag if you want the parameter's twirly arrow in the + Effect Control Window to be twirled up by default when the + effect is first applied. New in AE 4.0: you can now set & + clear this bit when handling PF_Cmd_UPDATE_PARAMS_UI and + PF_Cmd_USER_CHANGED_PARAM messages, so as to twirl your + parameters and groups up and down at will. + + PF_ParamFlag_SUPERVISE + If this is passed, PF_Cmd_USER_CHANGED_PARAM will be sent when + this parameter changes. + + PF_ParamFlag_USE_VALUE_FOR_OLD_PROJECTS + This only affects the loading of projects saved with an older version + of the effect which lacks parameters added later. When set, the PF_ParamDef + "value" field set in PF_ADD_PARAM will be used to initialize the missing parameter, + but the "dephault" field will still be used for initial value of the parameter when + the effect is newly applied or reset. This is useful for when you want a + parameter to default to one value but need it set to something else to + preserve rendering behaviour for older projects. + + This flag is valid for all PF_Param types except PF_Param_LAYER + + PF_ParamFlag_LAYER_PARAM_IS_TRACKMATTE + For PF_Param_LAYER, this flag indicates that the layer parameter is to be presented + as a track matte. Supported by Premiere, ignored in AE. + + PF_ParamFlag_EXCLUDE_FROM_HAVE_INPUTS_CHANGED + See doc for PF_HaveInputsChangedOverTimeSpan. + + PF_ParamFlag_SKIP_REVEAL_WHEN_UNHIDDEN + when this param is "un hidden" (cuz it may hide and show), then the GUI is NOT to cause + the parameter to be "revealed", ie: it won't twirl down it's parents and scroll it into view + +**/ +enum { + PF_ParamFlag_RESERVED1 = 1 << 0, + PF_ParamFlag_CANNOT_TIME_VARY = 1 << 1, /* can't vary over time */ + PF_ParamFlag_CANNOT_INTERP = 1 << 2, /* can only vary discontinuously */ + PF_ParamFlag_RESERVED2 = 1 << 3, /* was _old_ PF_ParamFlag_WANTS_UPDATE value, never used */ + PF_ParamFlag_RESERVED3 = 1 << 4, /* was _old_ PF_ParamFlag_SEPARATE, now use PF_PUI_ECW_SEPARATOR */ + PF_ParamFlag_COLLAPSE_TWIRLY = 1 << 5, /* controls the twirl-state of the twirly-arrow in the ECW (dynamic) */ + PF_ParamFlag_SUPERVISE = 1 << 6, /* call me with PF_Cmd_USER_CHANGED_PARAM (new in AE 4.0) */ + PF_ParamFlag_START_COLLAPSED = PF_ParamFlag_COLLAPSE_TWIRLY, /* when first applied, param comes up collapsed */ + PF_ParamFlag_USE_VALUE_FOR_OLD_PROJECTS = 1 << 7, /* see extensive comment above */ + PF_ParamFlag_LAYER_PARAM_IS_TRACKMATTE = 1 << 7, /* only valid for layer parameters. indicates that a layer param is used as a track-matte with applied filters (used in Premiere, ignored in AE) */ + PF_ParamFlag_EXCLUDE_FROM_HAVE_INPUTS_CHANGED = 1 << 8, /* only relevant if you call PF_HaveInputsChangedOverTimeSpan() */ + PF_ParamFlag_SKIP_REVEAL_WHEN_UNHIDDEN = 1 << 9 /* dont reveal this stream when un-hidden (use only during param setup) */ +}; +typedef A_long PF_ParamFlags; + +enum { + PF_Err_NONE = 0, + PF_Err_OUT_OF_MEMORY = 4, + PF_Err_INTERNAL_STRUCT_DAMAGED = PF_FIRST_ERR, + PF_Err_INVALID_INDEX, /* out of range, or action not allowed on this index */ + PF_Err_UNRECOGNIZED_PARAM_TYPE, + PF_Err_INVALID_CALLBACK, + PF_Err_BAD_CALLBACK_PARAM, + PF_Interrupt_CANCEL, /* Returned when user interrupts rendering */ + PF_Err_CANNOT_PARSE_KEYFRAME_TEXT /* Returned from PF_Arbitrary_SCAN_FUNC when effect + cannot parse arbitrary data from text */ +}; +typedef A_long PF_Err; + + +enum { + PF_WorldFlag_DEEP = 1L << 0, + PF_WorldFlag_WRITEABLE = 1L << 1, + + + PF_WorldFlag_RESERVED0 = 1L << 24, + PF_WorldFlag_RESERVED1 = 1L << 25, + PF_WorldFlag_RESERVED2 = 1L << 26, + PF_WorldFlag_RESERVED3 = 1L << 27, + PF_WorldFlag_RESERVED4 = 1L << 28, + PF_WorldFlag_RESERVED5 = 1L << 29, + PF_WorldFlag_RESERVED6 = 1L << 30, + PF_WorldFlag_RESERVED = 1L << 31 +}; + +typedef A_long PF_WorldFlags; + +#define PF_WORLD_IS_DEEP(W) ( ((W)->world_flags & PF_WorldFlag_DEEP) != 0 ) + +#define PF_MAX_CHAN8 255 +#define PF_HALF_CHAN8 128 +#define PF_MAX_CHAN16 32768 +#define PF_HALF_CHAN16 16384 + + + +/** -------------------- Output Flags -------------------- + + The out_flags field of the OutData can be set to an OR-ed + combination of these flags to communicate various things to + the driver program. The flags are described here: + + PF_OutFlag_NONE + This is the "empty" setting -- no outflags. + + PF_OutFlag_WIDE_TIME_INPUT + Set this flag if the effect calls get_param to inquire a + parameter at a time besides the current one (e.g. to get + the previous video frame). This should be sent, if it is + going to be sent, at PF_Cmd_GLOBAL_SETUP. Can be over-ridden + dynamically during PF_Cmd_QUERY_DYNAMIC_FLAGS. + + As of AE10, this flag is no longer recommended. It still works the + same way and is safe to set, but there's a more efficient option. + See PF_OutFlag2_AUTOMATIC_WIDE_TIME_INPUT. + + PF_OutFlag_NON_PARAM_VARY + Set this if the effect uses information other than the parameters + in the param list to generate its output at the current time. + For instance, if the effect uses the current time of the frame + or some random value to decide the output, set this flag. This + flag should be sent at PF_Cmd_GLOBAL_SETUP. If the effect + produces changing frames when applied to a still image and + all parameters are constant, that's a sure sign that this bit + should be set (e.g. Wave Warp). Can be over-ridden dynamically + during PF_Cmd_QUERY_DYNAMIC_FLAGS. + + PF_OutFlag_SEQUENCE_DATA_NEEDS_FLATTENING + When you allocate a sequence data handle, the app + may write the handle out to disk and reuse it + later. Pass this flag if the handle is not "flat" + (i.e. has pointers or handles hanging off of it). + Basically, this gives you a chance to alter the + handle contents before it is written out to disk, + so you won't get invalid handles or pointers. Once + you have flattened a handle, you will get an + opportunity to un-flatten it before the effect + needs to continue. For sequence data, you will be + invoked with a PF_Cmd_SEQUENCE_RESETUP call. You + should store a boolean at a common offset in your + unflattened and flattened data that says whether + the data is flat or not. If you get a + PF_Cmd_SEQUENCE_RESETUP and the boolean indicated + the data is flattened, you should unflatten the + data, free the flattened data handle, and set the + sequence_data handle in the PF_OutData. If you + ever set the data to NULL when you flatten it, you + will NOT get the sequence resetup call to + unflatten it. Instead, you may just get a RENDER + call with NULL data. Forewarned is forearmed. This + flag, indicating if the data will need to be + flattened, should be set at PF_Cmd_GLOBAL_SETUP time. + + PF_OutFlag_I_DO_DIALOG + Set this is the effect responds to a PF_Cmd_DO_DIALOG, i.e. Does this + effect bring up an options dialog box. PF_Cmd_DO_DIALOG is generated + when the user presses the Options button on the Effect floater. + This flag should be set at PF_Cmd_GLOBAL_SETUP time. + + PF_OutFlag_USE_OUTPUT_EXTENT + The output layer is passed with an "extent rect" indicating + the area of the layer that actually contains visible image data. If + the effect changes its behavior based on the extent rect (for instance, + by not iterating over the entire image), set this flag, so the + application will know whether having the extent change should cause + the frame to re-render. Specify this flag at PF_Cmd_GLOBAL_SETUP. + + PF_OutFlag_SEND_DO_DIALOG + Some filters need their options dialog box to be brought up at least + once to be valid. You can set this flag, and the driver app will + automatically send a PF_Cmd_DO_DIALOG to the effect when it is applied. + The DO_DIALOG will be sent after PF_Cmd_SEQUENCE_SETUP. This flag + should be set in PF_Cmd_SEQUENCE_SETUP if it is going to be set. + + PF_OutFlag_DISPLAY_ERROR_MESSAGE + Whenever the return_msg field in the PF_OutData is set to a string, + After Effects will bring up a simple dialog box containing that + string. If you set this flag, the dialog box will be made to look + like an error message dialog box. If you don't set this flag, it + will be an undecorated dialog box. Using this flag, an effects module + can have and display its own error messages and not worry about the + code for dialog boxes -- the program will do it for you. + This flag can be sent after any command. + + PF_OutFlag_I_EXPAND_BUFFER + Starting with After Effects 2.0, effects will be able to expand their buffers + beyond the current layer's dimensions. This has always been part of the + PF specification, but as an extra precaution (and hint to the AE rendering + engine) set this flag at PF_Cmd_GLOBAL_SETUP if you plan to expand your + buffer. + + PF_OutFlag_I_SHRINK_BUFFER + Set this flag if you can shrink your buffer based on the extent-rects passed + to you in order to be more memory efficient. + + PF_OutFlag_PIX_INDEPENDENT + Set this flag if the output at a given pixel is not dependent on the values + of the pixels around it. If this is set, the pixels After Effects does not + care about (because of field rendering, for example) could be filled with garbage + colors. Please set this flag at PF_Cmd_GLOBAL_SETUP. Can be over-ridden + dynamically during PF_Cmd_QUERY_DYNAMIC_FLAGS. + + PF_OutFlag_I_WRITE_INPUT_BUFFER + Set this flag if your effect would like to write into the input buffer. This + can be useful if you need an scratch buffer, but it also invalidates some speedups + in the AE rendering pipeline, so use it with some discretion. Please set this + flag at PF_Cmd_GLOBAL_SETUP. + + PF_OutFlag_KEEP_RESOURCE_OPEN + + Obsoleted in AE 2015 (does nothing when set). + + Set this flag if your effect expects its Macintosh resource fork to be open + at any time other than global setup. Note that this does not mean that + the resource fork will be kept open at all times, just whenever the + effect is being executed. + + PF_OutFlag_NOP_RENDER + + Set this flag in PF_Cmd_GLOBAL_SETUP if the render would never result in changes + to the source image (or audio?). For example, an expression control would set this. + + PF_OutFlag_CUSTOM_UI + + This flag must be set if your effect has a custom UI in the Effect Controls + Window, Layer Window or Comp Window. + + PF_OutFlag2_CUSTOM_UI_ASYNC_MANAGER (new in 13.5) + + This flags enables use of AEGP_CheckoutOrRender_*_AsyncManager() calls + which avoid the need for plugin management of the lifetime of async custom UI renders from the UI thread. + The plugin asks for what frames it needs and the manager calls PF_Event_DRAW again when they are available + (or cancels them as needed automatically). The plugin responds in PF_Event_DRAW by asking for what it needs + and drawing what it can from what is available. + + Due to separation of Render thread and UI thread in 13.5, frames for custom UI should no longer be + rendered synchronously (see RenderSuite5 for more details). The manager simplifies this, especially when + there are multiple requests needed for DRAW. + + When enabled, this flag associates a "PF_AsyncManager" with the NEW_CONTEXT/CLOSE_CONTEXT and PF_Event_DRAW + that will automatically track completion of 1 or more asynch render requests made for drawing custom UI. + As requests complete, PF_Event_DRAW will be called again and the current state of the CUSTOM_UI can be drawn. + Such requests may be canceled automatically as the user scrubs the time needle or project changes are made and + become invalid. + + This flag is used in addition to the CUSTOM_UI flag during PF_Cmd_GLOBAL_SETUP + + PF_OutFlag_REFRESH_UI + + Can be returned from PF_Cmd_EVENT, PF_Cmd_RENDER, and PF_Cmd_DO_DIALOG. + Causes the effects control window, layer window, and comp window to be re-drawn. + + PF_OutFlag_I_USE_SHUTTER_ANGLE + + Must be set at PF_Cmd_GLOBAL_SETUP time if the effect uses + the shutter_angle or the shutter_phase. Can be over-ridden dynamically during + PF_Cmd_QUERY_DYNAMIC_FLAGS. + + PF_OutFlag_I_USE_AUDIO + + Must be set at PF_Cmd_GLOBAL_SETUP time for a visual effect + that calls the audio checkout calls. + + PF_OutFlag_I_AM_OBSOLETE + + Set at PF_Cmd_GLOBAL_SETUP time for effects that don't + want to appear in the AE Effects menu (but will still be invoked + if you load a project that has an old copy of the effect applied). + + PF_OutFlag_FORCE_RERENDER + + Set at PF_Cmd_EVENT if the effect modified sequence data, + or did anything else that requires the effect needs to re-render. + Note that setting PF_ChangeFlag_CHANGED_VALUE automatically + causes a re-render, so don't worry about setting PF_OutFlag_FORCE_RERENDER + in that case. Also, I_MIX_GUID_DEPENDENCIES can be used to trigger a rerender on + dependant changes if sequence_data has not been changed. + + IMPORTANT: FORCE_RERENDER should be used as a last resort. Long term we should be eliminating the need for this + because it causes forced cache invalidation that doesn't work well with undo. + Once we have the full set of APIs in place needed to manage render state, we will be able to deprecate this. + Prefer using ARB data + CHANGED_VALUE or I_MIX_GUID_DEPENDENCIES when possible instead. + + In 13.5 the split between a UI and render threads means that FORCE_RERENDER will now also have the needed + side effect of copying sequence_data state to the render project. This can be expensive if the sequence_data is large. + Support GET_FLATTENED_SEQUENCE_DATA to prevent deallocation of your sequence_data, which can help. + GET_FLATTENED_SEQUENCE_DATA support is required for FORCE_RERENDER use in custom mouse/key events. + + PF_OutFlag_PiPL_OVERRIDES_OUTDATA_OUTFLAGS + + Valid only for setting in your PiPL. When set out_flags will be + ignored at PF_Cmd_GLOBAL_SETUP time (& thus don't need to match). + + PF_OutFlag_I_HAVE_EXTERNAL_DEPENDENCIES + + Set this flag at PF_Cmd_GLOBAL_SETUP time if the effect has dependencies + that the user should know about before transporting their project to a + different machine. For example, dependencies on an installed font, + or on an external file. If set, the effect will receive a + PF_Cmd_GET_EXTERNAL_DEPENDENCIES request, where the extra + param will be a PF_ExtDependenciesExtra, and the effect should + report its information based on the given sequence_data. + + PF_OutFlag_SEND_UPDATE_PARAMS_UI + + Set this flag at PF_Cmd_GLOBAL_SETUP time if you want to receive + PF_Cmd_UPDATE_PARAMS_UI messages. + + PF_OutFlag_AUDIO_FLOAT_ONLY + + Set this flag if you only want to receive PF_SIGNED_FLOAT data + when processing audio data. Requires PF_OutFlag_AUDIO_EFFECT_TOO + or PF_OutFlag_AUDIO_EFFECT_ONLY. + + PF_OutFlag_AUDIO_IIR + + Set this flag at PF_Cmd_GLOBAL_SETUP time if you are an + Infinite-Impulse-Response audio filter (i.e. your output at a given + time depends on your output from previous times). + + PF_OutFlag_I_SYNTHESIZE_AUDIO + + Set this flag at PF_Cmd_GLOBAL_SETUP time if you generate + audio even when handed silence. Requires PF_OutFlag_AUDIO_EFFECT_TOO + or PF_OutFlag_AUDIO_EFFECT_ONLY. + + PF_OutFlag_AUDIO_EFFECT_TOO + + Must be set at PF_Cmd_GLOBAL_SETUP time for an effect that + wants to filter the audio too (as opposed to just reading the audio). + + PF_OutFlag_AUDIO_EFFECT_ONLY + + Must be set at PF_Cmd_GLOBAL_SETUP time for an effect + that only filters audio (no video). + + PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS + + Set this during PF_Cmd_GLOBAL_SETUP if the effect handles PF_Cmd_QUERY_DYNAMIC_FLAGS. + Supporting this command can dramatically improve performance for certain + effects, because it provides dynamic information to the host about what + can be cached (as opposed to PIPL bits which cannot be changed at run-time) + + PF_OutFlag2_I_USE_3D_CAMERA + + This bit must be set if the effect ever uses the AEGP PF_Interface suite to + access camera layers. Can be over-ridden dynamically during PF_Cmd_QUERY_DYNAMIC_FLAGS. + + PF_OutFlag2_I_USE_3D_LIGHTS + + This bit must be set if the effect ever uses the AEGP PF_Interface suite to + access camera layers. Can be over-ridden dynamically during PF_Cmd_QUERY_DYNAMIC_FLAGS. + + PF_OutFlag2_PARAM_GROUP_START_COLLAPSED_FLAG + + If you want a parameter group to honor the PF_ParamFlag_COLLAPSE_TWIRLY or + PF_ParamFlag_START_COLLAPSED flag, set this bit. Otherwise, all parameter + groups will be collapsed by default. + + PF_OutFlag2_DOESNT_NEED_EMPTY_PIXELS + + Added for render optimizations; shrinks the input buffer passed to the effect to + exclude any empty pixels (where empty means "zero alpha" unless + PF_OutFlag2_REVEALS_ZERO_ALPHA is set, in which case RGB must be zero as well.) + The origin of the trimmed buffer can be found in in_data->pre_effect_source_origin. + Effects with both this flag and PF_OutFlag_I_EXPAND_BUFFER set may get called with + a null input buffer if their input is completely empty, and must be able to handle + this case without crashing. This flag can be cleared dynamically during + PF_Cmd_QUERY_DYNAMIC_FLAGS. + + PF_OutFlag2_REVEALS_ZERO_ALPHA + + The effect can take pixels with zero alpha and reveal the RGB data in them (like + our Set Channels effect). This tells After Effects not to trim such pixels when + determining the input for the effect. This flag can be cleared dynamically during + PF_Cmd_QUERY_DYNAMIC_FLAGS. + + PF_OutFlag2_I_AM_DEPRECATED + this effect is still available, and shows up under user-visible "Obsolete" category + in the UI. Setting this flag means "there's a better way to do this, but this effect + may still be useful in some situations". distinct from PF_OutFlag_I_AM_OBSOLETE in + that these will still show up in the GUI and the user can still apply them to new + projects. The category that is set by the effect is pretty much ignored, as it will + instead always go into the "Obsolete" category + + PF_OutFlag2_I_USE_TIMECODE + New in AE 9.0. The effect depends on the Composition's timecode or a layer's + source footage timecode. If the underlying timecode changes the effects will + be asked to rerender. + + PF_OutFlag2_AUTOMATIC_WIDE_TIME_INPUT + New in AE 10. Requires setting of PF_OutFlag_WIDE_TIME_INPUT (which allows you + to support old hosts), but effectively overrides that flag. When set, all + parameter checkouts are tracked so over-time dependencies are known by AE. Note + that if you use this new flag, and you cache any time-dependent data in your + sequence data (or anywhere else), you must validate that cache using the + new PF_HaveInputsChangedOverTimeSpan() before using it. + + This only works for smart effects (those that set PF_OutFlag2_SUPPORTS_SMART_RENDER). If you haven't + set that, After Effects will silently treat this as PF_OutFlag_WIDE_TIME_INPUT instead. + + To test that it's working, apply your effect with one parameter keyframed on every frame. + RAM Preview to fill the cache, then change one of the keyframes. The related frame and + all dependent frames (e.g. later frames, in the case of a simulation) should lose their + cache marks and require re-rendering. Simlarly, upstream changes to sources of layer + parameters should cause time-selective invalidation of the cache. + + PF_OutFlag2_DEPENDS_ON_UNREFERENCED_MASKS + Set this if you are going to look at paths that aren't directly referenced by a path + param, e.g. if you are going to draw a stroke on all masks. + + PF_OutFlag2_OUTPUT_IS_WATERMARKED + Set this if your output is going to be watermarked in some way that makes it unsuitable for + final use, probably because the user is using an unlicensed demo version. It is ok to change + this state during the course of app session, if e.g. a floating license status changes. + Plugin authors that actually do have this state changing asynchronously must be careful to + have the next render match the last state returned from QUERY_DYNAMIC_FLAGS otherwise race conditions + could cause incorrect frames to be cached. (This is a non-issue if you only change this in response + to DO_DIALOG.) + + PF_OutFlag2_I_MIX_GUID_DEPENDENCIES (new in 13.5) + Smart effects only. With this option, FORCE_RERENDER becomes a cache-savvy more efficient MAYBE rerender. + If custom UI or DO_DIALOG change sequence data, returning FORCE_RERENDER requests AE to check whether + rerender needs to occur. During PreRender, the effect uses the GuidMixInPtr callback to mix + any additional state that affects the render into our internal GUID for the cached frame. + AE can then tell whether the frame already exists and if so, no longer needs to render. + This also means that DO_DIALOG no longer always blows the cache and that undo works across DO_DIALOG. + Cancelation of DO_DIALOG no longer blows the cache either. + This also means that I_USE_* flags are now basically redundant since any dependency could be mixed in. + Just be sure to mix in everything that can uniquely affect resulting rendered pixels (that is not already + an AE stream parameter). But don't mixin things that are disabled and have no render effect (this + results in less cache efficiency). + + PF_OutFlag2_SUPPORTS_THREADED_RENDERING + Indicates the effect supports rendering on multiple threads at the same time. Single or multiple + applications of this effect on a layer can be called to render at the same time on multiple threads. + + UI selectors are still sent on the main thread, however Sequence Setup, Sequence Resetup, Sequence SetDown, + PreRender, and Render may be sent on multiple threads at the same time as the UI selectors are being handled + so all of these selectors must be thread safe. + + Global Setup and Global Setdown selectors are unaffected by this flag. Regardless whether this flag is set + or not, they will only be sent on the main thread, and will not be sent at the same time as any other selectors. + + If the effect sets PF_OutFlag_SEQUENCE_DATA_NEEDS_FLATTENING indicating the sequence data needs flattening + then it must also set PF_OutFlag2_SUPPORTS_GET_FLATTENED_SEQUENCE_DATA. + + sequence_data is read-only at render time and must be accessed with PF_EffectSequenceDataSuite. + in_data->sequence_data will be NULL during render. AEGP_ComputeCacheSuite is suggested if writing to + sequence_data at render time is needed for caching. This suite unifies cache entries so multiple threads do + not recompute the same cache value. If neither of these solutions work, see the next flag, + PF_OutFlag2_MUTABLE_RENDER_SEQUENCE_DATA_SLOWER. + + PF_OutFlag2_MUTABLE_RENDER_SEQUENCE_DATA_SLOWER + Indicates the effect needs sequence_data replicated for each render thread, thus allowing each render to have + sequence_data which can be written to. Note that changes to sequence_data will be discarded regularly, currently + after each span of frames is rendered such as single RAM Preview or Render Queue export. + +**/ + +enum { + PF_OutFlag_NONE = 0L, + + // which PF_Cmds each flag is relevant for: + PF_OutFlag_KEEP_RESOURCE_OPEN = 1L << 0, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_WIDE_TIME_INPUT = 1L << 1, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag_NON_PARAM_VARY = 1L << 2, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag_RESERVED6 = 1L << 3, + PF_OutFlag_SEQUENCE_DATA_NEEDS_FLATTENING = 1L << 4, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_I_DO_DIALOG = 1L << 5, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_USE_OUTPUT_EXTENT = 1L << 6, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_SEND_DO_DIALOG = 1L << 7, // PF_Cmd_SEQUENCE_SETUP + PF_OutFlag_DISPLAY_ERROR_MESSAGE = 1L << 8, // all PF_Cmds + PF_OutFlag_I_EXPAND_BUFFER = 1L << 9, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_PIX_INDEPENDENT = 1L << 10, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag_I_WRITE_INPUT_BUFFER = 1L << 11, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_I_SHRINK_BUFFER = 1L << 12, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_WORKS_IN_PLACE = 1L << 13, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_RESERVED8 = 1L << 14, + PF_OutFlag_CUSTOM_UI = 1L << 15, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_RESERVED7 = 1L << 16, + PF_OutFlag_REFRESH_UI = 1L << 17, // PF_Cmd_EVENT, PF_Cmd_RENDER, PF_Cmd_DO_DIALOG + PF_OutFlag_NOP_RENDER = 1L << 18, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_I_USE_SHUTTER_ANGLE = 1L << 19, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag_I_USE_AUDIO = 1L << 20, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_I_AM_OBSOLETE = 1L << 21, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_FORCE_RERENDER = 1L << 22, // PF_Cmd_EVENT, PF_Cmd_USER_CHANGED_PARAM, PF_Cmd_UPDATE_PARAMS_UI + PF_OutFlag_PiPL_OVERRIDES_OUTDATA_OUTFLAGS = 1L << 23, // PiPL-only-flag + PF_OutFlag_I_HAVE_EXTERNAL_DEPENDENCIES = 1L << 24, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_DEEP_COLOR_AWARE = 1L << 25, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_SEND_UPDATE_PARAMS_UI = 1L << 26, // PF_Cmd_GLOBAL_SETUP + + // audio flags (PF_OutFlag_AUDIO_EFFECT_TOO or PF_OutFlag_AUDIO_EFFECT_ONLY required for audio effects) + PF_OutFlag_AUDIO_FLOAT_ONLY = 1L << 27, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_AUDIO_IIR = 1L << 28, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_I_SYNTHESIZE_AUDIO = 1L << 29, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_AUDIO_EFFECT_TOO = 1L << 30, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag_AUDIO_EFFECT_ONLY = 1L << 31 // PF_Cmd_GLOBAL_SETUP +}; +typedef A_long PF_OutFlags; + +enum { + PF_OutFlag2_NONE = 0L, + // which PF_Cmds each flag is relevant for: + PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS = 1L << 0, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_I_USE_3D_CAMERA = 1L << 1, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag2_I_USE_3D_LIGHTS = 1L << 2, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag2_PARAM_GROUP_START_COLLAPSED_FLAG= 1L << 3, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_I_AM_THREADSAFE = 1L << 4, // PF_Cmd_GLOBAL_SETUP (unused) + PF_OutFlag2_CAN_COMBINE_WITH_DESTINATION = 1L << 5, // Premiere only (as of AE 6.0) + PF_OutFlag2_DOESNT_NEED_EMPTY_PIXELS = 1L << 6, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag2_REVEALS_ZERO_ALPHA = 1L << 7, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag2_PRESERVES_FULLY_OPAQUE_PIXELS = 1L << 8, // Premiere only (as of AE 6.0) + PF_OutFlag2_SUPPORTS_SMART_RENDER = 1L << 10, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_RESERVED9 = 1L << 11, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_FLOAT_COLOR_AWARE = 1L << 12, // PF_Cmd_GLOBAL_SETUP, may require PF_OutFlag2_SUPPORTS_SMART_RENDER + PF_OutFlag2_I_USE_COLORSPACE_ENUMERATION = 1L << 13, // PF_Cmd_GLOBAL_SETUP, not implemented in AE7 (may be impl in Premiere Pro) + PF_OutFlag2_I_AM_DEPRECATED = 1L << 14, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_PPRO_DO_NOT_CLONE_SEQUENCE_DATA_FOR_RENDER = 1L << 15, // PF_Cmd_GLOBAL_SETUP, Premiere only, CS4.1 and later + PF_OutFlag2_RESERVED10 = 1L << 16, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_AUTOMATIC_WIDE_TIME_INPUT = 1L << 17, // PF_Cmd_GLOBAL_SETUP, falls back to PF_OutFlag_WIDE_TIME_INPUT if not PF_OutFlag2_SUPPORTS_SMART_RENDER + PF_OutFlag2_I_USE_TIMECODE = 1L << 18, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_DEPENDS_ON_UNREFERENCED_MASKS = 1L << 19, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag2_OUTPUT_IS_WATERMARKED = 1L << 20, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_QUERY_DYNAMIC_FLAGS + PF_OutFlag2_I_MIX_GUID_DEPENDENCIES = 1L << 21, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_AE13_5_THREADSAFE = 1L << 22, // PF_Cmd_GLOBAL_SETUP (unused) + PF_OutFlag2_SUPPORTS_GET_FLATTENED_SEQUENCE_DATA = 1L << 23, // PF_Cmd_GLOBAL_SETUP, support required if both PF_OutFlag_SEQUENCE_DATA_NEEDS_FLATTENING and PF_OutFlag2_SUPPORTS_THREADED_RENDERING is set + PF_OutFlag2_CUSTOM_UI_ASYNC_MANAGER = 1L << 24, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_SUPPORTS_GPU_RENDER_F32 = 1L << 25, // PF_Cmd_GLOBAL_SETUP, PF_Cmd_GPU_DEVICE_SETUP. Must also set PF_RenderOutputFlag_GPU_RENDER_POSSIBLE at pre-render to enable GPU rendering. + PF_OutFlag2_RESERVED12 = 1L << 26, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_SUPPORTS_THREADED_RENDERING = 1L << 27, // PF_Cmd_GLOBAL_SETUP + PF_OutFlag2_MUTABLE_RENDER_SEQUENCE_DATA_SLOWER = 1L << 28 // PF_Cmd_GLOBAL_SETUP +}; +typedef A_long PF_OutFlags2; + + +/** -------------------- Input Flags -------------------- + + The in_flags field of the InData can be set to an OR-ed + combination of these flags to communicate various things from AE to an effect plugin + The flags are described here: + + PF_InFlag_NONE + This is the "empty" setting -- no inflags. + + PF_InFlag_PROJECT_IS_RENDER_ONLY (since 13.5) + + For efficiency, if a plugin sets up UI that is not used in render, this flag + can be tested to skip that step when an effect is being RESETUP for render only. + Effect instances with this flag on in RESETUP are in read-only AE projects and will not receive UI related selectors. + + This is an optimization hint. If you don't make such optimizations in render your plugin should still work. + + This flag should generally not be used to suppress errors in render. Errors should still be reported as usual via AE standard mechanisms, + and AE will then handle the differences in context reporting. + + If this is off, UI should be set up normally (and the effect could also be running in an earlier version of + AE that assumed render and UI on the same effect instance.) + +**/ + +enum { + PF_InFlag_NONE = 0L, + PF_InFlag_PROJECT_IS_RENDER_ONLY = 1L << 0 // since 13.5 and only in PF_Cmd_SEQUENCE_RESETUP +}; +typedef A_long PF_InFlags; + + + + + +/** -------------------- Command Selectors -------------------- + + The first parameter to the effect routine is one of t hese command + selectors. The commands are described here. + + PF_Cmd_ABOUT + This command should display an information dialog box about the + effect module. The easiest thing to do is PF_SPRINTF the info + into the out_data->return_msg field. After Effects will bring + up a simple undecorated modal dialog with your text proudly displayed. + This command can be sent at _any_ time, so don't count on having + any global data or anything else set. (Except, as always, the + current resource file will be set to your effects module.) + + PF_Cmd_GLOBAL_SETUP + When you get this command, you should check the version of the + effect protocol with which you are being invoked, and set any of + the necessary out flags (described above) or out data fields + (described below). If your global data was flattened, the flat + data will be passed here and you should unflatten it, free the + flat global data, and set the OutData global_data to the new un-flat + data. Alternatively, the global data may come in NULL and you can + allocate new global data at this time. + + PF_Cmd_GLOBAL_SETDOWN + You should free any global data you have allocated when you get + this command. + + PF_Cmd_PARAMS_SETUP + Here you should add any params your effect wants using the + PF_ADD_PARAM callback described below. This is called after global + setup -- see the add_param callback described below. + + PF_Cmd_SEQUENCE_SETUP + This is called when the effect is first applied to a layer. + A sequence is a series of images that will usually be all be of the same + size and in the same context. You can allocate sequence data + at this time -- many more input fields are defined at this time. + See the PF_InData description below. + + As of 13.5 this only happens on the UI thread. + Except for legacy (no GET_FLATTENED_SEQUENCE_DATA) effects that do I_DO_DIALOG which can still hit this in render. + + PF_Cmd_SEQUENCE_RESETUP + This call is made to unflatten flattened sequence data. + There are at least three cases when this can happen: + 1) after the sequence data is written to disk, 2) after the + sequence data is read in from disk, 3) after a duplicate + is made (called on both original and the new sequence). + + This can happen in UI or Render thread (13.5), the effect must handle + initialization of a NULL sequence_data input if needed. See also PF_InFlag_PROJECT_IS_RENDER_ONLY. + + PF_Cmd_SEQUENCE_FLATTEN + This call is made to flatten unflat sequence data so it can be + cached to disk. After the data is flattened, free the un-flat data + and set the out_data->sequence_data to the new flat data. + If you don't want your sequence handle written to disk, you + can set it to NULL (after disposing it) at this time. Presumably + you would then reallocate it at another time. + + This command will be sent when saving and when duplicating + the sequence. + + PF_Cmd_GET_FLATTENED_SEQUENCE_DATA (new in 13.5) + Returns an independent allocation of the sequence data which can be written + to disk or used to initialise or update other instances of the effect plug-in. + + The host calls this command to serialize the sequence data without + having to flatten and resetup the UI plug-in as was legacy practice. (However, at present effects + still may need flattening in render if the sequence_data is about to be assigned.) + + An effect that implements GET_FLATTENED_SEQUENCE_DATA will only receive SEQUENCE_SETUP on the UI thread. + SEQUENCE_RESETUP can happen on either thread. Make sure you handle a NULL sequence_data in RESETUP. + (Without GET_FLATTENED, a legacy effect may still get SEQUENCE_SETUP in render but DO_DIALOG will not be called.) + + Also when enabled, this means that the effect is guaranteed to get a + SEQUENCE_SETDOWN cmd to dispose the effect's sequence_data (previously + it was possible for AE to bypass this if the sequence_data was flat, + but that lead to SEQUENCE_SETUP/SETDOWN imbalances for some plugins. + The imbalance should not happen when using this flag, but the plugin must + handle being called on SETDOWN with possibly flat data. For example, + try copy and pasting an effect onto itself. + + Support for this command is indicated by setting + PF_OutFlag2_SUPPORTS_GET_FLATTENED_SEQUENCE_DATA + + The ownership of the returned handle is transferred to the host. + + PF_Cmd_SEQUENCE_SETDOWN + You should free any sequence data you have allocated when you + get this command. + + PF_Cmd_DO_DIALOG + This command indicated that the Options button or command has + been selected and the effect should bring up its options dialog. + This command will only be sent it the effect has indicated that + it has an options dialog with PF_OutFlag_I_DO_DIALOG. This + command will automatically be sent once upon applying the filter + if PF_OutFlag_SEND_DO_DIALOG is set in SEQUENCE_SETUP. + + PF_Cmd_FRAME_SETUP + This is called immediately before each frame is invoked. You + can allocate frame data at this time, if you wish, or you can + just wait for the RENDER which will immediately follow. + + PF_Cmd_RENDER + This is the call to render the frame. All fields in the in_data + will be valid at this time and you can inquire parameters or + what-have-you. This should set the output frame with the new + image data. This is the main action command. + + PF_Cmd_FRAME_SETDOWN + If you allocated data in PF_Cmd_FRAME_SETUP, this is the time + to free it and clean up after rendering the frame. + + PF_Cmd_USER_CHANGED_PARAM + This command will be sent if you set the PF_ParamFlag_SUPERVISE + flag for a param. This allows you to modify the params array contents to + control values or make one control affect others, including arbitrary + data. This command will be sent whenever the user interacts with a + standard param controller that has PF_ParamFlag_SUPERVISE + set. + + The "extra" field will be a pointer to a PF_UserChangedParamExtra structure + which contains the param_index of the changed parameter. + + You can return PF_ChangeFlag_CHANGED_VALUE and/or call PF_UpdateParamUI() + for any param. + + PF_Cmd_UPDATE_PARAMS_UI + This command will be sent when the Effect Controls Window (ECW) + needs to updated (e.g. after opening the ECW or moving the comp to + a new time) if you have set PF_OutFlag_SEND_UPDATE_PARAMS_UI at + global setup time. + + This gives you a chance to call PF_UpdateParamUI() to modify certain + ui fields for the params. See the doc for PF_UpdateParamUI() + to see which fields can be modified. + + WARNING: When handling PF_Cmd_UPDATE_PARAMS_UI, you can call + PF_UpdateParamUI() for any param(s), but not PF_ChangeFlag_CHANGED_VALUE -- + only cosmetic changes can be made in response to this command. + + PF_Cmd_QUERY_DYNAMIC_FLAGS + This command will be sent at arbitrary times if PF_OutFlag2_SUPPORTS_QUERY_DYNAMIC_FLAGS + is set during global setup. During this call the effect may examine the values + of its parameters at the current time (except layer parameters) by checking them out, + and decide whether any of the flags that support PF_Cmd_QUERY_DYNAMIC_FLAGS should be set. + + The appropriate flags must be set in out_data->out_flags and out_data->out_flags2 before + returning. The effect must decide what information is necessary to render a frame at + the current time, given only the values of parameters at that time. Clearing the + appropriate bits when possible can result in great performance improvements, but + incorrectly clearing bits will result in caching bugs, and you won't like that. Nope. + +**/ +enum { /* The order of this enumeration must not be altered! */ + PF_Cmd_ABOUT = 0, /* about can be called at any time */ + PF_Cmd_GLOBAL_SETUP, /* check versions, cpu, serial #, etc. always */ + PF_Cmd_UNUSED_0, + PF_Cmd_GLOBAL_SETDOWN, + PF_Cmd_PARAMS_SETUP, /* add parameters here */ + PF_Cmd_SEQUENCE_SETUP, + PF_Cmd_SEQUENCE_RESETUP, /* if part of in_data changed */ + PF_Cmd_SEQUENCE_FLATTEN, /* prepare handle to be written to disk */ + PF_Cmd_SEQUENCE_SETDOWN, + PF_Cmd_DO_DIALOG, /* called after SEQUENCE_SETUP only if effect requests */ + PF_Cmd_FRAME_SETUP, + PF_Cmd_RENDER, + PF_Cmd_FRAME_SETDOWN, + +/* most of these command types make use of the 'extra' field */ + + PF_Cmd_USER_CHANGED_PARAM, /* user just changed a param value, extra contains ptr to PF_UserChangedParamExtra */ + PF_Cmd_UPDATE_PARAMS_UI, /* UI fields in paramdefs need to be refreshed according to new values, no extra info */ + PF_Cmd_EVENT, /* handle some event. extra contains a ptr to a relevant structure */ + PF_Cmd_GET_EXTERNAL_DEPENDENCIES, /* new in AE4.1: return text description of things like fonts, etc. in PF_ExtDependenciesExtra */ + PF_Cmd_COMPLETELY_GENERAL, /* new in AE4.1: Used for completely general effect calls via AEGP */ + + PF_Cmd_QUERY_DYNAMIC_FLAGS, /* new in AE5.0: allows effect to control certain flags based on parameter values */ + + PF_Cmd_AUDIO_RENDER, /* For Audio Effects */ + PF_Cmd_AUDIO_SETUP, + PF_Cmd_AUDIO_SETDOWN, + + PF_Cmd_ARBITRARY_CALLBACK, /* used for arbitrary data, passes PF_ArbParamsExtra * in extra */ + + PF_Cmd_SMART_PRE_RENDER, /* used with Smart Render effect interface */ + PF_Cmd_SMART_RENDER, + + PF_Cmd_RESERVED1, /* private command */ + PF_Cmd_RESERVED2, /* private command */ + PF_Cmd_RESERVED3, /* private command */ + + PF_Cmd_GET_FLATTENED_SEQUENCE_DATA, + PF_Cmd_TRANSLATE_PARAMS_TO_PREFS, + + PF_Cmd_RESERVED4, /* private command */ + PF_Cmd_SMART_RENDER_GPU, /* used when rendering on the GPU */ + PF_Cmd_GPU_DEVICE_SETUP, + PF_Cmd_GPU_DEVICE_SETDOWN, + + PF_Cmd_NUM_CMDS +}; +typedef A_long PF_Cmd; + + +/** -------------------- Simple Types -------------------- +**/ + +typedef struct _PF_LayerAudio *PF_LayerAudio; + +typedef void *PF_SndSamplePtr; + +/* The following is an opaque type you pass to callback routines */ +struct PF_ProgressInfo; +typedef struct PF_ProgressInfo *PF_ProgPtr; + +typedef A_long PF_ParamValue; + +typedef struct { + A_short major; + A_short minor; +} PF_SpecVersion; + +typedef A_long PF_ParamIndex; + +typedef A_u_long PF_UFixed; + +#ifndef A_INTERNAL + + #if defined(_WINDOWS) || defined(__ANDROID__) + + typedef A_long PF_Fixed; + typedef A_char PF_Boolean; + typedef void **PF_Handle; + + typedef struct { + A_short v; + A_short h; + } PF_LegacyPoint; + + typedef struct { + A_short top, left, bottom, right; + } PF_LegacyRect; + + #else + + typedef Fixed PF_Fixed; + typedef Boolean PF_Boolean; + typedef Handle PF_Handle; + + #endif + + typedef struct { + #ifdef LPOINT_RENAME_COMPONENTS + A_long x; + A_long y; + #else + A_long h; + A_long v; + #endif + } PF_Point; + + typedef struct { + A_long left, top, right, bottom; + } PF_LRect; + + typedef PF_LRect PF_Rect; + + typedef PF_Rect PF_UnionableRect; + + typedef struct { + A_long num; /* numerator */ + A_u_long den; /* denominator */ + } PF_RationalScale; + +#endif + +#define PF_Fixed_MINVAL ((PF_Fixed)0x80000000) // Maximally negative value +#define PF_Fixed_MAXVAL ((PF_Fixed)0x7fffffff) // Maximally positive value + + +typedef struct { + PF_Fixed x, y; +} PF_FixedPoint; + +typedef struct { + PF_Fixed left, top, right, bottom; +} PF_FixedRect; + +typedef struct { + PF_Fixed mat[3][3]; +} PF_Matrix; + + +#ifndef A_INTERNAL + + // Basic pixel defn's + typedef struct { + A_u_char alpha, red, green, blue; + } PF_Pixel; + + typedef PF_Pixel PF_Pixel8; + typedef PF_Pixel PF_UnionablePixel; + + typedef struct { + #ifdef PF_PIXEL16_RENAME_COMPONENTS + // this style is useful for debugging code converted from 8 bit + A_u_short alphaSu, redSu, greenSu, blueSu; + #else + A_u_short alpha, red, green, blue; + #endif + } PF_Pixel16; + + typedef A_FpShort PF_FpShort; + typedef A_FpLong PF_FpLong; + + typedef struct { + PF_FpShort alpha, red, green, blue; + } PF_PixelFloat, PF_Pixel32; + + typedef struct { + PF_FpLong mat[3][3]; + } PF_FloatMatrix; + +#endif + + +typedef A_u_long PF_PixLong; + +typedef struct _PF_PixelOpaque *PF_PixelOpaquePtr; + +#ifdef PF_DEEP_COLOR_AWARE + typedef PF_PixelOpaquePtr PF_PixelPtr; +#else + typedef PF_Pixel *PF_PixelPtr; +#endif + + + +#define PF_HUE_UNDEFINED 0x80000000 + +typedef PF_Fixed PF_RGB_Pixel[3]; +typedef PF_Fixed PF_YIQ_Pixel[3]; +typedef PF_Fixed PF_HLS_Pixel[3]; + + + + +/** -------------------- Pixel Access Macros -------------------- + + If you're using the PF_PixLong struct for pixel representation, + you can use these macros to guarantee correct channel access + for a given pixel. + +**/ + +#define PF_PixLong_ALPHA(pl) ((A_u_char)(0xff & ((pl) >> 24))) +#define PF_PixLong_RED(pl) ((A_u_char)(0xff & ((pl) >> 16))) +#define PF_PixLong_GREEN(pl) ((A_u_char)(0xff & ((pl) >> 8))) +#define PF_PixLong_BLUE(pl) ((A_u_char)(0xff & (pl))) + +#define PF_SET_PixLong_ALPHA(pl, v) (pl)&=0x00ffffff, (pl)|=((A_long)(v)<<24) +#define PF_SET_PixLong_RED(pl, v) (pl)&=0xff00ffff, (pl)|=((A_long)(v)<<16) +#define PF_SET_PixLong_GREEN(pl, v) (pl)&=0xffff00ff, (pl)|=((A_long)(v)<<8) +#define PF_SET_PixLong_BLUE(pl, v) (pl)&=0xffffff00, (pl)|=(0xff & (v)) +#define PF_MAKE_PixLong(a, r, g, b) \ + ((PF_PixLong)(((A_long)(a)<<24) | ((A_long)(r)<<16) | ((A_long)(g)<<8) | (b))) + + + +/*********************** multi-channel data *********************/ + +/** + ** the kinds of multichannels we understand + **/ +#define PF_ChannelType_DEPTH 'DPTH' +#define PF_ChannelType_DEPTHAA 'DPAA' // since 16.0 for 3D Precomp in some Artisans +#define PF_ChannelType_NORMALS 'NRML' +#define PF_ChannelType_OBJECTID 'OBID' +#define PF_ChannelType_MOTIONVECTOR 'MTVR' +#define PF_ChannelType_BK_COLOR 'BKCR' +#define PF_ChannelType_TEXTURE 'TEXR' +#define PF_ChannelType_COVERAGE 'COVR' +#define PF_ChannelType_NODE 'NODE' +#define PF_ChannelType_MATERIAL 'MATR' +#define PF_ChannelType_UNCLAMPED 'UNCP' +#define PF_ChannelType_UNKNOWN 'UNKN' + +typedef A_long PF_ChannelType; + + +/** + ** These are the elementary data types we understand. + ** By convention we reserve the last characters of the type + ** to designate the size in bytes of a plane of data. This together + ** with the dimension tells us the size of each pixel. + ** For example, data of PF_ChannelType_COLOR with PF_DataType_DOUBLE would + ** consist of 32 bytes per pixel. + **/ +#define PF_DataType_FLOAT 'FLT4' /* 4 byte */ +#define PF_DataType_DOUBLE 'DBL8' /* 8 byte */ +#define PF_DataType_LONG 'LON4' /* 4 bytes */ +#define PF_DataType_SHORT 'SHT2' /* 2 bytes */ +#define PF_DataType_FIXED_16_16 'FIX4' /* 4 bytes */ +#define PF_DataType_CHAR 'CHR1' /* 1 byte */ +#define PF_DataType_U_BYTE 'UBT1' /* 1 byte */ +#define PF_DataType_U_SHORT 'UST2' /* 2 bytes */ +#define PF_DataType_U_FIXED_16_16 'UFX4' /* 4 bytes */ +#define PF_DataType_RGB 'RBG ' /* 3 bytes */ + +typedef A_long PF_DataType; + + + + + +/** + ** for enumerating over all the channels + **/ +typedef A_long PF_ChannelIndex; + + + + + +/** + ** a description of the channel + ** use this when iterating through channels to determine + ** the characteristics of the channel + ** + **/ +#define PF_CHANNEL_NAME_LEN 63 + +typedef struct { + PF_ChannelType channel_type; + A_char name[PF_CHANNEL_NAME_LEN+1]; + PF_DataType data_type; + A_long dimension; // the number of data per pixel +} PF_ChannelDesc; // eg 3 for normals + + + + + +/** + ** the opaque type representing the channel data + **/ +typedef struct { + A_intptr_t opaque[8]; +} PF_ChannelRef, *PF_ChannelRefPtr; + + + + + + +/** + ** the channel data parallels the image data in size and shape. + ** the width is the number of pixels, the height is the number of scanlines + ** the height is image_height + ** the dimension is the number of planes in a pixel + ** the row_bytes is the length of a scanline in bytes + ** the data type is the type of data in a plane + ** Note : a pixel consists of dimensionL * sizeof(data_type) bytes + ** dataH is a handle to the data. + ** dataPV is a pointer to the dereferenced locked handle + ** effects should always have dataPV non null. + **/ +typedef struct { + PF_ChannelRef channel_ref; + A_long widthL; + A_long heightL; + A_long dimensionL; + A_long row_bytesL; + PF_DataType data_type; + PF_Handle dataH; + void *dataPV; +} PF_ChannelChunk; + + + +/** -------------------- Effect Parameter Description Structures -------------------- + + In general each structure is divided into two parts: + a) description of the parameter + b) setting of parameter at the current invocation time + + A number of these structures end in A_char*, A_char[] unions. These + structures are "flattened" between the add_param callback (in which + the A_char * should be used) and the read-only values accessible when + the effect is later invoked (at which time the A_char [] is used and + the string data is concatenated right at the end of the struct). + +**/ + + +enum { + PF_LayerDefault_MYSELF = -1, /* default to this layer */ + PF_LayerDefault_NONE = 0 /* default to no layer */ +}; + +/** Layer -- PF_Param_LAYER + + Layer parameters represent movie or image layers in the composition. + All effects automatically have 1 layer param, param[0], which is the + layer to which they have been applied. Some effects may have additional + layer parameters to do compound effects or multi-channel effects. If + your effects module has a layer parameter other than the param[0] default, + you will have to call the checkout_param callback to access the contents + of that layer. There is a special case for all layer params (except the + param[0] automatic layer) which is that the user can set them to , + indicating that no layer is selected. The effect can detect this, because + the checkout_param callback will not return an error, but the "data" pointer + in the returned LayerDef struct will be NULL. For the NULL-layers, the + effect should attempt some logical interpretation, like pretending there + is an all alpha-zero layer or perhaps just using param[0]. + +**/ + +#ifndef A_INTERNAL + + + +typedef struct PF_LayerDef { + /* PARAMETER VALUE */ + + void *reserved0; + void *reserved1; + + PF_WorldFlags world_flags; + + PF_PixelPtr data; + + A_long rowbytes; + A_long width; + A_long height; + PF_UnionableRect extent_hint; + /* For source, extent_hint is the smallest rect encompassing all opaque + * (non-zero alpha) areas of the layer. For output, this encompasses + * the area that needs to be rendered (i.e. not covered by other layers, + * needs refreshing, etc.). if your plug-in varies based on extent (like + * a diffusion dither, for example) you should ignore this param and + * render the full frame each time. + */ + void *platform_ref; /* unused since CS5 */ + + A_long reserved_long1; + + void *reserved_long4; + + PF_RationalScale pix_aspect_ratio; /* pixel aspect ratio of checked out layer */ + + void *reserved_long2; + + A_long origin_x; /* origin of buffer in layer coords; smart effect checkouts only */ + A_long origin_y; + + A_long reserved_long3; + + /* PARAMETER DESCRIPTION */ + A_long dephault; /* use a PF_LayerDefault constant defined above */ + +} PF_LayerDef; + + + +typedef PF_LayerDef PF_EffectWorld; + +#endif + +#ifdef PF_USE_OLD_WORLD /* set this for source code compatibility with older effects */ + typedef PF_EffectWorld PF_World; +#endif + +enum { + PF_UNSIGNED_PCM = 0, + PF_SIGNED_PCM = 1, + PF_SIGNED_FLOAT = 2 +}; +typedef A_short PF_SoundFormat; + + +// Sound encoding is always SIGNED +enum { + PF_SSS_1 = 1, + PF_SSS_2 = 2, + PF_SSS_4 = 4 +}; +typedef A_short PF_SoundSampleSize; // in bytes + +enum { + PF_Channels_MONO = 1, + PF_Channels_STEREO = 2 +}; +typedef A_short PF_SoundChannels; + + +typedef struct { + PF_FpLong rateF; + PF_SoundChannels num_channels; + PF_SoundFormat format; + PF_SoundSampleSize sample_size; +} PF_SoundFormatInfo; + +typedef struct { + PF_SoundFormatInfo fi; + A_long num_samples; + void *dataP; +} PF_SoundWorld; + + + +enum { + PF_ValueDisplayFlag_NONE = 0, + PF_ValueDisplayFlag_PERCENT = 1 << 0, // append % to value display for A_FpShort sliders (for fixed-point sliders, also maps range into 0-100%) + PF_ValueDisplayFlag_PIXEL = 1 << 1, // assume 0..1 is a pixel value, either 0..255, 0..32768, or 0..1.0 in UI (value will always be 0..1), + PF_ValueDisplayFlag_RESERVED1 = 1 << 2, // reserved for After Effects + PF_ValueDisplayFlag_REVERSE = 1 << 3 // presentation negates values. eg: a true -5 would be presented as "5", and typing in "22" would store in the model as -22 +}; + +#define PF_VALUEFLAG_IS_PERCENT(A) (((A) & PF_ValueDisplayFlag_PERCENT) != 0) +#define PF_VALUEFLAG_IS_PIXEL(A) (((A) & PF_ValueDisplayFlag_PIXEL) != 0) +#define PF_VALUEFLAG_IS_REVERSED(A) (((A) & PF_ValueDisplayFlag_REVERSE) != 0) + +typedef A_short PF_ValueDisplayFlags; + + +/** Slider -- PF_Param_SLIDER +**/ +typedef struct { + /* PARAMETER VALUE */ + PF_ParamValue value; + A_char value_str[PF_MAX_PARAM_VALUE_LEN + 1]; /* string for value */ + A_char value_desc[PF_MAX_PARAM_DESCRIPTION_LEN + 1]; /* qualitative descr */ + + /* PARAMETER DESCRIPTION */ + PF_ParamValue valid_min, valid_max; /* acceptable input range */ + PF_ParamValue slider_min, slider_max; /* range represented by width of slider */ + PF_ParamValue dephault; +} PF_SliderDef; + + +/** Fixed Point Slider -- PF_Param_FIX_SLIDER +**/ +typedef struct { + /* PARAMETER VALUE */ + PF_Fixed value; + A_char value_str[PF_MAX_PARAM_VALUE_LEN + 1]; /* string for value */ + A_char value_desc[PF_MAX_PARAM_DESCRIPTION_LEN + 1]; /* qualitative descr */ + + /* PARAMETER DESCRIPTION */ + PF_Fixed valid_min, valid_max; /* acceptable input range */ + PF_Fixed slider_min, slider_max; /* range represented by width of slider */ + PF_Fixed dephault; + A_short precision; /* decimal places to display */ + PF_ValueDisplayFlags display_flags; /* set bit to 1 to enable special display: + * --> bit 0 == append percent sign + */ +} PF_FixedSliderDef; + + +#define AEFX_AUDIO_DEFAULT_CURVE_TOLERANCE 0.05f + + +enum { + PF_FSliderFlag_NONE = 0, + PF_FSliderFlag_WANT_PHASE = 1L << 0 /* works for audio effects only */ +}; +typedef A_u_long PF_FSliderFlags; + +/** Floating Point Slider -- PF_Param_FLOAT_SLIDER +**/ +typedef struct { + /* PARAMETER VALUE */ + PF_FpLong value; + PF_FpLong phase; /* used for PF_FSliderFlag_WANT_PHASE */ + A_char value_desc[PF_MAX_PARAM_DESCRIPTION_LEN + 1]; /* qualitative descr */ + + /* PARAMETER DESCRIPTION */ + PF_FpShort valid_min, valid_max; /* acceptable input range */ + PF_FpShort slider_min, slider_max; /* range represented by width of slider */ + PF_FpShort dephault; + A_short precision; /* decimal places to display */ + PF_ValueDisplayFlags display_flags; /* set bit to 1 to enable special display: + * --> bit 0 == append percent sign + */ + PF_FSliderFlags fs_flags; + PF_FpShort curve_tolerance; /* used for subdividing audio effects + set to zero for default, or non-audio */ + + /* next 2 fields are used in Premiere Pro and ignored in AE */ + PF_Boolean useExponent; /* use exponential value display */ + PF_FpShort exponent; /* typical values from 0.01 to 100 */ +} PF_FloatSliderDef; + + +/** Angle -- PF_Param_ANGLE +**/ +typedef struct { + /* PARAMETER VALUE */ + PF_Fixed value; /* degrees with fixed point accuracy; + * this is NOT limited in range to 0 to 360. + */ + + /* PARAMETER DESCRIPTION */ + PF_Fixed dephault; + + /* Min and max values. Note!! Not supported for effect plugins. + ** Angle properties in effects are always unlimited in range. + */ + PF_Fixed valid_min, valid_max; +} PF_AngleDef; + + +/** CheckBox -- PF_Param_CHECKBOX +**/ +typedef struct { + /* PARAMETER VALUE */ + PF_ParamValue value; + + /* PARAMETER DESCRIPTION */ + PF_Boolean dephault; + A_char reserved; /* padding */ + A_short reserved1; + union { + const A_char *nameptr; + } u; +} PF_CheckBoxDef; + + +/** Color -- PF_Param_COLOR +**/ +typedef struct { + /* PARAMETER VALUE */ + PF_UnionablePixel value; + + /* PARAMETER DESCRIPTION */ + PF_UnionablePixel dephault; +} PF_ColorDef; + + +/** Point -- PF_Param_POINT + + The values for the point use the source's coordinate system, with the + origin at the top left. The values are expressed in fixed point, with + 16 bits of fractional precision (out of a total of 32 bits). + + The dephaults (sorry) are expressed as percentages (with 16 bits of + fraction) with the origin at the top left. The percent can be negative, + but should not be smaller than -600%. It should not be greater than 600%. + + If restrict_bounds is TRUE, the user will not be allowed to specify + points outside the bounds of the layer to which they are applying the + effect. If this is TRUE, the dephaults should be between 0.0 and 100.0. + +**/ +typedef struct { + /* PARAMETER VALUE */ + PF_Fixed x_value; + PF_Fixed y_value; + + /* PARAMETER DESCRIPTION */ + A_char reserved[3]; + PF_Boolean restrict_bounds; /* restrict bounds to size of src */ + PF_Fixed x_dephault; /* percentage */ + PF_Fixed y_dephault; /* percentage */ +} PF_PointDef; + + +/** 3D Point -- PF_Param_POINT_3D + + Just like POINT, with an extra dimension. Supported in AE starting with version 10.5 (CS 5.5). + +**/ +typedef struct { + /* PARAMETER VALUE */ + PF_FpLong x_value; + PF_FpLong y_value; + PF_FpLong z_value; + + /* PARAMETER DESCRIPTION */ + PF_FpLong x_dephault; /* percentage of layer width; note: use 50 for halfway, not 0.5; this matches the old PF_PointDef behavior */ + PF_FpLong y_dephault; /* percentage of layer height */ + PF_FpLong z_dephault; /* percentage of layer _height_ (since typical layers are zero depth) */ + + char reserved[16]; /* set to zeros */ +} PF_Point3DDef; + +/** Popup Menu -- PF_Param_POPUP + ** + ** can also be used as a radio-button group in some hosts + ** when PF_PUI_RADIO_BUTTON is set + ** + **/ +typedef struct { + /* PARAMETER VALUE */ + PF_ParamValue value; + + /* PARAMETER DESCRIPTION */ + A_short num_choices; + A_short dephault; + union { + const A_char *namesptr; /* menu manager standard, '|' separator */ + } u; +} PF_PopupDef; + + +/** Momentary Buttons -- PF_Param_BUTTON + ** + ** supported by AE starting with CS 5.5 (AE 10.5); may be supported in other hosts + ** + **/ +typedef struct { + /* PARAMETER VALUE */ + PF_ParamValue value; // not used at this time + + union { + const A_char *namesptr; /* button name */ + } u; +} PF_ButtonDef; + + + + +enum { + PF_PathID_NONE = 0 +}; +typedef A_u_long PF_PathID; + + +enum { + PF_MaskMode_NONE = 0, // mask shape does nothing + PF_MaskMode_ADD, // shape is added into mask (normal behavior (really screen!)) + PF_MaskMode_SUBTRACT, + PF_MaskMode_INTERSECT, + PF_MaskMode_LIGHTEN, + PF_MaskMode_DARKEN, + PF_MaskMode_DIFFERENCE, + PF_MaskMode_ACCUM, // real add, not screen (not exposed in UI!) + + PF_NUM_MASKMODES +}; +#define PF_NUM_USER_MASKMODES (PF_NUM_MASKMODES - 1) +typedef A_long PF_MaskMode; + + + +/** Path -- PF_Param_PATH + + Path parameters give access to the mask/path/shapes of the layer on which + the effect is applied. For more information + on how to use these paths, see the PF_PathQuerySuite, and the PF_PathDataSuite + in AE_EffectSuites.h + +**/ +typedef struct PF_PathDef { + + /* PARAMETER VALUE */ + PF_PathID path_id; /* to be used with PF_CheckoutPath() + note that path_id != PF_PathID_NONE does not + guarantee that PF_CheckoutPath will return a + valid path (it may have been deleted) */ + + /* PARAMETER DESCRIPTION */ + A_long reserved0; /* not currently used, set to zero */ + + A_long dephault; /* 0 means that the default is NONE, + other numbers are the 1-based index of the + path, if the path doesn't exist, the + path_idLu value will be PF_PathID_NONE. + */ +} PF_PathDef; + + +/* --------------------- ARBITRARY DATA ----------------------------------- + * new arbitrary data type - you supply functions for various activities + * needed by After Effects to manipulate your arbitrary data. + */ + +typedef PF_Handle PF_ArbitraryH; + + +typedef struct { + A_short id; /* for effect use: lets effect distinguish between */ + /* different arbitrary data param types in the same effect */ + A_short pad; /* padding, set to zero */ + PF_ArbitraryH dephault; /* becomes owned by host at ADD_PARAM time */ + PF_ArbitraryH value; /* pass NULL at ADD_PARAM time; owned by host at render time */ + void *refconPV; /* passed into all callbacks, for effect use */ +} PF_ArbitraryDef; + + + +enum { + PF_Arbitrary_NEW_FUNC = 0, + PF_Arbitrary_DISPOSE_FUNC, + PF_Arbitrary_COPY_FUNC, + PF_Arbitrary_FLAT_SIZE_FUNC, + PF_Arbitrary_FLATTEN_FUNC, + PF_Arbitrary_UNFLATTEN_FUNC, + PF_Arbitrary_INTERP_FUNC, + PF_Arbitrary_COMPARE_FUNC, + PF_Arbitrary_PRINT_SIZE_FUNC, + PF_Arbitrary_PRINT_FUNC, + PF_Arbitrary_SCAN_FUNC +}; +typedef A_long PF_FunctionSelector; + + + +enum { + PF_ArbCompare_EQUAL = 0, + PF_ArbCompare_LESS, + PF_ArbCompare_MORE, + PF_ArbCompare_NOT_EQUAL +}; +typedef A_long PF_ArbCompareResult; + + +enum { + PF_ArbPrint_NONE = 0, + PF_ArbPrint_ABBREVIATED = 1 << 0 +}; +typedef A_long PF_ArbPrintFlags; + + + +/* this is what gets passed in the extra parameter with + * PF_Cmd_ARBITRARY_CALLBACKS + */ +typedef struct { + + PF_FunctionSelector which_function; + + A_short id; + A_short padding; + + union { + + /* PF_Arbitrary_NEW_FUNC + * + * allocate and initialize the data + * the passed in parameter,v, will already have its non data fields filled in + * you just allocate and optionally fill out the data. + */ + struct { + void *refconPV; /* >> */ + PF_ArbitraryH *arbPH; /* << */ + } new_func_params; + + + + /* PF_Arbitrary_DISPOSE_FUNC + * + * dispose of any allocated data + */ + struct { + void *refconPV; + PF_ArbitraryH arbH; + } dispose_func_params; + + + + /* PF_Arbitrary_COPY_FUNC + * + * make a copy of src_dataP into dst_dataP. refconPV was assigned from parameter def. + */ + struct { + void *refconPV; + PF_ArbitraryH src_arbH; + PF_ArbitraryH *dst_arbPH; /* << allocated by copy func, owned by caller */ + } copy_func_params; + + + + /* PF_Arbitrary_FLAT_SIZE_FUNC + * + * return in flat_data_sizePLu the number of bytes that are needed to flatten the object. + */ + struct { + void *refconPV; + PF_ArbitraryH arbH; + A_u_long *flat_data_sizePLu; /* << */ + } flat_size_func_params; + + + + /* PF_Arbitrary_FLATTEN_FUNC + * + * Flatten the arbH and place it into the supplied buffer, honoring its size. + */ + struct { + void *refconPV; + PF_ArbitraryH arbH; + A_u_long buf_sizeLu; // size of buffer + void *flat_dataPV; // buffer already allocated + } flatten_func_params; + + + + /* PF_Arbitrary_UNFLATTEN_FUNC + * + * opposite of FlattenFunc, unpack the buffer into a PF_ArbitraryH. + */ + struct { + void *refconPV; + A_u_long buf_sizeLu; /* size of buffer */ + const void *flat_dataPV; /* >> */ + PF_ArbitraryH *arbPH; /* << */ // owned by caller + } unflatten_func_params; + + + + /* PF_Arbitrary_INTERP_FUNC + * + * The interpolation function takes a left and a right keyframe and a value between + * 0 and 1, 0 being the left keyframe, 1 represents the right keyframe. + * allocate PF_ArbitraryH and fill it with interpolated data. + * The velocity curves have already been accounted for when the normalized time value was + * calculated. + */ + struct { + void *refconPV; + PF_ArbitraryH left_arbH; /* >> */ // left keyframe + PF_ArbitraryH right_arbH; /* >> */ // right keyframe + PF_FpLong tF; /* >> */ // range [0,1] + PF_ArbitraryH *interpPH; /* << */ // becomes owned by caller + } interp_func_params; + + + /* PF_Arbitrary_COMPARE_FUNC + * + * compare two arbitrary data types for equality + * return 0 if equal, otherwise return 1 in comparePL + */ + struct { + void *refconPV; + PF_ArbitraryH a_arbH; /* >> */ // value 1 + PF_ArbitraryH b_arbH; /* >> */ // value 2 + PF_ArbCompareResult *compareP; /* << */ // result of compare use enumeration above + } compare_func_params; + + + + /* PF_Arbitrary_PRINT_SIZE_FUNC + * + * return in print_sizePLu the number of bytes that are needed to print the object. + */ + struct { + void *refconPV; + PF_ArbitraryH arbH; /* >> */ // the data + A_u_long *print_sizePLu; /* << */ // size of buffer needed to print + } print_size_func_params; + + + /* PF_Arbitrary_PRINT_FUNC + * + * return in buff a user-readable description of your arb data + */ + struct { + void *refconPV; /* >> */ + PF_ArbPrintFlags print_flags; /* >> */ // PF_ArbPrint_NONE means print the complete description + PF_ArbitraryH arbH; /* >> */ + A_u_long print_sizeLu; /* >> */ // size of buffer + A_char *print_bufferPC; /* << */ + } print_func_params; + + + + /* PF_Arbitrary_SCAN_FUNC + * + * return a PF_ArbitraryH from the text description of your arb data + */ + struct { + void *refconPV; /* >> */ + const A_char *bufPC; /* >> */ + A_u_long bytes_to_scanLu; /* >> */ + PF_ArbitraryH *arbPH; /* << */ + } scan_func_params; + + } u; + +} PF_ArbParamsExtra; + + +typedef struct { + PF_ParamIndex param_index; +} PF_UserChangedParamExtra; // passed as extra for PF_Cmd_USER_CHANGED_PARAM + + +/* The following is an opaque type you pass to PF_Cmd_TRANSLATE_PARAMS_TO_PREFS */ +typedef struct PF_ImporterPrefsData *PF_ImporterPrefsDataPtr; + +/* prefsPC is a pointer to an importer opaque data (prefs) that coincides + * with its matching importer. It's an in/out param. The host owns it, + * but the filter will modify it. + * prefs_sizeLU is the size of the prefs object pointed to. + * This is part of a Premiere Pro feature that requires a matching Importer/Source Settings effect + * and will only be used in that particular case. + */ +typedef struct { + PF_ImporterPrefsDataPtr prefsPC; + A_u_long prefs_sizeLu; +} PF_TranslateParamsToPrefsExtra; // passed as extra for PF_Cmd_TRANSLATE_PARAMS_TO_PREFS + + +enum { + PF_DepCheckType_NONE = 0, + PF_DepCheckType_ALL_DEPENDENCIES, + PF_DepCheckType_MISSING_DEPENDENCIES +}; +typedef A_long PF_DepCheckType; + +typedef struct { + PF_DepCheckType check_type; /* >> */ // effect should ignore any unknown type + PF_Handle dependencies_strH; /* << */ // NULL terminated string. Flat and disposed of by the host +} PF_ExtDependenciesExtra; + + +#ifdef PREMIERE_INTERNAL + #include "PF_Private_Premiere.h" +#else + + +typedef union { + PF_LayerDef ld; + PF_SliderDef sd; + PF_FixedSliderDef fd; + PF_AngleDef ad; + PF_CheckBoxDef bd; + PF_ColorDef cd; + PF_PointDef td; + PF_PopupDef pd; + PF_FloatSliderDef fs_d; + PF_ArbitraryDef arb_d; + PF_PathDef path_d; + PF_ButtonDef button_d; + PF_Point3DDef point3d_d; +} PF_ParamDefUnion; + +#endif + +/** Param UI Flags + + PF_PUI_TOPIC + + Set this flag if you handle PF_Cmd_EVENTs for the "topic" of + the parameter. The "topic" is the portion of the param UI + in the Effect Controls Window (ECW) that is still visible + when the twirly-arrow is twirled up for that param. + + If you set this flag, you must also set PF_OutFlag_CUSTOM_UI + at PF_Cmd_GLOBAL_SETUP time. + + PF_PUI_CONTROL + + Set this flag if you handle PF_Cmd_EVENTs for the control + area in the ECW. This is the area that becomes invisible + when you twirl up a parameter's twirly arrow (and is the + usual place to have your custom UI). + + If you set this flag, you must also set PF_OutFlag_CUSTOM_UI + at PF_Cmd_GLOBAL_SETUP time. + + PF_PUI_STD_CONTROL_ONLY + + Set this flag if you want the standard control only -- no + data stream will be associated with this parameter, and + thus no keyframes (nothing appears in the Time Layout window + for this type of param). + + You might want to do this to control something in your + sequence data with a standard control. Or in your arb + data, or custom UI in the comp window, or to group-set multiple + other controls. + + + This flag can be used with these param types: + PF_Param_SLIDER, PF_Param_FIX_SLIDER, PF_Param_ANGLE, + PF_Param_CHECKBOX, PF_Param_COLOR, PF_Param_POINT, + PF_Param_POPUP, PF_Param_FLOAT_SLIDER, PF_Param_POINT_3D + + but NOT: + + PF_Param_CUSTOM, PF_Param_NO_DATA, + PF_Param_LAYER, PF_Param_ARBITRARY_DATA, PF_Param_PATH + + If you set this flag, you must also set PF_ParamFlag_SUPERVISE + (otherwise you would never find out about value changes, and + the setting would never be used for anything). This flag + does not require the setting of PF_OutFlag_CUSTOM_UI. + + If you want a standard control for PF_Param_ARBITRARY_DATA, + just add one (or more) using PF_PUI_STD_CONTROL_ONLY with + the supported param types, and then when handling + PF_Cmd_USER_CHANGED_PARAM you can modify your arb data. + + + PF_PUI_NO_ECW_UI + + Set this flag if you want no UI to appear in the Effect Controls + Window. Presumably, you are setting the value of the parameter + through some other method (e.g. custom UI in the comp window, + or while handling PF_Cmd_USER_CHANGED_PARAM for a different param with + PF_ParamFlag_SUPERVISE set). In AE, this doesn't affect keyframe + visibility in the timeline. In PPro it does remove the entire row, + so you won't see keyframes. + + PF_PUI_ECW_SEPARATOR + + Set this flag if you'd like a thick line above this parameter + in the effect control window. This is provided so that parameters + can be grouped visually, if needed (without adding groups). + This flag can be changed at runtime through the PF_UpdateParamUI() + method. Not used by AE. + + PF_PUI_INVISIBLE + + Set this flag if you'd like the parameter to be initially invisible. This is useful + if your effect needs hidden data parameters that affect rendering. + + Premiere only: The parameter can later be made visible by clearing the flag + during the PF_UpdateParamUI() callback. + +**/ + +enum { + PF_PUI_NONE = 0, + PF_PUI_TOPIC = 1L << 0, // effect has custom UI and wants events for this params' title (portion visible when twirled up) + PF_PUI_CONTROL = 1L << 1, // effect has custom UI and wants events for this params' control (portion invisible when twirled up) + // use the width and height below + + // following flags are new in AE 4.0 + + PF_PUI_STD_CONTROL_ONLY = 1L << 2, // param will be used as UI only, no data (new in AE 4.0) */ + PF_PUI_NO_ECW_UI = 1L << 3, // stop param from appearing in Effect Controls (which in PPro also means you won't see a keyframe track there) + PF_PUI_ECW_SEPARATOR = 1L << 4, // draw a thick separating line above this param; not used by AE + PF_PUI_DISABLED = 1L << 5, // disable (gray-out) UI for this param + + // following flags are new in AE 4.1 + + // AE will not erase the ECW topic, it's up to the FX to erase/draw every pixel. + // Handy if FX author implements an offscreen, prevents flashing. + PF_PUI_DONT_ERASE_TOPIC = 1L << 6, + PF_PUI_DONT_ERASE_CONTROL = 1L << 7, + + PF_PUI_RADIO_BUTTON = 1L << 8, // display as a radio-button group; only valid for PF_Param_POPUP; ignored by AE + + PF_PUI_INVISIBLE = 1L << 9 // in AE as of CS6, this hides the parameter UI in both the Effect Controls and Timeline. + // in Premiere since earlier than that, this hides the parameter UI in the Effect Controls, + // which includes the keyframe track; for PPro only, the flag is dynamic and can be cleared + // to make the parameter visible again. +}; +typedef A_long PF_ParamUIFlags; + +/** PF_ChangeFlags + + New in AE 4.0 (although PF_ChangeFlag_CHANGED_VALUE was implemented + by setting low bit of old changed field). + + PF_ChangeFlag_CHANGED_VALUE + + Set this flag for each param whose value you change when handling + a PF_Cmd_USER_CHANGED_PARAM or specific PF_Cmd_EVENT events + (PF_Event_DO_CLICK, PF_Event_DRAG, & PF_Event_KEYDOWN). If set during + PF_Cmd_EVENT, but sure to also set PF_EO_HANDLED_EVENT before returning. + You can change as many params as you want at once. These changes are undoable and + re-doable by the user. Exception: do not set PF_PUI_STD_CONTROL_ONLY + param values with this flag, use PF_UpdateParamUI() instead. + + PF_ChangeFlag_SET_TO_VARY + + Not yet implemented. Same restrictions as PF_ChangeFlag_CHANGED_VALUE. + + PF_ChangeFlag_SET_TO_CONSTANT + + Not yet implemented. Same restrictions as PF_ChangeFlag_CHANGED_VALUE. + +**/ + +enum { + PF_ChangeFlag_NONE = 0, + PF_ChangeFlag_CHANGED_VALUE = 1L << 0, + PF_ChangeFlag_RESERVED = 1L << 1, + PF_ChangeFlag_SET_TO_VARY = 1L << 2, + PF_ChangeFlag_SET_TO_CONSTANT = 1L << 3 +}; +typedef A_long PF_ChangeFlags; + + +/** ParamDef +**/ +typedef struct { + /* PARAMETER VALUE */ + union { + A_long id; // used by PF_ADD_PARAM callback, see doc + PF_ChangeFlags change_flags; // set when handling PF_Cmd_USER_CHANGED_PARAM & PF_Cmd_UPDATE_PARAMS_UI + } uu; + + PF_ParamUIFlags ui_flags; + A_short ui_width; /* ignored if !PF_PUI_CONTROL */ + A_short ui_height; /* ignored if !PF_PUI_CONTROL */ + + /* PARAMETER DESCRIPTION */ + PF_ParamType param_type; + A_char name[PF_MAX_EFFECT_PARAM_NAME_LEN + 1]; + PF_ParamFlags flags; + + A_long unused; // Once upon a time was reserved_tdb + PF_ParamDefUnion u; + +} PF_ParamDef, *PF_ParamDefPtr, **PF_ParamDefH; + +typedef PF_ParamDef** PF_ParamList; + +#define PF_ParamDef_IS_PUI_FLAG_SET(_defP, _puiFlag) \ + (((_defP)->ui_flags & _puiFlag) != 0) + +#define PF_ParamDef_IS_PARAM_FLAG_SET(_defP, _paramFlag) \ + (((_defP)->flags & _paramFlag) != 0) + + + + /** -------------------- Smart Render Interface Constants and Structures -------------------- + + PF_Cmd_SMART_PRE_RENDER gets a PF_PreRenderExtra struct in the extra pointer, and must + fill out the "output" field before returning. + + PF_Cmd_SMART_RENDER gets a PF_SmartRenderExtra struct in the extra pointer, if pre-render was invoked. + + */ + + enum { + PF_ChannelMask_ALPHA = 0x1, + PF_ChannelMask_RED = 0x2, + PF_ChannelMask_GREEN = 0x4, + PF_ChannelMask_BLUE = 0x8, + PF_ChannelMask_ARGB = 0xF + }; + typedef A_long PF_ChannelMask; + + enum { + PF_GPU_Framework_NONE = 0, + PF_GPU_Framework_OPENCL, + PF_GPU_Framework_METAL, + PF_GPU_Framework_CUDA, + }; + typedef A_long PF_GPU_Framework; + + typedef struct { + PF_LRect rect; + PF_Field field; + PF_ChannelMask channel_mask; + PF_Boolean preserve_rgb_of_zero_alpha; // whether the effect should attempt to preserve RGB when A=0 + char unused[3]; // keep this zeroed! + A_long reserved[4]; // this too + } PF_RenderRequest; + + typedef struct { + PF_RenderRequest output_request; // what the effect is being asked to render + short bitdepth; // bitdepth the effect is being driven in (in bpc) + const void *gpu_data; + PF_GPU_Framework what_gpu; + A_u_long device_index; + } PF_PreRenderInput; + + typedef void (*PF_DeletePreRenderDataFunc)(void *pre_render_data); + + + enum { + PF_RenderOutputFlag_RETURNS_EXTRA_PIXELS = 0x1, // if it's just as cheap to compute more pixels at once, set this to allow result > request rect + PF_RenderOutputFlag_GPU_RENDER_POSSIBLE = 0x2 // if the GPU render is possible given the params and frame render context + }; + typedef short PF_RenderOutputFlags; + + typedef struct { + PF_LRect result_rect; // the rectangle actually available from this request (can be empty) + PF_LRect max_result_rect; // the maximum size the output could possibly be, if AE asked for all of it + // (this must not vary depending on requested output size!) + + PF_Boolean solid; // optimization hint; set this if there is full alpha at every pixel in the result rect + PF_Boolean reserved; + PF_RenderOutputFlags flags; // RETURNS_EXTRA_PIXELS, other things later + + void* pre_render_data; // will be passed back to render + PF_DeletePreRenderDataFunc delete_pre_render_data_func; // and eventually passed to this function for deletion, if set + + } PF_PreRenderOutput; + +typedef struct { + PF_LRect result_rect; // the rectangle actually available from this request (can be empty) + PF_LRect max_result_rect; // the maximum size the output could possibly be, if AE asked for all of it + PF_RationalScale par; // aspect ratio of pixels + PF_Boolean solid; // boolean; true if result has full alpha throughout result rect + PF_Boolean reservedB[3]; + A_long ref_width; // original size of layer, pre-effects (without DSF, comp size for collapsed layers) + A_long ref_height; + A_long reserved[6]; + } PF_CheckoutResult; + + + typedef struct { + + PF_Err (*checkout_layer)( + PF_ProgPtr effect_ref, // reference from in_data + PF_ParamIndex index, // 0 = input, 1..n = param + A_long checkout_idL, // chosen by effect, must be >=0 and unique + const PF_RenderRequest *req, + A_long what_time, + A_long time_step, + A_u_long time_scale, + PF_CheckoutResult *checkout_result); // out + + PF_Err (*GuidMixInPtr)( + PF_ProgPtr effect_ref, // reference from in_data + //const PF_RenderRequest *req, + A_u_long buf_sizeLu, /* >> size of buffer to mix into guid */ + const void *buf ); + + } PF_PreRenderCallbacks; + + // This is passed as the extra parameter to PF_Cmd_PRE_RENDER when an effect is using the pre-render interface. + // Effect must fill out output. + typedef struct { + PF_PreRenderInput *input; + PF_PreRenderOutput *output; + PF_PreRenderCallbacks *cb; + } PF_PreRenderExtra; + + typedef struct { + PF_RenderRequest output_request; // what the effect is being asked to render + short bitdepth; // bitdepth the effect is being driven in (in bpc) + void *pre_render_data;// passed back from value placed in extra->output->pre_render_data during PF_Cmd_PRE_RENDER + const void *gpu_data; + PF_GPU_Framework what_gpu; + A_u_long device_index; // For use in conjunction with PrSDKGPUDeviceSuite + } PF_SmartRenderInput; + + typedef struct { + + PF_Err (*checkout_layer_pixels)( + PF_ProgPtr effect_ref, // reference from in_data + A_long checkout_idL, // passed during checkout_layer + PF_EffectWorld **pixels); // out, valid for duration of current command or until checked in + + PF_Err (*checkin_layer_pixels)( // not strictly necessary to call, but useful to free up memory early + PF_ProgPtr effect_ref, + A_long checkout_idL); + + PF_Err (*checkout_output)( + PF_ProgPtr effect_ref, // reference from in_data + PF_EffectWorld **output); // out + + } PF_SmartRenderCallbacks; + + // Passed as extra param during PF_Cmd_SMART_RENDER + typedef struct { + PF_SmartRenderInput *input; + PF_SmartRenderCallbacks *cb; + } PF_SmartRenderExtra; + + + /** -------------------- GPU Setup/Setdown Constants and Structures -------------------- + + PF_Cmd_GPU_DEVICE_SETUP gets a PF_GPUDeviceSetupExtra struct in the extra pointer. + + PF_Cmd_GPU_DEVICE_SETDOWN gets a PF_GPUDeviceSetdownExtra struct in the extra pointer. + + */ + + + typedef struct { + PF_GPU_Framework what_gpu; + A_u_long device_index; // For use in conjunction with PrSDKGPUDeviceSuite + } PF_GPUDeviceSetupInput; + + typedef struct { + void *gpu_data; // effect owned pointer. + } PF_GPUDeviceSetupOutput; + + typedef struct { + PF_GPUDeviceSetupInput *input; + PF_GPUDeviceSetupOutput *output; + } PF_GPUDeviceSetupExtra; + + + + typedef struct { + void *gpu_data; // effect must dispose. + PF_GPU_Framework what_gpu; + A_u_long device_index; // For use in conjunction with PrSDKGPUDeviceSuite + } PF_GPUDeviceSetdownInput; + + typedef struct { + PF_GPUDeviceSetdownInput *input; + } PF_GPUDeviceSetdownExtra; + + + +/** -------------------- Interaction Callbacks -------------------- + + Effects modules use callbacks to define their parameters. When invoked, + they will be given the parameters values at the particular invocation + moment, but some effects may need to ask for the parameter values at + other times (notably of layer parameters for, say, a visual echo). + + While running, effects modules are responsible for checking for user + interrupts. This checking can be done with either the abort callback, + which will return a value indicating if the user has taken any action, + or with the progress callback, which performs user interrupt checking + just like the abort callback, and also displays a progress display. + + At the bottom of this section are macros for accessing these callback + routines. The first parameter to each macro is a pointer to a PF_InData + structure, defined below. This pointer will be passed to your effect. + + checkout_param + The checkout_param callback allows you to inquire param values at times + other than the current one, and allows you to access layer params other + than the default input layer and the output layer. See the notes on the + "params" structure at the end of this file. The PF_ParamDef you must + specify cannot point into the "params" array; the memory must exist else- + where, such as on the stack. + + If you checkout a layer parameter and the layer popup is currently set + to , the return value will be filled with zeros. You can check + the "data" pointer. If it is NULL, then the layer param is set to + and you should do something like faking an all alpha zero layer or some + such nonsense. IMPORTANT: Due to 13.5 threading changes, checking out + a layer param that is not inside of UPDATE_PARAMS_UI will return + a frame with black pixels to avoid render requests and possible deadlock. + In other selectors the actual render will be triggered as it did before. + + checkin_param + When you have called checkout_param, you must call checkin_param when you + are done, so After Effects can clean up after itself and you. This is + very important for smooth functioning and also to save memory where possible. + Once checked in, the fields in the PF_ParamDef will no longer be valid. + + add_param + When given the PARAMS_SETUP message, the effect will generally make a + series of calls to the add_param routine to define the interface that + the After Effects user will see. See the PF_ParamDefs defined above. + Currently you can only add params at the end, and only at PARAMS_SETUP + time. + + abort + Periodically, you should check if the user wants to interrupt the + current processing. The abort proc here will return non-zero if + the effects module should suspend its current processing. If you + call this routine and it returns a value other than zero, you should + return that value when your effect returns. That will let us know + if the effect completed rendering or not. + + progress + Alternatively, you may wish to display a progress bar while you are + processing the image. This routine combines the abort proc user + interrupt checking with code that will display a progress bar for + you. The current and total params represent a fraction (current/total) + that describes how far you are along in your processing. Current + should equal total when done. Additionally, this routine will return + non-zero if you should suspend/abort your current processing. You + should probably try not to call this too frequently (e.g. at every pixel). + It is better to call it, say, once per scanline, unless your filter is + really really slow. + +**/ + +typedef struct _PF_CustomUIInfo PF_CustomUIInfo; + + +typedef struct { + // IMPORTANT: This structure is FROZEN. Changing this would break binary compatibility with PF_InData + + PF_Err (*checkout_param)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_ParamIndex index, /* 0 = input, 1..n = param */ + A_long what_time, + A_long time_step, /* duration between frames in time_scale units */ + A_u_long time_scale, + PF_ParamDef *param); /* the param you've been waiting for... */ + + PF_Err (*checkin_param)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_ParamDef *param); + + PF_Err (*add_param)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_ParamIndex index, /* -1 = add to end */ + PF_ParamDefPtr def); + + PF_Err (*abort)( + PF_ProgPtr effect_ref); /* reference from in_data */ + + PF_Err (*progress)( + PF_ProgPtr effect_ref, /* reference from in_data */ + A_long current, + A_long total); + + PF_Err (*register_ui)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_CustomUIInfo *cust_info); + + PF_Err (*checkout_layer_audio)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_ParamIndex index, /* 0 = input, 1..n = param */ + A_long start_time, /* in time_scale units */ + A_long duration, /* in time_scale units */ + A_u_long time_scale, /* units/sec */ + PF_UFixed rate, /* unsigned! */ + A_long bytes_per_sample, + A_long num_channels, + A_long fmt_signed, /* non-zero for signed, zero for unsigned */ + PF_LayerAudio *audio); /* the LayerAudio you've been waiting for... */ + + PF_Err (*checkin_layer_audio)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_LayerAudio audio); + + PF_Err (*get_audio_data)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_LayerAudio audio, + PF_SndSamplePtr *data0, /* optional - packed array of samples, if stereo, left/right */ + A_long *num_samples0, /* optional */ + PF_UFixed *rate0, /* optional - unsigned! */ + A_long *bytes_per_sample0, /* optional */ + A_long *num_channels0, /* optional */ + A_long *fmt_signed0); /* optional - non-zero for signed, zero for unsigned */ + + void *reserved_str[3]; + + void *reserved[10]; + +} PF_InteractCallbacks; + + +#define PF_CHECKOUT_PARAM(IN_DATA, INDEX, TIME, STEP, SCALE, PARAM) \ + (*(IN_DATA)->inter.checkout_param)((IN_DATA)->effect_ref, \ + (INDEX), (TIME), (STEP), (SCALE), (PARAM)) + +#define PF_CHECKIN_PARAM(IN_DATA, PARAM) \ + (*(IN_DATA)->inter.checkin_param)((IN_DATA)->effect_ref, (PARAM)) + +#define PF_ADD_PARAM(IN_DATA, INDEX, DEF) \ + (*(IN_DATA)->inter.add_param)((IN_DATA)->effect_ref, (INDEX), (DEF)) + +#define PF_ABORT(IN_DATA) \ + (*(IN_DATA)->inter.abort)((IN_DATA)->effect_ref) + +#define PF_PROGRESS(IN_DATA, CURRENT, TOTAL) \ + (*(IN_DATA)->inter.progress)((IN_DATA)->effect_ref, (CURRENT), (TOTAL)) + +#define PF_REGISTER_UI(IN_DATA, CUST_INFO) \ + (*(IN_DATA)->inter.register_ui)((IN_DATA)->effect_ref, (CUST_INFO)) + +#define PF_CHECKOUT_LAYER_AUDIO(IN_DATA, INDEX, START_TIME, DURATION, SCALE, RATE, \ + BYTES_PER_SAMPLE, NUM_CHANNELS, FMT_SIGNED, AUDIO) \ + (*(IN_DATA)->inter.checkout_layer_audio)((IN_DATA)->effect_ref, \ + (INDEX), (START_TIME), (DURATION), (SCALE), (RATE), (BYTES_PER_SAMPLE), \ + (NUM_CHANNELS), (FMT_SIGNED), (AUDIO)) + +#define PF_CHECKIN_LAYER_AUDIO(IN_DATA, AUDIO) \ + (*(IN_DATA)->inter.checkin_layer_audio)((IN_DATA)->effect_ref, (AUDIO)) + +#define PF_GET_AUDIO_DATA(IN_DATA, AUDIO, DATA_0, NUM_SAMPLES_0, RATE_0, \ + BYTES_PER_SAMPLE_0, NUM_CHANNELS_0, FMT_SIGNED_0) \ + (*(IN_DATA)->inter.get_audio_data)((IN_DATA)->effect_ref, \ + (AUDIO), (DATA_0), (NUM_SAMPLES_0), (RATE_0), (BYTES_PER_SAMPLE_0), \ + (NUM_CHANNELS_0), (FMT_SIGNED_0)) + + +/** -------------------- Effect Parameter Blocks -------------------- + + The effects module itself is invoked with input and output blocks + of parameters for various messages that it needs to handle. The + output block (values returned from the effect to the program) and + the input block (values provided by the program for the edification + of the effect) are defined here. Discussion follows. + + The Output Block + + Most fields of the output block are only examined for changes after + certain commands have been sent to the effect module. Each field + below describes when it will be checked. + + my_version + This is the version number of your plug-in effect, not to be confused + with the version of the plug-in specification. Please set this + at PF_Cmd_GLOBAL_SETUP. + + name + This lets you override the name of the effect in the Time Layout and + in the Effect Controls windows when the effect is applied. The name from + the PiPL resource is always used in the Effect menu. This field is + checked after PF_Cmd_SEQUENCE_SETUP. You will almost always leave + this field empty. + + global_data + This is a Handle that you can allocate at PF_Cmd_GLOBAL_SETUP + time. It will be passed back to you verbatim in the input + parameter block for use later on. In PF_Cmd_GLOBAL_SETUP, + the global_data field in the Input Block may be set to a + flattened version of your global data, in which case you should + unflatten it, free the flat version, and set this field to the + unflattened new global data. + + It will be locked & unlocked for you automatically like sequence_data. + + num_params + The calling application will sanity check the num_params field + vs the times add_param is called. The implicit main + layer parameter MUST be included in the parameter count. Use the + num_params value in the in_data as a starting value (it will + include the implicit layer parameter). + Set this field when you get PF_Cmd_PARAMS_SETUP. + + sequence_data + This is a Handle that you can allocate (using PF_NEW_HANDLE) + at PF_Cmd_SEQUENCE_SETUP time. + It will be passed back to you in the input parameter block + for later use. + + WARNING: this handle is always locked for you before your plugin + is called, and the lock-state is restored on the way out. If you + have arbitrary data, your plugin can be called re-entrantly, so + if you have a lock/unlock inside your plugin, the handle will + become unlocked prematurely -- instead simply depend on the host + to lock & unlock your sequence data for you. Of course during + PF_Cmd_SEQUENCE_SETUP the handle you allocate will not be + locked unless you explicitly lock it at that time. + + The contents of this handle will be written out to + disk. If other handles hang off this block, you must specify the + PF_OutFlag_SEQUENCE_DATA_NEEDS_FLATTENING out flag when you get + the PF_Cmd_GLOBAL_SETUP command. You will then receive the + PF_Cmd_SEQUENCE_FLATTEN before your handle is written out. At that + time, you should create a flat version of the handle contents, + free the old unflat handle, and set this field to the flattened + version of the handle. Or after disposing, simply set to NULL + and nothing will be written to disk. + + You will receive a PF_Cmd_SEQUENCE_RESETUP + call to unflatten this handle (as well as to adjust the sequence + data to altered frame rates, etc). If your + sequence data can be flat or unflat, you should store its current + state along with the other data, and check that value in Resetup. + If the handle is flat, Resetup should unflatten it, free the flat + handle, and set this field to the new unflat usable handle. + + flat_sdata_size + OBSOLETE. Turns out, it was never used. Since the handle + set in sequence_data must be allocated using PF_NEW_HANDLE, + the host can find out the size of the handle without asking. + + frame_data + This is a Handle that you can allocated at PF_Cmd_FRAME_SETUP + time. It will be passed to you in the input parameters, as + with the global_data and the sequence_data. This will not + be written out to disk. There is no particular use for this. + Set this field in PF_Cmd_FRAME_SETUP, if you must. + + It will be locked & unlocked for you like sequence_data. + + width + height + origin + You set these fields at PF_Cmd_FRAME_SETUP time to indicate + that the output image will be larger than the input image. + You should set width and height to the size that you want the + output buffer to be. Set origin to the place that the + point (0,0) in the input should map to in the new larger + output. Thus, if you created a 5 pixel drop shadow up and left, + you would set origin to (5, 5). + + out_flags + out_flags2 + This field can be set to an OR-ed combination of the PF_OutFlag + and PF_OutFlag2 constants (don't mix them up!) to communicate + things to After Effects. This will be checked after every + command, but only certain flags are relevant at given times. + Check the PF_OutFlag constants above. + + return_msg + This is a message string (in C string format) that will be + interpreted as either an error message or a useful display + message (for instance, for handling PF_Cmd_ABOUT). Fill + this string with a message you want After Effects to report + to the user for you. It will come up in a simple dialog + with an OK button. Set the first byte of this string to '\0' + to indicate no string -- it is set that way upon entry. This + field is examined after every PF_Cmd. + + The Input Block + + Many parts of the input block are actually structures defined elsewhere + in this file, or in the companion file AE_EffectCB.h. See the documentation + where those structures are defined to understand their contents. + With any given PF_Cmd, only certain fields in the Input Block will + have valid values. Each field described below tells when it is valid. + + in_flags + in_flags2 + These are various flags indicating some boolean value to + the effect module. This is a combination of PF_InFlag values + OR-ed together. This is set for all commands, though most + flags make sense only at certain times. Usually this is + just a copy of the PiPL global flags. See PF_OutFlags and + PF_OutFlags2 above. + + inter + This is a structure defined above containing callbacks + related to user interaction. This has callbacks to add parameters, + to check if the user has interrupted the effect, to display + a progress bar, and to inquire parameter values outside of the + current moment. See the doc above. When each callback can + validly be executed is defined above. + + utils + This is a pointer to a block of useful graphical and mathematical + callbacks provided for the effects module. The documentation + for this block is in the AE_EffectCB.h file. This is a void *, + which can be confusing. See AE_EffectCB.h for macros to use these + functions. This pointer will be defined at all times. + + effect_ref + This is a opaque piece of data that needs to be passed to + most of the various callback routines. Don't worry about it. + + quality + This is set to one of the PF_Quality constants above to + describe the Quality currently chosen by the user. Ideally, + your effect should do a faster version with LO quality, and + a better, "broadcast"-able version with HI quality. Also, + some of the utility callbacks perform differently between + LO and HI quality. This is defined for all PF_Cmds related + to SEQUENCE and FRAME (obviously, including RENDER). + + version + This is the version of the effects spec with which you are + being invoked. This will not be defined until after GLOBAL_SETUP. + + serial_num + This is the serial number of the invoking application. + + appl_id + This is the identifier of the invoking application. It will + be the creator A_long of the app. + + freq + This is an estimate of the frequency with which you should + call the abort check callback. You can ignore this. + + num_params + This is set to the number of input parameters you are receiving. + + what_cpu + This is set to the return value from Gestalt asking what sort + of CPU your machine has. If your effect requires a certain + type of CPU it should check this value and return an error + indicating that it cannot run. After Effects only runs on + 68020s and higher, so don't sweat it if you require that. + + what_fpu + This is set to the return value from Gestalt asking what sort + of FPU your machine has. If you require a floating point unit, + you should return the OutFlag indicating that in GLOBAL_SETUP, + and then do not execute your floating point code if this value + is set to 0 -- just do a PF_COPY of the input to the output when + you get the PF_Cmd_RENDER. See OutFlag description above. + + current_time + This is the time of the current frame. It will be set in RENDER. + The number of the current frame is current_time / time_step. + All effects sequences start at time 0. + + time_step + This is the time difference to the next or last frame. This value + and current_time and total_time are in units given by time_scale. + The time between frames is time_step, not 1. This value will be 0 + at SEQUENCE_SETUP if it is not constant for all frames. It will + be set correctly in the FRAME calls, even if it's not constant. + + total_time + This is the amount of time from the start to the end of the + image sequence on which this effect is being invoked. The total + number of frames is total_time / time_step. + + time_scale + These are the units that current_time, time_step, and total_time + are in. See QuickTime for an explanation of how these time values work. + + width + height + These are the size of the input image. As Stoney Ballard points out, + these are certainly NOT the same as the width and height fields in param[0], + but rather reflect the full-resolution dimensions of the input layer. + + field + Will be set to PF_Field_UPPER or PF_Field_LOWER during field-rendering + if certain conditions are met -- for example: effect must have + PF_OutFlag_PIX_INDEPENDENT set, and the layer to which the effect is + applied must not be rotated, scaled nor positioned on a subpixel. + You can safely ignore the setting of this field, but might be able to + optimize things by only processing the specified field. + + extent_hint + This is a rectangle that indicates the intersection of the visible + portions of the input and output layers. For an effect that does + not do a geometric distortion of the image, copying just this rectangle + from the source image to the destination image is sufficient to copy + all the image data that the user will see. This can speed up effects + very much. Just iterate over only this rectangle of pixels. + + output_origin_x + output_origin_y + These fields correspond to the origin returned in the out_data at + PF_Cmd_FRAME_SETUP time. They indicate the position of the top left + corner of the input buffer in the output buffer. + + downsample_x + downsample_y + For speed, the user may have asked for only every Nth vertical or + horizontal pixel to be actually rendered by After Effects. The width + and height of all effect parameters (including layers) will be + automatically adjusted to compensate, but the effect needs to know + the downsampling factors to correctly interpret scalar parameters + (ie. sliders) that represent pixel distances in the image. + Downsample factors will be in the range 1 to 999+. This is set in + SEQUENCE_SETUP or RESETUP as the case may be. As of PF_PLUG_IN_VERSION 2, + this factor is a rational quantity. + + global_data + sequence_data + frame_data + These fields are copied from the out data on previous invocations + and set here for you to access as you need them. They will only + be set if they have been allocated during previous commands. + + pre_effect_source_origin_x + pre_effect_source_origin_y + These fields are the origin of the source image in the input buffer. They are set + only during frame calls (PF_Cmd_FRAME_SETUP, PF_Cmd_RENDER, PF_Cmd_FRAME_SETDOWN). + They will be non-zero only if one or more effects that preceded this effect + on the same layer resized the output buffer (i.e. specified that the output + image will be larger or smaller than the input image). + +**/ + + +typedef struct { + A_u_long my_version; /* version # for plug-in code */ + A_char name[PF_MAX_EFFECT_NAME_LEN + 1]; /* only used at seq setup to change */ + PF_Handle global_data; + A_long num_params; + PF_Handle sequence_data; + A_long flat_sdata_size;/* obsolete */ + PF_Handle frame_data; + A_long width; /* change if you want resized output */ + A_long height; + PF_Point origin; + PF_OutFlags out_flags; /* ORed combo of PF_OutFlag values */ + A_char return_msg[PF_MAX_EFFECT_MSG_LEN + 1]; + A_long start_sampL; /* used only for audio commands */ + A_long dur_sampL; /* used only for audio commands */ + PF_SoundWorld dest_snd; /* used only for audio commands */ + PF_OutFlags2 out_flags2; /* ORed combo of PF_OutFlag2 values */ +} PF_OutData; + + +typedef struct { + PF_InteractCallbacks inter; /* effect interaction related callbacks */ + struct _PF_UtilCallbacks *utils; /* utility callbacks -- see AE_EffectCB.h */ + PF_ProgPtr effect_ref; /* opaque value for callbacks */ + PF_Quality quality; /* quality user has selected */ + PF_SpecVersion version; + A_long serial_num; + A_long appl_id; + A_long num_params; + A_long reserved; + A_long what_cpu; /* return value from Gestalt asking CPU */ + A_long what_fpu; /* as above for FPU */ + A_long current_time; + A_long time_step; /* time diff between calls or to next call */ + A_long total_time; + A_long local_time_step;/* time step in local comp */ + A_u_long time_scale; /* units per second of time system */ + PF_Field field; /* if field is specified, other field may be garbage */ + PF_Fixed shutter_angle; /* motion blur shutter angle (range is 0 to 1) */ + A_long width; /* full resolution width of source layer */ + A_long height; /* full resolution height of source layer */ + PF_Rect extent_hint; /* intersection of input and output extents */ + A_long output_origin_x; /* origin of input buffer in output buffer */ + A_long output_origin_y; /* non-zero only when effect changes buffer size */ + PF_RationalScale downsample_x; + PF_RationalScale downsample_y; + PF_RationalScale pixel_aspect_ratio; /* h/v of pixel aspect ratio (NTSC D-1 -> 0.9) */ + PF_InFlags in_flags; + PF_Handle global_data; /* the data created by global_setup */ + PF_Handle sequence_data; /* data from sequence_setup */ + PF_Handle frame_data; /* data from frame_data -- state for this render */ + A_long start_sampL; /* used only for audio commands */ + A_long dur_sampL; /* used only for audio commands */ + A_long total_sampL; /* used only for audio commands */ + PF_SoundWorld src_snd; /* used only for audio commands */ + struct SPBasicSuite *pica_basicP; /* pointer to PICA basic suite. Enjoy! */ + A_long pre_effect_source_origin_x; /* origin of original source in input buffer */ + A_long pre_effect_source_origin_y; /* non-zero only during frame calls (setup, render, setdown) + when effect follows an effect that resizes its output buffer */ + PF_Fixed shutter_phase; /* offset from frame time to shutter open time as a percentage of a frame */ +} PF_InData; + + +/** -------------------- Effect Prototype -------------------- + + The effects module provides a single entry point corresponding to the + below prototype through which all messages are dispatched to the + appropriate code. + + The cmd parameter is one of the PF_Cmd enumeration defined above. + All commands are discussed at that enumeration. There are a lot. + + The in_data and out_data parameters are respectively, PF_InData and + PF_OutData blocks defined and described above. The in_data contains + read only information that the effect can use. The out_data contains + write only information through which the effect communicates back to + the calling program. The descriptions above give a lot more detail. + + The params list is an array of pointers to variably sized PF_ParamDef + structs. This is in typical Unix-like argv format, where the last item + points to NULL. The entries in this array describe the current settings + of the parameters to the effect. Params[0] is the layer to which the + effect has been applied and is a PF_LayerDef param. Other parameters + are defined by the effect. + + The output param is also a PF_LayerDef param, like params[0], and is + an output buffer into which your effect should write the new contents + of the layer. + + A brief explanation about parameter passing to effects: + + When you are invoked to Render, all "params" array entries will be filled + with their value at the current time, except for layer params other than + the default input layer parameter (ie. param[0]). To get other layer param + values, you must call the checkout_param callback. (See callbacks above.) + + In other words, on PF_Cmd_RENDER, params[0] will be a valid ready-to-use + PF_EffectWorld and output will be a valid ready-to-use PF_EffectWorld. Other params that + are not layer params (i.e. sliders, popups, etc.) will be ready-to-use, filled + with their value at the current time; you do not need to call checkout_param for + them. However, other params (besides [0]) that are layer params will NOT be + filled in correctly -- you must make a checkout_param callback to get them. + + ANY param which you call checkout_param on, you must also call checkin_param + before you exit. If not, After Effects will automatically erase your effect + module code resource from the users hard disk, along with any files that contain + your name or any nicknames you have. Sorry. Calling checkin_param is important! + +**/ + +typedef PF_Err (*PF_FilterProc)( + PF_Cmd cmd, + PF_InData *in_data, + PF_OutData *out_data, + PF_ParamList params, + PF_LayerDef *output, + void *extra); + + +#ifdef __cplusplus +} // end extern "C" +#endif + + + +#include + + +#endif /* _H_AE_Effect */ + diff --git a/External/AE SDK/Headers/AE_EffectCB.h b/External/AE SDK/Headers/AE_EffectCB.h new file mode 100644 index 00000000..c5c0360f --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectCB.h @@ -0,0 +1,1223 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + +/** AE_EffectCB.h + + Part of the After Effects SDK + + NOTES + This file describes utility functions and macros for accessing + those utilities that are provided to every filter. These functions + provide graphical tools, mathematical utilities, and other basic + library functions. + + An effect will want to use these callbacks for three primary reasons: + + 1) The mathematical and graphics callbacks will be efficiently + implemented, and will adaptively take advantage of any hardware + acceleration transparent to the effects module. + 2) The callbacks will maximize portability of the effect code + and consistency of results from platform to platform and from + effect to effect. + 3) The callbacks will simplify construction of complex filters, + both making filters easier to write and resulting in smaller + code for each filter. + + The After Effects standard for routine parameters is to list input + parameters first, then list parameters whose contents will be modified, + and then pass output parameters whose old value will be completely + replaced. Large or significant params tend to be listed earlier within + their segment. Most callbacks we provide follow this standard, so with a + convolution callback, we generally would order parameters: + convolve(src_world, convolution_details, dst_world) + However, not all Mac routines follow this, so to be easily + brain-compatible with Mac programmers, we structure some routines + (actually just CopyBits) that we provide to be as much like the + corresponding Mac routine as possible. + +**/ + +#ifndef _H_AE_EffectCB +#define _H_AE_EffectCB + + +#include + +#include + +#ifdef __cplusplus + extern "C" { +#endif + + +/** ---------- Useful Constants ---------- **/ + +#define PF_PI 3.14159265358979323846 +#define PF_2PI 6.28318530717958647692 +#define PF_HALF_PI 1.57079632679489661923 +#define PF_E 2.7182818284590452354 +#define PF_SQRT2 1.41421356237309504880 +#define PF_RAD_PER_DEGREE 0.01745329251994329576 + + + +/** ---------- PF_KernelFlags ---------- + + Many functions work with "kernels" or matrices of values. These matrices + can be of different types, of different arrangements, and can be generated + or treated in different ways. The KernelFlags are used in a variety of + functions to determine how the matrices should be created and used. You + should OR together any flags you need. Which flags are relevant for a + given routine are documented along with the prototype for the routine below. + + The most important information to consider is the type of data. + You will have to choose whether to use Fixeds, Chars, or Longs. + See the information on the USE_... flags below. + + Note, the default for each flag is listed first and passing zero for + the flags parameter will automatically get you the defaults. + + ??? Some of the non-default parameters may not be implemented. Where + a flag is not implemented it will be commented with ??? beside it. + +**/ + +/* pass bottom flag for 1 dimensional kernel, or top for 2D kernel */ +#define PF_KernelFlag_2D 0 +#define PF_KernelFlag_1D (1L << 0) + +/* pass bottom flag to equalize kernel, forcing the volume under the + * kernel surface to be the same as the volume under the covered area + * of pixels. Otherwise, it will be unnormalized. + */ +#define PF_KernelFlag_UNNORMALIZED 0 +#define PF_KernelFlag_NORMALIZED (1L << 1) + +/* use the first flag to force values to be clamped into their valid + * range (that is determined by the type of item (A_char, fixed, A_long). + */ +#define PF_KernelFlag_CLAMP 0 +#define PF_KernelFlag_NO_CLAMP (1L << 2) + +/* pass the first flag to treat kernel as an array of longs valued from 0 to 255. + * pass the second to treat kernel as an array of unsigned chars from 0 to 255, + * pass the third to treat kernel as an array of Fixeds from 0 to 1. + * ??? NOTE! For now, only USE_LONG is implemented! ??? + */ +#define PF_KernelFlag_USE_LONG 0 +#define PF_KernelFlag_USE_CHAR (1L << 3) +#define PF_KernelFlag_USE_FIXED (1L << 4) +#define PF_KernelFlag_USE_UNDEFINED ((1L << 4) | (1L << 3)) + +/* pass the top flag to apply a 1D convolution horizontally, + * the second to apply it vertically. + */ +#define PF_KernelFlag_HORIZONTAL 0 +#define PF_KernelFlag_VERTICAL (1L << 5) + +/* pass the second flag to replicate border pixels when sampling + * off the edge; pass the first flag to treat pixels off the + * edge as alpha zero (black). ??? NOTE! The replicate borders + * flag is unimplemented and this will be ignored. ??? + */ +#define PF_KernelFlag_TRANSPARENT_BORDERS 0 +#define PF_KernelFlag_REPLICATE_BORDERS (1L << 6) + +/* top flag indicates straight convolution, second tells the + * convolution code to alpha-weight the contributions of pixels + * to the resulting convolved output. ??? NOTE! The alpha weighted + * convolve is not implemented and this will be ignored. ??? + */ +#define PF_KernelFlag_STRAIGHT_CONVOLVE 0 +#define PF_KernelFlag_ALPHA_WEIGHT_CONVOLVE (1L << 7) + +typedef A_u_long PF_KernelFlags; + + + +/** ---------- PF_SampleEdgeBehav ---------- + + The sampling routines always deal with 32 bit images, and thus + need to compute properly alpha-weighted samples. An issue arises + when an attempt is made to sample outside of the image content area. + + Before PF_PLUG_IN_VERSION 2, After Effects always treated pixels + outside of the image content area as having alpha = 0, which is desirable + in many cases. Distortions and other effects may want different sampling + behaviors, however, hence the PF_SampleEdgeBehav. + + +**/ + +enum { + PF_SampleEdgeBehav_ZERO = 0L /* Treat pixels outside image as alpha 0; + * Default behavior in After Effects 1.x */ +/* Sorry, not supported! + PF_SampleEdgeBehav_REPEAT = 1L, // Samples are clamped to nearest edge + PF_SampleEdgeBehav_WRAP = 2L // Image wraps around horizontally and vertically +*/ + +}; + +typedef A_u_long PF_SampleEdgeBehav; + +enum { + PF_Xfer_NONE = -1, + PF_Xfer_COPY, + PF_Xfer_BEHIND, + PF_Xfer_IN_FRONT, + PF_Xfer_DISSOLVE, + PF_Xfer_ADD, + PF_Xfer_MULTIPLY, + PF_Xfer_SCREEN, + PF_Xfer_OVERLAY, + PF_Xfer_SOFT_LIGHT, + PF_Xfer_HARD_LIGHT, + PF_Xfer_DARKEN, + PF_Xfer_LIGHTEN, + PF_Xfer_DIFFERENCE, // original < PS5.5 Difference + PF_Xfer_HUE, + PF_Xfer_SATURATION, + PF_Xfer_COLOR, + PF_Xfer_LUMINOSITY, + PF_Xfer_MULTIPLY_ALPHA, // dest alpha *= src alpha + PF_Xfer_MULTIPLY_ALPHA_LUMA, // dest alpha *= src luminance + PF_Xfer_MULTIPLY_NOT_ALPHA, // dest alpha *= ~(src alpha) + PF_Xfer_MULTIPLY_NOT_ALPHA_LUMA, // dest alpha *= ~(src luminance) + PF_Xfer_ADDITIVE_PREMUL, + PF_Xfer_ALPHA_ADD, + PF_Xfer_COLOR_DODGE, // original < PS5.5 Color Dodge + PF_Xfer_COLOR_BURN, // original < PS5.5 Color Burn + PF_Xfer_EXCLUSION, + + PF_Xfer_DIFFERENCE2, // PS >= 6.0, PDF 1.4 Difference + PF_Xfer_COLOR_DODGE2, // PS >= 6.0, PDF 1.4 Color Dodge + PF_Xfer_COLOR_BURN2, // PS >= 6.0, PDF 1.4 Color Burn + + PF_Xfer_LINEAR_DODGE, + PF_Xfer_LINEAR_BURN, + PF_Xfer_LINEAR_LIGHT, + PF_Xfer_VIVID_LIGHT, + PF_Xfer_PIN_LIGHT, + + PF_Xfer_HARD_MIX, + + PF_Xfer_LIGHTER_COLOR, // new in AE8 + PF_Xfer_DARKER_COLOR, + + PF_Xfer_SUBTRACT, // new in AE10 + PF_Xfer_DIVIDE, + + PF_Xfer_RESERVED0, // private/useless + PF_Xfer_RESERVED1, // ditto + + PF_Xfer_NUM_MODES +}; +typedef A_long PF_TransferMode; +typedef PF_TransferMode PF_XferMode; + +// obsolete xfer mode names +enum { + PF_Xfer_TINT = PF_Xfer_LINEAR_DODGE, + PF_Xfer_SHADE = PF_Xfer_LINEAR_BURN, + PF_Xfer_INTENSE_LIGHT = PF_Xfer_VIVID_LIGHT +}; + +typedef struct { + PF_TransferMode xfer; + A_long rand_seed; // for PF_Xfer_DISSOLVE_RANDOMIZED + A_u_char opacity; // 0 - 255 + PF_Boolean rgb_only; // ignored for PF_Xfer_MULTIPLY_ALPHA modes + A_u_short opacitySu; // for deep color only +} PF_CompositeMode; + + + +#define PF_TransferMode_ZERO_SRC_ALPHA_CLEARS_DST_ALPHA(TMODE) \ + ((TMODE) == PF_Xfer_MULTIPLY_ALPHA || \ + (TMODE) == PF_Xfer_MULTIPLY_ALPHA_LUMA) + + +// PF_TransferMode_ZERO_ALPHA_NOP is deprecated because it was +// confusing -- you probably want PF_TransferMode_ZERO_SRC_ALPHA_CLEARS_DST_ALPHA +// instead + +// WARNING: this macro is incorrect for PF_Xfer_COPY (returns true), but it's been like this for so long +// that we are leaving it unchanged so as not to create bugs by changing it. +#define PF_TransferMode_ZERO_SRC_ALPHA_LEAVES_DST_UNCHANGED(TMODE) \ + (((TMODE) == PF_Xfer_MULTIPLY_ALPHA || \ + (TMODE) == PF_Xfer_MULTIPLY_ALPHA_LUMA || \ + (TMODE) == PF_Xfer_ADDITIVE_PREMUL) == 0) + +enum { + PF_MaskFlag_NONE = 0, /* just use the alpha, thank you */ + PF_MaskFlag_INVERTED = 1L << 0, /* invert the result of the mask */ + PF_MaskFlag_LUMINANCE = 1L << 1 /* use the luminance values */ + +}; + + +typedef A_long PF_MaskFlags; + + +typedef struct { + + PF_EffectWorld mask; + PF_Point offset; + PF_MaskFlags what_is_mask; + +} PF_MaskWorld; + + +/** ---------- PF_SampPB ---------- + + There are calls to sample an a non-integral point in an image, + and to sample an area of an image. This parameter block describes + some information needed for these image resampling routines. + +**/ +typedef struct { + + /* parameters needed for single point or area sample */ + + PF_Fixed x_radius; /* radii are used for area sample, 0 for point sample */ + PF_Fixed y_radius; + PF_Fixed area; /* must fit in a Fixed; must be correct */ + PF_EffectWorld *src; /* the world to sample from */ + PF_SampleEdgeBehav samp_behave; + A_long allow_asynch; /* It's okay if I don't get the result until end_sampling */ + + + /* parameters needed for batch sampling & compositing, motion blur, etc. */ + + A_long motion_blur; /* requires pointer to 2 starting points and 2 dxdy's */ + PF_CompositeMode comp_mode; /* compositing mode info */ + PF_PixelPtr mask0; /* per-pixel extra masking, before xfer mode */ + + A_u_char *fcm_table; + A_u_char *fcd_table; + A_long reserved[8]; /* Set to zero at beginsampling */ + +} PF_SampPB; + + +/** ---------- Callback Selectors ---------- + + Some callbacks have different high and low quality versions. + The parameter block of function pointers will automatically + be filled with the appropriate versions for the current quality + setting, but some filters may wish to override this and access + a callback of different quality. To do this, a get_callback_addr + callback is provided which will take a callback selector and a + desired quality and return the callback of that quality. The + selectors for the various callbacks are listed here. Also, a + typedef for the function pointer that will be returned is given. + +**/ + +enum { + PF_Callback_NONE = 0, + PF_Callback_BEGIN_SAMPLING, + PF_Callback_SUBPIXEL_SAMPLE, + PF_Callback_AREA_SAMPLE, + PF_Callback_OBSOLETE0, + PF_Callback_END_SAMPLING, + PF_Callback_COMPOSITE_RECT, + PF_Callback_BLEND, + PF_Callback_CONVOLVE, + PF_Callback_COPY, + PF_Callback_FILL, + PF_Callback_GAUSSIAN, + PF_Callback_ITERATE, + PF_Callback_PREMUL, + PF_Callback_PREMUL_COLOR, + PF_Callback_RGB_TO_HLS, + PF_Callback_HLS_TO_RGB, + PF_Callback_RGB_TO_YIQ, + PF_Callback_YIQ_TO_RGB, + PF_Callback_LUMINANCE, + PF_Callback_HUE, + PF_Callback_LIGHTNESS, + PF_Callback_SATURATION, + PF_Callback_NEW_WORLD, + PF_Callback_DISPOSE_WORLD, + PF_Callback_ITERATE_ORIGIN, + PF_Callback_ITERATE_LUT, + PF_Callback_TRANSFER_RECT, + PF_Callback_TRANSFORM_WORLD, + PF_Callback_ITERATE_ORIGIN_NON_CLIP_SRC, + PF_Callback_ITERATE_GENERIC, + PF_Callback_SUBPIXEL_SAMPLE16, + PF_Callback_AREA_SAMPLE16, + PF_Callback_FILL16, + PF_Callback_PREMUL_COLOR16, + PF_Callback_ITERATE16, + PF_Callback_ITERATE_ORIGIN16, + PF_Callback_ITERATE_ORIGIN_NON_CLIP_SRC16, + PF_Callback_ITERATE_GENERIC_NO_MAX_THREADS, + PF_Callback_ITERATE_NO_MAX_THREADS, + PF_Callback_ITERATE_ORIGIN_NO_MAX_THREADS, + PF_Callback_ITERATE_ORIGIN_NON_CLIP_SRC_NO_MAX_THREADS, + PF_Callback_ITERATE16_NO_MAX_THREADS, + PF_Callback_ITERATE_ORIGIN16_NO_MAX_THREADS, + PF_Callback_ITERATE_ORIGIN_NON_CLIP_SRC16_NO_MAX_THREADS, +}; +typedef A_long PF_CallbackID; + +/** + Previous versions of PF_CallbackFunc were defined using varargs in attempt to enforce + the effect_ref passed as the first argument to all callbacks. The actual host + implementations are generally *not* varargs, and on some platforms the calling + conventions between normal C ABI and C varargs ABI are not compatible. If your + code is trying to call through a PF_CallbackFunc it is unsafe; with this definition + it will now no longer compile. To fix, cast to the proper API signature before + calling. Or better, use the extensive Suite implementations which are explicitly typed +**/ + +typedef struct PF_YouMustCastThisToActualFunctionType *PF_CallbackFunc; + +#define AEFX_MAX_PATH 260 + +enum { + PF_PlatData_MAIN_WND = 0, // windows only (output data => HWND) + PF_PlatData_EXE_FILE_PATH_DEPRECATED, // deprecated in CS6. Use _W versions below + PF_PlatData_RES_FILE_PATH_DEPRECATED, // deprecated in CS6. Use _W versions below + PF_PlatData_RES_REFNUM, // deprecated in AE 2015. Use PF_PlatData_BUNDLE_REF instead + PF_PlatData_RES_DLLINSTANCE, // windows only (output data => HANDLE) + PF_PlatData_SP_PLUG_REF, // unimplemented + PF_PlatData_BUNDLE_REF, // mac only (output data => CFBundleRef) + PF_PlatData_EXE_FILE_PATH_W, // mac and windows (output data => A_UTF16Char[AEFX_MAX_PATH]) + PF_PlatData_RES_FILE_PATH_W //// mac and windows (output data => A_UTF16Char[AEFX_MAX_PATH]) +}; + +typedef A_long PF_PlatDataID; + + +/** ---------- Image Plane Selectors ---------- + + These constants can be used to specify a subset + of the planes of the 32-bit image. + +**/ + +enum { + PF_Plane_ALPHA = 1, + PF_Plane_RED = 2, + PF_Plane_GREEN = 4, + PF_Plane_BLUE = 8 +}; +typedef A_u_long PF_Plane; + + +/** ---------- ANSI Routines Block ---------- + + Within the callback routines block there is a block of ANSI + routines, so that the filter will not need to link with the + ANSI library. The following structure describes that block + and is included in the larger Callback Routines block below. + + All angles are expressed in radians; use PF_RAD_PER_DEGREE + to convert from degrees to radians, if necessary. Be aware + that angle parameter types use degrees (in fixed point). + + Sprintf and strcpy are provided to facilitate string usage, + such as printing for names and supervised controls. + + None of these callbacks vary based on the Quality setting. + +**/ + +typedef struct { + A_FpLong (*atan)(A_FpLong); + A_FpLong (*atan2)(A_FpLong y, A_FpLong x); /* returns atan(y/x) - note param order! */ + A_FpLong (*ceil)(A_FpLong); /* returns next int above x */ + A_FpLong (*cos)(A_FpLong); + A_FpLong (*exp)(A_FpLong); /* returns e to the x power */ + A_FpLong (*fabs)(A_FpLong); /* returns absolute value of x */ + A_FpLong (*floor)(A_FpLong); /* returns closest int below x */ + A_FpLong (*fmod)(A_FpLong x, A_FpLong y); /* returns x mod y */ + A_FpLong (*hypot)(A_FpLong x, A_FpLong y); /* returns sqrt(x*x + y*y) */ + A_FpLong (*log)(A_FpLong); /* returns natural log of x */ + A_FpLong (*log10)(A_FpLong); /* returns log base 10 of x */ + A_FpLong (*pow)(A_FpLong x, A_FpLong y); /* returns x to the y power */ + A_FpLong (*sin)(A_FpLong); + A_FpLong (*sqrt)(A_FpLong); + A_FpLong (*tan)(A_FpLong); + + int (*sprintf)(A_char *, const A_char *, ...); + A_char * (*strcpy)(A_char *, const A_char *); + + A_FpLong (*asin)(A_FpLong); + A_FpLong (*acos)(A_FpLong); + + A_long ansi_procs[1]; +} PF_ANSICallbacks; + + + +/** ---------- Colorspace Conversion Callbacks + ** + **/ + +typedef struct { + PF_Err (*RGBtoHLS)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + PF_HLS_Pixel hls); + + PF_Err (*HLStoRGB)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_HLS_Pixel hls, + PF_Pixel *rgb); + + PF_Err (*RGBtoYIQ)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + PF_YIQ_Pixel yiq); + + PF_Err (*YIQtoRGB)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_YIQ_Pixel yiq, + PF_Pixel *rgb); + + PF_Err (*Luminance)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + A_long *lum100); /* << 100 * luminance */ + + PF_Err (*Hue)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + A_long *hue); /* << 0-255 maps to 0-360 */ + + PF_Err (*Lightness)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + A_long *lightness); /* << goes from 0-255 */ + + PF_Err (*Saturation)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + A_long *saturation); /* << goes from 0-255 */ + +} PF_ColorCallbacks; + + + +typedef void * PF_BatchSampleFunc; /* <<> see comment above !! */ + A_long xL, /* >> */ + A_long yL, /* >> */ + PF_Pixel *inP, /* <> */ + PF_Pixel *outP); /* <> */ + +typedef PF_Err (*PF_IteratePixel16Func) ( void* refconP, /* >> see comment above !! */ + A_long xL, /* >> */ + A_long yL, /* >> */ + PF_Pixel16 *inP, /* <> */ + PF_Pixel16 *outP); /* <> */ + +typedef PF_Err (*PF_IteratePixelFloatFunc) ( void* refconP, /* >> see comment above !! */ + A_long xL, /* >> */ + A_long yL, /* >> */ + PF_PixelFloat *inP, /* <> */ + PF_PixelFloat *outP); /* <> */ + + +typedef struct _PF_UtilCallbacks { + PF_Err (*begin_sampling)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Quality qual, + PF_ModeFlags mf, + PF_SampPB *params); + + PF_Err (*subpixel_sample)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel *dst_pixel); + + PF_Err (*area_sample)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel *dst_pixel); + + void *get_batch_func_is_deprecated; + + PF_Err (*end_sampling)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Quality qual, + PF_ModeFlags mf, + PF_SampPB *params); + + PF_Err (*composite_rect)( + PF_ProgPtr effect_ref, /* from in_data */ + PF_Rect *src_rect, /* rectangle in source image */ + A_long src_opacity, /* opacity of src */ + PF_EffectWorld *source_wld, /* src PF world */ + A_long dest_x, /* upper left-hand corner of src rect...*/ + A_long dest_y, /* ... in composite image */ + PF_Field field_rdr, /* which scanlines to render (all, upper, lower) */ + PF_XferMode xfer_mode, /* Copy, Composite Behind, Composite In Front */ + PF_EffectWorld *dest_wld); /* Destination buffer. Already filled */ + + PF_Err (*blend)( + PF_ProgPtr effect_ref, /* reference from in_data */ + const PF_EffectWorld *src1, + const PF_EffectWorld *src2, + PF_Fixed ratio, /* 0 == full src1, 0x00010000 == full src2 */ + PF_EffectWorld *dst); + + PF_Err (*convolve)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + PF_KernelFlags flags, + A_long kernel_size, + void *a_kernel, + void *r_kernel, + void *g_kernel, + void *b_kernel, + PF_EffectWorld *dst); + + PF_Err (*copy)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + PF_EffectWorld *dst, + PF_Rect *src_r, /* pass NULL for whole world */ + PF_Rect *dst_r); /* pass NULL for whole world */ + + PF_Err (*fill)( + PF_ProgPtr effect_ref, /* reference from in_data */ + const PF_Pixel *color, + const PF_Rect *dst_rect, /* pass NULL for whole world */ + PF_EffectWorld *world); + + PF_Err (*gaussian_kernel)( + PF_ProgPtr effect_ref, /* reference from in_data */ + A_FpLong kRadius, /* desired gaussian radius */ + PF_KernelFlags flags, /* see kernel flags commented above */ + A_FpLong multiplier, + A_long *diameter, + void *kernel); + + PF_Err (*iterate)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + void* refcon, + PF_IteratePixel8Func pix_fn, + PF_EffectWorld *dst); + + PF_Err (*premultiply)( + PF_ProgPtr effect_ref, /* reference from in_data */ + A_long forward, /* TRUE means convert non-premul to premul, FALSE mean reverse */ + PF_EffectWorld *dst); + + PF_Err (*premultiply_color)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + const PF_Pixel *color, /* color to premultiply/unmultiply with */ + A_long forward, /* TRUE means convert non-premul to premul, FALSE mean reverse */ + PF_EffectWorld *dst); + + PF_Err (*new_world)( + PF_ProgPtr effect_ref, /* reference from in_data */ + A_long width, + A_long height, + PF_NewWorldFlags flags, /* should would be pre-cleared to zeroes */ + PF_EffectWorld *world); /* always 32 bit */ + + PF_Err (*dispose_world)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *world); + + PF_Err (*iterate_origin)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + const PF_Point *origin, + void* refcon, + PF_IteratePixel8Func pix_fn, + PF_EffectWorld *dst); + + PF_Err (*iterate_lut)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + A_u_char *a_lut0, /* pass NULL for identity */ + A_u_char *r_lut0, /* pass NULL for identity */ + A_u_char *g_lut0, /* pass NULL for identity */ + A_u_char *b_lut0, /* pass NULL for identity */ + PF_EffectWorld *dst); + + + PF_Err (*transfer_rect)( + PF_ProgPtr effect_ref, + PF_Quality quality, + PF_ModeFlags m_flags, + PF_Field field, + const PF_Rect *src_rec, + const PF_EffectWorld *src_world, + const PF_CompositeMode *comp_mode, + const PF_MaskWorld *mask_world0, + A_long dest_x, + A_long dest_y, + PF_EffectWorld *dst_world); + + PF_Err (*transform_world)( + PF_ProgPtr effect_ref, + PF_Quality quality, + PF_ModeFlags m_flags, + PF_Field field, + const PF_EffectWorld *src_world, + const PF_CompositeMode *comp_mode, + const PF_MaskWorld *mask_world0, + const PF_FloatMatrix *matrices, + A_long num_matrices, + PF_Boolean src2dst_matrix, + const PF_Rect *dest_rect, + PF_EffectWorld *dst_world); + + PF_Handle (*host_new_handle)( + A_u_longlong size); + + void * (*host_lock_handle)( + PF_Handle pf_handle); + + void (*host_unlock_handle)( + PF_Handle pf_handle); + + void (*host_dispose_handle)( + PF_Handle pf_handle); + + PF_Err (*get_callback_addr)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Quality quality, + PF_ModeFlags mode_flags, + PF_CallbackID which_callback, + PF_CallbackFunc *fn_ptr); + + PF_Err (*app)(PF_ProgPtr, A_long, ...); /* application specific callback */ + + PF_ANSICallbacks ansi; /* ANSI callback block, see above */ + PF_ColorCallbacks colorCB; /* colorspace conversion callbacks */ + + PF_Err (*get_platform_data)( + PF_ProgPtr effect_ref, + PF_PlatDataID which, + void *data); + + A_u_longlong (*host_get_handle_size)( + PF_Handle pf_handle); + + PF_Err (*iterate_origin_non_clip_src)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, + const PF_Point *origin, + void* refcon, + PF_IteratePixel8Func pix_fn, + PF_EffectWorld *dst); + + PF_Err (*iterate_generic)( + A_long iterationsL, /* >> */ // can be PF_Iterations_ONCE_PER_PROCESSOR + void *refconPV, /* >> */ + PF_Err (*fn_func)( void *refconPV, /* >> */ + A_long thread_indexL, // only call abort and progress from thread_indexL == 0. + A_long i, + A_long iterationsL)); // never sends PF_Iterations_ONCE_PER_PROCESSOR + + PF_Err (*host_resize_handle)( + A_u_longlong new_sizeL, /* >> */ + PF_Handle *handlePH); /* <> Handle Value May Change */ + + + PF_Err (*subpixel_sample16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel16 *dst_pixel); + + PF_Err (*area_sample16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel16 *dst_pixel); + + PF_Err (*fill16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + const PF_Pixel16 *color, + const PF_Rect *dst_rect, /* pass NULL for whole world */ + PF_EffectWorld *world); + + PF_Err (*premultiply_color16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + const PF_Pixel16 *color, /* color to premultiply/unmultiply with */ + A_long forward, /* TRUE means convert non-premul to premul, FALSE mean reverse */ + PF_EffectWorld *dst); + + PF_Err (*iterate16)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + void* refcon, + PF_IteratePixel16Func pix_fn, + PF_EffectWorld *dst); + + PF_Err (*iterate_origin16)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + const PF_Point *origin, + void* refcon, + PF_IteratePixel16Func pix_fn, + PF_EffectWorld *dst); + + PF_Err (*iterate_origin_non_clip_src16)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, + const PF_Point *origin, + void* refcon, + PF_IteratePixel16Func pix_fn, + PF_EffectWorld *dst); + + PF_Err (*get_pixel_data8)( + PF_EffectWorld *worldP, + PF_PixelPtr pixelsP0, // NULL to use data in PF_EffectWorld + PF_Pixel8 **pixPP); // will return NULL if depth mismatch + + PF_Err (*get_pixel_data16)( + PF_EffectWorld *worldP, + PF_PixelPtr pixelsP0, // NULL to use data in PF_EffectWorld + PF_Pixel16 **pixPP); // will return NULL if depth mismatch + + + // and we're done. all future expansion + // is thru suite mechanism. (for example, + // this is where you'll find the floating + // pt pixel callbacks) + A_long reserved[1]; + +} PF_UtilCallbacks; + + +/** ---------- Callback Access Macros ---------- + + Each of these macros _ASSUMES_ that the (PF_InData *) parameter to + the effects module was passed as a parameter named "in_data". I know + this is a heinous assumption, but the template code all declares the + parameter like that, and by making that assumption, I can simplify + all these macros very much. If you absolutely need to change the + name of that parameter, you will have to pick apart these macros and + invoke the callbacks by yourself. It's not too hard... + + For efficiency, most notably with the image resampling functions (i.e. + subpixel_sample and area_sample), you may wish to declare a local function + pointer and bypass these macros to avoid the multiple dereferences in + your inner loop. The sample code will show how to do this. + + The prototypes and comments about each function are given above in + the PF_UtilCallbacks structure definition. + +**/ +#define PF_BEGIN_SAMPLING(QUALITY, PARAMS) \ + (*in_data->utils->begin_sampling)( \ + in_data->effect_ref, (QUALITY), PF_MF_Alpha_STRAIGHT, (PARAMS)) + +#define PF_SUBPIXEL_SAMPLE(X, Y, PARAMS, DST_PXL) \ + (*in_data->utils->subpixel_sample)( \ + in_data->effect_ref, (X), (Y), (PARAMS), (DST_PXL)) + +#define PF_AREA_SAMPLE(X, Y, PARAMS, DST_PXL) \ + (*in_data->utils->area_sample)( \ + in_data->effect_ref, (X), (Y), (PARAMS), (DST_PXL)) + +#define PF_END_SAMPLING(QUALITY, PARAMS) \ + (*in_data->utils->end_sampling)( \ + in_data->effect_ref, (QUALITY), PF_MF_Alpha_STRAIGHT, (PARAMS)) + +#define PF_BLEND(SRC1, SRC2, RATIO, DST) \ + (*in_data->utils->blend)( \ + in_data->effect_ref, (SRC1), (SRC2), (RATIO), (DST)) + +#define PF_CONVOLVE(SRC, RCT_P, FLAGS, KRNL_SZ, AK, RK, GK, BK, DST) \ + (*in_data->utils->convolve)( \ + in_data->effect_ref, (SRC), (RCT_P), (FLAGS), (KRNL_SZ), (AK), (RK), (GK), (BK), (DST)) + +#define PF_COPY(SRC, DST, SRC_RECT, DST_RECT) \ + (*in_data->utils->copy)( \ + in_data->effect_ref, (SRC), (DST), (SRC_RECT), (DST_RECT)) + +#define PF_FILL(COLOR, DST_RECT, DST) \ + (*in_data->utils->fill)( \ + in_data->effect_ref, (COLOR), (DST_RECT), (DST)) + +#define PF_GAUSSIAN_KERNEL(K_RAD, FLAGS, MULT, DIAM, KERNEL) \ + (*in_data->utils->gaussian_kernel)( \ + in_data->effect_ref, (K_RAD), (FLAGS), (MULT), (DIAM), (KERNEL)) + +#define PF_ITERATE(PROG_BASE, PROG_FINAL, SRC, RCT_P, REFCON, PIX_FUNC, DST) \ + (*in_data->utils->iterate)( \ + in_data, (PROG_BASE), (PROG_FINAL), (SRC), (RCT_P), (REFCON), (PIX_FUNC), (DST)) + +#define PF_ITERATE16(PROG_BASE, PROG_FINAL, SRC, RCT_P, REFCON, PIX_FUNC, DST) \ + (*in_data->utils->iterate16)( \ + in_data, (PROG_BASE), (PROG_FINAL), (SRC), (RCT_P), (REFCON), (PIX_FUNC), (DST)) + +#define PF_PREMUL(FORWARD, DST) \ + (*in_data->utils->premultiply)( \ + in_data->effect_ref, (FORWARD), (DST)) + +#define PF_PREMUL_COLOR(SRC, COLOR, FORWARD, DST) \ + (*in_data->utils->premultiply_color)( \ + in_data->effect_ref, (SRC), (COLOR), (FORWARD), (DST)) + +#define PF_NEW_WORLD(WIDTH, HEIGHT, FLAGS, WORLD) \ + (*in_data->utils->new_world)( \ + in_data->effect_ref, (WIDTH), (HEIGHT), (FLAGS), (WORLD)) + +#define PF_DISPOSE_WORLD(WORLD) \ + (*in_data->utils->dispose_world)( \ + in_data->effect_ref, (WORLD)) + +#define PF_ITERATE_ORIGIN(PROG_BASE, PROG_FINAL, SRC, RCT_P, OR, REFCON, PIX_FUNC, DST) \ + (*in_data->utils->iterate_origin)( \ + in_data, (PROG_BASE), (PROG_FINAL), (SRC), (RCT_P), (OR), (REFCON), (PIX_FUNC), (DST)) + +#define PF_ITERATE_ORIGIN16(PROG_BASE, PROG_FINAL, SRC, RCT_P, OR, REFCON, PIX_FUNC, DST) \ + (*in_data->utils->iterate_origin16)( \ + in_data, (PROG_BASE), (PROG_FINAL), (SRC), (RCT_P), (OR), (REFCON), (PIX_FUNC), (DST)) + +#define PF_ITERATE_LUT(PROG_BASE, PROG_FINAL, SRC, RCT_P, A_LUT, R_LUT, G_LUT, B_LUT, DST) \ + (*in_data->utils->iterate_lut)( \ + in_data, (PROG_BASE), (PROG_FINAL), (SRC), (RCT_P), (A_LUT), \ + (R_LUT), (G_LUT), (B_LUT), (DST)) + +#define PF_TRANSFER_RECT(QUALITY, M_FLAGS, FIELD, SRC_REC, SRC_WORLD, COMP_MODE, \ + MASK_WORLD_0, DST_X, DST_Y, DST) \ + (*in_data->utils->transfer_rect)( \ + in_data->effect_ref, (QUALITY), (M_FLAGS), (FIELD), (SRC_REC), (SRC_WORLD), \ + (COMP_MODE), (MASK_WORLD_0), (DST_X), (DST_Y), (DST)) + +#define PF_TRANSFORM_WORLD(QUALITY, M_FLAGS, FIELD, SRC_WORLD, COMP_MODE, \ + MASK_WORLD_0, MATRICES, NUM_MATRICES, SRC2DST_MATRIX, \ + DST_RECT, DST) \ + (*in_data->utils->transform_world)( \ + in_data->effect_ref, (QUALITY), (M_FLAGS), (FIELD), (SRC_WORLD), \ + (COMP_MODE), (MASK_WORLD_0), (MATRICES), (NUM_MATRICES), (SRC2DST_MATRIX), \ + (DST_RECT), (DST)) + +#define PF_ITERATE_ORIGIN_NON_SRC_CLIP(PROG_BASE, PROG_FINAL, SRC, RCT_P, OR, REFCON, PIX_FUNC, DST) \ + (*in_data->utils->iterate_origin_non_clip_src)( \ + in_data, (PROG_BASE), (PROG_FINAL), (SRC), (RCT_P), (OR), (REFCON), (PIX_FUNC), (DST)) + + +#define PF_NEW_HANDLE(SIZE) \ + (*in_data->utils->host_new_handle)((SIZE)) + +#define PF_DISPOSE_HANDLE(PF_HANDLE) \ + (*in_data->utils->host_dispose_handle)((PF_Handle)(PF_HANDLE)) + +#define PF_LOCK_HANDLE(PF_HANDLE) \ + (*in_data->utils->host_lock_handle)((PF_Handle)(PF_HANDLE)) + +#define PF_UNLOCK_HANDLE(PF_HANDLE) \ + (*in_data->utils->host_unlock_handle)((PF_Handle)(PF_HANDLE)) + +#define PF_GET_HANDLE_SIZE(PF_HANDLE) \ + (*in_data->utils->host_get_handle_size)((PF_Handle)(PF_HANDLE)) + + +// Takes a pointer to a handle. Handle may change. 4.1 and later ONLY. +#define PF_RESIZE_HANDLE(NEW_SIZE, PF_HANDLE_P) \ + (*in_data->utils->host_resize_handle)((NEW_SIZE), (PF_Handle*)(PF_HANDLE_P)) + + + +#define PF_GET_PLATFORM_DATA(ID, DATA) \ + (*in_data->utils->get_platform_data)(in_data->effect_ref, (ID), (DATA)) + +#define PF_GET_PIXEL_DATA8(WORLDP, PIXELPTR0, PIXEL8PP) \ + (*in_data->utils->get_pixel_data8)((WORLDP), (PIXELPTR0), (PIXEL8PP)) + +#define PF_GET_PIXEL_DATA16(WORLDP, PIXELPTR0, PIXEL16PP) \ + (*in_data->utils->get_pixel_data16)((WORLDP), (PIXELPTR0), (PIXEL16PP)) + + + + +#define PF_ACOS(X) (*in_data->utils->ansi.acos)(X) +#define PF_ASIN(X) (*in_data->utils->ansi.asin)(X) +#define PF_ATAN(X) (*in_data->utils->ansi.atan)(X) +#define PF_ATAN2(Y, X) (*in_data->utils->ansi.atan2)((Y), (X)) +#define PF_CEIL(X) (*in_data->utils->ansi.ceil)(X) +#define PF_COS(X) (*in_data->utils->ansi.cos)(X) +#define PF_EXP(X) (*in_data->utils->ansi.exp)(X) +#define PF_FABS(X) (*in_data->utils->ansi.fabs)(X) +#define PF_FLOOR(X) (*in_data->utils->ansi.floor)(X) +#define PF_FMOD(X, Y) (*in_data->utils->ansi.fmod)((X), (Y)) +#define PF_HYPOT(X, Y) (*in_data->utils->ansi.hypot)((X), (Y)) +#define PF_LOG(X) (*in_data->utils->ansi.log)(X) +#define PF_LOG10(X) (*in_data->utils->ansi.log10)(X) +#define PF_POW(X, Y) (*in_data->utils->ansi.pow)((X), (Y)) +#define PF_SIN(X) (*in_data->utils->ansi.sin)(X) +#define PF_SQRT(X) (*in_data->utils->ansi.sqrt)(X) +#define PF_TAN(X) (*in_data->utils->ansi.tan)(X) + +/* This is kind of a hack to deal with the varargs params to sprintf */ + +#define PF_SPRINTF (*in_data->utils->ansi.sprintf) + +#define PF_STRCPY(DST, SRC) \ + (*in_data->utils->ansi.strcpy)((DST), (SRC)) + + + +#define PF_RGB_TO_HLS(RGB, HLS) \ + (*in_data->utils->colorCB.RGBtoHLS)(in_data->effect_ref, (RGB), (HLS)) + +#define PF_HLS_TO_RGB(HLS, RGB) \ + (*in_data->utils->colorCB.HLStoRGB)(in_data->effect_ref, (HLS), (RGB)) + +#define PF_RGB_TO_YIQ(RGB, YIQ) \ + (*in_data->utils->colorCB.RGBtoYIQ)(in_data->effect_ref, (RGB), (YIQ)) + +#define PF_YIQ_TO_RGB(YIQ, RGB) \ + (*in_data->utils->colorCB.YIQtoRGB)(in_data->effect_ref, (YIQ), (RGB)) + +#define PF_LUMINANCE(RGB, LUM100) \ + (*in_data->utils->colorCB.Luminance)(in_data->effect_ref, (RGB), (LUM100)) + +#define PF_HUE(RGB, HUE) \ + (*in_data->utils->colorCB.Hue)(in_data->effect_ref, (RGB), (HUE)) + +#define PF_LIGHTNESS(RGB, LIGHTNESS) \ + (*in_data->utils->colorCB.Lightness)(in_data->effect_ref, (RGB), (LIGHTNESS)) + +#define PF_SATURATION(RGB, SATURATION) \ + (*in_data->utils->colorCB.Saturation)(in_data->effect_ref, (RGB), (SATURATION)) + + + + +#ifdef __cplusplus + } // end extern "C" +#endif + + + +#include + + +#endif /* _H_AE_EffectCB */ diff --git a/External/AE SDK/Headers/AE_EffectCBSuites.h b/External/AE SDK/Headers/AE_EffectCBSuites.h new file mode 100644 index 00000000..901023fe --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectCBSuites.h @@ -0,0 +1,914 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + +#ifndef _H_AE_EffectCBSuites +#define _H_AE_EffectCBSuites + + +#include +#include +#include + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +// note: many of these suites are not SPAPI because they are shared with the +// old-style PF_UtilCallback definitions and we want calls to them to +// be object compatible + +#define kPFHandleSuite "PF Handle Suite" +#define kPFHandleSuiteVersion1 2 /* frozen in AE 10.0 */ + +//Keeping the same version for compatibility reasons but bumping the actual value for 64-bit SDK. Please define A_HandleSize +//as A_u_long to get the same suite working with 32-bit SDK. + +typedef struct PF_HandleSuite1 { + PF_Handle (*host_new_handle)( + A_HandleSize size); + + void * (*host_lock_handle)( + PF_Handle pf_handle); + + void (*host_unlock_handle)( + PF_Handle pf_handle); + + void (*host_dispose_handle)( + PF_Handle pf_handle); + + A_HandleSize (*host_get_handle_size)( + PF_Handle pf_handle); + + PF_Err (*host_resize_handle)( + A_HandleSize new_sizeL, /* >> */ + PF_Handle *handlePH); /* <> Handle Value May Change */ + +} PF_HandleSuite1; + + +#define kPFANSISuite "PF ANSI Suite" +#define kPFANSISuiteVersion1 1 /* frozen in AE 5.0 */ + +typedef struct PF_ANSICallbacksSuite1 { + A_FpLong (*atan)(A_FpLong); + A_FpLong (*atan2)(A_FpLong y, A_FpLong x); /* returns atan(y/x) - note param order! */ + A_FpLong (*ceil)(A_FpLong); /* returns next int above x */ + A_FpLong (*cos)(A_FpLong); + A_FpLong (*exp)(A_FpLong); /* returns e to the x power */ + A_FpLong (*fabs)(A_FpLong); /* returns absolute value of x */ + A_FpLong (*floor)(A_FpLong); /* returns closest int below x */ + A_FpLong (*fmod)(A_FpLong x, A_FpLong y); /* returns x mod y */ + A_FpLong (*hypot)(A_FpLong x, A_FpLong y); /* returns sqrt(x*x + y*y) */ + A_FpLong (*log)(A_FpLong); /* returns natural log of x */ + A_FpLong (*log10)(A_FpLong); /* returns log base 10 of x */ + A_FpLong (*pow)(A_FpLong x, A_FpLong y); /* returns x to the y power */ + A_FpLong (*sin)(A_FpLong); + A_FpLong (*sqrt)(A_FpLong); + A_FpLong (*tan)(A_FpLong); + + int (*sprintf)(A_char *, const A_char *, ...); + A_char * (*strcpy)(A_char *, const A_char *); + + A_FpLong (*asin)(A_FpLong); + A_FpLong (*acos)(A_FpLong); + +} PF_ANSICallbacksSuite1; + + +#define kPFPixelDataSuite "PF Pixel Data Suite" +#define kPFPixelDataSuiteVersion1 1 /* frozen in AE 7.0 */ + +typedef struct PF_PixelDataSuite1 { + + PF_Err (*get_pixel_data8)( + PF_EffectWorld *worldP, + PF_PixelPtr pixelsP0, // NULL to use data in PF_EffectWorld + PF_Pixel8 **pixPP); // will return NULL if depth mismatch + + PF_Err (*get_pixel_data16)( + PF_EffectWorld *worldP, + PF_PixelPtr pixelsP0, // NULL to use data in PF_EffectWorld + PF_Pixel16 **pixPP); // will return NULL if depth mismatch + + PF_Err (*get_pixel_data_float)( + PF_EffectWorld *worldP, + PF_PixelPtr pixelsP0, // NULL to use data in PF_EffectWorld + PF_PixelFloat **pixPP); // will return NULL if depth mismatch + + +} PF_PixelDataSuite1; + + +#define kPFPixelDataSuiteVersion2 2 /* frozen in AE 16.0 */ + +typedef struct PF_PixelDataSuite2 { + + PF_Err (*get_pixel_data8)( + PF_EffectWorld *worldP, + PF_PixelPtr pixelsP0, // NULL to use data in PF_EffectWorld + PF_Pixel8 **pixPP); // will return NULL if depth mismatch + + PF_Err (*get_pixel_data16)( + PF_EffectWorld *worldP, + PF_PixelPtr pixelsP0, // NULL to use data in PF_EffectWorld + PF_Pixel16 **pixPP); // will return NULL if depth mismatch + + PF_Err (*get_pixel_data_float)( + PF_EffectWorld *worldP, + PF_PixelPtr pixelsP0, // NULL to use data in PF_EffectWorld + PF_PixelFloat **pixPP); // will return NULL if depth mismatch + + PF_Err (*get_pixel_data_float_gpu)( + PF_EffectWorld *worldP, + void **pixPP); // will return NULL if depth mismatch + +} PF_PixelDataSuite2; + + +#define kPFColorCallbacksSuite "PF Color Suite" +#define kPFColorCallbacksSuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_ColorCallbacksSuite1 { + PF_Err (*RGBtoHLS)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + PF_HLS_Pixel hls); + + PF_Err (*HLStoRGB)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_HLS_Pixel hls, + PF_Pixel *rgb); + + PF_Err (*RGBtoYIQ)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + PF_YIQ_Pixel yiq); + + PF_Err (*YIQtoRGB)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_HLS_Pixel yiq, + PF_Pixel *rgb); + + PF_Err (*Luminance)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + A_long *lum100); /* << 100 * luminance */ + + PF_Err (*Hue)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + A_long *hue); /* << 0-255 maps to 0-360 */ + + PF_Err (*Lightness)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + A_long *lightness); /* << goes from 0-255 */ + + PF_Err (*Saturation)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel *rgb, + A_long *saturation); /* << goes from 0-255 */ + +} PF_ColorCallbacksSuite1; + +#define kPFColorCallbacks16Suite "PF Color16 Suite" +#define kPFColorCallbacks16SuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_ColorCallbacks16Suite1 { + PF_Err (*RGBtoHLS)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel16 *rgb, + PF_HLS_Pixel hls); + + PF_Err (*HLStoRGB)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_HLS_Pixel hls, + PF_Pixel16 *rgb); + + PF_Err (*RGBtoYIQ)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel16 *rgb, + PF_YIQ_Pixel yiq); + + PF_Err (*YIQtoRGB)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_HLS_Pixel yiq, + PF_Pixel16 *rgb); + + PF_Err (*Luminance)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel16 *rgb, + A_long *lum100); /* << 100 * luminance */ + + PF_Err (*Hue)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel16 *rgb, + A_long *hue); /* << 0-255 maps to 0-360 */ + + PF_Err (*Lightness)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel16 *rgb, + A_long *lightness); /* << goes from 0-32768 */ + + PF_Err (*Saturation)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Pixel16 *rgb, + A_long *saturation); /* << goes from 0-32768 */ + +} PF_ColorCallbacks16Suite1; + + + + +#define kPFColorCallbacksFloatSuite "PF ColorFloat Suite" +#define kPFColorCallbacksFloatSuiteVersion1 1 /* frozen in AE 7.0 */ + + +typedef struct PF_ColorCallbacksFloatSuite1 { + PF_Err (*RGBtoHLS)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_PixelFloat *rgb, + PF_HLS_Pixel hls); + + PF_Err (*HLStoRGB)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_HLS_Pixel hls, + PF_PixelFloat *rgb); + + PF_Err (*RGBtoYIQ)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_PixelFloat *rgb, + PF_YIQ_Pixel yiq); + + PF_Err (*YIQtoRGB)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_HLS_Pixel yiq, + PF_PixelFloat *rgb); + + PF_Err (*Luminance)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_PixelFloat *rgb, + float *lumP); /* << luminance -- note *not* 100*lum */ + + PF_Err (*Hue)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_PixelFloat *rgb, + float *hue); /* 0..360 float */ + + PF_Err (*Lightness)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_PixelFloat *rgb, + float *lightness); /* << */ + + PF_Err (*Saturation)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_PixelFloat *rgb, + float *saturation); /* << */ + +} PF_ColorCallbacksFloatSuite1; + + + +#define kPFBatchSamplingSuite "PF Batch Sampling Suite" +#define kPFBatchSamplingSuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_BatchSamplingSuite1 { + PF_Err (*begin_sampling)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Quality qual, + PF_ModeFlags mf, + PF_SampPB *params); + + PF_Err (*end_sampling)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Quality qual, + PF_ModeFlags mf, + PF_SampPB *params); + + PF_Err (*get_batch_func)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Quality quality, + PF_ModeFlags mode_flags, + const PF_SampPB *params, + PF_BatchSampleFunc *batch); + + PF_Err (*get_batch_func16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Quality quality, + PF_ModeFlags mode_flags, + const PF_SampPB *params, + PF_BatchSample16Func *batch); + +} PF_BatchSamplingSuite1; + + +#define kPFSampling8Suite "PF Sampling8 Suite" +#define kPFSampling8SuiteVersion1 1 /* frozen in AE 5.0 */ + +typedef struct PF_Sampling8Suite1 { + + PF_Err (*nn_sample)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel *dst_pixel); + + PF_Err (*subpixel_sample)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel *dst_pixel); + + PF_Err (*area_sample)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel *dst_pixel); + + +} PF_Sampling8Suite1; + +#define kPFSampling16Suite "PF Sampling16 Suite" +#define kPFSampling16SuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_Sampling16Suite1 { + + PF_Err (*nn_sample16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel16 *dst_pixel); + + PF_Err (*subpixel_sample16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel16 *dst_pixel); + + PF_Err (*area_sample16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_Pixel16 *dst_pixel); + +} PF_Sampling16Suite1; + + +#define kPFSamplingFloatSuite "PF SamplingFloat Suite" +#define kPFSamplingFloatSuiteVersion1 1 /* frozen in AE 7.0 */ + + +typedef struct PF_SamplingFloatSuite1 { + + PF_Err (*nn_sample_float)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_PixelFloat *dst_pixel); + + PF_Err (*subpixel_sample_float)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_PixelFloat *dst_pixel); + + PF_Err (*area_sample_float)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_Fixed x, + PF_Fixed y, + const PF_SampPB *params, + PF_PixelFloat *dst_pixel); + +} PF_SamplingFloatSuite1; + + + + +#define kPFWorldSuite "PF World Suite" +#define kPFWorldSuiteVersion2 2 /* frozen in AE 7.0 */ + + +typedef struct PF_WorldSuite2 { + + PF_Err (*PF_NewWorld)( + PF_ProgPtr effect_ref, /* reference from in_data */ + A_long widthL, + A_long heightL, + PF_Boolean clear_pixB, + PF_PixelFormat pixel_format, + PF_EffectWorld *worldP); + + PF_Err (*PF_DisposeWorld)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *worldP); + + + PF_Err (*PF_GetPixelFormat)( + const PF_EffectWorld *worldP, /* the pixel buffer of interest */ + PF_PixelFormat *pixel_formatP); /* << OUT. one of the above PF_PixelFormat types */ + + +} PF_WorldSuite2; + + + + + +#define kPFPixelFormatSuite "PF Pixel Format Suite" +#define kPFPixelFormatSuiteVersion2 2 + + +// call during global setup + +typedef struct PF_PixelFormatSuite2 { + + PF_Err (*PF_AddSupportedPixelFormat)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_PixelFormat pixel_format); /* add a supported pixel format */ + + + PF_Err (*PF_ClearSupportedPixelFormats)( + PF_ProgPtr effect_ref); /* reference from in_data */ + +} PF_PixelFormatSuite2; + + + + + +#define kPFWorldSuite "PF World Suite" +#define kPFWorldSuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_WorldSuite1 { + + PF_Err (*new_world)( + PF_ProgPtr effect_ref, /* reference from in_data */ + A_long width, + A_long height, + PF_NewWorldFlags flags, /* should would be pre-cleared to zeroes */ + PF_EffectWorld *world); /* always 32 bit */ + + PF_Err (*dispose_world)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *world); + + +} PF_WorldSuite1; + + + +#define kPFIterate8Suite "PF Iterate8 Suite" +#define kPFIterate8SuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_Iterate8Suite1 { + PF_Err (*iterate)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + void* refcon, + PF_Err (*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel *in, PF_Pixel *out), + PF_EffectWorld *dst); + + + PF_Err (*iterate_origin)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + const PF_Point *origin, + void* refcon, + PF_Err (*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel *in, PF_Pixel *out), + PF_EffectWorld *dst); + + PF_Err (*iterate_lut)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + A_u_char *a_lut0, /* pass NULL for identity */ + A_u_char *r_lut0, /* pass NULL for identity */ + A_u_char *g_lut0, /* pass NULL for identity */ + A_u_char *b_lut0, /* pass NULL for identity */ + PF_EffectWorld *dst); + + PF_Err (*iterate_origin_non_clip_src)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, + const PF_Point *origin, + void* refcon, + PF_Err (*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel *in, PF_Pixel *out), + PF_EffectWorld *dst); + + PF_Err (*iterate_generic)( + A_long iterationsL, /* >> */ // can be PF_Iterations_ONCE_PER_PROCESSOR + void *refconPV, /* >> */ + PF_Err (*fn_func)( void *refconPV, /* >> */ + A_long thread_indexL, // only call abort and progress from thread_indexL == 0. + A_long i, + A_long iterationsL)); // never sends PF_Iterations_ONCE_PER_PROCESSOR + +} PF_Iterate8Suite1; + +#define kPFIterate8SuiteVersion2 2 /* frozen in AE 22.0 */ + +typedef struct PF_Iterate8Suite2 { + PF_Err(*iterate)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + void *refcon, + PF_Err(*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel* in, PF_Pixel* out), + PF_EffectWorld *dst); + + + PF_Err(*iterate_origin)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + const PF_Point *origin, + void *refcon, + PF_Err(*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel* in, PF_Pixel* out), + PF_EffectWorld *dst); + + PF_Err(*iterate_lut)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + A_u_char *a_lut0, /* pass NULL for identity */ + A_u_char *r_lut0, /* pass NULL for identity */ + A_u_char *g_lut0, /* pass NULL for identity */ + A_u_char *b_lut0, /* pass NULL for identity */ + PF_EffectWorld *dst); + + PF_Err(*iterate_origin_non_clip_src)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, + const PF_Point *origin, + void *refcon, + PF_Err(*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel* in, PF_Pixel* out), + PF_EffectWorld *dst); + + PF_Err(*iterate_generic)( + A_long iterationsL, /* >> */ // can be PF_Iterations_ONCE_PER_PROCESSOR + void *refconPV, /* >> */ + PF_Err(*fn_func)( + void *refconPV, /* >> */ + A_long thread_indexL, // only call abort and progress from thread_indexL == 0. + A_long i, + A_long iterationsL)); // never sends PF_Iterations_ONCE_PER_PROCESSOR + +} PF_Iterate8Suite2; + +#define kPFIterate16Suite "PF iterate16 Suite" +#define kPFIterate16SuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_iterate16Suite1 { + PF_Err (*iterate)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + void* refcon, + PF_Err (*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel16 *in, PF_Pixel16 *out), + PF_EffectWorld *dst); + + + PF_Err (*iterate_origin)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + const PF_Point *origin, + void* refcon, + PF_Err (*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel16 *in, PF_Pixel16 *out), + PF_EffectWorld *dst); + + PF_Err (*iterate_origin_non_clip_src)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, + const PF_Point *origin, + void* refcon, + PF_Err (*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel16 *in, PF_Pixel16 *out), + PF_EffectWorld *dst); + +} PF_Iterate16Suite1; + +#define kPFIterate16SuiteVersion2 2 /* frozen in AE 22.0 */ + +typedef struct PF_iterate16Suite2 { + PF_Err(*iterate)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + void *refcon, + PF_Err(*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel16* in, PF_Pixel16* out), + PF_EffectWorld *dst); + + + PF_Err(*iterate_origin)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + const PF_Point *origin, + void *refcon, + PF_Err(*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel16* in, PF_Pixel16* out), + PF_EffectWorld *dst); + + PF_Err(*iterate_origin_non_clip_src)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, + const PF_Point *origin, + void *refcon, + PF_Err(*pix_fn)(void* refcon, A_long x, A_long y, PF_Pixel16* in, PF_Pixel16* out), + PF_EffectWorld *dst); + +} PF_Iterate16Suite2; + +#define kPFIterateFloatSuite "PF iterateFloat Suite" +#define kPFIterateFloatSuiteVersion1 1 /* frozen in AE 7.0 */ + + +typedef struct PF_iterateFloatSuite1 { + PF_Err (*iterate)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + void* refcon, + PF_IteratePixelFloatFunc pix_fn, + PF_EffectWorld *dst); + + + PF_Err (*iterate_origin)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + const PF_Point *origin, + void* refcon, + PF_IteratePixelFloatFunc pix_fn, + PF_EffectWorld *dst); + + PF_Err (*iterate_origin_non_clip_src)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, + const PF_Point *origin, + void* refcon, + PF_IteratePixelFloatFunc pix_fn, + PF_EffectWorld *dst); + +} PF_IterateFloatSuite1; + +#define kPFIterateFloatSuiteVersion2 2 /* frozen in AE 22.0 */ + +typedef struct PF_iterateFloatSuite2 { + PF_Err (*iterate)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + void* refcon, + PF_IteratePixelFloatFunc pix_fn, + PF_EffectWorld *dst); + + + PF_Err (*iterate_origin)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + const PF_Point *origin, + void* refcon, + PF_IteratePixelFloatFunc pix_fn, + PF_EffectWorld *dst); + + PF_Err (*iterate_origin_non_clip_src)( + PF_InData *in_data, + A_long progress_base, + A_long progress_final, + PF_EffectWorld *src, + const PF_Rect *area, + const PF_Point *origin, + void* refcon, + PF_IteratePixelFloatFunc pix_fn, + PF_EffectWorld *dst); + +} PF_IterateFloatSuite2; + +#define kPFWorldTransformSuite "PF World Transform Suite" +#define kPFWorldTransformSuiteVersion1 1 /* frozen in AE 5.0 */ + +typedef struct PF_WorldTransformSuite1 { + + PF_Err (*composite_rect)( + PF_ProgPtr effect_ref, /* from in_data */ + PF_Rect *src_rect, /* rectangle in source image */ + A_long src_opacity, /* opacity of src */ + PF_EffectWorld *source_wld, /* src PF world */ + A_long dest_x, /* upper left-hand corner of src rect...*/ + A_long dest_y, /* ... in composite image */ + PF_Field field_rdr, /* which scanlines to render (all, upper, lower) */ + PF_XferMode xfer_mode, /* Copy, Composite Behind, Composite In Front */ + PF_EffectWorld *dest_wld); /* Destination buffer. Already filled */ + + PF_Err (*blend)( + PF_ProgPtr effect_ref, /* reference from in_data */ + const PF_EffectWorld *src1, + const PF_EffectWorld *src2, + PF_Fixed ratio, /* 0 == full src1, 0x00010000 == full src2 */ + PF_EffectWorld *dst); + + PF_Err (*convolve)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + const PF_Rect *area, /* pass NULL for all pixels */ + PF_KernelFlags flags, + A_long kernel_size, + void *a_kernel, + void *r_kernel, + void *g_kernel, + void *b_kernel, + PF_EffectWorld *dst); + + PF_Err (*copy)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + PF_EffectWorld *dst, + PF_Rect *src_r, /* pass NULL for whole world */ + PF_Rect *dst_r); /* pass NULL for whole world */ + + PF_Err (*copy_hq)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + PF_EffectWorld *dst, + PF_Rect *src_r, /* pass NULL for whole world */ + PF_Rect *dst_r); /* pass NULL for whole world */ + + + PF_Err (*transfer_rect)( + PF_ProgPtr effect_ref, + PF_Quality quality, + PF_ModeFlags m_flags, + PF_Field field, + const PF_Rect *src_rec, + const PF_EffectWorld *src_world, + const PF_CompositeMode *comp_mode, + const PF_MaskWorld *mask_world0, + A_long dest_x, + A_long dest_y, + PF_EffectWorld *dst_world); + + PF_Err (*transform_world)( + PF_ProgPtr effect_ref, + PF_Quality quality, + PF_ModeFlags m_flags, + PF_Field field, + const PF_EffectWorld *src_world, + const PF_CompositeMode *comp_mode, + const PF_MaskWorld *mask_world0, + const PF_FloatMatrix *matrices, + A_long num_matrices, + PF_Boolean src2dst_matrix, + const PF_Rect *dest_rect, + PF_EffectWorld *dst_world); + + +} PF_WorldTransformSuite1; + + +#define kPFFillMatteSuite "PF Fill Matte Suite" + + +#define kPFFillMatteSuiteVersion2 2 /* frozen in AE 7.0 */ +typedef struct PF_FillMatteSuite2 { + + PF_Err (*fill)( + PF_ProgPtr effect_ref, /* reference from in_data */ + const PF_Pixel *color, + const PF_Rect *dst_rect, /* pass NULL for whole world */ + PF_EffectWorld *world); + + PF_Err (*fill16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + const PF_Pixel16 *color, + const PF_Rect *dst_rect, /* pass NULL for whole world */ + PF_EffectWorld *world); + + PF_Err (*fill_float)( + PF_ProgPtr effect_ref, /* reference from in_data */ + const PF_PixelFloat *color, + const PF_Rect *dst_rect, /* pass NULL for whole world */ + PF_EffectWorld *world); + + PF_Err (*premultiply)( + PF_ProgPtr effect_ref, /* reference from in_data */ + A_long forward, /* TRUE means convert non-premul to premul, FALSE mean reverse */ + PF_EffectWorld *dst); + + PF_Err (*premultiply_color)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + const PF_Pixel *color, /* color to premultiply/unmultiply with */ + A_long forward, /* TRUE means convert non-premul to premul, FALSE mean reverse */ + PF_EffectWorld *dst); + + PF_Err (*premultiply_color16)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + const PF_Pixel16 *color, /* color to premultiply/unmultiply with */ + A_long forward, /* TRUE means convert non-premul to premul, FALSE mean reverse */ + PF_EffectWorld *dst); + + PF_Err (*premultiply_color_float)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *src, + const PF_PixelFloat *color, /* color to premultiply/unmultiply with */ + A_long forward, /* TRUE means convert non-premul to premul, FALSE mean reverse */ + PF_EffectWorld *dst); + +} PF_FillMatteSuite2; + + + +#ifdef __cplusplus + } // end extern "C" +#endif + + + +#include + + +#endif + diff --git a/External/AE SDK/Headers/AE_EffectGPUSuites.h b/External/AE SDK/Headers/AE_EffectGPUSuites.h new file mode 100644 index 00000000..9874b46f --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectGPUSuites.h @@ -0,0 +1,221 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2018 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef _H_AE_EffectGPUSuites +#define _H_AE_EffectGPUSuites + +#include +#include + +#include + +#ifdef __cplusplus + extern "C" { +#endif + + +#define PF_CUDAVersion 10010 + + +#define kPFGPUDeviceSuite "PF GPU Device Suite" +#define kPFGPUDeviceSuiteVersion1 1 /* frozen in AE 16.0 */ + +typedef struct +{ + PF_GPU_Framework device_framework; + PF_Boolean compatibleB; // device meets minimum requriement for acceleration + + void* platformPV; // cl_platform_id + void* devicePV; // CUdevice or cl_device_id or MTLDevice + void* contextPV; // CUcontext or cl_context + void* command_queuePV; // CUstream or cl_command_queue or MTLCommandQueue + void* offscreen_opengl_contextPV; // CGLContextObj or HGLRC - only available on the primary device + void* offscreen_opengl_devicePV; // HDC - only available on the primary device + +} PF_GPUDeviceInfo; + + + +typedef struct PF_GPUDeviceSuite1 { + + /** + ** This will return the number of gpu devices the host supports. + ** + ** @param effect_ref Comes with PF_InData. + ** @param device_countP Return number of devices available. + */ + SPAPI PF_Err (*GetDeviceCount)( PF_ProgPtr effect_ref, + A_u_long *device_countP); /* << */ + + /** + ** This will return the device info with given device index, which includes necessary context/queue information + ** needed to dispatch task to the device. Refer PF_GPUDeviceInfo for details. + ** + ** @param effect_ref Comes with PF_InData. + ** @param device_index The device index for the requested device. + ** @param PF_GPUDeviceInfo The device info will to be filled. + */ + SPAPI PF_Err (*GetDeviceInfo)( PF_ProgPtr effect_ref, + A_u_long device_index, + PF_GPUDeviceInfo *device_infoP); /* << */ + + + /** + ** Acquire/release exclusive access to inDeviceIndex. All calls below this point generally require access be held. + ** For full GPU plugins (those that use a separate entry point for GPU rendering) exclusive access is always held. + ** These calls do not need to be made in that case. + ** For CUDA calls cuCtxPushCurrent/cuCtxPopCurrent on the current thread to manage the devices context. + */ + SPAPI PF_Err (*AcquireExclusiveDeviceAccess)( PF_ProgPtr effect_ref, + A_u_long device_index); + + SPAPI PF_Err (*ReleaseExclusiveDeviceAccess)( PF_ProgPtr effect_ref, + A_u_long device_index); + + /** + ** All device memory must be allocated through this suite. + ** Purge should be called only in emergency situations when working with GPU memory + ** that cannot be allocated through this suite (eg OpenGL memory). + ** Returned pointer value represents memory allocated through cuMemAlloc or clCreateBuffer. + */ + + SPAPI PF_Err (*AllocateDeviceMemory)( PF_ProgPtr effect_ref, + A_u_long device_index, + size_t size_bytes, + void **memoryPP); /* << */ + + SPAPI PF_Err (*FreeDeviceMemory)( PF_ProgPtr effect_ref, + A_u_long device_index, + void *memoryP); + + SPAPI PF_Err (*PurgeDeviceMemory)( PF_ProgPtr effect_ref, + A_u_long device_index, + size_t size_bytes, + size_t *bytes_purgedP0); /* << */ + + /** + ** All host (pinned) memory must be allocated through this suite. + ** Purge should be called only in emergency situations when working with GPU memory + ** that cannot be allocated through this suite (eg OpenGL memory). + ** Returned pointer value represents memory allocated through cuMemHostAlloc or malloc. + */ + SPAPI PF_Err (*AllocateHostMemory)( PF_ProgPtr effect_ref, + A_u_long device_index, + size_t size_bytes, + void **memoryPP); /* << */ + + + SPAPI PF_Err (*FreeHostMemory)( PF_ProgPtr effect_ref, + A_u_long device_index, + void *memoryP); + + + SPAPI PF_Err (*PurgeHostMemory)( PF_ProgPtr effect_ref, + A_u_long device_index, + size_t bytes_to_purge, + size_t *bytes_purgedP0); /* << */ + + /** + ** This will allocate a gpu effect world. Caller is responsible for deallocating the buffer with + ** PF_GPUDeviceSuite1::DisposeGPUWorld. + ** + ** @param effect_ref Comes with PF_InData. + ** @param device_index The device you want your gpu effect world allocated with. + ** @param width Width of the effect world. + ** @param height Height of the effect world. + ** @param pixel_aspect_ratio Pixel Aspect Ratio of the effect world. + ** @param field_type The field of the effect world. + ** @param pixel_format The pixel format of the effect world, only gpu formats are accepted. + ** @param clear_pixB Pass in 'true' for a transparent black frame. + ** @param worldPP The handle to the effect world to be created. + */ + SPAPI PF_Err (*CreateGPUWorld)( PF_ProgPtr effect_ref, + A_u_long device_index, + A_long width, + A_long height, + PF_RationalScale pixel_aspect_ratio, + PF_Field field_type, + PF_PixelFormat pixel_format, + PF_Boolean clear_pixB, + PF_EffectWorld **worldPP); /* << */ + + + /** + ** This will free this effect world. The effect world is no longer valid after this function is called. + ** Plugin module is only allowed to dispose of effect worlds they create. + ** + ** @param effect_ref Comes with PF_InData. + ** @param worldP The effect world you want to dispose. + */ + SPAPI PF_Err (*DisposeGPUWorld)( PF_ProgPtr effect_ref, + PF_EffectWorld *worldP); + + + /** + ** This will return the gpu buffer address of the given effect world. + ** + ** @param effect_ref Comes with PF_InData. + ** @param worldP The effect world you want to operate on, has to be a gpu effect world. + ** @param pixPP Returns the gpu buffer address. + */ + SPAPI PF_Err (*GetGPUWorldData)( PF_ProgPtr effect_ref, + PF_EffectWorld *worldP, + void **pixPP); /* << */ + + /** + ** This will return the size of the total data in the effect world. + ** + ** @param effect_ref Comes with PF_InData. + ** @param worldP The effect world you want to operate on, has to be a gpu effect world. + ** @param device_indexP Returns the size of the total data in the effect world. + */ + SPAPI PF_Err (*GetGPUWorldSize)( PF_ProgPtr effect_ref, + PF_EffectWorld *worldP, + size_t *size_in_bytesP); /* << */ + + + /** + ** This will return device index the gpu effect world is associated with. + ** + ** @param effect_ref Comes with PF_InData. + ** @param worldP The effect world you want to operate on, has to be a gpu effect world. + ** @param device_indexP Returns the device index of the given effect world. + */ + SPAPI PF_Err (*GetGPUWorldDeviceIndex)( PF_ProgPtr effect_ref, + PF_EffectWorld *worldP, + A_u_long *device_indexP); /* << */ + + +} PF_GPUDeviceSuite1; + + + +/**********************************************************/ +/**********************************************************/ + +#ifdef __cplusplus + } +#endif + + +#include + +#endif diff --git a/External/AE SDK/Headers/AE_EffectPixelFormat.h b/External/AE SDK/Headers/AE_EffectPixelFormat.h new file mode 100644 index 00000000..44635a64 --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectPixelFormat.h @@ -0,0 +1,110 @@ +#ifndef _H_AE_PIXEL_FORMAT +#define _H_AE_PIXEL_FORMAT + +#include "A.h" + +/* data types for PF_EffectWorlds that are not just 8bpc ARGB + * + * see AE_EffectCBSuites.h for more details + * + */ + +#ifndef MAKE_PIXEL_FORMAT_FOURCC + +#define MAKE_PIXEL_FORMAT_FOURCC(ch0, ch1, ch2, ch3) \ + ((A_u_long)(A_u_char)(ch0) | ((A_u_long)(A_u_char)(ch1) << 8) | \ + ((A_u_long)(A_u_char)(ch2) << 16) | ((A_u_long)(A_u_char)(ch3) << 24 )) + +#endif + + +// +// note! MAKE_PIXEL_FORMAT_FOURCC('a', 'r', 'g', 'b') does not give the same result +// as the literal 'argb' in your compiler +// +// MS image compression interfaces define FOURCC this way (unlike QuickTime) so please +// be careful and use the enums as defined rather than rolling your own. +// + +enum { + PF_PixelFormat_ARGB32 = MAKE_PIXEL_FORMAT_FOURCC('a', 'r', 'g', 'b'), // After Effects-style ARGB, 8 bits per channel, range 0...255 + // trillions of pixels served since 1992. support required for After Effects + + PF_PixelFormat_ARGB64 = MAKE_PIXEL_FORMAT_FOURCC('a', 'e', '1', '6'), // After Effects-style ARGB, 16 bits per channel, range 0...32768 + PF_PixelFormat_ARGB128 = MAKE_PIXEL_FORMAT_FOURCC('a', 'e', '3', '2'), // After Effects-style ARGB, 32 bits floating point per channel, 1.0 is "white" + + + /* -------------------------------------------------------------------------------------- */ + + PF_PixelFormat_GPU_BGRA128 = MAKE_PIXEL_FORMAT_FOURCC('@', 'C', 'D', 'A'), // GPU, BGRA, 32 bits floating point per channel. + + PF_PixelFormat_RESERVED = MAKE_PIXEL_FORMAT_FOURCC('@', 'C', 'D', 'a'), // reserved for future use. + + /* -------------------------------------------------------------------------------------- */ + + PF_PixelFormat_BGRA32 = MAKE_PIXEL_FORMAT_FOURCC('b', 'g', 'r', 'a'), // Premiere-style BGRA, 8 bits per channel. Premiere-only; support required for Premiere + PF_PixelFormat_VUYA32 = MAKE_PIXEL_FORMAT_FOURCC('v', 'u', 'y', 'a'), // Premiere-style YUVA, 8 bits per channel. Premiere-only + + PF_PixelFormat_NTSCDV25 = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'n', '2'), // compressed DV-25. Premiere only. + PF_PixelFormat_PALDV25 = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'p', '2'), // compressed DV-25. Premiere only. + + PF_PixelFormat_INVALID = MAKE_PIXEL_FORMAT_FOURCC('b', 'a', 'd', 'f'), // invalid pixel format - this is used for intialization and error conditions + + + PF_PixelFormat_FORCE_LONG_INT = 0xFFFFFFFF +}; + +typedef A_long PF_PixelFormat; + + +#ifdef PREMIERE +// for Premiere-specific pixel format support +// some of these are aliases of formats already available as a PF_PixelFormat + +#ifndef PRSDKPIXELFORMAT_H +typedef PF_PixelFormat PrPixelFormat; + +enum { + // Uncompressed formats - these are most common for effects + PrPixelFormat_BGRA_4444_8u = PF_PixelFormat_BGRA32, + PrPixelFormat_VUYA_4444_8u = PF_PixelFormat_VUYA32, + PrPixelFormat_ARGB_4444_8u = PF_PixelFormat_ARGB32, + PrPixelFormat_BGRA_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('B', 'g', 'r', 'a'), // 16 bit integer per component BGRA + PrPixelFormat_VUYA_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('V', 'u', 'y', 'a'), // 16 bit integer per component VUYA + PrPixelFormat_ARGB_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('A', 'r', 'g', 'b'), // 16 bit integer per component ARGB + PrPixelFormat_BGRA_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('B', 'G', 'r', 'a'), // 32 bit float per component BGRA + PrPixelFormat_VUYA_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('V', 'U', 'y', 'a'), // 32 bit float per component VUYA + PrPixelFormat_ARGB_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('A', 'R', 'g', 'b'), // 32 bit float per component ARGB + + // Packed formats + PrPixelFormat_YUYV_422_8u_601 = MAKE_PIXEL_FORMAT_FOURCC('y', 'u', 'y', '2'), // 8 bit 422 YUY2 601 colorspace + PrPixelFormat_YUYV_422_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('y', 'u', 'y', '3'), // 8 bit 422 YUY2 709 colorspace + PrPixelFormat_UYVY_422_8u_601 = MAKE_PIXEL_FORMAT_FOURCC('u', 'y', 'v', 'y'), // 8 bit 422 UYVY 601 colorspace + PrPixelFormat_UYVY_422_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('u', 'y', 'v', '7'), // 8 bit 422 UYVY 709 colorspace + PrPixelFormat_V210_422_10u_601 = MAKE_PIXEL_FORMAT_FOURCC('v', '2', '1', '0'), // packed uncompressed 10 bit 422 YUV aka V210 601 colorspace + PrPixelFormat_V210_422_10u_709 = MAKE_PIXEL_FORMAT_FOURCC('v', '2', '1', '1'), + + // Planar formats + PrPixelFormat_YUV_420_MPEG2_FRAME_PICTURE_PLANAR_8u = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', '1', '2'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) + PrPixelFormat_YUV_420_MPEG2_FIELD_PICTURE_PLANAR_8u = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', 'i', '2'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) + + // Compressed formats + PrPixelFormat_NTSCDV25 = PF_PixelFormat_NTSCDV25, // compressed DV-25 + PrPixelFormat_PALDV25 = PF_PixelFormat_PALDV25, // compressed DV-25 + PrPixelFormat_720pDV100 = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', '7', '1'), // compressed DV-100 720p + PrPixelFormat_1080iDV100 = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', '1', '1'), // compressed DV-100 1080i + + // Raw, opaque data formats + PrPixelFormat_Raw = MAKE_PIXEL_FORMAT_FOURCC('r', 'a', 'w', 'w'), // raw, opaque data, with no row bytes or height + + // Invalid + PrPixelFormat_Invalid = PF_PixelFormat_INVALID, // invalid pixel format - this is used for intialization and error conditions + + PrPixelFormat_Any = 0 +}; + +#endif // PRSDKPIXELFORMAT_H + +#endif // PREMIERE + +#endif // AE_PixelFormat diff --git a/External/AE SDK/Headers/AE_EffectSuites.h b/External/AE SDK/Headers/AE_EffectSuites.h new file mode 100644 index 00000000..63a85492 --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectSuites.h @@ -0,0 +1,728 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef _H_AE_EffectSuites +#define _H_AE_EffectSuites + +#include +#include // for PF_CursorType +#include + +#include + +#ifdef __cplusplus + extern "C" { +#endif + + + +#define kPFPathQuerySuite "PF Path Query Suite" +#define kPFPathQuerySuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct PF_PathOutline *PF_PathOutlinePtr; +typedef struct PF_PathSegPrep *PF_PathSegPrepPtr; + +typedef struct PF_PathQuerySuite1 { + + SPAPI PF_Err (*PF_NumPaths)( PF_ProgPtr effect_ref, + A_long *num_pathsPL); /* << */ + + SPAPI PF_Err (*PF_PathInfo)( PF_ProgPtr effect_ref, + A_long indexL, + PF_PathID *unique_idP); /* << */ + + SPAPI PF_Err (*PF_CheckoutPath)( PF_ProgPtr effect_ref, + PF_PathID unique_id, + A_long what_time, + A_long time_step, + A_u_long time_scale, + PF_PathOutlinePtr *pathPP); /* << */ // can return NULL ptr if path doesn't exist + + SPAPI PF_Err (*PF_CheckinPath)( PF_ProgPtr effect_ref, + PF_PathID unique_id, + PF_Boolean changedB, + PF_PathOutlinePtr pathP); + +} PF_PathQuerySuite1; + + + +/* -------------------------------------------------------------------- */ + + +#define kPFPathDataSuite "PF Path Data Suite" +#define kPFPathDataSuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct { + + PF_FpLong x, y; + PF_FpLong tan_in_x, tan_in_y; + PF_FpLong tan_out_x, tan_out_y; + +} PF_PathVertex; + +#define PF_MAX_PATH_NAME_LEN 31 + + +typedef struct PF_PathDataSuite1 { + + SPAPI PF_Err (*PF_PathIsOpen)( PF_ProgPtr effect_ref0, + PF_PathOutlinePtr pathP, + PF_Boolean *openPB); + + // N segments means there are segments [0..N-1]; segment J is defined by vertex J & J+1 + SPAPI PF_Err (*PF_PathNumSegments)( PF_ProgPtr effect_ref0, + PF_PathOutlinePtr pathP, + A_long *num_segmentsPL); + + // which_pointL range: [0..num_segments]; for closed paths vertex[0] == vertex[num_segments] + SPAPI PF_Err (*PF_PathVertexInfo)( PF_ProgPtr effect_ref0, + PF_PathOutlinePtr pathP, + A_long which_pointL, + PF_PathVertex *vertexP); + + SPAPI PF_Err (*PF_PathPrepareSegLength)( + PF_ProgPtr effect_ref0, + PF_PathOutlinePtr pathP, + A_long which_segL, + A_long frequencyL, + PF_PathSegPrepPtr *lengthPrepPP); + + SPAPI PF_Err (*PF_PathGetSegLength)( PF_ProgPtr effect_ref0, + PF_PathOutlinePtr pathP, + A_long which_segL, + PF_PathSegPrepPtr *lengthPrepP0, + PF_FpLong *lengthPF); + + SPAPI PF_Err (*PF_PathEvalSegLength)(PF_ProgPtr effect_ref0, + PF_PathOutlinePtr pathP, + PF_PathSegPrepPtr *lengthPrepPP0, + A_long which_segL, + PF_FpLong lengthF, + PF_FpLong *x, + PF_FpLong *y); + + SPAPI PF_Err (*PF_PathEvalSegLengthDeriv1)( + PF_ProgPtr effect_ref0, + PF_PathOutlinePtr pathP, + PF_PathSegPrepPtr *lengthPrepPP0, + A_long which_segL, + PF_FpLong lengthF, + PF_FpLong *x, + PF_FpLong *y, + PF_FpLong *deriv1x, + PF_FpLong *deriv1y); + + + SPAPI PF_Err (*PF_PathCleanupSegLength)( + PF_ProgPtr effect_ref0, + PF_PathOutlinePtr pathP, + A_long which_segL, + PF_PathSegPrepPtr *lengthPrepPP); + + + SPAPI PF_Err (*PF_PathIsInverted)( PF_ProgPtr effect_ref, + PF_PathID unique_id, + PF_Boolean *invertedB); + + SPAPI PF_Err (*PF_PathGetMaskMode)( PF_ProgPtr effect_ref, + PF_PathID unique_id, + PF_MaskMode *modeP); + + SPAPI PF_Err (*PF_PathGetName)( PF_ProgPtr effect_ref, + PF_PathID unique_id, + A_char *nameZ); /* << can be up to PF_MAX_PATH_NAME_LEN+1 bytes long */ + + +} PF_PathDataSuite1; + + +/* -------------------------------------------------------------------- */ + +// New versions of state related APIs added in CS6 + +#define kPFParamUtilsSuite "PF Param Utils Suite" +#define kPFParamUtilsSuiteVersion3 3 // Frozen in AE CS6 [aka AE11.0] + +typedef struct { + A_long reservedAL[4]; +} PF_State; + + +#define PF_ParamIndex_NONE (-1L) +#define PF_ParamIndex_CHECK_ALL (-2L) +#define PF_ParamIndex_CHECK_ALL_EXCEPT_LAYER_PARAMS (-3L) +#define PF_ParamIndex_CHECK_ALL_HONOR_EXCLUDE (-4L) // Like PF_ParamIndex_CHECK_ALL, but honor PF_ParamFlag_EXCLUDE_FROM_HAVE_INPUTS_CHANGED + +#define PF_KeyIndex_NONE (-1L) + + +enum { + PF_TimeDir_GREATER_THAN = 0x0000, + PF_TimeDir_LESS_THAN = 0x0001, + PF_TimeDir_GREATER_THAN_OR_EQUAL = 0x1000, + PF_TimeDir_LESS_THAN_OR_EQUAL = 0x1001 +}; +typedef A_long PF_TimeDir; + +typedef A_long PF_KeyIndex; + + +/** PF_ParamUtilsSuite3 + + PF_UpdateParamUI() + + You can call this function for each param whose UI settings you + want to change when handling a PF_Cmd_USER_CHANGED_PARAM or + PF_Cmd_UPDATE_PARAMS_UI. These changes are cosmetic only, and don't + go into the undo buffer. + + The ONLY fields that can be changed in this way are: + + PF_ParamDef + ui_flags: PF_PUI_ECW_SEPARATOR, PF_PUI_DISABLED only (and PF_PUI_INVISIBLE in Premiere). + ui_width + ui_height + name + flags: PF_ParamFlag_COLLAPSE_TWIRLY only + + PF_ParamDefUnion: + slider_min, slider_max, precision, display_flags of any slider type + + For PF_PUI_STD_CONTROL_ONLY params, you can also change the value field by setting + PF_ChangeFlag_CHANGED_VALUE before returning. But you are not allowed to change + the value during PF_Cmd_UPDATE_PARAMS_UI. + + PF_GetCurrentState() / PF_AreStatesIdentical() + This API lets you determine if a set of your inputs (either layers, other properties, or both) + are different between when you first called PF_GetCurrentState() and a current call, so it can + be used for caching. You can specify a range of time to consider or all of time. + + For effects that do simulation across time and therefore set PF_OutFlag2_AUTOMATIC_WIDE_TIME_INPUT, + when you ask about a time range, it will be expanded to include any times needed to produce + that range. + + See doc on the old PF_HaveInputsChangedOverTimeSpan() for historical context. + +**/ + +typedef struct PF_ParamUtilsSuite3 { + + SPAPI PF_Err (*PF_UpdateParamUI)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + const PF_ParamDef *defP); + + // IMPORTANT: as of 13.5 to avoid threading deadlock problems, PF_GetCurrentState() returns a random state + // if used in the context of UPDATE_PARAMS_UI only. In other selectors this will behave normally. + SPAPI PF_Err (*PF_GetCurrentState)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + const A_Time *startPT0, // NULL for both start & duration means over all of time + const A_Time *durationPT0, + PF_State *stateP); /* << */ + + SPAPI PF_Err (*PF_AreStatesIdentical)( + PF_ProgPtr effect_ref, + const PF_State *state1P, + const PF_State *state2P, + A_Boolean *samePB); /* << */ + + SPAPI PF_Err (*PF_IsIdenticalCheckout)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + A_long what_time1, + A_long time_step1, + A_u_long time_scale1, + A_long what_time2, + A_long time_step2, + A_u_long time_scale2, + PF_Boolean *identicalPB); /* << */ + + SPAPI PF_Err (*PF_FindKeyframeTime)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + A_long what_time, + A_u_long time_scale, + PF_TimeDir time_dir, + PF_Boolean *foundPB, /* << */ + PF_KeyIndex *key_indexP0, /* << */ + A_long *key_timeP0, /* << */ // you can ask for either: + A_u_long *key_timescaleP0); /* << */ // time×cale OR neither + + SPAPI PF_Err (*PF_GetKeyframeCount)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + PF_KeyIndex *key_countP); /* << */ // returns PF_KeyIndex_NONE for constant + + SPAPI PF_Err (*PF_CheckoutKeyframe)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + PF_KeyIndex key_index, // zero-based + A_long *key_timeP0, /* << */ // you can ask for either: + A_u_long *key_timescaleP0, /* << */ // time×cale OR neither + PF_ParamDef *paramP0); /* << */ + + SPAPI PF_Err (*PF_CheckinKeyframe)( + PF_ProgPtr effect_ref, + PF_ParamDef *paramP); + + SPAPI PF_Err (*PF_KeyIndexToTime)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + PF_KeyIndex key_indexP, /* >> */ + A_long *key_timeP, /* >> */ + A_u_long *key_timescaleP); /* << */ + +} PF_ParamUtilsSuite3; + + + + +/* -------------------------------------------------------------------- */ + + +#define kPFColorParamSuite "PF ColorParamSuite" +#define kPFColorParamSuiteVersion1 1 /* frozen in AE 7.0 */ + +/** PF_ColorParamSuite1 + +**/ + +typedef struct PF_ColorParamSuite1 { + + // floating point color is in the working space of + // your effect, i.e. the same color space + // as the pixels you get + + // note that overrange and underrange values are possible + // even when project is not set to 32bpc + + SPAPI PF_Err (*PF_GetFloatingPointColorFromColorDef)( + PF_ProgPtr effect_ref, /* >> */ + const PF_ParamDef *color_defP, /* >> */ + PF_PixelFloat *fp_colorP); /* << */ + +} PF_ColorParamSuite1; + + + + +/* -------------------------------------------------------------------- */ + +#define kPFPointParamSuite "PF PointParamSuite" +#define kPFPointParamSuiteVersion1 1 /* frozen in AE 10.5 */ + +/** PF_PointParamSuite1 + +**/ + +typedef struct PF_PointParamSuite1 { + + // this api returns floating point value of a point parameter. + + SPAPI PF_Err (*PF_GetFloatingPointValueFromPointDef)( + PF_ProgPtr effect_ref, /* >> */ + const PF_ParamDef *point_defP, /* >> */ + A_FloatPoint *fp_pointP); /* << */ + +} PF_PointParamSuite1; + + +/* -------------------------------------------------------------------- */ + +#define kPFAngleParamSuite "PF AngleParamSuite" +#define kPFAngleParamSuiteVersion1 1 /* frozen in AE 11.0.x */ + +/** PF_AngleParamSuite1 + +**/ + +typedef struct PF_AngleParamSuite1 { + + // this api returns floating point value of an angle parameter. + + SPAPI PF_Err (*PF_GetFloatingPointValueFromAngleDef)( + PF_ProgPtr effect_ref, /* >> */ + const PF_ParamDef *angle_defP, /* >> */ + A_FpLong *fp_valueP); /* << */ + +} PF_AngleParamSuite1; + + +/* -------------------------------------------------------------------- */ + +#define kPFAppSuite "PF AE App Suite" +#define kPFAppSuiteVersion6 1 /* frozen in AE 13.1 */ + +enum { + PF_App_Color_NONE = -1, + + PF_App_Color_FRAME, + PF_App_Color_FILL, + PF_App_Color_TEXT, + PF_App_Color_LIGHT_TINGE, + PF_App_Color_DARK_TINGE, + PF_App_Color_HILITE, + PF_App_Color_SHADOW, + + PF_App_Color_BUTTON_FRAME, + PF_App_Color_BUTTON_FILL, + PF_App_Color_BUTTON_TEXT, + PF_App_Color_BUTTON_LIGHT_TINGE, + PF_App_Color_BUTTON_DARK_TINGE, + PF_App_Color_BUTTON_HILITE, + PF_App_Color_BUTTON_SHADOW, + + PF_App_Color_BUTTON_PRESSED_FRAME, + PF_App_Color_BUTTON_PRESSED_FILL, + PF_App_Color_BUTTON_PRESSED_TEXT, + PF_App_Color_BUTTON_PRESSED_LIGHT_TINGE, + PF_App_Color_BUTTON_PRESSED_DARK_TINGE, + PF_App_Color_BUTTON_PRESSED_HILITE, + PF_App_Color_BUTTON_PRESSED_SHADOW, + + /********************************/ + + PF_App_Color_FRAME_DISABLED, + PF_App_Color_FILL_DISABLED, + PF_App_Color_TEXT_DISABLED, + PF_App_Color_LIGHT_TINGE_DISABLED, + PF_App_Color_DARK_TINGE_DISABLED, + PF_App_Color_HILITE_DISABLED, + PF_App_Color_SHADOW_DISABLED, + + PF_App_Color_BUTTON_FRAME_DISABLED, + PF_App_Color_BUTTON_FILL_DISABLED, + PF_App_Color_BUTTON_TEXT_DISABLED, + PF_App_Color_BUTTON_LIGHT_TINGE_DISABLED, + PF_App_Color_BUTTON_DARK_TINGE_DISABLED, + PF_App_Color_BUTTON_HILITE_DISABLED, + PF_App_Color_BUTTON_SHADOW_DISABLED, + + PF_App_Color_BUTTON_PRESSED_FRAME_DISABLED, + PF_App_Color_BUTTON_PRESSED_FILL_DISABLED, + PF_App_Color_BUTTON_PRESSED_TEXT_DISABLED, + PF_App_Color_BUTTON_PRESSED_LIGHT_TINGE_DISABLED, + PF_App_Color_BUTTON_PRESSED_DARK_TINGE_DISABLED, + PF_App_Color_BUTTON_PRESSED_HILITE_DISABLED, + PF_App_Color_BUTTON_PRESSED_SHADOW_DISABLED, + + /********************************/ + PF_App_Color_BLACK, + PF_App_Color_WHITE, + PF_App_Color_GRAY, + PF_App_Color_RED, + PF_App_Color_YELLOW, + PF_App_Color_GREEN, + PF_App_Color_CYAN, + + /********************************/ + PF_App_Color_TLW_NEEDLE_CURRENT_TIME, + PF_App_Color_TLW_NEEDLE_PREVIEW_TIME, + PF_App_Color_TLW_CACHE_MARK_MEM, + PF_App_Color_TLW_CACHE_MARK_DISK, + PF_App_Color_TLW_CACHE_MARK_MIX, + PF_App_Color_FILL_LIGHT, + PF_App_Color_HOT_TEXT, + PF_App_Color_HOT_TEXT_DISABLED, + + /********************************/ + PF_App_Color_LABEL_0, + PF_App_Color_LABEL_1, + PF_App_Color_LABEL_2, + PF_App_Color_LABEL_3, + PF_App_Color_LABEL_4, + PF_App_Color_LABEL_5, + PF_App_Color_LABEL_6, + PF_App_Color_LABEL_7, + PF_App_Color_LABEL_8, + PF_App_Color_LABEL_9, + PF_App_Color_LABEL_10, + PF_App_Color_LABEL_11, + PF_App_Color_LABEL_12, + PF_App_Color_LABEL_13, + PF_App_Color_LABEL_14, + PF_App_Color_LABEL_15, + PF_App_Color_LABEL_16, + + /********************************/ + PF_App_Color_TLW_CACHE_MARK_MEM_DUBIOUS, + PF_App_Color_TLW_CACHE_MARK_DISK_DUBIOUS, + PF_App_Color_TLW_CACHE_MARK_MIX_DUBIOUS, + PF_App_Color_HOT_TEXT_PRESSED, + PF_App_Color_HOT_TEXT_WARNING, + PF_App_Color_PURE_BLACK, + PF_App_Color_PURE_WHITE, + + PF_App_Color_PANEL_BACKGROUND = 1000, + PF_App_Color_LIST_BOX_FILL, + PF_App_Color_DARK_CAPTION_FILL, + PF_App_Color_DARK_CAPTION_TEXT, + PF_App_Color_TEXT_ON_LIGHTER_BG, + + PF_App_Color_NUMTYPES +}; +typedef A_short PF_App_ColorType; + +enum { + // the first entry allows the user to do it the way they normally do with + // ae native color pickers (straight is the default, shift gives you premul) + PF_EyeDropperSampleMode_DEFAULT, + PF_EyeDropperSampleMode_STRAIGHT, + PF_EyeDropperSampleMode_PREMUL +}; + +typedef A_short PF_EyeDropperSampleMode; + +typedef struct PF_App_Color { + A_u_short red; + A_u_short green; + A_u_short blue; +} PF_App_Color; + + +#define PF_APP_MAX_PERS_LEN 63 + +typedef struct PF_AppPersonalTextInfo { + A_char name[PF_APP_MAX_PERS_LEN + 1]; + A_char org[PF_APP_MAX_PERS_LEN + 1]; + A_char serial_str[PF_APP_MAX_PERS_LEN + 1]; +} PF_AppPersonalTextInfo; + + +enum { + PF_FontStyle_NONE = -1, // sentinel + PF_FontStyle_SYS = 0, // system font, system size, system style (0, 0, 0) + PF_FontStyle_SMALL, // usually small annotation text + PF_FontStyle_SMALL_BOLD, // more important small annotations + PF_FontStyle_SMALL_ITALIC, // missing things, etc. + PF_FontStyle_MED, // times in in/out panels + PF_FontStyle_MED_BOLD, // + PF_FontStyle_APP, // + PF_FontStyle_APP_BOLD, // time in TL window + PF_FontStyle_APP_ITALIC // +}; +typedef A_LegacyEnumType PF_FontStyleSheet; + + + +#define PF_FONT_NAME_LEN 255 + +typedef struct PF_FontName { + A_char font_nameAC[PF_FONT_NAME_LEN+1]; +} PF_FontName; + + +#define PF_APP_LANG_TAG_SIZE (5 + 1) + +typedef struct _PF_AppProgressDialog *PF_AppProgressDialogP; + + +typedef struct PFAppSuite6 { /* frozen in AE 13.1 */ + + SPAPI PF_Err (*PF_AppGetBgColor)( PF_App_Color *bg_colorP); /* << */ + + SPAPI PF_Err (*PF_AppGetColor)( PF_App_ColorType color_type, /* >> */ + PF_App_Color *app_colorP); /* << */ + + // Provides the active displayed language of AE UI so plugin can match. e.g. "en_US" + SPAPI PF_Err (*PF_AppGetLanguage)( A_char *lang_tagZ); /* << up to PF_APP_LANG_TAG_SIZE-1 */ + + SPAPI PF_Err (*PF_GetPersonalInfo)( PF_AppPersonalTextInfo *ptiP); /* << */ + + SPAPI PF_Err (*PF_GetFontStyleSheet)(PF_FontStyleSheet sheet, /* >> */ + PF_FontName *font_nameP0, /* << */ + A_short *font_numPS0, /* << */ + A_short *sizePS0, /* << */ + A_short *stylePS0); /* << */ + + // normally the effect should respond to PF_Event_ADJUST_CURSOR, but for changing + // the cursor during modal situations, you can use this API + SPAPI PF_Err (*PF_SetCursor)( PF_CursorType cursor); /* >> */ + + // as of AE6.5, this function returns TRUE if installed app is the render engine (as before) + // OR if the app is being run with no UI OR if the app is in watch-folder mode + SPAPI PF_Err (*PF_IsRenderEngine)( PF_Boolean *render_enginePB); /* >> */ + + // will return PF_Interrupt_CANCEL if user cancels dialog. color is in project working colorspace + // if use_ws_to_monitor_xformB is TRUE, then the color chips and pickers are run through the + // working space -> display transformation while interacting. set FALSE to have the raw RGB values + // pushed directly to the screen. TRUE is intended for when the returned color is used in rendering, FALSE + // is intended if the color is for UI elements or other nonrenderables. + + SPAPI PF_Err (*PF_AppColorPickerDialog)( const A_char *dialog_titleZ0, /* >> */ + const PF_PixelFloat *sample_colorP, /* >> */ + PF_Boolean use_ws_to_monitor_xformB, /* >> */ + PF_PixelFloat *new_colorP); /* << */ + + // for use only when processing an event in an effect with custom UI + SPAPI PF_Err (*PF_GetMouse)(PF_Point* pointP); + + // NEW api in version 4. + // Use it to invalidate rect of current window being drawn. Invalidated rect will be updated during idle time. + // Specify PF_EO_UPDATE_NOW out flag to update the window immediately after the event returns. Specify rectP0 + // as NULL to invalidate the whole window. + // Only valid while handling an non-draw event in the effect. + SPAPI PF_Err (*PF_InvalidateRect)( const PF_ContextH contextH, + const PF_Rect* rectP0); + + // only safe to use when processing an event from a custom UI event. + SPAPI PF_Err (*PF_ConvertLocalToGlobal)(const PF_Point* localP, PF_Point* globalP); + + // this will return a deep color if over a content window containing 32bpc. + // eyeSize == 0 will use the application pref as set by the user. + SPAPI PF_Err (*PF_GetColorAtGlobalPoint)(const PF_Point* globalP, A_short eyeSize, PF_EyeDropperSampleMode mode, PF_PixelFloat* outColorP); + + + // Manages a modal progress dialog session for use inside of time-consuming AEGP commands + // Only one dialog active at a time is supported, and it may not get displayed in cases where AE UI is disabled (become no-ops) + // These calls must be used from the AE main/UI thread + // The app busy cursor will automatically set/reset as needed, regardless of whether dialog is displayed + SPAPI PF_Err (*PF_CreateNewAppProgressDialog)( + const A_UTF16Char* titleZ, // >> title of the progress dialog + const A_UTF16Char* cancel_strZ0, // >> [optional] what the name on the button should be. + // If NULL, AE localized Cancel used by default + PF_Boolean indeterminateB, // >> TRUE shows "barber pole" style animation with no incremental progress + PF_AppProgressDialogP *prog_dlgPP); // <> Returns allocated ProgressDialog session (may not display actual dialog yet) + + // This will trigger initial dialog display once timeout elapses. + // While dialog is displayed, this updates animation/progress status. + // If the session is disposed before the elapsed time the dialog is never displayed. + // This must be called frequently during your algorithm to keep UI responsive and animation moving. About 100ms interval would be a good target. + // Returns PF_Interrupt_CANCEL if user canceled the dialog + SPAPI PF_Err (*PF_AppProgressDialogUpdate)( + PF_AppProgressDialogP prog_dlgP, // >> The allocated session + A_long countL, A_long totalL); // >> count/total is the fraction of progress to display (when not indeterminate style) + // (pass zeros to keep barber-pole animation alive) + + // PF_AppProgressDialogP MUST be disposed whether the actual dialog is displayed or not + SPAPI PF_Err (*PF_DisposeAppProgressDialog)(PF_AppProgressDialogP prog_dlgP); // >> The allocated session. MUST be disposed. + +} PFAppSuite6; + + + +#define kPFEffectUISuite "PF Effect UI Suite" +#define kPFEffectUISuiteVersion1 1 /* frozen in 5.5 */ + +typedef struct PF_EffectUISuite1 { + + SPAPI PF_Err (*PF_SetOptionsButtonName)( PF_ProgPtr effect_ref, + const A_char *nameZ); + +} PF_EffectUISuite1; + + + + +#define kPFEffectCustomUISuite "PF Effect Custom UI Suite" +#define kPFEffectCustomUISuiteVersion2 2 /* frozen in 13.5 */ + +typedef struct _PF_AsyncManager *PF_AsyncManagerP; // manage multiple asynchronous render requests during lifetime, especially for better caching on UI thread + +// apis that relate to + +typedef struct PF_EffectCustomUISuite2 { + + // This provides basic apis needed for custom ui drawing in any window (Comp/Layer/ECW) + // Get the drawing reference for custom ui drawing. + SPAPI PF_Err (*PF_GetDrawingReference)( const PF_ContextH effect_contextH, /* >> */ + DRAWBOT_DrawRef *referenceP0); /* << */ + + // NEW in version 2 (ae13.5) + // When using PF_OutFlag2_CUSTOM_UI_ASYNC_MANAGER, use this to get the async manager associated with the effect PF_ContextH. + // The managed can then be asked to do Async render requests + SPAPI PF_Err (*PF_GetContextAsyncManager)( PF_InData* in_data, PF_EventExtra* extra, PF_AsyncManagerP* managerPP0); + +} PF_EffectCustomUISuite2; + + + + +#define kPFEffectCustomUIOverlayThemeSuite "PF Effect Custom UI Overlay Theme Suite" +#define kPFEffectCustomUIOverlayThemeSuiteVersion1 1 /* frozen in 10.0 */ + +// This suite should be used for stroking/filling paths, vertices etc on Comp/Layer window. After Effects is internally using it +// so use it to make custom ui look consistent across effects. The foreground/shadow colors are computed based on the app brightness +// level so custom ui is always visible regardless of app brightness. + +typedef struct PF_EffectCustomUIOverlayThemeSuite1 { + + // Get foreground/shadow colors preferred for custom ui drawing in AE. + // These colors are used by AE custom ui effects. + SPAPI PF_Err (*PF_GetPreferredForegroundColor)( DRAWBOT_ColorRGBA *foreground_colorP); /* << */ + + SPAPI PF_Err (*PF_GetPreferredShadowColor) ( DRAWBOT_ColorRGBA *shadow_colorP); /* << */ + + + // Get foreground & shadow stroke width, vertex size and shadow offset preferred for custom ui drawing in AE. + // These settings are used by AE custom ui effects. + SPAPI PF_Err (*PF_GetPreferredStrokeWidth)( float *stroke_widthPF); /* << for both foreground and shadow stroke */ + + SPAPI PF_Err (*PF_GetPreferredVertexSize)( float *vertex_sizePF); /* << */ + + SPAPI PF_Err (*PF_GetPreferredShadowOffset)( A_LPoint *shadow_offsetP); /* << */ + + + // Stroke the path with overlay theme foreground color. It can also draw shadow using overlay theme shadow color. + // It uses overlay theme stroke width for stroking foreground and shadow strokes. + SPAPI PF_Err (*PF_StrokePath) ( const DRAWBOT_DrawRef drawbot_ref, /* >> */ + const DRAWBOT_PathRef path_ref, /* >> */ + PF_Boolean draw_shadowB); /* >> */ + + + // Fills the path with overlay theme foreground color. It can also draw shadow using overlay theme shadow color. + // It can be used for drawing in any Comp/Layer/EC windows. + SPAPI PF_Err (*PF_FillPath) ( const DRAWBOT_DrawRef drawbot_ref, /* >> */ + const DRAWBOT_PathRef path_ref, /* >> */ + PF_Boolean draw_shadowB); /* >> */ + + + // Fills a square (vertex) around the center point using overlay theme foreground color and vertex size. + SPAPI PF_Err (*PF_FillVertex) ( const DRAWBOT_DrawRef drawbot_ref, /* >> */ + const A_FloatPoint *center_pointP, /* >> */ + PF_Boolean draw_shadowB); /* >> */ + +} PF_EffectCustomUIOverlayThemeSuite1; + + +// we include this at the end here to maintain source-level compatibility with +// files that #include AE_EffectSuite but are still using the old suites +// note: this is _inside_ the pre/post & ifdefs, as this is just a snippet, +// and not designed to be #include by anyone else +#define _H_AE_EffectSuitesOld + #include "AE_EffectSuitesOld.h" +#undef _H_AE_EffectSuitesOld + +/**********************************************************/ +/**********************************************************/ + +#ifdef __cplusplus + } +#endif + + +#include + +#endif diff --git a/External/AE SDK/Headers/AE_EffectSuitesHelper.h b/External/AE SDK/Headers/AE_EffectSuitesHelper.h new file mode 100644 index 00000000..0dc74657 --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectSuitesHelper.h @@ -0,0 +1,152 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/* Adobe Premiere Device Control plug-in definitions */ +/* */ +/* AE_EffectSuitesHelper.h */ +/* */ +/* After Effects 5.0 PICA Suites (extended 3/8/00) */ +/* */ +/* */ +/*******************************************************************/ + +#ifndef _H_AE_EffectSuitesHelper +#define _H_AE_EffectSuitesHelper + +#include +#include + +#include + +#ifdef __cplusplus + extern "C" { +#endif + + +/** PF_HelperSuite1 + + PF_GetCurrentTool() + + retrieves the type of the current tool palette tool selected + +**/ + +#define kPFHelperSuite "AE Plugin Helper Suite" +#define kPFHelperSuiteVersion1 1 +#define kPFHelperSuiteVersion kPFHelperSuiteVersion1 + +enum { + PF_SuiteTool_NONE = 0, + PF_SuiteTool_ARROW, + PF_SuiteTool_ROTATE, + PF_SuiteTool_SHAPE, + PF_SuiteTool_OBSOLETE, + PF_SuiteTool_PEN, + PF_SuiteTool_PAN, + PF_SuiteTool_HAND, + PF_SuiteTool_MAGNIFY, + PF_SuiteTool_ROUNDED_RECT, + PF_SuiteTool_POLYGON, + PF_SuiteTool_STAR, + PF_SuiteTool_PIN, + PF_SuiteTool_PIN_STARCH, + PF_SuiteTool_PIN_DEPTH +}; +typedef A_LegacyEnumType PF_SuiteTool; + + + +typedef struct PF_HelperSuite1 { + // obsolete, use PF_HelperSuite2 + SPAPI PF_Err (*PF_GetCurrentTool)( PF_SuiteTool *toolP ); /* << */ +} PF_HelperSuite1; + + +/** PF_HelperSuite2 + + PF_ParseClipboard() + + causes After Effects to parse the clipboard immediately + +**/ +enum { + PF_ExtendedSuiteTool_NONE = 0, + PF_ExtendedSuiteTool_ARROW, + PF_ExtendedSuiteTool_ROTATE, + PF_ExtendedSuiteTool_PEN_NORMAL, + PF_ExtendedSuiteTool_PEN_ADD_POINT, + PF_ExtendedSuiteTool_PEN_DELETE_POINT, + PF_ExtendedSuiteTool_PEN_CONVERT_POINT, + PF_ExtendedSuiteTool_RECT, + PF_ExtendedSuiteTool_OVAL, + PF_ExtendedSuiteTool_CAMERA_ORBIT_CAMERA, + PF_ExtendedSuiteTool_CAMERA_PAN_CAMERA, //changed from PF_ExtendedSuiteTool_CAMERA_TRACK_XY + PF_ExtendedSuiteTool_CAMERA_DOLLY_CAMERA, //changed from PF_ExtendedSuiteTool_CAMERA_TRACK_Z + PF_ExtendedSuiteTool_PAN_BEHIND, + PF_ExtendedSuiteTool_HAND, + PF_ExtendedSuiteTool_MAGNIFY, + PF_ExtendedSuiteTool_PAINTBRUSH, // All below added in 6.0 + PF_ExtendedSuiteTool_PENCIL, + PF_ExtendedSuiteTool_CLONE_STAMP, + PF_ExtendedSuiteTool_ERASER, + PF_ExtendedSuiteTool_TEXT, + PF_ExtendedSuiteTool_TEXT_VERTICAL, + PF_ExtendedSuiteTool_PIN, + PF_ExtendedSuiteTool_PIN_STARCH, + PF_ExtendedSuiteTool_PIN_DEPTH, + PF_ExtendedSuiteTool_ROUNDED_RECT, + PF_ExtendedSuiteTool_POLYGON, + PF_ExtendedSuiteTool_STAR, + PF_ExtendedSuiteTool_QUICKSELECT, + PF_ExtendedSuiteTool_CAMERA_MAYA, + PF_ExtendedSuiteTool_HAIRBRUSH, + PF_ExtendedSuiteTool_FEATHER, + PF_ExtendedSuiteTool_PIN_BEND, + PF_ExtendedSuiteTool_PIN_ADVANCED, + PF_ExtendedSuiteTool_CAMERA_ORBIT_CURSOR, //new cursors should go at the end to avoid messing with sdk order + PF_ExtendedSuiteTool_CAMERA_ORBIT_SCENE, + PF_ExtendedSuiteTool_CAMERA_PAN_CURSOR, + PF_ExtendedSuiteTool_CAMERA_DOLLY_TOWARDS_CURSOR, + PF_ExtendedSuiteTool_CAMERA_DOLLY_TO_CURSOR, +}; +typedef A_LegacyEnumType PF_ExtendedSuiteTool; + + +#define kPFHelperSuite2 "AE Plugin Helper Suite2" +#define kPFHelperSuite2Version1 1 +#define kPFHelperSuite2Version2 2 +#define kPFHelperSuite2Version kPFHelperSuite2Version2 + +typedef struct PF_HelperSuite2 { + SPAPI PF_Err (*PF_ParseClipboard)( void ); + // Do not call PF_SetCurrentExtendedTool until the UI is built. i.e. Do not call it from + // your plugin init function. + SPAPI PF_Err (*PF_SetCurrentExtendedTool)(PF_ExtendedSuiteTool tool); + SPAPI PF_Err (*PF_GetCurrentExtendedTool)(PF_ExtendedSuiteTool *tool); +} PF_HelperSuite2; + +#ifdef __cplusplus + } +#endif + +#include + + + +#endif diff --git a/External/AE SDK/Headers/AE_EffectSuitesOld.h b/External/AE SDK/Headers/AE_EffectSuitesOld.h new file mode 100644 index 00000000..a3f0d51a --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectSuitesOld.h @@ -0,0 +1,283 @@ +// AE_EffectSuitesOld.h +// +// Copyright (c) 2011 Adobe Systems Inc, Seattle WA +// All Rights Reserved +// +// These are old, deprecated versions of some suites. Please use the ones in AE_EffectSuites.h instead if at all possible. +// +// + +// +#ifndef _H_AE_EffectSuitesOld + #error this file is designed to be included only by AE_EffectSuites.h; do not include directly +#endif + +/** PF_ParamUtilsSuite1 + + PF_UpdateParamUI() + + You can call this function for each param whose UI settings you + want to change when handling a PF_Cmd_USER_CHANGED_PARAM or + PF_Cmd_UPDATE_PARAMS_UI. These changes are cosmetic only, and don't + go into the undo buffer. + + The ONLY fields that can be changed in this way are: + + PF_ParamDef + ui_flags: PF_PUI_ECW_SEPARATOR, PF_PUI_DISABLED only (and PF_PUI_INVISIBLE in Premiere). + ui_width + ui_height + name + flags: PF_ParamFlag_COLLAPSE_TWIRLY only + + PF_ParamDefUnion: + slider_min, slider_max, precision, display_flags of any slider type + + For PF_PUI_STD_CONTROL_ONLY params, you can also change the value field by setting + PF_ChangeFlag_CHANGED_VALUE before returning. But you are not allowed to change + the value during PF_Cmd_UPDATE_PARAMS_UI. + + PF_HaveInputsChangedOverTimeSpan() -- OBSOLETE, see PF_AreStatesIdentical() instead. + This API is handy for effects that do simulation across time, where frame N is + dependent on frame N-1, and you have a cache in your sequence data that needs validating. + When asked to render frame N, assume you have your cached data from frame N-1, you'd call + PF_HaveInputsChangedOverTimeSpan(start=0, duration=N-1) to see if your cache is still valid. + The state of all parameters (except those with PF_ParamFlag_EXCLUDE_FROM_HAVE_INPUTS_CHANGED + set), including layer parameters (including param[0]) are checked over the passed time + span. This is done efficiently, as the change tracking is done with timestamps. + + Requires PF_OutFlag2_AUTOMATIC_WIDE_TIME_INPUT to be set by the effect. If validating a + cache for use during a render, the call to PF_HaveInputsChangedOverTimeSpan() must + happen during one of the rendering PF_Cmds (PF_Cmd_FRAME_SETUP, PF_Cmd_RENDER, + PF_Cmd_FRAME_SETDOWN,PF_Cmd_SMART_PRE_RENDER, PF_Cmd_SMART_RENDER). + + If *changedPB is returned FALSE, you can safely use your cache, AND the internal + caching system will assume that you have a temporal dependency on the passed range, + so if something changes upstream, AE's caches will be properly invalidated. + +**/ + +#define kPFParamUtilsSuiteVersion1 2 /* 64-bit version frozen in AE 10.0 */ + + +typedef struct PF_ParamUtilsSuite1 { + + SPAPI PF_Err (*PF_UpdateParamUI)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + const PF_ParamDef *defP); + + // The next 3 methods have had "Obsolete" added to their name to intentionally + // break compile compatibility. They continue to work and are binary compatible, but + // are more conservative and inefficient than in previous versions. Please + // switch to the current version of this suite for maximum benefit. + SPAPI PF_Err (*PF_GetCurrentStateObsolete)( + PF_ProgPtr effect_ref, + PF_State *stateP); /* << */ + + SPAPI PF_Err (*PF_HasParamChangedObsolete)( + PF_ProgPtr effect_ref, + const PF_State *stateP, // has param changed since this state was grabbed + PF_ParamIndex param_index, // ignored, always treated as PF_ParamIndex_CHECK_ALL_HONOR_EXCLUDE - go use the modern version of this suite! + // have changed including layer param[0]; + // pass PF_ParamIndex_CHECK_ALL_EXCEPT_LAYER_PARAMS to see + // if any non-layer param values have changed + PF_Boolean *changedPB); /* << */ + + SPAPI PF_Err (*PF_HaveInputsChangedOverTimeSpanObsolete)( // see comment above + PF_ProgPtr effect_ref, + const PF_State *stateP, // has param changed since this state was grabbed + const A_Time *startPT0, // NULL for both start & duration mean at any time + const A_Time *durationPT0, + PF_Boolean *changedPB); /* << */ + + SPAPI PF_Err (*PF_IsIdenticalCheckout)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + A_long what_time1, + A_long time_step1, + A_u_long time_scale1, + A_long what_time2, + A_long time_step2, + A_u_long time_scale2, + PF_Boolean *identicalPB); /* << */ + + + SPAPI PF_Err (*PF_FindKeyframeTime)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + A_long what_time, + A_u_long time_scale, + PF_TimeDir time_dir, + PF_Boolean *foundPB, /* << */ + PF_KeyIndex *key_indexP0, /* << */ + A_long *key_timeP0, /* << */ // you can ask for either: + A_u_long *key_timescaleP0); /* << */ // time×cale OR neither + + SPAPI PF_Err (*PF_GetKeyframeCount)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + PF_KeyIndex *key_countP); /* << */ // returns PF_KeyIndex_NONE for constant + + SPAPI PF_Err (*PF_CheckoutKeyframe)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + PF_KeyIndex key_index, // zero-based + A_long *key_timeP0, /* << */ // you can ask for either: + A_u_long *key_timescaleP0, /* << */ // time×cale OR neither + PF_ParamDef *paramP0); /* << */ + + SPAPI PF_Err (*PF_CheckinKeyframe)( + PF_ProgPtr effect_ref, + PF_ParamDef *paramP); + + SPAPI PF_Err (*PF_KeyIndexToTime)( + PF_ProgPtr effect_ref, + PF_ParamIndex param_index, + PF_KeyIndex key_indexP, /* >> */ + A_long *key_timeP, /* >> */ + A_u_long *key_timescaleP); /* << */ + +} PF_ParamUtilsSuite1; + + +/* -------------------------------------------------------------------- */ + +#define kPFAppSuite "PF AE App Suite" +#define kPFAppSuiteVersion4 6 /* frozen in AE 10.0 */ + + +typedef struct PFAppSuite4 { /* frozen in AE 10.0 */ + + SPAPI PF_Err (*PF_AppGetBgColor)( PF_App_Color *bg_colorP); /* << */ + + SPAPI PF_Err (*PF_AppGetColor)( PF_App_ColorType color_type, /* >> */ + PF_App_Color *app_colorP); /* << */ + + SPAPI PF_Err (*PF_GetPersonalInfo)( PF_AppPersonalTextInfo *ptiP); /* << */ + + SPAPI PF_Err (*PF_GetFontStyleSheet)(PF_FontStyleSheet sheet, /* >> */ + PF_FontName *font_nameP0, /* << */ + A_short *font_numPS0, /* << */ + A_short *sizePS0, /* << */ + A_short *stylePS0); /* << */ + + // normally the effect should respond to PF_Event_ADJUST_CURSOR, but for changing + // the cursor during modal situations, you can use this API + SPAPI PF_Err (*PF_SetCursor)( PF_CursorType cursor); /* >> */ + + // as of AE6.5, this function returns TRUE if installed app is the render engine (as before) + // OR if the app is being run with no UI OR if the app is in watch-folder mode + SPAPI PF_Err (*PF_IsRenderEngine)( PF_Boolean *render_enginePB); /* >> */ + + // will return PF_Interrupt_CANCEL if user cancels dialog. color is in project working colorspace + // if use_ws_to_monitor_xformB is TRUE, then the color chips and pickers are run through the + // working space -> display transformation while interacting. set FALSE to have the raw RGB values + // pushed directly to the screen. TRUE is intended for when the returned color is used in rendering, FALSE + // is intended if the color is for UI elements or other nonrenderables. + + SPAPI PF_Err (*PF_AppColorPickerDialog)( const A_char *dialog_titleZ0, /* >> */ + const PF_PixelFloat *sample_colorP, /* >> */ + PF_Boolean use_ws_to_monitor_xformB, /* >> */ + PF_PixelFloat *new_colorP); /* << */ + + // for use only when processing an event in an effect with custom UI + SPAPI PF_Err (*PF_GetMouse)(PF_Point* pointP); + + // NEW api in version 4. + // Use it to invalidate rect of current window being drawn. Invalidated rect will be updated during idle time. + // Specify PF_EO_UPDATE_NOW out flag to update the window immediately after the event returns. Specify rectP0 + // as NULL to invalidate the whole window. + // Only valid while handling an non-draw event in the effect. + SPAPI PF_Err (*PF_InvalidateRect)( const PF_ContextH contextH, + const PF_Rect* rectP0); + + // only safe to use when processing an event from a custom UI event. + SPAPI PF_Err (*PF_ConvertLocalToGlobal)(const PF_Point* localP, PF_Point* globalP); + + // this will return a deep color if over a content window containing 32bpc. + // eyeSize == 0 will use the application pref as set by the user. + SPAPI PF_Err (*PF_GetColorAtGlobalPoint)(const PF_Point* globalP, A_short eyeSize, PF_EyeDropperSampleMode mode, PF_PixelFloat* outColorP); + +} PFAppSuite4; + + +/* -------------------------------------------------------------------- */ + + +#define kPFAppSuiteVersion5 7 /* frozen in AE 12.0 */ + +typedef struct PFAppSuite5 { /* frozen in AE 12.0 */ + + SPAPI PF_Err (*PF_AppGetBgColor)( PF_App_Color *bg_colorP); /* << */ + + SPAPI PF_Err (*PF_AppGetColor)( PF_App_ColorType color_type, /* >> */ + PF_App_Color *app_colorP); /* << */ + + // Provides the active displayed language of AE UI so plugin can match. e.g. "en_US" + SPAPI PF_Err (*PF_AppGetLanguage)( A_char *lang_tagZ); /* << up to PF_APP_LANG_TAG_SIZE-1 */ + + SPAPI PF_Err (*PF_GetPersonalInfo)( PF_AppPersonalTextInfo *ptiP); /* << */ + + SPAPI PF_Err (*PF_GetFontStyleSheet)(PF_FontStyleSheet sheet, /* >> */ + PF_FontName *font_nameP0, /* << */ + A_short *font_numPS0, /* << */ + A_short *sizePS0, /* << */ + A_short *stylePS0); /* << */ + + // normally the effect should respond to PF_Event_ADJUST_CURSOR, but for changing + // the cursor during modal situations, you can use this API + SPAPI PF_Err (*PF_SetCursor)( PF_CursorType cursor); /* >> */ + + // as of AE6.5, this function returns TRUE if installed app is the render engine (as before) + // OR if the app is being run with no UI OR if the app is in watch-folder mode + SPAPI PF_Err (*PF_IsRenderEngine)( PF_Boolean *render_enginePB); /* >> */ + + // will return PF_Interrupt_CANCEL if user cancels dialog. color is in project working colorspace + // if use_ws_to_monitor_xformB is TRUE, then the color chips and pickers are run through the + // working space -> display transformation while interacting. set FALSE to have the raw RGB values + // pushed directly to the screen. TRUE is intended for when the returned color is used in rendering, FALSE + // is intended if the color is for UI elements or other nonrenderables. + + SPAPI PF_Err (*PF_AppColorPickerDialog)( const A_char *dialog_titleZ0, /* >> */ + const PF_PixelFloat *sample_colorP, /* >> */ + PF_Boolean use_ws_to_monitor_xformB, /* >> */ + PF_PixelFloat *new_colorP); /* << */ + + // for use only when processing an event in an effect with custom UI + SPAPI PF_Err (*PF_GetMouse)(PF_Point* pointP); + + // NEW api in version 4. + // Use it to invalidate rect of current window being drawn. Invalidated rect will be updated during idle time. + // Specify PF_EO_UPDATE_NOW out flag to update the window immediately after the event returns. Specify rectP0 + // as NULL to invalidate the whole window. + // Only valid while handling an non-draw event in the effect. + SPAPI PF_Err (*PF_InvalidateRect)( const PF_ContextH contextH, + const PF_Rect* rectP0); + + // only safe to use when processing an event from a custom UI event. + SPAPI PF_Err (*PF_ConvertLocalToGlobal)(const PF_Point* localP, PF_Point* globalP); + + // this will return a deep color if over a content window containing 32bpc. + // eyeSize == 0 will use the application pref as set by the user. + SPAPI PF_Err (*PF_GetColorAtGlobalPoint)(const PF_Point* globalP, A_short eyeSize, PF_EyeDropperSampleMode mode, PF_PixelFloat* outColorP); + + +} PFAppSuite5; + +/* -------------------------------------------------------------------- */ + +#define kPFEffectCustomUISuite "PF Effect Custom UI Suite" +#define kPFEffectCustomUISuiteVersion1 1 /* frozen in 10.0 */ + +// This suite provides basic apis needed for custom ui drawing in any window (Comp/Layer/ECW) + +typedef struct PF_EffectCustomUISuite1 { + + // Get the drawing reference for custom ui drawing. + SPAPI PF_Err (*PF_GetDrawingReference)( const PF_ContextH effect_contextH, /* >> */ + DRAWBOT_DrawRef *referenceP0); /* << */ + +} PF_EffectCustomUISuite1; + + diff --git a/External/AE SDK/Headers/AE_EffectUI.h b/External/AE SDK/Headers/AE_EffectUI.h new file mode 100644 index 00000000..18371a00 --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectUI.h @@ -0,0 +1,580 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +/** AE_EffectUI.h + + Part of the After Effects SDK. + + Describes structures and callbacks used by plug-ins with Custom + composition window and effect palette UIs. + +**/ + +#ifndef _H_AE_EffectUI +#define _H_AE_EffectUI + + +#include + +#ifdef ADOBE_SDK_INTERNAL + #include +#else + #include +#endif + + +#include + + + + + +#ifdef __cplusplus + extern "C" { +#endif + + +/** PF_CustomFlags + ** + ** kinds of events and actions the custom parameter type might require + ** + **/ + +enum { + PF_CustomEFlag_NONE = 0, + + PF_CustomEFlag_COMP = 1L << 0, + PF_CustomEFlag_LAYER = 1L << 1, + PF_CustomEFlag_EFFECT = 1L << 2, + PF_CustomEFlag_PREVIEW = 1L << 3 +}; +typedef A_long PF_CustomEventFlags; + + +enum { + PF_Window_NONE = -1, + PF_Window_COMP, + PF_Window_LAYER, + PF_Window_EFFECT, + PF_Window_PREVIEW +}; +typedef A_long PF_WindowType; + + +/* $$$ document! + + new context -> evt extra has context and type, but everything else should be ignored + fill in plugin_state[4] + close context -> + all other evts -> params set up, but no layers + +*/ +enum { + PF_Event_NONE = -1, + PF_Event_NEW_CONTEXT, + PF_Event_ACTIVATE, + PF_Event_DO_CLICK, + PF_Event_DRAG, + PF_Event_DRAW, + PF_Event_DEACTIVATE, + PF_Event_CLOSE_CONTEXT, + PF_Event_IDLE, + PF_Event_KEYDOWN_OBSOLETE, // As of AE 7, this is no longer used. + PF_Event_ADJUST_CURSOR, // new for AE 4.0, sent when mouse moves over custom UI + PF_Event_KEYDOWN, // new for AE 7.0, replaces previous keydown event with cross platform codes and unicode characters. + PF_Event_MOUSE_EXITED, // new for AE 11.0, notification that the mouse is no longer over a specific view (layer or comp only). + + PF_Event_NUM_EVENTS +}; +typedef A_long PF_EventType; + + +enum { + PF_Cursor_NONE = 0, // see comment in PF_AdjustCursorEventInfo + PF_Cursor_CUSTOM, // means effect set cursor itself with platform-specific calls + PF_Cursor_ARROW, + PF_Cursor_HOLLOW_ARROW, + PF_Cursor_WATCH_N_WAIT, // watch on the Mac, wait (hourglass) on Windows + PF_Cursor_MAGNIFY, + PF_Cursor_MAGNIFY_PLUS, + PF_Cursor_MAGNIFY_MINUS, + PF_Cursor_CROSSHAIRS, + PF_Cursor_CROSS_RECT, + PF_Cursor_CROSS_OVAL, + PF_Cursor_CROSS_ROTATE, + PF_Cursor_PAN, + PF_Cursor_EYEDROPPER, + PF_Cursor_HAND, + PF_Cursor_PEN, + PF_Cursor_PEN_ADD, + PF_Cursor_PEN_DELETE, + PF_Cursor_PEN_CLOSE, + PF_Cursor_PEN_DRAG, + PF_Cursor_PEN_CORNER, + PF_Cursor_RESIZE_VERTICAL, + PF_Cursor_RESIZE_HORIZONTAL, + PF_Cursor_FINGER_POINTER, + PF_Cursor_SCALE_HORIZ, + PF_Cursor_SCALE_DIAG_LR, + PF_Cursor_SCALE_VERT, + PF_Cursor_SCALE_DIAG_UR, + PF_Cursor_ROT_TOP, + PF_Cursor_ROT_TOP_RIGHT, + PF_Cursor_ROT_RIGHT, + PF_Cursor_ROT_BOT_RIGHT, + PF_Cursor_ROT_BOTTOM, + PF_Cursor_ROT_BOT_LEFT, + PF_Cursor_ROT_LEFT, + PF_Cursor_ROT_TOP_LEFT, + PF_Cursor_DRAG_CENTER, + PF_Cursor_COPY, + PF_Cursor_ALIAS, + PF_Cursor_CONTEXT, + PF_Cursor_SLIP_EDIT, + PF_Cursor_CAMERA_ORBIT_CAMERA, //changed from PF_Cursor_ORBIT + PF_Cursor_CAMERA_PAN_CAMERA, //changed from PF_Cursor_TRACK_XY + PF_Cursor_CAMERA_DOLLY_CAMERA, //changed from PF_Cursor_TRACK_Z + PF_Cursor_ROTATE_X, + PF_Cursor_ROTATE_Y, + PF_Cursor_ROTATE_Z, + PF_Cursor_ARROW_X, + PF_Cursor_ARROW_Y, + PF_Cursor_ARROW_Z, + PF_Cursor_SCISSORS, + PF_Cursor_FAT_EYEDROPPER, + PF_Cursor_FINGER_POINTER_SCRUB, + PF_Cursor_HORZ_I_BEAM, + PF_Cursor_VERT_I_BEAM, + PF_Cursor_HORZ_BOX_I_BEAM, + PF_Cursor_VERT_BOX_I_BEAM, + PF_Cursor_I_BEAM_0, + PF_Cursor_I_BEAM_11_25, + PF_Cursor_I_BEAM_22_5, + PF_Cursor_I_BEAM_33_75, + PF_Cursor_I_BEAM_45, + PF_Cursor_I_BEAM_56_25, + PF_Cursor_I_BEAM_67_5, + PF_Cursor_I_BEAM_78_75, + PF_Cursor_I_BEAM_90, + PF_Cursor_I_BEAM_101_25, + PF_Cursor_I_BEAM_112_5, + PF_Cursor_I_BEAM_123_75, + PF_Cursor_I_BEAM_135, + PF_Cursor_I_BEAM_146_25, + PF_Cursor_I_BEAM_157_5, + PF_Cursor_I_BEAM_168_75, + PF_Cursor_CROSSHAIRS_PICKUP, + PF_Cursor_ARROW_SELECTOR, + PF_Cursor_LAYER_MOVE, + PF_Cursor_MOVE_START_MARGIN, + PF_Cursor_MOVE_END_MARGIN, + PF_Cursor_SOLID_ARROW, + PF_Cursor_HOLLOW_ARROW_PLUS, + PF_Cursor_BRUSH_CENTER, + PF_Cursor_CLONE_SOURCE, + PF_Cursor_CLONE_SOURCE_OFFSET, + PF_Cursor_HOLLOW_LAYER_MOVE, + PF_Cursor_MOVE_TRACK_SEARCH_REGION, + PF_Cursor_MOVE_TRACK_ATTACH_POINT, + PF_Cursor_COLOR_CUBE_CROSS_SECTION, + PF_Cursor_PEN_CORNER_ROTOBEZ_TENSION, + PF_Cursor_PIN, + PF_Cursor_PIN_ADD, + PF_Cursor_MESH_ADD, + PF_Cursor_MARQUEE, + PF_Cursor_CROSS_ROUNDED_RECT, + PF_Cursor_CROSS_POLYGON, + PF_Cursor_CROSS_STAR, + PF_Cursor_PIN_STARCH, + PF_Cursor_PIN_OVERLAP, + PF_Cursor_STOPWATCH, + PF_Cursor_DRAG_DOT, + PF_Cursor_DRAG_CIRCLE, + PF_Cursor_DIRECT_SELECT, + PF_Cursor_DRAG_COPY_MOVE, + PF_Cursor_DRAG_COPY_ROTATE, + PF_Cursor_CAMERA_MAYA, //Changed from PF_Cursor_MAYA + PF_Cursor_RESIZE_HORIZONTAL_LEFT, + PF_Cursor_RESIZE_HORIZONTAL_RIGHT, + PF_Cursor_FEATHER, + PF_Cursor_FEATHER_ADD, + PF_Cursor_FEATHER_DELETE, + PF_Cursor_FEATHER_MOVE, + PF_Cursor_FEATHER_TENSION, + PF_Cursor_FEATHER_MARQUEE, + PF_Cursor_LASSO_ARROW, + PF_Cursor_DRAG_NO_DROP, + PF_Cursor_DRAG_COPY, + PF_Cursor_DRAG_LINK, + PF_Cursor_PIN_BEND, + PF_Cursor_PIN_ADVANCED, + PF_Cursor_CAMERA_ORBIT_CURSOR, + PF_Cursor_CAMERA_ORBIT_SCENE, + PF_Cursor_CAMERA_PAN_CURSOR, + PF_Cursor_CAMERA_DOLLY_TOWARDS_CURSOR, + PF_Cursor_CAMERA_DOLLY_TO_CURSOR, + + PF_MAX_CURSOR_PLUS_ONE +}; +typedef A_long PF_CursorType; + + +enum { + PF_Mod_NONE = 0x0000, + PF_Mod_CMD_CTRL_KEY = 0x0100, // cmd on Mac, ctrl on Windows + PF_Mod_SHIFT_KEY = 0x0200, + PF_Mod_CAPS_LOCK_KEY = 0x0400, + PF_Mod_OPT_ALT_KEY = 0x0800, // option on Mac, alt on Windows + PF_Mod_MAC_CONTROL_KEY = 0x1000 // Mac control key only +}; +typedef A_long PF_Modifiers; + + +typedef struct { + PF_Point screen_point; /* >> where the mouse is right now */ + PF_Modifiers modifiers; /* >> modifiers right now */ + PF_CursorType set_cursor; /* << set this to your desired cursor, or PF_Cursor_CUSTOM if you + set the cursor yourself, or PF_Cursor_NONE if you don't + want to override the cursor (i.e. the app will set the + cursor however it wants) */ +} PF_AdjustCursorEventInfo; + +typedef struct { + A_u_long when; + PF_Point screen_point; + A_long num_clicks; + PF_Modifiers modifiers; + A_intptr_t continue_refcon[4]; /* <> if send_drag is TRUE, set this */ + PF_Boolean send_drag; /* << set this from a do_click to get a drag */ + PF_Boolean last_time; /* >> set the last time you get a drag */ +} PF_DoClickEventInfo; + + +typedef struct { + PF_UnionableRect update_rect; // in window's coordinate system + A_long depth; +} PF_DrawEventInfo; + + +typedef struct { + A_u_long when; + PF_Point screen_point; + A_long char_code; + A_long key_code; + PF_Modifiers modifiers; +} PF_KeyDownEventObsolete; // As of AE 7, this is no longer used. + + +typedef A_u_long PF_KeyCode; // For printable characters, we use the unshifted upper case version (A not a, 7 not &). +typedef A_u_short PF_ControlCode; + +typedef struct { + A_u_long when; + PF_Point screen_point; + PF_KeyCode keycode; // as of AE 7, this is either a control code, or character code + PF_Modifiers modifiers; + +} PF_KeyDownEvent; + + +enum { + PF_KEYCODE_FLAG_Printable = 1 << 31, // a printable key, otherwise a control code like page up + PF_KEYCODE_FLAG_Extended = 1 << 30 // an alternate key, typically on the numeric keypad. +}; + +#define PF_GENERATE_KEYBOARD_CODE_VALUE(CODE_VALUE, FLAGS) (((CODE_VALUE) & 0xFFFF) | (FLAGS)) +#define PF_GENERATE_KEYBOARD_CODE_VALUE_FROM_CHARACTER(CHAR) PF_GENERATE_KEYBOARD_CODE_VALUE(CHAR, PF_KEYCODE_FLAG_Printable) +#define PF_GENERATE_KEYBOARD_CODE_VALUE_FROM_CHARACTER_EXTENDED(CHAR) PF_GENERATE_KEYBOARD_CODE_VALUE(CHAR, PF_KEYCODE_FLAG_Printable | PF_KEYCODE_FLAG_Extended) +#define PF_GENERATE_KEYBOARD_CODE_VALUE_FROM_CONTROL_CODE(CODE) PF_GENERATE_KEYBOARD_CODE_VALUE(CODE, 0) +#define PF_GENERATE_KEYBOARD_CODE_VALUE_FROM_CONTROL_CODE_EXTENDED(CODE) PF_GENERATE_KEYBOARD_CODE_VALUE(CODE, PF_KEYCODE_FLAG_Extended) + +#define PF_KEYCODE_IS_PRINTABLE(_KEY_CODE) (((_KEY_CODE) & PF_KEYCODE_FLAG_Printable ) != 0) +#define PF_KEYCODE_IS_EXTENDED(_KEY_CODE) (((_KEY_CODE) & PF_KEYCODE_FLAG_Extended ) != 0) + +#define PF_KEYCODE_GET_SHORTCUT_CHARACTER(_KEY_CODE) (PF_KEYCODE_IS_PRINTABLE(_KEY_CODE)) ? ((_KEY_CODE) & 0xFFFF) : 0 +#define PF_KEYCODE_GET_CONTROL_CODE(_KEY_CODE) (!PF_KEYCODE_IS_PRINTABLE(_KEY_CODE)) ? ((_KEY_CODE) & 0xFFFF) : 0 + +enum { + PF_ControlCode_Unknown = (PF_ControlCode)0xFFFF, + + PF_ControlCode_Space = 1, + PF_ControlCode_Backspace, + PF_ControlCode_Tab, + PF_ControlCode_Return, + PF_ControlCode_Enter, + + PF_ControlCode_Escape, + + PF_ControlCode_F1, + PF_ControlCode_F2, + PF_ControlCode_F3, + PF_ControlCode_F4, + PF_ControlCode_F5, + PF_ControlCode_F6, + PF_ControlCode_F7, + PF_ControlCode_F8, + PF_ControlCode_F9, + PF_ControlCode_F10, + PF_ControlCode_F11, + PF_ControlCode_F12, + PF_ControlCode_F13, + PF_ControlCode_F14, + PF_ControlCode_F15, + PF_ControlCode_F16, + PF_ControlCode_F17, + PF_ControlCode_F18, + PF_ControlCode_F19, + PF_ControlCode_F20, + PF_ControlCode_F21, + PF_ControlCode_F22, + PF_ControlCode_F23, + PF_ControlCode_F24, + + PF_ControlCode_PrintScreen, + PF_ControlCode_ScrollLock, + PF_ControlCode_Pause, + + PF_ControlCode_Insert, + PF_ControlCode_Delete, + PF_ControlCode_Home, + PF_ControlCode_End, + PF_ControlCode_PageUp, + PF_ControlCode_PageDown, + PF_ControlCode_Help, + PF_ControlCode_Clear, + + PF_ControlCode_Left, + PF_ControlCode_Right, + PF_ControlCode_Up, + PF_ControlCode_Down, + + PF_ControlCode_NumLock, + + PF_ControlCode_Command, + PF_ControlCode_Option, + PF_ControlCode_Alt = PF_ControlCode_Option, + PF_ControlCode_Control, + PF_ControlCode_Shift, + PF_ControlCode_CapsLock, + + PF_ControlCode_ContextMenu +}; + + +typedef union { + PF_DoClickEventInfo do_click; // also drag + PF_DrawEventInfo draw; + PF_KeyDownEvent key_down; + PF_AdjustCursorEventInfo adjust_cursor; + + // add other event types here + +} PF_EventUnion; + +#if defined(A_INTERNAL) && defined (__cplusplus) + class FLT_FCSeqSpec; + typedef FLT_FCSeqSpec *PF_ContextRefcon; +#else + typedef struct _PF_ContextRefcon *PF_ContextRefcon; +#endif + +#define PF_CONTEXT_MAGIC 0x05ea771e +typedef struct { + A_u_long magic; + PF_WindowType w_type; + PF_ContextRefcon reserved_flt; + A_intptr_t plugin_state[4]; // plug-in specific data + DRAWBOT_DrawRef reserved_drawref; + void *reserved_paneP; + void *reserved_job_manageP; // used for managing async job requests for UI in the context of Effect pane custom UI +} PF_Context, *PF_ContextPtr, **PF_ContextH; + +typedef enum { + PenTip, + PenEraser +} PF_StylusTool; + +typedef struct { + // only applies when stylus_dataB == true; + A_FpShort stylus_tiltxF; // -1.0 to 1.0 0.0 == vertical + A_FpShort stylus_tiltyF; // -1.0 to 1.0 0.0 == vertical + A_FpShort stylus_pressureF; // 0.0 to 1.0 1.0 == full pressure + A_FpShort stylus_wheelF; // -1.0 to 1.0 0.0 == none +} PF_StylusEventInfo; + +typedef struct PF_PointerEventInfo { + A_FpLong when_secondsF; + PF_Point screen_point; + A_short num_clicksS; + A_long mod_keysL; + + PF_StylusTool stylus_tool; // set to PenTip when using mouse + PF_Boolean stylus_extra_dataB; + PF_StylusEventInfo stylus_extra_data; // only valid when stylus_extra_dataB == true +} PF_PointerEventInfo; + +typedef struct { + void *refcon; // front-end's refcon + + PF_Err (*layer_to_comp)(void *refcon, /* >> */ + PF_ContextH context, /* >> */ + A_long curr_time, /* >> */ + A_long time_scale, /* >> */ + PF_FixedPoint *pt); /* << */ + + PF_Err (*comp_to_layer)(void *refcon, /* >> */ + PF_ContextH context, /* >> */ + A_long curr_time, /* >> */ + A_long time_scale, /* >> */ + PF_FixedPoint *pt); /* << */ + + PF_Err (*get_comp2layer_xform)(void *refcon, /* >> */ + PF_ContextH context, /* >> */ + A_long curr_time, /* >> */ + A_long time_scale, /* >> */ + A_long *exists, /* << non-zero if exists */ + PF_FloatMatrix *c2l); /* << */ + + PF_Err (*get_layer2comp_xform)(void *refcon, /* >> */ + PF_ContextH context, /* >> */ + A_long curr_time, /* >> */ + A_long time_scale, /* >> */ + PF_FloatMatrix *l2c); /* << */ + + PF_Err (*source_to_frame)(void *refcon, PF_ContextH context, PF_FixedPoint *pt); + PF_Err (*frame_to_source)(void *refcon, PF_ContextH context, PF_FixedPoint *pt); + + PF_Err (*info_draw_color)(void *refcon, PF_Pixel color); + + // 2 lines of text, same as calling PF_InfoDrawText3( line1Z0, line2Z0, NULL) + PF_Err (*info_draw_text)(void *refcon, const A_char *text1Z0, const A_char *text2Z0); // Cstrings + + // Due to this structure's containment within PF_EventExtra, + // we are unable to add new functions to this structure in order + // to remain backwards compatible. In other words, do not add any + // new functions here, add them to the PF_AdvAppSuite1 suite + // within AE_AdvEffectSuites.h. -jja 10-24-2000 + +} PF_EventCallbacks, *PF_EventCallbacksPtr; + +enum { + PF_EA_NONE = 0, + PF_EA_PARAM_TITLE, + PF_EA_CONTROL +}; +typedef A_long PF_EffectArea; + +typedef struct { + PF_ParamIndex index; + PF_EffectArea area; + PF_UnionableRect current_frame; // full frame of the current area + PF_UnionableRect param_title_frame; // full frame of the param title area + A_long horiz_offset; // h offset to draw into title +} PF_EffectWindowInfo; + +enum { + PF_EO_NONE = 0, + PF_EO_HANDLED_EVENT = (1L << 0), + PF_EO_ALWAYS_UPDATE = (1L << 1), //rerender the comp + PF_EO_NEVER_UPDATE = (1L << 2), //do not rerender the comp + PF_EO_UPDATE_NOW = (1L << 3) //update the view immediately after the event returns when using PF_InvalidateRect +}; +typedef A_long PF_EventOutFlags; + +enum { + PF_EI_NONE = 0, + PF_EI_DONT_DRAW = 1L << 0 // don't draw controls in comp or layer window +}; +typedef A_long PF_EventInFlags; + +// this info is passed for ALL event types, except those in the Effect Control Window +// in ECW, you get the PF_EffectWindowInfo, during all events +typedef struct { + PF_UnionableRect port_rect; +} PF_ItemWindowInfo; + +/* + to know what union to take, look in + (**contextH).w_type. if == effect win, you get effect win, else you get item win +*/ +typedef union { + PF_EffectWindowInfo effect_win; /* >> only for Effect window do_click, draw, and adjust-cursor */ + PF_ItemWindowInfo item_win; /* >> comp or layer */ +} PF_WindowUnion; + +// uncomment if you want to get the port rect during most events +// #define PF_USE_NEW_WINDOW_UNION +typedef struct { + PF_ContextH contextH; /* >> */ + PF_EventType e_type; /* >> */ + PF_EventUnion u; /* >> based on e_type */ + + #ifdef PF_USE_NEW_WINDOW_UNION + PF_WindowUnion window_union; /* >> union of window-specific handy information */ + #else + PF_EffectWindowInfo effect_win; /* >> only for Effect window do_click, draw, and adjust-cursor */ + #endif + + PF_EventCallbacks cbs; /* >> not for new_context or close_context */ + PF_EventInFlags evt_in_flags; /* >> */ + PF_EventOutFlags evt_out_flags; /* << */ +} PF_EventExtra; + +enum { + PF_UIAlignment_NONE = 0, // No values other than PF_UIAlignment_NONE are honored, in AE or PPro. + PF_UIAlignment_TOP = 1L << 0, + PF_UIAlignment_LEFT = 1L << 1, + PF_UIAlignment_BOTTOM = 1L << 2, + PF_UIAlignment_RIGHT = 1L << 3 +}; + +typedef A_long PF_UIAlignment; + +struct _PF_CustomUIInfo { + + A_long reserved; + PF_CustomEventFlags events; + + A_long comp_ui_width; + A_long comp_ui_height; + PF_UIAlignment comp_ui_alignment; // unused + + A_long layer_ui_width; + A_long layer_ui_height; + PF_UIAlignment layer_ui_alignment; // unused + + A_long preview_ui_width; // unused + A_long preview_ui_height; // unused + PF_UIAlignment preview_ui_alignment; // unused + +}; + + +#ifdef __cplusplus +} +#endif + + +#include + + + +#endif /* _H_AE_EffectUI */ diff --git a/External/AE SDK/Headers/AE_EffectVers.h b/External/AE SDK/Headers/AE_EffectVers.h new file mode 100644 index 00000000..f9ab54a3 --- /dev/null +++ b/External/AE SDK/Headers/AE_EffectVers.h @@ -0,0 +1,17 @@ +#ifndef _H_AE_EffectVers +#define _H_AE_EffectVers + + +#define AEFX_API_VERSION 8 +#define AEFX_API_SUBVERS ' ' +#define AEFXp_CODE_VERSION 0 // no longer user, we have p4 now + +// these are here as copies -> when these change in AE_Effect.h, AEFX won't compile +// when they change, decide how to update above versions +// NOTE: this file is included by effect\shared\AEFX_PiPL.r and these versions are +// used when building PiPLs +#define PF_PLUG_IN_VERSION 13 // auto-set by prep_codeline_for_release.py, adjust comment if manually edit is okay +#define PF_PLUG_IN_SUBVERS 27 // manually set for SDK changes to allow more than 32 max threads for PF_Iterate + + +#endif diff --git a/External/AE SDK/Headers/AE_GeneralPlug.h b/External/AE SDK/Headers/AE_GeneralPlug.h new file mode 100644 index 00000000..ea0f7de9 --- /dev/null +++ b/External/AE SDK/Headers/AE_GeneralPlug.h @@ -0,0 +1,5779 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef _H_AE_PlugGeneral +#define _H_AE_PlugGeneral + +#include +#include +#include +#include +#include + +#include +#include +#include +#ifdef AEGP_INTERNAL +#include +#endif +#include +#include + + +#include + +#define AEGP_PLUGIN_TYPE 'AEgx' + +#define AEGP_INITFUNC_MAJOR_VERSION 1 +#define AEGP_INITFUNC_MINOR_VERSION 9 + +#ifndef AEGP_INTERNAL + typedef struct _AEGP_Project **AEGP_ProjectH; + typedef struct _AEGP_Item **AEGP_ItemH; + typedef struct _AEGP_Comp **AEGP_CompH; + typedef struct _AEGP_Footage **AEGP_FootageH; + typedef struct _AEGP_Layer **AEGP_LayerH; + typedef struct _AEGP_Effect **AEGP_EffectRefH; + typedef struct _AEGP_Mask **AEGP_MaskRefH; + typedef struct _AEGPp_Stream **AEGP_StreamRefH; + typedef struct _AEGP_LayerContext **AEGP_RenderLayerContextH; + typedef struct _AEGP_PersistentBlob **AEGP_PersistentBlobH; + typedef struct _AEGP_MaskOutline **AEGP_MaskOutlineValH; + typedef struct _AEGP_Collection **AEGP_CollectionH; + typedef struct _AEGP_Collection2 **AEGP_Collection2H; + typedef struct _AEGP_SoundData **AEGP_SoundDataH; + typedef struct _AEGP_AddKeyframesInfo **AEGP_AddKeyframesInfoH; + typedef struct _AEGP_RenderReceipt **AEGP_RenderReceiptH; + typedef struct _AEGP_World **AEGP_WorldH; + typedef struct _AEGP_RenderOptions **AEGP_RenderOptionsH; + typedef struct _AEGP_LayerRenderOptions **AEGP_LayerRenderOptionsH; + typedef struct _AEGP_FrameReceipt **AEGP_FrameReceiptH; + typedef struct _AEGP_RenderQueueItem **AEGP_RQItemRefH; + typedef struct _AEGP_OutputModule **AEGP_OutputModuleRefH; + typedef struct _AEGP_TextDocument **AEGP_TextDocumentH; + typedef struct _AEGP_MarkerVal *AEGP_MarkerValP; + // AEGP_ConstMarkerValP is defined in AE_IO.h; + typedef struct _AEGP_TextOutlines **AEGP_TextOutlinesH; + typedef struct _AEGP_TimeStamp{A_char a[4];} AEGP_TimeStamp; + typedef struct _AEGP_PlatformWorld **AEGP_PlatformWorldH; + typedef struct _AEGP_ItemView *AEGP_ItemViewP; + typedef struct _AEGP_ColorProfile *AEGP_ColorProfileP; + typedef const struct _AEGP_ColorProfile *AEGP_ConstColorProfileP; +#endif + +typedef A_long AEGP_SubLayerIndex; + +#define AEGP_SubLayer_ALL (-1L) + +typedef A_long AEGP_PluginID; +// define a _AEGP_Refcon1 struct to use a typesafe refcon. +typedef struct _AEGP_GlobalRefcon *AEGP_GlobalRefcon; +typedef struct _AEGP_CommandRefcon *AEGP_CommandRefcon; +typedef struct _AEGP_UpdateMenuRefcon *AEGP_UpdateMenuRefcon; +typedef struct _AEGP_DeathRefcon *AEGP_DeathRefcon; +typedef struct _AEGP_VersionRefcon *AEGP_VersionRefcon; +typedef struct _AEGP_AboutStringRefcon *AEGP_AboutStringRefcon; +typedef struct _AEGP_AboutRefcon *AEGP_AboutRefcon; +typedef struct _AEGP_AsyncFrameRequestRefcon *AEGP_AsyncFrameRequestRefcon; +typedef struct _AEGP_IdleRefcon *AEGP_IdleRefcon; +typedef struct _AEGP_IORefcon *AEGP_IORefcon; +typedef struct _AEGP_CancelRefcon *AEGP_CancelRefcon; + + +// _SIZE constants include space for the terminating null. -1 for string length. +#define AEGP_MAX_PATH_SIZE 260 +#define AEGP_MAX_ABOUT_STRING_SIZE 256 +#define AEGP_MAX_RQITEM_COMMENT_SIZE 256 +#define AEGP_MAX_TYPE_NAME_SIZE 32 +#define AEGP_MAX_ITEM_NAME_SIZE 32 +#define AEGP_MAX_ITEM_NAME_SIZE 32 +#define AEGP_MAX_LAYER_NAME_SIZE 32 +#define AEGP_MAX_MASK_NAME_SIZE 32 +#define AEGP_MAX_EFFECT_NAME_SIZE (PF_MAX_EFFECT_NAME_LEN + 17) +#define AEGP_MAX_EFFECT_MATCH_NAME_SIZE (PF_MAX_EFFECT_NAME_LEN + 17) +#define AEGP_MAX_EFFECT_CATEGORY_NAME_SIZE (PF_MAX_EFFECT_CATEGORY_NAME_LEN + 1) +#define AEGP_MAX_STREAM_NAME_SIZE (PF_MAX_EFFECT_PARAM_NAME_LEN + 1) +#define AEGP_MAX_STREAM_UNITS_SIZE (PF_MAX_EFFECT_PARAM_NAME_LEN + 1) +#define AEGP_MAX_PROJ_NAME_SIZE 48 +#define AEGP_MAX_PLUGIN_NAME_SIZE 32 + +#define AEGP_MAX_MARKER_NAME_SIZE 64 +#define AEGP_MAX_MARKER_URL_SIZE 1024 +#define AEGP_MAX_MARKER_TARGET_SIZE 128 +#define AEGP_MAX_MARKER_CHAPTER_SIZE 128 + + +enum { + AEGP_Platform_MAC, + AEGP_Platform_WIN +}; +typedef A_long AEGP_Platform; + +enum { + AEGP_ProjBitDepth_8 = 0, + AEGP_ProjBitDepth_16, + AEGP_ProjBitDepth_32, + AEGP_ProjBitDepth_NUM_VALID_DEPTHS +}; +typedef A_char AEGP_ProjBitDepth; + +#define AEGP_Index_NONE ((A_long)0x80000000) +#define AEGP_Index_START ((A_long)0) +#define AEGP_Index_END ((A_long)-1) + +typedef A_long AEGP_Index; + +#define AEGP_LayerIDVal_NONE (0L) + +typedef A_long AEGP_LayerIDVal; + +#define AEGP_MaskIDVal_NONE (0L) + +typedef A_long AEGP_MaskIDVal; + +typedef struct { + A_FpLong alphaF, redF, greenF, blueF; // in the range [0.0 - 1.0] +} AEGP_ColorVal; + + +enum { + AEGP_CameraType_NONE = -1, + + AEGP_CameraType_PERSPECTIVE, + AEGP_CameraType_ORTHOGRAPHIC, + + AEGP_CameraType_NUM_TYPES +}; + +typedef A_u_long AEGP_CameraType; + +enum { + AEGP_FootageDepth_1 = 1, + AEGP_FootageDepth_2 = 2, + AEGP_FootageDepth_4 = 4, + AEGP_FootageDepth_8 = 8, + AEGP_FootageDepth_16 = 16, + AEGP_FootageDepth_24 = 24, + AEGP_FootageDepth_30 = 30, + AEGP_FootageDepth_32 = 32, + AEGP_FootageDepth_GRAY_2 = 34, + AEGP_FootageDepth_GRAY_4 = 36, + AEGP_FootageDepth_GRAY_8 = 40, + AEGP_FootageDepth_48 = 48, + AEGP_FootageDepth_64 = 64, + AEGP_FootageDepth_GRAY_16 = -16 +}; + + +enum { + AEGP_FilmSizeUnits_NONE = 0, + AEGP_FilmSizeUnits_HORIZONTAL, + AEGP_FilmSizeUnits_VERTICAL, + AEGP_FilmSizeUnits_DIAGONAL +}; +typedef A_long AEGP_FilmSizeUnits; + + +enum { + AEGP_LightType_NONE = -1, + + AEGP_LightType_PARALLEL, + AEGP_LightType_SPOT, + AEGP_LightType_POINT, + AEGP_LightType_AMBIENT, + + AEGP_LightType_NUM_TYPES +}; + +typedef A_u_long AEGP_LightType; + + +enum { + AEGP_LightFalloff_NONE = 0, + AEGP_LightFalloff_SMOOTH, + AEGP_LightFalloff_INVERSE_SQUARE_CLAMPED +}; + +typedef A_u_long AEGP_LightFalloffType; + + +/* -------------------------------------------------------------------- */ + +enum { + AEGP_TimeDisplayType_TIMECODE = 0, + AEGP_TimeDisplayType_FRAMES, + AEGP_TimeDisplayType_FEET_AND_FRAMES +}; +typedef A_char AEGP_TimeDisplayType; + +#define AEGP_FramesPerFoot_35MM 16 +#define AEGP_FramesPerFoot_16MM 40 + +typedef struct { // note: unused values are still stored in settings and used when cycling through + // the 3 types using cmd/ctrl-click on timecode + AEGP_TimeDisplayType time_display_type; + A_char timebaseC; // only used for AEGP_TimeDisplayType_TIMECODE, 1 to 100 + A_Boolean non_drop_30B; // only used for AEGP_TimeDisplayType_TIMECODE, + // when timebaseC == 30 && item framerate == 29.97, use drop frame or non-drop? + A_char frames_per_footC; // only used for AEGP_TimeDisplayType_FEET_AND_FRAMES + A_long starting_frameL; // usually 0 or 1, not used for AEGP_TimeDisplayType_TIMECODE + A_Boolean auto_timecode_baseB; +} AEGP_TimeDisplay2; + +enum { + AEGP_TimeDisplay_TIMECODE = 0, + AEGP_TimeDisplay_FRAMES +}; +typedef char AEGP_TimeDisplayMode; + +enum { + AEGP_SourceTimecode_ZERO = 0, + AEGP_SourceTimecode_SOURCE_TIMECODE +}; +typedef char AEGP_SourceTimecodeDisplayMode; + +enum { + AEGP_Frames_ZERO_BASED = 0, + AEGP_Frames_ONE_BASED, + AEGP_Frames_TIMECODE_CONVERSION +}; +typedef char AEGP_FramesDisplayMode; + +typedef struct { + AEGP_TimeDisplayMode display_mode; + AEGP_SourceTimecodeDisplayMode footage_display_mode; + A_Boolean display_dropframeB; + A_Boolean use_feet_framesB; + A_char timebaseC; + A_char frames_per_footC; + AEGP_FramesDisplayMode frames_display_mode; +} AEGP_TimeDisplay3; + + + +#define kAEGPProjSuite "AEGP Proj Suite" +#define kAEGPProjSuiteVersion6 9 /* frozen in AE 10.5 */ + +typedef struct AEGP_ProjSuite6 { + + SPAPI A_Err (*AEGP_GetNumProjects)( /* will always (in 5.0) return 1 if project is open */ + A_long *num_projPL); /* << */ + + SPAPI A_Err (*AEGP_GetProjectByIndex)( + A_long proj_indexL, /* >> */ + AEGP_ProjectH *projPH); /* << */ + + SPAPI A_Err (*AEGP_GetProjectName)( + AEGP_ProjectH projH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_PROJ_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetProjectPath)( + AEGP_ProjectH projH, /* >> */ + AEGP_MemHandle *unicode_pathPH); // << empty string if no file. handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetProjectRootFolder)( + AEGP_ProjectH projH, /* >> */ + AEGP_ItemH *root_folderPH); /* << */ + + SPAPI A_Err (*AEGP_SaveProjectToPath)( + AEGP_ProjectH projH, /* >> */ + const A_UTF16Char *pathZ); // >> null terminated unicode path with platform separators + + SPAPI A_Err (*AEGP_GetProjectTimeDisplay)( + AEGP_ProjectH projH, /* >> */ + AEGP_TimeDisplay3 *time_displayP); /* << */ + + SPAPI A_Err (*AEGP_SetProjectTimeDisplay)( /* UNDOABLE */ + AEGP_ProjectH projH, /* <> */ + const AEGP_TimeDisplay3 *time_displayP); /* >> */ + + SPAPI A_Err (*AEGP_ProjectIsDirty)( + AEGP_ProjectH projH, /* >> */ + A_Boolean *is_dirtyPB); /* << */ + + SPAPI A_Err (*AEGP_SaveProjectAs)( + AEGP_ProjectH projH, /* >> */ + const A_UTF16Char *pathZ); // >> null terminated unicode path with platform separators + + SPAPI A_Err (*AEGP_NewProject)( + AEGP_ProjectH *new_projectPH); /* << WARNING: Will close any open projects! */ + + // WARNING: Will close any open projects! + SPAPI A_Err (*AEGP_OpenProjectFromPath)( + const A_UTF16Char *pathZ, // >> null terminated unicode path with platform separators + AEGP_ProjectH *projectPH); /* << */ + + SPAPI A_Err (*AEGP_GetProjectBitDepth)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ProjBitDepth *bit_depthP); /* << */ + + SPAPI A_Err (*AEGP_SetProjectBitDepth)( /* UNDOABLE */ + AEGP_ProjectH projectH, /* >> */ + AEGP_ProjBitDepth bit_depth); /* >> */ + +} AEGP_ProjSuite6; + +/* -------------------------------------------------------------------- */ + +enum { + AEGP_SoundEncoding_UNSIGNED_PCM = 3, + AEGP_SoundEncoding_SIGNED_PCM, + AEGP_SoundEncoding_FLOAT, + AEGP_SoundEncoding_END, + AEGP_SoundEncoding_BEGIN = AEGP_SoundEncoding_UNSIGNED_PCM +}; +typedef A_long AEGP_SoundEncoding; + +typedef struct AEGP_SoundDataFormat { + A_FpLong sample_rateF; + AEGP_SoundEncoding encoding; + A_long bytes_per_sampleL; /* 1, 2, or 4 only (ignored if encoding == AEGP_SoundEncoding_FLOAT) */ + A_long num_channelsL; /* 1 for mono, 2 for stereo */ +}AEGP_SoundDataFormat; + + +enum { + AEGP_ItemType_NONE, + AEGP_ItemType_FOLDER, + AEGP_ItemType_COMP, + AEGP_ItemType_SOLID_defunct, // as of AE6, solids are now just AEGP_ItemType_FOOTAGE with AEGP_FootageSignature_SOLID + AEGP_ItemType_FOOTAGE, + AEGP_ItemType_NUM_TYPES1 +}; +typedef A_short AEGP_ItemType; + + +enum { + AEGP_ItemFlag_MISSING = 0x1, /* footage property: here for convenience */ + AEGP_ItemFlag_HAS_PROXY = 0x2, + AEGP_ItemFlag_USING_PROXY = 0x4, /* is using the proxy as source */ + AEGP_ItemFlag_MISSING_PROXY = 0x8, /* footage property: here for convenience */ + AEGP_ItemFlag_HAS_VIDEO = 0x10, /* is there a video track? */ + AEGP_ItemFlag_HAS_AUDIO = 0x20, /* is there an audio track? */ + AEGP_ItemFlag_STILL = 0x40, /* are all frames exactly the same */ + AEGP_ItemFlag_HAS_ACTIVE_AUDIO = 0x80 /* new in AE CS 5.5: is there an audio track, and is it also turned on right now? */ +}; +typedef A_long AEGP_ItemFlags; + + +enum { + AEGP_Label_NONE = -1, /* undefined sentinel value */ + AEGP_Label_NO_LABEL = 0, + AEGP_Label_1, + AEGP_Label_2, + AEGP_Label_3, + AEGP_Label_4, + AEGP_Label_5, + AEGP_Label_6, + AEGP_Label_7, + AEGP_Label_8, + AEGP_Label_9, + AEGP_Label_10, + AEGP_Label_11, + AEGP_Label_12, + AEGP_Label_13, + AEGP_Label_14, + AEGP_Label_15, + AEGP_Label_16, // label 16 is new in AE 10.0 (CS5) + + AEGP_Label_NUMTYPES +}; +typedef A_char AEGP_LabelID; + +/* -------------------------------------------------------------------- */ + +enum { + AEGP_PersistentType_MACHINE_SPECIFIC, + AEGP_PersistentType_MACHINE_INDEPENDENT, + AEGP_PersistentType_MACHINE_INDEPENDENT_RENDER, + AEGP_PersistentType_MACHINE_INDEPENDENT_OUTPUT, + AEGP_PersistentType_MACHINE_INDEPENDENT_COMPOSITION, + AEGP_PersistentType_MACHINE_SPECIFIC_TEXT, + AEGP_PersistentType_MACHINE_SPECIFIC_PAINT, + + AEGP_PersistentType_NUMTYPES +}; +typedef A_long AEGP_PersistentType; + + +#define kAEGPItemSuite "AEGP Item Suite" +#define kAEGPItemSuiteVersion9 14 /* frozen in AE 14.1 */ + +typedef struct AEGP_ItemSuite9 { + + SPAPI A_Err (*AEGP_GetFirstProjItem)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetNextProjItem)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_PluginID pluginID, // in + AEGP_ItemH itemH, /* >> */ + AEGP_MemHandle *unicode_namePH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_SetItemName)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> */ + const A_UTF16Char *nameZ); /* >> null terminated UTF16 */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_SetItemParentFolder)( + AEGP_ItemH itemH, /* <> */ + AEGP_ItemH parent_folder_itemH); /* >> */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_UTF16Char *nameZ, /* >> null terminated UTF16 */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << allocated and owned by AE */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* UNDOABLE. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + SPAPI A_Err (*AEGP_GetItemComment)( + AEGP_ItemH itemH, /* >> */ + AEGP_MemHandle *unicode_namePH); /* << */ + + SPAPI A_Err (*AEGP_SetItemComment)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + const A_UTF16Char *commentZ); /* >> */ + + SPAPI A_Err (*AEGP_GetItemLabel)( + AEGP_ItemH itemH, /* >> */ + AEGP_LabelID *labelP); /* << */ + + SPAPI A_Err (*AEGP_SetItemLabel)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + AEGP_LabelID label); /* >> */ + + SPAPI A_Err (*AEGP_GetItemMRUView)( + AEGP_ItemH itemH, // >> + AEGP_ItemViewP *mru_viewP); // << + +} AEGP_ItemSuite9; + + +/* -------------------------------------------------------------------- */ + +#define kAEGPItemViewSuite "AEGP Item View Suite" +#define kAEGPItemViewSuiteVersion1 1 /* frozen in AE 13.6 */ + +typedef struct AEGP_ItemViewSuite1 { + // Each item view can have its own playback time, if previewing is active, otherwise the current associated item time + SPAPI A_Err (*AEGP_GetItemViewPlaybackTime)( + AEGP_ItemViewP item_viewP, /* >> */ + A_Boolean *is_currently_previewingPB0, /* >> whether the time is actually playback time (TRUE), FALSE is default item current_time */ + A_Time *curr_timePT ); /* << */ + +} AEGP_ItemViewSuite1; + + + +/* -------------------------------------------------------------------- */ + +#define kAEGPSoundDataSuite "AEGP Sound Data Suite" +#define kAEGPSoundDataVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct AEGP_SoundDataSuite1 { + SPAPI A_Err (*AEGP_NewSoundData)( /* Must be disposed with DisposeSoundData */ + const AEGP_SoundDataFormat* sound_formatP, + AEGP_SoundDataH *new_sound_dataPH); /* << can return NULL if no audio */ + + SPAPI A_Err (*AEGP_DisposeSoundData)( + AEGP_SoundDataH sound_dataH); /* >> */ + + SPAPI A_Err (*AEGP_GetSoundDataFormat)( + AEGP_SoundDataH soundH, /* >> */ + AEGP_SoundDataFormat *sound_formatP); /* << */ + + + /* + If the sound format has two channels, the data is interleaved + left (0), right(1), left(0), right(1), ... + + AEGP_SoundEncoding_FLOAT has a type of FpShort + + For bytes_per_sample == 1 + AEGP_SoundEncoding_UNSIGNED_PCM == A_u_char + AEGP_SoundEncoding_SIGNED_PCM == A_char + + For bytes_per_sample == 2 + AEGP_SoundEncoding_UNSIGNED_PCM == A_u_short + AEGP_SoundEncoding_SIGNED_PCM == A_short + + For bytes_per_sample == 4 + AEGP_SoundEncoding_UNSIGNED_PCM == A_u_long + AEGP_SoundEncoding_SIGNED_PCM == A_long + + usage: + void * sound_dataP; + sds->AEGP_LockSoundDataSamples( soundH, &sound_dataP); + A_u_long* correct_samples = (A_u_long*)sound_dataP; // for AEGP_SoundEncoding_UNSIGNED_PCM + */ + + SPAPI A_Err (*AEGP_LockSoundDataSamples)( + AEGP_SoundDataH soundH, /* >> */ + void **samples); /* << use the correct combination of unsigned/signed/float and bytes_per_sample to determine type */ + + SPAPI A_Err (*AEGP_UnlockSoundDataSamples)( + AEGP_SoundDataH soundH); /* >> */ + + SPAPI A_Err (*AEGP_GetNumSamples)( + AEGP_SoundDataH soundH, /* >> */ + A_long *num_samplesPL); /* << */ + +} AEGP_SoundDataSuite1 ; + + + +/* -------------------------------------------------------------------- */ + + +typedef struct { + A_short xS, yS; +} AEGP_DownsampleFactor; + +enum { + AEGP_CompFlag_SHOW_ALL_SHY = 0x1, + AEGP_CompFlag_RESERVED_1 = 0x2, + AEGP_CompFlag_RESERVED_2 = 0x4, + AEGP_CompFlag_ENABLE_MOTION_BLUR = 0x8, + AEGP_CompFlag_ENABLE_TIME_FILTER = 0x10, + AEGP_CompFlag_GRID_TO_FRAMES = 0x20, + AEGP_CompFlag_GRID_TO_FIELDS = 0x40, + AEGP_CompFlag_USE_LOCAL_DSF = 0x80, // If on, use the dsf in the comp, not the RO + AEGP_CompFlag_DRAFT_3D = 0x100, + AEGP_CompFlag_SHOW_GRAPH = 0x200, + AEGP_CompFlag_RESERVED_3 = 0x400 + +}; +typedef A_long AEGP_CompFlags; + + + + +#define kAEGPCompSuite "AEGP Comp Suite" +#define kAEGPCompSuiteVersion11 25 /* frozen in AE 14.2 */ + +typedef struct AEGP_CompSuite11 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_SetCompBGColor)( + AEGP_CompH compH, /* >> */ + const AEGP_ColorVal *bg_colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + /*Opens the comp*/ + SPAPI A_Err (*AEGP_GetShowLayerNameOrSourceName)( + AEGP_CompH compH, /* >> */ + A_Boolean *layer_names_shownPB); /* << true if layer names, false if source names */ + + /*Opens the comp*/ + SPAPI A_Err (*AEGP_SetShowLayerNameOrSourceName)( + AEGP_CompH compH, /* >> */ + A_Boolean show_layer_namesB); /* >> true to show layer names, false to show source names */ + + /*Opens the comp*/ + SPAPI A_Err (*AEGP_GetShowBlendModes)( + AEGP_CompH compH, /* >> */ + A_Boolean *blend_modes_shownPB); /* << */ + + /*Opens the comp*/ + SPAPI A_Err (*AEGP_SetShowBlendModes)( + AEGP_CompH compH, /* >> */ + A_Boolean show_blend_modesB); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompSuggestedMotionBlurSamples)( + AEGP_CompH compH, /* >> */ + A_long *samplesPL); /* << */ + + SPAPI A_Err (*AEGP_SetCompSuggestedMotionBlurSamples)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_long samplesL); /* >> */ + + SPAPI A_Err (*AEGP_GetCompMotionBlurAdaptiveSampleLimit)( + AEGP_CompH compH, /* >> */ + A_long *samplesPL); /* << */ + + SPAPI A_Err (*AEGP_SetCompMotionBlurAdaptiveSampleLimit)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_long samplesL); /* >> */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + const A_Time *work_area_startPT, /* >> */ + const A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_UTF16Char *utf_nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_Collection2H collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + A_Boolean select_new_layerB, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_CreateBoxTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + A_Boolean select_new_layerB, /* >> */ + A_FloatPoint box_dimensions, /* >> */ // (width and height) + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompDimensions)( + AEGP_CompH compH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateComp)( + AEGP_CompH compH, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompFrameDuration)( + AEGP_CompH compH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_GetMostRecentlyUsedComp)( + AEGP_CompH *compPH); /* << If compPH returns NULL, there's no available comp */ + + SPAPI A_Err (*AEGP_CreateVectorLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_vector_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCompMarkerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller */ + + SPAPI A_Err (*AEGP_GetCompDisplayDropFrame)( + AEGP_CompH compH, /* >> */ + A_Boolean *dropFramePB); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayDropFrame)( + AEGP_CompH compH, /* >> */ + A_Boolean dropFrameB); /* << */ + + SPAPI A_Err (*AEGP_ReorderCompSelection)( + AEGP_CompH compH, /* >> */ + A_long index); /* >> */ + +} AEGP_CompSuite11; + + +/* -------------------------------------------------------------------- */ + + +#define kAEGPMemorySuite "AEGP Memory Suite" +#define kAEGPMemorySuiteVersion1 1 /* frozen in AE 5.0 */ + +enum { + AEGP_MemFlag_NONE = 0x0, + AEGP_MemFlag_CLEAR = 0x01, + AEGP_MemFlag_QUIET = 0x02 +}; +typedef A_long AEGP_MemFlag; + +typedef A_u_long AEGP_MemSize; + + +typedef struct AEGP_MemorySuite1 { + + + SPAPI A_Err (*AEGP_NewMemHandle)( AEGP_PluginID plugin_id, /* >> */ + const A_char *whatZ, /* >> */ + AEGP_MemSize size, /* >> */ + AEGP_MemFlag flags, /* >> */ + AEGP_MemHandle *memPH); /* << */ + + SPAPI A_Err (*AEGP_FreeMemHandle)( AEGP_MemHandle memH); + + SPAPI A_Err (*AEGP_LockMemHandle)( AEGP_MemHandle memH, /* nestable */ + void **ptr_to_ptr); /* << */ + + SPAPI A_Err (*AEGP_UnlockMemHandle)( AEGP_MemHandle memH); + + SPAPI A_Err (*AEGP_GetMemHandleSize)( AEGP_MemHandle memH, + AEGP_MemSize *sizeP); /* << */ + + SPAPI A_Err (*AEGP_ResizeMemHandle)( const A_char *whatZ, /* >> */ + AEGP_MemSize new_size, /* >> */ + AEGP_MemHandle memH); /* <> */ + + SPAPI A_Err (*AEGP_SetMemReportingOn)( A_Boolean turn_OnB); + + SPAPI A_Err (*AEGP_GetMemStats)( AEGP_PluginID plugin_id, /* >> */ + A_long *countPL, /* << */ + A_long *sizePL); /* << */ +} AEGP_MemorySuite1; + +/* -------------------------------------------------------------------- */ + + +enum { + AEGP_TransferFlag_PRESERVE_ALPHA = 0x1, + AEGP_TransferFlag_RANDOMIZE_DISSOLVE = 0x2 +}; +typedef A_long AEGP_TransferFlags; + +enum { + AEGP_TrackMatte_NO_TRACK_MATTE, + AEGP_TrackMatte_ALPHA, + AEGP_TrackMatte_NOT_ALPHA, + AEGP_TrackMatte_LUMA, + AEGP_TrackMatte_NOT_LUMA +}; +typedef A_long AEGP_TrackMatte; + +typedef struct { + PF_TransferMode mode; // defined in AE_EffectCB.h + AEGP_TransferFlags flags; + AEGP_TrackMatte track_matte; +} AEGP_LayerTransferMode; + + + +enum { + AEGP_LayerQual_NONE = -1, // sentinel + AEGP_LayerQual_WIREFRAME, // wire-frames only + AEGP_LayerQual_DRAFT, // LO-qual filters, LO-qual geom + AEGP_LayerQual_BEST // HI-qual filters, HI-qual geom +}; +typedef A_short AEGP_LayerQuality; + + +enum { + AEGP_LayerSamplingQual_BILINEAR, // bilinear interpolation + AEGP_LayerSamplingQual_BICUBIC // bicubic interpolation +}; +typedef A_short AEGP_LayerSamplingQuality; + +enum { + AEGP_LayerFlag_NONE = 0x00000000, + AEGP_LayerFlag_VIDEO_ACTIVE = 0x00000001, + AEGP_LayerFlag_AUDIO_ACTIVE = 0x00000002, + AEGP_LayerFlag_EFFECTS_ACTIVE = 0x00000004, + AEGP_LayerFlag_MOTION_BLUR = 0x00000008, + AEGP_LayerFlag_FRAME_BLENDING = 0x00000010, + AEGP_LayerFlag_LOCKED = 0x00000020, + AEGP_LayerFlag_SHY = 0x00000040, + AEGP_LayerFlag_COLLAPSE = 0x00000080, + AEGP_LayerFlag_AUTO_ORIENT_ROTATION = 0x00000100, + AEGP_LayerFlag_ADJUSTMENT_LAYER = 0x00000200, + AEGP_LayerFlag_TIME_REMAPPING = 0x00000400, + AEGP_LayerFlag_LAYER_IS_3D = 0x00000800, + AEGP_LayerFlag_LOOK_AT_CAMERA = 0x00001000, + AEGP_LayerFlag_LOOK_AT_POI = 0x00002000, + AEGP_LayerFlag_SOLO = 0x00004000, + AEGP_LayerFlag_MARKERS_LOCKED = 0x00008000, + AEGP_LayerFlag_NULL_LAYER = 0x00010000, + AEGP_LayerFlag_HIDE_LOCKED_MASKS = 0x00020000, + AEGP_LayerFlag_GUIDE_LAYER = 0x00040000, + AEGP_LayerFlag_ADVANCED_FRAME_BLENDING = 0x00080000, + AEGP_LayerFlag_SUBLAYERS_RENDER_SEPARATELY = 0x00100000, + AEGP_LayerFlag_ENVIRONMENT_LAYER = 0x00200000 +}; +typedef A_long AEGP_LayerFlags; + + +// Layers are always one of the following types. + +enum { + AEGP_ObjectType_NONE = -1, + AEGP_ObjectType_AV, /* Includes all pre-AE 5.0 layer types (audio or video source, including adjustment layers) */ + AEGP_ObjectType_LIGHT, + AEGP_ObjectType_CAMERA, + AEGP_ObjectType_TEXT, + AEGP_ObjectType_VECTOR, + + AEGP_ObjectType_NUM_TYPES +}; +typedef A_long AEGP_ObjectType; + +enum { + AEGP_LTimeMode_LayerTime, + AEGP_LTimeMode_CompTime +}; +typedef A_short AEGP_LTimeMode; + +#define AEGP_REORDER_LAYER_TO_END -1 + +#define kAEGPLayerSuite "AEGP Layer Suite" +#define kAEGPLayerSuiteVersion7 13 /* frozen AE 10.0 build 396 */ + +typedef struct AEGP_LayerSuite7 { + + SPAPI A_Err (*AEGP_GetCompNumLayers)( + AEGP_CompH compH, /* >> */ + A_long *num_layersPL); /* << */ + + SPAPI A_Err (*AEGP_GetCompLayerByIndex)( + AEGP_CompH compH, /* >> */ + A_long layer_indexL, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetActiveLayer)( + AEGP_LayerH *layerPH); /* << returns non null only if one layer is selected */ + + SPAPI A_Err (*AEGP_GetLayerIndex)( + AEGP_LayerH layerH, /* >> */ + A_long *layer_indexPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItem)( + AEGP_LayerH layerH, /* >> */ + AEGP_ItemH *source_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItemID)( + AEGP_LayerH layerH, /* >> */ + A_long *source_item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerParentComp)( + AEGP_LayerH layerH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerName)( + AEGP_PluginID pluginID, // in + AEGP_LayerH layerH, /* >> */ + AEGP_MemHandle *utf_layer_namePH0, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *utf_source_namePH0); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetLayerQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality quality); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerFlags)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags *layer_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerFlag)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags single_flag, /* >> */ + A_Boolean valueB); /* >> */ + + SPAPI A_Err (*AEGP_IsLayerVideoReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerAudioReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_GetLayerCurrentTime)( // not updated while rendering + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerInPoint)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *in_pointPT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDuration)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetLayerInPointAndDuration)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *in_pointPT, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerOffset)( + AEGP_LayerH layerH, /* >> */ + A_Time *offsetPT); /* << always in comp time */ + + SPAPI A_Err (*AEGP_SetLayerOffset)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Time *offsetPT); /* >> always in comp time */ + + SPAPI A_Err (*AEGP_GetLayerStretch)( + AEGP_LayerH layerH, /* >> */ + A_Ratio *stretchPRt); /* << */ + + SPAPI A_Err (*AEGP_SetLayerStretch)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Ratio *stretchPRt); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerTransferMode)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerTransferMode *transfer_modeP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerTransferMode)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerTransferMode *transfer_modeP); /* >> */ + + SPAPI A_Err (*AEGP_IsAddLayerValid)( + AEGP_ItemH item_to_addH, /* >> */ + AEGP_CompH into_compH, /* >> */ + A_Boolean *validPB); /* << */ + + SPAPI A_Err (*AEGP_AddLayer)( /* UNDOABLE */ + AEGP_ItemH item_to_addH, /* >> check AEGP_IsAddLayerValid() before using */ + AEGP_CompH into_compH, /* >> */ + AEGP_LayerH *added_layerPH0); /* << */ + + SPAPI A_Err (*AEGP_ReorderLayer)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + A_long layer_indexL); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerMaskedBounds)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_FloatRect *boundsPR); /* << */ + + SPAPI A_Err (*AEGP_GetLayerObjectType)( + AEGP_LayerH layerH, /* >> */ + AEGP_ObjectType *object_type); /* << */ + + SPAPI A_Err (*AEGP_IsLayer3D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_3DPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayer2D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_2DPB); /* << */ + + SPAPI A_Err (*AEGP_IsVideoActive)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean *is_activePB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerUsedAsTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean fill_must_be_activeB, /* >> */ + A_Boolean *is_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_DoesLayerHaveTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *has_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_ConvertCompToLayerTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Time *layer_timePT); /* << */ + + SPAPI A_Err (*AEGP_ConvertLayerToCompTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *layer_timePT, /* >> */ + A_Time *comp_timePT) ; /* << */ + + SPAPI A_Err (*AEGP_GetLayerDancingRandValue)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_long *rand_valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerID)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXform)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXformFromView)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *view_timeP, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_SetLayerName)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_UTF16Char *new_nameZ); /* >> null terminated UTF16 */ + + SPAPI A_Err (*AEGP_GetLayerParent)( + const AEGP_LayerH layerH, /* >> */ + AEGP_LayerH *parent_layerPH); /* << NULL if no parent */ + + SPAPI A_Err (*AEGP_SetLayerParent)( + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerH parent_layerH0); /* >> */ + + SPAPI A_Err (*AEGP_DeleteLayer)( + AEGP_LayerH layerH); /* >> UNDOABLE */ + + SPAPI A_Err (*AEGP_DuplicateLayer)( + AEGP_LayerH orig_layerH, /* >> */ + AEGP_LayerH *duplicate_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerID)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerIDVal id, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerLabel)( + AEGP_LayerH layerH, /* >> */ + AEGP_LabelID *labelP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerLabel)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LabelID label); /* >> */ + +} AEGP_LayerSuite7; + +#define kAEGPLayerSuiteVersion8 14 /* frozen AE 12.0 x300 */ + +typedef struct AEGP_LayerSuite8 { + + SPAPI A_Err (*AEGP_GetCompNumLayers)( + AEGP_CompH compH, /* >> */ + A_long *num_layersPL); /* << */ + + SPAPI A_Err (*AEGP_GetCompLayerByIndex)( + AEGP_CompH compH, /* >> */ + A_long layer_indexL, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetActiveLayer)( + AEGP_LayerH *layerPH); /* << returns non null only if one layer is selected */ + + SPAPI A_Err (*AEGP_GetLayerIndex)( + AEGP_LayerH layerH, /* >> */ + A_long *layer_indexPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItem)( + AEGP_LayerH layerH, /* >> */ + AEGP_ItemH *source_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItemID)( + AEGP_LayerH layerH, /* >> */ + A_long *source_item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerParentComp)( + AEGP_LayerH layerH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerName)( + AEGP_PluginID pluginID, // in + AEGP_LayerH layerH, /* >> */ + AEGP_MemHandle *utf_layer_namePH0, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *utf_source_namePH0); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetLayerQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality quality); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerFlags)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags *layer_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerFlag)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags single_flag, /* >> */ + A_Boolean valueB); /* >> */ + + SPAPI A_Err (*AEGP_IsLayerVideoReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerAudioReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_GetLayerCurrentTime)( // not updated while rendering + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerInPoint)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *in_pointPT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDuration)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetLayerInPointAndDuration)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *in_pointPT, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerOffset)( + AEGP_LayerH layerH, /* >> */ + A_Time *offsetPT); /* << always in comp time */ + + SPAPI A_Err (*AEGP_SetLayerOffset)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Time *offsetPT); /* >> always in comp time */ + + SPAPI A_Err (*AEGP_GetLayerStretch)( + AEGP_LayerH layerH, /* >> */ + A_Ratio *stretchPRt); /* << */ + + SPAPI A_Err (*AEGP_SetLayerStretch)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Ratio *stretchPRt); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerTransferMode)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerTransferMode *transfer_modeP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerTransferMode)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerTransferMode *transfer_modeP); /* >> */ + + SPAPI A_Err (*AEGP_IsAddLayerValid)( + AEGP_ItemH item_to_addH, /* >> */ + AEGP_CompH into_compH, /* >> */ + A_Boolean *validPB); /* << */ + + SPAPI A_Err (*AEGP_AddLayer)( /* UNDOABLE */ + AEGP_ItemH item_to_addH, /* >> check AEGP_IsAddLayerValid() before using */ + AEGP_CompH into_compH, /* >> */ + AEGP_LayerH *added_layerPH0); /* << */ + + SPAPI A_Err (*AEGP_ReorderLayer)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + A_long layer_indexL); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerMaskedBounds)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_FloatRect *boundsPR); /* << */ + + SPAPI A_Err (*AEGP_GetLayerObjectType)( + AEGP_LayerH layerH, /* >> */ + AEGP_ObjectType *object_type); /* << */ + + SPAPI A_Err (*AEGP_IsLayer3D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_3DPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayer2D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_2DPB); /* << */ + + SPAPI A_Err (*AEGP_IsVideoActive)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean *is_activePB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerUsedAsTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean fill_must_be_activeB, /* >> */ + A_Boolean *is_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_DoesLayerHaveTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *has_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_ConvertCompToLayerTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Time *layer_timePT); /* << */ + + SPAPI A_Err (*AEGP_ConvertLayerToCompTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *layer_timePT, /* >> */ + A_Time *comp_timePT) ; /* << */ + + SPAPI A_Err (*AEGP_GetLayerDancingRandValue)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_long *rand_valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerID)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXform)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXformFromView)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *view_timeP, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_SetLayerName)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_UTF16Char *new_nameZ); /* >> null terminated UTF16 */ + + SPAPI A_Err (*AEGP_GetLayerParent)( + const AEGP_LayerH layerH, /* >> */ + AEGP_LayerH *parent_layerPH); /* << NULL if no parent */ + + SPAPI A_Err (*AEGP_SetLayerParent)( + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerH parent_layerH0); /* >> */ + + SPAPI A_Err (*AEGP_DeleteLayer)( + AEGP_LayerH layerH); /* >> UNDOABLE */ + + SPAPI A_Err (*AEGP_DuplicateLayer)( + AEGP_LayerH orig_layerH, /* >> */ + AEGP_LayerH *duplicate_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerID)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerIDVal id, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerLabel)( + AEGP_LayerH layerH, /* >> */ + AEGP_LabelID *labelP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerLabel)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LabelID label); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerSamplingQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerSamplingQuality *qualityP); /* << */ + + /* Option is explicitly set on the layer independent of layer quality. + If you want to force it on you must also set the layer quality to + AEGP_LayerQual_BEST with AEGP_SetLayerQuality. Otherwise it will only be using + the specified layer sampling quality whenever the layer quality is set to AEGP_LayerQual_BEST*/ + SPAPI A_Err (*AEGP_SetLayerSamplingQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerSamplingQuality quality); /* >> */ + +} AEGP_LayerSuite8; + + + + + + +/* -------------------------------------------------------------------- */ + + +enum { + /* + WARNING!! + don't reorder these items, don't add in the middle + these IDs are saved to disk! + + only ever add to the end of the list, right before AEGP_LayerStream_NUMTYPES + */ + + AEGP_LayerStream_NONE = -1, + AEGP_LayerStream_ANCHORPOINT, + AEGP_LayerStream_POSITION, + AEGP_LayerStream_SCALE, + AEGP_LayerStream_ROTATION, + AEGP_LayerStream_ROTATE_Z = AEGP_LayerStream_ROTATION, /* for 3D streams */ + AEGP_LayerStream_OPACITY, + AEGP_LayerStream_AUDIO, + AEGP_LayerStream_MARKER, + AEGP_LayerStream_TIME_REMAP, + AEGP_LayerStream_ROTATE_X, + AEGP_LayerStream_ROTATE_Y, + AEGP_LayerStream_ORIENTATION, + + // only valid for AEGP_ObjectType == AEGP_ObjectType_CAMERA + AEGP_LayerStream_ZOOM, + AEGP_LayerStream_DEPTH_OF_FIELD, + AEGP_LayerStream_FOCUS_DISTANCE, + AEGP_LayerStream_APERTURE, + AEGP_LayerStream_BLUR_LEVEL, + + // only valid for AEGP_ObjectType == AEGP_ObjectType_LIGHT + AEGP_LayerStream_INTENSITY, + AEGP_LayerStream_COLOR, + AEGP_LayerStream_CONE_ANGLE, + AEGP_LayerStream_CONE_FEATHER, + AEGP_LayerStream_SHADOW_DARKNESS, + AEGP_LayerStream_SHADOW_DIFFUSION, + + // only valid for AEGP_ObjectType == AEGP_ObjectType_AV + AEGP_LayerStream_ACCEPTS_SHADOWS, + AEGP_LayerStream_ACCEPTS_LIGHTS, + AEGP_LayerStream_AMBIENT_COEFF, + AEGP_LayerStream_DIFFUSE_COEFF, + AEGP_LayerStream_SPECULAR_INTENSITY, + AEGP_LayerStream_SPECULAR_SHININESS, + + AEGP_LayerStream_CASTS_SHADOWS, // LIGHT, and AV only, no CAMERA + AEGP_LayerStream_LIGHT_TRANSMISSION, // AV Layer only + AEGP_LayerStream_METAL, // AV layer only + + AEGP_LayerStream_SOURCE_TEXT, + + // only valid for AEGP_ObjectType == AEGP_ObjectType_CAMERA + AEGP_LayerStream_IRIS_SHAPE, + AEGP_LayerStream_IRIS_ROTATION, + AEGP_LayerStream_IRIS_ROUNDNESS, + AEGP_LayerStream_IRIS_ASPECT_RATIO, + AEGP_LayerStream_IRIS_DIFFRACTION_FRINGE, + AEGP_LayerStream_IRIS_HIGHLIGHT_GAIN, + AEGP_LayerStream_IRIS_HIGHLIGHT_THRESHOLD, + AEGP_LayerStream_IRIS_HIGHLIGHT_SATURATION, + + // only valid for AEGP_ObjectType == AEGP_ObjectType_LIGHT + AEGP_LayerStream_LIGHT_FALLOFF_TYPE, + AEGP_LayerStream_LIGHT_FALLOFF_START, + AEGP_LayerStream_LIGHT_FALLOFF_DISTANCE, + + // only valid for AEGP_ObjectType == AEGP_ObjectType_AV + AEGP_LayerStream_REFLECTION_INTENSITY, + AEGP_LayerStream_REFLECTION_SHARPNESS, + AEGP_LayerStream_REFLECTION_ROLLOFF, + AEGP_LayerStream_TRANSPARENCY_COEFF, + AEGP_LayerStream_TRANSPARENCY_ROLLOFF, + AEGP_LayerStream_INDEX_OF_REFRACTION, + + AEGP_LayerStream_EXTRUSION_BEVEL_STYLE, + AEGP_LayerStream_EXTRUSION_BEVEL_DIRECTION, + AEGP_LayerStream_EXTRUSION_BEVEL_DEPTH, + AEGP_LayerStream_EXTRUSION_HOLE_BEVEL_DEPTH, + AEGP_LayerStream_EXTRUSION_DEPTH, + AEGP_LayerStream_PLANE_CURVATURE, + AEGP_LayerStream_PLANE_SUBDIVISION, + + /*********************************************************/ + AEGP_LayerStream_NUMTYPES, + AEGP_LayerStream_BEGIN = AEGP_LayerStream_NONE + 1, + AEGP_LayerStream_END = AEGP_LayerStream_NUMTYPES + +}; +typedef A_long AEGP_LayerStream; + +enum { + AEGP_MaskStream_OUTLINE = 400, + AEGP_MaskStream_OPACITY, + AEGP_MaskStream_FEATHER, + AEGP_MaskStream_EXPANSION, + + // useful for iteration + AEGP_MaskStream_BEGIN = AEGP_MaskStream_OUTLINE, + AEGP_MaskStream_END = AEGP_MaskStream_EXPANSION+1 +}; +typedef A_long AEGP_MaskStream; + + +enum { + AEGP_StreamFlag_NONE = 0, + AEGP_StreamFlag_HAS_MIN = 0x01, + AEGP_StreamFlag_HAS_MAX = 0x02, + AEGP_StreamFlag_IS_SPATIAL = 0x04 +}; +typedef A_long AEGP_StreamFlags; + + +typedef A_FpLong AEGP_OneDVal; + +typedef struct { + A_FpLong x,y; +} AEGP_TwoDVal; // if audio, rt is x, left is y + +typedef struct { + A_FpLong x,y,z; +} AEGP_ThreeDVal; + +typedef A_FpLong AEGP_FourDVal[4]; + +typedef A_Handle AEGP_ArbBlockVal; + +enum { + AEGP_KeyInterp_NONE = 0, + AEGP_KeyInterp_LINEAR, + AEGP_KeyInterp_BEZIER, + AEGP_KeyInterp_HOLD, + + AEGP_Interp_NUM_VALUES +}; +typedef A_long AEGP_KeyframeInterpolationType; + +/* AEGP_KeyInterpMask -- allowed interpolation mask constants and type + */ +enum { + AEGP_KeyInterpMask_NONE = 0, + AEGP_KeyInterpMask_LINEAR = 1 << 0, + AEGP_KeyInterpMask_BEZIER = 1 << 1, + AEGP_KeyInterpMask_HOLD = 1 << 2, + AEGP_KeyInterpMask_CUSTOM = 1 << 3, + + AEGP_KeyInterpMask_ANY = 0xFFFF +}; +typedef A_long AEGP_KeyInterpolationMask; + +typedef struct { + A_FpLong speedF; + A_FpLong influenceF; +} AEGP_KeyframeEase; + + +typedef union { + AEGP_FourDVal four_d; + AEGP_ThreeDVal three_d; + AEGP_TwoDVal two_d; + AEGP_OneDVal one_d; + AEGP_ColorVal color; + AEGP_ArbBlockVal arbH; + AEGP_MarkerValP markerP; + AEGP_LayerIDVal layer_id; + AEGP_MaskIDVal mask_id; + AEGP_MaskOutlineValH mask; + AEGP_TextDocumentH text_documentH; +} AEGP_StreamVal2; + +typedef struct { + AEGP_StreamRefH streamH; + AEGP_StreamVal2 val; +} AEGP_StreamValue2; + +enum { + AEGP_StreamType_NO_DATA, + AEGP_StreamType_ThreeD_SPATIAL, + AEGP_StreamType_ThreeD, + AEGP_StreamType_TwoD_SPATIAL, + AEGP_StreamType_TwoD, + AEGP_StreamType_OneD, + AEGP_StreamType_COLOR, + AEGP_StreamType_ARB, + AEGP_StreamType_MARKER, + AEGP_StreamType_LAYER_ID, + AEGP_StreamType_MASK_ID, + AEGP_StreamType_MASK, + AEGP_StreamType_TEXT_DOCUMENT +}; +typedef A_long AEGP_StreamType; + + +#define kAEGPStreamSuite "AEGP Stream Suite" +#define kAEGPStreamSuiteVersion5 10 /* frozen in AE 15 */ + +typedef struct AEGP_StreamSuite5 { + // the only diff from this vs. last rev is that routines that pass AEGP_StreamValue2, when referring to a marker, + // (comp or layer) the struct now contains the NEW markerP type, which is compatible with the new Marker Suite + + SPAPI A_Err (*AEGP_IsStreamLegal)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + A_Boolean* is_legalP); /* << */ + + + SPAPI A_Err (*AEGP_CanVaryOverTime)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean* can_varyPB); /* << */ + + SPAPI A_Err (*AEGP_GetValidInterpolations)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyInterpolationMask* valid_interpolationsP); /* << */ + + SPAPI A_Err (*AEGP_GetNewLayerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetEffectNumParamStreams)( + AEGP_EffectRefH effect_refH, /* >> */ + A_long *num_paramsPL); /* << */ + + SPAPI A_Err (*AEGP_GetNewEffectStreamByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewMaskStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskStream which_stream, /* >> */ + AEGP_StreamRefH *mask_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_DisposeStream)( + AEGP_StreamRefH streamH); /* >> */ + + SPAPI A_Err (*AEGP_GetStreamName)( + AEGP_PluginID pluginID, // in + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + AEGP_MemHandle *utf_stream_namePH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetStreamUnitsText)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + A_char *unitsZ); /* << space for A_char[AEGP_MAX_STREAM_UNITS_SIZE] */ + + SPAPI A_Err (*AEGP_GetStreamProperties)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamFlags *flagsP, /* << */ + A_FpLong *minP0, /* << */ + A_FpLong *maxP0); /* << */ + + SPAPI A_Err (*AEGP_IsStreamTimevarying)( /* takes expressions into account */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *is_timevaryingPB); /* << */ + + SPAPI A_Err (*AEGP_GetStreamType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamType *stream_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetNewStreamValue)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamValue2 *valueP); /* << must be disposed */ + + SPAPI A_Err (*AEGP_DisposeStreamValue)( + AEGP_StreamValue2 *valueP); /* <> */ + + + SPAPI A_Err (*AEGP_SetStreamValue)( // only legal to call when AEGP_GetStreamNumKFs==0 or NO_DATA + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamValue2 *valueP); /* << */ + + // this is only valid on streams with primitive types. It is illegal on + // AEGP_ArbBlockVal || AEGP_MarkerValP || AEGP_MaskOutlineValH + + SPAPI A_Err (*AEGP_GetLayerStreamValue)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamVal2 *stream_valP, /* << */ + AEGP_StreamType *stream_typeP0); /* << */ + + SPAPI A_Err (*AEGP_GetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *enabledPB); /* >> */ + + SPAPI A_Err (*AEGP_SetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean enabledB); /* >> */ + + SPAPI A_Err(*AEGP_GetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_MemHandle *unicodeHZ); /* << must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err(*AEGP_SetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + const A_UTF16Char* expressionP); /* >> not adopted */ + + SPAPI A_Err (*AEGP_DuplicateStreamRef)( // must dispose yourself + AEGP_PluginID aegp_plugin_id, // in + AEGP_StreamRefH streamH, // in + AEGP_StreamRefH *dup_streamPH); // out +} AEGP_StreamSuite5; + + +/* -------------------------------------------------------------------- */ +/* new Dynamic Streams API for AE6 + + Used to access new tracker, text, & paint streams. Eventually + will work for all streams & groups on a layer. + +*/ + +#define AEGP_MAX_STREAM_MATCH_NAME_SIZE 40 + + +enum { + AEGP_StreamGroupingType_NONE = -1, + AEGP_StreamGroupingType_LEAF, + AEGP_StreamGroupingType_NAMED_GROUP, + AEGP_StreamGroupingType_INDEXED_GROUP +}; +typedef A_long AEGP_StreamGroupingType; + +enum { + AEGP_DynStreamFlag_ACTIVE_EYEBALL = 1L << 0, // read/write + AEGP_DynStreamFlag_HIDDEN = 1L << 1, // read/write, shown in UI at the moment? + AEGP_DynStreamFlag_DISABLED = 1L << 4, // read-only, greyed out in UI? + AEGP_DynStreamFlag_ELIDED = 1L << 5, // read-only, user never sees, children still seen and not indented + AEGP_DynStreamFlag_SHOWN_WHEN_EMPTY = 1L << 10, // read-only, should this group be shown when empty? + AEGP_DynStreamFlag_SKIP_REVEAL_WHEN_UNHIDDEN = 1L << 16 // read-only, do not auto reveal this property when un-hidden +}; +typedef A_u_long AEGP_DynStreamFlags; + +// Here are some matchnames for use with +// AEGP_GetNewStreamRefByMatchname(). + +#define AEGP_StreamGroupName_MASK_PARADE "ADBE Mask Parade" +#define AEGP_StreamGroupName_MASK_ATOM "ADBE Mask Atom" +#define AEGP_StreamName_MASK_FEATHER "ADBE Mask Feather" +#define AEGP_StreamName_MASK_OPACITY "ADBE Mask Opacity" +#define AEGP_StreamName_MASK_OFFSET "ADBE Mask Offset" +#define AEGP_StreamGroupName_EFFECT_PARADE "ADBE Effect Parade" +#define AEGP_StreamGroupName_LAYER "ADBE Abstract Layer" +#define AEGP_StreamGroupName_AV_LAYER "ADBE AV Layer" +#define AEGP_StreamGroupName_TEXT_LAYER "ADBE Text Layer" +#define AEGP_StreamGroupName_CAMERA_LAYER "ADBE Camera Layer" +#define AEGP_StreamGroupName_LIGHT_LAYER "ADBE Light Layer" +#define AEGP_StreamGroupName_AUDIO "ADBE Audio Group" +#define AEGP_StreamGroupName_MATERIAL_OPTIONS "ADBE Material Options Group" +#define AEGP_StreamGroupName_TRANSFORM "ADBE Transform Group" +#define AEGP_StreamGroupName_LIGHT_OPTIONS "ADBE Light Options Group" +#define AEGP_StreamGroupName_CAMERA_OPTIONS "ADBE Camera Options Group" + +#define kAEGPDynamicStreamSuite "AEGP Dynamic Stream Suite" +#define kAEGPDynamicStreamSuiteVersion4 5 /* frozen in AE 9.0 */ + +typedef struct AEGP_DynamicStreamSuite4 { + + SPAPI A_Err (*AEGP_GetNewStreamRefForLayer)( // used to start recursive walk of layer, + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewStreamRefForMask)( // used to start recursive walk of layer, + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_MaskRefH maskH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + + SPAPI A_Err (*AEGP_GetStreamDepth)( // layer is depth 0 + AEGP_StreamRefH streamH, /* >> */ + A_long *depthPL); /* << */ + + + SPAPI A_Err (*AEGP_GetStreamGroupingType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamGroupingType *group_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetNumStreamsInGroup)( // error on leaf + AEGP_StreamRefH streamH, /* >> */ + A_long *num_streamsPL); /* << */ + + + SPAPI A_Err (*AEGP_GetDynamicStreamFlags)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_DynStreamFlags *stream_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetDynamicStreamFlag)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_DynStreamFlags one_flag, /* >> */ + A_Boolean undoableB, /* true if you want this to be an undoable change */ + /* if false, the only legal flag is AEGP_DynStreamFlag_HIDDEN */ + A_Boolean setB); /* >> */ + + + SPAPI A_Err (*AEGP_GetNewStreamRefByIndex)( // legal for namedgroup, indexedgroup, not leaf + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH parent_groupH, /* >> */ + A_long indexL, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewStreamRefByMatchname)( // legal for namedgroup + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH parent_groupH, /* >> */ + const A_char *utf8_match_nameZ, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_DeleteStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH); /* >> */ // must still dispose the streamref later + + SPAPI A_Err (*AEGP_ReorderStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH, /* <> updated to refer to newly ordered stream */ + A_long new_indexL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_long *new_indexPL0); /* << */ + + /* GetStreamName is in main kAEGPStreamSuite, and works on dynamic streams including groups */ + + SPAPI A_Err (*AEGP_SetStreamName)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH, /* >> */ + const A_UTF16Char *nameZ); /* >> null terminated UTF16 */ + + SPAPI A_Err (*AEGP_CanAddStream)( + AEGP_StreamRefH group_streamH, /* >> */ + const A_char *utf8_match_nameZ, /* >> make note: this is now defined as a UTF8 string! */ + A_Boolean *can_addPB); /* << */ + + SPAPI A_Err (*AEGP_AddStream)( /* UNDOABLE, only valid for AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH indexed_group_streamH, /* >> */ + const A_char *utf8_match_nameZ, /* >> make note: this is now defined as a UTF8 string! */ + AEGP_StreamRefH *streamPH0); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetMatchName)( + AEGP_StreamRefH streamH, /* >> */ + A_char *utf8_match_nameZ); /* << UTF8!! use A_char[AEGP_MAX_STREAM_MATCH_NAME_SIZE] for buffer */ + + SPAPI A_Err (*AEGP_GetNewParentStreamRef)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamRefH *parent_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetStreamIsModified)( // i.e. changed from defaults, like the UU key + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *modifiedPB); /* << */ + + SPAPI A_Err (*AEGP_GetStreamIndexInParent)( // only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP + AEGP_StreamRefH streamH, /* >> */ + A_long *indexPL); /* << */ + + // Valid on leaf streams only. Returns true if this stream is a multidimensional stream + // that can have its dimensions separated, though they may not be currently separated. + // Terminology: A Leader is the stream that can be separated, a Follower is one + // of N automatically streams that correspond to the N dimensions of the Leader. + // A Leader isn't always separated, call AEGP_AreDimensionsSeparated to find out if it is. + // As of 8/20/2007, the only stream that is ever separarated is the layer's Position property. + // Please *do not* write code assuming that, we anticipate allowing separation of more streams in the future. + SPAPI A_Err (*AEGP_IsSeparationLeader)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *leaderPB); /* << */ + + // Valid on leaf streams only. Returns true if AEGP_IsSeparationLeader() is true and the + // dimensions are currently separated. If this is the case, this stream will have + // AEGP_DynStreamFlag_HIDDEN set, and AEGP_GetSeparationFollower() will help you find the individual + // dimension streams. However, some simple APIs can continue to be used on this leader, and + // they will simply automatically propagate to the follower, including: + // + // AEGP_GetNewStreamValue + // AEGP_SetStreamValue + // AEGP_GetLayerStreamValue + // + // Methods such as AEGP_GetNewKeyframeValue that work on keyframe indices will most definitely *not* work on the Leader property, + // you will need to retrieve and operate on the Followers explicitly. + SPAPI A_Err (*AEGP_AreDimensionsSeparated)( + AEGP_StreamRefH leader_streamH, /* >> */ + A_Boolean *separatedPB); /* << */ + + // Valid only if AEGP_IsSeparationLeader() is true. + SPAPI A_Err (*AEGP_SetDimensionsSeparated)( + AEGP_StreamRefH leader_streamH, /* >> */ + A_Boolean separatedB); /* << */ + + // Retrieve the Follower stream corresponding to a given dimension of the Leader stream. dimS + // can range from 0 to AEGP_GetStreamValueDimensionality(leader_streamH) - 1. + SPAPI A_Err (*AEGP_GetSeparationFollower)( + AEGP_StreamRefH leader_streamH, /* >> */ + A_short dimS, /* >> */ + AEGP_StreamRefH *follower_streamPH); /* << */ + + // Valid on leaf streams only. Returns true if this stream is a one dimensional property + // that represents one of the dimensions of a Leader. You can retrieve stream from the Leader + // using AEGP_GetSeparationFollower(). + SPAPI A_Err (*AEGP_IsSeparationFollower)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *followerPB); /* << */ + + // Valid on separation Followers only, returns the Leader it is part of + SPAPI A_Err (*AEGP_GetSeparationLeader)( + AEGP_StreamRefH follower_streamH, /* >> */ + AEGP_StreamRefH *leader_streamPH); /* << */ + + // Valid on separation Followers only, returns which dimension of the Leader it corresponds to + SPAPI A_Err (*AEGP_GetSeparationDimension)( + AEGP_StreamRefH follower_streamH, /* >> */ + A_short *dimPS); /* << */ + +} AEGP_DynamicStreamSuite4; + + + +/* -------------------------------------------------------------------- */ + +typedef A_long AEGP_KeyframeIndex; + +enum { + AEGP_KeyframeFlag_NONE = 0x00, + AEGP_KeyframeFlag_TEMPORAL_CONTINUOUS = 0x01, + AEGP_KeyframeFlag_TEMPORAL_AUTOBEZIER = 0x02, + AEGP_KeyframeFlag_SPATIAL_CONTINUOUS = 0x04, + AEGP_KeyframeFlag_SPATIAL_AUTOBEZIER = 0x08, + AEGP_KeyframeFlag_ROVING = 0x10 +}; +typedef A_long AEGP_KeyframeFlags; + + +enum { + AEGP_NumKF_NO_DATA = -1 +}; + +#define kAEGPKeyframeSuite "AEGP Keyframe Suite" +#define kAEGPKeyframeSuiteVersion4 4 /* frozen in 8 */ + +typedef struct AEGP_KeyframeSuite4 { + // the only diff from this vs. last rev is that routines that pass AEGP_StreamValue2, when referring to a marker, + // (comp or layer) the struct now contains the NEW markerP type, which is compatible with the new Marker Suite + + // returns AEGP_NumKF_NO_DATA if it's a AEGP_StreamType_NO_DATA, and you can't retrieve any values + // returns zero if no keyframes (but might have an expression, so not necessarily constant) + SPAPI A_Err (*AEGP_GetStreamNumKFs)( + AEGP_StreamRefH streamH, /* >> */ + A_long *num_kfsPL); /* << */ + + + SPAPI A_Err (*AEGP_GetKeyframeTime)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *timePT); /* << */ + + // leaves stream unchanged if a keyframe already exists at specified time + SPAPI A_Err (*AEGP_InsertKeyframe)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* <> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + AEGP_KeyframeIndex *key_indexP); /* << */ + + SPAPI A_Err (*AEGP_DeleteKeyframe)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* <> */ + AEGP_KeyframeIndex key_index); /* >> */ + + SPAPI A_Err (*AEGP_GetNewKeyframeValue)( // dispose using AEGP_DisposeStreamValue() + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_StreamValue2 *valueP); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeValue)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + const AEGP_StreamValue2 *valueP); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetStreamValueDimensionality)( + AEGP_StreamRefH streamH, /* >> */ + A_short *value_dimPS); /* << */ + + SPAPI A_Err (*AEGP_GetStreamTemporalDimensionality)( + AEGP_StreamRefH streamH, /* >> */ + A_short *temporal_dimPS); /* << */ + + SPAPI A_Err (*AEGP_GetNewKeyframeSpatialTangents)( // dispose using AEGP_DisposeStreamValue() + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_StreamValue2 *in_tanP0, /* << */ + AEGP_StreamValue2 *out_tanP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeSpatialTangents)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + const AEGP_StreamValue2 *in_tanP0, /* >> not adopted */ + const AEGP_StreamValue2 *out_tanP0); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetKeyframeTemporalEase)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + A_long dimensionL, /* >> ranges from 0..TemporalDimensionality-1 */ + AEGP_KeyframeEase *in_easeP0, /* << */ + AEGP_KeyframeEase *out_easeP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeTemporalEase)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + A_long dimensionL, /* >> ranges from 0..TemporalDimensionality-1 */ + const AEGP_KeyframeEase *in_easeP0, /* >> not adopted */ + const AEGP_KeyframeEase *out_easeP0); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetKeyframeFlags)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeFlags *flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeFlag)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeFlags flag, /* >> set one flag at a time */ + A_Boolean true_falseB); /* >> */ + + SPAPI A_Err (*AEGP_GetKeyframeInterpolation)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeInterpolationType *in_interpP0, /* << */ + AEGP_KeyframeInterpolationType *out_interpP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeInterpolation)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeInterpolationType in_interp, /* >> */ + AEGP_KeyframeInterpolationType out_interp); /* >> */ + + SPAPI A_Err (*AEGP_StartAddKeyframes)( + AEGP_StreamRefH streamH, + AEGP_AddKeyframesInfoH *akPH); /* << */ + + + SPAPI A_Err (*AEGP_AddKeyframes)( + AEGP_AddKeyframesInfoH akH, /* <> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_long *key_indexPL); /* >> */ + + SPAPI A_Err (*AEGP_SetAddKeyframe)( + AEGP_AddKeyframesInfoH akH, /* <> */ + A_long key_indexL, /* >> */ + const AEGP_StreamValue2 *valueP); /* >> */ + + SPAPI A_Err (*AEGP_EndAddKeyframes)( /* UNDOABLE */ + A_Boolean addB, + AEGP_AddKeyframesInfoH akH); /* >> */ + +} AEGP_KeyframeSuite4; + + +/* -------------------------------------------------------------------- */ + +#define kAEGPTextDocumentSuite "AEGP Text Document Suite" +#define kAEGPTextDocumentSuiteVersion1 1 /* frozen in AE 6.0 */ + +typedef struct AEGP_TextDocumentSuite1 { + + SPAPI A_Err (*AEGP_GetNewText)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_TextDocumentH text_documentH, /* >> */ + AEGP_MemHandle *unicodePH); /* << handle of A_u_short, UTF16, NULL terminated. must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err (*AEGP_SetText)( + AEGP_TextDocumentH text_documentH, /* >> */ + const A_u_short *unicodePS, /* >> */ + A_long lengthL); /* >> number of characters */ + +} AEGP_TextDocumentSuite1; + +/* -------------------------------------------------------------------- */ + +#define kAEGPMarkerSuite "AEGP Marker Suite" +#define kAEGPMarkerSuiteVersion3 3 /* frozen in AE 16.0 */ + +enum { + AEGP_MarkerString_NONE, + + AEGP_MarkerString_COMMENT, + AEGP_MarkerString_CHAPTER, + AEGP_MarkerString_URL, + AEGP_MarkerString_FRAME_TARGET, + AEGP_MarkerString_CUE_POINT_NAME, + + AEGP_MarkerString_NUMTYPES +}; +typedef A_long AEGP_MarkerStringType; + +enum { + AEGP_MarkerFlag_NONE = 0x00000000, + AEGP_MarkerFlag_NAVIGATION = 0x00000001, // if this bit is zero, then the marker is for "Event" rather than "Navigation" + AEGP_MarkerFlag_PROTECT_REGION = 0x00000002 // if this bit is 1, then the marker is for a protected region (protected against timestretching, when existing on a precomp layer) +}; +typedef A_long AEGP_MarkerFlagType; + +typedef struct AEGP_MarkerSuite3 { + + SPAPI A_Err (*AEGP_NewMarker)( + AEGP_MarkerValP *markerPP); + + SPAPI A_Err (*AEGP_DisposeMarker)( + AEGP_MarkerValP markerP); + + SPAPI A_Err (*AEGP_DuplicateMarker)( + AEGP_MarkerValP markerP, // >> + AEGP_MarkerValP *new_markerP); // << + + SPAPI A_Err (*AEGP_SetMarkerFlag)( + AEGP_MarkerValP markerP, // >> + AEGP_MarkerFlagType flagType, // >> + A_Boolean valueB); // >> + + SPAPI A_Err (*AEGP_GetMarkerFlag)( + AEGP_ConstMarkerValP markerP, // >> + AEGP_MarkerFlagType flagType, // >> + A_Boolean *valueBP); // << + + SPAPI A_Err (*AEGP_GetMarkerString)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_ConstMarkerValP markerP, // >> + AEGP_MarkerStringType strType, // >> + AEGP_MemHandle *unicodePH); /* << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err (*AEGP_SetMarkerString)( + AEGP_MarkerValP markerP, // <<>> + AEGP_MarkerStringType strType, // >> + const A_u_short *unicodeP, // >> + A_long lengthL); // >> number of characters + + SPAPI A_Err (*AEGP_CountCuePointParams)( + AEGP_ConstMarkerValP markerP, // >> + A_long *paramsLP); // << + + SPAPI A_Err (*AEGP_GetIndCuePointParam)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_ConstMarkerValP markerP, // >> + A_long param_indexL, // >> must be between 0 and count - 1. else error + AEGP_MemHandle *unicodeKeyPH, // << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *unicodeValuePH); // << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_SetIndCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL, // must be between 0 and count - 1. else error + const A_u_short *unicodeKeyP, // >> UTF16 + A_long key_lengthL, // >> number of characters + const A_u_short *unicodeValueP, // >> UTF16 + A_long value_lengthL); // >> number of characters + + // this call is followed by AEGP_SetIndCuePointParam() to actually set the data + // the ONLY thing this function does is reserve the space for the param, at the provided index + SPAPI A_Err (*AEGP_InsertCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL); // must be between 0 and count. else error + + SPAPI A_Err (*AEGP_DeleteIndCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL); // must be between 0 and count - 1. else error + + SPAPI A_Err (*AEGP_SetMarkerDuration)( + AEGP_MarkerValP markerP, // >> + const A_Time *durationPT); // >> + + + SPAPI A_Err (*AEGP_GetMarkerDuration)( + AEGP_ConstMarkerValP markerP, // >> + A_Time *durationPT); // << + + SPAPI A_Err (*AEGP_SetMarkerLabel)( + AEGP_MarkerValP markerP, // >> + A_long value); // >> + + SPAPI A_Err (*AEGP_GetMarkerLabel)( + AEGP_ConstMarkerValP markerP, // >> + A_long *valueP); // << + +} AEGP_MarkerSuite3; + + +/* -------------------------------------------------------------------- */ + +#define kAEGPTextLayerSuite "AEGP Text Layer Suite" +#define kAEGPTextLayerSuiteVersion1 1 /* frozen in AE 6.0 */ + +typedef struct AEGP_TextLayerSuite1 { + + SPAPI A_Err (*AEGP_GetNewTextOutlines)( + AEGP_LayerH layerH, /* >> must be a text layer */ + const A_Time *layer_timePT, /* >> */ + AEGP_TextOutlinesH *outlinesPH); /* << must be disposed with AEGP_DisposeTextOutlines */ + + SPAPI A_Err (*AEGP_DisposeTextOutlines)( + AEGP_TextOutlinesH outlinesH); /* >> */ + + SPAPI A_Err (*AEGP_GetNumTextOutlines)( + AEGP_TextOutlinesH outlinesH, /* >> */ + A_long *num_outlinesPL); /* << */ + + SPAPI A_Err (*AEGP_GetIndexedTextOutline)( + AEGP_TextOutlinesH outlinesH, /* >> */ + A_long path_indexL, /* >> */ + PF_PathOutlinePtr *pathPP); /* << DO NOT DISPOSE */ + +} AEGP_TextLayerSuite1; + + +/* -------------------------------------------------------------------- */ + + +typedef A_long AEGP_InstalledEffectKey; +#define AEGP_InstalledEffectKey_NONE 0 + +#define RQ_ITEM_INDEX_NONE -1 + +enum { + AEGP_EffectFlags_NONE =0, + AEGP_EffectFlags_ACTIVE =0x01L << 0, + AEGP_EffectFlags_AUDIO_ONLY =0x01L << 1, + AEGP_EffectFlags_AUDIO_TOO =0x01L << 2, + AEGP_EffectFlags_MISSING =0x01L << 3 +}; +typedef A_long AEGP_EffectFlags; + +typedef A_long AEGP_EffectIndex; + + +#define kAEGPEffectSuite "AEGP Effect Suite" +#define kAEGPEffectSuiteVersion4 4 /* frozen in AE 13.0 */ + +typedef struct AEGP_EffectSuite4 { + + SPAPI A_Err (*AEGP_GetLayerNumEffects)( + AEGP_LayerH layerH, /* >> */ + A_long *num_effectsPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerEffectByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_EffectIndex layer_effect_indexL, /* >> */ + AEGP_EffectRefH *effectPH); /* << MUST dispose with DisposeEffect*/ + + SPAPI A_Err (*AEGP_GetInstalledKeyFromLayerEffect)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_InstalledEffectKey *installed_effect_keyP); /* << */ + + SPAPI A_Err (*AEGP_GetEffectParamUnionByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + PF_ParamType *param_typeP, /* << */ + PF_ParamDefUnion *uP0); /* << DO NOT USE THE VALUE FROM THIS PARAMDEF! */ + + SPAPI A_Err (*AEGP_GetEffectFlags)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_EffectFlags *effect_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetEffectFlags)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_EffectFlags effect_flags_set_mask, /* >> */ + AEGP_EffectFlags effect_flags); /* >> */ + + SPAPI A_Err (*AEGP_ReorderEffect)( /* UNDOABLE */ + AEGP_EffectRefH effect_refH, /* >> */ + A_long effect_indexL); /* >> */ + + /** new command parameter addded. To get old behaviour pass in PF_Cmd_COMPLETELY_GENERAL for effect_command **/ + SPAPI A_Err (*AEGP_EffectCallGeneric)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + const A_Time *timePT, /* >> Use the timebase of the layer to which effect is applied. */ + PF_Cmd effect_cmd, /* >> new parameter from version 2 */ + void *effect_extraPV); /* <> */ + + SPAPI A_Err (*AEGP_DisposeEffect)( + AEGP_EffectRefH effect_refH ); /* >> */ + + SPAPI A_Err (*AEGP_ApplyEffect)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + AEGP_EffectRefH *effect_refPH); /* << MUST BE DISPOSED with AEGP_DisposeEffect */ + + SPAPI A_Err (*AEGP_DeleteLayerEffect)( + AEGP_EffectRefH effect_refH); /* >> undoable */ + + SPAPI A_Err (*AEGP_GetNumInstalledEffects)( + A_long *num_installed_effectsPL); /* << */ + + // pass in AEGP_InstalledEffectKey_NONE for installed_effect_key to get first effect key + + SPAPI A_Err (*AEGP_GetNextInstalledEffect)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + AEGP_InstalledEffectKey *next_effectPH); /* << */ + + SPAPI A_Err (*AEGP_GetEffectName)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_EFFECT_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetEffectMatchName)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *utf8_match_nameZ); /* << UTF8!! space for A_char[AEGP_MAX_EFFECT_MATCH_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetEffectCategory)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *categoryZ); /* << space for A_char[AEGP_MAX_EFFECT_CATEGORY_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_DuplicateEffect)( + AEGP_EffectRefH original_effect_refH, /* >> */ + AEGP_EffectRefH *duplicate_effect_refPH); /* << */ + + /** new in AE 13.0: effect masks */ + SPAPI A_Err (*AEGP_NumEffectMask)( + AEGP_EffectRefH effect_refH, /* >> */ + A_u_long *num_masksPL); /* << */ + + SPAPI A_Err (*AEGP_GetEffectMaskID)( + AEGP_EffectRefH effect_refH, /* >> */ + A_u_long mask_indexL, /* >> */ + AEGP_MaskIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_AddEffectMask)( /* UNDOABLE */ + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_MaskIDVal id_val, /* >> */ + AEGP_StreamRefH *streamPH0); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_RemoveEffectMask)( /* UNDOABLE */ + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_MaskIDVal id_val); /* >> */ + + SPAPI A_Err (*AEGP_SetEffectMask)( /* UNDOABLE */ + AEGP_EffectRefH effect_refH, /* >> */ + A_u_long mask_indexL, /* >> */ + AEGP_MaskIDVal id_val, /* >> */ + AEGP_StreamRefH *streamPH0); /* << must be disposed by caller! */ +} AEGP_EffectSuite4; + + +/* -------------------------------------------------------------------- */ + +typedef A_long AEGP_MaskIndex; + +enum { + AEGP_MaskMBlur_SAME_AS_LAYER, + AEGP_MaskMBlur_OFF, + AEGP_MaskMBlur_ON +}; +typedef A_u_char AEGP_MaskMBlur; // This must be A_u_char, used in disk safe BEE_MaskInfo + +enum { + AEGP_MaskFeatherFalloff_SMOOTH, + AEGP_MaskFeatherFalloff_LINEAR +}; +typedef A_u_char AEGP_MaskFeatherFalloff; // This must be A_u_char, used in disk safe BEE_MaskInfo + +enum { + AEGP_MaskFeatherInterp_NORMAL, + AEGP_MaskFeatherInterp_HOLD_CW +}; +typedef A_u_char AEGP_MaskFeatherInterp; + +enum { + AEGP_MaskFeatherType_OUTER, + AEGP_MaskFeatherType_INNER +}; +typedef A_u_char AEGP_MaskFeatherType; + +#define kAEGPMaskSuite "AEGP Layer Mask Suite" +#define kAEGPMaskSuiteVersion6 7 /* frozen AE 11 */ + +typedef struct AEGP_MaskSuite6 { + + SPAPI A_Err (*AEGP_GetLayerNumMasks)( + AEGP_LayerH aegp_layerH, /* >> */ + A_long *num_masksPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerMaskByIndex)( + AEGP_LayerH aegp_layerH, /* >> */ + AEGP_MaskIndex mask_indexL, /* >> */ + AEGP_MaskRefH *maskPH); /* << must be disposed by calling AEGP_DisposeMask() */ + + SPAPI A_Err (*AEGP_DisposeMask)( + AEGP_MaskRefH mask_refH); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean *invertPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean invertB); /* << */ + + SPAPI A_Err (*AEGP_GetMaskMode)( + AEGP_MaskRefH mask_refH, /* >> */ + PF_MaskMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMode)( + AEGP_MaskRefH maskH, /* >> */ + PF_MaskMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur *blur_stateP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur blur_state); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskFeatherFalloff)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskFeatherFalloff *feather_falloffP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskFeatherFalloff)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskFeatherFalloff feather_falloffP); /* >> */ + + // AEGP_GetMaskName/SetMaskName are obsoleted. Use AEGP_GetNewDynamicStreamForMask + // and the name functions there + + SPAPI A_Err (*AEGP_GetMaskID)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_CreateNewMask)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_MaskRefH *mask_refPH, /* << */ + A_long *mask_indexPL0); /* << */ + + SPAPI A_Err (*AEGP_DeleteMaskFromLayer)( /* UNDOABLE */ + AEGP_MaskRefH mask_refH); /* >> still need to Dispose MaskRefH */ + + SPAPI A_Err (*AEGP_GetMaskColor)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_ColorVal *colorP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskColor)( + AEGP_MaskRefH mask_refH, /* >> */ + const AEGP_ColorVal *colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskLockState)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean *is_lockedPB); /* >> */ + + SPAPI A_Err (*AEGP_SetMaskLockState)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean lockB); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskIsRotoBezier)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean *is_roto_bezierPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskIsRotoBezier)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean is_roto_bezierB); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateMask)( + AEGP_MaskRefH orig_mask_refH, /* >> */ + AEGP_MaskRefH *duplicate_mask_refPH); /* << */ + +} AEGP_MaskSuite6; + + +/* -------------------------------------------------------------------- */ + +typedef struct { + A_long segment; /* mask segment where feather is located */ + PF_FpLong segment_sF; /* 0-1: feather location on segment */ + PF_FpLong radiusF; /* negative value allowed if type == AEGP_MaskFeatherType_INNER */ + PF_FpShort ui_corner_angleF; /* 0-1: angle of UI handle on corners */ + PF_FpShort tensionF; /* 0-1: tension of boundary at feather pt */ + AEGP_MaskFeatherInterp interp; + AEGP_MaskFeatherType type; +} AEGP_MaskFeather; + +typedef A_long AEGP_FeatherIndex; + +typedef PF_PathVertex AEGP_MaskVertex; + +typedef A_long AEGP_VertexIndex; +#define AEGP_VertexIndex_END 10922 + +#define kAEGPMaskOutlineSuite "AEGP Mask Outline Suite" +#define kAEGPMaskOutlineSuiteVersion3 5 /* frozen in AE 11 */ + +typedef struct AEGP_MaskOutlineSuite3 { + + SPAPI A_Err (*AEGP_IsMaskOutlineOpen)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_Boolean *openPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskOutlineOpen)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_Boolean openB); /* >> */ + + // N segments means there are segments [0..N-1]; segment J is defined by vertex J & J+1 + SPAPI A_Err (*AEGP_GetMaskOutlineNumSegments)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_long *num_segmentsPL); /* << */ + + // which_pointL range: [0..num_segments]; for closed masks vertex[0] == vertex[num_segments] + SPAPI A_Err (*AEGP_GetMaskOutlineVertexInfo)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex which_pointL, /* >> */ + AEGP_MaskVertex *vertexP); /* << tangents are relative to position */ + + // Setting vertex 0 is special. Its in tangent will actually set the out tangent + // of the last vertex in the outline. + SPAPI A_Err (*AEGP_SetMaskOutlineVertexInfo)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex which_pointL, /* >> must already exists (use Create) */ + const AEGP_MaskVertex *vertexP); /* >> tangents are relative to position */ + + SPAPI A_Err (*AEGP_CreateVertex)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex insert_position); /* >> will insert at this index. moving other verticies index++*/ + + SPAPI A_Err (*AEGP_DeleteVertex)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex index); /* >> */ + + + SPAPI A_Err (*AEGP_GetMaskOutlineNumFeathers)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_long *num_feathersPL); /* << */ + + SPAPI A_Err (*AEGP_GetMaskOutlineFeatherInfo)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_FeatherIndex which_featherL, /* >> */ + AEGP_MaskFeather *featherP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskOutlineFeatherInfo)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex which_featherL, /* >> must already exists (use Create) */ + const AEGP_MaskFeather *featherP); /* >> */ + + SPAPI A_Err (*AEGP_CreateMaskOutlineFeather)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + const AEGP_MaskFeather *featherP0, /* >> */ + AEGP_FeatherIndex *insert_positionP); /* << index of new feather */ + + SPAPI A_Err (*AEGP_DeleteMaskOutlineFeather)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_FeatherIndex index); /* >> */ + +} AEGP_MaskOutlineSuite3; + + +/* -------------------------------------------------------------------- */ + + +typedef FIEL_Label AEGP_InterlaceLabel; + +enum { + AEGP_AlphaPremul = 0x1, /* otherwise straight */ + AEGP_AlphaInverted = 0x2, /* 255 = transparent */ + AEGP_AlphaIgnore = 0x4 +}; +typedef A_u_long AEGP_AlphaFlags; + +typedef struct { + AEGP_AlphaFlags flags; + A_u_char redCu; // color that was matted (if premul) + A_u_char greenCu; + A_u_char blueCu; +} AEGP_AlphaLabel; + +enum { + AEGP_PulldownPhase_NO_PULLDOWN = 0, + AEGP_PulldownPhase_WSSWW = 1, + AEGP_PulldownPhase_SSWWW, + AEGP_PulldownPhase_SWWWS, + AEGP_PulldownPhase_WWWSS, + AEGP_PulldownPhase_WWSSW, + AEGP_PulldownPhase_WWWSW, + AEGP_PulldownPhase_WWSWW, + AEGP_PulldownPhase_WSWWW, + AEGP_PulldownPhase_SWWWW, + AEGP_PulldownPhase_WWWWS +}; +typedef A_long AEGP_PulldownPhase; + +typedef struct { + A_long loops; + A_long reserved; /* set to 0; reserved for future use (palindrome, etc.) */ +} AEGP_LoopBehavior; + +typedef struct { + AEGP_InterlaceLabel il; + AEGP_AlphaLabel al; + AEGP_PulldownPhase pd; + AEGP_LoopBehavior loop; + A_Ratio pix_aspect_ratio; + A_FpLong native_fpsF; + A_FpLong conform_fpsF; + A_long depthL; + A_Boolean motion_dB; +} AEGP_FootageInterp; + +#define AEGP_FOOTAGE_LAYER_NAME_LEN (63) +#define AEGP_LayerIndex_UNKNOWN (-2) +#define AEGP_LayerIndex_MERGED (-1) +#define AEGP_LayerID_UNKNOWN (-1) + +enum { + AEGP_LayerDrawStyle_LAYER_BOUNDS = 0, + AEGP_LayerDrawStyle_DOCUMENT_BOUNDS +}; + +typedef A_long AEGP_LayerDrawStyle; + + +typedef struct { + A_long layer_idL; /* unique ID for layer, as contained in a Photoshop document's 'lyid' resource. */ + /* pass AEGP_LayerID_UNKNOWN if you don't know this */ + A_long layer_indexL; /* zero-based layer index. pass AEGP_LayerIndex_MERGED for merged layers */ + A_char nameAC[AEGP_FOOTAGE_LAYER_NAME_LEN + 1]; /* used for sequences and backup for linking */ + AEGP_LayerDrawStyle layer_draw_style; + +} AEGP_FootageLayerKey; + +#define AEGP_ANY_FRAME -1 + +typedef struct { + A_Boolean all_in_folderB; /* TRUE means intepret as a sequence, FALSE means still frame. + If FALSE, other parameters in this structure have no effect. */ + A_Boolean force_alphabeticalB; /* if TRUE, filenames of sequence will be forced to alphabetical order */ + A_long start_frameL; /* first frame of sequence, AEGP_ANY_FRAME means earliest frame found */ + A_long end_frameL; /* last frame of sequence, AEGP_ANY_FRAME means last frame found */ +} AEGP_FileSequenceImportOptions; + +enum { + AEGP_FootageSignature_NONE = -1, // invalid sig + AEGP_FootageSignature_MISSING = 0, // placeholder + AEGP_FootageSignature_SOLID = 'Soli' +}; +typedef A_long AEGP_FootageSignature; + + +#define AEGP_FOOTAGE_MAIN_FILE_INDEX 0 + +#define kAEGPFootageSuite "AEGP Footage Suite" + +#define kAEGPFootageSuiteVersion5 11 /* frozen in AE 10.0 */ + + +enum { + AEGP_InterpretationStyle_NO_DIALOG_GUESS = 0, // FALSE for backwards compatability: will guess alpha interpretation even if file contains unknown alpha interpretation and user pref says to ask user + AEGP_InterpretationStyle_DIALOG_OK = 1, // TRUE for backwards comptability. Optionally can show a dialog. + AEGP_InterpretationStyle_NO_DIALOG_NO_GUESS = 2 // used for replace footage implementation +}; +typedef A_u_char AEGP_InterpretationStyle; + +typedef struct AEGP_FootageSuite5 { + + SPAPI A_Err (*AEGP_GetMainFootageFromItem)( /* error if item isn't AEGP_ItemType_FOOTAGE! */ + AEGP_ItemH itemH, /* >> */ + AEGP_FootageH *footagePH); /* << */ + + SPAPI A_Err (*AEGP_GetProxyFootageFromItem)( /* error if has_proxy is false! (note, item could still be a comp) */ + AEGP_ItemH itemH, /* >> */ + AEGP_FootageH *proxy_footagePH); /* << */ + + SPAPI A_Err (*AEGP_GetFootageNumFiles)( + AEGP_FootageH footageH, /* >> */ + A_long *num_main_filesPL0, /* << */ + A_long *files_per_framePL0); /* << includes main file. e.g. 1 for no aux data */ + + SPAPI A_Err (*AEGP_GetFootagePath)( + AEGP_FootageH footageH, /* >> */ + A_long frame_numL, /* >> range is 0 to num_main_files */ + A_long file_indexL, /* >> AEGP_FOOTAGE_MAIN_FILE_INDEX is main file */ + AEGP_MemHandle *unicode_pathPH); // << empty string if no file. handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetFootageSignature)( + AEGP_FootageH footageH, /* >> */ + AEGP_FootageSignature *sigP); /* << like filetype, but also for non-file types like solids, etc. */ + + SPAPI A_Err (*AEGP_NewFootage)( + AEGP_PluginID aegp_plugin_id, /* >> */ + const A_UTF16Char *pathZ, // >> null terminated unicode path with platform separators + const AEGP_FootageLayerKey *layer_infoP0, /* >> optional layer info; pass NULL for merged layers */ + const AEGP_FileSequenceImportOptions *sequence_optionsP0, /* >> optional sequence info; passing NULL means not a sequence */ + AEGP_InterpretationStyle interp_style, /* >> (in) */ + void *reserved, /* >> pass NULL */ + AEGP_FootageH *footagePH); /* << caller owns until disposed or added to project */ + + SPAPI A_Err (*AEGP_AddFootageToProject)( /* UNDOABLE */ + AEGP_FootageH footageH, /* >> will be adopted by project, may not be added more than once */ + AEGP_ItemH folderH, /* >> add to this folder */ + AEGP_ItemH *added_itemPH0); /* << */ + + SPAPI A_Err (*AEGP_SetItemProxyFootage)( /* UNDOABLE */ + AEGP_FootageH footageH, /* >> will be adopted by project, may not be set more than once */ + AEGP_ItemH itemH); /* >> set for this item */ + + SPAPI A_Err (*AEGP_ReplaceItemMainFootage)( /* UNDOABLE */ + AEGP_FootageH footageH, /* >> will be adopted by project, may not be set more than once */ + AEGP_ItemH itemH); /* >> replace main footage for this item */ + + SPAPI A_Err (*AEGP_DisposeFootage)( + AEGP_FootageH footageH); /* >> do not dipose footage that is owned or has been adopted by project */ + + SPAPI A_Err (*AEGP_GetFootageInterpretation)( + AEGP_ItemH itemH, /* >> note: item that contains footage */ + A_Boolean proxyB, /* >> TRUE = get proxy interp; FALSE = get main interp */ + AEGP_FootageInterp *interpP); /* << */ + + SPAPI A_Err (*AEGP_SetFootageInterpretation)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> note: item that contains footage */ + A_Boolean proxyB, /* >> TRUE = set proxy interp; FALSE = set main interp */ + const AEGP_FootageInterp *interpP); /* >> */ + + SPAPI A_Err (*AEGP_GetFootageLayerKey) ( + AEGP_FootageH footageH, /* >> */ + AEGP_FootageLayerKey *layerKeyP); /* << the footages layer info */ + + SPAPI A_Err (*AEGP_NewPlaceholderFootage)( /* doesn't modify project, creates footage with AEGP_FootageSignature_MISSING */ + AEGP_PluginID plugin_id, /* >> */ + const A_char *nameZ, /* >> file name, not the path! */ + A_long width, /* >> */ + A_long height, /* >> */ + const A_Time *durationPT, /* >> */ + AEGP_FootageH *footagePH); /* << caller owns until disposed or added to project */ + + SPAPI A_Err (*AEGP_NewPlaceholderFootageWithPath)( /* doesn't modify project, creates footage with AEGP_FootageSignature_MISSING */ + AEGP_PluginID plugin_id, /* >> */ + const A_UTF16Char *pathZ, // >> null terminated unicode path with platform separators + AEGP_Platform path_platform, /* >> Mac or Win */ + AEIO_FileType file_type, // >> AEIO_FileType_NONE is now a warning condition. If you pass AEIO_FileType_ANY, then path MUST exist. if path may not exist: pass AEIO_FileType_DIR for folder, or AEIO_FileType_GENERIC for a file + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Time *durationPT, /* >> */ + AEGP_FootageH *footagePH); /* << caller owns until disposed or added to project */ + + SPAPI A_Err (*AEGP_NewSolidFootage)( /* doesn't modify project, creates footage with AEGP_FootageSignature_SOLID */ + const A_char *nameZ, /* >> file name, not the path! */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *colorP, /* >> */ + AEGP_FootageH *footagePH); /* << caller owns until disposed or added to project */ + + SPAPI A_Err (*AEGP_GetSolidFootageColor)( /* error if footage isn't AEGP_FootageSignature_SOLID */ + AEGP_ItemH itemH, /* >> note: item that contains footage */ + A_Boolean proxyB, /* >> TRUE = get proxy solid color; FALSE = get main solid color */ + AEGP_ColorVal *colorP); /* << */ + + SPAPI A_Err (*AEGP_SetSolidFootageColor)( /* UNDOABLE, error if footage isn't AEGP_FootageSignature_SOLID */ + AEGP_ItemH itemH, /* >> note: item that contains footage */ + A_Boolean proxyB, /* >> TRUE = set proxy solid color; FALSE = set main solid color */ + const AEGP_ColorVal *colorP); /* >> */ + + SPAPI A_Err (*AEGP_SetSolidFootageDimensions)( /* UNDOABLE, error if footage isn't AEGP_FootageSignature_SOLID */ + AEGP_ItemH itemH, /* >> note: item that contains footage */ + A_Boolean proxyB, /* >> TRUE = set proxy solid size; FALSE = set main solid size */ + A_long widthL, /* >> min 1, max 30,000 */ + A_long heightL); /* >> min 1, max 30,000 */ + + SPAPI A_Err (*AEGP_GetFootageSoundDataFormat)( + AEGP_FootageH footageH, /* >> */ + AEGP_SoundDataFormat* sound_formatP); /* << */ + + SPAPI A_Err (*AEGP_GetFootageSequenceImportOptions)( + AEGP_FootageH footageH, /* >> */ + AEGP_FileSequenceImportOptions *optionsP); /* << */ + +} AEGP_FootageSuite5; + +/* -------------------------------------------------------------------- */ + + +typedef A_long AEGP_Command; + +#define AEGP_Command_ALL 0 + +enum { + AEGP_WindType_NONE, + AEGP_WindType_PROJECT, + AEGP_WindType_COMP, + AEGP_WindType_TIME_LAYOUT, + AEGP_WindType_LAYER, + AEGP_WindType_FOOTAGE, + AEGP_WindType_RENDER_QUEUE, + AEGP_WindType_QT, + AEGP_WindType_DIALOG, + AEGP_WindType_FLOWCHART, + AEGP_WindType_EFFECT, + AEGP_WindType_OTHER +}; +typedef A_LegacyEnumType AEGP_WindowType; + + +enum { + AEGP_HP_BeforeAE = 0x1, // call hook before AE handles event (if AE handles) + AEGP_HP_AfterAE = 0x2 // call hook after AE handles event (if AE handles) +}; +typedef A_u_long AEGP_HookPriority; + + +typedef A_Err (*AEGP_CommandHook)( + AEGP_GlobalRefcon plugin_refconP, /* >> */ + AEGP_CommandRefcon refconP, /* >> */ + AEGP_Command command, /* >> */ + AEGP_HookPriority hook_priority, /* >> currently always AEGP_HP_BeforeAE */ + A_Boolean already_handledB, /* >> */ + A_Boolean *handledPB); /* << whether you handled */ + +typedef A_Err (*AEGP_UpdateMenuHook)( + AEGP_GlobalRefcon plugin_refconP, /* >> */ + AEGP_UpdateMenuRefcon refconP, /* >> */ + AEGP_WindowType active_window); /* >> */ + +typedef A_Err (*AEGP_DeathHook)( + AEGP_GlobalRefcon plugin_refconP, /* >> */ + AEGP_DeathRefcon refconP); /* >> */ + +typedef A_Err (*AEGP_VersionHook)( /* As of 5.0, not called */ + AEGP_GlobalRefcon plugin_refconP, /* >> */ + AEGP_VersionRefcon refconP, /* >> */ + A_u_long *pf_versionPLu); /* << use PF_VERSION() macro to build and PF_Version_XXX() macros to access */ + + // one line description. when displaying, AE will prepend name and version information. + // this will be used to display a list of about info for all plugins + +typedef A_Err (*AEGP_AboutStringHook)( /* As of 5.0, not called */ + AEGP_GlobalRefcon plugin_refconP, /* >> */ + AEGP_AboutStringRefcon refconP, /* >> */ + A_char *aboutZ); /* << space for A_char[AEGP_MAX_ABOUT_STRING_SIZE] */ + + // bring up a dialog and tell us about yourself +typedef A_Err (*AEGP_AboutHook)( /* As of 5.0, not called */ + AEGP_GlobalRefcon plugin_refconP, /* >> */ + AEGP_AboutRefcon refconP); /* >> */ + +typedef A_Err (*AEGP_IdleHook)( + AEGP_GlobalRefcon plugin_refconP, /* >> */ + AEGP_IdleRefcon refconP, /* >> */ + A_long *max_sleepPL); /* <> in 1/60 of a second*/ + + + + +#define kAEGPRegisterSuite "AEGP Register Suite" +#define kAEGPRegisterSuiteVersion5 6 /* frozen AE 10.0 */ + +typedef struct AEGP_RegisterSuite5 { + + SPAPI A_Err (*AEGP_RegisterCommandHook)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_HookPriority hook_priority, /* >> */ + AEGP_Command command, /* >> use AEGP_Command_ALL to get all commands */ + AEGP_CommandHook command_hook_func, /* >> */ + AEGP_CommandRefcon refconP); /* >> */ + + // this will be called anytime any menu is about to be drawn. it isn't specific to a menu so you + // must enable all appropriate menu items when this hook is called. + + SPAPI A_Err (*AEGP_RegisterUpdateMenuHook)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_UpdateMenuHook update_menu_hook_func, /* >> */ + AEGP_UpdateMenuRefcon refconP); /* >> */ + + SPAPI A_Err (*AEGP_RegisterDeathHook)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_DeathHook death_hook_func, /* >> */ + AEGP_DeathRefcon refconP); /* >> */ + + SPAPI A_Err (*AEGP_RegisterVersionHook)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_VersionHook version_hook_func, /* >> */ + AEGP_VersionRefcon refconP); /* >> */ + + SPAPI A_Err (*AEGP_RegisterAboutStringHook)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_AboutStringHook about_string_hook_func, /* >> */ + AEGP_AboutStringRefcon refconP); /* >> */ + + SPAPI A_Err (*AEGP_RegisterAboutHook)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_AboutHook about_hook_func, /* >> */ + AEGP_AboutRefcon refconP); /* >> */ + + SPAPI A_Err (*AEGP_RegisterArtisan) ( + A_Version api_version, /* >> */ + A_Version artisan_version, /* >> */ + AEGP_PluginID aegp_plugin_id, /* >> */ + void *aegp_refconPV, /* <> */ + const A_char *utf8_match_nameZ, /* >> */ + const A_char *artisan_nameZ, /* >> */ + PR_ArtisanEntryPoints *entry_funcs); /* >> */ + + SPAPI A_Err (*AEGP_RegisterIO) ( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_IORefcon aegp_refconP, /* >> */ + const AEIO_ModuleInfo *io_infoP, /* >> */ + const AEIO_FunctionBlock4 *aeio_fcn_blockP); /* >> */ + + SPAPI A_Err (*AEGP_RegisterIdleHook)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_IdleHook idle_hook_func, /* >> */ + AEGP_IdleRefcon refconP); /* >> */ + + + SPAPI A_Err (*AEGP_RegisterTracker)( + A_Version api_version, /* >> */ + A_Version tracker_version, /* >> */ + AEGP_PluginID aegp_plugin_id, /* >> */ + const AEGP_GlobalRefcon refconP, /* >> */ + const A_char *utf8_match_nameZ, /* >> */ + const A_char *tracker_nameZ, /* >> */ + const PT_TrackerEntryPoints *entry_pointsP); /* >> */ + + SPAPI A_Err (*AEGP_RegisterInteractiveArtisan) ( + A_Version api_version, /* >> */ + A_Version artisan_version, /* >> */ + AEGP_PluginID aegp_plugin_id, /* >> */ + void *aegp_refconPV, /* <> */ + const A_char *utf8_match_nameZ, /* >> */ + const A_char *artisan_nameZ, /* >> */ + PR_ArtisanEntryPoints *entry_funcs); /* >> */ + + // Call this to register as many strings as you like for name-replacement + // when presets are loaded. Any time a Property name is found, or referred + // to in an expression, and it starts with an ASCII tab character ('\t'), followed + // by one of the english names, it will be replaced with the localized name. (In + // English the tab character will simply be removed). + SPAPI A_Err (*AEGP_RegisterPresetLocalizationString) ( + const A_char *english_nameZ, /* >> */ + const A_char *localized_nameZ); /* >> */ + + + +} AEGP_RegisterSuite5; + + +/* -------------------------------------------------------------------- */ + + +enum { + AEGP_Menu_NONE, + AEGP_Menu_APPLE, + AEGP_Menu_FILE, + AEGP_Menu_EDIT, + AEGP_Menu_COMPOSITION, + AEGP_Menu_LAYER, + AEGP_Menu_EFFECT, + AEGP_Menu_WINDOW, + AEGP_Menu_FLOATERS, + AEGP_Menu_KF_ASSIST, + AEGP_Menu_IMPORT, + AEGP_Menu_SAVE_FRAME_AS, + AEGP_Menu_PREFS, + AEGP_Menu_EXPORT, + AEGP_Menu_ANIMATION, + AEGP_Menu_PURGE, + //the following menu options only valid for AE 12.0 and up + AEGP_Menu_NEW +}; +typedef A_LegacyEnumType AEGP_MenuID; + + +#define AEGP_MENU_INSERT_SORTED (-2) +#define AEGP_MENU_INSERT_AT_BOTTOM (-1) +#define AEGP_MENU_INSERT_AT_TOP 0 + + +#define kAEGPCommandSuite "AEGP Command Suite" +#define kAEGPCommandSuiteVersion1 1 /* frozen in AE 5.0 */ + +typedef struct AEGP_CommandSuite1 { + + SPAPI A_Err (*AEGP_GetUniqueCommand)( + AEGP_Command *unique_commandP); /* << */ + + SPAPI A_Err (*AEGP_InsertMenuCommand)( + AEGP_Command command, /* >> */ + const A_char *nameZ, /* >> */ + AEGP_MenuID menu_id, /* >> */ + A_long after_itemL); /* >> */ + + SPAPI A_Err (*AEGP_RemoveMenuCommand)( + AEGP_Command command); /* >> */ + + SPAPI A_Err (*AEGP_SetMenuCommandName)( + AEGP_Command command, /* >> */ + const A_char *nameZ); /* >> */ + + SPAPI A_Err (*AEGP_EnableCommand)( + AEGP_Command command); /* >> */ + + SPAPI A_Err (*AEGP_DisableCommand)( + AEGP_Command command); /* >> */ + + SPAPI A_Err (*AEGP_CheckMarkMenuCommand)( + AEGP_Command command, /* >> */ + A_Boolean checkB); /* >> */ + + SPAPI A_Err (*AEGP_DoCommand)( + AEGP_Command command); /* >> */ + +} AEGP_CommandSuite1; + + + + +/* -------------------------------------------------------------------- */ + + +typedef struct { + A_long reservedAL[12]; +} AEGP_ErrReportState; + + +enum { + AEGP_GetPathTypes_PLUGIN = 0, // (Not Implemented) The path to the executable of the plugin itself. + AEGP_GetPathTypes_USER_PLUGIN, // The suite specific location of user specific plugins. + AEGP_GetPathTypes_ALLUSER_PLUGIN, // The suite specific location of plugins shared by all users. + AEGP_GetPathTypes_APP // The After Effects exe or .app location. Not plugin specific. + }; +typedef A_u_long AEGP_GetPathTypes; + + +#define kAEGPUtilitySuite "AEGP Utility Suite" +#define kAEGPUtilitySuiteVersion6 13 /* frozen in AE 12.0 */ + +typedef struct AEGP_UtilitySuite6 { + + SPAPI A_Err (*AEGP_ReportInfo)( /* displays dialog with name of plugin followed by info string. See also: ReportInfoUnicode */ + AEGP_PluginID aegp_plugin_id, /* >> */ + const A_char *info_stringZ); /* >> */ + + SPAPI A_Err (*AEGP_ReportInfoUnicode)( /* displays dialog with name of plugin followed by info string */ + AEGP_PluginID aegp_plugin_id, /* >> */ + const A_UTF16Char *info_stringP); /* >> */ + + SPAPI A_Err (*AEGP_GetDriverPluginInitFuncVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_GetDriverImplementationVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_StartQuietErrors)( + AEGP_ErrReportState *err_stateP); /* << */ + + SPAPI A_Err (*AEGP_EndQuietErrors)( + A_Boolean report_quieted_errorsB, /* >> currently reports last quieted error */ + AEGP_ErrReportState *err_stateP); /* >> */ + + SPAPI A_Err (*AEGP_GetLastErrorMessage)( + A_long buffer_size, /* >> size of character buffer */ + A_char *error_string, /* << */ + A_Err *error_num); /* << */ + + SPAPI A_Err (*AEGP_StartUndoGroup)( /* MUST be balanced with call to AEGP_EndUndoGroup() */ + const A_char *undo_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_EndUndoGroup)(void); + + SPAPI A_Err (*AEGP_RegisterWithAEGP)( + AEGP_GlobalRefcon global_refcon, /* >> global refcon passed in command handlers */ + const A_char *plugin_nameZ, /* >> name of this plugin. AEGP_MAX_PLUGIN_NAME_SIZE */ + AEGP_PluginID *plugin_id); /* << id for plugin to use in other AEGP calls */ + + SPAPI A_Err (*AEGP_GetMainHWND)( + void *main_hwnd); /* << */ + + SPAPI A_Err (*AEGP_ShowHideAllFloaters)( + A_Boolean include_tool_palB); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalGetForeColor)( + AEGP_ColorVal *fore_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalGetBackColor)( + AEGP_ColorVal *back_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalSetForeColor)( + const AEGP_ColorVal *fore_colorP); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalSetBackColor)( + const AEGP_ColorVal *back_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalGetFillColor)( + A_Boolean *is_fill_color_definedPB, /* << */ + AEGP_ColorVal *fill_colorP); /* << only valid if is_fill_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalGetStrokeColor)( + A_Boolean *is_stroke_color_definedPB, /* << */ + AEGP_ColorVal *stroke_colorP); /* << only valid if is_stroke_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalSetFillColor)( + const AEGP_ColorVal *fill_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalSetStrokeColor)( + const AEGP_ColorVal *stroke_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalIsFillColorUIFrontmost)( /* Otherwise, StrokeColor is frontmost */ + A_Boolean *is_fill_color_selectedPB); /* << */ + + SPAPI A_Err (*AEGP_ConvertFpLongToHSFRatio)( + A_FpLong numberF, /* >> */ + A_Ratio *ratioPR); /* << */ + + SPAPI A_Err (*AEGP_ConvertHSFRatioToFpLong)( + A_Ratio ratioR, /* << */ + A_FpLong *numberPF); /* >> */ + + // this routine is safe to call from the non-main + // thread. It is asynchronous and will return before the idle handler is called. + // The Suite routines to get this pointer are not + // thread safe, therefore you need to save it off + // in the main thread for use by the child thread. + SPAPI A_Err (*AEGP_CauseIdleRoutinesToBeCalled)(void); + + + // Determine if after effects is running in a mode where there is no + // user interface, and attempting to interact with the user (via a modal dialog) + // will hang the application. + // This will not change during a run. Use it to optimize your plugin at startup + // to not create a user interface and make AE launch faster, and not break + // when running multiple instances of a service. + SPAPI A_Err (*AEGP_GetSuppressInteractiveUI)(A_Boolean* ui_is_suppressedPB); // out + + // this call writes text to the console if one is available. One is guaranteed to be available + // if ui_is_suppressedB == true. + // In general use the call AEGP_ReportInfo() as it will write to the console in + // non-interactive modes, and use a dialog in interactive modes. + SPAPI A_Err (*AEGP_WriteToOSConsole)(const A_char* textZ); // in + + // this writes an entry into the debug log, or to the command line if launched + // with the -debug flag. + SPAPI A_Err (*AEGP_WriteToDebugLog)(const A_char* subsystemZ, // in + const A_char* event_typeZ, // in + const A_char * infoZ); // in + + + SPAPI A_Err (*AEGP_IsScriptingAvailable)(A_Boolean* outAvailablePB); + + // Execute a script. + // The script text can either be in UTF-8, or the current + // application encoding. + // The result is the result string if OK. It is optional. + // The error is the error string if an error occurred. It is optional. + // the result and error are in the encoding specified by platform_encodingB + SPAPI A_Err (*AEGP_ExecuteScript)(AEGP_PluginID inPlugin_id, + const A_char* inScriptZ, // in + const A_Boolean platform_encodingB, // in + AEGP_MemHandle* outResultPH0, + AEGP_MemHandle* outErrorStringPH0); + + SPAPI A_Err (*AEGP_HostIsActivated)(A_Boolean *is_activatedPB); + + SPAPI A_Err (*AEGP_GetPluginPlatformRef)(AEGP_PluginID plug_id, void** plat_refPPV); // on the Mac, it is a CFBundleRef to your mach-o plugin or NULL for a CFM plug-in; on Windows it is set to NULL for now + + SPAPI A_Err (*AEGP_UpdateFontList)(void); // Rescan the system font list. This will return quickly if the font list hasn't changed. + + // return a particular path associated with the plugin + SPAPI A_Err (*AEGP_GetPluginPaths)( + AEGP_PluginID aegp_plugin_id, // >> which plugin we are talking about + AEGP_GetPathTypes path_type, // >> which path type to retrieve + AEGP_MemHandle *unicode_pathPH); // << UTF16 mem handle must be disposed with AEGP_FreeMemHandle + +} AEGP_UtilitySuite6; + + + +/* -------------------------------------------------------------------- */ + + +#define kAEGPMathSuite "AEGP Math Suite" +#define kAEGPMathSuiteVersion1 1 /* frozen AE 15.0 */ + +typedef struct AEGP_MathSuite1 { + + // Matrices + // right-hand rule, Y down, origin in upper left corner of comp. + + SPAPI A_Err(*AEGP_IdentityMatrix4)(A_Matrix4 *matrixP); + + SPAPI A_Err(*AEGP_MultiplyMatrix4)(const A_Matrix4 *A, const A_Matrix4 *B, A_Matrix4 *resultP); + + SPAPI A_Err(*AEGP_Matrix3ToMatrix4)(const A_Matrix3 *A, A_Matrix4 *B); + + SPAPI A_Err(*AEGP_MultiplyMatrix4by3)(const A_Matrix4 *A, const A_Matrix3 *B, A_Matrix4 *resultP); + + SPAPI A_Err(*AEGP_MatrixDecompose4)(const A_Matrix4 *A, A_FloatPoint3* posVP, A_FloatPoint3* scaleVP, A_FloatPoint3* shearVP, A_FloatPoint3* rotVP); + +} AEGP_MathSuite1; + + +/* -------------------------------------------------------------------- */ + + + +typedef struct _PF_OpaqueBlendingTables *PF_EffectBlendingTables; + +#define kAEGPColorSettingsSuite "PF Color Settings Suite" +#define kAEGPColorSettingsSuiteVersion3 4 // frozen in AE 16.1; adding an API to set working color space + +typedef struct AEGP_ColorSettingsSuite3 { + + SPAPI A_Err (*AEGP_GetBlendingTables)( + PR_RenderContextH render_contextH, + PF_EffectBlendingTables *blending_tables); + + SPAPI A_Err (*AEGP_DoesViewHaveColorSpaceXform)( + AEGP_ItemViewP viewP, // >> + A_Boolean *has_xformPB); // << + + SPAPI A_Err (*AEGP_XformWorkingToViewColorSpace)( + AEGP_ItemViewP viewP, // >> + AEGP_WorldH srcH, // in + AEGP_WorldH dstH); // out; must be the same size (can be the same as source) + + SPAPI A_Err (*AEGP_GetNewWorkingSpaceColorProfile)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_CompH compH, // >> + AEGP_ColorProfileP *color_profilePP); // << caller must dispose with AEGP_DisposeColorProfile + + SPAPI A_Err (*AEGP_GetNewColorProfileFromICCProfile)( + AEGP_PluginID aegp_plugin_id, // >> + A_long icc_sizeL, // >> icc profile size + const void *icc_dataPV, // >> icc profile + AEGP_ColorProfileP *color_profilePP); // << builds AEGP_ColorProfile from icc profile; caller must dispose with AEGP_DisposeColorProfile + + SPAPI A_Err (*AEGP_GetNewICCProfileFromColorProfile)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_ConstColorProfileP color_profileP, // >> + AEGP_MemHandle *icc_profilePH); // << extract icc profile from AEGP_ColorProfile; caller must dispose with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetNewColorProfileDescription)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_ConstColorProfileP color_profileP, // >> + AEGP_MemHandle *unicode_descPH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_DisposeColorProfile)( + AEGP_ColorProfileP color_profileP); // >> + + SPAPI A_Err (*AEGP_GetColorProfileApproximateGamma)( + AEGP_ConstColorProfileP color_profileP, // >> + A_FpShort *approx_gammaP); // << + + SPAPI A_Err (*AEGP_IsRGBColorProfile)( + AEGP_ConstColorProfileP color_profileP, // << + A_Boolean *is_rgbPB); // >> + + SPAPI A_Err (*AEGP_SetWorkingColorSpace)( + AEGP_PluginID aegp_plugin_id, + AEGP_CompH compH, // >> + AEGP_ConstColorProfileP color_profileP); // >> + + +} AEGP_ColorSettingsSuite3; + + +/* -------------------------------------------------------------------- */ +/* + Render Queue Suite + Used to add, remove, and modify items in the reder queue. + + */ + +#define kAEGPRenderQueueSuite "AEGP Render Queue Suite" +#define kAEGPRenderQueueSuiteVersion1 1 /* frozen in AE 5.0 */ + +enum { + AEGP_RenderQueueState_STOPPED, + AEGP_RenderQueueState_PAUSED, + AEGP_RenderQueueState_RENDERING +}; + +typedef A_u_long AEGP_RenderQueueState; + +enum { + AEGP_RenderItemStatus_NONE = -2, + + AEGP_RenderItemStatus_WILL_CONTINUE, // -1 + AEGP_RenderItemStatus_NEEDS_OUTPUT, // 0 + AEGP_RenderItemStatus_UNQUEUED, // 1 ready to be rendered, but not included in the queue + AEGP_RenderItemStatus_QUEUED, // 2 ready AND queued + AEGP_RenderItemStatus_RENDERING, + AEGP_RenderItemStatus_USER_STOPPED, + AEGP_RenderItemStatus_ERR_STOPPED, + AEGP_RenderItemStatus_DONE, + + AEGP_RenderItemStatus_LAST_PLUS_ONE +}; + +typedef A_long AEGP_RenderItemStatusType; + +typedef struct AEGP_RenderQueueSuite1 { + SPAPI A_Err (*AEGP_AddCompToRenderQueue)( + AEGP_CompH comp, /* >> */ + const A_char* pathZ); + + // not legal to go from STOPPED to PAUSED. + SPAPI A_Err (*AEGP_SetRenderQueueState)( + AEGP_RenderQueueState state); /* >> */ + + SPAPI A_Err (*AEGP_GetRenderQueueState)( + AEGP_RenderQueueState *stateP); /* << */ + +} AEGP_RenderQueueSuite1; + +/* -------------------------------------------------------------------- */ + +enum { + AEGP_LogType_NONE = -1, + AEGP_LogType_ERRORS_ONLY, + AEGP_LogType_PLUS_SETTINGS, + AEGP_LogType_PER_FRAME_INFO, + AEGP_LogType_NUM_TYPES +}; + +typedef A_long AEGP_LogType; + +enum { + AEGP_Embedding_NONE = -1, + AEGP_Embedding_NOTHING, + AEGP_Embedding_LINK, + AEGP_Embedding_LINK_AND_COPY, + AEGP_Embedding_NUM_TYPES +}; + +typedef A_long AEGP_EmbeddingType; + +enum { + AEGP_PostRenderOptions_NONE = -1, + AEGP_PostRenderOptions_IMPORT, + AEGP_PostRenderOptions_IMPORT_AND_REPLACE_USAGE, + AEGP_PostRenderOptions_SET_PROXY, + AEGP_PostRenderOptions_NUM_OPTIONS +}; + +typedef A_long AEGP_PostRenderAction; + +enum { + AEGP_OutputType_NONE = 0, + AEGP_OutputType_VIDEO = 1L << 0, + AEGP_OutputType_AUDIO = 1L << 1, + AEGP_OutputType_NUM_TYPES +}; + +typedef A_long AEGP_OutputTypes; + +enum { + AEGP_VideoChannels_NONE = -1, + AEGP_VideoChannels_RGB, + AEGP_VideoChannels_RGBA, + AEGP_VideoChannels_ALPHA, + AEGP_VideoChannels_NUMTYPES +}; + +typedef A_long AEGP_VideoChannels; + +enum { + AEGP_StretchQual_NONE = -1, + + AEGP_StretchQual_LOW, + AEGP_StretchQual_HIGH, + + AEGP_StretchQual_NUMTYPES +}; +typedef A_long AEGP_StretchQuality; + +enum { + AEGP_OutputColorType_STRAIGHT = -1, + AEGP_OutputColorType_PREMUL +}; + +typedef A_long AEGP_OutputColorType; + +#define kAEGPRQItemSuite "AEGP Render Queue Item Suite" +#define kAEGPRQItemSuiteVersion4 5 /* frozen in AE 14.1 */ + +typedef struct AEGP_RQItemSuite4 { + + SPAPI A_Err (*AEGP_GetNumRQItems)( + A_long *num_itemsPL); /* << */ + + /* NOTE: All AEGP_RQItemRefH are invalidated by ANY + re-ordering, addition or removal of render + items. DO NOT CACHE THEM. + */ + + SPAPI A_Err (*AEGP_GetRQItemByIndex)( + A_long rq_item_index, /* >> */ + AEGP_RQItemRefH *rq_item_refPH); /* << */ + + SPAPI A_Err (*AEGP_GetNextRQItem)( /* Pass RQ_ITEM_INDEX_NONE for current_rq_itemH to get first RQItemH. */ + AEGP_RQItemRefH current_rq_itemH, /* >> */ + AEGP_RQItemRefH *next_rq_itemH); /* << */ + + SPAPI A_Err (*AEGP_GetNumOutputModulesForRQItem)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_long *num_outmodsPL); /* << */ + + SPAPI A_Err (*AEGP_GetRenderState)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_RenderItemStatusType *statusP); /* << */ + + /* + the following now returns: + Err_PARAMETER if you try to call while AEGP_RenderQueueState != AEGP_RenderQueueState_STOPPED + + if that's okay then: + Err_RANGE if you pass a status that is illegal in any case + Err_PARAMETER if you try to pass a status that doesn't make sense right now (eg: trying to Que something for which you haven't set the output path) + */ + SPAPI A_Err (*AEGP_SetRenderState)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_RenderItemStatusType status); /* >> */ + + SPAPI A_Err (*AEGP_GetStartedTime)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_Time *started_timePT); /* << Returns {0,1} if not started. */ + + SPAPI A_Err (*AEGP_GetElapsedTime)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_Time *render_timePT); /* << Returns {0,1} if not rendered. */ + + SPAPI A_Err (*AEGP_GetLogType)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_LogType *logtypeP); /* << */ + + SPAPI A_Err (*AEGP_SetLogType)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_LogType logtype); /* << */ + + SPAPI A_Err (*AEGP_RemoveOutputModule)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH); /* >> */ + + SPAPI A_Err (*AEGP_GetComment)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_MemHandle *unicodeH); /* << */ + + SPAPI A_Err (*AEGP_SetComment)( + AEGP_RQItemRefH rq_itemH, /* >> */ + const A_UTF16Char *commentZ); /* >> */ + + SPAPI A_Err (*AEGP_GetCompFromRQItem)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_DeleteRQItem)( + AEGP_RQItemRefH rq_itemH); /* <> UNDOABLE */ + +} AEGP_RQItemSuite4; + + +#define kAEGPOutputModuleSuite "AEGP Output Module Suite" +#define kAEGPOutputModuleSuiteVersion4 4 /* frozen in AE 10.0 */ + +typedef struct AEGP_OutputModuleSuite4 { + + /* NOTE: All AEGP_OutputModuleRefHs are invalidated by ANY + re-ordering, addition or removal of output modules + from a render item. DO NOT CACHE THEM. + */ + + SPAPI A_Err (*AEGP_GetOutputModuleByIndex)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_long outmod_indexL, /* >> */ + AEGP_OutputModuleRefH *outmodPH); /* << */ + + SPAPI A_Err (*AEGP_GetEmbedOptions)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_EmbeddingType *embed_optionsP); /* << */ + + SPAPI A_Err (*AEGP_SetEmbedOptions)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_EmbeddingType embed_options); /* >> */ + + SPAPI A_Err (*AEGP_GetPostRenderAction)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_PostRenderAction *post_render_actionP); /* << */ + + SPAPI A_Err (*AEGP_SetPostRenderAction)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_PostRenderAction post_render_action); /* >> */ + + SPAPI A_Err (*AEGP_GetEnabledOutputs)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_OutputTypes *enabled_typesP); /* << */ + + SPAPI A_Err (*AEGP_SetEnabledOutputs)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_OutputTypes enabled_types); /* >> */ + + SPAPI A_Err (*AEGP_GetOutputChannels)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_VideoChannels *output_channelsP); /* << */ + + SPAPI A_Err (*AEGP_SetOutputChannels)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_VideoChannels output_channels); /* >> */ + + SPAPI A_Err (*AEGP_GetStretchInfo)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + A_Boolean *is_enabledPB, /* << */ + AEGP_StretchQuality *stretch_qualityP, /* << */ + A_Boolean *lockedPB); /* << */ + + SPAPI A_Err (*AEGP_SetStretchInfo)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + A_Boolean is_enabledB, /* >> */ + AEGP_StretchQuality stretch_quality); /* >> */ + + SPAPI A_Err (*AEGP_GetCropInfo)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + A_Boolean *is_enabledBP, /* << */ + A_Rect *crop_rectP); /* << */ + + SPAPI A_Err (*AEGP_SetCropInfo)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + A_Boolean enableB, /* >> */ + A_Rect crop_rect); /* >> */ + + SPAPI A_Err (*AEGP_GetSoundFormatInfo)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_SoundDataFormat *sound_format_infoP, /* << */ + A_Boolean *audio_enabledPB); /* << */ + + SPAPI A_Err (*AEGP_SetSoundFormatInfo)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_SoundDataFormat sound_format_info, /* >> */ + A_Boolean audio_enabledB); /* >> */ + + SPAPI A_Err (*AEGP_GetOutputFilePath)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + AEGP_MemHandle *unicode_pathPH); // << empty string if not specified. handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_SetOutputFilePath)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH, /* >> */ + const A_UTF16Char *pathZ); // >> null terminated unicode path with platform separators + + SPAPI A_Err (*AEGP_AddDefaultOutputModule)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH *outmodPH); /* << */ + + SPAPI A_Err (*AEGP_GetExtraOutputModuleInfo)( + AEGP_RQItemRefH rq_itemH, + AEGP_OutputModuleRefH outmodH, + AEGP_MemHandle *format_unicodePH, /* << handle of A_u_short, (contains null terminated UTF16 string) must be disposed with AEGP_FreeMemHandle */ + AEGP_MemHandle *info__unicodePH, /* << handle of A_u_short, (contains null terminated UTF16 string) must be disposed with AEGP_FreeMemHandle */ + A_Boolean *is_sequenceBP, + A_Boolean *multi_frameBP); + +} AEGP_OutputModuleSuite4; + +/* -------------------------------------------------------------------- */ + +/** + ** Canvas Suite + ** Used by artisans to render layers + **/ + +#define kAEGPCanvasSuite "AEGP Canvas Suite" +#define kAEGPCanvasSuiteVersion8 14 /* frozen in AE 12.0*/ + + +enum { + AEGP_RenderHints_NONE = 0, + AEGP_RenderHints_IGNORE_EXTENTS = 0x1, + AEGP_RenderHints_NO_TRANSFER_MODE = 0x2 // prevents application of opacity & transfer mode; for RenderLayer calls +}; +typedef A_u_long AEGP_RenderHints; + + +enum { + AEGP_RenderReceiptStatus_INVALID = 0, + AEGP_RenderReceiptStatus_VALID, + AEGP_RenderReceiptStatus_VALID_BUT_INCOMPLETE +}; +typedef A_u_long AEGP_RenderReceiptStatus; + + +enum { + AEGP_BinType_NONE = -1, + AEGP_BinType_2D = 0, + AEGP_BinType_3D = 1 +}; +typedef A_long AEGP_BinType; + + +typedef void * AEGP_PlatformWindowRef; + + + +enum { + AEGP_DisplayChannel_NONE = 0, + AEGP_DisplayChannel_RED, + AEGP_DisplayChannel_GREEN, + AEGP_DisplayChannel_BLUE, + AEGP_DisplayChannel_ALPHA, + AEGP_DisplayChannel_RED_ALT, + AEGP_DisplayChannel_GREEN_ALT, + AEGP_DisplayChannel_BLUE_ALT, + AEGP_DisplayChannel_ALPHA_ALT, + AEGP_DisplayChannel_NUM_ITEMS +}; +typedef A_long AEGP_DisplayChannelType; // disk safe + +enum { + AEGP_RenderNumEffects_ALL_EFFECTS = -1 +}; + +typedef A_short AEGP_NumEffectsToRenderType; + + +typedef struct AEGP_CanvasSuite8 { + + SPAPI A_Err (*AEGP_GetCompToRender)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumLayersToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_GetNthLayerContextToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n, /* >> */ + AEGP_RenderLayerContextH *layer_contextPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerContext)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerAndSubLayerFromLayerContext)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_LayerH *layerPH, /* << */ + AEGP_SubLayerIndex *sublayerP); /* << */ + + /** + ** With collapsed geometrics "on" this gives the layer in the root comp + ** contining the layer context. With collapsed geometrics off + ** this is the same as AEGP_GetLayerFromLayerContext. + ** + **/ + SPAPI A_Err (*AEGP_GetTopLayerFromLayerContext)( + const PR_RenderContextH render_contextH, + AEGP_RenderLayerContextH layer_contextH, + AEGP_LayerH *layerPH); + + SPAPI A_Err (*AEGP_GetCompRenderTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *time, /* << */ + A_Time *time_step); + + SPAPI A_Err (*AEGP_GetCompDestinationBuffer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_CompH compH, /* >> */ + AEGP_WorldH *dst); /* << */ + + SPAPI A_Err (*AEGP_GetROI)( + PR_RenderContextH render_contextH, /* <> */ + A_LegacyRect *roiPR); /* << */ + + // for rendering the texture map of a layer + SPAPI A_Err (*AEGP_RenderTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_WorldH *dstPH); /* <> */ + + + SPAPI A_Err (*AEGP_DisposeTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_WorldH dstH0); /* <> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + PR_RenderContextH render_contextH, /* >> */ + PF_Field *field); /* << */ + + // not thread safe on MacOS + // only call when thread ID = 0 + SPAPI A_Err (*AEGP_ReportArtisanProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long totalL); /* >> */ + + SPAPI A_Err (*AEGP_GetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_IsBlankCanvas)( + PR_RenderContextH render_contextH, /* >> */ + A_Boolean *is_blankPB); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerBounds)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_LegacyRect *boundsP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderOpacity)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_FpLong *opacityPF); /* << */ + + SPAPI A_Err (*AEGP_IsRenderLayerActive)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Boolean *activePB); /* << */ + + // set the layer index. If total > 0, set it too. + SPAPI A_Err (*AEGP_SetArtisanLayerProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long num_layersL); + + // for track mattes. + // Returns a comp-size buffer, which must be disposed thru AEGP_Dispose in World suite + SPAPI A_Err (*AEGP_RenderLayerPlus)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_WorldH *render_bufferPH); /* << must be disposed with AEGP_DisposeWorld */ + + + SPAPI A_Err (*AEGP_GetTrackMatteContext)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH fill_contextH, /* << */ + AEGP_RenderLayerContextH *matte_contextPH); /* >> */ + + // new for 6.0 --get receipt with the returned texture + // use receipt to determine if a subsequent call to render + // this layer can be skipped (because the artisan cached it) + SPAPI A_Err (*AEGP_RenderTextureWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_NumEffectsToRenderType num_effectsS, /* >> number of effect to render, -1 for all */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *dstPH); /* << */ + + + + SPAPI A_Err (*AEGP_GetNumberOfSoftwareEffects)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + A_short *num_software_effectsPS); + + SPAPI A_Err (*AEGP_RenderLayerPlusWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *render_bufferPH); /* << */ + + SPAPI A_Err (*AEGP_DisposeRenderReceipt)( + AEGP_RenderReceiptH render_receiptH); /* >> */ + + + /* modified for 7.0 - added num_effects to check against */ + SPAPI A_Err (*AEGP_CheckRenderReceipt)( + PR_RenderContextH current_render_contextH, /* in */ + AEGP_RenderLayerContextH current_layer_contextH, /* in */ + AEGP_RenderReceiptH old_render_receiptH, /* in */ + A_Boolean check_geometricsB, /* in */ + AEGP_NumEffectsToRenderType num_effectsS, /* in */ + AEGP_RenderReceiptStatus *receipt_statusP); /* out */ + + + /* new in 7.0 generate a receipt for a layer as asd if the first num_effectsS have been rendered */ + SPAPI A_Err (*AEGP_GenerateRenderReceipt)( + PR_RenderContextH current_render_contextH, /* >> */ + AEGP_RenderLayerContextH current_layer_contextH, /* >> */ + AEGP_NumEffectsToRenderType num_effectsS, /* in */ + AEGP_RenderReceiptH *render_receiptPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumBinsToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_bins_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_SetNthBin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n); /* >> */ + + SPAPI A_Err (*AEGP_GetBinType)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_BinType *bin_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform2D3D)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Boolean only_2dB, /* >> */ + A_Matrix4 *transform); /* << */ + + + // interactive artisan information + // handle to the on-screen window + SPAPI A_Err (*AEGP_GetPlatformWindowRef)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_PlatformWindowRef *window_refP); /* << */ + + + // the dsf src to frame scale factors + SPAPI A_Err (*AEGP_GetViewportScale)( + const PR_RenderContextH render_contextH, /* >> */ + A_FpLong *scale_xPF, /* << */ + A_FpLong *scale_yPF); /* << */ + + + // the dsf src to frame translate + SPAPI A_Err (*AEGP_GetViewportOrigin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *origin_xPL, /* << */ + A_long *origin_yPL); /* << */ + + + SPAPI A_Err (*AEGP_GetViewportRect)( + const PR_RenderContextH render_contextH, /* >> */ + A_LegacyRect *viewport_rectPR); /* << */ + + + SPAPI A_Err (*AEGP_GetFallowColor)( + const PR_RenderContextH render_contextH, /* >> */ + PF_Pixel8 *fallow_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboard)( + const PR_RenderContextH render_contextH, /* in */ + A_Boolean *checkerboard_onPB);/* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardColors)( + const PR_RenderContextH render_contextH, /* in */ + PF_Pixel *checkerboard_color1P, /* out */ + PF_Pixel *checkerboard_color2P); /* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardSize)( + const PR_RenderContextH render_contextH, /* in */ + A_u_long *checkerboard_widthPLu, /* out - width of square*/ + A_u_long *checkerboard_heightPLu); /* out - height of square*/ + + SPAPI A_Err (*AEGP_GetInteractiveCachedBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + + // should we call AEGP_RenderLayer or AEGP_RenderTexture + SPAPI A_Err (*AEGP_ArtisanMustRenderAsLayer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, + A_Boolean *use_render_texturePB); + + + SPAPI A_Err (*AEGP_GetInteractiveDisplayChannel)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_DisplayChannelType *display_channelP); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveExposure)( + const PR_RenderContextH render_contextH, /* >> */ + A_FpLong *exposurePF); /* << */ + + + SPAPI A_Err (*AEGP_GetColorTransform)( + const PR_RenderContextH render_contextH, /* >> */ + A_Boolean *cms_onB, + A_u_long *xform_keyLu, + void *xformP); + + + SPAPI A_Err (*AEGP_GetCompShutterTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *shutter_time, /* << */ + A_Time *shutter_dur); + + // uses remapping if any + SPAPI A_Err (*AEGP_MapCompToLayerTime)( + PR_RenderContextH render_contextH, /* in */ + AEGP_RenderLayerContextH layer_contextH, /* in*/ + const A_Time *comp_timePT, /* in */ + A_Time *layer_timePT); /* out */ + +} AEGP_CanvasSuite8; + + + + + + + +/** + ** Artisan utility suite + ** + **/ +#define kAEGPArtisanUtilSuite "AEGP Artisan Util Suite" +#define kAEGPArtisanUtilSuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct AEGP_ArtisanUtilSuite1 { + + + SPAPI A_Err (*AEGP_GetGlobalContextFromInstanceContext)( + const PR_InstanceContextH instance_contextH, /* >> */ + PR_GlobalContextH *global_contextPH); /* << */ + + + SPAPI A_Err (*AEGP_GetInstanceContextFromRenderContext)( + const PR_RenderContextH render_contextH, /* >> */ + PR_InstanceContextH *instance_contextPH); /* << */ + + + + SPAPI A_Err (*AEGP_GetInstanceContextFromQueryContext)( + const PR_QueryContextH query_contextH, /* >> */ + PR_InstanceContextH *instance_contextPH); /* << */ + + + SPAPI A_Err (*AEGP_GetGlobalData)( + const PR_GlobalContextH global_contextH, /* >> */ + PR_GlobalDataH *global_dataPH); /* << */ + + + SPAPI A_Err (*AEGP_GetInstanceData)( + const PR_InstanceContextH instance_contextH, /* >> */ + PR_InstanceDataH *instance_dataPH); /* << */ + + SPAPI A_Err (*AEGP_GetRenderData)( + const PR_RenderContextH render_contextH, /* >> */ + PR_RenderDataH *render_dataPH); /* << */ + +} AEGP_ArtisanUtilSuite1; + + + +#define kAEGPCameraSuite "AEGP Camera Suite" +#define kAEGPCameraSuiteVersion2 2 /* frozen in AE 5.5 */ + +typedef struct AEGP_CameraSuite2 { + + SPAPI A_Err (*AEGP_GetCamera)( + PR_RenderContextH render_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + AEGP_LayerH *camera_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetCameraType)( + AEGP_LayerH camera_layerH, /* >> */ + AEGP_CameraType *camera_typeP); /* << */ + + + SPAPI A_Err (*AEGP_GetDefaultCameraDistanceToImagePlane)( + AEGP_CompH compH, /* >> */ + A_FpLong *dist_to_planePF); /* << */ + + // If a camera is created using aegp, then you must set the film size units. + // No default is provided. + + SPAPI A_Err (*AEGP_GetCameraFilmSize)( + AEGP_LayerH camera_layerH, /* >> */ + AEGP_FilmSizeUnits *film_size_unitsP, /* << */ + A_FpLong *film_sizePF0); /* << in pixels */ + + SPAPI A_Err (*AEGP_SetCameraFilmSize)( + AEGP_LayerH camera_layerH, /* >> */ + AEGP_FilmSizeUnits film_size_units, /* >> */ + A_FpLong *film_sizePF0); /* >> in pixels */ + +} AEGP_CameraSuite2; + +#define kAEGPLightSuite "AEGP Light Suite" +#define kAEGPLightSuiteVersion2 2 /* frozen in AE 5.5 */ + +typedef struct AEGP_LightSuite2 { + + SPAPI A_Err (*AEGP_GetLightType)( + AEGP_LayerH light_layerH, /* >> */ + AEGP_LightType *light_typeP); /* << */ + + SPAPI A_Err (*AEGP_SetLightType)( + AEGP_LayerH light_layerH, /* >> */ + AEGP_LightType light_type); /* >> */ + +} AEGP_LightSuite2; + + + +/** + ** Query Xform suite + ** Called by artisans during a response to a Query + **/ + +#define kAEGPQueryXformSuite "AEGP QueryXform Suite" +#define kAEGPQueryXformSuiteVersion2 4 /* frozen in AE 6.0 */ + + +/** + ** the type of source or dst transformation wanted + **/ +enum { + AEGP_Query_Xform_LAYER, + AEGP_Query_Xform_WORLD, + AEGP_Query_Xform_VIEW, + AEGP_Query_Xform_SCREEN +}; + +typedef A_u_long AEGP_QueryXformType; + + + +typedef struct AEGP_QueryXformSuite2 { + + SPAPI A_Err (*AEGP_QueryXformGetSrcType)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_QueryXformType *src_type); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetDstType)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_QueryXformType *dst_type); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetLayer)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetComp)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetTransformTime)( + PR_QueryContextH query_contextH, /* <> */ + A_Time *time); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetViewTime)( + PR_QueryContextH query_contextH, /* <> */ + A_Time *time); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetCamera)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_LayerH *camera_layerPH); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetXform)( + PR_QueryContextH query_contextH, /* <> */ + A_Matrix4 *xform); /* << */ + + SPAPI A_Err (*AEGP_QueryXformSetXform)( + PR_QueryContextH query_contextH, /* <> */ + A_Matrix4 *xform); /* >> */ + + SPAPI A_Err (*AEGP_QueryWindowRef)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_PlatformWindowRef *window_refP); /* >> */ + + SPAPI A_Err (*AEGP_QueryWindowClear)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_PlatformWindowRef *window_refP, /* out */ + A_LegacyRect *boundsPR); /* out */ + + SPAPI A_Err (*AEGP_QueryFrozenProxy)( + PR_QueryContextH query_contextH, /* <> */ + A_Boolean *onPB); /* out */ + + SPAPI A_Err (*AEGP_QuerySwapBuffer)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_PlatformWindowRef *window_refP, /* out */ + AEGP_WorldH *dest_bufferp); /* out */ + + SPAPI A_Err (*AEGP_QueryDrawProcs)( + PR_QueryContextH query_contextH, /* <> */ + PR_InteractiveDrawProcs *window_refP); /* in */ + + + SPAPI A_Err (*AEGP_QueryPrepareForLineDrawing)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_PlatformWindowRef *window_refP, + A_LegacyRect *viewportP, + A_LPoint *originP, + A_FloatPoint *scaleP); /* in */ + + SPAPI A_Err (*AEGP_QueryUnprepareForLineDrawing)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_PlatformWindowRef *window_refP); /* in */ + + SPAPI A_Err (*AEGP_QueryGetData)( + PR_QueryContextH query_contextH, /* <> */ + A_long i, /* in */ + void **dataPP); /* out */ + + SPAPI A_Err (*AEGP_QuerySetData)( + PR_QueryContextH query_contextH, /* <> */ + A_long i, /* in */ + void *dataP); /* in */ + + +}AEGP_QueryXformSuite2; + + +/* -------------------------------------------------------------------- */ + + + +#define kAEGPCompositeSuite "AEGP Composite Suite" +#define kAEGPCompositeSuiteVersion2 4 /* frozen in AE 10.0 */ + +typedef struct AEGP_CompositeSuite2 { + + SPAPI A_Err (*AEGP_ClearAlphaExceptRect)( + A_Rect *clipped_dest_rectPR, /* >> */ + PF_EffectWorld *dstP); /* <> */ + + SPAPI A_Err (*AEGP_PrepTrackMatte)( + A_long num_pix, /* >> */ + A_Boolean deepB, /* >> */ + const PF_Pixel *src_mask, /* >> */ + PF_MaskFlags mask_flags, /* >> */ + PF_Pixel *dst_mask); /* << */ + + SPAPI A_Err (*AEGP_TransferRect)( + PF_Quality quality, /* >> */ + PF_ModeFlags m_flags, /* >> */ + PF_Field field, /* >> */ + const A_Rect *src_rec, /* >> */ + const PF_EffectWorld *src_world, /* >> */ + const PF_CompositeMode *comp_mode, /* >> */ + PF_EffectBlendingTables blend_tablesP0, /* >>, pass NULL to blend in workingspace*/ + const PF_MaskWorld *mask_world0, /* >> */ + A_long dest_x, /* >> */ + A_long dest_y, /* >> */ + PF_EffectWorld *dst_world); /* <> */ + + SPAPI A_Err (*AEGP_CopyBits_LQ) ( + PF_EffectWorld *src_worldP, /* >> */ + A_Rect *src_r, /* pass NULL for whole world */ + A_Rect *dst_r, /* pass NULL for whole world */ + PF_EffectWorld *dst_worldP); /* <> */ + + SPAPI A_Err (*AEGP_CopyBits_HQ_Straight) ( + PF_EffectWorld *src, /* >> */ + A_Rect *src_r, /* pass NULL for whole world */ + A_Rect *dst_r, /* pass NULL for whole world */ + PF_EffectWorld *dst); /* <> */ + + SPAPI A_Err (*AEGP_CopyBits_HQ_Premul) ( + PF_EffectWorld *src, /* >> */ + A_Rect *src_r, /* pass NULL for whole world */ + A_Rect *dst_r, /* pass NULL for whole world */ + PF_EffectWorld *dst); /* <> */ + +} AEGP_CompositeSuite2; + + + +/* -------------------------------------------------------------------- */ + +#define kAEGPIterateSuite "AEGP Iterate Suite" +#define kAEGPIterateSuiteVersion2 2 /* frozen in AE 22.0 */ + +typedef struct AEGP_IterateSuite2 { + + SPAPI A_Err (*AEGP_GetNumThreads)( + A_long *num_threadsPL); + + + SPAPI A_Err (*AEGP_IterateGeneric)( + A_long iterationsL, /* >> */ // can be PF_Iterations_ONCE_PER_PROCESSOR + void *refconPV, /* >> */ + A_Err (*fn_func)( void *refconPV, /* >> */ + A_long thread_indexL, /* >> */ + A_long i, /* >> */ + A_long iterationsL)); /* >> */ + +} AEGP_IterateSuite2; + +// Export the name of this function in your PiPL resource's EntryPoint + +typedef A_Err (AEGP_PluginInitFuncPrototype)( + struct SPBasicSuite *pica_basicP, /* >> */ + A_long driver_major_versionL, /* >> */ + A_long driver_minor_versionL, /* >> */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_GlobalRefcon *plugin_refconP); /* << will be passed to all hooks! */ + +typedef AEGP_PluginInitFuncPrototype *AEGP_PluginInitFunc; + + +/* -------------------------------------------------------------------- */ + +/** AEGPPFInterfaceSuite1 + + These are basically wrappers for constructing various AEGP objects from + the information available to an effect plug-in so that various other AEGP suites + may be used. + + AEGP_GetEffectLayer -- get AEGP_LayerH corresponding to layer that effect is applied to + AEGP_GetNewEffectForEffect -- get AEGP_EffectRefH corresponding to effect + AEGP_ConvertEffectToCompTime -- return comp time from time units passed to effect (layer time) + AEGP_GetEffectCamera -- get camera AEGP_LayerH which defines current 3D view + -- NOTE : this may be null if no camera is defined + + AEGP_GetEffectCameraMatrix -- use this to get the geometry for the camera. + + These may only be called during PF_Cmd_FRAME_SETUP, PF_Cmd_RENDER, + and PF_Cmd_EVENT::PF_Event_DRAW +**/ + +#define kAEGPPFInterfaceSuite "AEGP PF Interface Suite" +#define kAEGPPFInterfaceSuiteVersion1 1 /* frozen in AE 5.0 */ + + +typedef struct AEGP_PFInterfaceSuite1 { + + SPAPI A_Err (*AEGP_GetEffectLayer)( + PF_ProgPtr effect_pp_ref, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewEffectForEffect)( /* must be disposed using AEGP_DisposeEffect */ + AEGP_PluginID aegp_plugin_id, /* >> */ + PF_ProgPtr effect_pp_ref, /* >> */ + AEGP_EffectRefH *effect_refPH); /* << */ + + SPAPI A_Err (*AEGP_ConvertEffectToCompTime)( + PF_ProgPtr effect_pp_ref, /* >> */ + A_long what_timeL, /* >> */ + A_u_long time_scaleLu, /* from PF_InData */ + A_Time *comp_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetEffectCamera)( + PF_ProgPtr effect_pp_ref, /* >> */ + const A_Time *comp_timePT, /* >> */ + AEGP_LayerH *camera_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetEffectCameraMatrix)( + PF_ProgPtr effect_pp_ref, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Matrix4 *camera_matrixP, /* <> */ + A_FpLong *dist_to_image_planePF, /* <> */ + A_short *image_plane_widthPL, /* <> */ + A_short *image_plane_heightPL); /* <> */ +} AEGP_PFInterfaceSuite1; + +// PIN_FileSize +typedef A_u_longlong AEIO_FileSize; + +#define kAEGPIOInSuite "AEGP IO In Suite" +#define kAEGPIOInSuiteVersion5 6 /* frozen in AE 12 */ + +typedef struct AEGP_IOInSuite5 { + + SPAPI A_Err (*AEGP_GetInSpecOptionsHandle)( + AEIO_InSpecH inH, /* >> */ + void **optionsPPV); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecOptionsHandle)( + AEIO_InSpecH inH, /* >> */ + void *optionsPV, /* >> */ + void **old_optionsPPV); /* << */ + + SPAPI A_Err (*AEGP_GetInSpecFilePath)( + AEIO_InSpecH inH, /* >> */ + AEGP_MemHandle *unicode_pathPH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetInSpecNativeFPS)( + AEIO_InSpecH inH, /* >> */ + A_Fixed *native_fpsP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecNativeFPS)( + AEIO_InSpecH inH, /* >> */ + A_Fixed native_fps); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecDepth)( + AEIO_InSpecH inH, /* >> */ + A_short *depthPS); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecDepth)( + AEIO_InSpecH inH, /* >> */ + A_short depthS); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSize)( + AEIO_InSpecH inH, /* >> */ + AEIO_FileSize *sizePL); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecSize)( + AEIO_InSpecH inH, /* >> */ + AEIO_FileSize sizeL); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecInterlaceLabel)( + AEIO_InSpecH inH, /* >> */ + FIEL_Label *interlaceP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecInterlaceLabel)( + AEIO_InSpecH inH, /* >> */ + const FIEL_Label *interlaceP); /* << */ + + SPAPI A_Err (*AEGP_GetInSpecAlphaLabel)( + AEIO_InSpecH inH, /* >> */ + AEIO_AlphaLabel *alphaP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecAlphaLabel)( + AEIO_InSpecH inH, /* >> */ + const AEIO_AlphaLabel *alphaP); /* << */ + + SPAPI A_Err (*AEGP_GetInSpecDuration)( + AEIO_InSpecH inH, /* >> */ + A_Time *durationP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecDuration)( + AEIO_InSpecH inH, /* >> */ + const A_Time *durationP); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecDimensions)( + AEIO_InSpecH inH, /* >> */ + A_long *widthPL0, /* << */ + A_long *heightPL0); + + SPAPI A_Err (*AEGP_SetInSpecDimensions)( + AEIO_InSpecH inH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_InSpecGetRationalDimensions)( + AEIO_InSpecH inH, /* >> */ + const AEIO_RationalScale *rs0, /* << */ + A_long *width0, /* << */ + A_long *height0, /* << */ + A_Rect *r0); /* << */ + + SPAPI A_Err (*AEGP_GetInSpecHSF)( + AEIO_InSpecH inH, /* >> */ + A_Ratio *hsfP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecHSF)( + AEIO_InSpecH inH, /* >> */ + const A_Ratio *hsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSoundRate)( + AEIO_InSpecH inH, /* >> */ + A_FpLong *ratePF); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecSoundRate)( + AEIO_InSpecH inH, /* >> */ + A_FpLong rateF); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSoundEncoding)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndEncoding *encodingP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecSoundEncoding)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndEncoding encoding); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSoundSampleSize)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndSampleSize *bytes_per_sampleP);/* << */ + + SPAPI A_Err (*AEGP_SetInSpecSoundSampleSize)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndSampleSize bytes_per_sample); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSoundChannels)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndChannels *num_channelsP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecSoundChannels)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndChannels num_channels); /* >> */ + + SPAPI A_Err (*AEGP_AddAuxExtMap)( + const A_char *extension, /* >> */ + A_long file_type, /* >> */ + A_long creator); /* >> */ + + // In case of RGB data, if there is an embedded icc profile, build AEGP_ColorProfile out of this icc profile using AEGP_GetNewColorProfileFromICCProfile and pass it to + // AEGP_SetInSpecEmbeddedColorProfile, with profile description set to NULL. + // + // In case of non-RGB data, if there is an embedded non-RGB icc profile or you know the color space the data is in, pass its description as a null-terminated unicode string + // to AEGP_SetInSpecEmbeddedColorProfile, with color profile set to NULL. Doing this disables color management UI that allows user to affect + // profile choice in the application UI. + // + // If you are unpacking non-RGB data directly into working space (to get working space use AEGP_GetNewWorkingSpaceColorProfile), you are done. + // + // If you are unpacking non-RGB data into specific RGB color space, you must pass the profile describing this space to AEGP_SetInSpecAssignedColorProfile. + // Otherwise, your RGB data will be incorrectly interpreted as being in working space. + // + // Either color profile or profile description should be NULL in AEGP_SetInSpecEmbeddedColorProfile. You cannot use both. + SPAPI A_Err (*AEGP_SetInSpecEmbeddedColorProfile)( + AEIO_InSpecH inH, // << + AEGP_ConstColorProfileP color_profileP0, // << + const A_UTF16Char *profile_descP0); // << pointer to a null-terminated unicode string + + // Assign valid RGB profile to the footage + SPAPI A_Err (*AEGP_SetInSpecAssignedColorProfile)( + AEIO_InSpecH inH, // << + AEGP_ConstColorProfileP color_profileP); // << + + + SPAPI A_Err (*AEGP_GetInSpecNativeStartTime)( + AEIO_InSpecH inH, /* >> */ + A_Time *startTimeP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecNativeStartTime)( + AEIO_InSpecH inH, /* >> */ + const A_Time *startTimeP); /* >> */ + + SPAPI A_Err (*AEGP_ClearInSpecNativeStartTime)( + AEIO_InSpecH inH); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecNativeDisplayDropFrame)( + AEIO_InSpecH inH, /* >> */ + A_Boolean *displayDropFrameBP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecNativeDisplayDropFrame)( + AEIO_InSpecH inH, /* >> */ + A_Boolean displayDropFrameB); /* >> */ + + SPAPI A_Err (*AEGP_SetInSpecStillSequenceNativeFPS)( + AEIO_InSpecH inH, /* >> */ + A_Fixed native_still_seq_fps); /* >> */ + +} AEGP_IOInSuite5; + +#define kAEGPIOOutSuite "AEGP IO Out Suite" +#define kAEGPIOOutSuiteVersion5 8 /* frozen in AE 17.0 */ + +typedef struct AEGP_IOOutSuite5 { + SPAPI A_Err (*AEGP_GetOutSpecOptionsHandle)( + AEIO_OutSpecH outH, /* >> */ + void **optionsPPV); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecOptionsHandle)( + AEIO_OutSpecH outH, /* >> */ + void *optionsPV, /* >> */ + void **old_optionsPPVO); /* <> */ + + SPAPI A_Err (*AEGP_GetOutSpecFilePath)( + AEIO_OutSpecH outH, /* >> */ + AEGP_MemHandle *unicode_pathPH, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + A_Boolean *file_reservedPB); /* << If the file is reserved, do not create the file. + Otherwise, multi-machine rendering can fail. + If true, an empty file has already been created. */ + + SPAPI A_Err (*AEGP_GetOutSpecFPS)( + AEIO_OutSpecH outH, /* >> */ + A_Fixed *native_fpsP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecNativeFPS)( + AEIO_OutSpecH outH, /* >> */ + A_Fixed native_fpsP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecDepth)( + AEIO_OutSpecH outH, /* >> */ + A_short *depthPS); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecDepth)( + AEIO_OutSpecH outH, /* >> */ + A_short depthPS); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecInterlaceLabel)( + AEIO_OutSpecH outH, /* >> */ + FIEL_Label *interlaceP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecInterlaceLabel)( + AEIO_OutSpecH outH, /* >> */ + const FIEL_Label *interlaceP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecAlphaLabel)( + AEIO_OutSpecH outH, /* >> */ + AEIO_AlphaLabel *alphaP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecAlphaLabel)( + AEIO_OutSpecH outH, /* >> */ + const AEIO_AlphaLabel *alphaP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecDuration)( + AEIO_OutSpecH outH, /* >> */ + A_Time *durationP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecDuration)( + AEIO_OutSpecH outH, /* >> */ + const A_Time *durationP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecDimensions)( + AEIO_OutSpecH outH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecHSF)( + AEIO_OutSpecH outH, /* >> */ + A_Ratio *hsfP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecHSF)( + AEIO_OutSpecH outH, /* >> */ + const A_Ratio *hsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecSoundRate)( + AEIO_OutSpecH outH, /* >> */ + A_FpLong *ratePF); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecSoundRate)( + AEIO_OutSpecH outH, /* >> */ + A_FpLong rateF); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecSoundEncoding)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndEncoding *encodingP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecSoundEncoding)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndEncoding encoding); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecSoundSampleSize)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndSampleSize *bytes_per_sampleP);/* << */ + + SPAPI A_Err (*AEGP_SetOutSpecSoundSampleSize)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndSampleSize bytes_per_sample); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecSoundChannels)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndChannels *num_channelsP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecSoundChannels)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndChannels num_channels); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecIsStill)( + AEIO_OutSpecH outH, /* >> */ + A_Boolean *is_stillPB); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecPosterTime)( + AEIO_OutSpecH outH, /* >> */ + A_Time *poster_timeP); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecStartFrame)( + AEIO_OutSpecH outH, /* >> */ + A_long *start_frameP); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecPullDown)( + AEIO_OutSpecH outH, /* >> */ + AEIO_Pulldown *pulldownP); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecIsMissing)( + AEIO_OutSpecH outH, /* >> */ + A_Boolean *missingPB); /* << */ + + // see if you need to embed outspec's color profile as an icc profile + SPAPI A_Err (*AEGP_GetOutSpecShouldEmbedICCProfile)( + AEIO_OutSpecH outH, // >> + A_Boolean *embedPB); // << + + // query outspec's color profile + SPAPI A_Err (*AEGP_GetNewOutSpecColorProfile)( + AEGP_PluginID aegp_plugin_id, // >> + AEIO_OutSpecH outH, // >> + AEGP_ColorProfileP *color_profilePP); // << output color space; caller must dispose with AEGP_DisposeColorProfile + + // Fails if rq_itemP is not found. + // This API would also fail if the outH is not a confirmed outH and is a copy. + // e.g. if the Output Module settings dialog is Open. + SPAPI A_Err (*AEGP_GetOutSpecOutputModule)( + AEIO_OutSpecH outH, /* >> */ + AEGP_RQItemRefH *rq_itemP, /* << */ + AEGP_OutputModuleRefH *om_refP); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecStartTime)( + AEIO_OutSpecH outH, /* >> */ + A_Time *outStartTimePT); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecFrameTime)( // relative to start time + AEIO_OutSpecH outH, /* >> */ + A_Time *outFrameTimePT); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecIsDropFrame)( + AEIO_OutSpecH outH, /* >> */ + A_Boolean *outIsDropFramePB); /* << */ + + +} AEGP_IOOutSuite5; + + + +/* This suite allows you to take advantage of going through AE Import Dialog + and being treated as a native format type +*/ + +typedef A_long AE_FIM_ImportFlavorRef; + +#define AE_FIM_ImportFlavorRef_NONE AEGP_Index_NONE + +#define AE_FIM_MAX_FLAVOR_NAME_LEN 63 + +enum { + AE_FIM_ImportFlag_NONE = 0x0, + AE_FIM_ImportFlag_COMP = 0x2 +}; +typedef A_long AE_FIM_ImportFlags; + +enum { + AE_FIM_SpecialAction_NONE = -1, + AE_FIM_SpecialAction_DRAG_N_DROP_FILE = 2 +}; +typedef A_long AE_FIM_SpecialAction; + + +typedef struct AE_FIM_RefconTag *AE_FIM_Refcon; + +typedef struct AE_FIM_ImportOptionsTag *AE_FIM_ImportOptions; + +// callbacks +typedef A_Err (*AE_FIM_ImportFileCB)( + const A_UTF16Char *pathZ, // >> null terminated unicode path with platform separators + AE_FIM_ImportOptions imp_options, /* >> opaque structure; in the future could be expanded with query functions*/ + AE_FIM_SpecialAction action, /* >> is it a special kind of import situation? */ + AEGP_ItemH itemH, /* >> meaning varies depending on AE_FIM_SpecialAction */ + // both for no special action and drag'n'drop it is + // a folder where imported item should go + AE_FIM_Refcon refcon); /* >> the client defines this and it is stored with import callbacks */ + + + +typedef A_Err (*AE_FIM_VerifyImportableCB)( + const A_UTF16Char *pathZ, // >> null terminated unicode path with platform separators + AE_FIM_Refcon refcon, /* >> the client defines this and it is stored with import callbacks */ + A_Boolean *importablePB); /* << */ + + +typedef struct { + AE_FIM_Refcon refcon; // points to whatever you want; stored and passed back with the callbacks + AE_FIM_ImportFileCB import_cb; + AE_FIM_VerifyImportableCB verify_cb; +} AE_FIM_ImportCallbacks; + +#define kAEGPFIMSuite "AEGP File Import Manager Suite" +#define kAEGPFIMSuiteVersion4 4 /* frozen in AE 17.0 */ + + +typedef struct { + SPAPI A_Err (*AEGP_RegisterImportFlavor)( + const A_char *nameZ, // format name you'd like to appear + // in AE's Import Dialog Format pop-up + // menu. + // Limited to AE_FIM_MAX_IMPORT_FLAVOR_NAME_LEN. + // Everything after that will be truncated. + AE_FIM_ImportFlavorRef *imp_refP); // On return it is set to a valid opaque ref. + // If error occured, it will be returned to + // the caller and ref will be set to a special + // value - AE_FIM_ImportFlavorRef_NONE. + + SPAPI A_Err (*AEGP_RegisterImportFlavorFileTypes)( + AE_FIM_ImportFlavorRef imp_ref, // Received from AEGP_RegisterImportFlavor + A_long num_filekindsL, // number of supported file types for this format + const AEIO_FileKind *kindsAP, // Array of supported file types for this format + A_long num_fileextsL, // number of supported file exts for this format + const AEIO_FileKind *extsAP); // Array of supported file exts for this format + + + SPAPI A_Err (*AEGP_RegisterImportFlavorImportCallbacks)( + AE_FIM_ImportFlavorRef imp_ref, // Received from AEGP_RegisterImportFlavor + AE_FIM_ImportFlags single_flag, // You can register callbacks only per single flag + // this also registers the flag with the import flavor + const AE_FIM_ImportCallbacks *imp_cbsP); // Callbacks your format installs per each flag + + // optionally call once from AE_FIM_ImportFileCB. This is used by the application when re-importing + // from the render queue and replacing an existing item. + SPAPI A_Err (*AEGP_SetImportedItem)( + AE_FIM_ImportOptions imp_options, /* <> */ + AEGP_ItemH imported_itemH); /* >> */ + + SPAPI A_Err (*AEGP_FileSequenceImportOptionsFromFIMImportOptions)( + const AE_FIM_ImportOptions imp_options, /* >> */ + AEGP_FileSequenceImportOptions *seq_import_optionsP); /* << */ + +} AEGP_FIMSuite4; + + + +/* --------------------------- Persistent Data Suite ------------------------------*/ +/* +The persist data suite allows you to store persistant data with the application. + +The data entries are accessed by SectionKey, ValueKey pairs. It is recommended +that plugins use their matchname as their SectionKey, or the prefix if using multiple +section names. THe available data types are void*, floating point numbers, and strings. + +Void* unstructured data allows you to store any kind of data. You must pass in a size in +bytes along with the data. + +String data supports the full 8 bit space, only 0x00 is reserved for string ending. +This makes them ideal for storing UTF-8 encoded strings, ISO 8859-1, and plain ASCII. +Both Section keys and Value keys are of this type. + +FpLongs are stored with 6 decimal places of precision. There is no provision +for specifying a different precision. + +Right now the only persistent data host is the application. + +*/ + +#define kAEGPPersistentDataSuite "AEGP Persistent Data Suite" +#define kAEGPPersistentDataSuiteVersion4 4 /* frozen in AE 12.0 */ + +typedef struct { + // get a handle of the application blob, + // modifying this will modify the application + SPAPI A_Err (*AEGP_GetApplicationBlob)( + AEGP_PersistentType blob_type, /* >> new in AE 12 */ + AEGP_PersistentBlobH *blobPH); /* << */ + + // section and value key management + SPAPI A_Err (*AEGP_GetNumSections)( + AEGP_PersistentBlobH blobH, /* >> */ + A_long *num_sectionPL); /* << */ + + SPAPI A_Err (*AEGP_GetSectionKeyByIndex)( + AEGP_PersistentBlobH blobH, /* >> */ + A_long section_index, /* >> */ + A_long max_section_size, /* >> */ + A_char *section_keyZ); /* << */ + + SPAPI A_Err (*AEGP_DoesKeyExist)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_Boolean *existsPB); /* << */ + + SPAPI A_Err (*AEGP_GetNumKeys)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + A_long *num_keysPL); /* << */ + + SPAPI A_Err (*AEGP_GetValueKeyByIndex)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + A_long key_index, /* >> */ + A_long max_key_size, /* >> */ + A_char *value_keyZ); /* << */ + + // data access and manipulation + + // For the entry points below, if a given key is not found, + // the default value is both written to the blobH and + // returned as the value; if no default is provided, a blank value will be written + // and returned + + SPAPI A_Err (*AEGP_GetDataHandle)( + AEGP_PluginID plugin_id, + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + AEGP_MemHandle defaultH0, /* >> never adopted, NULL means no default data */ + AEGP_MemHandle *valuePH); /* << newly allocated, owned by caller, NULL if would be zero sized handle */ + + SPAPI A_Err (*AEGP_GetData)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_u_long data_sizeLu, /* >> bufPV & default must be this big, if pref isn't then the default will be used */ + const void *defaultPV0, /* >> NULL means all zeros for default */ + void *bufPV); /* << */ + + SPAPI A_Err (*AEGP_GetString)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const A_char *defaultZ0, /* >> NULL means '\0' is the default */ + A_u_long buf_sizeLu, /* >> size of buffer. Behavior dependent on actual_buf_sizeLu0 */ + A_char *bufZ, /* << will be "" if buf_size is too small */ + A_u_long *actual_buf_sizeLu0); /* << actual size needed to store the buffer (includes terminating NULL). Pass NULL for error reporting if size mismatch.*/ + + SPAPI A_Err (*AEGP_GetLong)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_long defaultL, /* >> */ + A_long *valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetFpLong)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_FpLong defaultF, /* >> */ + A_FpLong *valuePF); /* << */ + + SPAPI A_Err (*AEGP_GetTime)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const A_Time *defaultPT0, /* >> */ + A_Time *valuePT); /* << */ + + SPAPI A_Err (*AEGP_GetARGB)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const PF_PixelFloat *defaultP0, /* >> */ + PF_PixelFloat *valueP); /* << */ + + // setters + SPAPI A_Err (*AEGP_SetDataHandle)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const AEGP_MemHandle valueH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_SetData)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_u_long data_sizeLu, /* >> */ + const void *dataPV); /* >> */ + + SPAPI A_Err (*AEGP_SetString)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const A_char *strZ); /* >> */ + + SPAPI A_Err (*AEGP_SetLong)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_long valueL); /* >> */ + + SPAPI A_Err (*AEGP_SetFpLong)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_FpLong valueF); /* >> */ + + SPAPI A_Err (*AEGP_SetTime)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const A_Time *valuePT); /* >> */ + + SPAPI A_Err (*AEGP_SetARGB)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const PF_PixelFloat *valueP); /* >> */ + + SPAPI A_Err (*AEGP_DeleteEntry)( /* no error if entry not found */ + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ); /* >> */ + + SPAPI A_Err (*AEGP_GetPrefsDirectory)( + AEGP_MemHandle *unicode_pathPH); // << empty string if no file. handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + +} AEGP_PersistentDataSuite4; + + +// AEGP_CollectionSuite1 + +#define kAEGPCollectionSuite "AEGP Collection Suite" +#define kAEGPCollectionSuiteVersion2 2 /* frozen in AE 6.5 */ + +enum { + AEGP_CollectionItemType_NONE, + + AEGP_CollectionItemType_LAYER, + AEGP_CollectionItemType_MASK, + AEGP_CollectionItemType_EFFECT, + AEGP_CollectionItemType_STREAM, + AEGP_CollectionItemType_KEYFRAME, + AEGP_CollectionItemType_MASK_VERTEX, + AEGP_CollectionItemType_STREAMREF, + + AEGP_CollectionItemType_END, + AEGP_CollectionItemType_BEGIN = AEGP_CollectionItemType_LAYER +}; +typedef A_LegacyEnumType AEGP_CollectionItemType; + +typedef struct { + AEGP_LayerH layerH; /* comp derived from layerH */ +} AEGP_LayerCollectionItem; + +typedef struct { + AEGP_LayerH layerH; /* containing layer */ + AEGP_MaskIndex index; /* index to layer. */ +}AEGP_MaskCollectionItem; + +typedef struct { + AEGP_LayerH layerH; /* containing layer */ + AEGP_EffectIndex index; /* index to the effect */ +}AEGP_EffectCollectionItem; + +enum { + AEGP_StreamCollectionItemType_NONE, + AEGP_StreamCollectionItemType_LAYER, + AEGP_StreamCollectionItemType_MASK, + AEGP_StreamCollectionItemType_EFFECT, + AEGP_StreamCollectionItemType_END, + AEGP_StreamCollectionItemType_BEGIN = AEGP_StreamCollectionItemType_LAYER +}; +typedef A_LegacyEnumType AEGP_StreamCollectionItemType; + +typedef struct { + AEGP_MaskCollectionItem mask; + AEGP_MaskStream mask_stream; +} AEGP_MaskStreamCollectionItem; + +typedef struct { + AEGP_EffectCollectionItem effect; + A_long param_index; +} AEGP_EffectStreamCollectionItem; + +typedef struct { + AEGP_LayerH layerH; + AEGP_LayerStream layer_stream; +} AEGP_LayerStreamCollectionItem; + +typedef struct { + AEGP_StreamCollectionItemType type; + union { + AEGP_LayerStreamCollectionItem layer_stream; + AEGP_MaskStreamCollectionItem mask_stream; + AEGP_EffectStreamCollectionItem effect_stream; + } u; +}AEGP_StreamCollectionItem; + +typedef struct { + AEGP_MaskCollectionItem mask_sel; /* the mask must be selected for a vertex to be selected */ + AEGP_VertexIndex index; +}AEGP_MaskVertexCollectionItem; + +typedef struct { + AEGP_StreamCollectionItem stream_coll; + AEGP_KeyframeIndex index; +}AEGP_KeyframeCollectionItem; + +typedef struct { + AEGP_CollectionItemType type; + // the union is not used for AEGP_CollectionItemType_STREAMREF + union { + AEGP_LayerCollectionItem layer; + AEGP_MaskCollectionItem mask; + AEGP_EffectCollectionItem effect; + AEGP_StreamCollectionItem stream; + AEGP_MaskVertexCollectionItem mask_vertex; + AEGP_KeyframeCollectionItem keyframe; + } u; + + AEGP_StreamRefH stream_refH; // valid for all types +} AEGP_CollectionItemV2; + +typedef struct { + SPAPI A_Err (*AEGP_NewCollection)( /* dispose with dispose collection */ + AEGP_PluginID plugin_id, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_DisposeCollection)( + AEGP_Collection2H collectionH); /* >> */ + + SPAPI A_Err (*AEGP_GetCollectionNumItems)( /* constant time */ + AEGP_Collection2H collectionH, /* >> */ + A_u_long *num_itemsPL); /* << */ + + SPAPI A_Err (*AEGP_GetCollectionItemByIndex)( /* constant time */ + AEGP_Collection2H collectionH, /* >> */ + A_u_long indexL, /* >> */ + AEGP_CollectionItemV2 *collection_itemP); /* << */ + + SPAPI A_Err (*AEGP_CollectionPushBack)( /* constant time */ + AEGP_Collection2H collectionH, /* <> */ + const AEGP_CollectionItemV2 *collection_itemP); /* >> NOTE: The passed AEGP_CollectionItemV2, as well as all the AEGP_StreamRefH's + it references, will be adopted by AE; DO NOT dispose of it! */ + + SPAPI A_Err (*AEGP_CollectionErase)( /* O(n) */ + AEGP_Collection2H collectionH, /* <> */ + A_u_long index_firstL, /* >> */ + A_u_long index_lastL); /* >> */ + +} AEGP_CollectionSuite2; + + +enum +{ + AEGP_WorldType_NONE, + AEGP_WorldType_8, + AEGP_WorldType_16, + AEGP_WorldType_32 +}; + +typedef A_long AEGP_WorldType; + + +#define kAEGPWorldSuite "AEGP World Suite" +#define kAEGPWorldSuiteVersion3 3 /* frozen in AE 7.0 */ + +typedef struct { + SPAPI A_Err (*AEGP_New)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_WorldType type, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + AEGP_WorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_WorldH worldH); /* >> */ + + SPAPI A_Err (*AEGP_GetType)( + AEGP_WorldH worldH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + SPAPI A_Err (*AEGP_GetSize)( + AEGP_WorldH worldH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetRowBytes)( + AEGP_WorldH worldH, /* >> */ + A_u_long *row_bytesPL); /* << */ + + SPAPI A_Err (*AEGP_GetBaseAddr8)( + AEGP_WorldH worldH, /* >> error if the worldH is not AEGP_WorldType_8 */ + PF_Pixel8 **base_addrP); /* << */ + + SPAPI A_Err (*AEGP_GetBaseAddr16)( + AEGP_WorldH worldH, /* >> error if the worldH is not AEGP_WorldType_16 */ + PF_Pixel16 **base_addrP); /* << */ + + SPAPI A_Err (*AEGP_GetBaseAddr32)( + AEGP_WorldH worldH, /* >> error if the worldH is not AEGP_WorldType_32 */ + PF_PixelFloat **base_addrP); /* << */ + + SPAPI A_Err (*AEGP_FillOutPFEffectWorld)( /* Provided so you can use some of the PF routines with an AEGPWorld. Pass NULL as the ProgPtr to the PF routines.*/ + AEGP_WorldH worldH, /* >> */ + PF_EffectWorld *pf_worldP); /* << */ + + SPAPI A_Err (*AEGP_FastBlur)( + A_FpLong radiusF, /* >> */ + PF_ModeFlags mode, /* >> */ + PF_Quality quality, /* >> */ + AEGP_WorldH worldH); /* <> only for user allocated worlds; not for checked-out frames which are read only */ + + SPAPI A_Err (*AEGP_NewPlatformWorld)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_WorldType type, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + AEGP_PlatformWorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_DisposePlatformWorld)( + AEGP_PlatformWorldH worldH); /* >> */ + + SPAPI A_Err (*AEGP_NewReferenceFromPlatformWorld)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_PlatformWorldH platform_worldH, // >> + AEGP_WorldH *worldPH); /* << */ + + +} AEGP_WorldSuite3; + + +/* AEGP_RenderOptionsSuite + +*/ + +enum { + AEGP_MatteMode_STRAIGHT = 0, + AEGP_MatteMode_PREMUL_BLACK, + AEGP_MatteMode_PREMUL_BG_COLOR +}; +typedef A_long AEGP_MatteMode; + +enum { + AEGP_ChannelOrder_ARGB = 0, + AEGP_ChannelOrder_BGRA +}; +typedef A_char AEGP_ChannelOrder; + +enum { + AEGP_ItemQuality_DRAFT = 0, /* footage only. perform faster decode at expense of quality and draft-quality deinterlacing. */ + AEGP_ItemQuality_BEST /* footage only. perform full decode and resampled deinterlacing */ +}; +typedef A_char AEGP_ItemQuality; + +#define kAEGPRenderOptionsSuite "AEGP Render Options Suite" +#define kAEGPRenderOptionsSuiteVersion4 4 /* frozen in AE 10.5 */ + +typedef struct { + // fills out + // Time to 0 + // Time step to the frame duration + // field render to none + // depth is best resolution of item + SPAPI A_Err (*AEGP_NewFromItem)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_ItemH itemH, /* >> */ + AEGP_RenderOptionsH *optionsPH); /* << */ + + SPAPI A_Err (*AEGP_Duplicate)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderOptionsH *copyPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_RenderOptionsH optionsH); /* >> */ + + SPAPI A_Err (*AEGP_SetTime)( /* the render time */ + AEGP_RenderOptionsH optionsH, /* <> */ + A_Time time); /* >> */ + + SPAPI A_Err (*AEGP_GetTime)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_SetTimeStep)( /* duration of the frame; important for motion blur. */ + AEGP_RenderOptionsH optionsH, /* <> */ + A_Time time_step); /* >> */ + + SPAPI A_Err (*AEGP_GetTimeStep)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Time *timePT); /* << */ + + SPAPI A_Err (*AEGP_SetFieldRender)( /* How fields are to be handled. */ + AEGP_RenderOptionsH optionsH, /* <> */ + PF_Field field_render); /* >> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + AEGP_RenderOptionsH optionsH, /* >> */ + PF_Field *field_renderP); /* << */ + + + SPAPI A_Err (*AEGP_SetWorldType)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_WorldType type); /* >> */ + + SPAPI A_Err (*AEGP_GetWorldType)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + + // 1 == 100% + // 2 == 50% + // ... + SPAPI A_Err (*AEGP_SetDownsampleFactor)( + AEGP_RenderOptionsH optionsH, /* <> */ + A_short x, /* >> */ + A_short y); /* >> */ + + SPAPI A_Err (*AEGP_GetDownsampleFactor)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_short *xP, /* >> */ + A_short *yP); /* << */ + + SPAPI A_Err (*AEGP_SetRegionOfInterest)( + AEGP_RenderOptionsH optionsH, /* <> */ + const A_LRect *roiP); /* >> {0,0,0,0} for all*/ + + SPAPI A_Err (*AEGP_GetRegionOfInterest)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_LRect *roiP); /* << */ + + SPAPI A_Err (*AEGP_SetMatteMode)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_MatteMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMatteMode)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_MatteMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_SetChannelOrder)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_ChannelOrder channel_order); /* >> */ + + SPAPI A_Err (*AEGP_GetChannelOrder)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_ChannelOrder *channelP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderGuideLayers)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Boolean *will_renderPB); /* << */ + + SPAPI A_Err (*AEGP_SetRenderGuideLayers)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Boolean render_themB); /* >> */ + + /* AEGP_ItemType_FOOTAGE can be decoded at different with different + quality levels. Ignore for other AEGP_ItemType + */ + + SPAPI A_Err (*AEGP_GetRenderQuality)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_ItemQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetRenderQuality)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_ItemQuality quality); /* >> */ +} AEGP_RenderOptionsSuite4; + + +#define kAEGPLayerRenderOptionsSuite "AEGP Layer Render Options Suite" +#define kAEGPLayerRenderOptionsSuiteVersion2 2 /* frozen in 13.5 */ + +typedef struct { + // optionsPH must be disposed by calling code + // + // fills out + // Time to the layer's current time + // Time step to layer's frame duration + // ROI to the layer's nominal bounds + // EffectsToRender to "all" + SPAPI A_Err (*AEGP_NewFromLayer)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerRenderOptionsH *optionsPH); /* << */ + + // optionsPH must be disposed by calling code + // like AEGP_NewFromLayer, but sets EffectsToRender to be the index fof effectH + SPAPI A_Err (*AEGP_NewFromUpstreamOfEffect)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_EffectRefH effectH, /* >> */ + AEGP_LayerRenderOptionsH *optionsPH); /* << */ + + // optionsPH must be disposed by calling code + // like AEGP_NewFromLayer, but sets EffectsToRender to include the effect output + // THIS MAY ONLY BE CALLED FROM THE UI THREAD + SPAPI A_Err (*AEGP_NewFromDownstreamOfEffect)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_EffectRefH effectH, /* >> */ + AEGP_LayerRenderOptionsH *optionsPH); /* << */ + + // copyPH must be disposed by calling code + SPAPI A_Err (*AEGP_Duplicate)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_LayerRenderOptionsH optionsH, /* >> */ + AEGP_LayerRenderOptionsH *copyPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_LayerRenderOptionsH optionsH); /* >> */ + + SPAPI A_Err (*AEGP_SetTime)( /* the render time */ + AEGP_LayerRenderOptionsH optionsH, /* <> */ + A_Time time); /* >> */ + + SPAPI A_Err (*AEGP_GetTime)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_SetTimeStep)( /* duration of the frame; important for motion blur. */ + AEGP_LayerRenderOptionsH optionsH, /* <> */ + A_Time time_step); /* >> */ + + SPAPI A_Err (*AEGP_GetTimeStep)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + A_Time *timePT); /* << */ + + SPAPI A_Err (*AEGP_SetWorldType)( + AEGP_LayerRenderOptionsH optionsH, /* <> */ + AEGP_WorldType type); /* >> */ + + SPAPI A_Err (*AEGP_GetWorldType)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + // 1 == 100% + // 2 == 50% + // ... + SPAPI A_Err (*AEGP_SetDownsampleFactor)( + AEGP_LayerRenderOptionsH optionsH, /* <> */ + A_short x, /* >> */ + A_short y); /* >> */ + + SPAPI A_Err (*AEGP_GetDownsampleFactor)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + A_short *xP, /* >> */ + A_short *yP); /* << */ + + SPAPI A_Err (*AEGP_SetMatteMode)( + AEGP_LayerRenderOptionsH optionsH, /* <> */ + AEGP_MatteMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMatteMode)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + AEGP_MatteMode *modeP); /* << */ +} AEGP_LayerRenderOptionsSuite2; + + +#define kAEGPRenderSuite "AEGP Render Suite" +#define kAEGPRenderSuiteVersion5 8 /* frozen in 13.5 */ + +typedef A_u_longlong AEGP_AsyncRequestId; + +typedef A_Err (*AEGP_RenderSuiteCheckForCancel)( + void *refcon, + A_Boolean *cancelPB); + +typedef A_Err (*AEGP_AsyncFrameReadyCallback)( + AEGP_AsyncRequestId request_id, // this will be the AEGP_AsyncRequestId that was returned from AEGP_RenderAndCheckoutLayerFrame_Async + A_Boolean was_canceled, // will be set to true if this request was canceled via a call to AEGP_CancelAsyncRequest + A_Err error, // will be set to A_Err_NONE (0) if successful + AEGP_FrameReceiptH receiptH, // frame data (only if successful) + AEGP_AsyncFrameRequestRefcon refconP0); // this is the AEGP_AsyncFrameRequestRefcon that was (optionally) passed in to AEGP_RenderAndCheckoutLayerFrame_Async + +typedef struct { + // IMPORTANT: use of this call on the UI thread should be considered DEPRECATED except in a very narrow use case: + // a) the plugin requires this frame to make database change (e.g. an auto color button on an effect) + // b) the user explicitly requested this operation (e.g. this is not a passive redraw of UI because something else changed) + // This is to avoid having poor interactivity while the user is doing other unrelated things. + // Asynchronous APIs should be used on the UI thread except in this specific case + // On the UI thread, if the frame takes longer than 2 seconds, a progress dialog will automatically open to allow the user to cancel + // On a render thread, these calls will work as normal with no progress dialog + + // See IMPORTANT note above about using this synchronous call on the UI thread which is considered DEPRECATED behavior + SPAPI A_Err (*AEGP_RenderAndCheckoutFrame)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_FrameReceiptH *receiptPH); /* << check in using AEGP_CheckinFrame to release memory */ + + // render_plain_layer_frameB was confusing and is not the design we want going forward + // eventually this will be replaced with new RenderOptions calls. Until that is available, this will behave as if render_plain_layer_frameB is "false" + // (upstream effect render). If the "true" behavior for adjustment layer mask is desired, see kAEGPRenderSuiteVersion4 that still has this flag + + // See IMPORTANT note above about using this synchronous call on the UI thread which is considered DEPRECATED behavior + SPAPI A_Err (*AEGP_RenderAndCheckoutLayerFrame)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_FrameReceiptH *receiptPH); /* << check in using AEGP_CheckinFrame to release memory */ + + SPAPI A_Err (*AEGP_RenderAndCheckoutLayerFrame_Async)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + AEGP_AsyncFrameReadyCallback callback, /* >> this will be called when the frame is ready (guaranteed to be called unless AE is shutting down) */ + AEGP_AsyncFrameRequestRefcon request_completion_refconP0, /* >> optional. if included, it will be passed into the above callback */ + AEGP_AsyncRequestId *asyncRequestIdP); /* << Id associated with frame request. Can be used to cancel early */ + + SPAPI A_Err (*AEGP_CancelAsyncRequest)( + AEGP_AsyncRequestId asyncRequestId); /* >> */ + + SPAPI A_Err (*AEGP_CheckinFrame)( + AEGP_FrameReceiptH receiptH); /* >> */ + + /* This returns a read only world that is not-owned by the plugin. + Call CheckinFrame to release the world when you are done reading from it. + */ + + SPAPI A_Err (*AEGP_GetReceiptWorld)( + AEGP_FrameReceiptH receiptH, /* >> */ + AEGP_WorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_GetRenderedRegion)( + AEGP_FrameReceiptH receiptH, /* >> */ + A_LRect *rendered_regionP); /* << */ + + SPAPI A_Err (*AEGP_IsRenderedFrameSufficient)( + AEGP_RenderOptionsH rendered_optionsH, /* >> */ + AEGP_RenderOptionsH proposed_optionsH, /* >> */ + A_Boolean *rendered_is_sufficientPB); /* << */ + + // See IMPORTANT note above about using this synchronous call on the UI thread which is considered DEPRECATED behavior + SPAPI A_Err (*AEGP_RenderNewItemSoundData)( /* Works on Compositions and Footage items. */ + AEGP_ItemH itemH, /* >> */ + const A_Time *start_timePT, /* >> */ + const A_Time *durationPT, /* >> */ + const AEGP_SoundDataFormat *sound_formatP, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_SoundDataH *new_sound_dataPH); /* << AEGP_SoundDataH must be disposed. Returns NULL if no audio */ + + + // returns the current timestamp of the project.this is increased any time something is touched in the project + // that affects rendering + SPAPI A_Err (*AEGP_GetCurrentTimestamp)( + AEGP_TimeStamp * time_stampP); // out + + // Lets you know if the video of the item has changed since the input time stamp. + // Is not affected by audio. + SPAPI A_Err (*AEGP_HasItemChangedSinceTimestamp)(AEGP_ItemH itemH, // in + const A_Time * start_timeP, // in + const A_Time* durationP, //in + const AEGP_TimeStamp * time_stampP, //in + A_Boolean * item_has_changedPB); //out + + // checks whether this frame would be worth rendering externally and + // checking in to the cache. a speculative renderer should check this twice: + // (1) before sending the frame out to render + // (2) when it is complete, before calling AEGP_NewPlatformWorld and checking in. + // (don't forget to call AEGP_HasItemChangedSinceTimestamp also!) + SPAPI A_Err (*AEGP_IsItemWorthwhileToRender)( AEGP_RenderOptionsH roH, // in + const AEGP_TimeStamp* time_stampP, // in + A_Boolean *worthwhile_to_renderPB); // out + + // ticks_to_render is the approximate amount of time needed to render the frame + // on this machine. it is 60Hz. + SPAPI A_Err (*AEGP_CheckinRenderedFrame)( AEGP_RenderOptionsH roH, // in + const AEGP_TimeStamp* time_stampP, // in + A_u_long ticks_to_renderL, // in + AEGP_PlatformWorldH imageH); // in (adopted) + + SPAPI A_Err (*AEGP_GetReceiptGuid) (AEGP_FrameReceiptH receiptH, // in + AEGP_MemHandle *guidMH); // out, must be disposed +} AEGP_RenderSuite5; + + + +// AsyncManager render suite. For render requests that are managed by AE rather than explicitly by plugin callbacks (as in some cases in AEGP_RenderSuite5+) +// As of 13.5 the only way to get an AsyncManager is via PF_GetContextAsyncManager in PF_EffectCustomUISuite2. (This Async Manager is PF_Event_DRAW specific +// but there may be others in the future) + +#define kAEGPRenderAsyncManagerSuite "AEGP Render Asyc Manager Suite" +#define kAEGPRenderAsyncManagerSuiteVersion1 1 /* frozen in 13.5 */ + + +typedef struct { + + // An AsyncManager automatically handles possibly multiple async render requests + // The first use of this in for async requests in CUSTOM_UI of PF_EventDRAW. See PF_OutFlags2_CUSTOM_UI_ASYNC_MANAGER + // The purpose_id is a unique constant number that helps the manager understand when it can automatically cancel + // old requests (because they have the same purpose id and the RO has changed) + + SPAPI A_Err (*AEGP_CheckoutOrRender_ItemFrame_AsyncManager)( PF_AsyncManagerP async_managerP, // >> the async manager to ask for the render + A_u_long purpose_id, // >> a unique id to identify requests for the same usage (e.g. to hint cancellation of old) + AEGP_RenderOptionsH ro, // >> the description of the item frame to render + AEGP_FrameReceiptH *out_receiptPH ); // << on success, the rendered frame. Can succeed and have no pixels (no world) + + SPAPI A_Err (*AEGP_CheckoutOrRender_LayerFrame_AsyncManager)( PF_AsyncManagerP async_managerP, // >> the async manager to ask for the render + A_u_long purpose_id, // >> a unique id to identify requests for the same usage (e.g. to hint cancellation of old) + AEGP_LayerRenderOptionsH lro, // >> the description of the layer frame to render + AEGP_FrameReceiptH *out_receiptPH ); // << on success, the rendered frame. Can succeed and have no pixels (no world) + + + +} AEGP_RenderAsyncManagerSuite1; + + + + +#define kAEGPTrackerSuite "AEGP Tracker Suite" +#define kAEGPTrackerSuiteVersion1 1 /* frozen in AE 6.0 */ + + +typedef struct { + SPAPI A_Err (*AEGP_GetNumFeatures)( + const PT_TrackingContextPtr contextP, /* >> */ + A_long *num_featuresPL); /* << */ + + SPAPI A_Err (*AEGP_GetFeatureRegionByIndex)( + const PT_TrackingContextPtr contextP, /* >> */ + PT_Index index, /* >> */ + A_FloatRect *rectP); /* << */ + + SPAPI A_Err (*AEGP_GetSearchRegionByIndex)( + const PT_TrackingContextPtr contextP, /* >> */ + PT_Index index, /* >> */ + A_FloatRect *rectP); /* << */ + + SPAPI A_Err (*AEGP_GetFeatureWorldByIndex)( + const PT_TrackingContextPtr contextP, /* >> */ + PT_Index index, /* >> */ + AEGP_WorldH *feature_worldPH); /* << */ + + SPAPI A_Err (*AEGP_GetFrameWorld)( + const PT_TrackingContextPtr contextP, /* >> */ + AEGP_WorldH *frame_worldPH); /* << */ + + SPAPI A_Err (*AEGP_GetTrackerSourceDimensions)( + const PT_TrackingContextPtr contextP, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); + + SPAPI A_Err (*AEGP_SetFeatureRegionByIndex)( + const PT_TrackingContextPtr contextP, /* >> */ + PT_Index index, /* >> */ + const A_FloatRect *rectP); /* >> */ + + SPAPI A_Err (*AEGP_SetAccuracyByIndex)( + const PT_TrackingContextPtr contextP, /* >> */ + PT_Index index, /* >> */ + A_FpLong accuracyF); /* >> */ + + SPAPI A_Err (*AEGP_ShouldTrackFeature)( + const PT_TrackingContextPtr contextP, /* >> */ + PT_Index index, /* >> */ + A_Boolean *trackPB); /* << */ + +} AEGP_TrackerSuite1; + + +#define kAEGPTrackerUtilitySuite "AEGP Tracker Utility Suite" +#define kAEGPTrackerUtilitySuiteVersion1 1 /* frozen in AE 6.0 */ + +typedef struct { + SPAPI A_Err (*AEGP_HasUserCancelled)( + const PT_TrackingContextPtr contextP, /* >> */ + A_Boolean *user_cancelledPB); /* << */ + + SPAPI A_Err (*AEGP_GetTrackerFromTrackerInstance)( + const PT_TrackerInstancePtr tracker_instanceP, /* >> */ + PT_TrackerPtr *trackerPP); /* << */ + + SPAPI A_Err (*AEGP_GetTrackerInstanceFromTrackingContext)( + const PT_TrackingContextPtr contextP, /* >> */ + PT_TrackerInstancePtr *tracker_instancePP); /* << */ + + SPAPI A_Err (*AEGP_GetGlobalData)( + const PT_TrackerPtr trackerP, /* >> */ + AEGP_MemHandle *global_dataPH); /* << */ + + SPAPI A_Err (*AEGP_GetInstanceData)( + const PT_TrackerInstancePtr tracker_instanceP, /* >> */ + AEGP_MemHandle *instance_dataPH); /* << */ // currently has to be flat (no handles inside the handle) + + SPAPI A_Err (*AEGP_GetTrackData)( + const PT_TrackingContextPtr contextP, /* >> */ + AEGP_MemHandle *track_dataPH); /* << */ +} AEGP_TrackerUtilitySuite1; + + + +#define kAEGPRenderQueueMonitorSuite "AEGP RenderQueue Monitor Suite" +#define kAEGPRenderQueueMonitorSuiteVersion1 1 /* frozen AE 11.0 */ + +typedef struct _AEGP_RQM_Refcon *AEGP_RQM_Refcon; +typedef A_u_longlong AEGP_RQM_SessionId; +typedef A_u_longlong AEGP_RQM_ItemId; +typedef A_u_longlong AEGP_RQM_FrameId; + +typedef enum +{ + AEGP_RQM_FinishedStatus_UNKNOWN, + AEGP_RQM_FinishedStatus_SUCCEEDED, + AEGP_RQM_FinishedStatus_ABORTED, + AEGP_RQM_FinishedStatus_ERRED +} AEGP_RQM_FinishedStatus; + +typedef struct _AEGP_RQM_BasicData { + const struct SPBasicSuite *pica_basicP; + A_long aegp_plug_id; + AEGP_RQM_Refcon aegp_refconPV; +} AEGP_RQM_BasicData; + +typedef struct _AEGP_RQM_FunctionBlock1 { + A_Err (*AEGP_RQM_RenderJobStarted)(AEGP_RQM_BasicData *basic_dataP, AEGP_RQM_SessionId jobid); + A_Err (*AEGP_RQM_RenderJobEnded)(AEGP_RQM_BasicData *basic_dataP, AEGP_RQM_SessionId jobid); + A_Err (*AEGP_RQM_RenderJobItemStarted)(AEGP_RQM_BasicData *basic_dataP, AEGP_RQM_SessionId jobid, AEGP_RQM_ItemId itemid); + A_Err (*AEGP_RQM_RenderJobItemUpdated)(AEGP_RQM_BasicData *basic_dataP, AEGP_RQM_SessionId jobid, AEGP_RQM_ItemId itemid, AEGP_RQM_FrameId frameid); + A_Err (*AEGP_RQM_RenderJobItemEnded)(AEGP_RQM_BasicData *basic_dataP, AEGP_RQM_SessionId jobid, AEGP_RQM_ItemId itemid, AEGP_RQM_FinishedStatus fstatus); + A_Err (*AEGP_RQM_RenderJobItemReportLog)(AEGP_RQM_BasicData *basic_dataP, AEGP_RQM_SessionId jobid, AEGP_RQM_ItemId itemid, A_Boolean isError, AEGP_MemHandle logbuf); +} AEGP_RQM_FunctionBlock1; + +typedef struct AEGP_RenderQueueMonitorSuite1 { + + SPAPI A_Err (*AEGP_RegisterListener) ( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_RQM_Refcon aegp_refconP, /* >> */ + const AEGP_RQM_FunctionBlock1 * fcn_blockP); /* >> */ + + SPAPI A_Err (*AEGP_DeregisterListener) ( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_RQM_Refcon aegp_refconP); /* >> */ + + SPAPI A_Err (*AEGP_GetProjectName)( + AEGP_RQM_SessionId sessid, // >> + AEGP_MemHandle *utf_project_namePH0); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetAppVersion)( + AEGP_RQM_SessionId sessid, // >> + AEGP_MemHandle *utf_app_versionPH0); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetNumJobItems)( + AEGP_RQM_SessionId sessid, // >> + A_long *num_jobitemsPL); // << + + SPAPI A_Err (*AEGP_GetJobItemID)( + AEGP_RQM_SessionId sessid, // >> + A_long jobItemIndex, // >> + AEGP_RQM_ItemId *jobItemID); // << + + SPAPI A_Err (*AEGP_GetNumJobItemRenderSettings)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long *num_settingsPL); // << + + SPAPI A_Err (*AEGP_GetJobItemRenderSetting)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long settingIndex, // >> + AEGP_MemHandle *utf_setting_namePH0, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *utf_setting_valuePH0); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetNumJobItemOutputModules)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long *num_outputmodulesPL); // << + + SPAPI A_Err (*AEGP_GetNumJobItemOutputModuleSettings)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long outputModuleIndex, // >> + A_long *num_settingsPL); // << + + SPAPI A_Err (*AEGP_GetJobItemOutputModuleSetting)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long outputModuleIndex, // >> + A_long settingIndex, // >> + AEGP_MemHandle *utf_setting_namePH0, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *utf_setting_valuePH0); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetNumJobItemOutputModuleWarnings)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long outputModuleIndex, // >> + A_long *num_warningsPL); // << + + SPAPI A_Err (*AEGP_GetJobItemOutputModuleWarning)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long outputModuleIndex, // >> + A_long warningIndex, // >> + AEGP_MemHandle *utf_warning_valuePH0); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetNumJobItemFrameProperties)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + AEGP_RQM_FrameId frameid, // >> + A_long *num_propertiesPL); // << + + SPAPI A_Err (*AEGP_GetJobItemFrameProperty)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + AEGP_RQM_FrameId frameid, // >> + A_long propertyIndex, // >> + AEGP_MemHandle *utf_property_namePH0, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *utf_property_valuePH0);// << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetNumJobItemOutputModuleProperties)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long outputModuleIndex, // >> + A_long *num_propertiesPL); // << + + SPAPI A_Err (*AEGP_GetJobItemOutputModuleProperty)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + A_long outputModuleIndex, // >> + A_long propertyIndex, // >> + AEGP_MemHandle *utf_property_namePH0, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *utf_property_valuePH0);// << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetJobItemFrameThumbnail)( + AEGP_RQM_SessionId sessid, // >> + AEGP_RQM_ItemId itemid, // >> + AEGP_RQM_FrameId frameid, // >> + A_long *widthPL, // <> pass in the maximum width, returns the actual width + A_long *heightPL, // <> pass in the maximum height, returns the actual height + AEGP_MemHandle *thumbnailPH0); // << handle of an image memory block in JPEG format + +} AEGP_RenderQueueMonitorSuite1; + + + +/* -------------------------------------------------------------------- */ + +typedef const void *PF_ConstPtr; +typedef const PF_ConstPtr *PF_ConstHandle; + +#define kPFEffectSequenceDataSuite "PF Effect Sequence Data Suite" +#define kPFEffectSequenceDataSuiteVersion1 1 /* frozen in 18.2 */ + +typedef struct PF_EffectSequenceDataSuite1 { + + SPAPI PF_Err (*PF_GetConstSequenceData)( PF_ProgPtr effect_ref, + PF_ConstHandle *sequence_data); /* >> */ + +} PF_EffectSequenceDataSuite1; + + + + +#include + + +/****************************************************************/ +/* include old versions of the suites */ +/****************************************************************/ +#include + +#endif diff --git a/External/AE SDK/Headers/AE_GeneralPlugOld.h b/External/AE SDK/Headers/AE_GeneralPlugOld.h new file mode 100644 index 00000000..68bb8620 --- /dev/null +++ b/External/AE SDK/Headers/AE_GeneralPlugOld.h @@ -0,0 +1,9125 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +/*******************************************************************/ +/* */ +/* this file contains the old or deprecated versions of the suites */ +/* listed in AE_GeneralPlug.h */ +/*******************************************************************/ + + +#include + +typedef struct { // note: unused values are still stored in settings and used when cycling through + // the 3 types using cmd/ctrl-click on timecode + AEGP_TimeDisplayType time_display_type; + A_char timebaseC; // only used for AEGP_TimeDisplayType_TIMECODE, 1 to 100 + A_Boolean non_drop_30B; // only used for AEGP_TimeDisplayType_TIMECODE, + // when timebaseC == 30 && item framerate == 29.97, use drop frame or non-drop? + A_char frames_per_footC; // only used for AEGP_TimeDisplayType_FEET_AND_FRAMES + A_long starting_frameL; // usually 0 or 1, not used for AEGP_TimeDisplayType_TIMECODE +} AEGP_TimeDisplay; + +/** + ** Canvas Suite + ** Used by artisans to render layers + **/ + +#define kAEGPCanvasSuiteVersion1 4 /* frozen in AE 5.0 */ + +typedef struct AEGP_CanvasSuite1 { + + SPAPI A_Err (*AEGP_GetCompToRender)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumLayersToRender)( + const PR_RenderContextH render_contextH, + A_long *num_to_renderPL); + + + SPAPI A_Err (*AEGP_GetNthLayerContextToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n, /* >> */ + AEGP_RenderLayerContextH *layer_contextPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerContext)( + const PR_RenderContextH render_contextH, + AEGP_RenderLayerContextH layer_contextH, + AEGP_LayerH *layerPH); + + SPAPI A_Err (*AEGP_GetCompRenderTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *time, /* << */ + A_Time *time_step); + + SPAPI A_Err (*AEGP_GetCompDestinationBuffer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_CompH compH, /* >> */ + PF_EffectWorld *dst); /* <> */ + + SPAPI A_Err (*AEGP_GetROI)( + PR_RenderContextH render_contextH, /* <> */ + A_LegacyRect *roiPR); /* << */ + + /// for rendering track mattes + SPAPI A_Err (*AEGP_RenderLayer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + PF_EffectWorld *render_bufferP); /* >> */ + + // for rendering the texture map of a layer + SPAPI A_Err (*AEGP_RenderTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + PF_EffectWorld *dst); /* <> */ + + + SPAPI A_Err (*AEGP_DisposeTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + PF_EffectWorld *dst0); /* <> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + PR_RenderContextH render_contextH, /* >> */ + PF_Field *field); /* << */ + + // not thread safe on MacOS + // only call when thread ID = 0 + SPAPI A_Err (*AEGP_ReportArtisanProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long totalL); /* >> */ + + SPAPI A_Err (*AEGP_GetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_IsBlankCanvas)( + PR_RenderContextH render_contextH, /* >> */ + A_Boolean *is_blankPB); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerBounds)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_LegacyRect *boundsP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderOpacity)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_FpLong *opacityPF); /* << */ + + SPAPI A_Err (*AEGP_IsRenderLayerActive)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Boolean *activePB); /* << */ + + // set the layer index. If total > 0, set it too. + SPAPI A_Err (*AEGP_SetArtisanLayerProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long num_layersL); + +} AEGP_CanvasSuite1; + +/********************************************************************/ + +#define kAEGPRQItemSuiteVersion3 4 /* frozen in AE 7.0 */ + +typedef struct AEGP_RQItemSuite3 { + + SPAPI A_Err (*AEGP_GetNumRQItems)( + A_long *num_itemsPL); /* << */ + + /* NOTE: All AEGP_RQItemRefH are invalidated by ANY + re-ordering, addition or removal of render + items. DO NOT CACHE THEM. + */ + + SPAPI A_Err (*AEGP_GetRQItemByIndex)( + A_long rq_item_index, /* >> */ + AEGP_RQItemRefH *rq_item_refPH); /* << */ + + SPAPI A_Err (*AEGP_GetNextRQItem)( /* Pass RQ_ITEM_INDEX_NONE for current_rq_itemH to get first RQItemH. */ + AEGP_RQItemRefH current_rq_itemH, /* >> */ + AEGP_RQItemRefH *next_rq_itemH); /* << */ + + SPAPI A_Err (*AEGP_GetNumOutputModulesForRQItem)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_long *num_outmodsPL); /* << */ + + SPAPI A_Err (*AEGP_GetRenderState)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_RenderItemStatusType *statusP); /* << */ + + /* + the following now returns: + Err_PARAMETER if you try to call while AEGP_RenderQueueState != AEGP_RenderQueueState_STOPPED + + if that's okay then: + Err_RANGE if you pass a status that is illegal in any case + Err_PARAMETER if you try to pass a status that doesn't make sense right now (eg: trying to Que something for which you haven't set the output path) + */ + SPAPI A_Err (*AEGP_SetRenderState)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_RenderItemStatusType status); /* >> */ + + SPAPI A_Err (*AEGP_GetStartedTime)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_Time *started_timePT); /* << Returns {0,1} if not started. */ + + SPAPI A_Err (*AEGP_GetElapsedTime)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_Time *render_timePT); /* << Returns {0,1} if not rendered. */ + + SPAPI A_Err (*AEGP_GetLogType)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_LogType *logtypeP); /* << */ + + SPAPI A_Err (*AEGP_SetLogType)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_LogType logtype); /* << */ + + SPAPI A_Err (*AEGP_RemoveOutputModule)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH); /* >> */ + + SPAPI A_Err (*AEGP_GetComment)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_char *commentZ); /* << up to A_char[AEGP_MAX_RQITEM_COMMENT_SIZE] */ + + SPAPI A_Err (*AEGP_SetComment)( + AEGP_RQItemRefH rq_itemH, /* >> */ + const A_char *commentZ); /* >> up to A_char[AEGP_MAX_RQITEM_COMMENT_SIZE] */ + + SPAPI A_Err (*AEGP_GetCompFromRQItem)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_DeleteRQItem)( + AEGP_RQItemRefH rq_itemH); /* <> UNDOABLE */ + +} AEGP_RQItemSuite3; + +#define kAEGPRQItemSuiteVersion2 3 /* frozen in AE 6.5 */ + +typedef struct AEGP_RQItemSuite2 { + + SPAPI A_Err (*AEGP_GetNumRQItems)( + A_long *num_itemsPL); /* << */ + + /* NOTE: All AEGP_RQItemRefH are invalidated by ANY + re-ordering, addition or removal of render + items. DO NOT CACHE THEM. + */ + + SPAPI A_Err (*AEGP_GetRQItemByIndex)( + A_long rq_item_index, /* >> */ + AEGP_RQItemRefH *rq_item_refPH); /* << */ + + SPAPI A_Err (*AEGP_GetNextRQItem)( /* Pass NULL for current_rq_itemH to get first RQItemH. */ + AEGP_RQItemRefH current_rq_itemH, /* >> */ + AEGP_RQItemRefH *next_rq_itemH); /* << */ + + SPAPI A_Err (*AEGP_GetNumOutputModulesForRQItem)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_long *num_outmodsPL); /* << */ + + SPAPI A_Err (*AEGP_GetRenderState)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_RenderItemStatusType *statusP); /* << */ + + /* + the following now returns: + Err_PARAMETER if you try to call while AEGP_RenderQueueState != AEGP_RenderQueueState_STOPPED + + if that's okay then: + Err_RANGE if you pass a status that is illegal in any case + Err_PARAMETER if you try to pass a status that doesn't make sense right now (eg: trying to Que something for which you haven't set the output path) + */ + SPAPI A_Err (*AEGP_SetRenderState)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_RenderItemStatusType status); /* >> */ + + SPAPI A_Err (*AEGP_GetStartedTime)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_Time *started_timePT); /* << Returns {0,1} if not started. */ + + SPAPI A_Err (*AEGP_GetElapsedTime)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_Time *render_timePT); /* << Returns {0,1} if not rendered. */ + + SPAPI A_Err (*AEGP_GetLogType)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_LogType *logtypeP); /* << */ + + SPAPI A_Err (*AEGP_SetLogType)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_LogType logtype); /* << */ + + SPAPI A_Err (*AEGP_RemoveOutputModule)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH); /* >> */ + + SPAPI A_Err (*AEGP_GetComment)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_char *commentZ); /* << up to A_char[AEGP_MAX_RQITEM_COMMENT_SIZE] */ + + SPAPI A_Err (*AEGP_SetComment)( + AEGP_RQItemRefH rq_itemH, /* >> */ + const A_char *commentZ); /* >> up to A_char[AEGP_MAX_RQITEM_COMMENT_SIZE] */ + + SPAPI A_Err (*AEGP_GetCompFromRQItem)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + +} AEGP_RQItemSuite2; + +#define kAEGPRQItemSuiteVersion1 1 /* frozen in AE 6.0 */ + +typedef struct AEGP_RQItemSuite1 { + + SPAPI A_Err (*AEGP_GetNumRQItems)( + A_long *num_itemsPL); /* << */ + + /* NOTE: All AEGP_RQItemRefH are invalidated by ANY + re-ordering, addition or removal of render + items. DO NOT CACHE THEM. + */ + + SPAPI A_Err (*AEGP_GetRQItemByIndex)( + A_long rq_item_index, /* >> */ + AEGP_RQItemRefH *rq_item_refPH); /* << */ + + SPAPI A_Err (*AEGP_GetNextRQItem)( /* Pass NULL for current_rq_itemH to get first RQItemH. */ + AEGP_RQItemRefH current_rq_itemH, /* >> */ + AEGP_RQItemRefH *next_rq_itemH); /* << */ + + SPAPI A_Err (*AEGP_GetNumOutputModulesForRQItem)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_long *num_outmodsPL); /* << */ + + SPAPI A_Err (*AEGP_GetRenderState)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_RenderItemStatusType *statusP); /* << */ + + SPAPI A_Err (*AEGP_SetRenderState)( /* Will return error if called while (AEGP_RenderQueueState != AEGP_RenderQueueState_STOPPED). */ + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_RenderItemStatusType status); /* >> */ + + SPAPI A_Err (*AEGP_GetStartedTime)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_Time *started_timePT); /* << Returns {0,0} if not started. */ + + SPAPI A_Err (*AEGP_GetElapsedTime)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_Time *render_timePT); /* << Returns {0,0} if not rendered. */ + + SPAPI A_Err (*AEGP_GetLogType)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_LogType *logtypeP); /* << */ + + SPAPI A_Err (*AEGP_SetLogType)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_LogType logtype); /* << */ + + SPAPI A_Err (*AEGP_RemoveOutputModule)( + AEGP_RQItemRefH rq_itemH, /* >> */ + AEGP_OutputModuleRefH outmodH); /* >> */ + + SPAPI A_Err (*AEGP_GetComment)( + AEGP_RQItemRefH rq_itemH, /* >> */ + A_char *commentZ); /* << up to A_char[AEGP_MAX_RQITEM_COMMENT_SIZE] */ + + SPAPI A_Err (*AEGP_SetComment)( + AEGP_RQItemRefH rq_itemH, /* >> */ + const A_char *commentZ); /* >> up to A_char[AEGP_MAX_RQITEM_COMMENT_SIZE] */ + +} AEGP_RQItemSuite1; + + + +#define kAEGPCanvasSuiteVersion2 6 /* frozen in AE 5.5 */ + +typedef struct AEGP_CanvasSuite2 { + + SPAPI A_Err (*AEGP_GetCompToRender)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumLayersToRender)( + const PR_RenderContextH render_contextH, + A_long *num_to_renderPL); + + + SPAPI A_Err (*AEGP_GetNthLayerContextToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n, /* >> */ + AEGP_RenderLayerContextH *layer_contextPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerContext)( + const PR_RenderContextH render_contextH, + AEGP_RenderLayerContextH layer_contextH, + AEGP_LayerH *layerPH); + + /** + ** With collapsed geometrics "on" this gives the layer in the root comp + ** contining the layer context. With collapsed geometrics off + ** this is the same as AEGP_GetLayerFromLayerContext. + ** + **/ + SPAPI A_Err (*AEGP_GetTopLayerFromLayerContext)( + const PR_RenderContextH render_contextH, + AEGP_RenderLayerContextH layer_contextH, + AEGP_LayerH *layerPH); + + SPAPI A_Err (*AEGP_GetCompRenderTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *time, /* << */ + A_Time *time_step); + + SPAPI A_Err (*AEGP_GetCompDestinationBuffer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_CompH compH, /* >> */ + PF_EffectWorld *dst); /* <> */ + + SPAPI A_Err (*AEGP_GetROI)( + PR_RenderContextH render_contextH, /* <> */ + A_LegacyRect *roiPR); /* << */ + + /// for rendering track mattes + SPAPI A_Err (*AEGP_RenderLayer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + PF_EffectWorld *render_bufferP); /* >> */ + + // for rendering the texture map of a layer + SPAPI A_Err (*AEGP_RenderTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + PF_EffectWorld *dst); /* <> */ + + + SPAPI A_Err (*AEGP_DisposeTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + PF_EffectWorld *dst0); /* <> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + PR_RenderContextH render_contextH, /* >> */ + PF_Field *field); /* << */ + + // not thread safe on MacOS + // only call when thread ID = 0 + SPAPI A_Err (*AEGP_ReportArtisanProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long totalL); /* >> */ + + SPAPI A_Err (*AEGP_GetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_IsBlankCanvas)( + PR_RenderContextH render_contextH, /* >> */ + A_Boolean *is_blankPB); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerBounds)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_LegacyRect *boundsP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderOpacity)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_FpLong *opacityPF); /* << */ + + SPAPI A_Err (*AEGP_IsRenderLayerActive)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Boolean *activePB); /* << */ + + // set the layer index. If total > 0, set it too. + SPAPI A_Err (*AEGP_SetArtisanLayerProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long num_layersL); + + SPAPI A_Err (*AEGP_RenderLayerPlus)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + PF_EffectWorld *render_bufferP); /* << */ + + + SPAPI A_Err (*AEGP_GetTrackMatteContext)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH fill_contextH, /* << */ + AEGP_RenderLayerContextH *matte_contextPH); /* >> */ + +} AEGP_CanvasSuite2; + + + +#define kAEGPCanvasSuiteVersion4 9 /* frozen AE 6.0 */ + +typedef struct AEGP_CanvasSuite4 { + + SPAPI A_Err (*AEGP_GetCompToRender)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumLayersToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_GetNthLayerContextToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n, /* >> */ + AEGP_RenderLayerContextH *layer_contextPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerContext)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + /** + ** With collapsed geometrics "on" this gives the layer in the root comp + ** contining the layer context. With collapsed geometrics off + ** this is the same as AEGP_GetLayerFromLayerContext. + ** + **/ + SPAPI A_Err (*AEGP_GetTopLayerFromLayerContext)( + const PR_RenderContextH render_contextH, + AEGP_RenderLayerContextH layer_contextH, + AEGP_LayerH *layerPH); + + SPAPI A_Err (*AEGP_GetCompRenderTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *time, /* << */ + A_Time *time_step); + + SPAPI A_Err (*AEGP_GetCompDestinationBuffer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_CompH compH, /* >> */ + AEGP_WorldH *dst); /* << */ + + SPAPI A_Err (*AEGP_GetROI)( + PR_RenderContextH render_contextH, /* <> */ + A_LegacyRect *roiPR); /* << */ + + // for rendering the texture map of a layer + SPAPI A_Err (*AEGP_RenderTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_WorldH *dstPH); /* <> */ + + + SPAPI A_Err (*AEGP_DisposeTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_WorldH dstH0); /* <> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + PR_RenderContextH render_contextH, /* >> */ + PF_Field *field); /* << */ + + // not thread safe on MacOS + // only call when thread ID = 0 + SPAPI A_Err (*AEGP_ReportArtisanProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long totalL); /* >> */ + + SPAPI A_Err (*AEGP_GetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_IsBlankCanvas)( + PR_RenderContextH render_contextH, /* >> */ + A_Boolean *is_blankPB); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerBounds)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_LegacyRect *boundsP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderOpacity)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_FpLong *opacityPF); /* << */ + + SPAPI A_Err (*AEGP_IsRenderLayerActive)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Boolean *activePB); /* << */ + + // set the layer index. If total > 0, set it too. + SPAPI A_Err (*AEGP_SetArtisanLayerProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long num_layersL); + + // for track mattes. + // Returns a comp-size buffer, which must be disposed thru AEGP_Dispose in World suite + SPAPI A_Err (*AEGP_RenderLayerPlus)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_WorldH *render_bufferPH); /* << must be disposed with AEGP_DisposeWorld */ + + + SPAPI A_Err (*AEGP_GetTrackMatteContext)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH fill_contextH, /* << */ + AEGP_RenderLayerContextH *matte_contextPH); /* >> */ + + // new for 6.0 --get receipt with the returned texture + // use receipt to determine if a subsequent call to render + // this layer can be skipped (because the artisan cached it) + SPAPI A_Err (*AEGP_RenderTextureWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *dstPH); /* << */ + + SPAPI A_Err (*AEGP_RenderLayerPlusWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *render_bufferPH); /* << */ + + SPAPI A_Err (*AEGP_DisposeRenderReceipt)( + AEGP_RenderReceiptH render_receiptH); /* >> */ + + + SPAPI A_Err (*AEGP_CheckRenderReceipt)( + PR_RenderContextH current_render_contextH, /* >> */ + AEGP_RenderLayerContextH current_layer_contextH, /* >> */ + AEGP_RenderReceiptH old_render_receiptH, /* >> */ + A_Boolean check_aceB, /* >> */ + AEGP_RenderReceiptStatus *receipt_statusP); /* << */ + + + SPAPI A_Err (*AEGP_GetNumBinsToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_bins_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_SetNthBin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n); /* >> */ + + SPAPI A_Err (*AEGP_GetBinType)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_BinType *bin_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform2D3D)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Boolean only_2dB, /* >> */ + A_Matrix4 *transform); /* << */ + + + // interactive artisan information + // handle to the on-screen window + SPAPI A_Err (*AEGP_GetPlatformWindowRef)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_PlatformWindowRef *window_refP); /* << */ + + + // the dsf src to frame scale factors + SPAPI A_Err (*AEGP_GetViewportScale)( + const PR_RenderContextH render_contextH, /* >> */ + A_FpLong *scale_xPF, /* << */ + A_FpLong *scale_yPF); /* << */ + + + // the dsf src to frame translate + SPAPI A_Err (*AEGP_GetViewportOrigin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *origin_xPL, /* << */ + A_long *origin_yPL); /* << */ + + + SPAPI A_Err (*AEGP_GetViewportRect)( + const PR_RenderContextH render_contextH, /* >> */ + A_LegacyRect *viewport_rectPR); /* << */ + + + SPAPI A_Err (*AEGP_GetFallowColor)( + const PR_RenderContextH render_contextH, /* >> */ + PF_Pixel8 *fallow_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboard)( + const PR_RenderContextH render_contextH, /* in */ + A_Boolean *checkerboard_onPB);/* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardColors)( + const PR_RenderContextH render_contextH, /* in */ + PF_Pixel *checkerboard_color1P, /* out */ + PF_Pixel *checkerboard_color2P); /* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardSize)( + const PR_RenderContextH render_contextH, /* in */ + A_u_long *checkerboard_widthPLu, /* out - width of square*/ + A_u_long *checkerboard_heightPLu); /* out - height of square*/ + + SPAPI A_Err (*AEGP_GetInteractiveCachedBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + + // should we call AEGP_RenderLayer or AEGP_RenderTexture + SPAPI A_Err (*AEGP_ArtisanMustRenderAsLayer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, + A_Boolean *use_render_texturePB); + +} AEGP_CanvasSuite4; + + + +#define kAEGPCanvasSuiteVersion5 10 /* frozen in AE 6.5 */ + +typedef struct AEGP_CanvasSuite5 { + + SPAPI A_Err (*AEGP_GetCompToRender)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumLayersToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_GetNthLayerContextToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n, /* >> */ + AEGP_RenderLayerContextH *layer_contextPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerContext)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + /** + ** With collapsed geometrics "on" this gives the layer in the root comp + ** contining the layer context. With collapsed geometrics off + ** this is the same as AEGP_GetLayerFromLayerContext. + ** + **/ + SPAPI A_Err (*AEGP_GetTopLayerFromLayerContext)( + const PR_RenderContextH render_contextH, + AEGP_RenderLayerContextH layer_contextH, + AEGP_LayerH *layerPH); + + SPAPI A_Err (*AEGP_GetCompRenderTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *time, /* << */ + A_Time *time_step); + + SPAPI A_Err (*AEGP_GetCompDestinationBuffer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_CompH compH, /* >> */ + AEGP_WorldH *dst); /* << */ + + SPAPI A_Err (*AEGP_GetROI)( + PR_RenderContextH render_contextH, /* <> */ + A_LegacyRect *roiPR); /* << */ + + // for rendering the texture map of a layer + SPAPI A_Err (*AEGP_RenderTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_WorldH *dstPH); /* <> */ + + + SPAPI A_Err (*AEGP_DisposeTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_WorldH dstH0); /* <> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + PR_RenderContextH render_contextH, /* >> */ + PF_Field *field); /* << */ + + // not thread safe on MacOS + // only call when thread ID = 0 + SPAPI A_Err (*AEGP_ReportArtisanProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long totalL); /* >> */ + + SPAPI A_Err (*AEGP_GetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_IsBlankCanvas)( + PR_RenderContextH render_contextH, /* >> */ + A_Boolean *is_blankPB); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerBounds)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_LegacyRect *boundsP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderOpacity)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_FpLong *opacityPF); /* << */ + + SPAPI A_Err (*AEGP_IsRenderLayerActive)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Boolean *activePB); /* << */ + + // set the layer index. If total > 0, set it too. + SPAPI A_Err (*AEGP_SetArtisanLayerProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long num_layersL); + + // for track mattes. + // Returns a comp-size buffer, which must be disposed thru AEGP_Dispose in World suite + SPAPI A_Err (*AEGP_RenderLayerPlus)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_WorldH *render_bufferPH); /* << must be disposed with AEGP_DisposeWorld */ + + + SPAPI A_Err (*AEGP_GetTrackMatteContext)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH fill_contextH, /* << */ + AEGP_RenderLayerContextH *matte_contextPH); /* >> */ + + // new for 6.0 --get receipt with the returned texture + // use receipt to determine if a subsequent call to render + // this layer can be skipped (because the artisan cached it) + SPAPI A_Err (*AEGP_RenderTextureWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *dstPH); /* << */ + + SPAPI A_Err (*AEGP_RenderLayerPlusWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *render_bufferPH); /* << */ + + SPAPI A_Err (*AEGP_DisposeRenderReceipt)( + AEGP_RenderReceiptH render_receiptH); /* >> */ + + + SPAPI A_Err (*AEGP_CheckRenderReceipt)( + PR_RenderContextH current_render_contextH, /* >> */ + AEGP_RenderLayerContextH current_layer_contextH, /* >> */ + AEGP_RenderReceiptH old_render_receiptH, /* >> */ + A_Boolean check_geometricsB, /* >> */ + AEGP_RenderReceiptStatus *receipt_statusP); /* << */ + + + SPAPI A_Err (*AEGP_GetNumBinsToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_bins_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_SetNthBin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n); /* >> */ + + SPAPI A_Err (*AEGP_GetBinType)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_BinType *bin_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform2D3D)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Boolean only_2dB, /* >> */ + A_Matrix4 *transform); /* << */ + + + // interactive artisan information + // handle to the on-screen window + SPAPI A_Err (*AEGP_GetPlatformWindowRef)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_PlatformWindowRef *window_refP); /* << */ + + + // the dsf src to frame scale factors + SPAPI A_Err (*AEGP_GetViewportScale)( + const PR_RenderContextH render_contextH, /* >> */ + A_FpLong *scale_xPF, /* << */ + A_FpLong *scale_yPF); /* << */ + + + // the dsf src to frame translate + SPAPI A_Err (*AEGP_GetViewportOrigin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *origin_xPL, /* << */ + A_long *origin_yPL); /* << */ + + + SPAPI A_Err (*AEGP_GetViewportRect)( + const PR_RenderContextH render_contextH, /* >> */ + A_LegacyRect *viewport_rectPR); /* << */ + + + SPAPI A_Err (*AEGP_GetFallowColor)( + const PR_RenderContextH render_contextH, /* >> */ + PF_Pixel8 *fallow_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboard)( + const PR_RenderContextH render_contextH, /* in */ + A_Boolean *checkerboard_onPB);/* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardColors)( + const PR_RenderContextH render_contextH, /* in */ + PF_Pixel *checkerboard_color1P, /* out */ + PF_Pixel *checkerboard_color2P); /* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardSize)( + const PR_RenderContextH render_contextH, /* in */ + A_u_long *checkerboard_widthPLu, /* out - width of square*/ + A_u_long *checkerboard_heightPLu); /* out - height of square*/ + + SPAPI A_Err (*AEGP_GetInteractiveCachedBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + + // should we call AEGP_RenderLayer or AEGP_RenderTexture + SPAPI A_Err (*AEGP_ArtisanMustRenderAsLayer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, + A_Boolean *use_render_texturePB); + + + SPAPI A_Err (*AEGP_GetInteractiveDisplayChannel)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_DisplayChannelType *display_channelP); /* << */ + +} AEGP_CanvasSuite5; + + +#define kAEGPCanvasSuiteVersion6 11 /* frozen in AE 7.0 */ + +typedef struct AEGP_CanvasSuite6 { + + SPAPI A_Err (*AEGP_GetCompToRender)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumLayersToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_GetNthLayerContextToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n, /* >> */ + AEGP_RenderLayerContextH *layer_contextPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerContext)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + /** + ** With collapsed geometrics "on" this gives the layer in the root comp + ** contining the layer context. With collapsed geometrics off + ** this is the same as AEGP_GetLayerFromLayerContext. + ** + **/ + SPAPI A_Err (*AEGP_GetTopLayerFromLayerContext)( + const PR_RenderContextH render_contextH, + AEGP_RenderLayerContextH layer_contextH, + AEGP_LayerH *layerPH); + + SPAPI A_Err (*AEGP_GetCompRenderTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *time, /* << */ + A_Time *time_step); + + SPAPI A_Err (*AEGP_GetCompDestinationBuffer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_CompH compH, /* >> */ + AEGP_WorldH *dst); /* << */ + + SPAPI A_Err (*AEGP_GetROI)( + PR_RenderContextH render_contextH, /* <> */ + A_LegacyRect *roiPR); /* << */ + + // for rendering the texture map of a layer + SPAPI A_Err (*AEGP_RenderTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_WorldH *dstPH); /* <> */ + + + SPAPI A_Err (*AEGP_DisposeTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_WorldH dstH0); /* <> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + PR_RenderContextH render_contextH, /* >> */ + PF_Field *field); /* << */ + + // not thread safe on MacOS + // only call when thread ID = 0 + SPAPI A_Err (*AEGP_ReportArtisanProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long totalL); /* >> */ + + SPAPI A_Err (*AEGP_GetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_IsBlankCanvas)( + PR_RenderContextH render_contextH, /* >> */ + A_Boolean *is_blankPB); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerBounds)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_LegacyRect *boundsP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderOpacity)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_FpLong *opacityPF); /* << */ + + SPAPI A_Err (*AEGP_IsRenderLayerActive)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Boolean *activePB); /* << */ + + // set the layer index. If total > 0, set it too. + SPAPI A_Err (*AEGP_SetArtisanLayerProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long num_layersL); + + // for track mattes. + // Returns a comp-size buffer, which must be disposed thru AEGP_Dispose in World suite + SPAPI A_Err (*AEGP_RenderLayerPlus)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_WorldH *render_bufferPH); /* << must be disposed with AEGP_DisposeWorld */ + + + SPAPI A_Err (*AEGP_GetTrackMatteContext)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH fill_contextH, /* << */ + AEGP_RenderLayerContextH *matte_contextPH); /* >> */ + + // new for 6.0 --get receipt with the returned texture + // use receipt to determine if a subsequent call to render + // this layer can be skipped (because the artisan cached it) + SPAPI A_Err (*AEGP_RenderTextureWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_NumEffectsToRenderType num_effectsS, /* >> number of effect to render, -1 for all */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *dstPH); /* << */ + + + + SPAPI A_Err (*AEGP_GetNumberOfSoftwareEffects)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + A_short *num_software_effectsPS); + + SPAPI A_Err (*AEGP_RenderLayerPlusWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *render_bufferPH); /* << */ + + SPAPI A_Err (*AEGP_DisposeRenderReceipt)( + AEGP_RenderReceiptH render_receiptH); /* >> */ + + + /* modified for 7.0 - added num_effects to check against */ + SPAPI A_Err (*AEGP_CheckRenderReceipt)( + PR_RenderContextH current_render_contextH, /* in */ + AEGP_RenderLayerContextH current_layer_contextH, /* in */ + AEGP_RenderReceiptH old_render_receiptH, /* in */ + A_Boolean check_geometricsB, /* in */ + AEGP_NumEffectsToRenderType num_effectsS, /* in */ + AEGP_RenderReceiptStatus *receipt_statusP); /* out */ + + + /* new in 7.0 generate a receipt for a layer as asd if the first num_effectsS have been rendered */ + SPAPI A_Err (*AEGP_GenerateRenderReceipt)( + PR_RenderContextH current_render_contextH, /* >> */ + AEGP_RenderLayerContextH current_layer_contextH, /* >> */ + AEGP_NumEffectsToRenderType num_effectsS, /* in */ + AEGP_RenderReceiptH *render_receiptPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumBinsToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_bins_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_SetNthBin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n); /* >> */ + + SPAPI A_Err (*AEGP_GetBinType)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_BinType *bin_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform2D3D)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Boolean only_2dB, /* >> */ + A_Matrix4 *transform); /* << */ + + + // interactive artisan information + // handle to the on-screen window + SPAPI A_Err (*AEGP_GetPlatformWindowRef)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_PlatformWindowRef *window_refP); /* << */ + + + // the dsf src to frame scale factors + SPAPI A_Err (*AEGP_GetViewportScale)( + const PR_RenderContextH render_contextH, /* >> */ + A_FpLong *scale_xPF, /* << */ + A_FpLong *scale_yPF); /* << */ + + + // the dsf src to frame translate + SPAPI A_Err (*AEGP_GetViewportOrigin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *origin_xPL, /* << */ + A_long *origin_yPL); /* << */ + + + SPAPI A_Err (*AEGP_GetViewportRect)( + const PR_RenderContextH render_contextH, /* >> */ + A_LegacyRect *viewport_rectPR); /* << */ + + + SPAPI A_Err (*AEGP_GetFallowColor)( + const PR_RenderContextH render_contextH, /* >> */ + PF_Pixel8 *fallow_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboard)( + const PR_RenderContextH render_contextH, /* in */ + A_Boolean *checkerboard_onPB);/* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardColors)( + const PR_RenderContextH render_contextH, /* in */ + PF_Pixel *checkerboard_color1P, /* out */ + PF_Pixel *checkerboard_color2P); /* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardSize)( + const PR_RenderContextH render_contextH, /* in */ + A_u_long *checkerboard_widthPLu, /* out - width of square*/ + A_u_long *checkerboard_heightPLu); /* out - height of square*/ + + SPAPI A_Err (*AEGP_GetInteractiveCachedBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + + // should we call AEGP_RenderLayer or AEGP_RenderTexture + SPAPI A_Err (*AEGP_ArtisanMustRenderAsLayer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, + A_Boolean *use_render_texturePB); + + + SPAPI A_Err (*AEGP_GetInteractiveDisplayChannel)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_DisplayChannelType *display_channelP); /* << */ + + +} AEGP_CanvasSuite6; + + + +#define kAEGPCanvasSuiteVersion7 13 /* frozen in AE 8.0, source code-compatible additions in 64-bit AE 10.0*/ + +typedef struct AEGP_CanvasSuite7 { + + SPAPI A_Err (*AEGP_GetCompToRender)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumLayersToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_GetNthLayerContextToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n, /* >> */ + AEGP_RenderLayerContextH *layer_contextPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerContext)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerAndSubLayerFromLayerContext)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_LayerH *layerPH, /* << */ + AEGP_SubLayerIndex *sublayerP); /* << */ + + /** + ** With collapsed geometrics "on" this gives the layer in the root comp + ** contining the layer context. With collapsed geometrics off + ** this is the same as AEGP_GetLayerFromLayerContext. + ** + **/ + SPAPI A_Err (*AEGP_GetTopLayerFromLayerContext)( + const PR_RenderContextH render_contextH, + AEGP_RenderLayerContextH layer_contextH, + AEGP_LayerH *layerPH); + + SPAPI A_Err (*AEGP_GetCompRenderTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *time, /* << */ + A_Time *time_step); + + SPAPI A_Err (*AEGP_GetCompDestinationBuffer)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_CompH compH, /* >> */ + AEGP_WorldH *dst); /* << */ + + SPAPI A_Err (*AEGP_GetROI)( + PR_RenderContextH render_contextH, /* <> */ + A_LegacyRect *roiPR); /* << */ + + // for rendering the texture map of a layer + SPAPI A_Err (*AEGP_RenderTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_WorldH *dstPH); /* <> */ + + + SPAPI A_Err (*AEGP_DisposeTexture)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_WorldH dstH0); /* <> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + PR_RenderContextH render_contextH, /* >> */ + PF_Field *field); /* << */ + + // not thread safe on MacOS + // only call when thread ID = 0 + SPAPI A_Err (*AEGP_ReportArtisanProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long totalL); /* >> */ + + SPAPI A_Err (*AEGP_GetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetRenderDownsampleFactor)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_IsBlankCanvas)( + PR_RenderContextH render_contextH, /* >> */ + A_Boolean *is_blankPB); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerBounds)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_LegacyRect *boundsP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderOpacity)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_FpLong *opacityPF); /* << */ + + SPAPI A_Err (*AEGP_IsRenderLayerActive)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Boolean *activePB); /* << */ + + // set the layer index. If total > 0, set it too. + SPAPI A_Err (*AEGP_SetArtisanLayerProgress)( + PR_RenderContextH render_contextH, /* >> */ + A_long countL, /* >> */ + A_long num_layersL); + + // for track mattes. + // Returns a comp-size buffer, which must be disposed thru AEGP_Dispose in World suite + SPAPI A_Err (*AEGP_RenderLayerPlus)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_WorldH *render_bufferPH); /* << must be disposed with AEGP_DisposeWorld */ + + + SPAPI A_Err (*AEGP_GetTrackMatteContext)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH fill_contextH, /* << */ + AEGP_RenderLayerContextH *matte_contextPH); /* >> */ + + // new for 6.0 --get receipt with the returned texture + // use receipt to determine if a subsequent call to render + // this layer can be skipped (because the artisan cached it) + SPAPI A_Err (*AEGP_RenderTextureWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_NumEffectsToRenderType num_effectsS, /* >> number of effect to render, -1 for all */ + A_FloatPoint *suggested_scaleP0, /* >> */ + A_FloatRect *suggested_src_rectP0, /* >> */ + A_Matrix3 *src_matrixP0, /* << */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *dstPH); /* << */ + + + + SPAPI A_Err (*AEGP_GetNumberOfSoftwareEffects)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + A_short *num_software_effectsPS); + + SPAPI A_Err (*AEGP_RenderLayerPlusWithReceipt)( + PR_RenderContextH render_contextH, /* <> */ + AEGP_LayerH layerH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + AEGP_RenderHints render_hints, /* >> */ + AEGP_RenderReceiptH *render_receiptPH, /* << must be disposed with AEGP_DisposeRenderReceipt */ + AEGP_WorldH *render_bufferPH); /* << */ + + SPAPI A_Err (*AEGP_DisposeRenderReceipt)( + AEGP_RenderReceiptH render_receiptH); /* >> */ + + + /* modified for 7.0 - added num_effects to check against */ + SPAPI A_Err (*AEGP_CheckRenderReceipt)( + PR_RenderContextH current_render_contextH, /* in */ + AEGP_RenderLayerContextH current_layer_contextH, /* in */ + AEGP_RenderReceiptH old_render_receiptH, /* in */ + A_Boolean check_geometricsB, /* in */ + AEGP_NumEffectsToRenderType num_effectsS, /* in */ + AEGP_RenderReceiptStatus *receipt_statusP); /* out */ + + + /* new in 7.0 generate a receipt for a layer as asd if the first num_effectsS have been rendered */ + SPAPI A_Err (*AEGP_GenerateRenderReceipt)( + PR_RenderContextH current_render_contextH, /* >> */ + AEGP_RenderLayerContextH current_layer_contextH, /* >> */ + AEGP_NumEffectsToRenderType num_effectsS, /* in */ + AEGP_RenderReceiptH *render_receiptPH); /* << */ + + SPAPI A_Err (*AEGP_GetNumBinsToRender)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *num_bins_to_renderPL); /* << */ + + + SPAPI A_Err (*AEGP_SetNthBin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long n); /* >> */ + + SPAPI A_Err (*AEGP_GetBinType)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_BinType *bin_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderLayerToWorldXform2D3D)( + PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Boolean only_2dB, /* >> */ + A_Matrix4 *transform); /* << */ + + + // interactive artisan information + // handle to the on-screen window + SPAPI A_Err (*AEGP_GetPlatformWindowRef)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_PlatformWindowRef *window_refP); /* << */ + + + // the dsf src to frame scale factors + SPAPI A_Err (*AEGP_GetViewportScale)( + const PR_RenderContextH render_contextH, /* >> */ + A_FpLong *scale_xPF, /* << */ + A_FpLong *scale_yPF); /* << */ + + + // the dsf src to frame translate + SPAPI A_Err (*AEGP_GetViewportOrigin)( + const PR_RenderContextH render_contextH, /* >> */ + A_long *origin_xPL, /* << */ + A_long *origin_yPL); /* << */ + + + SPAPI A_Err (*AEGP_GetViewportRect)( + const PR_RenderContextH render_contextH, /* >> */ + A_LegacyRect *viewport_rectPR); /* << */ + + + SPAPI A_Err (*AEGP_GetFallowColor)( + const PR_RenderContextH render_contextH, /* >> */ + PF_Pixel8 *fallow_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboard)( + const PR_RenderContextH render_contextH, /* in */ + A_Boolean *checkerboard_onPB);/* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardColors)( + const PR_RenderContextH render_contextH, /* in */ + PF_Pixel *checkerboard_color1P, /* out */ + PF_Pixel *checkerboard_color2P); /* out */ + + SPAPI A_Err (*AEGP_GetInteractiveCheckerboardSize)( + const PR_RenderContextH render_contextH, /* in */ + A_u_long *checkerboard_widthPLu, /* out - width of square*/ + A_u_long *checkerboard_heightPLu); /* out - height of square*/ + + SPAPI A_Err (*AEGP_GetInteractiveCachedBuffer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_WorldH *buffer); /* << */ + + + // should we call AEGP_RenderLayer or AEGP_RenderTexture + SPAPI A_Err (*AEGP_ArtisanMustRenderAsLayer)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_RenderLayerContextH layer_contextH, + A_Boolean *use_render_texturePB); + + + SPAPI A_Err (*AEGP_GetInteractiveDisplayChannel)( + const PR_RenderContextH render_contextH, /* >> */ + AEGP_DisplayChannelType *display_channelP); /* << */ + + SPAPI A_Err (*AEGP_GetInteractiveExposure)( + const PR_RenderContextH render_contextH, /* >> */ + A_FpLong *exposurePF); /* << */ + + + SPAPI A_Err (*AEGP_GetColorTransform)( + const PR_RenderContextH render_contextH, /* >> */ + A_Boolean *cms_onB, + A_u_long *xform_keyLu, + void *xformP); + + + SPAPI A_Err (*AEGP_GetCompShutterTime)( + PR_RenderContextH render_contextH, /* >> */ + A_Time *shutter_time, /* << */ + A_Time *shutter_dur); + +} AEGP_CanvasSuite7; + + + + +#define kAEGPMaskOutlineSuite "AEGP Mask Outline Suite" +#define kAEGPMaskOutlineSuiteVersion2 3 /* frozen in AE 5.5 */ + +typedef struct AEGP_MaskOutlineSuite2 { + + SPAPI A_Err (*AEGP_IsMaskOutlineOpen)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_Boolean *openPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskOutlineOpen)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_Boolean openB); /* >> */ + + // N segments means there are segments [0..N-1]; segment J is defined by vertex J & J+1 + SPAPI A_Err (*AEGP_GetMaskOutlineNumSegments)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_long *num_segmentsPL); /* << */ + + // which_pointL range: [0..num_segments]; for closed masks vertex[0] == vertex[num_segments] + SPAPI A_Err (*AEGP_GetMaskOutlineVertexInfo)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex which_pointL, /* >> */ + AEGP_MaskVertex *vertexP); /* << tangents are relative to position */ + + // Setting vertex 0 is special. Its in tangent will actually set the out tangent + // of the last vertex in the outline. + SPAPI A_Err (*AEGP_SetMaskOutlineVertexInfo)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex which_pointL, /* >> must already exists (use Create) */ + const AEGP_MaskVertex *vertexP); /* >> tangents are relative to position */ + + SPAPI A_Err (*AEGP_CreateVertex)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex insert_position); /* >> will insert at this index. moving other verticies index++*/ + + SPAPI A_Err (*AEGP_DeleteVertex)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex index); /* >> */ + +} AEGP_MaskOutlineSuite2; + +#define kAEGPMaskOutlineSuiteVersion1 2 /* frozen in AE 5.0 */ + +typedef struct AEGP_MaskOutlineSuite1 { + + SPAPI A_Err (*AEGP_IsMaskOutlineOpen)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_Boolean *openPB); /* << */ + + // N segments means there are segments [0..N-1]; segment J is defined by vertex J & J+1 + SPAPI A_Err (*AEGP_GetMaskOutlineNumSegments)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + A_long *num_segmentsPL); /* << */ + + // which_pointL range: [0..num_segments]; for closed masks vertex[0] == vertex[num_segments] + SPAPI A_Err (*AEGP_GetMaskOutlineVertexInfo)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex which_pointL, /* >> */ + AEGP_MaskVertex *vertexP); /* << tangents are relative to position */ + + // Setting vertex 0 is special. Its in tangent will actually set the out tangent + // of the last vertex in the outline. + SPAPI A_Err (*AEGP_SetMaskOutlineVertexInfo)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex which_pointL, /* >> must already exists (use Create) */ + const AEGP_MaskVertex *vertexP); /* >> tangents are relative to position */ + + SPAPI A_Err (*AEGP_CreateVertex)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex insert_position); /* >> will insert at this index. moving other verticies index++*/ + + SPAPI A_Err (*AEGP_DeleteVertex)( + AEGP_MaskOutlineValH mask_outlineH, /* >> */ + AEGP_VertexIndex index); /* >> */ + +} AEGP_MaskOutlineSuite1; + + +#define kAEGPCompSuite "AEGP Comp Suite" +#define kAEGPCompSuiteVersion10 21 /* frozen in AE 12 */ + +typedef struct AEGP_CompSuite10 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_SetCompBGColor)( + AEGP_CompH compH, /* >> */ + const AEGP_ColorVal *bg_colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + /*Opens the comp*/ + SPAPI A_Err (*AEGP_GetShowLayerNameOrSourceName)( + AEGP_CompH compH, /* >> */ + A_Boolean *layer_names_shownPB); /* << true if layer names, false if source names */ + + /*Opens the comp*/ + SPAPI A_Err (*AEGP_SetShowLayerNameOrSourceName)( + AEGP_CompH compH, /* >> */ + A_Boolean show_layer_namesB); /* >> true to show layer names, false to show source names */ + + /*Opens the comp*/ + SPAPI A_Err (*AEGP_GetShowBlendModes)( + AEGP_CompH compH, /* >> */ + A_Boolean *blend_modes_shownPB); /* << */ + + /*Opens the comp*/ + SPAPI A_Err (*AEGP_SetShowBlendModes)( + AEGP_CompH compH, /* >> */ + A_Boolean show_blend_modesB); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompSuggestedMotionBlurSamples)( + AEGP_CompH compH, /* >> */ + A_long *samplesPL); /* << */ + + SPAPI A_Err (*AEGP_SetCompSuggestedMotionBlurSamples)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_long samplesL); /* >> */ + + SPAPI A_Err (*AEGP_GetCompMotionBlurAdaptiveSampleLimit)( + AEGP_CompH compH, /* >> */ + A_long *samplesPL); /* << */ + + SPAPI A_Err (*AEGP_SetCompMotionBlurAdaptiveSampleLimit)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_long samplesL); /* >> */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + const A_Time *work_area_startPT, /* >> */ + const A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_UTF16Char *utf_nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_Collection2H collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + A_Boolean select_new_layerB, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_CreateBoxTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + A_Boolean select_new_layerB, /* >> */ + A_FloatPoint box_dimensions, /* >> */ // (width and height) + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompDimensions)( + AEGP_CompH compH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateComp)( + AEGP_CompH compH, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompFrameDuration)( + AEGP_CompH compH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_GetMostRecentlyUsedComp)( + AEGP_CompH *compPH); /* << If compPH returns NULL, there's no available comp */ + + SPAPI A_Err (*AEGP_CreateVectorLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_vector_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCompMarkerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller */ + + SPAPI A_Err (*AEGP_GetCompDisplayDropFrame)( + AEGP_CompH compH, /* >> */ + A_Boolean *dropFramePB); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayDropFrame)( + AEGP_CompH compH, /* >> */ + A_Boolean dropFrameB); /* << */ + +} AEGP_CompSuite10; + + +#define kAEGPCompSuiteVersion9 19 /* frozen in AE 11 */ + +typedef struct AEGP_CompSuite9 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_SetCompBGColor)( + AEGP_CompH compH, /* >> */ + const AEGP_ColorVal *bg_colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompSuggestedMotionBlurSamples)( + AEGP_CompH compH, /* >> */ + A_long *samplesPL); /* << */ + + SPAPI A_Err (*AEGP_SetCompSuggestedMotionBlurSamples)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_long samplesL); /* >> */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + const A_Time *work_area_startPT, /* >> */ + const A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_UTF16Char *utf_nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_Collection2H collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + A_Boolean select_new_layerB, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_CreateBoxTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + A_Boolean select_new_layerB, /* >> */ + A_FloatPoint box_dimensions, /* >> */ // (width and height) + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompDimensions)( + AEGP_CompH compH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateComp)( + AEGP_CompH compH, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompFrameDuration)( + AEGP_CompH compH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_GetMostRecentlyUsedComp)( + AEGP_CompH *compPH); /* << If compPH returns NULL, there's no available comp */ + + SPAPI A_Err (*AEGP_CreateVectorLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_vector_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCompMarkerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller */ + + SPAPI A_Err (*AEGP_GetCompDisplayDropFrame)( + AEGP_CompH compH, /* >> */ + A_Boolean *dropFramePB); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayDropFrame)( + AEGP_CompH compH, /* >> */ + A_Boolean dropFrameB); /* << */ + + +} AEGP_CompSuite9; + + +#define kAEGPCompSuiteVersion8 18 /* frozen in AE 10.5 */ + +typedef struct AEGP_CompSuite8 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_SetCompBGColor)( + AEGP_CompH compH, /* >> */ + const AEGP_ColorVal *bg_colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompSuggestedMotionBlurSamples)( + AEGP_CompH compH, /* >> */ + A_long *samplesPL); /* << */ + + SPAPI A_Err (*AEGP_SetCompSuggestedMotionBlurSamples)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_long samplesL); /* >> */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + const A_Time *work_area_startPT, /* >> */ + const A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_UTF16Char *utf_nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_Collection2H collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_CreateBoxTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + A_FloatPoint box_dimensions, /* >> */ // (width and height) + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompDimensions)( + AEGP_CompH compH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateComp)( + AEGP_CompH compH, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompFrameDuration)( + AEGP_CompH compH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_GetMostRecentlyUsedComp)( + AEGP_CompH *compPH); /* << If compPH returns NULL, there's no available comp */ + + SPAPI A_Err (*AEGP_CreateVectorLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_vector_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCompMarkerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller */ + + SPAPI A_Err (*AEGP_GetCompDisplayDropFrame)( + AEGP_CompH compH, /* >> */ + A_Boolean *dropFramePB); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayDropFrame)( + AEGP_CompH compH, /* >> */ + A_Boolean dropFrameB); /* << */ + + +} AEGP_CompSuite8; + + + +#define kAEGPCompSuiteVersion7 15 /* frozen in AE 9.0 */ + +typedef struct AEGP_CompSuite7 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_SetCompBGColor)( + AEGP_CompH compH, /* >> */ + const AEGP_ColorVal *bg_colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompSuggestedMotionBlurSamples)( + AEGP_CompH compH, /* >> */ + A_long *samplesPL); /* << */ + + SPAPI A_Err (*AEGP_SetCompSuggestedMotionBlurSamples)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_long samplesL); /* >> */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + const A_Time *work_area_startPT, /* >> */ + const A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_UTF16Char *utf_nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_Collection2H collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_UTF16Char *utf_nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompDimensions)( + AEGP_CompH compH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateComp)( + AEGP_CompH compH, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompFrameDuration)( + AEGP_CompH compH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_GetMostRecentlyUsedComp)( + AEGP_CompH *compPH); /* << If compPH returns NULL, there's no available comp */ + + SPAPI A_Err (*AEGP_CreateVectorLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_vector_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCompMarkerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller */ + +} AEGP_CompSuite7; + + +#define kAEGPCompSuiteVersion6 14 /* frozen in AE 8.0 */ + +typedef struct AEGP_CompSuite6 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_SetCompBGColor)( + AEGP_CompH compH, /* >> */ + const AEGP_ColorVal *bg_colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompSuggestedMotionBlurSamples)( + AEGP_CompH compH, /* >> */ + A_long *samplesPL); /* << */ + + SPAPI A_Err (*AEGP_SetCompSuggestedMotionBlurSamples)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_long samplesL); /* >> */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + const A_Time *work_area_startPT, /* >> */ + const A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_char *nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_char *nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_Collection2H collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_char *nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompDimensions)( + AEGP_CompH compH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateComp)( + AEGP_CompH compH, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompFrameDuration)( + AEGP_CompH compH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_GetMostRecentlyUsedComp)( + AEGP_CompH *compPH); /* << If compPH returns NULL, there's no available comp */ + + SPAPI A_Err (*AEGP_CreateVectorLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_vector_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCompMarkerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller */ + +} AEGP_CompSuite6; + + +#define kAEGPCompSuiteVersion5 11 /* frozen AE 7.0 */ + +typedef struct AEGP_CompSuite5 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_SetCompBGColor)( + AEGP_CompH compH, /* >> */ + const AEGP_ColorVal *bg_colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT, /* >> */ + A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_char *nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_char *nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_Collection2H collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_char *nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompDimensions)( + AEGP_CompH compH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateComp)( + AEGP_CompH compH, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompFrameDuration)(AEGP_CompH compH, /* >> */ + A_Time* timeP); /* << */ + + SPAPI A_Err (*AEGP_GetMostRecentlyUsedComp)( + AEGP_CompH *compPH); /* << If compPH returns NULL, there's no available comp */ +} AEGP_CompSuite5; + + +#define kAEGPCompSuiteVersion4 9 /* frozen AE 6.5 */ + +typedef struct AEGP_CompSuite4 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT, /* >> */ + A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_char *nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_char *nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_Collection2H *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_Collection2H collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_char *nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompDimensions)( + AEGP_CompH compH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateComp)( + AEGP_CompH compH, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompFrameDuration)(AEGP_CompH compH, // in + A_Time* timeP); // out + +} AEGP_CompSuite4; + + +#define kAEGPCompSuiteVersion3 7 /* frozen AE 6.0 */ + +typedef struct AEGP_CompSuite3 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_SetCompFrameRate)( + AEGP_CompH compH, /* >> */ + const A_FpLong *fpsPF); /* >> */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT, /* >> */ + A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_char *nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_char *nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_CollectionH *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_CollectionH collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetCompDisplayStartTime)( + AEGP_CompH compH, /* >> */ + A_Time *start_timePT); /* << */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_char *nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + + SPAPI A_Err (*AEGP_SetCompPixelAspectRatio)( + AEGP_CompH compH, /* >> */ + const A_Ratio *pix_aspectratioPRt); /* >> */ + + SPAPI A_Err (*AEGP_CreateTextLayerInComp)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerH *new_text_layerPH); /* << */ + +} AEGP_CompSuite3; + + +#define kAEGPCompSuiteVersion2 6 /* frozen in AE 5.5 */ + +typedef struct AEGP_CompSuite2 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_SetCompDownsampleFactor)( + AEGP_CompH compH, /* <> */ + const AEGP_DownsampleFactor *dsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT, /* >> */ + A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_char *nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_ItemH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateCameraInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_ItemH parent_compH, /* >> */ + AEGP_LayerH *new_cameraPH); /* << */ + + SPAPI A_Err (*AEGP_CreateLightInComp)( + const A_char *nameZ, /* >> */ + A_FloatPoint center_point, /* >> */ + AEGP_ItemH parent_compH, /* >> */ + AEGP_LayerH *new_lightPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_char *nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_CompH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_CollectionH *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_CollectionH collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ + + + SPAPI A_Err (*AEGP_CreateNullInComp)( + const A_char *nameZ, /* >> */ + AEGP_CompH parent_compH, /* >> */ + const A_Time *durationPT0, /* >> */ + AEGP_LayerH *new_null_solidPH); /* << */ + +} AEGP_CompSuite2; + + +#define kAEGPCompSuiteVersion1 4 /* frozen in AE 5.0 */ + +typedef struct AEGP_CompSuite1 { + + SPAPI A_Err (*AEGP_GetCompFromItem)( // error if item isn't AEGP_ItemType_COMP! + AEGP_ItemH itemH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemFromComp)( + AEGP_CompH compH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetCompDownsampleFactor)( + AEGP_CompH compH, /* >> */ + AEGP_DownsampleFactor *dsfP); /* << */ + + SPAPI A_Err (*AEGP_GetCompBGColor)( + AEGP_CompH compH, /* >> */ + AEGP_ColorVal *bg_colorP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFlags)( + AEGP_CompH compH, /* >> */ + AEGP_CompFlags *comp_flagsP); /* << */ + + SPAPI A_Err (*AEGP_GetCompFramerate)( + AEGP_CompH compH, /* >> */ + A_FpLong *fpsPF); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterAnglePhase)( + AEGP_CompH compH, /* >> */ + A_Ratio *angle, /* << */ + A_Ratio *phase); /* << */ + + SPAPI A_Err (*AEGP_GetCompShutterFrameRange)( + AEGP_CompH compH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *start, /* << */ + A_Time *duration); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaStart)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT); /* << */ + + SPAPI A_Err (*AEGP_GetCompWorkAreaDuration)( + AEGP_CompH compH, /* >> */ + A_Time *work_area_durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetCompWorkAreaStartAndDuration)( /* UNDOABLE */ + AEGP_CompH compH, /* >> */ + A_Time *work_area_startPT, /* >> */ + A_Time *work_area_durationPT); /* >> */ + + SPAPI A_Err (*AEGP_CreateSolidInComp)( + const A_char *nameZ, /* >> */ + A_long width, /* >> */ + A_long height, /* >> */ + const AEGP_ColorVal *color, /* >> */ + AEGP_ItemH parent_compH, /* >> */ + AEGP_LayerH *new_solidPH); /* << */ + + SPAPI A_Err (*AEGP_CreateComp)( + AEGP_ItemH parent_folderH0, /* >> */ + const A_char *nameZ, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + const A_Ratio *pixel_aspect_ratioPRt, /* >> */ + const A_Time *durationPT, /* >> */ + const A_Ratio *frameratePRt, /* >> */ + AEGP_ItemH *new_compPH); /* << */ + + SPAPI A_Err (*AEGP_GetNewCollectionFromCompSelection)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_CompH compH, /* >> */ + AEGP_CollectionH *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_SetSelection)( + AEGP_CompH compH, /* >> */ + AEGP_CollectionH collectionH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_SetCompDisplayStartTime)( /* NOT Undoable! */ + AEGP_CompH compH, /* >> */ + const A_Time *start_timePT); /* >> */ + + SPAPI A_Err (*AEGP_SetCompDuration)( + AEGP_CompH compH, /* >> */ + const A_Time *durationPT); /* >> */ +} AEGP_CompSuite1; + + + +#define kAEGPLayerSuite "AEGP Layer Suite" + +#define kAEGPLayerSuiteVersion6 12 /* frozen AE 9.0 */ + +typedef struct AEGP_LayerSuite6 { + + SPAPI A_Err (*AEGP_GetCompNumLayers)( + AEGP_CompH compH, /* >> */ + A_long *num_layersPL); /* << */ + + SPAPI A_Err (*AEGP_GetCompLayerByIndex)( + AEGP_CompH compH, /* >> */ + A_long layer_indexL, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetActiveLayer)( + AEGP_LayerH *layerPH); /* << returns non null only if one layer is selected */ + + SPAPI A_Err (*AEGP_GetLayerIndex)( + AEGP_LayerH layerH, /* >> */ + A_long *layer_indexPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItem)( + AEGP_LayerH layerH, /* >> */ + AEGP_ItemH *source_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItemID)( + AEGP_LayerH layerH, /* >> */ + A_long *source_item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerParentComp)( + AEGP_LayerH layerH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerName)( + AEGP_PluginID pluginID, // in + AEGP_LayerH layerH, /* >> */ + AEGP_MemHandle *utf_layer_namePH0, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *utf_source_namePH0); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetLayerQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality quality); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerFlags)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags *layer_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerFlag)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags single_flag, /* >> */ + A_Boolean valueB); /* >> */ + + SPAPI A_Err (*AEGP_IsLayerVideoReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerAudioReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_GetLayerCurrentTime)( // not updated while rendering + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerInPoint)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *in_pointPT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDuration)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetLayerInPointAndDuration)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *in_pointPT, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerOffset)( + AEGP_LayerH layerH, /* >> */ + A_Time *offsetPT); /* << always in comp time */ + + SPAPI A_Err (*AEGP_SetLayerOffset)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Time *offsetPT); /* >> always in comp time */ + + SPAPI A_Err (*AEGP_GetLayerStretch)( + AEGP_LayerH layerH, /* >> */ + A_Ratio *stretchPRt); /* << */ + + SPAPI A_Err (*AEGP_SetLayerStretch)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Ratio *stretchPRt); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerTransferMode)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerTransferMode *transfer_modeP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerTransferMode)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerTransferMode *transfer_modeP); /* >> */ + + SPAPI A_Err (*AEGP_IsAddLayerValid)( + AEGP_ItemH item_to_addH, /* >> */ + AEGP_CompH into_compH, /* >> */ + A_Boolean *validPB); /* << */ + + SPAPI A_Err (*AEGP_AddLayer)( /* UNDOABLE */ + AEGP_ItemH item_to_addH, /* >> check AEGP_IsAddLayerValid() before using */ + AEGP_CompH into_compH, /* >> */ + AEGP_LayerH *added_layerPH0); /* << */ + + SPAPI A_Err (*AEGP_ReorderLayer)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + A_long layer_indexL); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerMaskedBounds)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_FloatRect *boundsPR); /* << */ + + SPAPI A_Err (*AEGP_GetLayerObjectType)( + AEGP_LayerH layerH, /* >> */ + AEGP_ObjectType *object_type); /* << */ + + SPAPI A_Err (*AEGP_IsLayer3D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_3DPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayer2D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_2DPB); /* << */ + + SPAPI A_Err (*AEGP_IsVideoActive)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean *is_activePB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerUsedAsTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean fill_must_be_activeB, /* >> */ + A_Boolean *is_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_DoesLayerHaveTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *has_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_ConvertCompToLayerTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Time *layer_timePT); /* << */ + + SPAPI A_Err (*AEGP_ConvertLayerToCompTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *layer_timePT, /* >> */ + A_Time *comp_timePT) ; /* << */ + + SPAPI A_Err (*AEGP_GetLayerDancingRandValue)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_long *rand_valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerID)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXform)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXformFromView)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *view_timeP, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_SetLayerName)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_UTF16Char *new_nameZ); /* >> null terminated UTF16 */ + + SPAPI A_Err (*AEGP_GetLayerParent)( + const AEGP_LayerH layerH, /* >> */ + AEGP_LayerH *parent_layerPH); /* << NULL if no parent */ + + SPAPI A_Err (*AEGP_SetLayerParent)( + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerH parent_layerH0); /* >> */ + + SPAPI A_Err (*AEGP_DeleteLayer)( + AEGP_LayerH layerH); /* >> UNDOABLE */ + + SPAPI A_Err (*AEGP_DuplicateLayer)( + AEGP_LayerH orig_layerH, /* >> */ + AEGP_LayerH *duplicate_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerID)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerIDVal id, /* >> */ + AEGP_LayerH *layerPH); /* << */ + +} AEGP_LayerSuite6; + + +#define kAEGPLayerSuiteVersion5 11 /* frozen AE 7.0 */ + +typedef struct AEGP_LayerSuite5 { + + SPAPI A_Err (*AEGP_GetCompNumLayers)( + AEGP_CompH compH, /* >> */ + A_long *num_layersPL); /* << */ + + SPAPI A_Err (*AEGP_GetCompLayerByIndex)( + AEGP_CompH compH, /* >> */ + A_long layer_indexL, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetActiveLayer)( + AEGP_LayerH *layerPH); /* << returns non null only if one layer is selected */ + + SPAPI A_Err (*AEGP_GetLayerIndex)( + AEGP_LayerH layerH, /* >> */ + A_long *layer_indexPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItem)( + AEGP_LayerH layerH, /* >> */ + AEGP_ItemH *source_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItemID)( + AEGP_LayerH layerH, /* >> */ + A_long *source_item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerParentComp)( + AEGP_LayerH layerH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerName)( + AEGP_LayerH layerH, /* >> */ + A_char *layer_nameZ0, /* << space for A_char[AEGP_MAX_LAYER_NAME_MB_SIZE] */ + A_char *source_nameZ0); /* << space for A_char[AEGP_MAX_LAYER_NAME_MB_SIZE] */ + + SPAPI A_Err (*AEGP_GetLayerQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality quality); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerFlags)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags *layer_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerFlag)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags single_flag, /* >> */ + A_Boolean valueB); /* >> */ + + SPAPI A_Err (*AEGP_IsLayerVideoReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerAudioReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_GetLayerCurrentTime)( // not updated while rendering + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerInPoint)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *in_pointPT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDuration)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetLayerInPointAndDuration)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *in_pointPT, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerOffset)( + AEGP_LayerH layerH, /* >> */ + A_Time *offsetPT); /* << always in comp time */ + + SPAPI A_Err (*AEGP_SetLayerOffset)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Time *offsetPT); /* >> always in comp time */ + + SPAPI A_Err (*AEGP_GetLayerStretch)( + AEGP_LayerH layerH, /* >> */ + A_Ratio *stretchPRt); /* << */ + + SPAPI A_Err (*AEGP_SetLayerStretch)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Ratio *stretchPRt); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerTransferMode)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerTransferMode *transfer_modeP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerTransferMode)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerTransferMode *transfer_modeP); /* >> */ + + SPAPI A_Err (*AEGP_IsAddLayerValid)( + AEGP_ItemH item_to_addH, /* >> */ + AEGP_CompH into_compH, /* >> */ + A_Boolean *validPB); /* << */ + + SPAPI A_Err (*AEGP_AddLayer)( /* UNDOABLE */ + AEGP_ItemH item_to_addH, /* >> check AEGP_IsAddLayerValid() before using */ + AEGP_CompH into_compH, /* >> */ + AEGP_LayerH *added_layerPH0); /* << */ + + SPAPI A_Err (*AEGP_ReorderLayer)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + A_long layer_indexL); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerMaskedBounds)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_FloatRect *boundsPR); /* << */ + + SPAPI A_Err (*AEGP_GetLayerObjectType)( + AEGP_LayerH layerH, /* >> */ + AEGP_ObjectType *object_type); /* << */ + + SPAPI A_Err (*AEGP_IsLayer3D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_3DPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayer2D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_2DPB); /* << */ + + SPAPI A_Err (*AEGP_IsVideoActive)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean *is_activePB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerUsedAsTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean fill_must_be_activeB, /* >> */ + A_Boolean *is_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_DoesLayerHaveTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *has_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_ConvertCompToLayerTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Time *layer_timePT); /* << */ + + SPAPI A_Err (*AEGP_ConvertLayerToCompTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *layer_timePT, /* >> */ + A_Time *comp_timePT) ; /* << */ + + SPAPI A_Err (*AEGP_GetLayerDancingRandValue)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_long *rand_valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerID)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXform)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXformFromView)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *view_timeP, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_SetLayerName)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_char *new_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerParent)( + const AEGP_LayerH layerH, /* >> */ + AEGP_LayerH *parent_layerPH); /* << NULL if no parent */ + + SPAPI A_Err (*AEGP_SetLayerParent)( + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerH parent_layerH0); /* >> */ + + SPAPI A_Err (*AEGP_DeleteLayer)( + AEGP_LayerH layerH); /* >> UNDOABLE */ + + SPAPI A_Err (*AEGP_DuplicateLayer)( + AEGP_LayerH orig_layerH, /* >> */ + AEGP_LayerH *duplicate_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerFromLayerID)( + AEGP_CompH parent_compH, /* >> */ + AEGP_LayerIDVal id, /* >> */ + AEGP_LayerH *layerPH); /* << */ + +} AEGP_LayerSuite5; + + + +#define kAEGPLayerSuiteVersion4 10 /* frozen AE 6.5 */ + +typedef struct AEGP_LayerSuite4 { + + SPAPI A_Err (*AEGP_GetCompNumLayers)( + AEGP_CompH compH, /* >> */ + A_long *num_layersPL); /* << */ + + SPAPI A_Err (*AEGP_GetCompLayerByIndex)( + AEGP_CompH compH, /* >> */ + A_long layer_indexL, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetActiveLayer)( + AEGP_LayerH *layerPH); /* << returns non null only if one layer is selected */ + + SPAPI A_Err (*AEGP_GetLayerIndex)( + AEGP_LayerH layerH, /* >> */ + A_long *layer_indexPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItem)( + AEGP_LayerH layerH, /* >> */ + AEGP_ItemH *source_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItemID)( + AEGP_LayerH layerH, /* >> */ + A_long *source_item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerParentComp)( + AEGP_LayerH layerH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerName)( + AEGP_LayerH layerH, /* >> */ + A_char *layer_nameZ0, /* << space for A_char[AEGP_MAX_LAYER_NAME_SIZE] */ + A_char *source_nameZ0); /* << space for A_char[AEGP_MAX_LAYER_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetLayerQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality quality); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerFlags)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags *layer_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerFlag)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags single_flag, /* >> */ + A_Boolean valueB); /* >> */ + + SPAPI A_Err (*AEGP_IsLayerVideoReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerAudioReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_GetLayerCurrentTime)( // not updated while rendering + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerInPoint)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *in_pointPT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDuration)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetLayerInPointAndDuration)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *in_pointPT, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerOffset)( + AEGP_LayerH layerH, /* >> */ + A_Time *offsetPT); /* << always in comp time */ + + SPAPI A_Err (*AEGP_SetLayerOffset)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Time *offsetPT); /* >> always in comp time */ + + SPAPI A_Err (*AEGP_GetLayerStretch)( + AEGP_LayerH layerH, /* >> */ + A_Ratio *stretchPRt); /* << */ + + SPAPI A_Err (*AEGP_SetLayerStretch)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Ratio *stretchPRt); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerTransferMode)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerTransferMode *transfer_modeP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerTransferMode)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerTransferMode *transfer_modeP); /* >> */ + + SPAPI A_Err (*AEGP_IsAddLayerValid)( + AEGP_ItemH item_to_addH, /* >> */ + AEGP_CompH into_compH, /* >> */ + A_Boolean *validPB); /* << */ + + SPAPI A_Err (*AEGP_AddLayer)( /* UNDOABLE */ + AEGP_ItemH item_to_addH, /* >> check AEGP_IsAddLayerValid() before using */ + AEGP_CompH into_compH, /* >> */ + AEGP_LayerH *added_layerPH0); /* << */ + + SPAPI A_Err (*AEGP_ReorderLayer)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + A_long layer_indexL); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerMaskedBounds)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_FloatRect *boundsPR); /* << */ + + SPAPI A_Err (*AEGP_GetLayerObjectType)( + AEGP_LayerH layerH, /* >> */ + AEGP_ObjectType *object_type); /* << */ + + SPAPI A_Err (*AEGP_IsLayer3D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_3DPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayer2D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_2DPB); /* << */ + + SPAPI A_Err (*AEGP_IsVideoActive)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean *is_activePB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerUsedAsTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean fill_must_be_activeB, /* >> */ + A_Boolean *is_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_DoesLayerHaveTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *has_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_ConvertCompToLayerTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Time *layer_timePT); /* << */ + + SPAPI A_Err (*AEGP_ConvertLayerToCompTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *layer_timePT, /* >> */ + A_Time *comp_timePT) ; /* << */ + + SPAPI A_Err (*AEGP_GetLayerDancingRandValue)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_long *rand_valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerID)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXform)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXformFromView)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *view_timeP, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *transform); /* << */ + + SPAPI A_Err (*AEGP_SetLayerName)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_char *new_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerParent)( + const AEGP_LayerH layerH, /* >> */ + AEGP_LayerH *parent_layerPH); /* << NULL if no parent */ + + SPAPI A_Err (*AEGP_SetLayerParent)( + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerH parent_layerH0); /* >> */ + + SPAPI A_Err (*AEGP_DeleteLayer)( + AEGP_LayerH layerH); /* >> UNDOABLE */ + + SPAPI A_Err (*AEGP_DuplicateLayer)( + AEGP_LayerH orig_layerH, /* >> */ + AEGP_LayerH *duplicate_layerPH); /* << */ + +} AEGP_LayerSuite4; + +#define kAEGPLayerSuiteVersion3 8 /* frozen AE 6.0 */ + +typedef struct AEGP_LayerSuite3 { + + SPAPI A_Err (*AEGP_GetCompNumLayers)( + AEGP_CompH compH, /* >> */ + A_long *num_layersPL); /* << */ + + SPAPI A_Err (*AEGP_GetCompLayerByIndex)( + AEGP_CompH compH, /* >> */ + A_long layer_indexL, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetActiveLayer)( + AEGP_LayerH *layerPH); /* << only if one layer is selected */ + + SPAPI A_Err (*AEGP_GetLayerIndex)( + AEGP_LayerH layerH, /* >> */ + A_long *layer_indexPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItem)( + AEGP_LayerH layerH, /* >> */ + AEGP_ItemH *source_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerParentComp)( + AEGP_LayerH layerH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerName)( + AEGP_LayerH layerH, /* >> */ + A_char *layer_nameZ0, /* << space for A_char[AEGP_MAX_LAYER_NAME_SIZE] */ + A_char *source_nameZ0); /* << space for A_char[AEGP_MAX_LAYER_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetLayerQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality quality); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerFlags)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags *layer_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerFlag)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags single_flag, /* >> */ + A_Boolean valueB); /* >> */ + + SPAPI A_Err (*AEGP_IsLayerVideoReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerAudioReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_GetLayerCurrentTime)( // not updated while rendering + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerInPoint)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *in_pointPT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDuration)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetLayerInPointAndDuration)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *in_pointPT, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerOffset)( + AEGP_LayerH layerH, /* >> */ + A_Time *offsetPT); /* << always in comp time */ + + SPAPI A_Err (*AEGP_SetLayerOffset)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Time *offsetPT); /* >> always in comp time */ + + SPAPI A_Err (*AEGP_GetLayerStretch)( + AEGP_LayerH layerH, /* >> */ + A_Ratio *stretchPRt); /* << */ + + SPAPI A_Err (*AEGP_SetLayerStretch)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Ratio *stretchPRt); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerTransferMode)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerTransferMode *transfer_modeP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerTransferMode)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerTransferMode *transfer_modeP); /* >> */ + + SPAPI A_Err (*AEGP_IsAddLayerValid)( + AEGP_ItemH item_to_addH, /* >> */ + AEGP_CompH into_compH, /* >> */ + A_Boolean *validPB); /* << */ + + SPAPI A_Err (*AEGP_AddLayer)( /* UNDOABLE */ + AEGP_ItemH item_to_addH, /* >> check AEGP_IsAddLayerValid() before using */ + AEGP_CompH into_compH, /* >> */ + AEGP_LayerH *added_layerPH0); /* << */ + + SPAPI A_Err (*AEGP_ReorderLayer)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + A_long layer_indexL); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerMaskedBounds)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_FloatRect *boundsPR); /* << */ + + SPAPI A_Err (*AEGP_GetLayerObjectType)( + AEGP_LayerH layerH, /* >> */ + AEGP_ObjectType *object_type); /* << */ + + SPAPI A_Err (*AEGP_IsLayer3D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_3DPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayer2D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_2DPB); /* << */ + + SPAPI A_Err (*AEGP_IsVideoActive)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean *is_activePB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerUsedAsTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean fill_must_be_activeB, /* >> */ + A_Boolean *is_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_DoesLayerHaveTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *has_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_ConvertCompToLayerTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Time *layer_timePT); /* << */ + + SPAPI A_Err (*AEGP_ConvertLayerToCompTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *layer_timePT, /* >> */ + A_Time *comp_timePT) ; /* << */ + + SPAPI A_Err (*AEGP_GetLayerDancingRandValue)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_long *rand_valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerID)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXform)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *tranform); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXformFromView)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *view_timeP, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *tranform); /* >> */ + + SPAPI A_Err (*AEGP_SetLayerName)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_char *new_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerParent)( + const AEGP_LayerH layerH, /* >> */ + AEGP_LayerH *parent_layerPH); /* << NULL if no parent */ + + SPAPI A_Err (*AEGP_SetLayerParent)( + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerH parent_layerH0); /* >> */ + + SPAPI A_Err (*AEGP_DeleteLayer)( + AEGP_LayerH layerH); /* >> UNDOABLE */ + + +} AEGP_LayerSuite3; + +/*******************************************************************************/ + +typedef struct { + A_char nameAC [AEGP_MAX_MARKER_NAME_SIZE]; + A_char urlAC [AEGP_MAX_MARKER_URL_SIZE]; + A_char targetAC [AEGP_MAX_MARKER_TARGET_SIZE]; + A_char chapterAC [AEGP_MAX_MARKER_CHAPTER_SIZE]; +} AEGP_MarkerVal; + +typedef AEGP_MarkerVal** AEGP_MarkerValH; + +typedef union { + AEGP_FourDVal four_d; + AEGP_ThreeDVal three_d; + AEGP_TwoDVal two_d; + AEGP_OneDVal one_d; + AEGP_ColorVal color; + AEGP_ArbBlockVal arbH; + AEGP_MarkerValH markerH; + AEGP_LayerIDVal layer_id; + AEGP_MaskIDVal mask_id; + AEGP_MaskOutlineValH mask; + AEGP_TextDocumentH text_documentH; +} AEGP_StreamVal; + +/* Metrowerks 2.4.6, a.k.a. Codewarrior Pro 7.1, changed PowerPC struct + alignment. The pragma ensures the same alignment as with 2.4.5 and + previous since plug-ins are built against this structure. See Codewarrior + release notes for for details. Bug# WB1-27922. +*/ + +#if (__MWERKS__ >= 0x2406) +#pragma options align=mac68k4byte +#endif + +typedef struct { + + AEGP_StreamRefH streamH; + /* CW 7.1 was adding 4 padding bytes here. See pragma above for comments. */ + AEGP_StreamVal val; +} AEGP_StreamValue; + +#define kAEGPStreamSuite "AEGP Stream Suite" + +#define kAEGPStreamSuiteVersion4 9 /* frozen in AE 9 */ +typedef struct AEGP_StreamSuite4 { + // the only diff from this vs. last rev is that routines that pass AEGP_StreamValue2, when referring to a marker, + // (comp or layer) the struct now contains the NEW markerP type, which is compatible with the new Marker Suite + + SPAPI A_Err(*AEGP_IsStreamLegal)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + A_Boolean* is_legalP); /* << */ + + + SPAPI A_Err(*AEGP_CanVaryOverTime)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean* can_varyPB); /* << */ + + SPAPI A_Err(*AEGP_GetValidInterpolations)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyInterpolationMask* valid_interpolationsP); /* << */ + + SPAPI A_Err(*AEGP_GetNewLayerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err(*AEGP_GetEffectNumParamStreams)( + AEGP_EffectRefH effect_refH, /* >> */ + A_long *num_paramsPL); /* << */ + + SPAPI A_Err(*AEGP_GetNewEffectStreamByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err(*AEGP_GetNewMaskStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskStream which_stream, /* >> */ + AEGP_StreamRefH *mask_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err(*AEGP_DisposeStream)( + AEGP_StreamRefH streamH); /* >> */ + + SPAPI A_Err(*AEGP_GetStreamName)( + AEGP_PluginID pluginID, // in + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + AEGP_MemHandle *utf_stream_namePH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err(*AEGP_GetStreamUnitsText)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + A_char *unitsZ); /* << space for A_char[AEGP_MAX_STREAM_UNITS_SIZE] */ + + SPAPI A_Err(*AEGP_GetStreamProperties)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamFlags *flagsP, /* << */ + A_FpLong *minP0, /* << */ + A_FpLong *maxP0); /* << */ + + SPAPI A_Err(*AEGP_IsStreamTimevarying)( /* takes expressions into account */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *is_timevaryingPB); /* << */ + + SPAPI A_Err(*AEGP_GetStreamType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamType *stream_typeP); /* << */ + + SPAPI A_Err(*AEGP_GetNewStreamValue)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamValue2 *valueP); /* << must be disposed */ + + SPAPI A_Err(*AEGP_DisposeStreamValue)( + AEGP_StreamValue2 *valueP); /* <> */ + + + SPAPI A_Err(*AEGP_SetStreamValue)( // only legal to call when AEGP_GetStreamNumKFs==0 or NO_DATA + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamValue2 *valueP); /* << */ + + // this is only valid on streams with primitive types. It is illegal on + // AEGP_ArbBlockVal || AEGP_MarkerValP || AEGP_MaskOutlineValH + + SPAPI A_Err(*AEGP_GetLayerStreamValue)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamVal2 *stream_valP, /* << */ + AEGP_StreamType *stream_typeP0); /* << */ + + SPAPI A_Err(*AEGP_GetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *enabledPB); /* >> */ + + SPAPI A_Err(*AEGP_SetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean enabledB); /* >> */ + + SPAPI A_Err(*AEGP_GetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_MemHandle *expressionHZ); /* << must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err(*AEGP_SetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + const A_char* expressionP); /* >> not adopted */ + + SPAPI A_Err(*AEGP_DuplicateStreamRef)( // must dispose yourself + AEGP_PluginID aegp_plugin_id, // in + AEGP_StreamRefH streamH, // in + AEGP_StreamRefH *dup_streamPH); // out +} AEGP_StreamSuite4; + + + +#define kAEGPStreamSuiteVersion3 8 /* frozen in AE 8 */ +typedef struct AEGP_StreamSuite3 { + // the only diff from this vs. last rev is that routines that pass AEGP_StreamValue2, when referring to a marker, + // (comp or layer) the struct now contains the NEW markerP type, which is compatible with the new Marker Suite + + SPAPI A_Err (*AEGP_IsStreamLegal)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + A_Boolean* is_legalP); /* << */ + + + SPAPI A_Err (*AEGP_CanVaryOverTime)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean* can_varyPB); /* << */ + + SPAPI A_Err (*AEGP_GetValidInterpolations)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyInterpolationMask* valid_interpolationsP); /* << */ + + SPAPI A_Err (*AEGP_GetNewLayerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetEffectNumParamStreams)( + AEGP_EffectRefH effect_refH, /* >> */ + A_long *num_paramsPL); /* << */ + + SPAPI A_Err (*AEGP_GetNewEffectStreamByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewMaskStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskStream which_stream, /* >> */ + AEGP_StreamRefH *mask_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_DisposeStream)( + AEGP_StreamRefH streamH); /* >> */ + + SPAPI A_Err (*AEGP_GetStreamName)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_STREAM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetStreamUnitsText)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + A_char *unitsZ); /* << space for A_char[AEGP_MAX_STREAM_UNITS_SIZE] */ + + SPAPI A_Err (*AEGP_GetStreamProperties)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamFlags *flagsP, /* << */ + A_FpLong *minP0, /* << */ + A_FpLong *maxP0); /* << */ + + SPAPI A_Err (*AEGP_IsStreamTimevarying)( /* takes expressions into account */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *is_timevaryingPB); /* << */ + + SPAPI A_Err (*AEGP_GetStreamType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamType *stream_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetNewStreamValue)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamValue2 *valueP); /* << must be disposed */ + + SPAPI A_Err (*AEGP_DisposeStreamValue)( + AEGP_StreamValue2 *valueP); /* <> */ + + + SPAPI A_Err (*AEGP_SetStreamValue)( // only legal to call when AEGP_GetStreamNumKFs==0 or NO_DATA + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamValue2 *valueP); /* << */ + + // this is only valid on streams with primitive types. It is illegal on + // AEGP_ArbBlockVal || AEGP_MarkerValP || AEGP_MaskOutlineValH + + SPAPI A_Err (*AEGP_GetLayerStreamValue)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamVal2 *stream_valP, /* << */ + AEGP_StreamType *stream_typeP0); /* << */ + + SPAPI A_Err (*AEGP_GetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *enabledPB); /* >> */ + + SPAPI A_Err (*AEGP_SetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean enabledB); /* >> */ + + SPAPI A_Err (*AEGP_GetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_MemHandle *expressionHZ); /* << must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err (*AEGP_SetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + const A_char* expressionP); /* >> not adopted */ + + SPAPI A_Err (*AEGP_DuplicateStreamRef)( // must dispose yourself + AEGP_PluginID aegp_plugin_id, // in + AEGP_StreamRefH streamH, // in + AEGP_StreamRefH *dup_streamPH); // out +} AEGP_StreamSuite3; + + +#define kAEGPStreamSuiteVersion2 7 /* frozen in AE 6.5 */ + +typedef struct AEGP_StreamSuite2 { + + SPAPI A_Err (*AEGP_IsStreamLegal)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + A_Boolean* is_legalP); /* << */ + + + SPAPI A_Err (*AEGP_CanVaryOverTime)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean* can_varyPB); /* << */ + + SPAPI A_Err (*AEGP_GetValidInterpolations)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyInterpolationMask* valid_interpolationsP); /* << */ + + SPAPI A_Err (*AEGP_GetNewLayerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetEffectNumParamStreams)( + AEGP_EffectRefH effect_refH, /* >> */ + A_long *num_paramsPL); /* << */ + + SPAPI A_Err (*AEGP_GetNewEffectStreamByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewMaskStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskStream which_stream, /* >> */ + AEGP_StreamRefH *mask_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_DisposeStream)( + AEGP_StreamRefH streamH); /* >> */ + + SPAPI A_Err (*AEGP_GetStreamName)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_STREAM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetStreamUnitsText)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + A_char *unitsZ); /* << space for A_char[AEGP_MAX_STREAM_UNITS_SIZE] */ + + SPAPI A_Err (*AEGP_GetStreamProperties)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamFlags *flagsP, /* << */ + A_FpLong *minP0, /* << */ + A_FpLong *maxP0); /* << */ + + SPAPI A_Err (*AEGP_IsStreamTimevarying)( /* takes expressions into account */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *is_timevaryingPB); /* << */ + + SPAPI A_Err (*AEGP_GetStreamType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamType *stream_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetNewStreamValue)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamValue *valueP); /* << must be disposed */ + + SPAPI A_Err (*AEGP_DisposeStreamValue)( + AEGP_StreamValue *valueP); /* <> */ + + + SPAPI A_Err (*AEGP_SetStreamValue)( // only legal to call when AEGP_GetStreamNumKFs==0 or NO_DATA + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamValue *valueP); /* << */ + + // this is only valid on streams with primitive types. It is illegal on + // AEGP_ArbBlockVal || AEGP_MarkerValP || AEGP_MaskOutlineValH + + SPAPI A_Err (*AEGP_GetLayerStreamValue)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamVal *stream_valP, /* << */ + AEGP_StreamType *stream_typeP0); /* << */ + + SPAPI A_Err (*AEGP_GetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *enabledPB); /* >> */ + + SPAPI A_Err (*AEGP_SetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean enabledB); /* >> */ + + SPAPI A_Err (*AEGP_GetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_MemHandle *expressionHZ); /* << must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err (*AEGP_SetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + const A_char* expressionP); /* >> not adopted */ + + SPAPI A_Err (*AEGP_DuplicateStreamRef)( // must dispose yourself + AEGP_PluginID aegp_plugin_id, // in + AEGP_StreamRefH streamH, // in + AEGP_StreamRefH *dup_streamPH); // out +} AEGP_StreamSuite2; + +#define kAEGPStreamSuite "AEGP Stream Suite" +#define kAEGPStreamSuiteVersion1 4 /* frozen in AE 5.0 */ + +typedef struct AEGP_StreamSuite1 { + + SPAPI A_Err (*AEGP_IsStreamLegal)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + A_Boolean* is_legalP); /* << */ + + + SPAPI A_Err (*AEGP_CanVaryOverTime)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean* can_varyPB); /* << */ + + + SPAPI A_Err (*AEGP_GetNewLayerStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetEffectNumParamStreams)( + AEGP_EffectRefH effect_refH, /* >> */ + A_long *num_paramsPL); /* << */ + + SPAPI A_Err (*AEGP_GetNewEffectStreamByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewMaskStream)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskStream which_stream, /* >> */ + AEGP_StreamRefH *mask_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_DisposeStream)( + AEGP_StreamRefH streamH); /* >> */ + + SPAPI A_Err (*AEGP_GetStreamName)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_STREAM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetStreamUnitsText)( + AEGP_StreamRefH streamH, /* >> */ + A_Boolean force_englishB, /* >> */ + A_char *unitsZ); /* << space for A_char[AEGP_MAX_STREAM_UNITS_SIZE] */ + + SPAPI A_Err (*AEGP_GetStreamProperties)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamFlags *flagsP, /* << */ + A_FpLong *minP0, /* << */ + A_FpLong *maxP0); /* << */ + + SPAPI A_Err (*AEGP_IsStreamTimevarying)( /* takes expressions into account */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *is_timevaryingPB); /* << */ + + SPAPI A_Err (*AEGP_GetStreamType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamType *stream_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetNewStreamValue)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamValue *valueP); /* << must be disposed */ + + SPAPI A_Err (*AEGP_DisposeStreamValue)( + AEGP_StreamValue *valueP); /* <> */ + + + SPAPI A_Err (*AEGP_SetStreamValue)( // only legal to call when AEGP_GetStreamNumKFs==0 or NO_DATA + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamValue *valueP); /* << */ + + // this is only valid on streams with primitive types. It is illegal on + // AEGP_ArbBlockVal || AEGP_MarkerValH || AEGP_MaskOutlineValH + + SPAPI A_Err (*AEGP_GetLayerStreamValue)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerStream which_stream, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean pre_expressionB, /* >> sample the stream before evaluating the expression */ + AEGP_StreamVal *stream_valP, /* << */ + AEGP_StreamType *stream_typeP0); /* << */ + + SPAPI A_Err (*AEGP_GetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *enabledPB); /* >> */ + + SPAPI A_Err (*AEGP_SetExpressionState)( /* expressions can be disabled automatically by the parser on playback */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_Boolean enabledB); /* >> */ + + SPAPI A_Err (*AEGP_GetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_MemHandle *expressionHZ); /* << must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err (*AEGP_SetExpression)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + const A_char* expressionP); /* >> not adopted */ + + +} AEGP_StreamSuite1; + + +#define kAEGPLayerSuiteVersion1 5 /* frozen in AE 5.0 */ + +typedef struct AEGP_LayerSuite1 { + + SPAPI A_Err (*AEGP_GetCompNumLayers)( + AEGP_CompH compH, /* >> */ + A_long *num_layersPL); /* << */ + + SPAPI A_Err (*AEGP_GetCompLayerByIndex)( + AEGP_CompH compH, /* >> */ + A_long layer_indexL, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetActiveLayer)( + AEGP_LayerH *layerPH); /* << only if one layer is selected */ + + SPAPI A_Err (*AEGP_GetLayerIndex)( + AEGP_LayerH layerH, /* >> */ + A_long *layer_indexPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItem)( + AEGP_LayerH layerH, /* >> */ + AEGP_ItemH *source_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerParentComp)( + AEGP_LayerH layerH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerName)( + AEGP_LayerH layerH, /* >> */ + A_char *layer_nameZ0, /* << space for A_char[AEGP_MAX_LAYER_NAME_SIZE] */ + A_char *source_nameZ0); /* << space for A_char[AEGP_MAX_LAYER_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetLayerQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality quality); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerFlags)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags *layer_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerFlag)( + AEGP_LayerH layerH, // >> + AEGP_LayerFlags single_flag, // >> + A_Boolean valueB); // >> + + SPAPI A_Err (*AEGP_IsLayerVideoReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerAudioReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_GetLayerCurrentTime)( // not updated while rendering + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerInPoint)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *in_pointPT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDuration)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetLayerInPointAndDuration)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *in_pointPT, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerOffset)( + AEGP_LayerH layerH, /* >> */ + A_Time *offsetPT); /* << always in comp time */ + + SPAPI A_Err (*AEGP_SetLayerOffset)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Time *offsetPT); /* >> always in comp time */ + + SPAPI A_Err (*AEGP_GetLayerStretch)( + AEGP_LayerH layerH, /* >> */ + A_Ratio *stretchPRt); /* << */ + + SPAPI A_Err (*AEGP_SetLayerStretch)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Ratio *stretchPRt); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerTransferMode)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerTransferMode *transfer_modeP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerTransferMode)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerTransferMode *transfer_modeP); /* >> */ + + SPAPI A_Err (*AEGP_IsAddLayerValid)( + AEGP_ItemH item_to_addH, /* >> */ + AEGP_CompH into_compH, /* >> */ + A_Boolean *validPB); /* << */ + + SPAPI A_Err (*AEGP_AddLayer)( /* UNDOABLE */ + AEGP_ItemH item_to_addH, /* >> check AEGP_IsAddLayerValid() before using */ + AEGP_CompH into_compH, /* >> */ + AEGP_LayerH *added_layerPH0); /* << */ + + SPAPI A_Err (*AEGP_ReorderLayer)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + A_long layer_indexL); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerMaskedBounds)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_FloatRect *boundsPR); /* << */ + + SPAPI A_Err (*AEGP_GetLayerObjectType)( + AEGP_LayerH layerH, /* >> */ + AEGP_ObjectType *object_type); /* << */ + + SPAPI A_Err (*AEGP_IsLayer3D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_3DPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayer2D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_2DPB); /* << */ + + SPAPI A_Err (*AEGP_IsVideoActive)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean *is_activePB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerUsedAsTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean fill_must_be_activeB, /* >> */ + A_Boolean *is_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_DoesLayerHaveTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *has_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_ConvertCompToLayerTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Time *layer_timeP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDancingRandValue)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_long *rand_valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerID)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXform)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *tranform); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXformFromView)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *view_timeP, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *tranform); /* >> */ + + SPAPI A_Err (*AEGP_SetLayerName)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_char *new_nameZ); /* >> */ + +} AEGP_LayerSuite1; + +#define kAEGPLayerSuiteVersion2 7 /* frozen in AE 5.5 */ + +typedef struct AEGP_LayerSuite2 { + + SPAPI A_Err (*AEGP_GetCompNumLayers)( + AEGP_CompH compH, /* >> */ + A_long *num_layersPL); /* << */ + + SPAPI A_Err (*AEGP_GetCompLayerByIndex)( + AEGP_CompH compH, /* >> */ + A_long layer_indexL, /* >> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetActiveLayer)( + AEGP_LayerH *layerPH); /* << only if one layer is selected */ + + SPAPI A_Err (*AEGP_GetLayerIndex)( + AEGP_LayerH layerH, /* >> */ + A_long *layer_indexPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerSourceItem)( + AEGP_LayerH layerH, /* >> */ + AEGP_ItemH *source_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerParentComp)( + AEGP_LayerH layerH, /* >> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_GetLayerName)( + AEGP_LayerH layerH, /* >> */ + A_char *layer_nameZ0, /* << space for A_char[AEGP_MAX_LAYER_NAME_SIZE] */ + A_char *source_nameZ0); /* << space for A_char[AEGP_MAX_LAYER_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetLayerQuality)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality *qualityP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerQuality)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerQuality quality); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerFlags)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags *layer_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerFlag)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerFlags single_flag, /* >> */ + A_Boolean valueB); /* >> */ + + SPAPI A_Err (*AEGP_IsLayerVideoReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerAudioReallyOn)( // accounts for solo status of other layers in comp + AEGP_LayerH layerH, /* >> */ + A_Boolean *onPB); /* << */ + + SPAPI A_Err (*AEGP_GetLayerCurrentTime)( // not updated while rendering + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerInPoint)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *in_pointPT); /* << */ + + SPAPI A_Err (*AEGP_GetLayerDuration)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *durationPT); /* << */ + + SPAPI A_Err (*AEGP_SetLayerInPointAndDuration)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *in_pointPT, /* >> */ + const A_Time *durationPT); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerOffset)( + AEGP_LayerH layerH, /* >> */ + A_Time *offsetPT); /* << always in comp time */ + + SPAPI A_Err (*AEGP_SetLayerOffset)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Time *offsetPT); /* >> always in comp time */ + + SPAPI A_Err (*AEGP_GetLayerStretch)( + AEGP_LayerH layerH, /* >> */ + A_Ratio *stretchPRt); /* << */ + + SPAPI A_Err (*AEGP_SetLayerStretch)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const A_Ratio *stretchPRt); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerTransferMode)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerTransferMode *transfer_modeP); /* << */ + + SPAPI A_Err (*AEGP_SetLayerTransferMode)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerTransferMode *transfer_modeP); /* >> */ + + SPAPI A_Err (*AEGP_IsAddLayerValid)( + AEGP_ItemH item_to_addH, /* >> */ + AEGP_CompH into_compH, /* >> */ + A_Boolean *validPB); /* << */ + + SPAPI A_Err (*AEGP_AddLayer)( /* UNDOABLE */ + AEGP_ItemH item_to_addH, /* >> check AEGP_IsAddLayerValid() before using */ + AEGP_CompH into_compH, /* >> */ + AEGP_LayerH *added_layerPH0); /* << */ + + SPAPI A_Err (*AEGP_ReorderLayer)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + A_long layer_indexL); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerMaskedBounds)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_FloatRect *boundsPR); /* << */ + + SPAPI A_Err (*AEGP_GetLayerObjectType)( + AEGP_LayerH layerH, /* >> */ + AEGP_ObjectType *object_type); /* << */ + + SPAPI A_Err (*AEGP_IsLayer3D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_3DPB); /* << */ + + SPAPI A_Err (*AEGP_IsLayer2D)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *is_2DPB); /* << */ + + SPAPI A_Err (*AEGP_IsVideoActive)( + AEGP_LayerH layerH, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_Boolean *is_activePB); /* << */ + + SPAPI A_Err (*AEGP_IsLayerUsedAsTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean fill_must_be_activeB, /* >> */ + A_Boolean *is_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_DoesLayerHaveTrackMatte)( + AEGP_LayerH layerH, /* >> */ + A_Boolean *has_track_mattePB); /* << */ + + SPAPI A_Err (*AEGP_ConvertCompToLayerTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_Time *layer_timePT); /* << */ + + SPAPI A_Err (*AEGP_ConvertLayerToCompTime)( + AEGP_LayerH layerH, /* >> */ + const A_Time *layer_timePT, /* >> */ + A_Time *comp_timePT) ; /* << */ + + SPAPI A_Err (*AEGP_GetLayerDancingRandValue)( + AEGP_LayerH layerH, /* >> */ + const A_Time *comp_timePT, /* >> */ + A_long *rand_valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerID)( + AEGP_LayerH layerH, /* >> */ + AEGP_LayerIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXform)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *tranform); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerToWorldXformFromView)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_Time *view_timeP, /* >> */ + const A_Time *comp_timeP, /* >> */ + A_Matrix4 *tranform); /* >> */ + + SPAPI A_Err (*AEGP_SetLayerName)( + AEGP_LayerH aegp_layerH, /* >> */ + const A_char *new_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_GetLayerParent)( + const AEGP_LayerH layerH, /* >> */ + AEGP_LayerH *parent_layerPH); /* << NULL if no parent */ + + SPAPI A_Err (*AEGP_SetLayerParent)( + AEGP_LayerH layerH, /* >> */ + const AEGP_LayerH parent_layerH); /* >> */ + + +} AEGP_LayerSuite2; + + + + +#define kAEGPEffectSuite "AEGP Effect Suite" +#define kAEGPEffectSuiteVersion1 1 /* frozen in AE 5.5 */ + +typedef struct AEGP_EffectSuite1 { + + SPAPI A_Err (*AEGP_GetLayerNumEffects)( + AEGP_LayerH layerH, /* >> */ + A_long *num_effectsPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerEffectByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_EffectIndex layer_effect_indexL, /* >> */ + AEGP_EffectRefH *effectPH); /* << MUST dispose with DisposeEffect*/ + + SPAPI A_Err (*AEGP_GetInstalledKeyFromLayerEffect)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_InstalledEffectKey *installed_effect_keyP); /* << */ + + SPAPI A_Err (*AEGP_GetEffectParamUnionByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + PF_ParamType *param_typeP, /* << */ + PF_ParamDefUnion *uP0); /* << DO NOT USE THE VALUE FROM THIS PARAMDEF! */ + + SPAPI A_Err (*AEGP_GetEffectFlags)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_EffectFlags *effect_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetEffectFlags)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_EffectFlags effect_flags_set_mask, /* >> */ + AEGP_EffectFlags effect_flags); /* >> */ + + SPAPI A_Err (*AEGP_ReorderEffect)( /* UNDOABLE */ + AEGP_EffectRefH effect_refH, /* >> */ + A_long effect_indexL); /* >> */ + + SPAPI A_Err (*AEGP_EffectCallGeneric)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + const A_Time *timePT, /* >> Use the timebase of the layer to which effect is applied. */ + void *effect_extraPV); /* <> */ + + SPAPI A_Err (*AEGP_DisposeEffect)( + AEGP_EffectRefH effect_refH ); /* >> */ + + SPAPI A_Err (*AEGP_ApplyEffect)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + AEGP_EffectRefH *effect_refPH); /* << MUST BE DISPOSED with AEGP_DisposeEffect */ + + SPAPI A_Err (*AEGP_DeleteLayerEffect)( + AEGP_EffectRefH effect_refH); /* >> undoable */ + + SPAPI A_Err (*AEGP_GetNumInstalledEffects)( + A_long *num_installed_effectsPL); /* << */ + + // pass in AEGP_InstalledEffectKey_NONE for installed_effect_key to get first effect key + + SPAPI A_Err (*AEGP_GetNextInstalledEffect)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + AEGP_InstalledEffectKey *next_effectPH); /* << */ + + SPAPI A_Err (*AEGP_GetEffectName)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_EFFECT_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetEffectMatchName)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *match_nameZ); /* << space for A_char[AEGP_MAX_EFFECT_MATCH_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetEffectCategory)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *categoryZ); /* << space for A_char[AEGP_MAX_EFFECT_CATEGORY_NAME_SIZE] */ + + +} AEGP_EffectSuite1; + + + + +#define kAEGPEffectSuiteVersion2 2 /* frozen in AE 6.5 */ + +typedef struct AEGP_EffectSuite2 { + + SPAPI A_Err (*AEGP_GetLayerNumEffects)( + AEGP_LayerH layerH, /* >> */ + A_long *num_effectsPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerEffectByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_EffectIndex layer_effect_indexL, /* >> */ + AEGP_EffectRefH *effectPH); /* << MUST dispose with DisposeEffect*/ + + SPAPI A_Err (*AEGP_GetInstalledKeyFromLayerEffect)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_InstalledEffectKey *installed_effect_keyP); /* << */ + + SPAPI A_Err (*AEGP_GetEffectParamUnionByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + PF_ParamType *param_typeP, /* << */ + PF_ParamDefUnion *uP0); /* << DO NOT USE THE VALUE FROM THIS PARAMDEF! */ + + SPAPI A_Err (*AEGP_GetEffectFlags)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_EffectFlags *effect_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetEffectFlags)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_EffectFlags effect_flags_set_mask, /* >> */ + AEGP_EffectFlags effect_flags); /* >> */ + + SPAPI A_Err (*AEGP_ReorderEffect)( /* UNDOABLE */ + AEGP_EffectRefH effect_refH, /* >> */ + A_long effect_indexL); /* >> */ + + SPAPI A_Err (*AEGP_EffectCallGeneric)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + const A_Time *timePT, /* >> Use the timebase of the layer to which effect is applied. */ + void *effect_extraPV); /* <> */ + + SPAPI A_Err (*AEGP_DisposeEffect)( + AEGP_EffectRefH effect_refH ); /* >> */ + + SPAPI A_Err (*AEGP_ApplyEffect)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + AEGP_EffectRefH *effect_refPH); /* << MUST BE DISPOSED with AEGP_DisposeEffect */ + + SPAPI A_Err (*AEGP_DeleteLayerEffect)( + AEGP_EffectRefH effect_refH); /* >> undoable */ + + SPAPI A_Err (*AEGP_GetNumInstalledEffects)( + A_long *num_installed_effectsPL); /* << */ + + // pass in AEGP_InstalledEffectKey_NONE for installed_effect_key to get first effect key + + SPAPI A_Err (*AEGP_GetNextInstalledEffect)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + AEGP_InstalledEffectKey *next_effectPH); /* << */ + + SPAPI A_Err (*AEGP_GetEffectName)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_EFFECT_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetEffectMatchName)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *match_nameZ); /* << space for A_char[AEGP_MAX_EFFECT_MATCH_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetEffectCategory)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *categoryZ); /* << space for A_char[AEGP_MAX_EFFECT_CATEGORY_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_DuplicateEffect)( + AEGP_EffectRefH original_effect_refH, /* >> */ + AEGP_EffectRefH *duplicate_effect_refPH); /* << */ + +} AEGP_EffectSuite2; + + +#define kAEGPEffectSuiteVersion3 3 /* frozen in AE 7.0 */ + +typedef struct AEGP_EffectSuite3 { + + SPAPI A_Err (*AEGP_GetLayerNumEffects)( + AEGP_LayerH layerH, /* >> */ + A_long *num_effectsPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerEffectByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_EffectIndex layer_effect_indexL, /* >> */ + AEGP_EffectRefH *effectPH); /* << MUST dispose with DisposeEffect*/ + + SPAPI A_Err (*AEGP_GetInstalledKeyFromLayerEffect)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_InstalledEffectKey *installed_effect_keyP); /* << */ + + SPAPI A_Err (*AEGP_GetEffectParamUnionByIndex)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + PF_ParamIndex param_index, /* >> valid in range [0 to AEGP_GetEffectNumParamStreams - 1], where 0 is the effect's input layer */ + PF_ParamType *param_typeP, /* << */ + PF_ParamDefUnion *uP0); /* << DO NOT USE THE VALUE FROM THIS PARAMDEF! */ + + SPAPI A_Err (*AEGP_GetEffectFlags)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_EffectFlags *effect_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetEffectFlags)( + AEGP_EffectRefH effect_refH, /* >> */ + AEGP_EffectFlags effect_flags_set_mask, /* >> */ + AEGP_EffectFlags effect_flags); /* >> */ + + SPAPI A_Err (*AEGP_ReorderEffect)( /* UNDOABLE */ + AEGP_EffectRefH effect_refH, /* >> */ + A_long effect_indexL); /* >> */ + + /** new command parameter addded. To get old behaviour pass in PF_Cmd_COMPLETELY_GENERAL for effect_command **/ + SPAPI A_Err (*AEGP_EffectCallGeneric)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_EffectRefH effect_refH, /* >> */ + const A_Time *timePT, /* >> Use the timebase of the layer to which effect is applied. */ + PF_Cmd effect_cmd, /* >> new parameter from version 2 */ + void *effect_extraPV); /* <> */ + + SPAPI A_Err (*AEGP_DisposeEffect)( + AEGP_EffectRefH effect_refH ); /* >> */ + + SPAPI A_Err (*AEGP_ApplyEffect)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + AEGP_EffectRefH *effect_refPH); /* << MUST BE DISPOSED with AEGP_DisposeEffect */ + + SPAPI A_Err (*AEGP_DeleteLayerEffect)( + AEGP_EffectRefH effect_refH); /* >> undoable */ + + SPAPI A_Err (*AEGP_GetNumInstalledEffects)( + A_long *num_installed_effectsPL); /* << */ + + // pass in AEGP_InstalledEffectKey_NONE for installed_effect_key to get first effect key + + SPAPI A_Err (*AEGP_GetNextInstalledEffect)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + AEGP_InstalledEffectKey *next_effectPH); /* << */ + + SPAPI A_Err (*AEGP_GetEffectName)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_EFFECT_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetEffectMatchName)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *match_nameZ); /* << space for A_char[AEGP_MAX_EFFECT_MATCH_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetEffectCategory)( + AEGP_InstalledEffectKey installed_effect_key, /* >> */ + A_char *categoryZ); /* << space for A_char[AEGP_MAX_EFFECT_CATEGORY_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_DuplicateEffect)( + AEGP_EffectRefH original_effect_refH, /* >> */ + AEGP_EffectRefH *duplicate_effect_refPH); /* << */ +} AEGP_EffectSuite3; + +#define kAEGPLightSuite "AEGP Light Suite" +#define kAEGPLightSuiteVersion1 1 /* frozen in AE 5.0 */ + + + +typedef struct AEGP_LightSuite1 { + + SPAPI A_Err (*AEGP_GetLightType)( + AEGP_LayerH light_layerH, /* >> */ + AEGP_LightType *light_typeP); /* << */ + + +} AEGP_LightSuite1; + + + +#define kAEGPMaskSuite "AEGP Layer Mask Suite" +#define kAEGPMaskSuiteVersion5 6 /* frozen AE 10 */ + +typedef struct AEGP_MaskSuite5 { + + SPAPI A_Err (*AEGP_GetLayerNumMasks)( + AEGP_LayerH aegp_layerH, /* >> */ + A_long *num_masksPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerMaskByIndex)( + AEGP_LayerH aegp_layerH, /* >> */ + AEGP_MaskIndex mask_indexL, /* >> */ + AEGP_MaskRefH *maskPH); /* << must be disposed by calling AEGP_DisposeMask() */ + + SPAPI A_Err (*AEGP_DisposeMask)( + AEGP_MaskRefH mask_refH); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean *invertPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean invertB); /* << */ + + SPAPI A_Err (*AEGP_GetMaskMode)( + AEGP_MaskRefH mask_refH, /* >> */ + PF_MaskMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMode)( + AEGP_MaskRefH maskH, /* >> */ + PF_MaskMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur *blur_stateP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur blur_state); /* >> */ + + // AEGP_GetMaskName/SetMaskName are obsoleted. Use AEGP_GetNewDynamicStreamForMask + // and the name functions there + + SPAPI A_Err (*AEGP_GetMaskID)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_CreateNewMask)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_MaskRefH *mask_refPH, /* << */ + A_long *mask_indexPL0); /* << */ + + SPAPI A_Err (*AEGP_DeleteMaskFromLayer)( /* UNDOABLE */ + AEGP_MaskRefH mask_refH); /* >> still need to Dispose MaskRefH */ + + SPAPI A_Err (*AEGP_GetMaskColor)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_ColorVal *colorP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskColor)( + AEGP_MaskRefH mask_refH, /* >> */ + const AEGP_ColorVal *colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskLockState)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean *is_lockedPB); /* >> */ + + SPAPI A_Err (*AEGP_SetMaskLockState)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean lockB); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskIsRotoBezier)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean *is_roto_bezierPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskIsRotoBezier)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean is_roto_bezierB); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateMask)( + AEGP_MaskRefH orig_mask_refH, /* >> */ + AEGP_MaskRefH *duplicate_mask_refPH); /* << */ + +} AEGP_MaskSuite5; + +#define kAEGPMaskSuiteVersion4 5 /* frozen AE 6.5 */ + +typedef struct AEGP_MaskSuite4 { + + SPAPI A_Err (*AEGP_GetLayerNumMasks)( + AEGP_LayerH aegp_layerH, /* >> */ + A_long *num_masksPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerMaskByIndex)( + AEGP_LayerH aegp_layerH, /* >> */ + AEGP_MaskIndex mask_indexL, /* >> */ + AEGP_MaskRefH *maskPH); /* << must be disposed by calling AEGP_DisposeMask() */ + + SPAPI A_Err (*AEGP_DisposeMask)( + AEGP_MaskRefH mask_refH); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean *invertPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean invertB); /* << */ + + SPAPI A_Err (*AEGP_GetMaskMode)( + AEGP_MaskRefH mask_refH, /* >> */ + PF_MaskMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMode)( + AEGP_MaskRefH maskH, /* >> */ + PF_MaskMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur *blur_stateP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur blur_state); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskName)( + AEGP_MaskRefH mask_refH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_MASK_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_SetMaskName)( + AEGP_MaskRefH mask_refH, /* >> */ + A_char *nameZ); /* >> space for A_char[AEGP_MAX_MASK_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetMaskID)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_CreateNewMask)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_MaskRefH *mask_refPH, /* << */ + A_long *mask_indexPL0); /* << */ + + SPAPI A_Err (*AEGP_DeleteMaskFromLayer)( /* UNDOABLE */ + AEGP_MaskRefH mask_refH); /* >> still need to Dispose MaskRefH */ + + SPAPI A_Err (*AEGP_GetMaskColor)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_ColorVal *colorP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskColor)( + AEGP_MaskRefH mask_refH, /* >> */ + const AEGP_ColorVal *colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskLockState)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean *is_lockedPB); /* >> */ + + SPAPI A_Err (*AEGP_SetMaskLockState)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean lockB); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskIsRotoBezier)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean *is_roto_bezierPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskIsRotoBezier)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean is_roto_bezierB); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateMask)( + AEGP_MaskRefH orig_mask_refH, /* >> */ + AEGP_MaskRefH *duplicate_mask_refPH); /* << */ + +} AEGP_MaskSuite4; + +#define kAEGPMaskSuiteVersion3 4 /* frozen AE 6.0 */ + +typedef struct AEGP_MaskSuite3 { + + SPAPI A_Err (*AEGP_GetLayerNumMasks)( + AEGP_LayerH aegp_layerH, /* >> */ + A_long *num_masksPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerMaskByIndex)( + AEGP_LayerH aegp_layerH, /* >> */ + AEGP_MaskIndex mask_indexL, /* >> */ + AEGP_MaskRefH *maskPH); /* << must be disposed by calling AEGP_DisposeMask() */ + + SPAPI A_Err (*AEGP_DisposeMask)( + AEGP_MaskRefH mask_refH); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean *invertPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean invertB); /* << */ + + SPAPI A_Err (*AEGP_GetMaskMode)( + AEGP_MaskRefH mask_refH, /* >> */ + PF_MaskMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMode)( + AEGP_MaskRefH maskH, /* >> */ + PF_MaskMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur *blur_stateP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur blur_state); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskName)( + AEGP_MaskRefH mask_refH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_MASK_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_SetMaskName)( + AEGP_MaskRefH mask_refH, /* >> */ + A_char *nameZ); /* >> space for A_char[AEGP_MAX_MASK_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetMaskID)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_CreateNewMask)( /* UNDOABLE */ + AEGP_LayerH layerH, /* >> */ + AEGP_MaskRefH *mask_refPH, /* << */ + A_long *mask_indexPL0); /* << */ + + SPAPI A_Err (*AEGP_DeleteMaskFromLayer)( /* UNDOABLE */ + AEGP_MaskRefH mask_refH); /* >> still need to Dispose MaskRefH */ + + SPAPI A_Err (*AEGP_GetMaskColor)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_ColorVal *colorP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskColor)( + AEGP_MaskRefH mask_refH, /* >> */ + const AEGP_ColorVal *colorP); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskLockState)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean *is_lockedPB); /* >> */ + + SPAPI A_Err (*AEGP_SetMaskLockState)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean lockB); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskIsRotoBezier)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean *is_roto_bezierPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskIsRotoBezier)( + AEGP_MaskRefH mask_refH, /* <> */ + A_Boolean is_roto_bezierB); /* >> */ + +} AEGP_MaskSuite3; + +#define kAEGPMaskSuiteVersion1 2 /* frozen in AE 5.0 */ + +typedef struct AEGP_MaskSuite1 { + + SPAPI A_Err (*AEGP_GetLayerNumMasks)( + AEGP_LayerH aegp_layerH, /* >> */ + A_long *num_masksPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerMaskByIndex)( + AEGP_LayerH aegp_layerH, /* >> */ + AEGP_MaskIndex mask_indexL, /* >> */ + AEGP_MaskRefH *maskPH); /* << must be disposed by calling AEGP_DisposeMask() */ + + SPAPI A_Err (*AEGP_DisposeMask)( + AEGP_MaskRefH mask_refH); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean *invertPB); /* << */ + + SPAPI A_Err (*AEGP_GetMaskMode)( + AEGP_MaskRefH mask_refH, /* >> */ + PF_MaskMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_GetMaskName)( + AEGP_MaskRefH mask_refH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_MASK_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetMaskID)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_CreateNewMask)( //undoable + AEGP_LayerH layerH, /* >> */ + AEGP_MaskRefH *mask_refPH, /* << */ + A_long *mask_indexPL0);/* << */ + + SPAPI A_Err (*AEGP_DeleteMaskFromLayer)( //undoable + AEGP_MaskRefH mask_refH); /* >> still need to Dispose MaskRefH */ + +} AEGP_MaskSuite1; + +#define kAEGPMaskSuiteVersion2 3 /* frozen in AE 5.5 */ + +typedef struct AEGP_MaskSuite2 { + + SPAPI A_Err (*AEGP_GetLayerNumMasks)( + AEGP_LayerH aegp_layerH, /* >> */ + A_long *num_masksPL); /* << */ + + SPAPI A_Err (*AEGP_GetLayerMaskByIndex)( + AEGP_LayerH aegp_layerH, /* >> */ + AEGP_MaskIndex mask_indexL, /* >> */ + AEGP_MaskRefH *maskPH); /* << must be disposed by calling AEGP_DisposeMask() */ + + SPAPI A_Err (*AEGP_DisposeMask)( + AEGP_MaskRefH mask_refH); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean *invertPB); /* << */ + + SPAPI A_Err (*AEGP_SetMaskInvert)( + AEGP_MaskRefH mask_refH, /* >> */ + A_Boolean invertB); /* << */ + + SPAPI A_Err (*AEGP_GetMaskMode)( + AEGP_MaskRefH mask_refH, /* >> */ + PF_MaskMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMode)( + AEGP_MaskRefH maskH, /* >> */ + PF_MaskMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur *blur_stateP); /* << */ + + SPAPI A_Err (*AEGP_SetMaskMotionBlurState)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskMBlur blur_state); /* >> */ + + SPAPI A_Err (*AEGP_GetMaskName)( + AEGP_MaskRefH mask_refH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_MASK_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetMaskID)( + AEGP_MaskRefH mask_refH, /* >> */ + AEGP_MaskIDVal *id_valP); /* << */ + + SPAPI A_Err (*AEGP_CreateNewMask)( //undoable + AEGP_LayerH layerH, /* >> */ + AEGP_MaskRefH *mask_refPH, /* << */ + A_long *mask_indexPL0); /* << */ + + SPAPI A_Err (*AEGP_DeleteMaskFromLayer)( //undoable + AEGP_MaskRefH mask_refH); /* >> still need to Dispose MaskRefH */ + +} AEGP_MaskSuite2; +/** + ** Camera Suite + ** + **/ +#define kAEGPCameraSuite "AEGP Camera Suite" +#define kAEGPCameraSuiteVersion1 1 /* frozen in AE 5.0 */ + + + +typedef struct AEGP_CameraSuite1 { + + SPAPI A_Err (*AEGP_GetCamera)( + PR_RenderContextH render_contextH, /* >> */ + const A_Time *comp_timeP, /* >> */ + AEGP_LayerH *camera_layerPH); /* << */ + + SPAPI A_Err (*AEGP_GetCameraType)( + AEGP_LayerH camera_layerH, /* >> */ + AEGP_CameraType *camera_typeP); /* << */ + + + SPAPI A_Err (*AEGP_GetDefaultCameraDistanceToImagePlane)( + AEGP_CompH compH, /* >> */ + A_FpLong *dist_to_planePF); /* << */ + +} AEGP_CameraSuite1; + + +#define kAEGPItemSuite "AEGP Item Suite" + +#define kAEGPItemSuiteVersion8 13 /* frozen in AE 9.0 */ + +typedef struct AEGP_ItemSuite8 { + + SPAPI A_Err (*AEGP_GetFirstProjItem)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetNextProjItem)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_PluginID pluginID, // in + AEGP_ItemH itemH, /* >> */ + AEGP_MemHandle *unicode_namePH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_SetItemName)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> */ + const A_UTF16Char *nameZ); /* >> null terminated UTF16 */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_SetItemParentFolder)( + AEGP_ItemH itemH, /* <> */ + AEGP_ItemH parent_folder_itemH); /* >> */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_UTF16Char *nameZ, /* >> null terminated UTF16 */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << allocated and owned by AE */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* UNDOABLE. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + SPAPI A_Err (*AEGP_GetItemCommentLength)( + AEGP_ItemH itemH, /* >> */ + A_u_long *buf_sizePLu); /* << */ + + SPAPI A_Err (*AEGP_GetItemComment)( + AEGP_ItemH itemH, /* >> */ + A_u_long buf_sizeLu, /* >> */ + A_char *commentZ); /* << */ + + SPAPI A_Err (*AEGP_SetItemComment)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + const A_char *commentZ); /* >> */ + + SPAPI A_Err (*AEGP_GetItemLabel)( + AEGP_ItemH itemH, /* >> */ + AEGP_LabelID *labelP); /* << */ + + SPAPI A_Err (*AEGP_SetItemLabel)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + AEGP_LabelID label); /* >> */ + + SPAPI A_Err (*AEGP_GetItemMRUView)( + AEGP_ItemH itemH, // >> + AEGP_ItemViewP *mru_viewP); // << + +} AEGP_ItemSuite8; + +#define kAEGPItemSuiteVersion7 11 /* frozen in AE 8.0 */ + +typedef struct AEGP_ItemSuite7 { + + SPAPI A_Err (*AEGP_GetFirstProjItem)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetNextProjItem)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_ItemH itemH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_SetItemName)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> */ + const A_char *nameZ); /* >> up to A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_SetItemParentFolder)( + AEGP_ItemH itemH, /* <> */ + AEGP_ItemH parent_folder_itemH); /* >> */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_char *nameZ, /* >> */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << allocated and owned by AE */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* UNDOABLE. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + SPAPI A_Err (*AEGP_GetItemCommentLength)( + AEGP_ItemH itemH, /* >> */ + A_u_long *buf_sizePLu); /* << */ + + SPAPI A_Err (*AEGP_GetItemComment)( + AEGP_ItemH itemH, /* >> */ + A_u_long buf_sizeLu, /* >> */ + A_char *commentZ); /* << */ + + SPAPI A_Err (*AEGP_SetItemComment)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + const A_char *commentZ); /* >> */ + + SPAPI A_Err (*AEGP_GetItemLabel)( + AEGP_ItemH itemH, /* >> */ + AEGP_LabelID *labelP); /* << */ + + SPAPI A_Err (*AEGP_SetItemLabel)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + AEGP_LabelID label); /* >> */ + + SPAPI A_Err (*AEGP_GetItemMRUView)( + AEGP_ItemH itemH, // >> + AEGP_ItemViewP *mru_viewP); // << + +} AEGP_ItemSuite7; + + +#define kAEGPItemSuiteVersion6 10 /* frozen in AE 7.0 */ + +typedef struct AEGP_ItemSuite6 { + + SPAPI A_Err (*AEGP_GetFirstProjItem)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ItemH *itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetNextProjItem)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_ItemH itemH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_SetItemName)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> */ + const A_char *nameZ); /* >> up to A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_SetItemParentFolder)( + AEGP_ItemH itemH, /* <> */ + AEGP_ItemH parent_folder_itemH); /* >> */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_char *nameZ, /* >> */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << allocated and owned by AE */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* UNDOABLE. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + SPAPI A_Err (*AEGP_GetItemCommentLength)( + AEGP_ItemH itemH, /* >> */ + A_u_long *buf_sizePLu); /* << */ + + SPAPI A_Err (*AEGP_GetItemComment)( + AEGP_ItemH itemH, /* >> */ + A_u_long buf_sizeLu, /* >> */ + A_char *commentZ); /* << */ + + SPAPI A_Err (*AEGP_SetItemComment)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + const A_char *commentZ); /* >> */ + + SPAPI A_Err (*AEGP_GetItemLabel)( + AEGP_ItemH itemH, /* >> */ + AEGP_LabelID *labelP); /* << */ + + SPAPI A_Err (*AEGP_SetItemLabel)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + AEGP_LabelID label); /* >> */ + +} AEGP_ItemSuite6; + + +#define kAEGPItemSuiteVersion5 7 /* frozen in AE 6.5 */ + +typedef struct AEGP_ItemSuite5 { + + SPAPI A_Err (*AEGP_GetNextItem)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_ItemH itemH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_SetItemParentFolder)( + AEGP_ItemH itemH, /* <> */ + AEGP_ItemH parent_folder_itemH); /* >> */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_char *nameZ, /* >> */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << allocated and owned by AE */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* UNDOABLE. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + SPAPI A_Err (*AEGP_GetItemCommentLength)( + AEGP_ItemH itemH, /* >> */ + A_u_long *buf_sizePLu); /* << */ + + SPAPI A_Err (*AEGP_GetItemComment)( + AEGP_ItemH itemH, /* >> */ + A_u_long buf_sizeLu, /* >> */ + char *commentZ); /* << */ + + SPAPI A_Err (*AEGP_SetItemComment)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + const char *commentZ); /* >> */ + +} AEGP_ItemSuite5; + + +#define kAEGPItemSuiteVersion4 6 /* frozen in AE 6.0 */ + +typedef struct AEGP_ItemSuite4 { + + SPAPI A_Err (*AEGP_GetNextItem)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_ItemH itemH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_char *nameZ, /* >> */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << allocated and owned by AE */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* UNDOABLE. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + SPAPI A_Err (*AEGP_GetItemCommentLength)( + AEGP_ItemH itemH, /* >> */ + A_u_long *buf_sizePLu); /* << */ + + SPAPI A_Err (*AEGP_GetItemComment)( + AEGP_ItemH itemH, /* >> */ + A_u_long buf_sizeLu, /* >> */ + char *commentZ); /* << */ + + SPAPI A_Err (*AEGP_SetItemComment)( + AEGP_ItemH itemH, /* >> UNDOABLE */ + const char *commentZ); /* >> */ + +} AEGP_ItemSuite4; + + +#define kAEGPItemSuite "AEGP Item Suite" +#define kAEGPItemSuiteVersion3 5 /* frozen in 5.5.1 */ + +typedef struct AEGP_ItemSuite3 { + + SPAPI A_Err (*AEGP_GetNextItem)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << could be NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_ItemH itemH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Solid/Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_GetItemSolidColor)( /* error if item isn't AEGP_ItemType_SOLID! */ + AEGP_ItemH itemH, /* >> */ + AEGP_ColorVal *colorP); /* << */ + + SPAPI A_Err (*AEGP_SetSolidColor)( /* error if item isn't AEGP_ItemType_SOLID! */ + AEGP_ItemH itemH, /* <> */ + AEGP_ColorVal color); /* >> */ + + SPAPI A_Err (*AEGP_SetSolidDimensions)( /* error if item isn't AEGP_ItemType_SOLID! */ + AEGP_ItemH itemH, /* <> */ + A_short widthS, /* >> */ + A_short heightS); /* >> */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_char *nameZ, /* >> */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << */ /* allocated and owned by project (AE) */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* Undoable. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + +} AEGP_ItemSuite3; + +/**************************************************************************************************/ +#define kAEGPKeyframeSuite "AEGP Keyframe Suite" +#define kAEGPKeyframeSuiteVersion3 3 /* frozen in 6.5 */ + +typedef struct AEGP_KeyframeSuite3 { + + // returns AEGP_NumKF_NO_DATA if it's a AEGP_StreamType_NO_DATA, and you can't retrieve any values + // returns zero if no keyframes (but might have an expression, so not necessarily constant) + + + SPAPI A_Err (*AEGP_GetStreamNumKFs)( + AEGP_StreamRefH streamH, /* >> */ + A_long *num_kfsPL); /* << */ + + + SPAPI A_Err (*AEGP_GetKeyframeTime)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *timePT); /* << */ + + // leaves stream unchanged if a keyframe already exists at specified time + SPAPI A_Err (*AEGP_InsertKeyframe)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* <> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + AEGP_KeyframeIndex *key_indexP); /* << */ + + SPAPI A_Err (*AEGP_DeleteKeyframe)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* <> */ + AEGP_KeyframeIndex key_index); /* >> */ + + SPAPI A_Err (*AEGP_GetNewKeyframeValue)( // dispose using AEGP_DisposeStreamValue() + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_StreamValue *valueP); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeValue)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + const AEGP_StreamValue *valueP); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetStreamValueDimensionality)( + AEGP_StreamRefH streamH, /* >> */ + A_short *value_dimPS); /* << */ + + SPAPI A_Err (*AEGP_GetStreamTemporalDimensionality)( + AEGP_StreamRefH streamH, /* >> */ + A_short *temporal_dimPS); /* << */ + + SPAPI A_Err (*AEGP_GetNewKeyframeSpatialTangents)( // dispose using AEGP_DisposeStreamValue() + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_StreamValue *in_tanP0, /* << */ + AEGP_StreamValue *out_tanP0); /* << */ + + // In AEGP_KeyframeSuite2 and prior versions, the values returned from + // this function were wrong when called on an effect point control stream or + // anchor point. They were not multiplied by the layer size. Now they are. + SPAPI A_Err (*AEGP_SetKeyframeSpatialTangents)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + const AEGP_StreamValue *in_tanP0, /* >> not adopted */ + const AEGP_StreamValue *out_tanP0); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetKeyframeTemporalEase)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + A_long dimensionL, /* >> ranges from 0..TemporalDimensionality-1 */ + AEGP_KeyframeEase *in_easeP0, /* << */ + AEGP_KeyframeEase *out_easeP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeTemporalEase)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + A_long dimensionL, /* >> ranges from 0..TemporalDimensionality-1 */ + const AEGP_KeyframeEase *in_easeP0, /* >> not adopted */ + const AEGP_KeyframeEase *out_easeP0); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetKeyframeFlags)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeFlags *flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeFlag)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeFlags flag, /* >> set one flag at a time */ + A_Boolean true_falseB); /* >> */ + + SPAPI A_Err (*AEGP_GetKeyframeInterpolation)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeInterpolationType *in_interpP0, /* << */ + AEGP_KeyframeInterpolationType *out_interpP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeInterpolation)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeInterpolationType in_interp, /* >> */ + AEGP_KeyframeInterpolationType out_interp); /* >> */ + + SPAPI A_Err (*AEGP_StartAddKeyframes)( + AEGP_StreamRefH streamH, + AEGP_AddKeyframesInfoH *akPH); /* << */ + + + SPAPI A_Err (*AEGP_AddKeyframes)( + AEGP_AddKeyframesInfoH akH, /* <> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_long *key_indexPL); /* >> */ + + SPAPI A_Err (*AEGP_SetAddKeyframe)( + AEGP_AddKeyframesInfoH akH, /* <> */ + A_long key_indexL, /* >> */ + const AEGP_StreamValue *valueP); /* >> */ + + SPAPI A_Err (*AEGP_EndAddKeyframes)( /* UNDOABLE */ + A_Boolean addB, + AEGP_AddKeyframesInfoH akH); /* >> */ + +} AEGP_KeyframeSuite3; + +#define kAEGPKeyframeSuiteVersion2 2 /* frozen in 5.5 */ + +typedef struct AEGP_KeyframeSuite2 { + + // returns AEGP_NumKF_NO_DATA if it's a AEGP_StreamType_NO_DATA, and you can't retrieve any values + // returns zero if no keyframes (but might have an expression, so not necessarily constant) + + + SPAPI A_Err (*AEGP_GetStreamNumKFs)( + AEGP_StreamRefH streamH, /* >> */ + A_long *num_kfsPL); /* << */ + + + SPAPI A_Err (*AEGP_GetKeyframeTime)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *timePT); /* << */ + + // leaves stream unchanged if a keyframe already exists at specified time + SPAPI A_Err (*AEGP_InsertKeyframe)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* <> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + AEGP_KeyframeIndex *key_indexP); /* << */ + + SPAPI A_Err (*AEGP_DeleteKeyframe)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* <> */ + AEGP_KeyframeIndex key_index); /* >> */ + + SPAPI A_Err (*AEGP_GetNewKeyframeValue)( // dispose using AEGP_DisposeStreamValue() + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_StreamValue *valueP); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeValue)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + const AEGP_StreamValue *valueP); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetStreamValueDimensionality)( + AEGP_StreamRefH streamH, /* >> */ + A_short *value_dimPS); /* << */ + + SPAPI A_Err (*AEGP_GetStreamTemporalDimensionality)( + AEGP_StreamRefH streamH, /* >> */ + A_short *temporal_dimPS); /* << */ + + SPAPI A_Err (*AEGP_GetNewKeyframeSpatialTangents)( // dispose using AEGP_DisposeStreamValue() + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_StreamValue *in_tanP0, /* << */ + AEGP_StreamValue *out_tanP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeSpatialTangents)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + const AEGP_StreamValue *in_tanP0, /* >> not adopted */ + const AEGP_StreamValue *out_tanP0); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetKeyframeTemporalEase)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + A_long dimensionL, /* >> ranges from 0..TemporalDimensionality-1 */ + AEGP_KeyframeEase *in_easeP0, /* << */ + AEGP_KeyframeEase *out_easeP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeTemporalEase)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + A_long dimensionL, /* >> ranges from 0..TemporalDimensionality-1 */ + const AEGP_KeyframeEase *in_easeP0, /* >> not adopted */ + const AEGP_KeyframeEase *out_easeP0); /* >> not adopted */ + + SPAPI A_Err (*AEGP_GetKeyframeFlags)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeFlags *flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeFlag)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeFlags flag, /* >> set one flag at a time */ + A_Boolean true_falseB); /* >> */ + + SPAPI A_Err (*AEGP_GetKeyframeInterpolation)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeInterpolationType *in_interpP0, /* << */ + AEGP_KeyframeInterpolationType *out_interpP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeInterpolation)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeInterpolationType in_interp, /* >> */ + AEGP_KeyframeInterpolationType out_interp); /* >> */ + + SPAPI A_Err (*AEGP_StartAddKeyframes)( + AEGP_StreamRefH streamH, + AEGP_AddKeyframesInfoH *akPH); /* << */ + + + SPAPI A_Err (*AEGP_AddKeyframes)( + AEGP_AddKeyframesInfoH akH, /* <> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + A_long *key_indexPL); /* >> */ + + SPAPI A_Err (*AEGP_SetAddKeyframe)( + AEGP_AddKeyframesInfoH akH, /* <> */ + A_long key_indexL, /* >> */ + const AEGP_StreamValue *valueP); /* >> */ + + SPAPI A_Err (*AEGP_EndAddKeyframes)( /* UNDOABLE */ + A_Boolean addB, + AEGP_AddKeyframesInfoH akH); /* >> */ + +} AEGP_KeyframeSuite2; + +#define kAEGPKeyframeSuiteVersion1 1 /* frozen in AE 5.0 */ + +typedef struct AEGP_KeyframeSuite1 { + + // returns AEGP_NumKF_NO_DATA if it's a AEGP_StreamType_NO_DATA, and you can't retrieve any values + // returns zero if no keyframes (but might have an expression, so not necessarily constant) + + + SPAPI A_Err (*AEGP_GetStreamNumKFs)( + AEGP_StreamRefH streamH, /* >> */ + A_long *num_kfsPL); /* << */ + + + SPAPI A_Err (*AEGP_GetKeyframeTime)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_LTimeMode time_mode, /* >> */ + A_Time *timePT); /* << */ + + // leaves stream unchanged if a keyframe already exists at specified time + SPAPI A_Err (*AEGP_InsertKeyframe)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* <> */ + AEGP_LTimeMode time_mode, /* >> */ + const A_Time *timePT, /* >> */ + AEGP_KeyframeIndex *key_indexP); /* << */ + + SPAPI A_Err (*AEGP_DeleteKeyframe)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* <> */ + AEGP_KeyframeIndex key_index); /* >> */ + + SPAPI A_Err (*AEGP_GetNewKeyframeValue)( // dispose using AEGP_DisposeStreamValue() + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_StreamValue *valueP); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeValue)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + const AEGP_StreamValue *valueP); /* >> */ // not adopted + + SPAPI A_Err (*AEGP_GetStreamValueDimensionality)( + AEGP_StreamRefH streamH, /* >> */ + short *value_dimPS); /* << */ + + SPAPI A_Err (*AEGP_GetStreamTemporalDimensionality)( + AEGP_StreamRefH streamH, /* >> */ + short *temporal_dimPS); /* << */ + + SPAPI A_Err (*AEGP_GetNewKeyframeSpatialTangents)( // dispose using AEGP_DisposeStreamValue() + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_StreamValue *in_tanP0, /* << */ + AEGP_StreamValue *out_tanP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeSpatialTangents)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + const AEGP_StreamValue *in_tanP0, /* >> */ // not adopted + const AEGP_StreamValue *out_tanP0); /* >> */ // not adopted + + SPAPI A_Err (*AEGP_GetKeyframeTemporalEase)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + A_long dimensionL, /* >> */ // ranges from 0..TemporalDimensionality-1 + AEGP_KeyframeEase *in_easeP0, /* << */ + AEGP_KeyframeEase *out_easeP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeTemporalEase)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + A_long dimensionL, /* >> */ // ranges from 0..TemporalDimensionality-1 + const AEGP_KeyframeEase *in_easeP0, /* >> */ // not adopted + const AEGP_KeyframeEase *out_easeP0); /* >> */ // not adopted + + SPAPI A_Err (*AEGP_GetKeyframeFlags)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeFlags *flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeFlag)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeFlags flag, /* >> */ // set one at a time + A_Boolean true_falseB); /* >> */ + + SPAPI A_Err (*AEGP_GetKeyframeInterpolation)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeInterpolationType *in_interpP0, /* << */ + AEGP_KeyframeInterpolationType *out_interpP0); /* << */ + + SPAPI A_Err (*AEGP_SetKeyframeInterpolation)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_KeyframeIndex key_index, /* >> */ + AEGP_KeyframeInterpolationType in_interp, /* >> */ + AEGP_KeyframeInterpolationType out_interp); /* >> */ + +} AEGP_KeyframeSuite1; + +/* frozen AE 5.5 */ +#define kAEGPItemSuiteVersion2 4 + +typedef struct AEGP_ItemSuite2 { + + SPAPI A_Err (*AEGP_GetNextItem)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << could be NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_ItemH itemH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Solid/Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_GetItemSolidColor)( /* error if item isn't AEGP_ItemType_SOLID! */ + AEGP_ItemH itemH, /* >> */ + AEGP_ColorVal *colorP); /* << */ + + SPAPI A_Err (*AEGP_SetSolidColor)( /* error if item isn't AEGP_ItemType_SOLID! */ + AEGP_ItemH itemH, /* <> */ + AEGP_ColorVal color); /* >> */ + + SPAPI A_Err (*AEGP_SetSolidDimensions)( /* error if item isn't AEGP_ItemType_SOLID! */ + AEGP_ItemH itemH, /* <> */ + A_short widthS, /* >> */ + A_short heightS); /* >> */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_char *nameZ, /* >> */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << */ /* allocated and owned by project (AE) */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* Undoable. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + + // work on Comps and Footage items. + SPAPI A_Err (*AEGP_RenderNewItemSoundData)( // AEGP_SoundDataH must be disposed. + AEGP_ItemH itemH, // >> + const A_Time *start_timePT, // >> + const A_Time *durationPT, // >> + const AEGP_SoundDataFormat* sound_formatP, // >> + AEGP_SoundDataH *new_sound_dataPH); // << can return NULL if no audio + +} AEGP_ItemSuite2; + + +#define kAEGPItemSuiteVersion1 3 /* frozen in AE 5.0 */ + +typedef struct AEGP_ItemSuite1 { + + SPAPI A_Err (*AEGP_GetNextItem)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *next_itemPH); /* << NULL after last item */ + + SPAPI A_Err (*AEGP_GetActiveItem)( + AEGP_ItemH *itemPH); /* << could be NULL if none is active */ + + SPAPI A_Err (*AEGP_IsItemSelected)( + AEGP_ItemH itemH, /* >> */ + A_Boolean *selectedPB); /* << */ + + SPAPI A_Err (*AEGP_SelectItem)( + AEGP_ItemH itemH, /* >> */ + A_Boolean selectB, /* >> allows to select or deselect the item */ + A_Boolean deselect_othersB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemType)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemType *item_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetTypeName)( + AEGP_ItemType item_type, /* << */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_TYPE_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemName)( + AEGP_ItemH itemH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_ITEM_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetItemID)( + AEGP_ItemH itemH, /* >> */ + A_long *item_idPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemFlags)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemFlags *item_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetItemUseProxy)( /* UNDOABLE */ + AEGP_ItemH itemH, /* >> error if has_proxy is FALSE! */ + A_Boolean use_proxyB); /* >> */ + + SPAPI A_Err (*AEGP_GetItemParentFolder)( + AEGP_ItemH itemH, /* >> */ + AEGP_ItemH *parent_folder_itemPH); /* << */ + + SPAPI A_Err (*AEGP_GetItemDuration)( /* Returns the result in the item's native timespace: */ + AEGP_ItemH itemH, /* >> Comp -> comp time, */ + A_Time *durationPT); /* << Footage -> footage time, */ + /* Solid/Folder -> 0 (no duration) */ + + SPAPI A_Err (*AEGP_GetItemCurrentTime)( /* Returns the result in the item's native timespace (not updated while rendering)*/ + AEGP_ItemH itemH, /* >> */ + A_Time *curr_timePT); /* << */ + + SPAPI A_Err (*AEGP_GetItemDimensions)( + AEGP_ItemH itemH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetItemPixelAspectRatio)( + AEGP_ItemH itemH, /* >> */ + A_Ratio *pix_aspect_ratioPRt); /* << */ + + SPAPI A_Err (*AEGP_DeleteItem)( /* UNDOABLE */ + AEGP_ItemH itemH); /* >> removes item from all comps */ + + SPAPI A_Err (*AEGP_GetItemSolidColor)( /* error if item isn't AEGP_ItemType_SOLID! */ + AEGP_ItemH itemH, /* >> */ + AEGP_ColorVal *colorP); /* << */ + + SPAPI A_Err (*AEGP_CreateNewFolder)( + const A_char *nameZ, /* >> */ + AEGP_ItemH parent_folderH0, /* >> */ + AEGP_ItemH *new_folderPH); /* << */ /* allocated and owned by project (AE) */ + + SPAPI A_Err (*AEGP_SetItemCurrentTime)( /* Undoable. Use the item's native timespace */ + AEGP_ItemH itemH, /* >> */ + const A_Time *new_timePT); /* >> */ + + + // work on Comps and Footage items. + SPAPI A_Err (*AEGP_RenderNewItemSoundData)( // AEGP_SoundDataH must be disposed. + AEGP_ItemH itemH, // >> + const A_Time *start_timePT, // >> + const A_Time *durationPT, // >> + const AEGP_SoundDataFormat* sound_formatP, // >> + AEGP_SoundDataH *new_sound_dataPH); // << can return NULL if no audio + +} AEGP_ItemSuite1; + +/*********************************************************/ + +#define kAEGPUtilitySuiteVersion5 11 /* frozen in AE 8.0 */ + +typedef struct AEGP_UtilitySuite5 { + + SPAPI A_Err (*AEGP_ReportInfo)( /* displays dialog with name of plugin followed by info string */ + AEGP_PluginID aegp_plugin_id, /* >> */ + const A_char *info_stringZ); /* >> */ + + + SPAPI A_Err (*AEGP_GetDriverPluginInitFuncVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_GetDriverImplementationVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_StartQuietErrors)( + AEGP_ErrReportState *err_stateP); /* << */ + + SPAPI A_Err (*AEGP_EndQuietErrors)( + A_Boolean report_quieted_errorsB, /* >> currently reports last quieted error */ + AEGP_ErrReportState *err_stateP); /* >> */ + + SPAPI A_Err (*AEGP_GetLastErrorMessage)( + A_long buffer_size, /* >> size of character buffer */ + A_char *error_string, /* << */ + A_Err *error_num); /* << */ + + SPAPI A_Err (*AEGP_StartUndoGroup)( /* MUST be balanced with call to AEGP_EndUndoGroup() */ + const A_char *undo_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_EndUndoGroup)(void); + + SPAPI A_Err (*AEGP_RegisterWithAEGP)( + AEGP_GlobalRefcon global_refcon, /* >> global refcon passed in command handlers */ + const A_char *plugin_nameZ, /* >> name of this plugin. AEGP_MAX_PLUGIN_NAME_SIZE */ + AEGP_PluginID *plugin_id); /* << id for plugin to use in other AEGP calls */ + + SPAPI A_Err (*AEGP_GetMainHWND)( + void *main_hwnd); /* << */ + + SPAPI A_Err (*AEGP_ShowHideAllFloaters)( + A_Boolean include_tool_palB); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalGetForeColor)( + AEGP_ColorVal *fore_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalGetBackColor)( + AEGP_ColorVal *back_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalSetForeColor)( + const AEGP_ColorVal *fore_colorP); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalSetBackColor)( + const AEGP_ColorVal *back_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalGetFillColor)( + A_Boolean *is_fill_color_definedPB, /* << */ + AEGP_ColorVal *fill_colorP); /* << only valid if is_fill_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalGetStrokeColor)( + A_Boolean *is_stroke_color_definedPB, /* << */ + AEGP_ColorVal *stroke_colorP); /* << only valid if is_stroke_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalSetFillColor)( + const AEGP_ColorVal *fill_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalSetStrokeColor)( + const AEGP_ColorVal *stroke_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalIsFillColorUIFrontmost)( /* Otherwise, StrokeColor is frontmost */ + A_Boolean *is_fill_color_selectedPB); /* << */ + + SPAPI A_Err (*AEGP_ConvertFpLongToHSFRatio)( + A_FpLong numberF, /* >> */ + A_Ratio *ratioPR); /* << */ + + SPAPI A_Err (*AEGP_ConvertHSFRatioToFpLong)( + A_Ratio ratioR, /* << */ + A_FpLong *numberPF); /* >> */ + + // this routine is safe to call from the non-main + // thread. It is asynchronous and will return before the idle handler is called. + // The Suite routines to get this pointer are not + // thread safe, therefore you need to save it off + // in the main thread for use by the child thread. + SPAPI A_Err (*AEGP_CauseIdleRoutinesToBeCalled)(void); + + + // Determine if after effects is running in a mode where there is no + // user interface, and attempting to interact with the user (via a modal dialog) + // will hang the application. + // This will not change during a run. Use it to optimize your plugin at startup + // to not create a user interface and make AE launch faster, and not break + // when running multiple instances of a service. + SPAPI A_Err (*AEGP_GetSuppressInteractiveUI)(A_Boolean* ui_is_suppressedPB); // out + + // this call writes text to the console if one is available. One is guaranteed to be available + // if ui_is_suppressedB == true. + // In general use the call AEGP_ReportInfo() as it will write to the console in + // non-interactive modes, and use a dialog in interactive modes. + SPAPI A_Err (*AEGP_WriteToOSConsole)(const A_char* textZ); // in + + // this writes an entry into the debug log, or to the command line if launched + // with the -debug flag. + SPAPI A_Err (*AEGP_WriteToDebugLog)(const A_char* subsystemZ, // in + const A_char* event_typeZ, // in + const A_char * infoZ); // in + + + SPAPI A_Err (*AEGP_IsScriptingAvailable)(A_Boolean* outAvailablePB); + + // Execute a script. + // The script text can either be in UTF-8, or the current + // application encoding. + // The result is the result string if OK. It is optional. + // The error is the error string if an error occurred. It is optional. + // the result and error are in the encoding specified by platform_encodingB + SPAPI A_Err (*AEGP_ExecuteScript)(AEGP_PluginID inPlugin_id, + const A_char* inScriptZ, // in + const A_Boolean platform_encodingB, // in + AEGP_MemHandle* outResultPH0, + AEGP_MemHandle* outErrorStringPH0); + + SPAPI A_Err (*AEGP_HostIsActivated)(A_Boolean *is_activatedPB); + + SPAPI A_Err (*AEGP_GetPluginPlatformRef)(AEGP_PluginID plug_id, void** plat_refPPV); // on the Mac, it is a CFBundleRef to your mach-o plugin or NULL for a CFM plug-in; on Windows it is set to NULL for now + + SPAPI A_Err (*AEGP_UpdateFontList)(void); // Rescan the system font list. This will return quickly if the font list hasn't changed. + +} AEGP_UtilitySuite5; + + + +#define kAEGPUtilitySuiteVersion4 10 /* frozen in AE 7.0 */ + +typedef struct AEGP_UtilitySuite4 { + + SPAPI A_Err (*AEGP_ReportInfo)( /* displays dialog with name of plugin followed by info string */ + AEGP_PluginID aegp_plugin_id, /* >> */ + const A_char *info_stringZ); /* >> */ + + + SPAPI A_Err (*AEGP_GetDriverPluginInitFuncVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_GetDriverImplementationVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_StartQuietErrors)( + AEGP_ErrReportState *err_stateP); /* << */ + + SPAPI A_Err (*AEGP_EndQuietErrors)( + A_Boolean report_quieted_errorsB, /* >> currently reports last quieted error */ + AEGP_ErrReportState *err_stateP); /* >> */ + + SPAPI A_Err (*AEGP_GetLastErrorMessage)( + A_long buffer_size, /* >> size of character buffer */ + A_char *error_string, /* << */ + A_Err *error_num); /* << */ + + SPAPI A_Err (*AEGP_StartUndoGroup)( /* MUST be balanced with call to AEGP_EndUndoGroup() */ + const A_char *undo_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_EndUndoGroup)(void); + + SPAPI A_Err (*AEGP_RegisterWithAEGP)( + AEGP_GlobalRefcon global_refcon, /* >> global refcon passed in command handlers */ + const A_char *plugin_nameZ, /* >> name of this plugin. AEGP_MAX_PLUGIN_NAME_SIZE */ + AEGP_PluginID *plugin_id); /* << id for plugin to use in other AEGP calls */ + + SPAPI A_Err (*AEGP_GetMainHWND)( + void *main_hwnd); /* << */ + + SPAPI A_Err (*AEGP_ShowHideAllFloaters)( + A_Boolean include_tool_palB); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalGetForeColor)( + AEGP_ColorVal *fore_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalGetBackColor)( + AEGP_ColorVal *back_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalSetForeColor)( + const AEGP_ColorVal *fore_colorP); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalSetBackColor)( + const AEGP_ColorVal *back_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalGetFillColor)( + A_Boolean *is_fill_color_definedPB, /* << */ + AEGP_ColorVal *fill_colorP); /* << only valid if is_fill_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalGetStrokeColor)( + A_Boolean *is_stroke_color_definedPB, /* << */ + AEGP_ColorVal *stroke_colorP); /* << only valid if is_stroke_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalSetFillColor)( + const AEGP_ColorVal *fill_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalSetStrokeColor)( + const AEGP_ColorVal *stroke_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalIsFillColorUIFrontmost)( /* Otherwise, StrokeColor is frontmost */ + A_Boolean *is_fill_color_selectedPB); /* << */ + + SPAPI A_Err (*AEGP_ConvertFpLongToHSFRatio)( + A_FpLong numberF, /* >> */ + A_Ratio *ratioPR); /* << */ + + SPAPI A_Err (*AEGP_ConvertHSFRatioToFpLong)( + A_Ratio ratioR, /* << */ + A_FpLong *numberPF); /* >> */ + + // this routine is safe to call from the non-main + // thread. It is asynchronous and will return before the idle handler is called. + // The Suite routines to get this pointer are not + // thread safe, therefore you need to save it off + // in the main thread for use by the child thread. + SPAPI A_Err (*AEGP_CauseIdleRoutinesToBeCalled)(void); + + + // Determine if after effects is running in a mode where there is no + // user interface, and attempting to interact with the user (via a modal dialog) + // will hang the application. + // This will not change during a run. Use it to optimize your plugin at startup + // to not create a user interface and make AE launch faster, and not break + // when running multiple instances of a service. + SPAPI A_Err (*AEGP_GetSuppressInteractiveUI)(A_Boolean* ui_is_suppressedPB); // out + + // this call writes text to the console if one is available. One is guaranteed to be available + // if ui_is_suppressedB == true. + // In general use the call AEGP_ReportInfo() as it will write to the console in + // non-interactive modes, and use a dialog in interactive modes. + SPAPI A_Err (*AEGP_WriteToOSConsole)(const A_char* textZ); // in + + // this writes an entry into the debug log, or to the command line if launched + // with the -debug flag. + SPAPI A_Err (*AEGP_WriteToDebugLog)(const A_char* subsystemZ, // in + const A_char* event_typeZ, // in + const A_char * infoZ); // in + + + SPAPI A_Err (*AEGP_IsScriptingAvailable)(A_Boolean* outAvailablePB); + + // Execute a script. + // The script text can either be in UTF-8, or the current + // application encoding. + // The result is the result string if OK. It is optional. + // The error is the error string if an error occurred. It is optional. + // the result and error are in the encoding specified by platform_encodingB + SPAPI A_Err (*AEGP_ExecuteScript)(AEGP_PluginID inPlugin_id, + const A_char* inScriptZ, // in + const A_Boolean platform_encodingB, // in + AEGP_MemHandle* outResultPH0, + AEGP_MemHandle* outErrorStringPH0); + + SPAPI A_Err (*AEGP_HostIsActivated)(A_Boolean *is_activatedPB); + + SPAPI A_Err (*AEGP_GetPluginPlatformRef)(AEGP_PluginID plug_id, void** plat_refPPV); // on the Mac, it is a CFBundleRef to your mach-o plugin or NULL for a CFM plug-in; on Windows it is set to NULL for now + +} AEGP_UtilitySuite4; + + + +#define kAEGPUtilitySuiteVersion3 7 /* frozen in AE 6.5 */ + +typedef struct AEGP_UtilitySuite3 { + + SPAPI A_Err (*AEGP_ReportInfo)( /* displays dialog with name of plugin followed by info string */ + AEGP_PluginID aegp_plugin_id, /* >> */ + const A_char *info_stringZ); /* >> */ + + + SPAPI A_Err (*AEGP_GetDriverPluginInitFuncVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_GetDriverImplementationVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_StartQuietErrors)( + AEGP_ErrReportState *err_stateP); /* << */ + + SPAPI A_Err (*AEGP_EndQuietErrors)( + A_Boolean report_quieted_errorsB, /* >> currently reports last quieted error */ + AEGP_ErrReportState *err_stateP); /* >> */ + + SPAPI A_Err (*AEGP_StartUndoGroup)( /* MUST be balanced with call to AEGP_EndUndoGroup() */ + const A_char *undo_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_EndUndoGroup)(void); + + SPAPI A_Err (*AEGP_RegisterWithAEGP)( + AEGP_GlobalRefcon global_refcon, /* >> global refcon passed in command handlers */ + const A_char *plugin_nameZ, /* >> name of this plugin. AEGP_MAX_PLUGIN_NAME_SIZE */ + AEGP_PluginID *plugin_id); /* << id for plugin to use in other AEGP calls */ + + SPAPI A_Err (*AEGP_GetMainHWND)( + void *main_hwnd); /* << */ + + SPAPI A_Err (*AEGP_ShowHideAllFloaters)( + A_Boolean include_tool_palB); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalGetForeColor)( + AEGP_ColorVal *fore_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalGetBackColor)( + AEGP_ColorVal *back_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalSetForeColor)( + const AEGP_ColorVal *fore_colorP); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalSetBackColor)( + const AEGP_ColorVal *back_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalGetFillColor)( + A_Boolean *is_fill_color_definedPB, /* << */ + AEGP_ColorVal *fill_colorP); /* << only valid if is_fill_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalGetStrokeColor)( + A_Boolean *is_stroke_color_definedPB, /* << */ + AEGP_ColorVal *stroke_colorP); /* << only valid if is_stroke_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalSetFillColor)( + const AEGP_ColorVal *fill_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalSetStrokeColor)( + const AEGP_ColorVal *stroke_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalIsFillColorUIFrontmost)( /* Otherwise, StrokeColor is frontmost */ + A_Boolean *is_fill_color_selectedPB); /* << */ + + SPAPI A_Err (*AEGP_ConvertFpLongToHSFRatio)( + A_FpLong numberF, /* >> */ + A_Ratio *ratioPR); /* << */ + + SPAPI A_Err (*AEGP_ConvertHSFRatioToFpLong)( + A_Ratio ratioR, /* << */ + A_FpLong *numberPF); /* >> */ + + // this routine is safe to call from the non-main + // thread. It is asynchronous and will return before the idle handler is called. + // The Suite routines to get this pointer are not + // thread safe, therefore you need to save it off + // in the main thread for use by the child thread. + SPAPI A_Err (*AEGP_CauseIdleRoutinesToBeCalled)(void); + + + // Determine if after effects is running in a mode where there is no + // user interface, and attempting to interact with the user (via a modal dialog) + // will hang the application. + // This will not change during a run. Use it to optimize your plugin at startup + // to not create a user interface and make AE launch faster, and not break + // when running multiple instances of a service. + SPAPI A_Err (*AEGP_GetSuppressInteractiveUI)(A_Boolean* ui_is_suppressedPB); // out + + // this call writes text to the console if one is available. One is guaranteed to be available + // if ui_is_suppressedB == true. + // In general use the call AEGP_ReportInfo() as it will write to the console in + // non-interactive modes, and use a dialog in interactive modes. + SPAPI A_Err (*AEGP_WriteToOSConsole)(const A_char* textZ); // in + + // this writes an entry into the debug log, or to the command line if launched + // with the -debug flag. + SPAPI A_Err (*AEGP_WriteToDebugLog)(const A_char* subsystemZ, // in + const A_char* event_typeZ, // in + const A_char * infoZ); // in +} AEGP_UtilitySuite3; + +#define kAEGPUtilitySuiteVersion2 5 /* frozen in AE 6.0 */ + +typedef struct AEGP_UtilitySuite2 { + + SPAPI A_Err (*AEGP_ReportInfo)( /* displays dialog with name of plugin followed by info string */ + AEGP_PluginID aegp_plugin_id, /* >> */ + const A_char *info_stringZ); /* >> */ + + + SPAPI A_Err (*AEGP_GetDriverPluginInitFuncVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_GetDriverImplementationVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_StartQuietErrors)( + AEGP_ErrReportState *err_stateP); /* << */ + + SPAPI A_Err (*AEGP_EndQuietErrors)( + A_Boolean report_quieted_errorsB, /* >> currently reports last quieted error */ + AEGP_ErrReportState *err_stateP); /* >> */ + + SPAPI A_Err (*AEGP_StartUndoGroup)( /* MUST be balanced with call to AEGP_EndUndoGroup() */ + const A_char *undo_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_EndUndoGroup)(void); + + SPAPI A_Err (*AEGP_RegisterWithAEGP)( + AEGP_GlobalRefcon global_refcon, /* >> global refcon passed in command handlers */ + const A_char *plugin_nameZ, /* >> name of this plugin. AEGP_MAX_PLUGIN_NAME_SIZE */ + AEGP_PluginID *plugin_id); /* << id for plugin to use in other AEGP calls */ + + SPAPI A_Err (*AEGP_GetMainHWND)( + void *main_hwnd); /* << */ + + SPAPI A_Err (*AEGP_ShowHideAllFloaters)( + A_Boolean include_tool_palB); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalGetForeColor)( + AEGP_ColorVal *fore_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalGetBackColor)( + AEGP_ColorVal *back_colorP); /* << */ + + SPAPI A_Err (*AEGP_PaintPalSetForeColor)( + const AEGP_ColorVal *fore_colorP); /* >> */ + + SPAPI A_Err (*AEGP_PaintPalSetBackColor)( + const AEGP_ColorVal *back_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalGetFillColor)( + A_Boolean *is_fill_color_definedPB, /* << */ + AEGP_ColorVal *fill_colorP); /* << only valid if is_fill_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalGetStrokeColor)( + A_Boolean *is_stroke_color_definedPB, /* << */ + AEGP_ColorVal *stroke_colorP); /* << only valid if is_stroke_color_definedPB == TRUE */ + + SPAPI A_Err (*AEGP_CharPalSetFillColor)( + const AEGP_ColorVal *fill_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalSetStrokeColor)( + const AEGP_ColorVal *stroke_colorP); /* >> */ + + SPAPI A_Err (*AEGP_CharPalIsFillColorUIFrontmost)( /* Otherwise, StrokeColor is frontmost */ + A_Boolean *is_fill_color_selectedPB); /* << */ + +} AEGP_UtilitySuite2; + +#define kAEGPUtilitySuiteVersion1 3 /* frozen in AE 5.0 */ + +typedef struct AEGP_UtilitySuite1 { + + SPAPI A_Err (*AEGP_ReportInfo)( /* displays dialog with name of plugin followed by info string */ + AEGP_PluginID aegp_plugin_id, /* >> */ + const A_char *info_stringZ); /* >> */ + + + SPAPI A_Err (*AEGP_GetDriverPluginInitFuncVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_GetDriverImplementationVersion)( + A_short *major_versionPS, /* << */ + A_short *minor_versionPS); /* << */ + + SPAPI A_Err (*AEGP_StartQuietErrors)( + AEGP_ErrReportState *err_stateP); /* << */ + + SPAPI A_Err (*AEGP_EndQuietErrors)( + A_Boolean report_quieted_errorsB, /* >> currently reports last quieted error */ + AEGP_ErrReportState *err_stateP); /* >> */ + + SPAPI A_Err (*AEGP_StartUndoGroup)( /* MUST be balanced with call to AEGP_EndUndoGroup() */ + const A_char *undo_nameZ); /* >> */ + + SPAPI A_Err (*AEGP_EndUndoGroup)(void); + + SPAPI A_Err (*AEGP_RegisterWithAEGP)( + AEGP_GlobalRefcon global_refcon, /* >> global refcon passed in command handlers */ + const A_char *plugin_nameZ, /* >> name of this plugin. AEGP_MAX_PLUGIN_NAME_SIZE */ + AEGP_PluginID *plugin_id); /* << id for plugin to use in other AEGP calls */ + + SPAPI A_Err (*AEGP_GetMainHWND)( + void *main_hwnd); /* << */ + +} AEGP_UtilitySuite1; + + + + +#define kAEGPQueryXformSuiteVersion1 1 /* frozen in AE 5.0 */ + + + +typedef struct AEGP_QueryXformSuite1 { + + SPAPI A_Err (*AEGP_QueryXformGetSrcType)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_QueryXformType *src_type); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetDstType)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_QueryXformType *dst_type); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetLayer)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_LayerH *layerPH); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetComp)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_CompH *compPH); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetTransformTime)( + PR_QueryContextH query_contextH, /* <> */ + A_Time *time); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetViewTime)( + PR_QueryContextH query_contextH, /* <> */ + A_Time *time); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetCamera)( + PR_QueryContextH query_contextH, /* <> */ + AEGP_LayerH *camera_layerPH); /* << */ + + SPAPI A_Err (*AEGP_QueryXformGetXform)( + PR_QueryContextH query_contextH, /* <> */ + A_Matrix4 *xform); /* << */ + + SPAPI A_Err (*AEGP_QueryXformSetXform)( + PR_QueryContextH query_contextH, /* <> */ + A_Matrix4 *xform); /* >> */ + +}AEGP_QueryXformSuite1; + + + + +#define kAEGPRenderSuiteVersion1 1 /* frozen in AE 5.5.1 */ + + +typedef struct { + SPAPI A_Err (*AEGP_RenderAndCheckoutFrame)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_FrameReceiptH *receiptPH); /* << check in using AEGP_CheckinFrame to release memory */ + + SPAPI A_Err (*AEGP_CheckinFrame)( + AEGP_FrameReceiptH receiptH); /* >> */ + + /* This returns a read only world that is not-owned by the plugin. + Call CheckinFrame to release the world when you are done reading from it. + */ + + SPAPI A_Err (*AEGP_GetReceiptWorld)( + AEGP_FrameReceiptH receiptH, /* >> */ + AEGP_WorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_GetRenderedRegion)( + AEGP_FrameReceiptH receiptH, /* >> */ + A_LRect *rendered_regionP); /* << */ + + SPAPI A_Err (*AEGP_IsRenderedFrameSufficient)( + AEGP_RenderOptionsH rendered_optionsH, /* >> */ + AEGP_RenderOptionsH proposed_optionsH, /* >> */ + A_Boolean *rendered_is_sufficientPB); /* << */ + + SPAPI A_Err (*AEGP_RenderNewItemSoundData)( /* Works on Compositions and Footage items. */ + AEGP_ItemH itemH, /* >> */ + const A_Time *start_timePT, /* >> */ + const A_Time *durationPT, /* >> */ + const AEGP_SoundDataFormat *sound_formatP, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_SoundDataH *new_sound_dataPH); /* << AEGP_SoundDataH must be disposed. Returns NULL if no audio */ + +} AEGP_RenderSuite1; + + +#define kAEGPRenderSuiteVersion2 2 /* frozen in 6.5 */ + + +typedef A_Err (*AEGP_RenderSuiteCheckForCancelv1)( + void *refcon, + A_Boolean *cancelPB); + +typedef struct { + SPAPI A_Err (*AEGP_RenderAndCheckoutFrame)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderSuiteCheckForCancelv1 cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_FrameReceiptH *receiptPH); /* << check in using AEGP_CheckinFrame to release memory */ + + SPAPI A_Err (*AEGP_CheckinFrame)( + AEGP_FrameReceiptH receiptH); /* >> */ + + /* This returns a read only world that is not-owned by the plugin. + Call CheckinFrame to release the world when you are done reading from it. + */ + + SPAPI A_Err (*AEGP_GetReceiptWorld)( + AEGP_FrameReceiptH receiptH, /* >> */ + AEGP_WorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_GetRenderedRegion)( + AEGP_FrameReceiptH receiptH, /* >> */ + A_LRect *rendered_regionP); /* << */ + + SPAPI A_Err (*AEGP_IsRenderedFrameSufficient)( + AEGP_RenderOptionsH rendered_optionsH, /* >> */ + AEGP_RenderOptionsH proposed_optionsH, /* >> */ + A_Boolean *rendered_is_sufficientPB); /* << */ + + SPAPI A_Err (*AEGP_RenderNewItemSoundData)( /* Works on Compositions and Footage items. */ + AEGP_ItemH itemH, /* >> */ + const A_Time *start_timePT, /* >> */ + const A_Time *durationPT, /* >> */ + const AEGP_SoundDataFormat *sound_formatP, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_SoundDataH *new_sound_dataPH); /* << AEGP_SoundDataH must be disposed. Returns NULL if no audio */ + + + // returns the current timestamp of the project.this is increased any time something is touched in the project + // that affects rendering + SPAPI A_Err (*AEGP_GetCurrentTimestamp)( + AEGP_TimeStamp * time_stampP); // out + + // Lets you know if the video of the item has changed since the input time stamp. + // Is not affected by audio. + SPAPI A_Err (*AEGP_HasItemChangedSinceTimestamp)(AEGP_ItemH itemH, // in + const A_Time * start_timeP, // in + const A_Time* durationP, //in + const AEGP_TimeStamp * time_stampP, //in + A_Boolean * item_has_changedPB); //out + + // checks whether this frame would be worth rendering externally and + // checking in to the cache. a speculative renderer should check this twice: + // (1) before sending the frame out to render + // (2) when it is complete, before calling AEGP_NewPlatformWorld and checking in. + // (don't forget to call AEGP_HasItemChangedSinceTimestamp also!) + SPAPI A_Err (*AEGP_IsItemWorthwhileToRender)( AEGP_RenderOptionsH roH, // in + const AEGP_TimeStamp* time_stampP, // in + A_Boolean *worthwhile_to_renderPB); // out + + // ticks_to_render is the approximate amount of time needed to render the frame + // on this machine. it is 60Hz. + SPAPI A_Err (*AEGP_CheckinRenderedFrame)( AEGP_RenderOptionsH roH, // in + const AEGP_TimeStamp* time_stampP, // in + A_u_long ticks_to_renderL, // in + AEGP_PlatformWorldH imageH); // in (adopted) +} AEGP_RenderSuite2; + + +#define kAEGPRenderSuiteVersion3 3 /* frozen in 11.0 */ + +typedef struct { + SPAPI A_Err (*AEGP_RenderAndCheckoutFrame)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_FrameReceiptH *receiptPH); /* << check in using AEGP_CheckinFrame to release memory */ + + SPAPI A_Err (*AEGP_CheckinFrame)( + AEGP_FrameReceiptH receiptH); /* >> */ + + /* This returns a read only world that is not-owned by the plugin. + Call CheckinFrame to release the world when you are done reading from it. + */ + + SPAPI A_Err (*AEGP_GetReceiptWorld)( + AEGP_FrameReceiptH receiptH, /* >> */ + AEGP_WorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_GetRenderedRegion)( + AEGP_FrameReceiptH receiptH, /* >> */ + A_LRect *rendered_regionP); /* << */ + + SPAPI A_Err (*AEGP_IsRenderedFrameSufficient)( + AEGP_RenderOptionsH rendered_optionsH, /* >> */ + AEGP_RenderOptionsH proposed_optionsH, /* >> */ + A_Boolean *rendered_is_sufficientPB); /* << */ + + SPAPI A_Err (*AEGP_RenderNewItemSoundData)( /* Works on Compositions and Footage items. */ + AEGP_ItemH itemH, /* >> */ + const A_Time *start_timePT, /* >> */ + const A_Time *durationPT, /* >> */ + const AEGP_SoundDataFormat *sound_formatP, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_SoundDataH *new_sound_dataPH); /* << AEGP_SoundDataH must be disposed. Returns NULL if no audio */ + + + // returns the current timestamp of the project.this is increased any time something is touched in the project + // that affects rendering + SPAPI A_Err (*AEGP_GetCurrentTimestamp)( + AEGP_TimeStamp * time_stampP); // out + + // Lets you know if the video of the item has changed since the input time stamp. + // Is not affected by audio. + SPAPI A_Err (*AEGP_HasItemChangedSinceTimestamp)(AEGP_ItemH itemH, // in + const A_Time * start_timeP, // in + const A_Time* durationP, //in + const AEGP_TimeStamp * time_stampP, //in + A_Boolean * item_has_changedPB); //out + + // checks whether this frame would be worth rendering externally and + // checking in to the cache. a speculative renderer should check this twice: + // (1) before sending the frame out to render + // (2) when it is complete, before calling AEGP_NewPlatformWorld and checking in. + // (don't forget to call AEGP_HasItemChangedSinceTimestamp also!) + SPAPI A_Err (*AEGP_IsItemWorthwhileToRender)( AEGP_RenderOptionsH roH, // in + const AEGP_TimeStamp* time_stampP, // in + A_Boolean *worthwhile_to_renderPB); // out + + // ticks_to_render is the approximate amount of time needed to render the frame + // on this machine. it is 60Hz. + SPAPI A_Err (*AEGP_CheckinRenderedFrame)( AEGP_RenderOptionsH roH, // in + const AEGP_TimeStamp* time_stampP, // in + A_u_long ticks_to_renderL, // in + AEGP_PlatformWorldH imageH); // in (adopted) + + SPAPI A_Err (*AEGP_GetReceiptGuid) (AEGP_FrameReceiptH receiptH, // in + AEGP_MemHandle *guidMH); // out, must be disposed +} AEGP_RenderSuite3; + + +#define kAEGPRenderSuiteVersion4 5 /* frozen in 13.0 */ + +typedef struct { + SPAPI A_Err (*AEGP_RenderAndCheckoutFrame)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_FrameReceiptH *receiptPH); /* << check in using AEGP_CheckinFrame to release memory */ + + SPAPI A_Err (*AEGP_RenderAndCheckoutLayerFrame)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + A_Boolean render_plain_layer_frameB, /* >> true to render layer frame, false to render effect input frame */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_FrameReceiptH *receiptPH); /* << check in using AEGP_CheckinFrame to release memory */ + + SPAPI A_Err (*AEGP_CheckinFrame)( + AEGP_FrameReceiptH receiptH); /* >> */ + + /* This returns a read only world that is not-owned by the plugin. + Call CheckinFrame to release the world when you are done reading from it. + */ + + SPAPI A_Err (*AEGP_GetReceiptWorld)( + AEGP_FrameReceiptH receiptH, /* >> */ + AEGP_WorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_GetRenderedRegion)( + AEGP_FrameReceiptH receiptH, /* >> */ + A_LRect *rendered_regionP); /* << */ + + SPAPI A_Err (*AEGP_IsRenderedFrameSufficient)( + AEGP_RenderOptionsH rendered_optionsH, /* >> */ + AEGP_RenderOptionsH proposed_optionsH, /* >> */ + A_Boolean *rendered_is_sufficientPB); /* << */ + + SPAPI A_Err (*AEGP_RenderNewItemSoundData)( /* Works on Compositions and Footage items. */ + AEGP_ItemH itemH, /* >> */ + const A_Time *start_timePT, /* >> */ + const A_Time *durationPT, /* >> */ + const AEGP_SoundDataFormat *sound_formatP, /* >> */ + AEGP_RenderSuiteCheckForCancel cancel_functionP0, /* >> optional*/ + AEGP_CancelRefcon cancel_function_refconP0, /* >> optional */ + AEGP_SoundDataH *new_sound_dataPH); /* << AEGP_SoundDataH must be disposed. Returns NULL if no audio */ + + + // returns the current timestamp of the project.this is increased any time something is touched in the project + // that affects rendering + SPAPI A_Err (*AEGP_GetCurrentTimestamp)( + AEGP_TimeStamp * time_stampP); // out + + // Lets you know if the video of the item has changed since the input time stamp. + // Is not affected by audio. + SPAPI A_Err (*AEGP_HasItemChangedSinceTimestamp)(AEGP_ItemH itemH, // in + const A_Time * start_timeP, // in + const A_Time* durationP, //in + const AEGP_TimeStamp * time_stampP, //in + A_Boolean * item_has_changedPB); //out + + // checks whether this frame would be worth rendering externally and + // checking in to the cache. a speculative renderer should check this twice: + // (1) before sending the frame out to render + // (2) when it is complete, before calling AEGP_NewPlatformWorld and checking in. + // (don't forget to call AEGP_HasItemChangedSinceTimestamp also!) + SPAPI A_Err (*AEGP_IsItemWorthwhileToRender)( AEGP_RenderOptionsH roH, // in + const AEGP_TimeStamp* time_stampP, // in + A_Boolean *worthwhile_to_renderPB); // out + + // ticks_to_render is the approximate amount of time needed to render the frame + // on this machine. it is 60Hz. + SPAPI A_Err (*AEGP_CheckinRenderedFrame)( AEGP_RenderOptionsH roH, // in + const AEGP_TimeStamp* time_stampP, // in + A_u_long ticks_to_renderL, // in + AEGP_PlatformWorldH imageH); // in (adopted) + + SPAPI A_Err (*AEGP_GetReceiptGuid) (AEGP_FrameReceiptH receiptH, // in + AEGP_MemHandle *guidMH); // out, must be disposed +} AEGP_RenderSuite4; + + + +#define kAEGPWorldSuiteVersion2 2 /* frozen in AE 6.5 */ + +typedef struct { + SPAPI A_Err (*AEGP_New)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_WorldType type, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + AEGP_WorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_WorldH worldH); /* >> */ + + SPAPI A_Err (*AEGP_GetType)( + AEGP_WorldH worldH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + SPAPI A_Err (*AEGP_GetSize)( + AEGP_WorldH worldH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetRowBytes)( + AEGP_WorldH worldH, /* >> */ + A_u_long *row_bytesPL); /* << */ + + SPAPI A_Err (*AEGP_GetBaseAddr8)( + AEGP_WorldH worldH, /* >> error if the worldH is not AEGP_WorldType_8 */ + PF_Pixel8 **base_addrP); /* << */ + + SPAPI A_Err (*AEGP_GetBaseAddr16)( + AEGP_WorldH worldH, /* >> error if the worldH is not AEGP_WorldType_16 */ + PF_Pixel16 **base_addrP); /* << */ + + SPAPI A_Err (*AEGP_FillOutPFEffectWorld)( /* Provided so you can use some of the PF routines with an AEGPWorld. Pass NULL as the ProgPtr to the PF routines.*/ + AEGP_WorldH worldH, /* >> */ + PF_EffectWorld *pf_worldP); /* << */ + + SPAPI A_Err (*AEGP_FastBlur)( + A_FpLong radiusF, /* >> */ + PF_ModeFlags mode, /* >> */ + PF_Quality quality, /* >> */ + AEGP_WorldH worldH); /* <> only for user allocated worlds; not for checked-out frames which are read only */ + + SPAPI A_Err (*AEGP_NewPlatformWorld)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_WorldType type, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + AEGP_PlatformWorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_DisposePlatformWorld)( + AEGP_PlatformWorldH worldH); /* >> */ + + SPAPI A_Err (*AEGP_NewReferenceFromPlatformWorld)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_PlatformWorldH platform_worldH, // >> + AEGP_WorldH *worldPH); /* << */ + + +} AEGP_WorldSuite2; + + +#define kAEGPWorldSuite "AEGP World Suite" +#define kAEGPWorldSuiteVersion1 1 /* frozen AE 6.0 */ + +typedef struct { + SPAPI A_Err (*AEGP_New)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_WorldType type, /* >> */ + A_long widthL, /* >> */ + A_long heightL, /* >> */ + AEGP_WorldH *worldPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_WorldH worldH); /* >> */ + + SPAPI A_Err (*AEGP_GetType)( + AEGP_WorldH worldH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + SPAPI A_Err (*AEGP_GetSize)( + AEGP_WorldH worldH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetRowBytes)( + AEGP_WorldH worldH, /* >> */ + A_u_long *row_bytesPL); /* << */ + + SPAPI A_Err (*AEGP_GetBaseAddr8)( + AEGP_WorldH worldH, /* >> error if the worldH is not AEGP_WorldType_8 */ + PF_Pixel8 **base_addrP); /* << */ + + SPAPI A_Err (*AEGP_GetBaseAddr16)( + AEGP_WorldH worldH, /* >> error if the worldH is not AEGP_WorldType_16 */ + PF_Pixel16 **base_addrP); /* << */ + + SPAPI A_Err (*AEGP_FillOutPFEffectWorld)( /* Provided so you can use some of the PF routines with an AEGPWorld. Pass NULL as the ProgPtr to the PF routines.*/ + AEGP_WorldH worldH, /* >> */ + PF_EffectWorld *pf_worldP); /* << */ + + SPAPI A_Err (*AEGP_FastBlur)( + A_FpLong radiusF, /* >> */ + PF_ModeFlags mode, /* >> */ + PF_Quality quality, /* >> */ + AEGP_WorldH worldH); /* <> only for user allocated worlds; not for checked-out frames which are read only */ +} AEGP_WorldSuite1; + + +typedef struct { + AEGP_CollectionItemType type; + union { + AEGP_LayerCollectionItem layer; + AEGP_MaskCollectionItem mask; + AEGP_EffectCollectionItem effect; + AEGP_StreamCollectionItem stream; + AEGP_MaskVertexCollectionItem mask_vertex; + AEGP_KeyframeCollectionItem keyframe; + } u; +} AEGP_CollectionItem; + + +#define kAEGPCollectionSuiteVersion1 1 /* frozen in AE 5.0 */ + +typedef struct { + SPAPI A_Err (*AEGP_NewCollection)( /* dispose with dispose collection */ + AEGP_PluginID plugin_id, /* >> */ + AEGP_CollectionH *collectionPH); /* << */ + + SPAPI A_Err (*AEGP_DisposeCollection)( + AEGP_CollectionH collectionH); /* >> */ + + SPAPI A_Err (*AEGP_GetCollectionNumItems)( /* constant time */ + AEGP_CollectionH collectionH, /* >> */ + A_u_long *num_itemsPL); /* << */ + + SPAPI A_Err (*AEGP_GetCollectionItemByIndex)( /* constant time */ + AEGP_CollectionH collectionH, /* >> */ + A_u_long indexL, /* >> */ + AEGP_CollectionItem *collection_itemP); /* << */ + + SPAPI A_Err (*AEGP_CollectionPushBack)( /* constant time */ + AEGP_CollectionH collectionH, /* <> */ + const AEGP_CollectionItem *collection_itemP); /* >> */ + + SPAPI A_Err (*AEGP_CollectionErase)( /* O(n) */ + AEGP_CollectionH collectionH, /* <> */ + A_u_long index_firstL, /* >> */ + A_u_long index_lastL); /* >> */ + +} AEGP_CollectionSuite1; + +#define kAEGPDynamicStreamSuiteVersion1 1 /* frozen in AE 6.0 */ + +typedef struct AEGP_DynamicStreamSuite1 { + + SPAPI A_Err (*AEGP_GetNewStreamRefForLayer)( // used to start recursive walk of layer, + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetStreamDepth)( // layer is depth 0 + AEGP_StreamRefH streamH, /* >> */ + A_long *depthPL); /* << */ + + + SPAPI A_Err (*AEGP_GetStreamGroupingType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamGroupingType *group_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetNumStreamsInGroup)( // error on leaf + AEGP_StreamRefH streamH, /* >> */ + A_long *num_streamsPL); /* << */ + + + SPAPI A_Err (*AEGP_GetDynamicStreamFlags)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_DynStreamFlags *stream_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetDynamicStreamFlag)( /* UNDOABLE */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_DynStreamFlags one_flag, /* >> */ + A_Boolean setB); /* >> */ + + + SPAPI A_Err (*AEGP_GetNewStreamRefByIndex)( // legal for namedgroup, indexedgroup, not leaf + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH parent_groupH, /* >> */ + A_long indexL, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewStreamRefByMatchname)( // legal for namedgroup + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH parent_groupH, /* >> */ + const A_char *match_nameZ, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_DeleteStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH); /* >> */ // must still dispose the streamref later + + SPAPI A_Err (*AEGP_ReorderStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH, /* <> updated to refer to newly ordered stream */ + A_long new_indexL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_long *new_indexPL0); /* << */ + + /* GetStreamName is in main kAEGPStreamSuite, and works on dynamic streams including groups */ + + SPAPI A_Err (*AEGP_SetStreamName)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH, /* >> */ + const A_char *nameZ); /* >> */ + + SPAPI A_Err (*AEGP_CanAddStream)( + AEGP_StreamRefH group_streamH, /* >> */ + const A_char *match_nameZ, /* >> */ + A_Boolean *can_addPB); /* << */ + + SPAPI A_Err (*AEGP_AddStream)( /* UNDOABLE, only valid for AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH indexed_group_streamH, /* >> */ + const A_char *match_nameZ, + AEGP_StreamRefH *streamPH0); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetMatchName)( + AEGP_StreamRefH streamH, /* >> */ + A_char *nameZ); /* << use A_char[AEGP_MAX_STREAM_MATCH_NAME_SIZE] for buffer */ + + SPAPI A_Err (*AEGP_GetNewParentStreamRef)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamRefH *parent_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetStreamIsModified)( // i.e. changed from defaults, like the UU key + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *modifiedPB); /* << */ + +} AEGP_DynamicStreamSuite1; + +#define kAEGPDynamicStreamSuiteVersion2 2 /* frozen in AE 6.5 */ + +typedef struct AEGP_DynamicStreamSuite2 { + + SPAPI A_Err (*AEGP_GetNewStreamRefForLayer)( // used to start recursive walk of layer, + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetStreamDepth)( // layer is depth 0 + AEGP_StreamRefH streamH, /* >> */ + A_long *depthPL); /* << */ + + + SPAPI A_Err (*AEGP_GetStreamGroupingType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamGroupingType *group_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetNumStreamsInGroup)( // error on leaf + AEGP_StreamRefH streamH, /* >> */ + A_long *num_streamsPL); /* << */ + + + SPAPI A_Err (*AEGP_GetDynamicStreamFlags)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_DynStreamFlags *stream_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetDynamicStreamFlag)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_DynStreamFlags one_flag, /* >> */ + A_Boolean undoableB, /* true if you want this to be an undoable change */ + /* if false, the only legal flag is AEGP_DynStreamFlag_HIDDEN */ + A_Boolean setB); /* >> */ + + + SPAPI A_Err (*AEGP_GetNewStreamRefByIndex)( // legal for namedgroup, indexedgroup, not leaf + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH parent_groupH, /* >> */ + A_long indexL, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewStreamRefByMatchname)( // legal for namedgroup + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH parent_groupH, /* >> */ + const A_char *match_nameZ, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_DeleteStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH); /* >> */ // must still dispose the streamref later + + SPAPI A_Err (*AEGP_ReorderStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH, /* <> updated to refer to newly ordered stream */ + A_long new_indexL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_long *new_indexPL0); /* << */ + + /* GetStreamName is in main kAEGPStreamSuite, and works on dynamic streams including groups */ + + SPAPI A_Err (*AEGP_SetStreamName)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH, /* >> */ + const A_char *nameZ); /* >> */ + + SPAPI A_Err (*AEGP_CanAddStream)( + AEGP_StreamRefH group_streamH, /* >> */ + const A_char *match_nameZ, /* >> */ + A_Boolean *can_addPB); /* << */ + + SPAPI A_Err (*AEGP_AddStream)( /* UNDOABLE, only valid for AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH indexed_group_streamH, /* >> */ + const A_char *match_nameZ, + AEGP_StreamRefH *streamPH0); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetMatchName)( + AEGP_StreamRefH streamH, /* >> */ + A_char *nameZ); /* << use A_char[AEGP_MAX_STREAM_MATCH_NAME_SIZE] for buffer */ + + SPAPI A_Err (*AEGP_GetNewParentStreamRef)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamRefH *parent_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetStreamIsModified)( // i.e. changed from defaults, like the UU key + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *modifiedPB); /* << */ + +} AEGP_DynamicStreamSuite2; + +#define kAEGPDynamicStreamSuiteVersion3 3 /* frozen in AE 7.0 */ + +typedef struct AEGP_DynamicStreamSuite3 { + + SPAPI A_Err (*AEGP_GetNewStreamRefForLayer)( // used to start recursive walk of layer, + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetStreamDepth)( // layer is depth 0 + AEGP_StreamRefH streamH, /* >> */ + A_long *depthPL); /* << */ + + + SPAPI A_Err (*AEGP_GetStreamGroupingType)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamGroupingType *group_typeP); /* << */ + + SPAPI A_Err (*AEGP_GetNumStreamsInGroup)( // error on leaf + AEGP_StreamRefH streamH, /* >> */ + A_long *num_streamsPL); /* << */ + + + SPAPI A_Err (*AEGP_GetDynamicStreamFlags)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_DynStreamFlags *stream_flagsP); /* << */ + + SPAPI A_Err (*AEGP_SetDynamicStreamFlag)( + AEGP_StreamRefH streamH, /* >> */ + AEGP_DynStreamFlags one_flag, /* >> */ + A_Boolean undoableB, /* true if you want this to be an undoable change */ + /* if false, the only legal flag is AEGP_DynStreamFlag_HIDDEN */ + A_Boolean setB); /* >> */ + + + SPAPI A_Err (*AEGP_GetNewStreamRefByIndex)( // legal for namedgroup, indexedgroup, not leaf + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH parent_groupH, /* >> */ + A_long indexL, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetNewStreamRefByMatchname)( // legal for namedgroup + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH parent_groupH, /* >> */ + const A_char *match_nameZ, /* >> */ + AEGP_StreamRefH *streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_DeleteStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH); /* >> */ // must still dispose the streamref later + + SPAPI A_Err (*AEGP_ReorderStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH, /* <> updated to refer to newly ordered stream */ + A_long new_indexL); /* >> */ + + SPAPI A_Err (*AEGP_DuplicateStream)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + A_long *new_indexPL0); /* << */ + + /* GetStreamName is in main kAEGPStreamSuite, and works on dynamic streams including groups */ + + SPAPI A_Err (*AEGP_SetStreamName)( /* UNDOABLE, only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_StreamRefH streamH, /* >> */ + const A_char *nameZ); /* >> */ + + SPAPI A_Err (*AEGP_CanAddStream)( + AEGP_StreamRefH group_streamH, /* >> */ + const A_char *match_nameZ, /* >> */ + A_Boolean *can_addPB); /* << */ + + SPAPI A_Err (*AEGP_AddStream)( /* UNDOABLE, only valid for AEGP_StreamGroupingType_INDEXED_GROUP */ + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH indexed_group_streamH, /* >> */ + const A_char *match_nameZ, + AEGP_StreamRefH *streamPH0); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetMatchName)( + AEGP_StreamRefH streamH, /* >> */ + A_char *nameZ); /* << use A_char[AEGP_MAX_STREAM_MATCH_NAME_SIZE] for buffer */ + + SPAPI A_Err (*AEGP_GetNewParentStreamRef)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_StreamRefH streamH, /* >> */ + AEGP_StreamRefH *parent_streamPH); /* << must be disposed by caller! */ + + SPAPI A_Err (*AEGP_GetStreamIsModified)( // i.e. changed from defaults, like the UU key + AEGP_StreamRefH streamH, /* >> */ + A_Boolean *modifiedPB); /* << */ + + SPAPI A_Err (*AEGP_GetStreamIndexInParent)( // only valid for children of AEGP_StreamGroupingType_INDEXED_GROUP + AEGP_StreamRefH streamH, /* >> */ + A_long *indexPL); /* << */ + + + +} AEGP_DynamicStreamSuite3; + + +#define kAEGPRenderOptionsSuite "AEGP Render Options Suite" +#define kAEGPRenderOptionsSuiteVersion3 3 /* frozen in AE 7.01 */ + +typedef struct { + // fills out + // Time to 0 + // Time step to the frame duration + // field render to none + // depth is best resolution of item + SPAPI A_Err (*AEGP_NewFromItem)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_ItemH itemH, /* >> */ + AEGP_RenderOptionsH *optionsPH); /* << */ + + SPAPI A_Err (*AEGP_Duplicate)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderOptionsH *copyPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_RenderOptionsH optionsH); /* >> */ + + SPAPI A_Err (*AEGP_SetTime)( /* the render time */ + AEGP_RenderOptionsH optionsH, /* <> */ + A_Time time); /* >> */ + + SPAPI A_Err (*AEGP_GetTime)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_SetTimeStep)( /* duration of the frame; important for motion blur. */ + AEGP_RenderOptionsH optionsH, /* <> */ + A_Time time_step); /* >> */ + + SPAPI A_Err (*AEGP_GetTimeStep)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Time *timePT); /* << */ + + SPAPI A_Err (*AEGP_SetFieldRender)( /* How fields are to be handled. */ + AEGP_RenderOptionsH optionsH, /* <> */ + PF_Field field_render); /* >> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + AEGP_RenderOptionsH optionsH, /* >> */ + PF_Field *field_renderP); /* << */ + + + SPAPI A_Err (*AEGP_SetWorldType)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_WorldType type); /* >> */ + + SPAPI A_Err (*AEGP_GetWorldType)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + + // 1 == 100% + // 2 == 50% + // ... + SPAPI A_Err (*AEGP_SetDownsampleFactor)( + AEGP_RenderOptionsH optionsH, /* <> */ + A_short x, /* >> */ + A_short y); /* >> */ + + SPAPI A_Err (*AEGP_GetDownsampleFactor)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_short *xP, /* >> */ + A_short *yP); /* << */ + + SPAPI A_Err (*AEGP_SetRegionOfInterest)( + AEGP_RenderOptionsH optionsH, /* <> */ + const A_LRect *roiP); /* >> {0,0,0,0} for all*/ + + SPAPI A_Err (*AEGP_GetRegionOfInterest)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_LRect *roiP); /* << */ + + SPAPI A_Err (*AEGP_SetMatteMode)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_MatteMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMatteMode)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_MatteMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_SetChannelOrder)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_ChannelOrder channel_order); /* >> */ + + SPAPI A_Err (*AEGP_GetChannelOrder)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_ChannelOrder *channelP); /* << */ + + SPAPI A_Err (*AEGP_GetRenderGuideLayers)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Boolean *will_renderPB); /* << */ + + SPAPI A_Err (*AEGP_SetRenderGuideLayers)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Boolean render_themB); /* >> */ + +} AEGP_RenderOptionsSuite3; + + +#define kAEGPRenderOptionsSuite "AEGP Render Options Suite" +#define kAEGPRenderOptionsSuiteVersion2 2 /* frozen in AE 7.0 */ + +typedef struct { + // fills out + // Time to 0 + // Time step to the frame duration + // field render to none + // depth is best resolution of item + SPAPI A_Err (*AEGP_NewFromItem)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_ItemH itemH, /* >> */ + AEGP_RenderOptionsH *optionsPH); /* << */ + + SPAPI A_Err (*AEGP_Duplicate)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderOptionsH *copyPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_RenderOptionsH optionsH); /* >> */ + + SPAPI A_Err (*AEGP_SetTime)( /* the render time */ + AEGP_RenderOptionsH optionsH, /* <> */ + A_Time time); /* >> */ + + SPAPI A_Err (*AEGP_GetTime)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_SetTimeStep)( /* duration of the frame; important for motion blur. */ + AEGP_RenderOptionsH optionsH, /* <> */ + A_Time time_step); /* >> */ + + SPAPI A_Err (*AEGP_GetTimeStep)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Time *timePT); /* << */ + + SPAPI A_Err (*AEGP_SetFieldRender)( /* How fields are to be handled. */ + AEGP_RenderOptionsH optionsH, /* <> */ + PF_Field field_render); /* >> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + AEGP_RenderOptionsH optionsH, /* >> */ + PF_Field *field_renderP); /* << */ + + + SPAPI A_Err (*AEGP_SetWorldType)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_WorldType type); /* >> */ + + SPAPI A_Err (*AEGP_GetWorldType)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + + // 1 == 100% + // 2 == 50% + // ... + SPAPI A_Err (*AEGP_SetDownsampleFactor)( + AEGP_RenderOptionsH optionsH, /* <> */ + A_short x, /* >> */ + A_short y); /* >> */ + + SPAPI A_Err (*AEGP_GetDownsampleFactor)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_short *xP, /* >> */ + A_short *yP); /* << */ + + SPAPI A_Err (*AEGP_SetRegionOfInterest)( + AEGP_RenderOptionsH optionsH, /* <> */ + const A_LRect *roiP); /* >> {0,0,0,0} for all*/ + + SPAPI A_Err (*AEGP_GetRegionOfInterest)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_LRect *roiP); /* << */ + + SPAPI A_Err (*AEGP_SetMatteMode)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_MatteMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMatteMode)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_MatteMode *modeP); /* << */ + + SPAPI A_Err (*AEGP_SetChannelOrder)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_ChannelOrder channel_order); /* >> */ + + SPAPI A_Err (*AEGP_GetChannelOrder)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_ChannelOrder *channelP); /* << */ +} AEGP_RenderOptionsSuite2; + + +#define kAEGPRenderOptionsSuite "AEGP Render Options Suite" +#define kAEGPRenderOptionsSuiteVersion1 1 /* frozen in AE 5.5.1 */ + +typedef struct { + // fills out + // Time to 0 + // Time step to the frame duration + // field render to none + // depth is best resolution of item + SPAPI A_Err (*AEGP_NewFromItem)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_ItemH itemH, /* >> */ + AEGP_RenderOptionsH *optionsPH); /* << */ + + SPAPI A_Err (*AEGP_Duplicate)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_RenderOptionsH *copyPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_RenderOptionsH optionsH); /* >> */ + + SPAPI A_Err (*AEGP_SetTime)( /* the render time */ + AEGP_RenderOptionsH optionsH, /* <> */ + A_Time time); /* >> */ + + SPAPI A_Err (*AEGP_GetTime)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_SetTimeStep)( /* duration of the frame; important for motion blur. */ + AEGP_RenderOptionsH optionsH, /* <> */ + A_Time time_step); /* >> */ + + SPAPI A_Err (*AEGP_GetTimeStep)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_Time *timePT); /* << */ + + SPAPI A_Err (*AEGP_SetFieldRender)( /* How fields are to be handled. */ + AEGP_RenderOptionsH optionsH, /* <> */ + PF_Field field_render); /* >> */ + + SPAPI A_Err (*AEGP_GetFieldRender)( + AEGP_RenderOptionsH optionsH, /* >> */ + PF_Field *field_renderP); /* << */ + + + SPAPI A_Err (*AEGP_SetWorldType)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_WorldType type); /* >> */ + + SPAPI A_Err (*AEGP_GetWorldType)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + + // 1 == 100% + // 2 == 50% + // ... + SPAPI A_Err (*AEGP_SetDownsampleFactor)( + AEGP_RenderOptionsH optionsH, /* <> */ + A_short x, /* >> */ + A_short y); /* >> */ + + SPAPI A_Err (*AEGP_GetDownsampleFactor)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_short *xP, /* >> */ + A_short *yP); /* << */ + + SPAPI A_Err (*AEGP_SetRegionOfInterest)( + AEGP_RenderOptionsH optionsH, /* <> */ + const A_LRect *roiP); /* >> {0,0,0,0} for all*/ + + SPAPI A_Err (*AEGP_GetRegionOfInterest)( + AEGP_RenderOptionsH optionsH, /* >> */ + A_LRect *roiP); /* << */ + + SPAPI A_Err (*AEGP_SetMatteMode)( + AEGP_RenderOptionsH optionsH, /* <> */ + AEGP_MatteMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMatteMode)( + AEGP_RenderOptionsH optionsH, /* >> */ + AEGP_MatteMode *modeP); /* << */ + +} AEGP_RenderOptionsSuite1; + + + + +#define kAEGPLayerRenderOptionsSuite "AEGP Layer Render Options Suite" +#define kAEGPLayerRenderOptionsSuiteVersion1 1 /* frozen in 13.0 */ + +typedef struct { + // optionsPH must be disposed by calling code + // + // fills out + // Time to the layer's current time + // Time step to layer's frame duration + // ROI to the layer's nominal bounds + // EffectsToRender to "all" + SPAPI A_Err (*AEGP_NewFromLayer)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_LayerH layerH, /* >> */ + AEGP_LayerRenderOptionsH *optionsPH); /* << */ + + // optionsPH must be disposed by calling code + // like AEGP_NewFromLayer, but sets EffectsToRender to be the index fof effectH + SPAPI A_Err (*AEGP_NewFromUpstreamOfEffect)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_EffectRefH effectH, /* >> */ + AEGP_LayerRenderOptionsH *optionsPH); /* << */ + + // copyPH must be disposed by calling code + SPAPI A_Err (*AEGP_Duplicate)( + AEGP_PluginID plugin_id, /* >> */ + AEGP_LayerRenderOptionsH optionsH, /* >> */ + AEGP_LayerRenderOptionsH *copyPH); /* << */ + + SPAPI A_Err (*AEGP_Dispose)( + AEGP_LayerRenderOptionsH optionsH); /* >> */ + + SPAPI A_Err (*AEGP_SetTime)( /* the render time */ + AEGP_LayerRenderOptionsH optionsH, /* <> */ + A_Time time); /* >> */ + + SPAPI A_Err (*AEGP_GetTime)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + A_Time *timeP); /* << */ + + SPAPI A_Err (*AEGP_SetTimeStep)( /* duration of the frame; important for motion blur. */ + AEGP_LayerRenderOptionsH optionsH, /* <> */ + A_Time time_step); /* >> */ + + SPAPI A_Err (*AEGP_GetTimeStep)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + A_Time *timePT); /* << */ + + SPAPI A_Err (*AEGP_SetWorldType)( + AEGP_LayerRenderOptionsH optionsH, /* <> */ + AEGP_WorldType type); /* >> */ + + SPAPI A_Err (*AEGP_GetWorldType)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + AEGP_WorldType *typeP); /* << */ + + // 1 == 100% + // 2 == 50% + // ... + SPAPI A_Err (*AEGP_SetDownsampleFactor)( + AEGP_LayerRenderOptionsH optionsH, /* <> */ + A_short x, /* >> */ + A_short y); /* >> */ + + SPAPI A_Err (*AEGP_GetDownsampleFactor)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + A_short *xP, /* >> */ + A_short *yP); /* << */ + + SPAPI A_Err (*AEGP_SetMatteMode)( + AEGP_LayerRenderOptionsH optionsH, /* <> */ + AEGP_MatteMode mode); /* >> */ + + SPAPI A_Err (*AEGP_GetMatteMode)( + AEGP_LayerRenderOptionsH optionsH, /* >> */ + AEGP_MatteMode *modeP); /* << */ +} AEGP_LayerRenderOptionsSuite1; + + + + +#define kAEGPColorSettingsSuiteVersion1 1 // frozen in AE 7.0 + +typedef struct AEGP_ColorSettingsSuite1 { + + SPAPI A_Err (*AEGP_GetBlendingTables)( + PR_RenderContextH render_contextH, + PF_EffectBlendingTables *blending_tables); + +} AEGP_ColorSettingsSuite1; + +#define kAEGPColorSettingsSuiteVersion2 3 // frozen in AE 8.0 + +typedef struct AEGP_ColorSettingsSuite2 { + + SPAPI A_Err (*AEGP_GetBlendingTables)( + PR_RenderContextH render_contextH, + PF_EffectBlendingTables *blending_tables); + + SPAPI A_Err (*AEGP_DoesViewHaveColorSpaceXform)( + AEGP_ItemViewP viewP, // >> + A_Boolean *has_xformPB); // << + + SPAPI A_Err (*AEGP_XformWorkingToViewColorSpace)( + AEGP_ItemViewP viewP, // >> + AEGP_WorldH srcH, // in + AEGP_WorldH dstH); // out; must be the same size (can be the same as source) + + SPAPI A_Err (*AEGP_GetNewWorkingSpaceColorProfile)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_CompH compH, // >> + AEGP_ColorProfileP *color_profilePP); // << caller must dispose with AEGP_DisposeColorProfile + + SPAPI A_Err (*AEGP_GetNewColorProfileFromICCProfile)( + AEGP_PluginID aegp_plugin_id, // >> + A_long icc_sizeL, // >> icc profile size + const void *icc_dataPV, // >> icc profile + AEGP_ColorProfileP *color_profilePP); // << builds AEGP_ColorProfile from icc profile; caller must dispose with AEGP_DisposeColorProfile + + SPAPI A_Err (*AEGP_GetNewICCProfileFromColorProfile)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_ConstColorProfileP color_profileP, // >> + AEGP_MemHandle *icc_profilePH); // << extract icc profile from AEGP_ColorProfile; caller must dispose with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetNewColorProfileDescription)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_ConstColorProfileP color_profileP, // >> + AEGP_MemHandle *unicode_descPH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_DisposeColorProfile)( + AEGP_ColorProfileP color_profileP); // >> + + SPAPI A_Err (*AEGP_GetColorProfileApproximateGamma)( + AEGP_ConstColorProfileP color_profileP, // >> + A_FpShort *approx_gammaP); // << + + SPAPI A_Err (*AEGP_IsRGBColorProfile)( + AEGP_ConstColorProfileP color_profileP, // << + A_Boolean *is_rgbPB); // >> + + +} AEGP_ColorSettingsSuite2; + +#define kAEGPMarkerSuiteVersion1 1 /* frozen in AE 8.0 */ + +typedef struct AEGP_MarkerSuite1 { + + SPAPI A_Err (*AEGP_NewMarker)( + AEGP_MarkerValP *markerPP); + + SPAPI A_Err (*AEGP_DisposeMarker)( + AEGP_MarkerValP markerP); + + SPAPI A_Err (*AEGP_DuplicateMarker)( + AEGP_MarkerValP markerP, // >> + AEGP_MarkerValP *new_markerP); // << + + SPAPI A_Err (*AEGP_SetMarkerFlag)( + AEGP_MarkerValP markerP, // >> + AEGP_MarkerFlagType flagType, // >> + A_Boolean valueB); // >> + + SPAPI A_Err (*AEGP_GetMarkerFlag)( + AEGP_ConstMarkerValP markerP, // >> + AEGP_MarkerFlagType flagType, // >> + A_Boolean *valueBP); // << + + SPAPI A_Err (*AEGP_GetMarkerString)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_ConstMarkerValP markerP, // >> + AEGP_MarkerStringType strType, // >> + AEGP_MemHandle *unicodePH); /* << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err (*AEGP_SetMarkerString)( + AEGP_MarkerValP markerP, // <<>> + AEGP_MarkerStringType strType, // >> + const A_u_short *unicodeP, // >> + A_long lengthL); // >> number of characters + + SPAPI A_Err (*AEGP_CountCuePointParams)( + AEGP_ConstMarkerValP markerP, // >> + A_long *paramsLP); // << + + SPAPI A_Err (*AEGP_GetIndCuePointParam)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_ConstMarkerValP markerP, // >> + A_long param_indexL, // >> must be between 0 and count - 1. else error + AEGP_MemHandle *unicodeKeyPH, // << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *unicodeValuePH); // << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_SetIndCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL, // must be between 0 and count - 1. else error + const A_u_short *unicodeKeyP, // >> UTF16 + A_long key_lengthL, // >> number of characters + const A_u_short *unicodeValueP, // >> UTF16 + A_long value_lengthL); // >> number of characters + + // this call is followed by AEGP_SetIndCuePointParam() to actually set the data + // the ONLY thing this function does is reserve the space for the param, at the provided index + SPAPI A_Err (*AEGP_InsertCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL); // must be between 0 and count. else error + + SPAPI A_Err (*AEGP_DeleteIndCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL); // must be between 0 and count - 1. else error + +} AEGP_MarkerSuite1; + +#define kAEGPMarkerSuiteVersion2 2 /* frozen in AE 9.0 */ + +typedef struct AEGP_MarkerSuite2 { + + SPAPI A_Err (*AEGP_NewMarker)( + AEGP_MarkerValP *markerPP); + + SPAPI A_Err (*AEGP_DisposeMarker)( + AEGP_MarkerValP markerP); + + SPAPI A_Err (*AEGP_DuplicateMarker)( + AEGP_MarkerValP markerP, // >> + AEGP_MarkerValP *new_markerP); // << + + SPAPI A_Err (*AEGP_SetMarkerFlag)( + AEGP_MarkerValP markerP, // >> + AEGP_MarkerFlagType flagType, // >> + A_Boolean valueB); // >> + + SPAPI A_Err (*AEGP_GetMarkerFlag)( + AEGP_ConstMarkerValP markerP, // >> + AEGP_MarkerFlagType flagType, // >> + A_Boolean *valueBP); // << + + SPAPI A_Err (*AEGP_GetMarkerString)( + AEGP_PluginID aegp_plugin_id, /* >> */ + AEGP_ConstMarkerValP markerP, // >> + AEGP_MarkerStringType strType, // >> + AEGP_MemHandle *unicodePH); /* << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle */ + + SPAPI A_Err (*AEGP_SetMarkerString)( + AEGP_MarkerValP markerP, // <<>> + AEGP_MarkerStringType strType, // >> + const A_u_short *unicodeP, // >> + A_long lengthL); // >> number of characters + + SPAPI A_Err (*AEGP_CountCuePointParams)( + AEGP_ConstMarkerValP markerP, // >> + A_long *paramsLP); // << + + SPAPI A_Err (*AEGP_GetIndCuePointParam)( + AEGP_PluginID aegp_plugin_id, // >> + AEGP_ConstMarkerValP markerP, // >> + A_long param_indexL, // >> must be between 0 and count - 1. else error + AEGP_MemHandle *unicodeKeyPH, // << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle + AEGP_MemHandle *unicodeValuePH); // << handle of A_u_short, UTF16, NULL terminated, must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_SetIndCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL, // must be between 0 and count - 1. else error + const A_u_short *unicodeKeyP, // >> UTF16 + A_long key_lengthL, // >> number of characters + const A_u_short *unicodeValueP, // >> UTF16 + A_long value_lengthL); // >> number of characters + + // this call is followed by AEGP_SetIndCuePointParam() to actually set the data + // the ONLY thing this function does is reserve the space for the param, at the provided index + SPAPI A_Err (*AEGP_InsertCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL); // must be between 0 and count. else error + + SPAPI A_Err (*AEGP_DeleteIndCuePointParam)( + AEGP_MarkerValP markerP, // >> + A_long param_indexL); // must be between 0 and count - 1. else error + + SPAPI A_Err (*AEGP_SetMarkerDuration)( + AEGP_MarkerValP markerP, // >> + const A_Time *durationPT); // >> + + + SPAPI A_Err (*AEGP_GetMarkerDuration)( + AEGP_ConstMarkerValP markerP, // >> + A_Time *durationPT); // << + + +} AEGP_MarkerSuite2; + +#define kAEGPProjSuiteVersion5 8 /* frozen in AE 10.0 */ + +typedef struct AEGP_ProjSuite5 { + + SPAPI A_Err (*AEGP_GetNumProjects)( /* will always (in 5.0) return 1 if project is open */ + A_long *num_projPL); /* << */ + + SPAPI A_Err (*AEGP_GetProjectByIndex)( + A_long proj_indexL, /* >> */ + AEGP_ProjectH *projPH); /* << */ + + SPAPI A_Err (*AEGP_GetProjectName)( + AEGP_ProjectH projH, /* >> */ + A_char *nameZ); /* << space for A_char[AEGP_MAX_PROJ_NAME_SIZE] */ + + SPAPI A_Err (*AEGP_GetProjectPath)( + AEGP_ProjectH projH, /* >> */ + AEGP_MemHandle *unicode_pathPH); // << empty string if no file. handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetProjectRootFolder)( + AEGP_ProjectH projH, /* >> */ + AEGP_ItemH *root_folderPH); /* << */ + + SPAPI A_Err (*AEGP_SaveProjectToPath)( + AEGP_ProjectH projH, /* >> */ + const A_UTF16Char *pathZ); // >> null terminated unicode path with platform separators + + SPAPI A_Err (*AEGP_GetProjectTimeDisplay)( + AEGP_ProjectH projH, /* >> */ + AEGP_TimeDisplay2 *time_displayP); /* << */ + + SPAPI A_Err (*AEGP_SetProjectTimeDisplay)( /* UNDOABLE */ + AEGP_ProjectH projH, /* <> */ + const AEGP_TimeDisplay2 *time_displayP); /* >> */ + + SPAPI A_Err (*AEGP_ProjectIsDirty)( + AEGP_ProjectH projH, /* >> */ + A_Boolean *is_dirtyPB); /* << */ + + SPAPI A_Err (*AEGP_SaveProjectAs)( + AEGP_ProjectH projH, /* >> */ + const A_UTF16Char *pathZ); // >> null terminated unicode path with platform separators + + SPAPI A_Err (*AEGP_NewProject)( + AEGP_ProjectH *new_projectPH); /* << WARNING: Will close any open projects! */ + + // WARNING: Will close any open projects! + SPAPI A_Err (*AEGP_OpenProjectFromPath)( + const A_UTF16Char *pathZ, // >> null terminated unicode path with platform separators + AEGP_ProjectH *projectPH); /* << */ + + SPAPI A_Err (*AEGP_GetProjectBitDepth)( + AEGP_ProjectH projectH, /* >> */ + AEGP_ProjBitDepth *bit_depthP); /* << */ + + SPAPI A_Err (*AEGP_SetProjectBitDepth)( /* UNDOABLE */ + AEGP_ProjectH projectH, /* >> */ + AEGP_ProjBitDepth bit_depth); /* >> */ + +} AEGP_ProjSuite5; + +#define kAEGPPersistentDataSuiteVersion3 3 /* frozen in AE 10.0 */ + +typedef struct { + // get a handle of the application blob, + // modifying this will modify the application + SPAPI A_Err (*AEGP_GetApplicationBlob)( + AEGP_PersistentBlobH *blobPH); /* >> */ + + // section and value key management + SPAPI A_Err (*AEGP_GetNumSections)( + AEGP_PersistentBlobH blobH, /* >> */ + A_long *num_sectionPL); /* << */ + + SPAPI A_Err (*AEGP_GetSectionKeyByIndex)( + AEGP_PersistentBlobH blobH, /* >> */ + A_long section_index, /* >> */ + A_long max_section_size, /* >> */ + A_char *section_keyZ); /* << */ + + SPAPI A_Err (*AEGP_DoesKeyExist)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_Boolean *existsPB); /* << */ + + SPAPI A_Err (*AEGP_GetNumKeys)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + A_long *num_keysPL); /* << */ + + SPAPI A_Err (*AEGP_GetValueKeyByIndex)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + A_long key_index, /* >> */ + A_long max_key_size, /* >> */ + A_char *value_keyZ); /* << */ + + // data access and manipulation + + // For the entry points below, if a given key is not found, + // the default value is both written to the blobH and + // returned as the value; if no default is provided, a blank value will be written + // and returned + + SPAPI A_Err (*AEGP_GetDataHandle)( + AEGP_PluginID plugin_id, + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + AEGP_MemHandle defaultH0, /* >> never adopted, NULL means no default data */ + AEGP_MemHandle *valuePH); /* << newly allocated, owned by caller, NULL if would be zero sized handle */ + + SPAPI A_Err (*AEGP_GetData)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_u_long data_sizeLu, /* >> bufPV & default must be this big, if pref isn't then the default will be used */ + const void *defaultPV0, /* >> NULL means all zeros for default */ + void *bufPV); /* << */ + + SPAPI A_Err (*AEGP_GetString)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const A_char *defaultZ0, /* >> NULL means '\0' is the default */ + A_u_long buf_sizeLu, /* >> size of buffer. Behavior dependent on actual_buf_sizeLu0 */ + A_char *bufZ, /* << will be "" if buf_size is too small */ + A_u_long *actual_buf_sizeLu0); /* << actual size needed to store the buffer (includes terminating NULL). Pass NULL for error reporting if size mismatch.*/ + + SPAPI A_Err (*AEGP_GetLong)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_long defaultL, /* >> */ + A_long *valuePL); /* << */ + + SPAPI A_Err (*AEGP_GetFpLong)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_FpLong defaultF, /* >> */ + A_FpLong *valuePF); /* << */ + + // setters + SPAPI A_Err (*AEGP_SetDataHandle)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const AEGP_MemHandle valueH); /* >> not adopted */ + + SPAPI A_Err (*AEGP_SetData)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_u_long data_sizeLu, /* >> */ + const void *dataPV); /* >> */ + + SPAPI A_Err (*AEGP_SetString)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + const A_char *strZ); /* >> */ + + SPAPI A_Err (*AEGP_SetLong)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_long valueL); /* >> */ + + + SPAPI A_Err (*AEGP_SetFpLong)( + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ, /* >> */ + A_FpLong valueF); /* >> */ + + SPAPI A_Err (*AEGP_DeleteEntry)( /* no error if entry not found */ + AEGP_PersistentBlobH blobH, /* >> */ + const A_char *section_keyZ, /* >> */ + const A_char *value_keyZ); /* >> */ + + SPAPI A_Err (*AEGP_GetPrefsDirectory)( + AEGP_MemHandle *unicode_pathPH); // << empty string if no file. handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + +} AEGP_PersistentDataSuite3; + +#define kAEGPIterateSuite "AEGP Iterate Suite" +#define kAEGPIterateSuiteVersion1 1 /* frozen in AE 5.0 */ + +typedef struct AEGP_IterateSuite1 { + + SPAPI A_Err(*AEGP_GetNumThreads)( + A_long* num_threadsPL); + + + SPAPI A_Err(*AEGP_IterateGeneric)( + A_long iterationsL, /* >> */ // can be PF_Iterations_ONCE_PER_PROCESSOR + void* refconPV, /* >> */ + A_Err(*fn_func)(void* refconPV, /* >> */ + A_long thread_indexL, /* >> */ + A_long i, /* >> */ + A_long iterationsL)); /* >> */ + +} AEGP_IterateSuite1; + +#define kAEGPIOInSuite "AEGP IO In Suite" +#define kAEGPIOInSuiteVersion4 5 /* frozen in AE 10 */ + +typedef struct AEGP_IOInSuite4 { + + SPAPI A_Err (*AEGP_GetInSpecOptionsHandle)( + AEIO_InSpecH inH, /* >> */ + void **optionsPPV); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecOptionsHandle)( + AEIO_InSpecH inH, /* >> */ + void *optionsPV, /* >> */ + void **old_optionsPPV); /* << */ + + SPAPI A_Err (*AEGP_GetInSpecFilePath)( + AEIO_InSpecH inH, /* >> */ + AEGP_MemHandle *unicode_pathPH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + SPAPI A_Err (*AEGP_GetInSpecNativeFPS)( + AEIO_InSpecH inH, /* >> */ + A_Fixed *native_fpsP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecNativeFPS)( + AEIO_InSpecH inH, /* >> */ + A_Fixed native_fps); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecDepth)( + AEIO_InSpecH inH, /* >> */ + A_short *depthPS); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecDepth)( + AEIO_InSpecH inH, /* >> */ + A_short depthS); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSize)( + AEIO_InSpecH inH, /* >> */ + AEIO_FileSize *sizePL); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecSize)( + AEIO_InSpecH inH, /* >> */ + AEIO_FileSize sizeL); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecInterlaceLabel)( + AEIO_InSpecH inH, /* >> */ + FIEL_Label *interlaceP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecInterlaceLabel)( + AEIO_InSpecH inH, /* >> */ + const FIEL_Label *interlaceP); /* << */ + + SPAPI A_Err (*AEGP_GetInSpecAlphaLabel)( + AEIO_InSpecH inH, /* >> */ + AEIO_AlphaLabel *alphaP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecAlphaLabel)( + AEIO_InSpecH inH, /* >> */ + const AEIO_AlphaLabel *alphaP); /* << */ + + SPAPI A_Err (*AEGP_GetInSpecDuration)( + AEIO_InSpecH inH, /* >> */ + A_Time *durationP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecDuration)( + AEIO_InSpecH inH, /* >> */ + const A_Time *durationP); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecDimensions)( + AEIO_InSpecH inH, /* >> */ + A_long *widthPL0, /* << */ + A_long *heightPL0); + + SPAPI A_Err (*AEGP_SetInSpecDimensions)( + AEIO_InSpecH inH, /* >> */ + A_long widthL, /* >> */ + A_long heightL); /* >> */ + + SPAPI A_Err (*AEGP_InSpecGetRationalDimensions)( + AEIO_InSpecH inH, /* >> */ + const AEIO_RationalScale *rs0, /* << */ + A_long *width0, /* << */ + A_long *height0, /* << */ + A_Rect *r0); /* << */ + + SPAPI A_Err (*AEGP_GetInSpecHSF)( + AEIO_InSpecH inH, /* >> */ + A_Ratio *hsfP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecHSF)( + AEIO_InSpecH inH, /* >> */ + const A_Ratio *hsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSoundRate)( + AEIO_InSpecH inH, /* >> */ + A_FpLong *ratePF); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecSoundRate)( + AEIO_InSpecH inH, /* >> */ + A_FpLong rateF); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSoundEncoding)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndEncoding *encodingP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecSoundEncoding)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndEncoding encoding); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSoundSampleSize)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndSampleSize *bytes_per_sampleP);/* << */ + + SPAPI A_Err (*AEGP_SetInSpecSoundSampleSize)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndSampleSize bytes_per_sample); /* >> */ + + SPAPI A_Err (*AEGP_GetInSpecSoundChannels)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndChannels *num_channelsP); /* << */ + + SPAPI A_Err (*AEGP_SetInSpecSoundChannels)( + AEIO_InSpecH inH, /* >> */ + AEIO_SndChannels num_channels); /* >> */ + + SPAPI A_Err (*AEGP_AddAuxExtMap)( + const A_char *extension, /* >> */ + A_long file_type, /* >> */ + A_long creator); /* >> */ + + // In case of RGB data, if there is an embedded icc profile, build AEGP_ColorProfile out of this icc profile using AEGP_GetNewColorProfileFromICCProfile and pass it to + // AEGP_SetInSpecEmbeddedColorProfile, with profile description set to NULL. + // + // In case of non-RGB data, if there is an embedded non-RGB icc profile or you know the color space the data is in, pass its description as a null-terminated unicode string + // to AEGP_SetInSpecEmbeddedColorProfile, with color profile set to NULL. Doing this disables color management UI that allows user to affect + // profile choice in the application UI. + // + // If you are unpacking non-RGB data directly into working space (to get working space use AEGP_GetNewWorkingSpaceColorProfile), you are done. + // + // If you are unpacking non-RGB data into specific RGB color space, you must pass the profile describing this space to AEGP_SetInSpecAssignedColorProfile. + // Otherwise, your RGB data will be incorrectly interpreted as being in working space. + // + // Either color profile or profile description should be NULL in AEGP_SetInSpecEmbeddedColorProfile. You cannot use both. + SPAPI A_Err (*AEGP_SetInSpecEmbeddedColorProfile)( + AEIO_InSpecH inH, // << + AEGP_ConstColorProfileP color_profileP0, // << + const A_UTF16Char *profile_descP0); // << pointer to a null-terminated unicode string + + // Assign valid RGB profile to the footage + SPAPI A_Err (*AEGP_SetInSpecAssignedColorProfile)( + AEIO_InSpecH inH, // << + AEGP_ConstColorProfileP color_profileP); // << + +} AEGP_IOInSuite4; + +#define kAEGPIOOutSuiteVersion4 7 /* frozen in AE 10.0 */ + +typedef struct AEGP_IOOutSuite4 { + SPAPI A_Err (*AEGP_GetOutSpecOptionsHandle)( + AEIO_OutSpecH outH, /* >> */ + void **optionsPPV); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecOptionsHandle)( + AEIO_OutSpecH outH, /* >> */ + void *optionsPV, /* >> */ + void **old_optionsPPVO); /* <> */ + + SPAPI A_Err (*AEGP_GetOutSpecFilePath)( + AEIO_OutSpecH outH, /* >> */ + AEGP_MemHandle *unicode_pathPH, // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + A_Boolean *file_reservedPB); /* << If the file is reserved, do not create the file. + Otherwise, multi-machine rendering can fail. + If true, an empty file has already been created. */ + + SPAPI A_Err (*AEGP_GetOutSpecFPS)( + AEIO_OutSpecH outH, /* >> */ + A_Fixed *native_fpsP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecNativeFPS)( + AEIO_OutSpecH outH, /* >> */ + A_Fixed native_fpsP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecDepth)( + AEIO_OutSpecH outH, /* >> */ + A_short *depthPS); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecDepth)( + AEIO_OutSpecH outH, /* >> */ + A_short depthPS); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecInterlaceLabel)( + AEIO_OutSpecH outH, /* >> */ + FIEL_Label *interlaceP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecInterlaceLabel)( + AEIO_OutSpecH outH, /* >> */ + const FIEL_Label *interlaceP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecAlphaLabel)( + AEIO_OutSpecH outH, /* >> */ + AEIO_AlphaLabel *alphaP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecAlphaLabel)( + AEIO_OutSpecH outH, /* >> */ + const AEIO_AlphaLabel *alphaP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecDuration)( + AEIO_OutSpecH outH, /* >> */ + A_Time *durationP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecDuration)( + AEIO_OutSpecH outH, /* >> */ + const A_Time *durationP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecDimensions)( + AEIO_OutSpecH outH, /* >> */ + A_long *widthPL, /* << */ + A_long *heightPL); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecHSF)( + AEIO_OutSpecH outH, /* >> */ + A_Ratio *hsfP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecHSF)( + AEIO_OutSpecH outH, /* >> */ + const A_Ratio *hsfP); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecSoundRate)( + AEIO_OutSpecH outH, /* >> */ + A_FpLong *ratePF); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecSoundRate)( + AEIO_OutSpecH outH, /* >> */ + A_FpLong rateF); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecSoundEncoding)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndEncoding *encodingP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecSoundEncoding)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndEncoding encoding); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecSoundSampleSize)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndSampleSize *bytes_per_sampleP);/* << */ + + SPAPI A_Err (*AEGP_SetOutSpecSoundSampleSize)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndSampleSize bytes_per_sample); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecSoundChannels)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndChannels *num_channelsP); /* << */ + + SPAPI A_Err (*AEGP_SetOutSpecSoundChannels)( + AEIO_OutSpecH outH, /* >> */ + AEIO_SndChannels num_channels); /* >> */ + + SPAPI A_Err (*AEGP_GetOutSpecIsStill)( + AEIO_OutSpecH outH, /* >> */ + A_Boolean *is_stillPB); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecPosterTime)( + AEIO_OutSpecH outH, /* >> */ + A_Time *poster_timeP); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecStartFrame)( + AEIO_OutSpecH outH, /* >> */ + A_long *start_frameP); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecPullDown)( + AEIO_OutSpecH outH, /* >> */ + AEIO_Pulldown *pulldownP); /* << */ + + SPAPI A_Err (*AEGP_GetOutSpecIsMissing)( + AEIO_OutSpecH outH, /* >> */ + A_Boolean *missingPB); /* << */ + + // see if you need to embed outspec's color profile as an icc profile + SPAPI A_Err (*AEGP_GetOutSpecShouldEmbedICCProfile)( + AEIO_OutSpecH outH, // >> + A_Boolean *embedPB); // << + + // query outspec's color profile + SPAPI A_Err (*AEGP_GetNewOutSpecColorProfile)( + AEGP_PluginID aegp_plugin_id, // >> + AEIO_OutSpecH outH, // >> + AEGP_ColorProfileP *color_profilePP); // << output color space; caller must dispose with AEGP_DisposeColorProfile + + // Fails if rq_itemP is not found. + // This API would also fail if the outH is not a confirmed outH and is a copy. + // e.g. if the Output Module settings dialog is Open. + SPAPI A_Err (*AEGP_GetOutSpecOutputModule)( + AEIO_OutSpecH outH, /* >> */ + AEGP_RQItemRefH *rq_itemP, /* << */ + AEGP_OutputModuleRefH *om_refP); /* << */ + + +} AEGP_IOOutSuite4; + +#define kAEGPFIMSuiteVersion3 3 /* frozen in AE 10.0 */ +typedef struct { + SPAPI A_Err (*AEGP_RegisterImportFlavor)( + const A_char *nameZ, // format name you'd like to appear + // in AE's Import Dialog Format pop-up + // menu. + // Limited to AE_FIM_MAX_IMPORT_FLAVOR_NAME_LEN. + // Everything after that will be truncated. + AE_FIM_ImportFlavorRef *imp_refP); // On return it is set to a valid opaque ref. + // If error occured, it will be returned to + // the caller and ref will be set to a special + // value - AE_FIM_ImportFlavorRef_NONE. + + SPAPI A_Err (*AEGP_RegisterImportFlavorFileTypes)( + AE_FIM_ImportFlavorRef imp_ref, // Received from AEGP_RegisterImportFlavor + A_long num_filekindsL, // number of supported file types for this format + const AEIO_FileKind *kindsAP, // Array of supported file types for this format + A_long num_fileextsL, // number of supported file exts for this format + const AEIO_FileKind *extsAP); // Array of supported file exts for this format + + + SPAPI A_Err (*AEGP_RegisterImportFlavorImportCallbacks)( + AE_FIM_ImportFlavorRef imp_ref, // Received from AEGP_RegisterImportFlavor + AE_FIM_ImportFlags single_flag, // You can register callbacks only per single flag + // this also registers the flag with the import flavor + const AE_FIM_ImportCallbacks *imp_cbsP); // Callbacks your format installs per each flag + + // optionally call once from AE_FIM_ImportFileCB. This is used by the application when re-importing + // from the render queue and replacing an existing item. + SPAPI A_Err (*AEGP_SetImportedItem)( + AE_FIM_ImportOptions imp_options, /* <> */ + AEGP_ItemH imported_itemH); /* >> */ + +} AEGP_FIMSuite3; + + +#include diff --git a/External/AE SDK/Headers/AE_GeneralPlugPanels.h b/External/AE SDK/Headers/AE_GeneralPlugPanels.h new file mode 100644 index 00000000..9f1e5e75 --- /dev/null +++ b/External/AE SDK/Headers/AE_GeneralPlugPanels.h @@ -0,0 +1,134 @@ +#ifndef _AEGP_PANELS_H_ +#define _AEGP_PANELS_H_ + +#include "AE_GeneralPlug.h" + +#if defined(__GNUC__) && defined(__MACH__) + #if defined(__LP64__) + #include + typedef NSView *AEGP_PlatformViewRef; + #else + typedef HIViewRef AEGP_PlatformViewRef; + #endif +#endif + +#if defined(WIN32) + #include + typedef HWND AEGP_PlatformViewRef; +#endif + +typedef struct _AEGP_CreatePanelRefcon *AEGP_CreatePanelRefcon; +typedef struct _AEGP_PanelRefcon *AEGP_PanelRefcon; + +#ifndef AEGP_INTERNAL + // opaque for everyone else + typedef struct _AEGP_PanelH *AEGP_PanelH; +#endif + + + +#include + + +enum {AEGP_FlyoutMenuCmdID_NONE = 0}; +typedef A_long AEGP_FlyoutMenuCmdID; + + +enum { + AEGP_FlyoutMenuMarkType_NORMAL, + AEGP_FlyoutMenuMarkType_CHECKED, + AEGP_FlyoutMenuMarkType_RADIO_BULLET, + AEGP_FlyoutMenuMarkType_SEPARATOR +}; +typedef A_long AEGP_FlyoutMenuMarkType; + +typedef A_long AEGP_FlyoutMenuIndent; + + +typedef struct +{ + AEGP_FlyoutMenuIndent indent; + AEGP_FlyoutMenuMarkType type; + A_Boolean enabledB; + AEGP_FlyoutMenuCmdID cmdID; // limited to MAX(A_long) - 201; + const A_u_char* utf8NameZ; +}AEGP_FlyoutMenuItem; + +/* +flyout menu's are a simple declarative structure + +AEGP_FlyoutMenuItem myMenu[] = { + {1, AEGP_FlyoutMenuMarkType_NORMAL, FALSE, AEGP_FlyoutMenuCmdID_NONE, "Hi!" }, + {1, AEGP_FlyoutMenuMarkType_SEPARATOR, TRUE, AEGP_FlyoutMenuCmdID_NONE, NULL }, + {1, AEGP_FlyoutMenuMarkType_NORMAL, TRUE, AEGP_FlyoutMenuCmdID_NONE, "Set BG Color" }, + {2, AEGP_FlyoutMenuMarkType_NORMAL, TRUE, PT_MenuCmd_RED, "Red" }, + {2, AEGP_FlyoutMenuMarkType_NORMAL, TRUE, PT_MenuCmd_GREEN, "Green" }, + {2, AEGP_FlyoutMenuMarkType_NORMAL, TRUE, PT_MenuCmd_BLUE, "Blue" }, + {1, AEGP_FlyoutMenuMarkType_NORMAL, TRUE, PT_MenuCmd_STANDARD, "Normal Fill Color" }, + {1, AEGP_FlyoutMenuMarkType_NORMAL, TRUE, AEGP_FlyoutMenuCmdID_NONE, "Set Title" }, + {2, AEGP_FlyoutMenuMarkType_NORMAL, TRUE, PT_MenuCmd_TITLE_LONGER, "Longer" }, + {2, AEGP_FlyoutMenuMarkType_NORMAL, TRUE, PT_MenuCmd_TITLE_SHORTER, "Shorter" } +}; + + +*/ + +typedef struct { + // no more than 5 snap sizes. Our algo can't really cope and it confuses + // the user. + A_Err (*GetSnapSizes)(AEGP_PanelRefcon refcon, A_LPoint* snapSizes, A_long * numSizesP); + + + A_Err (*PopulateFlyout)(AEGP_PanelRefcon refcon, AEGP_FlyoutMenuItem* itemsP, A_long * in_out_numItemsP); + A_Err (*DoFlyoutCommand)(AEGP_PanelRefcon refcon, AEGP_FlyoutMenuCmdID commandID); +} AEGP_PanelFunctions1; + +typedef A_Err (*AEGP_CreatePanelHook)( + AEGP_GlobalRefcon plugin_refconP, + AEGP_CreatePanelRefcon refconP, + AEGP_PlatformViewRef container, + AEGP_PanelH panelH, + AEGP_PanelFunctions1* outFunctionTable, + AEGP_PanelRefcon* outRefcon); +#define kAEGPPanelSuite "AEGP Workspace Panel Suite" +#define kAEGPPanelSuiteVersion1 1 /* frozen in AE 8.0 */ + +typedef struct { + SPAPI A_Err (*AEGP_RegisterCreatePanelHook)( + AEGP_PluginID in_plugin_id, + const A_u_char* in_utf8_match_nameZ, // do not localize + AEGP_CreatePanelHook in_update_menu_hook_func, + AEGP_CreatePanelRefcon in_refconP, + A_Boolean in_paint_backgroundB); + + + SPAPI A_Err (*AEGP_UnRegisterCreatePanelHook)( + const A_u_char* in_utf8_match_nameZ); // do not localize match name + + SPAPI A_Err (*AEGP_SetTitle)( + AEGP_PanelH in_panelH, + const A_u_char* in_utf8_nameZ // use this to localize the user visible name of the panel + ); + + /** Does the standard 'Window' menu operation + If tab is not in workspace, it creates it. + Otherwise, if the tab is not the front most tab in it's frame, it is made frontmost + Else, if it is visible and frontmost, it is closed. + */ + SPAPI A_Err (*AEGP_ToggleVisibility)( + const A_u_char* in_utf8_match_nameZ + ); + + SPAPI A_Err (*AEGP_IsShown)( + const A_u_char* in_utf8_match_nameZ, + A_Boolean* out_tab_is_shownB, + A_Boolean* out_panel_is_frontmostB + ); + +} AEGP_PanelSuite1; + + +#include + + +#endif \ No newline at end of file diff --git a/External/AE SDK/Headers/AE_GeneralPlugPost.h b/External/AE SDK/Headers/AE_GeneralPlugPost.h new file mode 100644 index 00000000..7b5fba7b --- /dev/null +++ b/External/AE SDK/Headers/AE_GeneralPlugPost.h @@ -0,0 +1,16 @@ + +#ifdef __cplusplus +} // end extern "C" +#endif + + + +#include + + + +#ifndef _AE_GENERAL_PLUG_PRE___ + #error "AE_GeneralPlugPost.h not balanced" +#else + #undef _AE_GENERAL_PLUG_PRE___ +#endif \ No newline at end of file diff --git a/External/AE SDK/Headers/AE_GeneralPlugPre.h b/External/AE SDK/Headers/AE_GeneralPlugPre.h new file mode 100644 index 00000000..8b2e28d9 --- /dev/null +++ b/External/AE SDK/Headers/AE_GeneralPlugPre.h @@ -0,0 +1,15 @@ + +/* This file should be included after all headers, but before the definition of any suites +or data structures. +*/ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _AE_GENERAL_PLUG_PRE___ +#error "AE_GeneralPlugPre.h not balanced" +#endif + +#define _AE_GENERAL_PLUG_PRE___ \ No newline at end of file diff --git a/External/AE SDK/Headers/AE_HashSuite.h b/External/AE SDK/Headers/AE_HashSuite.h new file mode 100644 index 00000000..04859b8a --- /dev/null +++ b/External/AE SDK/Headers/AE_HashSuite.h @@ -0,0 +1,52 @@ +/******************************************************************** +* ADOBE CONFIDENTIAL +* __________________ +* +* Copyright 2020 Adobe Inc. +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains +* the property of Adobe and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe +* and its suppliers and are protected by all applicable intellectual +* property laws, including trade secret and copyright laws. +* Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained +* from Adobe. +********************************************************************/ + +#ifndef _H_AE_HashSuite + #define _H_AE_HashSuite + +#ifdef AEGP_INTERNAL + #include +#endif + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +#define kAEGPHashSuite "AEGP Hash Suite" +#define kAEGPHashSuiteVersion1 1 /* frozen in AE 17.5.1 */ + +typedef struct { + + SPAPI A_Err (*AEGP_CreateHashFromPtr)( + const A_u_longlong buf_sizeLu, /* >> size of the buffer */ + const void *bufPV, /* >> the buffer pointer */ + AEGP_GUID *hashP); /* << result */ + + SPAPI A_Err (*AEGP_HashMixInPtr)( + const A_u_longlong buf_sizeLu, /* >> size of the buffer */ + const void *bufPV, /* >> the buffer pointer */ + AEGP_GUID *hashP); /* <> guid to be mixed in */ + +} AEGP_HashSuite1; + +#ifdef __cplusplus + } // end extern "C" +#endif + +#endif diff --git a/External/AE SDK/Headers/AE_Hook.h b/External/AE SDK/Headers/AE_Hook.h new file mode 100644 index 00000000..6f747688 --- /dev/null +++ b/External/AE SDK/Headers/AE_Hook.h @@ -0,0 +1,155 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef _H_HOOK_AE +#define _H_HOOK_AE + + +#include // for PF_Version, other types + + +#ifdef __cplusplus + extern "C" { +#endif + + +#define AE_HOOK_PLUGIN_TYPE 'AEgp' + +#define AE_HOOK_MAJOR_VERSION 3 +#define AE_HOOK_MINOR_VERSION 0 + +enum { + AE_PixFormat_NONE = -1, // sentinel -- meaningless + AE_PixFormat_ARGB = 0, + AE_PixFormat_BGRA +}; + +typedef A_long AE_PixFormat; + +enum { + AE_BlitOutFlag_NONE = 0, + AE_BlitOutFlag_ASYNCHRONOUS = 1L << 0 +}; + +enum { + AE_BlitInFlag_NONE = 0, + AE_BlitInFlag_RENDERING = 1L << 0 +}; + +typedef A_long AE_BlitInFlags; +typedef A_long AE_BlitOutFlags; + +// AE now supports 8bpp, 16bpp and 32bpc +// depthL, chan_bytesL, and plane_bytesL +// can now change. +typedef struct { + A_long widthL; + A_long heightL; + A_long depthL; // 32, 64, or 128 + AE_PixFormat pix_format; // always AE_PixFormat_ARGB on Mac, BGRA on Windows (for now) + + A_long row_bytesL; + A_long chan_bytesL; // 4, 8, or 16 + A_long plane_bytesL; // 1, 2, or 4 (for float) + + void *pixelsPV; + +} AE_PixBuffer; + + + +typedef struct { + A_long frame_widthL; // original size of image regardless of region of interest + A_long frame_heightL; + + A_long origin_xL; // where the pix buffer is placed in frame coords + A_long origin_yL; + + A_long view_rect_leftL; // what the user is actually seeing in the window + A_long view_rect_topL; + A_long view_rect_rightL; + A_long view_rect_bottomL; + + +} AE_ViewCoordinates; + + + +typedef struct _AE_BlitReceipt *AE_BlitReceipt; // opaque + +typedef struct _AE_CursorInfo *AE_CursorInfo; // opaque until I can decide what this means + + + +typedef void (*AE_DeathHook)( void *hook_refconPV); /* >> */ + +typedef void (*AE_VersionHook)( void *hook_refconPV, /* >> */ + A_u_long *versionPV); /* << */ + + +typedef struct FILE_Spec **AE_FileSpecH; + + +typedef void (*AE_BlitCompleteFunc)( AE_BlitReceipt receipt, + PF_Err err); // non zero if error during asynch operation + + +typedef PF_Err (*AE_BlitHook)( void *hook_refconPV, /* >> */ + const AE_PixBuffer *pix_bufP0, /* >> if NULL, display a blank frame */ + const AE_ViewCoordinates *viewP, /* >> */ + AE_BlitReceipt receipt, /* >> */ + AE_BlitCompleteFunc complete_func0, /* >> */ + AE_BlitInFlags in_flags, /* >> */ + AE_BlitOutFlags *out_flags); /* << */ + + + +typedef void (*AE_CursorHook)( void *hook_refconPV, /* >> */ + const AE_CursorInfo *cursorP); /* >> */ + +typedef struct { + // must match NIM_Hooks + + void *hook_refconPV; + void *reservedAPV[8]; + AE_DeathHook death_hook_func; + AE_VersionHook version_hook_func; + struct SPBasicSuite *pica_basicP; + AE_BlitHook blit_hook_func; + AE_CursorHook cursor_hook_func; + +} AE_Hooks; + + + +typedef PF_Err (*AE_HookPluginEntryFunc)( A_long major_version, /* >> */ + A_long minor_version, /* >> */ + AE_FileSpecH file_specH, /* >> */ + AE_FileSpecH res_specH, /* >> */ + AE_Hooks *hooksP); /* << */ + +#ifdef __cplusplus + } +#endif + + +#endif + diff --git a/External/AE SDK/Headers/AE_IO.h b/External/AE SDK/Headers/AE_IO.h new file mode 100644 index 00000000..88ccce2a --- /dev/null +++ b/External/AE SDK/Headers/AE_IO.h @@ -0,0 +1,789 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef _AEIO_Public_H +#define _AEIO_Public_H + +#include +#include +#include +#include +#include + +#include + + +/////////////////////////////////////////////////// +////////////////// PUBLIC //////////////////////// +////////////////////////////////////////////////// + +#define AEIO_MAX_MODULE_NAME_LEN 31 +#define AEIO_MAX_TYPES 16 +#define AEIO_MAX_SEQ_NAME_LEN 31 +#define AEIO_MAX_MESSAGE_LEN 127 +#define AEIO_MAX_AUX_EXT 16 + +#define AEIO_ANY_CREATOR -1 + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef AEGP_INTERNAL + typedef const struct _AEGP_MarkerVal *AEGP_ConstMarkerValP; +#else +#ifndef _H_AE_GENERALPLUG_PRIVATE_H +#error include general plug private header before including AEIO +#endif +#endif + + + +/** + ** in data is passed to every function block function + **/ + +typedef void (*AEIO_MessageFunc) (A_Err err_number, const A_char *msgA); + +typedef struct AEIO_InData { + AEIO_MessageFunc msg_func; + const struct SPBasicSuite *pica_basicP; + A_long aegp_plug_id; + void *aegp_refconPV; +} AEIO_BasicData; + +enum { + AEIO_Err_UNSUPPORTED_CALLBACK = (((39)<<8)+1), + AEIO_Err_UNIMPLEMENTED, + AEIO_Err_UNSUPPORTED_FILETYPE, + AEIO_Err_INAPPROPRIATE_ACTION, + AEIO_Err_BAD_BMWORLD, + AEIO_Err_INCONSISTENT_PARAMETERS, + AEIO_Err_INVALID_TIME, + AEIO_Err_USE_DFLT_CALLBACK, + AEIO_Err_USER_CANCEL, + AEIO_Err_DISK_FULL, + AEIO_Err_INITIALIZE_FAILED, + AEIO_Err_BAD_FILENAME, + AEIO_Err_PARSING, + AEIO_Err_NOT_SEQUENCE, + AEIO_Err_USE_DFLT_GETSIZES_FREESPACE +}; + +typedef struct _Up_OpaqueMem **AEIO_Handle; + +enum { + AEIO_DFlags_NONE = 0, + AEIO_DFlags_DID_DEINT = (1L<<1), // I already did deinterlacing + AEIO_DFlags_DID_ALPHA_CONV = (1L<<2) // I already did alpha conversion to what you wanted. +}; +typedef A_long AEIO_DrawingFlags; + +/* NOTE: AEIO_DFlags_NO_SCALE and AEIO_DFlags_DID_TIME_FILTER, + previously included in the above, were never honored (so + we removed them). -bbb 8/14/02 +*/ + +enum { + AEIO_Qual_LOW, + AEIO_Qual_HIGH +}; +typedef A_short AEIO_Quality; + +enum { + AEIO_TimeDir_FORWARD = 0x0000, + AEIO_TimeDir_BACKWARD = 0x0001, + AEIO_TimeDir_INCLUDE_BASE_TIME = 0x1000 +}; +typedef A_short AEIO_TimeDir; + +enum { + AEIO_IdleFlag_NONE = 0, + AEIO_IdleFlag_PURGED_MEM = 1L << 0, + AEIO_IdleFlag_ADD_YOUR_OWN = 1L << 1 +}; +typedef A_long AEIO_IdleFlags; + +enum { + AEIO_SndQuality_APPROX = -1, // This quality is used to draw the audio waveform. -jja + AEIO_SndQuality_LO = 0, + AEIO_SndQuality_HI +}; + +typedef A_long AEIO_SndQuality; + +enum { + AEIO_E_UNSIGNED_PCM = 1, + AEIO_E_SIGNED_PCM = 2, + AEIO_E_SIGNED_FLOAT = 3 +}; +typedef A_short AEIO_SndEncoding; + +enum { + AEIO_SS_1 = 1, + AEIO_SS_2 = 2, + AEIO_SS_4 = 4 +}; +typedef A_short AEIO_SndSampleSize; + +enum { + AEIO_SndChannels_MONO = 1, + AEIO_SndChannels_STEREO = 2 +}; +typedef A_short AEIO_SndChannels; + +enum { + AEIO_Marker_URL_FLIP, + AEIO_Marker_CHAPTER, + AEIO_Marker_HOTSPOT, + AEIO_Marker_NONE +}; +typedef A_u_char AEIO_MarkerType; + +enum { + AEIO_Field_FRAME = 0, + AEIO_Field_UPPER, + AEIO_Field_LOWER +}; +typedef A_long AEIO_Field; + + +typedef struct { + const A_char *chapterZ0; + const A_char *commentZ0; + const A_char *urlZ0; + const A_char *url_frame_targetZ0; // optionally used if urlZ0 != NULL +} AEIO_Marker; + + +enum { + AEIO_FrameBlend_NONE = 0, + AEIO_FrameBlend_LOW = 1, + AEIO_FrameBlend_HIGH = 2 +}; +typedef A_char AEIO_FrameBlend; + + +enum { + AEIO_LFlag_ALFA = 0x1, + AEIO_LFlag_FIELDS = 0x2, + AEIO_LFlag_SIGNATURE = 0x4 +}; +typedef A_long AEIO_LabelFlags; + +enum { + AEIO_InputDepth_1 = 1, + AEIO_InputDepth_2 = 2, + AEIO_InputDepth_4 = 4, + AEIO_InputDepth_8 = 8, + AEIO_InputDepth_16 = 16, + AEIO_InputDepth_24 = 24, + AEIO_InputDepth_30 = 30, + AEIO_InputDepth_32 = 32, + AEIO_InputDepth_GRAY_2 = 34, + AEIO_InputDepth_GRAY_4 = 36, + AEIO_InputDepth_GRAY_8 = 40, + AEIO_InputDepth_48 = 48, + AEIO_InputDepth_64 = 64, + AEIO_InputDepth_96 = 96, // RGB float + AEIO_InputDepth_128 = 128, // ARGB float + AEIO_InputDepth_GRAY_16 = -16, + AEIO_InputDepth_GRAY_32 = -32 +}; + +typedef A_long AEIO_InputDepth; + +enum { + AEIO_SupportedDepthFlags_NONE = 0, + AEIO_SupportedDepthFlags_DEPTH_1 = 1L << 1, // Enable 1 bit images. Put an interface on it, if you like + AEIO_SupportedDepthFlags_DEPTH_2 = 1L << 2, // Enable 2 bit images. etc. + AEIO_SupportedDepthFlags_DEPTH_4 = 1L << 3, + AEIO_SupportedDepthFlags_DEPTH_8 = 1L << 4, + AEIO_SupportedDepthFlags_DEPTH_16 = 1L << 5, + AEIO_SupportedDepthFlags_DEPTH_24 = 1L << 6, + AEIO_SupportedDepthFlags_DEPTH_32 = 1L << 7, // Enable 32-bit images (with alpha channels) + AEIO_SupportedDepthFlags_DEPTH_GRAY_2 = 1L << 8, // greyscale + AEIO_SupportedDepthFlags_DEPTH_GRAY_4 = 1L << 9, + AEIO_SupportedDepthFlags_DEPTH_GRAY_8 = 1L << 10, + AEIO_SupportedDepthFlags_DEPTH_48 = 1L << 11, + AEIO_SupportedDepthFlags_DEPTH_64 = 1L << 12, + AEIO_SupportedDepthFlags_DEPTH_GRAY_16 = 1L << 13, + AEIO_SupportedDepthFlags_DEPTH_96 = 1L << 14, + AEIO_SupportedDepthFlags_DEPTH_128 = 1L << 15, + AEIO_SupportedDepthFlags_LAST = 1L << 16 +}; + +typedef A_long AEIO_SupportedDepthFlags; + +enum { + AEIO_Phase_NO_PULLDOWN = 0, + AEIO_Phase_WSSWW = 1, + AEIO_Phase_SSWWW, + AEIO_Phase_SWWWS, + AEIO_Phase_WWWSS, + AEIO_Phase_WWSSW +}; +typedef A_long AEIO_Pulldown; + +typedef A_long AEIO_FileType; +typedef A_long AEIO_Creator; + +typedef struct { + AEIO_FileType type; + AEIO_Creator creator; +} PFILE_FileKind; + + +typedef union { + PFILE_FileKind mac; + AEIO_FileExt ext; + A_long scrap; +} AEIO_FileKind; + + +typedef struct { + A_char name[AEIO_MAX_SEQ_NAME_LEN+1]; // usually the filename + A_char type[AEIO_MAX_SEQ_NAME_LEN+1]; // e.g. "PICT Sequence" "QT Movie" + A_char sub_type[AEIO_MAX_MESSAGE_LEN+1]; +} AEIO_Verbiage; + + +#ifdef __cplusplus + } +#endif + + +///////////////////////////////////////////////////////// +////////////////// redefined in PRIVATE ///////////////// +//////////////////////////////////////////////////////// + +#ifdef A_INTERNAL + #include +#else + #ifdef __cplusplus + extern "C" { + #endif + + typedef struct AEIO_SeqSpec **AEIO_InSpecH; + typedef struct AEIO_OutSpec **AEIO_OutSpecH; + + typedef A_long AEIO_ModuleSignature; // please register your module signature with adobe + // mailto:bbb@adobe.com?subject=AEIO_Signature + + typedef struct { + A_Ratio x; + A_Ratio y; + } AEIO_RationalScale; + + + #define AEIO_AlphaLabel_VERSION 0x0101 + + enum { + AEIO_AlphaPremul = 0x1, // otherwise straight + AEIO_AlphaInverted = 0x2 // 255 = transparent + }; + + typedef A_u_long AEIO_AlphaFlags; + + enum { + AEIO_Alpha_STRAIGHT, + AEIO_Alpha_PREMUL, + AEIO_Alpha_IGNORE, + AEIO_Alpha_NONE + }; + + typedef A_u_char AEIO_AlphaType; + + + #pragma pack( push, CoSAalign, 2 ) + + typedef struct { + A_short version; + AEIO_AlphaFlags flags; + A_u_char red; // color that was matted (if premul) + A_u_char green; + A_u_char blue; + AEIO_AlphaType alpha; + } AEIO_AlphaLabel; +#if defined(A_INTERNAL) && defined(__cplusplus) + AE_STRUCT_SIZE_ASSERT(AEIO_AlphaLabel, 10); +#endif + + #pragma pack( pop, CoSAalign) + + + typedef A_Err (*AEIO_AbortProc)(void *refcon); + typedef A_Err (*AEIO_ProgressProc)(void *refcon, A_long count, A_long total); + + + typedef struct { + void *refcon; + AEIO_AbortProc abort0; + AEIO_ProgressProc progress0; + } AEIO_InterruptFuncs; + + + // All coordinates are in the scaled coordinate system. + typedef struct { + AEIO_Quality qual; + AEIO_AlphaLabel alpha_label; + AEIO_Field field_request; + AEIO_RationalScale rs; + A_Time tr; + A_Time duration; + AEIO_FrameBlend time_filter; + // CW adds 1 pad byte here + A_LRect required_region0; // empty rect means entire + // CW adds 2 pad bytes here + AEIO_InterruptFuncs inter; + } AEIO_DrawFramePB; + + enum { + AEIO_RenderMarkerFlag_NONE = 0x00000000, + AEIO_RenderMarkerFlag_COMP = 0x00000001 // if 1 means comp marker; 0 means Layer marker + }; + typedef A_long AEIO_RenderMarkerFlag; + + #ifdef __cplusplus + } + #endif +#endif // A_INTERNAL + +#ifdef __cplusplus + extern "C" { +#endif + + +#define AEIO_FileType_DIR -2L +#define AEIO_FileType_NONE -1L +#define AEIO_FileType_ANY 0L +#define AEIO_FileType_GENERIC 1L + + +//////////////////////////////////////////////////////////////////// +///////////////////////// PUBLIC /////////////////////////////////// +//////////////////////////////////////////////////////////////////// + + +enum { + AEIO_MFlag_NONE = 0, + AEIO_MFlag_INPUT = (1L<<0), // input module + AEIO_MFlag_OUTPUT = (1L<<1), // output module (can be both) + AEIO_MFlag_FILE = (1L<<2), // direct correspondence to file in file system + AEIO_MFlag_STILL = (1L<<3), // still image support (not VIDEO) + AEIO_MFlag_VIDEO = (1L<<4), // multiple image support (not STILL) + AEIO_MFlag_AUDIO = (1L<<5), // audio support + AEIO_MFlag_NO_TIME = (1L<<6), // time-independent frame-store? always true if STILL; PICS example of non-STILL one + AEIO_MFlag_INTERACTIVE_GET = (1L<<7), // user interaction for new seq, required if !FILE & INPUT + AEIO_MFlag_INTERACTIVE_PUT = (1L<<8), // user interaction for new out, required if !FILE & OUTPUT + AEIO_MFlag_CANT_CLIP = (1L<<9), // DrawFrame can't accept worlds smaller than requested dimensions + AEIO_MFlag_MUST_INTERACT_PUT = (1L<<10), // dialog box can't be avoided, even if optionsH available + AEIO_MFlag_CANT_SOUND_INTERLEAVE = (1L<<11), // all frames must be added, then sound + AEIO_MFlag_CAN_ADD_FRAMES_NON_LINEAR= (1L<<12), // AddFrame can handle non-sequential times + AEIO_MFlag_HOST_DEPTH_DIALOG = (1L<<13), // expects host to bring up a dialog with depth + AEIO_MFlag_HOST_FRAME_START_DIALOG = (1L<<14), // expects host to bring up dialog with starting frame # + AEIO_MFlag_RESERVED1 = (1L<<15), + AEIO_MFlag_NO_OPTIONS = (1L<<16), // set this bit if the module does not accept output options + AEIO_MFlag_RESERVED2 = (1L<<17), + + AEIO_MFlag_RESERVED3 = (1L<<18), + AEIO_MFlag_NO_PIXELS = (1L<<19), // this file format doesn't store real pixels, only geometry (or whatever) + AEIO_MFlag_SEQUENCE_OPTIONS_OK = (1L<<20), // this module should take the options of its parent sequence when a folder is selected + AEIO_MFlag_INPUT_OPTIONS = (1L<<21), // this module has user options associated with an input sequence. NOTE: options must be flat. + AEIO_MFlag_HSF_AWARE = (1L<<22), // this module set the hsf for incoming sequences -> don't guess what it is! + AEIO_MFlag_HAS_LAYERS = (1L<<23), // this module supports multiple layers in a single document + AEIO_MFlag_SCRAP = (1L<<24), // module has a memory parsing (clipboard) component + AEIO_MFlag_NO_UI = (1L<<25), // don't show any UI for this module + AEIO_MFlag_SEQ_OPTIONS_DLG = (1L<<26), // module has sequence options + AEIO_MFlag_HAS_AUX_DATA = (1L<<27), // has depth, or normals, or anything that is on a per pixel basis besides color + AEIO_MFlag_HAS_META_DATA = (1L<<28), // supports user definable metadata + AEIO_MFlag_CAN_DO_MARKERS = (1L<<29), // supports markers (e.g. URL flips, chapters) + AEIO_MFlag_CAN_DRAW_DEEP = (1L<<30), // module can draw into 64 bpp BM_Worlds + AEIO_MFlag_RESERVED4 = (1L<<31) +}; +typedef A_u_long AEIO_ModuleFlags; + +enum { + AEIO_MFlag2_NONE = 0, + AEIO_MFlag2_AUDIO_OPTIONS = (1L<<0), // has audio options + AEIO_MFlag2_RESERVED1 = (1L<<1), + AEIO_MFlag2_SEND_ADDMARKER_BEFORE_ADDFRAME = (1L<<2), // otherwise it is sent just after; use with AEIO_MFlag_CAN_DO_MARKERS + AEIO_MFlag2_CAN_DO_MARKERS_2 = (1L<<3), // supports combined markers (e.g. URL flips, chapters, comments) + AEIO_MFlag2_CAN_DRAW_FLOAT = (1L<<4), + AEIO_MFlag2_RESERVED2 = (1L<<5), + AEIO_MFlag2_CAN_DO_AUDIO_32 = (1L<<6), // supports 32 bit audio output. + AEIO_MFlag2_RESERVED3 = (1L<<7), + AEIO_MFlag2_SUPPORTS_ICC_PROFILES = (1L<<8), + AEIO_MFlag2_CAN_DO_MARKERS_3 = (1L<<9), // supports cue points + AEIO_MFlag2_SEND_ADDMARKER_BEFORE_STARTADDING = (1L<<10), + AEIO_MFlag2_RESERVED4 = (1L<<11), + AEIO_MFlag2_USES_QUICKTIME = (1L<<12), // Module uses quicktime for decompression or compression + AEIO_MFlag2_RESERVED5 = (1L<<13), + AEIO_MFlag2_RESERVED6 = (1L<<14), + AEIO_MFlag2_RESERVED7 = (1L<<15), + AEIO_MFlag2_RESERVED8 = (1L<<16), + AEIO_MFlag2_RESERVED9 = (1L<<17), + AEIO_MFlag2_RESERVED10 = (1L<<18) +}; +typedef A_u_long AEIO_ModuleFlags2; + +typedef struct { + A_char extension[4]; // includes '.' + A_long type; // mac type + A_long creator; // mac creator +} AEIO_AuxExt; + +typedef struct { + AEIO_ModuleSignature sig; // please register number this with adobe + A_char name[AEIO_MAX_MODULE_NAME_LEN+1]; + AEIO_ModuleFlags flags; + AEIO_ModuleFlags2 flags2; + A_long max_width; + A_long max_height; + A_short num_filetypes; // # of filetype/creator pairs supported + A_short num_extensions; // # of .XXX extensions supported + A_short num_clips; // # of clipboard types supported + A_short pad; + PFILE_FileKind create_kind; // type/creator for newly created files + AEIO_FileExt create_ext; // extension for new created DOS files + AEIO_FileKind read_kinds[AEIO_MAX_TYPES]; // mac types first, then DOS, then clipboard + A_short num_aux_extensionsS; + // CW adds 2 pad bytes here + AEIO_AuxExt aux_ext[AEIO_MAX_AUX_EXT]; +} AEIO_ModuleInfo; + +typedef struct AEIO_OptionsCBInfo { + AEIO_SupportedDepthFlags o_flags; + AEIO_OutSpecH out_specH; +} AEIO_OptionsCBInfo; + +typedef struct { + AEIO_Quality qual; + // CW adds 2 pad bytes here + AEIO_RationalScale rs; + A_Time tr; + A_Time duration; + A_LRect required_region; // empty rect means entire + AEIO_InterruptFuncs inter; +} AEIO_DrawSparseFramePB; + + +/*********************** plugin entry points ***************************** + ** the main routine of each plugin fills in these function pointers + ** AE will call them as appropriate + ****************************************************************************/ + +typedef struct _AEIO_FunctionBlock4 { // revved to 4 in AE 10. Frozen in AE10. + + A_Err (*AEIO_InitInSpecFromFile)( + AEIO_BasicData *basic_dataP, + const A_UTF16Char *file_pathZ, // Null terminated UTF16 string with platform separators + AEIO_InSpecH inH); + + A_Err (*AEIO_InitInSpecInteractive)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH); + + A_Err (*AEIO_DisposeInSpec)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH); + + A_Err (*AEIO_FlattenOptions)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + AEIO_Handle *flat_optionsPH); + + A_Err (*AEIO_InflateOptions)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + AEIO_Handle flat_optionsH); + + A_Err (*AEIO_SynchInSpec)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_Boolean *changed0); + + A_Err (*AEIO_GetActiveExtent)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, /* >> */ + const A_Time *tr, /* >> */ + A_LRect *extent); /* << */ + + A_Err (*AEIO_GetInSpecInfo)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + AEIO_Verbiage *verbiageP); + + // All coordinates are in the scaled coordinate system. + A_Err (*AEIO_DrawSparseFrame)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + const AEIO_DrawSparseFramePB *sparse_framePPB, + PF_EffectWorld *worldP, + AEIO_DrawingFlags *draw_flagsP); + + A_Err (*AEIO_GetDimensions)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + const AEIO_RationalScale *rs0, + A_long *width0, + A_long *height0); + + A_Err (*AEIO_GetDuration)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_Time *tr); + + A_Err (*AEIO_GetTime)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_Time *tr); + + A_Err (*AEIO_GetSound)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + AEIO_SndQuality quality, + const AEIO_InterruptFuncs *interrupt_funcsP0, + const A_Time *startPT, + const A_Time *durPT, + A_u_long start_sampLu, + A_u_long num_samplesLu, + void *dataPV); + + A_Err (*AEIO_InqNextFrameTime)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + const A_Time *base_time_tr, + AEIO_TimeDir time_dir, + A_Boolean *found0, + A_Time *key_time_tr0); + + A_Err (*AEIO_InitOutputSpec)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_Boolean *user_interacted); + + A_Err (*AEIO_GetFlatOutputOptions)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + AEIO_Handle *optionsH); + + A_Err (*AEIO_DisposeOutputOptions)( + AEIO_BasicData *basic_dataP, + void *optionsPV); + + A_Err (*AEIO_UserOptionsDialog)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + const PF_EffectWorld *sample0, + A_Boolean *user_interacted0); + + A_Err (*AEIO_GetOutputInfo)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + AEIO_Verbiage *verbiage); + + A_Err (*AEIO_OutputInfoChanged)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH); + + A_Err (*AEIO_SetOutputFile)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + const A_UTF16Char *file_pathZ); // Null terminated UTF16 string with platform separators + + A_Err (*AEIO_StartAdding)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_long flags); + + A_Err (*AEIO_AddFrame)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_long frame_index, + A_long frames, + const PF_EffectWorld *wP, + const A_LPoint *origin0, + A_Boolean was_compressedB, + AEIO_InterruptFuncs *inter0); + + A_Err (*AEIO_EndAdding)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_long flags); + + A_Err (*AEIO_OutputFrame)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + const PF_EffectWorld *wP); + + A_Err (*AEIO_WriteLabels)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + AEIO_LabelFlags *written); + + A_Err (*AEIO_GetSizes)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_u_longlong *free_space, + A_u_longlong *file_size); + + A_Err (*AEIO_Flush)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH); + + A_Err (*AEIO_AddSoundChunk)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + const A_Time *start, + A_u_long num_samplesLu, + const void *dataPV); + + A_Err (*AEIO_Idle)( + AEIO_BasicData *basic_dataP, + AEIO_ModuleSignature sig, + AEIO_IdleFlags *idle_flags0); /* >> */ + + A_Err (*AEIO_GetDepths)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + AEIO_SupportedDepthFlags *which); + + A_Err (*AEIO_GetOutputSuffix)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_char *suffix); + + A_Err (*AEIO_SeqOptionsDlg)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_Boolean *user_interactedPB0); + + A_Err (*AEIO_GetNumAuxChannels)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_long *num_channelsPL); + + A_Err (*AEIO_GetAuxChannelDesc)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_long chan_indexL, + PF_ChannelDesc *descP); + + A_Err (*AEIO_DrawAuxChannel)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_long chan_indexL, + const AEIO_DrawFramePB *pbP, + PF_ChannelChunk *chunkP); + + A_Err (*AEIO_FreeAuxChannel)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + PF_ChannelChunk *chunkP); + + A_Err (*AEIO_NumAuxFiles)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH seqH, + A_long *files_per_framePL0); + + A_Err (*AEIO_GetNthAuxFileSpec)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH seqH, + A_long frame_numL, + A_long n, + AEGP_MemHandle *pathPH); // << handle of A_UTF16Char (contains null terminated UTF16 string); must be disposed with AEGP_FreeMemHandle + + A_Err (*AEIO_CloseSourceFiles)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH seqH); + + A_Err (*AEIO_CountUserData)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_u_long typeLu, + A_u_long max_sizeLu, + A_u_long *num_of_typePLu); + + A_Err (*AEIO_SetUserData)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_u_long typeLu, + A_u_long indexLu, + const AEIO_Handle dataH); + + A_Err (*AEIO_GetUserData)( + AEIO_BasicData *basic_dataP, + AEIO_InSpecH inH, + A_u_long typeLu, + A_u_long indexLu, + A_u_long max_sizeLu, + AEIO_Handle *dataPH); + + A_Err (*AEIO_AddMarker)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_long frame_index, + AEIO_MarkerType marker_type, + void *marker_dataPV, + AEIO_InterruptFuncs *inter0); + + A_Err (*AEIO_VerifyFileImportable)( + AEIO_BasicData *basic_dataP, + AEIO_ModuleSignature sig, + const A_UTF16Char * file_pathZ, // Null terminated UTF16 string with platform separators + A_Boolean *importablePB); + + A_Err (*AEIO_UserAudioOptionsDialog)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_Boolean *user_interacted0); + + A_Err (*AEIO_AddMarker2)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_long frame_index, + const AEIO_Marker *markerP, + AEIO_InterruptFuncs *inter0); + + A_Err (*AEIO_AddMarker3)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_long frame_index, + AEGP_ConstMarkerValP marker_valP, + AEIO_RenderMarkerFlag marker_flag, + AEIO_InterruptFuncs *inter0); + + A_Err (*AEIO_GetMimeType)( + AEIO_BasicData *basic_dataP, + AEIO_OutSpecH outH, + A_long mime_type_sizeL, + char *mime_typeZ); + +} AEIO_FunctionBlock4; + +#ifdef __cplusplus + } +#endif + +#include + +#endif diff --git a/External/AE SDK/Headers/AE_IO_FileExt.h b/External/AE SDK/Headers/AE_IO_FileExt.h new file mode 100644 index 00000000..27625bda --- /dev/null +++ b/External/AE SDK/Headers/AE_IO_FileExt.h @@ -0,0 +1,32 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef _AEIO_FileExt_Public_H +#define _AEIO_FileExt_Public_H + +#include + +typedef struct { + A_char pad; // constant: always '.' + A_char extension[3]; +} AEIO_FileExt; + +#endif // _AEIO_FileExt_Public_H diff --git a/External/AE SDK/Headers/AE_Macros.h b/External/AE SDK/Headers/AE_Macros.h new file mode 100644 index 00000000..3f245cc7 --- /dev/null +++ b/External/AE SDK/Headers/AE_Macros.h @@ -0,0 +1,102 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 1999 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ +/** AE_Macros.h + + Part of the Adobe After Effects 4.0 SDK. + Copyright 1998 Adobe Systems Incorporated. + All Rights Reserved. + + REVISION HISTORY + 06/12/96 bsa Updated for After Effects 3.1 + 04/06/97 bsa Updated for After Effects 3.1 Windows version + 03/01/99 bbb Added DH. + +**/ + +#ifndef _H_AE_MACROS +#define _H_AE_MACROS + +#include "A.h" + +#ifndef ERR + #define ERR(FUNC) do { if (!err) { err = (FUNC); } } while (0) +#endif + +#ifndef ERR2 + #define ERR2(FUNC) do { if (((err2 = (FUNC)) != A_Err_NONE) && !err) err = err2; } while (0) +#endif + +#ifndef AEFX_CLR_STRUCT +#define AEFX_CLR_STRUCT(STRUCT) \ + do { \ + A_long _t = sizeof(STRUCT); \ + A_char *_p = (A_char*)&(STRUCT); \ + while (_t--) { \ + *_p++ = 0; \ + } \ + } while (0); +#endif + +#ifndef DH +#define DH(h) (*(h)) +#endif + +#define FIX2INT(X) ((A_long)(X) >> 16) +#define INT2FIX(X) ((A_long)(X) << 16) +#define FIX2INT_ROUND(X) (FIX2INT((X) + 32768)) +#define FIX_2_FLOAT(X) ((A_FpLong)(X) / 65536.0) +#define FLOAT2FIX(F) ((PF_Fixed)((F) * 65536 + (((F) < 0) ? -0.5 : 0.5))) + +// These are already defined if using Objective-C +#ifndef ABS + #define ABS(N) ((N) < 0 ? -(N) : (N)) +#endif + +#ifndef MIN + #define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif + +#ifndef MAX + #define MAX(A, B) ((A) > (B) ? (A) : (B)) +#endif + +#define A_Fixed_ONE ((A_Fixed)0x00010000L) +#define A_Fixed_HALF ((A_Fixed)0x00008000L) + +#define PF_RECT_2_FIXEDRECT(R,FR) do { \ + (FR).left = INT2FIX((R).left); \ + (FR).top = INT2FIX((R).top); \ + (FR).right = INT2FIX((R).right); \ + (FR).bottom = INT2FIX((R).bottom); \ + } while (0) + +#define PF_FIXEDRECT_2_RECT(FR,R) do { \ + (R).left = (A_short)FIX2INT_ROUND((FR).left); \ + (R).top = (A_short)FIX2INT_ROUND((FR).top); \ + (R).right = (A_short)FIX2INT_ROUND((FR).right); \ + (R).bottom = (A_short)FIX2INT_ROUND((FR).bottom); \ + } while (0) + +#define CONVERT8TO16(A) ( (((long)(A) * PF_MAX_CHAN16) + PF_HALF_CHAN8) / PF_MAX_CHAN8 ) + +#define RATIO2FLOAT(R) (A_FpLong)((A_FpLong)(R).num / ((A_FpLong)(R).den)) + +#endif // _H_AX_MACROS diff --git a/External/AE SDK/Headers/AE_PluginData.h b/External/AE SDK/Headers/AE_PluginData.h new file mode 100644 index 00000000..790843f4 --- /dev/null +++ b/External/AE SDK/Headers/AE_PluginData.h @@ -0,0 +1,84 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2017 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + +#ifndef _H_AE_PLUGIN_DATA +#define _H_AE_PLUGIN_DATA + +#ifdef A_INTERNAL + #include "PF_Private.h" +#endif + +#include "A.h" + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +typedef struct PF_PluginData * PF_PluginDataPtr; + +typedef A_Err (*PF_PluginDataCB)( + // The same plugin data pointer that was sent in the entry point + PF_PluginDataPtr inPtr, + const A_u_char* inNamePtr, + const A_u_char* inMatchNamePtr, + const A_u_char* inCategoryPtr, + const A_u_char* inEntryPointNamePtr, + // Type of plugin ( VFlt,eFKT ,8BFM) + A_long inkind, + // If the kind is eFKT, this argument must be PF_AE_PLUG_IN_VERSION + A_long inApiVersionMajor, + // If the kind is eFKT, this argument must be PF_AE_PLUG_IN_SUBVERS + A_long inApiVersionMinor, + A_long inReservedInfo + ) ; + +/* + * This is the Entry point function signature that must be implemented by the plugin + * Name of the function must be PluginDataEntryFunction +*/ +typedef A_Err (*PluginDataEntryFunctionPtr)( + // An opaque pointer, which must be sent as an argument in the callback + PF_PluginDataPtr inPtr, + // Callback function pointer + PF_PluginDataCB inPluginDataCallBackPtr, + // SPBasicSuite function pointer + struct SPBasicSuite* inSPBasicSuitePtr, + // Name of the host application which is invoking the plugin + const char* inHostName, + // Exact version of the host application e.x. 10.1.3 + const char* inHostVersion + ); + + + +#ifdef __cplusplus +} // end extern "C" +#endif + + + +#include + + +#endif /* _H_AE_PLUGIN_DATA */ diff --git a/External/AE SDK/Headers/DuckSuite.h b/External/AE SDK/Headers/DuckSuite.h new file mode 100644 index 00000000..59f9953c --- /dev/null +++ b/External/AE SDK/Headers/DuckSuite.h @@ -0,0 +1,13 @@ +#include "A.h" +#include + +#ifdef AE_OS_WIN + #include +#endif + +#define kDuckSuite1 "AEGP Duck Suite" +#define kDuckSuiteVersion1 1 + +typedef struct DuckSuite1 { + SPAPI A_Err (*Quack)(A_u_short timesSu); +} DuckSuite1; \ No newline at end of file diff --git a/External/AE SDK/Headers/FIEL_Public.h b/External/AE SDK/Headers/FIEL_Public.h new file mode 100644 index 00000000..8306b15b --- /dev/null +++ b/External/AE SDK/Headers/FIEL_Public.h @@ -0,0 +1,81 @@ +#ifndef _H_FIEL_PUBLIC +#define _H_FIEL_PUBLIC + +/* FIEL_Public.h + + (c) 1993 CoSA + + The purpose of this header is to define a standard way to communicate interlace information + within common image file formats. The FIEL_Label structure should be included as a + user data of type 'FIEL' of a QuickTime movie, and as 'FIEL' resouce 128 in an + image or animation file. + + The FIEL_Label structure may also be appended to the end of an ImageDescription if the creator + is unable to add the resource or user data. Only the first FIEL_Label in the movie may be + honored, however. If a sequence of frames is composed of multiple files, the FIEL_Label from only + the first frame may be honored. In a QuickTime movie, the first user data item (index 1) will be honored. + + If the version is increased, to preserve backward compatibility we will only add types + to the existing fields or add to the end of the FIEL_Label structure. + + *** Please note that most applications will only support interlaced full-height frames. The other + *** formats are included so the spec is as general as possible. If you choose to store field-rendered + *** video in one of the other formats it may not be de-interlaced properly by most applications. + + CoSA After Effects 1.0/1.1 outputs FIEL_Label version 0, with the obsolete tag 'Fiel' (not 'FIEL'). + The struct has a short version (set to 0) followed by a std::int32_t type that is 0 if field rendered, 1 + if upper field is first, and 2 if lower field is first. All field rendered frames output from + AE 1.0/1.1 are interlaced. + + Future versions of CoSA After Effects will label all output with a version 1 or higher FIEL_Label. + +*/ + +#include + +#define FIEL_Label_VERSION 1 + +#define FIEL_Tag 'FIEL' // use as udata and resource type +#define FIEL_ResID 128 + + +enum { + FIEL_Type_FRAME_RENDERED = 0, // FIEL_Order is irrelevant + FIEL_Type_INTERLACED = 1, + FIEL_Type_HALF_HEIGHT = 2, + FIEL_Type_FIELD_DOUBLED = 3, // 60 full size field-doubled frames/sec + FIEL_Type_UNSPECIFIED = 4 // do not use! +}; +typedef uint32_t FIEL_Type; + + +/* + If the frames are interlaced, the following structure tells which of the interlaced fields is + temporally first. If the frames are not interlaced but the animation was field rendered + (i.e. half height or field doubled), the structure tells which field the first sample (if the + label is attached to a multi-sample file like a QT movie) or the current sample (if the label is + attached to a single sample like a PICT file) contains. +*/ + +enum { + FIEL_Order_UPPER_FIRST = 0, + FIEL_Order_LOWER_FIRST = 1 +}; +typedef uint32_t FIEL_Order; + +#pragma pack(push, CoSAalign, 2) + typedef struct { + uint32_t signature; // always FIEL_Tag + int16_t version; + FIEL_Type type; + FIEL_Order order; + uint32_t reserved; + } FIEL_Label; + #if defined(A_INTERNAL) && defined(__cplusplus) + #include "AE_StructSizeAssert.h" + AE_STRUCT_SIZE_ASSERT(FIEL_Label, 18); + #endif + +#pragma pack(pop, CoSAalign) + +#endif diff --git a/External/AE SDK/Headers/Mach-O_prefix.h b/External/AE SDK/Headers/Mach-O_prefix.h new file mode 100644 index 00000000..e5da3715 --- /dev/null +++ b/External/AE SDK/Headers/Mach-O_prefix.h @@ -0,0 +1 @@ +#define __MACH__ 1 \ No newline at end of file diff --git a/External/AE SDK/Headers/MissingSuiteError.cpp b/External/AE SDK/Headers/MissingSuiteError.cpp new file mode 100644 index 00000000..5be71f4f --- /dev/null +++ b/External/AE SDK/Headers/MissingSuiteError.cpp @@ -0,0 +1,43 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#include "AEGP_SuiteHandler.h" + +void AEGP_SuiteHandler::MissingSuiteError() const +{ + // Yes, we've read Scott Meyers, and know throwing + // a stack-based object can cause problems. Since + // the err is just a long, and since we aren't de- + // referencing it in any way, risk is mimimal. + + // As always, we expect those of you who use + // exception-based code to do a little less rudi- + // mentary job of it than we are here. + + // Also, excuse the Madagascar-inspired monkey + // joke; couldn't resist. + // -bbb 10/10/05 + + PF_Err poop = PF_Err_BAD_CALLBACK_PARAM; + + throw poop; +} + diff --git a/External/AE SDK/Headers/PF_Masks.h b/External/AE SDK/Headers/PF_Masks.h new file mode 100644 index 00000000..88870b82 --- /dev/null +++ b/External/AE SDK/Headers/PF_Masks.h @@ -0,0 +1,49 @@ +/* PF_Masks.h */ + + +#ifndef H_PF_MASKS +#define H_PF_MASKS + +#include +#include +#include +#include + + +#pragma pack( push, 2 ) + +#define PF_MASKS_MAJOR_VERSION 1 +#define PF_MASKS_MINOR_VERSION 0 + +#ifdef __cplusplus + extern "C" { +#endif + + +#define kPF_MaskSuite "AEGP Mask Suite" +#define kPF_MaskSuiteVersion1 1 + +typedef struct PF_MaskSuite1 { + + SPAPI A_Err (*PF_MaskWorldWithPath)( + PF_ProgPtr effect_ref, + PF_PathOutlinePtr *mask, /* >> */ + PF_FpLong feather_x, /* >> */ + PF_FpLong feather_y, /* >> */ + PF_Boolean invert, /* >> */ + PF_FpLong opacity, /* >> 0...1 */ + PF_Quality quality, /* >> */ + PF_EffectWorld *worldP, /* <> */ + PF_Rect *bboxPR0); /* >> */ + +} PF_MaskSuite1; + +#ifdef __cplusplus +} // end extern "C" +#endif + + +#pragma pack( pop ) + + +#endif /* H_PH_MASKS */ \ No newline at end of file diff --git a/External/AE SDK/Headers/PR_Public.h b/External/AE SDK/Headers/PR_Public.h new file mode 100644 index 00000000..b851a530 --- /dev/null +++ b/External/AE SDK/Headers/PR_Public.h @@ -0,0 +1,424 @@ +#ifndef _PR_Public_H +#define _PR_Public_H + +/** PR_Public.h + ** (C)2005 by Adobe Systems Inc. + ** Public header that defines the API for plug-in renderers + ** + ** Plugin renderers are known as artisans. They are AEGP modules which register + ** themselves with the plug-in render manager when they are loaded at + ** program startup. + ** Very little is passed to these functions, just an opaque context + ** and a handle to previously allocated data. The artisan must query + ** for other rendering parameters via AEGP suites. The appropriate + ** suites will take one of the opaque rendering contexts as one of their + ** parameters. + ** + ** The entry points are : + ** PR_GlobalSetupFunc + ** Called at artisan load. If necessary allocate global data that will be shared + ** among all instances of this type of artisan. + ** + ** PR_GlobalSetdownFunc + ** Called at program termination. Delete the global data if any allocated. + ** + ** PR_GlobalDoAboutFunc + ** Display an about box with revelant information about the artisan + ** + ** + ** PR_InstanceSetupFunc + ** An instance of the artisan is associated with each comp. Each instance has its + ** own data. It should be allocated within this function. + ** + ** PR_InstanceSetdownFunc + ** Delete allocated data if needed. + ** + ** PR_FlattenInstanceFunc + ** Return a flattened platform independent version of the instance data. + ** This is called when the artisan is being written to disk or a copy of the + ** artisan is being made. Do not disturb the src instance handle. + ** + ** PR_DoInstanceDialogFunc + ** Some artisans may have parameters. They may be set here. + ** + ** PR_FrameSetupFunc + ** Called just berfore render. Allocate the render handle, if needed. + ** + ** PR_RenderFunc + ** This is the main rendering function. + ** + ** PR_FrameSetdownFunc + ** Called just after render. Deallocate the render handle if needed. + ** + ** PR_Query + ** This can be called at any time after Instance Setup. It is used by AE + ** to inquire about geomertic transforms used by the artisan. AE uses this information + ** to draw layer handles, and manipulate the layers with a mouse better. + ** + **/ + + +#include +#include +#include + +#pragma pack( push, 4 ) + + + + +#ifdef __cplusplus + extern "C" { +#endif + + + + +#define PR_FileType_ARTISAN 'ARt' +#define PR_ARTISAN_EXTENSION ".aex" + +#define PR_ARTISAN_API_VERSION_MAJOR 1 +#define PR_ARTISAN_API_VERSION_MINOR 0 + + +#define PR_PUBLIC_MATCH_NAME_LEN 31 +#define PR_PUBLIC_ARTISAN_NAME_LEN 31 + + +/** $$$ move to aegp.h ***/ +typedef struct _Up_OpaqueMem **PR_Handle; +typedef PR_Handle PR_FlatHandle; + +typedef PR_Handle PR_GlobalDataH; // holds data private to the plug-in +typedef PR_Handle PR_InstanceDataH; +typedef PR_Handle PR_RenderDataH; + +typedef struct PR_GlobalContext **PR_GlobalContextH; // opaque until PR.h +typedef struct PR_InstanceContext **PR_InstanceContextH; // opaque until PR.h +typedef struct PR_RenderContext **PR_RenderContextH; // opaque until PR.h +typedef struct PR_QueryContext **PR_QueryContextH; // opaque until PR.h + +typedef struct PF_LayerDef *PF_EffectWorldPtr; +/** + ** in data is passed to every pr entry function + **/ +typedef void (*PR_MessageFunc) (A_Err err_number, const A_char *msgA); + + +typedef struct PR_InData { + PR_MessageFunc msg_func; + const struct SPBasicSuite *pica_basicP; + A_long aegp_plug_id; + void *aegp_refconPV; +} PR_InData; + + + + + +/** + ** response from dialog box function + **/ +enum { + PR_DialogResult_NO_CHANGE, + PR_DialogResult_CHANGE_MADE +}; +typedef A_long PR_DialogResult; + + + +/** + ** The types of queries that will be made. + ** + **/ +enum { + PR_QueryType_NONE = 0, + PR_QueryType_TRANSFORM, + PR_QueryType_INTERACTIVE_WINDOW_DISPOSE, + PR_QueryType_INTERACTIVE_WINDOW_CLEAR, + PR_QueryType_INTERACTIVE_WINDOW_FROZEN_PROXY, + PR_QueryType_INTERACTIVE_SWAP_BUFFER, + PR_QueryType_INTERACTIVE_DRAW_PROCS, + PR_QueryType_PREPARE_FOR_LINE_DRAWING, + PR_QueryType_UNPREPARE_FOR_LINE_DRAWING, + PR_QueryType_GET_CURRENT_CONTEXT_SAFE_FOR_LINE_DRAWING, + PR_QueryType_GET_ARTISAN_QUALITY, +}; + +typedef A_u_long PR_QueryType; + + +// If this sounds interesting, talk to us +enum { + PR_ArtisanFeature_NONE = 0 +}; +typedef A_long PR_ArtisanFeature_Flags; + + +/** + ** PR_InstanceSetupFunc flags + **/ +enum { + PR_InstanceFlags_NONE = 0x0, + PR_InstanceFlags_DUPLICATE +}; + +typedef A_u_long PR_InstanceFlags; + + +/*********************** plugin entry points ***************************** + ** the main routine of each plugin fills in these function pointers + ** AE will call them as appropriate + ****************************************************************************/ + + + +/** + ** called after main. This happens just once, after the plugin is loaded. + ** The global data is common across all instances of the plugin + **/ +typedef A_Err (*PR_GlobalSetupFunc)( const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_GlobalDataH *global_dataPH); /* << */ + +/** + ** dispose of the global data + **/ +typedef A_Err (*PR_GlobalSetdownFunc)( const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_GlobalDataH global_dataH); /* <> */ // must be disposed by plugin + + +/** + ** display an about box + **/ +typedef A_Err (*PR_GlobalDoAboutFunc)( const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_GlobalDataH global_dataH); /* <> */ + + + +/** + ** Analogous to an Effect's Sequence setup call. This sets up the renderer's + ** instance data. + **/ +typedef A_Err (*PR_InstanceSetupFunc)( + const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_InstanceContextH instance_contextH, /* >> */ + PR_GlobalDataH global_dataH, /* >> */ + PR_InstanceFlags flags, + PR_FlatHandle flat_dataH0, /* >> */ + PR_InstanceDataH *instance_dataPH); /* << */ + + +/** + ** dispose of the instance data + **/ +typedef A_Err (*PR_InstanceSetdownFunc)( + const PR_InData *in_dataP, /* >> */ + const PR_GlobalContextH global_contextH, /* >> */ + const PR_InstanceContextH instance_contextH, /* >> */ + PR_GlobalDataH global_dataH, /* >> */ + PR_InstanceDataH instance_dataH); /* >> */ // must be disposed by plugin + + + +/** + ** flatten your data in preparation to being written to disk. + ** Make sure its OS independent + **/ +typedef A_Err (*PR_FlattenInstanceFunc)( + const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_InstanceContextH instance_contextH, /* >> */ + PR_GlobalDataH global_dataH, /* <> */ + PR_InstanceDataH instance_dataH, /* <> */ + PR_FlatHandle *flatH); /* << */ + + + + + +/** + ** if the renderer has parameters, this is where they get set or changed. + **/ + + +typedef A_Err (*PR_DoInstanceDialogFunc)( const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_InstanceContextH instance_contextH, /* >> */ + PR_GlobalDataH global_dataH, /* <> */ + PR_InstanceDataH instance_dataH, /* <> */ + PR_DialogResult *resultP); /* << */ + + + +/** + ** allocate render data if needed + **/ +typedef A_Err (*PR_FrameSetupFunc)( + const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_InstanceContextH instance_contextH, /* >> */ + PR_RenderContextH render_contextH, /* >> */ + PR_GlobalDataH global_dataH, /* <> */ + PR_InstanceDataH instance_dataH, /* <> */ + PR_RenderDataH *render_dataPH); /* << */ + + +/** + ** deallocate render data + **/ +typedef A_Err (*PR_FrameSetdownFunc)( + const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_InstanceContextH instance_contextH, /* >> */ + PR_RenderContextH render_contextH, /* >> */ + PR_GlobalDataH global_dataH, /* <> */ + PR_InstanceDataH instance_dataH, /* <> */ + PR_RenderDataH render_dataH); + + +/** + ** the main drawing routine + **/ +typedef A_Err (*PR_RenderFunc)( + const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_InstanceContextH instance_contextH, /* >> */ + PR_RenderContextH render_contextH, /* >> */ + PR_GlobalDataH global_dataH, /* <> */ + PR_InstanceDataH instance_dataH, /* <> */ + PR_RenderDataH render_dataH); + + + + +/** + ** AE will need to have the artisan process data on its behalf such as + ** projecting points to the screen, transforming axis, etc. This routine will handle + ** it all + **/ +typedef A_Err (*PR_QueryFunc)( const PR_InData *in_dataP, /* >> */ + PR_GlobalContextH global_contextH, /* >> */ + PR_InstanceContextH instance_contextH, /* >> */ + PR_QueryContextH query_contextH, /* <> */ + PR_QueryType query_type, /* >> */ + PR_GlobalDataH global_data, /* >> */ + PR_InstanceDataH instance_dataH); /* >> */ + + + + +/** + ** main fills this in, just once at plugin load time + ** These are the entry points that AE calls to use an artisan. + **/ + +typedef struct { + + PR_GlobalSetupFunc global_setup_func0; + PR_GlobalSetdownFunc global_setdown_func0; + PR_GlobalDoAboutFunc global_do_about_func0; + + PR_InstanceSetupFunc setup_instance_func0; + PR_InstanceSetdownFunc setdown_instance_func0; + PR_FlattenInstanceFunc flatten_instance_func0; + PR_DoInstanceDialogFunc do_instance_dialog_func0; + + PR_FrameSetupFunc frame_setup_func0; + PR_RenderFunc render_func; // must have at least this one function + PR_FrameSetdownFunc frame_setdown_func0; + + PR_QueryFunc query_func0; + +} PR_ArtisanEntryPoints; + + + + +/** + ** line drawing routines for interactive artisans + **/ +typedef void (*PR_Draw_MoveToFunc)(A_FpLong x, A_FpLong y); + +typedef void (*PR_Draw_LineToFunc)(A_FpLong x, A_FpLong y); + +typedef void (*PR_Draw_LineRelFunc)(A_FpLong dx, A_FpLong dy); + +typedef void (*PR_Draw_ForeColorFunc)(const A_Color *fore_color); + +typedef void (*PR_Draw_BackColorFunc)(const A_Color *fore_color); + +typedef void (*PR_Draw_FrameRectFunc)(const A_FloatRect *rectPR ); + +typedef void (*PR_Draw_PaintRectFunc)(const A_FloatRect *rectPR ); + +typedef void (*PR_Draw_FrameOvalFunc)(const A_FloatRect *rectPR ); + +typedef void (*PR_Draw_PaintOvalFunc)(const A_FloatRect *rectPR ); + +typedef void (*PR_Draw_InvertRectFunc)(const A_FloatRect *rectPR ); + +typedef void (*PR_Draw_SetClipFunc)(const A_FloatRect *rectPR, A_Boolean invertB ); + +typedef void (*PR_Draw_PenNormal)(void); + +typedef void (*PR_Draw_PenSize)(A_FpLong widthS, A_FpLong heightS); + +typedef void (*PR_Draw_PenPat)(A_u_char pattern); + +typedef void (*PR_Draw_Invert)(A_Boolean); + +typedef void (*PR_CacheIconFunc)(PF_EffectWorldPtr iconP); + +typedef void (*PR_DrawCachedIconFunc)(A_long x, A_long y); + +typedef void (*PR_DrawStringFunc)(const A_UTF16Char *nameZ, PF_FontStyleSheet style, const A_Color *fore_colorP, const A_Color *shadow_colorP, const A_FloatPoint *originP, const A_FloatPoint *shadow_offsetP); + +typedef void (*PR_StrokePolyFunc) (A_long nptsL, A_FloatPoint *ptsA); + +typedef void (*PR_PaintPolyFunc) (A_long nptsL, A_FloatPoint *ptsA); + + + +typedef struct { + + PR_Draw_MoveToFunc move_to_func; + PR_Draw_LineToFunc line_to_func; + PR_Draw_LineRelFunc line_rel_func; + PR_Draw_ForeColorFunc fore_color_func; + PR_Draw_BackColorFunc back_color_func; + PR_Draw_FrameRectFunc frame_rect_func; + PR_Draw_PaintRectFunc paint_rect_func; + PR_Draw_FrameOvalFunc frame_oval_func; + PR_Draw_PaintOvalFunc paint_oval_func; + PR_Draw_InvertRectFunc invert_rect_func; + PR_Draw_SetClipFunc set_clip_func; + PR_Draw_PenNormal pen_normal_func; + PR_Draw_PenSize pen_size_func; + PR_Draw_PenPat pen_pat_func; + PR_Draw_Invert invert_func; + PR_CacheIconFunc cache_icon_func; + PR_DrawCachedIconFunc draw_cached_icon_func; + PR_DrawStringFunc draw_string_func; + PR_StrokePolyFunc stroke_poly_func; + PR_PaintPolyFunc paint_poly_func; + +} PR_InteractiveDrawProcs; + + + + + +#pragma pack( pop ) + + + +#ifdef __cplusplus + } +#endif + + +#endif diff --git a/External/AE SDK/Headers/PT_Public.h b/External/AE SDK/Headers/PT_Public.h new file mode 100644 index 00000000..7065b1a9 --- /dev/null +++ b/External/AE SDK/Headers/PT_Public.h @@ -0,0 +1,120 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef _H_PT_Public +#define _H_PT_Public + +/*** + + This header file defines public interface for tracker or pixel- + matching plug-ins. + + Their function is to implement a pixel matching algorithm that a + tracker in After Effects could use to track user specified features. + + Tracker in the application provides UI and sets the main parameters. + Tracker plug-ins, however, can provide a simple dialog-based UI for + parameters specific to the implemented algorithm(s). + + +***/ + +#include + +#pragma pack( push, 4 ) + +#ifdef __cplusplus + extern "C" { +#endif + +#define PT_TRACKER_API_VERSION_MAJOR 1 +#define PT_TRACKER_API_VERSION_MINOR 0 + +#define PT_TRACKER_MATCH_NAME_LEN 31 +#define PT_TRACKER_NAME_LEN 31 + +typedef A_long PT_Index; + + +typedef struct PT_Tracker *PT_TrackerPtr; +typedef struct PT_TrackerInstance *PT_TrackerInstancePtr; +typedef struct PT_TrackingContext *PT_TrackingContextPtr; + +// plug-in entry points +typedef A_Err (*PT_GlobalSetupFunc)( + const PT_TrackerPtr trackerP, + AEGP_MemHandle *global_dataPH); // << + +typedef A_Err (*PT_GlobalSetdownFunc)( + const PT_TrackerPtr trackerP); + +typedef A_Err (*PT_GlobalDoAboutFunc)( + const PT_TrackerPtr trackerP); + +typedef A_Err (*PT_InstanceSetupFunc)( + const PT_TrackerInstancePtr tracker_instanceP, + AEGP_MemHandle flat_instance_dataH0, + AEGP_MemHandle *instance_dataPH); // currently has to be flat (no handles inside a handle) + +typedef A_Err (*PT_InstanceSetdownFunc)( + const PT_TrackerInstancePtr tracker_instanceP); + +typedef A_Err (*PT_InstanceFlattenFunc)( + const PT_TrackerInstancePtr tracker_instanceP, + AEGP_MemHandle *flat_instance_dataPH); + +typedef A_Err (*PT_InstanceDoOptionsFunc)( + const PT_TrackerInstancePtr tracker_instanceP); + +typedef A_Err (*PT_PrepareTrackFunc)( + const PT_TrackingContextPtr contextP, + AEGP_MemHandle *tracker_dataPH); // << + +typedef A_Err (*PT_TrackFunc)( + const PT_TrackingContextPtr contextP); + +typedef A_Err (*PT_FinishTrackFunc)( + const PT_TrackingContextPtr contextP); + + +typedef struct { + PT_GlobalSetupFunc global_setup_func; + PT_GlobalSetdownFunc global_setdown_func; + PT_GlobalDoAboutFunc global_do_about_func; + + PT_InstanceSetupFunc instance_setup_func; + PT_InstanceSetdownFunc instance_setdown_func; + PT_InstanceFlattenFunc instance_flatten_func; + PT_InstanceDoOptionsFunc instance_do_options_func; + + PT_PrepareTrackFunc track_prepare_func; + PT_TrackFunc track_func; + PT_FinishTrackFunc track_finish_func; +} PT_TrackerEntryPoints; + + +#pragma pack( pop ) + +#ifdef __cplusplus + } +#endif + +#endif // _H_PT_Public \ No newline at end of file diff --git a/External/AE SDK/Headers/Param_Utils.h b/External/AE SDK/Headers/Param_Utils.h new file mode 100644 index 00000000..f4129069 --- /dev/null +++ b/External/AE SDK/Headers/Param_Utils.h @@ -0,0 +1,343 @@ +#ifndef H_PARAM_UTILS +#define H_PARAM_UTILS + +// do not include DVA headers here +#include +#include + +// requires the explicit use of 'def' for the struct name + +#define PF_ParamDef_IS_PUI_FLAG_SET(_defP, _puiFlag) \ + (((_defP)->ui_flags & _puiFlag) != 0) + +#define PF_ParamDef_IS_PARAM_FLAG_SET(_defP, _paramFlag) \ + (((_defP)->flags & _paramFlag) != 0) + + +#define PF_ADD_COLOR(NAME, RED, GREEN, BLUE, ID)\ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_COLOR; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.cd.value.red = (RED); \ + def.u.cd.value.green = (GREEN); \ + def.u.cd.value.blue = (BLUE); \ + def.u.cd.value.alpha = 255; \ + def.u.cd.dephault = def.u.cd.value; \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_ARBITRARY2(NAME, WIDTH, HEIGHT, PARAM_FLAGS, PUI_FLAGS, DFLT, ID, REFCON)\ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_ARBITRARY_DATA; \ + def.flags = (PARAM_FLAGS); \ + PF_STRCPY(def.name, (NAME) ); \ + def.ui_width = (WIDTH);\ + def.ui_height = (HEIGHT);\ + def.ui_flags = (PUI_FLAGS); \ + def.u.arb_d.value = NULL;\ + def.u.arb_d.pad = 0;\ + def.u.arb_d.dephault = (DFLT); \ + def.uu.id = def.u.arb_d.id = (ID); \ + def.u.arb_d.refconPV = REFCON; \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_ARBITRARY(NAME, WIDTH, HEIGHT, PUI_FLAGS, DFLT, ID, REFCON)\ + PF_ADD_ARBITRARY2(NAME, WIDTH, HEIGHT, PF_ParamFlag_NONE, PUI_FLAGS, DFLT, ID, REFCON) + +#define PF_ADD_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, DFLT, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_SLIDER; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.sd.value_str[0] = '\0'; \ + def.u.sd.value_desc[0] = '\0'; \ + def.u.sd.valid_min = (VALID_MIN); \ + def.u.sd.slider_min = (SLIDER_MIN); \ + def.u.sd.valid_max = (VALID_MAX); \ + def.u.sd.slider_max = (SLIDER_MAX); \ + def.u.sd.value = def.u.sd.dephault = (DFLT); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_FIXED(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, DFLT, PREC, DISP, FLAGS, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_FIX_SLIDER; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.fd.value_str[0] = '\0'; \ + def.u.fd.value_desc[0] = '\0'; \ + def.u.fd.valid_min = (PF_Fixed)((VALID_MIN) * 65536.0); \ + def.u.fd.slider_min = (PF_Fixed)((SLIDER_MIN) * 65536.0); \ + def.u.fd.valid_max = (PF_Fixed)((VALID_MAX) * 65536.0); \ + def.u.fd.slider_max = (PF_Fixed)((SLIDER_MAX) * 65536.0); \ + def.u.fd.value = def.u.fd.dephault = (PF_Fixed)((DFLT) * 65536.0); \ + def.u.fd.precision = (A_short)(PREC); \ + def.u.fd.display_flags |= (A_short)(DISP); \ + def.flags |= (FLAGS); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +// why does fs_flags get or-ed in? and why is CURVE_TOLERANCE param ignored? and .flags is never set. oy. +#define PF_ADD_FLOAT_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, CURVE_TOLERANCE, DFLT, PREC, DISP, WANT_PHASE, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_FLOAT_SLIDER; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.fs_d.valid_min = (VALID_MIN); \ + def.u.fs_d.slider_min = (SLIDER_MIN); \ + def.u.fs_d.valid_max = (VALID_MAX); \ + def.u.fs_d.slider_max = (SLIDER_MAX); \ + def.u.fs_d.value = (DFLT); \ + def.u.fs_d.dephault = (PF_FpShort)(def.u.fs_d.value); \ + def.u.fs_d.precision = (PREC); \ + def.u.fs_d.display_flags = (DISP); \ + def.u.fs_d.fs_flags |= (WANT_PHASE) ? PF_FSliderFlag_WANT_PHASE : 0; \ + def.u.fs_d.curve_tolerance = AEFX_AUDIO_DEFAULT_CURVE_TOLERANCE;\ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +// safer newer version +#define PF_ADD_FLOAT_SLIDERX(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, DFLT, PREC, DISP, FLAGS, ID) \ + do { \ + AEFX_CLR_STRUCT(def); \ + def.flags = (FLAGS); \ + PF_ADD_FLOAT_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, 0, DFLT, PREC, DISP, 0, ID); \ + } while (0) + +// copied from Pr version of Param_Utils.h. It is used in some of Pr versions of AE effects +#define PF_ADD_FLOAT_EXPONENTIAL_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, CURVE_TOLERANCE, DFLT, PREC, DISP, WANT_PHASE, EXPONENT, ID) \ +do {\ +PF_Err priv_err = PF_Err_NONE; \ +def.param_type = PF_Param_FLOAT_SLIDER; \ +PF_STRCPY(def.name, (NAME) ); \ +def.u.fs_d.valid_min = (VALID_MIN); \ +def.u.fs_d.slider_min = (SLIDER_MIN); \ +def.u.fs_d.valid_max = (VALID_MAX); \ +def.u.fs_d.slider_max = (SLIDER_MAX); \ +def.u.fs_d.value = (DFLT); \ +def.u.fs_d.dephault = (DFLT); \ +def.u.fs_d.precision = (PREC); \ +def.u.fs_d.display_flags = (DISP); \ +def.u.fs_d.fs_flags |= (WANT_PHASE) ? PF_FSliderFlag_WANT_PHASE : 0; \ +def.u.fs_d.curve_tolerance = AEFX_AUDIO_DEFAULT_CURVE_TOLERANCE;\ +def.u.fs_d.useExponent = true;\ +def.u.fs_d.exponent = EXPONENT;\ +def.uu.id = (ID); \ +if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ +} while (0) + +enum { PF_Precision_INTEGER, PF_Precision_TENTHS, PF_Precision_HUNDREDTHS, PF_Precision_THOUSANDTHS, PF_Precision_TEN_THOUSANDTHS }; + +#define PF_ADD_CHECKBOX(NAME_A, NAME_B, DFLT, FLAGS, ID)\ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_CHECKBOX; \ + PF_STRCPY(def.name, NAME_A); \ + def.u.bd.u.nameptr = (NAME_B); \ + def.u.bd.value = (DFLT); \ + def.u.bd.dephault = (PF_Boolean)(def.u.bd.value); \ + def.flags |= (FLAGS); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +// safer newer version +#define PF_ADD_CHECKBOXX(NAME, DFLT, FLAGS, ID)\ + do {\ + AEFX_CLR_STRUCT(def); \ + PF_ADD_CHECKBOX(NAME, "", DFLT, FLAGS, ID); \ + } while (0) + +#define PF_ADD_BUTTON(PARAM_NAME, BUTTON_NAME, PUI_FLAGS, PARAM_FLAGS, ID)\ + do {\ + AEFX_CLR_STRUCT(def); \ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_BUTTON; \ + PF_STRCPY(def.name, PARAM_NAME); \ + def.u.button_d.u.namesptr = (BUTTON_NAME); \ + def.flags = (PARAM_FLAGS); \ + def.ui_flags = (PUI_FLAGS); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_ANGLE(NAME, DFLT, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_ANGLE; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.ad.value = def.u.ad.dephault = (PF_Fixed)((DFLT) * 65536.0); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + + +#define PF_ADD_NULL(NAME, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_NO_DATA; \ + PF_STRCPY(def.name, (NAME) ); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + + +#define PF_ADD_POPUP(NAME, CHOICES, DFLT, STRING, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_POPUP; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.pd.num_choices = (CHOICES); \ + def.u.pd.dephault = (DFLT); \ + def.u.pd.value = def.u.pd.dephault; \ + def.u.pd.u.namesptr = (STRING); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_LAYER(NAME, DFLT, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_LAYER; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.ld.dephault = (DFLT); \ + def.uu.id = ID;\ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_255_SLIDER(NAME, DFLT, ID)\ + PF_ADD_SLIDER( (NAME), 0, 255, 0, 255, (DFLT), (ID)) + +#define PF_ADD_PERCENT(NAME, DFLT, ID)\ + PF_ADD_FIXED( (NAME), 0, 100, 0, 100, (DFLT), 1, 1, 0, (ID)) + +#define PF_ADD_POINT(NAME, X_DFLT, Y_DFLT, RESTRICT_BOUNDS, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_POINT; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.td.restrict_bounds = RESTRICT_BOUNDS;\ + def.u.td.x_value = def.u.td.x_dephault = (X_DFLT << 16); \ + def.u.td.y_value = def.u.td.y_dephault = (Y_DFLT << 16); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_POINT_3D(NAME, X_DFLT, Y_DFLT, Z_DFLT, ID) \ + do {\ + AEFX_CLR_STRUCT(def); \ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_POINT_3D; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.point3d_d.x_value = def.u.point3d_d.x_dephault = X_DFLT; \ + def.u.point3d_d.y_value = def.u.point3d_d.y_dephault = Y_DFLT; \ + def.u.point3d_d.z_value = def.u.point3d_d.z_dephault = Y_DFLT; \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_TOPIC(NAME, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_GROUP_START; \ + PF_STRCPY(def.name, (NAME) ); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_END_TOPIC(ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_GROUP_END; \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_VERSIONED_FLAG(NAME) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_CHECKBOX; \ + def.name[0] = 0; \ + def.u.bd.u.nameptr = (NAME); \ + def.u.bd.value = true; \ + def.u.bd.dephault = false; \ + def.flags = PF_ParamFlag_USE_VALUE_FOR_OLD_PROJECTS; \ + def.ui_flags = PF_PUI_INVISIBLE; \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +// newer safer version +#define PF_ADD_TOPICX(NAME, FLAGS, ID) \ + do {\ + AEFX_CLR_STRUCT(def); \ + def.flags = (FLAGS); \ + PF_ADD_TOPIC(NAME, ID); \ + } while (0) + +#define PF_ADD_POPUPX(NAME, NUM_CHOICES, DFLT, ITEMS_STRING, FLAGS, ID) \ + do { \ + AEFX_CLR_STRUCT(def); \ + def.flags = (FLAGS); \ + PF_ADD_POPUP(NAME, NUM_CHOICES, DFLT, ITEMS_STRING, ID); \ + } while (0) + +enum { PF_ParamFlag_NONE=0 }; // SBI:AE_Effect.h + +#define PF_ADD_FLOAT_SLIDERX_DISABLED(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, DFLT, PREC, DISP, FLAGS, ID) \ + do { \ + AEFX_CLR_STRUCT(def); \ + def.flags = (FLAGS);\ + def.ui_flags = PF_PUI_DISABLED;\ + PF_ADD_FLOAT_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, 0, DFLT, PREC, DISP, 0, ID); \ + } while (0) + +namespace fxparam_utility { + + template + inline int RoundF(T x) + { + int ret; + + if (x > 0) { + ret = (int)(x + (T)0.5); + } else { + if ((int)(x + (T)0.5) == (x + (T)0.5)) { + ret = (int)x; + } else { + ret = (int)(x - (T)0.5); + } + } + + return ret; + } +}; + +inline PF_Err PF_AddPointControl(PF_InData *in_data, + const char *nameZ, + float x_defaultF, // 0-1 + float y_defaultF, // 0-1 + bool restrict_boundsB, + PF_ParamFlags param_flags, + PF_ParamUIFlags pui_flags, + A_long param_id) +{ + PF_ParamDef def = {{0}}; + namespace du = fxparam_utility; + + def.flags = param_flags; + def.ui_flags = pui_flags; + + PF_ADD_POINT(nameZ, du::RoundF(x_defaultF*100), du::RoundF(y_defaultF*100), restrict_boundsB, param_id); // has error return in macro + + return PF_Err_NONE; +} + + +#endif // H_PARAM_UTILS diff --git a/External/AE SDK/Headers/PrSDKAESupport.h b/External/AE SDK/Headers/PrSDKAESupport.h new file mode 100644 index 00000000..7bf914f0 --- /dev/null +++ b/External/AE SDK/Headers/PrSDKAESupport.h @@ -0,0 +1,547 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2002 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef PRSDKAESUPPORT_H +#define PRSDKAESUPPORT_H + +#ifdef PREMIERE_INTERNAL + +#ifndef PRSDKTYPES_H +#include "PrSDKTypes.h" +#endif + +#ifndef PRSDKTIMESUITE_H +#include "PrSDKTimeSuite.h" +#endif + +#endif + +#ifndef PRSDKPIXELFORMAT_H +#include "PrSDKPixelFormat.h" +#endif + +#ifdef _WIN32 +// Required for AE Stuff +#ifndef MSWindows +#define MSWindows 1 +#endif +#endif + +#ifndef _H_AE_Effect +#include "AE_Effect.h" +#endif + +#ifndef _H_AE_EffectCB +#include "AE_EffectCB.h" +#endif + +#ifndef PREMIERE_INTERNAL +#ifndef csSDK_uint32 +typedef unsigned int csSDK_uint32; +typedef int csSDK_int32; + +#ifdef AE_OS_WIN +typedef signed __int64 csSDK_int64; +#elif defined AE_OS_MAC +typedef int64_t csSDK_int64; +#endif + +typedef csSDK_int64 prInt64; +typedef csSDK_int32 prFieldType; +typedef csSDK_int32 PrTimelineID; +typedef csSDK_int32 PrClipID; +typedef prInt64 PrTime; +// This is a conflicting redefinition for any host +// other than PPRO because PREMIERE_INTERNAL +// is not defined for other hosts and PrSDKTypes.h +// will be included through other headers. +// We need to fix it. We go ahead and redefine it +// only if PrSDKTypes.h has not been included. +#ifndef PRSDKTYPES_H +typedef struct +{ + csSDK_int64 opaque[2]; +} PrSDKString; +#endif // PRSDKTYPES_H +#endif + +enum { + PF_TimeDisplay_24 = 1, + PF_TimeDisplay_25, + PF_TimeDisplay_30Drop, + PF_TimeDisplay_30NonDrop, + PF_TimeDisplay_50, + PF_TimeDisplay_60Drop, + PF_TimeDisplay_60NonDrop, + PF_TimeDisplay_NonStandard, + PF_TimeDisplay_Invalid +}; +typedef csSDK_uint32 PF_TimeDisplay; +#endif + +#define kPFPixelFormatSuite "PF Pixel Format Suite" +#define kPFPixelFormatSuiteVersion1 1 +#define kPFPixelFormatSuiteVersion kPFPixelFormatSuiteVersion1 + +typedef struct PF_PixelFormatSuite +{ + SPAPI PF_Err (*AddSupportedPixelFormat)( + PF_ProgPtr effect_ref, /* reference from in_data */ + PrPixelFormat pixelFormat); /* add a supported pixel format */ + + SPAPI PF_Err (*ClearSupportedPixelFormats)( + PF_ProgPtr effect_ref); /* reference from in_data */ + + // not implemented yet + SPAPI PF_Err (*NewWorldOfPixelFormat)( + PF_ProgPtr effect_ref, /* reference from in_data */ + A_u_long width, + A_u_long height, + PF_NewWorldFlags flags, /* should be pre-cleared to zeroes */ + PrPixelFormat pixelFormat, + PF_EffectWorld *world); /* always 32 bit */ + + // not implemented yet + SPAPI PF_Err (*DisposeWorld)( /* Identical to dispose_world in PF_WorldSuite */ + PF_ProgPtr effect_ref, /* reference from in_data */ + PF_EffectWorld *world); + + SPAPI PF_Err (*GetPixelFormat)( + PF_EffectWorld *inWorld, /* the pixel buffer of interest */ + PrPixelFormat *pixelFormat); /* one of the above PF_PixelFormat types */ + + SPAPI PF_Err (*GetBlackForPixelFormat)( + PrPixelFormat pixelFormat, + void* pixelData); + + SPAPI PF_Err (*GetWhiteForPixelFormat)( + PrPixelFormat pixelFormat, + void* pixelData); + + SPAPI PF_Err (*ConvertColorToPixelFormattedData)( + PrPixelFormat pixelFormat, + float alpha, + float red, + float green, + float blue, + void* pixelData); +} PF_PixelFormatSuite; + +typedef PF_PixelFormatSuite PF_PixelFormatSuite1; + +/********** Documentation *********************************************** +AddSupportedPixelFormat() + During PF_Cmd_GLOBAL_SETUP a plug-in can add the formats it supports. By definition, + the 8-bit ARGB pixel format in use today will be the lowest priority, the default and doesn't + need to be added. The default pixel format will be used when the rendering pipeline + indicates it would be optimal and minimizes color space conversions. Within the scope of + Premiere, the effect_ref will be a reference to one of the many types of plug-ins (import, + compile, export, etc...). + +NewWorldOfPixelFormat() + Since the pixel buffers for some of the formats are very different in structure, an allocator + that understands the new formats would be a nice convenience and have some performance benefits. + For example, YCbCr(YUV) is often stored planar rather than packed. + +DisposeWorld() + This call is to balance the suite, however it's functionally equivalent to the dispose_world + in the PF_WorldSuite or the dispose_world callback in the _PF_UtilCallbacks. However, all dispose + world calls will need to be updated to understand how to dispose of planar pixels. + +GetPixelFormat() + Retrieves the pixel format label of the PF_EffectWorld of interest. + +SetPixelFormat() + Sets the pixel format label of the PF_EffectWorld of interest. It does not convert the pixels to the + format specified. Perhaps this call doesn't need to be public, as the user will be using the + ConvertToPixelFormat() call which will set the format? + +ConvertToPixelFormat() + Used to convert a PF_EffectWorld to another pixel format, such as converting ARGB to YCbCr(YUV). The + function would use built in conversion routines and would account for white and black levels while + performing appropriate clipping or scaling. +***********************************************************************/ + +#define kPFBackgroundFrameSuite "PF Background Frame Suite" +#define kPFBackgroundFrameSuiteVersion1 1 +#define kPFBackgroundFrameSuiteVersion kPFBackgroundFrameSuiteVersion1 + +typedef struct PF_BackgroundFrameSuite +{ + SPAPI PF_Err (*AddSupportedBackgroundTransferMode)( + PF_ProgPtr inEffectRef, /* reference from in_data */ + PF_TransferMode supportedTransferMode, /* transfer mode that an effect can use to composite on the background */ + PrPixelFormat supportedPixelFormat); /* pixel format that the effect can composite with */ + + SPAPI PF_Err (*GetBackgroundFrame)( + PF_ProgPtr inEffectRef, /* reference from in_data */ + PF_LayerDef** backgroundFrame, /* the background frame, if any */ + PF_TransferMode* backgroundTransferMode); /* the transfer mode to be used on the background frame */ +} PF_BackgroundFrameSuite; + +typedef PF_BackgroundFrameSuite PF_BackgroundFrameSuite1; + +/********** Documentation *********************************************** +AddSupportedBackgroundTransferMode + Called to register support for a transfer mode in a filter. + The filter must be able to do its effect and composite onto the background. + +GetBackgroundLayer() + Get the background layer and the transfer mode. + If the returned PF_LayerDef* is nil, there is no background frame. +***********************************************************************/ + +#define kPFUtilitySuite "PF Utility Suite" +#define kPFUtilitySuiteVersion2 2 +#define kPFUtilitySuiteVersion3 3 +#define kPFUtilitySuiteVersion4 4 +#define kPFUtilitySuiteVersion5 5 +#define kPFUtilitySuiteVersion6 6 +#define kPFUtilitySuiteVersion7 7 +#define kPFUtilitySuiteVersion8 8 +#define kPFUtilitySuiteVersion9 9 +#define kPFUtilitySuiteVersion kPFUtilitySuiteVersion9 + +typedef struct PF_UtilitySuite4 +{ + SPAPI PF_Err (*GetFilterInstanceID)( + PF_ProgPtr effect_ref, + A_long* outFilterInstanceID); + SPAPI PF_Err (*GetMediaTimecode)( + PF_ProgPtr effect_ref, + A_long* outCurrentFrame, + PF_TimeDisplay* outTimeDisplay); + SPAPI PF_Err (*GetClipSpeed)( + PF_ProgPtr effect_ref, + double* speed); + SPAPI PF_Err (*GetClipDuration)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetClipStart)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetUnscaledClipDuration)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetUnscaledClipStart)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetTrackItemStart)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetMediaFieldType)( + PF_ProgPtr effect_ref, + prFieldType* outFieldType); + SPAPI PF_Err (*GetMediaFrameRate)( + PF_ProgPtr effect_ref, + PrTime* outTicksPerFrame); + SPAPI PF_Err (*GetContainingTimelineID)( + PF_ProgPtr effect_ref, + PrTimelineID* outTimelineID); + SPAPI PF_Err (*GetClipName)( + PF_ProgPtr effect_ref, + PrSDKString * outSDKString); + SPAPI PF_Err (*EffectWantsCheckedOutFramesToMatchRenderPixelFormat)( + PF_ProgPtr effect_ref); +} PF_UtilitySuite4; + +typedef struct PF_UtilitySuite +{ + SPAPI PF_Err (*GetFilterInstanceID)( + PF_ProgPtr effect_ref, + A_long* outFilterInstanceID); + SPAPI PF_Err (*GetMediaTimecode)( + PF_ProgPtr effect_ref, + A_long* outCurrentFrame, + PF_TimeDisplay* outTimeDisplay); + SPAPI PF_Err (*GetClipSpeed)( + PF_ProgPtr effect_ref, + double* speed); + SPAPI PF_Err (*GetClipDuration)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetClipStart)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetUnscaledClipDuration)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetUnscaledClipStart)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetTrackItemStart)( + PF_ProgPtr effect_ref, + A_long* frameDuration); + SPAPI PF_Err (*GetMediaFieldType)( + PF_ProgPtr effect_ref, + prFieldType* outFieldType); + SPAPI PF_Err (*GetMediaFrameRate)( + PF_ProgPtr effect_ref, + PrTime* outTicksPerFrame); + SPAPI PF_Err (*GetContainingTimelineID)( + PF_ProgPtr effect_ref, + PrTimelineID* outTimelineID); + SPAPI PF_Err (*GetClipName)( + PF_ProgPtr effect_ref, + A_Boolean inGetMasterClipName, + PrSDKString * outSDKString); + SPAPI PF_Err (*EffectWantsCheckedOutFramesToMatchRenderPixelFormat)( + PF_ProgPtr effect_ref); + SPAPI PF_Err (*EffectDependsOnClipName)( + PF_ProgPtr effect_ref, + A_Boolean inDependsOnClipName); + SPAPI PF_Err (*SetEffectInstanceName)( + PF_ProgPtr effect_ref, + const PrSDKString* inSDKString); + SPAPI PF_Err (*GetFileName)( + PF_ProgPtr effect_ref, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetOriginalClipFrameRate)( + PF_ProgPtr effect_ref, + PrTime* outTicksPerFrame); + SPAPI PF_Err (*GetSourceTrackMediaTimecode)( + PF_ProgPtr effect_ref, + csSDK_uint32 inLayerParamIndex, + bool inApplyTransform, + bool inAddStartTimeOffset, + A_long* outCurrentFrame); + SPAPI PF_Err (*GetSourceTrackClipName)( + PF_ProgPtr effect_ref, + csSDK_uint32 inLayerParamIndex, + A_Boolean inGetMasterClipName, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetSourceTrackFileName)( + PF_ProgPtr effect_ref, + csSDK_uint32 inLayerParamIndex, + PrSDKString* outSDKString); + SPAPI PF_Err (*EffectDependsOnClipName2)( + PF_ProgPtr effect_ref, + A_Boolean inDependsOnClipName, + csSDK_uint32 inLayerParamIndex); + SPAPI PF_Err (*GetMediaTimecode2)( + PF_ProgPtr effect_ref, + bool inApplyTrim, + A_long* outCurrentFrame, + PF_TimeDisplay* outTimeDisplay); + SPAPI PF_Err (*GetSourceTrackMediaTimecode2)( + PF_ProgPtr effect_ref, + csSDK_uint32 inLayerParamIndex, + bool inApplyTransform, + bool inAddStartTimeOffset, + PrTime inSequenceTime, + A_long* outCurrentFrame); + SPAPI PF_Err (*GetSourceTrackClipName2)( + PF_ProgPtr effect_ref, + csSDK_uint32 inLayerParamIndex, + A_Boolean inGetMasterClipName, + PrSDKString* outSDKString, + PrTime inSequenceTime); + SPAPI PF_Err (*GetSourceTrackFileName2)( + PF_ProgPtr effect_ref, + csSDK_uint32 inLayerParamIndex, + PrSDKString* outSDKString, + PrTime inSequenceTime); + SPAPI PF_Err (*GetCommentString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetLogNoteString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetCameraRollString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetClientMetadataString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetDailyRollString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetDescriptionString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetLabRollString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetSceneString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetShotString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetTapeNameString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetVideoCodecString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetGoodMetadataString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetSoundRollString)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrSDKString* outSDKString); + SPAPI PF_Err (*GetSequenceTime)( + PF_ProgPtr inEffectRef, + PrTime* outSequenceTime); + SPAPI PF_Err (*GetSoundTimecode)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + A_long* outCurrentFrame); + SPAPI PF_Err (*GetOriginalClipFrameRateForSourceTrack)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime* outTicksPerFrame); + SPAPI PF_Err (*GetMediaFrameRateForSourceTrack)( + PF_ProgPtr inEffectRef, + int32_t inSourceTrack, + PrTime inSequenceTime, + PrTime* outTicksPerFrame); + SPAPI PF_Err (*GetSourceTrackMediaActualStartTime)( + PF_ProgPtr inEffectRef, + csSDK_uint32 inLayerParamIndex, + PrTime inSequenceTime, + PrTime* outClipActualStartTime); + SPAPI PF_Err (*IsSourceTrackMediaTrimmed)( + PF_ProgPtr inEffectRef, + csSDK_uint32 inLayerParamIndex, + PrTime inSequenceTime, + bool* outTrimApplied); + SPAPI PF_Err (*IsMediaTrimmed)( + PF_ProgPtr inEffectRef, + PrTime inSequenceTime, + bool* outTrimApplied); + SPAPI PF_Err (*IsTrackEmpty)( + PF_ProgPtr inEffectRef, + csSDK_uint32 inLayerParamIndex, + PrTime inSequenceTime, + bool* outIsTrackEmpty); + SPAPI PF_Err (*IsTrackItemEffectAppliedToSynthetic)( + PF_ProgPtr inEffectRef, + bool* outIsTrackItemEffectAppliedToSynthetic); +} PF_UtilitySuite; + +// Legacy function tables +// Please note that version 4 didn't version the GetClipName API correctly, which is why it needs a separate table. But this was fixed in later versions, and that API didn't exist in prior versions, so all of the rest can use PF_UtilitySuite. +typedef PF_UtilitySuite PF_UtilitySuiteVersion1; +typedef PF_UtilitySuite PF_UtilitySuite2; +typedef PF_UtilitySuite PF_UtilitySuite3; +typedef PF_UtilitySuite4 PF_UtilitySuite4; +typedef PF_UtilitySuite PF_UtilitySuite5; +typedef PF_UtilitySuite PF_UtilitySuite6; +typedef PF_UtilitySuite PF_UtilitySuite7; +typedef PF_UtilitySuite PF_UtilitySuite8; + +#define kPFSourceSettingsSuite "PF Source Settings Suite" +#define kPFSourceSettingsSuiteVersion 1 + +typedef struct PF_SourceSettingsSuite +{ + SPAPI PF_Err (*PerformSourceSettingsCommand)( + PF_ProgPtr effect_ref, + void * ioCommandStruct, + csSDK_uint32 inDataSize); + +} PF_SourceSettingsSuite; + +/********** Documentation *********************************************** +GetFilterInstanceID + An AE filter running in Premiere can call this method to obtain + its instance ID from the PF_InData->effect_ref. The instance ID + obtained is the same value contained in the prtFilterRec of its RT segment. +GetMediaTimecode + Returns the starting timecode of the media file. +GetClipSpeed + Returns the playback rate of the underlying clip in the timeline + (negative speed means backwards playback). +GetClipDuration + Returns the trimmed duration (in frames) of the underlying clip in + the timeline. +***********************************************************************/ + + + +#define kPFTransitionSuite "PF Transition Suite" +#define kPFTransitionSuiteVersion1 1 +#define kPFTransitionSuiteVersion2 2 // Added RegisterTransitionStartParam and RegisterTransitionEndParam +#define kPFTransitionSuiteVersion kPFTransitionSuiteVersion2 + +typedef struct PF_TransitionSuite +{ + /** + ** Register an effect as a transition using the passed in + ** input layer as the outgoing clip. When registered the effect + ** will be available to be dragged directly onto clip ends rather + ** than only applied to layers. + */ + SPAPI PF_Err (*RegisterTransitionInputParam)( + PF_ProgPtr inEffectRef, + PF_ParamIndex inIndex); + + /** + ** Register a PF_ADD_FLOAT_SLIDER parameter to receive + ** changes to the start of the transition region through the + ** PF_Cmd_USER_CHANGED_PARAM command. + */ + SPAPI PF_Err (*RegisterTransitionStartParam)( + PF_ProgPtr inEffectRef, + PF_ParamIndex inIndex); + + /** + ** Register a PF_ADD_FLOAT_SLIDER parameter to receive + ** changes to the end of the transition region through the + ** PF_Cmd_USER_CHANGED_PARAM command. + */ + SPAPI PF_Err (*RegisterTransitionEndParam)( + PF_ProgPtr inEffectRef, + PF_ParamIndex inIndex); + +} PF_TransitionSuite; + + +#endif // PRSDKAESUPPORT_H + diff --git a/External/AE SDK/Headers/PrSDKPixelFormat.h b/External/AE SDK/Headers/PrSDKPixelFormat.h new file mode 100644 index 00000000..c39889b8 --- /dev/null +++ b/External/AE SDK/Headers/PrSDKPixelFormat.h @@ -0,0 +1,160 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2002 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#ifndef PRSDKPIXELFORMAT_H +#define PRSDKPIXELFORMAT_H + +#ifdef PREMIERE_INTERNAL + +#ifndef PRSDKTYPES_H +#include "PrSDKTypes.h" +#endif + +#endif + +#ifndef MAKE_PIXEL_FORMAT_FOURCC +#define MAKE_PIXEL_FORMAT_FOURCC(ch0, ch1, ch2, ch3) \ + (static_cast(static_cast(ch0)) | \ + (static_cast(static_cast(ch1)) << 8) | \ + (static_cast(static_cast(ch2)) << 16) | \ + (static_cast(static_cast(ch3)) << 24 )) +#endif + +/** +** Premiere supported pixel formats for RenderFrame and PPixs +*/ + +enum PrPixelFormat +{ + +/** +** Currently supported types +*/ + +// Packed formats +PrPixelFormat_BGRA_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('b', 'g', 'r', 'a'), // 4 byte BGRA, standard windows 32 bit pixels (was kPixelFormat_BGRA32) +PrPixelFormat_VUYA_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('v', 'u', 'y', 'a'), // 4 byte VUYA (was kPixelFormat_VUYA32) +PrPixelFormat_VUYA_4444_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('V', 'U', 'Y', 'A'), // 4 byte VUYA (was kPixelFormat_VUYA32) +PrPixelFormat_ARGB_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('a', 'r', 'g', 'b'), // 4 byte ARGB (the format used by AE) (was kPixelFormat_ARGB32) + +PrPixelFormat_BGRX_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('b', 'g', 'r', 'x'), // 4 byte BGRX +PrPixelFormat_VUYX_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('v', 'u', 'y', 'x'), // 4 byte VUYX +PrPixelFormat_VUYX_4444_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('v', 'u', 'x', '7'), // 4 byte VUYX +PrPixelFormat_XRGB_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('x', 'r', 'g', 'b'), // 4 byte XRGB + +PrPixelFormat_BGRP_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('b', 'g', 'r', 'p'), // 4 byte BGRP +PrPixelFormat_VUYP_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('v', 'u', 'y', 'p'), // 4 byte VUYP +PrPixelFormat_VUYP_4444_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('v', 'u', 'p', '7'), // 4 byte VUYP +PrPixelFormat_PRGB_4444_8u = MAKE_PIXEL_FORMAT_FOURCC('p', 'r', 'g', 'b'), // 4 byte PRGB + +PrPixelFormat_BGRA_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('B', 'g', 'r', 'a'), // 16 bit integer per component BGRA +PrPixelFormat_VUYA_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('V', 'u', 'y', 'a'), // 16 bit integer per component VUYA +PrPixelFormat_ARGB_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('A', 'r', 'g', 'b'), // 16 bit integer per component ARGB + +PrPixelFormat_BGRX_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('B', 'g', 'r', 'x'), // 16 bit integer per component BGRX +PrPixelFormat_XRGB_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('X', 'r', 'g', 'b'), // 16 bit integer per component XRGB + +PrPixelFormat_BGRP_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('B', 'g', 'r', 'p'), // 16 bit integer per component BGRP +PrPixelFormat_PRGB_4444_16u = MAKE_PIXEL_FORMAT_FOURCC('P', 'r', 'g', 'b'), // 16 bit integer per component PRGB + +PrPixelFormat_BGRA_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('B', 'G', 'r', 'a'), // 32 bit float per component BGRA +PrPixelFormat_VUYA_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('V', 'U', 'y', 'a'), // 32 bit float per component VUYA +PrPixelFormat_VUYA_4444_32f_709 = MAKE_PIXEL_FORMAT_FOURCC('v', 'U', 'Y', 'a'), // 32 bit float per component VUYA +PrPixelFormat_ARGB_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('A', 'R', 'g', 'b'), // 32 bit float per component ARGB + +PrPixelFormat_BGRX_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('B', 'G', 'r', 'x'), // 32 bit float per component BGRX +PrPixelFormat_VUYX_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('V', 'U', 'y', 'x'), // 32 bit float per component VUYX +PrPixelFormat_VUYX_4444_32f_709 = MAKE_PIXEL_FORMAT_FOURCC('V', 'U', 'x', '7'), // 32 bit float per component VUYX +PrPixelFormat_XRGB_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('X', 'R', 'g', 'b'), // 32 bit float per component XRGB + +PrPixelFormat_BGRP_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('B', 'G', 'r', 'p'), // 32 bit float per component BGRX +PrPixelFormat_VUYP_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('V', 'U', 'y', 'p'), // 32 bit float per component VUYX +PrPixelFormat_VUYP_4444_32f_709 = MAKE_PIXEL_FORMAT_FOURCC('V', 'U', 'p', '7'), // 32 bit float per component VUYX +PrPixelFormat_PRGB_4444_32f = MAKE_PIXEL_FORMAT_FOURCC('P', 'R', 'g', 'b'), // 32 bit float per component XRGB + +PrPixelFormat_RGB_444_10u = MAKE_PIXEL_FORMAT_FOURCC('R', 'G', 'B', '1'), // Full range 10-bit 444 RGB little-endian + +PrPixelFormat_YUYV_422_8u_601 = MAKE_PIXEL_FORMAT_FOURCC('y', 'u', 'y', '2'), // 8 bit 422 YUY2 601 colorspace +PrPixelFormat_YUYV_422_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('y', 'u', 'y', '3'), // 8 bit 422 YUY2 709 colorspace + +PrPixelFormat_UYVY_422_8u_601 = MAKE_PIXEL_FORMAT_FOURCC('u', 'y', 'v', 'y'), // 8 bit 422 UYVY 601 colorspace +PrPixelFormat_UYVY_422_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('u', 'y', 'v', '7'), // 8 bit 422 UYVY 709 colorspace + +PrPixelFormat_V210_422_10u_601 = MAKE_PIXEL_FORMAT_FOURCC('v', '2', '1', '0'), // packed uncompressed 10 bit 422 YUV aka V210 601 colorspace +PrPixelFormat_V210_422_10u_709 = MAKE_PIXEL_FORMAT_FOURCC('v', '2', '1', '1'), // packed uncompressed 10 bit 422 YUV aka V210 709 colorspace + +PrPixelFormat_UYVY_422_32f_601 = MAKE_PIXEL_FORMAT_FOURCC('U', 'Y', 'v', 'y'), +PrPixelFormat_UYVY_422_32f_709 = MAKE_PIXEL_FORMAT_FOURCC('U', 'Y', 'v', '7'), + +PrPixelFormat_BGRA_4444_32f_Linear = MAKE_PIXEL_FORMAT_FOURCC('B', 'G', 'a', 'L'), // 32 bit float per component linear BGRA +PrPixelFormat_BGRP_4444_32f_Linear = MAKE_PIXEL_FORMAT_FOURCC('B', 'G', 'p', 'L'), // 32 bit float per component linear BGRP +PrPixelFormat_BGRX_4444_32f_Linear = MAKE_PIXEL_FORMAT_FOURCC('B', 'G', 'x', 'L'), // 32 bit float per component linear BGRX +PrPixelFormat_ARGB_4444_32f_Linear = MAKE_PIXEL_FORMAT_FOURCC('A', 'R', 'g', 'L'), // 32 bit float per component linear ARGB +PrPixelFormat_PRGB_4444_32f_Linear = MAKE_PIXEL_FORMAT_FOURCC('P', 'R', 'g', 'L'), // 32 bit float per component linear PRGB +PrPixelFormat_XRGB_4444_32f_Linear = MAKE_PIXEL_FORMAT_FOURCC('X', 'R', 'g', 'L'), // 32 bit float per component linear XRGB + +PrPixelFormat_RGB_444_12u_PQ_709 = MAKE_PIXEL_FORMAT_FOURCC('@', 'P', 'Q', '7'), // 12 bit integer (in 16 bit words) per component RGB with PQ curve, Rec.709 primaries +PrPixelFormat_RGB_444_12u_PQ_P3 = MAKE_PIXEL_FORMAT_FOURCC('@', 'P', 'Q', 'P'), // 12 bit integer (in 16 bit words) per component RGB with PQ curve, P3 primaries +PrPixelFormat_RGB_444_12u_PQ_2020 = MAKE_PIXEL_FORMAT_FOURCC('@', 'P', 'Q', '2'), // 12 bit integer (in 16 bit words) per component RGB with PQ curve, Rec.2020 primaries + +// Planar formats +PrPixelFormat_YUV_420_MPEG2_FRAME_PICTURE_PLANAR_8u_601 = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', '1', '2'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) +PrPixelFormat_YUV_420_MPEG2_FIELD_PICTURE_PLANAR_8u_601 = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', 'i', '2'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) +PrPixelFormat_YUV_420_MPEG2_FRAME_PICTURE_PLANAR_8u_601_FullRange = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', '1', 'f'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) +PrPixelFormat_YUV_420_MPEG2_FIELD_PICTURE_PLANAR_8u_601_FullRange = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', 'i', 'f'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) +PrPixelFormat_YUV_420_MPEG2_FRAME_PICTURE_PLANAR_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', '1', '7'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) 709 colorspace +PrPixelFormat_YUV_420_MPEG2_FIELD_PICTURE_PLANAR_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', 'i', '7'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) 709 colorspace +PrPixelFormat_YUV_420_MPEG2_FRAME_PICTURE_PLANAR_8u_709_FullRange = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', '1', 'F'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) 709 colorspace +PrPixelFormat_YUV_420_MPEG2_FIELD_PICTURE_PLANAR_8u_709_FullRange = MAKE_PIXEL_FORMAT_FOURCC('y', 'v', 'i', 'F'), // YUV with 2x2 chroma subsampling. Planar. (for MPEG-2) 709 colorspace + +PrPixelFormat_YUV_420_MPEG4_FRAME_PICTURE_PLANAR_8u_601 = MAKE_PIXEL_FORMAT_FOURCC('Y', 'v', '1', '2'), // YUV with 2x2 chroma subsampling, center chroma. Planar. +PrPixelFormat_YUV_420_MPEG4_FIELD_PICTURE_PLANAR_8u_601 = MAKE_PIXEL_FORMAT_FOURCC('Y', 'v', 'i', '2'), // YUV with 2x2 chroma subsampling, center chroma. Planar. +PrPixelFormat_YUV_420_MPEG4_FRAME_PICTURE_PLANAR_8u_601_FullRange = MAKE_PIXEL_FORMAT_FOURCC('Y', 'v', '1', 'f'), // YUV with 2x2 chroma subsampling, center chroma. Planar. +PrPixelFormat_YUV_420_MPEG4_FIELD_PICTURE_PLANAR_8u_601_FullRange = MAKE_PIXEL_FORMAT_FOURCC('Y', 'v', 'i', 'f'), // YUV with 2x2 chroma subsampling, center chroma. Planar. +PrPixelFormat_YUV_420_MPEG4_FRAME_PICTURE_PLANAR_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('Y', 'v', '1', '7'), // YUV with 2x2 chroma subsampling, center chroma. Planar. 709 colorspace +PrPixelFormat_YUV_420_MPEG4_FIELD_PICTURE_PLANAR_8u_709 = MAKE_PIXEL_FORMAT_FOURCC('Y', 'v', 'i', '7'), // YUV with 2x2 chroma subsampling, center chroma. Planar. 709 colorspace +PrPixelFormat_YUV_420_MPEG4_FRAME_PICTURE_PLANAR_8u_709_FullRange = MAKE_PIXEL_FORMAT_FOURCC('Y', 'v', '1', 'F'), // YUV with 2x2 chroma subsampling, center chroma. Planar. 709 colorspace +PrPixelFormat_YUV_420_MPEG4_FIELD_PICTURE_PLANAR_8u_709_FullRange = MAKE_PIXEL_FORMAT_FOURCC('Y', 'v', 'i', 'F'), // YUV with 2x2 chroma subsampling, center chroma. Planar. 709 colorspace + +// Compressed formats +PrPixelFormat_NTSCDV25 = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'n', '2'), // compressed DV-25 +PrPixelFormat_PALDV25 = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'p', '2'), // compressed DV-25 +PrPixelFormat_NTSCDV50 = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'n', '5'), +PrPixelFormat_PALDV50 = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'p', '5'), +PrPixelFormat_NTSCDV100_720p = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'n', '7'), // compressed DV-100 720p, 60 Hz +PrPixelFormat_PALDV100_720p = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'p', '7'), // compressed DV-100 720p, 50 Hz +PrPixelFormat_NTSCDV100_1080i = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'n', '1'), // compressed DV-100 1080i, 60 Hz +PrPixelFormat_PALDV100_1080i = MAKE_PIXEL_FORMAT_FOURCC('d', 'v', 'p', '1'), // compressed DV-100 1080i, 50 Hz + +// Raw, opaque data formats +PrPixelFormat_Raw = MAKE_PIXEL_FORMAT_FOURCC('r', 'a', 'w', 'w'), // raw, opaque data, with no row bytes or height. + +// Invalid +PrPixelFormat_Invalid = MAKE_PIXEL_FORMAT_FOURCC('b', 'a', 'd', 'f'), // invalid pixel format - this is used for intialization and erorr conditions + +PrPixelFormat_Any = 0 +}; + +#define MAKE_ADOBE_PRIVATE_PIXEL_FORMAT_FOURCC(ch1, ch2, ch3) (static_cast(MAKE_PIXEL_FORMAT_FOURCC('@', ch1, ch2, ch3))) +#define MAKE_THIRD_PARTY_CUSTOM_PIXEL_FORMAT_FOURCC(ch1, ch2, ch3) (static_cast(MAKE_PIXEL_FORMAT_FOURCC('_', ch1, ch2, ch3))) + +#endif // PRSDKPIXELFORMAT_H + diff --git a/External/AE SDK/Headers/SP/PSIntTypes.h b/External/AE SDK/Headers/SP/PSIntTypes.h new file mode 100644 index 00000000..7811e58d --- /dev/null +++ b/External/AE SDK/Headers/SP/PSIntTypes.h @@ -0,0 +1,79 @@ +// ADOBE SYSTEMS INCORPORATED +// (c) Copyright 2009 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this +// file in accordance with the terms of the Adobe license agreement +// accompanying it. If you have received this file from a source +// other than Adobe, then your use, modification, or distribution +// of it requires the prior written permission of Adobe. +//------------------------------------------------------------------- +/** +* +* \file PSIntTypes.h +* +* \brief +* Fixed sized integer types used in Photoshop +* +* Distribution: +* PUBLIC +* +*/ + +#ifndef __PSIntTypes__ +#define __PSIntTypes__ + +//------------------------------------------------------------------- + +#if defined(_MSC_VER) && defined(__cplusplus) +#include +#else +#include +#endif + +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint8_t unsigned8; +typedef uint16_t unsigned16; +typedef uint32_t unsigned32; +typedef uint64_t unsigned64; + + +//------------------------------------------------------------------- +//------------------------------------------------------------------- + +#ifndef _BOOL8 + #define _BOOL8 + typedef unsigned char Bool8; +#endif + +#ifndef _BOOL32 + #define _BOOL32 + typedef uint32 Bool32; +#endif + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//REVISIT - PSFixedTypes.h would probably be a more appropriate name for this file + +#ifndef _REAL32 + #define _REAL32 + typedef float real32; +#endif + +#ifndef _REAL64 + #define _REAL64 + typedef double real64; +#endif + +typedef double nativeFloat; + +#endif /* __PSIntTypes.h__ */ diff --git a/External/AE SDK/Headers/SP/SPAccess.h b/External/AE SDK/Headers/SP/SPAccess.h new file mode 100644 index 00000000..79240f28 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPAccess.h @@ -0,0 +1,387 @@ +/***********************************************************************/ +/* */ +/* SPAccess.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPAccess__ +#define __SPAccess__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPPlugs.h" +#include "SPMData.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ + +/* + * The name and version number of the Sweet Pea Plug-in Access suite. + */ + +#define kSPAccessSuite "SP Access Suite" +/** Plug-in Access suite name */ +#define kSPAccessSuiteVersion 3 + +/** @ingroup Callers + The \c #SPAccessSuite sends a reload message (\c #kSPAccessReloadSelector) + to a plug-in when it has just been loaded, and an unload message + (\c #kSPAccessUnloadSelector) when it is about to be unloaded. + A plug-in is automatically loaded when the application or another + plug-in calls it or acquires as suite that it exports. + A plug-in can be unloaded at any time if it is not being used. + + A plug-in that exports a suite should unload the suite's procedure pointers + when it is unloaded, and restore them when the plug-in is reloaded. + \li On unload, replace the suite's procedure pointers + with the address of the \c #SPBasicSuite::Undefined() function + (which is always available). This is a protective measure + against other plug-ins that may mistakenly use the suite after they have + released it. + \li On reload, restore the suite's procedure + pointers with the updated addresses of their functions. + + For example: + @code + SPErr UnloadSuite( MySuite *mySuite, SPAccessMessage *message ) { + mySuite->functionA = (void *) message->d.basic->Undefined; + mySuite->functionB = (void *) message->d.basic->Undefined; + } + + SPErr ReloadSuite( MySuite *mySuite, SPAccessMessage *message ) { + mySuite->functionA = functionA; + mySuite->functionB = functionB; + } + @endcode + */ +#define kSPAccessCaller "SP Access" +/** @ingroup Selectors + The first message a plug-in receives on startup (whether + loaded or reloaded). Allows you to restore saved state information, + before startup initialization. + See \c #kSPAccessCaller, \c #SPAccessSuite */ +#define kSPAccessReloadSelector "Reload" +/** @ingroup Selectors + The first message a plug-in receives before being unloaded. + Allows you to save state information + See \c #kSPAccessCaller, \c #SPAccessSuite */ +#define kSPAccessUnloadSelector "Unload" + +/** The name of the object that the \c #SPAccessSuite caches, + which can be purged when caches are flushed. During a cache flush, + if this is the type sent to the \c #SPFlushCachesProc, it can + make calls to the Access suite to collect information about + the access object before deciding to purge it or not. + + For example, this purges filter plug-ins before window plug-ins: +@code +int32 myFlushCachesProc( const char *type, void *data, SPErr *error ) { +int32 flush = TRUE; +if ( strcmp( type, kSPFlushAccessType ) == 0 ) { + SPAccessRef access = data; + SPPluginRef plugin = sAccess->GetAccessPlugin( access, error ); + fail( error ); + switch ( myPluginType( plugin ) ) { + case kMyFilterPlugin: + if ( gPurgeLevel < kFilterPurgeLevel ) + flush = FALSE; + break; + case kMyWindowPlugin: + if ( gPurgeLevel < kWindowPurgeLevel ) + flush = FALSE; + break; + } + } + return flush; +} +@endcode +*/ +#define kSPFlushAccessType "SP Flush Access" + + +/******************************************************************************* + ** + ** Types + ** + **/ + +/** Prototype for a plug-in entry point, which receives messages from + the application or other plug-ins. + @param caller The caller, which identifies what suite or subsystem + made the call. See @ref Callers. + @param selector The specific event that triggered the call. See @ref Selectors. + @param message The message data, whose type depends on the specific event. + */ +typedef SPAPI SPErr (*SPEntry)( const char *caller, const char *selector, void *message ); + + +/** A plug-in access object, used with the \c #SPAccessSuite to make calls + to a plug-in. These objects are reference counted. The count is + incremented when you acquire the object using \c #SPAccessSuite::AcquirePlugin() + and decremented when you release it with \c #SPAccessSuite::ReleasePlugin(), + so you must be careful to balance these calls. The object is automatically + created and the plug-in loaded if necessary, and the object is destroyed + and the plug-in unloaded when the reference count is 0.*/ +typedef struct SPAccess *SPAccessRef; + + + + + +/** Plug-in library handle on Windows, resource chain on Mac. \deprecated */ +typedef void *SPPlatformAccessRef; + + +/** Access information for the resource chain on Mac OS, or library information on Windows. + See \c #SPAccessSuite::GetAccessInfo(). */ +typedef struct { + /** File access for entry and resources, when resource-access has not been set. \deprecated */ + SPPlatformAccessRef defaultAccess; /* */ + /** \deprecated File access for entry and resources, when resource-access + has been set using \c #SPAccessSuite::SetPluginResourceAccess(). + Otherwise \c NULL. */ + SPPlatformAccessRef resourceAccess; + /** The time since the last access operation, in clock-ticks (1/60th second). */ + uint32 lastAccessTicks; +} SPPlatformAccessInfo; + + + +/** Sent in the \c #SPAccessMessage to identify when an access call was made. + Use to distinguish a start-up load from a run-time load or reload, + and a run-time unload from a shut-down unload. */ +typedef enum { + /** The receiving plug-in has been loaded at application startup, and not yet initialized. + Sent with the \c #kSPAccessReloadSelector.*/ + kStartup = 0, + /** The receiving plug-in has been loaded programmatically while the application + is running, and not yet initialized. <> + Sent with the \c #kSPAccessReloadSelector.*/ + kRuntime, + /** The receiving plug-in is about to be unloaded. + Sent with the \c #kSPAccessUnloadSelector. */ + kShutdown, + /** The receiving plug-in has a non-zero access count and the application is shutting down. + Sent with the \c #kSPAccessUnloadSelector. + If the plug-in has acquired itself in order to remain in memory, + it should not free any resources and not acquire others when this + call is received.*/ + kTerminal +} SPAccessPoint; + +/** Message sent with the \c #kSPAccessCaller. */ +typedef struct SPAccessMessage { + /** The message data. */ + SPMessageData d; + /** When the access occurred. */ + SPAccessPoint when; +} SPAccessMessage; + + +/******************************************************************************* + ** + ** Suite + ** + **/ + +/** @ingroup Suites + This suite is used to load and unload plug-ins. The functions allow + you to send messages directly to another plug-in. For example: +@code + SPErr SendMessage( SPPluginRef plugin, const char *caller, const char *selector, void *message, SPErr *error ) { + + SPErr result; + SPAccessRef access; + + access = sAccess->AcquirePlugin( plugin, error ); + fail( error ); + + result = sAccess->CallPlugin( access, caller, selector, message, error ); + fail( error ); + + sAccess->ReleasePlugin( access, error ); + fail( error ); + + return result; + } +@endcode + Standard PICA plug-ins rarely call one another directly. Usually program + control flows from plug-in to plug-in through higher-level suites. + Plug-in adapters, which provide protocol conversion to non-PICA plug-ins, + can add their own access suites to provide access to their foreign plug-ins. + + @see \c #SPInterfaceSuite + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPAccessSuite and \c #kSPAccessSuiteVersion. +*/ +typedef struct SPAccessSuite { + + /** Loads a plug-in if necessary, and prepares it to be called. Creates + an accessor object if necessary, or increments the reference count + of the existing accessor. Use \c #ReleasePlugin() to decrement + the count when you not longer need the accessor. + + A plug-in can acquire itself in order to remain in memory, even if + not referenced by any other plug-in. + @param plugin The plug-in object. + @param access [out] A buffer in which to return the new access object. + */ + SPAPI SPErr (*AcquirePlugin)( SPPluginRef plugin, SPAccessRef *access ); + + /** Decrements the reference count of an accessor object. + When the reference count reaches 0, frees the accessor object + and allows the associated plug-in to be unloaded. + @param access The access object. + */ + SPAPI SPErr (*ReleasePlugin)( SPAccessRef access ); + + /** Retrieves the accessor object for a plug-in. + You can use this to get the accessor for your own plug-in, in order + to access the resource chain or library information. + + Used by plug-ins that export suites to manually establish a + resource context within any of the suite procedures, so that + they can access resources. Not needed when a plug-in is called + through its entry point. \c #SPAccessSuite::CallPlugin() + sets up the resource context for you. + + @param plugin The plug-in object. + @param access [out] A buffer in which to return the access object, + or \c NULL if the plug-in is not loaded. + */ + SPAPI SPErr (*GetPluginAccess)( SPPluginRef plugin, SPAccessRef *access ); + /** Retrieves the plug-in for an accessor. + @param access The access object. + @param plugin [out] A buffer in which to return the plug-in object, + or \c NULL if the plug-in is not loaded. <> + */ + SPAPI SPErr (*GetAccessPlugin)( SPAccessRef access, SPPluginRef *plugin ); + /** Retrieves the entry point of a plug-in accessor. This is the point to + which \c #CallPlugin() jumps. Before accessing the entry point directly, + use \c #SetCurrentPlugin() to make the plug-in current. + @param access The access object. + @param entry [out] A buffer in which to return the entry point structure. + */ + SPAPI SPErr (*GetAccessEntry)( SPAccessRef access, SPEntry *entry ); + /** Retrieves the current reference count of an accessor object. + @param access The access object. + @param count [out] A buffer in which to return the count. + */ + SPAPI SPErr (*GetAccessCount)( SPAccessRef access, int32 *count ); + /** Retrieves the platform-specific resource access information of a plug-in accessor. + This is for the resource-chain in Mac OS, or the plug-in library in Windows. + @param access The access object. + @param info [out] A buffer in which to return the information structure. + */ + SPAPI SPErr (*GetAccessInfo)( SPAccessRef access, SPPlatformAccessInfo *info ); + + /** Retrieves the platform-specific resource access information of a plug-in accessor. + This is for the resource-chain in Mac OS, or the plug-in library in Windows. + <> + @param access The access object. + @param info [out] A buffer in which to return the information structure. + */ + SPAPI SPErr (*GetPluginResourceAccess)( SPPluginRef plugin, SPPlatformAccessRef *resourceAccess ); + /** <> */ + SPAPI SPErr (*SetPluginResourceAccess)( SPPluginRef plugin, SPPlatformAccessRef resourceAccess ); + + /** Sends a message to a plug-in, using an accessor object. + @param access The access object. + @param caller The caller. + @param slector The selector. + @param message The message, as required for the selector. + @param result [out] A buffer in which to return the result of the call, + returned by the called plug-in. + */ + SPAPI SPErr (*CallPlugin)( SPAccessRef access, const char *caller, const char *selector, + void *message, SPErr *result ); + + /** Retrieves the current plug-in, whose access information is the current + resource context. This is typically the last plug-in to + receive a call, but can be set by a plug-in adapter, or by + \c #SetCurrentPlugin(). + @param plugin [out] A buffer in which to return the plug-in object, + */ + SPAPI SPErr (*GetCurrentPlugin)( SPPluginRef *plugin ); + /** Makes a plug-in and its resource context current. An adapter can use + this to set the resource context before making a call to a plug-in. + Before making this call, you should save the reference for the current + plug-in, and restore it when this plug-in no longer needs to be current. + @param plugin The plug-in object, + */ + SPAPI SPErr (*SetCurrentPlugin)( SPPluginRef plugin ); + +} SPAccessSuite; + +/** Internal */ +SPAPI SPErr SPAcquirePlugin( SPPluginRef plugin, SPAccessRef *access ); +/** Internal */ +SPAPI SPErr SPReleasePlugin( SPAccessRef access ); + +/** Internal */ +SPAPI SPErr SPGetPluginAccess( SPPluginRef plugin, SPAccessRef *access ); +/** Internal */ +SPAPI SPErr SPGetAccessPlugin( SPAccessRef access, SPPluginRef *plugin ); +/** Internal */ +SPAPI SPErr SPGetAccessEntry( SPAccessRef access, SPEntry *entry ); +/** Internal */ +SPAPI SPErr SPGetAccessCount( SPAccessRef access, int32 *count ); +/** Internal */ +SPAPI SPErr SPGetAccessInfo( SPAccessRef access, SPPlatformAccessInfo *info ); + +/** Internal */ +SPAPI SPErr SPGetPluginResourceAccess( SPPluginRef plugin, SPPlatformAccessRef *resourceAccess ); +/** Internal */ +SPAPI SPErr SPSetPluginResourceAccess( SPPluginRef plugin, SPPlatformAccessRef resourceAccess ); + +/** Internal */ +SPAPI SPErr SPCallPlugin( SPAccessRef access, const char *caller, const char *selector, + void *message, SPErr *result ); + +/** Internal */ +SPAPI SPErr SPGetCurrentPlugin( SPPluginRef *plugin ); +/** Internal */ +SPAPI SPErr SPSetCurrentPlugin( SPPluginRef plugin ); + + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPAdapts.h b/External/AE SDK/Headers/SP/SPAdapts.h new file mode 100644 index 00000000..9f12d5bb --- /dev/null +++ b/External/AE SDK/Headers/SP/SPAdapts.h @@ -0,0 +1,406 @@ +/***********************************************************************/ +/* */ +/* SPAdapts.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPAdapters__ +#define __SPAdapters__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPCaches.h" +#include "SPMData.h" +#include "SPProps.h" + +#ifdef __cplusplus +extern "C" { +#endif + + + +/******************************************************************************* + ** + ** Constants + ** + **/ + +/** SPAdapters suite name */ +#define kSPAdaptersSuite "SP Adapters Suite" +/** SPAdapters suite version */ +#define kSPAdaptersSuiteVersion 3 + +/** @ingroup Callers + Caller for a plug-in adapter. Sent to plug-ins + with adapters to allow the adapter to load or unload + files of managed types, or to make translations for + compatability with legacy versions of PICA, the application, + or earlier versions of the plug-in. + See \c #SPAdaptersSuite. */ +#define kSPAdaptersCaller "SP Adapters" + +/** @ingroup Selectors + Received by a plug-in with an adapter on application startup, after + PICA completes its plug-in startup process. Use for initialization + related to the adapter. + See \c #kSPAdaptersCaller, \c #SPAdaptersMessage, \c #SPAdaptersSuite. */ +#define kSPAdaptersStartupSelector "Start up" +/** @ingroup Selectors + Received by a plug-in with an adapter on application shutdown, after + PICA completes its plug-in shutdown process. Use for termination cleanup + related to the adapter. + See \c #kSPAdaptersCaller, \c #SPAdaptersMessage, \c #SPAdaptersSuite. */ +#define kSPAdaptersShutdownSelector "Shut down" +/** @ingroup Selectors + Received by a plug-in with an adapter after a call to + \c #SPCachesSuite::SPFlushCaches(), for a final flush of + any memory used for private data, including PICA lists and + string pools. + See \c #kSPAdaptersCaller, \c #SPAdaptersMessage, \c #SPAdaptersSuite. */ +#define kSPAdaptersDisposeInfoSelector "Dispose info" +/** @ingroup Selectors + Received by a plug-in with an adapter when the application + frees memory, to allow garbage collection. + See \c #kSPAdaptersCaller, \c #SPAdaptersMessage, \c #SPAdaptersSuite. */ +#define kSPAdaptersFlushSelector "Flush" + +// Second generation adapters (has property 'adpt'/2) +//--------------------------------------------------- +/** @ingroup Selectors + Received by a plug-in after its initialization, to allow it to + register its own adapter. Get the adapter list from PICA and + use \c #SPAdaptersSuite::AddAdapter( ) to register your adapter. + For example: + @code +SPAdapterRef oldAPI; +SPAdapterListRef adapterList; +SPErr error; +error = sSPRuntime->GetRuntimeAdapterList( &adapterList); +error = sSPAdapters->AddAdapter( adapterList, message->d.self, "old API adapter", &oldAPI ); + @endcode + + See \c #kSPAdaptersCaller, \c #SPAdaptersMessage, \c #SPAdaptersSuite. */ +#define kSPAdaptersRegisterPluginsSelector "Register plugins" + +/** @ingroup Selectors + Received by a plug-in with an adapter before it is loaded, to allow the + adapter to perform needed translations before the load occurs. The + handler does not need to call the load operation. + See \c #kSPAdaptersCaller, \c #SPAdaptersMessage, \c #SPAdaptersSuite. */ +#define kSPAdaptersLoadPluginSelector "Load plugin" +/** @ingroup Selectors + Received by a plug-in with an adapter before it is unloaded, to allow the + adapter to perform needed translations before the unload occurs. The + handler does not need to call the unload operation. + See \c #kSPAdaptersCaller, \c #SPAdaptersMessage, \c #SPAdaptersSuite. */ +#define kSPAdaptersReleasePluginSelector "Release plugin" + +/** @ingroup Selectors + Received by a plug-in with an adapter when the application needs to + communicate with it. The adapter should relay the message, performing + any required translation. + See \c #kSPAdaptersCaller, \c #SPAdaptersMessage, \c #SPAdaptersSuite. */ +#define kSPAdaptersSendMessageSelector "Send message" + +// First generation adapters (no 'adpt' property, or 'adpt'/1 ) +//------------------------------------------------------------- +// These messages are only for the "SP2 Adapter" that is built into +// Sweet Pea and maybe legacy adapters (i.e., AI6Adapter for AI7). +// For newer adapters, all of these methods are now deprecated. +// New adapters should do the vast majority of their processing via +// the message kSPAdaptersSendMessageSelector. +/** @deprecated Used internally. */ +#define kSPAdaptersFindPropertySelector "Find property" +/** @deprecated Used internally. */ +#define kSPAdaptersAboutSelector "About" +/** @deprecated Used internally. */ +#define kSPAdaptersAcquireSuiteHostSelector "Acquire Suite" +/** @deprecated Used internally. */ +#define kSPAdaptersReleaseSuiteHostSelector "Release Suite" + +/** PICA global list of registered plug-in adapters. + @see \c #SPAdaptersSuite::AddAdapter(), \c #SPRuntimeSuite::GetRuntimeAdapterList(). */ +#define kSPRuntimeAdapterList ((SPAdapterListRef)NULL) + + +/******************************************************************************* + ** + ** Types + ** + **/ + +/** An opaque reference to an adapter object. Access using the \c #SPAdaptersSuite. */ +typedef struct SPAdapter *SPAdapterRef; +/** A list of adapter objects. Create with + \c #SPAdaptersSuite::AllocateAdapterList(), or use + the global list, \c #kSPRuntimeAdapterList. */ +typedef struct SPAdapterList *SPAdapterListRef; +/** An iterator object for examining an adapter list. + See \c #SPAdaptersSuite::NewAdapterListIterator(). */ +typedef struct SPAdapterListIterator *SPAdapterListIteratorRef; + +/** The message passed with all \c #kSPAdaptersCaller calls. + Fields are used by specific selectors as indicated. */ +typedef struct SPAdaptersMessage { + /** The message data. All selectors. */ + SPMessageData d; + /** The adapter object. All selectors. If you add more than + one adapter for a plug-in, use this to determine which handler to use. */ + SPAdapterRef adapter; + + /** For \c #kSPAdaptersAboutSelector, the plug-in object for which to display information. + No longer used. <> */ + struct SPPlugin *targetPlugin; + /** For \c #kSPAdaptersAboutSelector, the target result of the handler, if any. + No longer used. <> */ + SPErr targetResult; + + /** For \c #kSPAdaptersFindPropertySelector. + No longer used. */ + PIType vendorID; + /** For \c #kSPAdaptersFindPropertySelector. + No longer used. */ + PIType propertyKey; + /** For \c #kSPAdaptersFindPropertySelector. + No longer used. */ + int32 propertyID; + /** For \c #kSPAdaptersFindPropertySelector. + No longer used. */ + void *property; + + /** For \c #kSPAdaptersFlushSelector. The procedure with which to flush caches, + passed from the call to \c #SPCachesSuite::SPFlushCaches(). + The adapter should call this to determine which plug-ins are being removed from + memory, and unload them. */ + SPFlushCachesProc flushProc; + /** For \c #kSPAdaptersFlushSelector. Return the result of the flush procedure, + the number of plug-ins removed.*/ + int32 flushed; + + /** For \c #kSPAdaptersAcquireSuiteHostSelector and \c #kSPAdaptersReleaseSuiteHostSelector. + No longer used.*/ + struct SPSuiteList *suiteList; /* use these if you need name, apiVersion, internalVersion */ + /** For \c #kSPAdaptersAcquireSuiteHostSelector and \c #kSPAdaptersReleaseSuiteHostSelector. + No longer used.*/ + struct SPSuite *suite; + /** For \c #kSPAdaptersAcquireSuiteHostSelector and \c #kSPAdaptersReleaseSuiteHostSelector. + No longer used.*/ + struct SPPlugin *host; /* plug-in hosting the suite, to be aquired/released by adapter */ + /** For \c #kSPAdaptersAcquireSuiteHostSelector and \c #kSPAdaptersReleaseSuiteHostSelector. + No longer used.*/ + const void *suiteProcs; /* returned here if reallocated */ + /** For \c #kSPAdaptersAcquireSuiteHostSelector and \c #kSPAdaptersReleaseSuiteHostSelector. + No longer used.*/ + int32 acquired; /* returned here */ + + /** For \c #kSPAdaptersSendMessageSelector. + The caller to pass to the adapted plug-in. */ + const char *plugin_caller; + /** For \c #kSPAdaptersSendMessageSelector. + The selector to pass to the adapted plug-in. */ + const char *plugin_selector; + /** For \c #kSPAdaptersSendMessageSelector. + The message to pass to the adapted plug-in. */ + void *plugin_message; +} SPAdaptersMessage; + +/** A string pool structure. See \c #SPStringsSuite. */ +struct SPStringPool; + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + An adapter is an interface between the PICA plug-in manager and + an individual plug-in. PICA and application plug-ins are hosted by + internal PICA adapters. Plug-ins can add other adapters to PICA's + \e adapter \e list, allowing non-PICA plug-ins to run under the PICA API. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPAdaptersSuite and \c #kSPAdaptersSuiteVersion. + + An adapter searches the PICA \e file \e list (\c #kSPRuntimeFileList) + for plug-ins types that it supports, and adds them to the \e plug-in \e list + (\c #kSPRuntimePluginList). When notified by PICA to do so, the adapter is + responsible for loading and calling the plug-ins it adds, and must + do any conversion of messages, data structures or other API elements. + An adapter can be used to update + + There are always at least two adapters, the internal adapters for PICA + and for the application, in the global adapter list (\c #kSPRuntimeAdapterList). + The internal adapters translate any legacy function calls into those + currently supported by PICA and the application. + + You can provide an adapter for backward compatability with older + versions of your own plug-ins, or to interpret your own file types. + To make an adapter available for your plug-in, add it in response to the + \c #kSPAdaptersRegisterPluginsSelector when your plug-in is loaded. + + You can also use this suite to create and maintain your own adapter list, + in addition to the global list. + + Use the adapter to load and call the adapted plug-in. For example, to + verify that a message could be sent to a plug-in: +@code +SPErr error; +SPPluginRef pluginToCall; +SPAdapterRef pluginsAdapter; +char *adapterName; +int32 adapterVersion; + +error = sSPPlugins->GetPluginAdapter( pluginToCall, &pluginsAdapter ); +error = sSPAdapters->GetAdapterName( pluginsAdapter, &adapterName ); +if ( strcmp( adapterName, kSPSweetPea2Adapter ) == 0 ) { + // it is a PICA plug-in, call it as such with sSPInterface. + } else if ( strcmp( adapterName, "MYAPP Legacy Plug-in Adapter" ) == 0 ) { + // it is an adapted plug-in, call it with the adapter's + // interface suite + error = sSPAdapters->GetAdapterVersion( pluginsAdapter, &adapterVersion ); + if ( adapterVersion == 1 ) { + // use one hypothetical interface suite + } else if ( adapterVersion == 2) { + // use another hypothetical interface suite + } + } +@endcode +*/ +typedef struct SPAdaptersSuite { + + /** Allocates a new list of adapters. You can keep your own list, + or obtain the global list with \c #SPRuntimeSuite::GetRuntimeAdapterList(). + @param stringPool The string pool in which to keep adapter names. + @param adapterList [out] A buffer in which to return the new list object. + */ + SPAPI SPErr (*AllocateAdapterList)( struct SPStringPool *stringPool, SPAdapterListRef *adapterList ); + /** Frees a list of adapters allocated with \c #AllocateAdapterList(), and + also frees any entries in the list. Do not free the global list (\c #kSPRuntimeAdapterList). + @param adapterList The adapter list object. + */ + SPAPI SPErr (*FreeAdapterList)( SPAdapterListRef adapterList ); + /** Creates a new adapter object and adds it to an adapter list. Do this in + response to the \c #kSPAdaptersRegisterPluginsSelector message. + @param adapterList The adapter list object, or \c NULL to use the + global list. + @param host This plug-in object, for which the adapter is responsible. + @param name The unique, identifying name of the adapter. + @param version The version number of the adapter. Only the latest version + of any adapter is used to start up plug-ins. + @param adapter [out] A buffer in which to return the new adapter object, or + \c NULL if you add only one adapter. If you add more than one adapter, + compare this to \c #SPAdaptersMessage::adapter to determine which handler to use. + @see \c #AllocateAdapterList() + */ + SPAPI SPErr (*AddAdapter)( SPAdapterListRef adapterList, struct SPPlugin *host, const char *name, + int32 version, SPAdapterRef *adapter ); + + /** Retrieves an adapter by name. + @param adapterList The adapter list object, or \c NULL to use the + global list. + @param name The unique, identifying name of the adapter. + @param adapter [out] A buffer in which to return the adapter object. + */ + SPAPI SPErr (*SPFindAdapter)( SPAdapterListRef adapterList, const char *name, SPAdapterRef *adapter ); + + /** Creates an iterator object with which to traverse an adapter list. + The iterator is initially set to the first adapter in the list. + @param adapterList The adapter list object, or \c NULL to use the + global list. + @param iter [out] A buffer in which to return the new iterator object. + @see \c #NextAdapter(), \c #DeleteAdapterListIterator() + */ + SPAPI SPErr (*NewAdapterListIterator)( SPAdapterListRef adapterList, SPAdapterListIteratorRef *iter ); + /** Retrieves the current adapter and advances an adapter-list iterator to the + next adapter in the list. + @param iter The adapter-list iterator object. + @param adapter [out] A buffer in which to return the current adapter object, \c NULL + if the end of the list has been reached. + @see \c #NewAdapterListIterator(), + */ + SPAPI SPErr (*NextAdapter)( SPAdapterListIteratorRef iter, SPAdapterRef *adapter ); + /** Frees an adapter-list iterator that is no longer needed. + @param iter The adapter-list iterator object. + @see \c #NewAdapterListIterator(), + */ + SPAPI SPErr (*DeleteAdapterListIterator)( SPAdapterListIteratorRef iter ); + + /** Retrieves the plug-in that an adapter manages. + @param adapter The adapter object. + @param plug-in [out] A buffer in which to return the plug-in object. + */ + SPAPI SPErr (*GetAdapterHost)( SPAdapterRef adapter, struct SPPlugin **plugin ); + /** Retrieves the unique, identifying name of an adapter. + @param adapter The adapter object. + @param name [out] A buffer in which to return the name string. + */ + SPAPI SPErr (*GetAdapterName)( SPAdapterRef adapter, const char **name ); + /** Retrieves the version of an adapter. + @param adapter The adapter object. + @param version [out] A buffer in which to return the version number. + */ + SPAPI SPErr (*GetAdapterVersion)( SPAdapterRef adapter, int32 *version ); + +} SPAdaptersSuite; + + +/** Internal */ +SPAPI SPErr SPAllocateAdapterList( struct SPStringPool *stringPool, SPAdapterListRef *adapterList ); +/** Internal */ +SPAPI SPErr SPFreeAdapterList( SPAdapterListRef adapterList ); + +/** Internal */ +SPAPI SPErr SPAddAdapter( SPAdapterListRef adapterList, struct SPPlugin *host, const char *name, + int32 version, SPAdapterRef *adapter ); + +/** Internal */ +SPAPI SPErr SPFindAdapter( SPAdapterListRef adapterList, const char *name, SPAdapterRef *adapter ); + +/** Internal */ +SPAPI SPErr SPNewAdapterListIterator( SPAdapterListRef adapterList, SPAdapterListIteratorRef *iter ); +/** Internal */ +SPAPI SPErr SPNextAdapter( SPAdapterListIteratorRef iter, SPAdapterRef *adapter ); +/** Internal */ +SPAPI SPErr SPDeleteAdapterListIterator( SPAdapterListIteratorRef iter ); + +/** Internal */ +SPAPI SPErr SPGetAdapterHost( SPAdapterRef adapter, struct SPPlugin **plugin ); +/** Internal */ +SPAPI SPErr SPGetAdapterName( SPAdapterRef adapter, const char **name ); +/** Internal */ +SPAPI SPErr SPGetAdapterVersion( SPAdapterRef adapter, int32 *version ); + + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPBasic.h b/External/AE SDK/Headers/SP/SPBasic.h new file mode 100644 index 00000000..c0273a40 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPBasic.h @@ -0,0 +1,184 @@ +/***********************************************************************/ +/* */ +/* SPBasic.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPBasic__ +#define __SPBasic__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** PICA basic suite name */ +#define kSPBasicSuite "SP Basic Suite" +/** PICA basic suite version */ +#define kSPBasicSuiteVersion 4 + + +/******************************************************************************* + ** + ** Suite + ** + **/ + +/** @ingroup Suites + This suite provides basic memory management for PICA (the Adobe plug-in manager) + and defines the basic functions for acquiring and releasing other suites. + + A suite consists of a list of function pointers. The application, or a + plug-in that loads a suite, provides valid pointers when the suite is + acquired. When a suite is not available, the pointers are set to the + address of the \c #Undefined() function. + + Do not attempt to acquire a suite (other than the \c #SPBlocksSuite) + in response to a PICA access (\c #kSPAccessCaller) or property + (\c #kSPPropertiesCaller) message. Most suites are unavailable + during these load and unload operations. + + You can acquire all the suites you will need when your plug-in is first + loaded, as long as you release them before your plug-in is unloaded. + At shutdown, however, it is most efficient to acquire only those + suites explicitly needed to shut down; for example, to free memory + and save preferences. + + The \c SPBasicSuite itself is a part of the message data passed + to your plug-in with any call. To access it from the message data structure: + @code + SPBasicSuite sBasic = message->d.basic; + sBasic->function( ) + @endcode + */ +typedef struct SPBasicSuite { + /** Acquires a function suite. Loads the suite if necessary, + and increments its reference count. For example: + @code +SPErr error; +SPBasicSuite *sBasic = message->d.basic; +AIRandomSuite *sRandom; +sBasic->AcquireSuite( kAIRandomSuite, kAIRandomVersion, &sRandom ); + @endcode + @param name The suite name. + @param version The suite version number. + @param suite [out] A buffer in which to return the suite pointer. + @see \c #SPSuitesSuite::AcquireSuite() + */ + SPAPI SPErr (*AcquireSuite)( const char *name, int32 version, const void **suite ); + /** Decrements the reference count of a suite and unloads it when the + reference count reaches 0. + @param name The suite name. + @param version The suite version number. + */ + SPAPI SPErr (*ReleaseSuite)( const char *name, int32 version ); + /** Compares two strings for equality. + @param token1 The first null-terminated string. + @param token2 The second null-terminated string. + @return True if the strings are the same, false otherwise. + */ + SPAPI SPBoolean (*IsEqual)( const char *token1, const char *token2 ); + /** Allocates a block of memory. + @param size The number of bytes. + @param block [out] A buffer in which to return the block pointer. + @see \c #SPBlocksSuite::AllocateBlock() + */ + SPAPI SPErr (*AllocateBlock)( size_t size, void **block ); + /** Frees a block of memory allocated with \c #AllocateBlock(). + @param block The block pointer. + @see \c #SPBlocksSuite::FreeBlock() + */ + SPAPI SPErr (*FreeBlock)( void *block ); + /** Reallocates a block previously allocated with \c #AllocateBlock(). + Increases the size without changing the location, if possible. + @param block The block pointer. + @param newSize The new number of bytes. + @param newblock [out] A buffer in which to return the new block pointer. + @see \c #SPBlocksSuite::ReallocateBlock() + */ + SPAPI SPErr (*ReallocateBlock)( void *block, size_t newSize, void **newblock ); + /** A function pointer for unloaded suites. This is a protective measure + against other plug-ins that may mistakenly use the suite after they have + released it. + + A plug-in that exports a suite should unload the suite's procedure pointers + when it is unloaded, and restore them when the plug-in is reloaded. + \li On unload, replace the suite's procedure pointers + with the address of this function. + \li On reload, restore the suite's procedure + pointers with the updated addresses of their functions. + + For example: + @code + SPErr UnloadSuite( MySuite *mySuite, SPAccessMessage *message ) { + mySuite->functionA = (void *) message->d.basic->Undefined; + mySuite->functionB = (void *) message->d.basic->Undefined; + } + + SPErr ReloadSuite( MySuite *mySuite, SPAccessMessage *message ) { + mySuite->functionA = functionA; + mySuite->functionB = functionB; + } + @endcode + */ + SPAPI SPErr (*Undefined)( void ); + +} SPBasicSuite; + + +/** Internal */ +SPAPI SPErr SPBasicAcquireSuite( const char *name, int32 version, const void **suite ); +/** Internal */ +SPAPI SPErr SPBasicReleaseSuite( const char *name, int32 version ); +/** Internal */ +SPAPI SPBoolean SPBasicIsEqual( const char *token1, const char *token2 ); +/** Internal */ +SPAPI SPErr SPBasicAllocateBlock( size_t size, void **block ); +/** Internal */ +SPAPI SPErr SPBasicFreeBlock( void *block ); +/** Internal */ +SPAPI SPErr SPBasicReallocateBlock( void *block, size_t newSize, void **newblock ); +/** Internal */ +SPAPI SPErr SPBasicUndefined( void ); + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPBckDbg.h b/External/AE SDK/Headers/SP/SPBckDbg.h new file mode 100644 index 00000000..b7bfe08c --- /dev/null +++ b/External/AE SDK/Headers/SP/SPBckDbg.h @@ -0,0 +1,118 @@ +/***********************************************************************/ +/* */ +/* SPBckDbg.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPBlockDebug__ +#define __SPBlockDebug__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** SPBlockDebug suite name */ +#define kSPBlockDebugSuite "SP Block Debug Suite" +/** SPBlockDebug suite version */ +#define kSPBlockDebugSuiteVersion 2 + + +/******************************************************************************* + ** + ** Suite + ** + **/ + +/** @ingroup Suites + This suite provides basic debugging capability for blocks of memory + allocated with the \c #SPBlocksSuite. Debugging can only be enabled + in the developement environment. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPBlockDebugSuite and \c #kSPBlockDebugSuiteVersion. + */ +typedef struct SPBlockDebugSuite { + /** Reports whether block debugging is enabled. + @param enabled [out] A buffer in which to return 1 if debugging + is enabled, 0 otherwise. + */ + SPAPI SPErr (*GetBlockDebugEnabled)( int32 *enabled ); + /** Turns debugging on or off. + @param debug 1 to turn debugging on, 0 to turn it off. + */ + SPAPI SPErr (*SetBlockDebugEnabled)( int32 debug ); + /** Retrieves the first block of memory allocated. Use with \c #GetNextBlock() + to iterate through all allocated blocks. + @param block [out] A buffer in which to return the block pointer. + */ + SPAPI SPErr (*GetFirstBlock)( void **block ); + /** Retrieves the block of memory allocated immediately after a given block. + Use with \c #GetFirstBlock() to iterate through all allocated blocks. + @param block The current block pointer + @param nextblock [out] A buffer in which to return the next block pointer. + */ + SPAPI SPErr (*GetNextBlock)( void *block, void **nextblock ); + /** Retrieves the debugging tag assigned to a block of memory when it + was allocated or reallocated. + @param block The block pointer. + @param debug [out] A buffer in which to return the tag string. + @see \c #SPBlocksSuite::AllocateBlock(), \c #SPBlocksSuite::ReallocateBlock() + */ + SPAPI SPErr (*GetBlockDebug)( void *block, const char **debug ); + +} SPBlockDebugSuite; + + +/** Internal */ +SPAPI SPErr SPGetBlockDebugEnabled( int32 *enabled ); +/** Internal */ +SPAPI SPErr SPSetBlockDebugEnabled( int32 debug ); +/** Internal */ +SPAPI SPErr SPGetFirstBlock( void **block ); +/** Internal */ +SPAPI SPErr SPGetNextBlock( void *block, void **nextblock ); +/** Internal */ +SPAPI SPErr SPGetBlockDebug( void *block, const char **debug ); + + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPBlocks.h b/External/AE SDK/Headers/SP/SPBlocks.h new file mode 100644 index 00000000..cdb0effd --- /dev/null +++ b/External/AE SDK/Headers/SP/SPBlocks.h @@ -0,0 +1,118 @@ +/***********************************************************************/ +/* */ +/* SPBlocks.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPBlocks__ +#define __SPBlocks__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#ifdef SWEETPEA_STRICTER_HOST_COMPATIBILITY +#include +#endif +#include "SPTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** SPBlocks suite name */ +#define kSPBlocksSuite "SP Blocks Suite" +/** SPBlocks suite version */ +#define kSPBlocksSuiteVersion 2 + + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + This suite provides basic memory management for PICA (the Adobe plug-in manager), + with debugging capability for the development version of the application. + + Unlike other suites, this suite is available during plug-in load and unload operations. + You can acquire it in response to a PICA access (\c #kSPAccessCaller) or property + (\c #kSPPropertiesCaller) message, and use it to allocate and free memory + for the plug-in you are loading or unloading. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPBlocksSuite and \c #kSPBlocksSuiteVersion. + */ +typedef struct SPBlocksSuite { + + /** Allocates a block of memory. + @param size The number of bytes. + @param debug Optional. A tag for the block, available in the + developement version of the application. Otherwise ignored. + See \c #SPBlockDebugSuite::GetBlockDebug(). + @param block [out] A buffer in which to return the block pointer. + @see \c #SPBasicSuite::AllocateBlock() + */ + SPAPI SPErr (*AllocateBlock)( size_t size, const char *debug, void **block ); + /** Frees a block of memory allocated with \c #AllocateBlock(). + @param block The block pointer. + @see \c #SPBasicSuite::FreeBlock() + */ + SPAPI SPErr (*FreeBlock)( void *block ); + /** Reallocates a block previously allocated with \c #AllocateBlock(). + Increases the size without changing the location, if possible. + @param block The block pointer. + @param newSize The new number of bytes. + @param debug Optional. A tag for the block, available in the + developement version of the application. Otherwise ignored. + See \c #SPBlockDebugSuite::GetBlockDebug(). + @param newblock [out] A buffer in which to return the new block pointer. + @see \c #SPBasicSuite::ReallocateBlock() + */ + SPAPI SPErr (*ReallocateBlock)( void *block, size_t newSize, const char *debug, void **rblock ); + +} SPBlocksSuite; + +/** Internal */ +SPAPI SPErr SPAllocateBlock( size_t size, const char *debug, void **block ); +/** Internal */ +SPAPI SPErr SPFreeBlock( void *block ); +/** Internal */ +SPAPI SPErr SPReallocateBlock( void *block, size_t newSize, const char *debug, void **rblock ); + + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPCOM.h b/External/AE SDK/Headers/SP/SPCOM.h new file mode 100644 index 00000000..0783c1fb --- /dev/null +++ b/External/AE SDK/Headers/SP/SPCOM.h @@ -0,0 +1,9 @@ +/* (c) Copyright 2002. Adobe Systems, Incorporated. All rights reserved. */ + +#pragma once + +#ifndef __SPCOM__ +#define __SPCOM__ +/* This module is obsolete. */ +#endif // __SPCOM__ + diff --git a/External/AE SDK/Headers/SP/SPCaches.h b/External/AE SDK/Headers/SP/SPCaches.h new file mode 100644 index 00000000..c2150f6e --- /dev/null +++ b/External/AE SDK/Headers/SP/SPCaches.h @@ -0,0 +1,128 @@ +/***********************************************************************/ +/* */ +/* SPCaches.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPCaches__ +#define __SPCaches__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPMData.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** Cache suite name */ +#define kSPCachesSuite "SP Caches Suite" +/** Cache suite version */ +#define kSPCachesSuiteVersion 2 + +/* To receive these, an PIConditionalMessages property must be present + * with the PIAcceptsPurgeCachesMessage flag set. */ +/** @ingroup Callers + The cache management caller. See \c #SPCachesSuite */ +#define kSPCacheCaller "SP Cache" +/** @ingroup Selectors + Received by plug-in adapters with the \c #PIAcceptsPurgeCachesMessage flag set + in the \c #PIConditionalMessages property, when a call has + been made to \c #SPCachesSuite::SPFlushCaches(). Accompanied by + the \c #SPPurgeCachesMessage. + @see \c #SPAdaptersSuite, \c #kSPAdaptersDisposeInfoSelector + */ +#define kSPPluginPurgeCachesSelector "Plug-in Purge" + +/* The plug-in should return one of these two responses when it receives the kSPPluginPurgeCachesSelector */ +//<> +//#define kSPPluginCachesFlushResponse 'pFls' +//#define kSPPluginCouldntFlushResponse kSPNoError; +#include "SPErrorCodes.h" + +/******************************************************************************* + ** + ** Types + ** + **/ +/** Prototype for the cache-flushing procedure an adapter calls in response to the + \c #kSPAdaptersDisposeInfoSelector, to determine which plug-ins to unload, + and inform the caller of whether its managed plug-in have been unloaded. + @param type The plug-in type, as set by the adapter.<> + @param data A pointer to the adapter-defined plug-in data. <> + @param flushed [out] A buffer in which to return the result, + the number of plug-ins actually unloaded. + */ +typedef SPErr (*SPFlushCachesProc)( const char *type, void *data, int32 *flushed ); + +/** Message passed with the \c #kSPPluginPurgeCachesSelector. */ +typedef struct SPPurgeCachesMessage { + /** The message data. */ + SPMessageData d; +} SPPurgeCachesMessage; + + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + This suite allows you to manage PICA cache memory. + + PICA plug-ins are intended to move in and out of memory (cache) as necessary, + to allow a small memory footprint. By default, PICA keeps loaded plug-ins in + cache until the application heap has been filled, and then unloads them. + Beyond this simple strategy, the application and plug-ins can use this + function to unload plug-ins when needed. Plug-ins do not typically need + to do this. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPCachesSuite and \c #kSPCachesSuiteVersion. +*/ +typedef struct SPCachesSuite { + /** Sends a message to all plug-in adapters telling them to unload any + unused plug-ins from memory. + @param flushProc The procedure the adapter uses to determine which + plug-ins to unload. + @param flushed [out] A buffer in which to return the result of the + procedure calls, the total number of plug-ins actually unloaded. + */ + SPAPI SPErr (*SPFlushCaches)( SPFlushCachesProc flushProc, int32 *flushed ); + +} SPCachesSuite; + +/** Internal */ +SPAPI SPErr SPFlushCaches( SPFlushCachesProc flushProc, int32 *flushed ); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPConfig.h b/External/AE SDK/Headers/SP/SPConfig.h new file mode 100644 index 00000000..499d7b25 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPConfig.h @@ -0,0 +1,76 @@ +/***********************************************************************/ +/* */ +/* SPConfig.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +/** + + SPConfig.h is the environment configuration file for Sweet Pea. It + defines MAC_ENV or WIN_ENV. These are used to control platform-specific + sections of code. + + **/ + +#ifndef __SPCnfig__ +#define __SPCnfig__ + +#if defined(__APPLE_CC__) +#if !defined (MAC_ENV) && !defined(SIMULATED_WASM) +#define MAC_ENV 1 +#endif +#endif + +/* + * Windows + */ +#if defined(_WINDOWS) || defined(_MSC_VER) || defined(WINDOWS) // PSMod, better compiler check +#ifndef WIN_ENV +#define WIN_ENV 1 +#endif +#endif + +#ifndef qiOS +#if defined(MAC_ENV) && defined(__arm__) +#define qiOS 1 +#endif +#endif + +/* + * Make certain that one and only one of the platform constants is defined. + */ + +#ifdef __ANDROID__ + #define ANDROID_ENV 1 +#endif + +#ifdef __LINUX__ + #define UNIX_ENV 1 +#endif + +#if defined (__EMSCRIPTEN__) + #define WEB_ENV 1 +#endif + +#if !defined(WIN_ENV) && !defined(MAC_ENV) && !defined(ANDROID_ENV) && !defined(UNIX_ENV) && !defined(WEB_ENV) + #error +#endif + +#if defined(WIN_ENV) && defined(MAC_ENV) && defined(ANDROID_ENV) && defined(UNIX_ENV) && defined (WEB_ENV) + #error +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPEDebug.c b/External/AE SDK/Headers/SP/SPEDebug.c new file mode 100644 index 00000000..97c14e3e --- /dev/null +++ b/External/AE SDK/Headers/SP/SPEDebug.c @@ -0,0 +1,2 @@ +// (c) Copyright 2002. Adobe Systems, Incorporated. All rights reserved. + diff --git a/External/AE SDK/Headers/SP/SPErrorCodes.h b/External/AE SDK/Headers/SP/SPErrorCodes.h new file mode 100644 index 00000000..137faaed --- /dev/null +++ b/External/AE SDK/Headers/SP/SPErrorCodes.h @@ -0,0 +1,172 @@ +/***********************************************************************/ +/* */ +/* SPErrorCodes.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPErrorCodes__ +#define __SPErrorCodes__ + +#if PRAGMA_ONCE +#pragma once +#endif + +/******************************************************************************* + ** + ** General Errors + ** + **/ + +// General errors +#define kASNoError 0 +#define kASUnimplementedError '!IMP' +#define kASUserCanceledError 'stop' + + +/******************************************************************************* + ** + ** SP Errors + ** + **/ + +// General errors +/** @ingroup Errors + PICA no-error code is \c NULL. All other + PICA errors are strings, except \c #kSPOutOfMemoryError. See \c SPTypes.h. */ +#define kSPNoError 0 +/** @ingroup Errors + PICA error, applies to all PICA suites. See \c SPTypes.h. */ +#define kSPUnimplementedError '!IMP' +/** @ingroup Errors + PICA error. */ +#define kSPUserCanceledError 'stop' +#define kSPOperationInterrupted 'intr' +#define kSPLogicError 'fbar' // general programming error + +// SPAccessSuite errors +/** @ingroup Errors + PICA access error. See \c #SPAccessSuite. */ +#define kSPCantAcquirePluginError '!Acq' +/** @ingroup Errors + PICA access error. See \c #SPAccessSuite. */ +#define kSPCantReleasePluginError '!Rel' +/** @ingroup Errors + PICA access error. See \c #SPAccessSuite. */ +#define kSPPluginAlreadyReleasedError 'AlRl' + +// SPAdaptsSuite errors +/** @ingroup Errors + PICA adapter error. See \c #SPAdaptsSuite */ +#define kSPAdapterAlreadyExistsError 'AdEx' +/** @ingroup Errors + PICA adapter error.See \c #SPAdaptsSuite */ +#define kSPBadAdapterListIteratorError 'BdAL' + +// SPBasicSuite errors +/** @ingroup Errors + Basic PICA error. See \c #SPBasicSuite */ +#define kSPBadParameterError 'Parm' + +// Block debugging errors +/** @ingroup Errors + PICA debugging error. See \c #SPBlockDebugSuite */ +#define kSPCantChangeBlockDebugNowError '!Now' +/** @ingroup Errors + PICA debugging error. See \c #SPBlockDebugSuite */ +#define kSPBlockDebugNotEnabledError '!Nbl' + +// SPBlocks errors +/** @ingroup Errors + PICA memory management error. See \c #SPBlocksSuite */ +#define kSPOutOfMemoryError (int32(0xFFFFFF6c)) /* -108, same as Mac memFullErr */ +/** @ingroup Errors + PICA memory management error. See \c #SPBlocksSuite */ +#define kSPBlockSizeOutOfRangeError 'BkRg' + +// SPCaches errors +/** @ingroup Errors + PICA cache-flushing error. See \c #SPCachesSuite */ +#define kSPPluginCachesFlushResponse 'pFls' +/** @ingroup Errors + PICA cache-flushing error. See \c #SPCachesSuite */ +#define kSPPluginCouldntFlushResponse kSPNoError; + +// SPFiles errors +/** @ingroup Errors + PICA file-access error. See \c #SPFilesSuite */ +#define kSPTroubleAddingFilesError 'TAdd' +/** @ingroup Errors + PICA file-access error. See \c #SPFilesSuite */ +#define kSPBadFileListIteratorError 'BFIt' + +// SPHost errors +/** @ingroup Errors + PICA plug-in atart-up error. See \c #SPHostSuite */ +#define kSPTroubleInitializingError 'TIni' // Some non-descript problem encountered while starting up. +/** @ingroup Errors PICA plug-in atart-up error. See \c #SPHostSuite */ +#define kHostCanceledStartupPluginsError 'H!St' + +// SPInterface errors +/** @ingroup Errors + PICA interface error. See \c #SPInterfaceSuite */ +#define kSPNotASweetPeaPluginError 'NSPP' +/** @ingroup Errors + PICA interface error. See \c #SPInterfaceSuite */ +#define kSPAlreadyInSPCallerError 'AISC' + +// SPPlugins errors +/** @ingroup Errors + PICA plug-in error. See \c #SPPluginsSuite */ +#define kSPUnknownAdapterError '?Adp' +/** @ingroup Errors + PICA plug-in error. See \c #SPPluginsSuite */ +#define kSPBadPluginListIteratorError 'PiLI' +/** @ingroup Errors + PICA plug-in error. See \c #SPPluginsSuite */ +#define kSPBadPluginHost 'PiH0' +/** @ingroup Errors + PICA plug-in error. See \c #SPPluginsSuite */ +#define kSPCantAddHostPluginError 'AdHo' +/** @ingroup Errors + PICA plug-in error. See \c #SPPluginsSuite */ +#define kSPPluginNotFound 'P!Fd' + +// SPProperties errors +/** @ingroup Errors + PICA properties error. See \c #SPPropertiesSuite */ +#define kSPCorruptPiPLError 'CPPL' +/** @ingroup Errors + PICA properties error. See \c #SPPropertiesSuite */ +#define kSPBadPropertyListIteratorError 'BPrI' + +// SPSuites errors +/** @ingroup Errors + PICA suite access error. See \c #SPSuitesSuite */ +#define kSPSuiteNotFoundError 'S!Fd' +/** @ingroup Errors + PICA suite access error. See \c #SPSuitesSuite */ +#define kSPSuiteAlreadyExistsError 'SExi' +/** @ingroup Errors + PICA suite access error. See \c #SPSuitesSuite */ +#define kSPSuiteAlreadyReleasedError 'SRel' +/** @ingroup Errors + PICA suite access error. See \c #SPSuitesSuite */ +#define kSPBadSuiteListIteratorError 'SLIt' +/** @ingroup Errors + PICA suite access error. See \c #SPSuitesSuite */ +#define kSPBadSuiteInternalVersionError 'SIVs' + +#endif diff --git a/External/AE SDK/Headers/SP/SPErrors.h b/External/AE SDK/Headers/SP/SPErrors.h new file mode 100644 index 00000000..7b8fd8f3 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPErrors.h @@ -0,0 +1,34 @@ +/***********************************************************************/ +/* */ +/* SPErrors.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + + +/******************************************************************************* + ** + ** Errors + ** + **/ +/** @ingroup Errors + PICA access error. See \c #SPAccessSuite. */ +#define kSPCantAcquirePluginError '!Acq' +/** @ingroup Errors + PICA access error. See \c #SPAccessSuite. */ +#define kSPCantReleasePluginError '!Rel' +/** @ingroup Errors + PICA access error. See \c #SPAccessSuite. */ +#define kSPPluginAlreadyReleasedError 'AlRl' diff --git a/External/AE SDK/Headers/SP/SPFiles.h b/External/AE SDK/Headers/SP/SPFiles.h new file mode 100644 index 00000000..fa19c09c --- /dev/null +++ b/External/AE SDK/Headers/SP/SPFiles.h @@ -0,0 +1,511 @@ +/***********************************************************************/ +/* */ +/* SPFiles.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPFiles__ +#define __SPFiles__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPProps.h" + +#include "photoshop/config/platform.hpp" + +#if PS_PLATFORM_APPLE +#include "CoreFoundation/CoreFoundation.h" +#if PS_OS_MAC +#include "Carbon/Carbon.h" +#endif +#endif + +#if PS_OS_IOS +#include "photoshop/platform/EmulateEndianOnIOS.h" +#include "photoshop/platform/EmulateMacErrorsOnIOS.h" +#include "photoshop/platform/EmulateQuickdrawOnIOS.h" +#include "photoshop/platform/EmulateOSAPIsOnIOS.h" +#include "photoshop/platform/EmulateCarbonFilesOnIOS.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** Files suite name */ +#define kSPFilesSuite "SP Files Suite" +/** Files suite version */ +#define kSPFilesSuitePrevVers 3 +#define kSPFilesSuiteVersion 4 + +/** PICA global list of potential plug-in files. . + @see \c #SPRuntimeSuite::GetRuntimeFileList().*/ +#define kSPRuntimeFileList ((SPFileListRef)NULL) + +/** Return value for \c #SPFilesSuite::GetFilePropertyList(), + indicating that the file has no property list. */ +#define kFileDoesNotHavePiPL (SPPropertyListRef)((intptr_t)-1) +/** Return value for \c #SPFilesSuite::GetFilePropertyList(), + indicating that the file has multiple property lists. <> */ +#define kFileHasMulitplePiPLs NULL + +/******************************************************************************* + ** + ** Types + ** + **/ + +/** The maximum number of characters allowed in a file path specification. */ +#define kMaxPathLength 300 + +/** Opaque reference to a file. Access with the \c #SPFilesSuite. */ +typedef struct SPFile *SPFileRef; +/** Opaque reference to a file list. Access with the \c #SPFilesSuite. */ +typedef struct SPFileList *SPFileListRef; +/** Opaque reference to a file-list iterator. Access with the \c #SPFilesSuite. */ +typedef struct SPFileListIterator *SPFileListIteratorRef; +/** Opaque reference to a platform-specific file specification. Access with the \c #SPFilesSuite. */ +typedef struct OpaqueSPPlatformFileRef SPPlatformFileRef; + +#define kXPlatFileSpecVersion 1 + +/** The replacement for SPPlatformFileSpecification and SPPlatformFileSpecificationW, +** used in SP Files Suite version 4 and later */ +typedef struct XPlatFileSpec { + int32 mFileSpecVersion; ///< \brief kXPlatFileSpecVersion + ///< + ///< A value of zero implies "not initialized", + ///< and you should not attempt to use mFileReference +#if defined(WIN_ENV) || defined(ANDROID_ENV) || WEB_ENV || defined(UNIX_ENV) + uint16* mFileReference; ///< \brief mFileReference could be as long as 64K but MUST be NULL terminated. +#elif defined(MAC_ENV) + CFURLRef mFileReference; ///< \brief A CFURLRef, as defined by Mac OS X +#endif +} XPlatFileSpec; + + +/*******************************************************************************/ + +#if defined (MAC_ENV) +#if PRAGMA_STRUCT_ALIGN // DRSWAT +#pragma options align=mac68k +#endif // PRAGMA_STRUCT_ALIGN + + +/** A file specification: + \li In Mac OS 32 bit, the same as \c FSSpec. + \li In Windows, a path string. */ + + +#if USE_POSIX_API + +typedef struct SPPlatformFileSpecification { /* this handles unicode file names */ + /** The file path string. */ + char path[kMaxPathLength]; +} SPPlatformFileSpecification; + +typedef struct SPPlatformFileSpecificationW { /* this handles unicode file names */ + /** mReference could be as long as 64K but MUST be NULL terminated. */ + uint16 *mReference; +} SPPlatformFileSpecificationW; + +/**Platform-specific file metadata. */ +typedef struct SPPlatformFileInfo { + /** File attribute flags; see Windows documentation. */ + uint32 attributes; + /** Least-significant byte of the file creation date-time (Windows).*/ + uint32 lowCreationTime; + /** Most-significant byte of the file creation date-time (Windows).*/ + uint32 highCreationTime; + /** Least-significant byte of the file modification date-time (Windows).*/ + uint32 lowModificationTime; + /** Most-significant byte of the file cremodification date-time (Windows).*/ + uint32 highModificationTime; + /** The file-name extension indicating the file type (Windows). */ + const char *extension; +} SPPlatformFileInfo; + +#elif PS_PLATFORM_APPLE + +typedef struct SPPlatformFileSpecification { /* this handles unicode file names */ + FSRef mReference; +} SPPlatformFileSpecification; + +typedef struct SPPlatformFileSpecificationW { /* this handles unicode file names */ + FSRef mReference; +} SPPlatformFileSpecificationW; + +#if PRAGMA_STRUCT_ALIGN // DRSWAT +#pragma options align=reset +#endif + + /*******************************************************************************/ + + /** Platform-specific file metadata. */ + typedef struct SPPlatformFileInfo { /* On Mac OS*/ + /** Not used. */ + uint32 attributes; //Unused, but still required to maintain binary compatibility + /** Date file was created (Mac OS). */ + uint32 creationDate; + /** Data file was last modified (Mac OS). */ + uint32 modificationDate; + /** Type of file for Finder (Mac OS). */ + uint32 finderType; + /** File creator (Mac OS). */ + uint32 finderCreator; + /** File flags for Finder; see Mac OS documentation. */ + uint16 finderFlags; + } SPPlatformFileInfo; +#endif // PS_PLATFORM_APPLE + +#endif // MAC_ENV + +/*******************************************************************************/ + +#ifdef WIN_ENV +/** A file specification in Windows. */ +typedef struct SPPlatformFileSpecification { + /** The file path string. */ + char path[kMaxPathLength]; +} SPPlatformFileSpecification; + +/** A widechar file specification in Windows to handle unicode file names. */ +typedef struct SPPlatformFileSpecificationW { + /** mReference could be as long as 64K but MUST be NULL terminated. */ + uint16 *mReference; +} SPPlatformFileSpecificationW; + +/*******************************************************************************/ + +/**Platform-specific file metadata. */ +typedef struct SPPlatformFileInfo { + /** File attribute flags; see Windows documentation. */ + uint32 attributes; + /** Least-significant byte of the file creation date-time (Windows).*/ + uint32 lowCreationTime; + /** Most-significant byte of the file creation date-time (Windows).*/ + uint32 highCreationTime; + /** Least-significant byte of the file modification date-time (Windows).*/ + uint32 lowModificationTime; + /** Most-significant byte of the file cremodification date-time (Windows).*/ + uint32 highModificationTime; + /** The file-name extension indicating the file type (Windows). */ + const uint16 *extension; +} SPPlatformFileInfo; +#endif // WIN_ENV + +/*******************************************************************************/ + + +#if defined(__ANDROID__) || defined(__LINUX__) || defined (__EMSCRIPTEN__) || defined(SIMULATED_WASM) +typedef struct SPPlatformFileSpecification { + /** The file path string. */ + char path[kMaxPathLength]; +} SPPlatformFileSpecification; + +/** A widechar file specification in Windows to handle unicode file names. */ +typedef struct SPPlatformFileSpecificationW { + /** mReference could be as long as 64K but MUST be NULL terminated. */ + uint16 *mReference; +} SPPlatformFileSpecificationW; + +/*******************************************************************************/ + +/**Platform-specific file metadata. */ +typedef struct SPPlatformFileInfo { + uint32 attributes; + uint32 lowCreationTime; + uint32 highCreationTime; + uint32 lowModificationTime; + uint32 highModificationTime; + const uint16 *extension; +} SPPlatformFileInfo; +#endif // __ANDROID__ + +/** Conversion from new platform file specification to old platform file +** specification, and vice-versa. It's okay to pass NULL pointers to these +** functions. If you do, the value returned will be a default constructed +** structure (i.e. zero-filled) +*/ +/** Internal ? */ +SPAPI SPPlatformFileSpecification OldFileSpecFromXplatFileSpec(const XPlatFileSpec* newSpec); + +SPAPI SPPlatformFileSpecificationW OldFileSpecWFromXplatFileSpec(const XPlatFileSpec* newSpec); + +/// Caller owns the CFURLRef contained in XPlatFileSpec::mFileReference +SPAPI XPlatFileSpec XplatFileSpecFromOldFileSpec(const SPPlatformFileSpecification* oldSpec); + +/// Caller owns the CFURLRef contained in XPlatFileSpec::mFileReference +SPAPI XPlatFileSpec XplatFileSpecFromOldFileSpecW(const SPPlatformFileSpecificationW* oldSpecW); + +/*******************************************************************************/ + +/** Internal */ +typedef SPBoolean (*SPAddPiPLFilterProc)( SPPlatformFileInfo *info ); + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + This suite allows you to access the PICA files list. This list, created at startup, + contains references to every file in the application's plug-in folder, including + any resolved file and folder aliases. PICA maintains this list, and uses it to find plug-ins. + + Use this suite to access the plug-in file list, in order to avoid redundant directory + scans. Adapters looking for their own plug-ins and PICA plug-ins looking for + support files should scan the list to locate relevant files rather than walking + platform directory structures on their own. + + Similarly, you can use this suite to create, maintain, and access your own lists + of files in a platform-independant and efficient manner. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPFilesSuite and \c #kSPFilesSuiteVersion (4). + */ + +typedef struct SPFilesSuite { + /** Creates a new file list. Typically, you use the main PICA file list to access + plug-in files, available through \c #SPRuntimeSuite::GetRuntimeFileList(). + You can use this to track other file collections. If you create a new list, you + must free it when it is no longer needed, using \c #FreeFileList(). + @param fileList [out] A buffer in which to return the new file list object. + */ + SPAPI SPErr (*AllocateFileList)( SPFileListRef *fileList ); + /** Frees a file list created with \c #AllocateFileList(), and any entries in the list. + @param fileList The file list object. + */ + SPAPI SPErr (*FreeFileList)( SPFileListRef fileList ); + + /** Adds a file or all files in a directory to a file list. Searches a directory + recursively for contained files. + @param fileList The file list object. + @param file The file or directory specification. + */ + SPAPI SPErr (*AddFiles)( SPFileListRef fileList, const XPlatFileSpec *file ); + + /** Creates a file-list iterator object to use with \c #NextFile() for iterating + through a file list. The iterator is initially set to the first file in the list. + When the iterator is no longer needed, free it with \c #DeleteFileListIterator(). + @param fileList The file list object. + @param iter [out] A buffer in which to return the new iterator object. + */ + SPAPI SPErr (*NewFileListIterator)( SPFileListRef fileList, SPFileListIteratorRef *iter ); + /** Retrieves the current file from a file list iterator, and advances the iterator. + @param iter The iterator object. + @param file [out] A buffer in which to return the current file object, or \c NULL + if the end of the list has been reached. + */ + SPAPI SPErr (*NextFile)( SPFileListIteratorRef iter, SPFileRef *file ); + /** Frees a file-list iterator created with /c #NewFileListIterator(). + @param iter The iterator object. + */ + SPAPI SPErr (*DeleteFileListIterator)( SPFileListIteratorRef iter ); + + /** Retrieves the platform-specific file specification for a file. + @param file The file object. + @param fileSpec [out] A buffer in which to return the file specification. + */ + SPAPI SPErr (*GetFileSpecification)( SPFileRef file, XPlatFileSpec *fileSpec ); + /** Retrieves the metadata for a file. + @param file The file object. + @param info [out] A buffer in which to return the file information. + */ + SPAPI SPErr (*GetFileInfo)( SPFileRef file, SPPlatformFileInfo *info ); + + /** Reports whether a file in a file list is a plug-in. + @param file The file object. + @param isAPlugin [out] A buffer in which to return true if the file is a plug-in. + */ + SPAPI SPErr (*GetIsAPlugin)( SPFileRef file, SPBoolean *isAPlugin ); + /** Sets whether a file in a file list is a plug-in. + @param file The file object. + @param isAPlugin True to mark the file as a plug-in, false to mark it as not a plug-in. + */ + SPAPI SPErr (*SetIsAPlugin)( SPFileRef file, SPBoolean isAPlugin ); + + /** Retrieves the property list for a file. + @param file The file object. + @param propertList [out] A buffer in which to return the property list, + or \c #kFileDoesNotHavePiPL if the file does not have a property list, + or \c #kFileHasMulitplePiPLs if the file has multiple property lists. + @see \c SPPiPL.h + */ + SPAPI SPErr (*GetFilePropertyList)( SPFileRef file, SPPropertyListRef *propertList ); + /** Sets the property list for a file. + @param file The file object. + @param propertList The new property list. + */ + SPAPI SPErr (*SetFilePropertyList)( SPFileRef file, SPPropertyListRef propertList ); + +} SPFilesSuite; + + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + This suite allows you to access the PICA files list. This list, created at startup, + contains references to every file in the application's plug-in folder, including + any resolved file and folder aliases. PICA maintains this list, and uses it to find plug-ins. + + Use this suite to access the plug-in file list, in order to avoid redundant directory + scans. Adapters looking for their own plug-ins and PICA plug-ins looking for + support files should scan the list to locate relevant files rather than walking + platform directory structures on their own. + + Similarly, you can use this suite to create, maintain, and access your own lists + of files in a platform-independant and efficient manner. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPFilesSuite and \c #kSPFilesSuitePrevVers (3). + */ +typedef struct SPFilesV3Suite { + /** Creates a new file list. Typically, you use the main PICA file list to access + plug-in files, available through \c #SPRuntimeSuite::GetRuntimeFileList(). + You can use this to track other file collections. If you create a new list, you + must free it when it is no longer needed, using \c #FreeFileList(). + @param fileList [out] A buffer in which to return the new file list object. + */ + SPAPI SPErr (*AllocateFileList)( SPFileListRef *fileList ); + /** Frees a file list created with \c #AllocateFileList(), and any entries in the list. + @param fileList The file list object. + */ + SPAPI SPErr (*FreeFileList)( SPFileListRef fileList ); + + /** Adds a file or all files in a directory to a file list. Searches a directory + recursively for contained files. + @param fileList The file list object. + @param file The file or directory specification. + */ + SPAPI SPErr (*AddFiles)( SPFileListRef fileList, const SPPlatformFileSpecification *file ); + + /** Creates a file-list iterator object to use with \c #NextFile() for iterating + through a file list. The iterator is initially set to the first file in the list. + When the iterator is no longer needed, free it with \c #DeleteFileListIterator(). + @param fileList The file list object. + @param iter [out] A buffer in which to return the new iterator object. + */ + SPAPI SPErr (*NewFileListIterator)( SPFileListRef fileList, SPFileListIteratorRef *iter ); + /** Retrieves the current file from a file list iterator, and advances the iterator. + @param iter The iterator object. + @param file [out] A buffer in which to return the current file object, or \c NULL + if the end of the list has been reached. + */ + SPAPI SPErr (*NextFile)( SPFileListIteratorRef iter, SPFileRef *file ); + /** Frees a file-list iterator created with /c #NewFileListIterator(). + @param iter The iterator object. + */ + SPAPI SPErr (*DeleteFileListIterator)( SPFileListIteratorRef iter ); + + /** Retrieves the platform-specific file specification for a file. + @param file The file object. + @param fileSpec [out] A buffer in which to return the file specification. + */ + SPAPI SPErr (*GetFileSpecification)( SPFileRef file, SPPlatformFileSpecification *fileSpec ); + /** Retrieves the metadata for a file. + @param file The file object. + @param info [out] A buffer in which to return the file information. + */ + SPAPI SPErr (*GetFileInfo)( SPFileRef file, SPPlatformFileInfo *info ); + + /** Reports whether a file in a file list is a plug-in. + @param file The file object. + @param isAPlugin [out] A buffer in which to return true if the file is a plug-in. + */ + SPAPI SPErr (*GetIsAPlugin)( SPFileRef file, SPBoolean *isAPlugin ); + /** Sets whether a file in a file list is a plug-in. + @param file The file object. + @param isAPlugin True to mark the file as a plug-in, false to mark it as not a plug-in. + */ + SPAPI SPErr (*SetIsAPlugin)( SPFileRef file, SPBoolean isAPlugin ); + + /** Retrieves the property list for a file. + @param file The file object. + @param propertList [out] A buffer in which to return the property list, + or \c #kFileDoesNotHavePiPL if the file does not have a property list, + or \c #kFileHasMulitplePiPLs if the file has multiple property lists. + @see \c SPPiPL.h + */ + SPAPI SPErr (*GetFilePropertyList)( SPFileRef file, SPPropertyListRef *propertList ); + /** Sets the property list for a file. + @param file The file object. + @param propertList The new property list. + */ + SPAPI SPErr (*SetFilePropertyList)( SPFileRef file, SPPropertyListRef propertList ); + +} SPFilesV3Suite; + + +/** Internal */ +SPAPI SPErr SPAllocateFileList( SPFileListRef *fileList ); +/** Internal */ +SPAPI SPErr SPFreeFileList( SPFileListRef fileList ); +/** Internal */ +SPAPI SPErr SPAddFiles( SPFileListRef fileList, const SPPlatformFileSpecification *file ); +/** Internal */ +SPAPI SPErr SPNewAddFiles( SPFileListRef fileList, const XPlatFileSpec *file ); + +/** Internal */ +SPAPI SPErr SPNewFileListIterator( SPFileListRef fileList, SPFileListIteratorRef *iter ); +/** Internal */ +SPAPI SPErr SPNextFile( SPFileListIteratorRef iter, SPFileRef *file ); +/** Internal */ +SPAPI SPErr SPDeleteFileListIterator( SPFileListIteratorRef iter ); + +/** Internal */ +SPAPI SPErr SPGetFileSpecification( SPFileRef file, SPPlatformFileSpecification *fileSpec ); +/** Internal */ +SPAPI SPErr SPNewGetFileSpecification( SPFileRef file, XPlatFileSpec *fileSpec ); +/** Internal */ +SPAPI SPErr SPGetFileInfo( SPFileRef file, SPPlatformFileInfo *info ); +/** Internal */ +SPAPI SPErr SPGetIsAPlugin( SPFileRef file, SPBoolean *isAPlugin ); +/** Internal */ +SPAPI SPErr SPSetIsAPlugin( SPFileRef file, SPBoolean isAPlugin ); + +/** Internal */ +SPAPI SPErr SPGetFilePropertyList( SPFileRef file, SPPropertyListRef *propertList ); +/** Internal */ +SPAPI SPErr SPSetFilePropertyList( SPFileRef file, SPPropertyListRef propertList ); + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPHost.h b/External/AE SDK/Headers/SP/SPHost.h new file mode 100644 index 00000000..601bf736 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPHost.h @@ -0,0 +1,176 @@ +/***********************************************************************/ +/* */ +/* SPHost.h */ +/* */ +/* Copyright 1995-1999 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPHost__ +#define __SPHost__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPAccess.h" +#include "SPAdapts.h" +#include "SPBasic.h" +#include "SPBckDbg.h" +#include "SPBlocks.h" +#include "SPCaches.h" +#include "SPFiles.h" +#include "SPInterf.h" +#include "SPPlugs.h" +#include "SPProps.h" +#include "SPRuntme.h" +#include "SPStrngs.h" +#include "SPSuites.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ + + +/* + * The version number of the Sweet Pea host interface. You can compare it to the + * version number that Sweet Pea was compiled with to determine that you are + * running the version you think you are. See SPVersion() below. + * + * This number consists of a hi word which is the major version number reflecting + * changes to the SP inteface, and a low word which is the minor revision number, + * for instance indicating bug fixes. + */ + +#define kSPVersion 0x000B0002 // version 11.2 + + +/* + * Options available to the host at init time. They are: + * + * kSPHostBlockDebugOption - block allocation debugging is enabled. See + * SPBckDbg.h for details. + * + * Examples: + * + * SPInit( hostProcs, pluginsFolder, kSPHostNoOptions, error ); + * // No debugging. + * + * SPInit( hostProcs, pluginsFolder, kSPHostBlockDebugOption, error ); + * // Enable block debugging. + */ + +#define kSPHostNoOptions 0 +#define kSPHostBlockDebugOption (1<<0L) + + +/******************************************************************************* + ** + ** Functions + ** + **/ + +/* + * SPInit() initializes Sweet Pea. It is the first call made to Sweet Pea. It + * initializes its suites and builds the list of application files. + * + * HostProcs points to a filled-in structure of host callbacks, as described + * in SPRuntme.h. It may be NULL, in which case Sweet Pea uses its default + * versions for all of the host callbacks. PluginFolder is the file spec of the + * plug-ins folder. The contents of this folder are collected into the application + * files list (see SPFiles.h). Options may be any of the host options described + * above. + */ +SPErr SPInit( SPHostProcs *hostProcs, const SPPlatformFileSpecification *pluginFolder, int32 options ); + +/* + * SPXPlatInit() uses the XPlatFileSpec rather than the SPPlatformFileSpecification. + * + * Otherwise it's identical to SPInit (and actually calls through to it for Photoshop 17.0) + */ +SPErr SPXPlatInit( SPHostProcs *hostProcs, const XPlatFileSpec *pluginFolder, int32 options ); + +SPBoolean SPInited( void ); + +/* + * SPTerm() terminates Sweet Pea. Call this when your application quits. + */ +SPErr SPTerm( void ); + +/* + * SPStartupPlugins() scans the list of application files and builds the list + * of plug-ins. It then starts them up, calling each in turn with a start up + * message (see SPPlugs.h). Call this sometime after SPInit(). + */ +SPErr SPStartupPlugins( void ); + +/* + * SPShutdownPlugins() shuts down the plug-ins. It calls each in turn with a + * shut down message (see SPPlugs.h). Call this when your application quits + * before calling SPTerm(). + */ +SPErr SPShutdownPlugins( void ); + + +#ifdef MAC_ENV +/* + * SPSetPPCLoadHeap() sets the destination heap of plug-in accesses on PowerPPC + * Macintoshes. Plug-ins can load into the system heap or the application heap. + */ +typedef enum { + kAppHeap = 0, + kSysHeap +} SPTargetHeap; + +SPErr SPSetPPCLoadHeap( SPTargetHeap target ); + +/* + * SPSetHostBundleRef() lets sweet pea know the bundle ref of the host. + */ +SPErr SPSetHostBundleRef(CFBundleRef hostBundle); +#endif + + +/* + * SPVersion() returns the version number of the Sweet Pea host interface (this + * file) for which Sweet Pea was built. You can compare this to the constant + * kSPVersion to make sure you're using the version you think you are. + */ +uint32 SPVersion( void ); + + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPInterf.h b/External/AE SDK/Headers/SP/SPInterf.h new file mode 100644 index 00000000..276d09f0 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPInterf.h @@ -0,0 +1,180 @@ +/***********************************************************************/ +/* */ +/* SPInterf.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPInterface__ +#define __SPInterface__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPBasic.h" +#include "SPFiles.h" +#include "SPMData.h" +#include "SPPlugs.h" +#include "SPProps.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** PICA Interface suite name. */ +#define kSPInterfaceSuite "SP Interface Suite" +/** PICA Interface suite version. */ +#define kSPInterfaceSuiteVersion 2 + +/** PICA messaging system caller; see \c #SPInterfaceSuite. */ +#define kSPInterfaceCaller "SP Interface" +/** PICA messaging system startup; see \c #SPInterfaceSuite. */ +#define kSPInterfaceStartupSelector "Startup" +/** PICA messaging system shutdown; see \c #SPInterfaceSuite. */ +#define kSPInterfaceShutdownSelector "Shutdown" +/** PICA messaging system request for information; see \c #SPInterfaceSuite. + Illustrator sends this call to all plug-ins to implement + the "About Plug-ins" feature.*/ +#define kSPInterfaceAboutSelector "About" + +/** Adapter name for PICA version 2. */ +#define kSPSweetPea2Adapter "Sweet Pea 2 Adapter" +/** Adapter version for PICA version 2.*/ +#define kSPSweetPea2AdapterVersion 1 + +/******************************************************************************* + ** + ** Types + ** + **/ + +/** A basic message, sent with \c #kSPInterfaceCaller. */ +typedef struct SPInterfaceMessage { + + /** The message data. */ + SPMessageData d; + +} SPInterfaceMessage; + + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + This suite provides is the ability for a plug-in to call + other plug-ins, by sending a message to the main entry point. + This is how the application communicates with plug-ins. + + Use \c #SetupMessageData() to prepare the message for a call, + \c #SendMessage() to send the call with the message, and + \c #EmptyMessageData() to terminate the operation, allowing + PICA to release the basic suite and store global variables. + + These calls work only with PICA plug-ins. Before making the calls, + use \c #SPAdaptersSuite::GetAdapterName() to determine that + the target is a PICA plug-in. For non-PICA plug-ins, use the + interface suite provided by the adapter. See \c #SPAdaptersSuite. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPInterfaceSuite and \c #kSPInterfaceSuiteVersion. +*/ +typedef struct SPInterfaceSuite { + + /** Sends a message to a PICA plug-in, loading it if needed and + passing the caller, selector, and message to the main entry point. + @param plug-in The target plug-in object. + @param caller The caller constant. See @ref Callers. + @param selector The selector constant. See @ref Selectors. + @param message The message, initialized by \c #SetupMessageData(). + @param result [out] A buffer in which to return the result of the call, + as returned by the target plug-in. + */ + SPAPI SPErr (*SendMessage)( SPPluginRef plugin, const char *caller, const char *selector, + void *message, SPErr *result ); + + /** Initializes a message to be sent with \c #SendMessage(). + The function fills in the basic suite, the plug-in reference, + and the globals pointer that PICA keeps for that plug-in. + You must provide any additional data needed. + @param plugin The target plug-in object. + @param data The message structure, initialized with data required + for the intended call. + */ + SPAPI SPErr (*SetupMessageData)( SPPluginRef plugin, SPMessageData *data ); + /** Terminates a call to another plug-in, releasing the basic suite and + updating the target plug-in's globals pointer, in case it has changed. + Use after a call to \c #SendMessage(). + @param plugin The target plug-in object. + @param data The message structure, updated during the call. + */ + SPAPI SPErr (*EmptyMessageData)( SPPluginRef plugin, SPMessageData *data ); + + /** Starts up the plug-in in a plug-in list that exports a given suite. + Searches in the given plug-in list for the plug-in that exports the named + suite, and, if found, sends it the startup message. + @param pluginList The plug-in list object. Access PICA's global plug-in + list using \c #SPRuntimeSuite::GetRuntimePluginList(), + or create your own lists with \c #SPPluginsSuite::AllocatePluginList(). + @param name The suite name constant. + @param version The suite version number constant. + @param started [out] A buffer in which to return true (non-zero) if a + plug-in that exports the suite was found, false (0) if not. + */ + SPAPI SPErr (*StartupExport)( SPPluginListRef pluginList, const char *name, int32 version, + int32 *started ); + +} SPInterfaceSuite; + + +/** Internal */ +SPAPI SPErr SPSendMessage( SPPluginRef plugin, const char *caller, const char *selector, + void *message, SPErr *result ); + +/** Internal */ +SPAPI SPErr SPSetupMessageData( SPPluginRef plugin, SPMessageData *data ); +/** Internal */ +SPAPI SPErr SPEmptyMessageData( SPPluginRef plugin, SPMessageData *data ); + +/** Internal */ +SPAPI SPErr SPStartupExport( SPPluginListRef pluginList, const char *name, int32 version, + int32 *started ); + + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPMData.h b/External/AE SDK/Headers/SP/SPMData.h new file mode 100644 index 00000000..507e5fff --- /dev/null +++ b/External/AE SDK/Headers/SP/SPMData.h @@ -0,0 +1,66 @@ +/***********************************************************************/ +/* */ +/* SPMData.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPMessageData__ +#define __SPMessageData__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Types + ** + **/ + +/** The value of \c #SPMessageData::SPCheck, if the message data associated + with a call to a plug-in has come from \c #SPInterfaceSuite::SendMessage(), + or is prepared using \c #SPInterfaceSuite::SetupMessageData(). */ +#define kSPValidSPMessageData 'SPCk' + +/** Basic suite-access information provided with every call. */ +typedef struct SPMessageData { + /** \c #kSPValidSPMessageData if this is a valid PICA message. */ + int32 SPCheck; + /** This plug-in, an \c #SPPluginRef. */ + struct SPPlugin *self; + /** An array of application-wide global variables. */ + void *globals; + /** A pointer to the basic PICA suite, which you use to obtain all other suites. */ + struct SPBasicSuite *basic; + +} SPMessageData; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPObject.h b/External/AE SDK/Headers/SP/SPObject.h new file mode 100644 index 00000000..9c419b2b --- /dev/null +++ b/External/AE SDK/Headers/SP/SPObject.h @@ -0,0 +1,15 @@ +/****************************************************************************** + SPObject.h + +Purpose: + Defines the suite for registering and creating Sweet Pea objects. + It is a "conventional" Sweet Pea suite used to provide + COM-like objects from Sweet Pea plugins. + + Copyright (c) 1995-1998, 2002 Adobe Systems Incorporated. +******************************************************************************/ +#pragma once +#ifndef __SPObject__ +#define __SPObject__ +/* This module is obsolete. */ +#endif /* __SPObject__ */ diff --git a/External/AE SDK/Headers/SP/SPPiPL.h b/External/AE SDK/Headers/SP/SPPiPL.h new file mode 100644 index 00000000..02aac5d8 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPPiPL.h @@ -0,0 +1,302 @@ +/***********************************************************************/ +/* */ +/* SPPiPL.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPPiPL__ +#define __SPPiPL__ + + +/******************************************************************************* + ** + ** Imports and alignment + ** + **/ + +#include "SPTypes.h" + + +#if PRAGMA_STRUCT_ALIGN +#pragma options align=mac68k +#endif + + +/******************************************************************************* + ** + ** Constants + ** + ** Note: 4-character long IDs must be defined in hexidecimal, not long + ** literal ('long'), due to Windows RC compilers not understanding what + ** to do with them. + ** + **/ + +/** Vendor identifier for a plug-in resource, \c #PIProperty::vendorID value. +
'ADBE' Vendor identifier for PICA-generic applications. */ +#define PIAdobeVendorID (PIType)0x41444245L + +/** Property mechanism version property, \c #PIProperty::propertyKey value +
'ivrs' PICA plug-in version. */ +#define PISPVersionProperty (PIType)0x69767273L + +/** Plug-in resource type, \c #PIProperty::propertyKey value. +
'impt' Suite import information. */ +#define PIImportsProperty (PIType)0x696D7074L + +/** Plug-in resource type, \c #PIProperty::propertyKey value. +
'expt' Suite export information. */ +#define PIExportsProperty (PIType)0x65787074L + +/** Plug-in resource type, \c #PIProperty::propertyKey value. +
'ppcR' Power PC resource information. */ +#define PIPowerPCCodeResProperty (PIType)0x70706352L + +/** Plug-in resource type, \c #PIProperty::propertyKey value. +
'heap' Mac OS PPC-only. +
If not defined, loads application default heap. +
If 0, loads system heap */ +#define PIDestinationHeapProperty (PIType)0x68656170L +/** Value of \c #PIDestinationHeapProperty, loads system heap */ +#define PILoadInAppHeap (1L<<0) + +/** Plug-in resource type, \c #PIProperty::propertyKey value. +
'adpt' Adapter version property (a long value) */ +#define PIAdapterProperty (PIType)0x61647074L + +/** Plug-in resource type, \c #PIProperty::propertyKey value. +
'pinm' Internal plug-in name */ +#define PIPluginNameProperty (PIType)0x70696E6DL + +/** Plug-in resource type, \c #PIProperty::propertyKey value. +
'AcpM' Message flags */ +#define PIConditionalMessages (PIType)0x4163704DL +/** Flag bit for \c #PIConditionalMessages: plug-in accepts property changes. <> */ +#define PIAcceptsPropertyMessage (1L<<0) +/** Flag bit for \c #PIConditionalMessages: skip shutdown. <> */ +#define PISkipShutDownMessage (1L<<1) +/** Flag bit for \c #PIConditionalMessages: plug-in accepts purge-cache messages. */ +#define PIAcceptsPurgeCachesMessage (1L<<2) +/** Flag bit for \c #PIConditionalMessages: skip startup message. <> */ +#define PISkipStartupMessage (1L<<3) + +/** Internal. Plug-in resource type, \c #PIProperty::propertyKey value. +
'RelP' generated by Illustrator to optimize program launch */ +#define PIReleasePluginEarly 0x52656c50 + +/******************************************************************************* + ** + ** General PiPL properties and structures + ** + ** Many hosts multiply define these properties, so we bracket them + ** so they are only defined once. + ** + **/ + +#ifndef kGeneralPiPLPropertiesDefined // Already defined? +/** Internal: Defines the general properties only if the application has + not already done so. */ +#define kGeneralPiPLPropertiesDefined // Only define once. + +/** Data type for plug-in property key and vendor ID. See \c #PIProperty. */ +typedef SPUInt32 PIType; + +/** Plug-in properties version number. */ +#define kCurrentPiPLVersion 0 + +// 'kind' giving the plug-in's kind: +#define PIKindProperty (PIType)0x6b696e64L + +// 'm68k' 68k code descriptor. See struct below. +#define PI68KCodeProperty (PIType)0x6d36386bL + +// 'pwpc' PowerPC code descriptor. See struct below. +#define PIPowerPCCodeProperty (PIType)0x70777063L + +// 'ppcb' PowerPC CARBON code descriptor. See struct below. +#define PIPowerPCCarbonCodeProperty 'ppcb' + +// 'mach' PowerPC Mach-O code descriptor. See struct below. +#define PIPowerPCMachOCodeProperty 'mach' + +// 'mi32' Intel 32 Mach-O code descriptor. See struct below. +#define PIMacIntel32Property 'mi32' + +// 'mi64' Intel 64 Mach-O code descriptor. See struct below. +#define PIMacIntel64Property 'mi64' + +// 'ma64' ARM 64 Mach-O code descriptor. See struct below. +#define PIMacARM64Property 'ma64' + +// 'frag' PowerPC fragment descriptor. See struct below. +#define PICodeFragmentProperty 'frag' + +// 'frgc' PowerPC CARBON fragment descriptor. See struct below. +#define PICarbonCodeFragmentProperty 'frgc' + +// '8664' Win32 Intel code descriptor. See struct below. +#define PIWin64X86CodeProperty (PIType)0x38363634L + +// 'wx86' Win32 Intel code descriptor. See struct below. +#define PIWin32X86CodeProperty (PIType)0x77783836L + +// \deprecated 'fx86' Win16 Intel code descriptor. See struct below. +#define PIWin16X86CodeProperty (PIType)0x66783836L + +/** Plug-in property. Properties contain information about + plug-in resource files, such as their type and location. */ +typedef struct PIProperty { + /** Vendor-specific identifier. */ + PIType vendorID; + /** Identification key for this resource type. */ + PIType propertyKey; + /** 0-based index of this resource within its type. + Must be unique for properties of a given type within + a property list. */ + SPInt32 propertyID; + /** Number of characters in the data array. Rounded to a multiple of 4. */ + SPInt32 propertyLength; + /** The property data array that contains the property value, a string of 4 characters. */ + char propertyData[1]; +} PIProperty; + +/** Plug-in property list. Provides the version number of the plug-in + property mechanism itself, and properties for the associated plug-in. + */ +typedef struct PIPropertyList { + /** Version number for the \c #PIProperty structure. */ + SPInt32 version; + /** Number of properties in the list. */ + SPInt32 count; + /** The properties array. */ + PIProperty properties[1]; +} PIPropertyList; + +/* Following structures describe resource file types used in plug-in property lists. + * These structures obey Macintosh 68k alignment and padding rules though + * generally they are laid out so fields have natural alignment and any + * needed padding is explicit in the structure. + */ + //<> + +/** 68k code descriptor. */ +typedef struct PI68KCodeDesc { + /** Property type key code. */ + PIType fType; + /** Property type unique identifier. */ + int16 fID; +} PI68KCodeDesc; + +/** PowerPC code descriptor. */ +typedef struct PICFMCodeDesc { + /** The offset within the data fork for the start of this plugin's + code fragment. This allows more than one code-fragment-based + plug-in per file. */ + SPInt32 fContainerOffset; + /** The length of this plug-in's code fragment. If this + is the only fragment in the file, the length is 0. */ + SPInt32 fContainerLength; + /** The entry-point name, used to look up the address of + the function to call within the fragment; allows a single code + fragment to export more than one plug-in. + + If the name is an empty string, the default entry point + for the code fragment is used. The entry-point name + must be an exported symbol of the code fragment. */ + unsigned char fEntryName[1]; +} PICFMCodeDesc; + +/** PowerPC Mach-O code descriptor. */ +typedef struct PIMachCodeDesc +{ + /** Property type key code <> */ + unsigned char fEntryName[1]; +} PIMachCodeDesc; + +// For 'mi32' PICodeMacIntel32Property: +// For 'mi64' PICodeMacIntel64Property: +typedef struct PIMacIntelMachCodeDesc +{ + unsigned char fEntryName[1]; +} PIMacIntelMachCodeDesc; + +typedef struct PIFragmentCodeDesc +{ + SPInt32 fFragmentResource; + SPInt32 fFramentNumber; + unsigned char fEntryName[1]; +} PIFragmentCodeDesc; + +/** The entry point name for 64 bit windows, used to lookup the function +which is called to invoke the plug-in. A \c NULL terminated string, padded +with additional \ NULL charcters if needed to satisfy the 4-byte alignment +requirement. See @ref PIWin64X86CodeProperty above. */ +typedef struct PIWin64X86CodeDesc +{ + char fEntryName[1]; +} PIWin64X86CodeDesc; + +/** The entry point name for 32 bit windows, used to lookup the function +which is called to invoke the plug-in. A \c NULL terminated string, padded +with additional \ NULL charcters if needed to satisfy the 4-byte alignment +requirement. See @ref PIWin32X86CodeProperty above. */ +typedef struct PIWin32X86CodeDesc { + char fEntryName[1]; +} PIWin32X86CodeDesc; + +/** \deprecated Win16 Intel code descriptor. +See @ref PIWin16X86CodeProperty above. */ +typedef struct PIWin16X86CodeDesc { + char fEntryName[1]; +} PIWin16X86CodeDesc; + +#endif // kGeneralPiPLPropertiesDefined + + +/******************************************************************************* + ** + ** Additional Types + ** + **/ + +/** CFM code descriptor */ +typedef struct PICFMCodeResourceDesc { + /** Not used. */ + SPInt32 fContainerOffset; /* Currently unused, reserved. */ + /** The length of this plug-in's code fragment. If this + is the only fragment in the file, the length is 0. */ + SPInt32 fContainerLength; + /** Resource type key code. <> */ + PIType fType; + /** Unique identifier for the resource within the type. <> */ + int16 fID; + /** The entry-point name, used to look up the address of + the function to call within the fragment; allows a single code + fragment to export more than one plug-in. + + If the name is an empty string, the default entry point + for the code fragment is used. The entry-point name + must be an exported symbol of the code fragment. */ + unsigned char fEntryName[1]; +} PICFMCodeResourceDesc; + +/*******************************************************************************/ + +#if PRAGMA_STRUCT_ALIGN +#pragma options align=reset +#endif + +#endif // SPPiPL diff --git a/External/AE SDK/Headers/SP/SPPlugs.h b/External/AE SDK/Headers/SP/SPPlugs.h new file mode 100644 index 00000000..7cbd83be --- /dev/null +++ b/External/AE SDK/Headers/SP/SPPlugs.h @@ -0,0 +1,631 @@ +/***********************************************************************/ +/* */ +/* SPPlugs.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPPlugins__ +#define __SPPlugins__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPFiles.h" +#include "SPAdapts.h" +#include "SPProps.h" +#include "SPStrngs.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** PICA plugins suite name */ +#define kSPPluginsSuite "SP Plug-ins Suite" +/** PICA plugins suite version */ +#define kSPPluginsSuiteVersion4 4 +/** PICA plugins suite version */ +#define kSPPluginsSuiteVersion5 5 +/** PICA plugins suite version */ +#define kSPPluginsSuiteVersion6 6 + +#define kSPPluginsSuiteVersion kSPPluginsSuiteVersion4 + +/** PICA global list of available plug-ins.. + @see \c #SPRuntimeSuite::GetRuntimePluginList(). */ +#define kSPRuntimePluginList ((SPPluginListRef)NULL) + + +/******************************************************************************* + ** + ** Types + ** + **/ + +/** Opaque reference to a plug-in object. Access with the \c #SPPluginsSuite. */ +typedef struct SPPlugin *SPPluginRef; +/** A list of plug-in objects. Create with + \c #SPPluginsSuite::AllocatePluginList(), or use + the global list, \c #kSPRuntimePluginList. */ +typedef struct SPPluginList *SPPluginListRef; +/** An iterator object for examining a plug-in list. + See \c #SPPluginsSuite::NewPluginListIterator(). */ +typedef struct SPPluginListIterator *SPPluginListIteratorRef; + +/** PICA file-access error */ +typedef struct _SPErrorData +{ + /** The file for which the error occurred. */ + SPPlatformFileSpecification mErrorFile; + /** Error code, see @ref Errors. */ + SPErr mErrorCode; +} SPErrorData, *SPErrorDataPtr; + +/** File-access error */ +typedef struct _SPXPlatErrorData +{ + /** The file for which the error occurred. */ + XPlatFileSpec mErrorFile; + /** Error code, see @ref Errors. */ + SPErr mErrorCode; +} SPXPlatErrorData, *SPXPlatErrorDataPtr; + +/** */ +typedef SPAPI SPErr (*SPPluginEntryFunc)( const char *caller, const char *selector, void *message ); + +/******************************************************************************* + ** + ** Suite + ** + **/ + +/** This suite allows you to access and manipulate the plug-in object for your own + and those of other plug-ins managed by the Adobe plug-in manager (PICA). + You can access both plug-ins provided with the application (\e host plug-ins), + and external plug-ins.You can query and set plug-in states, + including the "broken" state, which indicates that a plug-in has + become unavailable due to an error condition. + + You can also use this suite to create and use your own lists of plug-ins, + in addition to the global list kept by the application. + + For higher-level access to plug-ins, see \c #AIPluginSuite. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPPluginsSuite and \c #kSPPluginsSuiteVersion. + */ +typedef struct SPPluginsSuite { + + /** Creates a new plug-in list. You can also access PICA's global plug-in list, + using \c #SPRuntimeSuite::GetRuntimePluginList(). + @param stringPool The string pool in which to keep plug-in names. + @param pluginList [out] A buffer in which to return the new list object. + */ + SPAPI SPErr (*AllocatePluginList)( SPStringPoolRef strings, SPPluginListRef *pluginList ); + /** Frees a list of plug-ins allocated with \c #AllocatePluginList(), and + also frees any entries in the list. Do not free the global list (\c #kSPRuntimePluginList). + @param pluginList The plug-in list object. + */ + SPAPI SPErr (*FreePluginList)( SPPluginListRef pluginList ); + + /** Creates a new plug-in object and adds it to a plug-in list. + @param pluginList The plug-in list object, or \c NULL to use the + global list. + @param fileSpec The file specification for the plug-in code and resources. + @param PiPL The structure containing the plug-in properties. + @param adapterName The unique identifiying name of the adapter for the new plug-in. + @param adapterInfo A pointer to the adapter-defined structure that stores needed + information about this plug-in. + @param plugin [out] A buffer in which to return the new plug-in object. + @see \c #AllocatePluginList(), \c #SPAdaptersSuite + */ + SPAPI SPErr (*AddPlugin)( SPPluginListRef pluginList, const SPPlatformFileSpecification *fileSpec, + PIPropertyList *PiPL, const char *adapterName, void *adapterInfo, SPPluginRef *plugin ); + + /** Creates an iterator object with which to traverse a plug-in list. + The iterator is initially set to the first plug-in in the list. + @param pluginList The plug-in list object, or \c NULL to use the + global list. + @param iter [out] A buffer in which to return the new iterator object. + @see \c #NextPlugin(), \c #DeletePluginListIterator() + */ + SPAPI SPErr (*NewPluginListIterator)( SPPluginListRef pluginList, SPPluginListIteratorRef *iter ); + /** Retrieves the current plug-in and advances a plug-in-list iterator to the next plug-in in the list. + @param iter The plug-in-list iterator object. + @param plugin [out] A buffer in which to return the current plug-in object, \c NULL + if the end of the list has been reached. + @see \c #NewPluginListIterator(), + */ + SPAPI SPErr (*NextPlugin)( SPPluginListIteratorRef iter, SPPluginRef *plugin ); + /** Frees a plug-in-list iterator that is no longer needed. + @param iter The plug-in-list iterator object. + @see \c #NewPluginListIterator(), + */ + SPAPI SPErr (*DeletePluginListIterator)( SPPluginListIteratorRef iter ); + /** Reports whether a plug-in that is needed <> is + available in a plug-in list. + @param pluginList The plug-in list object, or \c NULL to use the global list. + @param available [out] A buffer in which to return true if the plug-in <> + is found in the list. + @see \c #SPInterfaceSuite::StartupExport() + */ + SPAPI SPErr (*GetPluginListNeededSuiteAvailable)( SPPluginListRef pluginList, SPBoolean *available ); + + /** Retrieves <> for a plug-in provided by the application. <> + @param plugin The plug-in object. + @param host A pointer to the callback procedure. <> + */ + SPAPI SPErr (*GetPluginHostEntry)( SPPluginRef plugin, SPPluginEntryFunc *hostEntry ); + /** Retrieves the code and resources file of a plug-in. + @param plugin The plug-in object. + @param fileSpec [out] A buffer in which to return the file specification. + @see \c #SPFilesSuite + */ + SPAPI SPErr (*GetPluginFileSpecification)( SPPluginRef plugin, SPPlatformFileSpecification *fileSpec ); + /** Retrieves the property list of a plug-in. + @param plugin The plug-in object. + @param propertList [out] A buffer in which to return the property list object. + @see \c #SPPropertiesSuite + */ + SPAPI SPErr (*GetPluginPropertyList)( SPPluginRef plugin, SPPropertyListRef *propertList ); + /** Retrieves the global variables of a plug-in. This is the same value passed in messages + to the plug-in, which PICA stores when the plug-in is unloaded. + @param plugin The plug-in object. + @param globals [out] A buffer in which to return a pointer to the global variable array. + */ + SPAPI SPErr (*GetPluginGlobals)( SPPluginRef plugin, void **globals ); + /** Sets the global variables for a plug-in. This is the same value passed in messages + to the plug-in, which PICA stores when the plug-in is unloaded. + @param plugin The plug-in object. + @param globals The new global variable array. + */ + SPAPI SPErr (*SetPluginGlobals)( SPPluginRef plugin, void *globals ); + /** Reports whether a plug-in has received and returned from the interface start-up message. + @param plugin The plug-in object. + @param started [out] A buffer in which to return true (non-zero) if the plug-in has been started, + false (0) otherwise. + */ + SPAPI SPErr (*GetPluginStarted)( SPPluginRef plugin, int32 *started ); + /** Sets whether a plug-in has received and returned from the interface start-up message. + @param plugin The plug-in object. + @param started True (non-zero) if the plug-in has been started, false (0) otherwise. + */ + SPAPI SPErr (*SetPluginStarted)( SPPluginRef plugin, int32 started ); + /** Reports whether a plug-in is instructed to skip the start-up message. + @param plugin The plug-in object. + @param skipShutdown [out] A buffer in which to return true (non-zero) if the plug-in skips + the start-up message, false (0) otherwise. + */ + SPAPI SPErr (*GetPluginSkipShutdown)( SPPluginRef plugin, int32 *skipShutdown ); + /** Instructs a plug-in to respond or not to respond to the start-up message. + @param plugin The plug-in object. + @param skipShutdown True (non-zero) to skip the start-up message, false (0) + to respond normally to the start-up message. + */ + SPAPI SPErr (*SetPluginSkipShutdown)( SPPluginRef plugin, int32 skipShutdown ); + /** Reports whether a plug-in has reported an error condition that makes it unavailable. + @param plugin The plug-in object. + @param broken [out] A buffer in which to return true (non-zero) if + the plug-in is marked as broken, false (0) otherwise. + */ + SPAPI SPErr (*GetPluginBroken)( SPPluginRef plugin, int32 *broken ); + /** Sets or clears the broken flag that marks a plug-in as unavailable due to an + error condition. + @param plugin The plug-in object. + @param broken True (non-zero) to mark the plug-in as broken, false (0) + to clear the broken flag. + */ + SPAPI SPErr (*SetPluginBroken)( SPPluginRef plugin, int32 broken ); + /** Retrieves the adapter for a plug-in. + @param plugin The plug-in object. + @param adapter [out] A buffer in which to return the adapter object. + @see \c #SPAdaptersSuite + */ + SPAPI SPErr (*GetPluginAdapter)( SPPluginRef plugin, SPAdapterRef *adapter ); + /** Retrieves the adapter-specific information for a plug-in. Typically + used only by the adapter that defined the information. Other plug-ins + should use \c #AIPluginSuite::GetPluginOptions(). + @param plugin The plug-in object. + @param adapterInfo [out] A buffer in which to return a pointer to the adapter-defined + information structure. + @see \c #SPAdaptersSuite + */ + SPAPI SPErr (*GetPluginAdapterInfo)( SPPluginRef plugin, void **adapterInfo ); + /** Sets the adapter-specific information for a plug-in. Typically + used only by the adapter that defined the information. Other plug-ins + should use \c #AIPluginSuite::SetPluginOptions(). + @param plugin The plug-in object. + @param adapterInfo The adapter-defined information structure. + @see \c #SPAdaptersSuite + */ + SPAPI SPErr (*SetPluginAdapterInfo)( SPPluginRef plugin, void *adapterInfo ); + + /** Retrieves a specific property from the property list for a plug-in. If + the property is not found in the list, sends the plug-in the + \c #kSPPropertiesAcquireSelector message. The plug-in can ignore the + message, or it can create and return the requested property. In either + case, this function adds the (possibly \c NULL) property to the list + and returns it. + @param plugin The plug-in object. + @param vendorID The property vendor ID code. + @param propetyKey The property type key code. + @param propertyID The specific property identifier. + @param p [out] A buffer in which to return a pointer to the property object. + @see \c #SPPropertiesSuite + */ + SPAPI SPErr (*FindPluginProperty)( SPPluginRef plugin, PIType vendorID, PIType propertyKey, int32 propertyID, PIProperty **p ); + + /** Retrieves the name of a plug-in. + @param plugin The plug-in object. + @param name [out] A buffer in which to return the name string. + */ + SPAPI SPErr (*GetPluginName)( SPPluginRef plugin, const char **name ); + /** Sets the name of a plug-in. + @param plugin The plug-in object. + @param name The new name string. + */ + SPAPI SPErr (*SetPluginName)( SPPluginRef plugin, const char *name ); + /** Retrieves a plug-in by name. + @param name The name string. + @param plugin [out] A buffer in which to return the plug-in object. + */ + SPAPI SPErr (*GetNamedPlugin)( const char *name, SPPluginRef *plugin); + + /** Sets the property list for a plug-in. + @param plugin The plug-in object. + @param file The file containing the property list. <> + */ + SPAPI SPErr (*SetPluginPropertyList)( SPPluginRef plugin, SPFileRef file ); + + // Plug-ins suite version 5 + /* This attribute frees the adapterInfo field for private data for adapters. + <> */ + /** Retrieves host information for a plug-in. <> + @param plugin The plug-in object. + @param hostInfo [out] A buffer in which to return a pointer to the + host information structure. + */ + SPAPI SPErr (*GetPluginHostInfo)( SPPluginRef plugin, void **hostInfo ); + /** Sets host information for a plug-in. <> + @param plugin The plug-in object. + @param hostInfo The new host information structure. + */ + SPAPI SPErr (*SetPluginHostInfo)( SPPluginRef plugin, void *hostInfo ); + +} SPPluginsSuite; + + + +/******************************************************************************* + ** + ** Suite + ** + **/ + +/** This suite allows you to access and manipulate the plug-in object but uses + the XPlatFileSpec rather than the SPPlatformFileSpecification as in previous + versions. + + For higher-level access to plug-ins, see \c #AIPluginSuite. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPPluginsSuite and \c #kSPPluginsSuiteVersion6. + */ +typedef struct SPXPlatPluginsSuite { + + /** Creates a new plug-in list. You can also access PICA's global plug-in list, + using \c #SPRuntimeSuite::GetRuntimePluginList(). + @param stringPool The string pool in which to keep plug-in names. + @param pluginList [out] A buffer in which to return the new list object. + */ + SPAPI SPErr (*AllocatePluginList)( SPStringPoolRef strings, SPPluginListRef *pluginList ); + /** Frees a list of plug-ins allocated with \c #AllocatePluginList(), and + also frees any entries in the list. Do not free the global list (\c #kSPRuntimePluginList). + @param pluginList The plug-in list object. + */ + SPAPI SPErr (*FreePluginList)( SPPluginListRef pluginList ); + + /** Creates a new plug-in object and adds it to a plug-in list. + @param pluginList The plug-in list object, or \c NULL to use the + global list. + @param fileSpec The file specification for the plug-in code and resources. + @param PiPL The structure containing the plug-in properties. + @param adapterName The unique identifiying name of the adapter for the new plug-in. + @param adapterInfo A pointer to the adapter-defined structure that stores needed + information about this plug-in. + @param plugin [out] A buffer in which to return the new plug-in object. + @see \c #AllocatePluginList(), \c #SPAdaptersSuite + */ + SPAPI SPErr (*AddXPlatPlugin)( SPPluginListRef pluginList, const XPlatFileSpec *fileSpec, + PIPropertyList *PiPL, const char *adapterName, void *adapterInfo, SPPluginRef *plugin ); + + /** Creates an iterator object with which to traverse a plug-in list. + The iterator is initially set to the first plug-in in the list. + @param pluginList The plug-in list object, or \c NULL to use the + global list. + @param iter [out] A buffer in which to return the new iterator object. + @see \c #NextPlugin(), \c #DeletePluginListIterator() + */ + SPAPI SPErr (*NewPluginListIterator)( SPPluginListRef pluginList, SPPluginListIteratorRef *iter ); + /** Retrieves the current plug-in and advances a plug-in-list iterator to the next plug-in in the list. + @param iter The plug-in-list iterator object. + @param plugin [out] A buffer in which to return the current plug-in object, \c NULL + if the end of the list has been reached. + @see \c #NewPluginListIterator(), + */ + SPAPI SPErr (*NextPlugin)( SPPluginListIteratorRef iter, SPPluginRef *plugin ); + /** Frees a plug-in-list iterator that is no longer needed. + @param iter The plug-in-list iterator object. + @see \c #NewPluginListIterator(), + */ + SPAPI SPErr (*DeletePluginListIterator)( SPPluginListIteratorRef iter ); + /** Reports whether a plug-in that is needed <> is + available in a plug-in list. + @param pluginList The plug-in list object, or \c NULL to use the global list. + @param available [out] A buffer in which to return true if the plug-in <> + is found in the list. + @see \c #SPInterfaceSuite::StartupExport() + */ + SPAPI SPErr (*GetPluginListNeededSuiteAvailable)( SPPluginListRef pluginList, SPBoolean *available ); + + /** Retrieves <> for a plug-in provided by the application. <> + @param plugin The plug-in object. + @param host A pointer to the callback procedure. <> + */ + SPAPI SPErr (*GetPluginHostEntry)( SPPluginRef plugin, SPPluginEntryFunc *hostEntry ); + /** Retrieves the code and resources file of a plug-in. + @param plugin The plug-in object. + @param fileSpec [out] A buffer in which to return the file specification. + @see \c #SPFilesSuite + */ + SPAPI SPErr (*GetPluginXplatFileSpec)( SPPluginRef plugin, XPlatFileSpec *fileSpec ); + /** Retrieves the property list of a plug-in. + @param plugin The plug-in object. + @param propertList [out] A buffer in which to return the property list object. + @see \c #SPPropertiesSuite + */ + SPAPI SPErr (*GetPluginPropertyList)( SPPluginRef plugin, SPPropertyListRef *propertList ); + /** Retrieves the global variables of a plug-in. This is the same value passed in messages + to the plug-in, which PICA stores when the plug-in is unloaded. + @param plugin The plug-in object. + @param globals [out] A buffer in which to return a pointer to the global variable array. + */ + SPAPI SPErr (*GetPluginGlobals)( SPPluginRef plugin, void **globals ); + /** Sets the global variables for a plug-in. This is the same value passed in messages + to the plug-in, which PICA stores when the plug-in is unloaded. + @param plugin The plug-in object. + @param globals The new global variable array. + */ + SPAPI SPErr (*SetPluginGlobals)( SPPluginRef plugin, void *globals ); + /** Reports whether a plug-in has received and returned from the interface start-up message. + @param plugin The plug-in object. + @param started [out] A buffer in which to return true (non-zero) if the plug-in has been started, + false (0) otherwise. + */ + SPAPI SPErr (*GetPluginStarted)( SPPluginRef plugin, int32 *started ); + /** Sets whether a plug-in has received and returned from the interface start-up message. + @param plugin The plug-in object. + @param started True (non-zero) if the plug-in has been started, false (0) otherwise. + */ + SPAPI SPErr (*SetPluginStarted)( SPPluginRef plugin, int32 started ); + /** Reports whether a plug-in is instructed to skip the start-up message. + @param plugin The plug-in object. + @param skipShutdown [out] A buffer in which to return true (non-zero) if the plug-in skips + the start-up message, false (0) otherwise. + */ + SPAPI SPErr (*GetPluginSkipShutdown)( SPPluginRef plugin, int32 *skipShutdown ); + /** Instructs a plug-in to respond or not to respond to the start-up message. + @param plugin The plug-in object. + @param skipShutdown True (non-zero) to skip the start-up message, false (0) + to respond normally to the start-up message. + */ + SPAPI SPErr (*SetPluginSkipShutdown)( SPPluginRef plugin, int32 skipShutdown ); + /** Reports whether a plug-in has reported an error condition that makes it unavailable. + @param plugin The plug-in object. + @param broken [out] A buffer in which to return true (non-zero) if + the plug-in is marked as broken, false (0) otherwise. + */ + SPAPI SPErr (*GetPluginBroken)( SPPluginRef plugin, int32 *broken ); + /** Sets or clears the broken flag that marks a plug-in as unavailable due to an + error condition. + @param plugin The plug-in object. + @param broken True (non-zero) to mark the plug-in as broken, false (0) + to clear the broken flag. + */ + SPAPI SPErr (*SetPluginBroken)( SPPluginRef plugin, int32 broken ); + /** Retrieves the adapter for a plug-in. + @param plugin The plug-in object. + @param adapter [out] A buffer in which to return the adapter object. + @see \c #SPAdaptersSuite + */ + SPAPI SPErr (*GetPluginAdapter)( SPPluginRef plugin, SPAdapterRef *adapter ); + /** Retrieves the adapter-specific information for a plug-in. Typically + used only by the adapter that defined the information. Other plug-ins + should use \c #AIPluginSuite::GetPluginOptions(). + @param plugin The plug-in object. + @param adapterInfo [out] A buffer in which to return a pointer to the adapter-defined + information structure. + @see \c #SPAdaptersSuite + */ + SPAPI SPErr (*GetPluginAdapterInfo)( SPPluginRef plugin, void **adapterInfo ); + /** Sets the adapter-specific information for a plug-in. Typically + used only by the adapter that defined the information. Other plug-ins + should use \c #AIPluginSuite::SetPluginOptions(). + @param plugin The plug-in object. + @param adapterInfo The adapter-defined information structure. + @see \c #SPAdaptersSuite + */ + SPAPI SPErr (*SetPluginAdapterInfo)( SPPluginRef plugin, void *adapterInfo ); + + /** Retrieves a specific property from the property list for a plug-in. If + the property is not found in the list, sends the plug-in the + \c #kSPPropertiesAcquireSelector message. The plug-in can ignore the + message, or it can create and return the requested property. In either + case, this function adds the (possibly \c NULL) property to the list + and returns it. + @param plugin The plug-in object. + @param vendorID The property vendor ID code. + @param propetyKey The property type key code. + @param propertyID The specific property identifier. + @param p [out] A buffer in which to return a pointer to the property object. + @see \c #SPPropertiesSuite + */ + SPAPI SPErr (*FindPluginProperty)( SPPluginRef plugin, PIType vendorID, PIType propertyKey, int32 propertyID, PIProperty **p ); + + /** Retrieves the name of a plug-in. + @param plugin The plug-in object. + @param name [out] A buffer in which to return the name string. + */ + SPAPI SPErr (*GetPluginName)( SPPluginRef plugin, const char **name ); + /** Sets the name of a plug-in. + @param plugin The plug-in object. + @param name The new name string. + */ + SPAPI SPErr (*SetPluginName)( SPPluginRef plugin, const char *name ); + /** Retrieves a plug-in by name. + @param name The name string. + @param plugin [out] A buffer in which to return the plug-in object. + */ + SPAPI SPErr (*GetNamedPlugin)( const char *name, SPPluginRef *plugin); + + /** Sets the property list for a plug-in. + @param plugin The plug-in object. + @param file The file containing the property list. <> + */ + SPAPI SPErr (*SetPluginPropertyList)( SPPluginRef plugin, SPFileRef file ); + + // Plug-ins suite version 5 + /* This attribute frees the adapterInfo field for private data for adapters. + <> */ + /** Retrieves host information for a plug-in. <> + @param plugin The plug-in object. + @param hostInfo [out] A buffer in which to return a pointer to the + host information structure. + */ + SPAPI SPErr (*GetPluginHostInfo)( SPPluginRef plugin, void **hostInfo ); + /** Sets host information for a plug-in. <> + @param plugin The plug-in object. + @param hostInfo The new host information structure. + */ + SPAPI SPErr (*SetPluginHostInfo)( SPPluginRef plugin, void *hostInfo ); + +} SPXPlatPluginsSuite; + + +/** Internal */ +SPAPI SPErr SPAllocatePluginList( SPStringPoolRef strings, SPPluginListRef *pluginList ); +/** Internal */ +SPAPI SPErr SPFreePluginList( SPPluginListRef pluginList ); +/** Internal */ +SPAPI SPErr SPGetPluginListNeededSuiteAvailable( SPPluginListRef pluginList, SPBoolean *available ); + +/** Internal */ +SPAPI SPErr SPAddPlugin( SPPluginListRef pluginList, const SPPlatformFileSpecification *fileSpec, + PIPropertyList *PiPL, const char *adapterName, void *adapterInfo, SPPluginRef *plugin ); + +/** Internal */ +SPAPI SPErr SPAddXPlatPlugin( SPPluginListRef pluginList, const XPlatFileSpec *fileSpec, + PIPropertyList *PiPL, const char *adapterName, void *adapterInfo, SPPluginRef *plugin ); + +/** Internal */ +SPAPI SPErr SPNewPluginListIterator( SPPluginListRef pluginList, SPPluginListIteratorRef *iter ); +/** Internal */ +SPAPI SPErr SPNextPlugin( SPPluginListIteratorRef iter, SPPluginRef *plugin ); +/** Internal */ +SPAPI SPErr SPDeletePluginListIterator( SPPluginListIteratorRef iter ); + +/** Internal */ +SPAPI SPErr SPGetHostPluginEntry( SPPluginRef plugin, SPPluginEntryFunc *hostEntry ); +/** Internal */ +SPAPI SPErr SPGetPluginFileSpecification( SPPluginRef plugin, SPPlatformFileSpecification *fileSpec ); +/** Internal */ +SPAPI SPErr SPGetPluginXplatFileSpec( SPPluginRef plugin, XPlatFileSpec *fileSpec ); +/** Internal */ +SPAPI SPErr SPGetPluginPropertyList( SPPluginRef plugin, SPPropertyListRef *propertyList ); +/** Internal */ +SPAPI SPErr SPGetPluginGlobals( SPPluginRef plugin, void **globals ); +/** Internal */ +SPAPI SPErr SPSetPluginGlobals( SPPluginRef plugin, void *globals ); +/** Internal */ +SPAPI SPErr SPGetPluginStarted( SPPluginRef plugin, int32 *started ); +/** Internal */ +SPAPI SPErr SPSetPluginStarted( SPPluginRef plugin, int32 started ); +/** Internal */ +SPAPI SPErr SPGetPluginSkipShutdown( SPPluginRef plugin, int32 *skipShutdown ); +/** Internal */ +SPAPI SPErr SPSetPluginSkipShutdown( SPPluginRef plugin, int32 skipShutdown ); +/** Internal */ +SPAPI SPErr SPGetPluginBroken( SPPluginRef plugin, int32 *broken ); +/** Internal */ +SPAPI SPErr SPSetPluginBroken( SPPluginRef plugin, int32 broken ); +/** Internal */ +SPAPI SPErr SPGetPluginAdapter( SPPluginRef plugin, SPAdapterRef *adapter ); +/** Internal */ +SPAPI SPErr SPGetPluginAdapterInfo( SPPluginRef plugin, void **adapterInfo ); +/** Internal */ +SPAPI SPErr SPSetPluginAdapterInfo( SPPluginRef plugin, void *adapterInfo ); + +/** Internal */ +SPAPI SPErr SPFindPluginProperty( SPPluginRef plugin, PIType vendorID, PIType propertyKey, + int32 propertyID, PIProperty **p ); + +/** Internal */ +SPAPI SPErr SPGetPluginName( SPPluginRef plugin, const char **name ); +/** Internal */ +SPAPI SPErr SPSetPluginName( SPPluginRef plugin, const char *name ); +/** Internal */ +SPAPI SPErr SPGetNamedPlugin( const char *name, SPPluginRef *plugin); + +/** Internal */ +SPAPI SPErr SPSetPluginPropertyList( SPPluginRef plugin, SPFileRef file ); + +/** Internal */ +SPErr SPAddHostPlugin( SPPluginListRef pluginList, SPPluginEntryFunc entry, void *access, const char *adapterName, + void *adapterInfo, SPPluginRef *plugin, const char *name); + /* access is SPPlatformAccessRef */ + + +// Plug-ins suite version 5 +/* This attribute frees the adapterInfo field for private data for adapters. */ +/** Internal */ +SPAPI SPErr SPGetPluginHostInfo( SPPluginRef plugin, void **hostInfo ); +/** Internal */ +SPAPI SPErr SPSetPluginHostInfo( SPPluginRef plugin, void *hostInfo ); + + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPProps.h b/External/AE SDK/Headers/SP/SPProps.h new file mode 100644 index 00000000..748c7ba7 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPProps.h @@ -0,0 +1,316 @@ +/***********************************************************************/ +/* */ +/* SPProps.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPProperties__ +#define __SPProperties__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPMData.h" +#include "SPPiPL.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ + +/** PICA properties suite name */ +#define kSPPropertiesSuite "SP Properties Suite" +/** PICA properties suite version */ +#define kSPPropertiesSuiteVersion2 2 +/** PICA properties suite version */ +#define kSPPropertiesSuiteVersion kSPPropertiesSuiteVersion2 // minimal is default +/** PICA properties suite version */ +#define kSPPropertiesSuiteVersion3 3 + +/** @ingroup Callers + PICA plug-in property operation; sent with \c #SPPropertiesMessage. + See \c #SPPropertiesSuite. */ +#define kSPPropertiesCaller "SP Properties" +/** @ingroup Selectors + Acquire PICA plug-in properties; sent with \c #SPPropertiesMessage. + See \c #SPPropertiesSuite.*/ +#define kSPPropertiesAcquireSelector "Acquire" +/** @ingroup Selectors + Release PICA plug-in properties; sent with \c #SPPropertiesMessage. + See \c #SPPropertiesSuite.*/ +#define kSPPropertiesReleaseSelector "Release" + + +/******************************************************************************* + ** + ** Types + ** + **/ +/** An opaque reference to a plug-in property. Access with the \c #SPPropertiesSuite. */ +typedef struct SPProperty *SPPropertyRef; +/** An opaque reference to a plug-in property list. Create and access with the \c #SPPropertiesSuite. */ +typedef struct SPPropertyList *SPPropertyListRef; +/** An opaque reference to an iterator for a plug-in property list. Create and access with the \c #SPPropertiesSuite. */ +typedef struct SPPropertyListIterator *SPPropertyListIteratorRef; + +/** Message passed with the \c #kSPPropertiesCaller. */ +typedef struct SPPropertiesMessage { + /** The message data. */ + SPMessageData d; + + /** Unique identifier for the vendor defining this property type. This allows + you to define your own properties in a way that + does not conflict with either Adobe or other vendors. + Use a registered application creator code to ensure uniqueness. + All PICA properties use \c #PIAdobeVendorID.*/ + PIType vendorID; + /** The property type key code, typically identifies a resource type. */ + PIType propertyKey; + /** The unique property identifier, for multiple resources of a given + type. Normally, there is only one, and the ID value is 0. */ + int32 propertyID; + + /** A structure containing the property data, or value. */ + void *property; + /** Reference count. Increment when a property is acquired, decrement + when it is released. */ + int32 refCon; + /** True (non-zero) if this property does not change betweeen sessions + and can be cached by the application in the start-up preferences + file, false (0) otherwise. Typically true. */ + int32 cacheable; + +} SPPropertiesMessage; + + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + Use these functions to create, access, and manage plug-in property lists + associated with a specific plug-in. Plug-in properties provide the + application with resource information for the plug-in, such as the types + and locations of code files, and the plug-in version. + + A plug-in can be associated with multiple properties lists. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPPropertiesSuite and \c #kSPPropertiesSuiteVersion. + */ +typedef struct SPPropertiesSuite { + + /** Creates a new plug-in property list. + @param stringPool The string pool in which to keep plug-in names. + @param propertyList [out] A buffer in which to return the new list object. + */ + SPAPI SPErr (*AllocatePropertyList)( SPPropertyListRef *propertyList ); + /** Frees a list of plug-in properties allocated with \c #AllocatePropertyList(), and + also frees any entries in the list. If the list is one of a chain, frees the + entire chain. + @param propertyList The plug-in properties list object. + @see \c #SPHasMultiplePropertyLists() + */ + SPAPI SPErr (*FreePropertyList)( SPPropertyListRef propertyList ); + + /** Adds a set of properties to a plug-in properties list. This set is typically + read from a resource file.Creates an \c #SPPropertyRef for each property, + but does not return these objects. + @param propertyList The plug-in properties list object. + @param pList A pointer to the low-level structure for the set of properties to add. + @param refCon The initial reference count for properties in the set. + @param cacheable True (non-zero) if these properties do not change betweeen sessions + and can be cached by the application in the start-up preferences + file, false (0) otherwise. Typically true. + @see \c #AddProperty() + */ + SPAPI SPErr (*AddProperties)( SPPropertyListRef propertyList, PIPropertyList *pList, int32 refCon, int32 cacheable ); + + /** Creates a new individual property and adds it to a plug-in properties list. + Typically called to install a property returned from an \c #kSPPropertiesAcquireSelector message. + @param propertyList The plug-in properties list object. + @param vendorID The vendor identifier for the new property. + @param propertyKey The type key code for the new property. + @param propertyID The unique identifier for the individual property (normally 0). + @param p A pointer to the property value structure. + <> + @param refCon The initial reference count for property. + @param cacheable True (non-zero) if this property does not change betweeen sessions + and can be cached by the application in the start-up preferences + file, false (0) otherwise. Typically true. + @param property [out] A buffer in which to return the new property object. + @see \c #AllocatePropertyList(), \c #AddProperties() + */ + SPAPI SPErr (*AddProperty)( SPPropertyListRef propertyList, PIType vendorID, PIType propertyKey, int32 propertyID, PIProperty *p, + int32 refCon, int32 cacheable, SPPropertyRef *property ); + + /** Retrieves a property from a plug-in properties list, or from any list in its chain. + @param propertyList The plug-in properties list object. + @param vendorID The vendor identifier for the new property. + @param propertyKey The type key code for the new property. + @param propertyID The unique identifier for the individual property (normally 0). + @param property [out] A buffer in which to return the property object, or \c NULL if a + matching property is not found. + @param \c #FindPropertyLocal() + */ + SPAPI SPErr (*FindProperty)( SPPropertyListRef propertyList, PIType vendorID, PIType propertyKey, int32 propertyID, SPPropertyRef *property ); + + /** Creates an iterator object with which to traverse a plug-in properties list. + The iterator is initially set to the first property in the list. + @param propertyList The plug-in properties list object. + @param iter [out] A buffer in which to return the new iterator object. + @see \c #NextProperty(), \c #DeletePropertyListIterator() + */ + SPAPI SPErr (*NewPropertyListIterator)( SPPropertyListRef propertyList, SPPropertyListIteratorRef *iter ); + /** Retrieves the current property and advances a plug-in properties list iterator + to the next property in the list. + @param iter The plug-in properties list iterator object. + @param property [out] A buffer in which to return the current property object, \c NULL + if the end of the list has been reached. + @see \c #NewPropertyListIterator(), + */ + SPAPI SPErr (*NextProperty)( SPPropertyListIteratorRef iter, SPPropertyRef *property ); + /** Frees a plug-in properties list iterator that is no longer needed. + @param iter The plug-in properties list iterator object. + @see \c #NewPropertyListIterator(), + */ + SPAPI SPErr (*DeletePropertyListIterator)( SPPropertyListIteratorRef iter ); + + /** Retrieves the low-level property structure of a property object. + @param property The property object. + @param p [out] A buffer in which to return a pointer to the property structure. + */ + SPAPI SPErr (*GetPropertyPIProperty)( SPPropertyRef property, PIProperty **p ); + /** Retrieves the current reference count of a property. + @param property The property object. + @param refCon [out] A buffer in which to return the reference count. + */ + SPAPI SPErr (*GetPropertyRefCon)( SPPropertyRef property, int32 *refCon ); + /** Reports whether a property is cacheable. + @param property The property object. + @param cacheable [out] A buffer in which to return true (non-zero) + if this property does not change betweeen sessions + and can be cached by the application in the start-up preferences + file, false (0) otherwise. + */ + SPAPI SPErr (*GetPropertyCacheable)( SPPropertyRef property, int32 *cacheable ); + /** Reports whether a property was allocated by the plug-in that contains it. + @param property The property object. + @param allocatedByPlugin [out] A buffer in which to return true (non-zero) + if this property was created after being acquired from a + \c #kSPPropertiesAcquireSelector message, false (0) if the + property was read from a resource file. + @see \c #AddProperty(), \c #AddProperties() + */ + SPAPI SPErr (*GetPropertyAllocatedByPlugin)( SPPropertyRef property, int32 *allocatedByPlugin ); + + // kSPPropertiesSuiteVersion3 + /** Reports whether a plug-in properties list is one of a chain of properties lists for its plug-in. + (Note that this function returns a boolean value, not an error code.) + @param propertyList The plug-in properties list object. + @return True (non-zero) if the list is one of a chain, false (0) otherwise. + @see \c #GetNextPropertyList() + */ + SPAPI SPBoolean (*SPHasMultiplePropertyLists)(SPPropertyListRef propertyList); + /** Retrieves the next plug-in properties list in a properties-list chain. + @param propertyList The current plug-in properties list object. + @param nextPropertyList [out] A buffer in which to return the next properties list object, + or \c NULL if the end of the chain has been reached. + */ + SPAPI SPErr (*GetNextPropertyList)(SPPropertyListRef propertyList, SPPropertyListRef *nextPropertyList); + /** Retrieves a property from a plug-in properties list, but does not search in other + lists in the chain. + @param propertyList The plug-in properties list object. + @param vendorID The vendor identifier for the new property. + @param propertyKey The type key code for the new property. + @param propertyID The unique identifier for the individual property (normally 0). + @param property [out] A buffer in which to return the property object, or \c NULL if a + matching property is not found. + @see \c #FindProperty() + */ + SPAPI SPErr (*FindPropertyLocal)( SPPropertyListRef propertyList, PIType vendorID, PIType propertyKey, + int32 propertyID, SPPropertyRef *property ); + +} SPPropertiesSuite; + + +/** Internal */ +SPAPI SPErr SPAllocatePropertyList( SPPropertyListRef *propertyList ); +/** Internal */ +SPAPI SPErr SPFreePropertyList( SPPropertyListRef propertyList ); + +/** Internal */ +SPAPI SPErr SPAddProperties( SPPropertyListRef propertyList, PIPropertyList *pList, int32 refCon, + int32 cacheable ); + +/** Internal */ +SPAPI SPErr SPAddProperty( SPPropertyListRef propertyList, PIType vendorID, PIType propertyKey, + int32 propertyID, PIProperty *p, int32 refCon, int32 cacheable, SPPropertyRef *property ); + +/** Internal */ +SPAPI SPErr SPFindProperty( SPPropertyListRef propertyList, PIType vendorID, PIType propertyKey, + int32 propertyID, SPPropertyRef *property ); + +/** Internal */ +SPAPI SPErr SPNewPropertyListIterator( SPPropertyListRef propertyList, SPPropertyListIteratorRef *iter ); +/** Internal */ +SPAPI SPErr SPNextProperty( SPPropertyListIteratorRef iter, SPPropertyRef *property ); +/** Internal */ +SPAPI SPErr SPDeletePropertyListIterator( SPPropertyListIteratorRef iter ); + +/** Internal */ +SPAPI SPErr SPGetPropertyPIProperty( SPPropertyRef property, PIProperty **p ); +/** Internal */ +SPAPI SPErr SPGetPropertyRefCon( SPPropertyRef property, int32 *refCon ); +/** Internal */ +SPAPI SPErr SPGetPropertyCacheable( SPPropertyRef property, int32 *cacheable ); +/** Internal */ +SPAPI SPErr SPGetPropertyAllocatedByPlugin( SPPropertyRef property, int32 *allocatedByPlugin ); + +/** Internal */ +SPAPI SPBoolean SPHasMultiplePropertyLists(SPPropertyListRef propertyList); +/** Internal */ +SPAPI SPErr SPGetNextPropertyList(SPPropertyListRef propertyList, SPPropertyListRef *nextPropertyList); + +/** Internal */ +SPAPI SPErr SPFindPropertyLocal( SPPropertyListRef propertyList, PIType vendorID, + PIType propertyKey, int32 propertyID, SPPropertyRef *property ); + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPRuntme.h b/External/AE SDK/Headers/SP/SPRuntme.h new file mode 100644 index 00000000..8f6f6aa6 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPRuntme.h @@ -0,0 +1,500 @@ +/***********************************************************************/ +/* */ +/* SPRuntme.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPRuntime__ +#define __SPRuntime__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPAdapts.h" +#include "SPFiles.h" +#include "SPPlugs.h" +#include "SPStrngs.h" +#include "SPSuites.h" +#include "SPStrngs.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ + +#define kSPRuntimeSuite "SP Runtime Suite" +#define kSPRuntimeSuiteVersion 5 +#define kSPRuntimeSuiteXPlatVersion 6 + + +/******************************************************************************* + ** + ** Types + ** + **/ + +/* INTERNAL DOCS + * PICA makes callbacks into the host through the host procs. The host + * procs are filled in by the host and passed to Sweet Pea at SPInit(). + * + * hostData - data that is given back to each host proc when Sweet Pea + * calls it. Sweet Pea does nothing with it itself. + * + * extAllocate - implementation of the Block Suite's AllocateBlock() routine. + * It is identical to ANSI C malloc(). It returns a pointer to the + * beginning of the allocated block or NULL. + * + * extFree - implementation of the Block Suite's FreeBlock() routine. It is + * identical to ANSI C free(). Note that you can pass it NULL. + * + * extReallocate - implementation of the Block Suite's ReallocateBlock() + * routine. It is identical to ANSI C realloc(). It returns a pointer + * to the resized block or NULL. Note that you can pass it NULL or a + * newSize of 0. + * + * intAllocate, intFree, intReallocate - routines used by Sweet Pea for + * its own memory needs. You may want to allocate blocks differently + * with plug-ins and Sweet Pea. Plug-ins are unbounded in their memory + * needs, while Sweet Pea's memory usage can be approximated. + * + * startupNotify - called as each plug-in is started up. This is intended + * as a way to tell the user what's happening during start up. + * Note that plug-ins may start up at any time, not just during + * SPStartupPlugins(). + * + * shutdownNotify - called as each plug-in is shut down. Also intended as + * a way to let users know what's going on. + * + * assertTrap - called when a fatal assert is triggered. Sweet Pea does + * not expect execution to continue after an assert. + * + * throwTrap - called when an internal error is thrown. This can be used + * during debugging to catch errors as they happen. It should return + * to allow Sweet Pea to handle the error. + * + * + * To aid in getting Sweet Pea up and running quickly, you can set any of + * these to NULL and Sweet Pea will use a default implementation. However: + * you cannot mix your implementations of the memory routines with + * Sweet Pea's defaults. + * + * + * The string pool functions replace the default routines used internally + * and exported by the Strings suite. Because they are exported, the behaviors + * listed below should be followed. + * + * allocateStringPool - creates a new string pool instance. The host app and + * Sweet Pea have a string pool which can be used by a plug-in, or a plug-in + * can create its own. See the notes in SPStrngs.h on how the pool is + * implemented. + * The function should return kSPNoError if the pool is allocated successfully + * or kSPOutOfMemoryError if allocation fails. + * + * freeStringPool - disposes of the string pool and any associated memory. The + * funtion should return kSPNoError + * + * makeWString - the string pool keeps a list of added strings. When a new string is + * added with MakeWString(), the routine checks to see if it is already in the + * pool. If so, the address of the string instance in the pool is returned. If + * not, it will add it to the pool and return the address of the newly + * created string instance. The behavior is: + * + * if ( string == NULL ) + * *wString = NULL; + * returns kSPNoError; + * else if ( string in string pool ) + * *wString = found string; + * returns kSPNoError; + * else add string + * if successful + * *wString = new string; + * returns kSPNoError; + * else + * *wString = nil + * returns kSPOutOfMemoryError + * + * appStringPool - if the host application has already allocated a string pool to use, + * it's reference should be passed here. If this value is NULL, Sweet Pea will + * allocate the pool when initialized and dispose of it at termination. + * + * filterEvent - a function called for each event allowing the host to cancel it. + * The event type is indicative of what the filter is to do. A file validation + * is called before a directory entry is added to the file list (kAddFile). + * A plug-in validation before a file is checked for PiPL information (kAddPlugin); + * the host might examine the file name/type to determine whether it should be added. + * For these 'add' events the return value is TRUE if the item should be skipped + * or FALSE if should be should be added. The default filter proc, used (if NULL) + * is passed, will skip files/folders in ( ). + * The other event is kSuitesAvailable. It is called when the last suite adding + * plug-in (as determined by available PiPL information) has been added. This is + * a point at which the host can cancel the startup process; for instance, if the host + * requires a suite from a plug-in, this is the time to check for it. If the + * host returns TRUE, the startup process continues. If it returns FALSE, the + * plug-in startup is canceled and the host would likely terminate or startup in + * an alternate manner. + * + * overrideAddPlugins - if supplied, SP will call the host to create the runtime + * plug-in list. This occurs at SPStartupPlugins(). The function takes no parameters + * as it is up to the host to determine how to do this. For instance, the host can do + * this from cached data or, as SP would, from the file list. A returned error will + * stop the plug-in startup process. + * + * overrideStartup - a function called for each SP2 plug-in before it is sent the + * startup message. If the host returns FALSE, SP will startup the plug-in normal. + * If the host returns true, it is assumed that the host has handled the startup + * for the plug-in, so SP will not do anything for the plug-in. This is intended + * to be used with a plug-in caching scheme. + * The host would be responsible, for instance, for defining the cacheable + * information in the PiPL, adding it when the callback is made, and later issuing + * a startup message when the plug-in is actually needed (e.g. when a menu item + * is selected.) Two notes: don't forget to SetPluginStarted(), and make sure + * to use a string pooled char* to kSPInterfaceCaller and kSPInterfaceStartupSelector. + * + * resolveLink - Windows only. If the search for plug-ins is to recurse sub-folders, + * the host needs to suply this routine. When a .lnk file is encountered, the + * resolveLink host callback function will be called and should return a resolved path. + * This is a host callback due to OLE issues such as initialization, which the SP + * libary does not currently handle. If it returns an error code, the result will + * be ignored. + * + * getPluginAccess - Allows the host to set the plug-in access information. This would + * be used if, for instance, the host kept its own plug-in list (ala, Photoshop), but + * still needed these to be compatible with SPPlugins (e.g. whose accesses are used by ADM) + * + * memoryIsCritical - Mac only. Allows the host to indicate that memory is in a critical state + * (really low, but can't be purged because you are, say, shutdown.) + * If so and the plug-in load target heap is the app heap, when a plug-in fails to load + * SP will then try to load the plug-in into the system heap + */ + +/* These are passed in startup and shutdown host notify procs and the filter file proc. */ +/** A notification event type, that an adapter passes to the \c #SPStartupNotifyProc + and \c #SPShutdownNotifyProc when the associated plug-in is loaded or unloaded. + */ +typedef enum { + /** Sent to the \c #SPStartupNotifyProc after a file has been added as a plug-in. + The \c notifyData value is the plug-in object, an \c #SPPluginRef. */ + kAddFile, /* Internal: for filter file, received before a file is + added to a file list, notifyData is a pointer to the + SPPlatformFileSpecification */ + /** Sent to the \c #SPStartupNotifyProc after a plug-in has been added. + The \c notifyData value is the plug-in object, an \c #SPPluginRef. */ + kAddPlugin, /* Internal: for filter file, received before a file is + checked to see if it is a plugin, notifyData is the + files SPFileRef */ + /** Sent to the \c #SPStartupNotifyProc to specify a general message for the application splash screen. + The \c notifyData value is a pointer to a C string, char**. */ + kSetMessage, + /** Internal */ + kSuitesAvailable, /* Internal: used only by event filter to allow host to + check for suites it requires, notifyDatais NULL */ + /** Internal */ + kError, /* Internal: notifyData is SPErrorDataPtr*/ + /** Sent to the \c #SPStartupNotifyProc after the plug-in is started. + The \c notifyData value is the plug-in object, an \c #SPPluginRef. */ + kStartingupPlugin, /* Internal: for filter file, received before a file is + checked to see if it is a plugin, notifyData is the + files SPFileRef */ + kXPlatError, /* Internal: notifyData is SPXPlatErrorData */ + /** Sent to the \c #SPStartupNotifyProc after the plug-in is started. + The \c notifyData value is the plug-in object, an \c #SPPluginRef. */ + /** Internal */ + kNoEvent = 0xffffffff + } NotifyEvent; + +/** Internal */ +typedef void *(*SPAllocateProc)( size_t size, void *hostData ); +/** Internal */ +typedef void (*SPFreeProc)( void *block, void *hostData ); +/** Internal */ +typedef void *(*SPReallocateProc)( void *block, size_t newSize, void *hostData ); +/** Called by an adapter to inform the application that a plug-in is being started up. + The application uses this information to track the start-up process; for example, + to display a list of plug-ins being loaded. + @param event The notification event constant that identifies which event occurred. + @param notifyData A pointer to plug-in-defined initialization data. + @param hostData A pointer to application-defined initialization data. + @return Nothing. + */ +typedef void (*SPStartupNotifyProc)( NotifyEvent event, void *notifyData, void *hostData ); +/** Called by an adapter to inform the application that a plug-in is being shut down. + The application uses this information to track the shut-down process. + @param event The notificatin event. + @param notifyData A pointer to plug-in-defined termination data. + @param hostData A pointer to application-defined termination data. + @return Nothing. + */ +typedef void (*SPShutdownNotifyProc)( NotifyEvent event, void *notifyData, void *hostData ); +/** Internal */ +typedef void (*SPAssertTrapProc)( const char *failMessage, void *hostData ); +/** Internal */ +typedef void (*SPThrowTrapProc)( SPErr error, void *hostData ); +/** Internal */ +typedef void (*SPDebugTrapProc)( const char *debugMessage, void *hostData ); + +/** Internal */ +typedef SPAPI SPErr (*SPAllocateStringPoolProc)( SPStringPoolRef *pool ); +/** Internal */ +typedef SPAPI SPErr (*SPFreeStringPoolProc)( SPStringPoolRef stringPool ); +/** Internal */ +typedef SPAPI SPErr (*SPMakeWStringProc)( SPStringPoolRef stringPool, const char *string, + const char **wString ); + +/** Internal */ +typedef SPAPI SPErr (*SPGetHostAccessInfoProc)( SPPlatformAccessInfo *spHostAccessInfo ); + +/** Internal */ +typedef SPAPI SPBoolean (*SPFilterEventProc)( NotifyEvent event, const void *eventData ); +/** Internal */ +typedef SPAPI SPErr (*SPAddPluginsProc)( void ); +/** Internal */ +typedef SPAPI SPBoolean (*SPOverrideStartupProc)( SPPluginRef currentPlugin ); + +#if defined(WIN_ENV) || defined(ANDROID_ENV) +/** Internal */ +typedef SPAPI SPErr (*SPResolveLinkProc)(const char *shortcutFile, char *resolvedPath); +#endif + +/** Internal */ +typedef SPAPI SPErr (*GetNativePluginAccessProc)(SPPluginRef plugin, SPAccessRef *access); + +/** Internal */ +typedef SPAPI SPBoolean (*MemoryIsCriticalProc)( void ); + +/** Callback procedures provided to PICA by the application. + Plug-ins do not use these, except for adapters, which + call the initialization and termination procedures. + @see \c #SPRuntimeSuite::GetRuntimeHostFileSpec() */ +typedef struct SPHostProcs { + + void *hostData; + + SPAllocateProc extAllocate; + SPFreeProc extFree; + SPReallocateProc extReallocate; + + SPAllocateProc intAllocate; + SPFreeProc intFree; + SPReallocateProc intReallocate; + /** Plug-in initialization procedure */ + SPStartupNotifyProc startupNotify; + /** Plug-in termination procedure */ + SPShutdownNotifyProc shutdownNotify; + + SPAssertTrapProc assertTrap; + SPThrowTrapProc throwTrap; + SPDebugTrapProc debugTrap; + + SPAllocateStringPoolProc allocateStringPool; + SPFreeStringPoolProc freeStringPool; + SPMakeWStringProc makeWString; + SPStringPoolRef appStringPool; + + SPFilterEventProc filterEvent; + SPAddPluginsProc overrideAddPlugins; + SPOverrideStartupProc overridePluginStartup; + +#if defined(WIN_ENV) || defined(ANDROID_ENV) + SPResolveLinkProc resolveLink; +#endif + + GetNativePluginAccessProc getPluginAccess; + +#ifdef MAC_ENV + // enable second-chance plugin loading for success-critical situations + MemoryIsCriticalProc memoryIsCritical; +#endif + +} SPHostProcs; + + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + This suite allows you to obtain specific references to the + PICA global lists and string pool. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPRuntimeSuite and \c #kSPRuntimeSuiteVersion. + */ +typedef struct SPRuntimeSuite { + /** Retrieves the PICA global string pool. + @param stringPool [out] A buffer in which to return the string-pool object. + @see \c #SPStringsSuite + */ + SPAPI SPErr (*GetRuntimeStringPool)( SPStringPoolRef *stringPool ); + /** Retrieves the PICA global suite list. + @param suiteList [out] A buffer in which to return the list object. + @see \c #SPSuitesSuite + */ + SPAPI SPErr (*GetRuntimeSuiteList)( SPSuiteListRef *suiteList ); + /** Retrieves the PICA global file list. + @param fileList [out] A buffer in which to return the list object. + @see \c #SPFilesSuite + */ + SPAPI SPErr (*GetRuntimeFileList)( SPFileListRef *fileList ); + /** Retrieves the PICA global plug-in list. + @param pluginList [out] A buffer in which to return the list object. + @see \c #SPPluginsSuite + */ + SPAPI SPErr (*GetRuntimePluginList)( SPPluginListRef *pluginList ); + /** Retrieves the PICA global adapter list. + @param adapterList [out] A buffer in which to return the list object. + @see \c #SPAdaptersSuite + */ + SPAPI SPErr (*GetRuntimeAdapterList)( SPAdapterListRef *adapterList ); + /** Retrieves the block of function pointers supplied to PICA by the + application, which contains memory management routines, notification routines, + exception handling, and string pool routines. + + A plug-in does not normally call the host functions directly; you + can use the PICA suite functions for most operations. An adapter, however, + uses the host functions for start-up and shut-down notification. + @param hostProcs [out] A buffer in which to return a pointer to the + block of function pointers. + */ + SPAPI SPErr (*GetRuntimeHostProcs)( SPHostProcs **hostProcs ); + /** Retrieves the location of the application's plug-in folder. + @param pluginFolder [out] A buffer in which to return the + file specification for the directory that contains plug-ins. + */ + SPAPI SPErr (*GetRuntimePluginsFolder)( SPPlatformFileSpecification *pluginFolder ); + /** Retrieves the location of the application's executable file. + @param hostFileSpec [out] A buffer in which to return the + file specification for the application's executable file. + */ + SPAPI SPErr (*GetRuntimeHostFileSpec)( SPPlatformFileSpecification *hostFileSpec ); +} SPRuntimeSuite; + + + +/******************************************************************************* + ** + ** Suite + ** + **/ +/** @ingroup Suites + This suite allows you to obtain specific references to the + PICA global lists and string pool using the new XPlatFileSpec + rather than the old SPPlatformFileSpecification. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPRuntimeSuite and \c #kSPRuntimeSuiteXPlatVersion. + */ +typedef struct SPXPlatRuntimeSuite { + /** Retrieves the PICA global string pool. + @param stringPool [out] A buffer in which to return the string-pool object. + @see \c #SPStringsSuite + */ + SPAPI SPErr (*GetRuntimeStringPool)( SPStringPoolRef *stringPool ); + /** Retrieves the PICA global suite list. + @param suiteList [out] A buffer in which to return the list object. + @see \c #SPSuitesSuite + */ + SPAPI SPErr (*GetRuntimeSuiteList)( SPSuiteListRef *suiteList ); + /** Retrieves the PICA global file list. + @param fileList [out] A buffer in which to return the list object. + @see \c #SPFilesSuite + */ + SPAPI SPErr (*GetRuntimeFileList)( SPFileListRef *fileList ); + /** Retrieves the PICA global plug-in list. + @param pluginList [out] A buffer in which to return the list object. + @see \c #SPPluginsSuite + */ + SPAPI SPErr (*GetRuntimePluginList)( SPPluginListRef *pluginList ); + /** Retrieves the PICA global adapter list. + @param adapterList [out] A buffer in which to return the list object. + @see \c #SPAdaptersSuite + */ + SPAPI SPErr (*GetRuntimeAdapterList)( SPAdapterListRef *adapterList ); + /** Retrieves the block of function pointers supplied to PICA by the + application, which contains memory management routines, notification routines, + exception handling, and string pool routines. + + A plug-in does not normally call the host functions directly; you + can use the PICA suite functions for most operations. An adapter, however, + uses the host functions for start-up and shut-down notification. + @param hostProcs [out] A buffer in which to return a pointer to the + block of function pointers. + */ + SPAPI SPErr (*GetRuntimeHostProcs)( SPHostProcs **hostProcs ); + /** Retrieves the location of the application's plug-in folder. + @param pluginFolder [out] A buffer in which to return the + file specification for the directory that contains plug-ins. + */ + SPAPI SPErr (*XPlatGetRuntimePluginsFolder)( XPlatFileSpec *pluginFolder ); + /** Retrieves the location of the application's executable file. + @param hostFileSpec [out] A buffer in which to return the + file specification for the application's executable file. + */ + SPAPI SPErr (*XPlatGetRuntimeHostFileSpec)( XPlatFileSpec *hostFileSpec ); +} SPXPlatRuntimeSuite; + + +/** Internal */ +SPAPI SPErr SPGetRuntimeStringPool( SPStringPoolRef *stringPool ); +/** Internal */ +SPAPI SPErr SPGetRuntimeSuiteList( SPSuiteListRef *suiteList ); +/** Internal */ +SPAPI SPErr SPGetRuntimeFileList( SPFileListRef *fileList ); +/** Internal */ +SPAPI SPErr SPGetRuntimePluginList( SPPluginListRef *pluginList ); +/** Internal */ +SPAPI SPErr SPGetRuntimeAdapterList( SPAdapterListRef *adapterList ); +/** Internal */ +SPAPI SPErr SPGetRuntimeHostProcs( SPHostProcs **hostProcs ); +/** Internal */ +SPAPI SPErr SPGetRuntimePluginsFolder( SPPlatformFileSpecification *pluginFolder ); +/** Internal */ +SPAPI SPErr SPXPlatGetRuntimePluginsFolder( XPlatFileSpec *pluginFolder ); +/** Internal */ +SPAPI SPErr SPGetRuntimeHostFileSpec( SPPlatformFileSpecification *hostFileSpec ); +/** Internal */ +SPAPI SPErr SPXPlatGetRuntimeHostFileSpec( XPlatFileSpec *hostFileSpec ); + +/** Internal */ +typedef struct +{ + SPAPI SPErr (*SPAcquireSuiteFunc)( SPSuiteListRef suiteList, const char *name, int32 apiVersion, int32 internalVersion, const void **suiteProcs ); + SPAPI SPErr (*SPReleaseSuiteFunc)( SPSuiteListRef suiteList, const char *name, int32 apiVersion, int32 internalVersion ); + SPErr (*spAllocateBlockFunc)( SPAllocateProc allocateProc, size_t size, const char *debug, void **block ); + SPErr (*spFreeBlockFunc)( SPFreeProc freeProc, void *block ); + SPErr (*spReallocateBlockFunc)( SPReallocateProc reallocateProc, void *block, size_t newSize, const char *debug, void **newblock ); + SPHostProcs *gProcs; +} SPBasicFuncStruct; + +/** Internal */ +void SetUpBasicFuncs(SPBasicFuncStruct *inStruct); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPSTSPrp.h b/External/AE SDK/Headers/SP/SPSTSPrp.h new file mode 100644 index 00000000..956173b3 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPSTSPrp.h @@ -0,0 +1,52 @@ +/***********************************************************************/ +/* */ +/* SPSTSPrp.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPSTSPrp__ +#define __SPSTSPrp__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPPiPL.h" + + +/******************************************************************************* + ** + ** Constants + ** + **/ + +/** Internal */ +#define PISuperTopSecretProperty 'StsP' +/** Internal */ +#define PISuperTopSecretValue 'clEn' + + +/******************************************************************************* + ** + ** Types + ** + **/ + + +#endif diff --git a/External/AE SDK/Headers/SP/SPStrngs.h b/External/AE SDK/Headers/SP/SPStrngs.h new file mode 100644 index 00000000..ebe9bed4 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPStrngs.h @@ -0,0 +1,132 @@ +/***********************************************************************/ +/* */ +/* SPStrngs.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPStrings__ +#define __SPStrings__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** PICA strings suite name */ +#define kSPStringsSuite "SP Strings Suite" +/** PICA strings suite version */ +#define kSPStringsSuiteVersion 2 + +/** Globally available PICA strings resources. + @see \c #SPRuntimeSuite::GetRuntimeStringPool(). */ +#define kSPRuntimeStringPool ((SPStringPoolRef)NULL) + + +/******************************************************************************* + ** + ** Types + ** + **/ + +/* If you override the default string pool handler by defining host proc routines, + * how the string pool memory allocation and searching is done is up to you. As an example, + * the structure below is similar to what Sweet Pea uses for its default string pool + * routines. The pool is a sorted list of strings of number count, kept in memory referenced + * by the heap field. + * + * typedef struct SPStringPool { + * + * SPPoolHeapRef heap; + * int32 count; + * + * } SPStringPool; + */ + +/** Opaque reference to a string pool. Access with the \c #SPStringsSuite. */ +typedef struct SPStringPool *SPStringPoolRef; + + +/******************************************************************************* + ** + ** Suite + ** + **/ + +/** @ingroup Suites + This suite allows you to work with the PICA string pool. + + PICA manages a string pool, which provides an efficient central + storage space for C strings. When a string is placed in the pool, PICA + checks whether it already exists in the pool, and if so, returns a + pointer to the existing string. If not, it copies the string into the pool, + and returns a pointer to the copy. + + This mechanisms atomizes the strings. Because each string exists in + only one place, strings can be compared by address, rather than character + by character, and string searches are made much more efficient. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPStringsSuite and \c #kSPStringsSuiteVersion. + */ +typedef struct SPStringsSuite { + + /** Creates a new string pool and allocates an initial block of memory for + its strings. You can also access PICA's global string pool, + using \c #SPRuntimeSuite::GetRuntimeStringPool(). + @param stringPool [out] A buffer in which to return the new string pool reference. + */ + SPAPI SPErr (*AllocateStringPool)( SPStringPoolRef *stringPool ); + /** Frees the memory used for a string pool created with \c #AllocateStringPool(). + Do not free the global string pool (\c #kSPRuntimeStringPool). + @param stringPool The string pool reference. + */ + SPAPI SPErr (*FreeStringPool)( SPStringPoolRef stringPool ); + /** Adds a string to a string pool, or, if the string has already been added + to the pool, retrieves a reference to the pooled string. + @param stringPool The string pool reference. + @param string The string. + @param wString [out] A buffer in which to return the address of + the atomized string in the pool. + */ + SPAPI SPErr (*MakeWString)( SPStringPoolRef stringPool, const char *string, const char **wString ); + +} SPStringsSuite; + + +SPAPI SPErr SPAllocateStringPool( SPStringPoolRef *stringPool ); +SPAPI SPErr SPFreeStringPool( SPStringPoolRef stringPool ); +SPAPI SPErr SPMakeWString( SPStringPoolRef stringPool, const char *string, const char **wString ); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPSuites.h b/External/AE SDK/Headers/SP/SPSuites.h new file mode 100644 index 00000000..17b8dc93 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPSuites.h @@ -0,0 +1,284 @@ +/***********************************************************************/ +/* */ +/* SPSuites.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + +#ifndef __SPSuites__ +#define __SPSuites__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPTypes.h" +#include "SPAccess.h" +#include "SPPlugs.h" +#include "SPStrngs.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + ** + ** Constants + ** + **/ +/** PICA suite-management suite name */ +#define kSPSuitesSuite "SP Suites Suite" +/** PICA suite-management suite version */ +#define kSPSuitesSuiteVersion 2 + +/** Internal */ +#define kSPLatestInternalVersion 0 + +/** PICA global list of available suites. + @see \c #SPRuntimeSuite::GetRuntimeSuiteList(). */ +#define kSPRuntimeSuiteList ((SPSuiteListRef)NULL) + + +/******************************************************************************* + ** + ** Types + ** + **/ + +/** Opaque reference to a suite object. Access with the \c #SPSuitesSuite. */ +typedef struct SPSuite *SPSuiteRef; +/** A list of suite objects. Create with + \c #SPSuitesSuite::AllocateSuiteList(), or use + the global list, \c #kSPRuntimeSuiteList. */ +typedef struct SPSuiteList *SPSuiteListRef; +/** An iterator object for examining a suite list. + See \c #SPSuitesSuite::NewSuiteListIterator(). */ +typedef struct SPSuiteListIterator *SPSuiteListIteratorRef; + + +/******************************************************************************* + ** + ** Suite + ** + **/ + +/** @ingroup Suites + This suite allows you to create, manage, and access PICA function suites. + + A suite associates a name and version number with a pointer to an array of + function pointers. The functions generally haves some common purpose, such as + accessing a data type, and are used by plug-ins to interact with PICA, with + the application, and with each other. + + In order to use a function in a suite, you must first \e acquire it. + This suite provides the low-level function \c #AcquireSuite(), + but a plug-in more typically uses the \c #SPBasicSuite, which is provided + with every message to a plug-in. + + PICA creates a global suite list at application startup, which contains + references to every suite added by PICA, the application, or other plug-ins. + You can use this suite to create and manage additional suite lists. + + \li Acquire this suite using \c #SPBasicSuite::AcquireSuite() with the constants + \c #kSPSuitesSuite and \c #kSPSuitesSuiteVersion. + */ +typedef struct SPSuitesSuite { + + /** Creates a new suite list. You can also access PICA's global suite list, + using \c #SPRuntimeSuite::GetRuntimeSuiteList(). + @param stringPool The string pool in which to keep suite names. + @param plugins <> + @param suiteList [out] A buffer in which to return the new list object. + */ + SPAPI SPErr (*AllocateSuiteList)( SPStringPoolRef stringPool, SPPluginListRef plugins, + SPSuiteListRef *suiteList ); + + /** Frees a list of suites allocated with \c #AllocateSuiteList(), and + also frees any entries in the list. Do not free the global list (\c #kSPRuntimeSuiteList). + @param suiteList The suite list object. + */ + SPAPI SPErr (*FreeSuiteList)( SPSuiteListRef suiteList ); + + /** Creates a new plug-in function suite and adds it to a suite list. + Identifying constants for the suite name and version must be made + available in a public header file. + @param suiteList The suite list object, or \c NULL to use the + global list. + @param host The plug-in object providing the suite. + @param name The unique name of the suite. + @param apiVersion The public version number of the suite. + @param internalVersion The internal version number of the suite. + @param suiteProcs A pointer to a structure containing the function pointers + for the suite. + @param suite [out] A buffer in which to return the new suite object. + */ + SPAPI SPErr (*AddSuite)( SPSuiteListRef suiteList, SPPluginRef host, const char *name, + int32 apiVersion, int32 internalVersion, const void *suiteProcs, SPSuiteRef *suite ); + + /** Acquires a function suite from a suite list. Loads the suite if necessary, + and increments its reference count. This function differs from + \c #SPBasicSuite::AcquireSuite() in that you can specify a suite list + and internal version number. + @param suiteList The suite list object, or \c NULL to use the + global list. + @param name The suite name. + @param version The public suite version number. + @param internalVersion The internal suite version number. + @param suiteProcs [out] A buffer in which to return a pointer to the + suite function pointer array. + */ + SPAPI SPErr (*AcquireSuite)( SPSuiteListRef suiteList, const char *name, int32 apiVersion, + int32 internalVersion, const void **suiteProcs ); + + /** Decrements the reference count of a suite in a suite list and unloads it when the + reference count reaches 0. + @param suiteList The suite list object, or \c NULL to use the + global list. + @param name The suite name. + @param version The public suite version number. + @param internalVersion The internal suite version number. + */ + SPAPI SPErr (*ReleaseSuite)( SPSuiteListRef suiteList, const char *name, int32 apiVersion, + int32 internalVersion ); + + /** Retrieves a suite from a suite list. + @param suiteList The suite list object, or \c NULL to use the + global list. + @param name The suite name. + @param version The public suite version number. + @param internalVersion The internal suite version number. + @param suiteProcs [out] A buffer in which to return the suite object, or + \c NULL if no matching suite is found in the list. + */ + SPAPI SPErr (*FindSuite)( SPSuiteListRef suiteList, const char *name, int32 apiVersion, + int32 internalVersion, SPSuiteRef *suite ); + + /** Creates an iterator object with which to traverse a suite list. + The iterator is initially set to the first suite in the list. + @param suiteList The suite list object, or \c NULL to use the + global list. + @param iter [out] A buffer in which to return the new iterator object. + @see \c #NextSuite(), \c #DeleteSuiteListIterator() + */ + SPAPI SPErr (*NewSuiteListIterator)( SPSuiteListRef suiteList, SPSuiteListIteratorRef *iter ); + /** Retrieves the current suite and advances a suite-list iterator to the next suite in the list. + @param iter The suite-list iterator object. + @param suite [out] A buffer in which to return the current suite object, \c NULL + if the end of the list has been reached. + @see \c #NewSuiteListIterator(), + */ + SPAPI SPErr (*NextSuite)( SPSuiteListIteratorRef iter, SPSuiteRef *suite ); + /** Frees a suite-list iterator that is no longer needed. + @param iter The suite-list iterator object. + @see \c #NewSuiteListIterator(), + */ + SPAPI SPErr (*DeleteSuiteListIterator)( SPSuiteListIteratorRef iter ); + + /** Retrieves the plug-in that provides a suite. + @param suite The suite object. + @param plugin [out] A buffer in which to return the plug-in object. + */ + SPAPI SPErr (*GetSuiteHost)( SPSuiteRef suite, SPPluginRef *plugin ); + /** Retrieves the unique name of a suite. + @param suite The suite object. + @param name [out] A buffer in which to return the name string. + */ + SPAPI SPErr (*GetSuiteName)( SPSuiteRef suite, const char **name ); + /** Retrieves the public version number of a suite. + @param suite The suite object. + @param version [out] A buffer in which to return the public version number. + */ + SPAPI SPErr (*GetSuiteAPIVersion)( SPSuiteRef suite, int32 *version ); + /** Retrieves the internal version number of a suite. + @param suite The suite object. + @param version [out] A buffer in which to return the internal version number. + */ + SPAPI SPErr (*GetSuiteInternalVersion)( SPSuiteRef suite, int32 *version ); + /** Retrieves the function pointer array of a suite. + @param suite The suite object. + @param suiteProcs [out] A buffer in which to return a pointer + to the function pointer array. + */ + SPAPI SPErr (*GetSuiteProcs)( SPSuiteRef suite, const void **suiteProcs ); + /** Retrieves the current reference count of a suite. + @param suite The suite object. + @param count [out] A buffer in which to return the reference count. + */ + SPAPI SPErr (*GetSuiteAcquireCount)( SPSuiteRef suite, int32 *count ); + +} SPSuitesSuite; + + +/** Internal */ +SPAPI SPErr SPAllocateSuiteList( SPStringPoolRef stringPool, SPPluginListRef plugins, + SPSuiteListRef *suiteList ); + +/** Internal */ +SPAPI SPErr SPFreeSuiteList( SPSuiteListRef suiteList ); + +/** Internal */ +SPAPI SPErr SPAddSuite( SPSuiteListRef suiteList, SPPluginRef host, const char *name, + int32 apiVersion, int32 internalVersion, const void *suiteProcs, SPSuiteRef *suite ); + +/** Internal */ +SPAPI SPErr SPAcquireSuite( SPSuiteListRef suiteList, const char *name, int32 apiVersion, + int32 internalVersion, const void **suiteProcs ); + +/** Internal */ +SPAPI SPErr SPReleaseSuite( SPSuiteListRef suiteList, const char *name, int32 apiVersion, + int32 internalVersion ); + +/** Internal */ +SPAPI SPErr SPFindSuite( SPSuiteListRef suiteList, const char *name, int32 apiVersion, + int32 internalVersion, SPSuiteRef *suite ); + +/** Internal */ +SPAPI SPErr SPNewSuiteListIterator( SPSuiteListRef suiteList, SPSuiteListIteratorRef *iter ); +/** Internal */ +SPAPI SPErr SPNextSuite( SPSuiteListIteratorRef iter, SPSuiteRef *suite ); +/** Internal */ +SPAPI SPErr SPDeleteSuiteListIterator( SPSuiteListIteratorRef iter ); + +/** Internal */ +SPAPI SPErr SPGetSuiteHost( SPSuiteRef suite, SPPluginRef *plugin ); +/** Internal */ +SPAPI SPErr SPGetSuiteName( SPSuiteRef suite, const char **name ); +/** Internal */ +SPAPI SPErr SPGetSuiteAPIVersion( SPSuiteRef suite, int32 *version ); +/** Internal */ +SPAPI SPErr SPGetSuiteInternalVersion( SPSuiteRef suite, int32 *version ); +/** Internal */ +SPAPI SPErr SPGetSuiteProcs( SPSuiteRef suite, const void **suiteProcs ); +/** Internal */ +SPAPI SPErr SPGetSuiteAcquireCount( SPSuiteRef suite, int32 *count ); + + +/******************************************************************************* + ** + ** Errors + ** + **/ + +#include "SPErrorCodes.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/External/AE SDK/Headers/SP/SPTypes.h b/External/AE SDK/Headers/SP/SPTypes.h new file mode 100644 index 00000000..182c0810 --- /dev/null +++ b/External/AE SDK/Headers/SP/SPTypes.h @@ -0,0 +1,175 @@ +/***********************************************************************/ +/* */ +/* SPTypes.h */ +/* */ +/* Copyright 1995-2006 Adobe Systems Incorporated. */ +/* All Rights Reserved. */ +/* */ +/* Patents Pending */ +/* */ +/* NOTICE: All information contained herein is the property of Adobe */ +/* Systems Incorporated. Many of the intellectual and technical */ +/* concepts contained herein are proprietary to Adobe, are protected */ +/* as trade secrets, and are made available only to Adobe licensees */ +/* for their internal use. Any reproduction or dissemination of this */ +/* software is strictly forbidden unless prior written permission is */ +/* obtained from Adobe. */ +/* */ +/***********************************************************************/ + + +/** + + These are the basic declarations used by Sweet Pea. + + **/ + + +#ifndef __SPTypes__ +#define __SPTypes__ + + +/******************************************************************************* + ** + ** Imports + ** + **/ + +#include "SPConfig.h" + + +/* + * You can replace SPTypes.h with your own. Define OTHER_SP_TYPES_H on the + * command line or in SPConfig.h to be the name of the replacement file. + * + * Example: + * + * #define OTHER_SP_TYPES_H "MySPTypes.h" + * #include "SPBasic.h" // for example + * + * Sweet Pea depends on TRUE, FALSE, SPErr, etc. Your replacement must + * define them. + */ + +#ifdef OTHER_SP_TYPES_H +#include OTHER_SP_TYPES_H +#else + + +/******************************************************************************* + ** + ** Constants + ** + **/ + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef NULL + +#ifdef MAC_ENV +#if !defined(__cplusplus) && (defined(__SC__) || defined(THINK_C)) +#define NULL ((void *) 0) +#else +#define NULL 0 +#endif +#endif + +#ifdef WIN_ENV +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#endif + + +/* + * SPAPI is placed in front of procedure declarations in the API. On the Mac + * it used to be 'pascal', which forced consistent calling conventions across different + * compilers. No longer needed. On Windows it's nothing. + * + * Example: + * + * SPAPI void *SPAllocateBlock( int32 size, const char *debug, SPErr *error ); + * + */ + +#if defined(MAC_ENV) || defined(__ANDROID__) || defined(__LINUX__) || defined (__EMSCRIPTEN__) || defined(SIMULATED_WASM) +#if defined(__GNUC__) +#define SPAPI +#else +#define SPAPI pascal +#endif +#endif + +#ifdef WIN_ENV +#define SPAPI +#endif + +#include "PSIntTypes.h" + +typedef uint8 SPUInt8; +typedef uint16 SPUInt16; +typedef uint32 SPUInt32; + +typedef int32 SPInt32; + +#if defined(MAC_ENV) || defined(__ANDROID__) || defined(__LINUX__) || defined (__EMSCRIPTEN__) || defined(SIMULATED_WASM) + +/* SPBoolean is the same a Macintosh Boolean. */ +typedef uint8 SPBoolean; + +#endif + +#ifdef WIN_ENV + +/* SPBoolean is the same a Windows BOOL. */ +typedef int32 SPBoolean; + +#endif + + +/******************************************************************************* + ** + ** Error Handling + ** + **/ + +/* + * Error codes in Sweet Pea are C strings, with the exception of the code for + * no error, which is NULL. The error can first be compared with kSPNoError to + * test if the function succeeded. If it is not NULL then the error can be + * string-compared with predefined error strings. + * + * Example: + * + * SPErr error = kSPNoError; + * + * block = SPAllocateBlock( size, debug, &error ); + * if ( error != kSPNoError ) { + * if ( strcmp( error, kSPOutOfMemoryError ) == 0 ) + * FailOutOfMemory(); + * ... + * } + */ + +typedef int32 SPErr; + +/* + * kSPNoError and kSPUnimplementedError are universal. Other error codes should + * be defined in the appropriate header files. + */ + +#include "SPErrorCodes.h" + +#endif /* OTHER_SP_TYPES_H */ + +#endif diff --git a/External/AE SDK/Headers/SP/artemis/config/platform.hpp b/External/AE SDK/Headers/SP/artemis/config/platform.hpp new file mode 100755 index 00000000..5d128c4a --- /dev/null +++ b/External/AE SDK/Headers/SP/artemis/config/platform.hpp @@ -0,0 +1,114 @@ +// +// ADOBE CONFIDENTIAL +// __________________ +// +// Copyright 2016 Adobe +// All Rights Reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Adobe and its suppliers, if any. The intellectual +// and technical concepts contained herein are proprietary to Adobe +// and its suppliers and are protected by all applicable intellectual +// property laws, including trade secret and copyright laws. +// Dissemination of this information or reproduction of this material +// is strictly forbidden unless prior written permission is obtained +// from Adobe. +// + +#ifndef ARTEMIS_PLATFORM_HPP +#define ARTEMIS_PLATFORM_HPP + +/* + The ARTEMIS_PLATFORM() macro is used to conditionalize code based on platform or platform + attibutes. + + It is used as: + + #if ARTEMIS_PLATFORM(MACOS) + #endif + + The attributes currently create a hierarchy from general to specific, items lower in the + hierarchy imply their parent are defined as '1', all others are '0'. + + This graph may eventually become a DAG. Higher level nodes represent a set of services that the + lower level nodes have in common. As such, it should rarely be necessary to write an expression + using more than one of these terms. If you find yourself doing so, please name the common + service and add the flag. + + An unqualified else clause should only be written entirely in terms of standard constructs that + has no platform dependencies and should not assume that 'not X' implies some other 'Y'. + + POSIX - any Posix compliant platform + APPLE - any Apple platform + MACOS - compiled for macOS + IOS - compiled for iOS + LINUX - compiled for Linux + ANDROID - compiled for Android + MICROSOFT - any Microsoft platform + UWP - Compiled for UWP + WIN32 - Compiled for Win32 +*/ +#define ARTEMIS_PLATFORM(X) (ARTEMIS_PRIVATE_PLATFORM_##X()) + +/**************************************************************************************************/ + +// The *_PRIVATE_* macros are just that. Don't use them directly. + +#define ARTEMIS_PRIVATE_PLATFORM_ANDROID() 0 +#define ARTEMIS_PRIVATE_PLATFORM_WEB() 0 +#define ARTEMIS_PRIVATE_PLATFORM_APPLE() 0 +#define ARTEMIS_PRIVATE_PLATFORM_IOS() 0 +#define ARTEMIS_PRIVATE_PLATFORM_LINUX() 0 +#define ARTEMIS_PRIVATE_PLATFORM_MACOS() 0 +#define ARTEMIS_PRIVATE_PLATFORM_MICROSOFT() 0 +#define ARTEMIS_PRIVATE_PLATFORM_POSIX() 0 +#define ARTEMIS_PRIVATE_PLATFORM_UWP() 0 +#define ARTEMIS_PRIVATE_PLATFORM_WIN32() 0 + +#if defined(__ANDROID__) + #undef ARTEMIS_PRIVATE_PLATFORM_POSIX + #define ARTEMIS_PRIVATE_PLATFORM_POSIX() 1 + #undef ARTEMIS_PRIVATE_PLATFORM_ANDROID + #define ARTEMIS_PRIVATE_PLATFORM_ANDROID() 1 +#elif defined(_WIN32) + #include // for #define WINVER + #include + + #undef ARTEMIS_PRIVATE_PLATFORM_MICROSOFT + #define ARTEMIS_PRIVATE_PLATFORM_MICROSOFT() 1 + + #if defined(WINAPI_FAMILY) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + #undef ARTEMIS_PRIVATE_PLATFORM_UWP + #define ARTEMIS_PRIVATE_PLATFORM_UWP() 1 + #else + #undef ARTEMIS_PRIVATE_PLATFORM_WIN32 + #define ARTEMIS_PRIVATE_PLATFORM_WIN32() 1 + #endif +#elif defined(__APPLE__) && !defined (__SIMULATED_WASM__) + #include "TargetConditionals.h" + + #undef ARTEMIS_PRIVATE_PLATFORM_POSIX + #define ARTEMIS_PRIVATE_PLATFORM_POSIX() 1 + #undef ARTEMIS_PRIVATE_PLATFORM_APPLE + #define ARTEMIS_PRIVATE_PLATFORM_APPLE() 1 + + #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + #undef ARTEMIS_PRIVATE_PLATFORM_IOS + #define ARTEMIS_PRIVATE_PLATFORM_IOS() 1 + #elif TARGET_OS_MAC + #undef ARTEMIS_PRIVATE_PLATFORM_MACOS + #define ARTEMIS_PRIVATE_PLATFORM_MACOS() 1 + #endif +#elif defined(__LINUX__) + #undef ARTEMIS_PRIVATE_PLATFORM_POSIX + #define ARTEMIS_PRIVATE_PLATFORM_POSIX() 1 + #undef ARTEMIS_PRIVATE_PLATFORM_LINUX + #define ARTEMIS_PRIVATE_PLATFORM_LINUX() 1 +#elif defined(__EMSCRIPTEN__) || defined (__SIMULATED_WASM__) + #undef ARTEMIS_PRIVATE_PLATFORM_POSIX + #define ARTEMIS_PRIVATE_PLATFORM_POSIX() 1 + #undef ARTEMIS_PRIVATE_PLATFORM_WEB + #define ARTEMIS_PRIVATE_PLATFORM_WEB() 1 +#endif + +#endif // ARTEMIS_PLATFORM_HPP diff --git a/External/AE SDK/Headers/SP/photoshop/config/platform.hpp b/External/AE SDK/Headers/SP/photoshop/config/platform.hpp new file mode 100755 index 00000000..e9f9da0b --- /dev/null +++ b/External/AE SDK/Headers/SP/photoshop/config/platform.hpp @@ -0,0 +1,95 @@ +// +// ADOBE CONFIDENTIAL +// __________________ +// +// Copyright 2016 Adobe +// All Rights Reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Adobe and its suppliers, if any. The intellectual +// and technical concepts contained herein are proprietary to Adobe +// and its suppliers and are protected by all applicable intellectual +// property laws, including trade secret and copyright laws. +// Dissemination of this information or reproduction of this material +// is strictly forbidden unless prior written permission is obtained +// from Adobe. +// + +#ifndef PHOTOSHOP_PLATFORM_HPP +#define PHOTOSHOP_PLATFORM_HPP + +/**************************************************************************************************/ + +#ifdef RC_INVOKED // Windows Resource Compiler + + // #error Windows resource compiler - do not include this file! + +#else + +/**************************************************************************************************/ + +#include + +/**************************************************************************************************/ + +// alias to the private artemis macros via concatenation because calling PHOTOSHOP_PLATFORM(X) errors +// when PHOTOSHOP_PLATFORM(X) = (ARTEMIS_PLATFORM(X)) when the value of X is itself defined as a +// macro. This is especially problematic for WIN32. + +#define PHOTOSHOP_PLATFORM(X) (ARTEMIS_PRIVATE_PLATFORM_##X()) +#define PHOTOSHOP_ARCH(X) (ARTEMIS_PRIVATE_ARCH_##X()) +#define PHOTOSHOP_BITS(X) (ARTEMIS_PRIVATE_BITS_##X()) +#define PHOTOSHOP_CPU(A,B) (ARTEMIS_PRIVATE_ARCH_##A() && ARTEMIS_PRIVATE_BITS_##B()) +#define PHOTOSHOP_PLATFORM_ARCH(X, A) (ARTEMIS_PRIVATE_PLATFORM_##X() && ARTEMIS_PRIVATE_ARCH_##A()) +#define PHOTOSHOP_PLATFORM_ARCH_BITS(X, A, B) (ARTEMIS_PRIVATE_PLATFORM_##X() && ARTEMIS_PRIVATE_ARCH_##A() && ARTEMIS_PRIVATE_BITS_##B()) + +// Really, these need to die a horrible death. However, they are still required +// for rez_defines.h (See the comment in rez_platform.h for more details.) +#define PS_PLATFORM_ANDROID PHOTOSHOP_PLATFORM(ANDROID) +#define PS_PLATFORM_WEB PHOTOSHOP_PLATFORM(WEB) +#define PS_PLATFORM_APPLE PHOTOSHOP_PLATFORM(APPLE) +#define PS_PLATFORM_IOS PHOTOSHOP_PLATFORM(IOS) +#define PS_PLATFORM_LINUX PHOTOSHOP_PLATFORM(LINUX) +#define PS_PLATFORM_MACOS PHOTOSHOP_PLATFORM(MACOS) +#define PS_PLATFORM_MS PHOTOSHOP_PLATFORM(MICROSOFT) +#define PS_PLATFORM_POSIX PHOTOSHOP_PLATFORM(POSIX) +#define PS_PLATFORM_UWP PHOTOSHOP_PLATFORM(UWP) +#define PS_PLATFORM_WIN32 PHOTOSHOP_PLATFORM(WIN32) + +// Is there a reason why the above are replicated here? +#ifndef PS_OS_WIN // Some Windows projects define this in their props file + #define PS_OS_WIN PHOTOSHOP_PLATFORM(MICROSOFT) +#endif +#ifndef PS_OS_IOS // Some Windows projects define this in their props file + #define PS_OS_IOS PHOTOSHOP_PLATFORM(IOS) +#endif +#ifndef PS_OS_MAC // Some Windows projects define this in their props file + #define PS_OS_MAC PHOTOSHOP_PLATFORM(MACOS) +#endif +#ifndef PS_OS_ANDROID // Some Windows projects define this in their props file + #define PS_OS_ANDROID PHOTOSHOP_PLATFORM(ANDROID) +#endif + +#define PS_OS_WEB POISONED_MACRO_PS_OS_WEB() + +/**************************************************************************************************/ + +// Deprecated + +#define qPSIsWin (PHOTOSHOP_PLATFORM(MICROSOFT)) +#define qPSIsMac (PHOTOSHOP_PLATFORM(APPLE)) + +// REVISIT (sparent) : This also come from Switches.h... sometimes. Untangle + +// #ifndef MSWindows +// #define MSWindows (PHOTOSHOP_PLATFORM(MICROSOFT)) +// #endif + +// Macintosh is only defined for apple platforms +#if PHOTOSHOP_PLATFORM(APPLE) && !defined(Macintosh) + #define Macintosh 1 +#endif + +/**************************************************************************************************/ +#endif // RC_INVOKED +#endif // PHOTOSHOP_PLATFORM_HPP diff --git a/External/AE SDK/Headers/Smart_Utils.cpp b/External/AE SDK/Headers/Smart_Utils.cpp new file mode 100644 index 00000000..b67378b7 --- /dev/null +++ b/External/AE SDK/Headers/Smart_Utils.cpp @@ -0,0 +1,62 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#include "Smart_Utils.h" + + +PF_Boolean IsEmptyRect(const PF_LRect *r){ + return (r->left >= r->right) || (r->top >= r->bottom); +} + +void UnionLRect(const PF_LRect *src, PF_LRect *dst) +{ + if (IsEmptyRect(dst)) { + *dst = *src; + } else if (!IsEmptyRect(src)) { + dst->left = mmin(dst->left, src->left); + dst->top = mmin(dst->top, src->top); + dst->right = mmax(dst->right, src->right); + dst->bottom = mmax(dst->bottom, src->bottom); + } +} + +PF_Boolean +IsEdgePixel( + PF_LRect *rectP, + A_long x, + A_long y) +{ + PF_Boolean x_hitB = FALSE, + y_hitB = FALSE; + + x_hitB = ((x == rectP->left) || (x == rectP->right)); + + y_hitB = ((y == rectP->top) || (y == rectP->bottom)); + + if (x_hitB){ + y_hitB = ((y >= rectP->top) && (y <= rectP->bottom)); + } else { + if (y_hitB){ + x_hitB = ((x >= rectP->left) && (x <= rectP->right)); + } + } + return (x_hitB && y_hitB); +} \ No newline at end of file diff --git a/External/AE SDK/Headers/Smart_Utils.h b/External/AE SDK/Headers/Smart_Utils.h new file mode 100644 index 00000000..3e1c03ce --- /dev/null +++ b/External/AE SDK/Headers/Smart_Utils.h @@ -0,0 +1,34 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#include "AE_Effect.h" +#include "SPTypes.h" + +#ifndef mmin + #define mmin(a,b) ((a) < (b) ? (a) : (b)) + #define mmax(a,b) ((a) > (b) ? (a) : (b)) +#endif + +PF_Boolean IsEmptyRect(const PF_LRect *r); + +void UnionLRect(const PF_LRect *src, PF_LRect *dst); + +PF_Boolean IsEdgePixel(PF_LRect *rectP, A_long x, A_long y); \ No newline at end of file diff --git a/External/AE SDK/Headers/String_Utils.c b/External/AE SDK/Headers/String_Utils.c new file mode 100644 index 00000000..b897d050 --- /dev/null +++ b/External/AE SDK/Headers/String_Utils.c @@ -0,0 +1,6 @@ +#include "String_Utils.h" + +A_char *GetStringPtr(int strNum) +{ + return g_strs[strNum].str; +} \ No newline at end of file diff --git a/External/AE SDK/Headers/String_Utils.h b/External/AE SDK/Headers/String_Utils.h new file mode 100644 index 00000000..eadf62e7 --- /dev/null +++ b/External/AE SDK/Headers/String_Utils.h @@ -0,0 +1,48 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + + +/* String_Utils.h */ + + +#pragma once + +#ifndef STRING_UTILS_H +#define STRING_UTILS_H + +#ifdef __cplusplus +extern "C" { +#endif +A_char *GetStringPtr(int strNum); +#ifdef __cplusplus +} +#endif + +#define STR(_foo) GetStringPtr(_foo) + + + + + + + +#endif /* STRING_UTILS_H */ \ No newline at end of file diff --git a/External/AE SDK/Headers/SuiteHelper.h b/External/AE SDK/Headers/SuiteHelper.h new file mode 100644 index 00000000..ff050ccd --- /dev/null +++ b/External/AE SDK/Headers/SuiteHelper.h @@ -0,0 +1,97 @@ +#ifndef _H_SUITEHELPER +#define _H_SUITEHELPER + +#include "A.h" +#include "SPBasic.h" + +#include + +template +struct SuiteTraits +{ + static const A_char* i_name; + static const int32_t i_version; +}; + +template +class AssertAndThrowOnMissingSuite +{ +public: + void operator()() + { + assert( false ); + A_THROW(A_Err_MISSING_SUITE); + } +}; + + +class MissingSuiteErrFunc_NoOp +{ +public: + void operator()() + { + //swallow the error, not much we want to do or can do + } +}; + + +template > +class SuiteHelper +{ +public: + SuiteHelper(const SPBasicSuite* const basic_suiteP); + ~SuiteHelper(); + + const SuiteType* operator->() const; + SuiteType* get() const; + +private: + mutable SuiteType* i_SuiteP; + const SPBasicSuite* const i_basic_suiteP; +}; + + +template +SuiteHelper::SuiteHelper(const SPBasicSuite* const basic_suiteP) : i_basic_suiteP(basic_suiteP), i_SuiteP( NULL ) +{ + assert(basic_suiteP); + const void * acquired_suite = NULL; + + A_Err err = i_basic_suiteP->AcquireSuite(SuiteTraits::i_name, SuiteTraits::i_version, &acquired_suite); + if (err || !acquired_suite) { + MissingSuiteErrFunc error_func; + error_func(); + } else { + i_SuiteP = reinterpret_cast(const_cast(acquired_suite)); + } +} + +template +SuiteHelper::~SuiteHelper() +{ + if (i_SuiteP) { + + #ifdef DEBUG + A_Err err = + #endif + + i_basic_suiteP->ReleaseSuite(SuiteTraits::i_name, SuiteTraits::i_version); + + #ifdef DEBUG + assert( !err ); + #endif + } +} + +template +const SuiteType* SuiteHelper::operator->() const +{ + return i_SuiteP; +} + +template +SuiteType* SuiteHelper::get() const +{ + return i_SuiteP; +} +#endif diff --git a/External/AE SDK/Headers/adobesdk/DrawbotSuite.h b/External/AE SDK/Headers/adobesdk/DrawbotSuite.h new file mode 100644 index 00000000..409ed070 --- /dev/null +++ b/External/AE SDK/Headers/adobesdk/DrawbotSuite.h @@ -0,0 +1,660 @@ +/************************************************************************** +* +* ADOBE CONFIDENTIAL +* ___________________ +* +* Copyright 2009 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains the property of +* Adobe Systems Incorporated and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe Systems +* Incorporated and its suppliers and may be covered by U.S. and Foreign +* Patents,patents in process,and are protected by trade secret or copyright +* law. Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained from +* Adobe Systems Incorporated. +**************************************************************************/ + +#ifndef DRAWBOT_SUITE_H +#define DRAWBOT_SUITE_H + +#include + +#ifdef __cplusplus + #include // for std::exception +#endif +//Sweet pea header +#include + +#ifdef ADOBE_SDK_INTERNAL + #include +#else + #include +#endif + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/* +C STYLE +-------- +Drawbot suites can be used to draw paths, strings, images using application-provided DrawbotRef. Use C++ style (mentioned later in the file) +if you are creating cpp files as it is more elegant and you don't have to deal with retain/release of objects. + +Below function takes DrawbotRef and strokes a circle & a rectangle. + +void DrawSomething(DRAWBOT_DrawRef drawbot_ref) +{ + //Acquire drawbot (drawbot_suiteP), supplier (supplier_suiteP), surface (surface_suiteP) & path (path_suiteP) suites + ... + + //Get the supplier and surface reference from drawbot_ref + DRAWBOT_SupplierRef supplier_ref; + DRAWBOT_SurfaceRef surface_ref; + + drawbot_suiteP->GetSupplier(drawbot_ref, &supplier_ref); + drawbot_suiteP->GetSurface(drawbot_ref, &surface_ref); + + //Save the surface state by pushing it in stack. It is required to restore state if you are going to clip/transform surface + //or change interpolation/anti-aliasing policy. + surface_suiteP->PushStateStack(surface_ref); + + //Create a new red-color brush. + DRAWBOT_BrushRef brush_ref; + + supplier_suiteP->NewBrush(supplier_ref, DRAWBOT_ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f), &brush_ref); + + //Create a new path + DRAWBOT_PathRef path_ref; + + supplier_suiteP->NewPath(supplier_ref, &path_ref); + + //Add a rectangle to the path + DRAWBOT_RectF32 rect1(0.0f, 0.0f, 50.0f, 50.0f); + + path_suiteP->AddRect(path_ref, rect1); + + //Add a circle to the path + path_suiteP->AddArc(path_ref, DRAWBOT_PointF32(25.0f, 25.0f), 10.0f, 0.0f, 360.0f); + + //Fill the path using red-colored brush. + surface_suiteP->FillPath(surface_ref, brush_ref, path_ref, kDRAWBOT_FillType_EvenOdd); + + //We are done. Release (delete) all the objects. There will be memory leak if you don't release. + surface_suiteP->ReleaseObject((DRAWBOT_ObjectRef)path_ref); + surface_suiteP->ReleaseObject((DRAWBOT_ObjectRef)brush_ref); + + //Don't forget to pop surface state (if pushed earlier) + surface_suiteP->PopStateStack(surface_ref); + + //DO NOT CALL ReleaseObject on surface_ref and supplier_ref as you did not create them. + + //Release drawbot (drawbot_suiteP), supplier (supplier_suiteP), surface (surface_suiteP) & path (path_suiteP) suites +} +*/ + + +#define kDRAWBOT_DrawSuite "DRAWBOT Draw Suite" +#define kDRAWBOT_DrawSuite_Version1 1 + +#define kDRAWBOT_DrawSuite_VersionCurrent kDRAWBOT_DrawSuite_Version1 +#define DRAWBOT_DrawbotSuiteCurrent DRAWBOT_DrawbotSuite1 + +typedef struct DRAWBOT_DrawbotSuite1 { + + //Get the supplier from the drawbot_ref + SPAPI SPErr (*GetSupplier)( DRAWBOT_DrawRef in_drawbot_ref, + DRAWBOT_SupplierRef *out_supplierP); + + //Get the surface from the drawbot_ref + SPAPI SPErr (*GetSurface)( DRAWBOT_DrawRef in_drawbot_ref, + DRAWBOT_SurfaceRef *out_surfaceP); + +} DRAWBOT_DrawbotSuite1; + + + +#define kDRAWBOT_SupplierSuite "DRAWBOT Supplier Suite" +#define kDRAWBOT_SupplierSuite_Version1 1 + +#define kDRAWBOT_SupplierSuite_VersionCurrent kDRAWBOT_SupplierSuite_Version1 +#define DRAWBOT_SupplierSuiteCurrent DRAWBOT_SupplierSuite1 + +typedef struct DRAWBOT_SupplierSuite1 { + + //Create a new pen. + //It should be released with ReleaseObject api. + SPErr (*NewPen)( DRAWBOT_SupplierRef in_supplier_ref, + const DRAWBOT_ColorRGBA *in_colorP, + float in_size, + DRAWBOT_PenRef *out_penP); + + //Create a new brush. + //It should be released with ReleaseObject api. + SPErr (*NewBrush)(DRAWBOT_SupplierRef in_supplier_ref, + const DRAWBOT_ColorRGBA *in_colorP, + DRAWBOT_BrushRef *out_brushP); + + //Check if current supplier supports text. + SPErr (*SupportsText)(DRAWBOT_SupplierRef in_supplier_ref, + DRAWBOT_Boolean *out_supports_textPB); + + //Get default font size. + SPErr (*GetDefaultFontSize)( DRAWBOT_SupplierRef in_supplier_ref, + float *out_font_sizeF); + + //Create a new font with default settings. + //You can pass default font size from GetDefaultFontSize. + //It should be released with ReleaseObject api. + SPErr (*NewDefaultFont)( DRAWBOT_SupplierRef in_supplier_ref, + float in_font_sizeF, + DRAWBOT_FontRef *out_fontP); + + //Create a new image from buffer. + //It should be released with ReleaseObject api. + SPErr (*NewImageFromBuffer)( DRAWBOT_SupplierRef in_supplier_ref, + int in_width, + int in_height, + int in_row_bytes, + DRAWBOT_PixelLayout in_pl, + const void *in_dataP, + DRAWBOT_ImageRef *out_imageP); + + //Create a new path. + //It should be released with ReleaseObject api. + SPErr (*NewPath)( DRAWBOT_SupplierRef in_supplier_ref, + DRAWBOT_PathRef *out_pathP); + + + //A given drawbot implementation can support multiple channel orders, but will likely + //prefer one over the other. Use below apis to get the preferred layout for any api that + //takes DRAWBOT_PixelLayout (ex- NewImageFromBuffer). + + SPErr (*SupportsPixelLayoutBGRA)( DRAWBOT_SupplierRef in_supplier_ref, + DRAWBOT_Boolean *out_supports_bgraPB); + + SPErr (*PrefersPixelLayoutBGRA) ( DRAWBOT_SupplierRef in_supplier_ref, + DRAWBOT_Boolean *out_prefers_bgraPB); + + SPErr (*SupportsPixelLayoutARGB)( DRAWBOT_SupplierRef in_supplier_ref, + DRAWBOT_Boolean *out_supports_argbPB); + + SPErr (*PrefersPixelLayoutARGB) ( DRAWBOT_SupplierRef in_supplier_ref, + DRAWBOT_Boolean *out_prefers_argbPB); + + //Retain (increase reference count) any object (pen, brush, path etc) + //Ex: It should be used when any object is copied and the copied object should be retained. + SPErr (*RetainObject)(DRAWBOT_ObjectRef in_obj_ref); + + //Release (decrease reference count) any object (pen, brush, path etc) + //This function MUST be called for any object created using NewXYZ() from this suite. + SPErr (*ReleaseObject)(DRAWBOT_ObjectRef in_obj_ref); + +} DRAWBOT_SupplierSuite1; + + +#define kDRAWBOT_SurfaceSuite "DRAWBOT Surface Suite" +#define kDRAWBOT_SurfaceSuite_Version1 1 +#define kDRAWBOT_SurfaceSuite_Version2 2 + +#define kDRAWBOT_SurfaceSuite_VersionCurrent kDRAWBOT_SurfaceSuite_Version2 +#define DRAWBOT_SurfaceSuiteCurrent DRAWBOT_SurfaceSuite2 + +typedef struct DRAWBOT_SurfaceSuite1 { + + //Push the current surface state in stack. It should be popped to retrieve old state. + SPErr (*PushStateStack)( DRAWBOT_SurfaceRef in_surface_ref); + + //Pop the last pushed surface state. + SPErr (*PopStateStack)( DRAWBOT_SurfaceRef in_surface_ref); + + //Paint a rectangle with a color on the surface. + SPErr (*PaintRect)( DRAWBOT_SurfaceRef in_surface_ref, + const DRAWBOT_ColorRGBA *in_colorP, + const DRAWBOT_RectF32 *in_rectPR); + + //Fill a path using a brush and fill type. + SPErr (*FillPath)( DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_BrushRef in_brush_ref, + DRAWBOT_PathRef in_path_ref, + DRAWBOT_FillType in_fill_type); + + //Stroke a path using a pen. + SPErr (*StrokePath)( DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_PenRef in_pen_ref, + DRAWBOT_PathRef in_path_ref); + + //Clip the surface + SPErr (*Clip)( DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_SupplierRef in_supplier_ref, + const DRAWBOT_Rect32 *in_rectPR); + + //Get clip bounds + SPErr (*GetClipBounds)( + DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_Rect32 *out_rectPR); + + //Checks whether a rect is within the clip bounds. + SPErr (*IsWithinClipBounds)( + DRAWBOT_SurfaceRef in_surface_ref, + const DRAWBOT_Rect32 *in_rectPR, + DRAWBOT_Boolean *out_withinPB); + + //Transform the last surface state. + SPErr (*Transform)( DRAWBOT_SurfaceRef in_surface_ref, + const DRAWBOT_MatrixF32 *in_matrixP); + + //Draw a string + SPErr (*DrawString)( DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_BrushRef in_brush_ref, + DRAWBOT_FontRef in_font_ref, + const DRAWBOT_UTF16Char *in_stringP, + const DRAWBOT_PointF32 *in_originP, + DRAWBOT_TextAlignment in_alignment_style, + DRAWBOT_TextTruncation in_truncation_style, + float in_truncation_width); + + //Draw an image (created using NewImageFromBuffer())on the surface + //alpha = [0.0f, 1.0f] + SPErr (*DrawImage)( DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_ImageRef in_image_ref, + const DRAWBOT_PointF32 *in_originP, + float in_alpha); + + SPErr (*SetInterpolationPolicy)( + DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_InterpolationPolicy in_interp); + + SPErr (*GetInterpolationPolicy)( + DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_InterpolationPolicy *out_interpP); + + SPErr (*SetAntiAliasPolicy)( + DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_AntiAliasPolicy in_policy); + + SPErr (*GetAntiAliasPolicy)( + DRAWBOT_SurfaceRef in_surface_ref, + DRAWBOT_AntiAliasPolicy *out_policyP); + + //Flush drawing + SPErr (*Flush)( DRAWBOT_SurfaceRef in_surface_ref); + + //Get the transform of the surface state. + SPErr (*GetTransformToScreenScale)(DRAWBOT_SurfaceRef in_surface_ref, + float* out_scale); +} DRAWBOT_SurfaceSuite2; + +typedef DRAWBOT_SurfaceSuite2 DRAWBOT_SurfaceSuite1; // At the time, the last function was Flush. + + +#define kDRAWBOT_PathSuite "DRAWBOT Path Suite" +#define kDRAWBOT_PathSuite_Version1 1 + +#define kDRAWBOT_PathSuite_VersionCurrent kDRAWBOT_PathSuite_Version1 +#define DRAWBOT_PathSuiteCurrent DRAWBOT_PathSuite1 + +typedef struct DRAWBOT_PathSuite1 { + + //Move to a point + SPErr (*MoveTo)( DRAWBOT_PathRef in_path_ref, + float in_x, + float in_y); + + //Add a line to the path + SPErr (*LineTo)( DRAWBOT_PathRef in_path_ref, + float in_x, + float in_y); + + //Add a cubic bezier to the path + SPErr (*BezierTo)(DRAWBOT_PathRef in_path_ref, + const DRAWBOT_PointF32 *in_pt1P, + const DRAWBOT_PointF32 *in_pt2P, + const DRAWBOT_PointF32 *in_pt3P); + + //Add a rect to the path + SPErr (*AddRect)( DRAWBOT_PathRef in_path_ref, + const DRAWBOT_RectF32 *in_rectPR); + + //Add a arc to the path + //zero start degrees == 3 o'clock + //sweep is clockwise + //units in degrees + SPErr (*AddArc)( DRAWBOT_PathRef in_path_ref, + const DRAWBOT_PointF32 *in_centerP, + float in_radius, + float in_start_angle, + float in_sweep); + + SPErr (*Close)( DRAWBOT_PathRef in_path_ref); + +} DRAWBOT_PathSuite1; + + +#define kDRAWBOT_PenSuite "DRAWBOT Pen Suite" +#define kDRAWBOT_PenSuite_Version1 1 + +#define kDRAWBOT_PenSuite_VersionCurrent kDRAWBOT_PenSuite_Version1 +#define DRAWBOT_PenSuiteCurrent DRAWBOT_PenSuite1 + +typedef struct DRAWBOT_PenSuite1 { + + //Make the line dashed + SPErr (*SetDashPattern)( DRAWBOT_PenRef in_pen_ref, + const float *in_dashesP, + int in_pattern_size); + +} DRAWBOT_PenSuite1; + +#define kDRAWBOT_ImageSuite "DRAWBOT Image Suite" +#define kDRAWBOT_ImageSuite_Version1 1 + +#define kDRAWBOT_ImageSuite_VersionCurrent kDRAWBOT_ImageSuite_Version1 +#define DRAWBOT_ImageSuiteCurrent DRAWBOT_ImageSuite1 + +typedef struct DRAWBOT_ImageSuite1 { + + //Make the line dashed + SPErr (*SetScaleFactor)( DRAWBOT_ImageRef in_image_ref, + float in_scale_factor); + +} DRAWBOT_ImageSuite1; + +//Collection of latest drawbot suites +typedef struct { + DRAWBOT_DrawbotSuiteCurrent *drawbot_suiteP; + DRAWBOT_SupplierSuiteCurrent *supplier_suiteP; + DRAWBOT_SurfaceSuiteCurrent *surface_suiteP; + DRAWBOT_PathSuiteCurrent *path_suiteP; + DRAWBOT_PenSuiteCurrent *pen_suiteP; + DRAWBOT_ImageSuiteCurrent *image_suiteP; +} DRAWBOT_Suites; + + +#ifdef __cplusplus + } // end extern "C" +#endif + + + +#ifdef __cplusplus //C++ Style + +/* +Use C++ style as it will automatically deal with memory management of objects. Below example will make it clear. + +Below function takes DrawbotRef and strokes a circle & a rectangle. + +void DrawSomething(DRAWBOT_DrawRef drawbot_ref) +{ + //Acquire drawbot (drawbot_suiteP), supplier (supplier_suiteP), surface (surface_suiteP) & path (path_suiteP) suites + ... + + //Get the supplier and surface reference from drawbot_ref + DRAWBOT_SupplierRef supplier_ref; + DRAWBOT_SurfaceRef surface_ref; + + drawbot_suiteP->GetSupplier(drawbot_ref, &supplier_ref); + drawbot_suiteP->GetSurface(drawbot_ref, &surface_ref); + + //Save the surface state by pushing it in stack. It is required to restore if you are going to clip or transform surface. + //Below call acts like a a scoper: it will push the current surface state and automatically pop at the end of scope. + DRAWBOT_SaveAndRestoreStateStack sc_save_state(surface_suiteP, surface_ref); + + //Create a new red-color brush. + //Compare below call with C-style apis. It is compact and brush will be automatically released at the end of scope. + DRAWBOT_BrushP brushP(supplier_suiteP, supplier_ref, DRAWBOT_ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f)); + + //Create a new path + DRAWBOT_PathP pathP(supplier_suiteP, supplier_ref); + + //Add a rectangle to the path + DRAWBOT_RectF32 rect1(0.0f, 0.0f, 50.0f, 50.0f); + + path_suiteP->AddRect(pathP, rect1); + + //Add a circle to the path + path_suiteP->AddArc(pathP, DRAWBOT_PointF32(25.0f, 25.0f), 10.0f, 0.0f, 360.0f); + + //Fill the path using red-colored brush. + surface_suiteP->FillPath(surface_ref, brushP, pathP, kDRAWBOT_FillType_EvenOdd); + + //Release drawbot (drawbot_suiteP), supplier (supplier_suiteP), surface (surface_suiteP) & path (path_suiteP) suites + + //We are DONE. You don't have to release brush & path objects as you did in C-style. +} +*/ +class DRAWBOT_Exception : public std::exception { +public: + DRAWBOT_Exception(SPErr err): mErr(err) + { + } + virtual ~DRAWBOT_Exception() throw () {} + + SPErr mErr; +}; + +#define DRAWBOT_ErrorToException(EXPR) { SPErr _err = (EXPR); if (_err) throw DRAWBOT_Exception(_err); } + + +//SharedRefImpl declaration + +template +class SharedRefImpl { +public: + SharedRefImpl(DRAWBOT_SupplierSuiteCurrent *suiteP, REF_T r = 0, bool retainB = true) + : + mRef(r), + mSuiteP(suiteP) + { + if (retainB) { + RetainObject(); + } + } + + virtual ~SharedRefImpl() + { + ReleaseObject(); + } + + //copy constructor + SharedRefImpl(SharedRefImpl const & rhs) + { + *this = rhs; + } + + //assignment operator + SharedRefImpl & operator=(SharedRefImpl const & rhs) + { + mSuiteP = rhs.mSuiteP; + mRef = rhs.mRef; + + RetainObject(); + + return *this; + } + + inline REF_T Get() const + { + return mRef; + } + + inline operator REF_T() const + { + return mRef; + } + + inline void Reset(REF_T rhs = 0, bool retainB = true) + { + if (mRef != rhs) { + ReleaseObject(); + + mRef = rhs; + + if (retainB) { + RetainObject(); + } + } + } + +private: + void ReleaseObject() + { + if (mRef) { + DRAWBOT_ErrorToException(mSuiteP->ReleaseObject(reinterpret_cast(mRef))); + mRef = NULL; + } + } + + void RetainObject() + { + if (mRef) { + DRAWBOT_ErrorToException(mSuiteP->RetainObject(reinterpret_cast(mRef))); + } + } + + REF_T mRef; + DRAWBOT_SupplierSuiteCurrent *mSuiteP; +}; + + +//DRAWBOT_PenP declaration + +class DRAWBOT_PenP : public SharedRefImpl { + typedef SharedRefImpl _inherited; +public: + + DRAWBOT_PenP( DRAWBOT_SupplierSuiteCurrent *suiteP, + const DRAWBOT_SupplierRef supplier_ref, + const DRAWBOT_ColorRGBA *colorP, + float sizeF) + : + _inherited(suiteP) + { + New(suiteP, supplier_ref, colorP, sizeF); + } + + void New( DRAWBOT_SupplierSuiteCurrent *suiteP, + const DRAWBOT_SupplierRef supplier_ref, + const DRAWBOT_ColorRGBA *colorP, + float sizeF) + { + DRAWBOT_PenRef pen_ref; + + DRAWBOT_ErrorToException(suiteP->NewPen(supplier_ref, colorP, sizeF, &pen_ref)); + + Reset(pen_ref, false); + } +}; + + +//DRAWBOT_PathP declaration + +class DRAWBOT_PathP : public SharedRefImpl { + typedef SharedRefImpl _inherited; +public: + DRAWBOT_PathP( DRAWBOT_SupplierSuiteCurrent *suiteP, + const DRAWBOT_SupplierRef supplier_ref) + : + _inherited(suiteP) + { + New(suiteP, supplier_ref); + } + + void New( DRAWBOT_SupplierSuiteCurrent *suiteP, + const DRAWBOT_SupplierRef supplier_ref) + { + DRAWBOT_PathRef path_ref; + + DRAWBOT_ErrorToException(suiteP->NewPath(supplier_ref, &path_ref)); + + Reset(path_ref, false); + } +}; + + +//DRAWBOT_BrushP declaration + +class DRAWBOT_BrushP : public SharedRefImpl { + typedef SharedRefImpl _inherited; +public: + DRAWBOT_BrushP( DRAWBOT_SupplierSuiteCurrent *suiteP, + const DRAWBOT_SupplierRef supplier_ref, + const DRAWBOT_ColorRGBA *colorP) + : + _inherited(suiteP) + { + New(suiteP, supplier_ref, colorP); + } + + void New( DRAWBOT_SupplierSuiteCurrent *suiteP, + const DRAWBOT_SupplierRef supplier_ref, + const DRAWBOT_ColorRGBA *colorP) + { + DRAWBOT_BrushRef brush_ref; + + DRAWBOT_ErrorToException(suiteP->NewBrush(supplier_ref, colorP, &brush_ref)); + + Reset(brush_ref, false); + } +}; + + +//DRAWBOT_FontP declaration + +class DRAWBOT_FontP : public SharedRefImpl { + typedef SharedRefImpl _inherited; +public: + DRAWBOT_FontP( DRAWBOT_SupplierSuiteCurrent *suiteP, + const DRAWBOT_SupplierRef supplier_ref, + float in_font_size) + : + _inherited(suiteP) + { + New(suiteP, supplier_ref, in_font_size); + } + + void New( DRAWBOT_SupplierSuiteCurrent *suiteP, + const DRAWBOT_SupplierRef supplier_ref, + float in_font_size) + { + DRAWBOT_FontRef font_ref; + + DRAWBOT_ErrorToException(suiteP->NewDefaultFont(supplier_ref, in_font_size, &font_ref)); + + Reset(font_ref, false); + } +}; + + +class DRAWBOT_SaveAndRestoreStateStack { +public: + DRAWBOT_SaveAndRestoreStateStack( DRAWBOT_SurfaceSuiteCurrent *suiteP, + const DRAWBOT_SurfaceRef surface_ref) + : + mSurfaceRef(surface_ref), + mSuiteP(suiteP) + { + DRAWBOT_ErrorToException(mSuiteP->PushStateStack(mSurfaceRef)); + } + + ~DRAWBOT_SaveAndRestoreStateStack() + { + (void)mSuiteP->PopStateStack(mSurfaceRef); + } + +private: + DRAWBOT_SurfaceRef mSurfaceRef; + DRAWBOT_SurfaceSuiteCurrent *mSuiteP; +}; + + +#endif //C++ Style + + +#include + +#endif //DRAWBOT_SUITE_H diff --git a/External/AE SDK/Headers/adobesdk/config/AdobesdkTypes.h b/External/AE SDK/Headers/adobesdk/config/AdobesdkTypes.h new file mode 100755 index 00000000..4dc90478 --- /dev/null +++ b/External/AE SDK/Headers/adobesdk/config/AdobesdkTypes.h @@ -0,0 +1,54 @@ +/************************************************************************** +* +* ADOBE CONFIDENTIAL +* ___________________ +* +* Copyright 2009 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains the property of +* Adobe Systems Incorporated and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe Systems +* Incorporated and its suppliers and may be covered by U.S. and Foreign +* Patents,patents in process,and are protected by trade secret or copyright +* law. Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained from +* Adobe Systems Incorporated. +**************************************************************************/ + +/** + Definition of common types used by adobesdk. +**/ + +#ifndef ADOBESDK_CONFIG_TYPES_H +#define ADOBESDK_CONFIG_TYPES_H + +#include + +#include "stdint.h" + + +typedef uint16_t ADOBESDK_UTF16Char; +typedef uint8_t ADOBESDK_UTF8Char; +typedef uint8_t ADOBESDK_Boolean; + +enum +{ + kAdobesdk_False = 0, + kAdobesdk_True = 1 +}; + + +typedef ADOBESDK_UTF16Char DRAWBOT_UTF16Char; +typedef ADOBESDK_Boolean DRAWBOT_Boolean; + + +typedef struct +{ + int64_t opaque[2]; +} ADOBESDK_String; + + +#include + +#endif //ADOBESDK_CONFIG_TYPES_H diff --git a/External/AE SDK/Headers/adobesdk/config/PostConfig.h b/External/AE SDK/Headers/adobesdk/config/PostConfig.h new file mode 100755 index 00000000..f10326ad --- /dev/null +++ b/External/AE SDK/Headers/adobesdk/config/PostConfig.h @@ -0,0 +1,2 @@ + +#pragma pack( pop, AdobeSDKExternalAlign ) \ No newline at end of file diff --git a/External/AE SDK/Headers/adobesdk/config/PreConfig.h b/External/AE SDK/Headers/adobesdk/config/PreConfig.h new file mode 100755 index 00000000..2675004d --- /dev/null +++ b/External/AE SDK/Headers/adobesdk/config/PreConfig.h @@ -0,0 +1,23 @@ + +//Must be balanced with PostConfig.h! + +#ifdef _WINDOWS + //disable warning in VS2008 about unbalanced struct alignment changes + #pragma warning( disable : 4103 ) + + // This is taken from PreConfig_Win.h in dvacore, there is a bug in the VS2010 xlocnum header in particular where it is + // incorrectly putting a declspec on a static member of a template class 'numpunct'. + #if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(PREMIERE_INTERNAL) + // Compilation problems due to locale id being marked as dllimport. -jacquave 2/18/2010 + // Also, opened a Technical Support Request with Microsoft, # 111021865918375. + + // http://connect.microsoft.com/VisualStudio/feedback/details/572376/msvc10-c-std-numpunct-has-a-hardcoded-dllimport-in-definition + // http://dotnetforum.net/topic/7346-vs2010-error-c2491-stdnumpunctid-while-using-stdbasic-fstream-in-ccli/ + #ifdef __cplusplus + #include "dvacore/config/win/xlocnum_hack.h" + #endif + #endif +#endif + +//8 byte alignment for adobesdk public files. +#pragma pack( push, AdobeSDKExternalAlign, 8 ) diff --git a/External/AE SDK/Headers/adobesdk/drawbotsuite/DrawbotSuiteTypes.h b/External/AE SDK/Headers/adobesdk/drawbotsuite/DrawbotSuiteTypes.h new file mode 100755 index 00000000..5c1ee028 --- /dev/null +++ b/External/AE SDK/Headers/adobesdk/drawbotsuite/DrawbotSuiteTypes.h @@ -0,0 +1,148 @@ +/************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2009 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains the property of + * Adobe Systems Incorporated and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe Systems + * Incorporated and its suppliers and may be covered by U.S. and Foreign + * Patents,patents in process,and are protected by trade secret or copyright + * law. Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe Systems Incorporated. + **************************************************************************/ +// Author: pankajn@adobe.com + +#ifndef DRAWBOT_SUITE_TYPES_H +#define DRAWBOT_SUITE_TYPES_H + +#include + + +typedef struct _DRAWBOT_DrawRef *DRAWBOT_DrawRef; +typedef struct _DRAWBOT_SupplierRef *DRAWBOT_SupplierRef; +typedef struct _DRAWBOT_SurfaceRef *DRAWBOT_SurfaceRef; +typedef struct _DRAWBOT_PenRef *DRAWBOT_PenRef; +typedef struct _DRAWBOT_PathRef *DRAWBOT_PathRef; +typedef struct _DRAWBOT_BrushRef *DRAWBOT_BrushRef; +typedef struct _DRAWBOT_ImageRef *DRAWBOT_ImageRef; +typedef struct _DRAWBOT_FontRef *DRAWBOT_FontRef; +typedef struct _DRAWBOT_ObjectRef *DRAWBOT_ObjectRef; + + +// 0.0f to 1.0f +typedef struct { + float red; + float green; + float blue; + float alpha; +} DRAWBOT_ColorRGBA; + + +typedef struct { + float x; + float y; +} DRAWBOT_PointF32; + + +typedef struct { + float left; + float top; + float width; //not right + float height; //not bottom +} DRAWBOT_RectF32; + + +typedef struct { + int left; + int top; + int width; //not right + int height; //not bottom +} DRAWBOT_Rect32; + + +typedef struct { + float mat[3][3]; +} DRAWBOT_MatrixF32; + + +//Enum to fill a path +enum { + kDRAWBOT_FillType_EvenOdd = 0, + kDRAWBOT_FillType_Winding, + + kDRAWBOT_FillType_Default = kDRAWBOT_FillType_Winding +}; +typedef int DRAWBOT_FillType; + + +//Enum to specify pixel layout of buffer to create an image. +enum { + kDRAWBOT_PixelLayout_24RGB = 0, + kDRAWBOT_PixelLayout_24BGR, + kDRAWBOT_PixelLayout_32RGB, // ARGB (A is ignored). + kDRAWBOT_PixelLayout_32BGR, // BGRA (A is ignored). + kDRAWBOT_PixelLayout_32ARGB_Straight, + kDRAWBOT_PixelLayout_32ARGB_Premul, + kDRAWBOT_PixelLayout_32BGRA_Straight, + kDRAWBOT_PixelLayout_32BGRA_Premul +}; +typedef int DRAWBOT_PixelLayout; + + +//Enum to specify the text alignment (used in DrawString) +enum { + kDRAWBOT_TextAlignment_Left = 0, + kDRAWBOT_TextAlignment_Center, + kDRAWBOT_TextAlignment_Right, + + kDRAWBOT_TextAlignment_Default = kDRAWBOT_TextAlignment_Left +}; +typedef int DRAWBOT_TextAlignment; + + +//Enum to specify text truncation (used in DrawString) +enum { + kDRAWBOT_TextTruncation_None = 0, + kDRAWBOT_TextTruncation_End, + kDRAWBOT_TextTruncation_EndEllipsis, + kDRAWBOT_TextTruncation_PathEllipsis // tries to preserve the disk name ellipsis in middle of string +}; +typedef int DRAWBOT_TextTruncation; + + +//Enum to specify surface interpolation level +enum { + kDRAWBOT_InterpolationPolicy_None = 0, + kDRAWBOT_InterpolationPolicy_Med, + kDRAWBOT_InterpolationPolicy_High, + + kDRAWBOT_InterpolationPolicy_Default = kDRAWBOT_InterpolationPolicy_None +}; +typedef int DRAWBOT_InterpolationPolicy; + + +//Enum to specify drawing anti-aliasing level +enum { + kDRAWBOT_AntiAliasPolicy_None = 0, + kDRAWBOT_AntiAliasPolicy_Med, + kDRAWBOT_AntiAliasPolicy_High, + + kDRAWBOT_AntiAliasPolicy_Default = kDRAWBOT_AntiAliasPolicy_None +}; +typedef int DRAWBOT_AntiAliasPolicy; + + +#include + +#endif //DRAWBOT_SUITE_TYPES_H + + + + + + \ No newline at end of file diff --git a/External/AE SDK/Headers/entry.h b/External/AE SDK/Headers/entry.h new file mode 100644 index 00000000..6a0175db --- /dev/null +++ b/External/AE SDK/Headers/entry.h @@ -0,0 +1,53 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +/* + Entry.h + + Part of the Adobe After Effects SDK. +*/ + +#include "AE_PluginData.h" + +#ifdef AE_OS_WIN + #define DllExport __declspec( dllexport ) +#elif defined AE_OS_MAC + #define DllExport __attribute__ ((visibility ("default"))) +#endif + + +#define AE_ENTRY_POINT "EffectMain" +#define AE_RESERVED_INFO 8 + +#define PF_REGISTER_EFFECT(INPTR, CBPTR, NAME, MATCHNAME, CATEGORY,RESERVEDINFO) \ + result = (*(CBPTR))((INPTR),\ + reinterpret_cast(NAME),\ + reinterpret_cast(MATCHNAME),\ + reinterpret_cast(CATEGORY),\ + reinterpret_cast(AE_ENTRY_POINT),\ + 'eFKT',\ + PF_AE_PLUG_IN_VERSION,\ + PF_AE_PLUG_IN_SUBVERS,\ + RESERVEDINFO);\ + if(result == A_Err_NONE)\ + {\ + result = PF_Err_NONE;\ + } diff --git a/External/AE SDK/Resources/AE_General.r b/External/AE SDK/Resources/AE_General.r new file mode 100644 index 00000000..a0b146cf --- /dev/null +++ b/External/AE SDK/Resources/AE_General.r @@ -0,0 +1,548 @@ +/* + File: AE_General.r + + Copyright 1991-96 by Adobe Systems Inc.. + + Photoshop's Rinclude with AE extensions + +*/ + +#ifndef __AEPIGeneral_r__ +#define __AEPIGeneral_r__ + +#ifndef kPIPropertiesVersion +#define kPIPropertiesVersion 0 +#endif + +type 'PiPL' + { + longint = kPIPropertiesVersion; + longint = $$CountOf(properties); + array properties + { + switch + { + +/* Properties for all types of plug-ins. */ + + case Kind: + longint = '8BIM'; + key longint = 'kind'; + longint = 0; + longint = 4; + literal longint Filter = '8BFM', Parser = '8BYM', ImageFormat='8BIF', + Extension = '8BXM', Acquire = '8BAM', Export = '8BEM', + /* AE specific */ + AEEffect = 'eFKT', AEImageFormat = 'FXIF', AEAccelerator = 'eFST', + AEGeneral = 'AEgp', AEGP = 'AEgx', AEForeignProjectFormat = 'eFPF'; + + case Version: + longint = '8BIM'; + key longint = 'vers'; + longint = 0; + longint = 4; + longint; + + case Priority: + longint = '8BIM'; + key longint = 'prty'; + longint = 0; + longint = 4; + longint; + + case RequiredHost: + longint = '8BIM'; + key longint = 'host'; + longint = 0; + longint = 4; + literal longint; + + case Name: + longint = '8BIM'; + key longint = 'name'; + longint = 0; +#if DeRez + fill long; +#else + longint = (nameEnd[$$ArrayIndex(properties)] - nameStart[$$ArrayIndex(properties)]) / 8; +#endif + nameStart: + pstring; + nameEnd: + align long; + + case Category: + longint = '8BIM'; + key longint = 'catg'; + longint = 0; +#if DeRez + fill long; +#else + longint = (catgEnd[$$ArrayIndex(properties)] - catgStart[$$ArrayIndex(properties)]) / 8; +#endif + catgStart: + pstring; + catgEnd: + align long; + + case Code68k: + longint = '8BIM'; + key longint = 'm68k'; + longint = 0; + longint = 6; + literal longint; + integer; + align long; + + case Code68kFPU: + longint = '8BIM'; + key longint = '68fp'; + longint = 0; + longint = 6; + literal longint; + integer; + align long; + + case CodePowerPC: + longint = '8BIM'; + key longint = 'pwpc'; + longint = 0; +#if DeRez + fill long; +#else + longint = (pwpcEnd[$$ArrayIndex(properties)] - pwpcStart[$$ArrayIndex(properties)]) / 8; +#endif + pwpcStart: + longint; + longint; + pstring; + pwpcEnd: + align long; + + case CodeCarbonPowerPC: + longint = '8BIM'; + key longint = 'ppcb'; + longint = 0; + #if DeRez + fill long; + #else + longint = (pwpcCarbonEnd[$$ArrayIndex(properties)] - pwpcCarbonStart[$$ArrayIndex(properties)]) / 8; + #endif + pwpcCarbonStart: + longint; + longint; + pstring; + pwpcCarbonEnd: + align long; + + // Mach-O Support + case CodeMachOPowerPC: + longint = '8BIM'; + key longint = 'mach'; + longint = 0; + #if DeRez + fill long; + #else + longint = (pwpcMachEnd[$$ArrayIndex(properties)] - pwpcMachStart[$$ArrayIndex(properties)]) / 8; + #endif + pwpcMachStart: + pstring; + pwpcMachEnd: + align long; + + // Mach-O Intel 32bit Support + case CodeMacIntel32: + longint = '8BIM'; + key longint = 'mi32'; + longint = 0; + #if DeRez + fill long; + #else + longint = (pwpcMacIntel32End[$$ArrayIndex(properties)] - pwpcMacIntel32Start[$$ArrayIndex(properties)]) / 8; + #endif + pwpcMacIntel32Start: + pstring; + pwpcMacIntel32End: + align long; + + // Mach-O Intel 64bit Support + case CodeMacIntel64: + longint = '8BIM'; + key longint = 'mi64'; + longint = 0; + #if DeRez + fill long; + #else + longint = (pwpcMacIntel64End[$$ArrayIndex(properties)] - pwpcMacIntel64Start[$$ArrayIndex(properties)]) / 8; + #endif + pwpcMacIntel64Start: + pstring; + pwpcMacIntel64End: + align long; + + case CodeMacARM64: + longint = '8BIM'; + key longint = 'ma64'; + longint = 0; + #if DeRez + fill long; + #else + longint = (pwpcMacARM64End[$$ArrayIndex(properties)] - pwpcMacARM64Start[$$ArrayIndex(properties)]) / 8; + #endif + pwpcMacARM64Start: + pstring; + pwpcMacARM64End: + align long; + + +#ifdef AE_OS_WIN /* For documentation purposes only. */ + case CodeWin32X86: + longint = '8BIM'; + key longint = 'wx86'; + longint = 0; + longint = (win32x86End[$$ArrayIndex(properties)] - win32x86Start[$$ArrayIndex(properties)]) / 8; + win32x86Start: + cstring; + win32x86End: + align long; + + case CodeWin64X86: + longint = '8BIM'; + key longint = '8664'; + longint = 0; + longint = (win64x86End[$$ArrayIndex(properties)] - win64x86Start[$$ArrayIndex(properties)]) / 8; + win64x86Start: + cstring; + win64x86End: + align long; +#endif + + case SupportedModes: + longint = '8BIM'; + key longint = 'mode'; + longint = 0; +#if DeRez + fill long; +#else + longint = (modeEnd[$$ArrayIndex(properties)] - modeStart[$$ArrayIndex(properties)]) / 8; +#endif + modeStart: + boolean noBitmap, doesSupportBitmap; + boolean noGrayScale, doesSupportGrayScale; + boolean noIndexedColor, doesSupportIndexedColor; + boolean noRGBColor, doesSupportRGBColor; + boolean noCMYKColor, doesSupportCMYKColor; + boolean noHSLColor, doesSupportHSLColor; + boolean noHSBColor, doesSupportHSBColor; + boolean noMultichannel, doesSupportMultichannel; + boolean noDuotone, doesSupportDuotone; + boolean noLABColor, doesSupportLABColor; + boolean noGray16, doesSupportGray16; + boolean noRGB48, doesSupportRGB48; + boolean noLab48, doesSupportLab48; + boolean noCMYK64, doesSupportCMYK64; + boolean noDeepMultichannel, doesSupportDeepMultichannel; + boolean noDuotone16, doesSupportDuotone16; + modeEnd: + align long; + +/* Filter plug-in properties. */ + + case FilterCaseInfo: + longint = '8BIM'; + key longint = 'fici'; + longint = 0; + longint = 28; + array [7] + { + byte inCantFilter = 0, + inStraightData = 1, + inBlackMat = 2, + inGrayMat = 3, + inWhiteMat = 4, + inDefringe = 5, + inBlackZap = 6, + inGrayZap = 7, + inWhiteZap = 8, + inBackgroundZap = 10, + inForegroundZap = 11; + byte outCantFilter = 0, + outStraightData = 1, + outBlackMat = 2, + outGrayMat = 3, + outWhiteMat = 4, + outFillMask = 9; + fill bit [5]; + boolean doesNotFilterLayerMasks, filtersLayerMasks; + boolean doesNotWorkWithBlankData, worksWithBlankData; + boolean copySourceToDestination, doNotCopySourceToDestination; + fill byte; + } ; + +/* Export plug-in properties. */ + + case ExportFlags: + longint = '8BIM'; + key longint = 'expf'; + longint = 0; +#if DeRez + fill long; +#else + longint = (expFlagsEnd[$$ArrayIndex(properties)] - expFlagsStart[$$ArrayIndex(properties)]) / 8; +#endif + expFlagsStart: + boolean expDoesNotSupportTransparency, expSupportsTransparency; + fill bit[7]; + expFlagsEnd: + align long; + +/* Format plug-in properties. */ +// If this property is present, then its on. No parameters + case SupportsPOSIXIO: + longint = '8BIM'; + key longint = 'fxio'; + longint = 0; + longint = 4; + literal longint = 1; + + case FmtFileType: + longint = '8BIM'; + key longint = 'fmTC'; + longint = 0; + longint = 8; + literal longint; /* Default file type. */ + literal longint; /* Default file creator. */ + + case ReadTypes: + longint = '8BIM'; + key longint = 'RdTy'; + longint = 0; + longint = $$CountOf(ReadableTypes) * 8; + wide array ReadableTypes { literal longint; literal longint; } ; + + case WriteTypes: + longint = '8BIM'; + key longint = 'WrTy'; + longint = 0; + longint = $$CountOf(WritableTypes) * 8; + wide array WritableTypes { literal longint; literal longint; } ; + + case FilteredTypes: + longint = '8BIM'; + key longint = 'fftT'; + longint = 0; + longint = $$CountOf(FilteredTypes) * 8; + wide array FilteredTypes { literal longint; literal longint; } ; + + case ReadExtensions: + longint = '8BIM'; + key longint = 'RdEx'; + longint = 0; + longint = $$CountOf(ReadableExtensions) * 4; + wide array ReadableExtensions { literal longint; } ; + + case WriteExtensions: + longint = '8BIM'; + key longint = 'WrEx'; + longint = 0; + longint = $$CountOf(WriteableExtensions) * 4; + wide array WriteableExtensions { literal longint; } ; + + case FilteredExtensions: + longint = '8BIM'; + key longint = 'fftE'; + longint = 0; + longint = $$CountOf(FilteredExtensions) * 4; + wide array FilteredExtensions { literal longint; } ; + + case FormatFlags: + longint = '8BIM'; + key longint = 'fmtf'; + longint = 0; +/* longint = (fmtFlagsEnd[$$ArrayIndex(properties)] - fmtFlagsStart[$$ArrayIndex(properties)]) / 8; */ + longint = 1; + fmtFlagsStart: + boolean fmtReadsAllTypes, fmtDoesntReadAllTypes; + boolean fmtDoesNotSaveImageResources, fmtSavesImageResources; + boolean fmtCannotRead, fmtCanRead; + boolean fmtCannotWrite, fmtCanWrite; + boolean fmtWritesAll, fmtCanWriteIfRead; + fill bit[3]; + fmtFlagsEnd: + align long; + + case FormatICCFlags: + longint = '8BIM'; + key longint = 'fmip'; + longint = 0; + //longint = (iccFlagsEnd[$ArrayIndex(properties)] - iccFlagsStart[$ArrayIndex(properties)]) / 8; + longint = 1; + iccFlagsStart: + boolean iccCannotEmbedGray, iccCanEmbedGray; + boolean iccCannotEmbedIndexed, iccCanEmbedIndexed; + boolean iccCannotEmbedRGB, iccCanEmbedRGB; + boolean iccCannotEmbedCMYK, iccCanEmbedCMYK; + fill bit[4]; + iccFlagsEnd: + align long; + + case FormatMaxSize: + longint = '8BIM'; + key longint = 'mxsz'; + longint = 0; + longint = 4; + Point; + + case FormatMaxChannels: + longint = '8BIM'; + key longint = 'mxch'; + longint = 0; + longint = $$CountOf(ChannelsSupported) * 2; + wide array ChannelsSupported { integer; } ; + align long; + + /* after effects specific PiPL atoms */ + + case AE_PiPL_Version: + longint = '8BIM'; + key longint = 'ePVR'; + longint = 0; + longint = 4; + integer; + integer; + + case AE_Effect_Spec_Version: + longint = '8BIM'; + key longint = 'eSVR'; + longint = 0; + longint = 4; + integer; + integer; + + + case AE_Effect_Version: + longint = '8BIM'; + key longint = 'eVER'; + longint = 0; + longint = 4; + longint; + + + case AE_Effect_Info_Flags: + longint = '8BIM'; + key longint = 'eINF'; + longint = 0; + longint = 2; + integer; + align long; +/* + case AE_Effect_Global_OutFlags: + longint = '8BIM'; + key longint = 'eGLO'; + longint = 0; +#if DeRez + fill long; +#else + longint = (gloEnd[$$ArrayIndex(properties)] - gloStart[$$ArrayIndex(properties)]) / 8; +#endif + gloStart: + fill bit[6]; + boolean noReserved4, reserved4; + boolean noReserved3, reserved3; + boolean noReserved2, reserved2; + boolean noReserved1, reserved1; + boolean noObsolete, obsolete; + boolean noAudio, audio; + boolean noShutterAngle, shutterAngle; + boolean noNopRender, nopRender; + boolean noRefreshUI, refreshUI; + boolean noCustomNtrp, customNtrp; + boolean noCustomUI, customUI; + boolean noNonSquareOnly, nonSquareOnly; + boolean noWorksInPlace, worksInPlace; + boolean noShrinkBuf, shrinkBuf; + boolean noWriteInput, writeInput; + boolean noPixIndep, pixIndep; + boolean noExpandBuf, expandBuf; + boolean noErrMsg, errMsg; + boolean noSendDialog, sendDialog; + boolean noOutputExtent, outputExtent; + boolean noDialog, dialog; + boolean noSeqFlatten, seqFlatten; + boolean noSendParamsUpdate, sendParamsUpdate; + boolean noRandomness, randomness; + boolean noWideTimeInput, wideTimeInput; + boolean noKeepRsrcOpen, keepRsrcOpen; + gloEnd: + align long; +*/ + case AE_Effect_Global_OutFlags: + longint = '8BIM'; + key longint = 'eGLO'; + longint = 0; + longint = 4; + longint; + + case AE_Effect_Global_OutFlags_2: + longint = '8BIM'; + key longint = 'eGL2'; + longint = 0; + longint = 4; + longint; + + case AE_Effect_Match_Name: + longint = '8BIM'; + key longint = 'eMNA'; + longint = 0; +#if DeRez + fill long; +#else + longint = (matchNameEnd[$$ArrayIndex(properties)] - matchNameStart[$$ArrayIndex(properties)]) / 8; +#endif + matchNameStart: + pstring; + matchNameEnd: + align long; + + case AE_ImageFormat_Extension_Info: + longint = '8BIM'; + key longint = 'FXMF'; + longint = 0; + longint = 16; + integer; /* major version */ + integer; /* minor version */ + fill bit[21]; + boolean hasOptions, hasNoOptions; + boolean sequentialOnly, nonSequentialOk; + boolean noInteractRequired, mustInteract; + boolean noInteractPut, hasInteractPut; + boolean noInteractGet, hasInteractGet; + boolean hasTime, hasNoTime; + boolean noVideo, hasVideo; + boolean noStill, still; + boolean noFile, hasFile; + boolean noOutput, output; + boolean noInput, input; + longint = 0; /* reserved */ + literal longint;/* signature */ + + + case AE_Reserved: + longint = '8BIM'; + key longint = 'aeRD'; + longint = 0; + longint = 4; + longint; + + case AE_Reserved_Info: + longint = '8BIM'; + key longint = 'aeFL'; + longint = 0; + longint = 4; + longint; + }; + }; + }; + + +#endif diff --git a/External/AE SDK/Resources/Mach-O_prefix.h b/External/AE SDK/Resources/Mach-O_prefix.h new file mode 100644 index 00000000..e5da3715 --- /dev/null +++ b/External/AE SDK/Resources/Mach-O_prefix.h @@ -0,0 +1 @@ +#define __MACH__ 1 \ No newline at end of file diff --git a/External/AE SDK/Resources/PiPLtool.exe b/External/AE SDK/Resources/PiPLtool.exe new file mode 100755 index 00000000..a50f04f6 --- /dev/null +++ b/External/AE SDK/Resources/PiPLtool.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c4d33fe38e8b8bd99c4dc98f4bebcd2f486c016ae6d9259775060b2ef9fac05 +size 201216 diff --git a/External/AE SDK/Util/AEFX_ArbParseHelper.c b/External/AE SDK/Util/AEFX_ArbParseHelper.c new file mode 100644 index 00000000..29d75396 --- /dev/null +++ b/External/AE SDK/Util/AEFX_ArbParseHelper.c @@ -0,0 +1,174 @@ +// AEFX_ArbParseHelper.c +// + + + +#include "AEFX_ArbParseHelper.h" + +#include +#include +#include +#include +#include + +PF_Err +AEFX_AppendText( A_char *srcAC, /* >> */ + const A_u_long dest_sizeL, /* >> */ + A_char *destAC, /* <> */ + A_u_long *current_indexPLu) /* <> */ +{ + PF_Err err = PF_Err_NONE; + + A_u_long new_strlenLu = (A_u_long) strlen(srcAC) + *current_indexPLu; + + + if (new_strlenLu <= dest_sizeL) { + destAC[*current_indexPLu] = 0x00; + + strcat(destAC, srcAC); + *current_indexPLu = new_strlenLu; + } else { + err = AEFX_ParseError_APPEND_ERROR; + } + + return err; +} + + + + +PF_Err +AEFX_ParseCell( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + A_char *bufAC) /* << AEFX_CELL_SIZE */ +{ + (void)out_data; + (void)in_data; + + PF_Err err = PF_Err_NONE; + A_char c; + A_char buf[AEFX_CELL_SIZE]; + A_char *scan; + A_short count; + + if (startPC[*current_indexPL] == AEFX_Char_EOL) { + err = AEFX_ParseError_EXPECTING_MORE_DATA; + } else if (startPC[*current_indexPL] == 0) { + err = AEFX_ParseError_EXPECTING_MORE_DATA; + } else { + count = 0; + scan = buf; + while ((c = startPC[(*current_indexPL)++]) != 0) { + if (c == AEFX_Char_TAB) + break; + if (c == AEFX_Char_EOL) { + (*current_indexPL)--; + break; + } + + *scan++ = c; + + if (++count >= AEFX_CELL_SIZE) + break; + } + *scan = 0; + + // trim spaces from head + scan = buf; + while (isspace(*scan)) + scan++; + + strcpy(bufAC, scan); + + // trim spaces from end (guaranteed not to scan past start of string, because + // if the string were all spaces, it would be trimmed down to nothing in the + // head-trim step above + if (*bufAC) { + scan = bufAC + strlen(bufAC) - 1; + while (*scan == AEFX_Char_SPACE) { + *scan-- = 0; + } + } + } + + return err; + +} + + +/** AEFX_ParseFpLong + + Reads in the next cell in the input stream and converts it to a double. + The first non-space character must be numeric. + +**/ +PF_Err +AEFX_ParseFpLong( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + PF_FpLong *dPF) /* << */ +{ + PF_Err err = PF_Err_NONE; + A_char c; + A_char *end_ptr; + A_char buf[AEFX_CELL_SIZE]; + + err = AEFX_ParseCell(in_data, out_data, startPC, current_indexPL, buf); + + if (!err) { + c = buf[0]; + + if (!isdigit(c) && c != '.' && c != '-') { + err = AEFX_ParseError_EXPECTING_A_NUMBER; + } else { + errno = 0; + *dPF = strtod(buf, &end_ptr); + } + } + + return err; +} + + + +PF_Err +AEFX_MatchCell( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *strPC, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + PF_Boolean *matchPB0) /* << */ +{ + PF_Err err = PF_Err_NONE; + A_char buf[AEFX_CELL_SIZE]; + A_u_long origLu = *current_indexPL; + PF_Boolean found = 0; + + if (startPC[*current_indexPL] == AEFX_Char_EOL) { + found = 0; + err = AEFX_ParseError_EXPECTING_MORE_DATA; + } else { + err = AEFX_ParseCell(in_data, out_data, startPC, current_indexPL, buf); + + if (!err) { + found = STR_EQUAL(buf, strPC); + + if (!found) + *current_indexPL = origLu; + } + } + + if (!err && !found && matchPB0 == NULL) { + err = AEFX_ParseError_MATCH_ERROR; + } + + if (matchPB0) + *matchPB0 = found; + + return err; +} + + diff --git a/External/AE SDK/Util/AEFX_ArbParseHelper.h b/External/AE SDK/Util/AEFX_ArbParseHelper.h new file mode 100644 index 00000000..fa79fa3e --- /dev/null +++ b/External/AE SDK/Util/AEFX_ArbParseHelper.h @@ -0,0 +1,75 @@ +// AEFX_ArbParseHelper.h +// + +// This file has no header, and is designed to by #included as necessary. -jja 9/30/98 + + +#ifndef _H_AEFX_ArbParseHelper +#define _H_AEFX_ArbParseHelper + +#include + +#define AEFX_Char_TAB '\t' +#define AEFX_Char_EOL '\r' +#define AEFX_Char_SPACE ' ' + +#ifndef AEFX_CELL_SIZE +#define AEFX_CELL_SIZE 256 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +enum { + AEFX_ParseError_EXPECTING_MORE_DATA = 0x00FEBE00, + AEFX_ParseError_APPEND_ERROR, + AEFX_ParseError_EXPECTING_A_NUMBER, + AEFX_ParseError_MATCH_ERROR +}; +typedef A_long AEFX_ParseErrors; + + + +#ifndef STR_EQUAL + #define STR_EQUAL(A, B) (strcmp((A),(B)) == 0) +#endif + + +PF_Err +AEFX_AppendText( A_char *srcAC, /* >> */ + const A_u_long dest_sizeL, /* >> */ + A_char *destAC, /* <> */ + A_u_long *current_indexPLu); /* <> */ + + +PF_Err +AEFX_ParseFpLong( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + PF_FpLong *dPF); /* << */ + + +PF_Err +AEFX_MatchCell( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *strPC, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + PF_Boolean *matchPB0); /* << */ + +PF_Err +AEFX_ParseCell( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const A_char *startPC, /* >> */ + A_u_long *current_indexPL, /* << */ + A_char *bufAC); /* << AEFX_CELL_SIZE */ + + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/External/AE SDK/Util/AEFX_ChannelDepthTpl.h b/External/AE SDK/Util/AEFX_ChannelDepthTpl.h new file mode 100644 index 00000000..55c0546d --- /dev/null +++ b/External/AE SDK/Util/AEFX_ChannelDepthTpl.h @@ -0,0 +1,59 @@ +#ifndef _H_AEFX_CHANNELDEPTHTPL +#define _H_AEFX_CHANNELDEPTHTPL + +/** AEFX_ChannelDepthTpl.h + + (c) 2005 Adobe Systems Incorporated + +**/ + +// Basic pixel traits structure. This structure is never used per se, merely overidden -- see below. +template +struct PixelTraits { + typedef int PixType; + typedef int DataType; + static DataType + LutFunc(DataType input, const DataType *map); + + enum {max_value = 0 }; +}; + + +// 8 bit pixel types, constants, and functions +template <> +struct PixelTraits{ + typedef PF_Pixel8 PixType; + typedef u_char DataType; + static DataType + LutFunc(DataType input, const DataType *map){return map[input];} + enum {max_value = PF_MAX_CHAN8}; +}; + +// 16 bit pixel types, constants, and functions +template <> +struct PixelTraits{ + typedef PF_Pixel16 PixType; + typedef u_short DataType; + static u_short + LutFunc(u_short input, const u_short *map); + enum {max_value = PF_MAX_CHAN16}; +}; + + +inline u_short +PixelTraits::LutFunc(u_short input, + const u_short *map) +{ + u_short index = input >> (15 - PF_TABLE_BITS); + uint32_t fract = input & ((1 << (15 - PF_TABLE_BITS)) - 1); + A_long result = map [index]; + + if (fract) { + result += ((((A_long) map [index + 1] - result) * fract) + + (1 << (14 - PF_TABLE_BITS))) >> (15 - PF_TABLE_BITS); + } + return (u_short) result; + +} + +#endif //_H_AEFX_CHANNELDEPTHTPL \ No newline at end of file diff --git a/External/AE SDK/Util/AEFX_SuiteHelper.c b/External/AE SDK/Util/AEFX_SuiteHelper.c new file mode 100644 index 00000000..9ddd9b2a --- /dev/null +++ b/External/AE SDK/Util/AEFX_SuiteHelper.c @@ -0,0 +1,139 @@ +/************************************************************************** +* +* ADOBE CONFIDENTIAL +* ___________________ +* +* Copyright 2009 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains the property of +* Adobe Systems Incorporated and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe Systems +* Incorporated and its suppliers and may be covered by U.S. and Foreign +* Patents,patents in process,and are protected by trade secret or copyright +* law. Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained from +* Adobe Systems Incorporated. +**************************************************************************/ + + +/** AEFX_SuiteHelper.c + + Contains helper routines for acquiring/releasing suites. + +**/ + +#include "AEFX_SuiteHelper.h" +#include + +PF_Err AEFX_AcquireSuite( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version, /* >> */ + const char *error_stringPC0, /* >> */ + void **suite) /* << */ +{ + PF_Err err = PF_Err_NONE; + SPBasicSuite *bsuite; + + bsuite = in_data->pica_basicP; + + if (bsuite) { + (*bsuite->AcquireSuite)((char*)name, version, (const void**)suite); + + if (!*suite) { + err = PF_Err_BAD_CALLBACK_PARAM; + } + } else { + err = PF_Err_BAD_CALLBACK_PARAM; + } + + if (err) { + const char *error_stringPC = error_stringPC0 ? error_stringPC0 : "Not able to acquire AEFX Suite."; + + out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + + PF_SPRINTF(out_data->return_msg, error_stringPC); + } + + return err; +} + + + +PF_Err AEFX_ReleaseSuite( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version, /* >> */ + const char *error_stringPC0) /* >> */ +{ + PF_Err err = PF_Err_NONE; + SPBasicSuite *bsuite; + + bsuite = in_data->pica_basicP; + + if (bsuite) { + (*bsuite->ReleaseSuite)((char*)name, version); + } else { + err = PF_Err_BAD_CALLBACK_PARAM; + } + + if (err) { + const char *error_stringPC = error_stringPC0 ? error_stringPC0 : "Not able to release AEFX Suite."; + + out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + + PF_SPRINTF(out_data->return_msg, error_stringPC); + } + + return err; +} + + +PF_Err AEFX_AcquireDrawbotSuites( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + DRAWBOT_Suites *suitesP) /* << */ +{ + PF_Err err = PF_Err_NONE; + + if (suitesP == NULL) { + out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE; + + PF_SPRINTF(out_data->return_msg, "NULL suite pointer passed to AEFX_AcquireDrawbotSuites"); + + err = PF_Err_UNRECOGNIZED_PARAM_TYPE; + } + + if (!err) { + err = AEFX_AcquireSuite(in_data, out_data, kDRAWBOT_DrawSuite, kDRAWBOT_DrawSuite_VersionCurrent, NULL, (void **)&suitesP->drawbot_suiteP); + } + if (!err) { + err = AEFX_AcquireSuite(in_data, out_data, kDRAWBOT_SupplierSuite, kDRAWBOT_SupplierSuite_VersionCurrent, NULL, (void **)&suitesP->supplier_suiteP); + } + if (!err) { + err = AEFX_AcquireSuite(in_data, out_data, kDRAWBOT_SurfaceSuite, kDRAWBOT_SurfaceSuite_VersionCurrent, NULL, (void **)&suitesP->surface_suiteP); + } + if (!err) { + err = AEFX_AcquireSuite(in_data, out_data, kDRAWBOT_PathSuite, kDRAWBOT_PathSuite_VersionCurrent, NULL, (void **)&suitesP->path_suiteP); + } + + return err; +} + + +PF_Err AEFX_ReleaseDrawbotSuites( PF_InData *in_data, /* >> */ + PF_OutData *out_data) /* >> */ +{ + PF_Err err = PF_Err_NONE; + + AEFX_ReleaseSuite(in_data, out_data, kDRAWBOT_DrawSuite, kDRAWBOT_DrawSuite_VersionCurrent, NULL); + AEFX_ReleaseSuite(in_data, out_data, kDRAWBOT_SupplierSuite, kDRAWBOT_SupplierSuite_VersionCurrent, NULL); + AEFX_ReleaseSuite(in_data, out_data, kDRAWBOT_SurfaceSuite, kDRAWBOT_SurfaceSuite_VersionCurrent, NULL); + AEFX_ReleaseSuite(in_data, out_data, kDRAWBOT_PathSuite, kDRAWBOT_PathSuite_VersionCurrent, NULL); + + return err; +} + + + + diff --git a/External/AE SDK/Util/AEFX_SuiteHelper.h b/External/AE SDK/Util/AEFX_SuiteHelper.h new file mode 100644 index 00000000..2ede44c8 --- /dev/null +++ b/External/AE SDK/Util/AEFX_SuiteHelper.h @@ -0,0 +1,157 @@ +/************************************************************************** +* +* ADOBE CONFIDENTIAL +* ___________________ +* +* Copyright 2009 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains the property of +* Adobe Systems Incorporated and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe Systems +* Incorporated and its suppliers and may be covered by U.S. and Foreign +* Patents,patents in process,and are protected by trade secret or copyright +* law. Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained from +* Adobe Systems Incorporated. +**************************************************************************/ + +#ifndef AEFX_SUITE_HELPER_H +#define AEFX_SUITE_HELPER_H + + +/** AEFX_SuiteHelper.h + + Contains helper routines for acquiring/releasing suites. + + NOTE: If you're writing C++ plug-ins that support exceptions, use the AEGP_SuiteHandler class or AEFX_SuiteScoper. + +**/ + +#include +#include +#include +#include + + + +#ifdef __cplusplus + extern "C" { +#endif + +PF_Err AEFX_AcquireSuite( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version, /* >> */ + const char *error_stringPC0, /* >> */ + void **suite); /* << */ + + +PF_Err AEFX_ReleaseSuite( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version, /* >> */ + const char *error_stringPC0); /* >> */ + + +PF_Err AEFX_AcquireDrawbotSuites( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + DRAWBOT_Suites *suiteP); /* << */ + + +PF_Err AEFX_ReleaseDrawbotSuites( PF_InData *in_data, /* >> */ + PF_OutData *out_data); /* >> */ + + +#ifdef __cplusplus + } +#endif + + +#ifdef __cplusplus + + template + class AEFX_SuiteHelperT + { + public: + AEFX_SuiteHelperT( PF_InData *in_data, /* >> */ + PF_OutData *out_data, /* >> */ + const char *name, /* >> */ + int32_t version) : /* >> */ + mInDataP(in_data), mOutDataP(out_data), mSuiteName(name), mSuiteVersion(version), mSuiteP(NULL) + { + void *suiteP(NULL); + + PF_Err err = AEFX_AcquireSuite(mInDataP, mOutDataP, mSuiteName, mSuiteVersion, NULL, &suiteP); + + if (err) { + A_THROW(err); + } + + mSuiteP = reinterpret_cast(suiteP); + } + + ~AEFX_SuiteHelperT() + { + (void)AEFX_ReleaseSuite(mInDataP, mOutDataP, mSuiteName, mSuiteVersion, NULL); + } + + const SuiteType* operator->() const + { + return mSuiteP; + } + + SuiteType* get() const + { + return mSuiteP; + } + + private: + + PF_InData *mInDataP; + PF_OutData *mOutDataP; + const char *mSuiteName; + int32_t mSuiteVersion; + SuiteType *mSuiteP; + }; + + + +// clients of this class probably should just be using the regular template +// instead + +class AEFX_DrawbotSuitesScoper +{ +public: + AEFX_DrawbotSuitesScoper(PF_InData *in_data, PF_OutData *out_data) + : + i_in_data(in_data), + i_out_data(out_data) + { + PF_Err err = AEFX_AcquireDrawbotSuites(in_data, out_data, &i_suites); + + if (err) { + A_THROW(err); + } + } + + inline DRAWBOT_Suites* Get() + { + return &i_suites; + } + + ~AEFX_DrawbotSuitesScoper() + { + AEFX_ReleaseDrawbotSuites(i_in_data, i_out_data); + } + +private: + DRAWBOT_Suites i_suites; + PF_InData *i_in_data; + PF_OutData *i_out_data; +}; + +#endif + + +#endif // AEFX_SUITE_HELPER_H diff --git a/External/AE SDK/Util/AEGP_SuiteHandler.cpp b/External/AE SDK/Util/AEGP_SuiteHandler.cpp new file mode 100644 index 00000000..146a5f5e --- /dev/null +++ b/External/AE SDK/Util/AEGP_SuiteHandler.cpp @@ -0,0 +1,66 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +/** AEGP_SuiteHandler.cpp + + Implementation of AEGP_SuiteHandler non-inlines. See AEGP_SuiteHandler.h for usage. + + created 9/11/2000 jms +**/ + + +#include +#include + +AEGP_SuiteHandler::AEGP_SuiteHandler(const SPBasicSuite *pica_basicP) : + i_pica_basicP(pica_basicP) +{ + AEFX_CLR_STRUCT(i_suites); + + if (!i_pica_basicP) { //can't construct w/out basic suite, everything else is demand loaded + MissingSuiteError(); + } +} + +AEGP_SuiteHandler::~AEGP_SuiteHandler() +{ + ReleaseAllSuites(); +} + +// Had to go to the header file to be inlined to please CW mach-o target +/*void *AEGP_SuiteHandler::pLoadSuite(A_char *nameZ, A_long versionL) const +{ + const void *suiteP; + A_long err = i_pica_basicP->AcquireSuite(nameZ, versionL, &suiteP); + + if (err || !suiteP) { + MissingSuiteError(); + } + + return (void*)suiteP; +}*/ + +// Free a particular suite. Ignore errors, because, what is there to be done if release fails? +void AEGP_SuiteHandler::ReleaseSuite(const A_char *nameZ, A_long versionL) +{ + i_pica_basicP->ReleaseSuite(nameZ, versionL); +} + diff --git a/External/AE SDK/Util/AEGP_SuiteHandler.h b/External/AE SDK/Util/AEGP_SuiteHandler.h new file mode 100644 index 00000000..59bc043b --- /dev/null +++ b/External/AE SDK/Util/AEGP_SuiteHandler.h @@ -0,0 +1,601 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + + +/** AEGP_SuiteHandler.h + + DEPRECATED: + This way of doing things is out of date. See AEFX_SuiteHandlerTemplate.h for the + new way of doing things. + + -kjw 2/28/2014 + + A very helpful class that manages demand loading and automatic, exception-safe freeing + of AEGP suites. + + USAGE INSTRUCTIONS: + + The accompanying file, AEGP_SuiteHandler.cpp, is designed to be compiled right into + the client application or plug-in. + + You'll get a link error. + + This is because AEGP_SuiteHandler.cpp lacks a definition for the MissingSuiteError() + method. You must provide one to define the error handling behaviour of the class. + This function may or may not display an error message etc. but it must end + by throwing an exception. It cannot return. + + Other than that, usage is pretty trivial. Construct with a pointer to the PICA + basic suite, and then call the public method to obtain lazily loaded pointers + to other AEGP suites. Upon desctruction, all loaded suites are freed (so this class + is really handy for writing exception-safe AEGP code.) + + NOTE!!! If you need to upgrade a suite, DO NOT SIMPLY UPDATE THE VERSION NUMBER. + You should: + 1. Add a new member to the Suites structure for that suite. + 2. Add the boiler plate macro to release the suite in ReleaseAllSuites (AEGP_SUITE_RELEASE_BOILERPLATE). + 3. Add the boiler plate macro to define the suite. (AEGP_SUITE_ACCESS_BOILERPLATE) + + If you have any questions, ask me. -jja 5/7/2004 + + If you'll be using ADM suites, #define I_NEED_ADM_SUPPORT before #including AEGP_SuiteHandler.h. + + -bbb 9/16/2004 +**/ + +#ifndef _H_AEGP_SUITEHANDLER +#define _H_AEGP_SUITEHANDLER + +#include +#include +#include +#include +#include +#include +#include + +#ifdef I_NEED_ADM_SUPPORT +#include +#include +#include +#include +#include +#include +#include +#endif + +// Suite registration and handling object +class AEGP_SuiteHandler { + +private: + // forbid copy construct + AEGP_SuiteHandler(const AEGP_SuiteHandler&) {} + AEGP_SuiteHandler& operator=(const AEGP_SuiteHandler&) { return *this; } + + // basic suite pointer + const SPBasicSuite *i_pica_basicP; + + // Suites we can register. These are mutable because they are demand loaded using a const object. + + struct Suites { + AEGP_KeyframeSuite4 *keyframe_suite4P; + AEGP_StreamSuite3 *stream_suite3P; + AEGP_StreamSuite4 *stream_suite4P; + AEGP_StreamSuite5 *stream_suite5P; + AEGP_MarkerSuite1 *marker_suite1P; + AEGP_MarkerSuite2 *marker_suite2P; + AEGP_MarkerSuite3 *marker_suite3P; + AEGP_CompSuite4 *comp_suite4P; + AEGP_CompSuite5 *comp_suite5P; + AEGP_CompSuite6 *comp_suite6P; + AEGP_CompSuite7 *comp_suite7P; + AEGP_CompSuite8 *comp_suite8P; + AEGP_CompSuite9 *comp_suite9P; + AEGP_CompSuite10 *comp_suite10P; + AEGP_CompSuite11 *comp_suite11P; + AEGP_LayerSuite3 *layer_suite3P; + AEGP_LayerSuite4 *layer_suite4P; + AEGP_StreamSuite2 *stream_suite2P; + AEGP_DynamicStreamSuite2 *dynamic_stream_suite2P; + AEGP_DynamicStreamSuite3 *dynamic_stream_suite3P; + AEGP_DynamicStreamSuite4 *dynamic_stream_suite4P; + AEGP_KeyframeSuite3 *keyframe_suite3P; + AEGP_CanvasSuite5 *canvas_suite5P; + AEGP_CanvasSuite6 *canvas_suite6P; + AEGP_CanvasSuite7 *canvas_suite7P; + AEGP_CanvasSuite8 *canvas_suite8P; + AEGP_CameraSuite2 *camera_suite2P; + AEGP_RegisterSuite5 *register_suite5P; + AEGP_MemorySuite1 *memory_suite1P; + AEGP_ItemViewSuite1 *item_view_suite1P; + AEGP_ItemSuite9 *item_suite9P; + AEGP_ItemSuite8 *item_suite8P; + AEGP_ItemSuite7 *item_suite7P; + AEGP_ItemSuite6 *item_suite6P; + AEGP_ItemSuite5 *item_suite5P; + AEGP_ItemSuite1 *item_suite1P; + AEGP_LightSuite1 *light_suite1P; + AEGP_LightSuite2 *light_suite2P; + AEGP_EffectSuite1 *effect_suite1P; + AEGP_EffectSuite2 *effect_suite2P; + AEGP_EffectSuite3 *effect_suite3P; + AEGP_EffectSuite4 *effect_suite4P; + AEGP_MaskSuite4 *mask_suite4P; + AEGP_MaskOutlineSuite1 *mask_outline_suite1P; + AEGP_MaskOutlineSuite2 *mask_outline_suite2P; + AEGP_MaskOutlineSuite3 *mask_outline_suite3P; + AEGP_CommandSuite1 *command_suite1P; + AEGP_UtilitySuite3 *utility_suite3P; + AEGP_RenderSuite1 *render_suite1P; + AEGP_RenderSuite2 *render_suite2P; + AEGP_RenderSuite3 *render_suite3P; + AEGP_RenderSuite4 *render_suite4P; + AEGP_RenderSuite5 *render_suite5P; + PF_ANSICallbacksSuite1 *ansi_callbacks_suite1P; + PF_HandleSuite1 *handle_suite1P; + PF_FillMatteSuite2 *fill_matte_suite2P; + PF_WorldTransformSuite1 *world_transform_suite1P; + AEGP_QueryXformSuite2 *query_xform_suite2P; + AEGP_CompositeSuite2 *composite_suite2P; + PF_WorldSuite1 *world_suite1P; + AEGP_PFInterfaceSuite1 *pf_interface_suite1P; + AEGP_MathSuite1 *math_suite1P; + PF_AdvTimeSuite4 *adv_time_suite4P; + PF_PathQuerySuite1 *path_query_suite1P; + PF_PathDataSuite1 *path_data_suite1P; + PF_ParamUtilsSuite3 *param_utils_suite3P; + PFAppSuite4 *app_suite4P; + PFAppSuite5 *app_suite5P; + PFAppSuite6 *app_suite6P; + PF_AdvAppSuite2 *adv_app_suite2P; + AEGP_IOInSuite4 *io_in_suite4P; + AEGP_IOOutSuite4 *io_out_suite4P; + AEGP_PersistentDataSuite3 *persistent_data_suite3P; + AEGP_PersistentDataSuite4 *persistent_data_suite4P; + AEGP_RenderQueueSuite1 *render_queue_suite1P; + AEGP_RQItemSuite2 *rq_item_suite2P; + AEGP_OutputModuleSuite4 *output_module_suite4P; + AEGP_FIMSuite3 *fim_suite3P; + PF_Sampling8Suite1 *sampling_8_suite1P; + PF_Sampling16Suite1 *sampling_16_suite1P; + PF_Iterate8Suite1 *iterate_8_suite1P; + PF_iterate16Suite1 *iterate_16_suite1P; + PF_iterateFloatSuite1 *iterate_float_suite1P; + PF_Iterate8Suite2 *iterate_8_suite2P; + PF_iterate16Suite2 *iterate_16_suite2P; + PF_iterateFloatSuite2 *iterate_float_suite2P; + AEGP_CollectionSuite2 *collection_suite2P; + AEGP_TextDocumentSuite1 *text_document_suite1P; + AEGP_SoundDataSuite1 *sound_data_suite1P; + AEGP_IterateSuite1 *aegp_iterate_suite1P; + AEGP_IterateSuite2 *aegp_iterate_suite2P; + AEGP_TextLayerSuite1 *text_layer_suite1P; + AEGP_ArtisanUtilSuite1 *artisan_util_suite1P; + AEGP_WorldSuite2 *aegp_world_suite_2P; + AEGP_WorldSuite3 *aegp_world_suite_3P; + AEGP_RenderOptionsSuite1 *render_options_suite_1P; + AEGP_LayerRenderOptionsSuite1 *layer_render_options_suite_1P; + AEGP_LayerRenderOptionsSuite2 *layer_render_options_suite_2P; + AEGP_RenderAsyncManagerSuite1 *async_manager_suite_1P; + AEGP_TrackerSuite1 *tracker_suite_1P; + AEGP_TrackerUtilitySuite1 *tracker_utility_suite_1P; + PF_HelperSuite2 *helper_suite_2P; + AEGP_LayerSuite5 *layer_suite_5P; + AEGP_LayerSuite6 *layer_suite_6P; + AEGP_LayerSuite7 *layer_suite_7P; + AEGP_LayerSuite8 *layer_suite_8P; + +#ifdef I_NEED_ADM_SUPPORT + ADMBasicSuite8 *adm_basic_suite_8P; + ADMDialogSuite8 *adm_dialog_suite_8P; + ADMDialogGroupSuite3 *adm_dialog_group_suite_3P; + ADMItemSuite8 *adm_item_suite_8P; + ADMListSuite3 *adm_list_suite_3P; + ADMEntrySuite5 *adm_entry_suite_5P; + ADMNotifierSuite2 *adm_notifier_suite_2P; +#endif + AEGP_LayerSuite1 *layer_suite_1P; + AEGP_MaskSuite1 *mask_suite_1P; + AEGP_MaskSuite5 *mask_suite_5P; + AEGP_MaskSuite6 *mask_suite_6P; + AEGP_StreamSuite1 *stream_suite_1P; + AEGP_CompSuite1 *comp_suite_1P; + AEGP_CollectionSuite1 *collection_suite_1P; + AEGP_KeyframeSuite1 *keyframe_suite_1P; + PF_AdvAppSuite1 *adv_app_suite_1P; + AEGP_UtilitySuite1 *utility_suite_1P; + AEGP_RenderOptionsSuite2 *render_options_suite_2P; + AEGP_ProjSuite5 *proj_suite_5P; + AEGP_ProjSuite6 *proj_suite_6P; + AEGP_FootageSuite5 *footage_suite_5P; + AEGP_RQItemSuite3 *rq_item_suite_3P; + AEGP_UtilitySuite4 *utility_suite_4P; + AEGP_ColorSettingsSuite3 *color_settings_suite_3P; + AEGP_ColorSettingsSuite2 *color_settings_suite_2P; + AEGP_ColorSettingsSuite1 *color_settings_suite_1P; + PF_AdvItemSuite1 *adv_item_suite_1P; + AEGP_RenderOptionsSuite3 *render_options_suite_3P; + PF_ColorParamSuite1 *color_param_suite_1P; + PF_SamplingFloatSuite1 *sampling_float_suite_1P; + AEGP_UtilitySuite5 *utility_suite_5P; + AEGP_UtilitySuite6 *utility_suite_6P; + PF_EffectCustomUISuite1 *custom_ui_suite1P; + PF_EffectCustomUISuite2 *custom_ui_suite2P; + PF_EffectCustomUIOverlayThemeSuite1 *custom_ui_theme_suite1P; + + //Drawbot Suites + DRAWBOT_DrawbotSuiteCurrent *drawing_suite_currentP; + DRAWBOT_SupplierSuiteCurrent *drawbot_supplier_suite_currentP; + DRAWBOT_SurfaceSuiteCurrent *drawbot_surface_suite_currentP; + DRAWBOT_PathSuiteCurrent *drawbot_path_suite_currentP; + + SPSuitesSuite *suites_suite_2P; + }; + + mutable Suites i_suites; + + // private methods + // I had to make this inline by moving the definition from the .cpp file + // CW mach-o target was freaking otherwise when seeing the call to this + // function in inlined public suite accessors below + + void *LoadSuite(const A_char *nameZ, A_long versionL) const + { + const void *suiteP; + A_long err = i_pica_basicP->AcquireSuite(nameZ, versionL, &suiteP); + + if (err || !suiteP) { + MissingSuiteError(); + } + + return (void*)suiteP; + } + + void ReleaseSuite(const A_char *nameZ, A_long versionL); + void ReleaseAllSuites() + { + #define AEGP_SUITE_RELEASE_BOILERPLATE(MEMBER_NAME, kSUITE_NAME, kVERSION_NAME) \ + if (i_suites.MEMBER_NAME) { \ + ReleaseSuite(kSUITE_NAME, kVERSION_NAME); \ + } + + AEGP_SUITE_RELEASE_BOILERPLATE(marker_suite1P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(marker_suite2P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(marker_suite3P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite3P, kAEGPLayerSuite, kAEGPLayerSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite4P, kAEGPLayerSuite, kAEGPLayerSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite5P, kAEGPStreamSuite, kAEGPStreamSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite4P, kAEGPStreamSuite, kAEGPStreamSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite3P, kAEGPStreamSuite, kAEGPStreamSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite2P, kAEGPStreamSuite, kAEGPStreamSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(stream_suite_1P, kAEGPStreamSuite, kAEGPStreamSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(dynamic_stream_suite2P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(dynamic_stream_suite3P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(dynamic_stream_suite4P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(keyframe_suite4P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(keyframe_suite3P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(keyframe_suite_1P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite4P, kAEGPCompSuite, kAEGPCompSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite5P, kAEGPCompSuite, kAEGPCompSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite6P, kAEGPCompSuite, kAEGPCompSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite7P, kAEGPCompSuite, kAEGPCompSuiteVersion7); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite8P, kAEGPCompSuite, kAEGPCompSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite9P, kAEGPCompSuite, kAEGPCompSuiteVersion9); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite10P, kAEGPCompSuite, kAEGPCompSuiteVersion10); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite11P, kAEGPCompSuite, kAEGPCompSuiteVersion11); + AEGP_SUITE_RELEASE_BOILERPLATE(canvas_suite5P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(canvas_suite6P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(canvas_suite7P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion7); + AEGP_SUITE_RELEASE_BOILERPLATE(canvas_suite8P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(camera_suite2P, kAEGPCameraSuite, kAEGPCameraSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(register_suite5P, kAEGPRegisterSuite, kAEGPRegisterSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(item_view_suite1P, kAEGPItemViewSuite, kAEGPItemViewSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite8P, kAEGPItemSuite, kAEGPItemSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite7P, kAEGPItemSuite, kAEGPItemSuiteVersion7); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite6P, kAEGPItemSuite, kAEGPItemSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite5P, kAEGPItemSuite, kAEGPItemSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(item_suite1P, kAEGPItemSuite, kAEGPItemSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(pf_interface_suite1P, kAEGPPFInterfaceSuite, kAEGPPFInterfaceSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(math_suite1P, kAEGPMathSuite, kAEGPMathSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_time_suite4P, kPFAdvTimeSuite, kPFAdvTimeSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(path_query_suite1P, kPFPathQuerySuite, kPFPathQuerySuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(memory_suite1P, kAEGPMemorySuite, kAEGPMemorySuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(path_data_suite1P, kPFPathDataSuite, kPFPathDataSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(param_utils_suite3P, kPFParamUtilsSuite, kPFParamUtilsSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(app_suite4P, kPFAppSuite, kPFAppSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(app_suite5P, kPFAppSuite, kPFAppSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(app_suite6P, kPFAppSuite, kPFAppSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_app_suite2P, kPFAdvAppSuite, kPFAdvAppSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(light_suite1P, kAEGPLightSuite, kAEGPLightSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(light_suite2P, kAEGPLightSuite, kAEGPLightSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(effect_suite1P, kAEGPEffectSuite, kAEGPEffectSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(effect_suite2P, kAEGPEffectSuite, kAEGPEffectSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(effect_suite3P, kAEGPEffectSuite, kAEGPEffectSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(effect_suite4P, kAEGPEffectSuite, kAEGPEffectSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_suite4P, kAEGPMaskSuite, kAEGPMaskSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_outline_suite1P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_outline_suite2P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_outline_suite3P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(command_suite1P, kAEGPCommandSuite, kAEGPCommandSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite3P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite1P, kAEGPRenderSuite, kAEGPRenderSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite2P, kAEGPRenderSuite, kAEGPRenderSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite3P, kAEGPRenderSuite, kAEGPRenderSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite4P, kAEGPRenderSuite, kAEGPRenderSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(render_suite5P, kAEGPRenderSuite, kAEGPRenderSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(ansi_callbacks_suite1P, kPFANSISuite, kPFANSISuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(handle_suite1P, kPFHandleSuite, kPFHandleSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(fill_matte_suite2P, kPFFillMatteSuite, kPFFillMatteSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(world_transform_suite1P, kPFWorldTransformSuite, kPFWorldTransformSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(query_xform_suite2P, kAEGPQueryXformSuite, kAEGPQueryXformSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(composite_suite2P, kAEGPCompositeSuite, kAEGPCompositeSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(world_suite1P, kPFWorldSuite, kPFWorldSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(io_in_suite4P, kAEGPIOInSuite, kAEGPIOInSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(io_out_suite4P, kAEGPIOOutSuite, kAEGPIOOutSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(render_queue_suite1P, kAEGPRenderQueueSuite, kAEGPRenderQueueSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(rq_item_suite2P, kAEGPRQItemSuite, kAEGPRQItemSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(output_module_suite4P, kAEGPOutputModuleSuite, kAEGPOutputModuleSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(fim_suite3P, kAEGPFIMSuite, kAEGPFIMSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(math_suite1P, kAEGPMathSuite, kAEGPMathSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_time_suite4P, kPFAdvTimeSuite, kPFAdvTimeSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(sampling_8_suite1P, kPFSampling8Suite, kPFSampling8SuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(sampling_16_suite1P, kPFSampling16Suite, kPFSampling16SuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_8_suite1P, kPFIterate8Suite, kPFIterate8SuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_16_suite1P, kPFIterate16Suite, kPFIterate16SuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_float_suite1P, kPFIterateFloatSuite, kPFIterateFloatSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_8_suite2P, kPFIterate8Suite, kPFIterate8SuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_16_suite2P, kPFIterate16Suite, kPFIterate16SuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(iterate_float_suite2P, kPFIterateFloatSuite, kPFIterateFloatSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(collection_suite2P, kAEGPCollectionSuite, kAEGPCollectionSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(text_document_suite1P, kAEGPTextDocumentSuite, kAEGPTextDocumentSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(sound_data_suite1P, kAEGPSoundDataSuite, kAEGPSoundDataVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(text_layer_suite1P, kAEGPTextLayerSuite, kAEGPTextLayerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(artisan_util_suite1P, kAEGPArtisanUtilSuite, kAEGPArtisanUtilSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(aegp_world_suite_2P, kAEGPWorldSuite, kAEGPWorldSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(aegp_world_suite_3P, kAEGPWorldSuite, kAEGPWorldSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(render_options_suite_1P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(tracker_suite_1P, kAEGPTrackerSuite, kAEGPTrackerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(tracker_utility_suite_1P, kAEGPTrackerUtilitySuite, kAEGPTrackerUtilitySuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(helper_suite_2P, kPFHelperSuite2, kPFHelperSuite2Version2); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_5P, kAEGPLayerSuite, kAEGPLayerSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_6P, kAEGPLayerSuite, kAEGPLayerSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_7P, kAEGPLayerSuite, kAEGPLayerSuiteVersion7); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_8P, kAEGPLayerSuite, kAEGPLayerSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_item_suite_1P, kPFAdvItemSuite, kPFAdvItemSuiteVersion1); +#ifdef I_NEED_ADM_SUPPORT + AEGP_SUITE_RELEASE_BOILERPLATE(adm_basic_suite_8P, kADMBasicSuite, kADMBasicSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_dialog_suite_8P, kADMDialogSuite, kADMDialogSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_dialog_group_suite_3P, kADMDialogGroupSuite, kADMDialogGroupSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_item_suite_8P, kADMItemSuite, kADMItemSuiteVersion8); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_list_suite_3P, kADMListSuite, kADMListSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_entry_suite_5P, kADMEntrySuite, kADMEntrySuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(adm_notifier_suite_2P, kADMNotifierSuite, kADMNotifierSuiteVersion2); +#endif + AEGP_SUITE_RELEASE_BOILERPLATE(layer_suite_1P, kAEGPLayerSuite, kAEGPLayerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_suite_1P, kAEGPMaskSuite, kAEGPMaskSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_suite_5P, kAEGPMaskSuite, kAEGPMaskSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(mask_suite_6P, kAEGPMaskSuite, kAEGPMaskSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(comp_suite_1P, kAEGPCompSuite, kAEGPCompSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(collection_suite_1P, kAEGPCollectionSuite, kAEGPCollectionSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(adv_app_suite_1P, kPFAdvAppSuite, kPFAdvAppSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite_1P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(render_options_suite_2P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_render_options_suite_1P, kAEGPLayerRenderOptionsSuite, kAEGPLayerRenderOptionsSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(layer_render_options_suite_2P, kAEGPLayerRenderOptionsSuite, kAEGPLayerRenderOptionsSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(async_manager_suite_1P, kAEGPRenderAsyncManagerSuite, kAEGPRenderAsyncManagerSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(proj_suite_5P, kAEGPProjSuite, kAEGPProjSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(proj_suite_6P, kAEGPProjSuite, kAEGPProjSuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(footage_suite_5P, kAEGPFootageSuite, kAEGPFootageSuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(rq_item_suite_3P, kAEGPRQItemSuite, kAEGPRQItemSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite_4P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(persistent_data_suite4P, kAEGPPersistentDataSuite, kAEGPPersistentDataSuiteVersion4); + AEGP_SUITE_RELEASE_BOILERPLATE(persistent_data_suite3P, kAEGPPersistentDataSuite, kAEGPPersistentDataSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(color_settings_suite_3P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion3); + AEGP_SUITE_RELEASE_BOILERPLATE(color_settings_suite_2P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(color_settings_suite_1P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(color_param_suite_1P, kPFColorParamSuite, kPFColorParamSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(sampling_float_suite_1P, kPFSamplingFloatSuite, kPFSamplingFloatSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite_5P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion5); + AEGP_SUITE_RELEASE_BOILERPLATE(utility_suite_6P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion6); + AEGP_SUITE_RELEASE_BOILERPLATE(custom_ui_suite1P, kPFEffectCustomUISuite, kPFEffectCustomUISuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(custom_ui_suite2P, kPFEffectCustomUISuite, kPFEffectCustomUISuiteVersion2); + AEGP_SUITE_RELEASE_BOILERPLATE(custom_ui_theme_suite1P, kPFEffectCustomUIOverlayThemeSuite, kPFEffectCustomUIOverlayThemeSuiteVersion1); + AEGP_SUITE_RELEASE_BOILERPLATE(drawing_suite_currentP, kDRAWBOT_DrawSuite, kDRAWBOT_DrawSuite_VersionCurrent); + AEGP_SUITE_RELEASE_BOILERPLATE(drawbot_supplier_suite_currentP, kDRAWBOT_SupplierSuite, kDRAWBOT_SupplierSuite_VersionCurrent); + AEGP_SUITE_RELEASE_BOILERPLATE(drawbot_surface_suite_currentP, kDRAWBOT_SurfaceSuite, kDRAWBOT_SurfaceSuite_VersionCurrent); + AEGP_SUITE_RELEASE_BOILERPLATE(drawbot_path_suite_currentP, kDRAWBOT_PathSuite, kDRAWBOT_PathSuite_VersionCurrent); + AEGP_SUITE_RELEASE_BOILERPLATE(suites_suite_2P, kSPSuitesSuite, kSPSuitesSuiteVersion); +} + + // Here is the error handling function which must be defined. + // It must exit by throwing an exception, it cannot return. + void MissingSuiteError() const; + +public: + // To construct, pass pica_basicP + AEGP_SuiteHandler(const SPBasicSuite *pica_basicP); + ~AEGP_SuiteHandler(); + + const SPBasicSuite *Pica() const { return i_pica_basicP; } + + #define AEGP_SUITE_ACCESS_BOILERPLATE(SUITE_NAME, VERSION_NUMBER, SUITE_PREFIX, MEMBER_NAME, kSUITE_NAME, kVERSION_NAME) \ + SUITE_PREFIX##SUITE_NAME##VERSION_NUMBER *SUITE_NAME##VERSION_NUMBER() const \ + { \ + if (i_suites.MEMBER_NAME == NULL) { \ + i_suites.MEMBER_NAME = (SUITE_PREFIX##SUITE_NAME##VERSION_NUMBER*) \ + LoadSuite(kSUITE_NAME, kVERSION_NAME); \ + } \ + return i_suites.MEMBER_NAME; \ + } + + AEGP_SUITE_ACCESS_BOILERPLATE(MarkerSuite, 1, AEGP_, marker_suite1P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MarkerSuite, 2, AEGP_, marker_suite2P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(MarkerSuite, 3, AEGP_, marker_suite3P, kAEGPMarkerSuite, kAEGPMarkerSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 3, AEGP_, layer_suite3P, kAEGPLayerSuite, kAEGPLayerSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 4, AEGP_, layer_suite4P, kAEGPLayerSuite, kAEGPLayerSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 5, AEGP_, stream_suite5P, kAEGPStreamSuite, kAEGPStreamSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 4, AEGP_, stream_suite4P, kAEGPStreamSuite, kAEGPStreamSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 3, AEGP_, stream_suite3P, kAEGPStreamSuite, kAEGPStreamSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 2, AEGP_, stream_suite2P, kAEGPStreamSuite, kAEGPStreamSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(StreamSuite, 1, AEGP_, stream_suite_1P, kAEGPStreamSuite, kAEGPStreamSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(DynamicStreamSuite, 2, AEGP_, dynamic_stream_suite2P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(DynamicStreamSuite, 3, AEGP_, dynamic_stream_suite3P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(DynamicStreamSuite, 4, AEGP_, dynamic_stream_suite4P, kAEGPDynamicStreamSuite, kAEGPDynamicStreamSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(KeyframeSuite, 4, AEGP_, keyframe_suite4P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(KeyframeSuite, 3, AEGP_, keyframe_suite3P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(KeyframeSuite, 1, AEGP_, keyframe_suite_1P, kAEGPKeyframeSuite, kAEGPKeyframeSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 4, AEGP_, comp_suite4P, kAEGPCompSuite, kAEGPCompSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 5, AEGP_, comp_suite5P, kAEGPCompSuite, kAEGPCompSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 6, AEGP_, comp_suite6P, kAEGPCompSuite, kAEGPCompSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 7, AEGP_, comp_suite7P, kAEGPCompSuite, kAEGPCompSuiteVersion7); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 8, AEGP_, comp_suite8P, kAEGPCompSuite, kAEGPCompSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 9, AEGP_, comp_suite9P, kAEGPCompSuite, kAEGPCompSuiteVersion9); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 10, AEGP_, comp_suite10P, kAEGPCompSuite, kAEGPCompSuiteVersion10); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 11, AEGP_, comp_suite11P, kAEGPCompSuite, kAEGPCompSuiteVersion11); + AEGP_SUITE_ACCESS_BOILERPLATE(CanvasSuite, 5, AEGP_, canvas_suite5P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(CanvasSuite, 6, AEGP_, canvas_suite6P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(CanvasSuite, 7, AEGP_, canvas_suite7P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion7); + AEGP_SUITE_ACCESS_BOILERPLATE(CanvasSuite, 8, AEGP_, canvas_suite8P, kAEGPCanvasSuite, kAEGPCanvasSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(CameraSuite, 2, AEGP_, camera_suite2P, kAEGPCameraSuite, kAEGPCameraSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(RegisterSuite, 5, AEGP_, register_suite5P, kAEGPRegisterSuite, kAEGPRegisterSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(MemorySuite, 1, AEGP_, memory_suite1P, kAEGPMemorySuite, kAEGPMemorySuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemViewSuite, 1, AEGP_, item_view_suite1P, kAEGPItemViewSuite, kAEGPItemViewSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 9, AEGP_, item_suite9P, kAEGPItemSuite, kAEGPItemSuiteVersion9); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 8, AEGP_, item_suite8P, kAEGPItemSuite, kAEGPItemSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 7, AEGP_, item_suite7P, kAEGPItemSuite, kAEGPItemSuiteVersion7); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 6, AEGP_, item_suite6P, kAEGPItemSuite, kAEGPItemSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 5, AEGP_, item_suite5P, kAEGPItemSuite, kAEGPItemSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 1, AEGP_, item_suite1P, kAEGPItemSuite, kAEGPItemSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(PFInterfaceSuite, 1, AEGP_, pf_interface_suite1P, kAEGPPFInterfaceSuite, kAEGPPFInterfaceSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MathSuite, 1, AEGP_, math_suite1P, kAEGPMathSuite, kAEGPMathSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(AdvTimeSuite, 4, PF_, adv_time_suite4P, kPFAdvTimeSuite, kPFAdvTimeSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(PathQuerySuite, 1, PF_, path_query_suite1P, kPFPathQuerySuite, kPFPathQuerySuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(PathDataSuite, 1, PF_, path_data_suite1P, kPFPathDataSuite, kPFPathDataSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ParamUtilsSuite, 3, PF_, param_utils_suite3P, kPFParamUtilsSuite, kPFParamUtilsSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(AppSuite, 4, PF, app_suite4P, kPFAppSuite, kPFAppSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(AppSuite, 5, PF, app_suite5P, kPFAppSuite, kPFAppSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(AppSuite, 6, PF, app_suite6P, kPFAppSuite, kPFAppSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(AdvAppSuite, 2, PF_, adv_app_suite2P, kPFAdvAppSuite, kPFAdvAppSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(LightSuite, 1, AEGP_, light_suite1P, kAEGPLightSuite, kAEGPLightSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(LightSuite, 2, AEGP_, light_suite2P, kAEGPLightSuite, kAEGPLightSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectSuite, 1, AEGP_, effect_suite1P, kAEGPEffectSuite, kAEGPEffectSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectSuite, 2, AEGP_, effect_suite2P, kAEGPEffectSuite, kAEGPEffectSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectSuite, 3, AEGP_, effect_suite3P, kAEGPEffectSuite, kAEGPEffectSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectSuite, 4, AEGP_, effect_suite4P, kAEGPEffectSuite, kAEGPEffectSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskSuite, 4, AEGP_, mask_suite4P, kAEGPMaskSuite, kAEGPMaskSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskOutlineSuite, 1, AEGP_, mask_outline_suite1P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskOutlineSuite, 2, AEGP_, mask_outline_suite2P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskOutlineSuite, 3, AEGP_, mask_outline_suite3P, kAEGPMaskOutlineSuite, kAEGPMaskOutlineSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(CommandSuite, 1, AEGP_, command_suite1P, kAEGPCommandSuite, kAEGPCommandSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 3, AEGP_, utility_suite3P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 1, AEGP_, render_suite1P, kAEGPRenderSuite, kAEGPRenderSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 2, AEGP_, render_suite2P, kAEGPRenderSuite, kAEGPRenderSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 3, AEGP_, render_suite3P, kAEGPRenderSuite, kAEGPRenderSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 4, AEGP_, render_suite4P, kAEGPRenderSuite, kAEGPRenderSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderSuite, 5, AEGP_, render_suite5P, kAEGPRenderSuite, kAEGPRenderSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(ANSICallbacksSuite, 1, PF_, ansi_callbacks_suite1P, kPFANSISuite, kPFANSISuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(HandleSuite, 1, PF_, handle_suite1P, kPFHandleSuite, kPFHandleSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(FillMatteSuite, 2, PF_, fill_matte_suite2P, kPFFillMatteSuite, kPFFillMatteSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(WorldTransformSuite, 1, PF_, world_transform_suite1P, kPFWorldTransformSuite, kPFWorldTransformSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(QueryXformSuite, 2, AEGP_, query_xform_suite2P, kAEGPQueryXformSuite, kAEGPQueryXformSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(CompositeSuite, 2, AEGP_, composite_suite2P, kAEGPCompositeSuite, kAEGPCompositeSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(WorldSuite, 1, PF_, world_suite1P, kPFWorldSuite, kPFWorldSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(IOInSuite, 4, AEGP_, io_in_suite4P, kAEGPIOInSuite, kAEGPIOInSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(IOOutSuite, 4, AEGP_, io_out_suite4P, kAEGPIOOutSuite, kAEGPIOOutSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderQueueSuite, 1, AEGP_, render_queue_suite1P, kAEGPRenderQueueSuite, kAEGPRenderQueueSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(RQItemSuite, 2, AEGP_, rq_item_suite2P, kAEGPRQItemSuite, kAEGPRQItemSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(OutputModuleSuite, 4, AEGP_, output_module_suite4P, kAEGPOutputModuleSuite, kAEGPOutputModuleSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(FIMSuite, 3, AEGP_, fim_suite3P, kAEGPFIMSuite, kAEGPFIMSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(Sampling8Suite, 1, PF_, sampling_8_suite1P, kPFSampling8Suite, kPFSampling8SuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(Sampling16Suite, 1, PF_, sampling_16_suite1P, kPFSampling16Suite, kPFSampling16SuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(Iterate8Suite, 1, PF_, iterate_8_suite1P, kPFIterate8Suite, kPFIterate8SuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(Iterate16Suite, 1, PF_, iterate_16_suite1P, kPFIterate16Suite, kPFIterate16SuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(IterateFloatSuite, 1, PF_, iterate_float_suite1P, kPFIterateFloatSuite, kPFIterateFloatSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(Iterate8Suite, 2, PF_, iterate_8_suite2P, kPFIterate8Suite, kPFIterate8SuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(Iterate16Suite, 2, PF_, iterate_16_suite2P, kPFIterate16Suite, kPFIterate16SuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(IterateFloatSuite, 2, PF_, iterate_float_suite2P, kPFIterateFloatSuite, kPFIterateFloatSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(CollectionSuite, 2, AEGP_, collection_suite2P, kAEGPCollectionSuite, kAEGPCollectionSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(TextDocumentSuite, 1, AEGP_, text_document_suite1P, kAEGPTextDocumentSuite, kAEGPTextDocumentSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(SoundDataSuite, 1, AEGP_, sound_data_suite1P, kAEGPSoundDataSuite, kAEGPSoundDataVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(IterateSuite, 1, AEGP_, aegp_iterate_suite1P, kAEGPIterateSuite, kAEGPIterateSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(IterateSuite, 2, AEGP_, aegp_iterate_suite2P, kAEGPIterateSuite, kAEGPIterateSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(TextLayerSuite, 1, AEGP_, text_layer_suite1P, kAEGPTextLayerSuite, kAEGPTextLayerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ArtisanUtilSuite, 1, AEGP_, artisan_util_suite1P, kAEGPArtisanUtilSuite, kAEGPArtisanUtilSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(WorldSuite, 2, AEGP_, aegp_world_suite_2P, kAEGPWorldSuite, kAEGPWorldSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(WorldSuite, 3, AEGP_, aegp_world_suite_3P, kAEGPWorldSuite, kAEGPWorldSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderOptionsSuite, 1, AEGP_, render_options_suite_1P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(TrackerSuite, 1, AEGP_, tracker_suite_1P, kAEGPTrackerSuite, kAEGPTrackerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(TrackerUtilitySuite, 1, AEGP_, tracker_utility_suite_1P, kAEGPTrackerUtilitySuite, kAEGPTrackerUtilitySuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(HelperSuite, 2, PF_, helper_suite_2P, kPFHelperSuite2, kPFHelperSuite2Version2); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 5, AEGP_, layer_suite_5P, kAEGPLayerSuite, kAEGPLayerSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 6, AEGP_, layer_suite_6P, kAEGPLayerSuite, kAEGPLayerSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 7, AEGP_, layer_suite_7P, kAEGPLayerSuite, kAEGPLayerSuiteVersion7); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 8, AEGP_, layer_suite_8P, kAEGPLayerSuite, kAEGPLayerSuiteVersion8); +#ifdef I_NEED_ADM_SUPPORT + AEGP_SUITE_ACCESS_BOILERPLATE(BasicSuite, 8, ADM, adm_basic_suite_8P, kADMBasicSuite, kADMBasicSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(DialogSuite, 8, ADM, adm_dialog_suite_8P, kADMDialogSuite, kADMDialogSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(DialogGroupSuite, 3, ADM, adm_dialog_group_suite_3P, kADMDialogGroupSuite, kADMDialogGroupSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(ItemSuite, 8, ADM, adm_item_suite_8P, kADMItemSuite, kADMItemSuiteVersion8); + AEGP_SUITE_ACCESS_BOILERPLATE(ListSuite, 3, ADM, adm_list_suite_3P, kADMListSuite, kADMListSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(EntrySuite, 5, ADM, adm_entry_suite_5P, kADMEntrySuite, kADMEntrySuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(NotifierSuite, 2, ADM, adm_notifier_suite_2P, kADMNotifierSuite, kADMNotifierSuiteVersion2); +#endif + AEGP_SUITE_ACCESS_BOILERPLATE(LayerSuite, 1, AEGP_, layer_suite_1P, kAEGPLayerSuite, kAEGPLayerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(AdvItemSuite, 1, PF_, adv_item_suite_1P, kPFAdvItemSuite, kPFAdvItemSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskSuite, 1, AEGP_, mask_suite_1P, kAEGPMaskSuite, kAEGPMaskSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskSuite, 5, AEGP_, mask_suite_5P, kAEGPMaskSuite, kAEGPMaskSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(MaskSuite, 6, AEGP_, mask_suite_6P, kAEGPMaskSuite, kAEGPMaskSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(CompSuite, 1, AEGP_, comp_suite_1P, kAEGPCompSuite, kAEGPCompSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(CollectionSuite, 1, AEGP_, collection_suite_1P, kAEGPCollectionSuite, kAEGPCollectionSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(AdvAppSuite, 1, PF_, adv_app_suite_1P, kPFAdvAppSuite, kPFAdvAppSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 1, AEGP_, utility_suite_1P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderOptionsSuite, 2, AEGP_, render_options_suite_2P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderOptionsSuite, 3, AEGP_, render_options_suite_3P, kAEGPRenderOptionsSuite, kAEGPRenderOptionsSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerRenderOptionsSuite, 1, AEGP_, layer_render_options_suite_1P, kAEGPLayerRenderOptionsSuite, kAEGPLayerRenderOptionsSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(LayerRenderOptionsSuite, 2, AEGP_, layer_render_options_suite_2P, kAEGPLayerRenderOptionsSuite, kAEGPLayerRenderOptionsSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(RenderAsyncManagerSuite, 1, AEGP_, async_manager_suite_1P, kAEGPRenderAsyncManagerSuite, kAEGPRenderAsyncManagerSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ProjSuite, 5, AEGP_, proj_suite_5P, kAEGPProjSuite, kAEGPProjSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(ProjSuite, 6, AEGP_, proj_suite_6P, kAEGPProjSuite, kAEGPProjSuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(FootageSuite, 5, AEGP_, footage_suite_5P, kAEGPFootageSuite, kAEGPFootageSuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(RQItemSuite, 3, AEGP_, rq_item_suite_3P, kAEGPRQItemSuite, kAEGPRQItemSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 4, AEGP_, utility_suite_4P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(ColorSettingsSuite, 3, AEGP_, color_settings_suite_3P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(ColorSettingsSuite, 2, AEGP_, color_settings_suite_2P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(ColorSettingsSuite, 1, AEGP_, color_settings_suite_1P, kAEGPColorSettingsSuite, kAEGPColorSettingsSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(ColorParamSuite, 1, PF_, color_param_suite_1P, kPFColorParamSuite, kPFColorParamSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(PersistentDataSuite, 4, AEGP_, persistent_data_suite4P, kAEGPPersistentDataSuite, kAEGPPersistentDataSuiteVersion4); + AEGP_SUITE_ACCESS_BOILERPLATE(PersistentDataSuite, 3, AEGP_, persistent_data_suite3P, kAEGPPersistentDataSuite, kAEGPPersistentDataSuiteVersion3); + AEGP_SUITE_ACCESS_BOILERPLATE(SamplingFloatSuite, 1, PF_, sampling_float_suite_1P, kPFSamplingFloatSuite, kPFSamplingFloatSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 5, AEGP_, utility_suite_5P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion5); + AEGP_SUITE_ACCESS_BOILERPLATE(UtilitySuite, 6, AEGP_, utility_suite_6P, kAEGPUtilitySuite, kAEGPUtilitySuiteVersion6); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectCustomUISuite, 1, PF_, custom_ui_suite1P, kPFEffectCustomUISuite, kPFEffectCustomUISuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectCustomUISuite, 2, PF_, custom_ui_suite2P, kPFEffectCustomUISuite, kPFEffectCustomUISuiteVersion2); + AEGP_SUITE_ACCESS_BOILERPLATE(EffectCustomUIOverlayThemeSuite, 1, PF_, custom_ui_theme_suite1P, kPFEffectCustomUIOverlayThemeSuite, kPFEffectCustomUIOverlayThemeSuiteVersion1); + AEGP_SUITE_ACCESS_BOILERPLATE(DrawbotSuite, Current, DRAWBOT_, drawing_suite_currentP, kDRAWBOT_DrawSuite, kDRAWBOT_DrawSuite_VersionCurrent); + AEGP_SUITE_ACCESS_BOILERPLATE(SupplierSuite, Current, DRAWBOT_, drawbot_supplier_suite_currentP, kDRAWBOT_SupplierSuite, kDRAWBOT_SupplierSuite_VersionCurrent); + AEGP_SUITE_ACCESS_BOILERPLATE(SurfaceSuite, Current, DRAWBOT_, drawbot_surface_suite_currentP, kDRAWBOT_SurfaceSuite, kDRAWBOT_SurfaceSuite_VersionCurrent); + AEGP_SUITE_ACCESS_BOILERPLATE(PathSuite, Current, DRAWBOT_, drawbot_path_suite_currentP, kDRAWBOT_PathSuite, kDRAWBOT_PathSuite_VersionCurrent); + + AEGP_SUITE_ACCESS_BOILERPLATE(SuitesSuite, , SP, suites_suite_2P, kSPSuitesSuite, kSPSuitesSuiteVersion); +}; + +#endif diff --git a/External/AE SDK/Util/AEGP_Utils.cpp b/External/AE SDK/Util/AEGP_Utils.cpp new file mode 100644 index 00000000..95f7cdb6 --- /dev/null +++ b/External/AE SDK/Util/AEGP_Utils.cpp @@ -0,0 +1,38 @@ +#include "AEGP_Utils.h" + + +A_Err GetNewFirstLayerInFirstComp( + SPBasicSuite *sP, + AEGP_LayerH *first_layerPH) +{ + A_Err err = A_Err_NONE; + + AEGP_ItemH itemH = NULL; + AEGP_ItemType type = AEGP_ItemType_NONE; + AEGP_CompH compH = NULL; + AEGP_ProjectH projH = NULL; + A_long num_projectsL = 0, + num_layersL = 0; + + AEGP_SuiteHandler suites(sP); + + (void)num_projectsL; + ERR(suites.ProjSuite5()->AEGP_GetProjectByIndex(0, &projH)); + ERR(suites.ItemSuite8()->AEGP_GetFirstProjItem(projH, &itemH)); + ERR(suites.ItemSuite6()->AEGP_GetItemType(itemH, &type)); + + while ((itemH != NULL) && (type != AEGP_ItemType_COMP)){ + ERR(suites.ItemSuite6()->AEGP_GetNextProjItem(projH, itemH, &itemH)); + ERR(suites.ItemSuite6()->AEGP_GetItemType(itemH, &type)); + } + if (!err && (type == AEGP_ItemType_COMP)){ + err = suites.CompSuite4()->AEGP_GetCompFromItem(itemH, &compH); + } + if (!err && compH) { + err = suites.LayerSuite5()->AEGP_GetCompNumLayers(compH, &num_layersL); + } + if (!err && num_layersL){ + err = suites.LayerSuite5()->AEGP_GetCompLayerByIndex(compH, 0, first_layerPH); + } + return err; +} diff --git a/External/AE SDK/Util/AEGP_Utils.h b/External/AE SDK/Util/AEGP_Utils.h new file mode 100644 index 00000000..a2f2b06f --- /dev/null +++ b/External/AE SDK/Util/AEGP_Utils.h @@ -0,0 +1,9 @@ +#include "A.h" +#include "AE_GeneralPlug.h" +#include "AEGP_SuiteHandler.h" +#include "AE_Macros.h" + +A_Err GetNewFirstLayerInFirstComp( + SPBasicSuite *sP, + AEGP_LayerH *first_layerPH); + diff --git a/External/AE SDK/Util/DuckSuite.h b/External/AE SDK/Util/DuckSuite.h new file mode 100644 index 00000000..59f9953c --- /dev/null +++ b/External/AE SDK/Util/DuckSuite.h @@ -0,0 +1,13 @@ +#include "A.h" +#include + +#ifdef AE_OS_WIN + #include +#endif + +#define kDuckSuite1 "AEGP Duck Suite" +#define kDuckSuiteVersion1 1 + +typedef struct DuckSuite1 { + SPAPI A_Err (*Quack)(A_u_short timesSu); +} DuckSuite1; \ No newline at end of file diff --git a/External/AE SDK/Util/MissingSuiteError.cpp b/External/AE SDK/Util/MissingSuiteError.cpp new file mode 100644 index 00000000..5be71f4f --- /dev/null +++ b/External/AE SDK/Util/MissingSuiteError.cpp @@ -0,0 +1,43 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#include "AEGP_SuiteHandler.h" + +void AEGP_SuiteHandler::MissingSuiteError() const +{ + // Yes, we've read Scott Meyers, and know throwing + // a stack-based object can cause problems. Since + // the err is just a long, and since we aren't de- + // referencing it in any way, risk is mimimal. + + // As always, we expect those of you who use + // exception-based code to do a little less rudi- + // mentary job of it than we are here. + + // Also, excuse the Madagascar-inspired monkey + // joke; couldn't resist. + // -bbb 10/10/05 + + PF_Err poop = PF_Err_BAD_CALLBACK_PARAM; + + throw poop; +} + diff --git a/External/AE SDK/Util/Param_Utils.h b/External/AE SDK/Util/Param_Utils.h new file mode 100644 index 00000000..f4129069 --- /dev/null +++ b/External/AE SDK/Util/Param_Utils.h @@ -0,0 +1,343 @@ +#ifndef H_PARAM_UTILS +#define H_PARAM_UTILS + +// do not include DVA headers here +#include +#include + +// requires the explicit use of 'def' for the struct name + +#define PF_ParamDef_IS_PUI_FLAG_SET(_defP, _puiFlag) \ + (((_defP)->ui_flags & _puiFlag) != 0) + +#define PF_ParamDef_IS_PARAM_FLAG_SET(_defP, _paramFlag) \ + (((_defP)->flags & _paramFlag) != 0) + + +#define PF_ADD_COLOR(NAME, RED, GREEN, BLUE, ID)\ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_COLOR; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.cd.value.red = (RED); \ + def.u.cd.value.green = (GREEN); \ + def.u.cd.value.blue = (BLUE); \ + def.u.cd.value.alpha = 255; \ + def.u.cd.dephault = def.u.cd.value; \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_ARBITRARY2(NAME, WIDTH, HEIGHT, PARAM_FLAGS, PUI_FLAGS, DFLT, ID, REFCON)\ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_ARBITRARY_DATA; \ + def.flags = (PARAM_FLAGS); \ + PF_STRCPY(def.name, (NAME) ); \ + def.ui_width = (WIDTH);\ + def.ui_height = (HEIGHT);\ + def.ui_flags = (PUI_FLAGS); \ + def.u.arb_d.value = NULL;\ + def.u.arb_d.pad = 0;\ + def.u.arb_d.dephault = (DFLT); \ + def.uu.id = def.u.arb_d.id = (ID); \ + def.u.arb_d.refconPV = REFCON; \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_ARBITRARY(NAME, WIDTH, HEIGHT, PUI_FLAGS, DFLT, ID, REFCON)\ + PF_ADD_ARBITRARY2(NAME, WIDTH, HEIGHT, PF_ParamFlag_NONE, PUI_FLAGS, DFLT, ID, REFCON) + +#define PF_ADD_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, DFLT, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_SLIDER; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.sd.value_str[0] = '\0'; \ + def.u.sd.value_desc[0] = '\0'; \ + def.u.sd.valid_min = (VALID_MIN); \ + def.u.sd.slider_min = (SLIDER_MIN); \ + def.u.sd.valid_max = (VALID_MAX); \ + def.u.sd.slider_max = (SLIDER_MAX); \ + def.u.sd.value = def.u.sd.dephault = (DFLT); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_FIXED(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, DFLT, PREC, DISP, FLAGS, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_FIX_SLIDER; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.fd.value_str[0] = '\0'; \ + def.u.fd.value_desc[0] = '\0'; \ + def.u.fd.valid_min = (PF_Fixed)((VALID_MIN) * 65536.0); \ + def.u.fd.slider_min = (PF_Fixed)((SLIDER_MIN) * 65536.0); \ + def.u.fd.valid_max = (PF_Fixed)((VALID_MAX) * 65536.0); \ + def.u.fd.slider_max = (PF_Fixed)((SLIDER_MAX) * 65536.0); \ + def.u.fd.value = def.u.fd.dephault = (PF_Fixed)((DFLT) * 65536.0); \ + def.u.fd.precision = (A_short)(PREC); \ + def.u.fd.display_flags |= (A_short)(DISP); \ + def.flags |= (FLAGS); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +// why does fs_flags get or-ed in? and why is CURVE_TOLERANCE param ignored? and .flags is never set. oy. +#define PF_ADD_FLOAT_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, CURVE_TOLERANCE, DFLT, PREC, DISP, WANT_PHASE, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_FLOAT_SLIDER; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.fs_d.valid_min = (VALID_MIN); \ + def.u.fs_d.slider_min = (SLIDER_MIN); \ + def.u.fs_d.valid_max = (VALID_MAX); \ + def.u.fs_d.slider_max = (SLIDER_MAX); \ + def.u.fs_d.value = (DFLT); \ + def.u.fs_d.dephault = (PF_FpShort)(def.u.fs_d.value); \ + def.u.fs_d.precision = (PREC); \ + def.u.fs_d.display_flags = (DISP); \ + def.u.fs_d.fs_flags |= (WANT_PHASE) ? PF_FSliderFlag_WANT_PHASE : 0; \ + def.u.fs_d.curve_tolerance = AEFX_AUDIO_DEFAULT_CURVE_TOLERANCE;\ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +// safer newer version +#define PF_ADD_FLOAT_SLIDERX(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, DFLT, PREC, DISP, FLAGS, ID) \ + do { \ + AEFX_CLR_STRUCT(def); \ + def.flags = (FLAGS); \ + PF_ADD_FLOAT_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, 0, DFLT, PREC, DISP, 0, ID); \ + } while (0) + +// copied from Pr version of Param_Utils.h. It is used in some of Pr versions of AE effects +#define PF_ADD_FLOAT_EXPONENTIAL_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, CURVE_TOLERANCE, DFLT, PREC, DISP, WANT_PHASE, EXPONENT, ID) \ +do {\ +PF_Err priv_err = PF_Err_NONE; \ +def.param_type = PF_Param_FLOAT_SLIDER; \ +PF_STRCPY(def.name, (NAME) ); \ +def.u.fs_d.valid_min = (VALID_MIN); \ +def.u.fs_d.slider_min = (SLIDER_MIN); \ +def.u.fs_d.valid_max = (VALID_MAX); \ +def.u.fs_d.slider_max = (SLIDER_MAX); \ +def.u.fs_d.value = (DFLT); \ +def.u.fs_d.dephault = (DFLT); \ +def.u.fs_d.precision = (PREC); \ +def.u.fs_d.display_flags = (DISP); \ +def.u.fs_d.fs_flags |= (WANT_PHASE) ? PF_FSliderFlag_WANT_PHASE : 0; \ +def.u.fs_d.curve_tolerance = AEFX_AUDIO_DEFAULT_CURVE_TOLERANCE;\ +def.u.fs_d.useExponent = true;\ +def.u.fs_d.exponent = EXPONENT;\ +def.uu.id = (ID); \ +if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ +} while (0) + +enum { PF_Precision_INTEGER, PF_Precision_TENTHS, PF_Precision_HUNDREDTHS, PF_Precision_THOUSANDTHS, PF_Precision_TEN_THOUSANDTHS }; + +#define PF_ADD_CHECKBOX(NAME_A, NAME_B, DFLT, FLAGS, ID)\ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_CHECKBOX; \ + PF_STRCPY(def.name, NAME_A); \ + def.u.bd.u.nameptr = (NAME_B); \ + def.u.bd.value = (DFLT); \ + def.u.bd.dephault = (PF_Boolean)(def.u.bd.value); \ + def.flags |= (FLAGS); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +// safer newer version +#define PF_ADD_CHECKBOXX(NAME, DFLT, FLAGS, ID)\ + do {\ + AEFX_CLR_STRUCT(def); \ + PF_ADD_CHECKBOX(NAME, "", DFLT, FLAGS, ID); \ + } while (0) + +#define PF_ADD_BUTTON(PARAM_NAME, BUTTON_NAME, PUI_FLAGS, PARAM_FLAGS, ID)\ + do {\ + AEFX_CLR_STRUCT(def); \ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_BUTTON; \ + PF_STRCPY(def.name, PARAM_NAME); \ + def.u.button_d.u.namesptr = (BUTTON_NAME); \ + def.flags = (PARAM_FLAGS); \ + def.ui_flags = (PUI_FLAGS); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_ANGLE(NAME, DFLT, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_ANGLE; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.ad.value = def.u.ad.dephault = (PF_Fixed)((DFLT) * 65536.0); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + + +#define PF_ADD_NULL(NAME, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_NO_DATA; \ + PF_STRCPY(def.name, (NAME) ); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + + +#define PF_ADD_POPUP(NAME, CHOICES, DFLT, STRING, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_POPUP; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.pd.num_choices = (CHOICES); \ + def.u.pd.dephault = (DFLT); \ + def.u.pd.value = def.u.pd.dephault; \ + def.u.pd.u.namesptr = (STRING); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_LAYER(NAME, DFLT, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_LAYER; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.ld.dephault = (DFLT); \ + def.uu.id = ID;\ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_255_SLIDER(NAME, DFLT, ID)\ + PF_ADD_SLIDER( (NAME), 0, 255, 0, 255, (DFLT), (ID)) + +#define PF_ADD_PERCENT(NAME, DFLT, ID)\ + PF_ADD_FIXED( (NAME), 0, 100, 0, 100, (DFLT), 1, 1, 0, (ID)) + +#define PF_ADD_POINT(NAME, X_DFLT, Y_DFLT, RESTRICT_BOUNDS, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_POINT; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.td.restrict_bounds = RESTRICT_BOUNDS;\ + def.u.td.x_value = def.u.td.x_dephault = (X_DFLT << 16); \ + def.u.td.y_value = def.u.td.y_dephault = (Y_DFLT << 16); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_POINT_3D(NAME, X_DFLT, Y_DFLT, Z_DFLT, ID) \ + do {\ + AEFX_CLR_STRUCT(def); \ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_POINT_3D; \ + PF_STRCPY(def.name, (NAME) ); \ + def.u.point3d_d.x_value = def.u.point3d_d.x_dephault = X_DFLT; \ + def.u.point3d_d.y_value = def.u.point3d_d.y_dephault = Y_DFLT; \ + def.u.point3d_d.z_value = def.u.point3d_d.z_dephault = Y_DFLT; \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_TOPIC(NAME, ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_GROUP_START; \ + PF_STRCPY(def.name, (NAME) ); \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_END_TOPIC(ID) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_GROUP_END; \ + def.uu.id = (ID); \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +#define PF_ADD_VERSIONED_FLAG(NAME) \ + do {\ + PF_Err priv_err = PF_Err_NONE; \ + def.param_type = PF_Param_CHECKBOX; \ + def.name[0] = 0; \ + def.u.bd.u.nameptr = (NAME); \ + def.u.bd.value = true; \ + def.u.bd.dephault = false; \ + def.flags = PF_ParamFlag_USE_VALUE_FOR_OLD_PROJECTS; \ + def.ui_flags = PF_PUI_INVISIBLE; \ + if ((priv_err = PF_ADD_PARAM(in_data, -1, &def)) != PF_Err_NONE) return priv_err; \ + } while (0) + +// newer safer version +#define PF_ADD_TOPICX(NAME, FLAGS, ID) \ + do {\ + AEFX_CLR_STRUCT(def); \ + def.flags = (FLAGS); \ + PF_ADD_TOPIC(NAME, ID); \ + } while (0) + +#define PF_ADD_POPUPX(NAME, NUM_CHOICES, DFLT, ITEMS_STRING, FLAGS, ID) \ + do { \ + AEFX_CLR_STRUCT(def); \ + def.flags = (FLAGS); \ + PF_ADD_POPUP(NAME, NUM_CHOICES, DFLT, ITEMS_STRING, ID); \ + } while (0) + +enum { PF_ParamFlag_NONE=0 }; // SBI:AE_Effect.h + +#define PF_ADD_FLOAT_SLIDERX_DISABLED(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, DFLT, PREC, DISP, FLAGS, ID) \ + do { \ + AEFX_CLR_STRUCT(def); \ + def.flags = (FLAGS);\ + def.ui_flags = PF_PUI_DISABLED;\ + PF_ADD_FLOAT_SLIDER(NAME, VALID_MIN, VALID_MAX, SLIDER_MIN, SLIDER_MAX, 0, DFLT, PREC, DISP, 0, ID); \ + } while (0) + +namespace fxparam_utility { + + template + inline int RoundF(T x) + { + int ret; + + if (x > 0) { + ret = (int)(x + (T)0.5); + } else { + if ((int)(x + (T)0.5) == (x + (T)0.5)) { + ret = (int)x; + } else { + ret = (int)(x - (T)0.5); + } + } + + return ret; + } +}; + +inline PF_Err PF_AddPointControl(PF_InData *in_data, + const char *nameZ, + float x_defaultF, // 0-1 + float y_defaultF, // 0-1 + bool restrict_boundsB, + PF_ParamFlags param_flags, + PF_ParamUIFlags pui_flags, + A_long param_id) +{ + PF_ParamDef def = {{0}}; + namespace du = fxparam_utility; + + def.flags = param_flags; + def.ui_flags = pui_flags; + + PF_ADD_POINT(nameZ, du::RoundF(x_defaultF*100), du::RoundF(y_defaultF*100), restrict_boundsB, param_id); // has error return in macro + + return PF_Err_NONE; +} + + +#endif // H_PARAM_UTILS diff --git a/External/AE SDK/Util/Smart_Utils.cpp b/External/AE SDK/Util/Smart_Utils.cpp new file mode 100644 index 00000000..b67378b7 --- /dev/null +++ b/External/AE SDK/Util/Smart_Utils.cpp @@ -0,0 +1,62 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#include "Smart_Utils.h" + + +PF_Boolean IsEmptyRect(const PF_LRect *r){ + return (r->left >= r->right) || (r->top >= r->bottom); +} + +void UnionLRect(const PF_LRect *src, PF_LRect *dst) +{ + if (IsEmptyRect(dst)) { + *dst = *src; + } else if (!IsEmptyRect(src)) { + dst->left = mmin(dst->left, src->left); + dst->top = mmin(dst->top, src->top); + dst->right = mmax(dst->right, src->right); + dst->bottom = mmax(dst->bottom, src->bottom); + } +} + +PF_Boolean +IsEdgePixel( + PF_LRect *rectP, + A_long x, + A_long y) +{ + PF_Boolean x_hitB = FALSE, + y_hitB = FALSE; + + x_hitB = ((x == rectP->left) || (x == rectP->right)); + + y_hitB = ((y == rectP->top) || (y == rectP->bottom)); + + if (x_hitB){ + y_hitB = ((y >= rectP->top) && (y <= rectP->bottom)); + } else { + if (y_hitB){ + x_hitB = ((x >= rectP->left) && (x <= rectP->right)); + } + } + return (x_hitB && y_hitB); +} \ No newline at end of file diff --git a/External/AE SDK/Util/Smart_Utils.h b/External/AE SDK/Util/Smart_Utils.h new file mode 100644 index 00000000..3e1c03ce --- /dev/null +++ b/External/AE SDK/Util/Smart_Utils.h @@ -0,0 +1,34 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +#include "AE_Effect.h" +#include "SPTypes.h" + +#ifndef mmin + #define mmin(a,b) ((a) < (b) ? (a) : (b)) + #define mmax(a,b) ((a) > (b) ? (a) : (b)) +#endif + +PF_Boolean IsEmptyRect(const PF_LRect *r); + +void UnionLRect(const PF_LRect *src, PF_LRect *dst); + +PF_Boolean IsEdgePixel(PF_LRect *rectP, A_long x, A_long y); \ No newline at end of file diff --git a/External/AE SDK/Util/String_Utils.h b/External/AE SDK/Util/String_Utils.h new file mode 100644 index 00000000..00f9f9ad --- /dev/null +++ b/External/AE SDK/Util/String_Utils.h @@ -0,0 +1,48 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + + + +/* String_Utils.h */ + + +#pragma once + +#ifndef STRING_UTILS_H +#define STRING_UTILS_H + +#if defined(__cplusplus) +extern "C" { +#endif +A_char *GetStringPtr(int strNum); +#if defined(__cplusplus) +} +#endif + +#define STR(_foo) GetStringPtr(_foo) + + + + + + + +#endif /* STRING_UTILS_H */ \ No newline at end of file diff --git a/External/AE SDK/Util/entry.h b/External/AE SDK/Util/entry.h new file mode 100644 index 00000000..6a0175db --- /dev/null +++ b/External/AE SDK/Util/entry.h @@ -0,0 +1,53 @@ +/*******************************************************************/ +/* */ +/* ADOBE CONFIDENTIAL */ +/* _ _ _ _ _ _ _ _ _ _ _ _ _ */ +/* */ +/* Copyright 2007 Adobe Systems Incorporated */ +/* All Rights Reserved. */ +/* */ +/* NOTICE: All information contained herein is, and remains the */ +/* property of Adobe Systems Incorporated and its suppliers, if */ +/* any. The intellectual and technical concepts contained */ +/* herein are proprietary to Adobe Systems Incorporated and its */ +/* suppliers and may be covered by U.S. and Foreign Patents, */ +/* patents in process, and are protected by trade secret or */ +/* copyright law. Dissemination of this information or */ +/* reproduction of this material is strictly forbidden unless */ +/* prior written permission is obtained from Adobe Systems */ +/* Incorporated. */ +/* */ +/*******************************************************************/ + +/* + Entry.h + + Part of the Adobe After Effects SDK. +*/ + +#include "AE_PluginData.h" + +#ifdef AE_OS_WIN + #define DllExport __declspec( dllexport ) +#elif defined AE_OS_MAC + #define DllExport __attribute__ ((visibility ("default"))) +#endif + + +#define AE_ENTRY_POINT "EffectMain" +#define AE_RESERVED_INFO 8 + +#define PF_REGISTER_EFFECT(INPTR, CBPTR, NAME, MATCHNAME, CATEGORY,RESERVEDINFO) \ + result = (*(CBPTR))((INPTR),\ + reinterpret_cast(NAME),\ + reinterpret_cast(MATCHNAME),\ + reinterpret_cast(CATEGORY),\ + reinterpret_cast(AE_ENTRY_POINT),\ + 'eFKT',\ + PF_AE_PLUG_IN_VERSION,\ + PF_AE_PLUG_IN_SUBVERS,\ + RESERVEDINFO);\ + if(result == A_Err_NONE)\ + {\ + result = PF_Err_NONE;\ + } diff --git a/External/popcornfx.qt/Qt5Core.dll b/External/popcornfx.qt/Qt5Core.dll new file mode 100644 index 00000000..c0a7b6b7 --- /dev/null +++ b/External/popcornfx.qt/Qt5Core.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dae3aefe8afc6ecce88184c8908722af6a1382bcf2a67ea66fe5c97dfa59322a +size 6453232 diff --git a/External/popcornfx.qt/Qt5Gui.dll b/External/popcornfx.qt/Qt5Gui.dll new file mode 100644 index 00000000..b3b7f0cb --- /dev/null +++ b/External/popcornfx.qt/Qt5Gui.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38a6c697833268f5c5013e68e8bb7f7b7ef00bd9946ebfc9d563f533fa55bf66 +size 7208960 diff --git a/External/popcornfx.qt/Qt5Widgets.dll b/External/popcornfx.qt/Qt5Widgets.dll new file mode 100644 index 00000000..fb41e8cd --- /dev/null +++ b/External/popcornfx.qt/Qt5Widgets.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da032d6457d5f6993c3aa3388d62739d9c3387a5d34edd0b7f79a81cb9af6f74 +size 5562880 diff --git a/External/popcornfx.qt/popcornfx.qt.manifest b/External/popcornfx.qt/popcornfx.qt.manifest new file mode 100644 index 00000000..f2161de7 --- /dev/null +++ b/External/popcornfx.qt/popcornfx.qt.manifest @@ -0,0 +1,9 @@ + +" + + + + + + + \ No newline at end of file diff --git a/External/popcornfx.qt/qwindows.dll b/External/popcornfx.qt/qwindows.dll new file mode 100644 index 00000000..4a3eaf74 --- /dev/null +++ b/External/popcornfx.qt/qwindows.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f083147f27e7f6ac7d8d97b02e165cfb00af89b2b79ab4524971d0cfc5eaca9 +size 1469952 diff --git a/Native/debugger/PopcornFX.natvis b/Native/debugger/PopcornFX.natvis new file mode 100644 index 00000000..94eba7ef --- /dev/null +++ b/Native/debugger/PopcornFX.natvis @@ -0,0 +1,409 @@ + + + + + + + + + + + + null + {*((char**)((ptrdiff_t)m_Container.m_Ptr + (((sizeof(PopcornFX::CStringContainer) + 4) + (sizeof(void*) - 1)) & ~((ptrdiff_t)(sizeof(void*) - 1))))),s} [Len={m_Container.m_Ptr->m_Length & 0x7FFFFFFF}] + {(char*)((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringContainer) + (0xF - ((sizeof(PopcornFX::CStringContainer) + 0xF) & ((ptrdiff_t)0xF)))),s} [Len={m_Container.m_Ptr->m_Length & 0x7FFFFFFF}] + null + *((char**)((ptrdiff_t)m_Container.m_Ptr + (((sizeof(PopcornFX::CStringContainer) + 4) + (sizeof(void*) - 1)) & ~((ptrdiff_t)(sizeof(void*) - 1))))),s + (char*)((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringContainer) + (0xF - ((sizeof(PopcornFX::CStringContainer) + 0xF) & ((ptrdiff_t)0xF)))),s + + + + null + {*((wchar_t**)((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringUnicodeContainer) + 4)),su} [Len={m_Container.m_Ptr->m_Length & 0x7FFFFFFF}] + {(wchar_t*)(((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringUnicodeContainer) + 0xF) & ~((ptrdiff_t)0xF)),su} [Len={m_Container.m_Ptr->m_Length & 0x7FFFFFFF}] + null + *((wchar_t**)((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringUnicodeContainer) + 4)),su + (wchar_t*)(((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringUnicodeContainer) + 0xF) & ~((ptrdiff_t)0xF)),su + + + + Id=0 null + Id={m_Id} {PopcornFX::CStringInternals::m_StringIdDictionnary->m_StringIdPool.m_Chunks[m_Id / PopcornFX::CStringIdDictionary::kPoolChunkSize][m_Id % PopcornFX::CStringIdDictionary::kPoolChunkSize]} + + PopcornFX::CStringInternals::m_StringIdDictionnary->m_StringIdPool.m_Chunks[m_Id / PopcornFX::CStringIdDictionary::kPoolChunkSize][m_Id % PopcornFX::CStringIdDictionary::kPoolChunkSize] + + + + + null + {m_Data,[m_Length]s} [Len={m_Length}] + + + + null + {m_DataFeed.m_Ptr} + + m_DataFeed.m_Ptr + + + + + {{RefPtr={(void*)m_Ptr}}} + + m_Ptr + + + + {{WeakPtr={(void*)m_Ptr}}} + + m_Ptr + + + + {{ScopedPtr={(void*)m_Ptr}}} + + m_Ptr + + + + + {{A Count={m_Count}}} + + + m_Count + ($T1*)m_Data + + + + + + {{A Count={m_Count}}} + + + m_Count + ($T1*)m_Data + + + + + + {{SDA Count={m_Count & 0x7FFFFFFF} Data={(void*)m_Allocated.m_Data}} + {{SDA Count={m_Count & 0x7FFFFFFF} Data={(void*)(((unsigned long long)m_StaticData + kAlignment - 1) & - kAlignment)}} + + + m_Count & 0x7FFFFFFF + ($T1*)m_Allocated.m_Data + + + m_Count + ($T1*)(((unsigned long long)m_StaticData + kAlignment - 1) & - kAlignment) + + + + + + {{SFA Count={m_Count}, Data={(void*)m_Data}, Cap={m_Capacity}}} + + + m_Count + ($T1*)m_Data + + + + + + {{SA _Count={$T2}, Data={(void*)(((unsigned long long)_m_Data + kAlignment - 1) & - kAlignment)} + + + $T2 + ($T1*)(((unsigned long long)_m_Data + kAlignment - 1) & - kAlignment) + + + + + + {{SCA Count={m_Count}, Data={(void*)(((unsigned long long)_m_Data + kAlignment - 1) & - kAlignment)}}} + + + m_Count + ($T1*)(((unsigned long long)_m_Data + kAlignment - 1) & - kAlignment) + + + + + + {{CA Count={$T2 * m_ChunksCount}({$T2}*{m_ChunksCount}), ChuncksCap={m_ChunksCapacity}}} + + + $T2 * m_ChunksCount + m_Chunks[$i / $T2][$i % $T2] + + + + + + {{SlotA UsedCount={m_UsedSlots} _Count={$T2}}} + + + $T2 + ($T1*)m_Data + + + + + + {{SlotA UsedCount={m_UsedSlots} Count={m_DataSizeInBytes / sizeof($T1)}}} + + + m_DataSizeInBytes / sizeof($T1) + ($T1*)m_Data + + + + + + {{MV Count={m_Count}, Data={(void*)m_Data}, sizeof={sizeof($T1)}}} + + + m_Count + ($T1*)m_Data + + + + + + {{SMV Count={m_Storage.m_Count}, Data={(void*)m_Storage.m_RawDataPtr}, Stride={m_Storage.m_Stride}, sizeof={sizeof($T1)}}} + + + m_Storage.m_Count + *(($T1*)(m_Storage.m_RawDataPtr + $i * m_Storage.m_Stride)) + + + + + + {{SMVF Count={m_Storage.m_Count}, Data={(void*)m_Storage.m_RawDataPtr}, Stride={m_Storage.m_Stride}, Footp={m_ElementFootprintInBytes}, sizeof={sizeof($T1)}} + + + m_Storage.m_Count + *(($T1*)(m_Storage.m_RawDataPtr + $i * m_Storage.m_Stride)) + + + + + + {{First={m_First}, Second={m_Second}}} + + m_First + m_Second + + + + + {{FHM Count={m_Count}, Data={(void*)m_Slots}, Size={m_Size}}} + + + m_Size + m_Slots + + + + + + + empty + + void (error) + + + const class cr{m_RawBits & 0xFFFF,d} + variable class vr{m_RawBits & 0xFFFF,d} + instance class ir{m_RawBits & 0xFFFF,d} + stream class sr{m_RawBits & 0xFFFF,d} + + + const bool1 cr{m_RawBits & 0xFFFF,d} + variable bool1 vr{m_RawBits & 0xFFFF,d} + instance bool1 ir{m_RawBits & 0xFFFF,d} + stream bool1 sr{m_RawBits & 0xFFFF,d} + + const bool2 cr{m_RawBits & 0xFFFF,d} + variable bool2 vr{m_RawBits & 0xFFFF,d} + instance bool2 ir{m_RawBits & 0xFFFF,d} + stream bool2 sr{m_RawBits & 0xFFFF,d} + + const bool3 cr{m_RawBits & 0xFFFF,d} + variable bool3 vr{m_RawBits & 0xFFFF,d} + instance bool3 ir{m_RawBits & 0xFFFF,d} + stream bool3 sr{m_RawBits & 0xFFFF,d} + + const bool4 cr{m_RawBits & 0xFFFF,d} + variable bool4 vr{m_RawBits & 0xFFFF,d} + instance bool4 ir{m_RawBits & 0xFFFF,d} + stream bool4 sr{m_RawBits & 0xFFFF,d} + + + const int1 cr{m_RawBits & 0xFFFF,d} + variable int1 vr{m_RawBits & 0xFFFF,d} + instance int1 ir{m_RawBits & 0xFFFF,d} + stream int1 sr{m_RawBits & 0xFFFF,d} + + const int2 cr{m_RawBits & 0xFFFF,d} + variable int2 vr{m_RawBits & 0xFFFF,d} + instance int2 ir{m_RawBits & 0xFFFF,d} + stream int2 sr{m_RawBits & 0xFFFF,d} + + const int3 cr{m_RawBits & 0xFFFF,d} + variable int3 vr{m_RawBits & 0xFFFF,d} + instance int3 ir{m_RawBits & 0xFFFF,d} + stream int3 sr{m_RawBits & 0xFFFF,d} + + const int4 cr{m_RawBits & 0xFFFF,d} + variable int4 vr{m_RawBits & 0xFFFF,d} + instance int4 ir{m_RawBits & 0xFFFF,d} + stream int4 sr{m_RawBits & 0xFFFF,d} + + + const float1 cr{m_RawBits & 0xFFFF,d} + variable float1 vr{m_RawBits & 0xFFFF,d} + instance float1 ir{m_RawBits & 0xFFFF,d} + stream float1 sr{m_RawBits & 0xFFFF,d} + + const float2 cr{m_RawBits & 0xFFFF,d} + variable float2 vr{m_RawBits & 0xFFFF,d} + instance float2 ir{m_RawBits & 0xFFFF,d} + stream float2 sr{m_RawBits & 0xFFFF,d} + + const float3 cr{m_RawBits & 0xFFFF,d} + variable float3 vr{m_RawBits & 0xFFFF,d} + instance float3 ir{m_RawBits & 0xFFFF,d} + stream float3 sr{m_RawBits & 0xFFFF,d} + + const float4 cr{m_RawBits & 0xFFFF,d} + variable float4 vr{m_RawBits & 0xFFFF,d} + instance float4 ir{m_RawBits & 0xFFFF,d} + stream float4 sr{m_RawBits & 0xFFFF,d} + + + const orientation cr{m_RawBits & 0xFFFF,d} + variable orientation vr{m_RawBits & 0xFFFF,d} + instance orientation ir{m_RawBits & 0xFFFF,d} + stream orientation sr{m_RawBits & 0xFFFF,d} + + + + + + Range = ]{m_BoundMin.m_Value.m_Data32u,X}, {m_BoundMax.m_Value.m_Data32u,X}[ - ]{m_BoundMin.m_Value.m_Data32f}, {m_BoundMax.m_Value.m_Data32f}[ - ]{m_BoundMin.m_Value.m_Data32s}, {m_BoundMax.m_Value.m_Data32s}[ + Range = ]{m_BoundMin.m_Value.m_Data32u,X}, {m_BoundMax.m_Value.m_Data32u,X}] - ]{m_BoundMin.m_Value.m_Data32f}, {m_BoundMax.m_Value.m_Data32f}] - ]{m_BoundMin.m_Value.m_Data32s}, {m_BoundMax.m_Value.m_Data32s}] + Range = [{m_BoundMin.m_Value.m_Data32u,X}, {m_BoundMax.m_Value.m_Data32u,X}[ - [{m_BoundMin.m_Value.m_Data32f}, {m_BoundMax.m_Value.m_Data32f}[ - [{m_BoundMin.m_Value.m_Data32s}, {m_BoundMax.m_Value.m_Data32s}[ + Range = [{m_BoundMin.m_Value.m_Data32u,X}, {m_BoundMax.m_Value.m_Data32u,X}] - [{m_BoundMin.m_Value.m_Data32f}, {m_BoundMax.m_Value.m_Data32f}] - [{m_BoundMin.m_Value.m_Data32s}, {m_BoundMax.m_Value.m_Data32s}] + + + + X + O + + + + {*(PopcornFX::Range::Internal::_SConstantRange_Natvis*)(m_BoundMin.m_Value.m_Data32u + 0)} + + + 4 + (PopcornFX::Range::Internal::_SConstantRange_Natvis*)(m_BoundMin.m_Value.m_Data32u + $i) + + + + + + {*(PopcornFX::Range::Internal::_SConstantEdge_Natvis*)(m_Edge.m_Data+0)}{*(PopcornFX::Range::Internal::_SConstantEdge_Natvis*)(m_Edge.m_Data+1)}{*(PopcornFX::Range::Internal::_SConstantEdge_Natvis*)(m_Edge.m_Data+2)}{*(PopcornFX::Range::Internal::_SConstantEdge_Natvis*)(m_Edge.m_Data+3)}: |{m_Value.m_Data32u[0],X}, {m_Value.m_Data32u[1],X}, {m_Value.m_Data32u[2],X}, {m_Value.m_Data32u[3],X}| - |{m_Value.m_Data32f[0]}, {m_Value.m_Data32f[1]}, {m_Value.m_Data32f[2]}, {m_Value.m_Data32f[3]}| - |{m_Value.m_Data32s[0]}, {m_Value.m_Data32s[1]}, {m_Value.m_Data32s[2]}, {m_Value.m_Data32s[3]}| + + + + INVALID + void + auto + byte + float + float2 + float3 + float4 + int + int2 + int3 + int4 + bool + bool2 + bool3 + bool4 + orientation + + m_Index + + + + + (PopcornFX::CVStreamSemanticDictionnary::EDefaultOrdinals)(m_Code >> 8) + (m_Code >> 8) + + (PopcornFX::CVStreamSemanticDictionnary::EDefaultOrdinals)(m_Code >> 8) + (m_Code >> 8) + (PopcornFX::SVStreamCode::EElementType)(m_Code & 0x1F) + (m_Code & 0x80) != 0 + (m_Code & 0x40) != 0 + m_Code + + + + + v{(m_Key >> 29) & 0x7,d}.{(m_Key >> 24) & 0x1F,d}.{(m_Key >> 18) & 0x3F,d}.{m_Key & 0x3FFFF,d} + + m_Key + + + + + {m_Data} + + + $T2 + m_Data + + + + + + {m_Axes} + + + $T2 + m_Axes + + + + + + {{{m_Imag[0]}, {m_Imag[1]}, {m_Imag[2]}, {m_Real}}} + + + 4 + m_Imag + + + + + diff --git a/Native/debugger/qt5.natvis b/Native/debugger/qt5.natvis new file mode 100644 index 00000000..65bf3a65 --- /dev/null +++ b/Native/debugger/qt5.natvis @@ -0,0 +1,683 @@ + + + + + + {{ x = {xp}, y = {yp} }} + + xp + yp + + + + + {{ x = {x1}, y = {y1}, width = {x2 - x1 + 1}, height = {y2 - y1 + 1} }} + + x1 + y1 + x2 - x1 + 1 + y2 - y1 + 1 + + + + + {{ x = {xp}, y = {yp}, width = {w}, height = {h} }} + + xp + yp + w + h + + + + + + {{ width = {wd}, height = {ht} }} + + wd + ht + + + + + + {{ start point = {pt1}, end point = {pt2} }} + + + {pt1} + + pt1 + + + + {pt2} + + pt2 + + + + + + + + {{ size = {d->size} }} + + d->ref.atomic._q_value + + d->size + (QPoint*)((reinterpret_cast<char*>(d)) + d->offset) + + + + + + {{ size = {d->size} }} + + + d->size > 0 + && ((((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[0]).xp + == (((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[d->size - 1]).xp) + && ((((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[0]).yp + == (((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[d->size - 1]).yp) + + d->ref.atomic._q_value + + d->size + (QPointF*)((reinterpret_cast<char*>(d)) + d->offset) + + + + + + {{ x = {xp}, y = {yp} }} + + xp + yp + + + + + {{ x = {xp}, y = {yp}, z = {zp} }} + + xp + yp + zp + + + + + {{ x = {xp}, y = {yp}, z = {zp}, w = {wp} }} + + xp + yp + zp + wp + + + + + + {{ m11 = {_m11}, m12 = {_m12}, m21 = {_m21}, m22 = {_m22}, ... }} + + + _m11 + _m12 + _m21 + _m22 + _dx + _dy + + + + + + {{ m11 = {m[0][0]}, m12 = {m[1][0]}, m13 = {m[2][0]}, m14 = {m[3][0]}, ... }} + + + m[0][0] + m[1][0] + m[2][0] + m[3][0] + m[0][1] + m[1][1] + m[2][1] + m[3][1] + m[0][2] + m[1][2] + m[2][2] + m[3][2] + m[0][3] + m[1][3] + m[2][3] + m[3][3] + + + + + + {{ horizontal = {static_cast<Policy>(bits.horPolicy)}, vertical = {static_cast<Policy>(bits.verPolicy)}, type = {ControlType(1 << bits.ctype)} }} + + + + QSizePolicy::Policy::{static_cast<Policy>(bits.verPolicy)} + + + QSizePolicy::Policy::{static_cast<Policy>(bits.horPolicy)} + + + QSizePolicy::ControlType::{ControlType(1 << bits.ctype)} + + + + Qt::Vertical (2) + + + Qt::Horizontal (1) + + + static_cast<int>(bits.verStretch) + static_cast<int>(bits.horStretch) + bits.hfw == 1 + bits.wfh == 1 + + + + + {ucs,c} + ucs,c + + ucs > 0xff ? '\0' : char(ucs),c + ucs,c + + + + + {((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub} + ((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub + + d->size + d->ref.atomic._q_value + + d->size + ((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),c + + + + + + {((reinterpret_cast<char*>(d)) + d->offset),sb} + ((reinterpret_cast<char*>(d)) + d->offset),sb + + d->size + d->ref.atomic._q_value + + d->size + ((reinterpret_cast<char*>(d)) + d->offset),c + + + + + + {{ size = {(d.d->size << 3) - *((reinterpret_cast<char*>(d.d)) + d.d->offset)} }} + + d.d->ref.atomic._q_value + + (d.d->size << 3) - *((reinterpret_cast<char*>(d.d)) + d.d->offset) + + (*(reinterpret_cast<const unsigned char*>((reinterpret_cast<char*>(d.d)) + d.d->offset) + 1 + + ($i >> 3)) & (1 << ($i & 7))) != 0 + + + + + + + + {{ size = {s} }} + + a + + s + ptr + + + + + + {{ julian day = {jd} }} + + + + + {{ millisecond = {mds} }} + {{ milliseconds = {mds} }} + + mds / 3600000, d + mds / 3600000, d + (mds % 3600000) / 60000, d + (mds % 3600000) / 60000, d + (mds / 1000) % 60, d + (mds / 1000) % 60, d + mds % 1000, d + mds % 1000, d + + + + + {d.pattern} + + + + + ref._q_value + + + + + strong reference to shared pointer of type {"$T1"} + + value == 0 + d->weakref._q_value + d->strongref._q_value + + + + + pointer to implicit shared object of type {"$T1"} + + d + + + + + pointer to explicit shared object of type {"$T1"} + + d + + + + + guarded pointer to subclass of QObject of type {"$T1"} + + wp.d == 0 || wp.d->strongref._q_value == 0 || wp.value == 0 + + + + + weak reference to shared pointer of type {"$T1"} + + d == 0 || d->strongref._q_value == 0 || value == 0 + d->weakref._q_value + d->strongref._q_value + + + + + scoped pointer to a dynamically allocated object of type {"$T1"} + + !d + + + + + scoped pointer to dynamically allocated array of objects of type {"$T1"} + + !d + + + + + ({first}, {second}) + + first + second + + + + + + {{ size = {d->size} }} + + d->ref.atomic._q_value + + d->size + ($T1*)((reinterpret_cast<char*>(d)) + d->offset) + + + + + + + + {{ size = {d->end - d->begin} }} + + d->ref.atomic._q_value + + d->end - d->begin + + *reinterpret_cast<$T1*>((sizeof($T1) > sizeof(void*)) + ? reinterpret_cast<Node*>(d->array + d->begin + $i)->v + : reinterpret_cast<$T1*>(d->array + d->begin + $i)) + + + + + + + {{ size = {d->size} }} + + d->ref.atomic._q_value + + d->size + d->n + n + (*(QLinkedListNode<$T1>*)this).t + + + + + + ({key}, {value}) + + key + value + + + + + + {{ size = {d->size} }} + + d->ref.atomic._q_value + + d->size + d->header.left + left + right + *((QMapNode<$T1,$T2>*)this) + + + + + + (empty) + ({key}, {value}) + + key + value + + + + + + {{ size = {d->size} }} + + d->ref.atomic._q_value + + d->numBuckets + *((QHashNode<$T1,$T2>*)d->buckets[$i]) + + + + + + (empty) + ({key}) + + key + + + + + {{ size = {q_hash.d->size} }} + + q_hash + + + + + ({*keyPtr}, {*t}) + + *keyPtr + *t + + + + + {{ size = {hash.d->size} }} + + mx + total + hash.d->ref.atomic._q_value + + hash.d->size + f + n + *((Node*)this) + + + + + + + + Invalid + {d.data.b} + {d.data.i} + {d.data.u} + {d.data.ll} + {d.data.ull} + {d.data.d} + {d.data.c} + + {*((QMap<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QList<QVariant>*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QString*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QStringList*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QByteArray*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QBitArray*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QDate*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QTime*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + DateTime + Url + Locale + + {*((QRect*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QRectF*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QSize*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QSizeF*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QLine*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QLineF*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QPoint*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + + {*((QPointF*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + RegExp + RegularExpression + + {*((QHash<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr)))} + + EasingCurve + Uuid + ModelIndex + LastCoreType + Font + Pixmap + Brush + Color + Palette + Image + Polygon + Region + Bitmap + Cursor + KeySequence + Pen + TextLength + TextFormat + Matrix + Transform + Matrix4x4 + Vector2D + Vector3D + Vector4D + Quaternion + PolygonF + Icon + LastGuiType + SizePolicy + UserType + LastType + + + + + + d.data.c + + + *((QString*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + + *((QByteArray*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + + + + + + + *((QMap<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QList<QVariant>*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QString*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QStringList*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QByteArray*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QBitArray*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QDate*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QTime*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QRect*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QRectF*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QSize*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QSizeF*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QLine*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QLineF*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QPoint*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QPointF*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + *((QHash<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr + : reinterpret_cast<const void *>(&d.data.ptr))) + + + + + + + diff --git a/PopcornFX/CHANGELOG.md b/PopcornFX/CHANGELOG.md new file mode 100644 index 00000000..be56853b --- /dev/null +++ b/PopcornFX/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog +For each PopcornFX **Editor** / **Runtime SDK** there is one matching After Effects plugin version. +Official changelog for each version can be found [here](https://www.popcornfx.com/category/news/) \ No newline at end of file diff --git a/PopcornFX/LICENSE.md b/PopcornFX/LICENSE.md new file mode 100644 index 00000000..1814cd64 --- /dev/null +++ b/PopcornFX/LICENSE.md @@ -0,0 +1,14 @@ +# After Effects PopcornFX Plugin and its PopcornFX Runtime SDK License + +[PopcornFX store terms & conditions](http://www.popcornfx.com/terms-and-conditions/) +governs the After Effects PopcornFX Plugin, its PopcornFX Runtime SDK, and +related products licenses. + +* After Effects PopcornFX Plugin **source code** AND its PopcornFX Runtime SDK + **source code and binaries**: + * You cannot lease, rent or sell them in any form + * You will only use them in Adobe After Effects + * You cannot use them in a different way + * http://www.popcornfx.com/terms-and-conditions/ +* Any other form of the After Effects PopcornFX Plugin and PopcornFX Runtime SDK: + * http://www.popcornfx.com/terms-and-conditions/ diff --git a/PopcornFX/PK-ShaderTool_r.exe b/PopcornFX/PK-ShaderTool_r.exe new file mode 100755 index 00000000..f12f8ac1 --- /dev/null +++ b/PopcornFX/PK-ShaderTool_r.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7b0fedfe562427e13f1240e29fc6b853faa8d0f9bdada8761cf58ba551ad5f1 +size 7867904 diff --git a/PopcornFX/PopcornFXInternals/Meshes/default.pkmm b/PopcornFX/PopcornFXInternals/Meshes/default.pkmm new file mode 100644 index 00000000..d47df868 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Meshes/default.pkmm @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82104142fed2d9e31deb8f93ca50471e9e943fa52c582d2e30bacc6c1b24e9b6 +size 67558 diff --git a/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.0C443080A9914F8E3821857B39F3B3F6.metallib b/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.0C443080A9914F8E3821857B39F3B3F6.metallib new file mode 100644 index 00000000..a2291409 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.0C443080A9914F8E3821857B39F3B3F6.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.3C55D2DBBDE67D3B05E91E33AA424D4A.cso b/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.3C55D2DBBDE67D3B05E91E33AA424D4A.cso new file mode 100644 index 00000000..ffe3a662 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.3C55D2DBBDE67D3B05E91E33AA424D4A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.3C55D2DBBDE67D3B05E91E33AA424D4A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.3C55D2DBBDE67D3B05E91E33AA424D4A.cso.pdb new file mode 100644 index 00000000..17717a48 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/BlurCubemap.comp.3C55D2DBBDE67D3B05E91E33AA424D4A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aafbc7496a983e712b2cc8df191f3c4c8d5287b6f957a3f15974068d5366f62e +size 26112 diff --git a/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.3777E0C4C3850AF4730B699288C64A32.cso b/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.3777E0C4C3850AF4730B699288C64A32.cso new file mode 100644 index 00000000..3d0d1c6a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.3777E0C4C3850AF4730B699288C64A32.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.3777E0C4C3850AF4730B699288C64A32.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.3777E0C4C3850AF4730B699288C64A32.cso.pdb new file mode 100644 index 00000000..4840e78e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.3777E0C4C3850AF4730B699288C64A32.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88dde5563655c93391976dacd279d11933216eb2e923ad451b3a6b58c29b8cf4 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.DBCFC7E098405CD8ABAFBFE666F38717.metallib b/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.DBCFC7E098405CD8ABAFBFE666F38717.metallib new file mode 100644 index 00000000..ee7ad13c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/BrushBackdrop.frag.DBCFC7E098405CD8ABAFBFE666F38717.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.1CFFFE56845EBA06EDCF9E5C8278FEE3.cso b/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.1CFFFE56845EBA06EDCF9E5C8278FEE3.cso new file mode 100644 index 00000000..2143fb24 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.1CFFFE56845EBA06EDCF9E5C8278FEE3.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.1CFFFE56845EBA06EDCF9E5C8278FEE3.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.1CFFFE56845EBA06EDCF9E5C8278FEE3.cso.pdb new file mode 100644 index 00000000..e11625d0 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.1CFFFE56845EBA06EDCF9E5C8278FEE3.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffdf6b851c4c60f8bbb05fe8a80f8c20f625529c33e94390c30423f2c8451373 +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.C5813AF3B0DA61049FC61318A52A0039.metallib b/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.C5813AF3B0DA61049FC61318A52A0039.metallib new file mode 100644 index 00000000..9c0beab5 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ColorRemap.frag.C5813AF3B0DA61049FC61318A52A0039.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.08B780C3B4A4A9B95239BE4725C155E3.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.08B780C3B4A4A9B95239BE4725C155E3.metallib new file mode 100644 index 00000000..80284571 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.08B780C3B4A4A9B95239BE4725C155E3.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.2BF4FFEBF18FD2317E7196CCB179BBD1.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.2BF4FFEBF18FD2317E7196CCB179BBD1.metallib new file mode 100644 index 00000000..4a36924f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.2BF4FFEBF18FD2317E7196CCB179BBD1.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.ACF5EA8A26A387527C94AE3CADBEEFE0.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.ACF5EA8A26A387527C94AE3CADBEEFE0.cso new file mode 100644 index 00000000..43ef3510 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.ACF5EA8A26A387527C94AE3CADBEEFE0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.ACF5EA8A26A387527C94AE3CADBEEFE0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.ACF5EA8A26A387527C94AE3CADBEEFE0.cso.pdb new file mode 100644 index 00000000..fd7b5270 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.ACF5EA8A26A387527C94AE3CADBEEFE0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df546b68fb555a01962f4e1d2999530814e2360722528bf00b24873a7390a881 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.FADA9FB998752BB17F58A80A5F9E1569.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.FADA9FB998752BB17F58A80A5F9E1569.cso new file mode 100644 index 00000000..33fd82d6 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.FADA9FB998752BB17F58A80A5F9E1569.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.FADA9FB998752BB17F58A80A5F9E1569.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.FADA9FB998752BB17F58A80A5F9E1569.cso.pdb new file mode 100644 index 00000000..4ded88c6 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeCubemap.comp.FADA9FB998752BB17F58A80A5F9E1569.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca51db38578448dc555fe08e2b5824f45636a75980f5a8ec1eacf2eb155f7b48 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.12DC1B81F40BCA0B86B8977219474DA2.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.12DC1B81F40BCA0B86B8977219474DA2.metallib new file mode 100644 index 00000000..8147212e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.12DC1B81F40BCA0B86B8977219474DA2.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.227B4305DA369E84D660CF7D0F95A7B1.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.227B4305DA369E84D660CF7D0F95A7B1.cso new file mode 100644 index 00000000..c6bcaf2d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.227B4305DA369E84D660CF7D0F95A7B1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.227B4305DA369E84D660CF7D0F95A7B1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.227B4305DA369E84D660CF7D0F95A7B1.cso.pdb new file mode 100644 index 00000000..b5ae85b5 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.227B4305DA369E84D660CF7D0F95A7B1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6da8ea664deab78fa9b2cbdfd3d430cf5ac8f58719b2c0fb3cc6c7c14bf9d43b +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3041E5075421B7BEDB64891F34806B09.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3041E5075421B7BEDB64891F34806B09.cso new file mode 100644 index 00000000..aa99cf60 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3041E5075421B7BEDB64891F34806B09.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3041E5075421B7BEDB64891F34806B09.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3041E5075421B7BEDB64891F34806B09.cso.pdb new file mode 100644 index 00000000..35d83324 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3041E5075421B7BEDB64891F34806B09.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29eb91d1984d241c2d785e5770af60fad9c061812ac7dd6920b818c3d0f25030 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3F9F670175C1E9A2721D86BF200E8992.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3F9F670175C1E9A2721D86BF200E8992.metallib new file mode 100644 index 00000000..0e364f54 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.3F9F670175C1E9A2721D86BF200E8992.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.47AFC4B8F363592BAB2CB2B7450DC6CB.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.47AFC4B8F363592BAB2CB2B7450DC6CB.metallib new file mode 100644 index 00000000..e404f2a3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.47AFC4B8F363592BAB2CB2B7450DC6CB.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.68D7368ADF463DA7672D728718850C05.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.68D7368ADF463DA7672D728718850C05.cso new file mode 100644 index 00000000..8cd83ef9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.68D7368ADF463DA7672D728718850C05.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.68D7368ADF463DA7672D728718850C05.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.68D7368ADF463DA7672D728718850C05.cso.pdb new file mode 100644 index 00000000..22840312 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.68D7368ADF463DA7672D728718850C05.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d478c2ae3a4fdcfee24e09563d8f2c62e524f8c45074a77a23e598e590cd9ab +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.ADF077D22B698F0058CD269AB3B307F6.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.ADF077D22B698F0058CD269AB3B307F6.cso new file mode 100644 index 00000000..6fbffbb9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.ADF077D22B698F0058CD269AB3B307F6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.ADF077D22B698F0058CD269AB3B307F6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.ADF077D22B698F0058CD269AB3B307F6.cso.pdb new file mode 100644 index 00000000..f4a13950 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.ADF077D22B698F0058CD269AB3B307F6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:236faf9c48946a5979f5526f56f6d811bc721168a1af6763f1ce5c0be119e93e +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.E6559EF41DF4A3259DE7762E070648DE.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.E6559EF41DF4A3259DE7762E070648DE.metallib new file mode 100644 index 00000000..a2729650 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshIndirectionBuffer.comp.E6559EF41DF4A3259DE7762E070648DE.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.4FB8AAE1AE744B6A08826A79EB921BC5.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.4FB8AAE1AE744B6A08826A79EB921BC5.metallib new file mode 100644 index 00000000..d7263356 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.4FB8AAE1AE744B6A08826A79EB921BC5.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.B71DE41E8684A6AE211AB8D5CC66868D.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.B71DE41E8684A6AE211AB8D5CC66868D.cso new file mode 100644 index 00000000..0ba53e55 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.B71DE41E8684A6AE211AB8D5CC66868D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.B71DE41E8684A6AE211AB8D5CC66868D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.B71DE41E8684A6AE211AB8D5CC66868D.cso.pdb new file mode 100644 index 00000000..a4a37f6c --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeMeshMatrices.comp.B71DE41E8684A6AE211AB8D5CC66868D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6309cca5c70b21dae5c58007e41eecd9af7b23ac92c3451491b17f0d48ff58db +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.77033778233ABE1F8DF4DC10896A9D54.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.77033778233ABE1F8DF4DC10896A9D54.cso new file mode 100644 index 00000000..ecc68c0e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.77033778233ABE1F8DF4DC10896A9D54.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.77033778233ABE1F8DF4DC10896A9D54.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.77033778233ABE1F8DF4DC10896A9D54.cso.pdb new file mode 100644 index 00000000..b0e89021 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.77033778233ABE1F8DF4DC10896A9D54.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e0053f4776e1127986b71a7943a80d82719accd60a235c475615aaecfc7dcd5 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.C9C782D1BBE13E453755EC081421DED8.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.C9C782D1BBE13E453755EC081421DED8.metallib new file mode 100644 index 00000000..e17856b7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeMipMap.comp.C9C782D1BBE13E453755EC081421DED8.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.369D88A577A88042FF66C8A4DB9A4FFF.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.369D88A577A88042FF66C8A4DB9A4FFF.cso new file mode 100644 index 00000000..f88da5ea Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.369D88A577A88042FF66C8A4DB9A4FFF.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.369D88A577A88042FF66C8A4DB9A4FFF.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.369D88A577A88042FF66C8A4DB9A4FFF.cso.pdb new file mode 100644 index 00000000..8cd5167a --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.369D88A577A88042FF66C8A4DB9A4FFF.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:981f069b8f4240835c0a93939e1b5f51426e08d1ba00a0f2baf897d27cd901b7 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.392E08DB2C8E05308B151D1DA50C5FD0.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.392E08DB2C8E05308B151D1DA50C5FD0.cso new file mode 100644 index 00000000..4a0c0682 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.392E08DB2C8E05308B151D1DA50C5FD0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.392E08DB2C8E05308B151D1DA50C5FD0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.392E08DB2C8E05308B151D1DA50C5FD0.cso.pdb new file mode 100644 index 00000000..892a44f1 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.392E08DB2C8E05308B151D1DA50C5FD0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d29e01e0ec3cdf74afb7121682367426c6ca4b529c2aaa6abdea62f4fa36455 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.5105918DD8BE389C150428D89E1DC2A5.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.5105918DD8BE389C150428D89E1DC2A5.metallib new file mode 100644 index 00000000..c3018993 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.5105918DD8BE389C150428D89E1DC2A5.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.51CA73B06455A1B1FE3E7645C1E97A2C.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.51CA73B06455A1B1FE3E7645C1E97A2C.cso new file mode 100644 index 00000000..192167bc Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.51CA73B06455A1B1FE3E7645C1E97A2C.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.51CA73B06455A1B1FE3E7645C1E97A2C.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.51CA73B06455A1B1FE3E7645C1E97A2C.cso.pdb new file mode 100644 index 00000000..1c671c06 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.51CA73B06455A1B1FE3E7645C1E97A2C.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ddc5c8b495d55fb4d56c45e90d6ec2ff82b6aa1e5110cd194923dd5c07197856 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.87A39CD991750E4B6AA82597D1D6999F.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.87A39CD991750E4B6AA82597D1D6999F.metallib new file mode 100644 index 00000000..02506f8f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.87A39CD991750E4B6AA82597D1D6999F.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.AE073ACCCC101E16160223DC2E63E101.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.AE073ACCCC101E16160223DC2E63E101.metallib new file mode 100644 index 00000000..bb97a50d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.AE073ACCCC101E16160223DC2E63E101.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.C8248FD11EC1733B4966D0AD2A176353.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.C8248FD11EC1733B4966D0AD2A176353.cso new file mode 100644 index 00000000..4aa03c72 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.C8248FD11EC1733B4966D0AD2A176353.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.C8248FD11EC1733B4966D0AD2A176353.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.C8248FD11EC1733B4966D0AD2A176353.cso.pdb new file mode 100644 index 00000000..b88a0f55 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.C8248FD11EC1733B4966D0AD2A176353.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2b9ef09c333c56cb8a72814c5c6c8493b1290e1d32be4c7ca6cfb41029c925a +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.DF3F5EC676EAEE69B51393B80926E694.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.DF3F5EC676EAEE69B51393B80926E694.metallib new file mode 100644 index 00000000..c8eb3cf7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeParticleCountPerMesh.comp.DF3F5EC676EAEE69B51393B80926E694.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.2616FB8E13640920939266A5AB69B20D.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.2616FB8E13640920939266A5AB69B20D.metallib new file mode 100644 index 00000000..e88279a1 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.2616FB8E13640920939266A5AB69B20D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.5193D9B98F2643DCDDD49DEB24A0B7BF.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.5193D9B98F2643DCDDD49DEB24A0B7BF.cso new file mode 100644 index 00000000..a054253c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.5193D9B98F2643DCDDD49DEB24A0B7BF.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.5193D9B98F2643DCDDD49DEB24A0B7BF.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.5193D9B98F2643DCDDD49DEB24A0B7BF.cso.pdb new file mode 100644 index 00000000..b51dabff --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeRibbonSortKeys.comp.5193D9B98F2643DCDDD49DEB24A0B7BF.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb60f15bfcd9f3186e2c86edef225ca60ef5da932d3b4f954c60046e80622664 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.1176896EBBA00E7091A5D3AB0E2EBB79.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.1176896EBBA00E7091A5D3AB0E2EBB79.metallib new file mode 100644 index 00000000..f09064de Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.1176896EBBA00E7091A5D3AB0E2EBB79.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.22E56629C521714CE47CDCC8E03CCD62.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.22E56629C521714CE47CDCC8E03CCD62.cso new file mode 100644 index 00000000..7d8ed48e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.22E56629C521714CE47CDCC8E03CCD62.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.22E56629C521714CE47CDCC8E03CCD62.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.22E56629C521714CE47CDCC8E03CCD62.cso.pdb new file mode 100644 index 00000000..b8fb83e8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.22E56629C521714CE47CDCC8E03CCD62.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27d9ba9db584feda5e5cd0d93d4360395617265c40e583d30b1d2fa1c12b65b7 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.3048D89D90DE3FE53B72E0B170415B00.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.3048D89D90DE3FE53B72E0B170415B00.cso new file mode 100644 index 00000000..9a9e0cd3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.3048D89D90DE3FE53B72E0B170415B00.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.3048D89D90DE3FE53B72E0B170415B00.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.3048D89D90DE3FE53B72E0B170415B00.cso.pdb new file mode 100644 index 00000000..4f87694e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.3048D89D90DE3FE53B72E0B170415B00.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be25f238f8ee65fbb7f0d4edec55b84988d050b5ac900b999074c49d5eb571a2 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.52AF64226113D111C7C55923680D03E7.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.52AF64226113D111C7C55923680D03E7.metallib new file mode 100644 index 00000000..6e35f567 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.52AF64226113D111C7C55923680D03E7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.6D4F2B8F547360DC2A71F660E3706939.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.6D4F2B8F547360DC2A71F660E3706939.metallib new file mode 100644 index 00000000..75a7b958 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.6D4F2B8F547360DC2A71F660E3706939.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.82765548E48F470AE2C324FD1DD1DF19.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.82765548E48F470AE2C324FD1DD1DF19.cso new file mode 100644 index 00000000..29f901ee Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.82765548E48F470AE2C324FD1DD1DF19.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.82765548E48F470AE2C324FD1DD1DF19.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.82765548E48F470AE2C324FD1DD1DF19.cso.pdb new file mode 100644 index 00000000..95ec0792 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.82765548E48F470AE2C324FD1DD1DF19.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4282efc647e46b2851cf3e13db593dcd83c472c784797b763cb93cf09fd620ea +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.BF85DD78B470A799944AD5A0F0323B0C.cso b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.BF85DD78B470A799944AD5A0F0323B0C.cso new file mode 100644 index 00000000..bd5d95ff Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.BF85DD78B470A799944AD5A0F0323B0C.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.BF85DD78B470A799944AD5A0F0323B0C.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.BF85DD78B470A799944AD5A0F0323B0C.cso.pdb new file mode 100644 index 00000000..86e07468 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.BF85DD78B470A799944AD5A0F0323B0C.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c099a9fbf2b8ce8740ae6c823fbc76b41060bfbb3abde95e1097cb37727b5625 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.EEC67DE904429E8E712062FB728CA7E7.metallib b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.EEC67DE904429E8E712062FB728CA7E7.metallib new file mode 100644 index 00000000..5bc024b4 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ComputeSortKeys.comp.EEC67DE904429E8E712062FB728CA7E7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.002AC7D0B7F236B81143408D73D581F8.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.002AC7D0B7F236B81143408D73D581F8.cso new file mode 100644 index 00000000..2546e838 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.002AC7D0B7F236B81143408D73D581F8.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.002AC7D0B7F236B81143408D73D581F8.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.002AC7D0B7F236B81143408D73D581F8.cso.pdb new file mode 100644 index 00000000..e4e9376b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.002AC7D0B7F236B81143408D73D581F8.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89fcddfba33e50cf1fe921a113848cde22185511d786e51ae3bbd075eb42516d +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.008D18448C772DC164148A23DB8594EA.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.008D18448C772DC164148A23DB8594EA.cso new file mode 100644 index 00000000..e10d35e7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.008D18448C772DC164148A23DB8594EA.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.008D18448C772DC164148A23DB8594EA.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.008D18448C772DC164148A23DB8594EA.cso.pdb new file mode 100644 index 00000000..a9aca89f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.008D18448C772DC164148A23DB8594EA.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66966791aef765de1a9649f6930079d9bae0c0b4e4b84edd47039291d4d57c66 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.0AD45649F32641AAA69A3A9C079BDDBC.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.0AD45649F32641AAA69A3A9C079BDDBC.metallib new file mode 100644 index 00000000..fa5cbd8e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.0AD45649F32641AAA69A3A9C079BDDBC.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.18BB2ED0068256FAC47DC4810295F65B.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.18BB2ED0068256FAC47DC4810295F65B.cso new file mode 100644 index 00000000..dff14136 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.18BB2ED0068256FAC47DC4810295F65B.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.18BB2ED0068256FAC47DC4810295F65B.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.18BB2ED0068256FAC47DC4810295F65B.cso.pdb new file mode 100644 index 00000000..f2415748 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.18BB2ED0068256FAC47DC4810295F65B.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aac324c2510bcf2201c92b154f8430336f76df7768bfe67a9467c5444cfc6c80 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.3AEC42EAC916E5302A5879B5E0480E46.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.3AEC42EAC916E5302A5879B5E0480E46.metallib new file mode 100644 index 00000000..dd4c8bd0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.3AEC42EAC916E5302A5879B5E0480E46.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.42142CB169269EB33A0A31A418C939A6.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.42142CB169269EB33A0A31A418C939A6.metallib new file mode 100644 index 00000000..171a3466 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.42142CB169269EB33A0A31A418C939A6.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.48B033222FD1BD594675302F045A38A7.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.48B033222FD1BD594675302F045A38A7.cso new file mode 100644 index 00000000..b5155bd8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.48B033222FD1BD594675302F045A38A7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.48B033222FD1BD594675302F045A38A7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.48B033222FD1BD594675302F045A38A7.cso.pdb new file mode 100644 index 00000000..377b9f0a --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.48B033222FD1BD594675302F045A38A7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34fd1efbd3de6b0f4193ab20149e0f0a4d25dd93920704b8981fbf90ebc15ad2 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.4B0896B385CFE32F521EF3625ECD7CE6.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.4B0896B385CFE32F521EF3625ECD7CE6.cso new file mode 100644 index 00000000..283ec606 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.4B0896B385CFE32F521EF3625ECD7CE6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.4B0896B385CFE32F521EF3625ECD7CE6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.4B0896B385CFE32F521EF3625ECD7CE6.cso.pdb new file mode 100644 index 00000000..ba9ecd43 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.4B0896B385CFE32F521EF3625ECD7CE6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfbc4104c1259e72961a166af1f460c5cf670295bd83feedc7122b640fd05ed1 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.570374695D2EDE03975F3ACEEF142B8A.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.570374695D2EDE03975F3ACEEF142B8A.metallib new file mode 100644 index 00000000..821e9889 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.570374695D2EDE03975F3ACEEF142B8A.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.5BCF450E7AAEB04EFE81950BC64E3F24.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.5BCF450E7AAEB04EFE81950BC64E3F24.metallib new file mode 100644 index 00000000..861cdf5d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.5BCF450E7AAEB04EFE81950BC64E3F24.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.6B6958101DFBCC2D44E480C8108B4531.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.6B6958101DFBCC2D44E480C8108B4531.metallib new file mode 100644 index 00000000..d6460bcf Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.6B6958101DFBCC2D44E480C8108B4531.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.724B5E7F9D5F2C642BBADBF98BCE6122.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.724B5E7F9D5F2C642BBADBF98BCE6122.metallib new file mode 100644 index 00000000..5fcccdc2 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.724B5E7F9D5F2C642BBADBF98BCE6122.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.7D3D408F4D90CC373A284D34F9B71F98.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.7D3D408F4D90CC373A284D34F9B71F98.cso new file mode 100644 index 00000000..6a69bccb Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.7D3D408F4D90CC373A284D34F9B71F98.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.7D3D408F4D90CC373A284D34F9B71F98.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.7D3D408F4D90CC373A284D34F9B71F98.cso.pdb new file mode 100644 index 00000000..d51c02f8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.7D3D408F4D90CC373A284D34F9B71F98.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1df151aaa046972d0ea6b722a37a8348eac53c168558cc3aa4ee25b9fba9c7d2 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.842841B5F4FFDF9CF56BEF4C0A6C5C2D.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.842841B5F4FFDF9CF56BEF4C0A6C5C2D.cso new file mode 100644 index 00000000..110129f7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.842841B5F4FFDF9CF56BEF4C0A6C5C2D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.842841B5F4FFDF9CF56BEF4C0A6C5C2D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.842841B5F4FFDF9CF56BEF4C0A6C5C2D.cso.pdb new file mode 100644 index 00000000..e95f0024 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.842841B5F4FFDF9CF56BEF4C0A6C5C2D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:180c78b057b50d89195a6688c7fb275ce91512d3d1be4d8a4fe938d59b80393b +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.87D14E5B2AF4072ABF40B5A743B01133.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.87D14E5B2AF4072ABF40B5A743B01133.cso new file mode 100644 index 00000000..3e906cf8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.87D14E5B2AF4072ABF40B5A743B01133.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.87D14E5B2AF4072ABF40B5A743B01133.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.87D14E5B2AF4072ABF40B5A743B01133.cso.pdb new file mode 100644 index 00000000..085d2ee5 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.87D14E5B2AF4072ABF40B5A743B01133.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e74de029d9143b26d6ea41502873a2f2c032980b980615d4a0bbd7658683d7e +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.8EB0F8ED9C71D976C3914CE541D3AFC7.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.8EB0F8ED9C71D976C3914CE541D3AFC7.metallib new file mode 100644 index 00000000..159d80a4 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.8EB0F8ED9C71D976C3914CE541D3AFC7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.9868960EE5BAA4542CE68A32E3F82EAB.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.9868960EE5BAA4542CE68A32E3F82EAB.metallib new file mode 100644 index 00000000..1aa1d41a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.9868960EE5BAA4542CE68A32E3F82EAB.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.BD068B89B4F2CBB0E292F53BC3714F9D.metallib b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.BD068B89B4F2CBB0E292F53BC3714F9D.metallib new file mode 100644 index 00000000..1668fe2d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.BD068B89B4F2CBB0E292F53BC3714F9D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.CBB6451884404E44D465B01DF5A806BE.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.CBB6451884404E44D465B01DF5A806BE.cso new file mode 100644 index 00000000..7b334d3e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.CBB6451884404E44D465B01DF5A806BE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.CBB6451884404E44D465B01DF5A806BE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.CBB6451884404E44D465B01DF5A806BE.cso.pdb new file mode 100644 index 00000000..fcb2b132 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.CBB6451884404E44D465B01DF5A806BE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:856770a12e1e19197abe34121e2e4abb32d120bdc2c0cdba938fc57640ca5ea1 +size 24064 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.F0E2F0F689387705D12CB9970013F51D.cso b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.F0E2F0F689387705D12CB9970013F51D.cso new file mode 100644 index 00000000..3de42144 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.F0E2F0F689387705D12CB9970013F51D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.F0E2F0F689387705D12CB9970013F51D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.F0E2F0F689387705D12CB9970013F51D.cso.pdb new file mode 100644 index 00000000..225b2a19 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Copy.frag.F0E2F0F689387705D12CB9970013F51D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ffe52cc7c0550254f5f6eca05497383544a57e2d97d91f47e37ea4d71d580cc +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.cso new file mode 100644 index 00000000..ea0c185f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.cso.pdb new file mode 100644 index 00000000..e34fc891 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:929076f1050aa7afa3dd259b38a31723ae3c3fc2377ae80e3e9d9c757444eb07 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.metallib new file mode 100644 index 00000000..a41e7f56 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.01D890EA6B89BCCBE76EB1FEC30F851E.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.140F4C3CE57F202DE2DE8B945704F1F0.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.140F4C3CE57F202DE2DE8B945704F1F0.cso new file mode 100644 index 00000000..5c3f8836 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.140F4C3CE57F202DE2DE8B945704F1F0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.140F4C3CE57F202DE2DE8B945704F1F0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.140F4C3CE57F202DE2DE8B945704F1F0.cso.pdb new file mode 100644 index 00000000..2cba2033 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.140F4C3CE57F202DE2DE8B945704F1F0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56abd05e0af4cea96fb87b3b6491e92937ffd056e483b90fc3b95cc2b3fa9490 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.1DCA9D50DC853C86C4F97DC839A9325E.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.1DCA9D50DC853C86C4F97DC839A9325E.cso new file mode 100644 index 00000000..123c8f8a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.1DCA9D50DC853C86C4F97DC839A9325E.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.1DCA9D50DC853C86C4F97DC839A9325E.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.1DCA9D50DC853C86C4F97DC839A9325E.cso.pdb new file mode 100644 index 00000000..03310796 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.1DCA9D50DC853C86C4F97DC839A9325E.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70e5250db4a4a7ea9fe3a812d41d9da6652fd2e245b67db29a73efc4d2fbfe84 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.2FF984AB185BE7E8637187AC34C0981A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.2FF984AB185BE7E8637187AC34C0981A.cso new file mode 100644 index 00000000..239e5f21 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.2FF984AB185BE7E8637187AC34C0981A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb new file mode 100644 index 00000000..2ec71f25 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5a1951e88020112c517eece099f1a851db5a36fe5294e576b4fd13a859dba12 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.3348F0F53DE2A58A3FAD84C6699E871C.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.3348F0F53DE2A58A3FAD84C6699E871C.metallib new file mode 100644 index 00000000..c7e6c0b7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.3348F0F53DE2A58A3FAD84C6699E871C.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.58AAEEAE9F43BBE34D312BD53914D01A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.58AAEEAE9F43BBE34D312BD53914D01A.cso new file mode 100644 index 00000000..2912f1ac Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.58AAEEAE9F43BBE34D312BD53914D01A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.58AAEEAE9F43BBE34D312BD53914D01A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.58AAEEAE9F43BBE34D312BD53914D01A.cso.pdb new file mode 100644 index 00000000..3f06266d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.58AAEEAE9F43BBE34D312BD53914D01A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bd79f945ebd2a3490eea034940690b833ec1384703cac2f49507076af78224b +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib new file mode 100644 index 00000000..65cef256 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.7DDABF541F1046F394F9BD2476CB5992.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.7DDABF541F1046F394F9BD2476CB5992.metallib new file mode 100644 index 00000000..05f8ea0e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.7DDABF541F1046F394F9BD2476CB5992.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.E77F6D2C2CCEA5FD8F910DA990E10013.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.E77F6D2C2CCEA5FD8F910DA990E10013.metallib new file mode 100644 index 00000000..99e05045 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDraw.vert.E77F6D2C2CCEA5FD8F910DA990E10013.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.cso new file mode 100644 index 00000000..d1fe6999 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb new file mode 100644 index 00000000..1ffab6d6 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb7beabd9ad98a1d93319b2a342d68ad2f6e55a6256d0f75293f13880fe5a040 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib new file mode 100644 index 00000000..83ede918 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.5DF351B082B2DAEB6EA8D2B69FF8CE75.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.5DF351B082B2DAEB6EA8D2B69FF8CE75.metallib new file mode 100644 index 00000000..19dbc8af Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.5DF351B082B2DAEB6EA8D2B69FF8CE75.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7CF9397E238069F29B5AD306936DC2E1.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7CF9397E238069F29B5AD306936DC2E1.cso new file mode 100644 index 00000000..403fad6c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7CF9397E238069F29B5AD306936DC2E1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb new file mode 100644 index 00000000..421c8579 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be6e3da731d3cf2450670fb27b9fa9c49b3061c518a6b974044271ee89316354 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7F37BB3F141BE207B89B42BD7E923FBA.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7F37BB3F141BE207B89B42BD7E923FBA.metallib new file mode 100644 index 00000000..c537c11e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.7F37BB3F141BE207B89B42BD7E923FBA.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.9E055DD95BFFEC03321947DE0EB82637.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.9E055DD95BFFEC03321947DE0EB82637.metallib new file mode 100644 index 00000000..4b3ff476 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.9E055DD95BFFEC03321947DE0EB82637.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.DAB1785A8432D17D3A9633C69AC4C0BF.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.DAB1785A8432D17D3A9633C69AC4C0BF.metallib new file mode 100644 index 00000000..5370f856 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.DAB1785A8432D17D3A9633C69AC4C0BF.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.EF723B81A7A0BF6787FDDD555588FDAA.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.EF723B81A7A0BF6787FDDD555588FDAA.metallib new file mode 100644 index 00000000..8511d10c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawColor.frag.EF723B81A7A0BF6787FDDD555588FDAA.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.7CF9397E238069F29B5AD306936DC2E1.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.7CF9397E238069F29B5AD306936DC2E1.cso new file mode 100644 index 00000000..330025df Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.7CF9397E238069F29B5AD306936DC2E1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb new file mode 100644 index 00000000..f52526a6 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b80d97194a7b86a1f827c0ea0a697657d223b909c1e69e2d642a141fbb3e73d +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.EF723B81A7A0BF6787FDDD555588FDAA.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.EF723B81A7A0BF6787FDDD555588FDAA.metallib new file mode 100644 index 00000000..a61be7c9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.frag.EF723B81A7A0BF6787FDDD555588FDAA.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.2FF984AB185BE7E8637187AC34C0981A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.2FF984AB185BE7E8637187AC34C0981A.cso new file mode 100644 index 00000000..f3b7113b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.2FF984AB185BE7E8637187AC34C0981A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb new file mode 100644 index 00000000..47c9d66f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc274141b737bafdc741482968c6e5b11cf3a197c5100989ca23e127185a6631 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib new file mode 100644 index 00000000..13b8a60d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawLine.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.8DBEE0AA3D769A49703B7DD05C82CFA3.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.8DBEE0AA3D769A49703B7DD05C82CFA3.metallib new file mode 100644 index 00000000..14829203 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.8DBEE0AA3D769A49703B7DD05C82CFA3.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.C1B07717CD6E335BA0719719B22FAFE3.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.C1B07717CD6E335BA0719719B22FAFE3.cso new file mode 100644 index 00000000..9051590d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.C1B07717CD6E335BA0719719B22FAFE3.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.C1B07717CD6E335BA0719719B22FAFE3.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.C1B07717CD6E335BA0719719B22FAFE3.cso.pdb new file mode 100644 index 00000000..80f16adc --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.frag.C1B07717CD6E335BA0719719B22FAFE3.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2c99a60447fabdb2283210459c04804c2f694da8b7c10b14c8cbe85225c72db +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.29EB9B0EAE29F9736E833F3E1F035C27.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.29EB9B0EAE29F9736E833F3E1F035C27.metallib new file mode 100644 index 00000000..5b913ede Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.29EB9B0EAE29F9736E833F3E1F035C27.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.75A6F16850E5D3B8E8B7368097463B42.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.75A6F16850E5D3B8E8B7368097463B42.cso new file mode 100644 index 00000000..9fa68291 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.75A6F16850E5D3B8E8B7368097463B42.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.75A6F16850E5D3B8E8B7368097463B42.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.75A6F16850E5D3B8E8B7368097463B42.cso.pdb new file mode 100644 index 00000000..0c3b8ce4 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugDrawValue.vert.75A6F16850E5D3B8E8B7368097463B42.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58de6040f7756ffb1c0a12d1d78cada676eec46ae36b765b697ca6a2800b9c8d +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.03430199D846164B6B0612A9B2AB28EA.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.03430199D846164B6B0612A9B2AB28EA.cso new file mode 100644 index 00000000..aedc27f1 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.03430199D846164B6B0612A9B2AB28EA.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.03430199D846164B6B0612A9B2AB28EA.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.03430199D846164B6B0612A9B2AB28EA.cso.pdb new file mode 100644 index 00000000..3cde1232 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.03430199D846164B6B0612A9B2AB28EA.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7e4cb24d2e1cee69a72a54b88a16404c4b2e703329eeef11270a61d2e645782 +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.40C070F9811750AE211F3378926ED3B0.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.40C070F9811750AE211F3378926ED3B0.metallib new file mode 100644 index 00000000..36ec41ea Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.40C070F9811750AE211F3378926ED3B0.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.9D7F4A290A88D708B9D8641A2177BBE3.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.9D7F4A290A88D708B9D8641A2177BBE3.metallib new file mode 100644 index 00000000..a0dba10b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.9D7F4A290A88D708B9D8641A2177BBE3.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.AA13DF163AA5F83DF77B65270B739A08.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.AA13DF163AA5F83DF77B65270B739A08.cso new file mode 100644 index 00000000..c15ad362 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.AA13DF163AA5F83DF77B65270B739A08.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.AA13DF163AA5F83DF77B65270B739A08.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.AA13DF163AA5F83DF77B65270B739A08.cso.pdb new file mode 100644 index 00000000..09813c9c --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.AA13DF163AA5F83DF77B65270B739A08.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45fc024a6da504ec98528ae91d233880eb7c6458004fa772032174e9b2f22af3 +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.ABB1D1D062F10893CD085B71E73BA1FB.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.ABB1D1D062F10893CD085B71E73BA1FB.metallib new file mode 100644 index 00000000..ef4f6823 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.ABB1D1D062F10893CD085B71E73BA1FB.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB070F836ADD72A3E65E350E4F68AAFE.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB070F836ADD72A3E65E350E4F68AAFE.cso new file mode 100644 index 00000000..bd8ff441 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB070F836ADD72A3E65E350E4F68AAFE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB070F836ADD72A3E65E350E4F68AAFE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB070F836ADD72A3E65E350E4F68AAFE.cso.pdb new file mode 100644 index 00000000..31ff1c86 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB070F836ADD72A3E65E350E4F68AAFE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00c835585d124ce2be52516e03db09ab50d30fe19a7fda2af1f2b9262ffcb7c5 +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB420670B55EEABBBB80947E171765E6.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB420670B55EEABBBB80947E171765E6.cso new file mode 100644 index 00000000..a1ba79c3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB420670B55EEABBBB80947E171765E6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB420670B55EEABBBB80947E171765E6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB420670B55EEABBBB80947E171765E6.cso.pdb new file mode 100644 index 00000000..ae2c40a8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.BB420670B55EEABBBB80947E171765E6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49ec8238f3f1956e951e19568b3ccc6d3ed105002e41eb996bff436bef092d07 +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.C0FACB4FBDE6B9C944D0F6B61E5515FE.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.C0FACB4FBDE6B9C944D0F6B61E5515FE.cso new file mode 100644 index 00000000..40014b43 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.C0FACB4FBDE6B9C944D0F6B61E5515FE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.C0FACB4FBDE6B9C944D0F6B61E5515FE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.C0FACB4FBDE6B9C944D0F6B61E5515FE.cso.pdb new file mode 100644 index 00000000..896d7176 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.C0FACB4FBDE6B9C944D0F6B61E5515FE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12d35565d6525e0381649617dd85ebd89d1cd85d948119a6eabbdbba1edc4270 +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.F6238D8991D40344B66C2ABAF21B2B5A.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.F6238D8991D40344B66C2ABAF21B2B5A.metallib new file mode 100644 index 00000000..68187601 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.F6238D8991D40344B66C2ABAF21B2B5A.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.FE53A6036CA4635A540C1FEA2D189F45.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.FE53A6036CA4635A540C1FEA2D189F45.metallib new file mode 100644 index 00000000..3641c882 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugMesh_GPU.vert.FE53A6036CA4635A540C1FEA2D189F45.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.05E05A32B897F2006A110EB2D80A4548.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.05E05A32B897F2006A110EB2D80A4548.cso new file mode 100644 index 00000000..a7392d2c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.05E05A32B897F2006A110EB2D80A4548.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.05E05A32B897F2006A110EB2D80A4548.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.05E05A32B897F2006A110EB2D80A4548.cso.pdb new file mode 100644 index 00000000..718eaf4a --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.05E05A32B897F2006A110EB2D80A4548.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f19da39f693a5ba6a5da356bd43941f8eae8207651b2cec170be531d472c816 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.0E8B137E61B073CBAAAB0C24A2C4CEF9.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.0E8B137E61B073CBAAAB0C24A2C4CEF9.cso new file mode 100644 index 00000000..4448ee14 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.0E8B137E61B073CBAAAB0C24A2C4CEF9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.0E8B137E61B073CBAAAB0C24A2C4CEF9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.0E8B137E61B073CBAAAB0C24A2C4CEF9.cso.pdb new file mode 100644 index 00000000..1d41f7bd --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.0E8B137E61B073CBAAAB0C24A2C4CEF9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1733bda76f9af2b030f2db6379cd99426fc5bbae675dca26650dac44bd044c2 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.266E4511F0C4068B851B075051BA543B.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.266E4511F0C4068B851B075051BA543B.cso new file mode 100644 index 00000000..ef45836b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.266E4511F0C4068B851B075051BA543B.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.266E4511F0C4068B851B075051BA543B.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.266E4511F0C4068B851B075051BA543B.cso.pdb new file mode 100644 index 00000000..a5fe5993 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.266E4511F0C4068B851B075051BA543B.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0704b1602c7830dbc989f84e215eda67fec07efb6f5453fdc0f763734d1927a7 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.2FF984AB185BE7E8637187AC34C0981A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.2FF984AB185BE7E8637187AC34C0981A.cso new file mode 100644 index 00000000..95aa483b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.2FF984AB185BE7E8637187AC34C0981A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb new file mode 100644 index 00000000..c2797970 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.2FF984AB185BE7E8637187AC34C0981A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0102d06fa2f93f586219cfecc37176c5a25811c9ec7e2cff76f4c542f700431 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.35C1E2A66FBFA2887558AC3636CCA6EB.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.35C1E2A66FBFA2887558AC3636CCA6EB.metallib new file mode 100644 index 00000000..3059a74e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.35C1E2A66FBFA2887558AC3636CCA6EB.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.38A9BD92AA3A1500ADA3082B18F935F4.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.38A9BD92AA3A1500ADA3082B18F935F4.cso new file mode 100644 index 00000000..952fafcf Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.38A9BD92AA3A1500ADA3082B18F935F4.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.38A9BD92AA3A1500ADA3082B18F935F4.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.38A9BD92AA3A1500ADA3082B18F935F4.cso.pdb new file mode 100644 index 00000000..b517906e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.38A9BD92AA3A1500ADA3082B18F935F4.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52ed8319a81df60fd2f2f6ac2fc2680422221407c132781a7495aafd7fab940e +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.3DC0E88754F11D4478F7B7D881ADF28E.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.3DC0E88754F11D4478F7B7D881ADF28E.metallib new file mode 100644 index 00000000..c7e1a050 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.3DC0E88754F11D4478F7B7D881ADF28E.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.473011F7B55118D4409E7A91C4CA0C06.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.473011F7B55118D4409E7A91C4CA0C06.metallib new file mode 100644 index 00000000..9edfc9ef Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.473011F7B55118D4409E7A91C4CA0C06.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.53C5FFB4F1F65014E9D8CE139E165C06.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.53C5FFB4F1F65014E9D8CE139E165C06.metallib new file mode 100644 index 00000000..47c50194 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.53C5FFB4F1F65014E9D8CE139E165C06.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5A4DDE443DFF866A0B6F7E709735D7AB.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5A4DDE443DFF866A0B6F7E709735D7AB.cso new file mode 100644 index 00000000..61b2ee81 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5A4DDE443DFF866A0B6F7E709735D7AB.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5A4DDE443DFF866A0B6F7E709735D7AB.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5A4DDE443DFF866A0B6F7E709735D7AB.cso.pdb new file mode 100644 index 00000000..4ade7e02 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5A4DDE443DFF866A0B6F7E709735D7AB.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70a653812d03eb8e373a6c6fad4a052078671e6912463ff5b8e78ee510f72ea2 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib new file mode 100644 index 00000000..2d8ca46d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5AE82EFD5FB29F367E0D45BA786D928A.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5C6447565A432691A52405F2D1A50012.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5C6447565A432691A52405F2D1A50012.cso new file mode 100644 index 00000000..2f6d1a75 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5C6447565A432691A52405F2D1A50012.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5C6447565A432691A52405F2D1A50012.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5C6447565A432691A52405F2D1A50012.cso.pdb new file mode 100644 index 00000000..e60eed66 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.5C6447565A432691A52405F2D1A50012.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5beefc767258925dfd57c31b267e5f0965921686efb12a8a43dc794673ff65b7 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.620373BC462CC9D98E9DAE33EC0EF03D.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.620373BC462CC9D98E9DAE33EC0EF03D.metallib new file mode 100644 index 00000000..366e0269 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.620373BC462CC9D98E9DAE33EC0EF03D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.65E266EB404652FA1212BBD1F985A6AC.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.65E266EB404652FA1212BBD1F985A6AC.cso new file mode 100644 index 00000000..0fcfe946 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.65E266EB404652FA1212BBD1F985A6AC.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.65E266EB404652FA1212BBD1F985A6AC.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.65E266EB404652FA1212BBD1F985A6AC.cso.pdb new file mode 100644 index 00000000..06b4a78c --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.65E266EB404652FA1212BBD1F985A6AC.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93883e8debe110b55eb5af401f16a28f72f0596cc134243f38767e833c1f7b6c +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.66F6E1229EB0784EFA3F715B73E43D2B.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.66F6E1229EB0784EFA3F715B73E43D2B.metallib new file mode 100644 index 00000000..1cacec2b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.66F6E1229EB0784EFA3F715B73E43D2B.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.6CE9330E31EBBC32AE8E316A8C0EE277.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.6CE9330E31EBBC32AE8E316A8C0EE277.metallib new file mode 100644 index 00000000..1cc444bb Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.6CE9330E31EBBC32AE8E316A8C0EE277.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8BD5661BC011A36608F82548C23FB052.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8BD5661BC011A36608F82548C23FB052.cso new file mode 100644 index 00000000..6cd8b7ef Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8BD5661BC011A36608F82548C23FB052.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8BD5661BC011A36608F82548C23FB052.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8BD5661BC011A36608F82548C23FB052.cso.pdb new file mode 100644 index 00000000..8ecf8ab3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8BD5661BC011A36608F82548C23FB052.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a74f88ecbd079299696b4d48072518e6ebbb94a7570f29cf39f24b3df7a5b203 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8D18B0A6A0838F6914203A391288C860.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8D18B0A6A0838F6914203A391288C860.metallib new file mode 100644 index 00000000..437d7840 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.8D18B0A6A0838F6914203A391288C860.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.A7855B18F4958E7E1B7D9B72701C3720.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.A7855B18F4958E7E1B7D9B72701C3720.metallib new file mode 100644 index 00000000..86879263 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.A7855B18F4958E7E1B7D9B72701C3720.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.ADDF91CE486A3BFBC7564616DE170ABA.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.ADDF91CE486A3BFBC7564616DE170ABA.cso new file mode 100644 index 00000000..80975608 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.ADDF91CE486A3BFBC7564616DE170ABA.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.ADDF91CE486A3BFBC7564616DE170ABA.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.ADDF91CE486A3BFBC7564616DE170ABA.cso.pdb new file mode 100644 index 00000000..16998020 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.ADDF91CE486A3BFBC7564616DE170ABA.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a32d70e5612b4ea944ca90924a4304327f05790fe5b6c7d78471aad8d315062f +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.B745EB05721137F2AE8C910D1BE17F25.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.B745EB05721137F2AE8C910D1BE17F25.metallib new file mode 100644 index 00000000..f7170528 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.B745EB05721137F2AE8C910D1BE17F25.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.C7EED909597A865FF430CA2885C69439.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.C7EED909597A865FF430CA2885C69439.cso new file mode 100644 index 00000000..565a279f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.C7EED909597A865FF430CA2885C69439.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.C7EED909597A865FF430CA2885C69439.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.C7EED909597A865FF430CA2885C69439.cso.pdb new file mode 100644 index 00000000..7f94ec9c --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.C7EED909597A865FF430CA2885C69439.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01a72acaf994cc4be38d5359fd2f0a3ae17a3f1716590935002c859668ca5638 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.DC15E12AB500EAEE4B0F9A2C8075E8E1.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.DC15E12AB500EAEE4B0F9A2C8075E8E1.cso new file mode 100644 index 00000000..cfd2c92c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.DC15E12AB500EAEE4B0F9A2C8075E8E1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.DC15E12AB500EAEE4B0F9A2C8075E8E1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.DC15E12AB500EAEE4B0F9A2C8075E8E1.cso.pdb new file mode 100644 index 00000000..4b178ee8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.DC15E12AB500EAEE4B0F9A2C8075E8E1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3d60ca289229cc8d8a2d287e3cca4059a99185ad15f829c37c7779f77144a43 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.FDDCD4D907DA9A03ACCD42C140A776A4.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.FDDCD4D907DA9A03ACCD42C140A776A4.metallib new file mode 100644 index 00000000..39c04b9a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticle.vert.FDDCD4D907DA9A03ACCD42C140A776A4.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.11A3F59B29869268E24243BE4EABD116.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.11A3F59B29869268E24243BE4EABD116.cso new file mode 100644 index 00000000..34910ae5 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.11A3F59B29869268E24243BE4EABD116.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.11A3F59B29869268E24243BE4EABD116.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.11A3F59B29869268E24243BE4EABD116.cso.pdb new file mode 100644 index 00000000..5a7461a6 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.11A3F59B29869268E24243BE4EABD116.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb57d8a4c8b03e4cebcd41291cd0ea6b0ba3db69b781abc7a5c804185399719c +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.125C4FCD6DC29A9F6B47ACC988C0162F.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.125C4FCD6DC29A9F6B47ACC988C0162F.cso new file mode 100644 index 00000000..558d5938 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.125C4FCD6DC29A9F6B47ACC988C0162F.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.125C4FCD6DC29A9F6B47ACC988C0162F.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.125C4FCD6DC29A9F6B47ACC988C0162F.cso.pdb new file mode 100644 index 00000000..f79557a9 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.125C4FCD6DC29A9F6B47ACC988C0162F.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8225d5924a1c1c8b768149769c0bad4abdfb789e5cb109a1667e96516d949852 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1873B621D321CE82AA536C28DCE3C58D.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1873B621D321CE82AA536C28DCE3C58D.cso new file mode 100644 index 00000000..fd5c0748 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1873B621D321CE82AA536C28DCE3C58D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1873B621D321CE82AA536C28DCE3C58D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1873B621D321CE82AA536C28DCE3C58D.cso.pdb new file mode 100644 index 00000000..fe31c556 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1873B621D321CE82AA536C28DCE3C58D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cd33ff9591ce16cb6e182dabbf420209121578ee6539352f2ccf49d27cc7d85 +size 42496 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1A146F33833BE9EEA65C6C0C0CBE799D.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1A146F33833BE9EEA65C6C0C0CBE799D.cso new file mode 100644 index 00000000..5701ca73 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1A146F33833BE9EEA65C6C0C0CBE799D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1A146F33833BE9EEA65C6C0C0CBE799D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1A146F33833BE9EEA65C6C0C0CBE799D.cso.pdb new file mode 100644 index 00000000..3a500721 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1A146F33833BE9EEA65C6C0C0CBE799D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad03641019a88fc39e05623cfaac6f0268ab4c42953c64f01cc0cbf8dbd8b802 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1B816B245295CA5D5327E96BFE6301F6.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1B816B245295CA5D5327E96BFE6301F6.cso new file mode 100644 index 00000000..2c24d0d8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1B816B245295CA5D5327E96BFE6301F6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1B816B245295CA5D5327E96BFE6301F6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1B816B245295CA5D5327E96BFE6301F6.cso.pdb new file mode 100644 index 00000000..ee5b50d5 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1B816B245295CA5D5327E96BFE6301F6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c55f20070408288fbc4be297498428b2b061cfc739e10ad3fa3e8dd3e835fa17 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1C0F0C96333B91901C06D1175A16E1DE.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1C0F0C96333B91901C06D1175A16E1DE.cso new file mode 100644 index 00000000..6f651012 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1C0F0C96333B91901C06D1175A16E1DE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1C0F0C96333B91901C06D1175A16E1DE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1C0F0C96333B91901C06D1175A16E1DE.cso.pdb new file mode 100644 index 00000000..ea1ce426 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.1C0F0C96333B91901C06D1175A16E1DE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b3181d7b842bc01a66beeea545a790ae7ebe121e0af6b4a345596a953d24b79 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2ACA21574A23B0D0074098285F176749.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2ACA21574A23B0D0074098285F176749.cso new file mode 100644 index 00000000..09647457 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2ACA21574A23B0D0074098285F176749.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2ACA21574A23B0D0074098285F176749.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2ACA21574A23B0D0074098285F176749.cso.pdb new file mode 100644 index 00000000..3707245e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2ACA21574A23B0D0074098285F176749.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfb7348dbf9d468391dfe6c609132946e814bb80234ff527fd941fa59fc430ed +size 42496 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2C8009173B59A839A8E4FF2BC5B85094.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2C8009173B59A839A8E4FF2BC5B85094.cso new file mode 100644 index 00000000..3e5771a8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2C8009173B59A839A8E4FF2BC5B85094.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2C8009173B59A839A8E4FF2BC5B85094.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2C8009173B59A839A8E4FF2BC5B85094.cso.pdb new file mode 100644 index 00000000..855e4c4a --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2C8009173B59A839A8E4FF2BC5B85094.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a21a333e947421f30435a5c2fcbd041ab002cd12a9f5963fd0d714a8d01e662e +size 42496 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2CEEC2A138B6BB946C7E5836CC5E37E0.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2CEEC2A138B6BB946C7E5836CC5E37E0.cso new file mode 100644 index 00000000..b7291057 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2CEEC2A138B6BB946C7E5836CC5E37E0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2CEEC2A138B6BB946C7E5836CC5E37E0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2CEEC2A138B6BB946C7E5836CC5E37E0.cso.pdb new file mode 100644 index 00000000..60be348d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.2CEEC2A138B6BB946C7E5836CC5E37E0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cebe2a566ace5f142b1ec45d57de06f586e25d87aeade24a40924ac8c34adf7c +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.377370747DA9B2908354049AAC2D30FA.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.377370747DA9B2908354049AAC2D30FA.cso new file mode 100644 index 00000000..6bef9265 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.377370747DA9B2908354049AAC2D30FA.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.377370747DA9B2908354049AAC2D30FA.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.377370747DA9B2908354049AAC2D30FA.cso.pdb new file mode 100644 index 00000000..d9e3db95 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.377370747DA9B2908354049AAC2D30FA.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c501ab8482ceb8674f58256e0f616191170cf3c3a23cd8e70ed3c28d4ff5096b +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.38E2D27FF7046D8A00290708435B3AC5.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.38E2D27FF7046D8A00290708435B3AC5.cso new file mode 100644 index 00000000..89c5bb07 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.38E2D27FF7046D8A00290708435B3AC5.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.38E2D27FF7046D8A00290708435B3AC5.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.38E2D27FF7046D8A00290708435B3AC5.cso.pdb new file mode 100644 index 00000000..80e92f65 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.38E2D27FF7046D8A00290708435B3AC5.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:659a2bfe78b503c238ced41192a55213ae61b97d3ac3fdc252ae2113bca51c9b +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.40452A858BDF0DD351CAAC7CAD4D75AC.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.40452A858BDF0DD351CAAC7CAD4D75AC.cso new file mode 100644 index 00000000..fc5bd9a9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.40452A858BDF0DD351CAAC7CAD4D75AC.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.40452A858BDF0DD351CAAC7CAD4D75AC.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.40452A858BDF0DD351CAAC7CAD4D75AC.cso.pdb new file mode 100644 index 00000000..3d330d39 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.40452A858BDF0DD351CAAC7CAD4D75AC.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77a025bc5ae704a7856aa5620c6cb585d224ad337f9da94238da6710d5b0d8e5 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.455299EAF18CA9285CFB885E58CDC6D0.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.455299EAF18CA9285CFB885E58CDC6D0.cso new file mode 100644 index 00000000..0e5efc3e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.455299EAF18CA9285CFB885E58CDC6D0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.455299EAF18CA9285CFB885E58CDC6D0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.455299EAF18CA9285CFB885E58CDC6D0.cso.pdb new file mode 100644 index 00000000..413cda2b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.455299EAF18CA9285CFB885E58CDC6D0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ad09153831c20b6dbcf6d977162951b52f8b36202cdbfa2dd5780f25f31f685 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.494F248863E815B635F86B4C4A2B9878.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.494F248863E815B635F86B4C4A2B9878.cso new file mode 100644 index 00000000..f20244ec Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.494F248863E815B635F86B4C4A2B9878.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.494F248863E815B635F86B4C4A2B9878.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.494F248863E815B635F86B4C4A2B9878.cso.pdb new file mode 100644 index 00000000..b6b342ce --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.494F248863E815B635F86B4C4A2B9878.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9afbf74f7b6448fd68c5b6fe5fd2c9ddc5cc3b46b5d4ec8a248d31418bd81fbf +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.4A6E9FDAA1CE421286BA2A3A30A6658A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.4A6E9FDAA1CE421286BA2A3A30A6658A.cso new file mode 100644 index 00000000..e9420125 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.4A6E9FDAA1CE421286BA2A3A30A6658A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.4A6E9FDAA1CE421286BA2A3A30A6658A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.4A6E9FDAA1CE421286BA2A3A30A6658A.cso.pdb new file mode 100644 index 00000000..dccafe46 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.4A6E9FDAA1CE421286BA2A3A30A6658A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1ff29324879af0e0c147c279af0de844dd6f69d89f27992ffdedc55cd9c248f +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.566A5829015B608CF29A39550DEF77DC.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.566A5829015B608CF29A39550DEF77DC.cso new file mode 100644 index 00000000..58fba7af Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.566A5829015B608CF29A39550DEF77DC.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.566A5829015B608CF29A39550DEF77DC.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.566A5829015B608CF29A39550DEF77DC.cso.pdb new file mode 100644 index 00000000..85c6ae1e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.566A5829015B608CF29A39550DEF77DC.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70a373b6c2be64e7f5c1b79025863029f9fe2ba6a2027a97e9cb2c494173c4eb +size 42496 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5E305102DF74F937A763A780239EC2AB.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5E305102DF74F937A763A780239EC2AB.cso new file mode 100644 index 00000000..ba17e45d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5E305102DF74F937A763A780239EC2AB.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5E305102DF74F937A763A780239EC2AB.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5E305102DF74F937A763A780239EC2AB.cso.pdb new file mode 100644 index 00000000..6a370466 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5E305102DF74F937A763A780239EC2AB.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2750140be0635c77aec77a605eaeca48306d6c4974c37e74e022f7ad5006bd84 +size 42496 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5F5DF159396A6B8FE4C4A0F97D78924B.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5F5DF159396A6B8FE4C4A0F97D78924B.cso new file mode 100644 index 00000000..a142a19c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5F5DF159396A6B8FE4C4A0F97D78924B.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5F5DF159396A6B8FE4C4A0F97D78924B.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5F5DF159396A6B8FE4C4A0F97D78924B.cso.pdb new file mode 100644 index 00000000..f613bb8e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.5F5DF159396A6B8FE4C4A0F97D78924B.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:546aff8e2b310c23a418f545f438025618a280254fe37cea7e622173ac647217 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7B8359347B0DEF37AA39A05B62E5CBC1.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7B8359347B0DEF37AA39A05B62E5CBC1.cso new file mode 100644 index 00000000..7ef23763 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7B8359347B0DEF37AA39A05B62E5CBC1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7B8359347B0DEF37AA39A05B62E5CBC1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7B8359347B0DEF37AA39A05B62E5CBC1.cso.pdb new file mode 100644 index 00000000..7e25a2a3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7B8359347B0DEF37AA39A05B62E5CBC1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffcc0921ac4896e1459de6596d55ea2660080937deb20ec7ca7f4e60ec70ab5f +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7EEA6AF74A7E1398CE4B70E260147AF0.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7EEA6AF74A7E1398CE4B70E260147AF0.cso new file mode 100644 index 00000000..1ad9918f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7EEA6AF74A7E1398CE4B70E260147AF0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7EEA6AF74A7E1398CE4B70E260147AF0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7EEA6AF74A7E1398CE4B70E260147AF0.cso.pdb new file mode 100644 index 00000000..a76ba645 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7EEA6AF74A7E1398CE4B70E260147AF0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59f77f5559f38f4d5cf7794b5a632115f9f6338802bd0189d68d9dda51d4f100 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7F33C027EBB191F2059BE1A8839D31F5.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7F33C027EBB191F2059BE1A8839D31F5.cso new file mode 100644 index 00000000..ca314563 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7F33C027EBB191F2059BE1A8839D31F5.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7F33C027EBB191F2059BE1A8839D31F5.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7F33C027EBB191F2059BE1A8839D31F5.cso.pdb new file mode 100644 index 00000000..f4b9d705 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.7F33C027EBB191F2059BE1A8839D31F5.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f87e8c5f336d025b69733b6d41ccf00680e7a618ac5ac8e80506aa2d14114479 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.893C3B31AEB4B56E07A0C0112A35B626.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.893C3B31AEB4B56E07A0C0112A35B626.cso new file mode 100644 index 00000000..349ca727 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.893C3B31AEB4B56E07A0C0112A35B626.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.893C3B31AEB4B56E07A0C0112A35B626.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.893C3B31AEB4B56E07A0C0112A35B626.cso.pdb new file mode 100644 index 00000000..29c397a6 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.893C3B31AEB4B56E07A0C0112A35B626.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca3cec2ff6311ab3d00808c58d67ad75f4207fb6bf970dc3d51556a5f3c60247 +size 42496 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.8DDF66C3535F05343B6E0711A2F5EDE9.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.8DDF66C3535F05343B6E0711A2F5EDE9.cso new file mode 100644 index 00000000..813470d2 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.8DDF66C3535F05343B6E0711A2F5EDE9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.8DDF66C3535F05343B6E0711A2F5EDE9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.8DDF66C3535F05343B6E0711A2F5EDE9.cso.pdb new file mode 100644 index 00000000..4f466b22 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.8DDF66C3535F05343B6E0711A2F5EDE9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07288cea6a0c827df1204975332ae9c1e36163861576f0d80ba008eaf8fb94c3 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9EBF63F0CECB121FB08C73258F424154.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9EBF63F0CECB121FB08C73258F424154.cso new file mode 100644 index 00000000..8f0564ad Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9EBF63F0CECB121FB08C73258F424154.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9EBF63F0CECB121FB08C73258F424154.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9EBF63F0CECB121FB08C73258F424154.cso.pdb new file mode 100644 index 00000000..9525fc74 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9EBF63F0CECB121FB08C73258F424154.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcb5475c2a31a887b04a551600f0f21e44b7d4069a5464bb279373cb8fe21997 +size 42496 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9F151426D3A5187075EB122B45099E95.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9F151426D3A5187075EB122B45099E95.cso new file mode 100644 index 00000000..90a5ff6a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9F151426D3A5187075EB122B45099E95.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9F151426D3A5187075EB122B45099E95.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9F151426D3A5187075EB122B45099E95.cso.pdb new file mode 100644 index 00000000..e47a1b30 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.9F151426D3A5187075EB122B45099E95.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb55d301486edae1cc6a0231c5866d5e405deb0d94a54ae385b21d03d6add179 +size 42496 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.C1D8B1B3F659E4754B02859930024C34.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.C1D8B1B3F659E4754B02859930024C34.cso new file mode 100644 index 00000000..ae1b9daa Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.C1D8B1B3F659E4754B02859930024C34.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.C1D8B1B3F659E4754B02859930024C34.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.C1D8B1B3F659E4754B02859930024C34.cso.pdb new file mode 100644 index 00000000..5bf19a77 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.C1D8B1B3F659E4754B02859930024C34.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d45e8d8781732872132d4e69497e30873c1253041fe22a84226b51ea7734594 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.CD3CD6C95FE00B70F3CB44712C4E6F6F.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.CD3CD6C95FE00B70F3CB44712C4E6F6F.cso new file mode 100644 index 00000000..3f272522 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.CD3CD6C95FE00B70F3CB44712C4E6F6F.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.CD3CD6C95FE00B70F3CB44712C4E6F6F.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.CD3CD6C95FE00B70F3CB44712C4E6F6F.cso.pdb new file mode 100644 index 00000000..738281ec --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.CD3CD6C95FE00B70F3CB44712C4E6F6F.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd4f6dd9017b0f99d615679fae7e10363107a380a71821551e838c7e464a005f +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.DBAB50AF656C0B77BE3EACFA872A4107.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.DBAB50AF656C0B77BE3EACFA872A4107.cso new file mode 100644 index 00000000..f05b45c9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.DBAB50AF656C0B77BE3EACFA872A4107.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.DBAB50AF656C0B77BE3EACFA872A4107.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.DBAB50AF656C0B77BE3EACFA872A4107.cso.pdb new file mode 100644 index 00000000..43943094 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.DBAB50AF656C0B77BE3EACFA872A4107.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2e089b6c75980dda503674dbb6237a7341eb235d1faae8d94681bf9e3149610 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.E46C7BF11C16009DAD26F2E52BCA71ED.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.E46C7BF11C16009DAD26F2E52BCA71ED.cso new file mode 100644 index 00000000..bbc6c5a7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.E46C7BF11C16009DAD26F2E52BCA71ED.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.E46C7BF11C16009DAD26F2E52BCA71ED.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.E46C7BF11C16009DAD26F2E52BCA71ED.cso.pdb new file mode 100644 index 00000000..81c0691e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.E46C7BF11C16009DAD26F2E52BCA71ED.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0b03ccb55d005465f7b2e32adbfe99732ad53870c6a028368d0ae8a03e99ceb +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.EDC05431FEB536B2137D9C70A18E0E85.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.EDC05431FEB536B2137D9C70A18E0E85.cso new file mode 100644 index 00000000..a3e83898 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.EDC05431FEB536B2137D9C70A18E0E85.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.EDC05431FEB536B2137D9C70A18E0E85.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.EDC05431FEB536B2137D9C70A18E0E85.cso.pdb new file mode 100644 index 00000000..1abd4e5f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.EDC05431FEB536B2137D9C70A18E0E85.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd8b9f166153a92ded2ad5afc870ae42290beecca49e57c2c9465039d89b9914 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.F43E932D41866B4751D2AAAA122C0DF8.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.F43E932D41866B4751D2AAAA122C0DF8.cso new file mode 100644 index 00000000..2b12f3cd Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.F43E932D41866B4751D2AAAA122C0DF8.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.F43E932D41866B4751D2AAAA122C0DF8.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.F43E932D41866B4751D2AAAA122C0DF8.cso.pdb new file mode 100644 index 00000000..946e7112 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.F43E932D41866B4751D2AAAA122C0DF8.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ba5fd9ac48410391549ace185a56ebd827d5efa7d30fcdead72abcf135f7ce1 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.FD048825BBE1F9EEFF9AF105929E49F9.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.FD048825BBE1F9EEFF9AF105929E49F9.cso new file mode 100644 index 00000000..4f77dc07 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.FD048825BBE1F9EEFF9AF105929E49F9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.FD048825BBE1F9EEFF9AF105929E49F9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.FD048825BBE1F9EEFF9AF105929E49F9.cso.pdb new file mode 100644 index 00000000..32e3d29e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom.geom.FD048825BBE1F9EEFF9AF105929E49F9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:812b3fea4339f23f040b5c1ee63a68427ccf15208747313c211d06ac6d5002ef +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.0491B9E5DB4146F6039DB5A1028E068F.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.0491B9E5DB4146F6039DB5A1028E068F.cso new file mode 100644 index 00000000..62aced56 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.0491B9E5DB4146F6039DB5A1028E068F.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.0491B9E5DB4146F6039DB5A1028E068F.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.0491B9E5DB4146F6039DB5A1028E068F.cso.pdb new file mode 100644 index 00000000..0e8cd03c --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.0491B9E5DB4146F6039DB5A1028E068F.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55ba160231ab66e2d1acf4bbabf5c511be3d416116e8de508749105bddd6eec8 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.089C1A93F75623C5625465ADC48162D9.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.089C1A93F75623C5625465ADC48162D9.cso new file mode 100644 index 00000000..6639cd40 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.089C1A93F75623C5625465ADC48162D9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.089C1A93F75623C5625465ADC48162D9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.089C1A93F75623C5625465ADC48162D9.cso.pdb new file mode 100644 index 00000000..e5352988 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.089C1A93F75623C5625465ADC48162D9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bca8facc1ddf56f55eae65c0ae87a8af3f777769353b1c9b90074cbcacfd42e1 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2CBCDD973DD8785D8ED96E438B732020.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2CBCDD973DD8785D8ED96E438B732020.cso new file mode 100644 index 00000000..7ac674c8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2CBCDD973DD8785D8ED96E438B732020.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2CBCDD973DD8785D8ED96E438B732020.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2CBCDD973DD8785D8ED96E438B732020.cso.pdb new file mode 100644 index 00000000..4373588f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2CBCDD973DD8785D8ED96E438B732020.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6458a1a14910ada25ca816062f571a90b7ba56c2ff356bbd2b321e014662e506 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2EBB1E214294B7250FB31039A38D6AC5.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2EBB1E214294B7250FB31039A38D6AC5.cso new file mode 100644 index 00000000..6cc2e58c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2EBB1E214294B7250FB31039A38D6AC5.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2EBB1E214294B7250FB31039A38D6AC5.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2EBB1E214294B7250FB31039A38D6AC5.cso.pdb new file mode 100644 index 00000000..abccaa50 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.2EBB1E214294B7250FB31039A38D6AC5.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd2a52a94db93c6e466426885e84a1bdc64c91bc919a961a6b0a2a3400096ec4 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.38E30D094B028C691653A728362634B2.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.38E30D094B028C691653A728362634B2.cso new file mode 100644 index 00000000..ea98af95 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.38E30D094B028C691653A728362634B2.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.38E30D094B028C691653A728362634B2.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.38E30D094B028C691653A728362634B2.cso.pdb new file mode 100644 index 00000000..84b4ff47 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.38E30D094B028C691653A728362634B2.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc31cfa461da8069a4d0bd99029549cb66eb3cc71325af5936fa30d95d07f1e6 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.45152D6B551F36103EA55B435AD0C462.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.45152D6B551F36103EA55B435AD0C462.cso new file mode 100644 index 00000000..046b1d3f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.45152D6B551F36103EA55B435AD0C462.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.45152D6B551F36103EA55B435AD0C462.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.45152D6B551F36103EA55B435AD0C462.cso.pdb new file mode 100644 index 00000000..f9e204a7 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.45152D6B551F36103EA55B435AD0C462.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4bca360de2fb32922245078f5eac17d74c188b0c7141a61cdf0c27bbbfe8522 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.57701C60E841F468867561F9335BDAB3.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.57701C60E841F468867561F9335BDAB3.cso new file mode 100644 index 00000000..9671c962 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.57701C60E841F468867561F9335BDAB3.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.57701C60E841F468867561F9335BDAB3.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.57701C60E841F468867561F9335BDAB3.cso.pdb new file mode 100644 index 00000000..6de36fd3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.57701C60E841F468867561F9335BDAB3.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09f681536ee81dbd8055106af19a60eae7bf4340017eb5351fd56c46716324b5 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.630652A3268DE6E9BDE38BC918841E62.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.630652A3268DE6E9BDE38BC918841E62.cso new file mode 100644 index 00000000..afd7ff0b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.630652A3268DE6E9BDE38BC918841E62.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.630652A3268DE6E9BDE38BC918841E62.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.630652A3268DE6E9BDE38BC918841E62.cso.pdb new file mode 100644 index 00000000..9ca25cb0 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.630652A3268DE6E9BDE38BC918841E62.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c40a4083e3ebd567d2565ead4eee2067b5a3aaa67ffe5fafdcfad35497bae1c +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.77B31999700322078CF970FEB7407F9C.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.77B31999700322078CF970FEB7407F9C.cso new file mode 100644 index 00000000..8defe52a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.77B31999700322078CF970FEB7407F9C.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.77B31999700322078CF970FEB7407F9C.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.77B31999700322078CF970FEB7407F9C.cso.pdb new file mode 100644 index 00000000..8fe188bb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.77B31999700322078CF970FEB7407F9C.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26a3f743ee2782fd1cd6d54db5428d023b27d6a11c29fdee656472570c18a48f +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.7D65653E05F3CFD999E0CFE63FA6E06D.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.7D65653E05F3CFD999E0CFE63FA6E06D.cso new file mode 100644 index 00000000..b0e8a188 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.7D65653E05F3CFD999E0CFE63FA6E06D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.7D65653E05F3CFD999E0CFE63FA6E06D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.7D65653E05F3CFD999E0CFE63FA6E06D.cso.pdb new file mode 100644 index 00000000..ff89ae16 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.7D65653E05F3CFD999E0CFE63FA6E06D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f44318954e1855bb8fdeb613acfdef0d8b92ad61bac2ee05a52641a808effba4 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AA7A6E402DA45EA1877F3864059BB328.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AA7A6E402DA45EA1877F3864059BB328.cso new file mode 100644 index 00000000..9efe3df2 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AA7A6E402DA45EA1877F3864059BB328.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AA7A6E402DA45EA1877F3864059BB328.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AA7A6E402DA45EA1877F3864059BB328.cso.pdb new file mode 100644 index 00000000..70a3e3af --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AA7A6E402DA45EA1877F3864059BB328.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e574e74b4fb62fd97e888b276cfe9332d1707b902099d232d246d080e03616ff +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.ABC8329C82EFC7A175A670CD89AFCF15.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.ABC8329C82EFC7A175A670CD89AFCF15.cso new file mode 100644 index 00000000..f28a15b0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.ABC8329C82EFC7A175A670CD89AFCF15.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.ABC8329C82EFC7A175A670CD89AFCF15.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.ABC8329C82EFC7A175A670CD89AFCF15.cso.pdb new file mode 100644 index 00000000..dd1d9085 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.ABC8329C82EFC7A175A670CD89AFCF15.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a4237e411c7daabfd345b002e133599b3b15e35c2c3e36db2075245ab658b72 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AF299C4F5A88FF41BB134DEBBD221243.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AF299C4F5A88FF41BB134DEBBD221243.cso new file mode 100644 index 00000000..975593e0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AF299C4F5A88FF41BB134DEBBD221243.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AF299C4F5A88FF41BB134DEBBD221243.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AF299C4F5A88FF41BB134DEBBD221243.cso.pdb new file mode 100644 index 00000000..9bad1939 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.AF299C4F5A88FF41BB134DEBBD221243.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:293486c4297b22e4941e9bb84e4a1dfb5d2e3799aa7accf1e45883bab38b82eb +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.B73B1CA9CB013890A989873EBD811678.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.B73B1CA9CB013890A989873EBD811678.cso new file mode 100644 index 00000000..23c1007d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.B73B1CA9CB013890A989873EBD811678.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.B73B1CA9CB013890A989873EBD811678.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.B73B1CA9CB013890A989873EBD811678.cso.pdb new file mode 100644 index 00000000..11fd48b3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.B73B1CA9CB013890A989873EBD811678.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:009a0b6db5f51b0169cad9b451e130aa8a327a52e68c28981627189944c65409 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.BB1894D2E83C03A44A1F4C0ACFAC5941.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.BB1894D2E83C03A44A1F4C0ACFAC5941.cso new file mode 100644 index 00000000..79faa231 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.BB1894D2E83C03A44A1F4C0ACFAC5941.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.BB1894D2E83C03A44A1F4C0ACFAC5941.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.BB1894D2E83C03A44A1F4C0ACFAC5941.cso.pdb new file mode 100644 index 00000000..9f788649 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.BB1894D2E83C03A44A1F4C0ACFAC5941.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b730e11a2ecc4cf19ab879ab3e951ced2c8b91bd7c99ed4bd88f473cb7029c5c +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CF3846F9E7636FD9485E620D0B85EA7A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CF3846F9E7636FD9485E620D0B85EA7A.cso new file mode 100644 index 00000000..693e82c2 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CF3846F9E7636FD9485E620D0B85EA7A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CF3846F9E7636FD9485E620D0B85EA7A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CF3846F9E7636FD9485E620D0B85EA7A.cso.pdb new file mode 100644 index 00000000..1892bb11 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CF3846F9E7636FD9485E620D0B85EA7A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aad36b174c6b090f75142a9dbc27b407006e683b7ae8be4536ae566c13220e50 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CFDCA74BBAE47557D9554F9C6994FFF5.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CFDCA74BBAE47557D9554F9C6994FFF5.cso new file mode 100644 index 00000000..2e25a3c6 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CFDCA74BBAE47557D9554F9C6994FFF5.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CFDCA74BBAE47557D9554F9C6994FFF5.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CFDCA74BBAE47557D9554F9C6994FFF5.cso.pdb new file mode 100644 index 00000000..9061b648 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.CFDCA74BBAE47557D9554F9C6994FFF5.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f3a9d76cb6c954c6a6b2a275976236c6cfe1a2d018f4801aa43cb17145ef6ae +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D1027BFD27F09759DCE21D6C3D0007E6.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D1027BFD27F09759DCE21D6C3D0007E6.cso new file mode 100644 index 00000000..5801f226 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D1027BFD27F09759DCE21D6C3D0007E6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D1027BFD27F09759DCE21D6C3D0007E6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D1027BFD27F09759DCE21D6C3D0007E6.cso.pdb new file mode 100644 index 00000000..499c10ad --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D1027BFD27F09759DCE21D6C3D0007E6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a529d61d853136c0497c4d049d6eefa27ab86335544f6422e9716dfe639be54b +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D11F440AEF887A61EE9AF025D5E23AB9.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D11F440AEF887A61EE9AF025D5E23AB9.cso new file mode 100644 index 00000000..43a90263 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D11F440AEF887A61EE9AF025D5E23AB9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D11F440AEF887A61EE9AF025D5E23AB9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D11F440AEF887A61EE9AF025D5E23AB9.cso.pdb new file mode 100644 index 00000000..9b972dfb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.D11F440AEF887A61EE9AF025D5E23AB9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:377482110927848e0737254c5ea3887c59ed8b127edd152878bba0c3e12965a2 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.DF9214C22288F9B9A48D38F5B74524DE.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.DF9214C22288F9B9A48D38F5B74524DE.cso new file mode 100644 index 00000000..e36982c8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.DF9214C22288F9B9A48D38F5B74524DE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.DF9214C22288F9B9A48D38F5B74524DE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.DF9214C22288F9B9A48D38F5B74524DE.cso.pdb new file mode 100644 index 00000000..0ddc20df --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.DF9214C22288F9B9A48D38F5B74524DE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fb483713263f69836594a0ec5f8b88a148643f3f583eb9fec6783de0a72792b +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E085F93BEC7DF3EBA14A46B44E57CA65.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E085F93BEC7DF3EBA14A46B44E57CA65.cso new file mode 100644 index 00000000..1364ec51 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E085F93BEC7DF3EBA14A46B44E57CA65.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E085F93BEC7DF3EBA14A46B44E57CA65.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E085F93BEC7DF3EBA14A46B44E57CA65.cso.pdb new file mode 100644 index 00000000..db1118a3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E085F93BEC7DF3EBA14A46B44E57CA65.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dce01634b88c5cc384de5bbfe0781be9bceeb98de03efd7c45a421152b1f6557 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E439E2679AC92876BE93DB6F63E71BA4.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E439E2679AC92876BE93DB6F63E71BA4.cso new file mode 100644 index 00000000..c3c887b3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E439E2679AC92876BE93DB6F63E71BA4.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E439E2679AC92876BE93DB6F63E71BA4.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E439E2679AC92876BE93DB6F63E71BA4.cso.pdb new file mode 100644 index 00000000..340377b4 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.E439E2679AC92876BE93DB6F63E71BA4.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e874134df4ce1901b43d2f1f9cd96796db1f28dc3bcd6feb60d8c0548ee8586 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FD3064546B01E2F76BFF1BFDEB54CC81.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FD3064546B01E2F76BFF1BFDEB54CC81.cso new file mode 100644 index 00000000..c0c96578 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FD3064546B01E2F76BFF1BFDEB54CC81.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FD3064546B01E2F76BFF1BFDEB54CC81.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FD3064546B01E2F76BFF1BFDEB54CC81.cso.pdb new file mode 100644 index 00000000..eb84abce --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FD3064546B01E2F76BFF1BFDEB54CC81.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85ed3eeb18d4f6a01ad85fcde13db09f9df1c84c5efbf4df44a406d06b869109 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FF385EE49D348C3D94E3E75DDEC43EF1.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FF385EE49D348C3D94E3E75DDEC43EF1.cso new file mode 100644 index 00000000..a332bc56 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FF385EE49D348C3D94E3E75DDEC43EF1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FF385EE49D348C3D94E3E75DDEC43EF1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FF385EE49D348C3D94E3E75DDEC43EF1.cso.pdb new file mode 100644 index 00000000..fc8ece0e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_CPU.vert.FF385EE49D348C3D94E3E75DDEC43EF1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94e8803223374966d0a38883d3ffefb61fcc3350a55d7ff3010676be7ba78045 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.03A9039DF625A5CE430A52161825FB2E.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.03A9039DF625A5CE430A52161825FB2E.cso new file mode 100644 index 00000000..08b2525e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.03A9039DF625A5CE430A52161825FB2E.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.03A9039DF625A5CE430A52161825FB2E.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.03A9039DF625A5CE430A52161825FB2E.cso.pdb new file mode 100644 index 00000000..064fe288 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.03A9039DF625A5CE430A52161825FB2E.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd90dac786cd8c73435512d7c36c913697c7693d7a5d0b86ba3c75a652824070 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.125702F176A5DC7DE52D9A2D09ACB336.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.125702F176A5DC7DE52D9A2D09ACB336.cso new file mode 100644 index 00000000..559d519f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.125702F176A5DC7DE52D9A2D09ACB336.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.125702F176A5DC7DE52D9A2D09ACB336.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.125702F176A5DC7DE52D9A2D09ACB336.cso.pdb new file mode 100644 index 00000000..d7a542f4 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.125702F176A5DC7DE52D9A2D09ACB336.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15b53022692dfcf8286b4d4658c840bd9de6b2e4dbb43f97c7c37ce3ca2b3906 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1ADEC6D7AA8D6B5FA2623A3803561740.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1ADEC6D7AA8D6B5FA2623A3803561740.cso new file mode 100644 index 00000000..34229a14 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1ADEC6D7AA8D6B5FA2623A3803561740.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1ADEC6D7AA8D6B5FA2623A3803561740.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1ADEC6D7AA8D6B5FA2623A3803561740.cso.pdb new file mode 100644 index 00000000..d533b494 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1ADEC6D7AA8D6B5FA2623A3803561740.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a8a921c14feccbd9074cfc32fcf47fbb16264c76ccee0a4cce32fb223c86ab8 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1B4EF1D1BFD046CEA6303A75D5A090DD.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1B4EF1D1BFD046CEA6303A75D5A090DD.cso new file mode 100644 index 00000000..5c576bc3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1B4EF1D1BFD046CEA6303A75D5A090DD.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1B4EF1D1BFD046CEA6303A75D5A090DD.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1B4EF1D1BFD046CEA6303A75D5A090DD.cso.pdb new file mode 100644 index 00000000..1fea6842 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.1B4EF1D1BFD046CEA6303A75D5A090DD.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8e1488b23ab97ad6299f3cd49d992a64e5a8f0b513bf619b16bf5e3f0e1c3fa +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.215E7FA2E1D915E575BF0D051FF57DAC.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.215E7FA2E1D915E575BF0D051FF57DAC.cso new file mode 100644 index 00000000..3223381e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.215E7FA2E1D915E575BF0D051FF57DAC.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.215E7FA2E1D915E575BF0D051FF57DAC.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.215E7FA2E1D915E575BF0D051FF57DAC.cso.pdb new file mode 100644 index 00000000..9e47680b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.215E7FA2E1D915E575BF0D051FF57DAC.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:831a97879ad39ae1adbac136cd22e1cea6373a8a56055f5d26e033a6a7ec2455 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.2CF9EB30E57EC06C260F1C994273BBB9.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.2CF9EB30E57EC06C260F1C994273BBB9.cso new file mode 100644 index 00000000..868d4bc0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.2CF9EB30E57EC06C260F1C994273BBB9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.2CF9EB30E57EC06C260F1C994273BBB9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.2CF9EB30E57EC06C260F1C994273BBB9.cso.pdb new file mode 100644 index 00000000..4bbe34a4 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.2CF9EB30E57EC06C260F1C994273BBB9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c345b81f77ea7c38d5069798750cd0c8daee2ef1015049bf522f4e7db3227723 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3830050E054524D9FB4B97B3C5795D74.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3830050E054524D9FB4B97B3C5795D74.cso new file mode 100644 index 00000000..fba531c3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3830050E054524D9FB4B97B3C5795D74.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3830050E054524D9FB4B97B3C5795D74.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3830050E054524D9FB4B97B3C5795D74.cso.pdb new file mode 100644 index 00000000..61f332c5 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3830050E054524D9FB4B97B3C5795D74.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ea36a6f6c9a787bec6e541b46f504e1998a84c6e18a8aa85eca00c07f838547 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3FC5681EEA9466868BDE6277412A1602.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3FC5681EEA9466868BDE6277412A1602.cso new file mode 100644 index 00000000..e22de834 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3FC5681EEA9466868BDE6277412A1602.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3FC5681EEA9466868BDE6277412A1602.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3FC5681EEA9466868BDE6277412A1602.cso.pdb new file mode 100644 index 00000000..23c8d38e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.3FC5681EEA9466868BDE6277412A1602.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a656f6fbdb11169ad174782f86e1be1e67af770503be3c179c65b25f1ef58b23 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.54CE329F05A57498A425EEE7FFB92A53.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.54CE329F05A57498A425EEE7FFB92A53.cso new file mode 100644 index 00000000..26ad5f73 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.54CE329F05A57498A425EEE7FFB92A53.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.54CE329F05A57498A425EEE7FFB92A53.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.54CE329F05A57498A425EEE7FFB92A53.cso.pdb new file mode 100644 index 00000000..1c3a9401 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.54CE329F05A57498A425EEE7FFB92A53.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c312a5e87c074b4bd1734ce1cea5e184387a97062041d4a5b9bd95d90f7ab93f +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.63E4E8675470AA49793AE6B8F2EFB412.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.63E4E8675470AA49793AE6B8F2EFB412.cso new file mode 100644 index 00000000..4dd60920 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.63E4E8675470AA49793AE6B8F2EFB412.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.63E4E8675470AA49793AE6B8F2EFB412.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.63E4E8675470AA49793AE6B8F2EFB412.cso.pdb new file mode 100644 index 00000000..5e213120 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.63E4E8675470AA49793AE6B8F2EFB412.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea822c5bd97d40f3f559c75cab3113fbc35d332b43dd80f6282972134f2135df +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.6EDA9FA1D0CE763321BA160FE1F69436.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.6EDA9FA1D0CE763321BA160FE1F69436.cso new file mode 100644 index 00000000..b47697b8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.6EDA9FA1D0CE763321BA160FE1F69436.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.6EDA9FA1D0CE763321BA160FE1F69436.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.6EDA9FA1D0CE763321BA160FE1F69436.cso.pdb new file mode 100644 index 00000000..ea1cb126 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.6EDA9FA1D0CE763321BA160FE1F69436.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:181b53c7f318458ed0ac83b5d7344a928511a01d7edc9bf50edfdfea217fcaff +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.7B6CA6E5E319B7DCD804E51483B1560B.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.7B6CA6E5E319B7DCD804E51483B1560B.cso new file mode 100644 index 00000000..9b9f27c8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.7B6CA6E5E319B7DCD804E51483B1560B.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.7B6CA6E5E319B7DCD804E51483B1560B.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.7B6CA6E5E319B7DCD804E51483B1560B.cso.pdb new file mode 100644 index 00000000..c4103275 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.7B6CA6E5E319B7DCD804E51483B1560B.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0debf4624002c5d3d4b27dfa29e2ae96c1910c676204bde3a0a36222ec21c24d +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.8041C676881D61780106102C13F8133C.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.8041C676881D61780106102C13F8133C.cso new file mode 100644 index 00000000..db0bb70e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.8041C676881D61780106102C13F8133C.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.8041C676881D61780106102C13F8133C.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.8041C676881D61780106102C13F8133C.cso.pdb new file mode 100644 index 00000000..020cbbb7 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.8041C676881D61780106102C13F8133C.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d733ab7544641694bf63f15bc19c4254c8b56d23b69e7dfcd514929d5cff484 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.96BCBFB5543D4357E250741BD758D684.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.96BCBFB5543D4357E250741BD758D684.cso new file mode 100644 index 00000000..705bc67c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.96BCBFB5543D4357E250741BD758D684.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.96BCBFB5543D4357E250741BD758D684.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.96BCBFB5543D4357E250741BD758D684.cso.pdb new file mode 100644 index 00000000..ce7bf47f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.96BCBFB5543D4357E250741BD758D684.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:787fb22d12293ad6998bc012bf1c5550b42fb0411eeab5fae165c24340e44b44 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.AAE2DCCA9E4429BEDF7F5C12A4918FBE.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.AAE2DCCA9E4429BEDF7F5C12A4918FBE.cso new file mode 100644 index 00000000..34e9be7e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.AAE2DCCA9E4429BEDF7F5C12A4918FBE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.AAE2DCCA9E4429BEDF7F5C12A4918FBE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.AAE2DCCA9E4429BEDF7F5C12A4918FBE.cso.pdb new file mode 100644 index 00000000..a6745743 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.AAE2DCCA9E4429BEDF7F5C12A4918FBE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:668eedd96b68ea81b21f7423e6b47e0b8fb6be2d9b9cc337e76be32894d4c498 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B7B90948D23B69401E4275BBBA5F6021.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B7B90948D23B69401E4275BBBA5F6021.cso new file mode 100644 index 00000000..52fc085c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B7B90948D23B69401E4275BBBA5F6021.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B7B90948D23B69401E4275BBBA5F6021.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B7B90948D23B69401E4275BBBA5F6021.cso.pdb new file mode 100644 index 00000000..711ef79d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B7B90948D23B69401E4275BBBA5F6021.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6dd54e4aec10043e8c814089635fc725dcbee403c5fb18cc5a7368d774603eda +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B959A091D6A562E3BB2A4A86D8938E3B.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B959A091D6A562E3BB2A4A86D8938E3B.cso new file mode 100644 index 00000000..71075093 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B959A091D6A562E3BB2A4A86D8938E3B.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B959A091D6A562E3BB2A4A86D8938E3B.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B959A091D6A562E3BB2A4A86D8938E3B.cso.pdb new file mode 100644 index 00000000..14f23cd9 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.B959A091D6A562E3BB2A4A86D8938E3B.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae97bb585e818cf1a72d693e2d9b9a0abda193ca2d765863ad3b3a2d057309fd +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C631C6F1C848D8407BB4550427BFAFE5.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C631C6F1C848D8407BB4550427BFAFE5.cso new file mode 100644 index 00000000..aa86914d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C631C6F1C848D8407BB4550427BFAFE5.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C631C6F1C848D8407BB4550427BFAFE5.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C631C6F1C848D8407BB4550427BFAFE5.cso.pdb new file mode 100644 index 00000000..21ac8fd1 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C631C6F1C848D8407BB4550427BFAFE5.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e2f8dd1f3aa1c55d7831b149eb87bbe1b69c764077e013be11ddae65ce089c0 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C7D9E2F6ACF45D7DCA8F8EB92111BCBC.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C7D9E2F6ACF45D7DCA8F8EB92111BCBC.cso new file mode 100644 index 00000000..663f25cb Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C7D9E2F6ACF45D7DCA8F8EB92111BCBC.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C7D9E2F6ACF45D7DCA8F8EB92111BCBC.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C7D9E2F6ACF45D7DCA8F8EB92111BCBC.cso.pdb new file mode 100644 index 00000000..f6ef8eeb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.C7D9E2F6ACF45D7DCA8F8EB92111BCBC.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5702ff080d40558c9f8be2a8bcefe73198cf628a0bf18e4ab9f80d9e1870d0d6 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.E757CD08237F5B4A4C260EE943E6A7BC.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.E757CD08237F5B4A4C260EE943E6A7BC.cso new file mode 100644 index 00000000..d0aed03b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.E757CD08237F5B4A4C260EE943E6A7BC.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.E757CD08237F5B4A4C260EE943E6A7BC.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.E757CD08237F5B4A4C260EE943E6A7BC.cso.pdb new file mode 100644 index 00000000..3ec2c38b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.E757CD08237F5B4A4C260EE943E6A7BC.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9c8777a0d27c0784106c8041c2dbb98c26dc35c005f79332071001f19198392 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F0F89BC5650EEE995AA9D7357378D280.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F0F89BC5650EEE995AA9D7357378D280.cso new file mode 100644 index 00000000..1430ebfb Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F0F89BC5650EEE995AA9D7357378D280.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F0F89BC5650EEE995AA9D7357378D280.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F0F89BC5650EEE995AA9D7357378D280.cso.pdb new file mode 100644 index 00000000..52f89e77 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F0F89BC5650EEE995AA9D7357378D280.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e9748c8d8d884785aefdf5f2b8b8a74128b542f363d9b70ea78b4f544b0b9ce +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F2AC0D1822C5C821BF888C0AB7491E5E.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F2AC0D1822C5C821BF888C0AB7491E5E.cso new file mode 100644 index 00000000..4fee59de Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F2AC0D1822C5C821BF888C0AB7491E5E.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F2AC0D1822C5C821BF888C0AB7491E5E.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F2AC0D1822C5C821BF888C0AB7491E5E.cso.pdb new file mode 100644 index 00000000..b18a15b7 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.F2AC0D1822C5C821BF888C0AB7491E5E.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:405a6100c3cec55ebe55cf7d4671d6a737d18a114b3604589d08c3fff15b4c6f +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FA071B919FA56A0FB70F4ED2F802D474.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FA071B919FA56A0FB70F4ED2F802D474.cso new file mode 100644 index 00000000..5720f097 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FA071B919FA56A0FB70F4ED2F802D474.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FA071B919FA56A0FB70F4ED2F802D474.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FA071B919FA56A0FB70F4ED2F802D474.cso.pdb new file mode 100644 index 00000000..0ce197aa --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FA071B919FA56A0FB70F4ED2F802D474.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:320be02b575d78457ca9fa6fac549877acc2005ea73168cd95d7245976c69fc7 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FEE5E6A661D8F4453A0120A78702157A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FEE5E6A661D8F4453A0120A78702157A.cso new file mode 100644 index 00000000..2564eec2 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FEE5E6A661D8F4453A0120A78702157A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FEE5E6A661D8F4453A0120A78702157A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FEE5E6A661D8F4453A0120A78702157A.cso.pdb new file mode 100644 index 00000000..530953b7 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleGeom_GPU.vert.FEE5E6A661D8F4453A0120A78702157A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96aabfe26c95831032be39e428739ad994a2842aee2b9dc12d88e4aaac04d1a8 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0323DA1D4D66DFFC422FD195212F40AC.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0323DA1D4D66DFFC422FD195212F40AC.cso new file mode 100644 index 00000000..ee489fd3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0323DA1D4D66DFFC422FD195212F40AC.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0323DA1D4D66DFFC422FD195212F40AC.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0323DA1D4D66DFFC422FD195212F40AC.cso.pdb new file mode 100644 index 00000000..ce16f537 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0323DA1D4D66DFFC422FD195212F40AC.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20ed6c909ca2e832c670e78f98cf5856cee36237177df100b7b3186f1be83cb7 +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.08792B0244607751B94495BF11FEA6C3.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.08792B0244607751B94495BF11FEA6C3.metallib new file mode 100644 index 00000000..61a44220 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.08792B0244607751B94495BF11FEA6C3.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0A7FA5C512F5E63FC77778DAD58C1444.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0A7FA5C512F5E63FC77778DAD58C1444.cso new file mode 100644 index 00000000..33d1b3bc Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0A7FA5C512F5E63FC77778DAD58C1444.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0A7FA5C512F5E63FC77778DAD58C1444.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0A7FA5C512F5E63FC77778DAD58C1444.cso.pdb new file mode 100644 index 00000000..0e219888 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0A7FA5C512F5E63FC77778DAD58C1444.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22789563c963258366fde2d3638c641db5152a6ed8fe8fd7ab8c2eb352e522cd +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0BD3C6312B7670505B943262A89C9294.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0BD3C6312B7670505B943262A89C9294.cso new file mode 100644 index 00000000..d33a71b7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0BD3C6312B7670505B943262A89C9294.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0BD3C6312B7670505B943262A89C9294.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0BD3C6312B7670505B943262A89C9294.cso.pdb new file mode 100644 index 00000000..81472c5e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0BD3C6312B7670505B943262A89C9294.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac9db074fc708a92e7aa60ce04485d2d392e69812f7aff5649f2771169bd364e +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0C752CA2B0AA5C4F58A28B4FB4DBC067.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0C752CA2B0AA5C4F58A28B4FB4DBC067.metallib new file mode 100644 index 00000000..ee133bc6 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0C752CA2B0AA5C4F58A28B4FB4DBC067.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0D2906E0F0B901297CEC98725443F6B8.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0D2906E0F0B901297CEC98725443F6B8.cso new file mode 100644 index 00000000..e5f712d0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0D2906E0F0B901297CEC98725443F6B8.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0D2906E0F0B901297CEC98725443F6B8.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0D2906E0F0B901297CEC98725443F6B8.cso.pdb new file mode 100644 index 00000000..87f0b97a --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0D2906E0F0B901297CEC98725443F6B8.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15029721b3e04e5069a88cb99ca1f0d4a1e484e5a5687485b92deee54f84710e +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0DC89CC6EF2BB651C434A448D67109E9.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0DC89CC6EF2BB651C434A448D67109E9.cso new file mode 100644 index 00000000..25d155e8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0DC89CC6EF2BB651C434A448D67109E9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0DC89CC6EF2BB651C434A448D67109E9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0DC89CC6EF2BB651C434A448D67109E9.cso.pdb new file mode 100644 index 00000000..d2343b36 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.0DC89CC6EF2BB651C434A448D67109E9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9016d562824cb0a76fc04d65c1038a5080d77621035bce8fd71e10f790428e90 +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1244F96A9F041AA77E0829FE15A81781.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1244F96A9F041AA77E0829FE15A81781.cso new file mode 100644 index 00000000..99166476 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1244F96A9F041AA77E0829FE15A81781.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1244F96A9F041AA77E0829FE15A81781.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1244F96A9F041AA77E0829FE15A81781.cso.pdb new file mode 100644 index 00000000..04c36734 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1244F96A9F041AA77E0829FE15A81781.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4edc3d6e393f58fcb5c2a5c96c192392a006b755e76baa8d4447d87ce7d970b4 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.15BA3C3CB8B8717F4D80F5FEC204370F.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.15BA3C3CB8B8717F4D80F5FEC204370F.metallib new file mode 100644 index 00000000..f524d000 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.15BA3C3CB8B8717F4D80F5FEC204370F.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.180EA62B9D1202547139A36A2D1C9FCC.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.180EA62B9D1202547139A36A2D1C9FCC.metallib new file mode 100644 index 00000000..234b025d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.180EA62B9D1202547139A36A2D1C9FCC.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1925F8BB8C5C6BD69F02FA2CD1B6D8F0.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1925F8BB8C5C6BD69F02FA2CD1B6D8F0.cso new file mode 100644 index 00000000..149022ea Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1925F8BB8C5C6BD69F02FA2CD1B6D8F0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1925F8BB8C5C6BD69F02FA2CD1B6D8F0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1925F8BB8C5C6BD69F02FA2CD1B6D8F0.cso.pdb new file mode 100644 index 00000000..1aeb406f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1925F8BB8C5C6BD69F02FA2CD1B6D8F0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:970de3a055b23f9c12924fff5f61ff4674bf1a4959f55e7ed94d3b2459539cd6 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.19E6B3D25951E1F2F91F02467D1FB30F.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.19E6B3D25951E1F2F91F02467D1FB30F.cso new file mode 100644 index 00000000..15f5b9e5 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.19E6B3D25951E1F2F91F02467D1FB30F.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.19E6B3D25951E1F2F91F02467D1FB30F.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.19E6B3D25951E1F2F91F02467D1FB30F.cso.pdb new file mode 100644 index 00000000..50018ab6 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.19E6B3D25951E1F2F91F02467D1FB30F.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94db9aef3f2b0ecad6ff47298d7d39fbd2a83b3f8f5452548d20d10c6ef727c0 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A0AF4135571475AB793369A890D45CA.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A0AF4135571475AB793369A890D45CA.metallib new file mode 100644 index 00000000..73e87541 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A0AF4135571475AB793369A890D45CA.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A894823438A140EA9E04BF73CD2EAA5.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A894823438A140EA9E04BF73CD2EAA5.cso new file mode 100644 index 00000000..d311c698 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A894823438A140EA9E04BF73CD2EAA5.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A894823438A140EA9E04BF73CD2EAA5.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A894823438A140EA9E04BF73CD2EAA5.cso.pdb new file mode 100644 index 00000000..9b195d8f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1A894823438A140EA9E04BF73CD2EAA5.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44d346c82c6dd431cc4657583a5ffa7a2dcb2e69760eb6ae5c361e3b72d16a62 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1B961C28B1FDF4C1823DAA29CE009487.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1B961C28B1FDF4C1823DAA29CE009487.cso new file mode 100644 index 00000000..f81d8252 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1B961C28B1FDF4C1823DAA29CE009487.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1B961C28B1FDF4C1823DAA29CE009487.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1B961C28B1FDF4C1823DAA29CE009487.cso.pdb new file mode 100644 index 00000000..34831a0f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1B961C28B1FDF4C1823DAA29CE009487.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9553448b6cc8807a5c0eae4edbe9eb975f855cf726206550d02976d437a95768 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1E6971511258F0A69158B0C15A49CFC7.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1E6971511258F0A69158B0C15A49CFC7.metallib new file mode 100644 index 00000000..4bdf2f56 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.1E6971511258F0A69158B0C15A49CFC7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.21E51D63F6FD0658E746CAE70039F290.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.21E51D63F6FD0658E746CAE70039F290.cso new file mode 100644 index 00000000..c906175b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.21E51D63F6FD0658E746CAE70039F290.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.21E51D63F6FD0658E746CAE70039F290.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.21E51D63F6FD0658E746CAE70039F290.cso.pdb new file mode 100644 index 00000000..4d2afeb5 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.21E51D63F6FD0658E746CAE70039F290.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e37ab4eca2a815a30c7225f1f5e344294ea9c23fb7be8430a20ee762a3680ff1 +size 38400 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.22F4863734AAC59D6C9C66C631B23B6E.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.22F4863734AAC59D6C9C66C631B23B6E.cso new file mode 100644 index 00000000..8108237c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.22F4863734AAC59D6C9C66C631B23B6E.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.22F4863734AAC59D6C9C66C631B23B6E.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.22F4863734AAC59D6C9C66C631B23B6E.cso.pdb new file mode 100644 index 00000000..45743359 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.22F4863734AAC59D6C9C66C631B23B6E.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1b8a820628b8ad5fc2be85c7860110785102529d2eb7d94f874ba739e908112 +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2CD2DBBA33D183ACE6CD7F2A42321467.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2CD2DBBA33D183ACE6CD7F2A42321467.metallib new file mode 100644 index 00000000..cdb1ae8d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2CD2DBBA33D183ACE6CD7F2A42321467.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2E6BE8AF0F44BC5CC7DA119DDBB43E98.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2E6BE8AF0F44BC5CC7DA119DDBB43E98.cso new file mode 100644 index 00000000..89c4c629 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2E6BE8AF0F44BC5CC7DA119DDBB43E98.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2E6BE8AF0F44BC5CC7DA119DDBB43E98.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2E6BE8AF0F44BC5CC7DA119DDBB43E98.cso.pdb new file mode 100644 index 00000000..031ce6fb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2E6BE8AF0F44BC5CC7DA119DDBB43E98.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2423b12b896feb09590b2df94310dbc85caa3beae0fb238fc5fdb65d75cb258f +size 40448 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2F8A55777C2632894CF6DBCA38D259A8.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2F8A55777C2632894CF6DBCA38D259A8.cso new file mode 100644 index 00000000..70924579 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2F8A55777C2632894CF6DBCA38D259A8.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2F8A55777C2632894CF6DBCA38D259A8.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2F8A55777C2632894CF6DBCA38D259A8.cso.pdb new file mode 100644 index 00000000..f238ca3a --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.2F8A55777C2632894CF6DBCA38D259A8.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63f51ad8aaf2db3ac8df1fa89eb1f60d411a20eb134b02d719d3aa7728fe7645 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.31F564DDF64897CE8D0D8575BA11EA13.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.31F564DDF64897CE8D0D8575BA11EA13.metallib new file mode 100644 index 00000000..c159619d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.31F564DDF64897CE8D0D8575BA11EA13.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.323B3616109D749EF6D2A3CF51050BE6.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.323B3616109D749EF6D2A3CF51050BE6.cso new file mode 100644 index 00000000..9403f295 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.323B3616109D749EF6D2A3CF51050BE6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.323B3616109D749EF6D2A3CF51050BE6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.323B3616109D749EF6D2A3CF51050BE6.cso.pdb new file mode 100644 index 00000000..08944ff0 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.323B3616109D749EF6D2A3CF51050BE6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3417a66931dad758d96f44e12c2c24d0a3b6e30de1959e88b2a6a3530e795066 +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3340D8F8BFE958B965936432A77D2811.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3340D8F8BFE958B965936432A77D2811.cso new file mode 100644 index 00000000..77f9334c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3340D8F8BFE958B965936432A77D2811.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3340D8F8BFE958B965936432A77D2811.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3340D8F8BFE958B965936432A77D2811.cso.pdb new file mode 100644 index 00000000..9311bf4b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3340D8F8BFE958B965936432A77D2811.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5c5d66f5bcede98f0695e157990a9334613a04c5e72f3c328ce01b75b56af1e +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.34AC697454E7671946541CA5BDED791A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.34AC697454E7671946541CA5BDED791A.cso new file mode 100644 index 00000000..410a4327 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.34AC697454E7671946541CA5BDED791A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.34AC697454E7671946541CA5BDED791A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.34AC697454E7671946541CA5BDED791A.cso.pdb new file mode 100644 index 00000000..79f40108 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.34AC697454E7671946541CA5BDED791A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0951cb0a26548f13cfba235b6b419f57e83a8cfce053691fbce85167ab8d9d0c +size 38400 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3A79EBFB229E33A9A80C49E5140236DE.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3A79EBFB229E33A9A80C49E5140236DE.cso new file mode 100644 index 00000000..e3ed2c47 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3A79EBFB229E33A9A80C49E5140236DE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3A79EBFB229E33A9A80C49E5140236DE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3A79EBFB229E33A9A80C49E5140236DE.cso.pdb new file mode 100644 index 00000000..2dd3c35d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3A79EBFB229E33A9A80C49E5140236DE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c08825be653f4bff01406af3f7f2bcd020bbe1aa512744a73f654639110d50e +size 38400 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B0D4E708AD83ECD8CB195DDCB463524.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B0D4E708AD83ECD8CB195DDCB463524.cso new file mode 100644 index 00000000..49dfee1e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B0D4E708AD83ECD8CB195DDCB463524.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B0D4E708AD83ECD8CB195DDCB463524.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B0D4E708AD83ECD8CB195DDCB463524.cso.pdb new file mode 100644 index 00000000..66aa815e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B0D4E708AD83ECD8CB195DDCB463524.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:939d27ce992a6c7f9c0c88479fb1c458fded532053348cd6900afbec97eb5382 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B4B9C3BB8420D61B0C14B7C673D4312.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B4B9C3BB8420D61B0C14B7C673D4312.metallib new file mode 100644 index 00000000..2615e883 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.3B4B9C3BB8420D61B0C14B7C673D4312.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.40FE6F3B1F908655080943E7970B5923.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.40FE6F3B1F908655080943E7970B5923.cso new file mode 100644 index 00000000..cc717f8a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.40FE6F3B1F908655080943E7970B5923.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.40FE6F3B1F908655080943E7970B5923.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.40FE6F3B1F908655080943E7970B5923.cso.pdb new file mode 100644 index 00000000..15f196a0 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.40FE6F3B1F908655080943E7970B5923.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2fc10ee67ebcd08463407e421ca26069c32e4744fbb662c7633f5e80bec0d8a +size 38400 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.41CC71331EA3F4DF19C62447C3B4957D.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.41CC71331EA3F4DF19C62447C3B4957D.metallib new file mode 100644 index 00000000..b2ac0957 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.41CC71331EA3F4DF19C62447C3B4957D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.441699570AB850AD3DB81564F52B0908.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.441699570AB850AD3DB81564F52B0908.metallib new file mode 100644 index 00000000..d0596e76 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.441699570AB850AD3DB81564F52B0908.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.476DA901FEFBD9A0A3C70B45C3313D67.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.476DA901FEFBD9A0A3C70B45C3313D67.metallib new file mode 100644 index 00000000..8acae239 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.476DA901FEFBD9A0A3C70B45C3313D67.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.495C0A9F8FB4194D8EF08AE9C350B23E.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.495C0A9F8FB4194D8EF08AE9C350B23E.metallib new file mode 100644 index 00000000..c2d66431 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.495C0A9F8FB4194D8EF08AE9C350B23E.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.4B8021430CC3C9971C8BC859E0C8989D.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.4B8021430CC3C9971C8BC859E0C8989D.cso new file mode 100644 index 00000000..7c334256 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.4B8021430CC3C9971C8BC859E0C8989D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.4B8021430CC3C9971C8BC859E0C8989D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.4B8021430CC3C9971C8BC859E0C8989D.cso.pdb new file mode 100644 index 00000000..91793722 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.4B8021430CC3C9971C8BC859E0C8989D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:011df0f75409d90a14d7d0501264b8653b59bca54c4305718cdecb686325d12e +size 38400 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.50D311BEF26C71B333D271C49B078772.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.50D311BEF26C71B333D271C49B078772.metallib new file mode 100644 index 00000000..43bfc22f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.50D311BEF26C71B333D271C49B078772.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.5166BF50736369CD4E22FFBFC064DE76.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.5166BF50736369CD4E22FFBFC064DE76.metallib new file mode 100644 index 00000000..fdfed4ff Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.5166BF50736369CD4E22FFBFC064DE76.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.56DD6FF54063679C76D12691EA79ED95.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.56DD6FF54063679C76D12691EA79ED95.cso new file mode 100644 index 00000000..ab949d5d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.56DD6FF54063679C76D12691EA79ED95.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.56DD6FF54063679C76D12691EA79ED95.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.56DD6FF54063679C76D12691EA79ED95.cso.pdb new file mode 100644 index 00000000..b7e4976f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.56DD6FF54063679C76D12691EA79ED95.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a6879cc53caf1f8381671ffe4740f58d4a3fc30f3ca554d578f59fe411e60db +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6421B04960935975A09996C65CF0A478.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6421B04960935975A09996C65CF0A478.cso new file mode 100644 index 00000000..b7b542ed Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6421B04960935975A09996C65CF0A478.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6421B04960935975A09996C65CF0A478.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6421B04960935975A09996C65CF0A478.cso.pdb new file mode 100644 index 00000000..f84dc814 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6421B04960935975A09996C65CF0A478.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fb5109e92b6802ef8a2954e24d2fa71576d768e8e3fe16a7cd9b32450cf8772 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.654D257A8942334F737B4CF3DBED0F48.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.654D257A8942334F737B4CF3DBED0F48.cso new file mode 100644 index 00000000..7816cb95 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.654D257A8942334F737B4CF3DBED0F48.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.654D257A8942334F737B4CF3DBED0F48.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.654D257A8942334F737B4CF3DBED0F48.cso.pdb new file mode 100644 index 00000000..1cef3cea --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.654D257A8942334F737B4CF3DBED0F48.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce34d4d162f9f7a35c803c106c745ebd3c93319d77685d0da13fb55f2b201ddd +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.67F490450BA69DEBD5593D019A7EC0B6.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.67F490450BA69DEBD5593D019A7EC0B6.metallib new file mode 100644 index 00000000..f9a76c8e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.67F490450BA69DEBD5593D019A7EC0B6.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6ABEABA3444031DF1A478CE27CADC998.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6ABEABA3444031DF1A478CE27CADC998.cso new file mode 100644 index 00000000..cb99afae Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6ABEABA3444031DF1A478CE27CADC998.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6ABEABA3444031DF1A478CE27CADC998.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6ABEABA3444031DF1A478CE27CADC998.cso.pdb new file mode 100644 index 00000000..b94da728 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6ABEABA3444031DF1A478CE27CADC998.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3fa1ab7f81d3dc47e246f5a6902beb58042733e3676466216ba198bd1d46994 +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6AF760A6E9E643069DB35D5D06BD6BA9.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6AF760A6E9E643069DB35D5D06BD6BA9.cso new file mode 100644 index 00000000..f25b3f64 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6AF760A6E9E643069DB35D5D06BD6BA9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6AF760A6E9E643069DB35D5D06BD6BA9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6AF760A6E9E643069DB35D5D06BD6BA9.cso.pdb new file mode 100644 index 00000000..f1283606 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6AF760A6E9E643069DB35D5D06BD6BA9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75b69c854405af932f87404c08824c0f9bf92c508b176ec9f21ce545c00daeed +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6D377C6B02680802CD74BA81C639ED28.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6D377C6B02680802CD74BA81C639ED28.cso new file mode 100644 index 00000000..1f955882 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6D377C6B02680802CD74BA81C639ED28.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6D377C6B02680802CD74BA81C639ED28.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6D377C6B02680802CD74BA81C639ED28.cso.pdb new file mode 100644 index 00000000..e89c8ff1 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6D377C6B02680802CD74BA81C639ED28.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:468304eef6572654cdd191a13f16a65ec190423b038fe5bbd5418f3f0971244b +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6E949D72552C7F34F1E09D89F1E1C952.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6E949D72552C7F34F1E09D89F1E1C952.cso new file mode 100644 index 00000000..55759737 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6E949D72552C7F34F1E09D89F1E1C952.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6E949D72552C7F34F1E09D89F1E1C952.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6E949D72552C7F34F1E09D89F1E1C952.cso.pdb new file mode 100644 index 00000000..681a6c93 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.6E949D72552C7F34F1E09D89F1E1C952.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:917bb46358d054069cc113199264e5fda171119494c8336a473dd7390ed54c3b +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.71D4C26BBE212B4D2A9608C1E34D86E4.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.71D4C26BBE212B4D2A9608C1E34D86E4.metallib new file mode 100644 index 00000000..9e5c048a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.71D4C26BBE212B4D2A9608C1E34D86E4.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7204742FB331648ED83573329D86D073.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7204742FB331648ED83573329D86D073.cso new file mode 100644 index 00000000..4e2e0e1e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7204742FB331648ED83573329D86D073.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7204742FB331648ED83573329D86D073.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7204742FB331648ED83573329D86D073.cso.pdb new file mode 100644 index 00000000..85e413a7 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7204742FB331648ED83573329D86D073.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb9711cd63857be17bd3050dfbcb787e1c25ace1ce716b6c85ea7e1bb617b3bc +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.73CFC84CF655AC999324D43BDB1E4EB6.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.73CFC84CF655AC999324D43BDB1E4EB6.metallib new file mode 100644 index 00000000..9945a0cc Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.73CFC84CF655AC999324D43BDB1E4EB6.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.74380FFB48164FF6B35623BE8701B7EB.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.74380FFB48164FF6B35623BE8701B7EB.cso new file mode 100644 index 00000000..e6d55b3e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.74380FFB48164FF6B35623BE8701B7EB.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.74380FFB48164FF6B35623BE8701B7EB.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.74380FFB48164FF6B35623BE8701B7EB.cso.pdb new file mode 100644 index 00000000..774e2d5d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.74380FFB48164FF6B35623BE8701B7EB.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a532234527d12bf00e0e10496931744b6c409f589a479f600874651d598b8fc5 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7521DA417DCEAD1B47E7D7BE0B95AFE5.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7521DA417DCEAD1B47E7D7BE0B95AFE5.metallib new file mode 100644 index 00000000..880932d4 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7521DA417DCEAD1B47E7D7BE0B95AFE5.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7B8E55E72E6CA6ACF6F1D3A81B3BC9D2.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7B8E55E72E6CA6ACF6F1D3A81B3BC9D2.metallib new file mode 100644 index 00000000..971d720e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7B8E55E72E6CA6ACF6F1D3A81B3BC9D2.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7E7C2EBE718EBA32FB6282BC269E323D.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7E7C2EBE718EBA32FB6282BC269E323D.cso new file mode 100644 index 00000000..01134b97 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7E7C2EBE718EBA32FB6282BC269E323D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7E7C2EBE718EBA32FB6282BC269E323D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7E7C2EBE718EBA32FB6282BC269E323D.cso.pdb new file mode 100644 index 00000000..ef01b7d1 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.7E7C2EBE718EBA32FB6282BC269E323D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc743451387500ed7c23fb3892955290eb4e30ad6e3608490aa5d52e98e89c08 +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.80EF261D1CC4A59FCF572E60A2F410EF.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.80EF261D1CC4A59FCF572E60A2F410EF.cso new file mode 100644 index 00000000..b73e6e1e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.80EF261D1CC4A59FCF572E60A2F410EF.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.80EF261D1CC4A59FCF572E60A2F410EF.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.80EF261D1CC4A59FCF572E60A2F410EF.cso.pdb new file mode 100644 index 00000000..6f24d559 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.80EF261D1CC4A59FCF572E60A2F410EF.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:654e61717de9cccc50e165216fdf1cbbc60d3057cc7401f41d0ff9f3b7df2766 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8206568794DB63EDFB28346F08717693.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8206568794DB63EDFB28346F08717693.metallib new file mode 100644 index 00000000..71d72630 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8206568794DB63EDFB28346F08717693.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.86BBDE2865C753261D68E62FEF5F2901.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.86BBDE2865C753261D68E62FEF5F2901.cso new file mode 100644 index 00000000..cc7bd243 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.86BBDE2865C753261D68E62FEF5F2901.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.86BBDE2865C753261D68E62FEF5F2901.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.86BBDE2865C753261D68E62FEF5F2901.cso.pdb new file mode 100644 index 00000000..5d007882 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.86BBDE2865C753261D68E62FEF5F2901.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f5616cea92cbe191f37611453588b1efc28877a1a817e1ab96291820c40662 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8ADA3DCDE80CB10E83BA6B98332AB60B.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8ADA3DCDE80CB10E83BA6B98332AB60B.cso new file mode 100644 index 00000000..68333e20 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8ADA3DCDE80CB10E83BA6B98332AB60B.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8ADA3DCDE80CB10E83BA6B98332AB60B.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8ADA3DCDE80CB10E83BA6B98332AB60B.cso.pdb new file mode 100644 index 00000000..61f49526 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8ADA3DCDE80CB10E83BA6B98332AB60B.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cf148f461ed70cd239f6d199f0d9ee475a6a7b33942d9dfe6a5523d06d04e9e +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8B6EC10AD63C117AADC967DFF1835F04.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8B6EC10AD63C117AADC967DFF1835F04.cso new file mode 100644 index 00000000..33400d07 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8B6EC10AD63C117AADC967DFF1835F04.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8B6EC10AD63C117AADC967DFF1835F04.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8B6EC10AD63C117AADC967DFF1835F04.cso.pdb new file mode 100644 index 00000000..bb5bc30e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8B6EC10AD63C117AADC967DFF1835F04.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bac1d4b06c324859fedec8cce8b4a34d1c86207268dd5b815f9106955855593 +size 38400 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8D5882C7F4BE916035D8A2A19C6DF78A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8D5882C7F4BE916035D8A2A19C6DF78A.cso new file mode 100644 index 00000000..689e14af Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8D5882C7F4BE916035D8A2A19C6DF78A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8D5882C7F4BE916035D8A2A19C6DF78A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8D5882C7F4BE916035D8A2A19C6DF78A.cso.pdb new file mode 100644 index 00000000..3bd7ea1f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.8D5882C7F4BE916035D8A2A19C6DF78A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22c256c69bed83f4947bf27a77fac0cb99cd26cdb27fb09772a9eef06c7f0f07 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.90E1EDC296925F67098F2D916779539D.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.90E1EDC296925F67098F2D916779539D.cso new file mode 100644 index 00000000..0465cc96 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.90E1EDC296925F67098F2D916779539D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.90E1EDC296925F67098F2D916779539D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.90E1EDC296925F67098F2D916779539D.cso.pdb new file mode 100644 index 00000000..5a4dd658 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.90E1EDC296925F67098F2D916779539D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22ca56b3357c45b61a099b3d266f2ab667d252cd152d6ba82e2436dcf82da784 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.91F8A2067B8EA071695FF41B8B76AE97.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.91F8A2067B8EA071695FF41B8B76AE97.cso new file mode 100644 index 00000000..197eb5f9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.91F8A2067B8EA071695FF41B8B76AE97.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.91F8A2067B8EA071695FF41B8B76AE97.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.91F8A2067B8EA071695FF41B8B76AE97.cso.pdb new file mode 100644 index 00000000..72232501 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.91F8A2067B8EA071695FF41B8B76AE97.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7fc3306801ed011fc3656460eafcf44f359f7634e94cf6c73165f0458ea94a3e +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.93D943F5A9C29E618797431F40796C35.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.93D943F5A9C29E618797431F40796C35.cso new file mode 100644 index 00000000..29e9c4d3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.93D943F5A9C29E618797431F40796C35.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.93D943F5A9C29E618797431F40796C35.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.93D943F5A9C29E618797431F40796C35.cso.pdb new file mode 100644 index 00000000..9a5f53c0 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.93D943F5A9C29E618797431F40796C35.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b67be1e5e9328335599f3ea2a107227bf81497ec07f3d1c82919da25ff72663 +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.96DAC364F30C96759E77B529B883C028.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.96DAC364F30C96759E77B529B883C028.cso new file mode 100644 index 00000000..b3e4f1a5 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.96DAC364F30C96759E77B529B883C028.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.96DAC364F30C96759E77B529B883C028.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.96DAC364F30C96759E77B529B883C028.cso.pdb new file mode 100644 index 00000000..bde91599 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.96DAC364F30C96759E77B529B883C028.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87c99824ecd10241aff211aba89258753b8176655a6b1ad9fe5b3e1e0d62cd5d +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.979416BB843C6F05F3845FFCC3ECD7D6.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.979416BB843C6F05F3845FFCC3ECD7D6.cso new file mode 100644 index 00000000..674bd155 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.979416BB843C6F05F3845FFCC3ECD7D6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.979416BB843C6F05F3845FFCC3ECD7D6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.979416BB843C6F05F3845FFCC3ECD7D6.cso.pdb new file mode 100644 index 00000000..58b899b9 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.979416BB843C6F05F3845FFCC3ECD7D6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:529c48910f79397cb02ecb707fecaeaaa3976a94610612bd18335ac0960278ba +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.984E39E04658AF07687F9C17D33781DA.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.984E39E04658AF07687F9C17D33781DA.cso new file mode 100644 index 00000000..34efe241 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.984E39E04658AF07687F9C17D33781DA.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.984E39E04658AF07687F9C17D33781DA.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.984E39E04658AF07687F9C17D33781DA.cso.pdb new file mode 100644 index 00000000..e5b50219 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.984E39E04658AF07687F9C17D33781DA.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8529b454d516147ddf90a3592ea2a53e128a1b9d0fffdcbe56226b805e28c8ea +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9AE9452EB8270BB640EA28FE04E85D12.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9AE9452EB8270BB640EA28FE04E85D12.cso new file mode 100644 index 00000000..aae23d54 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9AE9452EB8270BB640EA28FE04E85D12.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9AE9452EB8270BB640EA28FE04E85D12.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9AE9452EB8270BB640EA28FE04E85D12.cso.pdb new file mode 100644 index 00000000..2d630bda --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9AE9452EB8270BB640EA28FE04E85D12.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42873ac2df24345ff4fc4de1d2c71b36ed6220453554e6fd6c23b1a52c8d47e8 +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C59ECCAF416177DA2B674CC26C4C7C6.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C59ECCAF416177DA2B674CC26C4C7C6.cso new file mode 100644 index 00000000..ebf97f54 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C59ECCAF416177DA2B674CC26C4C7C6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C59ECCAF416177DA2B674CC26C4C7C6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C59ECCAF416177DA2B674CC26C4C7C6.cso.pdb new file mode 100644 index 00000000..2e60296d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C59ECCAF416177DA2B674CC26C4C7C6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90c6dc02164104f9fd0a853de8700a7bc62d721f41a803aef04cf7eb942a1f0d +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C9DC497EE8CB2A3010B8F5BE870A4AD.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C9DC497EE8CB2A3010B8F5BE870A4AD.metallib new file mode 100644 index 00000000..ebe153bb Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.9C9DC497EE8CB2A3010B8F5BE870A4AD.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A14339AF9BA1D695A2231452C7C125B1.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A14339AF9BA1D695A2231452C7C125B1.metallib new file mode 100644 index 00000000..42301533 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A14339AF9BA1D695A2231452C7C125B1.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A416CC957DBBA6BB89F520075E9ED987.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A416CC957DBBA6BB89F520075E9ED987.metallib new file mode 100644 index 00000000..24430932 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A416CC957DBBA6BB89F520075E9ED987.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A911A0900D6EB7FD73E64020B22DC54D.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A911A0900D6EB7FD73E64020B22DC54D.cso new file mode 100644 index 00000000..6e17f469 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A911A0900D6EB7FD73E64020B22DC54D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A911A0900D6EB7FD73E64020B22DC54D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A911A0900D6EB7FD73E64020B22DC54D.cso.pdb new file mode 100644 index 00000000..058d5609 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.A911A0900D6EB7FD73E64020B22DC54D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d76f7ff0ca593ced94b39f8cf8b09566c4a27500c7f60f9bc7a386d5724ef03 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B0C01FFF068BBB8EC7C84EC464A263C6.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B0C01FFF068BBB8EC7C84EC464A263C6.cso new file mode 100644 index 00000000..31e59ac4 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B0C01FFF068BBB8EC7C84EC464A263C6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B0C01FFF068BBB8EC7C84EC464A263C6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B0C01FFF068BBB8EC7C84EC464A263C6.cso.pdb new file mode 100644 index 00000000..3e329a1b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B0C01FFF068BBB8EC7C84EC464A263C6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40f1f20e24da8652d2bfc01627ed2f9b27b40865f69a1bb7e5aabee20a5ac68d +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B33BD37027E2C6E47FBC917C8D1AD34C.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B33BD37027E2C6E47FBC917C8D1AD34C.cso new file mode 100644 index 00000000..f9f1c707 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B33BD37027E2C6E47FBC917C8D1AD34C.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B33BD37027E2C6E47FBC917C8D1AD34C.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B33BD37027E2C6E47FBC917C8D1AD34C.cso.pdb new file mode 100644 index 00000000..eaf11e7d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B33BD37027E2C6E47FBC917C8D1AD34C.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e983553b07cf4ab766f8ac8a7f85f5f3fd3867e3e6bb56def727e97190a43efc +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B815C5761C479B16EDEFA49DD71F5BEF.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B815C5761C479B16EDEFA49DD71F5BEF.cso new file mode 100644 index 00000000..77d05b78 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B815C5761C479B16EDEFA49DD71F5BEF.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B815C5761C479B16EDEFA49DD71F5BEF.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B815C5761C479B16EDEFA49DD71F5BEF.cso.pdb new file mode 100644 index 00000000..c3f254bb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B815C5761C479B16EDEFA49DD71F5BEF.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aba096b646fdc1d9df6ebf325c87d39a691386e987c3a26eee5a7854d1911899 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B95B5D8436DC9065FA2624B17C3A8F4A.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B95B5D8436DC9065FA2624B17C3A8F4A.cso new file mode 100644 index 00000000..a90490be Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B95B5D8436DC9065FA2624B17C3A8F4A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B95B5D8436DC9065FA2624B17C3A8F4A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B95B5D8436DC9065FA2624B17C3A8F4A.cso.pdb new file mode 100644 index 00000000..2a37a416 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.B95B5D8436DC9065FA2624B17C3A8F4A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9c69a7c97f9e3ef3770f5bfb7308dea2fab44d6ceba4037ec5519f64ee6be98 +size 38400 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BB64A8E44AB8BAEEC81BE23ACF911CBC.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BB64A8E44AB8BAEEC81BE23ACF911CBC.metallib new file mode 100644 index 00000000..49438446 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BB64A8E44AB8BAEEC81BE23ACF911CBC.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BBDA720FBCB03878657725DCB4070478.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BBDA720FBCB03878657725DCB4070478.cso new file mode 100644 index 00000000..a39bd178 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BBDA720FBCB03878657725DCB4070478.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BBDA720FBCB03878657725DCB4070478.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BBDA720FBCB03878657725DCB4070478.cso.pdb new file mode 100644 index 00000000..0fae237b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.BBDA720FBCB03878657725DCB4070478.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cac091cf40d076b00ee8ad9cc3d280239d3b3f3f2ba0652448897d1f18a56258 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C15B7A17F66E5D27A740A3A3C1979581.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C15B7A17F66E5D27A740A3A3C1979581.cso new file mode 100644 index 00000000..dfa8019a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C15B7A17F66E5D27A740A3A3C1979581.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C15B7A17F66E5D27A740A3A3C1979581.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C15B7A17F66E5D27A740A3A3C1979581.cso.pdb new file mode 100644 index 00000000..ab837ad3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C15B7A17F66E5D27A740A3A3C1979581.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c9378bb7124fce21edb2fd94c2260f0e778f3d00d512e1740ef86451d1ffea5 +size 38400 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C7B2BB2F20BE157E180C159EFD14D8DE.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C7B2BB2F20BE157E180C159EFD14D8DE.metallib new file mode 100644 index 00000000..f14518ac Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C7B2BB2F20BE157E180C159EFD14D8DE.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C98B044AB7848AFC025DE95581642A05.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C98B044AB7848AFC025DE95581642A05.cso new file mode 100644 index 00000000..4d19aa18 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C98B044AB7848AFC025DE95581642A05.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C98B044AB7848AFC025DE95581642A05.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C98B044AB7848AFC025DE95581642A05.cso.pdb new file mode 100644 index 00000000..cd1afacc --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.C98B044AB7848AFC025DE95581642A05.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77ac8e9aff475e75147c924a8971be6540ed75e3e1fabe6b4d41e0c027fef606 +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CB92CEE22B94959EEA2E37687128679E.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CB92CEE22B94959EEA2E37687128679E.cso new file mode 100644 index 00000000..f82bdb73 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CB92CEE22B94959EEA2E37687128679E.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CB92CEE22B94959EEA2E37687128679E.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CB92CEE22B94959EEA2E37687128679E.cso.pdb new file mode 100644 index 00000000..0c82f97d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CB92CEE22B94959EEA2E37687128679E.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45d6888f937ca789d62fce66455a8ea86ae0f32c3186f5667275e1971f58c201 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CC0D866961E5688D9882D28BF15A2DD1.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CC0D866961E5688D9882D28BF15A2DD1.cso new file mode 100644 index 00000000..11bed290 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CC0D866961E5688D9882D28BF15A2DD1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CC0D866961E5688D9882D28BF15A2DD1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CC0D866961E5688D9882D28BF15A2DD1.cso.pdb new file mode 100644 index 00000000..ec786e12 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CC0D866961E5688D9882D28BF15A2DD1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91e9cd96944c60869b0b4ed5f5c4d641e776acc8fc4086854b3a5f73bab66745 +size 40448 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CDA1E3C0E334532F508888E67D4074B0.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CDA1E3C0E334532F508888E67D4074B0.cso new file mode 100644 index 00000000..ca0e48bb Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CDA1E3C0E334532F508888E67D4074B0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CDA1E3C0E334532F508888E67D4074B0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CDA1E3C0E334532F508888E67D4074B0.cso.pdb new file mode 100644 index 00000000..89b10fac --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.CDA1E3C0E334532F508888E67D4074B0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0571a655ee7fa180695f6eb972a9fb6eee7e190153edc7563c1b1443884e528a +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D1972016D72D5B585C503DFDD9ABA548.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D1972016D72D5B585C503DFDD9ABA548.cso new file mode 100644 index 00000000..230f0821 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D1972016D72D5B585C503DFDD9ABA548.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D1972016D72D5B585C503DFDD9ABA548.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D1972016D72D5B585C503DFDD9ABA548.cso.pdb new file mode 100644 index 00000000..56f0f232 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D1972016D72D5B585C503DFDD9ABA548.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e0b924292e7ba5b7f4899c68f25cb6b48861b3757fbfc31409b19be7368a1d9 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D580014BB3F0D7F3FB392B6DE11130DF.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D580014BB3F0D7F3FB392B6DE11130DF.cso new file mode 100644 index 00000000..fe805382 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D580014BB3F0D7F3FB392B6DE11130DF.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D580014BB3F0D7F3FB392B6DE11130DF.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D580014BB3F0D7F3FB392B6DE11130DF.cso.pdb new file mode 100644 index 00000000..2fc44a89 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D580014BB3F0D7F3FB392B6DE11130DF.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bac0ee1c234f2ec28bbac1f21b3114b0f23d7a6cfccd5429abc152e6f14544fa +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D8BEC1C4205A6483977E29A6E5C0A924.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D8BEC1C4205A6483977E29A6E5C0A924.metallib new file mode 100644 index 00000000..2660f066 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.D8BEC1C4205A6483977E29A6E5C0A924.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DB334DF1BF578B4A345D78EACFC48EFD.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DB334DF1BF578B4A345D78EACFC48EFD.cso new file mode 100644 index 00000000..7f20084b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DB334DF1BF578B4A345D78EACFC48EFD.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DB334DF1BF578B4A345D78EACFC48EFD.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DB334DF1BF578B4A345D78EACFC48EFD.cso.pdb new file mode 100644 index 00000000..626573c3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DB334DF1BF578B4A345D78EACFC48EFD.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df2ee492dec6b7d99b2e02aa19729feac005f15d8fb91b03b911db352a75f88f +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DBF0DC4E7C492B8443906BDABAB124D6.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DBF0DC4E7C492B8443906BDABAB124D6.cso new file mode 100644 index 00000000..57573f9f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DBF0DC4E7C492B8443906BDABAB124D6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DBF0DC4E7C492B8443906BDABAB124D6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DBF0DC4E7C492B8443906BDABAB124D6.cso.pdb new file mode 100644 index 00000000..7f57db55 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DBF0DC4E7C492B8443906BDABAB124D6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af0449055ec88cff9664e9e1ead727b9b64af8566f550a76d11622ded75135f6 +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DC6974CAEE2A36877F6F6ECC13BBAD7E.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DC6974CAEE2A36877F6F6ECC13BBAD7E.cso new file mode 100644 index 00000000..d79cc6bc Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DC6974CAEE2A36877F6F6ECC13BBAD7E.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DC6974CAEE2A36877F6F6ECC13BBAD7E.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DC6974CAEE2A36877F6F6ECC13BBAD7E.cso.pdb new file mode 100644 index 00000000..570b871c --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DC6974CAEE2A36877F6F6ECC13BBAD7E.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f63bb617cca8a9d912db17e03896aac7b17d8e8a63c24c1468c0fddea84d6177 +size 28160 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DDEB5E46AE2974A0BD8EEF904023D7ED.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DDEB5E46AE2974A0BD8EEF904023D7ED.cso new file mode 100644 index 00000000..a3d2eb9f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DDEB5E46AE2974A0BD8EEF904023D7ED.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DDEB5E46AE2974A0BD8EEF904023D7ED.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DDEB5E46AE2974A0BD8EEF904023D7ED.cso.pdb new file mode 100644 index 00000000..5e733acc --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.DDEB5E46AE2974A0BD8EEF904023D7ED.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6df402bbc91d7a5b70d242c99a4b92d489a25543f93399ef606c4f945653140 +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E21668FA3F80C375943DB33466B664B7.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E21668FA3F80C375943DB33466B664B7.metallib new file mode 100644 index 00000000..e8c18094 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E21668FA3F80C375943DB33466B664B7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2A6EFBB662583C8B826AB85395FBE8B.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2A6EFBB662583C8B826AB85395FBE8B.cso new file mode 100644 index 00000000..9532ae4c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2A6EFBB662583C8B826AB85395FBE8B.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2A6EFBB662583C8B826AB85395FBE8B.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2A6EFBB662583C8B826AB85395FBE8B.cso.pdb new file mode 100644 index 00000000..5e6fe5b9 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2A6EFBB662583C8B826AB85395FBE8B.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1160249709125ff9f4735cefbef006ca9e6b00fabcabd7b03525a776db7b238f +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2B113ED936BDA4068FB8C5E849E995C.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2B113ED936BDA4068FB8C5E849E995C.cso new file mode 100644 index 00000000..d4ec5415 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2B113ED936BDA4068FB8C5E849E995C.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2B113ED936BDA4068FB8C5E849E995C.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2B113ED936BDA4068FB8C5E849E995C.cso.pdb new file mode 100644 index 00000000..ee4675e6 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E2B113ED936BDA4068FB8C5E849E995C.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c752ffd645b97008700f6171fa40fdcfc876c5a5e2b8c857d777d368b6a971fb +size 32256 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E7704C9D770808997358C137DF29684D.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E7704C9D770808997358C137DF29684D.metallib new file mode 100644 index 00000000..13a17df5 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E7704C9D770808997358C137DF29684D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E7F82C90DC6E05851419E96B05BE71AC.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E7F82C90DC6E05851419E96B05BE71AC.metallib new file mode 100644 index 00000000..7394a4c0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.E7F82C90DC6E05851419E96B05BE71AC.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.EB837A0928B395784434A7A111B53B5A.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.EB837A0928B395784434A7A111B53B5A.metallib new file mode 100644 index 00000000..86c94665 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.EB837A0928B395784434A7A111B53B5A.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.F57F07EF6B6ED1C1CCD0B43033944746.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.F57F07EF6B6ED1C1CCD0B43033944746.metallib new file mode 100644 index 00000000..0548c7b3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.F57F07EF6B6ED1C1CCD0B43033944746.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.FE9156D85DC490262296F717A3729F04.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.FE9156D85DC490262296F717A3729F04.cso new file mode 100644 index 00000000..593eea5d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.FE9156D85DC490262296F717A3729F04.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.FE9156D85DC490262296F717A3729F04.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.FE9156D85DC490262296F717A3729F04.cso.pdb new file mode 100644 index 00000000..c738d100 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexBB.vert.FE9156D85DC490262296F717A3729F04.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ced9f78870148c5639871df3e10ab37ae13f6a9e3d8bab559e40fb3faa02cb2 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.3AA9FB07C369A60580272C87CD195B48.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.3AA9FB07C369A60580272C87CD195B48.cso new file mode 100644 index 00000000..cc357314 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.3AA9FB07C369A60580272C87CD195B48.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.3AA9FB07C369A60580272C87CD195B48.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.3AA9FB07C369A60580272C87CD195B48.cso.pdb new file mode 100644 index 00000000..7f99f481 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.3AA9FB07C369A60580272C87CD195B48.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e91285916af3b8ac0595631c615240a02b3cdc64bbd4192e13b2f6f252589c42 +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.54B0DD8802234A5C2D1599668B7B9206.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.54B0DD8802234A5C2D1599668B7B9206.metallib new file mode 100644 index 00000000..7f837217 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.54B0DD8802234A5C2D1599668B7B9206.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.55B9ABEC1E3A57FF5B4B48F003CA9752.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.55B9ABEC1E3A57FF5B4B48F003CA9752.cso new file mode 100644 index 00000000..2453582c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.55B9ABEC1E3A57FF5B4B48F003CA9752.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.55B9ABEC1E3A57FF5B4B48F003CA9752.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.55B9ABEC1E3A57FF5B4B48F003CA9752.cso.pdb new file mode 100644 index 00000000..794478ec --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.55B9ABEC1E3A57FF5B4B48F003CA9752.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b80daed4d3912a57db1b307570e02545ea77353d9557ee6380c9b6068cb741a9 +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E0A95D2F1F3EE6F204B740E133E167F9.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E0A95D2F1F3EE6F204B740E133E167F9.metallib new file mode 100644 index 00000000..8eb2972e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E0A95D2F1F3EE6F204B740E133E167F9.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E4DE4FF3AC2C78D948169907E0A73083.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E4DE4FF3AC2C78D948169907E0A73083.cso new file mode 100644 index 00000000..ed34cadb Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E4DE4FF3AC2C78D948169907E0A73083.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E4DE4FF3AC2C78D948169907E0A73083.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E4DE4FF3AC2C78D948169907E0A73083.cso.pdb new file mode 100644 index 00000000..f6a2e66e --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E4DE4FF3AC2C78D948169907E0A73083.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d486529a36e7d42d989c0287c36a25962db8210cc77bfbe04f57936447b98797 +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E82AF2A7438928C99FB4380BF1D38EEA.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E82AF2A7438928C99FB4380BF1D38EEA.metallib new file mode 100644 index 00000000..6216e810 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.E82AF2A7438928C99FB4380BF1D38EEA.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.F5A70F5EA17C5E1466A4461A319A10E1.cso b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.F5A70F5EA17C5E1466A4461A319A10E1.cso new file mode 100644 index 00000000..b4e41816 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.F5A70F5EA17C5E1466A4461A319A10E1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.F5A70F5EA17C5E1466A4461A319A10E1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.F5A70F5EA17C5E1466A4461A319A10E1.cso.pdb new file mode 100644 index 00000000..153fe3e0 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.F5A70F5EA17C5E1466A4461A319A10E1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5aff727c3ccbfd5f7b065dde8e1bd2690c5e464b124ef7c0153e224630adfc94 +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.FC5D8F71F6D3DF19E20E42FF6618F7D3.metallib b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.FC5D8F71F6D3DF19E20E42FF6618F7D3.metallib new file mode 100644 index 00000000..262b36a8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DebugParticleVertexTri.vert.FC5D8F71F6D3DF19E20E42FF6618F7D3.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.7D4CDE3609CAABADC704CA9E51BB9F61.cso b/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.7D4CDE3609CAABADC704CA9E51BB9F61.cso new file mode 100644 index 00000000..661e2511 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.7D4CDE3609CAABADC704CA9E51BB9F61.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.7D4CDE3609CAABADC704CA9E51BB9F61.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.7D4CDE3609CAABADC704CA9E51BB9F61.cso.pdb new file mode 100644 index 00000000..4e0600e4 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.7D4CDE3609CAABADC704CA9E51BB9F61.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a96485d0356def4ff3bd2b9e877cbc9c21b27f32fc5e286b74dd3cecd956cd3 +size 69120 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.B5C43DC2134A05755ADB00CA12BAF5C9.metallib b/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.B5C43DC2134A05755ADB00CA12BAF5C9.metallib new file mode 100644 index 00000000..4f71ebf9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DeferredLights.frag.B5C43DC2134A05755ADB00CA12BAF5C9.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.AA6AB5EFB19FD706650DFAFAA01D7D90.cso b/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.AA6AB5EFB19FD706650DFAFAA01D7D90.cso new file mode 100644 index 00000000..0194720e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.AA6AB5EFB19FD706650DFAFAA01D7D90.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.AA6AB5EFB19FD706650DFAFAA01D7D90.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.AA6AB5EFB19FD706650DFAFAA01D7D90.cso.pdb new file mode 100644 index 00000000..f3e8fef3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.AA6AB5EFB19FD706650DFAFAA01D7D90.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b95073ff284f9da82197070009ac87fc9e2cce6d6afa5d7a85ab3478bae2eae9 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.F9A4E1FF18B4D49D16DE912FD8A20B3E.metallib b/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.F9A4E1FF18B4D49D16DE912FD8A20B3E.metallib new file mode 100644 index 00000000..5ead1849 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/DeferredMerging.frag.F9A4E1FF18B4D49D16DE912FD8A20B3E.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.2BFF67C6D3C7441503662DA3FF5A8E57.metallib b/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.2BFF67C6D3C7441503662DA3FF5A8E57.metallib new file mode 100644 index 00000000..ee95e589 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.2BFF67C6D3C7441503662DA3FF5A8E57.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.AFFAB2D8D5F189DCDB557A256A2F8D08.cso b/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.AFFAB2D8D5F189DCDB557A256A2F8D08.cso new file mode 100644 index 00000000..a9021c83 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.AFFAB2D8D5F189DCDB557A256A2F8D08.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.AFFAB2D8D5F189DCDB557A256A2F8D08.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.AFFAB2D8D5F189DCDB557A256A2F8D08.cso.pdb new file mode 100644 index 00000000..c9817647 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Distortion.frag.AFFAB2D8D5F189DCDB557A256A2F8D08.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f88dd036b3b1b2954cff86f75e109a23c6641b35394d0f062928d25b30e4529 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.3A86B375B47444ED50B241CB31E4DE69.metallib b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.3A86B375B47444ED50B241CB31E4DE69.metallib new file mode 100644 index 00000000..ccbf29f7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.3A86B375B47444ED50B241CB31E4DE69.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.4E1DEB657074C0BC7622F2752888C406.cso b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.4E1DEB657074C0BC7622F2752888C406.cso new file mode 100644 index 00000000..3dbcb142 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.4E1DEB657074C0BC7622F2752888C406.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.4E1DEB657074C0BC7622F2752888C406.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.4E1DEB657074C0BC7622F2752888C406.cso.pdb new file mode 100644 index 00000000..2f3d5a5a --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.4E1DEB657074C0BC7622F2752888C406.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d961815c143783e7caeb0d42dcdb311b5ab81667aa844356e1779676fc32452 +size 44544 diff --git a/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.6FF25215FE2377D1A9D44CB228A6FDCC.metallib b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.6FF25215FE2377D1A9D44CB228A6FDCC.metallib new file mode 100644 index 00000000..c9184ad2 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.6FF25215FE2377D1A9D44CB228A6FDCC.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.A565FBDBEDF828A39BE5F7DB10013507.cso b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.A565FBDBEDF828A39BE5F7DB10013507.cso new file mode 100644 index 00000000..9b618fd6 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.A565FBDBEDF828A39BE5F7DB10013507.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.A565FBDBEDF828A39BE5F7DB10013507.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.A565FBDBEDF828A39BE5F7DB10013507.cso.pdb new file mode 100644 index 00000000..85247643 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/FXAA.frag.A565FBDBEDF828A39BE5F7DB10013507.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9df90306916167c5d36330509a0aee52016601478763998bb726ed8de28eca75 +size 40448 diff --git a/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.48F96F1C309D71E7B09A68D687BCAF2B.cso b/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.48F96F1C309D71E7B09A68D687BCAF2B.cso new file mode 100644 index 00000000..4ab6408a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.48F96F1C309D71E7B09A68D687BCAF2B.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.48F96F1C309D71E7B09A68D687BCAF2B.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.48F96F1C309D71E7B09A68D687BCAF2B.cso.pdb new file mode 100644 index 00000000..38348ff3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.48F96F1C309D71E7B09A68D687BCAF2B.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a329deee723dfa06f7a45f350f5eacd29eb70d3d99aedf39047bea50dc3b0d9 +size 30208 diff --git a/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.7D008C2220573C54554F7ECF45C09AE1.metallib b/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.7D008C2220573C54554F7ECF45C09AE1.metallib new file mode 100644 index 00000000..ea079e67 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FilterCubemap.comp.7D008C2220573C54554F7ECF45C09AE1.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.06F70F70BEE3A7F2C9007828EAC27793.metallib b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.06F70F70BEE3A7F2C9007828EAC27793.metallib new file mode 100644 index 00000000..3b68e903 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.06F70F70BEE3A7F2C9007828EAC27793.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.23547C37D36CF6F9E3E4E1A5EFFDA5D7.cso b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.23547C37D36CF6F9E3E4E1A5EFFDA5D7.cso new file mode 100644 index 00000000..c1d52097 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.23547C37D36CF6F9E3E4E1A5EFFDA5D7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.23547C37D36CF6F9E3E4E1A5EFFDA5D7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.23547C37D36CF6F9E3E4E1A5EFFDA5D7.cso.pdb new file mode 100644 index 00000000..2e1020f8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.23547C37D36CF6F9E3E4E1A5EFFDA5D7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5f36f49103bf8a705e64b44365faacea057d22c44277abdffaaf86a4b3b42fc +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.5458F29FA4CB16046183E24079014F66.cso b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.5458F29FA4CB16046183E24079014F66.cso new file mode 100644 index 00000000..7b48e2bf Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.5458F29FA4CB16046183E24079014F66.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.5458F29FA4CB16046183E24079014F66.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.5458F29FA4CB16046183E24079014F66.cso.pdb new file mode 100644 index 00000000..881db8a4 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.5458F29FA4CB16046183E24079014F66.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19f65e3b481f1347dd4871154f1c59d5dda9bafec6bc8b4a2d46ff14c080ee6f +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.6820B8E6207A3B72C4104BBEBA6362A7.cso b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.6820B8E6207A3B72C4104BBEBA6362A7.cso new file mode 100644 index 00000000..6f86fa8c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.6820B8E6207A3B72C4104BBEBA6362A7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.6820B8E6207A3B72C4104BBEBA6362A7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.6820B8E6207A3B72C4104BBEBA6362A7.cso.pdb new file mode 100644 index 00000000..f2c44328 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.6820B8E6207A3B72C4104BBEBA6362A7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a03b8c910e1a38fbc270cb45c93dde5a47a1c1c9281e0b29a8afd4db1828e71 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.cso b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.cso new file mode 100644 index 00000000..a12de3a7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.cso.pdb new file mode 100644 index 00000000..d63a2787 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81519e2e6e031ba0aa4b64ec9b73b628f1d6bbb6e999ed3d71cea4fa4bfbbe3f +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.metallib b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.metallib new file mode 100644 index 00000000..31a4fe75 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.84F2CED1305C36A788150F98225EDB8E.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.AB34E7F5715922651FCAC50613AD2C84.metallib b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.AB34E7F5715922651FCAC50613AD2C84.metallib new file mode 100644 index 00000000..eabc4f33 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.AB34E7F5715922651FCAC50613AD2C84.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.E9BEA09E84D5D4F71D5B417CB9E33C2B.metallib b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.E9BEA09E84D5D4F71D5B417CB9E33C2B.metallib new file mode 100644 index 00000000..25a93a7c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/FullScreenQuad.vert.E9BEA09E84D5D4F71D5B417CB9E33C2B.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.20F6C676AA4429ECE221D06C3579FE6E.metallib b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.20F6C676AA4429ECE221D06C3579FE6E.metallib new file mode 100644 index 00000000..cdbd320a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.20F6C676AA4429ECE221D06C3579FE6E.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.39AB76CAE213E76DBA545C88E8BDE602.cso b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.39AB76CAE213E76DBA545C88E8BDE602.cso new file mode 100644 index 00000000..9af57da0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.39AB76CAE213E76DBA545C88E8BDE602.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.39AB76CAE213E76DBA545C88E8BDE602.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.39AB76CAE213E76DBA545C88E8BDE602.cso.pdb new file mode 100644 index 00000000..547975c9 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.39AB76CAE213E76DBA545C88E8BDE602.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fea09ea65b30a52793fd2ec36a27332ea97bcf741876d6cfc8c78bf5f3b7612d +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.504D71546723AF7F0E946069BF0BBDC1.cso b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.504D71546723AF7F0E946069BF0BBDC1.cso new file mode 100644 index 00000000..4be0ea05 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.504D71546723AF7F0E946069BF0BBDC1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.504D71546723AF7F0E946069BF0BBDC1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.504D71546723AF7F0E946069BF0BBDC1.cso.pdb new file mode 100644 index 00000000..da3ce8f4 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.504D71546723AF7F0E946069BF0BBDC1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18f1f0170040f5dbd0599996364eb75687ca23237a845d32a9ff75e48e95d5fa +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.621E6F8AB62D0530723E6071DD1AECAE.cso b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.621E6F8AB62D0530723E6071DD1AECAE.cso new file mode 100644 index 00000000..acb7d8d2 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.621E6F8AB62D0530723E6071DD1AECAE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.621E6F8AB62D0530723E6071DD1AECAE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.621E6F8AB62D0530723E6071DD1AECAE.cso.pdb new file mode 100644 index 00000000..d4a876a0 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.621E6F8AB62D0530723E6071DD1AECAE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73ec0766ba1db7c2e7df68f75731790c76821b290e156ff79356288b9a360d68 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.6B3AB535C56AF8AAA886CB915A7DE392.cso b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.6B3AB535C56AF8AAA886CB915A7DE392.cso new file mode 100644 index 00000000..0e47e6b4 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.6B3AB535C56AF8AAA886CB915A7DE392.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.6B3AB535C56AF8AAA886CB915A7DE392.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.6B3AB535C56AF8AAA886CB915A7DE392.cso.pdb new file mode 100644 index 00000000..40871a93 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.6B3AB535C56AF8AAA886CB915A7DE392.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f867367b8d53ffa72a706d266775825cf093197bfec75879d859dcfdf8ff7726 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.835D4B0EE4352DFABEFBE67F99F03581.cso b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.835D4B0EE4352DFABEFBE67F99F03581.cso new file mode 100644 index 00000000..e6b51fdc Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.835D4B0EE4352DFABEFBE67F99F03581.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.835D4B0EE4352DFABEFBE67F99F03581.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.835D4B0EE4352DFABEFBE67F99F03581.cso.pdb new file mode 100644 index 00000000..a1379a0f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.835D4B0EE4352DFABEFBE67F99F03581.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:902e2c59d3461f6c5a0c75bb4cebb0f17904de8164af9a3f760e3876e6c78cb3 +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.A9E805B45F4C48DB5EC5940F2DBB49EF.metallib b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.A9E805B45F4C48DB5EC5940F2DBB49EF.metallib new file mode 100644 index 00000000..9de2f633 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.A9E805B45F4C48DB5EC5940F2DBB49EF.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.AD528D11B24C3E9547BBC2755B99AF0D.metallib b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.AD528D11B24C3E9547BBC2755B99AF0D.metallib new file mode 100644 index 00000000..c9f4fa52 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.AD528D11B24C3E9547BBC2755B99AF0D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.AE86D100987DC55AC4CD67341D850BC9.metallib b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.AE86D100987DC55AC4CD67341D850BC9.metallib new file mode 100644 index 00000000..52cb72e7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.AE86D100987DC55AC4CD67341D850BC9.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.BBC3FA3E5A6A9C8BD17B04A4C3C3131F.metallib b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.BBC3FA3E5A6A9C8BD17B04A4C3C3131F.metallib new file mode 100644 index 00000000..61403979 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.BBC3FA3E5A6A9C8BD17B04A4C3C3131F.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C26A349E4B498C28CA45FDF2B358356D.metallib b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C26A349E4B498C28CA45FDF2B358356D.metallib new file mode 100644 index 00000000..bc619ac2 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C26A349E4B498C28CA45FDF2B358356D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C7D82581B244FE8E3E7FAD38CA9B4C30.cso b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C7D82581B244FE8E3E7FAD38CA9B4C30.cso new file mode 100644 index 00000000..c8060469 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C7D82581B244FE8E3E7FAD38CA9B4C30.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C7D82581B244FE8E3E7FAD38CA9B4C30.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C7D82581B244FE8E3E7FAD38CA9B4C30.cso.pdb new file mode 100644 index 00000000..d0dddcc4 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.C7D82581B244FE8E3E7FAD38CA9B4C30.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:395f6bce0d1aa18eefecb46be77c1df66d9bd95cdcfc7a8a34a3d1127b43714f +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.D12FD3934A8AEA8B731F0FFDEE6E4203.metallib b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.D12FD3934A8AEA8B731F0FFDEE6E4203.metallib new file mode 100644 index 00000000..5707a4d1 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.D12FD3934A8AEA8B731F0FFDEE6E4203.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.F024867C34EF3686655F5D8B96BD85AD.cso b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.F024867C34EF3686655F5D8B96BD85AD.cso new file mode 100644 index 00000000..efff9cd7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.F024867C34EF3686655F5D8B96BD85AD.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.F024867C34EF3686655F5D8B96BD85AD.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.F024867C34EF3686655F5D8B96BD85AD.cso.pdb new file mode 100644 index 00000000..61997bbb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GBuffer.frag.F024867C34EF3686655F5D8B96BD85AD.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f02be367c47fb0c9b1543a6c43dd75093ad2fe808049a394207458fe0b42f86a +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.0A585A8EE1FAF289D0FA00431292E74D.metallib b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.0A585A8EE1FAF289D0FA00431292E74D.metallib new file mode 100644 index 00000000..ba44a26c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.0A585A8EE1FAF289D0FA00431292E74D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.196033BDAFEE16C2947AC8D3CBD9E464.metallib b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.196033BDAFEE16C2947AC8D3CBD9E464.metallib new file mode 100644 index 00000000..d48ddd2a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.196033BDAFEE16C2947AC8D3CBD9E464.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.44119E8A23CB98B578519BD7A8DD2D3A.cso b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.44119E8A23CB98B578519BD7A8DD2D3A.cso new file mode 100644 index 00000000..24ce28bb Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.44119E8A23CB98B578519BD7A8DD2D3A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.44119E8A23CB98B578519BD7A8DD2D3A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.44119E8A23CB98B578519BD7A8DD2D3A.cso.pdb new file mode 100644 index 00000000..914cd08f --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.44119E8A23CB98B578519BD7A8DD2D3A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:300fa8fb412760ed98a99eede03e6d3e69fddb917356df27253db5fbd9cbe558 +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.4D18DB2E6615B37CE61ADA69E7CF80B7.cso b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.4D18DB2E6615B37CE61ADA69E7CF80B7.cso new file mode 100644 index 00000000..053fa26a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.4D18DB2E6615B37CE61ADA69E7CF80B7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.4D18DB2E6615B37CE61ADA69E7CF80B7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.4D18DB2E6615B37CE61ADA69E7CF80B7.cso.pdb new file mode 100644 index 00000000..ab97abbb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.4D18DB2E6615B37CE61ADA69E7CF80B7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30978b44b2e67f7fe994fdd73ead0870d09d9d964f11650e957cb6fdd6458e25 +size 24064 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.6B1E1A9B04F783E5EF5AF1FA2DD7A8F0.cso b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.6B1E1A9B04F783E5EF5AF1FA2DD7A8F0.cso new file mode 100644 index 00000000..ff9771db Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.6B1E1A9B04F783E5EF5AF1FA2DD7A8F0.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.6B1E1A9B04F783E5EF5AF1FA2DD7A8F0.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.6B1E1A9B04F783E5EF5AF1FA2DD7A8F0.cso.pdb new file mode 100644 index 00000000..bce292bb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.6B1E1A9B04F783E5EF5AF1FA2DD7A8F0.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a1360b8321964dbebacfbccb925ca56fe36753856d59ebdbbafd463589fa25c +size 24064 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.776C8F8C4765207534C2B33EE67BA844.metallib b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.776C8F8C4765207534C2B33EE67BA844.metallib new file mode 100644 index 00000000..c50ac0c5 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.776C8F8C4765207534C2B33EE67BA844.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.A85F6F848367C44C2139ED7946A2DD41.cso b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.A85F6F848367C44C2139ED7946A2DD41.cso new file mode 100644 index 00000000..7c316de7 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.A85F6F848367C44C2139ED7946A2DD41.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.A85F6F848367C44C2139ED7946A2DD41.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.A85F6F848367C44C2139ED7946A2DD41.cso.pdb new file mode 100644 index 00000000..066e40da --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.A85F6F848367C44C2139ED7946A2DD41.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a61d7a730fce6e8fc53da0e0ba017433b91a7017e8276a103798342e851bd9e +size 24064 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.C7B3E6FB6A02D2891A0BFE850ABA2E05.cso b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.C7B3E6FB6A02D2891A0BFE850ABA2E05.cso new file mode 100644 index 00000000..ac6d1a0a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.C7B3E6FB6A02D2891A0BFE850ABA2E05.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.C7B3E6FB6A02D2891A0BFE850ABA2E05.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.C7B3E6FB6A02D2891A0BFE850ABA2E05.cso.pdb new file mode 100644 index 00000000..2ab757df --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.C7B3E6FB6A02D2891A0BFE850ABA2E05.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24503f9a880cbe9b60be6bd543ff5ed55ff1f22b4ecbdb7a218e3f099c66941c +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.D4B8B59DC084AF08261271DE31BD80FB.metallib b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.D4B8B59DC084AF08261271DE31BD80FB.metallib new file mode 100644 index 00000000..d2439be8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.D4B8B59DC084AF08261271DE31BD80FB.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.D6F2FD832CE84459152427CA78D65D28.metallib b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.D6F2FD832CE84459152427CA78D65D28.metallib new file mode 100644 index 00000000..50fcb9ca Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.D6F2FD832CE84459152427CA78D65D28.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E0C7B3E835DB79196070A24486ABF763.cso b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E0C7B3E835DB79196070A24486ABF763.cso new file mode 100644 index 00000000..db41e7a8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E0C7B3E835DB79196070A24486ABF763.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E0C7B3E835DB79196070A24486ABF763.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E0C7B3E835DB79196070A24486ABF763.cso.pdb new file mode 100644 index 00000000..7a9d36a1 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E0C7B3E835DB79196070A24486ABF763.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5020986a520b7a357d19803434bd16383dfc26c04b936a60f76bbb336b75f6eb +size 22016 diff --git a/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E8745B044C2DFE8709E100D425FD7E22.metallib b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E8745B044C2DFE8709E100D425FD7E22.metallib new file mode 100644 index 00000000..f936aab3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/GaussianBlur.frag.E8745B044C2DFE8709E100D425FD7E22.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.cso b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.cso new file mode 100644 index 00000000..795d9518 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb new file mode 100644 index 00000000..fc631202 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:215ead0b83bc1d6e79550443e62984efdeadc4c2331005b80299be8a386c40b2 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib new file mode 100644 index 00000000..55552916 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.C992EAD4108528439F5ACC0580D33319.cso b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.C992EAD4108528439F5ACC0580D33319.cso new file mode 100644 index 00000000..b5fcef5c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.C992EAD4108528439F5ACC0580D33319.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.C992EAD4108528439F5ACC0580D33319.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.C992EAD4108528439F5ACC0580D33319.cso.pdb new file mode 100644 index 00000000..9d959fe2 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.C992EAD4108528439F5ACC0580D33319.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c38601f73e6cfdd7ba3d920c077b4a9df07712b715e2e50434fe7aba92cf472d +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.EEDB02B1278B2566C0A24981ED8E295B.metallib b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.EEDB02B1278B2566C0A24981ED8E295B.metallib new file mode 100644 index 00000000..f87faf3a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Gizmo.vert.EEDB02B1278B2566C0A24981ED8E295B.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.9005CED6A719F4C5A6266F97BBFB476E.metallib b/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.9005CED6A719F4C5A6266F97BBFB476E.metallib new file mode 100644 index 00000000..9cbd676d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.9005CED6A719F4C5A6266F97BBFB476E.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.F811CE9BD360967E23FA73EFC790BF73.cso b/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.F811CE9BD360967E23FA73EFC790BF73.cso new file mode 100644 index 00000000..1efdb0a8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.F811CE9BD360967E23FA73EFC790BF73.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.F811CE9BD360967E23FA73EFC790BF73.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.F811CE9BD360967E23FA73EFC790BF73.cso.pdb new file mode 100644 index 00000000..77d04fc8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Heatmap.frag.F811CE9BD360967E23FA73EFC790BF73.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:162e86cdf1da252b67772408f0aa5e84c5d8a27a53d12aeabbaa489c08451689 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.87409A88665BA0A46F3F776DF2CA1206.metallib b/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.87409A88665BA0A46F3F776DF2CA1206.metallib new file mode 100644 index 00000000..c492c380 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.87409A88665BA0A46F3F776DF2CA1206.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.F0E2F0F689387705D12CB9970013F51D.cso b/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.F0E2F0F689387705D12CB9970013F51D.cso new file mode 100644 index 00000000..a712b231 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.F0E2F0F689387705D12CB9970013F51D.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.F0E2F0F689387705D12CB9970013F51D.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.F0E2F0F689387705D12CB9970013F51D.cso.pdb new file mode 100644 index 00000000..dcc62b7b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ImGui.frag.F0E2F0F689387705D12CB9970013F51D.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2fbf983506f174a94552aeab0eb1655e9b00ccf1b6ed157280772fdfae9410c2 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.13B53A2583576C2B028749CFE7A75DBA.cso b/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.13B53A2583576C2B028749CFE7A75DBA.cso new file mode 100644 index 00000000..dfc46c18 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.13B53A2583576C2B028749CFE7A75DBA.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.13B53A2583576C2B028749CFE7A75DBA.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.13B53A2583576C2B028749CFE7A75DBA.cso.pdb new file mode 100644 index 00000000..291a6ec3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.13B53A2583576C2B028749CFE7A75DBA.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af88f424ebb14f4bdcbc50a762c9366af83cc56a37339208258e75b7986cce98 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.613A033E7F8C94916EEEB5D560FE454B.metallib b/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.613A033E7F8C94916EEEB5D560FE454B.metallib new file mode 100644 index 00000000..adad004b Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ImGui.vert.613A033E7F8C94916EEEB5D560FE454B.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.03B060E36BAC8979EBFFCD327F74AAF9.cso b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.03B060E36BAC8979EBFFCD327F74AAF9.cso new file mode 100644 index 00000000..8fc7fd52 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.03B060E36BAC8979EBFFCD327F74AAF9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.03B060E36BAC8979EBFFCD327F74AAF9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.03B060E36BAC8979EBFFCD327F74AAF9.cso.pdb new file mode 100644 index 00000000..6b909a65 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.03B060E36BAC8979EBFFCD327F74AAF9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c64062182aa2468f071c24dcd063c143d396c345b8703e9504371491f700024 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.0AE6A05A739437D201C8C1B2F93B8544.metallib b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.0AE6A05A739437D201C8C1B2F93B8544.metallib new file mode 100644 index 00000000..f5e073d9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.0AE6A05A739437D201C8C1B2F93B8544.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.3C1C64A82544849508C4F7B5018CED35.cso b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.3C1C64A82544849508C4F7B5018CED35.cso new file mode 100644 index 00000000..0dfa4273 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.3C1C64A82544849508C4F7B5018CED35.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.3C1C64A82544849508C4F7B5018CED35.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.3C1C64A82544849508C4F7B5018CED35.cso.pdb new file mode 100644 index 00000000..4e83db77 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.3C1C64A82544849508C4F7B5018CED35.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d01b30cfb7e6583f89b29eb459e271d1d2218f3b0a9dcb84a00ec8339f7041d6 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.712FE560E255C4424D1793FEF1498944.metallib b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.712FE560E255C4424D1793FEF1498944.metallib new file mode 100644 index 00000000..ba05cac3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/InitIndirectionOffsetsBuffer.comp.712FE560E255C4424D1793FEF1498944.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.95BBBD48996763573C91C6D61130ADC6.metallib b/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.95BBBD48996763573C91C6D61130ADC6.metallib new file mode 100644 index 00000000..bde83251 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.95BBBD48996763573C91C6D61130ADC6.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.C69D1C8B63FD48E0C28A855BE4BC8C72.cso b/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.C69D1C8B63FD48E0C28A855BE4BC8C72.cso new file mode 100644 index 00000000..6700474d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.C69D1C8B63FD48E0C28A855BE4BC8C72.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.C69D1C8B63FD48E0C28A855BE4BC8C72.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.C69D1C8B63FD48E0C28A855BE4BC8C72.cso.pdb new file mode 100644 index 00000000..39f374c7 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/LightInstanced.vert.C69D1C8B63FD48E0C28A855BE4BC8C72.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21d06b0e0bd31775623a046d0c15a66a9045d4224e7b00deee721b522b9ab6a7 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.01A367EBF8EF61BEB5BBD977C507AD5D.metallib b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.01A367EBF8EF61BEB5BBD977C507AD5D.metallib new file mode 100644 index 00000000..b3f5c062 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.01A367EBF8EF61BEB5BBD977C507AD5D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.46FFC0AC778725D76C1B4B50B25D2820.cso b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.46FFC0AC778725D76C1B4B50B25D2820.cso new file mode 100644 index 00000000..9f3df263 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.46FFC0AC778725D76C1B4B50B25D2820.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.46FFC0AC778725D76C1B4B50B25D2820.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.46FFC0AC778725D76C1B4B50B25D2820.cso.pdb new file mode 100644 index 00000000..f6f7ca02 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelector.comp.46FFC0AC778725D76C1B4B50B25D2820.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a10406c540e3ef73a0485eacddf210b313365adb53ee389c5f6e27d9ef13b136 +size 34304 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.01A367EBF8EF61BEB5BBD977C507AD5D.metallib b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.01A367EBF8EF61BEB5BBD977C507AD5D.metallib new file mode 100644 index 00000000..158ff11a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.01A367EBF8EF61BEB5BBD977C507AD5D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.46FFC0AC778725D76C1B4B50B25D2820.cso b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.46FFC0AC778725D76C1B4B50B25D2820.cso new file mode 100644 index 00000000..d98daea4 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.46FFC0AC778725D76C1B4B50B25D2820.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.46FFC0AC778725D76C1B4B50B25D2820.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.46FFC0AC778725D76C1B4B50B25D2820.cso.pdb new file mode 100644 index 00000000..1fe95e40 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ParticleSelectorCycle.comp.46FFC0AC778725D76C1B4B50B25D2820.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d75ecb1fd20715088297a79dcbcf3df778fc1e77f09528745b94d57f333d9ed9 +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.40666DC8ABC0281162338BC37344400B.metallib b/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.40666DC8ABC0281162338BC37344400B.metallib new file mode 100644 index 00000000..02b11769 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.40666DC8ABC0281162338BC37344400B.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.4AB7012A334144666A00F99BE4F8ABF5.cso b/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.4AB7012A334144666A00F99BE4F8ABF5.cso new file mode 100644 index 00000000..d5921c43 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.4AB7012A334144666A00F99BE4F8ABF5.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.4AB7012A334144666A00F99BE4F8ABF5.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.4AB7012A334144666A00F99BE4F8ABF5.cso.pdb new file mode 100644 index 00000000..61aa37ec --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/PointLightInstanced.frag.4AB7012A334144666A00F99BE4F8ABF5.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6696385d6b7a3ecbf77dbaadb649087b5565afb0c341cc72d01a2274430a14c9 +size 26112 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.cso b/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.cso new file mode 100644 index 00000000..2bf6b39c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb new file mode 100644 index 00000000..62a11ebe --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dee034cf83b3442ef24f26dc8d57c5c243a24701e60ca61bc7760d54f04b1bc3 +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib b/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib new file mode 100644 index 00000000..ff59c0a4 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Profiler.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.607F7C9197328C04A914D3DB28E91B70.metallib b/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.607F7C9197328C04A914D3DB28E91B70.metallib new file mode 100644 index 00000000..987da1aa Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.607F7C9197328C04A914D3DB28E91B70.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.7421279F2283857C300D16BA4AC862F9.cso b/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.7421279F2283857C300D16BA4AC862F9.cso new file mode 100644 index 00000000..a241f9ef Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.7421279F2283857C300D16BA4AC862F9.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.7421279F2283857C300D16BA4AC862F9.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.7421279F2283857C300D16BA4AC862F9.cso.pdb new file mode 100644 index 00000000..2fe4df39 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/Profiler.vert.7421279F2283857C300D16BA4AC862F9.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c60e5e7af8efdad407c258c60ded33ac09b894d66986c37d577018d0a0d995b6 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.cso b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.cso new file mode 100644 index 00000000..692338d5 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.cso.pdb new file mode 100644 index 00000000..5314be6b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92641976840521cbbb0a718c6c4cac655f0784ffa7d9ff67337a110eeb7c858c +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.metallib b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.metallib new file mode 100644 index 00000000..c16def64 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.3F8899175EDEBECFC90A9FCF4189D177.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.cso b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.cso new file mode 100644 index 00000000..6e650c5a Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb new file mode 100644 index 00000000..9a9d1ed8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e5529519834f4e0b4fd2d15d2a40ea641720d1e1deb27b60891d1578aff7afb +size 13824 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib new file mode 100644 index 00000000..4fbe4dc0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.frag.4DD1C89DF8002B409E089089CE8F24E7.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.A0CB1C647BF9FDC5B765A1CD78BEA0C6.cso b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.A0CB1C647BF9FDC5B765A1CD78BEA0C6.cso new file mode 100644 index 00000000..24e68a04 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.A0CB1C647BF9FDC5B765A1CD78BEA0C6.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.A0CB1C647BF9FDC5B765A1CD78BEA0C6.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.A0CB1C647BF9FDC5B765A1CD78BEA0C6.cso.pdb new file mode 100644 index 00000000..be22c408 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.A0CB1C647BF9FDC5B765A1CD78BEA0C6.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23a4e612c8b63d1940ec5095415f7b428a7c24c715936a706aa17eff7adba99c +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.B1F47489E9CAD9F30B6E29EECDC49DC7.cso b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.B1F47489E9CAD9F30B6E29EECDC49DC7.cso new file mode 100644 index 00000000..b0554d29 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.B1F47489E9CAD9F30B6E29EECDC49DC7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.B1F47489E9CAD9F30B6E29EECDC49DC7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.B1F47489E9CAD9F30B6E29EECDC49DC7.cso.pdb new file mode 100644 index 00000000..8f5cf0e3 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.B1F47489E9CAD9F30B6E29EECDC49DC7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb132f734a7c09064df4b39b49026f6cd5255925e87e484aeb0678442a1427a4 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.C6E60C6043020672ADB3C28FE4231386.metallib b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.C6E60C6043020672ADB3C28FE4231386.metallib new file mode 100644 index 00000000..c3a6a6d3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.C6E60C6043020672ADB3C28FE4231386.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.E306BFB69B25E84A37254307D2194DE4.metallib b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.E306BFB69B25E84A37254307D2194DE4.metallib new file mode 100644 index 00000000..fcbd8339 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/ProfilerDrawNode.vert.E306BFB69B25E84A37254307D2194DE4.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.000E9EBE432F6B318E8869722FA96736.cso b/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.000E9EBE432F6B318E8869722FA96736.cso new file mode 100644 index 00000000..150bc225 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.000E9EBE432F6B318E8869722FA96736.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.000E9EBE432F6B318E8869722FA96736.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.000E9EBE432F6B318E8869722FA96736.cso.pdb new file mode 100644 index 00000000..43947f2a --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.000E9EBE432F6B318E8869722FA96736.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d130910080ad13bbce71889b21153c158269f935e20605419b6d81d92d4144d +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.6B0FF562C6B4E087E89ECFB854F4DF16.metallib b/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.6B0FF562C6B4E087E89ECFB854F4DF16.metallib new file mode 100644 index 00000000..b1a6b9ab Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/RenderCubemapFace.comp.6B0FF562C6B4E087E89ECFB854F4DF16.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.00EEAD7565201E1D171906979186BFF4.metallib b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.00EEAD7565201E1D171906979186BFF4.metallib new file mode 100644 index 00000000..2aad2fd4 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.00EEAD7565201E1D171906979186BFF4.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.194FBD4081C25D96A0D72764B5D2868C.cso b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.194FBD4081C25D96A0D72764B5D2868C.cso new file mode 100644 index 00000000..61e2591f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.194FBD4081C25D96A0D72764B5D2868C.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.194FBD4081C25D96A0D72764B5D2868C.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.194FBD4081C25D96A0D72764B5D2868C.cso.pdb new file mode 100644 index 00000000..bbbc7438 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.194FBD4081C25D96A0D72764B5D2868C.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60b006368c0a5f541c18f1805807d1bd7ff14c28a2e315fd58e7670679543e82 +size 17920 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.5914DC24CB72BBC25D999BA4C1DB9B5A.cso b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.5914DC24CB72BBC25D999BA4C1DB9B5A.cso new file mode 100644 index 00000000..bc80679d Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.5914DC24CB72BBC25D999BA4C1DB9B5A.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.5914DC24CB72BBC25D999BA4C1DB9B5A.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.5914DC24CB72BBC25D999BA4C1DB9B5A.cso.pdb new file mode 100644 index 00000000..839a5d02 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.5914DC24CB72BBC25D999BA4C1DB9B5A.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e06a04b94c2ff1c31410f4c731a1cbaae6a83b6c96555f0e9b75a6b3b62cbbf4 +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.A50757CC2A13C001045CDD9A011A0E78.cso b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.A50757CC2A13C001045CDD9A011A0E78.cso new file mode 100644 index 00000000..562b569c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.A50757CC2A13C001045CDD9A011A0E78.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.A50757CC2A13C001045CDD9A011A0E78.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.A50757CC2A13C001045CDD9A011A0E78.cso.pdb new file mode 100644 index 00000000..2e85d4d8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.A50757CC2A13C001045CDD9A011A0E78.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afcb244abbbfc83d475d317b4c1f2caaa8ecd9bda803f2ed51e73b1a7dfca53d +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C771D47D0FD2493829F05C25BF23328F.metallib b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C771D47D0FD2493829F05C25BF23328F.metallib new file mode 100644 index 00000000..60ba8ab9 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C771D47D0FD2493829F05C25BF23328F.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C91A588C69123D5B74210A1169C0B7CB.cso b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C91A588C69123D5B74210A1169C0B7CB.cso new file mode 100644 index 00000000..8a37b1c6 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C91A588C69123D5B74210A1169C0B7CB.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C91A588C69123D5B74210A1169C0B7CB.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C91A588C69123D5B74210A1169C0B7CB.cso.pdb new file mode 100644 index 00000000..718b05c6 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.C91A588C69123D5B74210A1169C0B7CB.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20c20c15ed47fa89138090451e8163d0208862f59fe44fd728914e6f6dc80277 +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.D2590CD60D4E66225883164A95636A82.metallib b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.D2590CD60D4E66225883164A95636A82.metallib new file mode 100644 index 00000000..a235441f Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.D2590CD60D4E66225883164A95636A82.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.F1C2D218A3AFC30EF7F2C8297F4B8646.metallib b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.F1C2D218A3AFC30EF7F2C8297F4B8646.metallib new file mode 100644 index 00000000..b23fa667 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMesh.vert.F1C2D218A3AFC30EF7F2C8297F4B8646.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.7CF9397E238069F29B5AD306936DC2E1.cso b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.7CF9397E238069F29B5AD306936DC2E1.cso new file mode 100644 index 00000000..6de455df Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.7CF9397E238069F29B5AD306936DC2E1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb new file mode 100644 index 00000000..04b1b398 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.7CF9397E238069F29B5AD306936DC2E1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:804263473f92ef6f2480ccbcdf4872ffbdb003e9e78bc2bbf8c6a8e1a6a3f45e +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.9E055DD95BFFEC03321947DE0EB82637.metallib b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.9E055DD95BFFEC03321947DE0EB82637.metallib new file mode 100644 index 00000000..14f13e4e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.frag.9E055DD95BFFEC03321947DE0EB82637.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.18162C7773971E53C43D7A0F15D8ECE4.metallib b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.18162C7773971E53C43D7A0F15D8ECE4.metallib new file mode 100644 index 00000000..8f796fa5 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.18162C7773971E53C43D7A0F15D8ECE4.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.6D34106F328960A07AB5DB0CBEBE05E5.cso b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.6D34106F328960A07AB5DB0CBEBE05E5.cso new file mode 100644 index 00000000..c3c724ee Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.6D34106F328960A07AB5DB0CBEBE05E5.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.6D34106F328960A07AB5DB0CBEBE05E5.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.6D34106F328960A07AB5DB0CBEBE05E5.cso.pdb new file mode 100644 index 00000000..c79eaceb --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SolidMeshShadow.vert.6D34106F328960A07AB5DB0CBEBE05E5.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:829b0c84e9a246f955d70b61d089ac3245e8532c597de96a24b3eb592515e923 +size 15872 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.36030C466ADE37AEB6B32358DC8DBAC7.cso b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.36030C466ADE37AEB6B32358DC8DBAC7.cso new file mode 100644 index 00000000..12ec630c Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.36030C466ADE37AEB6B32358DC8DBAC7.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.36030C466ADE37AEB6B32358DC8DBAC7.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.36030C466ADE37AEB6B32358DC8DBAC7.cso.pdb new file mode 100644 index 00000000..b734a75c --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.36030C466ADE37AEB6B32358DC8DBAC7.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fff472b41b6943e3f00e3ae69e52cdc8d8e4f18fff8e5177e43f18de2b29f960 +size 73216 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.5CFD62E25CEECDE84ED94155C845E9B2.cso b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.5CFD62E25CEECDE84ED94155C845E9B2.cso new file mode 100644 index 00000000..ee19cba0 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.5CFD62E25CEECDE84ED94155C845E9B2.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.5CFD62E25CEECDE84ED94155C845E9B2.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.5CFD62E25CEECDE84ED94155C845E9B2.cso.pdb new file mode 100644 index 00000000..f9c489e8 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.5CFD62E25CEECDE84ED94155C845E9B2.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2491b8a6fbbc16e1e6a10243e7ce0bb1bfe1bb577e7b143e3ad8ce63e88bb34 +size 81408 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.D224AE024F31A732967118BC1834D51D.metallib b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.D224AE024F31A732967118BC1834D51D.metallib new file mode 100644 index 00000000..6d981294 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.D224AE024F31A732967118BC1834D51D.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.D53181CD829C7C2CC9A7D66D28AA2D06.metallib b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.D53181CD829C7C2CC9A7D66D28AA2D06.metallib new file mode 100644 index 00000000..8bed0bd3 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortDownSweep.comp.D53181CD829C7C2CC9A7D66D28AA2D06.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.001CEFA3E15B4064857DF52248F766BE.cso b/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.001CEFA3E15B4064857DF52248F766BE.cso new file mode 100644 index 00000000..6e41bbb8 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.001CEFA3E15B4064857DF52248F766BE.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.001CEFA3E15B4064857DF52248F766BE.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.001CEFA3E15B4064857DF52248F766BE.cso.pdb new file mode 100644 index 00000000..2bb24765 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.001CEFA3E15B4064857DF52248F766BE.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a9e3be22abdbbbe38cb4e65bfade478e5ebd42ad65b577fb6460c53d3b7c7f1 +size 36352 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.4C1B3D9DE2E2589090B928914DBDCA22.metallib b/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.4C1B3D9DE2E2589090B928914DBDCA22.metallib new file mode 100644 index 00000000..8d107716 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortPrefixSum.comp.4C1B3D9DE2E2589090B928914DBDCA22.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.BC3EED1104C7A5A05486050D5E27A5CC.cso b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.BC3EED1104C7A5A05486050D5E27A5CC.cso new file mode 100644 index 00000000..572066ec Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.BC3EED1104C7A5A05486050D5E27A5CC.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.BC3EED1104C7A5A05486050D5E27A5CC.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.BC3EED1104C7A5A05486050D5E27A5CC.cso.pdb new file mode 100644 index 00000000..e5ebac87 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.BC3EED1104C7A5A05486050D5E27A5CC.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e1cde92d78584e04544ea58e0c7a8ec582d993c372aa5ae7254f5f3afd2ac9c +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.E926B5F5F536A436919B0059B2A29EFC.metallib b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.E926B5F5F536A436919B0059B2A29EFC.metallib new file mode 100644 index 00000000..0250663e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.E926B5F5F536A436919B0059B2A29EFC.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.EDD9731E86E29E66F0807C2362C8B640.metallib b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.EDD9731E86E29E66F0807C2362C8B640.metallib new file mode 100644 index 00000000..8221e22e Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.EDD9731E86E29E66F0807C2362C8B640.metallib differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.F3A85FB3B74B54E33EEF438D2BBA34A1.cso b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.F3A85FB3B74B54E33EEF438D2BBA34A1.cso new file mode 100644 index 00000000..d7e16935 Binary files /dev/null and b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.F3A85FB3B74B54E33EEF438D2BBA34A1.cso differ diff --git a/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.F3A85FB3B74B54E33EEF438D2BBA34A1.cso.pdb b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.F3A85FB3B74B54E33EEF438D2BBA34A1.cso.pdb new file mode 100644 index 00000000..ac40a19b --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Shaders/SortUpSweep.comp.F3A85FB3B74B54E33EEF438D2BBA34A1.cso.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f47cf904a74ab394bd512723a83f33fa7f11745df980d6f6c67ee43dea64207c +size 19968 diff --git a/PopcornFX/PopcornFXInternals/Textures/DitheringPatterns.png b/PopcornFX/PopcornFXInternals/Textures/DitheringPatterns.png new file mode 100644 index 00000000..42e5f943 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Textures/DitheringPatterns.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:219b964bf372bdb5db2c7e6cdd8c7af7db3401faf4a8d47997bdfaa2ec7d5af8 +size 134 diff --git a/PopcornFX/PopcornFXInternals/Textures/Overdraw.dds b/PopcornFX/PopcornFXInternals/Textures/Overdraw.dds new file mode 100644 index 00000000..1375f68d --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Textures/Overdraw.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:437b9a994d1537999b8980532529f6ca127070998f83d659ee348b43f65a593e +size 384 diff --git a/PopcornFX/PopcornFXInternals/Textures/TextAtlas.dds b/PopcornFX/PopcornFXInternals/Textures/TextAtlas.dds new file mode 100644 index 00000000..23a9dd19 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Textures/TextAtlas.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e91b9b9b474174c7ffe931f0845532510e102d0a4cafeb2e9ece2d2c2ccfb32 +size 1398228 diff --git a/PopcornFX/PopcornFXInternals/Textures/TextAtlas.pkat b/PopcornFX/PopcornFXInternals/Textures/TextAtlas.pkat new file mode 100644 index 00000000..fa8de922 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Textures/TextAtlas.pkat @@ -0,0 +1,98 @@ +0, 0, 0.0625, 0.125 +0, 0.125, 0.0625, 0.25 +0, 0.25, 0.0625, 0.375 +0, 0.375, 0.0625, 0.5 +0, 0.5, 0.0625, 0.625 +0, 0.625, 0.0625, 0.75 +0, 0.75, 0.0625, 0.875 +0, 0.875, 0.0625, 1 +0.0625, 0, 0.125, 0.125 +0.0625, 0.125, 0.125, 0.25 +0.0625, 0.25, 0.125, 0.375 +0.0625, 0.375, 0.125, 0.5 +0.0625, 0.5, 0.125, 0.625 +0.0625, 0.625, 0.125, 0.75 +0.0625, 0.75, 0.125, 0.875 +0.0625, 0.875, 0.125, 1 +0.125, 0, 0.1875, 0.125 +0.1875, 0, 0.25, 0.125 +0.25, 0, 0.3125, 0.125 +0.3125, 0, 0.375, 0.125 +0.375, 0, 0.4375, 0.125 +0.4375, 0, 0.5, 0.125 +0.5, 0, 0.5625, 0.125 +0.5625, 0, 0.625, 0.125 +0.625, 0, 0.6875, 0.125 +0.6875, 0, 0.75, 0.125 +0.75, 0, 0.8125, 0.125 +0.8125, 0, 0.875, 0.125 +0.875, 0, 0.9375, 0.125 +0.9375, 0, 1, 0.125 +0.125, 0.125, 0.1875, 0.25 +0.125, 0.25, 0.1875, 0.375 +0.125, 0.375, 0.1875, 0.5 +0.125, 0.5, 0.1875, 0.625 +0.125, 0.625, 0.1875, 0.75 +0.125, 0.75, 0.1875, 0.875 +0.125, 0.875, 0.1875, 1 +0.1875, 0.125, 0.25, 0.25 +0.1875, 0.25, 0.25, 0.375 +0.1875, 0.375, 0.25, 0.5 +0.1875, 0.5, 0.25, 0.625 +0.1875, 0.625, 0.25, 0.75 +0.1875, 0.75, 0.25, 0.875 +0.1875, 0.875, 0.25, 1 +0.25, 0.125, 0.3125, 0.25 +0.3125, 0.125, 0.375, 0.25 +0.375, 0.125, 0.4375, 0.25 +0.4375, 0.125, 0.5, 0.25 +0.5, 0.125, 0.5625, 0.25 +0.5625, 0.125, 0.625, 0.25 +0.625, 0.125, 0.6875, 0.25 +0.6875, 0.125, 0.75, 0.25 +0.75, 0.125, 0.8125, 0.25 +0.8125, 0.125, 0.875, 0.25 +0.875, 0.125, 0.9375, 0.25 +0.9375, 0.125, 1, 0.25 +0.25, 0.25, 0.3125, 0.375 +0.25, 0.375, 0.3125, 0.5 +0.25, 0.5, 0.3125, 0.625 +0.25, 0.625, 0.3125, 0.75 +0.25, 0.75, 0.3125, 0.875 +0.25, 0.875, 0.3125, 1 +0.3125, 0.25, 0.375, 0.375 +0.3125, 0.375, 0.375, 0.5 +0.3125, 0.5, 0.375, 0.625 +0.3125, 0.625, 0.375, 0.75 +0.3125, 0.75, 0.375, 0.875 +0.3125, 0.875, 0.375, 1 +0.375, 0.25, 0.4375, 0.375 +0.4375, 0.25, 0.5, 0.375 +0.5, 0.25, 0.5625, 0.375 +0.5625, 0.25, 0.625, 0.375 +0.625, 0.25, 0.6875, 0.375 +0.6875, 0.25, 0.75, 0.375 +0.75, 0.25, 0.8125, 0.375 +0.8125, 0.25, 0.875, 0.375 +0.875, 0.25, 0.9375, 0.375 +0.9375, 0.25, 1, 0.375 +0.375, 0.375, 0.4375, 0.5 +0.375, 0.5, 0.4375, 0.625 +0.375, 0.625, 0.4375, 0.75 +0.375, 0.75, 0.4375, 0.875 +0.375, 0.875, 0.4375, 1 +0.4375, 0.375, 0.5, 0.5 +0.4375, 0.5, 0.5, 0.625 +0.4375, 0.625, 0.5, 0.75 +0.4375, 0.75, 0.5, 0.875 +0.4375, 0.875, 0.5, 1 +0.5, 0.375, 0.5625, 0.5 +0.5625, 0.375, 0.625, 0.5 +0.625, 0.375, 0.6875, 0.5 +0.6875, 0.375, 0.75, 0.5 +0.75, 0.375, 0.8125, 0.5 +0.8125, 0.375, 0.875, 0.5 +0.875, 0.375, 0.9375, 0.5 +0.9375, 0.375, 1, 0.5 +0.5, 0.5, 0.5625, 0.625 +0.875, 0.875, 1, 1 \ No newline at end of file diff --git a/PopcornFX/PopcornFXInternals/Textures/default.dds b/PopcornFX/PopcornFXInternals/Textures/default.dds new file mode 100644 index 00000000..e68293b9 --- /dev/null +++ b/PopcornFX/PopcornFXInternals/Textures/default.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eeddc8a31f1c0c91724241ef291f667942316ef589b3a9aa7638ccd33d473303 +size 22000 diff --git a/PopcornFX/README.md b/PopcornFX/README.md new file mode 100644 index 00000000..cdcad638 --- /dev/null +++ b/PopcornFX/README.md @@ -0,0 +1,31 @@ +# After Effects PopcornFX Plugin + +Integrates the **PopcornFX Runtime SDK** into **After Effects** as a Plugin. +* **Version:** `v2.19.1` +* **Platforms:** `Windows` (http://www.popcornfx.com/contact-us/) for more information. + +## Setup + +* **[Install](https://wiki.popcornfx.com/index.php?title=Announcements)** the PopcornFX v2 Editor **matching** that plugin version + to create effects +* **[Install](https://www.popcornfx.com/docs/popcornfx-v2/plugins/after-effects-plugin/plugin-installation/) the After Effects PopcornFX Plugin** in your After Effects install folder + +## Updating the plugin (minor or patch update) + +* **(Minor update only)** Open PopcornFX Editor, **upgrade your project from the [project launcher](https://www.popcornfx.com/docs/popcornfx-v2/editor/project-launcher/)** +* **Remove the old plugin** +* [Install](https://www.popcornfx.com/docs/popcornfx-v2/plugins/after-effects-plugin/plugin-installation/) the latest released archive. +* **(Minor update only)** Open your After Effects project and reimport all effects, they will not load otherwise + +## Quick Links: Documentation and Support + +* [**Plugin** documentation](https://www.popcornfx.com/docs/popcornfx-v2/plugins/after-effects-plugin/) (Install, Import, Setup, Troubleshooting, etc..) +* [PopcornFX **Editor** documentation](https://www.popcornfx.com/docs/popcornfx-v2/) +* [PopcornFX Answer Hub](https://answers.popcornfx.com/) + +The PopcornFX Runtime SDK cannot be in any way: transfered, modified, or used +without this Plugin or outside After Effects, see [LICENSE.md](/LICENSE.md). + +## License + +See [LICENSE.md](/LICENSE.md). diff --git a/PopcornFX/Resources.rcc b/PopcornFX/Resources.rcc new file mode 100644 index 00000000..401aad1e Binary files /dev/null and b/PopcornFX/Resources.rcc differ diff --git a/PopcornFX/Resources/Fonts/Consolas.ttf b/PopcornFX/Resources/Fonts/Consolas.ttf new file mode 100644 index 00000000..77b62225 --- /dev/null +++ b/PopcornFX/Resources/Fonts/Consolas.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f8d58e719a7d724be036145f506acf38b0942e253a7c331887c7056b93deac8 +size 98520 diff --git a/PopcornFX/Resources/Fonts/Roboto-Bold.ttf b/PopcornFX/Resources/Fonts/Roboto-Bold.ttf new file mode 100644 index 00000000..5fdb6b6c --- /dev/null +++ b/PopcornFX/Resources/Fonts/Roboto-Bold.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d0b991ee3e0be7af01ad7ea8cd2beea6c00a25e679a0226b6737f079aafff86 +size 170760 diff --git a/PopcornFX/Resources/Fonts/Roboto-Light.ttf b/PopcornFX/Resources/Fonts/Roboto-Light.ttf new file mode 100644 index 00000000..ff021ce6 --- /dev/null +++ b/PopcornFX/Resources/Fonts/Roboto-Light.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6d343d425bc38db90152fa06058b1c7391eca9264f334ef65c1ce175085c6f6 +size 170420 diff --git a/PopcornFX/Resources/Fonts/Roboto-Regular.ttf b/PopcornFX/Resources/Fonts/Roboto-Regular.ttf new file mode 100644 index 00000000..c1da4573 --- /dev/null +++ b/PopcornFX/Resources/Fonts/Roboto-Regular.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79e851404657dac2106b3d22ad256d47824a9a5765458edb72c9102a45816d95 +size 171676 diff --git a/PopcornFX/Resources/Fonts/RobotoMono-Regular.ttf b/PopcornFX/Resources/Fonts/RobotoMono-Regular.ttf new file mode 100644 index 00000000..90e78edc --- /dev/null +++ b/PopcornFX/Resources/Fonts/RobotoMono-Regular.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7ab2d73cf7d538face08bcdde95b928ce609a970237c8811ca3c76059c8bb2f +size 114624 diff --git a/PopcornFX/Resources/Icons/Reset.png b/PopcornFX/Resources/Icons/Reset.png new file mode 100644 index 00000000..d40d432a --- /dev/null +++ b/PopcornFX/Resources/Icons/Reset.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a176a5dd45498d18d5692b677c6c246fa01bad88add52ef56b6144dfb38473cb +size 760 diff --git a/PopcornFX/Resources/Icons/branch-closed.png b/PopcornFX/Resources/Icons/branch-closed.png new file mode 100644 index 00000000..c9f730f1 --- /dev/null +++ b/PopcornFX/Resources/Icons/branch-closed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa82c07fbfdd45e4be67cd014f6e75fab0d8a46a08ea68f34801f8cba43db921 +size 238 diff --git a/PopcornFX/Resources/Icons/branch-open.png b/PopcornFX/Resources/Icons/branch-open.png new file mode 100644 index 00000000..f715694d --- /dev/null +++ b/PopcornFX/Resources/Icons/branch-open.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:177b190fee54d81e8507e0b4874dade50194f46d4bce28c05f73eb1d732ac90c +size 333 diff --git a/PopcornFX/Stylesheet.qss b/PopcornFX/Stylesheet.qss new file mode 100644 index 00000000..f4f7a935 --- /dev/null +++ b/PopcornFX/Stylesheet.qss @@ -0,0 +1,146 @@ +/*---- Main app font ----*/ +/*-------- NOTE: We do that in code before loading the stylesheet, but we can override it here: + * { font-family: Roboto;} +--------*/ + +/*--------*/ +QWidget:window { + background: #202020; +} + +/*---AE---*/ + +QWidget { + background: #303030; + border: none; +} + +/*---- Tabs used by QTabWidget ----*/ + +QTabWidget::pane { + margin-right: -1px; +} + +QTabWidget QTabBar::tab { + color: #808080; + background: #303030; + border: none; + margin: 0px; + padding: 8px; + padding-top: 3px; + padding-bottom: 3px; +} +QTabWidget QTabBar::tab:selected { + color: #E0E0E0; + background: #434343; + margin-left: 0px; +} +QTabWidget QTabBar::tab:selected:top { + border-bottom: 0px; + margin-top: 1px; +} +QTabWidget QTabBar::tab:selected:bottom { + border-top: 0px; + margin-bottom: 1px; +} +QTabWidget QTabBar::tab:!selected:top { + border-bottom: 1px solid #5A5A5A; + margin-bottom: 0px; + margin-top: 2px; +} +QTabWidget QTabBar::tab:!selected:bottom { + border-top: 1px solid #5A5A5A; + margin-top: 0px; + margin-bottom: 2px; +} +QTabWidget QTabBar::tab:!selected:hover:top { + color: #AAA; + background: #383838; + margin: 0px; + padding-top: 4px; +} +QTabWidget QTabBar::tab:!selected:hover:bottom { + color: #AAA; + background: #383838; + margin: 0px; + padding-bottom: 4px; +} + +/*--------*/ +QComboBox::drop-down { +} + +QComboBox QAbstractItemView { +} + + +/*--------*/ +QTreeView { + background: #303030; + padding-left: 2px; + spacing: 0px; +} + + +QTreeView::item { + color: white; +} + +QTreeView::branch:open:has-children { + image: url(:/icons/branch-open.png); +} + +QTreeView::branch:closed:has-children { + image: url(:/icons/branch-closed.png); +} + +/*--------*/ +QHeaderView::section { + background-color: #303030; + color: white; + border: 1px solid #5A5A5A; +} + +/*--------*/ +QScrollBar { + border: none; + background: none; + padding: 1px; +} +QScrollBar:vertical { + width: 10px; +} +QScrollBar:horizontal { + height: 10px; +} +QScrollBar::handle { + background: #505050; + min-width: 8px; + min-height: 8px; + border: none; + border-radius: 4px; /** (width - padding-left) / 2 */ +} +QScrollBar::handle:hover { + background: #707070; +} +QScrollBar::handle:disabled { + background: #383838; +} +QScrollBar::sub-line, QScrollBar::add-line { + border: none; + background: none; + height:0px; /** IMPORTANT : remove arrow button logic at the edges of the scrollbar */ + width:0px; /** IMPORTANT : remove arrow button logic at the edges of the scrollbar */ +} +QScrollBar::left-arrow, QScrollBar::right-arrow, +QScrollBar::top-arrow, QScrollBar::bottom-arrow { + border: none; + background: none; + height:0px; /** IMPORTANT : remove arrow button logic at the edges of the scrollbar */ + width:0px; /** IMPORTANT : remove arrow button logic at the edges of the scrollbar */ +} + +/*--------*/ +QAbstractItemView::item:!selected:hover { + background: #404040; +} \ No newline at end of file diff --git a/PopcornFX/WinPixEventRuntime.dll b/PopcornFX/WinPixEventRuntime.dll new file mode 100644 index 00000000..e98cecfd --- /dev/null +++ b/PopcornFX/WinPixEventRuntime.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:365a63da6a83c91b76bd7f8a9efcc3806b6188a6d29acdbe9d7e43decf3510d8 +size 55032 diff --git a/PopcornFX/documentation/debugger/PopcornFX.natvis b/PopcornFX/documentation/debugger/PopcornFX.natvis new file mode 100644 index 00000000..94eba7ef --- /dev/null +++ b/PopcornFX/documentation/debugger/PopcornFX.natvis @@ -0,0 +1,409 @@ + + + + + + + + + + + + null + {*((char**)((ptrdiff_t)m_Container.m_Ptr + (((sizeof(PopcornFX::CStringContainer) + 4) + (sizeof(void*) - 1)) & ~((ptrdiff_t)(sizeof(void*) - 1))))),s} [Len={m_Container.m_Ptr->m_Length & 0x7FFFFFFF}] + {(char*)((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringContainer) + (0xF - ((sizeof(PopcornFX::CStringContainer) + 0xF) & ((ptrdiff_t)0xF)))),s} [Len={m_Container.m_Ptr->m_Length & 0x7FFFFFFF}] + null + *((char**)((ptrdiff_t)m_Container.m_Ptr + (((sizeof(PopcornFX::CStringContainer) + 4) + (sizeof(void*) - 1)) & ~((ptrdiff_t)(sizeof(void*) - 1))))),s + (char*)((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringContainer) + (0xF - ((sizeof(PopcornFX::CStringContainer) + 0xF) & ((ptrdiff_t)0xF)))),s + + + + null + {*((wchar_t**)((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringUnicodeContainer) + 4)),su} [Len={m_Container.m_Ptr->m_Length & 0x7FFFFFFF}] + {(wchar_t*)(((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringUnicodeContainer) + 0xF) & ~((ptrdiff_t)0xF)),su} [Len={m_Container.m_Ptr->m_Length & 0x7FFFFFFF}] + null + *((wchar_t**)((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringUnicodeContainer) + 4)),su + (wchar_t*)(((ptrdiff_t)m_Container.m_Ptr + sizeof(PopcornFX::CStringUnicodeContainer) + 0xF) & ~((ptrdiff_t)0xF)),su + + + + Id=0 null + Id={m_Id} {PopcornFX::CStringInternals::m_StringIdDictionnary->m_StringIdPool.m_Chunks[m_Id / PopcornFX::CStringIdDictionary::kPoolChunkSize][m_Id % PopcornFX::CStringIdDictionary::kPoolChunkSize]} + + PopcornFX::CStringInternals::m_StringIdDictionnary->m_StringIdPool.m_Chunks[m_Id / PopcornFX::CStringIdDictionary::kPoolChunkSize][m_Id % PopcornFX::CStringIdDictionary::kPoolChunkSize] + + + + + null + {m_Data,[m_Length]s} [Len={m_Length}] + + + + null + {m_DataFeed.m_Ptr} + + m_DataFeed.m_Ptr + + + + + {{RefPtr={(void*)m_Ptr}}} + + m_Ptr + + + + {{WeakPtr={(void*)m_Ptr}}} + + m_Ptr + + + + {{ScopedPtr={(void*)m_Ptr}}} + + m_Ptr + + + + + {{A Count={m_Count}}} + + + m_Count + ($T1*)m_Data + + + + + + {{A Count={m_Count}}} + + + m_Count + ($T1*)m_Data + + + + + + {{SDA Count={m_Count & 0x7FFFFFFF} Data={(void*)m_Allocated.m_Data}} + {{SDA Count={m_Count & 0x7FFFFFFF} Data={(void*)(((unsigned long long)m_StaticData + kAlignment - 1) & - kAlignment)}} + + + m_Count & 0x7FFFFFFF + ($T1*)m_Allocated.m_Data + + + m_Count + ($T1*)(((unsigned long long)m_StaticData + kAlignment - 1) & - kAlignment) + + + + + + {{SFA Count={m_Count}, Data={(void*)m_Data}, Cap={m_Capacity}}} + + + m_Count + ($T1*)m_Data + + + + + + {{SA _Count={$T2}, Data={(void*)(((unsigned long long)_m_Data + kAlignment - 1) & - kAlignment)} + + + $T2 + ($T1*)(((unsigned long long)_m_Data + kAlignment - 1) & - kAlignment) + + + + + + {{SCA Count={m_Count}, Data={(void*)(((unsigned long long)_m_Data + kAlignment - 1) & - kAlignment)}}} + + + m_Count + ($T1*)(((unsigned long long)_m_Data + kAlignment - 1) & - kAlignment) + + + + + + {{CA Count={$T2 * m_ChunksCount}({$T2}*{m_ChunksCount}), ChuncksCap={m_ChunksCapacity}}} + + + $T2 * m_ChunksCount + m_Chunks[$i / $T2][$i % $T2] + + + + + + {{SlotA UsedCount={m_UsedSlots} _Count={$T2}}} + + + $T2 + ($T1*)m_Data + + + + + + {{SlotA UsedCount={m_UsedSlots} Count={m_DataSizeInBytes / sizeof($T1)}}} + + + m_DataSizeInBytes / sizeof($T1) + ($T1*)m_Data + + + + + + {{MV Count={m_Count}, Data={(void*)m_Data}, sizeof={sizeof($T1)}}} + + + m_Count + ($T1*)m_Data + + + + + + {{SMV Count={m_Storage.m_Count}, Data={(void*)m_Storage.m_RawDataPtr}, Stride={m_Storage.m_Stride}, sizeof={sizeof($T1)}}} + + + m_Storage.m_Count + *(($T1*)(m_Storage.m_RawDataPtr + $i * m_Storage.m_Stride)) + + + + + + {{SMVF Count={m_Storage.m_Count}, Data={(void*)m_Storage.m_RawDataPtr}, Stride={m_Storage.m_Stride}, Footp={m_ElementFootprintInBytes}, sizeof={sizeof($T1)}} + + + m_Storage.m_Count + *(($T1*)(m_Storage.m_RawDataPtr + $i * m_Storage.m_Stride)) + + + + + + {{First={m_First}, Second={m_Second}}} + + m_First + m_Second + + + + + {{FHM Count={m_Count}, Data={(void*)m_Slots}, Size={m_Size}}} + + + m_Size + m_Slots + + + + + + + empty + + void (error) + + + const class cr{m_RawBits & 0xFFFF,d} + variable class vr{m_RawBits & 0xFFFF,d} + instance class ir{m_RawBits & 0xFFFF,d} + stream class sr{m_RawBits & 0xFFFF,d} + + + const bool1 cr{m_RawBits & 0xFFFF,d} + variable bool1 vr{m_RawBits & 0xFFFF,d} + instance bool1 ir{m_RawBits & 0xFFFF,d} + stream bool1 sr{m_RawBits & 0xFFFF,d} + + const bool2 cr{m_RawBits & 0xFFFF,d} + variable bool2 vr{m_RawBits & 0xFFFF,d} + instance bool2 ir{m_RawBits & 0xFFFF,d} + stream bool2 sr{m_RawBits & 0xFFFF,d} + + const bool3 cr{m_RawBits & 0xFFFF,d} + variable bool3 vr{m_RawBits & 0xFFFF,d} + instance bool3 ir{m_RawBits & 0xFFFF,d} + stream bool3 sr{m_RawBits & 0xFFFF,d} + + const bool4 cr{m_RawBits & 0xFFFF,d} + variable bool4 vr{m_RawBits & 0xFFFF,d} + instance bool4 ir{m_RawBits & 0xFFFF,d} + stream bool4 sr{m_RawBits & 0xFFFF,d} + + + const int1 cr{m_RawBits & 0xFFFF,d} + variable int1 vr{m_RawBits & 0xFFFF,d} + instance int1 ir{m_RawBits & 0xFFFF,d} + stream int1 sr{m_RawBits & 0xFFFF,d} + + const int2 cr{m_RawBits & 0xFFFF,d} + variable int2 vr{m_RawBits & 0xFFFF,d} + instance int2 ir{m_RawBits & 0xFFFF,d} + stream int2 sr{m_RawBits & 0xFFFF,d} + + const int3 cr{m_RawBits & 0xFFFF,d} + variable int3 vr{m_RawBits & 0xFFFF,d} + instance int3 ir{m_RawBits & 0xFFFF,d} + stream int3 sr{m_RawBits & 0xFFFF,d} + + const int4 cr{m_RawBits & 0xFFFF,d} + variable int4 vr{m_RawBits & 0xFFFF,d} + instance int4 ir{m_RawBits & 0xFFFF,d} + stream int4 sr{m_RawBits & 0xFFFF,d} + + + const float1 cr{m_RawBits & 0xFFFF,d} + variable float1 vr{m_RawBits & 0xFFFF,d} + instance float1 ir{m_RawBits & 0xFFFF,d} + stream float1 sr{m_RawBits & 0xFFFF,d} + + const float2 cr{m_RawBits & 0xFFFF,d} + variable float2 vr{m_RawBits & 0xFFFF,d} + instance float2 ir{m_RawBits & 0xFFFF,d} + stream float2 sr{m_RawBits & 0xFFFF,d} + + const float3 cr{m_RawBits & 0xFFFF,d} + variable float3 vr{m_RawBits & 0xFFFF,d} + instance float3 ir{m_RawBits & 0xFFFF,d} + stream float3 sr{m_RawBits & 0xFFFF,d} + + const float4 cr{m_RawBits & 0xFFFF,d} + variable float4 vr{m_RawBits & 0xFFFF,d} + instance float4 ir{m_RawBits & 0xFFFF,d} + stream float4 sr{m_RawBits & 0xFFFF,d} + + + const orientation cr{m_RawBits & 0xFFFF,d} + variable orientation vr{m_RawBits & 0xFFFF,d} + instance orientation ir{m_RawBits & 0xFFFF,d} + stream orientation sr{m_RawBits & 0xFFFF,d} + + + + + + Range = ]{m_BoundMin.m_Value.m_Data32u,X}, {m_BoundMax.m_Value.m_Data32u,X}[ - ]{m_BoundMin.m_Value.m_Data32f}, {m_BoundMax.m_Value.m_Data32f}[ - ]{m_BoundMin.m_Value.m_Data32s}, {m_BoundMax.m_Value.m_Data32s}[ + Range = ]{m_BoundMin.m_Value.m_Data32u,X}, {m_BoundMax.m_Value.m_Data32u,X}] - ]{m_BoundMin.m_Value.m_Data32f}, {m_BoundMax.m_Value.m_Data32f}] - ]{m_BoundMin.m_Value.m_Data32s}, {m_BoundMax.m_Value.m_Data32s}] + Range = [{m_BoundMin.m_Value.m_Data32u,X}, {m_BoundMax.m_Value.m_Data32u,X}[ - [{m_BoundMin.m_Value.m_Data32f}, {m_BoundMax.m_Value.m_Data32f}[ - [{m_BoundMin.m_Value.m_Data32s}, {m_BoundMax.m_Value.m_Data32s}[ + Range = [{m_BoundMin.m_Value.m_Data32u,X}, {m_BoundMax.m_Value.m_Data32u,X}] - [{m_BoundMin.m_Value.m_Data32f}, {m_BoundMax.m_Value.m_Data32f}] - [{m_BoundMin.m_Value.m_Data32s}, {m_BoundMax.m_Value.m_Data32s}] + + + + X + O + + + + {*(PopcornFX::Range::Internal::_SConstantRange_Natvis*)(m_BoundMin.m_Value.m_Data32u + 0)} + + + 4 + (PopcornFX::Range::Internal::_SConstantRange_Natvis*)(m_BoundMin.m_Value.m_Data32u + $i) + + + + + + {*(PopcornFX::Range::Internal::_SConstantEdge_Natvis*)(m_Edge.m_Data+0)}{*(PopcornFX::Range::Internal::_SConstantEdge_Natvis*)(m_Edge.m_Data+1)}{*(PopcornFX::Range::Internal::_SConstantEdge_Natvis*)(m_Edge.m_Data+2)}{*(PopcornFX::Range::Internal::_SConstantEdge_Natvis*)(m_Edge.m_Data+3)}: |{m_Value.m_Data32u[0],X}, {m_Value.m_Data32u[1],X}, {m_Value.m_Data32u[2],X}, {m_Value.m_Data32u[3],X}| - |{m_Value.m_Data32f[0]}, {m_Value.m_Data32f[1]}, {m_Value.m_Data32f[2]}, {m_Value.m_Data32f[3]}| - |{m_Value.m_Data32s[0]}, {m_Value.m_Data32s[1]}, {m_Value.m_Data32s[2]}, {m_Value.m_Data32s[3]}| + + + + INVALID + void + auto + byte + float + float2 + float3 + float4 + int + int2 + int3 + int4 + bool + bool2 + bool3 + bool4 + orientation + + m_Index + + + + + (PopcornFX::CVStreamSemanticDictionnary::EDefaultOrdinals)(m_Code >> 8) + (m_Code >> 8) + + (PopcornFX::CVStreamSemanticDictionnary::EDefaultOrdinals)(m_Code >> 8) + (m_Code >> 8) + (PopcornFX::SVStreamCode::EElementType)(m_Code & 0x1F) + (m_Code & 0x80) != 0 + (m_Code & 0x40) != 0 + m_Code + + + + + v{(m_Key >> 29) & 0x7,d}.{(m_Key >> 24) & 0x1F,d}.{(m_Key >> 18) & 0x3F,d}.{m_Key & 0x3FFFF,d} + + m_Key + + + + + {m_Data} + + + $T2 + m_Data + + + + + + {m_Axes} + + + $T2 + m_Axes + + + + + + {{{m_Imag[0]}, {m_Imag[1]}, {m_Imag[2]}, {m_Real}}} + + + 4 + m_Imag + + + + + diff --git a/PopcornFX/fxc.exe b/PopcornFX/fxc.exe new file mode 100644 index 00000000..19101cdf --- /dev/null +++ b/PopcornFX/fxc.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a2f88683e759a3fa805e90e18cc0f26a7177c8cee87c928dc9ecdfff27231e9 +size 154376 diff --git a/PopcornFX/popcornfx.qt/Qt5Core.dll b/PopcornFX/popcornfx.qt/Qt5Core.dll new file mode 100644 index 00000000..c0a7b6b7 --- /dev/null +++ b/PopcornFX/popcornfx.qt/Qt5Core.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dae3aefe8afc6ecce88184c8908722af6a1382bcf2a67ea66fe5c97dfa59322a +size 6453232 diff --git a/PopcornFX/popcornfx.qt/Qt5Gui.dll b/PopcornFX/popcornfx.qt/Qt5Gui.dll new file mode 100644 index 00000000..b3b7f0cb --- /dev/null +++ b/PopcornFX/popcornfx.qt/Qt5Gui.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38a6c697833268f5c5013e68e8bb7f7b7ef00bd9946ebfc9d563f533fa55bf66 +size 7208960 diff --git a/PopcornFX/popcornfx.qt/Qt5Widgets.dll b/PopcornFX/popcornfx.qt/Qt5Widgets.dll new file mode 100644 index 00000000..fb41e8cd --- /dev/null +++ b/PopcornFX/popcornfx.qt/Qt5Widgets.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da032d6457d5f6993c3aa3388d62739d9c3387a5d34edd0b7f79a81cb9af6f74 +size 5562880 diff --git a/PopcornFX/popcornfx.qt/popcornfx.qt.manifest b/PopcornFX/popcornfx.qt/popcornfx.qt.manifest new file mode 100644 index 00000000..f2161de7 --- /dev/null +++ b/PopcornFX/popcornfx.qt/popcornfx.qt.manifest @@ -0,0 +1,9 @@ + +" + + + + + + + \ No newline at end of file diff --git a/PopcornFX/popcornfx.qt/qwindows.dll b/PopcornFX/popcornfx.qt/qwindows.dll new file mode 100644 index 00000000..4a3eaf74 --- /dev/null +++ b/PopcornFX/popcornfx.qt/qwindows.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f083147f27e7f6ac7d8d97b02e165cfb00af89b2b79ab4524971d0cfc5eaca9 +size 1469952 diff --git a/Samples/PK-MCPP/directive.cpp b/Samples/PK-MCPP/directive.cpp new file mode 100644 index 00000000..e68143ad --- /dev/null +++ b/Samples/PK-MCPP/directive.cpp @@ -0,0 +1,1713 @@ +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * D I R E C T I V E . C + * P r o c e s s D i r e c t i v e L i n e s + * + * The routines to handle directives other than #include and #pragma + * are placed here. + */ + +#include "precompiled.h" +#include "pk_mcpp_bridge.h" + +#if defined(PK_COMPILER_MSVC) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wwrite-strings" +# pragma clang diagnostic ignored "-Wimplicit-fallthrough" +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wwrite-strings" +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + +static int do_if( int hash, const char * directive_name); + /* #if, #elif, #ifdef, #ifndef */ +static void sync_linenum( void); + /* Synchronize number of newlines */ +static long do_line( void); + /* Process #line directive */ +static int get_parm( void); + /* Get parameters of macro, its nargs, names, lengths */ +static int get_repl( const char * macroname); + /* Get replacement text embedding parameter number */ +static char * is_formal( const char * name, int conv); + /* If formal parameter, save the number */ +static char * def_stringization( char * repl_cur); + /* Define stringization */ +static char * mgtoken_save( const char * macroname); + /* Prefix DEF_MAGIC to macro name in repl-text */ +static char * str_parm_scan( char * string_end); + /* Scan the parameter in quote */ +static void do_undef( void); + /* Process #undef directive */ +static void dump_repl( const DEFBUF * dp, SIOHandle * fp, int gcc2_va); + /* Dump replacement text */ + +/* + * Generate (by hand-inspection) a set of unique values for each directive. + * MCPP won't compile if there are hash conflicts. + */ +#define L_if ('i' ^ (EOS << 1)) +#define L_ifdef ('i' ^ ('d' << 1)) +#define L_ifndef ('i' ^ ('n' << 1)) +#define L_elif ('e' ^ ('i' << 1)) +#define L_else ('e' ^ ('s' << 1)) +#define L_endif ('e' ^ ('d' << 1)) +#define L_define ('d' ^ ('f' << 1)) +#define L_undef ('u' ^ ('d' << 1)) +#define L_line ('l' ^ ('n' << 1)) +#define L_include ('i' ^ ('c' << 1)) +#if COMPILER == GNUC +#define L_include_next ('i' ^ ('c' << 1) ^ ('_' << 1)) +#endif +#if SYSTEM == SYS_MAC +#define L_import ('i' ^ ('p' << 1)) +#endif +#define L_error ('e' ^ ('r' << 1)) +#define L_pragma ('p' ^ ('a' << 1)) + +static const char * const not_ident + = "Not an identifier \"%s\""; /* _E_ */ +static const char * const no_arg = "No argument"; /* _E_ */ +static const char * const excess + = "Excessive token sequence \"%s\""; /* _E_ _W1_ */ + +void directive( void) +/* + * Process #directive lines. Each directive have their own subroutines. + */ +{ + const char * const many_nesting = +"More than %.0s%ld nesting of #if (#ifdef) sections%s"; /* _F_ _W4_ _W8_ */ + const char * const not_in_section + = "Not in a #if (#ifdef) section in a source file"; /* _E_ _W1_ */ + const char * const illeg_dir + = "Illegal #directive \"%s%.0ld%s\""; /* _E_ _W1_ _W8_ */ + const char * const in_skipped = " (in skipped block)"; /* _W8_ */ + FILEINFO * file; + int token_type; + int hash; + int c; + const char * tp; + + g_internal_data->in_directive = TRUE; + if (g_internal_data->keep_comments) { + mcpp_fputc( '\n', DEST_OUT); /* Possibly flush out comments */ + g_internal_data->newlines--; + } + c = skip_ws(); + if (c == '\n') /* 'null' directive */ + goto ret; + token_type = scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end); + if (g_internal_data->in_asm && (token_type != NAM + || (! str_eq( g_internal_data->identifier, "asm") + && ! str_eq( g_internal_data->identifier, "endasm")))) + /* In #asm block, ignore #anything other than #asm or #endasm */ + goto skip_line; + if (token_type != NAM) { + if (g_internal_data->mcpp_mode == OLD_PREP && token_type == NUM) { /* # 123 [fname]*/ + strcpy( g_internal_data->identifier, "line"); + } else { + if (compiling) { + if (g_internal_data->option_flags.lang_asm) { + if (g_internal_data->warn_level & 1) + cwarn( illeg_dir, g_internal_data->work_buf, 0L, NULL); + } else { + cerror( illeg_dir, g_internal_data->work_buf, 0L, NULL); + } + } else if (g_internal_data->warn_level & 8) { + cwarn( illeg_dir, g_internal_data->work_buf, 0L, in_skipped); + } + goto skip_line; + } + } + hash = (g_internal_data->identifier[ 1] == EOS) ? g_internal_data->identifier[ 0] + : (g_internal_data->identifier[ 0] ^ (g_internal_data->identifier[ 2] << 1)); + if (strlen( g_internal_data->identifier) > 7) + hash ^= (g_internal_data->identifier[ 7] << 1); + + /* hash is set to a unique value corresponding to the directive.*/ + switch (hash) { + case L_if: tp = "if"; break; + case L_ifdef: tp = "ifdef"; break; + case L_ifndef: tp = "ifndef"; break; + case L_elif: tp = "elif"; break; + case L_else: tp = "else"; break; + case L_endif: tp = "endif"; break; + case L_define: tp = "define"; break; + case L_undef: tp = "undef"; break; + case L_line: tp = "line"; break; + case L_include: tp = "include"; break; +#if COMPILER == GNUC + case L_include_next: tp = "include_next"; break; +#endif +#if SYSTEM == SYS_MAC + case L_import: tp = "import"; break; +#endif + case L_error: tp = "error"; break; + case L_pragma: tp = "pragma"; break; + default: tp = NULL; break; + } + + if (tp != NULL && ! str_eq( g_internal_data->identifier, tp)) { /* Hash conflict*/ + hash = 0; /* Unknown directive, will */ + tp = NULL; /* be handled by do_old() */ + } + + if (! compiling) { /* Not compiling now */ + switch (hash) { + case L_elif : + if (! g_internal_data->standard) { + if (g_internal_data->warn_level & 8) + do_old(); /* Unknown directive */ + goto skip_line; /* Skip the line */ + } /* Else fall through */ + case L_else : /* Test the #if's nest, if 0, compile */ + case L_endif: /* Un-nest #if */ + break; + case L_if : /* These can't turn */ + case L_ifdef: /* compilation on, but */ + case L_ifndef : /* we must nest #if's.*/ + if (&g_internal_data->ifstack[ BLK_NEST] < ++g_internal_data->ifptr) + goto if_nest_err; + if (g_internal_data->standard && (g_internal_data->warn_level & 8) + && &g_internal_data->ifstack[ g_internal_data->std_limits.blk_nest + 1] == g_internal_data->ifptr) + cwarn( many_nesting, NULL, (long) g_internal_data->std_limits.blk_nest + , in_skipped); + g_internal_data->ifptr->stat = 0; /* !WAS_COMPILING */ + g_internal_data->ifptr->ifline = g_internal_data->src_line; /* Line at section start*/ + goto skip_line; + default : /* Other directives */ + if (tp == NULL && (g_internal_data->warn_level & 8)) + do_old(); /* Unknown directive ? */ + goto skip_line; /* Skip the line */ + } + } + + g_internal_data->macro_line = 0; /* Reset error flag */ + file = g_internal_data->infile; /* Remember the current file */ + + switch (hash) { + + case L_if: + case L_ifdef: + case L_ifndef: + if (&g_internal_data->ifstack[ BLK_NEST] < ++g_internal_data->ifptr) + goto if_nest_err; + if (g_internal_data->standard && (g_internal_data->warn_level & 4) && + &g_internal_data->ifstack[ g_internal_data->std_limits.blk_nest + 1] == g_internal_data->ifptr) + cwarn( many_nesting, NULL , (long) g_internal_data->std_limits.blk_nest, NULL); + g_internal_data->ifptr->stat = WAS_COMPILING; + g_internal_data->ifptr->ifline = g_internal_data->src_line; + goto ifdo; + + case L_elif: + if (! g_internal_data->standard) { + do_old(); /* Unrecognized directive */ + break; + } + if (g_internal_data->ifptr == &g_internal_data->ifstack[0]) + goto nest_err; + if (g_internal_data->ifptr == g_internal_data->infile->initif) { + goto in_file_nest_err; + } + if (g_internal_data->ifptr->stat & ELSE_SEEN) + goto else_seen_err; + if ((g_internal_data->ifptr->stat & (WAS_COMPILING | TRUE_SEEN)) != WAS_COMPILING) { + compiling = FALSE; /* Done compiling stuff */ + goto skip_line; /* Skip this group */ + } + hash = L_if; +ifdo: + c = do_if( hash, tp); + if (g_internal_data->mcpp_debug & IF) { + mcpp_fprintf( DEST_DBG + , "#if (#elif, #ifdef, #ifndef) evaluate to %s.\n" + , compiling ? "TRUE" : "FALSE"); + mcpp_fprintf( DEST_DBG, "line %ld: %s", g_internal_data->src_line, g_internal_data->infile->buffer); + } + if (c == FALSE) { /* Error */ + compiling = FALSE; /* Skip this group */ + goto skip_line; /* Prevent an extra error message */ + } + break; + + case L_else: + if (g_internal_data->ifptr == &g_internal_data->ifstack[0]) + goto nest_err; + if (g_internal_data->ifptr == g_internal_data->infile->initif) { + if (g_internal_data->standard) + goto in_file_nest_err; + else if (g_internal_data->warn_level & 1) + cwarn( not_in_section, NULL, 0L, NULL); + } + if (g_internal_data->ifptr->stat & ELSE_SEEN) + goto else_seen_err; + g_internal_data->ifptr->stat |= ELSE_SEEN; + g_internal_data->ifptr->elseline = g_internal_data->src_line; + if (g_internal_data->ifptr->stat & WAS_COMPILING) { + if (compiling || (g_internal_data->ifptr->stat & TRUE_SEEN) != 0) + compiling = FALSE; + else + compiling = TRUE; + } + if ((g_internal_data->mcpp_debug & MACRO_CALL) && (g_internal_data->ifptr->stat & WAS_COMPILING)) { + sync_linenum(); + mcpp_fprintf( DEST_OUT, "/*else %ld:%c*/\n", g_internal_data->src_line + , compiling ? 'T' : 'F'); /* Show that #else is seen */ + } + break; + + case L_endif: + if (g_internal_data->ifptr == &g_internal_data->ifstack[0]) + goto nest_err; + if (g_internal_data->ifptr <= g_internal_data->infile->initif) { + if (g_internal_data->standard) + goto in_file_nest_err; + else if (g_internal_data->warn_level & 1) + cwarn( not_in_section, NULL, 0L, NULL); + } + if (! compiling && (g_internal_data->ifptr->stat & WAS_COMPILING)) + g_internal_data->wrong_line = TRUE; + compiling = (g_internal_data->ifptr->stat & WAS_COMPILING); + if ((g_internal_data->mcpp_debug & MACRO_CALL) && compiling) { + sync_linenum(); + mcpp_fprintf( DEST_OUT, "/*endif %ld*/\n", g_internal_data->src_line); + /* Show that #if block has ended */ + } + --g_internal_data->ifptr; + break; + + case L_define: + do_define( FALSE, 0); + break; + + case L_undef: + do_undef(); + break; + + case L_line: + if ((c = do_line()) > 0) { + g_internal_data->src_line = c; + sharp( NULL, 0); /* Putout the new line number and file name */ + g_internal_data->infile->line = --g_internal_data->src_line; /* Next line number is 'src_line' */ + g_internal_data->newlines = -1; + } else { /* Error already diagnosed by do_line() */ + skip_nl(); + } + break; + + case L_include: + g_internal_data->in_include = TRUE; + if (do_include( FALSE) == TRUE && file != g_internal_data->infile) + g_internal_data->newlines = -1; /* File has been included. Clear blank lines */ + g_internal_data->in_include = FALSE; + break; + + case L_error: + if (! g_internal_data->standard) { + do_old(); /* Unrecognized directive */ + break; + } + cerror( g_internal_data->infile->buffer, NULL, 0L, NULL); /* _E_ */ + break; + + case L_pragma: + if (! g_internal_data->standard) { + do_old(); /* Unrecognized directive */ + break; + } + do_pragma(); + g_internal_data->newlines = -1; /* Do not putout excessive '\n' */ + break; + + default: /* Non-Standard or unknown directives */ + do_old(); + break; + } + + switch (hash) { + case L_if : + case L_elif : + case L_define : + case L_line : + goto skip_line; /* To prevent duplicate error message */ +#if COMPILER == GNUC + case L_include_next : + if (file != g_internal_data->infile) /* File has been included */ + g_internal_data->newlines = -1; +#endif +#if SYSTEM == SYS_MAC + case L_import : + if (file != g_internal_data->infile) /* File has been included */ + g_internal_data->newlines = -1; +#endif + case L_error : + if (g_internal_data->standard) + goto skip_line; + /* Else fall through */ + case L_include : + case L_pragma : + if (g_internal_data->standard) + break; /* Already read over the line */ + /* Else fall through */ + default : /* L_else, L_endif, L_undef, etc. */ + if (g_internal_data->mcpp_mode == OLD_PREP) { + /* + * Ignore the rest of the #directive line so you can write + * #if foo + * #endif foo + */ + ; + } else if (skip_ws() != '\n') { +#if COMPILER == GNUC + if (g_internal_data->standard && hash != L_endif) +#else + if (g_internal_data->standard) +#endif + cerror( excess, g_internal_data->infile->bptr-1, 0L, NULL); + else if (g_internal_data->warn_level & 1) + cwarn( excess, g_internal_data->infile->bptr-1, 0L, NULL); + } + skip_nl(); + } + goto ret; + +in_file_nest_err: + cerror( not_in_section, NULL, 0L, NULL); + goto skip_line; +nest_err: + cerror( "Not in a #if (#ifdef) section", NULL, 0L, NULL); /* _E_ */ + goto skip_line; +else_seen_err: + cerror( "Already seen #else at line %.0s%ld" /* _E_ */ + , NULL, g_internal_data->ifptr->elseline, NULL); +skip_line: + skip_nl(); /* Ignore rest of line */ + goto ret; + +if_nest_err: + cfatal( many_nesting, NULL, (long) BLK_NEST, NULL); + +ret: + g_internal_data->in_directive = FALSE; + g_internal_data->keep_comments = g_internal_data->option_flags.c && compiling && !g_internal_data->no_output; + g_internal_data->keep_spaces = g_internal_data->option_flags.k && compiling; + /* keep_spaces is on for #define line even if no_output is TRUE */ + if (! g_internal_data->wrong_line) + g_internal_data->newlines++; +} + +static int do_if( int hash, const char * directive_name) +/* + * Process an #if (#elif), #ifdef or #ifndef. The latter two are straight- + * forward, while #if needs a subroutine to evaluate the expression. + * do_if() is called only if compiling is TRUE. If false, compilation is + * always supressed, so we don't need to evaluate anything. This supresses + * unnecessary warnings. + */ +{ + int c; + int found; + DEFBUF * defp; + + if ((c = skip_ws()) == '\n') { + unget_ch(); + cerror( no_arg, NULL, 0L, NULL); + return FALSE; + } + if (g_internal_data->mcpp_debug & MACRO_CALL) { + sync_linenum(); + mcpp_fprintf( DEST_OUT, "/*%s %ld*/", directive_name, g_internal_data->src_line); + } + if (hash == L_if) { /* #if or #elif */ + unget_ch(); + found = (eval_if() != 0L); /* Evaluate expression */ + if (g_internal_data->mcpp_debug & MACRO_CALL) + g_internal_data->in_if = FALSE; /* 'in_if' is dynamically set in eval_lex() */ + hash = L_ifdef; /* #if is now like #ifdef */ + } else { /* #ifdef or #ifndef */ + if (scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end) != NAM) { + cerror( not_ident, g_internal_data->work_buf, 0L, NULL); + return FALSE; /* Next token is not an identifier */ + } + found = ((defp = look_id( g_internal_data->identifier)) != NULL); /* Look in table*/ + if (g_internal_data->mcpp_debug & MACRO_CALL) { + if (found) + mcpp_fprintf( DEST_OUT, "/*%s*/", defp->name); + } + } + if (found == (hash == L_ifdef)) { + compiling = TRUE; + g_internal_data->ifptr->stat |= TRUE_SEEN; + } else { + compiling = FALSE; + } + if (g_internal_data->mcpp_debug & MACRO_CALL) { + mcpp_fprintf( DEST_OUT, "/*i %c*/\n", compiling ? 'T' : 'F'); + /* Report wheather the directive is evaluated TRUE or FALSE */ + } + return TRUE; +} + +static void sync_linenum( void) +/* + * Put out newlines or #line line to synchronize line number with the + * annotations about #if, #elif, #ifdef, #ifndef, #else or #endif on -K option. + */ +{ + if (g_internal_data->wrong_line || g_internal_data->newlines > 10) { + sharp( NULL, 0); + } else { + while (g_internal_data->newlines-- > 0) + mcpp_fputc('\n', DEST_OUT); + } + g_internal_data->newlines = -1; +} + +static long do_line( void) +/* + * Parse the line to update the line number and "filename" field for the next + * input line. + * Values returned are as follows: + * -1: syntax error or out-of-range error (diagnosed by do_line(), + * eval_num()). + * [1,32767]: legal line number for C90, [1,2147483647] for C99. + * Line number [32768,2147483647] in C90 mode is only warned (not an error). + * do_line() always absorbs the line (except the ). + */ +{ + const char * const not_digits + = "Line number \"%s\" isn't a decimal digits sequence"; /* _E_ _W1_ */ + const char * const out_of_range + = "Line number \"%s\" is out of range of [1,%ld]"; /* _E_ _W1_ */ + int token_type; + VAL_SIGN * valp; + char * save; + int c; + + if ((c = skip_ws()) == '\n') { + cerror( no_arg, NULL, 0L, NULL); + unget_ch(); /* Push back */ + return -1L; /* Line number is not changed */ + } + + if (g_internal_data->standard) { + token_type = get_unexpandable( c, FALSE); + if (g_internal_data->macro_line == MACRO_ERROR) /* Unterminated macro */ + return -1L; /* already diagnosed. */ + if (token_type == NO_TOKEN) /* Macro expanded to 0 token */ + goto no_num; + if (token_type != NUM) + goto illeg_num; + } else if (scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end) != NUM) { + goto illeg_num; + } + for (g_internal_data->workp = g_internal_data->work_buf; *g_internal_data->workp != EOS; g_internal_data->workp++) { + if (! isdigit( *g_internal_data->workp & UCHARMAX)) { + if (g_internal_data->standard) { + cerror( not_digits, g_internal_data->work_buf, 0L, NULL); + return -1L; + } else if (g_internal_data->warn_level & 1) { + cwarn( not_digits, g_internal_data->work_buf, 0L, NULL); + } + } + } + valp = eval_num( g_internal_data->work_buf); /* Evaluate number */ + if (valp->sign == VAL_ERROR) { /* Error diagnosed by eval_num()*/ + return -1; + } else if (g_internal_data->standard + && (g_internal_data->std_limits.line_num < valp->val || valp->val <= 0L)) { + if (valp->val < LINE99LIMIT && valp->val > 0L) { + if (g_internal_data->warn_level & 1) + cwarn( out_of_range, g_internal_data->work_buf, g_internal_data->std_limits.line_num, NULL); + } else { + cerror( out_of_range, g_internal_data->work_buf, g_internal_data->std_limits.line_num, NULL); + return -1L; + } + } + + if (g_internal_data->standard) { + token_type = get_unexpandable( skip_ws(), FALSE); + if (g_internal_data->macro_line == MACRO_ERROR) + return -1L; + if (token_type != STR) { + if (token_type == NO_TOKEN) { /* Filename is absent */ + return (long) valp->val; + } else { /* Expanded macro should be a quoted string */ + goto not_fname; + } + } + } else { + if ((c = skip_ws()) == '\n') { + unget_ch(); + return (long) valp->val; + } + if (scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end) != STR) + goto not_fname; + } +#if COMPILER == GNUC + if (memcmp( g_internal_data->workp - 3, "//", 2) == 0) { /* "/cur-dir//" */ + save = g_internal_data->infile->filename; /* Do not change the file name */ + } else +#endif + { + *(g_internal_data->workp - 1) = EOS; /* Ignore right '"' */ + save = save_string( &g_internal_data->work_buf[ 1]); /* Ignore left '"' */ + } + + if (g_internal_data->standard) { + if (get_unexpandable( skip_ws(), FALSE) != NO_TOKEN) { + cerror( excess, g_internal_data->work_buf, 0L, NULL); + free( save); + return -1L; + } + } else if (g_internal_data->mcpp_mode == OLD_PREP) { + skip_nl(); + unget_ch(); + } else if ((c = skip_ws()) == '\n') { + unget_ch(); + } else { + if (g_internal_data->warn_level & 1) { + scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end); + cwarn( excess, g_internal_data->work_buf, 0, NULL); + } + skip_nl(); + unget_ch(); + } + + if (g_internal_data->infile->filename) + free( g_internal_data->infile->filename); + g_internal_data->infile->filename = save; /* New file name */ + /* Note that this does not change g_internal_data->infile->real_fname */ + return (long) valp->val; /* New line number */ + +no_num: + cerror( "No line number", NULL, 0L, NULL); /* _E_ */ + return -1L; +illeg_num: + cerror( "Not a line number \"%s\"", g_internal_data->work_buf, 0L, NULL); /* _E_ */ + return -1L; +not_fname: + cerror( "Not a file name \"%s\"", g_internal_data->work_buf, 0L, NULL); /* _E_ */ + return -1L; +} + +/* + * M a c r o D e f i n i t i o n s + */ + +/* + * look_id() Looks for the name in the defined symbol table. Returns a + * pointer to the definition if found, or NULL if not present. + * install_macro() Installs the definition. Updates the symbol table. + * undefine() Deletes the definition from the symbol table. + */ + +/* + * Global work_buf[] are used to store #define parameter lists and + * parms[].name point to them. + * 'nargs' contains the actual number of parameters stored. + */ +typedef struct { + char * name; /* -> Start of each parameter */ + size_t len; /* Length of parameter name */ +} PARM; +static PARM parms[ NMACPARS]; +static int nargs; /* Number of parameters */ +static char * token_p; /* Pointer to the token scanned */ +static char * repl_base; /* Base of buffer for repl-text */ +static char * repl_end; /* End of buffer for repl-text */ +static const char * const no_ident = "No identifier"; /* _E_ */ +#if COMPILER == GNUC +static int gcc2_va_arg; /* GCC2-spec variadic macro */ +#endif + +DEFBUF * do_define( + int ignore_redef, /* Do not redefine */ + int predefine /* Predefine compiler-specific name */ + /* + * Note: The value of 'predefine' should be one of 0, DEF_NOARGS_PREDEF + * or DEF_NOARGS_PREDEF_OLD, the other values cause errors. + */ +) +/* + * Called from directive() when a #define is scanned or called from + * do_options() when a -D option is scanned. This module parses formal + * parameters by get_parm() and the replacement text by get_repl(). + * + * There is some special case code to distinguish + * #define foo bar -- object-like macro + * from #define foo() bar -- function-like macro with no parameter + * + * Also, we make sure that + * #define foo foo + * expands to "foo" but doesn't put MCPP into an infinite loop. + * + * A warning is printed if you redefine a symbol with a non-identical + * text. I.e, + * #define foo 123 + * #define foo 123 + * is ok, but + * #define foo 123 + * #define foo +123 + * is not. + * + * The following subroutines are called from do_define(): + * get_parm() parsing and remembering parameter names. + * get_repl() parsing and remembering replacement text. + * + * The following subroutines are called from get_repl(): + * is_formal() is called when an identifier is scanned. It checks through + * the array of formal parameters. If a match is found, the + * identifier is replaced by a control byte which will be used + * to locate the parameter when the macro is expanded. + * def_stringization() is called when '#' operator is scanned. It surrounds + * the token to stringize with magic-codes. + * + * modes other than STD ignore difference of parameter names in macro + * redefinition. + */ +{ + const char * const predef = "\"%s\" shouldn't be redefined"; /* _E_ */ + char repl_list[ NMACWORK + IDMAX]; /* Replacement text */ + char macroname[ IDMAX + 1]; /* Name of the macro defining */ + DEFBUF * defp; /* -> Old definition */ + DEFBUF ** prevp; /* -> Pointer to previous def in list */ + int c; + int redefined; /* TRUE if redefined */ + int dnargs = 0; /* defp->nargs */ + int cmp; /* Result of name comparison */ + size_t def_start = 0; /* Column of macro definition */ + size_t def_end = 0; /* Column of macro definition */ + + repl_base = repl_list; + repl_end = & repl_list[ NMACWORK]; + c = skip_ws(); + if ((g_internal_data->mcpp_debug & MACRO_CALL) && g_internal_data->src_line) /* Start of definition */ + def_start = g_internal_data->infile->bptr - g_internal_data->infile->buffer - 1; + if (c == '\n') { + cerror( no_ident, NULL, 0L, NULL); + unget_ch(); + return NULL; + } else if (scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end) != NAM) { + cerror( not_ident, g_internal_data->work_buf, 0L, NULL); + return NULL; + } else { + prevp = look_prev( g_internal_data->identifier, &cmp); + /* Find place in the macro list to insert the definition */ + defp = *prevp; + if (g_internal_data->standard) { + if (cmp || defp->push) { /* Not known or 'pushed' macro */ + if (str_eq( g_internal_data->identifier, "defined") + || ((g_internal_data->stdc_val || g_internal_data->cplus_val) + && str_eq( g_internal_data->identifier, "__VA_ARGS__"))) { + cerror( + "\"%s\" shouldn't be defined", g_internal_data->identifier, 0L, NULL); /* _E_ */ + return NULL; + } + redefined = FALSE; /* Quite new definition */ + } else { /* It's known: */ + if (ignore_redef) + return defp; + dnargs = (defp->nargs == DEF_NOARGS_STANDARD + || defp->nargs == DEF_NOARGS_PREDEF + || defp->nargs == DEF_NOARGS_PREDEF_OLD) + ? DEF_NOARGS : defp->nargs; + if (dnargs <= DEF_NOARGS_DYNAMIC /* __FILE__ and such */ + || dnargs == DEF_PRAGMA /* _Pragma() pseudo-macro */ + ) { + cerror( predef, g_internal_data->identifier, 0L, NULL); + return NULL; + } else { + redefined = TRUE; /* Remember this fact */ + } + } + } else { + if (cmp) { + redefined = FALSE; /* Quite new definition */ + } else { /* It's known: */ + if (ignore_redef) + return defp; + dnargs = (defp->nargs == DEF_NOARGS_STANDARD + || defp->nargs == DEF_NOARGS_PREDEF + || defp->nargs == DEF_NOARGS_PREDEF_OLD) + ? DEF_NOARGS : defp->nargs; + redefined = TRUE; + } + } + } + strcpy( macroname, g_internal_data->identifier); /* Remember the name */ + + g_internal_data->in_define = TRUE; /* Recognize '#', '##' */ + if (get_parm() == FALSE) { /* Get parameter list */ + g_internal_data->in_define = FALSE; + return NULL; /* Syntax error */ + } + if (get_repl( macroname) == FALSE) { /* Get replacement text */ + g_internal_data->in_define = FALSE; + return NULL; /* Syntax error */ + } + if ((g_internal_data->mcpp_debug & MACRO_CALL) && g_internal_data->src_line) { + /* Remember location on source */ + char * cp; + cp = g_internal_data->infile->bptr - 1; /* Before '\n' */ + while (g_internal_data->char_type[ *cp & UCHARMAX] & HSP) + cp--; /* Trailing space */ + cp++; /* Just after the last token */ + def_end = cp - g_internal_data->infile->buffer; /* End of definition */ + } + + g_internal_data->in_define = FALSE; + if (redefined) { + if (dnargs != nargs || ! str_eq( defp->repl, repl_list) + || (g_internal_data->mcpp_mode == STD && ! str_eq( defp->parmnames, g_internal_data->work_buf)) + ) { /* Warn if differently redefined */ + if (g_internal_data->warn_level & 1) { + cwarn( + "The macro is redefined", NULL, 0L, NULL); /* _W1_ */ + if (! g_internal_data->option_flags.no_source_line) + dump_a_def( " previously macro", defp, FALSE, TRUE + , g_internal_data->fp_err); + } + } else { /* Identical redefinition */ + return defp; + } + } /* Else new or re-definition*/ + defp = install_macro( macroname, nargs, g_internal_data->work_buf, repl_list, prevp, cmp + , predefine); + if ((g_internal_data->mcpp_debug & MACRO_CALL) && g_internal_data->src_line) { + /* Get location on source file */ + LINE_COL s_line_col, e_line_col; + s_line_col.line = g_internal_data->src_line; + s_line_col.col = def_start; + get_src_location( & s_line_col); + /* Convert to pre-line-splicing data */ + e_line_col.line = g_internal_data->src_line; + e_line_col.col = def_end; + get_src_location( & e_line_col); + /* Putout the macro definition information embedded in comment */ + mcpp_fprintf( DEST_OUT, "/*m%s %ld:%d-%ld:%d*/\n", defp->name + , s_line_col.line, s_line_col.col + , e_line_col.line, e_line_col.col); + g_internal_data->wrong_line = TRUE; /* Need #line later */ + } + if (g_internal_data->mcpp_mode == STD && g_internal_data->cplus_val && id_operator( macroname) + && (g_internal_data->warn_level & 1)) + /* These are operators, not identifiers, in C++98 */ + cwarn( "\"%s\" is defined as macro", macroname /* _W1_ */ + , 0L, NULL); + return defp; +} + +static int get_parm( void) +/* + * Get parameters i.e. numbers into nargs, name into work_buf[], name-length + * into parms[].len. parms[].name point into work_buf. + * Return TRUE if the parameters are legal, else return FALSE. + * In STD mode preprocessor must remember the parameter names, only for + * checking the validity of macro redefinitions. This is required by the + * Standard (what an overhead !). + */ +{ + const char * const many_parms + = "More than %.0s%ld parameters"; /* _E_ _W4_ */ + const char * const illeg_parm + = "Illegal parameter \"%s\""; /* _E_ */ + const char * const misplaced_ellip + = "\"...\" isn't the last parameter"; /* _E_ */ + int token_type; + int c; + + parms[ 0].name = g_internal_data->workp = g_internal_data->work_buf; + g_internal_data->work_buf[ 0] = EOS; +#if COMPILER == GNUC + gcc2_va_arg = FALSE; +#endif + + /* POST_STD mode */ + g_internal_data->insert_sep = NO_SEP; /* Clear the inserted token separator */ + c = get_ch(); + + if (c == '(') { /* With arguments? */ + nargs = 0; /* Init parms counter */ + if (skip_ws() == ')') + return TRUE; /* Macro with 0 parm */ + else + unget_ch(); + + do { /* Collect parameters */ + if (nargs >= NMACPARS) { + cerror( many_parms, NULL, (long) NMACPARS, NULL); + return FALSE; + } + parms[ nargs].name = g_internal_data->workp; /* Save its start */ + if ((token_type = scan_token( c = skip_ws(), &g_internal_data->workp, g_internal_data->work_end)) + != NAM) { + if (c == '\n') { + break; + } else if (c == ',' || c == ')') { + cerror( "Empty parameter", NULL, 0L, NULL); /* _E_ */ + return FALSE; + } else if (g_internal_data->standard && (g_internal_data->stdc_val || g_internal_data->cplus_val) + && token_type == OPE && g_internal_data->openum == OP_ELL) { + /* + * Enable variable argument macro which is a feature of + * C99. We enable this even on C90 or C++ for GCC + * compatibility. + */ + if (skip_ws() != ')') { + cerror( misplaced_ellip, NULL, 0L, NULL); + return FALSE; + } + parms[ nargs++].len = 3; + nargs |= VA_ARGS; + goto ret; + } else { + cerror( illeg_parm, parms[ nargs].name, 0L, NULL); + return FALSE; /* Bad parameter syntax */ + } + } + if (g_internal_data->standard && (g_internal_data->stdc_val || g_internal_data->cplus_val) + && str_eq( g_internal_data->identifier, "__VA_ARGS__")) { + cerror( illeg_parm, parms[ nargs].name, 0L, NULL); + return FALSE; + /* __VA_ARGS__ should not be used as a parameter */ + } + if (is_formal( parms[ nargs].name, FALSE)) { + cerror( "Duplicate parameter name \"%s\"" /* _E_ */ + , parms[ nargs].name, 0L, NULL); + return FALSE; + } + parms[ nargs].len = (size_t) (g_internal_data->workp - parms[ nargs].name); + /* Save length of param */ + *g_internal_data->workp++ = ','; + nargs++; + } while ((c = skip_ws()) == ','); /* Get another parameter*/ + + *--g_internal_data->workp = EOS; /* Remove excessive ',' */ + if (c != ')') { /* Must end at ) */ +#if COMPILER == GNUC + /* Handle GCC2 variadic params like par... */ + char * tp = g_internal_data->workp; + if (g_internal_data->mcpp_mode == STD + &&(token_type = scan_token( c, &g_internal_data->workp, g_internal_data->work_end)) == OPE + && g_internal_data->openum == OP_ELL) { + if ((c = skip_ws()) != ')') { + cerror( misplaced_ellip, NULL, 0L, NULL); + return FALSE; + } + *tp = EOS; /* Remove "..." */ + nargs |= VA_ARGS; + gcc2_va_arg = TRUE; + goto ret; + } +#endif + unget_ch(); /* Push back '\n' */ + cerror( + "Missing \",\" or \")\" in parameter list \"(%s\"" /* _E_ */ + , g_internal_data->work_buf, 0L, NULL); + return FALSE; + } + } else { + /* + * DEF_NOARGS is needed to distinguish between + * "#define foo" and "#define foo()". + */ + nargs = DEF_NOARGS; /* Object-like macro */ + unget_ch(); + } +ret: +#if NMACPARS > NMACPARS90MIN + if ((g_internal_data->warn_level & 4) && (nargs & ~AVA_ARGS) > g_internal_data->std_limits.n_mac_pars) + cwarn( many_parms, NULL , (long) g_internal_data->std_limits.n_mac_pars, NULL); +#endif + return TRUE; +} + +static int get_repl( + const char * macroname +) +/* + * Get replacement text i.e. names of formal parameters are converted to + * the magic numbers, and operators #, ## is converted to magic characters. + * Return TRUE if replacement list is legal, else return FALSE. + * Any token separator in the text is converted to a single space, no token + * sepatator is inserted by MCPP. Those are required by the Standard for + * stringizing of an argument by # operator. + * In POST_STD mode, inserts a space between any tokens in source (except a + * macro name and the next '(' in macro definition), hence presence or absence + * of token separator makes no difference. + */ +{ + const char * const mixed_ops + = "Macro with mixing of ## and # operators isn't portable"; /* _W4_ */ + const char * const multiple_cats + = "Macro with multiple ## operators isn't portable"; /* _W4_ */ + char * prev_token = NULL; /* Preceding token */ + char * prev_prev_token = NULL; /* Pre-preceding token */ + int multi_cats = FALSE; /* Multiple ## operators*/ + int c; + int token_type; /* Type of token */ + char * temp; + char * repl_cur = repl_base; /* Pointer into repl-text buffer*/ + + *repl_cur = EOS; + token_p = NULL; + if (g_internal_data->mcpp_mode == STD) { + c = get_ch(); + unget_ch(); + if (((g_internal_data->char_type[ c] & SPA) == 0) && (nargs < 0) && (g_internal_data->warn_level & 1)) + cwarn( "No space between macro name \"%s\" and repl-text"/* _W1_ */ + , macroname, 0L, NULL); + } + c = skip_ws(); /* Get to the body */ + + while (c != '\n') { + if (g_internal_data->standard) { + prev_prev_token = prev_token; + prev_token = token_p; + } + token_p = repl_cur; /* Remember the pointer */ + token_type = scan_token( c, &repl_cur, repl_end); + + switch (token_type) { + case OPE: /* Operator or punctuator */ + if (! g_internal_data->standard) + break; + switch (g_internal_data->openum) { + case OP_CAT: /* ## */ + if (prev_token == NULL) { + cerror( "No token before ##" /* _E_ */ + , NULL, 0L, NULL); + return FALSE; + } else if (*prev_token == CAT) { + cerror( "## after ##", NULL, 0L, NULL); /* _E_ */ + return FALSE; + } else if (prev_prev_token && *prev_prev_token == CAT) { + multi_cats = TRUE; + } else if (prev_prev_token && *prev_prev_token == ST_QUOTE + && (g_internal_data->warn_level & 4)) { /* # parm ## */ + cwarn( mixed_ops, NULL, 0L, NULL); + } + repl_cur = token_p; + *repl_cur++ = CAT; /* Convert to CAT */ + break; + case OP_STR: /* # */ + if (nargs < 0) /* In object-like macro */ + break; /* '#' is an usual char */ + if (prev_token && *prev_token == CAT + && (g_internal_data->warn_level & 4)) /* ## # */ + cwarn( mixed_ops, NULL, 0L, NULL); + repl_cur = token_p; /* Overwrite on # */ + if ((temp = def_stringization( repl_cur)) == NULL) { + return FALSE; /* Error */ + } else { + repl_cur = temp; + } + break; + default: /* Any operator as it is */ + break; + } + break; + case NAM: + /* + * Replace this name if it's a parm. Note that the macro name is a + * possible replacement token. We stuff DEF_MAGIC in front of the + * token which is treated as a LETTER by the token scanner and eaten + * by the macro expanding routine. This prevents the macro expander + * from looping if someone writes "#define foo foo". + */ + temp = is_formal( g_internal_data->identifier, TRUE); + if (temp == NULL) { /* Not a parameter name */ + if (! g_internal_data->standard) + break; + if ((g_internal_data->stdc_val || g_internal_data->cplus_val) + && str_eq( g_internal_data->identifier, "__VA_ARGS__")) { +#if COMPILER == GNUC + if (gcc2_va_arg) { + cerror( "\"%s\" cannot be used in GCC2-spec variadic macro" /* _E_ */ + , g_internal_data->identifier, 0L, NULL); + return FALSE; + } +#endif + cerror( "\"%s\" without corresponding \"...\"" /* _E_ */ + , g_internal_data->identifier, 0L, NULL); + return FALSE; + } + if ((temp = mgtoken_save( macroname)) != NULL) + repl_cur = temp; /* Macro name */ + } else { /* Parameter name */ + repl_cur = temp; +#if COMPILER == GNUC + if (g_internal_data->mcpp_mode == STD && (nargs & VA_ARGS) + && *(repl_cur - 1) == (nargs & ~AVA_ARGS)) { + if (! str_eq( g_internal_data->identifier, "__VA_ARGS__") + && (g_internal_data->warn_level & 2)) + cwarn( + "GCC2-spec variadic macro is defined" /* _W2_ */ + , NULL, 0L, NULL); + if (prev_token && *prev_token == CAT + && prev_prev_token && *prev_prev_token == ',') + /* ", ## __VA_ARGS__" is sequence peculiar */ + /* to GCC3-spec variadic macro. */ + /* Or ", ## last_arg" is sequence peculiar */ + /* to GCC2-spec variadic macro. */ + nargs |= GVA_ARGS; + /* Mark as sequence peculiar to GCC */ + /* This will be warned at expansion time */ + } +#endif + } + break; + + case STR: /* String in mac. body */ + case CHR: /* Character constant */ + if (g_internal_data->mcpp_mode == OLD_PREP) + repl_cur = str_parm_scan( repl_cur); + break; + case SEP: + if (g_internal_data->mcpp_mode == OLD_PREP && c == COM_SEP) + repl_cur--; /* Skip comment now */ + break; + default: /* Any token as it is */ + break; + } + + if ((c = get_ch()) == ' ' || c == '\t') { + *repl_cur++ = ' '; /* Space */ + while ((c = get_ch()) == ' ' || c == '\t') + ; /* Skip excessive spaces */ + } + } + + while (repl_base < repl_cur + && (*(repl_cur - 1) == ' ' || *(repl_cur - 1) == '\t')) + repl_cur--; /* Remove trailing spaces */ + *repl_cur = EOS; /* Terminate work */ + + unget_ch(); /* For syntax check */ + if (g_internal_data->standard) { + if (token_p && *token_p == CAT) { + cerror( "No token after ##", NULL, 0L, NULL); /* _E_ */ + return FALSE; + } + if (multi_cats && (g_internal_data->warn_level & 4)) + cwarn( multiple_cats, NULL, 0L, NULL); + if ((nargs & VA_ARGS) && g_internal_data->stdc_ver < 199901L && (g_internal_data->warn_level & 2)) + /* Variable arg macro is the spec of C99, not C90 nor C++98 */ + cwarn( "Variable argument macro is defined", /* _W2_ */ + NULL, 0L, NULL); + } + + return TRUE; +} + +static char * is_formal( + const char * name, + int conv /* Convert to magic number? */ +) +/* + * If the identifier is a formal parameter, save the MAC_PARM and formal + * offset, returning the advanced pointer into the replacement text. + * Else, return NULL. + */ +{ + char * repl_cur; + const char * va_arg = "__VA_ARGS__"; + PARM parm; + size_t len; + int i; + + len = strlen( name); + for (i = 0; i < (nargs & ~AVA_ARGS); i++) { /* For each parameter */ + parm = parms[ i]; + if ((len == parm.len + /* Note: parms[].name are comma separated */ + && memcmp( name, parm.name, parm.len) == 0) + || (g_internal_data->standard && (nargs & VA_ARGS) + && i == (nargs & ~AVA_ARGS) - 1 && conv + && str_eq( name, va_arg))) { /* __VA_ARGS__ */ + /* If it's known */ +#if COMPILER == GNUC + if (gcc2_va_arg && str_eq( name, va_arg)) + return NULL; /* GCC2 variadic macro */ +#endif + if (conv) { + repl_cur = token_p; /* Overwrite on the name*/ + *repl_cur++ = MAC_PARM; /* Save the signal */ + *repl_cur++ = (char)(i + 1); /* Save the parm number */ + return repl_cur; /* Return "gotcha" */ + } else { + return parm.name; /* Duplicate parm name */ + } + } + } + + return NULL; /* Not a formal param */ +} + +static char * def_stringization( char * repl_cur) +/* + * Define token stringization. + * We store a magic cookie (which becomes surrouding " on expansion) preceding + * the parameter as an operand of # operator. + * Return the current pointer into replacement text if the token following # + * is a parameter name, else return NULL. + */ +{ + int c; + char * temp; + + *repl_cur++ = ST_QUOTE; /* Prefix */ + if (g_internal_data->char_type[ c = get_ch()] & HSP) { /* There is a space */ + *repl_cur++ = ' '; + while (g_internal_data->char_type[ c = get_ch()] & HSP) /* Skip excessive spaces*/ + ; + } + token_p = repl_cur; /* Remember the pointer */ + if (scan_token( c, &repl_cur, repl_end) == NAM) { + if ((temp = is_formal( g_internal_data->identifier, TRUE)) != NULL) { + repl_cur = temp; + return repl_cur; + } + } + cerror( "Not a formal parameter \"%s\"", token_p, 0L, NULL); /* _E_ */ + return NULL; +} + +static char * mgtoken_save( const char * macroname) +/* + * A magic cookie is inserted if the token is identical to the macro name, + * so the expansion doesn't recurse. + * Return the advanced pointer into the replacement text or NULL. + */ +{ + char * repl_cur; + + if (str_eq( macroname, g_internal_data->identifier)) { /* Macro name in body */ + repl_cur = token_p; /* Overwrite on token */ + *repl_cur++ = DEF_MAGIC; /* Save magic marker */ + repl_cur = stpcpy( repl_cur, g_internal_data->identifier); + /* And save the token */ + return repl_cur; + } else { + return NULL; + } +} + +static char * str_parm_scan( char * string_end) +/* + * String parameter scan. + * This code -- if enabled -- recognizes a formal parameter in a string + * literal or in a character constant. + * #define foo(bar, v) printf("%bar\n", v) + * foo( d, i) + * expands to: + * printf("%d\n", i) + * str_parm_scan() return the advanced pointer into the replacement text. + * This has been superceded by # stringizing and string concatenation. + * This routine is called only in OLD_PREP mode. + */ +{ + int delim; + int c; + char * tp; + char * wp; /* Pointer into the quoted literal */ + + delim = *token_p; + unget_string( ++token_p, NULL); + /* Pseudo-token-parsing in a string literal */ + wp = token_p; + while ((c = get_ch()) != delim) { + token_p = wp; + if (scan_token( c, &wp, string_end) != NAM) + continue; + if ((tp = is_formal( token_p, TRUE)) != NULL) + wp = tp; + } + *wp++ = (char)delim; + return wp; +} + +static void do_undef( void) +/* + * Remove the symbol from the defined list. + * Called from directive(). + */ +{ + DEFBUF * defp; + int c; + + if ((c = skip_ws()) == '\n') { + cerror( no_ident, NULL, 0L, NULL); + unget_ch(); + return; + } + if (scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end) != NAM) { + cerror( not_ident, g_internal_data->work_buf, 0L, NULL); + skip_nl(); + unget_ch(); + } else { + if ((defp = look_id( g_internal_data->identifier)) == NULL) { + if (g_internal_data->warn_level & 8) + cwarn( "\"%s\" wasn't defined" /* _W8_ */ + , g_internal_data->identifier, 0L, NULL); + } else if (g_internal_data->standard && (defp->nargs <= DEF_NOARGS_STANDARD + /* Standard predef */ + || defp->nargs == DEF_PRAGMA)) { + /* _Pragma() pseudo-macro */ + cerror( "\"%s\" shouldn't be undefined" /* _E_ */ + , g_internal_data->identifier, 0L, NULL); + } else if (g_internal_data->standard) { + c = skip_ws(); + unget_ch(); + if (c != '\n') /* Trailing junk */ + return; + else + undefine( g_internal_data->identifier); + } else { + undefine( g_internal_data->identifier); + } + } +} + +/* + * C P P S y m b o l T a b l e s + * + * SBSIZE defines the number of hash-table slots for the symbol table. + * It must be a power of 2. + */ + +/* Symbol table queue headers. */ +static DEFBUF * symtab[ SBSIZE]; +static long num_of_macro = 0; + +#if MCPP_LIB +void init_directive( void) +/* Initialize static variables. */ +{ + num_of_macro = 0; +} +#endif + +DEFBUF * look_id( const char * name) +/* + * Look for the identifier in the symbol table. + * If found, return the table pointer; Else return NULL. + */ +{ + DEFBUF ** prevp; + int cmp; + + prevp = look_prev( name, &cmp); + + if (g_internal_data->standard) + return ((cmp == 0 && (*prevp)->push == 0) ? *prevp : NULL); + else + return ((cmp == 0) ? *prevp : NULL); +} + +DEFBUF ** look_prev( + const char * name, /* Name of the macro */ + int * cmp /* Result of comparison */ +) +/* + * Look for the place to insert the macro definition. + * Return a pointer to the previous member in the linked list. + */ +{ + const char * np; + DEFBUF ** prevp; + DEFBUF * dp; + size_t s_name; + int hash; + + for (hash = 0, np = name; *np != EOS; ) + hash += *np++; + hash += (int)(s_name = (size_t)(np - name)); + s_name++; + prevp = & symtab[ hash & SBMASK]; + *cmp = -1; /* Initialize */ + + while ((dp = *prevp) != NULL) { + if ((*cmp = strcmp( dp->name, name)) >= 0) + break; + prevp = &dp->link; + } + + return prevp; +} + +DEFBUF * look_and_install( + const char * name, /* Name of the macro */ + int numargs, /* The numbers of parms */ + const char * parmnames, /* Names of parameters concatenated */ + const char * repl /* Replacement text */ +) +/* + * Look for the name and (re)define it. + * Returns a pointer to the definition block. + * Returns NULL if the symbol was Standard-predefined. + */ +{ + DEFBUF ** prevp; /* Place to insert definition */ + DEFBUF * defp; /* New definition block */ + int cmp; /* Result of comparison of new name and old */ + + prevp = look_prev( name, &cmp); + defp = install_macro( name, numargs, parmnames, repl, prevp, cmp, 0); + return defp; +} + +DEFBUF * install_macro( + const char * name, /* Name of the macro */ + int numargs, /* The numbers of parms */ + const char * parmnames, /* Names of parameters concatenated */ + const char * repl, /* Replacement text */ + DEFBUF ** prevp, /* The place to insert definition */ + int cmp, /* Result of comparison of new name and old */ + int predefine /* Predefined macro without leading '_' */ +) +/* + * Enter this name in the lookup table. + * Returns a pointer to the definition block. + * Returns NULL if the symbol was Standard-predefined. + * Note that predefinedness can be specified by either of 'numargs' or + * 'predefine'. + */ +{ + DEFBUF * dp; + DEFBUF * defp; + size_t s_name, s_parmnames, s_repl; + + defp = *prevp; /* Old definition, if cmp == 0 */ + if (cmp == 0 && defp->nargs < DEF_NOARGS - 1) + return NULL; /* Standard predefined */ + if (parmnames == NULL || repl == NULL || (predefine && numargs > 0) + || (predefine && predefine != DEF_NOARGS_PREDEF + && predefine != DEF_NOARGS_PREDEF_OLD)) + /* Shouldn't happen */ + cfatal( "Bug: Illegal macro installation of \"%s\"" /* _F_ */ + , name, 0L, NULL); /* Use "" instead of NULL */ + s_name = strlen( name); + if (g_internal_data->mcpp_mode == STD) + s_parmnames = strlen( parmnames) + 1; + else + s_parmnames = 0; + s_repl = strlen( repl) + 1; + dp = (DEFBUF *) + xmalloc( sizeof (DEFBUF) + s_name + s_parmnames + s_repl); + if (cmp || (g_internal_data->standard && (*prevp)->push)) { /* New definition */ + dp->link = defp; /* Insert to linked list */ + *prevp = dp; + } else { /* Redefinition */ + dp->link = defp->link; /* Replace old def with new */ + *prevp = dp; + free( defp); + } + dp->nargs = (short)(predefine ? predefine : numargs); + if (g_internal_data->standard) { + dp->push = 0; + dp->parmnames = (char *)dp + sizeof (DEFBUF) + s_name; + dp->repl = dp->parmnames + s_parmnames; + if (g_internal_data->mcpp_mode == STD) + memcpy( dp->parmnames, parmnames, s_parmnames); + } else { + dp->repl = (char *)dp + sizeof (DEFBUF) + s_name; + } + memcpy( dp->name, name, s_name + 1); + memcpy( dp->repl, repl, s_repl); + /* Remember where the macro is defined */ + dp->fname = g_internal_data->cur_fullname; /* Full-path-list of current file */ + dp->mline = g_internal_data->src_line; + if (g_internal_data->standard && cmp && ++num_of_macro == g_internal_data->std_limits.n_macro + 1 + && g_internal_data->std_limits.n_macro && (g_internal_data->warn_level & 4)) + /* '&& std_limits.n_macro' to avoid warning before initialization */ + cwarn( "More than %.0s%ld macros defined" /* _W4_ */ + , NULL , g_internal_data->std_limits.n_macro, NULL); + return dp; +} + +int undefine( + const char * name /* Name of the macro */ +) +/* + * Delete the macro definition from the symbol table. + * Returns TRUE, if deleted; + * Else returns FALSE (when the macro was not defined or was Standard + * predefined). + */ +{ + DEFBUF ** prevp; /* Preceding definition in list */ + DEFBUF * dp; /* Definition to delete */ + int cmp; /* 0 if defined, else not defined */ + + prevp = look_prev( name, &cmp); + dp = *prevp; /* Definition to delete */ + if (cmp || dp->nargs <= DEF_NOARGS_STANDARD) + return FALSE; /* Not defined or Standard predefined */ + if (g_internal_data->standard && dp->push) + return FALSE; /* 'Pushed' macro */ + *prevp = dp->link; /* Link the previous and the next */ + if ((g_internal_data->mcpp_debug & MACRO_CALL) && dp->mline) { + /* Notice this directive unless the macro is predefined */ + mcpp_fprintf( DEST_OUT, "/*undef %ld*//*%s*/\n", g_internal_data->src_line, dp->name); + g_internal_data->wrong_line = TRUE; + } + free( dp); /* Delete the definition */ + if (g_internal_data->standard) + num_of_macro--; + return TRUE; +} + +static void dump_repl( + const DEFBUF * dp, + SIOHandle * fp, + int gcc2_va +) +/* + * Dump replacement text. + */ +{ + int numargs = dp->nargs; + char * cp1; + size_t i; + int c; + const char * cp; + + for (cp = dp->repl; (c = *cp++ & UCHARMAX) != EOS; ) { + + switch (c) { + case MAC_PARM: /* Parameter */ + c = (*cp++ & UCHARMAX) - 1; + if (g_internal_data->standard) { + PARM parm = parms[ c]; + if ((numargs & VA_ARGS) && c == (numargs & ~AVA_ARGS) - 1) { + mcpp_fputs( gcc2_va ? parm.name : "__VA_ARGS__" + , FP2DEST( fp)); + /* gcc2_va is possible only in STD mode */ + } else { + if (g_internal_data->mcpp_mode == STD) { + for (i = 0, cp1 = parm.name; i < parm.len; i++) + mcpp_fputc( *cp1++, FP2DEST( fp)); + } else { + mcpp_fputc( 'a' + c % 26, FP2DEST( fp)); + if (c > 26) + mcpp_fputc( '0' + c / 26, FP2DEST( fp)); + } + } + } else { + mcpp_fputc( 'a' + c % 26, FP2DEST( fp)); + if (c > 26) + mcpp_fputc( '0' + c / 26, FP2DEST( fp)); + } + break; + case DEF_MAGIC: + if (! g_internal_data->standard) + mcpp_fputc( c, FP2DEST( fp)); + /* Else skip */ + break; + case CAT: + if (g_internal_data->standard) + mcpp_fputs( "##", FP2DEST( fp)); + else + mcpp_fputc( c, FP2DEST( fp)); + break; + case ST_QUOTE: + if (g_internal_data->standard) + mcpp_fputs( "#", FP2DEST( fp)); + else + mcpp_fputc( c, FP2DEST( fp)); + break; + case COM_SEP: + /* + * Though TOK_SEP coincides to COM_SEP, this cannot appear in + * Standard mode. + */ + if (g_internal_data->mcpp_mode == OLD_PREP) + mcpp_fputs( "/**/", FP2DEST( fp)); + break; + default: + mcpp_fputc( c, FP2DEST( fp)); + break; + } + } +} + +/* + * If the compiler is so-called "one-pass" compiler, compiler-predefined + * macros are commented out to avoid redefinition. + */ +#if ONE_PASS +#define CAN_REDEF DEF_NOARGS +#else +#define CAN_REDEF DEF_NOARGS_PREDEF +#endif + +void dump_a_def( + const char * why, + const DEFBUF * dp, + int newdef, /* TRUE if parmnames are currently in parms[] */ + int comment, /* Show location of the definition in comment */ + SIOHandle * fp +) +/* + * Dump a macro definition. + */ +{ + char * cp, * cp1; + int numargs = dp->nargs & ~AVA_ARGS; + int commented; /* To be commented out */ + int gcc2_va = FALSE; /* GCC2-spec variadic */ + int i; + + if (g_internal_data->standard && numargs == DEF_PRAGMA) /* _Pragma pseudo-macro */ + return; + if ((numargs < CAN_REDEF) || (g_internal_data->standard && dp->push)) + commented = TRUE; + else + commented = FALSE; + if (! comment && commented) /* For -dM option */ + return; + if (why) + mcpp_fprintf( FP2DEST( fp), "%s \"%s\" defined as: ", why, dp->name); + mcpp_fprintf( FP2DEST( fp), "%s#define %s", commented ? "/* " : "", + dp->name); /* Macro name */ + if (numargs >= 0) { /* Parameter list */ + if (g_internal_data->mcpp_mode == STD) { + const char * appendix = g_internal_data->empty_str; + if (! newdef) { + /* Make parms[] for dump_repl() */ + for (i = 0, cp = dp->parmnames; i < numargs; + i++, cp = cp1 + 1) { + if ((cp1 = strchr( cp, ',')) == NULL) /* The last arg */ + parms[ i].len = strlen( cp); + else + parms[ i].len = (size_t) (cp1 - cp); + parms[ i].name = cp; + } + } +#if COMPILER == GNUC + if ((dp->nargs & VA_ARGS) + && memcmp( parms[ numargs - 1].name, "...", 3) != 0) { + appendix = "..."; /* Append ... so as to become 'args...' */ + gcc2_va = TRUE; + } +#endif + mcpp_fprintf( FP2DEST( fp), "(%s%s)", dp->parmnames, appendix); + } else { + if (newdef) { + mcpp_fprintf( FP2DEST( fp), "(%s)", parms[ 0].name); + } else if (numargs == 0) { + mcpp_fputs( "()", FP2DEST( fp)); + } else { + /* Print parameter list automatically made as: */ + /* a, b, c, ..., a0, b0, c0, ..., a1, b1, c1, ... */ + mcpp_fputc( '(', FP2DEST( fp)); + for (i = 0; i < numargs; i++) { /* Make parameter list */ + mcpp_fputc( 'a' + i % 26, FP2DEST( fp)); + if (i >= 26) + mcpp_fputc( '0' + i / 26, FP2DEST( fp)); + if (i + 1 < numargs) + mcpp_fputc( ',', FP2DEST( fp)); + } + mcpp_fputc( ')', FP2DEST( fp)); + } + } + } + if (*dp->repl) { + mcpp_fputc( ' ', FP2DEST( fp)); + dump_repl( dp, fp, gcc2_va); /* Replacement text */ + } + if (commented) + /* Standard predefined or one-pass-compiler-predefined */ + mcpp_fputs( " */", FP2DEST( fp)); + if (comment) /* Not -dM option */ + mcpp_fprintf( FP2DEST( fp), " \t/* %s:%ld\t*/", dp->fname, dp->mline); + mcpp_fputc( '\n', FP2DEST( fp)); +} + +void dump_def( + int comment, /* Location of definition in comment */ + int K_opt /* -K option is specified */ +) +/* + * Dump all the current macro definitions to output stream. + */ +{ + DEFBUF * dp; + DEFBUF ** symp; + + sharp( NULL, 0); /* Report the current source file & line */ + if (comment) + mcpp_fputs( "/* Currently defined macros. */\n", DEST_OUT); + for (symp = symtab; symp < &symtab[ SBSIZE]; symp++) { + if ((dp = *symp) != NULL) { + do { + if (K_opt) + mcpp_fprintf( DEST_OUT, "/*m%s*/\n", dp->name); + else + dump_a_def( NULL, dp, FALSE, comment, g_internal_data->fp_out); + } while ((dp = dp->link) != NULL); + } + } + g_internal_data->wrong_line = TRUE; /* Line number is out of sync */ +} + +#if MCPP_LIB +void clear_symtable( void) +/* + * Free all the macro definitions. + */ +{ + DEFBUF * next; + DEFBUF * dp; + DEFBUF ** symp; + + for (symp = symtab; symp < &symtab[ SBSIZE]; symp++) { + for (next = *symp; next != NULL; ) { + dp = next; + next = dp->link; + free( dp); /* Free the symbol */ + } + *symp = NULL; + } +} +#endif + +#if defined(PK_COMPILER_MSVC) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic pop +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic pop +#endif diff --git a/Samples/PK-MCPP/eval.cpp b/Samples/PK-MCPP/eval.cpp new file mode 100644 index 00000000..1e933dfb --- /dev/null +++ b/Samples/PK-MCPP/eval.cpp @@ -0,0 +1,1693 @@ +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * E V A L . C + * E x p r e s s i o n E v a l u a t i o n + * + * The routines to evaluate #if expression are placed here. + * Some routines are used also to evaluate the value of numerical tokens. + */ + +#include "precompiled.h" +#include "pk_mcpp_bridge.h" + +#if defined(PK_COMPILER_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4146) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wwrite-strings" +# pragma clang diagnostic ignored "-Wchar-subscripts" +# pragma clang diagnostic ignored "-Wtype-limits" +# pragma clang diagnostic ignored "-Wimplicit-fallthrough" +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wwrite-strings" +# pragma GCC diagnostic ignored "-Wchar-subscripts" +# pragma GCC diagnostic ignored "-Wtype-limits" +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + +typedef struct optab { + char op; /* Operator */ + char prec; /* Its precedence */ + char skip; /* Short-circuit: non-0 to skip */ +} OPTAB; + +static int eval_lex( void); + /* Get type and value of token */ +static int chk_ops( void); + /* Check identifier-like ops */ +static VAL_SIGN * eval_char( char * const token); + /* Evaluate character constant */ +static expr_t eval_one( char ** seq_pp, int wide, int mbits, int * ucn8); + /* Evaluate a character */ +static VAL_SIGN * eval_eval( VAL_SIGN * valp, int op); + /* Entry to #if arithmetic */ +static expr_t eval_signed( VAL_SIGN ** valpp, expr_t v1, expr_t v2, int op); + /* Do signed arithmetic of expr.*/ +static expr_t eval_unsigned( VAL_SIGN ** valpp, uexpr_t v1u, uexpr_t v2u + , int op); + /* Do unsigned arithmetic */ +static void overflow( const char * op_name, VAL_SIGN ** valpp + , int ll_overflow); + /* Diagnose overflow of expr. */ +static int do_sizeof( void); + /* Evaluate sizeof (type) */ +static int look_type( int typecode); + /* Look for type of the name */ +static void dump_val( const char * msg, const VAL_SIGN * valp); + /* Print value of an operand */ +static void dump_stack( const OPTAB * opstack, const OPTAB * opp + , const VAL_SIGN * value, const VAL_SIGN * valp); + /* Print stacked operators */ + +/* For debug and error messages. */ +static const char * const opname[ OP_END + 1] = { + "end of expression", "val", "(", + "unary +", "unary -", "~", "!", + "*", "/", "%", + "+", "-", "<<", ">>", + "<", "<=", ">", ">=", "==", "!=", + "&", "^", "|", "&&", "||", + "?", ":", + ")", "(none)" +}; + +/* + * opdope[] has the operator (and operand) precedence: + * Bits + * 7 Unused (so the value is always positive) + * 6-2 Precedence (0000 .. 0174) + * 1-0 Binary op. flags: + * 10 The next binop flag (binop should/not follow). + * 01 The binop flag (should be set/cleared when this op is seen). + * Note: next binop + * value 1 0 Value doesn't follow value. + * Binop, ), END should follow value, value or unop doesn't. + * ( 0 0 ( doesn't follow value. Value follows. + * unary 0 0 Unop doesn't follow value. Value follows. + * binary 0 1 Binary op follows value. Value follows. + * ) 1 1 ) follows value. Binop, ), END follows. + * END 0 1 END follows value, doesn't follow ops. + */ + +static const char opdope[ OP_END + 1] = { + 0001, /* End of expression */ + 0002, 0170, /* VAL (constant), LPA */ +/* Unary op's */ + 0160, 0160, 0160, 0160, /* PLU, NEG, COM, NOT */ +/* Binary op's */ + 0151, 0151, 0151, /* MUL, DIV, MOD, */ + 0141, 0141, 0131, 0131, /* ADD, SUB, SL, SR */ + 0121, 0121, 0121, 0121, 0111, 0111, /* LT, LE, GT, GE, EQ, NE */ + 0101, 0071, 0061, 0051, 0041, /* AND, XOR, OR, ANA, ORO */ + 0031, 0031, /* QUE, COL */ +/* Parens */ + 0013, 0023 /* RPA, END */ +}; +/* + * OP_QUE, OP_RPA and unary operators have alternate precedences: + */ +#define OP_RPA_PREC 0013 +#define OP_QUE_PREC 0024 /* From right to left grouping */ +#define OP_UNOP_PREC 0154 /* ditto */ + +/* + * S_ANDOR and S_QUEST signal "short-circuit" boolean evaluation, so that + * #if FOO != 0 && 10 / FOO ... + * doesn't generate an error message. They are stored in optab.skip. + */ +#define S_ANDOR 2 +#define S_QUEST 1 + +static VAL_SIGN ev; /* Current value and signedness */ +static int skip = 0; /* 3-way signal of skipping expr*/ +static const char * const non_eval + = " (in non-evaluated sub-expression)"; /* _W8_ */ + +#if HAVE_LONG_LONG && COMPILER == INDEPENDENT + static int w_level = 1; /* warn_level at overflow of long */ +#else + static int w_level = 2; +#endif + +/* + * In KR and OLD_PREP modes. + * Define bits for the basic types and their adjectives. + */ +#define T_CHAR 1 +#define T_INT 2 +#define T_FLOAT 4 +#define T_DOUBLE 8 +#define T_LONGDOUBLE 16 +#define T_SHORT 32 +#define T_LONG 64 +#define T_LONGLONG 128 +#define T_SIGNED 256 +#define T_UNSIGNED 512 +#define T_PTR 1024 /* Pointer to data objects */ +#define T_FPTR 2048 /* Pointer to functions */ + +/* + * The SIZES structure is used to store the values for #if sizeof. + */ +typedef struct sizes { + int bits; /* If this bit is set, */ + int size; /* this is the datum size value */ + int psize; /* this is the pointer size */ +} SIZES; + +/* + * S_CHAR, etc. define the sizeof the basic TARGET machine word types. + * By default, sizes are set to the values for the HOST computer. If + * this is inappropriate, see those tables for details on what to change. + * Also, if you have a machine where sizeof (signed int) differs from + * sizeof (unsigned int), you will have to edit those tables and code in + * eval.c. + * Note: sizeof in #if expression is disallowed by Standard. + */ + +#define S_CHAR (sizeof (char)) +#define S_SINT (sizeof (short int)) +#define S_INT (sizeof (int)) +#define S_LINT (sizeof (long int)) +#define S_FLOAT (sizeof (float)) +#define S_DOUBLE (sizeof (double)) +#define S_PCHAR (sizeof (char *)) +#define S_PSINT (sizeof (short int *)) +#define S_PINT (sizeof (int *)) +#define S_PLINT (sizeof (long int *)) +#define S_PFLOAT (sizeof (float *)) +#define S_PDOUBLE (sizeof (double *)) +#define S_PFPTR (sizeof (int (*)())) +#if HAVE_LONG_LONG +#if (HOST_COMPILER == BORLANDC) \ + || (HOST_COMPILER == MSC && defined(_MSC_VER) && (_MSC_VER < 1300)) +#define S_LLINT (sizeof (__int64)) +#define S_PLLINT (sizeof (__int64 *)) +#else +#define S_LLINT (sizeof (long long int)) +#define S_PLLINT (sizeof (long long int *)) +#endif +#endif +#define S_LDOUBLE (sizeof (long double)) +#define S_PLDOUBLE (sizeof (long double *)) + +typedef struct types { + int type; /* This is the bits for types */ + const char * token_name; /* this is the token word */ + int excluded; /* but these aren't legal here. */ +} TYPES; + +#define ANYSIGN (T_SIGNED | T_UNSIGNED) +#define ANYFLOAT (T_FLOAT | T_DOUBLE | T_LONGDOUBLE) +#if HAVE_LONG_LONG +#define ANYINT (T_CHAR | T_SHORT | T_INT | T_LONG | T_LONGLONG) +#else +#define ANYINT (T_CHAR | T_SHORT | T_INT | T_LONG) +#endif + +static const TYPES basic_types[] = { + { T_CHAR, "char", ANYFLOAT | ANYINT }, + { T_SHORT, "short", ANYFLOAT | ANYINT }, + { T_INT, "int", ANYFLOAT | T_CHAR | T_INT }, + { T_LONG, "long", ANYFLOAT | ANYINT }, +#if HAVE_LONG_LONG +#if HOST_COMPILER == BORLANDC + { T_LONGLONG, "__int64", ANYFLOAT | ANYINT }, +#else + { T_LONGLONG, "long long", ANYFLOAT | ANYINT }, +#endif +#endif + { T_FLOAT, "float", ANYFLOAT | ANYINT | ANYSIGN }, + { T_DOUBLE, "double", ANYFLOAT | ANYINT | ANYSIGN }, + { T_LONGDOUBLE, "long double", ANYFLOAT | ANYINT | ANYSIGN }, + { T_SIGNED, "signed", ANYFLOAT | ANYINT | ANYSIGN }, + { T_UNSIGNED, "unsigned", ANYFLOAT | ANYINT | ANYSIGN }, + { 0, NULL, 0 } /* Signal end */ +}; + +/* + * In this table, T_FPTR (pointer to function) should be placed last. + */ +static const SIZES size_table[] = { + { T_CHAR, S_CHAR, S_PCHAR }, /* char */ + { T_SHORT, S_SINT, S_PSINT }, /* short int */ + { T_INT, S_INT, S_PINT }, /* int */ + { T_LONG, S_LINT, S_PLINT }, /* long */ +#if HAVE_LONG_LONG + { T_LONGLONG, S_LLINT, S_PLLINT }, /* long long */ +#endif + { T_FLOAT, S_FLOAT, S_PFLOAT }, /* float */ + { T_DOUBLE, S_DOUBLE, S_PDOUBLE }, /* double */ + { T_LONGDOUBLE, S_LDOUBLE, S_PLDOUBLE }, /* long double */ + { T_FPTR, 0, S_PFPTR }, /* int (*()) */ + { 0, 0, 0 } /* End of table */ +}; + +#define is_binary(op) (FIRST_BINOP <= op && op <= LAST_BINOP) +#define is_unary(op) (FIRST_UNOP <= op && op <= LAST_UNOP) + + +#if MCPP_LIB +void init_eval( void) +{ + skip = 0; +} +#endif + +expr_t eval_if( void) +/* + * Evaluate a #if expression. Straight-forward operator precedence. + * This is called from directive() on encountering an #if directive. + * It calls the following routines: + * eval_lex() Lexical analyser -- returns the type and value of + * the next input token. + * eval_eval() Evaluates the current operator, given the values on the + * value stack. Returns a pointer to the (new) value stack. + */ +{ + VAL_SIGN value[ NEXP * 2 + 1]; /* Value stack */ + OPTAB opstack[ NEXP * 3 + 1]; /* Operator stack */ + int parens = 0; /* Nesting levels of (, ) */ + int prec; /* Operator precedence */ + int binop = 0; /* Set if binary op. needed */ + int op1; /* Operator from stack */ + int skip_cur; /* For short-circuit testing */ + VAL_SIGN * valp = value; /* -> Value and signedness */ + OPTAB * opp = opstack; /* -> Operator stack */ + int op; /* Current operator */ + + opp->op = OP_END; /* Mark bottom of stack */ + opp->prec = opdope[ OP_END]; /* And its precedence */ + skip = skip_cur = opp->skip = 0; /* Not skipping now */ + + while (1) { + if (g_internal_data->mcpp_debug & EXPRESSION) + mcpp_fprintf( DEST_DBG + , "In eval loop skip = %d, binop = %d, line is: %s\n" + , opp->skip, binop, g_internal_data->infile->bptr); + skip = opp->skip; + op = eval_lex(); + skip = 0; /* Reset to be ready to return */ + switch (op) { + case OP_SUB : + if (binop == 0) + op = OP_NEG; /* Unary minus */ + break; + case OP_ADD : + if (binop == 0) + op = OP_PLU; /* Unary plus */ + break; + case OP_FAIL: + return 0L; /* Token error */ + } + if (g_internal_data->mcpp_debug & EXPRESSION) + mcpp_fprintf( DEST_DBG + , "op = %s, opdope = %04o, binop = %d, skip = %d\n" + , opname[ op], opdope[ op], binop, opp->skip); + if (op == VAL) { /* Value? */ + if (binop != 0) { /* Binop is needed */ + cerror( "Misplaced constant \"%s\"" /* _E_ */ + , g_internal_data->work_buf, 0L, NULL); + return 0L; + } else if (& value[ NEXP * 2] <= valp) { + cerror( "More than %.0s%ld constants stacked at %s" /* _E_ */ + , NULL, (long) (NEXP * 2 - 1), g_internal_data->work_buf); + return 0L; + } else { + if (g_internal_data->mcpp_debug & EXPRESSION) { + dump_val( "pushing ", &ev); + mcpp_fprintf( DEST_DBG, " onto value stack[%d]\n" + , (int)(valp - value)); + } + valp->val = ev.val; + (valp++)->sign = ev.sign; + binop = 1; /* Binary operator or so should follow */ + } + continue; + } /* Else operators */ + prec = opdope[ op]; + if (binop != (prec & 1)) { + if (op == OP_EOE) + cerror( "Unterminated expression" /* _E_ */ + , NULL, 0L, NULL); + else + cerror( "Operator \"%s\" in incorrect context" /* _E_ */ + , opname[ op], 0L, NULL); + return 0L; + } + binop = (prec & 2) >> 1; /* Binop should follow? */ + + while (1) { + if (g_internal_data->mcpp_debug & EXPRESSION) + mcpp_fprintf( DEST_DBG + , "op %s, prec %d, stacked op %s, prec %d, skip %d\n" + , opname[ op], prec, opname[ opp->op], opp->prec, opp->skip); + + /* Stack coming sub-expression of higher precedence. */ + if (opp->prec < prec) { + if (op == OP_LPA) { + prec = OP_RPA_PREC; + if (g_internal_data->standard && (g_internal_data->warn_level & 4) + && ++parens == g_internal_data->std_limits.exp_nest + 1) + cwarn( + "More than %.0s%ld nesting of parens" /* _W4_ */ + , NULL, (long) g_internal_data->std_limits.exp_nest, NULL); + } else if (op == OP_QUE) { + prec = OP_QUE_PREC; + } else if (is_unary( op)) { + prec = OP_UNOP_PREC; + } + op1 = opp->skip; /* Save skip for test */ + /* + * Push operator onto operator stack. + */ + opp++; + if (& opstack[ NEXP * 3] <= opp) { + cerror( + "More than %.0s%ld operators and parens stacked at %s" /* _E_ */ + , NULL, (long) (NEXP * 3 - 1), opname[ op]); + return 0L; + } + opp->op = (char)op; + opp->prec = (char)prec; + if (&value[0] < valp) + skip_cur = (valp[-1].val != 0L); + /* Short-circuit tester */ + /* + * Do the short-circuit stuff here. Short-circuiting + * stops automagically when operators are evaluated. + */ + if ((op == OP_ANA && ! skip_cur) + || (op == OP_ORO && skip_cur)) { + opp->skip = S_ANDOR; /* And/or skip starts */ + if (skip_cur) /* Evaluate non-zero */ + valp[-1].val = 1L; /* value to 1 */ + } else if (op == OP_QUE) { /* Start of ?: operator */ + opp->skip = (op1 & S_ANDOR) | (!skip_cur ? S_QUEST : 0); + } else if (op == OP_COL) { /* : inverts S_QUEST */ + opp->skip = (op1 & S_ANDOR) + | (((op1 & S_QUEST) != 0) ? 0 : S_QUEST); + } else { /* Other operators leave*/ + opp->skip = (char)op1; /* skipping unchanged. */ + } + if (g_internal_data->mcpp_debug & EXPRESSION) { + mcpp_fprintf( DEST_DBG, "stacking %s, ", opname[ op]); + if (&value[0] < valp) + dump_val( "valp[-1].val == ", valp - 1); + mcpp_fprintf( DEST_DBG, " at %s\n", g_internal_data->infile->bptr); + dump_stack( opstack, opp, value, valp); + } + break; + } + + /* + * Coming sub-expression is of lower precedence. + * Evaluate stacked sub-expression. + * Pop operator from operator stack and evaluate it. + * End of stack and '(', ')' are specials. + */ + skip_cur = opp->skip; /* Remember skip value */ + switch ((op1 = opp->op)) { /* Look at stacked op */ + case OP_END: /* Stack end marker */ + if (op == OP_RPA) { /* No corresponding ( */ + cerror( "Excessive \")\"", NULL, 0L, NULL); /* _E_ */ + return 0L; + } + if (op == OP_EOE) + return valp[-1].val; /* Finished ok. */ + break; + case OP_LPA: /* ( on stack */ + if (op != OP_RPA) { /* Matches ) on input? */ + cerror( "Missing \")\"", NULL, 0L, NULL); /* _E_ */ + return 0L; + } + opp--; /* Unstack it */ + parens--; /* Count down nest level*/ + break; + case OP_QUE: /* Evaluate true expr. */ + break; + case OP_COL: /* : on stack */ + opp--; /* Unstack : */ + if (opp->op != OP_QUE) { /* Matches ? on stack? */ + cerror( + "Misplaced \":\", previous operator is \"%s\"" /* _E_ */ + , opname[opp->op], 0L, NULL); + return 0L; + } + /* Evaluate op1. Fall through */ + default: /* Others: */ + opp--; /* Unstack the operator */ + if (g_internal_data->mcpp_debug & EXPRESSION) { + mcpp_fprintf( DEST_DBG, "Stack before evaluation of %s\n" + , opname[ op1]); + dump_stack( opstack, opp, value, valp); + } + if (op1 == OP_COL) + skip = 0; + else + skip = skip_cur; + valp = eval_eval( valp, op1); + if (valp->sign == VAL_ERROR) + return 0L; /* Out of range or divide by 0 */ + valp++; + skip = 0; + if (g_internal_data->mcpp_debug & EXPRESSION) { + mcpp_fprintf( DEST_DBG, "Stack after evaluation\n"); + dump_stack( opstack, opp, value, valp); + } + } /* op1 switch end */ + + if (op1 == OP_END || op1 == OP_LPA || op1 == OP_QUE) + break; /* Read another op. */ + } /* Stack unwind loop */ + + } + + return 0L; /* Never reach here */ +} + +static int eval_lex( void) +/* + * Return next operator or constant to evaluate. Called from eval_if(). It + * calls a special-purpose routines for character constants and numeric values: + * eval_char() called to evaluate 'x' + * eval_num() called to evaluate numbers + * C++98 treats 11 identifier-like tokens as operators. + * POST_STD forbids character constants in #if expression. + */ +{ + int c1; + VAL_SIGN * valp; + int warn = ! skip || (g_internal_data->warn_level & 8); + int token_type; + int c; + + ev.sign = SIGNED; /* Default signedness */ + ev.val = 0L; /* Default value (on error or 0 value) */ + g_internal_data->in_if = ! skip; /* Inform to expand_macro() that the macro is */ + /* in #if line and not skipped expression. */ + c = skip_ws(); + if (c == '\n') { + unget_ch(); + return OP_EOE; /* End of expression */ + } + token_type = get_unexpandable( c, warn); + if (g_internal_data->standard && g_internal_data->macro_line == MACRO_ERROR) + return OP_FAIL; /* Unterminated macro call */ + if (token_type == NO_TOKEN) + return OP_EOE; /* Only macro(s) expanding to 0-token */ + + switch (token_type) { + case NAM: + if (g_internal_data->standard && str_eq( g_internal_data->identifier, "defined")) { /* defined name */ + c1 = c = skip_ws(); + if (c == '(') /* Allow defined (name) */ + c = skip_ws(); + if (scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end) == NAM) { + DEFBUF * defp = look_id( g_internal_data->identifier); + if (warn) { + ev.val = (defp != NULL); + if ((g_internal_data->mcpp_debug & MACRO_CALL) && ! skip && defp) + /* Annotate if the macro is in non-skipped expr. */ + mcpp_fprintf( DEST_OUT, "/*%s*/", defp->name); + } + if (c1 != '(' || skip_ws() == ')') /* Balanced ? */ + return VAL; /* Parsed ok */ + } + cerror( "Bad defined syntax: %s" /* _E_ */ + , g_internal_data->infile->fp ? "" : g_internal_data->infile->buffer, 0L, NULL); + break; + } else if (g_internal_data->cplus_val) { + if (str_eq( g_internal_data->identifier, "true")) { + ev.val = 1L; + return VAL; + } else if (str_eq( g_internal_data->identifier, "false")) { + ev.val = 0L; + return VAL; + } else if (g_internal_data->mcpp_mode != POST_STD + && (g_internal_data->openum = id_operator( g_internal_data->identifier)) != 0) { + /* Identifier-like operator in C++98 */ + strcpy( g_internal_data->work_buf, g_internal_data->identifier); + return chk_ops(); + } + } else if (! g_internal_data->standard && str_eq( g_internal_data->identifier, "sizeof")) { + /* sizeof hackery */ + return do_sizeof(); /* Gets own routine */ + } + /* + * The ANSI C Standard says that an undefined symbol + * in an #if has the value zero. We are a bit pickier, + * warning except where the programmer was careful to write + * #if defined(foo) ? foo : 0 + */ + if ((! skip && (g_internal_data->warn_level & 4)) || (skip && (g_internal_data->warn_level & 8))) + cwarn( "Undefined symbol \"%s\"%.0ld%s" /* _W4_ _W8_ */ + , g_internal_data->identifier, 0L, skip ? non_eval : ", evaluated to 0"); + return VAL; + case CHR: /* Character constant */ + case WCHR: /* Wide char constant */ + if (g_internal_data->mcpp_mode == POST_STD) { + cerror( "Can't use a character constant %s" /* _E_ */ + , g_internal_data->work_buf, 0L, NULL); + break; + } + valp = eval_char( g_internal_data->work_buf); /* 'valp' points 'ev' */ + if (valp->sign == VAL_ERROR) + break; + if (g_internal_data->mcpp_debug & EXPRESSION) { + dump_val( "eval_char returns ", &ev); + mcpp_fputc( '\n', DEST_DBG); + } + return VAL; /* Return a value */ + case STR: /* String literal */ + case WSTR: /* Wide string literal */ + cerror( + "Can't use a string literal %s", g_internal_data->work_buf, 0L, NULL); /* _E_ */ + break; + case NUM: /* Numbers are harder */ + valp = eval_num( g_internal_data->work_buf); /* 'valp' points 'ev' */ + if (valp->sign == VAL_ERROR) + break; + if (g_internal_data->mcpp_debug & EXPRESSION) { + dump_val( "eval_num returns ", &ev); + mcpp_fputc( '\n', DEST_DBG); + } + return VAL; + case OPE: /* Operator or punctuator */ + return chk_ops(); + + default: /* Total nonsense */ + cerror( "Can't use the character %.0s0x%02lx" /* _E_ */ + , NULL, (long) c, NULL); + break; + } + + return OP_FAIL; /* Any errors */ +} + +static int chk_ops( void) +/* + * Check the operator. + * If it can't be used in #if expression return OP_FAIL + * else return openum. + */ +{ + switch (g_internal_data->openum) { + case OP_STR: case OP_CAT: case OP_ELL: + case OP_1: case OP_2: case OP_3: + cerror( "Can't use the operator \"%s\"" /* _E_ */ + , g_internal_data->work_buf, 0L, NULL); + return OP_FAIL; + default: + return g_internal_data->openum; + } +} + +static int do_sizeof( void) +/* + * Process the sizeof (basic type) operation in an #if string. + * Sets ev.val to the size and returns + * VAL success + * OP_FAIL bad parse or something. + * This routine is never called in STD and POST_STD mode. + */ +{ + const char * const no_type = "sizeof: No type specified"; /* _E_ */ + int warn = ! skip || (g_internal_data->warn_level & 8); + int type_end = FALSE; + int typecode = 0; + int token_type = NO_TOKEN; + const SIZES * sizp = NULL; + + if (get_unexpandable( skip_ws(), warn) != OPE || g_internal_data->openum != OP_LPA) + goto no_good; /* Not '(' */ + + /* + * Scan off the tokens. + */ + + while (! type_end) { + token_type = get_unexpandable( skip_ws(), warn); + /* Get next token expanding macros */ + switch (token_type) { + case OPE: + if (g_internal_data->openum == OP_LPA) { /* thing (*)() func ptr */ + if (get_unexpandable( skip_ws(), warn) == OPE + && g_internal_data->openum == OP_MUL + && get_unexpandable( skip_ws(), warn) == OPE + && g_internal_data->openum == OP_RPA) { /* (*) */ + if (get_unexpandable( skip_ws(), warn) != OPE + || g_internal_data->openum != OP_LPA + || get_unexpandable( skip_ws(), warn) != OPE + || g_internal_data->openum != OP_RPA) /* Not () */ + goto no_good; + typecode |= T_FPTR; /* Function pointer */ + } else { /* Junk is an error */ + goto no_good; + } + } else { /* '*' or ')' */ + type_end = TRUE; + } + break; + case NAM: /* Look for type comb. */ + if ((typecode = look_type( typecode)) == 0) + return OP_FAIL; /* Illegal type or comb.*/ + break; + default: goto no_good; /* Illegal token */ + } + } /* End of while */ + + /* + * We are at the end of the type scan. Chew off '*' if necessary. + */ + if (token_type == OPE) { + if (g_internal_data->openum == OP_MUL) { /* '*' */ + typecode |= T_PTR; + if (get_unexpandable( skip_ws(), warn) != OPE) + goto no_good; + } + if (g_internal_data->openum == OP_RPA) { /* ')' */ + /* + * Last syntax check + * We assume that all function pointers are the same size: + * sizeof (int (*)()) == sizeof (float (*)()) + * We assume that signed and unsigned don't change the size: + * sizeof (signed int) == sizeof (unsigned int) + */ + if ((typecode & T_FPTR) != 0) { /* Function pointer */ + typecode = T_FPTR | T_PTR; + } else { /* Var or var * datum */ + typecode &= ~(T_SIGNED | T_UNSIGNED); +#if HAVE_LONG_LONG + if ((typecode & (T_SHORT | T_LONG | T_LONGLONG)) != 0) +#else + if ((typecode & (T_SHORT | T_LONG)) != 0) +#endif + typecode &= ~T_INT; + } + if ((typecode & ~T_PTR) == 0) { + cerror( no_type, NULL, 0L, NULL); + return OP_FAIL; + } else { + /* + * Exactly one bit (and possibly T_PTR) may be set. + */ + for (sizp = size_table; sizp->bits != 0; sizp++) { + if ((typecode & ~T_PTR) == sizp->bits) { + ev.val = ((typecode & T_PTR) != 0) + ? sizp->psize : sizp->size; + break; + } + } + } + } else { + goto no_good; + } + } else { + goto no_good; + } + + if (g_internal_data->mcpp_debug & EXPRESSION) { + if (sizp) + mcpp_fprintf( DEST_DBG, + "sizp->bits:0x%x sizp->size:0x%x sizp->psize:0x%x ev.val:0x%lx\n" + , sizp->bits, sizp->size, sizp->psize + , (unsigned long) ev.val); + } + return VAL; + +no_good: + unget_ch(); + cerror( "sizeof: Syntax error", NULL, 0L, NULL); /* _E_ */ + return OP_FAIL; +} + +static int look_type( + int typecode +) +{ + const char * const unknown_type + = "sizeof: Unknown type \"%s\"%.0ld%s"; /* _E_ _W8_ */ + const char * const illeg_comb + = "sizeof: Illegal type combination with \"%s\"%.0ld%s"; /* _E_ _W8_ */ + int token_type; + const TYPES * tp; + + if (str_eq( g_internal_data->identifier, "long")) { + if ((token_type + = get_unexpandable( skip_ws(), !skip || (g_internal_data->warn_level & 8))) + == NO_TOKEN) + return typecode; + if (token_type == NAM) { +#if HAVE_LONG_LONG + if (str_eq( g_internal_data->identifier, "long")) { + strcpy( g_internal_data->work_buf, "long long"); + goto basic; + } +#endif + if (str_eq( g_internal_data->identifier, "double")) { + strcpy( g_internal_data->work_buf, "long double"); + goto basic; + } + } + unget_string( g_internal_data->work_buf, NULL); /* Not long long */ + strcpy( g_internal_data->work_buf, "long"); /* nor long double */ + } + + /* + * Look for this unexpandable token in basic_types. + */ +basic: + for (tp = basic_types; tp->token_name != NULL; tp++) { + if (str_eq( g_internal_data->work_buf, tp->token_name)) + break; + } + + if (tp->token_name == NULL) { + if (! skip) { + cerror( unknown_type, g_internal_data->work_buf, 0L, NULL); + return 0; + } else if (g_internal_data->warn_level & 8) { + cwarn( unknown_type, g_internal_data->work_buf, 0L, non_eval); + } + } + if ((typecode & tp->excluded) != 0) { + if (! skip) { + cerror( illeg_comb, g_internal_data->work_buf, 0L, NULL); + return 0; + } else if (g_internal_data->warn_level & 8) { + cwarn( illeg_comb, g_internal_data->work_buf, 0L, non_eval); + } + } + + if (g_internal_data->mcpp_debug & EXPRESSION) { + if (tp->token_name) + mcpp_fprintf( DEST_DBG, + "sizeof -- typecode:0x%x tp->token_name:\"%s\" tp->type:0x%x\n" + , typecode, tp->token_name, tp->type); + } + return typecode |= tp->type; /* Or in the type bit */ +} + +VAL_SIGN * eval_num( + const char * nump /* Preprocessing number */ +) +/* + * Evaluate number for #if lexical analysis. Note: eval_num recognizes + * the unsigned suffix, but only returns a signed expr_t value, and stores + * the signedness to ev.sign, which is set UNSIGNED (== unsigned) if the + * value is not in the range of positive (signed) expr_t. + */ +{ + const char * const not_integer = "Not an integer \"%s\""; /* _E_ */ + const char * const out_of_range + = "Constant \"%s\"%.0ld%s is out of range"; /* _E_ _W1_ _W8_ */ + expr_t value; + uexpr_t v, v1; /* unsigned long long or unsigned long */ + int uflag = FALSE; + int lflag = FALSE; + int erange = FALSE; + int base; + int c, c1; + const char * cp = nump; +#if HAVE_LONG_LONG + const char * const out_of_range_long = + "Constant \"%s\"%.0ld%s is out of range " /* _E_ _W1_ _W2_ _W8_ */ + "of (unsigned) long"; + const char * const ll_suffix = +"LL suffix is used in other than C99 mode \"%s\"%.0ld%s"; /* _W1_ _W2_ _W8_ */ +#if COMPILER == MSC || COMPILER == BORLANDC + const char * const i64_suffix = +"I64 suffix is used in other than C99 mode \"%s\"%.0ld%s"; /* _W2_ _W8_ */ +#endif + int llflag = FALSE; + int erange_long = FALSE; +#endif + + ev.sign = SIGNED; /* Default signedness */ + ev.val = 0L; /* Default value */ + if ((g_internal_data->char_type[ c = *cp++ & UCHARMAX] & DIG) == 0) /* Dot */ + goto num_err; + if (c != '0') { /* Decimal */ + base = 10; + } else if ((c = *cp++ & UCHARMAX) == 'x' || c == 'X') { + base = 16; /* Hexadecimal */ + c = *cp++ & UCHARMAX; + } else if (c == EOS) { /* 0 */ + return & ev; + } else { /* Octal or illegal */ + base = 8; + } + + v = v1 = 0L; + for (;;) { + c1 = c; + if (isupper( c1)) + c1 = tolower( c1); + if (c1 >= 'a') + c1 -= ('a' - 10); + else + c1 -= '0'; + if (c1 < 0 || base <= c1) + break; + v1 *= base; + v1 += c1; + if (v1 / base < v) { /* Overflow */ + if (! skip) + goto range_err; + else + erange = TRUE; + } +#if HAVE_LONG_LONG + if (! g_internal_data->stdc3 && v1 > ULONGMAX) + /* Overflow of long or unsigned long */ + erange_long = TRUE; +#endif + v = v1; + c = *cp++ & UCHARMAX; + } + + value = v; + while (c == 'u' || c == 'U' || c == 'l' || c == 'L') { + if (c == 'u' || c == 'U') { + if (uflag) + goto num_err; + uflag = TRUE; + } else if (c == 'l' || c == 'L') { +#if HAVE_LONG_LONG + if (llflag) { + goto num_err; + } else if (lflag) { + llflag = TRUE; + if (! g_internal_data->stdc3 && ((! skip && (g_internal_data->warn_level & w_level)) + || (skip && (g_internal_data->warn_level & 8)))) + cwarn( ll_suffix, nump, 0L, skip ? non_eval : NULL); + } else { + lflag = TRUE; + } +#else + if (lflag) + goto num_err; + else + lflag = TRUE; +#endif + } + c = *cp++; + } +#if HAVE_LONG_LONG && (COMPILER == MSC || COMPILER == BORLANDC) + if (tolower( c) == 'i') { + c1 = atoi( cp); + if (c1 == 64) { + if (! g_internal_data->stdc3 && ((! skip && (g_internal_data->warn_level & w_level)) + || (skip && (g_internal_data->warn_level & 8)))) + cwarn( i64_suffix, nump, 0L, skip ? non_eval : NULL); + cp += 2; + } else if (c1 == 32 || c1 == 16) { + cp += 2; + } else if (c1 == 8) { + cp++; + } + c = *cp++; + } +#endif + + if (c != EOS) + goto num_err; + + if (g_internal_data->standard) { + if (uflag) /* If 'U' suffixed, uexpr_t is treated as unsigned */ + ev.sign = UNSIGNED; + else + ev.sign = (value >= 0L); +#if HAVE_LONG_LONG + } else { + if (value > LONGMAX) + erange_long = TRUE; +#endif + } + + ev.val = value; + if (erange && (g_internal_data->warn_level & 8)) + cwarn( out_of_range, nump, 0L, non_eval); +#if HAVE_LONG_LONG + else if (erange_long && ((skip && (g_internal_data->warn_level & 8)) + || (! g_internal_data->stdc3 && ! skip && (g_internal_data->warn_level & w_level)))) + cwarn( out_of_range_long, nump, 0L, skip ? non_eval : NULL); +#endif + return & ev; + +range_err: + cerror( out_of_range, nump, 0L, NULL); + ev.sign = VAL_ERROR; + return & ev; +num_err: + cerror( not_integer, nump, 0L, NULL); + ev.sign = VAL_ERROR; + return & ev; +} + +static VAL_SIGN * eval_char( + char * const token +) +/* + * Evaluate a character constant. + * This routine is never called in POST_STD mode. + */ +{ + const char * const w_out_of_range + = "Wide character constant %s%.0ld%s is out of range"; /* _E_ _W8_ */ + const char * const c_out_of_range + = "Integer character constant %s%.0ld%s is out of range"; /* _E_ _W8_ */ + uexpr_t value; + uexpr_t tmp; + expr_t cl; + int erange = FALSE; + int wide = (*token == 'L'); + int ucn8; + int i; + int bits, mbits, u8bits, bits_save; + char * cp = token + 1; /* Character content */ +#if HAVE_LONG_LONG + const char * const w_out_of_range_long = + "Wide character constant %s%.0ld%s is " /* _E_ _W1_ _W2_ _W8_ */ + "out of range of unsigned long"; + const char * const c_out_of_range_long = + "Integer character constant %s%.0ld%s is " /* _E_ _W1_ _W2_ _W8_ */ + "out of range of unsigned long"; + int erange_long = FALSE; +#endif + + bits = CHARBIT; + u8bits = CHARBIT * 4; + if (g_internal_data->mbchar & UTF8) + mbits = CHARBIT * 4; + else + mbits = CHARBIT * 2; + if (g_internal_data->mcpp_mode == STD && wide) { /* Wide character constant */ + cp++; /* Skip 'L' */ + bits = mbits; + } + if (g_internal_data->char_type[ *cp & UCHARMAX] & g_internal_data->mbchk) { + cl = mb_eval( &cp); + bits = mbits; + } else if ((cl = eval_one( &cp, wide, mbits, (ucn8 = FALSE, &ucn8))) + == -1L) { + ev.sign = VAL_ERROR; + return & ev; + } + bits_save = bits; + value = cl; + + for (i = 0; *cp != '\'' && *cp != EOS; i++) { + if (g_internal_data->char_type[ *cp & UCHARMAX] & g_internal_data->mbchk) { + cl = mb_eval( &cp); + if (cl == 0) + /* Shift-out sequence of multi-byte or wide character */ + continue; + bits = mbits; + } else { + cl = eval_one( &cp, wide, mbits, (ucn8 = FALSE, &ucn8)); + if (cl == -1L) { + ev.sign = VAL_ERROR; + return & ev; + } +#if OK_UCN + if (ucn8 == TRUE) + bits = u8bits; + else + bits = bits_save; +#endif + } + tmp = value; + value = (value << bits) | cl; /* Multi-char or multi-byte char */ + if ((value >> bits) < tmp) { /* Overflow */ + if (! skip) + goto range_err; + else + erange = TRUE; + } +#if HAVE_LONG_LONG + if ((g_internal_data->mcpp_mode == STD && (! g_internal_data->stdc3 && value > ULONGMAX)) + || (! g_internal_data->standard && value > LONGMAX)) + erange_long = TRUE; +#endif + } + + ev.sign = ((expr_t) value >= 0L); + ev.val = value; + + if (erange && skip && (g_internal_data->warn_level & 8)) { + if (wide) + cwarn( w_out_of_range, token, 0L, non_eval); + else + cwarn( c_out_of_range, token, 0L, non_eval); +#if HAVE_LONG_LONG + } else if (erange_long && ((skip && (g_internal_data->warn_level & 8)) + || (! g_internal_data->stdc3 && ! skip && (g_internal_data->warn_level & w_level)))) { + if (wide) + cwarn( w_out_of_range_long, token, 0L, skip ? non_eval : NULL); + else + cwarn( c_out_of_range_long, token, 0L, skip ? non_eval : NULL); +#endif + } + + if (i == 0) /* Constant of single (character or wide-character) */ + return & ev; + + if ((! skip && (g_internal_data->warn_level & 4)) || (skip && (g_internal_data->warn_level & 8))) { + if (g_internal_data->mcpp_mode == STD && wide) + cwarn( +"Multi-character wide character constant %s%.0ld%s isn't portable" /* _W4_ _W8_ */ + , token, 0L, skip ? non_eval : NULL); + else + cwarn( +"Multi-character or multi-byte character constant %s%.0ld%s isn't portable" /* _W4_ _W8_ */ + , token, 0L, skip ? non_eval : NULL); + } + return & ev; + +range_err: + if (wide) + cerror( w_out_of_range, token, 0L, NULL); + else + cerror( c_out_of_range, token, 0L, NULL); + ev.sign = VAL_ERROR; + return & ev; +} + +static expr_t eval_one( + char ** seq_pp, /* Address of pointer to sequence */ + /* eval_one() advances the pointer to sequence */ + int wide, /* Flag of wide-character */ + int mbits, /* Number of bits of a wide-char */ + int * ucn8 /* Flag of UCN-32 bits */ +) +/* + * Called from eval_char() above to get a single character, single multi- + * byte character or wide character (with or without \ escapes). + * Returns the value of the character or -1L on error. + */ +{ +#if OK_UCN + const char * const ucn_malval + = "UCN cannot specify the value %.0s\"%08lx\""; /* _E_ _W8_ */ +#endif + const char * const out_of_range + = "%s%ld bits can't represent escape sequence '%s'"; /* _E_ _W8_ */ + uexpr_t value; + int erange = FALSE; + char * seq = *seq_pp; /* Initial seq_pp for diagnostic*/ + const char * cp; + const char * digits; + unsigned uc; + unsigned uc1; + int count; + int bits; + size_t wchar_max; + + uc = *(*seq_pp)++ & UCHARMAX; + + if (uc != '\\') /* Other than escape sequence */ + return (expr_t) uc; + + /* escape sequence */ + uc1 = uc = *(*seq_pp)++ & UCHARMAX; + switch (uc) { + case 'a': + return '\a'; + case 'b': + return '\b'; + case 'f': + return '\f'; + case 'n': + return '\n'; + case 'r': + return '\r'; + case 't': + return '\t'; + case 'v': + return '\v'; +#if OK_UCN + case 'u': case 'U': + if (! g_internal_data->stdc2) + goto undefined; + /* Else Universal character name */ + /* Fall through */ +#endif + case 'x': /* '\xFF' */ + if (! g_internal_data->standard) + goto undefined; + digits = "0123456789abcdef"; + bits = 4; + uc = *(*seq_pp)++ & UCHARMAX; + break; + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + digits = "01234567"; + bits = 3; + break; + case '\'': case '"': case '?': case '\\': + return (expr_t) uc; + default: + goto undefined; + } + + wchar_max = (UCHARMAX << CHARBIT) | UCHARMAX; + if (mbits == CHARBIT * 4) { + if (g_internal_data->mcpp_mode == STD) + wchar_max = (wchar_max << CHARBIT * 2) | wchar_max; + else + wchar_max = LONGMAX; + } + + value = 0L; + for (count = 0; ; ++count) { + if (isupper( uc)) + uc = tolower( uc); + if ((cp = strchr( digits, uc)) == NULL) + break; + if (count >= 3 && bits == 3) + break; /* Octal escape sequence at most 3 digits */ +#if OK_UCN + if ((count >= 4 && uc1 == 'u') || (count >= 8 && uc1 == 'U')) + break; +#endif + value = (value << bits) | (cp - digits); +#if OK_UCN + if (wchar_max < value && uc1 != 'u' && uc1 != 'U') +#else + if (wchar_max < value) +#endif + { + if (! skip) + goto range_err; + else + erange = TRUE; + } + uc = *(*seq_pp)++ & UCHARMAX; + } + (*seq_pp)--; + + if (erange) { + value &= wchar_max; + goto range_err; + } + + if (count == 0 && bits == 4) /* '\xnonsense' */ + goto undefined; +#if OK_UCN + if (uc1 == 'u' || uc1 == 'U') { + if ((count < 4 && uc1 == 'u') || (count < 8 && uc1 == 'U')) + goto undefined; + if ((value >= 0L && value <= 0x9FL + && value != 0x24L && value != 0x40L && value != 0x60L) + || (!g_internal_data->stdc3 && value >= 0xD800L && value <= 0xDFFFL)) { + if (!skip) + cerror( ucn_malval, NULL, (long) value, NULL); + else if (g_internal_data->warn_level & 8) + cwarn( ucn_malval, NULL, (long) value, NULL); + } + if (count >= 8 && uc1 == 'U') + *ucn8 = TRUE; + return (expr_t) value; + } +#endif /* OK_UCN */ + if (! wide && (UCHARMAX < value)) { + value &= UCHARMAX; + goto range_err; + } + return (expr_t) value; + +undefined: + uc1 = **seq_pp; + **seq_pp = EOS; /* For diagnostic */ + if ((! skip && (g_internal_data->warn_level & 1)) || (skip && (g_internal_data->warn_level & 8))) + cwarn( + "Undefined escape sequence%s %.0ld'%s'" /* _W1_ _W8_ */ + , skip ? non_eval : NULL, 0L, seq); + **seq_pp = (char)uc1; + *seq_pp = seq + 1; + return (expr_t) '\\'; /* Returns the escape char */ + +range_err: + uc1 = **seq_pp; + **seq_pp = EOS; /* For diagnostic */ + if (wide) { + if (! skip) + cerror( out_of_range, NULL, (long) mbits, seq); + else if (g_internal_data->warn_level & 8) + cwarn( out_of_range, non_eval, (long) mbits, seq); + } else { + if (! skip) + cerror( out_of_range, NULL, (long) CHARBIT, seq); + else if (g_internal_data->warn_level & 8) + cwarn( out_of_range, non_eval, (long) CHARBIT, seq); + } + + **seq_pp = (char)uc1; + if (! skip) + return -1L; + else + return (expr_t) value; +} + +static VAL_SIGN * eval_eval( + VAL_SIGN * valp, + int op +) +/* + * One or two values are popped from the value stack and do arithmetic. + * The result is pushed onto the value stack. + * eval_eval() returns the new pointer to the top of the value stack. + */ +{ + const char * const zero_div = "%sDivision by zero%.0ld%s"; /* _E_ _W8_ */ +#if HAVE_LONG_LONG + const char * const neg_format = +"Negative value \"%" LL_FORM "d\" is converted to positive \"%" /* _W1_ _W8_*/ + LL_FORM "u\"%%s"; +#else + const char * const neg_format = +"Negative value \"%ld\" is converted to positive \"%lu\"%%s"; /* _W1_ _W8_*/ +#endif + expr_t v1, v2; + int sign1, sign2; + + if (is_binary( op)) { + v2 = (--valp)->val; + sign2 = valp->sign; + } else { + v2 = 0L; /* Dummy */ + sign2 = SIGNED; /* Dummy */ + } + v1 = (--valp)->val; + sign1 = valp->sign; + if (g_internal_data->mcpp_debug & EXPRESSION) { + mcpp_fprintf( DEST_DBG, "%s op %s", (is_binary( op)) ? "binary" : "unary" + , opname[ op]); + dump_val( ", v1 = ", valp); + if (is_binary( op)) + dump_val( ", v2 = ", valp + 1); + mcpp_fputc( '\n', DEST_DBG); + } + + if (g_internal_data->standard + && (sign1 == UNSIGNED || sign2 == UNSIGNED) && is_binary( op) + && op != OP_ANA && op != OP_ORO && op != OP_SR && op != OP_SL) { + if (((sign1 == SIGNED && v1 < 0L) || (sign2 == SIGNED && v2 < 0L) + ) && ((! skip && (g_internal_data->warn_level & 1)) + || (skip && (g_internal_data->warn_level & 8)))) { + char negate[(((sizeof (expr_t) * 8) / 3) + 1) * 2 + 50]; + expr_t v3; + + v3 = (sign1 == SIGNED ? v1 : v2); + sprintf( negate, neg_format, v3, v3); + cwarn( negate, skip ? non_eval : NULL, 0L, NULL); + } + valp->sign = sign1 = sign2 = UNSIGNED; + } + if ((op == OP_SL || op == OP_SR) + && ((! skip && (g_internal_data->warn_level & 1)) || (skip && (g_internal_data->warn_level & 8)))) { + if (v2 < 0L || v2 >= (expr_t)sizeof (expr_t) * CHARBIT) + cwarn( "Illegal shift count %.0s\"%ld\"%s" /* _W1_ _W8_ */ + , NULL, (long) v2, skip ? non_eval : NULL); +#if HAVE_LONG_LONG + else if (! g_internal_data->stdc3 && v2 >= (expr_t)sizeof (long) * CHARBIT + && ((! skip && (g_internal_data->warn_level & w_level)) + || (skip && (g_internal_data->warn_level & 8)))) + cwarn( +"Shift count %.0s\"%ld\" is larger than bit count of long%s" /* _W1_ _W8_*/ + , NULL, (long) v2, skip ? non_eval : NULL); +#endif + } + if ((op == OP_DIV || op == OP_MOD) && v2 == 0L) { + if (! skip) { + cerror( zero_div, NULL, 0L, NULL); + valp->sign = VAL_ERROR; + return valp; + } else { + if (g_internal_data->warn_level & 8) + cwarn( zero_div, NULL, 0L, non_eval); + valp->sign = sign1; + valp->val = (expr_t) EXPR_MAX; + return valp; + } + } + + if (! g_internal_data->standard || sign1 == SIGNED) + v1 = eval_signed( & valp, v1, v2, op); + else + v1 = eval_unsigned( & valp, (uexpr_t) v1, (uexpr_t) v2, op); + + if (valp->sign == VAL_ERROR) /* Out of range */ + return valp; + + switch (op) { + case OP_NOT: case OP_EQ: case OP_NE: + case OP_LT: case OP_LE: case OP_GT: case OP_GE: + case OP_ANA: case OP_ORO: + valp->sign = SIGNED; + break; + default: + valp->sign = sign1; + break; + } + valp->val = v1; + return valp; +} + +static expr_t eval_signed( + VAL_SIGN ** valpp, + expr_t v1, + expr_t v2, + int op +) +/* + * Apply the argument operator to the signed data. + * OP_COL is a special case. + */ +{ + const char * const illeg_op + = "Bug: Illegal operator \"%s\" in eval_signed()"; /* _F_ */ + const char * const not_portable + = "\"%s\" of negative number isn't portable%.0ld%s"; /* _W1_ _W8_*/ + const char * op_name = opname[ op]; + VAL_SIGN * valp = *valpp; + expr_t val; + int chk; /* Flag of overflow in long long */ + + switch (op) { + case OP_EOE: + case OP_PLU: break; + case OP_NEG: + chk = v1 && v1 == -v1; + if (chk +#if HAVE_LONG_LONG + || (! g_internal_data->stdc3 && v1 && (long) v1 == (long) -v1) +#endif + ) + overflow( op_name, valpp, chk); + v1 = -v1; + break; + case OP_COM: v1 = ~v1; break; + case OP_NOT: v1 = !v1; break; + case OP_MUL: + val = v1 * v2; + chk = v1 && v2 && (val / v1 != v2 || val / v2 != v1); + if (chk +#if HAVE_LONG_LONG + || (! g_internal_data->stdc3 && v1 && v2 + && ((long)val / (long)v1 != (long)v2 + || (long)val / (long)v2 != (long)v1)) +#endif + ) + overflow( op_name, valpp, chk); + v1 = val; + break; + case OP_DIV: + case OP_MOD: + /* Division by 0 has been already diagnosed by eval_eval(). */ + chk = -v1 == v1 && v2 == -1; + if (chk /* LONG_MIN / -1 on two's complement */ +#if HAVE_LONG_LONG + || (! g_internal_data->stdc3 + && (long)-v1 == (long)v1 && (long)v2 == (long)-1) +#endif + ) + overflow( op_name, valpp, chk); + else if (! g_internal_data->stdc3 && (v1 < 0L || v2 < 0L) + && ((! skip && (g_internal_data->warn_level & 1)) + || (skip && (g_internal_data->warn_level & 8)))) + cwarn( not_portable, op_name, 0L, skip ? non_eval : NULL); + if (op == OP_DIV) + v1 /= v2; + else + v1 %= v2; + break; + case OP_ADD: + val = v1 + v2; + chk = (v2 > 0L && v1 > val) || (v2 < 0L && v1 < val); + if (chk +#if HAVE_LONG_LONG + || (! g_internal_data->stdc3 + && (((long)v2 > 0L && (long)v1 > (long)val) + || ((long)v2 < 0L && (long)v1 < (long)val))) +#endif + ) + overflow( op_name, valpp, chk); + v1 = val; + break; + case OP_SUB: + val = v1 - v2; + chk = (v2 > 0L && val > v1) || (v2 < 0L && val < v1); + if (chk +#if HAVE_LONG_LONG + || (! g_internal_data->stdc3 + && (((long)v2 > 0L && (long)val > (long)v1) + || ((long)v2 < 0L && (long)val < (long)v1))) +#endif + ) + overflow( op_name, valpp, chk); + v1 = val; + break; + case OP_SL: v1 <<= v2; break; + case OP_SR: + if (v1 < 0L + && ((!skip && (g_internal_data->warn_level & 1)) + || (skip && (g_internal_data->warn_level & 8)))) + cwarn( not_portable, op_name, 0L, skip ? non_eval : NULL); + v1 >>= v2; + break; + case OP_LT: v1 = (v1 < v2); break; + case OP_LE: v1 = (v1 <= v2); break; + case OP_GT: v1 = (v1 > v2); break; + case OP_GE: v1 = (v1 >= v2); break; + case OP_EQ: v1 = (v1 == v2); break; + case OP_NE: v1 = (v1 != v2); break; + case OP_AND: v1 &= v2; break; + case OP_XOR: v1 ^= v2; break; + case OP_OR: v1 |= v2; break; + case OP_ANA: v1 = (v1 && v2); break; + case OP_ORO: v1 = (v1 || v2); break; + case OP_COL: + /* + * If v1 has the "true" value, v2 has the "false" value. + * The top of the value stack has the test. + */ + v1 = (--*valpp)->val ? v1 : v2; + break; + default: + cfatal( illeg_op, op_name, 0L, NULL); + } + + *valpp = valp; + return v1; +} + +static expr_t eval_unsigned( + VAL_SIGN ** valpp, + uexpr_t v1u, + uexpr_t v2u, + int op +) +/* + * Apply the argument operator to the unsigned data. + * Called from eval_eval() only in Standard mode. + */ +{ + const char * const illeg_op + = "Bug: Illegal operator \"%s\" in eval_unsigned()"; /* _F_ */ + const char * op_name = opname[ op]; + VAL_SIGN * valp = *valpp; + uexpr_t v1 = 0; + int chk; /* Flag of overflow in unsigned long long */ + int minus; /* Big integer converted from signed long */ + + minus = ! g_internal_data->stdc3 && (v1u > ULONGMAX || v2u > ULONGMAX); + + switch (op) { + case OP_EOE: + case OP_PLU: v1 = v1u; break; + case OP_NEG: + v1 = -v1u; + if (v1u) + overflow( op_name, valpp, TRUE); + break; + case OP_COM: v1 = ~v1u; break; + case OP_NOT: v1 = !v1u; break; + case OP_MUL: + v1 = v1u * v2u; + chk = v1u && v2u && (v1 / v2u != v1u || v1 / v1u != v2u); + if (chk +#if HAVE_LONG_LONG + || (! g_internal_data->stdc3 && ! minus && v1 > ULONGMAX) +#endif + ) + overflow( op_name, valpp, chk); + break; + case OP_DIV: + /* Division by 0 has been already diagnosed by eval_eval(). */ + v1 = v1u / v2u; + break; + case OP_MOD: + v1 = v1u % v2u; + break; + case OP_ADD: + v1 = v1u + v2u; + chk = v1 < v1u; + if (chk +#if HAVE_LONG_LONG + || (! g_internal_data->stdc3 && ! minus && v1 > ULONGMAX) +#endif + ) + overflow( op_name, valpp, chk); + break; + case OP_SUB: + v1 = v1u - v2u; + chk = v1 > v1u; + if (chk +#if HAVE_LONG_LONG + || (! g_internal_data->stdc3 && ! minus && v1 > ULONGMAX) +#endif + ) + overflow( op_name, valpp, chk); + break; + case OP_SL: v1 = v1u << v2u; break; + case OP_SR: v1 = v1u >> v2u; break; + case OP_LT: v1 = (v1u < v2u); break; + case OP_LE: v1 = (v1u <= v2u); break; + case OP_GT: v1 = (v1u > v2u); break; + case OP_GE: v1 = (v1u >= v2u); break; + case OP_EQ: v1 = (v1u == v2u); break; + case OP_NE: v1 = (v1u != v2u); break; + case OP_AND: v1 = v1u & v2u; break; + case OP_XOR: v1 = v1u ^ v2u; break; + case OP_OR: v1 = v1u | v2u; break; + case OP_ANA: v1 = (v1u && v2u); break; + case OP_ORO: v1 = (v1u || v2u); break; + case OP_COL: valp--; + if (valp->val) + v1 = v1u; + else + v1 = v2u; + break; + default: + cfatal( illeg_op, op_name, 0L, NULL); + } + + *valpp = valp; + return v1; +} + +static void overflow( + const char * op_name, + VAL_SIGN ** valpp, + int ll_overflow /* Flag of overflow in long long */ +) +{ + const char * const out_of_range + = "Result of \"%s\" is out of range%.0ld%s"; /* _E_ _W1_ _W8_ */ + +#if HAVE_LONG_LONG + if (g_internal_data->standard && ! ll_overflow) { + /* Overflow of long not in C99 mode */ + if ((! skip && (g_internal_data->warn_level & w_level)) || (skip && (g_internal_data->warn_level & 8))) + cwarn( out_of_range, op_name, 0L, " of (unsigned) long"); + } else +#endif + if (skip) { + if (g_internal_data->warn_level & 8) + cwarn( out_of_range, op_name, 0L, non_eval); + /* Else don't warn */ + } else if (g_internal_data->standard && (*valpp)->sign == UNSIGNED) {/* Never overflow */ + if (g_internal_data->warn_level & 1) + cwarn( out_of_range, op_name, 0L, NULL); + } else { + cerror( out_of_range, op_name, 0L, NULL); + (*valpp)->sign = VAL_ERROR; + } +} + +static void dump_val( + const char * msg, + const VAL_SIGN * valp +) +/* + * Dump a value by internal representation. + */ +{ +#if HAVE_LONG_LONG + const char * const format + = "%s(%ssigned long long) 0x%016" LL_FORM "x"; +#else + const char * const format = "%s(%ssigned long) 0x%08lx"; +#endif + int sign = valp->sign; + + mcpp_fprintf( DEST_DBG, format, msg, sign ? "" : "un", valp->val); +} + +static void dump_stack( + const OPTAB * opstack, /* Operator stack */ + const OPTAB * opp, /* Pointer into operator stack */ + const VAL_SIGN * value, /* Value stack */ + const VAL_SIGN * valp /* -> value vector */ +) +/* + * Dump stacked operators and values. + */ +{ + if (opstack < opp) + mcpp_fprintf( DEST_DBG, "Index op prec skip name -- op stack at %s" + , g_internal_data->infile->bptr); + + while (opstack < opp) { + mcpp_fprintf( DEST_DBG, " [%2d] %2d %04o %d %s\n", (int)(opp - opstack) + , opp->op, opp->prec, opp->skip, opname[ opp->op]); + opp--; + } + + while (value <= --valp) { + mcpp_fprintf( DEST_DBG, "value[%d].val = ", (int)(valp - value)); + dump_val( "", valp); + mcpp_fputc( '\n', DEST_DBG); + } +} + +#if defined(PK_COMPILER_MSVC) +# pragma warning( pop ) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic pop +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic pop +#endif diff --git a/Samples/PK-MCPP/expand.cpp b/Samples/PK-MCPP/expand.cpp new file mode 100644 index 00000000..2e211454 --- /dev/null +++ b/Samples/PK-MCPP/expand.cpp @@ -0,0 +1,2998 @@ +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * E X P A N D . C + * M a c r o E x p a n s i o n + * + * The macro expansion routines are placed here. + */ + +#include "precompiled.h" +#include "pk_mcpp_bridge.h" + +#if defined(PK_COMPILER_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4189) +# pragma warning( disable : 4703) +# pragma warning( disable : 4702) +# pragma warning( disable : 4101) +# pragma warning( disable : 4100) +# pragma warning( disable : 4611) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wwrite-strings" +# pragma clang diagnostic ignored "-Wunused-variable" +# pragma clang diagnostic ignored "-Wunused-parameter" +# pragma clang diagnostic ignored "-Wimplicit-fallthrough" +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wwrite-strings" +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wunused-but-set-variable" +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + +#define ARG_ERROR (-255) +#define CERROR 1 +#define CWARN 2 + +typedef struct location { /* Where macro or arg locate */ + long start_line; /* Beginning at 1 */ + size_t start_col; /* Beginning at 0 */ + long end_line; + size_t end_col; +} LOCATION; +typedef struct magic_seq { /* Data of a sequence inserted between tokens */ + char * magic_start; /* First MAC_INF sequence */ + char * magic_end; /* End of last MAC_INF seq */ + int space; /* Space succeeds or not */ +} MAGIC_SEQ; + +static char * expand_std( DEFBUF * defp, char * out, char * out_end + , LINE_COL line_col, int * pragma_op); + /* Expand a macro completely (for Standard modes) */ +static char * expand_prestd( DEFBUF * defp, char * out, char * out_end + , LINE_COL line_col, int * pragma_op); + /* Expand a macro completely (for pre-Standard modes) */ +static DEFBUF * is_macro_call( DEFBUF * defp, char ** cp, char ** endf + , MAGIC_SEQ * mgc_seq); /* Is this really a macro call ? */ +static int collect_args( const DEFBUF * defp, char ** arglist, int m_num); + /* Collect arguments of a macro call*/ +static int get_an_arg( int c, char ** argpp, char * arg_end + , char ** seqp, int var_arg, int nargs, LOCATION ** locp, int m_num + , MAGIC_SEQ * mgc_prefix); /* Get an argument */ +static int squeeze_ws( char ** out, char ** endf, MAGIC_SEQ * mgc_seq); + /* Squeeze white spaces to a space */ +static void skip_macro( void); + /* Skip the rest of macro call */ +static void diag_macro( int severity, const char * format + , const char * arg1, long arg2, const char * arg3, const DEFBUF * defp1 + , const DEFBUF * defp2) ; + /* Supplement diagnostic information*/ +static void dump_args( const char * why, int nargs, const char ** arglist); + /* Dump arguments list */ + +static int rescan_level; /* Times of macro rescan */ + +static const char * const macbuf_overflow + = "Buffer overflow expanding macro \"%s\" at %.0ld\"%s\""; /* _E_ */ +static const char * const empty_arg + = "Empty argument in macro call \"%s\""; /* _W2_ */ +static const char * const unterm_macro + = "Unterminated macro call \"%s\""; /* _E_ */ +static const char * const narg_error + = "%s than necessary %ld argument(s) in macro call \"%s\""; /* _E_ _W1_ */ +static const char * const only_name + = "Macro \"%s\" needs arguments"; /* _W8_ */ + +void expand_init() +/* Set expand_macro() function */ +{ + g_internal_data->expand_macro = g_internal_data->standard ? expand_std : expand_prestd; +} + +DEFBUF * is_macro( + char ** cp +) +/* + * The name is already in 'identifier', the next token is not yet read. + * Return the definition info if the name is a macro call, else return NULL. + */ +{ + DEFBUF * defp; + + if ((defp = look_id( g_internal_data->identifier)) != NULL) /* Is a macro name */ + return is_macro_call( defp, cp, NULL, NULL); + else + return NULL; +} + +static DEFBUF * is_macro_call( + DEFBUF * defp, + char ** cp, /* Pointer to output buffer */ + char ** endf, /* Pointer to indicate end of infile buffer */ + MAGIC_SEQ * mgc_seq /* Infs on MAC_INF sequences and space */ +) +/* + * Return DEFBUF if the defp->name is a macro call, else return NULL. + */ +{ + int c; + + if (defp->nargs >= 0 /* Function-like macro */ + || defp->nargs == DEF_PRAGMA) { /* _Pragma() pseudo-macro */ + c = squeeze_ws( cp, endf, mgc_seq); /* See the next char. */ + if (c == CHAR_EOF) /* End of file */ + unget_string( "\n", NULL); /* Restore skipped '\n' */ + else if (! g_internal_data->standard || c != RT_END) + /* Still in the file and rescan boundary ? */ + unget_ch(); /* To see it again */ + if (c != '(') { /* Only the name of function-like macro */ + if (! g_internal_data->standard && g_internal_data->warn_level & 8) + cwarn( only_name, defp->name, 0L, NULL); + return NULL; + } + } + return defp; /* Really a macro call */ +} + +/* + * expand_macro() expands a macro call completely, and writes out the result + * to the specified output buffer and returns the advanced pointer. + */ + + +/* + * T h e S T A N D A R D C o n f o r m i n g M o d e + * o f M a c r o E x p a n s i o n + * + * 1998/08 First released. kmatsui + */ + +/* For debug of -K option: should be turned off on release version. */ +#define DEBUG_MACRO_ANN FALSE + +/* Return value of is_able_repl() */ +#define NO 0 /* "Blue-painted" */ +#define YES 1 /* Not blue-painted */ +#define READ_OVER 2 + /* Still "blue-painted", yet has read over repl-list */ + +/* + * Macros related to macro notification mode. + * The macro notification routines are hacks on the normal processing + * routines, and very complicated and cumbersome. Be sure to keep symmetry + * of starting and closing magic sequences. Enable the routines enclosed + * by #if 0 - #endif for debugging. + * Any byte in the sequences beginning with MAC_INF can coincide with any + * other character. Hence, the data stream should be read from the top, + * not from the tail, in principle. + */ +/* Length of sequence of MAC_INF, MAC_CALL_START, mac_num-1, mac_num-2 */ +#define MAC_S_LEN 4 +/* Length of sequence of MAC_INF, MAC_ARG_START, mac_num1, mac_num2, arg-num*/ +#define ARG_S_LEN 5 +#define MAC_E_LEN 2 /* Length of MAC_INF, MAC_CALL_END sequence */ +#define ARG_E_LEN MAC_E_LEN /* Lenght of MAC_INF, MAC_ARG_END sequence */ +#define MAC_E_LEN_V 4 /* Length of macro closing sequence in verbose mode */ + /* MAC_INF, MAC_CALL_END, mac_num1, mac_num2 */ +#define ARG_E_LEN_V 5 /* Length of argument closing sequence in verbose */ + /* MAC_INF, MAC_ARG_END, mac_num1, mac_num2, arg_num */ +#define IN_SRC_LEN 3 /* Length of sequence of IN_SRC, num-1, num-2 */ +#define INIT_MAC_INF 0x100 /* Initial num of elements in mac_inf[] */ +#define MAX_MAC_INF 0x1000 /* Maximum num of elements in mac_inf[] */ +#define INIT_IN_SRC_NUM 0x100 /* Initial num of elements in in_src[] */ +#define MAX_IN_SRC_NUM 0x1000 /* Maximum num of elements in in_src[] */ + +/* Variables for macro notification mode */ +typedef struct macro_inf { /* Informations of a macro */ + const DEFBUF * defp; /* Definition of the macro */ + char * args; /* Arguments, if any */ + int num_args; /* Number of real arguments */ + int recur; /* Recurrence of this macro */ + LOCATION locs; /* Location of macro call */ + LOCATION * loc_args; /* Location of arguments */ +} MACRO_INF; +static MACRO_INF * mac_inf; +static int max_mac_num; /* Current num of elements in mac_inf[] */ +static int mac_num; /* Index into mac_inf[] */ +static LOCATION * in_src; /* Location of identifiers in macro arguments */ +static int max_in_src_num; /* Current num of elements in in_src[] */ +static int in_src_num; /* Index into in_src[] */ +static int trace_macro; /* Enable to trace macro infs */ + +static struct { + const DEFBUF * def; /* Macro definition */ + int read_over; /* Has read over repl-list */ + /* 'read_over' is never used in POST_STD mode and in compat_mode*/ +} replacing[ RESCAN_LIMIT]; /* Macros currently replacing */ +static int has_pragma = FALSE; /* Flag of _Pragma() operator */ + +static int print_macro_inf( int c, char ** cpp, char ** opp); + /* Embed macro infs into comments */ +static char * print_macro_arg( char *out, MACRO_INF * m_inf, int argn + , int real_arg, int start); + /* Embed macro arg inf into comments*/ +static char * chk_magic_balance( char * buf, char * buf_end, int move + , int diag); /* Check imbalance of magics */ +static char * replace( DEFBUF * defp, char * out, char * out_end + , const DEFBUF * outer, FILEINFO * rt_file, LINE_COL line_col + , int in_src_n); + /* Replace a macro recursively */ +static char * close_macro_inf( char * out_p, int m_num, int in_src_n); + /* Put closing mark for a macro call*/ +static DEFBUF * def_special( DEFBUF * defp); + /* Re-define __LINE__, __FILE__ */ +static int prescan( const DEFBUF * defp, const char ** arglist + , char * out, char * out_end); + /* Process #, ## operator */ +static char * catenate( const DEFBUF * defp, const char ** arglist + , char * out, char * out_end, char ** token_p); + /* Catenate tokens */ +static const char * remove_magics( const char * argp, int from_last); + /* Remove pair of magic characters */ +#if DEBUG_MACRO_ANN +static void chk_symmetry( char * start_id, char * end_id, size_t len); + /* Check if a pair of magics are symmetrical */ +#endif +static char * stringize( const DEFBUF * defp, const char * argp, char * out); + /* Stringize an argument */ +static char * substitute( const DEFBUF * defp, const char ** arglist + , const char * in, char * out, char * out_end); + /* Substitute parms with arguments */ +static char * rescan( const DEFBUF * outer, const char * in, char * out + , char * out_end); + /* Rescan once replaced sequences */ +static int disable_repl( const DEFBUF * defp); + /* Disable the macro once replaced */ +static void enable_repl( const DEFBUF * defp, int done); + /* Enable the macro for later use */ +static int is_able_repl( const DEFBUF * defp); + /* Is the macro allowed to replace? */ +static char * insert_to_bptr( char * ins, size_t len); + /* Insert a sequence into infile->bptr */ + +static char * expand_std( + DEFBUF * defp, /* Macro definition */ + char * out, /* Output buffer */ + char * out_end, /* End of output buffer */ + LINE_COL line_col, /* Location of macro */ + int * pragma_op /* _Pragma() is found ? */ +) +/* + * Expand a macro call completely, write the results to the specified buffer + * and return the advanced output pointer. + */ +{ + char macrobuf[ NMACWORK + IDMAX]; /* Buffer for replace() */ + char * out_p = out; + size_t len; + int c, c1; + char * cp; + + has_pragma = FALSE; /* Have to re-initialize*/ + g_internal_data->macro_line = g_internal_data->src_line; /* Line number for diag */ + g_internal_data->macro_name = defp->name; + rescan_level = 0; + trace_macro = (g_internal_data->mcpp_mode == STD) && (g_internal_data->mcpp_debug & MACRO_CALL) + && ! g_internal_data->in_directive; + if (trace_macro) { + max_mac_num = INIT_MAC_INF; + mac_inf = (MACRO_INF *) xmalloc( sizeof (MACRO_INF) * max_mac_num); + memset( mac_inf, 0, sizeof (MACRO_INF) * max_mac_num); + max_in_src_num = INIT_IN_SRC_NUM; + in_src = (LOCATION *) xmalloc( sizeof (LOCATION) * max_in_src_num); + memset( in_src, 0, sizeof (LOCATION) * max_in_src_num); + mac_num = in_src_num = 0; /* Initialize */ + } + if (replace( defp, macrobuf, macrobuf + NMACWORK, NULL, g_internal_data->infile, line_col + , 0) == NULL) { /* Illegal macro call */ + skip_macro(); + g_internal_data->macro_line = MACRO_ERROR; + goto exp_end; + } + len = (size_t) (out_end - out); + if (strlen( macrobuf) > len) { + cerror( macbuf_overflow, g_internal_data->macro_name, 0, macrobuf); + memcpy( out, macrobuf, len); + out_p = out + len; + g_internal_data->macro_line = MACRO_ERROR; + goto exp_end; + } + +#if DEBUG_MACRO_ANN + chk_magic_balance( macrobuf, macrobuf + strlen( macrobuf), FALSE, TRUE); +#endif + cp = macrobuf; + c1 = '\0'; /* The char previous to 'c' */ + while ((c = *cp++) != EOS) { + if (c == DEF_MAGIC) + continue; /* Skip DEF_MAGIC */ + if (g_internal_data->mcpp_mode == STD) { + if (c == IN_SRC) { /* Skip IN_SRC */ + if (trace_macro) + cp += 2; /* Skip also the number (coded in 2 bytes) */ + continue; + } else if (c == TOK_SEP) { + /* Remove redundant token separator */ + if ((g_internal_data->char_type[ c1 & UCHARMAX] & HSP) + || (g_internal_data->char_type[ *cp & UCHARMAX] & HSP) + || g_internal_data->in_include || g_internal_data->option_flags.lang_asm + || (*cp == MAC_INF && *(cp + 1) == MAC_CALL_END) + || (!g_internal_data->option_flags.v && c1 == MAC_CALL_END) + || (g_internal_data->option_flags.v + && *(cp - MAC_E_LEN_V - 1) == MAC_INF + && *(cp - MAC_E_LEN_V) == MAC_CALL_END)) + continue; + /* Skip separator just after ' ', '\t' */ + /* and just after MAC_CALL_END. */ + /* Also skip this in lang_asm mode, #include */ + /* Skip just before another TOK_SEP, ' ', '\t' */ + /* Skip just before MAC_INF,MAC_CALL_END seq too*/ + else + c = ' '; /* Else convert to ' ' */ + } else if (trace_macro && (c == MAC_INF)) { + /* Embed macro expansion informations into comments */ + c = *cp++; + c1 = print_macro_inf( c, &cp, &out_p); + if (out_end <= out_p) { + cerror( macbuf_overflow, g_internal_data->macro_name, 0, out); + g_internal_data->macro_line = MACRO_ERROR; + goto exp_end; + } + continue; + } + } + c1 = c; + *out_p++ = (char)c; + } + + g_internal_data->macro_line = 0; +exp_end: + *out_p = EOS; + if (g_internal_data->mcpp_debug & EXPAND) + dump_string( "expand_std exit", out); + g_internal_data->macro_name = NULL; + clear_exp_mac(); /* Clear the information for diagnostic */ + if (trace_macro) { /* Clear macro informations */ + int num; + for (num = 1; num < mac_num; num++) { /* 'num' start at 1 */ + if (mac_inf[ num].num_args >= 0) { /* Macro with args */ + free( mac_inf[ num].args); /* Saved arguments */ + free( mac_inf[ num].loc_args); /* Location of args */ + } + } + free( mac_inf); + free( in_src); + } + *pragma_op = has_pragma; + + return out_p; +} + +static int print_macro_inf( + int c, + char ** cpp, /* Magic character sequence */ + char ** opp /* Output for macro information */ +) +/* + * Embed macro expansion information into comments. + * Enabled by '#pragma MCPP debug macro_call' or -K option in STD mode. + */ +{ + MACRO_INF * m_inf = NULL; + int num; + int num_args; /* Number of actual args (maybe less than expected) */ + int i; + + if (*((*opp) - 1) == '/' && *((*opp) - 2) != '*') + /* Immediately preceding token is '/' (not '*' and '/') */ + *((*opp)++) = ' '; + /* Insert a space to separate with following '/' and '*' */ + if (g_internal_data->option_flags.v || c == MAC_CALL_START || c == MAC_ARG_START) { + num = ((*(*cpp)++ & UCHARMAX) - 1) * UCHARMAX; + num += (*(*cpp)++ & UCHARMAX) - 1; + m_inf = & mac_inf[ num]; /* Saved information */ + } + switch (c) { + case MAC_CALL_START : /* Start of a macro expansion */ + *opp += sprintf( *opp, "/*<%s", m_inf->defp->name); /* Macro name */ + if (m_inf->locs.start_line) { + /* Location of the macro call in source file */ + *opp += sprintf( *opp, " %ld:%d-%ld:%d" + , m_inf->locs.start_line, (int) m_inf->locs.start_col + , m_inf->locs.end_line, (int) m_inf->locs.end_col); + } + *opp = stpcpy( *opp, "*/"); + if ((num_args = m_inf->num_args) >= 1) { + /* The macro has arguments. Show the locations. */ + for (i = 0; i < num_args; i++) /* Arg num begins at 0 */ + *opp = print_macro_arg( *opp, m_inf, i, TRUE, TRUE); + } + break; + case MAC_ARG_START : /* Start of an argument */ + i = (*(*cpp)++ & UCHARMAX) - 1; /* Argument number */ + *opp = print_macro_arg( *opp, m_inf, i, FALSE, TRUE); + break; + case MAC_CALL_END : /* End of a macro expansion */ + if (g_internal_data->option_flags.v) { /* Verbose mode */ + *opp += sprintf( *opp, "/*%s>*/", m_inf->defp->name); + break; + } + /* Else fall through */ + case MAC_ARG_END : /* End of an argument */ + if (g_internal_data->option_flags.v) { + i = (*(*cpp)++ & UCHARMAX) - 1; + /* Output verbose infs symmetrical to start of the arg infs */ + *opp = print_macro_arg( *opp, m_inf, i, FALSE, FALSE); + } else { + *opp = stpcpy( *opp, "/*>*/"); + } + break; + } + + return **cpp & UCHARMAX; +} + +static char * print_macro_arg( + char * out, /* Output buffer */ + MACRO_INF * m_inf, /* &mac_inf[ m_num] */ + int argn, /* Argument number */ + int real_arg, /* Real argument or expanded argument ? */ + int start /* Start of an argument or end ? */ +) +/* + * Embed an argument information into a comment. + * This routine is only called from above print_macro_inf(). + */ +{ + LOCATION * loc = m_inf->loc_args + argn; + + out += sprintf( out, "/*%s%s:%d-%d", real_arg ? "!" : (start ? "<" : "") + , m_inf->defp->name, m_inf->recur, argn); + + if (real_arg && m_inf->loc_args && loc->start_line) { + /* Location of the argument in source file */ + out += sprintf( out, " %ld:%d-%ld:%d", loc->start_line + , (int) loc->start_col, loc->end_line, (int) loc->end_col); + } + if (! start) /* End of an argument in verbose mode */ + out = stpcpy( out, ">"); + out = stpcpy( out, "*/"); + + return out; +} + +static char * chk_magic_balance( + char * buf, /* Sequence to check */ + char * buf_end, /* End of the sequence */ + int move, /* Move a straying magic ? */ + int diag /* Output a diagnostic? */ +) +/* + * Check imbalance of macro information magics and warn it. + * get_an_arg() calls this routine setting 'move' argument on, hence a stray + * magic is moved to an edge if found. + * This routine does not do token parsing. Yet it will do fine practically. + */ +{ +#define MAX_NEST_MAGICS 255 + char mac_id[ MAX_NEST_MAGICS][ MAC_E_LEN_V - 2]; + char arg_id[ MAX_NEST_MAGICS][ ARG_E_LEN_V - 2]; + char * mac_loc[ MAX_NEST_MAGICS]; + char * arg_loc[ MAX_NEST_MAGICS]; + const char * mesg = "%s %ld %s-closing-comment(s) in tracing macro"; + int mac, arg; + int mac_s_n, mac_e_n, arg_s_n, arg_e_n; + char * buf_p = buf; /* Save 'buf' for debugging purpose */ + + mac = arg = 0; + + while (buf_p < buf_end) { + if (*buf_p++ != MAC_INF) + continue; + switch (*buf_p++) { + case MAC_CALL_START : + if (g_internal_data->option_flags.v) { + mac_loc[ mac] = buf_p - 2; + memcpy( mac_id[ mac], buf_p, MAC_S_LEN - 2); + } + mac++; + buf_p += MAC_S_LEN - 2; + break; + case MAC_ARG_START : + if (g_internal_data->option_flags.v) { + arg_loc[ arg] = buf_p - 2; + memcpy( arg_id[ arg], buf_p, ARG_S_LEN - 2); + } + arg++; + buf_p += ARG_S_LEN - 2; + break; + case MAC_ARG_END : + arg--; + if (g_internal_data->option_flags.v) { + if (arg < 0) { /* Perhaps moved magic */ + if (diag) + cwarn( mesg, "Redundant", (long) -arg, "argument"); + } else if (memcmp( arg_id[ arg], buf_p, ARG_E_LEN_V - 2) != 0) + { + char * to_be_edge = NULL; + char * cur_edge; + + if (arg >= 1 && memcmp( arg_id[ 0], buf_p, ARG_E_LEN_V - 2) + == 0) { + to_be_edge = arg_loc[ arg]; + /* To be moved to top */ + cur_edge = arg_loc[ 0]; /* Current top */ + } else if (arg == 0) { + char arg_end_magic[ 2] = { MAC_INF, MAC_ARG_END}; + cur_edge = buf_end - ARG_E_LEN_V; + /* Search the last magic */ + /* Sequence from get_an_arg() is always */ + /* surrounded by starting of an arg magic */ + /* and its corresponding closing magic. */ + while (buf_p + (ARG_E_LEN_V - 2) <= cur_edge + && memcmp( cur_edge, arg_end_magic, 2) != 0) + cur_edge--; + if (buf_p + (ARG_E_LEN_V - 2) <= cur_edge + && memcmp( arg_id[ 0], cur_edge + 2 + , ARG_E_LEN_V - 2) == 0) { + to_be_edge = buf_p - 2; /* To be moved to end */ + } + } + if (to_be_edge) { /* Appropriate place found */ + if (diag) { + mac_s_n = ((to_be_edge[ 2] & UCHARMAX) - 1) + * UCHARMAX; + mac_s_n += (to_be_edge[ 3] & UCHARMAX) - 1; + arg_s_n = (to_be_edge[ 4] & UCHARMAX) - 1; + mcpp_fprintf( DEST_ERR, + "Stray arg inf of macro: %d:%d at line:%d\n" + , mac_s_n, arg_s_n, g_internal_data->src_line); + } + if (move) { + /* Move a stray magic to outside of sequences */ + char magic[ ARG_E_LEN_V]; + size_t len = ARG_E_LEN_V; + memcpy( magic, cur_edge, len); + /* Save current edge */ + if (to_be_edge == arg_loc[ arg]) + /* Shift followings to cur_edge */ + memmove( cur_edge, cur_edge + len + , to_be_edge - cur_edge); + else /* Shift precedents to cur_edge */ + memmove( to_be_edge + len, to_be_edge + , cur_edge - to_be_edge); + memcpy( to_be_edge, magic, len); + /* Restore old 'cur_edge' into old 'to_be_edge' */ + } + } else { /* Serious imbalance, just warn */ + char * arg_p = arg_id[ arg]; + arg_s_n = ((arg_p[ 0] & UCHARMAX) - 1) * UCHARMAX; + arg_s_n += (arg_p[ 1] & UCHARMAX) - 1; + arg_e_n = ((buf_p[ 0] & UCHARMAX) - 1) * UCHARMAX; + arg_e_n += (buf_p[ 1] & UCHARMAX) - 1; + mcpp_fprintf( DEST_ERR, + "Asymmetry of arg inf found: start %d, end %d at line:%d\n" + , arg_s_n, arg_e_n, g_internal_data->src_line); + } + } + buf_p += ARG_E_LEN_V - 2; + } + break; + case MAC_CALL_END : + mac--; + if (g_internal_data->option_flags.v) { + if (mac < 0) { + if (diag) + cwarn( mesg, "Redundant", (long) -mac, "macro"); + } else if (memcmp( mac_id[ mac], buf_p, MAC_E_LEN_V - 2) != 0) + { + char * mac_p = mac_id[ mac]; + mac_s_n = ((mac_p[ 0] & UCHARMAX) - 1) * UCHARMAX; + mac_s_n += (mac_p[ 1] & UCHARMAX) - 1; + mac_e_n = ((buf_p[ 0] & UCHARMAX) - 1) * UCHARMAX; + mac_e_n += (buf_p[ 1] & UCHARMAX) - 1; + mcpp_fprintf( DEST_ERR, + "Asymmetry of macro inf found: start %d, end %d at line:%d\n" + , mac_s_n, mac_e_n, g_internal_data->src_line); + } + buf_p += MAC_E_LEN_V - 2; + } + break; + default : /* Not a MAC_INF sequence */ + break; /* Continue */ + } + } + + if (diag && (g_internal_data->warn_level & 1)) { + if (mac > 0) + cwarn( mesg, "Lacking", (long) mac, "macro"); + if (arg > 0) + cwarn( mesg, "Lacking", (long) arg, "argument"); + if ((mac || arg) && (g_internal_data->mcpp_debug & EXPAND)) + mcpp_fputs( +"Imbalance of magics occurred (perhaps a moved magic), see and diagnostics.\n" + , DEST_DBG); + } + + return buf; +} + +static char * replace( + DEFBUF * defp, /* Macro to be replaced */ + char * out, /* Output Buffer */ + char * out_end, /* End of output buffer */ + const DEFBUF * outer, /* Outer macro replacing*/ + FILEINFO * rt_file, /* Repl-text "file" */ + LINE_COL line_col, /* Location of macro */ + int in_src_n /* Index into in_src[] */ +) +/* + * Replace a possibly nested macro recursively. + * replace() and rescan() call each other recursively. + * Return the advanced output pointer or NULL on error. + */ +{ + char ** arglist = NULL; /* Pointers to arguments*/ + int nargs; /* Number of arguments expected */ + char * catbuf; /* Buffer for prescan() */ + char * expbuf; /* Buffer for substitute() */ + char * out_p; /* Output pointer */ + char * cur_out = out; /* One more output pointer */ + int num_args; + /* Number of actual arguments (maybe less than expected) */ + int enable_trace_macro; /* To exclude _Pragma() pseudo macro */ + int m_num = 0; /* 'mac_num' of current macro */ + MACRO_INF * m_inf = NULL; /* Pointer into mac_inf[] */ + + if (g_internal_data->mcpp_debug & EXPAND) { + dump_a_def( "replace entry", defp, FALSE, TRUE, g_internal_data->fp_debug); + dump_unget( "replace entry"); + } + if ((g_internal_data->mcpp_debug & MACRO_CALL) && g_internal_data->in_if) + mcpp_fprintf( DEST_OUT, "/*%s*/", defp->name); + + enable_trace_macro = trace_macro && defp->nargs != DEF_PRAGMA; + if (enable_trace_macro) { + int num; + int recurs; + + if (mac_num >= MAX_MAC_INF - 1) { + cerror( "Too many nested macros in tracing %s" /* _E_ */ + , defp->name, 0L, NULL); + return NULL; + } else if (mac_num >= max_mac_num - 1) { + size_t len = sizeof (MACRO_INF) * max_mac_num; + /* Enlarge the array */ + mac_inf = (MACRO_INF *) xrealloc( (char *) mac_inf, len * 2); + memset( mac_inf + max_mac_num, 0, len); + /* Clear the latter half */ + max_mac_num *= 2; + } + m_num = ++mac_num; /* Remember this number */ + /* Note 'mac_num' starts at 1 */ + *cur_out++ = MAC_INF; /* Embed a magic char */ + *cur_out++ = MAC_CALL_START; /* A macro call */ + /* Its index number, can be greater than UCHARMAX */ + /* We represent the number by 2 bytes where each byte is not '\0' */ + *cur_out++ = (char)((m_num / UCHARMAX) + 1); + *cur_out++ = (char)((m_num % UCHARMAX) + 1); + *cur_out = EOS; + m_inf = & mac_inf[ m_num]; + m_inf->defp = defp; /* The macro definition */ + m_inf->num_args = 0; /* Default num of args */ + if (line_col.line) { + get_src_location( & line_col); + m_inf->locs.start_line = line_col.line; + m_inf->locs.start_col = line_col.col; + } else { + m_inf->locs.start_col = m_inf->locs.start_line = 0L; + } + m_inf->args = NULL; /* Default args */ + m_inf->loc_args = NULL; + for (num = 1, recurs = 0; num < m_num; num++) + if (mac_inf[ num].defp == defp) + recurs++; /* Recursively nested macro */ + m_inf->recur = recurs; + } + + nargs = (defp->nargs == DEF_PRAGMA) ? 1 : (defp->nargs & ~AVA_ARGS); + + if (nargs < DEF_NOARGS_DYNAMIC) { /* __FILE__, __LINE__ */ + defp = def_special( defp); /* These are redefined dynamically */ + if (g_internal_data->mcpp_mode == STD) { + /* Wrap repl-text with token separators to prevent token merging */ + *cur_out++ = TOK_SEP; + cur_out = stpcpy( cur_out, defp->repl); + *cur_out++ = TOK_SEP; + *cur_out = EOS; + } else { + cur_out = stpcpy( cur_out, defp->repl); + } + if (enable_trace_macro) { + m_inf->defp = defp; /* Redefined dynamically*/ + cur_out = close_macro_inf( cur_out, m_num, in_src_n); + } + return cur_out; + } else if (nargs == DEF_NOARGS_PREDEF_OLD && g_internal_data->standard + && (g_internal_data->warn_level & 1)) { /* Some macros on GCC */ + cwarn( "Old style predefined macro \"%s\" is used", /* _W2_ */ + defp->name, 0L, NULL); + } else if (nargs >= 0) { /* Function-like macro */ + squeeze_ws( NULL, NULL, NULL); /* Skip to '(' */ + /* Magic sequences are already read over by is_macro_call() */ + arglist = (char **) xmalloc( (nargs + 1) * sizeof (char *)); + arglist[ 0] = xmalloc( (size_t) (NMACWORK + IDMAX * 2)); + /* Note: arglist[ n] may be reallocated */ + /* and re-written by collect_args() */ + if ((num_args = collect_args( defp, arglist, m_num)) == ARG_ERROR) { + free( arglist[ 0]); /* Syntax error */ + free( arglist); + return NULL; + } + if (enable_trace_macro) { + /* Save the arglist for later informations */ + m_inf->args = arglist[ 0]; + m_inf->num_args = num_args; /* Number of actual args*/ + } + if (g_internal_data->mcpp_mode == STD && outer && rt_file != g_internal_data->infile) { + /* Has read over replacement-text */ + if (g_system_data->compat_mode) { + enable_repl( outer, FALSE); /* Enable re-expansion */ + if (g_internal_data->mcpp_debug & EXPAND) + dump_string( "enabled re-expansion" + , outer ? outer->name : ""); + } else { + replacing[ rescan_level-1].read_over = READ_OVER; + } + } + } + + catbuf = xmalloc( (size_t) (NMACWORK + IDMAX)); + if (g_internal_data->mcpp_debug & EXPAND) { + mcpp_fprintf( DEST_DBG, "(%s)", defp->name); + dump_string( "prescan entry", defp->repl); + } + if (prescan( defp, (const char **) arglist, catbuf, catbuf + NMACWORK) + == FALSE) { /* Process #, ## operators */ + diag_macro( CERROR, macbuf_overflow, defp->name, 0L, catbuf, defp + , NULL); + if (nargs >= 0) { + if (! enable_trace_macro) + /* arglist[0] is needed for macro infs */ + free( arglist[ 0]); + free( arglist); + } + free( catbuf); + return NULL; + } + catbuf = xrealloc( catbuf, strlen( catbuf) + 1); + /* Use memory sparingly */ + if (g_internal_data->mcpp_debug & EXPAND) { + mcpp_fprintf( DEST_DBG, "(%s)", defp->name); + dump_string( "prescan exit", catbuf); + } + + if (nargs > 0) { /* Function-like macro with any argument */ + expbuf = xmalloc( (size_t) (NMACWORK + IDMAX)); + if (g_internal_data->mcpp_debug & EXPAND) { + mcpp_fprintf( DEST_DBG, "(%s)", defp->name); + dump_string( "substitute entry", catbuf); + } + out_p = substitute( defp, (const char **) arglist, catbuf, expbuf + , expbuf + NMACWORK); /* Expand each arguments */ + if (! enable_trace_macro) + free( arglist[ 0]); + free( arglist); + free( catbuf); + expbuf = xrealloc( expbuf, strlen( expbuf) + 1); + /* Use memory sparingly */ + if (g_internal_data->mcpp_debug & EXPAND) { + mcpp_fprintf( DEST_DBG, "(%s)", defp->name); + dump_string( "substitute exit", expbuf); + } + } else { /* Object-like macro or */ + if (nargs == 0 && ! enable_trace_macro) + /* Function-like macro with no argument */ + free( arglist[ 0]); + free( arglist); + out_p = expbuf = catbuf; + } + + if (out_p) + out_p = rescan( defp, expbuf, cur_out, out_end); + if (out_p && defp->nargs == DEF_PRAGMA) + has_pragma = TRUE; + /* Inform mcpp_main() that _Pragma() was found */ + free( expbuf); + if (enable_trace_macro && out_p) + out_p = close_macro_inf( out_p, m_num, in_src_n); + if (g_internal_data->mcpp_debug & EXPAND) + dump_string( "replace exit", out); + + if (trace_macro && defp->nargs == DEF_PRAGMA) { + /* Remove intervening magics if the macro is _Pragma pseudo-macro */ + /* These magics have been inserted by macros in _Pragma()'s args */ + int c; + cur_out = out_p = out; + while ((c = *cur_out++) != EOS) { + if (c == MAC_INF) { + if (! g_internal_data->option_flags.v) { + switch (*cur_out) { + case MAC_ARG_START : + cur_out++; + /* Fall through */ + case MAC_CALL_START : + cur_out++; + cur_out++; + /* Fall through */ + default: + cur_out++; + break; + } + } else { + switch (*cur_out) { + case MAC_ARG_START : + case MAC_ARG_END : + cur_out++; + /* Fall through */ + default: + cur_out += 3; + break; + } + } + } else { + *out_p++ = (char)c; + } + } + *out_p = EOS; + } + + return out_p; +} + +static char * close_macro_inf( + char * out_p, /* Current output pointer */ + int m_num, /* 'mac_num' of this macro */ + int in_src_n /* Location of macro in arg */ +) +/* + * Mark up closing of a macro expansion. + * Note that 'm_num' argument is necessary rather than 'm_inf' from replace(), + * because mac_inf[] may have been reallocated while rescanning. + */ +{ + MACRO_INF * m_inf; + LINE_COL e_line_col; + + m_inf = & mac_inf[ m_num]; + *out_p++ = MAC_INF; /* Magic for end of macro expansion */ + *out_p++ = MAC_CALL_END; + if (g_internal_data->option_flags.v) { + *out_p++ = (char)((m_num / UCHARMAX) + 1); + *out_p++ = (char)((m_num % UCHARMAX) + 1); + } + *out_p = EOS; + get_ch(); /* Clear the garbage */ + unget_ch(); + if (g_internal_data->infile->fp || in_src_n) { + if (g_internal_data->infile->fp) { /* Macro call on source file */ + e_line_col.line = g_internal_data->src_line; + e_line_col.col = g_internal_data->infile->bptr - g_internal_data->infile->buffer; + } else { /* Macro in argument of parent macro and from source */ + e_line_col.line = in_src[ in_src_n].end_line; + e_line_col.col = in_src[ in_src_n].end_col; + } + /* Get the location before line splicing by */ + /* or by a line-crossing comment */ + get_src_location( & e_line_col); + m_inf->locs.end_line = e_line_col.line; + m_inf->locs.end_col = e_line_col.col; + } else { + m_inf->locs.end_col = m_inf->locs.end_line = 0L; + } + + return out_p; +} + +static DEFBUF * def_special( + DEFBUF * defp /* Macro definition */ +) +/* + * Re-define __LINE__, __FILE__. + * Return the new definition. + */ +{ + const FILEINFO * file; + DEFBUF ** prevp; + int cmp; + + switch (defp->nargs) { + case DEF_NOARGS_DYNAMIC - 1: /* __LINE__ */ + if ((g_internal_data->src_line > g_internal_data->std_limits.line_num || g_internal_data->src_line <= 0) + && (g_internal_data->warn_level & 1)) + diag_macro( CWARN + , "Line number %.0s\"%ld\" is out of range" /* _W1_ */ + , NULL, g_internal_data->src_line, NULL, defp, NULL); + sprintf( defp->repl, "%ld", g_internal_data->src_line); /* Re-define */ + break; + case DEF_NOARGS_DYNAMIC - 2: /* __FILE__ */ + for (file = g_internal_data->infile; file != NULL; file = file->parent) { + if (file->fp != NULL) { + sprintf( g_internal_data->work_buf, "\"%s\"", file->filename); + if (str_eq( g_internal_data->work_buf, defp->repl)) + break; /* No change */ + defp->nargs = DEF_NOARGS; /* Enable to redefine */ + prevp = look_prev( defp->name, &cmp); + defp = install_macro( "__FILE__", DEF_NOARGS_DYNAMIC - 2, "" + , g_internal_data->work_buf, prevp, cmp, 0); /* Re-define */ + break; + } + } + break; + } + return defp; +} + +static int prescan( + const DEFBUF * defp, /* Definition of the macro */ + const char ** arglist, /* Pointers to actual arguments */ + char * out, /* Output buffer */ + char * out_end /* End of output buffer */ +) +/* + * Concatenate the tokens surounding ## by catenate(), and stringize the + * argument following # by stringize(). + */ +{ + FILEINFO * file; + char * prev_token = NULL; /* Preceding token */ + char * horiz_space = NULL; /* Horizontal white space */ + int c; /* Value of a character */ + /* + * The replacement lists are -- + * stuff1stuff2 + * or stuff1stuff2stuff3... + * where is CAT, maybe with preceding space and following space, + * stuff might be + * ordinary-token + * MAC_PARM + * or MAC_PARM + * where is ST_QUO, possibly with following space. + * + * DEF_MAGIC may has been inserted sometimes. + * In other than POST_STD modes, TOK_SEP and IN_SRC may have been + * inserted, and TOK_SEPs are inserted also in this routine. + * In trace_macro mode, many magic character sequences may have been + * inserted here and there. + */ + + if (g_internal_data->mcpp_mode == POST_STD) { + file = unget_string( defp->repl, defp->name); + } else { + *out++ = TOK_SEP; /* Wrap replacement */ + g_internal_data->workp = g_internal_data->work_buf; /* text with token */ + g_internal_data->workp = stpcpy( g_internal_data->workp, defp->repl); /* separators to */ + *g_internal_data->workp++ = TOK_SEP; /* prevent unintended*/ + *g_internal_data->workp = EOS; /* token merging. */ + file = unget_string( g_internal_data->work_buf, defp->name); + } + + while (c = get_ch(), file == g_internal_data->infile) { /* To the end of repl */ + + switch (c) { + case ST_QUOTE: + skip_ws(); /* Skip spaces and the returned MAC_PARM*/ + c = get_ch() - 1; /* Parameter number */ + prev_token = out; /* Remember the token */ + out = stringize( defp, arglist[ c], out); + /* Stringize without expansion */ + horiz_space = NULL; + break; + case CAT: + if (*prev_token == DEF_MAGIC || *prev_token == IN_SRC) { + /* Rare case yet possible after catenate() */ + size_t len = 1; + /* Remove trailing white space prior to removing DEF_MAGIC */ + if (horiz_space == out - 1) { + *--out = EOS; + horiz_space = NULL; + } + if (*prev_token == IN_SRC && trace_macro) + len = IN_SRC_LEN; + memmove( prev_token, prev_token + len + , strlen( prev_token + len)); + out -= len; + *out = EOS; /* Remove DEF_MAGIC, IN_SRC */ + } +#if COMPILER == GNUC + if (*prev_token == ',') + break; /* ', ##' sequence (peculiar to GCC) */ +#endif + if (horiz_space == out - 1) { + *--out = EOS; /* Remove trailing white space */ + horiz_space = NULL; + } + out = catenate( defp, arglist, out, out_end, &prev_token); + if (g_internal_data->char_type[ *(out - 1) & UCHARMAX] & HSP) + horiz_space = out - 1; /* TOK_SEP has been appended */ + break; + case MAC_PARM: + prev_token = out; + *out++ = MAC_PARM; + *out++ = (char)get_ch(); /* Parameter number */ + break; + case TOK_SEP: + case ' ': + case '\t' : + if (out - 1 == horiz_space) + continue; /* Squeeze white spaces */ + horiz_space = out; + *out++ = (char)c; + break; + default: + prev_token = out; + scan_token( c, &out, out_end); /* Ordinary token */ + break; + } + + *out = EOS; /* Ensure termination */ + if (out_end <= out) /* Buffer overflow */ + return FALSE; + } + + *out = EOS; /* Ensure terminatation in case of no token */ + unget_ch(); + return TRUE; +} + +static char * catenate( + const DEFBUF * defp, /* The macro definition */ + const char ** arglist, /* Pointers to actual arguments */ + char * out, /* Output buffer */ + char * out_end, /* End of output buffer */ + char ** token_p /* Address of preceding token pointer */ +) +/* + * Concatenate the previous and the following tokens. + * Note: The parameter codes may coincide with white spaces or any + * other characters. + */ +{ + FILEINFO * file; + char * prev_prev_token = NULL; + const char * invalid_token + = "Not a valid preprocessing token \"%s\""; /* _E_ _W2_ */ + const char * argp; /* Pointer to an actual argument*/ + char * prev_token = *token_p; /* Preceding token */ + int in_arg = FALSE; + int c; /* Value of a character */ + + /* Get the previous token */ + if (*prev_token == MAC_PARM) { /* Formal parameter */ + c = (*(prev_token + 1) & UCHARMAX) - 1; /* Parm number */ + argp = arglist[ c]; /* Actual argument */ + out = prev_token; /* To overwrite */ + if (trace_macro) + argp = remove_magics( argp, TRUE); /* Remove pair of magics */ + if ((g_internal_data->mcpp_mode == POST_STD && *argp == EOS) + || (g_internal_data->mcpp_mode == STD && *argp == RT_END)) { + *out = EOS; /* An empty argument */ + } else { + if (g_internal_data->mcpp_mode == POST_STD) { + file = unget_string( argp, NULL); + while (c = get_ch(), file == g_internal_data->infile) { + prev_token = out; /* Remember the last token */ + scan_token( c, &out, out_end); + } /* Copy actual argument without expansion */ + unget_ch(); + } else { + unget_string( argp, NULL); + if (trace_macro) + free( (char *) argp); + /* malloc()ed in remove_magics() */ + while ((c = get_ch()) != RT_END) { + prev_prev_token = prev_token; + prev_token = out; /* Remember the last token */ + scan_token( c, &out, out_end); + } /* Copy actual argument without expansion */ + if (*prev_token == TOK_SEP) { + out = prev_token; + prev_token = prev_prev_token; /* Skip separator */ + } + } + if (*prev_token == DEF_MAGIC + || (g_internal_data->mcpp_mode == STD && *prev_token == IN_SRC)) { + size_t len = 1; + if (trace_macro && *prev_token == IN_SRC) + len = IN_SRC_LEN; + memmove( prev_token, prev_token + len + , (size_t) ((out -= len) - prev_token)); + /* Remove DEF_MAGIC enabling the name to replace later */ + } + } + } /* Else the previous token is an ordinary token, not an argument */ + + c = skip_ws(); + + /* Catenate */ + switch (c) { + case ST_QUOTE: /* First stringize and then catenate */ + skip_ws(); /* Skip MAC_PARM, ST_QUOTE */ + c = get_ch() - 1; + out = stringize( defp, arglist[ c], out); + break; + case MAC_PARM: + c = get_ch() - 1; /* Parameter number */ + argp = arglist[ c]; /* Actual argument */ + if (trace_macro) + argp = remove_magics( argp, FALSE); /* Remove pair of magics */ + if ((g_internal_data->mcpp_mode == POST_STD && *argp == EOS) + || (g_internal_data->mcpp_mode == STD && *argp == RT_END)) { + *out = EOS; /* An empty argument */ + } else { + unget_string( argp, NULL); + if (trace_macro) + free( (char *) argp); + if ((c = get_ch()) == DEF_MAGIC) { /* Remove DEF_MAGIC */ + c = get_ch(); /* enabling to replace */ + } else if (c == IN_SRC) { /* Remove IN_SRC */ + if (trace_macro) { + get_ch(); /* Also its number */ + get_ch(); + } + c = get_ch(); + } + scan_token( c, &out, out_end); /* The first token */ + if (*g_internal_data->infile->bptr) /* There are more tokens*/ + in_arg = TRUE; + } + break; + case IN_SRC: + if (trace_macro) { + get_ch(); + get_ch(); + } + /* Fall through */ + case DEF_MAGIC: + c = get_ch(); /* Skip DEF_MAGIC, IN_SRC */ + /* Fall through */ + default: + scan_token( c, &out, out_end); /* Copy the token */ + break; + } + + /* The generated sequence is a valid preprocessing-token ? */ + if (*prev_token) { /* There is any token */ + unget_string( prev_token, NULL); /* Scan once more */ + c = get_ch(); /* This line should be before the next line. */ + g_internal_data->infile->fp = (SIOHandle *)-1; /* To check token length*/ + if (g_internal_data->mcpp_debug & EXPAND) + dump_string( "checking generated token", g_internal_data->infile->buffer); + scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end); + g_internal_data->infile->fp = NULL; + if (*g_internal_data->infile->bptr != EOS) { /* More than a token */ + if (g_internal_data->option_flags.lang_asm) { /* Assembler source */ + if (g_internal_data->warn_level & 2) + diag_macro( CWARN, invalid_token, prev_token, 0L, NULL + , defp, NULL); + } else { + diag_macro( CERROR, invalid_token, prev_token, 0L, NULL, defp + , NULL); + } + g_internal_data->infile->bptr += strlen( g_internal_data->infile->bptr); + } + get_ch(); /* To the parent "file" */ + unget_ch(); + } + + if (g_internal_data->mcpp_mode == STD && ! g_internal_data->option_flags.lang_asm) { + *out++ = TOK_SEP; /* Prevent token merging*/ + *out = EOS; + } + if (in_arg) { /* There are more tokens after the generated one */ + if (g_internal_data->mcpp_mode == POST_STD) { + file = g_internal_data->infile; + while (c = get_ch(), file == g_internal_data->infile) { + prev_token = out; /* Remember the last token */ + scan_token( c, &out, out_end); + } /* Copy rest of argument without expansion */ + unget_ch(); + } else { + while ((c = get_ch()) != RT_END) { + if (c == TOK_SEP) + continue; /* Skip separator */ + prev_token = out; /* Remember the last token */ + scan_token( c, &out, out_end); + } /* Copy rest of argument without expansion */ + } + } + *token_p = prev_token; /* Report back the last token */ + + return out; +} + +static const char * remove_magics( + const char * argp, /* The argument list */ + int from_last /* token is the last or first? */ +) +/* + * Remove pair of magic character sequences in an argument in order to catenate + * the last or first token to another. + * Or remove pair of magic character sequences surrounding an argument in order + * to keep symmetry of magics. + */ +{ +#define INIT_MAGICS 128 + + char (* mac_id)[ MAC_S_LEN]; + char (* arg_id)[ ARG_S_LEN]; + char ** mac_loc; + char ** arg_loc; + char * mgc_index; + size_t max_magics; + int mac_n, arg_n, ind, n; + char * first = NULL; + char * last = NULL; + char * token; + char * arg_p; + char * ap; + char * ep; + char * tp; + char * space = NULL; + int with_rtend; + int c; + FILEINFO * file; + + mac_id = (char (*)[ MAC_S_LEN]) xmalloc( MAC_S_LEN * INIT_MAGICS); + arg_id = (char (*)[ ARG_S_LEN]) xmalloc( ARG_S_LEN * INIT_MAGICS * 2); + mac_loc = (char **) xmalloc( sizeof (char *) * INIT_MAGICS); + arg_loc = (char **) xmalloc( sizeof (char *) * INIT_MAGICS * 2); + mgc_index = xmalloc( INIT_MAGICS * 3); + max_magics = INIT_MAGICS; + + mac_n = arg_n = ind = 0; + ap = arg_p = xmalloc( strlen( argp) + 1); + strcpy( arg_p, argp); + ep = arg_p + strlen( arg_p); + if (*(ep - 1) == RT_END) { + with_rtend = TRUE; + ep--; /* Point to RT_END */ + } else { + with_rtend = FALSE; + } + file = unget_string( arg_p, NULL); /* Stack to "file" for token parsing*/ + + /* Search all the magics in argument, as well as first and last token */ + /* Read stacked arg_p and write it to arg_p as a dummy buffer */ + while ((*ap++ = (char)(c = get_ch())) != RT_END && file == g_internal_data->infile) { + if (c == MAC_INF) { + if ((size_t)mac_n >= max_magics || (size_t)arg_n >= max_magics * 2) { + max_magics *= 2; + mac_id = (char (*)[ MAC_S_LEN]) xrealloc( (char *) mac_id + , MAC_S_LEN * max_magics); + arg_id = (char (*)[ ARG_S_LEN]) xrealloc( (char *) arg_id + , ARG_S_LEN * max_magics * 2); + mac_loc = (char **) xrealloc( (char *) mac_loc + , sizeof (char *) * max_magics); + arg_loc = (char **) xrealloc( (char *) arg_loc + , sizeof (char *) * max_magics * 2); + mgc_index = xrealloc( mgc_index, max_magics * 3); + } + *ap++ = (char)(c = get_ch()); + switch (c) { + case MAC_CALL_START : + *ap++ = (char)get_ch(); + *ap++ = (char)get_ch(); + mac_loc[ mac_n] = ap - MAC_S_LEN; /* Location of the seq */ + memcpy( mac_id[ mac_n], ap - (MAC_S_LEN - 1), MAC_S_LEN - 1); + /* Copy the sequence from its second byte */ + mac_id[ mac_n++][ MAC_S_LEN - 1] = FALSE; + /* Mark of to-be-removed or not */ + break; + case MAC_ARG_START : + *ap++ = (char)get_ch(); + *ap++ = (char)get_ch(); + *ap++ = (char)get_ch(); + arg_loc[ arg_n] = ap - ARG_S_LEN; + memcpy( arg_id[ arg_n], ap - (ARG_S_LEN - 1), ARG_S_LEN - 1); + arg_id[ arg_n++][ ARG_S_LEN - 1] = FALSE; + break; + case MAC_CALL_END : + mac_loc[ mac_n] = ap - MAC_E_LEN; + mac_id[ mac_n][ 0] = (char)c; + mac_id[ mac_n++][ MAC_E_LEN_V - 1] = FALSE; + break; + case MAC_ARG_END : + arg_loc[ arg_n] = ap - ARG_E_LEN; + arg_id[ arg_n][ 0] = (char)c; + arg_id[ arg_n++][ ARG_E_LEN_V - 1] = FALSE; + break; + } + if (g_internal_data->option_flags.v) { + switch (c) { + case MAC_CALL_END : + mac_id[ mac_n - 1][ 1] = *ap++ = (char)get_ch(); + mac_id[ mac_n - 1][ 2] = *ap++ = (char)get_ch(); + break; + case MAC_ARG_END : + arg_id[ arg_n - 1][ 1] = *ap++ = (char)get_ch(); + arg_id[ arg_n - 1][ 2] = *ap++ = (char)get_ch(); + arg_id[ arg_n - 1][ 3] = *ap++ = (char)get_ch(); + break; + } + } + mgc_index[ ind++] = (char)c; /* Index to mac_id[] and arg_id[] */ + continue; + } else if (g_internal_data->char_type[ c & UCHARMAX] & HSP) { + if (! first) { + ap--; /* Skip white space on top of the argument */ + ep--; + } + continue; + } + last = --ap; + if (! first) + first = ap; + if (g_internal_data->char_type[ c & UCHARMAX] & HSP) + space = ap; /* Remember the last white space */ + scan_token( c, &ap, ep); + } + if (file == g_internal_data->infile) + get_ch(); /* Clear the "file" */ + unget_ch(); + if (space == ep - 1) + ep--; /* Remove trailing white space */ + if (with_rtend) + *ep++ = RT_END; + *ep = EOS; + if ((from_last && !last) || (!from_last && !first)) + return arg_p; + if (mac_n == 0 && arg_n == 0) /* No magic sequence */ + return arg_p; + token = from_last ? last : first; + + /* Remove pair of magics surrounding the last (or first) token */ + if (mac_n) { + /* Remove pair of macro magics surrounding the token */ + int magic, mac_s, mac_e; + int nest_s, nest_e; + + nest_s = 0; + for (mac_s = 0; mac_loc[ mac_s] < token; mac_s++) { + magic = mac_id[ mac_s][ 0]; + if (magic == MAC_CALL_START) { /* Starting magic */ + nest_e = ++nest_s; + /* Search the corresponding closing magic */ + for (mac_e = mac_s + 1; mac_e < mac_n; mac_e++) { + magic = mac_id[ mac_e][ 0]; + if (magic == MAC_CALL_START) { + nest_e++; + } else { /* MAC_CALL_END: Closing magic */ + nest_e--; + /* Search after the token */ + if (token < mac_loc[ mac_e] && nest_e == nest_s - 1) { +#if DEBUG_MACRO_ANN + if (option_flags.v) + chk_symmetry( mac_id[ mac_s], mac_id[ mac_e] + , MAC_E_LEN - 2); +#endif + mac_id[ mac_e][ MAC_S_LEN - 1] = TRUE; + /* To be removed */ + break; /* Done for this mac_s */ + } + } + } + if (mac_e < mac_n) /* Found corresponding magic */ + mac_id[ mac_s][ MAC_S_LEN - 1] = TRUE; /* To be removed*/ + else /* Not found */ + break; + } else { + nest_s--; /* MAC_CALL_END: Closing magic */ + } + } + } + if (arg_n) { + /* Remove pair of arg magics surrounding the token */ + int magic, arg_s, arg_e; + int nest_s, nest_e; + + nest_s = 0; + for (arg_s = 0; arg_loc[ arg_s] < token; arg_s++) { + magic = arg_id[ arg_s][ 0]; + if (magic == MAC_ARG_START) { + nest_e = ++nest_s; + for (arg_e = arg_s + 1; arg_e < arg_n; arg_e++) { + magic = arg_id[ arg_e][ 0]; + if (magic == MAC_ARG_START) { + nest_e++; + } else { + nest_e--; + if (token < arg_loc[ arg_e] && nest_e == nest_s - 1) { +#if DEBUG_MACRO_ANN + if (option_flags.v) + chk_symmetry( arg_id[ arg_s], arg_id[ arg_e] + , ARG_E_LEN_V - 2); +#endif + arg_id[ arg_e][ ARG_S_LEN - 1] = TRUE; + break; + } + } + } + if (arg_e < arg_n) + arg_id[ arg_s][ ARG_S_LEN - 1] = TRUE; + else + break; + } else { + nest_s--; + } + } + } + + /* Copy the sequences skipping the to-be-removed magic seqs */ + file = unget_string( arg_p, NULL); /* Stack to "file" for token parsing*/ + tp = arg_p; + ep = arg_p + strlen( arg_p); + mac_n = arg_n = n = 0; + + while ((*tp++ = (char)(c = get_ch())) != RT_END && file == g_internal_data->infile) { + char ** loc_tab = NULL; + int mark, magic; + int num = 0; + int rm = FALSE; + size_t len = 0; + + if (c != MAC_INF) { + scan_token( c, (--tp, &tp), ep); + continue; + } + unget_ch(); /* Pushback MAC_INF */ + tp--; + + switch (magic = mgc_index[ n++]) { + case MAC_CALL_START : + len = MAC_S_LEN; + mark = MAC_S_LEN - 1; + break; + case MAC_CALL_END : + len = g_internal_data->option_flags.v ? MAC_E_LEN_V : MAC_E_LEN; + mark = MAC_E_LEN_V - 1; + break; + case MAC_ARG_START : + len = ARG_S_LEN; + mark = ARG_S_LEN - 1; + break; + case MAC_ARG_END : + len = g_internal_data->option_flags.v ? ARG_E_LEN_V : ARG_E_LEN; + mark = ARG_E_LEN_V - 1; + break; + } + switch (magic) { + case MAC_CALL_START : + case MAC_CALL_END : + loc_tab = mac_loc; + num = mac_n; + rm = mac_id[ mac_n++][ mark]; + break; + case MAC_ARG_START : + case MAC_ARG_END : + loc_tab = arg_loc; + num = arg_n; + rm = arg_id[ arg_n++][ mark]; + break; + } + if (rm == FALSE) { /* Not to be removed */ + memmove( tp, loc_tab[ num], len); + /* Copy it (from arg_p buffer for convenience) */ + tp += len; + } + g_internal_data->infile->bptr += len; + } + if (! with_rtend) + tp--; + *tp = EOS; + if (file == g_internal_data->infile) + get_ch(); /* Clear the "file" */ + unget_ch(); + + return arg_p; +} + +#if DEBUG_MACRO_ANN +static void chk_symmetry( + char * start_id, /* Sequence of macro (or arg) starting inf */ + char * end_id, /* Sequence of macro (or arg) closing inf */ + size_t len /* Length of the sequence */ +) +/* + * Check whether starting sequence and corresponding closing sequence is the + * same. + */ +{ + int s_id, e_id, arg_s_n, arg_e_n; + + if (memcmp( start_id + 1, end_id + 1, len) == 0) + return; /* The sequences are the same */ + s_id = ((start_id[ 1] & UCHARMAX) - 1) * UCHARMAX; + s_id += (start_id[ 2] & UCHARMAX) - 1; + e_id = ((end_id[ 1] & UCHARMAX) - 1) * UCHARMAX; + e_id += (end_id[ 2] & UCHARMAX) - 1; + if (len >= 3) { + arg_s_n = (start_id[ 3] & UCHARMAX) - 1; + arg_e_n = (end_id[ 3] & UCHARMAX) - 1; + mcpp_fprintf( DEST_ERR, +"Asymmetry of arg inf found removing magics: start %d:%d, end: %d:%d at line:%d\n" + , s_id, arg_s_n, e_id, arg_e_n, g_internal_data->src_line); + } else { + mcpp_fprintf( DEST_ERR, +"Asymmetry of macro inf found removing magics: start %d, end: %d at line:%d\n" + , s_id, e_id, g_internal_data->src_line); + } +} +#endif + +static char * stringize( + const DEFBUF * defp, /* The macro definition */ + const char * argp, /* Pointer to argument */ + char * out /* Output buffer */ +) +/* + * Make a string literal from an argument. + */ +{ + char arg_end_inf[ 8][ ARG_E_LEN_V - 1]; + /* Verbose information of macro arguments */ + FILEINFO * file; + int stray_bsl = FALSE; /* '\\' not in literal */ + char * out_p = out; + int token_type; + int num_arg_magic = 0; + size_t len; + size_t arg_e_len = g_internal_data->option_flags.v ? ARG_E_LEN_V : ARG_E_LEN; + int c; + + if (trace_macro) { + while ((*argp == MAC_INF && *(argp + 1) == MAC_ARG_START) + /* Argument is prefixed with macro tracing magics */ + || (g_internal_data->char_type[ *argp & UCHARMAX] & HSP)) { + if (*argp == MAC_INF) { /* Move magics to outside of string */ + memcpy( out_p, argp, ARG_S_LEN); + out_p += ARG_S_LEN; + argp += ARG_S_LEN; + num_arg_magic++; + } else { /* Skip white spaces */ + argp++; + } + } + } + + file = unget_string( argp, NULL); + len = strlen( g_internal_data->infile->buffer); /* Sequence ends with RT_END */ + if (trace_macro) { /* Remove suffixed argument closing magics */ + /* There are 0 or more argument closing magic sequences and */ + /* 0 or more TOK_SEPs and no space at the end of argp. */ + /* This is assured by get_an_arg(). */ + int nmagic = 0; + while (len > arg_e_len + && (((*(g_internal_data->infile->buffer + len - arg_e_len - 1) == MAC_INF + && *(g_internal_data->infile->buffer + len - arg_e_len) == MAC_ARG_END) + || *(g_internal_data->infile->buffer + len - 2) == TOK_SEP))) { + if (*(g_internal_data->infile->buffer + len - arg_e_len - 1) == MAC_INF + && *(g_internal_data->infile->buffer + len - arg_e_len) == MAC_ARG_END) { + if (g_internal_data->option_flags.v) { + memcpy( arg_end_inf[ nmagic] + , g_internal_data->infile->buffer + len - arg_e_len + 1 + , arg_e_len - 2); + arg_end_inf[ nmagic][ arg_e_len - 2] = EOS; + } + nmagic++; + len -= arg_e_len; + *(g_internal_data->infile->buffer + len - 1) = RT_END; + *(g_internal_data->infile->buffer + len) = EOS; + } else if (*(g_internal_data->infile->buffer + len - 2) == TOK_SEP) { + len--; + *(g_internal_data->infile->buffer + len - 1) = RT_END; + *(g_internal_data->infile->buffer + len) = EOS; + } + } + if (nmagic != num_arg_magic) { /* There are some imbalances */ + /* Some surrounding magics correspond to intervening ones. */ + /* So, unmatched surrounding magics should be removed. */ + if (num_arg_magic > nmagic) { + num_arg_magic = nmagic; /* Ignore the surplus */ + out_p = out + ARG_S_LEN * num_arg_magic; + } /* Else simply ignore the surplus nmagic */ + } + } + *out_p++ = '"'; /* Starting quote */ + + while ((c = get_ch()), ((g_internal_data->mcpp_mode == POST_STD && file == g_internal_data->infile) + || (g_internal_data->mcpp_mode == STD && c != RT_END))) { + if (c == ' ' || c == '\t') { + *out_p++ = (char)c; + continue; + } else if (c == TOK_SEP) { + continue; /* Skip inserted separator */ + } else if (c == IN_SRC) { /* Skip magics */ + if (trace_macro) { + get_ch(); + get_ch(); + } + continue; + } else if (c == '\\') { + stray_bsl = TRUE; /* May cause a trouble */ + } else if (c == MAC_INF) { /* Remove intervening magics */ + switch (c = get_ch()) { + case MAC_ARG_START : + get_ch(); + /* Fall through */ + case MAC_CALL_START : + get_ch(); + get_ch(); + break; + } + if (g_internal_data->option_flags.v) { + switch (c) { + case MAC_ARG_END : + get_ch(); + /* Fall through */ + case MAC_CALL_END : + get_ch(); + get_ch(); + break; + } + } + continue; + } + token_type = scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end); + + switch (token_type) { + case WSTR: + case WCHR: + case STR: + case CHR: + g_internal_data->workp = g_internal_data->work_buf; + while ((c = *g_internal_data->workp++ & UCHARMAX) != EOS) { + if (g_internal_data->char_type[ c] & g_internal_data->mbchk) { /* Multi-byte character */ + g_internal_data->mb_read( c, &g_internal_data->workp, (*out_p++ = (char)c, &out_p)); + /* Copy as it is */ + continue; + } else if (c == '"') { + *out_p++ = '\\'; /* Insert '\\' */ + } else if (c == '\\') { +#if OK_UCN + if (g_internal_data->mcpp_mode == POST_STD || ! g_internal_data->stdc3 + || (*g_internal_data->workp != 'u' && *g_internal_data->workp != 'U')) + /* Not UCN */ +#endif + *out_p++ = '\\'; + } + *out_p++ = (char)c; + } + *out_p = EOS; + break; + default: + out_p = stpcpy( out_p, g_internal_data->work_buf); + break; + } + } + + if (g_internal_data->mcpp_mode == POST_STD) + unget_ch(); + *out_p++ = '"'; /* Closing quote */ + if (trace_macro) { + while (num_arg_magic--) { + *out_p++ = MAC_INF; /* Restore removed magic*/ + *out_p++ = MAC_ARG_END; + if (g_internal_data->option_flags.v) + out_p = stpcpy( out_p, arg_end_inf[ num_arg_magic]); + } + } + *out_p = EOS; + + if (stray_bsl) { /* '\\' outside of quotation has been found */ + int invalid = FALSE; + unget_string( out, defp->name); + if (g_internal_data->mcpp_debug & EXPAND) + dump_string( "checking generated token", g_internal_data->infile->buffer); + scan_quote( get_ch(), g_internal_data->work_buf, g_internal_data->work_end, TRUE); + /* Unterminated or too long string will be diagnosed */ + if (*g_internal_data->infile->bptr != EOS) /* More than a token */ + invalid = TRUE; /* Diagnose after clearing the "file" */ + g_internal_data->infile->bptr += strlen( g_internal_data->infile->bptr); + get_ch(); /* Clear the "file" */ + unget_ch(); + if (invalid) + diag_macro( CERROR + , "Not a valid string literal %s" /* _E_ */ + , out, 0L, NULL, defp, NULL); + } +#if NWORK-2 > SLEN90MIN + else if ((g_internal_data->warn_level & 4) && out_p - out > g_internal_data->std_limits.str_len) + diag_macro( CWARN + , "String literal longer than %.0s%ld bytes %s" /* _W4_ */ + , NULL , (long) g_internal_data->std_limits.str_len, out, defp, NULL); +#endif + return out_p; +} + +static char * substitute( + const DEFBUF * defp, /* The macro getting arguments */ + const char ** arglist, /* Pointers to actual arguments */ + const char * in, /* Replacement text */ + char * out, /* Output buffer */ + char * out_end /* End of output buffer */ +) +/* + * Replace completely each actual arguments of the macro, and substitute for + * the formal parameters in the replacement list. + */ +{ + char * out_start = out; + const char * arg; + int c; + int gvar_arg; /* gvar_arg'th argument is GCC variable argument */ + + gvar_arg = (defp->nargs & GVA_ARGS) ? (defp->nargs & ~AVA_ARGS) : 0; + *out = EOS; /* Ensure to termanate */ + (void)gvar_arg; + + while ((c = *in++) != EOS) { + if (c == MAC_PARM) { /* Formal parameter */ + c = *in++ & UCHARMAX; /* Parameter number */ + if (g_internal_data->mcpp_debug & EXPAND) { + mcpp_fprintf( DEST_DBG, " (expanding arg[%d])", c); + dump_string( NULL, arglist[ c - 1]); + } +#if COMPILER == GNUC || COMPILER == MSC + arg = arglist[ c - 1]; + if (trace_macro) { + if (*arg == MAC_INF) { + if (*++arg == MAC_ARG_START) + arg += ARG_S_LEN - 1; /* Next to magic chars */ + } + } +#if COMPILER == GNUC + if (c == gvar_arg && *arg == RT_END && ! g_system_data->ansi) { + /* + * GCC variadic macro and its variable argument is absent. + * Note that in its "strict-ansi" mode GCC does not remove + * ',', nevertheless it ignores '##' (inconsistent + * behavior). Though GCC2 changes behavior depending the + * ',' is preceded by space or not, we only count on the + * "strict-ansi" flag. + */ +#else + if ((defp->nargs & VA_ARGS) && c == (defp->nargs & ~VA_ARGS) + && *arg == RT_END && g_internal_data->mcpp_mode == STD) { + /* Visual C 2005 also removes ',' immediately preceding */ + /* absent variable arguments. It does not use '##' though. */ +#endif + char * tmp; + tmp = out - 1; + while (g_internal_data->char_type[ *tmp & UCHARMAX] & HSP) + tmp--; + if (*tmp == ',') { + out = tmp; /* Remove the immediately preceding ',' */ + if (g_internal_data->warn_level & 1) { + *out = EOS; + diag_macro( CWARN, + "Removed ',' preceding the absent variable argument: %s" /* _W1_ */ + , out_start, 0L, NULL, defp, NULL); + } + } + } else +#endif + if ((out = rescan( NULL, arglist[ c - 1], out, out_end)) + == NULL) { /* Replace completely */ + return NULL; /* Error */ + } + } else { + *out++ = (char)c; /* Copy the character */ + } + } + *out = EOS; + return out; +} + +static char * rescan( + const DEFBUF * outer, /* Outer macro just replacing */ + const char * in, /* Sequences to be rescanned */ + char * out, /* Output buffer */ + char * out_end /* End of output buffer */ +) +/* + * Re-scan the once replaced sequences to replace the remaining macros + * completely. + * rescan() and replace() call each other recursively. + * + * Note: POST_STD mode does not use IN_SRC nor TOK_SEP and seldom uses RT_END. + * Checking of those are unnecessary overhead for POST_STD mode. To integrate + * the code for POST_STD with STD mode, however, we use these checkings + * commonly. + * Also compat_mode does not use IN_SRC unless in trace_macro mode. + * STD mode has macro notification mode (trace_macro mode), too. Its routines + * are complicated and not easy to understand. + */ +{ + char * cur_cp = NULL; + char * tp = NULL; /* Temporary pointer into buffer*/ + char * out_p = out; /* Current output pointer */ + FILEINFO * file; /* Input sequences stacked on a "file" */ + DEFBUF * inner = NULL; /* Inner macro to replace */ + int c; /* First character of token */ + int token_type; + char * mac_arg_start = NULL; +#if COMPILER == GNUC + int within_defined = FALSE; + int within_defined_arg_depth = 0; +#endif + + if (g_internal_data->mcpp_debug & EXPAND) { + mcpp_fprintf( DEST_DBG, "rescan_level--%d (%s) " + , rescan_level + 1, outer ? outer->name : ""); + dump_string( "rescan entry", in); + } + if (! disable_repl( outer)) /* Don't re-replace replacing macro */ + return NULL; /* Too deeply nested macro call */ + if (g_internal_data->mcpp_mode == STD) { + get_ch(); /* Clear empty "file"s */ + unget_ch(); /* for diagnostic */ + cur_cp = g_internal_data->infile->bptr; /* Remember current location */ + } + file = unget_string( in, outer ? outer->name : NULL); + /* Stack input on a "file" */ + + while ((c = get_ch()), file == g_internal_data->infile + /* Rescanning is limited to the "file" */ + && c != RT_END) { + /* + * This is the trick of STD mode. collect_args() via replace() + * may read over to file->parent (provided the "file" is macro) + * unless stopped by RT_END. + */ + size_t len = 0; + + if (g_internal_data->char_type[ c] & HSP) { + *out_p++ = (char)c; + continue; + } else if (c == MAC_INF) { /* Only in STD mode */ + *out_p++ = (char)c; + *out_p++ = (char)(c = get_ch()); + switch (c) { + case MAC_ARG_START : + mac_arg_start = out_p - 2; /* Remember the position */ + *out_p++ = (char)get_ch(); + /* Fall through */ + case MAC_CALL_START : + *out_p++ = (char)get_ch(); + *out_p++ = (char)get_ch(); + break; + case MAC_ARG_END : + if (! g_internal_data->option_flags.v) + break; + else + *out_p++ = (char)get_ch(); + /* Fall through */ + case MAC_CALL_END : + if (g_internal_data->option_flags.v) { + *out_p++ = (char)get_ch(); + *out_p++ = (char)get_ch(); + } + break; + } /* Pass these characters as they are */ + continue; + } + token_type = scan_token( c, (tp = out_p, &out_p), out_end); +#if COMPILER == GNUC + if (g_internal_data->mcpp_mode == STD) { + /* Pass stuff within defined() as they are, if in_directive */ + if ((within_defined || within_defined_arg_depth)) { + if (c == '(') { + within_defined_arg_depth++; + within_defined = FALSE; + } else if (within_defined_arg_depth && c == ')') { + within_defined_arg_depth--; + } /* Else should be a name (possibly macro) */ + continue; + } else if (token_type == NAM && g_internal_data->in_directive + && str_eq(g_internal_data->identifier, "defined")) { + within_defined = TRUE; + /* 'defined' token in directive line */ + continue; + } + } +#endif + if (g_internal_data->mcpp_mode == STD && c == IN_SRC) + len = trace_macro ? IN_SRC_LEN : 1; + if (token_type == NAM && c != DEF_MAGIC + && (inner = look_id( tp + len)) != NULL) { /* A macro name */ + int is_able; /* Macro is not "blue-painted" */ + char * endf = NULL; /* Output stream at end of infile */ + MAGIC_SEQ mgc_seq; /* Magics between macro name and '(' */ + + if (trace_macro) + memset( &mgc_seq, 0, sizeof (MAGIC_SEQ)); + if (is_macro_call( inner, &out_p, &endf + , trace_macro ? &mgc_seq : NULL) + && ((g_internal_data->mcpp_mode == POST_STD && is_able_repl( inner)) + || (g_internal_data->mcpp_mode == STD + && (((is_able = is_able_repl( inner)) == YES) + || (is_able == READ_OVER + && (c == IN_SRC || g_system_data->compat_mode)))))) { + /* Really a macro call */ + LINE_COL in_src_line_col = { 0L, 0}; + int in_src_n = 0; + + if (trace_macro) { + if (c == IN_SRC) { /* Macro in argument from source */ + /* Get the location in source */ + in_src_n = ((*(tp + 1) & UCHARMAX) - 1) * UCHARMAX; + in_src_n += (*(tp + 2) & UCHARMAX) - 1; + in_src_line_col.line = in_src[ in_src_n].start_line; + in_src_line_col.col = in_src[ in_src_n].start_col; + } + if (inner->nargs >= 0 && mgc_seq.magic_start) { + /* Magic sequence is found between macro */ + /* name and '('. This is a nuisance. */ + char * mgc_cleared; + size_t seq_len; + size_t arg_elen = g_internal_data->option_flags.v ? ARG_E_LEN_V + : ARG_E_LEN; + if ((tp - ARG_S_LEN) == mac_arg_start + && *mgc_seq.magic_start == MAC_INF + && *(mgc_seq.magic_start + 1) == MAC_ARG_END) { + /* Name of function-like macro is surrounded by */ + /* magics, which were inserted by outer macro. */ + /* Remove the starting magic. (The closing magic*/ + /* has already been removed by is_macro_call(). */ + tp -= ARG_S_LEN; + mgc_seq.magic_start += arg_elen; /* Next seq */ + } + /* Restore once skipped magic sequences, */ + /* then remove "pair"s of sequences. */ + seq_len = mgc_seq.magic_end - mgc_seq.magic_start; + if (seq_len) { + insert_to_bptr( mgc_seq.magic_start, seq_len); + mgc_cleared = (char*)remove_magics( + (const char *) g_internal_data->infile->bptr, FALSE); + /* Remove pair of magics */ + strcpy( g_internal_data->infile->bptr, mgc_cleared); + free( mgc_cleared); + } + } + } + if ((out_p = replace( inner, tp, out_end, outer, file + , in_src_line_col, in_src_n)) == NULL) + break; /* Error of macro call */ + } else { + if (endf && strlen( endf)) { + /* Has read over to parent file: another nuisance. */ + /* Restore the read-over sequence into current buffer. */ + /* Don't use unget_string() here. */ + insert_to_bptr( endf, out_p - endf); + out_p = endf; + *out_p = EOS; + } + if ((is_able = is_able_repl( inner)) == NO + || (g_internal_data->mcpp_mode == STD && is_able == READ_OVER + && c != IN_SRC && ! g_system_data->compat_mode)) { + if (g_internal_data->mcpp_mode == POST_STD || c != IN_SRC) + memmove( tp + 1, tp, (size_t) (out_p++ - tp)); + *tp = DEF_MAGIC; /* Mark not to replace */ + } /* Else not a macro call*/ + } + } + if (out_end <= out_p) { + *out_p = EOS; + diag_macro( CERROR, macbuf_overflow, outer ? outer->name : in, 0L + , out, outer, inner); + out_p = NULL; + break; + } + } + + if (out_p) { + *out_p = EOS; + if (g_internal_data->mcpp_mode == STD) { + if (c != RT_END) { + unget_ch(); + if (outer != NULL) { /* outer isn't a macro in argument */ + if (g_internal_data->infile && g_internal_data->infile->bptr != cur_cp + /* Have overrun replacement list*/ + && !(tp && *tp == DEF_MAGIC) + /* Macro is enabled */ + && ((!g_system_data->compat_mode && (g_internal_data->warn_level & 1)) + || (g_system_data->compat_mode && (g_internal_data->warn_level & 8)))) { + diag_macro( CWARN, +"Replacement text \"%s\" of macro %.0ld\"%s\" involved subsequent text" /* _W1_ */ + , in, 0L, outer->name, outer, inner); + } + } + } /* Else remove RT_END */ + } else { + unget_ch(); + } + } + enable_repl( outer, TRUE); /* Enable macro for later text */ + if (g_internal_data->mcpp_debug & EXPAND) { + mcpp_fprintf( DEST_DBG, "rescan_level--%d (%s) " + , rescan_level + 1, outer ? outer->name : ""); + dump_string( "rescan exit", out); + } + return out_p; +} + +static int disable_repl( + const DEFBUF * defp +) +/* + * Register the macro name currently replacing. + */ +{ + if (defp == NULL) + return TRUE; + if (rescan_level >= RESCAN_LIMIT) { + diag_macro( CERROR, + "Rescanning macro \"%s\" more than %ld times at \"%s\"" /* _E_ */ + , g_internal_data->macro_name, (long) RESCAN_LIMIT, defp->name, defp, NULL); + return FALSE; + } + replacing[ rescan_level].def = defp; + replacing[ rescan_level++].read_over = NO; + return TRUE; +} + +static void enable_repl( + const DEFBUF * defp, + int done +) +/* + * Un-register the macro name just replaced for later text. + */ +{ + if (defp == NULL) + return; + replacing[ rescan_level - 1].def = NULL; + if (done && rescan_level) + rescan_level--; +} + +static int is_able_repl( + const DEFBUF * defp +) +/* + * The macro is permitted to replace ? + */ +{ + int i; + + if (defp == NULL) + return YES; + for (i = rescan_level-1; i >= 0; i--) { + if (defp == replacing[ i].def) + return replacing[ i].read_over; + } + return YES; +} + +static char * insert_to_bptr( + char * ins, /* Sequence to be inserted */ + size_t len /* Byte to be inserted */ +) +/* + * Insert a sequence into infile->bptr. + * infile->buffer is reallocated to ensure buffer size. + * This routine changes absolute address of infile->bptr, hence rescan() emits + * a "Replacement text ... involved subsequent text" warning. Anyway, + * a macro which needs this routine deserves that warning. + */ +{ + size_t bptr_offset = g_internal_data->infile->bptr - g_internal_data->infile->buffer; + + if (g_internal_data->infile->fp == NULL) { /* Not source file */ + g_internal_data->infile->buffer = xrealloc( g_internal_data->infile->buffer + , strlen( g_internal_data->infile->buffer) + len + 1); + g_internal_data->infile->bptr = g_internal_data->infile->buffer + bptr_offset; + } + memmove( g_internal_data->infile->bptr + len, g_internal_data->infile->bptr, strlen( g_internal_data->infile->bptr) + 1); + memcpy( g_internal_data->infile->bptr, ins, len); + + return g_internal_data->infile->buffer; +} + +/* + * M a c r o E x p a n s i o n i n P R E - S T A N D A R D M o d e + */ + +#include "setjmp.h" + +static jmp_buf jump; + +static char * arglist_pre[ NMACPARS]; /* Pointers to args */ + +static int rescan_pre( int c, char * mp, char * mac_end); + /* Replace a macro repeatedly */ +static int replace_pre( DEFBUF * defp); + /* Replace a macro once */ +static void substitute_pre( DEFBUF * defp); + /* Substitute parms with args */ + +static char * expand_prestd( + DEFBUF * defp, /* Macro definition */ + char * out, /* Output buffer */ + char * out_end, /* End of output buffer */ + LINE_COL line_col, /* Location of macro (not used in prestd) */ + int * pragma_op /* Flag of _Pragma (not used in prestd) */ +) +/* + * Expand a macro call completely, write the results to the specified buffer + * and return the advanced pointer. + */ +{ + char macrobuf[ NMACWORK + IDMAX]; /* Buffer for rescan_pre() */ + char * mac_end = ¯obuf[ NMACWORK]; /* End of macrobuf[] */ + char * out_p; /* Pointer into out[] */ + char * mp = macrobuf; /* Pointer into macrobuf*/ + int len; /* Length of a token */ + int token_type; /* Type of token */ + int c; + + g_internal_data->macro_line = g_internal_data->src_line; /* Line number for diag.*/ + unget_string( g_internal_data->identifier, g_internal_data->identifier); /* To re-read */ + g_internal_data->macro_name = defp->name; + rescan_level = 0; + if (setjmp( jump) == 1) { + skip_macro(); + mp = macrobuf; + *mp = EOS; + g_internal_data->macro_line = MACRO_ERROR; + goto err_end; + } + + while ((c = get_ch()) != CHAR_EOF && g_internal_data->infile->fp == NULL) { + /* While the input stream is a macro */ + while (c == ' ' || c == '\t') { /* Output the spaces */ + *mp++ = (char)c; + c = get_ch(); + if (g_internal_data->infile == NULL || g_internal_data->infile->fp != NULL) + goto exp_end; + } + token_type = rescan_pre( c, mp, mac_end); /* Scan token */ + /* and expand. Result of expansion is written at mp. */ + + switch (token_type) { + case STR: /* String literal */ + case CHR: /* Character constant */ + case NUM: /* Number token */ + case OPE: /* Operator or punct. */ + case NAM: /* Identifier */ + len = (int)strlen( mp); + mp += len; + break; + case SEP: /* Special character */ + switch( *mp) { + case COM_SEP: + if (g_internal_data->mcpp_mode == OLD_PREP) + break; /* Zero-length comment is removed now */ + /* Else fall through */ + default: /* Who knows ? */ + mp++; /* Copy the character */ + break; + } + break; + case NO_TOKEN: break; /* End of file */ + default: /* Unkown token char. */ + mp++; /* Copy the character */ + break; + } + + if (mac_end <= mp) { + *mp = EOS; + cerror( macbuf_overflow, g_internal_data->macro_name, 0L, macrobuf); + longjmp( jump, 1); + } + if (g_internal_data->mcpp_debug & GETC) { + *mp = EOS; + dump_string( "macrobuf", macrobuf); + } + } + +exp_end: + unget_ch(); + while (macrobuf < mp && (*(mp - 1) == ' ' || *(mp - 1) == '\t')) + mp--; /* Remove trailing blank */ + g_internal_data->macro_line = 0; + *mp = EOS; + if (mp - macrobuf > out_end - out) { + cerror( macbuf_overflow, g_internal_data->macro_name, 0L, macrobuf); + g_internal_data->macro_line = MACRO_ERROR; + } +err_end: + out_p = stpcpy( out, macrobuf); + if (g_internal_data->mcpp_debug & EXPAND) { + dump_string( "expand_prestd exit", out); + } + g_internal_data->macro_name = NULL; + clear_exp_mac(); + *pragma_op = FALSE; + return out_p; +} + +static int rescan_pre( + int c, /* First character of token */ + char * mp, /* Output buffer */ + char * mac_end /* End of output buffer */ +) +/* + * If the token is a macro name, replace the macro repeatedly until the first + * token becomes a non-macro and return the type of token after expansion. + */ +{ + int token_type; /* Type of token */ + char * cp = mp; /* Value of mp should not be changed */ + DEFBUF * defp; + FILEINFO * file; + + while ((token_type = scan_token( c, &cp, mac_end)) == NAM + && (defp = look_id( g_internal_data->identifier)) != NULL) { /* Macro */ + if (replace_pre( defp) == FALSE) + break; /* Macro name with no argument */ + file = g_internal_data->infile; + c = get_ch(); + if (file != g_internal_data->infile) { /* Replaced to 0 token */ + unget_ch(); + token_type = NO_TOKEN; + break; + } + cp = mp; /* Overwrite on the macro call */ + } /* The macro call is replaced */ + return token_type; +} + +static int replace_pre( + DEFBUF * defp /* Definition of the macro */ +) +/* + * Replace a macro one level. Called from expand_prestd() (via rescan_pre()) + * when an identifier is found in the macro table. It calls collect_args() + * to parse actual arguments, checking for the correct number. It then + * creates a "file" containing single line containing the replacement text + * with the actual arguments inserted appropriately. This is "pushed back" + * onto the input stream. (When get_ch() routine runs off the end of the macro + * line, it will dismiss the macro itself.) + */ +{ + int arg_len; + int c; + + if (g_internal_data->mcpp_debug & EXPAND) { + dump_a_def( "replace_pre entry", defp, FALSE, TRUE, g_internal_data->fp_debug); + dump_unget( "replace_pre entry"); + } + if (++rescan_level >= PRESTD_RESCAN_LIMIT) { + diag_macro( CERROR + , "Recursive macro definition of \"%s\"" /* _E_ */ + , defp->name, 0L, NULL, defp, NULL); + longjmp( jump, 1); + } + + /* + * Here's a macro to replace. + */ + switch (defp->nargs) { + case DEF_NOARGS: /* No argument just stuffs */ + case DEF_NOARGS_PREDEF_OLD: /* Compiler-specific predef without '_' */ + case DEF_NOARGS_PREDEF: /* Compiler-specific predef */ + break; + default: /* defp->nargs >= 0 */ + c = squeeze_ws( NULL, NULL, NULL); /* Look for and skip '('*/ + if (c != '(') { /* Macro name without following '(' */ + unget_ch(); + if (g_internal_data->warn_level & 8) + diag_macro( CWARN, only_name, defp->name, 0L, NULL, defp, NULL); + return FALSE; + } else { + arglist_pre[ 0] = xmalloc( (size_t) (NMACWORK + IDMAX * 2)); + arg_len = collect_args( defp, arglist_pre, 0); + /* Collect arguments */ + if (arg_len == ARG_ERROR) { /* End of input */ + free( arglist_pre[ 0]); + longjmp( jump, 1); + } + } + break; + } + + if (defp->nargs > 0) + substitute_pre( defp); /* Do actual arguments */ + else + unget_string( defp->repl, defp->name); + + if (g_internal_data->mcpp_debug & EXPAND) + dump_unget( "replace_pre exit"); + if (defp->nargs >= 0) + free( arglist_pre[ 0]); + return TRUE; +} + +static void substitute_pre( + DEFBUF * defp /* Current macro being replaced */ +) +/* + * Stuff the macro body, substituting formal parameters with actual arguments. + */ +{ + int c; /* Current character */ + FILEINFO * file; /* Funny #include */ + char * out_end; /* -> output buffer end */ + char * in_p; /* -> replacement text */ + char * out_p; /* -> macro output buff */ + + file = get_file( defp->name, NULL, NULL, (size_t) (NMACWORK + 1), FALSE); + /* file == infile */ + in_p = defp->repl; /* -> macro replacement */ + out_p = file->buffer; /* -> output buffer */ + out_end = file->buffer + NMACWORK; /* -> buffer end */ + + while ((c = *in_p++) != EOS) { + if (c == MAC_PARM) { + c = (*in_p++ & UCHARMAX) - 1; /* Parm number */ + /* + * Substitute formal parameter with actual argument. + */ + if (out_end <= (out_p + strlen( arglist_pre[ c]))) + goto nospace; + out_p = stpcpy( out_p, arglist_pre[ c]); + } else { + *out_p++ = (char)c; + } + if (out_end <= out_p) + goto nospace; + } + + *out_p = EOS; + file->buffer = xrealloc( file->buffer, strlen( file->buffer) + 1); + file->bptr = file->buffer; /* Truncate buffer */ + if (g_internal_data->mcpp_debug & EXPAND) + dump_string( "substitute_pre macroline", file->buffer); + return; + +nospace: + *out_p = EOS; + diag_macro( CERROR, macbuf_overflow, defp->name, 0L, file->buffer, defp + , NULL); + longjmp( jump, 1); +} + + +/* + * C O M M O N R O U T I N E S + * f o r S T A N D A R D a n d p r e - S T A N D A R D M o d e s + */ + +static int collect_args( + const DEFBUF * defp, /* Definition of the macro */ + char ** arglist, /* Pointers to actual arguments */ + int m_num /* Index into mac_inf[] */ +) +/* + * Collect the actual arguments for the macro, checking for correct number + * of arguments. + * Variable arguments (on Standard modes) are read as a merged argument. + * Return number of real arguments, or ARG_ERROR on error of unterminated + * macro. + * collect_args() may read over to the next line unless 'in_directive' is + * set to TRUE. + * collect_args() may read over into file->parent to complete a macro call + * unless stopped by RT_END (provided the "file" is macro). This is a key + * trick of STD mode macro expansion. Meanwhile, POST_STD mode limits the + * arguments in the "file" (macro or not). + * Note: arglist[ n] may be reallocated by collect_args(). + */ +{ + const char * name = defp->name; + char * argp = arglist[ 0]; /* Pointer to an argument */ + char * arg_end; /* End of arguments buffer */ + char * valid_argp = NULL; /* End of valid arguments */ + char * sequence; /* Token sequence for diagnostics */ + char * seq; /* Current pointer into 'sequence' */ + char * seq_end; /* Limit of buffer */ + int args; /* Number of arguments expected */ + int nargs = 0; /* Number of collected args */ + int var_arg = defp->nargs & VA_ARGS; /* Variable args */ + int more_to_come = FALSE; /* Next argument is expected*/ + LOCATION * locs = NULL; /* Location of args in source file */ + LOCATION * loc = NULL; /* Current locs */ + MAGIC_SEQ mgc_prefix; /* MAC_INF seqs and spaces preceding an arg */ + int c; + + if (g_internal_data->mcpp_debug & EXPAND) + dump_unget( "collect_args entry"); + args = (defp->nargs == DEF_PRAGMA) ? 1 : (defp->nargs & ~AVA_ARGS); + if (args == 0) /* Need no argument */ + valid_argp = argp; + *argp = EOS; /* Make sure termination */ + arg_end = argp + NMACWORK/2; + seq = sequence = arg_end + IDMAX; /* Use latter half of argp */ + seq_end = seq + NMACWORK/2; + seq = stpcpy( seq, name); + *seq++ = '('; + if (g_internal_data->mcpp_mode == STD) { + /* + * in_getarg is set TRUE while getting macro arguments, for the sake + * of diagnostic's convenience. in_getarg is used only in STD mode. + */ + g_internal_data->in_getarg = TRUE; + if (trace_macro && m_num) { + /* #pragma MCPP debug macro_call, and the macro is on source */ + mac_inf[ m_num].loc_args = loc = locs + = (LOCATION *) xmalloc( (sizeof (LOCATION)) * UCHARMAX); + memset( loc, 0, (sizeof (LOCATION)) * UCHARMAX); + /* 0-clear for default values, including empty argument */ + } + } + + while (1) { + memset( &mgc_prefix, 0, sizeof (MAGIC_SEQ)); + c = squeeze_ws( &seq, NULL + , (trace_macro && m_num) ? &mgc_prefix : NULL); + /* Skip MAC_INF seqs and white spaces, still remember */ + /* the sequence in buffer, if necessary. */ + if (c == ')' || c == ',') + scan_token( c, &seq, seq_end); /* Ensure token parsing */ + else + *seq = EOS; + + switch (c) { /* First character of token */ + case ')': + if (! more_to_come) { /* Zero argument */ + if (trace_macro && m_num) + loc++; + break; + } /* Else fall through */ + case ',': /* Empty argument */ + if (trace_macro && m_num) + loc++; /* Advance pointer to infs */ + if (g_internal_data->warn_level & 2) + diag_macro( CWARN, empty_arg, sequence, 0L, NULL, defp, NULL); + if (g_internal_data->standard && var_arg && nargs == args - 1) { + /* Variable arguments begin with an empty argument */ + c = get_an_arg( c, &argp, arg_end, &seq, 1, nargs, &loc + , m_num, (trace_macro && m_num) ? &mgc_prefix : NULL); + } else { + if (g_internal_data->mcpp_mode == STD) + *argp++ = RT_END; + *argp++ = EOS; + } + if (++nargs == args) + valid_argp = argp; + if (c == ',') { + more_to_come = TRUE; + continue; + } else { /* ')' */ + break; + } + case '\n': /* Unterminated macro call in directive line*/ + unget_ch(); /* Fall through */ + case RT_END: /* Error of missing ')' */ + diag_macro( CERROR, unterm_macro, sequence, 0L, NULL, defp, NULL); + /* Fall through */ + case CHAR_EOF: /* End of file in macro call*/ + nargs = ARG_ERROR; + goto arg_ret; /* Diagnosed by at_eof() */ + default: /* Nomal argument */ + break; + } + + if (c == ')') /* At end of all args */ + break; + + c = get_an_arg( c, &argp, arg_end, &seq + , (var_arg && nargs == args - 1) ? 1 : 0, nargs, &loc + , m_num, (trace_macro && m_num) ? &mgc_prefix : NULL); + + if (++nargs == args) + valid_argp = argp; /* End of valid arguments */ + if (c == ')') + break; + if (c == 0) { /* End of file */ + nargs = ARG_ERROR; + goto arg_ret; /* Diagnosed by at_eof() */ + } + if (c == -1) { /* Untermanated macro call */ + diag_macro( CERROR, unterm_macro, sequence, 0L, NULL, defp, NULL); + nargs = ARG_ERROR; + goto arg_ret; + } + more_to_come = (c == ','); + } /* Collected all arguments */ + + if (nargs == 0 && args == 1) { /* Only and empty argument */ + if (g_internal_data->warn_level & 2) + diag_macro( CWARN, empty_arg, sequence, 0L, NULL, defp, NULL); + } else if (nargs != args) { /* Wrong number of arguments*/ + if (g_internal_data->mcpp_mode != OLD_PREP || (g_internal_data->warn_level & 1)) { + if ((g_internal_data->standard && var_arg && (nargs == args - 1)) + /* Absence of variable arguments */ + || (g_internal_data->mcpp_mode == OLD_PREP)) { + if (g_internal_data->warn_level & 1) + diag_macro( CWARN, narg_error, nargs < args ? "Less" + : "More", (long) args, sequence, defp, NULL); + } else { + diag_macro( CERROR, narg_error, nargs < args ? "Less" : "More" + , (long) args, sequence, defp, NULL); + } + } + } + if (args < nargs) { + argp = valid_argp; /* Truncate excess arguments*/ + } else { + for (c = nargs; c < args; c++) { + if (g_internal_data->mcpp_mode == STD) + *argp++ = RT_END; /* For rescan() */ + *argp++ = EOS; /* Missing arguments */ + } + if (c == 0) + argp++; /* Ensure positive length */ + } + arglist[ 0] = argp + = xrealloc( arglist[ 0], (size_t) (argp - arglist[ 0])); + /* Use memory sparingly */ + for (c = 1; c < args; c++) + arglist[ c] = argp += strlen( argp) + 1; + if (trace_macro && m_num) + mac_inf[ m_num].loc_args /* Truncate excess memory */ + = (LOCATION *) xrealloc( (char *) locs + , (loc - locs) * sizeof (LOCATION)); + + if (g_internal_data->mcpp_debug & EXPAND) { + if (nargs > 0) { + if (nargs > args) + nargs = args; + dump_args( "collect_args exit", nargs, (const char **) arglist); + } + dump_unget( "collect_args exit"); + } +arg_ret: + if (g_internal_data->mcpp_mode == STD) + g_internal_data->in_getarg = FALSE; + /* Return number of found arguments for function-like macro at most */ + /* defp->nargs, or return defp->nargs for object-like macro. */ + return defp->nargs <= DEF_NOARGS ? defp->nargs : nargs; +} + +static int get_an_arg( + int c, + char ** argpp, /* Address of pointer into argument list */ + char * arg_end, /* End of argument list buffer */ + char ** seqp, /* Buffer for diagnostics */ + int var_arg, /* 1 on __VA_ARGS__, 0 on others*/ + int nargs, /* Argument number */ + LOCATION ** locp, /* Where to save location infs */ + int m_num, /* Macro number to trace */ + MAGIC_SEQ * mgc_prefix /* White space and magics leading to argument */ +) +/* + * Get an argument of macro into '*argpp', return the next punctuator. + * Variable arguments are read as a merged argument. + * Note: nargs, locp and m_num are used only in macro trace mode of + * '#pragma MCPP debug macro_call' or -K option. + */ +{ + struct { + int n_par; + int n_in_src; + } n_paren[ 16]; + int num_paren = 0; + int end_an_arg = FALSE; /* End-of-an-arg flag */ + int paren = var_arg; /* For embedded ()'s */ + int token_type; + char * prevp; + char * argp = *argpp; + int trace_arg = 0; /* Enable tracing arg */ + LINE_COL s_line_col, e_line_col; /* Location of macro in an argument */ + MAGIC_SEQ mgc_seq; /* Magic seqs and spaces succeeding an arg */ + size_t len; + + if (trace_macro) { + trace_arg = m_num && g_internal_data->infile->fp; + if (m_num) { + if (trace_arg) { /* The macro call is in source */ + s_line_col.line = g_internal_data->src_line; + s_line_col.col = g_internal_data->infile->bptr - g_internal_data->infile->buffer - 1; + /* '-1': bptr is one byte passed beginning of the token */ + get_src_location( & s_line_col); + (*locp)->start_line = s_line_col.line; + (*locp)->start_col = s_line_col.col; + e_line_col = s_line_col; + /* Save the location, */ + /* also for end of arg in case of empty arg*/ + memset( n_paren, 0, sizeof (n_paren)); + } + *argp++ = MAC_INF; + *argp++ = MAC_ARG_START; + *argp++ = (char)(m_num / UCHARMAX) + 1; + *argp++ = (char)(m_num % UCHARMAX) + 1; + *argp++ = (char)nargs + 1; + /* Argument number internally starts at 1 */ + if (mgc_prefix->magic_start) { + /* Copy the preceding magics, if any */ + len = mgc_prefix->magic_end - mgc_prefix->magic_start; + memcpy( argp, mgc_prefix->magic_start, len); + argp += len; + } + } + memset( &mgc_seq, 0, sizeof (MAGIC_SEQ)); + } + + while (1) { + if (c == '\n' /* In control line */ + || c == RT_END) { /* Boundary of rescan (in STD mode) */ + if (c == '\n') + unget_ch(); + break; + } + if (trace_arg) { /* Save the location */ + s_line_col.line = g_internal_data->src_line; /* of the token */ + s_line_col.col = g_internal_data->infile->bptr - g_internal_data->infile->buffer - 1; + } + token_type = scan_token( c, (prevp = argp, &argp), arg_end); + /* Scan the next token */ + switch (c) { + case '(': /* Worry about balance */ + paren++; /* To know about commas */ + break; + case ')': /* Other side too */ + if (paren-- == var_arg) /* At the end? */ + end_an_arg = TRUE; /* Else more to come */ + if (trace_arg) { + if (num_paren && paren == n_paren[ num_paren].n_par) { + /* Maybe corresponding parentheses for the macro in arg */ + int src_n; + src_n = n_paren[ num_paren].n_in_src; + in_src[ src_n].end_line = s_line_col.line; + in_src[ src_n].end_col = s_line_col.col + 1; + num_paren--; + } + } + break; + case ',': + if (paren == 0) /* Comma delimits arg */ + end_an_arg = TRUE; + break; + case MAC_INF : /* Copy magics as they are */ + switch (*argp++ = (char)get_ch()) { + case MAC_ARG_START : + *argp++ = (char)get_ch(); + /* Fall through */ + case MAC_CALL_START : + *argp++ = (char)get_ch(); + *argp++ = (char)get_ch(); + break; + case MAC_ARG_END : + if (! g_internal_data->option_flags.v) + break; + else + *argp++ = (char)get_ch(); + /* Fall through */ + case MAC_CALL_END : + if (g_internal_data->option_flags.v) { + *argp++ = (char)get_ch(); + *argp++ = (char)get_ch(); + } + break; + } + break; + case CHAR_EOF : /* Unexpected EOF */ + return 0; + default : /* Any token */ + if (g_internal_data->mcpp_mode == STD && token_type == NAM + && c != IN_SRC && c != DEF_MAGIC && g_internal_data->infile->fp) { + len = trace_arg ? IN_SRC_LEN : 1; + memmove( prevp + len, prevp, (size_t) (argp - prevp)); + argp += len; + *prevp = IN_SRC; + /* Mark that the name is read from source file */ + if (trace_arg) { + DEFBUF * defp; + + defp = look_id( prevp + IN_SRC_LEN); + if (in_src_num >= MAX_IN_SRC_NUM - 1) { + cerror( + "Too many names in arguments tracing %s" /* _E_ */ + , defp ? defp->name : g_internal_data->empty_str, 0L, NULL); + return 0; + } else if (++in_src_num > max_in_src_num) { + size_t old_len; + old_len = sizeof (LOCATION) * max_in_src_num; + /* Enlarge the array */ + in_src = (LOCATION *) xrealloc( (char *) in_src + , old_len * 2); + /* Have to initialize the enlarged area */ + memset( in_src + max_in_src_num, 0, old_len); + max_in_src_num *= 2; + } + /* Insert the identifier number in 2-bytes-encoding */ + *(prevp + 1) = (char)(in_src_num / UCHARMAX) + 1; + *(prevp + 2) = (char)(in_src_num % UCHARMAX) + 1; + if (defp) { /* Macro name in arg */ + in_src[ in_src_num].start_line = s_line_col.line; + in_src[ in_src_num].start_col = s_line_col.col; + /* For object-like macro, also for function-like */ + /* macro in case of parens are not found. */ + in_src[ in_src_num].end_line = s_line_col.line; + in_src[ in_src_num].end_col + = g_internal_data->infile->bptr - g_internal_data->infile->buffer; + if (defp->nargs >= 0) { + /* Function-like macro: search parentheses */ + n_paren[ ++num_paren].n_par = paren; + n_paren[ num_paren].n_in_src = in_src_num; + } + } /* Else in_src[ in_src_num].* are 0L */ + } + } + break; + } /* End of switch */ + + if (end_an_arg) /* End of an argument */ + break; + if (trace_arg) { /* Save the location */ + e_line_col.line = g_internal_data->src_line; /* before spaces */ + e_line_col.col = g_internal_data->infile->bptr - g_internal_data->infile->buffer; + } + memset( &mgc_seq, 0, sizeof (MAGIC_SEQ)); + c = squeeze_ws( &argp, NULL, &mgc_seq); + /* To the next token */ + } /* Collected an argument*/ + + *argp = EOS; + *seqp = stpcpy( *seqp, *argpp); /* Save the sequence */ + if (c == '\n' || c == RT_END) + return -1; /* Unterminated macro */ + argp--; /* Remove the punctuator*/ + if (mgc_seq.space) + --argp; /* Remove trailing space */ + if (g_internal_data->mcpp_mode == STD) { + if (trace_macro && m_num) { + if (trace_arg) { /* Location of end of an arg */ + get_src_location( & e_line_col); + (*locp)->end_line = e_line_col.line; + (*locp)->end_col = e_line_col.col; + } + (*locp)++; /* Advance pointer even if !trace_arg */ + *argp++ = MAC_INF; + *argp++ = MAC_ARG_END; + if (g_internal_data->option_flags.v) { + *argp++ = (char)(m_num / UCHARMAX) + 1; + *argp++ = (char)(m_num % UCHARMAX) + 1; + *argp++ = (char)nargs + 1; + *argp = EOS; + *argpp = chk_magic_balance( *argpp, argp, TRUE, FALSE); + /* Check a stray magic caused by abnormal macro */ + /* and move it to an edge if found. */ + } + } + *argp++ = RT_END; /* For rescan() */ + } + *argp++ = EOS; /* Terminate an argument*/ + *argpp = argp; + return c; +} + +static int squeeze_ws( + char ** out, /* Pointer to output pointer */ + char ** endf, /* Pointer to end of infile data*/ + MAGIC_SEQ * mgc_seq /* Sequence of MAC_INFs and space */ + /* mgc_seq should be initialized in the calling routine */ +) +/* + * Squeeze white spaces to one space. + * White spaces are ' ' (and possibly '\t', when keep_spaces == TRUE. Note + * that '\r', '\v', '\f' have been already converted to ' ' by get_ch()), + * and '\n' unless in_directive is set. + * COM_SEP is skipped. TOK_SEPs are squeezed to one TOK_SEP. + * Copy MAC_INF and its sequences as they are. + * If white spaces are found and 'out' is not NULL, write a space to *out and + * increment *out. + * Record start and end of MAC_INF sequences and whether space is found or + * not for a convenience of get_an_arg(). + * Return the next character. + */ +{ + int c; + int space = 0; + int tsep = 0; + FILEINFO * file = g_internal_data->infile; + SIOHandle * fp = g_internal_data->infile->fp; + int end_of_file = (out && endf) ? FALSE : TRUE; + + while (((g_internal_data->char_type[ c = get_ch()] & SPA) && (! g_internal_data->standard + || (g_internal_data->mcpp_mode == POST_STD && file == g_internal_data->infile) + || (g_internal_data->mcpp_mode == STD + && ((g_internal_data->macro_line != 0 && g_internal_data->macro_line != MACRO_ERROR) + || file == g_internal_data->infile)))) + || c == MAC_INF) { + if (! end_of_file && file != g_internal_data->infile) { /* Infile has been read over*/ + *endf = *out; /* Remember the location */ + end_of_file = TRUE; + } + if (c == '\n' && g_internal_data->in_directive) /* If scanning control line */ + break; /* do not skip newline. */ + switch (c) { + case '\n': + space++; + g_internal_data->wrong_line = TRUE; + break; + case TOK_SEP: + if (g_internal_data->mcpp_mode == STD) + tsep++; + continue; /* Skip COM_SEP in OLD_PREP mode */ + case MAC_INF : /* Copy magics as they are, or skip */ + if (mgc_seq && ! mgc_seq->magic_start) + mgc_seq->magic_start = *out; + /* First occurence of magic seq */ + if (out) + *(*out)++ = (char)c; + c = get_ch(); + if (out) + *(*out)++ = (char)c; + switch (c) { + case MAC_ARG_START : + c = get_ch(); + if (out) + *(*out)++ = (char)c; + /* Fall through */ + case MAC_CALL_START : + c = get_ch(); + if (out) + *(*out)++ = (char)c; + c = get_ch(); + if (out) + *(*out)++ = (char)c; + break; + case MAC_ARG_END : + if (! g_internal_data->option_flags.v) { + break; + } else { + c = get_ch(); + if (out) + *(*out)++ = (char)c; + /* Fall through */ + } + case MAC_CALL_END : + if (g_internal_data->option_flags.v) { + c = get_ch(); + if (out) + *(*out)++ = (char)c; + c = get_ch(); + if (out) + *(*out)++ = (char)c; + } + break; + } + if (mgc_seq) /* Remember end of last magic seq */ + mgc_seq->magic_end = *out; + break; + default: + space++; + break; + } + } + + if (out) { + if (space) { /* Write a space to output pointer */ + *(*out)++ = ' '; /* and increment the pointer. */ + if (mgc_seq) + mgc_seq->space = TRUE; + } + if (tsep && !space) /* Needs to preserve token separator*/ + *(*out)++ = TOK_SEP; + **out = EOS; + } + if (g_internal_data->mcpp_mode == POST_STD && file != g_internal_data->infile) { + unget_ch(); /* Arguments cannot cross "file"s */ + c = fp ? CHAR_EOF : RT_END; /* EOF is diagnosed by at_eof() */ + } else if (g_internal_data->mcpp_mode == STD && g_internal_data->macro_line == MACRO_ERROR + && file != g_internal_data->infile) { /* EOF */ + unget_ch(); /* diagnosed by at_eof() or only */ + c = CHAR_EOF; /* name of a function-like macro. */ + } /* at_eof() resets macro_line on error */ + return c; /* Return the next character */ +} + +static void skip_macro( void) +/* + * Clear the stacked (i.e. half-expanded) macro, called on macro error. + */ +{ + if (g_internal_data->infile == NULL) /* End of input */ + return; + if (g_internal_data->infile->fp) /* Source file */ + return; + while (g_internal_data->infile->fp == NULL) { /* Stacked stuff */ + g_internal_data->infile->bptr += strlen( g_internal_data->infile->bptr); + get_ch(); /* To the parent "file" */ + } + unget_ch(); +} + +static void diag_macro( + int severity, /* Error or warning */ + const char * format, + const char * arg1, + long arg2, + const char * arg3, + const DEFBUF * defp1, /* Macro causing the problem 1 */ + const DEFBUF * defp2 /* 2 */ +) +/* + * Supplement macro information for diagnostic. + */ +{ + + if (defp1 && defp1->name != g_internal_data->macro_name) + expanding( defp1->name, FALSE); + /* Inform of the problematic macro call */ + if (defp2 && defp2->name != g_internal_data->macro_name) + expanding( defp2->name, FALSE); + if (severity == CERROR) + cerror( format, arg1, arg2, arg3); + else + cwarn( format, arg1, arg2, arg3); +} + +static void dump_args( + const char * why, + int nargs, + const char ** arglist +) +/* + * Dump arguments list. + */ +{ + int i; + + mcpp_fprintf( DEST_DBG, "dump of %d actual arguments %s\n", nargs, why); + for (i = 0; i < nargs; i++) { + mcpp_fprintf( DEST_DBG, "arg[%d]", i + 1); + dump_string( NULL, arglist[ i]); + } +} + +#if defined(PK_COMPILER_MSVC) +# pragma warning( pop ) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic pop +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic pop +#endif diff --git a/Samples/PK-MCPP/internal.h b/Samples/PK-MCPP/internal.h new file mode 100644 index 00000000..bea96c16 --- /dev/null +++ b/Samples/PK-MCPP/internal.h @@ -0,0 +1,478 @@ +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * I N T E R N A L . H + * I n t e r n a l D e f i n i t i o n s f o r M C P P + * + * In general, definitions in this file should not be changed by implementor. + */ + +#ifndef SYSTEM_H + #error "system.h" must be included prior to "internal.h" +#endif + +#include "mcpp_out.h" + +#if MCPP_LIB +#include "mcpp_lib.h" /* External interface when used as library */ +#endif + +#define EOS '\0' /* End of string */ +#define CHAR_EOF 0 /* Returned by get_ch() on eof */ + +#define VA_ARGS (UCHARMAX + 1) /* Signal of variable arguments */ +#define GVA_ARGS (VA_ARGS * 2) /* GCC-specific variable args */ +#define AVA_ARGS (VA_ARGS | GVA_ARGS)/* Any variable arguments */ +#define DEF_PRAGMA (-1 - AVA_ARGS) /* _Pragma() pseudo-macro */ +#define DEF_NOARGS (-2 - AVA_ARGS) /* #define foo vs #define foo() */ +#define DEF_NOARGS_PREDEF_OLD (DEF_NOARGS - 1) + /* Compiler-predefined macro without leading '_' */ +#define DEF_NOARGS_PREDEF (DEF_NOARGS - 2)/* Compiler-predefined macro */ +#define DEF_NOARGS_STANDARD (DEF_NOARGS - 3)/* Standard predefined macro */ +#define DEF_NOARGS_DYNAMIC (DEF_NOARGS - 4)/* Standard dynamically defined */ + +/* + * These magic characters must be control characters which can't be used + * in source file. + */ +/* for '#pragma MCPP debug macro_call' and -K option in STD mode. */ +#define MAC_INF 0x18 /* Magic for macro informations */ +/* In STD and POST_STD modes (IN_SRC and TOK_SEP are for STD mode only). */ +#define DEF_MAGIC 0x19 /* Magic to prevent recursive expansion */ +#define IN_SRC 0x1A /* Magic of name from source */ +#define RT_END 0x1C /* Magic of macro rescan boundary */ +#define ST_QUOTE 0x1D /* Magic for stringizing */ +#define CAT 0x1E /* Token concatenation delim. */ +#define TOK_SEP 0x1F /* Magic to wrap expanded macro */ +/* In OLD_PREP mode. */ +#define COM_SEP 0x1F /* Comment of 0-length */ + +#define MAC_PARM 0x7F /* Macro parameter signal */ + +/* Special character types */ +#define LET 1 /* Letter (alphabet and _) */ +#define DIG 2 /* Digit */ +#define DOT 4 /* . might start a number */ +#define PUNC 8 /* Punctuators and operators */ +#define QUO 0x10 /* Both flavors of quotation ",'*/ +#define SPA 0x20 /* White spaces */ +#define HSP 0x40 + /* Horizontal white spaces (' ', '\t', TOK_SEP) */ + +/* + * Codes for operators used in #if expression. + * The value of the scanned operator is stored in 'openum'. + */ +#define INV 0 /* Invalid, must be zero */ +#define OP_EOE INV /* End of expression */ +#define VAL 1 /* Value (operand) */ +#define OP_LPA 2 /* ( */ +/* The following are unary. */ +#define FIRST_UNOP OP_PLU /* First unary operator */ +#define OP_PLU 3 /* + */ +#define OP_NEG 4 /* - */ +#define OP_COM 5 /* ~ */ +#define OP_NOT 6 /* ! */ +#define LAST_UNOP OP_NOT /* Last unary operator */ +/* The following are binary. */ +#define FIRST_BINOP OP_MUL /* First binary operator */ +#define OP_MUL 7 /* * */ +#define OP_DIV 8 /* / */ +#define OP_MOD 9 /* % */ +#define OP_ADD 10 /* + */ +#define OP_SUB 11 /* - */ +#define OP_SL 12 /* << */ +#define OP_SR 13 /* >> */ +#define OP_LT 14 /* < */ +#define OP_LE 15 /* <= */ +#define OP_GT 16 /* > */ +#define OP_GE 17 /* >= */ +#define OP_EQ 18 /* == */ +#define OP_NE 19 /* != */ +#define OP_AND 20 /* & */ +#define OP_XOR 21 /* ^ */ +#define OP_OR 22 /* | */ +#define OP_ANA 23 /* && */ +#define OP_ORO 24 /* || */ +#define OP_QUE 25 /* ? */ +#define OP_COL 26 /* : */ +#define LAST_BINOP OP_COL /* Last binary operator */ +/* Parenthesis */ +#define OP_RPA 27 /* ) */ +#define OP_END 28 /* End of expression marker */ +#define OP_FAIL (OP_END + 1) /* For error returns */ + +/* + * The following are operators used in macro definition only. + */ +/* In STD and POST_STD modes. */ +#define OP_STR 30 /* # */ +#define OP_CAT 31 /* ## */ +#define OP_ELL 32 /* ... */ + +/* + * The following are C source operators or punctuators, + * not preprocessing operators. + * Note: "sizeof", "defined" are read as identifier for convenience. + */ +#define OP_1 33 /* Any other single byte ops or puncs */ + /* =, ., ;, [, ], {, }, ',' */ +#define OP_2 34 /* Any other two bytes operators */ + /* &=, |=, ++, +=, --, -=, ->, %=, *=, /=, ^=, */ +#define OP_3 35 /* Three bytes operators : <<=, >>= */ +/* + * The following are operators spelled in digraphs. + */ +/* In STD and POST_STD modes. */ +#define OP_LBRACE_D 0x40 /* <% i.e. { */ +#define OP_RBRACE_D 0x41 /* %> i.e. } */ +#define OP_LBRCK_D 0x42 /* <: i.e. [ */ +#define OP_RBRCK_D 0x43 /* :> i.e. ] */ +#define OP_SHARP_D 0x44 /* %: i.e. # */ +#define OP_DSHARP_D 0x45 /* %:%: i.e. ## */ +#define OP_DIGRAPH 0x40 /* (OP_*_D & OP_DIGRAPH) == 0x40 */ + +/* + * The following are for lexical scanning only. + */ +/* Token types */ +#define NO_TOKEN 0 +#define NAM 65 /* Identifier (name, keyword) */ +#define NUM 66 /* Preprocessing number */ +#define STR 67 /* Character string literal */ +#define CHR 69 /* Integer character constant */ + +/* In STD and POST_STD modes. */ +#define WSTR 68 /* Wide string literal */ +#define WCHR 70 /* Wide character constant */ + +#define OPE 71 /* Operator or punctuator */ +#define SPE 72 /* Unknown token (@ or others) */ +#define SEP 73 /* Token separator or magics */ + +/* + * The following are values of 'mcpp_debug' variable which is set by the + * arguments of '#pragma MCPP debug' directive. + */ +#define PATH 1 +#define TOKEN 2 +#define EXPAND 4 +#define MACRO_CALL 8 +#define IF 16 +#define EXPRESSION 32 +#define GETC 64 +#define MEMORY 128 + +/* MAC_* represent macro information types for -K option. */ +#define MAC_CALL_START 1 +#define MAC_CALL_END 2 +#define MAC_ARG_START 3 +#define MAC_ARG_END 4 + +/* MB_ERROR signals wrong multi-byte character sequence. */ +#define MB_ERROR 0x8000 + +#if MCPP_LIB && HOST_COMPILER == GNUC \ + && (SYS_FAMILY == SYS_UNIX && SYSTEM != SYS_CYGWIN) + /* For GCC 4.* on UNIXes */ +#pragma GCC visibility push( hidden) /* Hide these names from outside */ +#endif + +/* + * The DEFBUF structure stores information about #defined macros. + * Note that DEFBUF->parmnames is parameter names catenated with commas, + * which is saved for the check of redefinition for STD mode. + * 'parmnames' and 'repl' are allocated to the area succeding to name. + */ +typedef struct defbuf { + struct defbuf * link; /* Pointer to next def in chain */ + short nargs; /* Number of parameters */ + char * parmnames; /* -> Parameter names catenated by ',' */ + char * repl; /* Pointer to replacement text */ + const char * fname; /* Macro is defined in the source file */ + long mline; /* at the line. */ + char push; /* Push level indicator */ + char name[1]; /* Macro name */ +} DEFBUF; + +/* + * IFINFO stores information of conditional compilation. + */ +typedef struct ifinfo { + int stat; /* State of compilation */ + long ifline; /* Line #if started */ + long elseline; /* Line #else started */ +} IFINFO; + +/* + * The FILEINFO structure stores information about open files and macros + * being expanded. + */ +typedef struct fileinfo { + char * bptr; /* Current pointer into buffer */ + long line; /* Current line number of file */ + SIOHandle * fp; /* Source file if non-null */ + long pos; /* Position next to #include */ + struct fileinfo * parent; /* Link to includer */ + struct ifinfo * initif; /* Initial ifstack (return there on EOF)*/ + int sys_header; /* System header file or not */ + int include_opt; /* Specified by -include option */ + const char ** dirp; /* Include directory the file resides */ + const char * src_dir; /* Directory of source file */ + const char * real_fname; /* Real file name */ + const char * full_fname; /* Real full path list */ + char * filename; /* File/macro name (maybe changed) */ + char * buffer; /* Buffer of current input line */ +#if MCPP_LIB + /* Save output functions during push/pop of #includes */ + int (* last_fputc) ( int c, OUTDEST od); + int (* last_fputs) ( const char * s, OUTDEST od); + int (* last_fprintf)( OUTDEST od, const char * format, ...); +#endif +} FILEINFO; + +/* + * These bits are set in IFINFO.stat + */ +#define WAS_COMPILING 1 /* TRUE if compile set at entry */ +#define ELSE_SEEN 2 /* TRUE when #else processed */ +#define TRUE_SEEN 4 /* TRUE when #if TRUE processed */ + +#define compiling g_internal_data->ifstack[0].stat + +#define FP2DEST(fp) \ + (fp == g_internal_data->fp_out) ? DEST_OUT : \ + ((fp == g_internal_data->fp_err) ? DEST_ERR : \ + ((fp == g_internal_data->fp_debug) ? DEST_DBG : \ + ((OUTDEST) -1))) + +/* VAL_SIGN structure stores information about evaluated number. */ +typedef struct val_sign { + expr_t val; /* Value */ + int sign; /* Signed, unsigned, error */ +} VAL_SIGN; + +/* Values of VAL_SIGN.sign. */ +#define SIGNED 1 +#define UNSIGNED 0 +#define VAL_ERROR (-1) + +/* LINE_COL stores information of line and column data */ +typedef struct line_col { + long line; + size_t col; +} LINE_COL; + +/* Value of macro_line on macro call error. */ +#define MACRO_ERROR (-1L) + +/* + * Values of insert_sep (flag of insertion of token separator). + * Used only in POST_STD mode. + */ +#define NO_SEP 0 /* No separator is inserted */ +#define INSERT_SEP 1 /* Next get_ch() insert a separator */ +#define INSERTED_SEP 2 /* Last get_ch() Inserted a separator */ + +#define str_eq(s1, s2) (strcmp(s1, s2) == 0) + +#ifndef IO_SUCCESS +#define IO_SUCCESS 0 +#endif +#ifndef IO_ERROR +#define IO_ERROR (errno ? errno : 1) +#endif + +/* + * Externs + */ + /* Temporary buffer for directive line and macro expansion */ + +/* main.c */ +extern void un_predefine( int clearall); + /* Undefine predefined macros */ + +/* directive.c */ +extern void directive( void); + /* Process #directive line */ +extern DEFBUF * do_define( int ignore_redef, int predefine); + /* Do #define directive */ +extern DEFBUF * look_id( const char * name); + /* Look for a #define'd thing */ +extern DEFBUF ** look_prev( const char * name, int * cmp); + /* Look for place to insert def.*/ +extern DEFBUF * look_and_install( const char * name, int numargs + , const char * parmnames, const char * repl); + /* Look and insert macro def. */ +extern DEFBUF * install_macro( const char * name, int numargs + , const char * parmnames, const char * repl, DEFBUF ** prevp, int cmp + , int predefine); + /* Install a def to symbol table*/ +extern int undefine( const char * name); + /* Delete from symbol table */ +extern void dump_a_def( const char * why, const DEFBUF * dp, int newdef + , int comment, SIOHandle * fp); + /* Dump a specific macro def */ +extern void dump_def( int comment, int K_opt); + /* Dump current macro defs */ + +/* eval.c */ +extern expr_t eval_if( void); + /* Evaluate #if expression */ +extern VAL_SIGN * eval_num( const char * nump); + /* Evaluate preprocessing number*/ + + /* Expand a macro completely */ +extern void expand_init(); + /* Initialize expand_macro() */ +extern DEFBUF * is_macro( char ** cp); + /* The sequence is a macro call?*/ + +/* mbchar.c */ +extern const char * set_encoding( char * name, const char * env, int pragma); + /* Multi-byte char encoding */ +extern void mb_init( void); + /* Initialize mbchar variables */ +extern uexpr_t mb_eval( char ** seq_pp); + /* Evaluate mbchar in #if */ +extern int last_is_mbchar( const char * in, int len); + /* The line ends with MBCHAR ? */ + +/* support.c */ +extern int get_unexpandable( int c, int diag); + /* Get next unexpandable token */ +extern void skip_nl( void); + /* Skip to the end of the line */ +extern int skip_ws( void); + /* Skip over white-spaces */ +extern int scan_token( int c, char ** out_pp, char * out_end); + /* Get the next token */ +extern char * scan_quote( int delim, char * out, char * out_end, int diag); + /* Scan a quoted literal */ +extern int id_operator( const char * name); + /* Check identifier-like ops */ +extern void expanding( const char * name, int to_be_freed); + /* Save macro name expanding */ +extern void clear_exp_mac( void); + /* Clear expanding macro infs */ +extern int get_ch( void); + /* Get the next char from input */ +extern int cnv_trigraph( char * in); + /* Do trigraph replacement */ +extern int cnv_digraph( char * in); + /* Convert digraphs to usual tok*/ +extern void unget_ch( void); + /* Push back the char to input */ +extern FILEINFO * unget_string( const char * text, const char * name); + /* Push back the string to input*/ +extern char * save_string( const char * text); + /* Stuff string in malloc mem. */ +extern FILEINFO * get_file( const char * name, const char * src_dir + , const char * fullname, size_t bufsize, int include_opt); + /* New FILEINFO initialization */ +extern char * (xmalloc)( size_t size); + /* Get memory or die */ +extern char * (xrealloc)( char * ptr, size_t size); + /* Reallocate memory or die */ +extern LINE_COL * get_src_location( LINE_COL * p_line_col); + /* Get location on source file */ +extern void cfatal( const char * format, const char * arg1, long arg2 + , const char * arg3); + /* Print a fatal error and exit */ +extern void cerror( const char * format, const char * arg1, long arg2 + , const char * arg3); + /* Print an error message */ +extern void cwarn( const char * format, const char * arg1, long arg2 + , const char * arg3); + /* Print a warning message */ +extern void dump_string( const char * why, const char * text); + /* Dump text readably */ +extern void dump_unget( const char * why); + /* Dump all ungotten junk */ +/* Support for alternate output mechanisms (e.g. memory buffers) */ +extern int (* mcpp_fputc)( int c, OUTDEST od), + (* mcpp_fputs)( const char * s, OUTDEST od), + (* mcpp_fprintf)( OUTDEST od, const char * format, ...); + +/* system.c */ +extern void do_options( int argc, char ** argv, char ** in_pp + , char ** out_pp); + /* Process command line args */ +extern void init_sys_macro( void); + /* Define system-specific macro */ +extern void at_start( void); + /* Commands prior to main input */ +extern void put_depend( const char * filename); + /* Output source dependency line*/ +extern int do_include( int next); + /* Process #include directive */ +extern void add_file( SIOHandle * fp, const char * src_dir + , const char * filename, const char * fullname, int include_opt); + /* Chain the included file */ +extern void sharp( FILEINFO * sharp_file, int marker); + /* Output # line number */ +extern void do_pragma( void); + /* Process #pragma directive */ +extern void put_asm( void); + /* Putout an asm code line */ +extern void do_old( void); + /* Process older directives */ +extern void at_end( void); + /* Do the final commands */ +extern void print_heap( void); + /* Print blocks of heap memory */ +#if ! HOST_HAVE_STPCPY +extern char * stpcpy( char * dest, const char * src); + /* Non-Standard library function*/ +#endif + +#if MCPP_LIB /* Setting to use mcpp as a subroutine */ +/* directive.c */ +extern void clear_symtable( void); + /* Free all macro definitions */ +/* system.c */ +extern void clear_filelist( void); + /* Free filename and directory list */ +/* The following 5 functions are to Initialize static variables. */ +/* directive.c */ +extern void init_directive( void); +/* eval.c */ +extern void init_eval( void); +/* support.c */ +extern void init_support( void); + +#if HOST_COMPILER == GNUC && (SYS_FAMILY == SYS_UNIX && SYSTEM != SYS_CYGWIN) +#pragma GCC visibility pop +#endif +#endif + +#if HOST_HAVE_STPCPY && !defined(stpcpy) +extern char * stpcpy( char * dest, const char * src); +#endif diff --git a/Samples/PK-MCPP/main.cpp b/Samples/PK-MCPP/main.cpp new file mode 100644 index 00000000..7aa26d6a --- /dev/null +++ b/Samples/PK-MCPP/main.cpp @@ -0,0 +1,903 @@ +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * M A I N . C + * M C P P M a i n P r o g r a m + * + * The main routine and it's supplementary routines are placed here. + * The post-preprocessing routines are also placed here. + */ + +#include "precompiled.h" +#include "pk_mcpp_bridge.h" + +#if defined(PK_COMPILER_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4611) +# pragma warning( disable : 4101) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wwrite-strings" +# pragma clang diagnostic ignored "-Wunused-function" +# pragma clang diagnostic ignored "-Wchar-subscripts" +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wwrite-strings" +# pragma GCC diagnostic ignored "-Wunused-function" +# pragma GCC diagnostic ignored "-Wchar-subscripts" +#endif + +#define MBCHAR_IS_ESCAPE_FREE (SJIS_IS_ESCAPE_FREE && \ + BIGFIVE_IS_ESCAPE_FREE && ISO2022_JP_IS_ESCAPE_FREE) + +#if MCPP_LIB +static void init_main( void); + /* Initialize static variables */ +#endif +static void init_defines( void); + /* Predefine macros */ +static void mcpp_main( void); + /* Main loop to process input lines */ +static void do_pragma_op( void); + /* Execute the _Pragma() operator */ +static void put_seq( char * begin, char * seq); + /* Put out the failed sequence */ +static char * de_stringize( char * in, char * out); + /* "De-stringize" for _Pragma() op. */ +static void putout( char * out); + /* May concatenate adjacent string */ +#if COMPILER != GNUC && COMPILER != MSC +static void devide_line( char * out); + /* Devide long line for compiler */ +#endif +static void put_a_line( char * out); + /* Put out the processed line */ +#if ! HAVE_DIGRAPHS || ! MBCHAR_IS_ESCAPE_FREE +static int post_preproc( char * out); + /* Post-preprocess for older comps */ +#if ! HAVE_DIGRAPHS +static char * conv_a_digraph( char * cp); + /* Convert a digraph in place */ +#endif +#if ! MBCHAR_IS_ESCAPE_FREE +static char * esc_mbchar( char * str, char * str_end); + /* Double \ as 2nd byte of SJIS */ +#endif +#endif + + +#if MCPP_LIB +int mcpp_lib_main +#else +int main +#endif +( + int argc, + char ** argv +) +{ + char * in_file = NULL; + char * out_file = NULL; + const char * stdin_name = ""; + + if (setjmp( g_internal_data->error_exit) == -1) { + g_internal_data->errors++; + goto fatal_error_exit; + } + +#if MCPP_LIB + /* Initialize global and static variables. */ + init_directive(); + init_eval(); + init_support(); +#endif + + g_internal_data->fp_in = &g_global_data->m_std_in; + g_internal_data->fp_out = &g_global_data->m_std_out; + g_internal_data->fp_err = &g_global_data->m_std_err; + g_internal_data->fp_debug = &g_global_data->m_std_out; + /* + * Debugging information is output to stdout in order to + * synchronize with preprocessed output. + */ + + g_internal_data->inc_dirp = &g_internal_data->empty_str; /* Initialize to current (null) directory */ + g_internal_data->cur_fname = g_internal_data->cur_fullname = const_cast("(predefined)"); /* For predefined macros */ + init_defines(); /* Predefine macros */ + mb_init(); /* Should be initialized prior to get options */ + do_options( argc, argv, &in_file, &out_file); /* Command line options */ + + /* Open input file, "-" means stdin. */ + if (in_file != NULL && ! str_eq( in_file, "-")) { + if ((g_internal_data->fp_in = pk_fopen( in_file, "r")) == NULL) { + mcpp_fprintf( DEST_ERR, "Can't open input file \"%s\".\n", in_file); + g_internal_data->errors++; +#if MCPP_LIB + goto fatal_error_exit; +#else + return( IO_ERROR); +#endif + } + } else { + in_file = const_cast(stdin_name); + } + /* Open output file, "-" means stdout. */ + if (out_file != NULL && ! str_eq( out_file, "-")) { + if ((g_internal_data->fp_out = pk_fopen( out_file, "w")) == NULL) { + mcpp_fprintf( DEST_ERR, "Can't open output file \"%s\".\n", out_file); + g_internal_data->errors++; +#if MCPP_LIB + goto fatal_error_exit; +#else + return( IO_ERROR); +#endif + } + g_internal_data->fp_debug = g_internal_data->fp_out; + } + if (g_internal_data->option_flags.q) { /* Redirect diagnostics */ + if ((g_internal_data->fp_err = pk_fopen( "mcpp.err", "a")) == NULL) { + g_internal_data->errors++; + mcpp_fprintf( DEST_OUT, "Can't open \"mcpp.err\"\n"); +#if MCPP_LIB + goto fatal_error_exit; +#else + return( IO_ERROR); +#endif + } + } + init_sys_macro(); /* Initialize system-specific macros */ + add_file( g_internal_data->fp_in, NULL, in_file, in_file, FALSE); + /* "open" main input file */ + g_internal_data->infile->dirp = g_internal_data->inc_dirp; + g_internal_data->infile->sys_header = FALSE; + g_internal_data->cur_fullname = in_file; + if (g_internal_data->mkdep && str_eq( g_internal_data->infile->real_fname, stdin_name) == FALSE) + put_depend( in_file); /* Putout target file name */ + at_start(); /* Do the pre-main commands */ + + mcpp_main(); /* Process main file */ + + if (g_internal_data->mkdep) + put_depend( NULL); /* Append '\n' to dependency line */ + at_end(); /* Do the final commands */ + +fatal_error_exit: +#if MCPP_LIB + /* Free malloced memory */ + if (g_internal_data->mcpp_debug & MACRO_CALL) { + if (in_file != stdin_name) + free( in_file); + } + clear_filelist(); + clear_symtable(); +#endif + + if (g_internal_data->fp_in != &g_global_data->m_std_in) + pk_fclose( g_internal_data->fp_in); + if (g_internal_data->fp_out != &g_global_data->m_std_out) + pk_fclose( g_internal_data->fp_out); + if (g_internal_data->fp_err != &g_global_data->m_std_err) + pk_fclose( g_internal_data->fp_err); + + if (g_internal_data->mcpp_debug & MEMORY) + print_heap(); + if (g_internal_data->errors > 0 && g_internal_data->option_flags.no_source_line == FALSE) { + mcpp_fprintf( DEST_ERR, "%d error%s in preprocessor.\n", + g_internal_data->errors, (g_internal_data->errors == 1) ? "" : "s"); + return IO_ERROR; + } + return IO_SUCCESS; /* No errors */ +} + +/* + * This is the table used to predefine target machine, operating system and + * compiler designators. It may need hacking for specific circumstances. + * The -N option supresses these definitions. + */ +typedef struct pre_set { + const char * name; + const char * val; +} PRESET; + +static PRESET preset[] = { + +#ifdef SYSTEM_OLD + { SYSTEM_OLD, "1"}, +#endif +#ifdef SYSTEM_SP_OLD + { SYSTEM_SP_OLD, "1"}, +#endif +#ifdef COMPILER_OLD + { COMPILER_OLD, "1"}, +#endif +#ifdef COMPILER_SP_OLD + { COMPILER_SP_OLD, "1"}, +#endif + + { NULL, NULL}, /* End of macros beginning with alphabet */ + +#ifdef SYSTEM_STD + { SYSTEM_STD, "1"}, +#endif +#ifdef SYSTEM_STD1 + { SYSTEM_STD1, "1"}, +#endif +#ifdef SYSTEM_STD2 + { SYSTEM_STD2, "1"}, +#endif + +#ifdef SYSTEM_EXT + { SYSTEM_EXT, SYSTEM_EXT_VAL}, +#endif +#ifdef SYSTEM_EXT2 + { SYSTEM_EXT2, SYSTEM_EXT2_VAL}, +#endif +#ifdef SYSTEM_SP_STD + { SYSTEM_SP_STD, SYSTEM_SP_STD_VAL}, +#endif +#ifdef COMPILER_STD + { COMPILER_STD, COMPILER_STD_VAL}, +#endif +#ifdef COMPILER_STD1 + { COMPILER_STD1, COMPILER_STD1_VAL}, +#endif +#ifdef COMPILER_STD2 + { COMPILER_STD2, COMPILER_STD2_VAL}, +#endif +#ifdef COMPILER_EXT + { COMPILER_EXT, COMPILER_EXT_VAL}, +#endif +#ifdef COMPILER_EXT2 + { COMPILER_EXT2, COMPILER_EXT2_VAL}, +#endif +#ifdef COMPILER_SP_STD + { COMPILER_SP_STD, COMPILER_SP_STD_VAL}, +#endif +#ifdef COMPILER_SP1 + { COMPILER_SP1, COMPILER_SP1_VAL}, +#endif +#ifdef COMPILER_SP2 + { COMPILER_SP2, COMPILER_SP2_VAL}, +#endif +#ifdef COMPILER_SP3 + { COMPILER_SP3, COMPILER_SP3_VAL}, +#endif +#ifdef COMPILER_CPLUS + { COMPILER_CPLUS, COMPILER_CPLUS_VAL}, +#endif + { NULL, NULL}, /* End of macros with value of any integer */ +}; + +static void init_defines( void) +/* + * Initialize the built-in #define's. + * Called only on cpp startup prior to do_options(). + * + * Note: the built-in static definitions are removed by the -N option. + */ +{ + int n = sizeof preset / sizeof (PRESET); + int nargs; + PRESET * pp; + + /* Predefine the built-in symbols. */ + nargs = DEF_NOARGS_PREDEF_OLD; + for (pp = preset; pp < preset + n; pp++) { + if (pp->name && *(pp->name)) + look_and_install( pp->name, nargs, g_internal_data->empty_str, pp->val); + else if (! pp->name) + nargs = DEF_NOARGS_PREDEF; + } + + look_and_install( "__MCPP", DEF_NOARGS_PREDEF, g_internal_data->empty_str, "2"); + /* MCPP V.2.x */ + /* This macro is predefined and is not undefined by -N option, */ + /* yet can be undefined by -U or #undef. */ +} + +void un_predefine( + int clearall /* TRUE for -N option */ +) +/* + * Remove predefined symbols from the symbol table. + */ +{ + PRESET * pp; + DEFBUF * defp; + int n = sizeof preset / sizeof (PRESET); + + for (pp = preset; pp < preset + n; pp++) { + if (pp->name) { + if (*(pp->name) && (defp = look_id( pp->name)) != NULL + && defp->nargs >= DEF_NOARGS_PREDEF) + undefine( pp->name); + } else if (clearall == FALSE) { /* -S option */ + break; + } + } +} + +/* + * output[] and out_ptr are used for: + * buffer to store preprocessed line (this line is put out or handed to + * post_preproc() via putout() in some cases) + */ +static char output[ NMACWORK]; /* Buffer for preprocessed line */ +static char * const out_end = & output[ NWORK - 2]; + /* Limit of output line for other than GCC and VC */ +static char * const out_wend = & output[ NMACWORK - 2]; + /* Buffer end of output line */ +static char * out_ptr; /* Current pointer into output[]*/ + +static void mcpp_main( void) +/* + * Main process for mcpp -- copies tokens from the current input stream + * (main file or included file) to the output file. + */ +{ + int c; /* Current character */ + char * wp; /* Temporary pointer */ + DEFBUF * defp; /* Macro definition */ + int line_top; /* Is in the line top, possibly spaces */ + LINE_COL line_col; /* Location of macro call in source */ + + g_internal_data->keep_comments = g_internal_data->option_flags.c && !g_internal_data->no_output; + g_internal_data->keep_spaces = g_internal_data->option_flags.k; /* Will be turned off if !compiling */ + line_col.col = line_col.line = 0L; + + /* + * This loop is started "from the top" at the beginning of each line. + * 'wrong_line' is set TRUE in many places if it is necessary to write + * a #line record. (But we don't write them when expanding macros.) + * + * 'newlines' variable counts the number of blank lines that have been + * skipped over. These are then either output via #line records or + * by outputting explicit blank lines. + * 'newlines' will be cleared on end of an included file by get_ch(). + */ + while (1) { /* For the whole input */ + g_internal_data->newlines = 0; /* Count empty lines */ + + while (1) { /* For each line, ... */ + out_ptr = output; /* Top of the line buf */ + c = get_ch(); + if (g_internal_data->src_col) + break; /* There is a residual tokens on the line */ + while (g_internal_data->char_type[ c] & HSP) { /* ' ' or '\t' */ + if (c != COM_SEP) + *out_ptr++ = (char)c; /* Retain line top white spaces */ + /* Else skip 0-length comment */ + c = get_ch(); + } + if (c == '#') { /* Is 1st non-space '#' */ + directive(); /* Do a #directive */ + } else if (g_internal_data->mcpp_mode == STD && g_internal_data->option_flags.dig && c == '%') { + /* In POST_STD digraphs are already converted */ + if (get_ch() == ':') { /* '%:' i.e. '#' */ + directive(); /* Do a #directive */ + } else { + unget_ch(); + if (! compiling) { + skip_nl(); + g_internal_data->newlines++; + } else { + break; + } + } + } else if (c == CHAR_EOF) { /* End of input */ + break; + } else if (! compiling) { /* #ifdef false? */ + skip_nl(); /* Skip to newline */ + g_internal_data->newlines++; /* Count it, too. */ + } else if (g_internal_data->in_asm && ! g_internal_data->no_output) { /* In #asm block */ + put_asm(); /* Put out as it is */ + } else if (c == '\n') { /* Blank line */ + if (g_internal_data->keep_comments) + mcpp_fputc( '\n', DEST_OUT); /* May flush comments */ + else + g_internal_data->newlines++; /* Wait for a token */ + } else { + break; /* Actual token */ + } + } + + if (c == CHAR_EOF) /* Exit process at */ + break; /* end of input */ + + /* + * If the loop didn't terminate because of end of file, we + * know there is a token to compile. First, clean up after + * absorbing newlines. newlines has the number we skipped. + */ + if (g_internal_data->no_output) { + g_internal_data->wrong_line = FALSE; + } else { + if (g_internal_data->wrong_line || g_internal_data->newlines > 10) { + sharp( NULL, 0); /* Output # line number */ + if (g_internal_data->keep_spaces && g_internal_data->src_col) { + while (g_internal_data->src_col--) /* Adjust columns */ + mcpp_fputc( ' ', DEST_OUT); + g_internal_data->src_col = 0; + } + } else { /* If just a few, stuff */ + while (g_internal_data->newlines-- > 0) /* them out ourselves */ + mcpp_fputc('\n', DEST_OUT); + } + } + + /* + * Process each token on this line. + */ + line_top = TRUE; + while (c != '\n' && c != CHAR_EOF) { /* For the whole line */ + /* + * has_pragma is set to TRUE so as to execute _Pragma() operator + * when the psuedo macro _Pragma() is found. + */ + int has_pragma; + + if ((g_internal_data->mcpp_debug & MACRO_CALL) && ! g_internal_data->in_directive) { + line_col.line = g_internal_data->src_line; /* Location in source */ + line_col.col = g_internal_data->infile->bptr - g_internal_data->infile->buffer - 1; + } + if (scan_token( c, (wp = out_ptr, &wp), out_wend) == NAM + && (defp = is_macro( &wp)) != NULL) { /* A macro */ + wp = g_internal_data->expand_macro( defp, out_ptr, out_wend, line_col + , & has_pragma); /* Expand it completely */ + if (line_top) { /* The first token is a macro */ + char * tp = out_ptr; + while (g_internal_data->char_type[ *tp & UCHARMAX] & HSP) + tp++; /* Remove excessive spaces */ + memmove( out_ptr, tp, strlen( tp) + 1); + wp -= (tp - out_ptr); + } + if (has_pragma) { /* Found _Pramga() */ + do_pragma_op(); /* Do _Pragma() operator*/ + out_ptr = output; /* Do the rest of line */ + g_internal_data->wrong_line = TRUE; /* Line-num out of sync */ + } else { + out_ptr = wp; + } + if (g_internal_data->keep_spaces && g_internal_data->wrong_line && g_internal_data->infile + && *(g_internal_data->infile->bptr) != '\n' && *(g_internal_data->infile->bptr) != EOS) { + g_internal_data->src_col = (int)(g_internal_data->infile->bptr - g_internal_data->infile->buffer); + /* Remember the current colums */ + break; /* Do sharp() now */ + } + } else { /* Not a macro call */ + out_ptr = wp; /* Advance the place */ + if (g_internal_data->wrong_line) /* is_macro() swallowed */ + break; /* the newline */ + } + while (g_internal_data->char_type[ c = get_ch()] & HSP) { /* Horizontal space */ + if (c != COM_SEP) /* Skip 0-length comment*/ + *out_ptr++ = (char)c; + } + line_top = FALSE; /* Read over some token */ + } /* Loop for line */ + + putout( output); /* Output the line */ + } /* Continue until EOF */ +} + +static void do_pragma_op( void) +/* + * Execute the _Pragma() operator contained in an expanded macro. + * Note: _Pragma() operator is also implemented as a special macro. Therefore + * it is always searched as a macro. + * There might be more than one _Pragma() in a expanded macro and those may be + * surrounded by other token sequences. + * Since all the macros have been expanded completely, any name identical to + * macro should not be re-expanded. + * However, a macro in the string argument of _Pragma() may be expanded by + * do_pragma() after de_stringize(), if EXPAND_PRAGMA == TRUE. + */ +{ + FILEINFO * file; + DEFBUF * defp; + int prev = output < out_ptr; /* There is a previous sequence */ + int token_type; + char * cp1, * cp2; + int c; + + file = unget_string( out_ptr, NULL); + while (c = get_ch(), file == g_internal_data->infile) { + if (g_internal_data->char_type[ c] & HSP) { + *out_ptr++ = (char)c; + continue; + } + if (scan_token( c, (cp1 = out_ptr, &cp1), out_wend) + == NAM && (defp = is_macro( &cp1)) != NULL + && defp->nargs == DEF_PRAGMA) { /* _Pragma() operator */ + if (prev) { + putout( output); /* Putout the previous sequence */ + cp1 = stpcpy( output, "pragma "); /* From top of buffer */ + } + /* is_macro() already read over possible spaces after _Pragma */ + *cp1++ = (char)get_ch(); /* '(' */ + while (g_internal_data->char_type[ c = get_ch()] & HSP) + *cp1++ = (char)c; + if (((token_type = scan_token( c, (cp2 = cp1, &cp1), out_wend)) + != STR && token_type != WSTR)) { + /* Not a string literal */ + put_seq( output, cp1); + return; + } + g_internal_data->workp = de_stringize( cp2, g_internal_data->work_buf); + while (g_internal_data->char_type[ c = get_ch()] & HSP) + *cp1++ = (char)c; + if (c != ')') { /* More than a string literal */ + unget_ch(); + put_seq( output, cp1); + return; + } + strcpy( g_internal_data->workp, "\n"); /* Terminate with */ + unget_string( g_internal_data->work_buf, NULL); + do_pragma(); /* Do the #pragma "line" */ + g_internal_data->infile->bptr += strlen( g_internal_data->infile->bptr); /* Clear sequence */ + cp1 = out_ptr = output; /* From the top of buffer */ + prev = FALSE; + } else { /* Not pragma sequence */ + out_ptr = cp1; + prev = TRUE; + } + } + unget_ch(); + if (prev) + putout( output); +} + +static void put_seq( + char * begin, /* Sequence already in buffer */ + char * seq /* Sequence to be read */ +) +/* + * Put out the failed sequence as it is. + */ +{ + FILEINFO * file = g_internal_data->infile; + int c; + + cerror( "Operand of _Pragma() is not a string literal" /* _E_ */ + , NULL, 0L, NULL); + while (c = get_ch(), file == g_internal_data->infile) + *seq++ = (char)c; + unget_ch(); + out_ptr = seq; + putout( begin); +} + +static char * de_stringize( + char * in, /* Null terminated string literal */ + char * out /* Output buffer */ +) +/* + * Make token sequence from a string literal for _Pragma() operator. + */ +{ + char * in_p; + int c1, c; + + in_p = in; + if (*in_p == 'L') + in_p++; /* Skip 'L' prefix */ + while ((c = *++in_p) != EOS) { + if (c == '\\' && ((c1 = *(in_p + 1), c1 == '\\') || c1 == '"')) + c = *++in_p; /* "De-escape" escape sequence */ + *out++ = (char)c; + } + *--out = EOS; /* Remove the closing '"' */ + return out; +} + +static void putout( + char * out /* Output line (line-end is always 'out_ptr') */ +) +/* + * Put out a line with or without "post-preprocessing". + */ +{ + size_t len; + + *out_ptr++ = '\n'; /* Put out a newline */ + *out_ptr = EOS; + +#if ! MBCHAR_IS_ESCAPE_FREE + post_preproc( out); +#elif ! HAVE_DIGRAPHS + if (mcpp_mode == STD && option_flag.dig) + post_preproc( out); +#endif + /* Else no post-preprocess */ +#if COMPILER != GNUC && COMPILER != MSC + /* GCC and Visual C can accept very long line */ + len = strlen( out); + if (len > NWORK - 1) + devide_line( out); /* Devide a too long line */ + else +#endif + put_a_line( out); +} + +#if COMPILER != GNUC && COMPILER != MSC + +static void devide_line( + char * out /* 'out' is 'output' in actual */ +) +/* + * Devide a too long line into output lines shorter than NWORK. + * This routine is called from putout(). + */ +{ + FILEINFO * file; + char * save; + char * wp; + int c; + + file = unget_string( out, NULL); /* To re-read the line */ + wp = out_ptr = out; + + while ((c = get_ch()), file == g_internal_data->infile) { + if (g_internal_data->char_type[ c] & HSP) { + if (g_internal_data->keep_spaces || out == out_ptr + || (g_internal_data->char_type[ *(out_ptr - 1) & UCHARMAX] & HSP)) { + *out_ptr++ = (char)c; + wp++; + } + continue; + } + scan_token( c, &wp, out_wend); /* Read a token */ + if (NWORK-2 < wp - out_ptr) { /* Too long a token */ + cfatal( "Too long token %s", out_ptr, 0L, NULL); /* _F_ */ + } else if (out_end <= wp) { /* Too long line */ + if (g_internal_data->mcpp_debug & MACRO_CALL) { /* -K option */ + /* Other than GCC or Visual C */ + /* scan_token() scans a comment as sequence of some */ + /* tokens such as '/', '*', ..., '*', '/', since it */ + /* does not expect comment. */ + save = out_ptr; + while ((save = strrchr( save, '/')) != NULL) { + if (*(save - 1) == '*') { /* '*' '/' sequence */ + out_ptr = save + 1; /* Devide at the end*/ + break; /* of a comment*/ + } + } + } + save = save_string( out_ptr); /* Save the token */ + *out_ptr++ = '\n'; /* Append newline */ + *out_ptr = EOS; + put_a_line( out); /* Putout the former tokens */ + wp = out_ptr = stpcpy( out, save); /* Restore the token */ + free( save); + } else { /* Still in size */ + out_ptr = wp; /* Advance the pointer */ + } + } + + unget_ch(); /* Push back the source character */ + put_a_line( out); /* Putout the last tokens */ + sharp( NULL, 0); /* Correct line number */ +} + +#endif + +static void put_a_line( + char * out +) +/* + * Finally put out the preprocessed line. + */ +{ + size_t len; + char * out_p; + char * tp; + + if (g_internal_data->no_output) + return; + len = strlen( out); + out_p = out + len; /* Just before '\n' */ + if (len >= 2) + out_p -= 2; + tp = out_p; + while (g_internal_data->char_type[ *out_p & UCHARMAX] & SPA) + out_p--; /* Remove trailing white spaces */ + if (out_p < tp) { + *++out_p = '\n'; + *++out_p = EOS; + } + if (mcpp_fputs( out, DEST_OUT) == EOF) + cfatal( "File write error", NULL, 0L, NULL); /* _F_ */ +} + + +/* + * Routines to P O S T - P R E P R O C E S S + * + * 1998/08 created kmatsui (revised 1998/09, 2004/02, 2006/07) + * Supplementary phase for the older compiler-propers. + * 1. Convert digraphs to usual tokens. + * 2. Double '\\' of the second byte of multi-byte characters. + * These conversions are done selectively according to the macros defined + * in system.h. + * 1. Digraphs are converted if ! HAVE_DIGRAPHS and digraph recoginition + * is enabled by DIGRAPHS_INIT and/or -2 option on execution. + * 2. '\\' of the second byte of SJIS (BIGFIVE or ISO2022_JP) is doubled + * if bsl_need_escape == TRUE. + */ + +#if HAVE_DIGRAPHS && MBCHAR_IS_ESCAPE_FREE + /* No post_preproc() */ +#else + +static int post_preproc( + char * out +) +/* + * Convert digraphs and double '\\' of the second byte of SJIS (BIGFIVE or + * ISO2022_JP). + * Note: Output of -K option embeds macro informations into comments. + * scan_token() does not recognize comment and parses it as '/', '*', etc. + */ +{ +#if ! HAVE_DIGRAPHS + int di_count = 0; +#endif + int token_type; + int c; + char * str; + char * cp = out; + + unget_string( out, NULL); + while ((c = get_ch()) != '\n') { /* Not to read over to next line */ + if (g_internal_data->char_type[ c] & HSP) { + *cp++ = (char)c; + continue; + } + str = cp; + token_type = scan_token( c, &cp, out_wend); + switch (token_type) { +#if ! MBCHAR_IS_ESCAPE_FREE + case WSTR : + case WCHR : + str++; /* Skip prefix 'L' */ + /* Fall through */ + case STR : + case CHR : + if (g_internal_data->bsl_need_escape) + cp = esc_mbchar( str, cp); + break; +#endif /* ! MBCHAR_IS_ESCAPE_FREE */ +#if ! HAVE_DIGRAPHS + case OPE : + if (mcpp_mode == STD && (openum & OP_DIGRAPH)) { + cp = conv_a_digraph( cp); /* Convert a digraph */ + di_count++; + } + break; +#endif + } + } + *cp++ = '\n'; + *cp = EOS; +#if ! HAVE_DIGRAPHS + if (mcpp_mode == STD && di_count && (warn_level & 16)) + cwarn( "%.0s%ld digraph(s) converted" /* _W16_ */ + , NULL, (long) di_count, NULL); +#endif + return 0; +} + +#endif /* ! HAVE_DIGRAPHS || ! MBCHAR_IS_ESCAPE_FREE */ + +#if ! HAVE_DIGRAPHS +static char * conv_a_digraph( + char * cp /* The end of the digraph token */ +) +/* + * Convert a digraph to usual token in place. + * This routine is never called in POST_STD mode. + */ +{ + cp -= 2; + switch (openum) { + case OP_LBRACE_D : + *cp++ = '{'; + break; + case OP_RBRACE_D : + *cp++ = '}'; + break; + case OP_LBRCK_D : + *cp++ = '['; + break; + case OP_RBRCK_D : + *cp++ = ']'; + break; + case OP_SHARP_D : /* Error of source */ + *cp++ = '#'; + break; + case OP_DSHARP_D : /* Error of source */ + cp -= 2; + *cp++ = '#'; + *cp++ = '#'; + break; + } + return cp; +} +#endif /* ! HAVE_DIGRAPHS */ + +#if ! MBCHAR_IS_ESCAPE_FREE +static char * esc_mbchar( + char * str, /* String literal or character constant without 'L' */ + char * str_end /* The end of the token */ +) +/* + * Insert \ before the byte of 0x5c('\\') of the SJIS, BIGFIVE or ISO2022_JP + * multi-byte character code in string literal or character constant. + * Insert \ also before the byte of 0x22('"') and 0x27('\'') of ISO2022_JP. + * esc_mbchar() does in-place insertion. + */ +{ + char * cp; + int delim; + int c; + + if (! g_internal_data->bsl_need_escape) + return str_end; + if ((delim = *str++) == 'L') + delim = *str++; /* The quote character */ + while ((c = *str++ & UCHARMAX) != delim) { + if (g_internal_data->char_type[ c] & g_internal_data->mbchk) { /* MBCHAR */ + cp = str; + g_internal_data->mb_read( c, &str, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp)); + while (cp++ < str) { + c = *(cp - 1); + if (c == '\\' || c == '"' || c == '\'') { + /* Insert \ before 0x5c, 0x22, 0x27 */ + memmove( cp, cp - 1, (size_t) (str_end - cp) + 2); + *(cp++ - 1) = '\\'; + str++; + str_end++; + } + } + } else if (c == '\\' && ! (g_internal_data->char_type[ *str & UCHARMAX] & g_internal_data->mbchk)) { + str++; /* Escape sequence */ + } + } + return str_end; +} +#endif /* ! MBCHAR_IS_ESCAPE_FREE */ + +#if defined(PK_COMPILER_MSVC) +# pragma warning( pop ) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic pop +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic pop +#endif diff --git a/Samples/PK-MCPP/mbchar.cpp b/Samples/PK-MCPP/mbchar.cpp new file mode 100644 index 00000000..58027b4d --- /dev/null +++ b/Samples/PK-MCPP/mbchar.cpp @@ -0,0 +1,878 @@ +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * M B C H A R . C + * C h a r a c t e r h a n d l i n g R o u t i n e s + * + * Character handling and multi-byte character handling routines are + * placed here. + */ + +#include "precompiled.h" +#include "pk_mcpp_bridge.h" + +#if defined(PK_COMPILER_MSVC) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wchar-subscripts" +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wchar-subscripts" +#endif + +/* + * Tables of character types and multi-byte character types. + * + * Some of these character attributes will be overwritten by + * execution time option '-@post' or '-@old'. + * Warning on erroneous sequence will be issued from the caller routines: + * scan_quote(), scan_id() or scan_number(). + */ + +/* Non-ASCII characters are always checked by mb_read(). */ +#define NA 0x4000 /* Non-ASCII characters */ + +/* Horizontal spaces (' ', '\t' and TOK_SEP) */ +#define HSPA (SPA | HSP) + +#define EJ1 0x100 /* 1st byte of EUC_JP */ +#define EJ2 0x200 /* 2nd byte of EUC_JP */ +#define GB1 0x400 /* 1st byte of GB2312 */ +#define GB2 0x800 /* 2nd byte of GB2312 */ +#define KS1 0x1000 /* 1st byte of KSC5601 */ +#define KS2 0x2000 /* 2nd byte of KSC5601 */ + +#define EJ12 (EJ1 | EJ2) /* 1st byte or 2nd byte of EUC_JP */ +#define GB12 (GB1 | GB2) +#define KS12 (KS1 | KS2) +#define EJ1N (NA | EJ1) +#define EU12N (NA | EJ12 | GB12 | KS12) + /* 1st or 2nd byte of EUC_JP, GB2312 or KSC5601, or any other non-ASCII */ + +static short type_euc[ UCHARMAX + 1] = { +/* + * For EUC_JP, GB2312, KSC5601 or other similar multi-byte char encodings. + */ + +/* Character type codes */ +/* 0, 1, 2, 3, 4, 5, 6, 7, */ +/* 8, 9, A, B, C, D, E, F, Hex */ + + 000, 000, 000, 000, 000, 000, 000, 000, /* 00 */ + 000, HSPA, SPA, SPA, SPA, SPA, 000, 000, /* 08 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 10 */ + /* 0x17-0x1A and 0x1F will be cleared in some modes by chk_opts() */ + 000, LET, LET, 000, 000, 000, 000, HSPA, /* 18 */ + HSPA, PUNC, QUO, PUNC, 000, PUNC, PUNC, QUO, /* 20 !"#$%&' */ + PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, DOT, PUNC, /* 28 ()*+,-./ */ + DIG, DIG, DIG, DIG, DIG, DIG, DIG, DIG, /* 30 01234567 */ + DIG, DIG, PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, /* 38 89:;<=>? */ + + 000, LET, LET, LET, LET, LET, LET, LET, /* 40 @ABCDEFG */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 48 HIJKLMNO */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 50 PQRSTUVW */ + LET, LET, LET, PUNC, 000, PUNC, PUNC, LET, /* 58 XYZ[\]^_ */ + 000, LET, LET, LET, LET, LET, LET, LET, /* 60 `abcdefg */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 68 hijklmno */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 70 pqrstuvw */ + LET, LET, LET, PUNC, PUNC, PUNC, PUNC, 000, /* 78 xyz{|}~ */ + + NA, NA, NA, NA, NA, NA, NA, NA, /* 80 .. 87 */ + NA, NA, NA, NA, NA, NA, EJ1N, NA, /* 88 .. 8F */ + NA, NA, NA, NA, NA, NA, NA, NA, /* 90 .. 97 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* 98 .. 9F */ + NA, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* A0 .. A7 */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* A8 .. AF */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* B0 .. B7 */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* B8 .. BF */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* C0 .. C7 */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* C8 .. CF */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* D0 .. D7 */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* D8 .. DF */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* E0 .. E7 */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* E8 .. EF */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, /* F0 .. F7 */ + EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, EU12N, NA, /* F8 .. FF */ +}; + +static short type_bsl[ UCHARMAX + 1] = { +/* + * For SJIS, BIGFIVE or other similar encodings which may have '\\' value as + * the second byte of multi-byte character. + */ + +#define SJ1 0x100 /* 1st byte of SJIS */ +#define SJ2 0x200 /* 2nd byte of SJIS */ +#define BF1 0x400 /* 1st byte of BIGFIVE */ +#define BF2 0x800 /* 2nd byte of BIGFIVE */ + +#define SB2 (SJ2 | BF2) +#define SJ2N (NA | SJ2) +#define SB2N (NA | SJ2 | BF2) +#define SJ12N (NA | SJ1 | SJ2) +#define BF12N (NA | BF1 | BF2) +#define SB12N (NA | SJ1 | SJ2 | BF1 | BF2) +#define S2B12N (NA | SJ2 | BF1 | BF2) + +#define LSB2 (LET | SB2) +#define PSB2 (PUNC| SB2) + +/* Character type codes */ +/* 0, 1, 2, 3, 4, 5, 6, 7, */ +/* 8, 9, A, B, C, D, E, F, Hex */ + + 000, 000, 000, 000, 000, 000, 000, 000, /* 00 */ + 000, HSPA, SPA, SPA, SPA, SPA, 000, 000, /* 08 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 10 */ + /* 0x17-0x1A and 0x1F will be cleared in some modes by chk_opts() */ + 000, LET, LET, 000, 000, 000, 000, HSPA, /* 18 */ + HSPA, PUNC, QUO, PUNC, 000, PUNC, PUNC, QUO, /* 20 !"#$%&' */ + PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, DOT, PUNC, /* 28 ()*+,-./ */ + DIG, DIG, DIG, DIG, DIG, DIG, DIG, DIG, /* 30 01234567 */ + DIG, DIG, PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, /* 38 89:;<=>? */ + + SB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, /* 40 @ABCDEFG */ + LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, /* 48 HIJKLMNO */ + LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, /* 50 PQRSTUVW */ + LSB2, LSB2, LSB2, PSB2, SB2, PSB2, PSB2, LSB2, /* 58 XYZ[\]^_ */ + SB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, /* 60 `abcdefg */ + LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, /* 68 hijklmno */ + LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, LSB2, /* 70 pqrstuvw */ + LSB2, LSB2, LSB2, PSB2, PSB2, PSB2, PSB2, 000, /* 78 xyz{|}~ */ + + SB2N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, /* 80 .. 87 */ + SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, /* 88 .. 8F */ + SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, /* 90 .. 97 */ + SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, SJ12N, /* 98 .. 9F */ + SJ2N, S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N, /* A0 .. A7 */ + S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N, /* A8 .. AF */ + S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N, /* B0 .. B7 */ + S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N, /* B8 .. BF */ + S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N, /* C0 .. C7 */ + S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N, /* C8 .. CF */ + S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N, /* D0 .. D7 */ + S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N,S2B12N, /* D8 .. DF */ + SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, /* E0 .. E7 */ + SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, /* E8 .. EF */ + SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, SB12N, /* F0 .. F7 */ + SB12N, SB12N, SB12N, SB12N, SB12N, BF12N, BF12N, NA, /* F8 .. FF */ +}; + +/* + * For ISO2022_JP multi-byte character encoding. + */ + +#define IS1 0x100 /* 1st byte of shift-sequence */ +#define IS2 0x200 /* 2nd byte of shift-sequence */ +#define IS3 0x400 /* 3rd byte of shift-sequence */ +#define IS4 0x800 /* 4th byte of shift-sequence */ +#define IJP 0x1000 /* 1st or 2nd byte of ISO-2022-JP (ISO-2022-JP1) */ + +#define PIJP (PUNC | IJP) +#define QIJP (QUO | IJP) +#define DTJP (DOT | IJP) +#define DGJP (DIG | IJP) +#define LIJP (LET | IJP) + +#define JPS2 (IJP | IS2) +#define PJPS23 (PIJP | IS2 | IS3) +#define LJPS3 (LIJP | IS3) +#define LJPS4 (LIJP | IS4) + +static short type_iso2022_jp[ UCHARMAX + 1] = { + +/* Character type codes */ +/* 0, 1, 2, 3, 4, 5, 6, 7, */ +/* 8, 9, A, B, C, D, E, F, Hex */ + + 000, 000, 000, 000, 000, 000, 000, 000, /* 00 */ + 000, HSPA, SPA, SPA, SPA, SPA, 000, 000, /* 08 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 10 */ + /* 0x17-0x1A and 0x1F will be cleared in some modes by chk_opts() */ + 000, LET, LET, IS1, 000, 000, 000, HSPA, /* 18 */ + HSPA, PIJP, QIJP, PIJP, JPS2, PIJP, PIJP, QIJP, /* 20 !"#$%&' */ + PJPS23,PIJP, PIJP, PIJP, PIJP, PIJP, DTJP, PIJP, /* 28 ()*+,-./ */ + DGJP, DGJP, DGJP, DGJP, DGJP, DGJP, DGJP, DGJP, /* 30 01234567 */ + DGJP, DGJP, PIJP, PIJP, PIJP, PIJP, PIJP, PIJP, /* 38 89:;<=>? */ + + IJP, LIJP, LJPS3, LIJP, LJPS4, LIJP, LIJP, LIJP, /* 40 @ABCDEFG */ + LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, /* 48 HIJKLMNO */ + LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, /* 50 PQRSTUVW */ + LIJP, LIJP, LIJP, PIJP, IJP, PIJP, PIJP, LIJP, /* 58 XYZ[\]^_ */ + IJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, /* 60 `abcdefg */ + LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, /* 68 hijklmno */ + LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, LIJP, /* 70 pqrstuvw */ + LIJP, LIJP, LIJP, PIJP, PIJP, PIJP, PIJP, 000, /* 78 xyz{|}~ */ + + NA, NA, NA, NA, NA, NA, NA, NA, /* 80 .. 87 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* 88 .. 8F */ + NA, NA, NA, NA, NA, NA, NA, NA, /* 90 .. 97 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* 98 .. 9F */ + NA, NA, NA, NA, NA, NA, NA, NA, /* A0 .. A7 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* A8 .. AF */ + NA, NA, NA, NA, NA, NA, NA, NA, /* B0 .. B7 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* B8 .. BF */ + NA, NA, NA, NA, NA, NA, NA, NA, /* C0 .. C7 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* C8 .. CF */ + NA, NA, NA, NA, NA, NA, NA, NA, /* D0 .. D7 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* D8 .. DF */ + NA, NA, NA, NA, NA, NA, NA, NA, /* E0 .. E7 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* E8 .. EF */ + NA, NA, NA, NA, NA, NA, NA, NA, /* F0 .. F7 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* F8 .. FF */ +}; + +/* + * For UTF8 multi-byte character encoding. + */ + +#define U2_1 0x100 /* 1st byte of 2-byte encoding of UTF8 */ +#define U3_1 0x200 /* 1st byte of 3-byte encoding of UTF8 */ +#define U4_1 0x400 /* 1st byte of 4-byte encoding of UTF8 */ +#define UCONT 0x800 /* Continuation of a 2, 3, or 4 byte UTF8 sequence */ +#define U2_1N (NA | U2_1) +#define U3_1N (NA | U3_1) +#define U4_1N (NA | U4_1) +#define UCONTN (NA | UCONT) + +static short type_utf8[ UCHARMAX + 1] = { + +/* Character type codes */ +/* 0, 1, 2, 3, 4, 5, 6, 7, */ +/* 8, 9, A, B, C, D, E, F, Hex */ + + 000, 000, 000, 000, 000, 000, 000, 000, /* 00 */ + 000, HSPA, SPA, SPA, SPA, SPA, 000, 000, /* 08 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 10 */ + /* 0x17-0x1A and 0x1F will be cleared in some modes by chk_opts() */ + 000, LET, LET, 000, 000, 000, 000, HSPA, /* 18 */ + HSPA, PUNC, QUO, PUNC, 000, PUNC, PUNC, QUO, /* 20 !"#$%&' */ + PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, DOT, PUNC, /* 28 ()*+,-./ */ + DIG, DIG, DIG, DIG, DIG, DIG, DIG, DIG, /* 30 01234567 */ + DIG, DIG, PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, /* 38 89:;<=>? */ + + 000, LET, LET, LET, LET, LET, LET, LET, /* 40 @ABCDEFG */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 48 HIJKLMNO */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 50 PQRSTUVW */ + LET, LET, LET, PUNC, 000, PUNC, PUNC, LET, /* 58 XYZ[\]^_ */ + 000, LET, LET, LET, LET, LET, LET, LET, /* 60 `abcdefg */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 68 hijklmno */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 70 pqrstuvw */ + LET, LET, LET, PUNC, PUNC, PUNC, PUNC, 000, /* 78 xyz{|}~ */ + + UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN, /* 80 .. 87 */ + UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN, /* 88 .. 8F */ + UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN, /* 90 .. 97 */ + UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN, /* 98 .. 9F */ + UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN, /* A0 .. A7 */ + UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN, /* A8 .. AF */ + UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN, /* B0 .. B7 */ + UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN,UCONTN, /* B8 .. BF */ + NA, NA, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, /* C0 .. C7 */ + U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, /* C8 .. CF */ + U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, /* D0 .. D7 */ + U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, U2_1N, /* D8 .. DF */ + U3_1N, U3_1N, U3_1N, U3_1N, U3_1N, U3_1N, U3_1N, U3_1N, /* E0 .. E7 */ + U3_1N, U3_1N, U3_1N, U3_1N, U3_1N, U3_1N, U3_1N, U3_1N, /* E8 .. EF */ + U4_1N, U4_1N, U4_1N, U4_1N, U4_1N, NA, NA, NA, /* F0 .. F7 */ + NA, NA, NA, NA, NA, NA, NA, NA, /* F8 .. FF */ +}; + +#define SETLOCALE 2 /* #pragma setlocale (not __setlocale) */ + +#define NUM_ENCODING 8 +#define NUM_ALIAS 6 + +/* Names of encoding recognized. Table for search_encoding(). */ +static const char * const encoding_name[ NUM_ENCODING][ NUM_ALIAS] = { + /* Visual C full, Visual C short + , 4 miscellaneous */ + { "english", "c" + , "c", "en", "latin", "iso8859"}, + { "", "" + , "eucjp", "euc", "ujis", ""}, + { "chinesesimplified", "chs" + , "gb2312", "cngb", "euccn", ""}, + { "korean", "kor" + , "ksc5601", "ksx1001", "wansung", "euckr"}, + { "japanese", "jpn" + , "sjis", "shiftjis", "mskanji", ""}, + { "chinesetraditional", "cht" + , "bigfive", "big5", "cnbig5", "euctw"}, + { "", "" + , "iso2022jp", "iso2022jp1", "jis", ""}, + { "", "" + , "utf8", "utf", "", ""}, +}; + +static int mbstart; +static int mb2; + +static size_t mb_read_2byte( int c1, char ** in_pp, char ** out_pp); + /* For 2-byte encodings of mbchar */ +static const char * search_encoding( char * norm, int alias); + /* Search encoding_name[][] table */ +static void strip_bar( char * string); + /* Remove '_', '-' or '.' in the string */ +static void conv_case( char * name, char * lim, int upper); + /* Convert to upper/lower case */ +static size_t mb_read_iso2022_jp( int c1, char ** in_pp, char ** out_pp); + /* For ISO2022_JP encoding */ +static size_t mb_read_utf8( int c1, char ** in_pp, char ** out_pp); + /* For UTF8 mbchar encoding */ + +#define NAMLEN 20 +#define UPPER 1 /* To upper */ +#define LOWER 0 /* To lower */ + + +const char * set_encoding( + char * name, /* Name of encoding specified */ + const char * env, /* Name of environment variable */ + int pragma + /* 2: #pragma setlocale, 1: #pragma __setlocale, 0: not #pragma */ +) +/* + * Search the encoding specified and re-initialize mbchar settings. + */ +{ + const char * unknown_encoding + = "Unknown encoding: %s%.0ld%.0s"; /* _W1_ */ + const char * too_long + = "Too long encoding name: %s%.0ld%.0s"; /* _E_ */ + const char * loc = ""; + int alias; + char norm[ NAMLEN]; + /* + * Normalized name (removed 'xxxxx.', stripped '_', '-', '.' + * and lowered. + */ + + if (strlen( name) >= NAMLEN) { + if ((env || pragma) && (g_internal_data->warn_level & 1)) { + cwarn( too_long, name, 0L, NULL); + } else { + mcpp_fprintf( DEST_ERR, too_long, name); + mcpp_fputc( '\n', DEST_ERR); + } + } + strcpy( norm, name); + if (norm[ 5] == '.') + memmove( norm, norm + 5, strlen( norm + 5) + 1); + /* Remove initial 'xxxxx.' as 'ja_JP.', 'en_US.' or any other */ + conv_case( norm, norm + strlen( norm), LOWER); + strip_bar( norm); + + if (strlen( name) == 0) { /* "" */ + g_internal_data->mbchar = MBCHAR; /* Restore to the default encoding */ + } else if (memcmp( norm, "iso8859", 7) == 0 /* iso8859* */ + || memcmp( norm, "latin", 5) == 0 /* latin* */ + || memcmp( norm, "en", 2) == 0) { /* en* */ + g_internal_data->mbchar = 0; /* No multi-byte character */ + } else { + alias = 2; +#if COMPILER == MSC + if (pragma == SETLOCALE) /* #pragma setlocale */ + alias = 0; +#endif + loc = search_encoding( norm, alias); /* Search the name */ + } + if (loc == NULL) { + if ((env || pragma) && (g_internal_data->warn_level & 1)) { + cwarn( unknown_encoding, name, 0L, NULL); + } else { /* -m option */ + mcpp_fprintf( DEST_ERR, unknown_encoding, name); + mcpp_fputc( '\n', DEST_ERR); + } + } else { + mb_init(); /* Re-initialize */ + } + return loc; +} + +static const char * search_encoding( + char * norm, /* The name of encoding specified */ + int alias /* The number of alias to start searching */ +) +{ + const char * loc; + int lo, al; + + for (lo = 0; lo < NUM_ENCODING; lo++) { + for (al = alias ; al < NUM_ALIAS; al++) { + loc = encoding_name[ lo][ al]; + if (str_eq( loc, norm)) { + switch (lo) { + case 0 : g_internal_data->mbchar = 0; break; + case 1 : g_internal_data->mbchar = EUC_JP; break; + case 2 : g_internal_data->mbchar = GB2312; break; + case 3 : g_internal_data->mbchar = KSC5601; break; + case 4 : g_internal_data->mbchar = SJIS; break; + case 5 : g_internal_data->mbchar = BIGFIVE; break; + case 6 : g_internal_data->mbchar = ISO2022_JP; break; + case 7 : g_internal_data->mbchar = UTF8; break; + } + return loc; + } + } + } + return NULL; +} + +static void strip_bar( + char * string +) +/* + * Strip '_', '-' or '.' in the string. + */ +{ + char * cp = string; + + while (*cp != EOS) { + if (*cp == '_' || *cp == '-' || *cp == '.') + memmove( cp, cp + 1, strlen( cp)); + else + cp++; + } +} + +static void conv_case( + char * name, /* (diretory) Name */ + char * lim, /* End of (directory) name */ + int upper /* TRUE if to upper */ +) +/* Convert a string to upper-case letters or lower-case letters in-place */ +{ + int c; + char * sp; + + for (sp = name; sp < lim; sp++) { + c = *sp & UCHARMAX; +#if MBCHAR + if ((g_internal_data->char_type[ c] & mbstart)) { + char tmp[ PATHMAX+1]; + char * tp = tmp; + *tp++ = *sp++; + g_internal_data->mb_read( c, &sp, &tp); + } else +#endif + { + if (upper) + *sp = (char)toupper( c); + else + *sp = (char)tolower( c); + } + } +} + +void mb_init( void) +/* + * Initialize multi-byte character settings. + * First called prior to setting the 'mcpp_mode'. + * Will be called again each time the multibyte character encoding is changed. + */ +{ + /* + * Select the character classification table, select the multi-byte + * character reading routine and decide whether multi-byte character + * may contain the byte of value 0x5c. + */ + switch (g_internal_data->mbchar) { + case 0 : + case EUC_JP : + case GB2312 : + case KSC5601 : + g_internal_data->char_type = type_euc; + g_internal_data->bsl_in_mbchar = FALSE; + g_internal_data->mb_read = mb_read_2byte; + break; + case SJIS : + case BIGFIVE : + g_internal_data->char_type = type_bsl; + g_internal_data->bsl_in_mbchar = TRUE; + g_internal_data->mb_read = mb_read_2byte; + break; + case ISO2022_JP : + g_internal_data->char_type = type_iso2022_jp; + g_internal_data->bsl_in_mbchar = TRUE; + g_internal_data->mb_read = mb_read_iso2022_jp; + break; + case UTF8 : + g_internal_data->char_type = type_utf8; + g_internal_data->bsl_in_mbchar = FALSE; + g_internal_data->mb_read = mb_read_utf8; + break; + } + + /* Set the bit patterns for character classification. */ + switch (g_internal_data->mbchar) { + case 0 : + mbstart = 0; + break; + case EUC_JP : + mbstart = EJ1; + mb2 = EJ2; + break; + case GB2312 : + mbstart = GB1; + mb2 = GB2; + break; + case KSC5601: + mbstart = KS1; + mb2 = KS2; + break; + case SJIS : + mbstart = SJ1; + mb2 = SJ2; + break; + case BIGFIVE: + mbstart = BF1; + mb2 = BF2; + break; + case ISO2022_JP : + mbstart = IS1; + break; + case UTF8 : + mbstart = (U2_1 | U3_1 | U4_1); + break; + } + switch (g_internal_data->mbchar) { + case 0 : + g_internal_data->mbchk = 0; + break; + case EUC_JP : + case GB2312 : + case KSC5601: + case SJIS : + case BIGFIVE: + case UTF8 : + g_internal_data->mbchk = NA; + break; + case ISO2022_JP : + g_internal_data->mbchk = (IS1 | NA); + break; + } + + /* + * Set special handling for some encodings to supplement some compiler's + * deficiency. + */ + switch (g_internal_data->mbchar) { + case SJIS : +#if ! SJIS_IS_ESCAPE_FREE + g_internal_data->bsl_need_escape = TRUE; +#endif + break; + case BIGFIVE: +#if ! BIGFIVE_IS_ESCAPE_FREE + g_internal_data->bsl_need_escape = TRUE; +#endif + break; + case ISO2022_JP : +#if ! ISO2022_JP_IS_ESCAPE_FREE + g_internal_data->bsl_need_escape = TRUE; +#endif + break; + default : + g_internal_data->bsl_need_escape = FALSE; + break; + } + + /* + * Modify magic characters in character type table. + * char_type[] table should be rewritten in accordance with the 'mcpp_mode' + * whenever the encoding is changed. + */ + if (g_internal_data->mcpp_mode) { /* If mcpp_mode is already set */ + g_internal_data->char_type[ DEF_MAGIC] = g_internal_data->standard ? LET : 0; + g_internal_data->char_type[ IN_SRC] = (g_internal_data->mcpp_mode == STD) ? LET : 0; + g_internal_data->char_type[ TOK_SEP] = (g_internal_data->mcpp_mode == STD || g_internal_data->mcpp_mode == OLD_PREP) + ? HSPA: 0; /* TOK_SEP equals to COM_SEP */ + } +} + +static size_t mb_read_2byte( + int c1, /* The 1st byte of mbchar sequence (already read) */ + char ** in_pp, /* Pointer to input */ + char ** out_pp /* Pointer to output */ +) +/* + * Multi-byte character reading routine for 2-byte encodings. + */ +{ + int error = FALSE; + size_t len = 0; /* Number of multi-byte characters read. */ + char * in_p = *in_pp; + char * out_p = *out_pp; + + if (! (g_internal_data->char_type[ c1 & UCHARMAX] & mbstart)) + return MB_ERROR; /* Not a multi-byte character */ + + do { + if (! (g_internal_data->char_type[ (*out_p++ = *in_p++) & UCHARMAX] & mb2)) { + error = TRUE; + break; + } + len++; + } while (g_internal_data->char_type[ (*out_p++ = *in_p++) & UCHARMAX] & mbstart); + *in_pp = --in_p; + *(--out_p) = EOS; + *out_pp = out_p; + return error ? (len | MB_ERROR) : len; +} + +static size_t mb_read_iso2022_jp( + int c1, /* The 1st byte of the sequence already read (always 0x1b). */ + char ** in_pp, + char ** out_pp +) +/* + * Multi-byte character reading routine for ISO2022_JP. + */ +{ + int error = FALSE; + size_t len = 0; + char * in_p = *in_pp; + char * out_p = *out_pp; + int c2, c3, c4; + + if (! (g_internal_data->char_type[ c1 & UCHARMAX] & mbstart)) + return MB_ERROR; + + do { + *out_p++ = (char)(c2 = *in_p++); + if (! (g_internal_data->char_type[ c2 & UCHARMAX] & IS2)) { + error = TRUE; + break; + } + *out_p++ = (char)(c3 = *in_p++); + if (! (g_internal_data->char_type[ c3 & UCHARMAX] & IS3)) { + error = TRUE; + break; + } + + switch (c2) { + case 0x24 : + switch (c3) { + case 0x42 : /* 0x1b 0x24 0x42: JIS X 0208-1983 */ + break; + case 0x28 : + *out_p++ = (char)(c4 = *in_p++); + if (! (g_internal_data->char_type[ c4 & UCHARMAX] & IS4)) + error = TRUE; + /* else: 0x1b 0x24 0x28 0x44: JIS X 0212 */ + break; + default : + error = TRUE; + } + break; + case 0x28 : + switch (c3) { + case 0x42 : /* 0x1b 0x28 0x42: ASCII */ + c1 = *out_p++ = *in_p++ & UCHARMAX; + continue; + default : + error = TRUE; + } + break; + } + if (error) + break; + + while (g_internal_data->char_type[ c1 = *out_p++ = (*in_p++ & UCHARMAX)] & IJP) { + if (! (g_internal_data->char_type[ *out_p++ = (*in_p++ & UCHARMAX)] & IJP)) { + error = TRUE; + break; + } + len++; /* String of multi-byte characters */ + } + if (error) + break; + + } while (g_internal_data->char_type[ c1] & IS1); /* 0x1b: start of shift-sequence */ + + *in_pp = --in_p; + *(--out_p) = EOS; + *out_pp = out_p; + return error ? (len | MB_ERROR) : len; +} + +static size_t mb_read_utf8( + int c1, + char ** in_pp, + char ** out_pp +) +/* + * Multi-byte character reading routine for UTF8. + */ +{ + int error = FALSE; + size_t len = 0; + char * in_p = *in_pp; + char * out_p = *out_pp; + + if (! (g_internal_data->char_type[ c1 & UCHARMAX] & mbstart)) + return MB_ERROR; + + do { + unsigned int codepoint; + int i; + int bytes = 0; + + if ((g_internal_data->char_type[ c1 & UCHARMAX] & U4_1) == U4_1) + bytes = 4; /* 4-byte character */ + else if ((g_internal_data->char_type[ c1 & UCHARMAX] & U3_1) == U3_1) + bytes = 3; /* 3-byte character */ + else if ((g_internal_data->char_type[ c1 & UCHARMAX] & U2_1) == U2_1) + bytes = 2; /* 2-byte character */ + + /* Must ensure that the sequence is not reserved as a surrogate */ + codepoint = ((2 << (6-bytes)) - 1) & c1; /* mask off top bits */ + + /* All bytes left in the sequence must be in 0x80 - 0xBF */ + for (i = bytes - 1; i && !error; i--) { + codepoint = (codepoint << 6) + ((*in_p) & 0x3fU); + if (! (g_internal_data->char_type[ (*out_p++ = *in_p++) & UCHARMAX] & UCONT)) + error = TRUE; + } + + /* Check for overlong/underlong sequences */ + if ((bytes == 2 && (codepoint < 0x80 || codepoint > 0x7FF)) + || (bytes == 3 && (codepoint < 0x800 || codepoint > 0xFFFF)) + || (bytes == 4 && (codepoint < 0x10000 || codepoint > 0x10FFFF))) + error = TRUE; + if ((codepoint >= 0xD800 && codepoint <= 0xDFFF) + /* Check for reserved surrogate codepoints */ + || (codepoint >= 0xFFFE && codepoint <= 0xFFFF)) + /* Illegal */ + error = TRUE; +#if 0 + printf( "codepoint:0x%x\n", codepoint); +#endif + if (error) + break; + len++; + } while (g_internal_data->char_type[ (*out_p++ = (char)(c1 = *in_p++)) & UCHARMAX] & mbstart); + /* Start of the next multi-byte character */ + *in_pp = --in_p; + *(--out_p) = EOS; + *out_pp = out_p; + return error ? (len | MB_ERROR) : len; +} + +uexpr_t mb_eval( + char ** seq_pp +) +/* + * Evaluate the value of a multi-byte character. + * This routine does not check the legality of the sequence. + * This routine is called from eval_char(). + * This routine is never called in POST_STD mode. + */ +{ + char * seq = *seq_pp; + uexpr_t val = 0; + int c, c1; + + if (! (g_internal_data->char_type[ c = *seq++ & UCHARMAX] & mbstart)) { + *seq_pp = seq; + return c; /* Not a multi-byte character */ + } + + switch (g_internal_data->mbchar) { + case EUC_JP : + case GB2312 : + case KSC5601: + case SJIS : + case BIGFIVE: + val = (c << 8) + (*seq++ & UCHARMAX); + /* Evaluate the 2-byte sequence */ + break; + case ISO2022_JP : + if (g_internal_data->char_type[ c & UCHARMAX] & IS1) { /* Skip shift-sequence */ + if (g_internal_data->char_type[ c = *seq++ & UCHARMAX] & IS2) { + if (g_internal_data->char_type[ c1 = *seq++ & UCHARMAX] & IS3) { + if (c1 == 0x28) + seq++; + if (c == 0x28 && c1 == 0x42) { /* Shift-out sequence */ + val = 0; + break; + } + c = *seq++ & UCHARMAX; + } + } + } + val = (c << 8) + (*seq++ & UCHARMAX); /* Evaluate the 2-bytes */ + break; + case UTF8 : /* Evaluate the sequence of 2, 3 or 4 bytes as it is */ + val = (c << 8) + (*seq++ & UCHARMAX); + if (g_internal_data->char_type[ c & UCHARMAX] & U3_1) { + val = (val << 8) + (*seq++ & UCHARMAX); + } else if (g_internal_data->char_type[ c & UCHARMAX] & U4_1) { + val = (val << 8) + (*seq++ & UCHARMAX); + val = (val << 8) + (*seq++ & UCHARMAX); + } + break; + } + + *seq_pp = seq; + return val; +} + +int last_is_mbchar( + const char * in, /* Input physical line */ + int len /* Length of the line minus 2 */ +) +/* + * Return 2, if the last char of the line is second byte of SJIS or BIGFIVE, + * else return 0. + */ +{ + const char * cp = in + len; + const char * const endp = in + len; /* -> the char befor '\n' */ + + if ((g_internal_data->mbchar & (SJIS | BIGFIVE)) == 0) + return 0; + while (in <= --cp) { /* Search backwardly */ + if ((g_internal_data->char_type[ *cp & UCHARMAX] & mbstart) == 0) + break; /* Not the first byte of MBCHAR */ + } + if ((endp - cp) & 1) + return 0; + else + return 2; +} + +#if defined(PK_COMPILER_MSVC) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic pop +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic pop +#endif diff --git a/Samples/PK-MCPP/mcpp_lib.h b/Samples/PK-MCPP/mcpp_lib.h new file mode 100644 index 00000000..05abec54 --- /dev/null +++ b/Samples/PK-MCPP/mcpp_lib.h @@ -0,0 +1,30 @@ +/* mcpp_lib.h: declarations of libmcpp exported (visible) functions */ +#ifndef _MCPP_LIB_H +#define _MCPP_LIB_H + +#ifndef _MCPP_OUT_H +#include "mcpp_out.h" /* declaration of OUTDEST */ +#endif + +#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) || defined(__CYGWIN64__) || defined(__MINGW32__) || defined(__MINGW64__) +#if DLL_EXPORT || (__CYGWIN__ && PIC) +#define DLL_DECL __declspec( dllexport) +#elif DLL_IMPORT +#define DLL_DECL __declspec( dllimport) +#else +#define DLL_DECL +#endif +#else +#define DLL_DECL +#endif + +extern DLL_DECL int mcpp_lib_main( int argc, char ** argv); +extern DLL_DECL void mcpp_reset_def_out_func( void); +extern DLL_DECL void mcpp_set_out_func( + int (* func_fputc) ( int c, OUTDEST od), + int (* func_fputs) ( const char * s, OUTDEST od), + int (* func_fprintf)( OUTDEST od, const char * format, ...) + ); +extern DLL_DECL void mcpp_use_mem_buffers( int tf); +extern DLL_DECL char * mcpp_get_mem_buffer( OUTDEST od); +#endif /* _MCPP_LIB_H */ diff --git a/Samples/PK-MCPP/mcpp_out.h b/Samples/PK-MCPP/mcpp_out.h new file mode 100644 index 00000000..297277d7 --- /dev/null +++ b/Samples/PK-MCPP/mcpp_out.h @@ -0,0 +1,13 @@ +/* mcpp_out.h: declarations of OUTDEST data types for MCPP */ +#ifndef _MCPP_OUT_H +#define _MCPP_OUT_H + +/* Choices for output destination */ +typedef enum { + DEST_OUT, /* ~= fp_out */ + DEST_ERR, /* ~= fp_err */ + DEST_DBG, /* ~= fp_debug */ + NUM_OUTDEST +} OUTDEST; + +#endif /* _MCPP_OUT_H */ diff --git a/Samples/PK-MCPP/noconfig.h b/Samples/PK-MCPP/noconfig.h new file mode 100644 index 00000000..58ff45ae --- /dev/null +++ b/Samples/PK-MCPP/noconfig.h @@ -0,0 +1,616 @@ +/* + * noconfig.h + * Configurations for MCPP not using config.h. + * + * WARNING: These are default settings. To configure for your system, you + * must edit this file here and there. + */ + +#define TRUE 1 +#define FALSE 0 + +/* Version message. */ +/* "MCPP V.2.* (200y/mm) compiled by " precedes VERSION_MSG */ +#define VERSION_MSG "GCC 3.4" +#if 0 + "LCC-Win32 2006-03" + "Visual C 2005" + "Visual C 2008" + "BCC V.5.5" +#endif + +/* + * P A R T 1 Configurations for target-operating-system + * and target-compiler. + */ + +/* + * Names of the SYSTEM (i.e. target operating system). This is needed so that + * cpp can use appropriate filename conventions. + */ +#define SYS_UNKNOWN 0 +#define SYS_UNIX 0x1000 +#define SYS_LINUX 0x1800 /* (SYS_LINUX & 0xF000) == SYS_UNIX */ +#define SYS_FREEBSD 0x1A00 /* (SYS_FREEBSD & 0xF000) == SYS_UNIX */ +#define SYS_CYGWIN 0x1C00 /* (SYS_CYGWIN & 0xF000) == SYS_UNIX */ +#define SYS_MAC 0x1E00 /* (SYS_MAC & 0xF000) == SYS_UNIX */ +#define SYS_WIN 0x7000 +#define SYS_WIN32 0x7400 /* (SYS_WIN32 & 0xF000) == SYS_WIN */ +#define SYS_WIN64 0x7800 /* (SYS_WIN64 & 0xF000) == SYS_WIN */ +#define SYS_MINGW 0x7C00 /* (SYS_MINGW & 0xF000) == SYS_WIN */ + +/* COMPILER */ +#define COMPILER_UNKNOWN 0 +#define MSC 0x7400 /* Microsoft C, Visual C++ */ +#define BORLANDC 0x7440 /* Borland C */ +#define LCC 0x74C0 /* LCC-Win32 */ +#define GNUC 0x00E0 /* GNU C (GCC) */ +#define INDEPENDENT 0xFFFF /* No target, compiler-independent build*/ + + +#if (PK_OS == PK_OS_WINDOWS) +# define SYSTEM SYS_WIN +#elif (PK_OS == PK_OS_MACOSX) +# define SYSTEM SYS_MAC +#elif (PK_OS == PK_OS_LINUX) +# define SYSTEM SYS_LINUX +#else +# error "Unknown OS for MCPP" +#endif + +#if defined(PK_COMPILER_MSVC) +# define HOST_COMPILER MSC +#elif defined(PK_COMPILER_GCC) +# define HOST_COMPILER GNUC +#else +# error "Unknown compiler for MCPP" +#endif + +/* Define target compiler. */ +#ifndef COMPILER +# define COMPILER INDEPENDENT +#endif + +/* Define host operating-system. */ +#define HOST_SYSTEM SYSTEM + +#define SYS_FAMILY (SYSTEM & 0xF000) +#define COMPILER_FAMILY (COMPILER & 0xF0) +#define HOST_SYS_FAMILY (HOST_SYSTEM & 0xF000) + +/* Default MBCHAR (multi-byte character) encoding. */ +#define EUC_JP 0x10 /* Extended UNIX code of JIS X 0208 */ +#define GB2312 0x20 /* EUC-like encoding of Chinese GB 2312-80 */ +#define KSC5601 0x30 /* EUC-like encoding of Korean KS C 5601 */ +#define SJIS 0x80 /* Shift-JIS encoding of JIS X 0208 */ +#define BIGFIVE 0x90 /* Encoding of Taiwanese Big Five */ +#define ISO2022_JP 0x100 /* ISO-2022-JP (ISO-2022-JP1) encoding */ +#define UTF8 0x1000 /* UTF-8 encoding */ + +/* + * MBCHAR means multi-byte character encoding. + * MBCHAR means the default encoding, and you can change the encoding by + * #pragma MCPP setlocale, -e option or environment variable + * LC_ALL, LC_CTYPE, LANG. + * MBCHAR == 0 means not to recognize any multi-byte character encoding. + */ + +/* + * In order to predefine target-system-dependent macros, + * several macros are defined here: + * *_OLD define the macro beginning with an alphabetic letter, + * *_STD, *_STD?, *_EXT, *_EXT2 define the macro beginning with an '_'. + * *_STD1 define the macro beginning with '__' and ending with an alphanumeric + * letter. + * *_STD2 define the macro beginning with '__' and ending with '__'. + * These may not be defined, if they are not needed. + * They should not be #defined to no token or to "". + * + * SYSTEM_OLD, SYSTEM_STD1, SYSTEM_STD2, SYSTEM_EXT, SYSTEM_EXT2 + * define the target operating system (by name). + * SYSTEM_SP_OLD, SYSTEM_SP_STD define the target-OS specific macro name + * COMPILER_OLD, COMPILER_STD1, COMPILER_STD2, COMPILER_EXT, COMPILER_EXT2 + * , COMPILER_SP_OLD, COMPILER_SP_STD + * define the target compiler (by name). + * COMPILER_CPLUS defines the target C++ compiler. + * COMPILER_SP1, COMPILER_SP2, COMPILER_SP3 + * define the compiler-specific macros. + * + * _VAL specify the value of the . + * If not specified, these values default to "1". + * To define the value of no-token, specify as "" rather than no-token. + * SYSTEM_OLD, SYSTEM_STD?, COMPILER_OLD have the value of "1". + */ + +/* + * target-compiler-dependent definitions: + * + * LINE_PREFIX defines the output line prefix, if not "#line 123". + * This should be defined as "# " to represent "# 123" format + * ("#line " represents "#line 123" format). + * + * C_INCLUDE_DIR1, C_INCLUDE_DIR2 may be defined if you have a compiler- + * specific include directory which is to be searched *before* + * the operating-system specific directories (e.g. /usr/include). + * CPLUS_INCLUDE_DIR1, CPLUS_INCLUDE_DIR2, CPLUS_INCLUDE_DIR3 + * , CPLUS_INCLUDE_DIR4 are for C++ include directory which exist + * other than C include directory. + * ENV_C_INCLUDE_DIR may be defined to the name of environment-variable for + * C include directory. + * ENV_CPLUS_INCLUDE_DIR is name of environment-variable for C++ include + * directory which exists other than ENV_C_INCLUDE_DIR. + * ENV_SEP is the separator (other than space) of include-paths in an + * environment-variable. e.g. the ':' in + * "/usr/abc/include:/usr/xyz/include" + * + * EMFILE should be defined to the macro to represent errno of 'too many + * open files' if the macro is different from EMFILE. + * + * ONE_PASS should be set TRUE, if COMPILER is "one pass compiler". + * + * FNAME_FOLD means that target-system folds upper and lower cases of + * directory and file-name. + * + * SEARCH_INIT specifies the default value of 'search_rule' (in system.c). + * 'search_rule' holds searching rule of #include "header.h" to + * search first before searching user specified or system- + * specific include directories. + * CURRENT means to search the directory relative to "current + * directory" which is current at cpp invocation. + * SOURCE means to search the directory relative to that of the + * source file (i.e. "includer"). + * (CURRENT & SOURCE) means to search current directory first + * source directory next. + * 'search_rule' is initialized to SEARCH_INIT. + */ +#define CURRENT 1 +#define SOURCE 2 + +#if SYS_FAMILY == SYS_UNIX +#define SYSTEM_OLD "unix" +#define SYSTEM_STD1 "__unix" +#define SYSTEM_STD2 "__unix__" + +#if SYSTEM == SYS_FREEBSD +#define SYSTEM_EXT "__FreeBSD__" +#define SYSTEM_EXT_VAL "6" /* V.5.*: 5, V.6.*:6 */ +#endif + +#if SYSTEM == SYS_LINUX +#define SYSTEM_EXT "__linux__" +#endif + +#if SYSTEM == SYS_MAC /* Mac OS X */ +#define SYSTEM_EXT "__APPLE__" +#define FNAME_FOLD TRUE /* Case-insensitive file-system */ +#define FRAMEWORK1 "/System/Library/Frameworks" +#define FRAMEWORK2 "/Library/Frameworks" +#endif /* SYSTEM == SYS_MAC */ + +#if SYSTEM == SYS_CYGWIN +#define SYSTEM_EXT "__CYGWIN__" +#define SYSTEM_EXT2 "__CYGWIN32__" +#define MBCHAR SJIS +#define FNAME_FOLD TRUE +#define CYGWIN_ROOT_DIRECTORY "c:/pub/compilers/cygwin" +#endif /* SYSTEM == SYS_CYGWIN */ + +#ifndef MBCHAR +#define MBCHAR EUC_JP /* UTF8 if you like */ +#endif +#ifndef FNAME_FOLD +#define FNAME_FOLD FALSE +#endif + +#endif /* SYS_FAMILY == SYS_UNIX */ + +#if SYS_FAMILY == SYS_WIN + +#define SYSTEM_SP_STD "__FLAT__" +#define SYSTEM_SP_STD_VAL "1" + +#ifndef MBCHAR +#define MBCHAR SJIS /* Multi-byte char is encoded in SJIS */ +#endif + +#if COMPILER == MSC +#define CMP_NAME "Visual C++" +#if _MSC_VER >= 1200 /* Visual C++ V.6.0 or later */ + /* When HOST == TARGET */ +#define ONE_PASS TRUE +#endif +#define COMPILER_EXT "_MSC_VER" +#define COMPILER_EXT_VAL "1500" /* VC 6.0: "1200" */ + /* VC 2002: "1300", VC 2003: "1310", VC 2005: "1400", VC 2008: "1500" */ +#define COMPILER_EXT2 "_MSC_FULL_VER" +#define COMPILER_EXT2_VAL "150021022" /* VC 6.0: "12008804" */ + /* VC 2002: "13009466", VC 2003: "13103077", VC 2005: "140050320" */ + /* VC 2008: "150021022" */ +#define COMPILER_SP1 "_MSC_EXTENSIONS" +#define COMPILER_SP1_VAL "1" +#define COMPILER_SP2 "_INTEGRAL_MAX_BITS" +#define COMPILER_SP2_VAL "64" /* VC 2003, VC2005, VC2008: 64 */ +#define TARGET_HAVE_LONG_LONG TRUE + /* __int64 instead of long long (VC 2.0 through 8.0) */ +#define EXPAND_PRAGMA TRUE +#define HAVE_DIGRAPHS TRUE +#define BIGFIVE_IS_ESCAPE_FREE TRUE +#define SEARCH_INIT SOURCE + +#elif COMPILER == BORLANDC /* Borland C 5.* and C++Builder */ +#define CMP_NAME "Borland C" +#define ONE_PASS TRUE +#define COMPILER_STD2 "__TURBOC__" +#if __BORLANDC__ /* Borland C */ +#define COMPILER_STD2_VAL "0x0550" + /* BC 5.5: "0x0550", BC 5.9: "0x5930" */ +#define COMPILER_EXT "__BORLANDC__" +#define COMPILER_EXT_VAL "0x0550" + /* BC 5.5: "0x0550", BC 5.9: "0x5930" */ +#define COMPILER_CPLUS "__BCPLUSPLUS__" +#define COMPILER_CPLUS_VAL "0x0550" + /* BC 5.5: "0x0550", BC 5.9: "0x5930" */ +#define EXPAND_PRAGMA TRUE +#define SEARCH_INIT (CURRENT & SOURCE) +#define TARGET_HAVE_LONG_LONG TRUE /* __int64 instead of long long */ +#endif /* __BORLANDC__ */ + +#elif COMPILER == LCC +#define CMP_NAME "LCC-Win32" +#define COMPILER_STD2 "__LCC__" +#define COMPILER_SP1 "__LCCDEBUGLEVEL" +#define COMPILER_SP1_VAL "0" +#define COMPILER_SP2 "__LCCOPTIMLEVEL" +#define COMPILER_SP2_VAL "0" +#define ONE_PASS TRUE +#define TARGET_HAVE_LONG_LONG TRUE +#define SJIS_IS_ESCAPE_FREE FALSE + +#endif + +#if SYSTEM == SYS_MINGW +#define SYSTEM_EXT "__MINGW__" +#define SYSTEM_EXT2 "__MINGW32__" +#define MSYS_ROOT_DIRECTORY "c:/pub/compilers/msys/1.0" +#define MINGW_DIRECTORY "c:/pub/compilers/mingw" +#if COMPILER == GNUC +#define SJIS_IS_ESCAPE_FREE FALSE +#define INC_DIR C_INCLUDE_DIR2 +#endif +#endif /* SYSTEM == SYS_MINGW */ + +#ifndef SJIS_IS_ESCAPE_FREE +#define SJIS_IS_ESCAPE_FREE TRUE /* or FALSE following your compiler */ +#endif + +#endif /* SYS_FAMILY == SYS_WIN */ + +#if COMPILER_FAMILY == GNUC +#define CMP_NAME "GCC" +#define COMPILER_EXT "__GNUC__" +#define COMPILER_EXT_VAL "3" /* "3" for V.3.* "4" for V.4.* */ +#define COMPILER_EXT2 "__GNUC_MINOR__" +#define COMPILER_EXT2_VAL "4" /* "4" for V.3.4, "1" for V.4.1 */ +#define COMPILER_CPLUS "__GNUG__" +#define COMPILER_CPLUS_VAL "3" /* "3" for V.3.*, "4" for V.4.* */ +#define GCC_MAJOR_VERSION 3 /* Value of __GNUC__ as a digit */ +#define LINE_PREFIX "# " +#ifndef HAVE_DIGRAPHS +#define HAVE_DIGRAPHS TRUE +#endif +#ifndef TARGET_HAVE_LONG_LONG +#define TARGET_HAVE_LONG_LONG TRUE +#endif +#define STDC_VERSION 0L /* 199409L for V.2.9, 0L for V.3.*,V.4.* */ +#define CPLUS_INCLUDE_DIR1 "/usr/include/c++/3.4" /* "/usr/include/c++/3.3.6" */ /* "/usr/include/c++/4.1.2" */ +#define CPLUS_INCLUDE_DIR2 "/usr/include/c++/3.4/backward" /* "/usr/include/c++/3.3.6/i386-vine-linux" */ /* "/usr/include/c++/4.1.2/i486-linux-gnu" */ +/* #define CPLUS_INCLUDE_DIR3 */ /* "/usr/include/c++/3.3.6/backward" */ /* "/usr/include/c++/4.1.2/backward" */ +/* #define C_INCLUDE_DIR1 */ /* "/usr/lib/gcc-lib/i386-vine-linux/3.3.6/include" */ /* "/usr/lib/gcc/i486-linux-gnu/4.1.2/include" */ +/* #define C_INCLUDE_DIR2 */ +#ifndef INC_DIR +#ifdef C_INCLUDE_DIR1 +#define INC_DIR C_INCLUDE_DIR1 /* GNUC version specific dir */ +#else +#define INC_DIR "/usr/local/include" /* "/usr/include" */ +#endif +#endif +#ifndef ENV_C_INCLUDE_DIR +#define ENV_C_INCLUDE_DIR "C_INCLUDE_PATH" +#define ENV_CPLUS_INCLUDE_DIR "CPLUS_INCLUDE_PATH" +#endif +#define SEARCH_INIT SOURCE /* Include directory relative to source */ +/* + * __SIZE_TYPE__, __PTRDIFF_TYPE__ and __WCHAR_TYPE__ are predefines of GCC. + */ +#if GCC_MAJOR_VERSION < 3 +#define COMPILER_SP1 "__SIZE_TYPE__" +#define COMPILER_SP2 "__PTRDIFF_TYPE__" +#define COMPILER_SP3 "__WCHAR_TYPE__" +#define COMPILER_SP1_VAL "unsigned int" +#define COMPILER_SP2_VAL "int" +#define COMPILER_SP3_VAL "int" + /* SYS_FREEBSD: "int", SYS_CYGWIN, SYS_MINGW: "short unsigned int" + , others: "long int" */ +#endif /* GCC_MAJOR_VERSION < 3 */ +/* On GCC V.3.*, V.4.*, these macros are known by mcpp_g*_predef_*.h files. */ +#endif /* COMPILER_FAMILY == GNUC */ + +#if COMPILER == INDEPENDENT +/* specifications of compiler-independent build */ +#define LINE_PREFIX "#line " +#define STD_LINE_PREFIX TRUE /* Output #line by C source format */ +#define HAVE_DIGRAPHS TRUE /* Output digraphs as it is */ +#define SEARCH_INIT SOURCE /* Include directory relative to source */ +#define SJIS_IS_ESCAPE_FREE TRUE /* Do not treat SJIS specially */ +#define BIGFIVE_IS_ESCAPE_FREE TRUE /* Do not treat specially */ +#define ISO2022_JP_IS_ESCAPE_FREE TRUE /* Do not treat specially */ +#define TARGET_HAVE_LONG_LONG TRUE /* dummy */ +#define STDC_VERSION 199409L /* Initial value of __STDC_VERSION__ */ +#endif + +/* + * Each OS has some different target architectures. The followings define + * the target CPU. + * MCPP defines some predefined macros based on the CPU macro, and possibly + * redefine them on an execution time by some options. + */ +#if defined (__x86_64__) || defined (__amd64__) || defined (_M_AMD64) \ + || defined (_AMD64_) || defined (_X64_) +#define CPU "x86_64" +#elif defined (__ppc64__) || defined (__powerpc64__) +#define CPU "ppc64" +#elif defined (__ppc__) || defined (__powerpc__) +#define CPU "ppc" +#else /* Defaults to i386 */ +#define CPU "i386" +#endif + +/* + * defaults + */ + +#ifdef SYSTEM_EXT +#ifndef SYSTEM_EXT_VAL +#define SYSTEM_EXT_VAL "1" +#endif +#endif +#ifdef SYSTEM_EXT2 +#ifndef SYSTEM_EXT2_VAL +#define SYSTEM_EXT2_VAL "1" +#endif +#endif +#ifdef COMPILER_STD1 +#ifndef COMPILER_STD1_VAL +#define COMPILER_STD1_VAL "1" +#endif +#endif +#ifdef COMPILER_STD2 +#ifndef COMPILER_STD2_VAL +#define COMPILER_STD2_VAL "1" +#endif +#endif +#ifdef COMPILER_EXT +#ifndef COMPILER_EXT_VAL +#define COMPILER_EXT_VAL "1" +#endif +#endif +#ifdef COMPILER_EXT2 +#ifndef COMPILER_EXT2_VAL +#define COMPILER_EXT2_VAL "1" +#endif +#endif +#ifdef COMPILER_CPLUS +#ifndef COMPILER_CPLUS_VAL +#define COMPILER_CPLUS_VAL "1" +#endif +#endif + +#ifndef LINE_PREFIX +#define LINE_PREFIX "#line " +#define STD_LINE_PREFIX TRUE /* C source format */ +#else +#ifndef STD_LINE_PREFIX +#define STD_LINE_PREFIX FALSE /* Compiler-dependent format */ +#endif +#endif + +#ifndef HAVE_DIGRAPHS +#define HAVE_DIGRAPHS FALSE +#endif + +#ifndef ENV_C_INCLUDE_DIR +#define ENV_C_INCLUDE_DIR "INCLUDE" +#endif +#ifndef ENV_CPLUS_INCLUDE_DIR +#define ENV_CPLUS_INCLUDE_DIR "CPLUS_INCLUDE" +#endif + +#ifndef ENV_SEP +#if SYS_FAMILY == SYS_WIN +#define ENV_SEP ';' +#else +#define ENV_SEP ':' +#endif +#endif + +#ifndef ONE_PASS +#define ONE_PASS FALSE +#endif + +#ifndef FNAME_FOLD +#define FNAME_FOLD TRUE +#endif + +#ifndef SEARCH_INIT +#define SEARCH_INIT CURRENT +#endif + +/* + * CHARBIT, UCHARMAX are respectively CHAR_BIT, UCHAR_MAX of target compiler. + * CHARBIT should be defined to the number of bits per character. + * It is needed only for processing of multi-byte character constants. + * UCHARMAX should be defined to the maximum value of type unsigned char + * or maximum value of unsigned int which is converted from type (signed) + * char. + * + * LONGMAX should be defined to the LONG_MAX in . + * ULONGMAX should be defined to the ULONG_MAX in or LONG_MAX + * for the compiler which does not have unsigned long. + */ + +#ifndef CHARBIT +#define CHARBIT 8 +#endif +#ifndef UCHARMAX +#define UCHARMAX 0xFF +#endif +#ifndef LONGMAX +#define LONGMAX 0x7FFFFFFFL +#endif +#ifndef ULONGMAX +#define ULONGMAX 0xFFFFFFFFUL +#endif + +/* + * Define MBCHAR (multi-byte character encoding) to SJIS, EUC_JP or other. + */ +#ifndef MBCHAR +#define MBCHAR 0 +#endif + +/* + * SJIS_IS_ESCAPE_FREE means the compiler does not escape '0x5c' ('\\') in + * shift-JIS encoded multi-byte character. SJIS_IS_ESCAPE_FREE == FALSE + * enables cpp to insert * '\\' before '\\' of the 2nd byte of SJIS code in + * literal. This insertion is for the compiler-proper which can't recognize + * SJIS literal. + * BIGFIVE_IS_ESCAPE_FREE means similar case on BIGFIVE encoding. + * ISO2022_JP_IS_ESCAPE_FREE means similar case on ISO2022_JP encoding. + */ +#ifndef SJIS_IS_ESCAPE_FREE +#define SJIS_IS_ESCAPE_FREE FALSE /* or TRUE following your compiler */ +#endif +#ifndef BIGFIVE_IS_ESCAPE_FREE +#define BIGFIVE_IS_ESCAPE_FREE FALSE /* or TRUE following your compiler */ +#endif +#ifndef ISO2022_JP_IS_ESCAPE_FREE +#define ISO2022_JP_IS_ESCAPE_FREE FALSE /* or TRUE following compiler */ +#endif + +/* + * P A R T 2 Configurations for host-compiler. + * + * WARNING: In case of HOST_COMPILER differs from COMPILER, you must + * edit here and there of this part. + */ +#if HOST_COMPILER == GNUC +#if __GNUC__ >= 3 +#define HAVE_INTMAX_T TRUE +#define HAVE_INTTYPES_H TRUE +#define HAVE_STDINT_H TRUE +#endif +#define HOST_HAVE_LONG_LONG TRUE +#if HOST_SYSTEM == SYS_LINUX +#define HOST_HAVE_STPCPY TRUE +#endif +#if HOST_SYSTEM == SYS_MAC +#define HOST_HAVE_STPCPY TRUE +#endif + +#elif HOST_COMPILER == LCC +#define HOST_HAVE_LONG_LONG TRUE + +#elif HOST_COMPILER == MSC +#define HOST_HAVE_LONG_LONG TRUE + +#elif HOST_COMPILER == BORLANDC +#if __BORLANDC__ >= 0x550 +#define HOST_HAVE_LONG_LONG TRUE +#endif +#define HOST_HAVE_STPCPY TRUE +#if __STDC__ +#define stpcpy( dest, src) __stpcpy__( dest, src) +#endif +#endif + +#ifndef HAVE_INTMAX_T +#define HAVE_INTMAX_T FALSE +#endif + +/* The host compiler has the type long long int ? */ +#ifndef HOST_HAVE_LONG_LONG +#define HOST_HAVE_LONG_LONG FALSE +#endif + +/* + * This definitions should be set TRUE, if *both* of the target + * and the host compilers have long long type. + */ +#if TARGET_HAVE_LONG_LONG && HOST_HAVE_LONG_LONG +#define HAVE_LONG_LONG TRUE +#endif + +/* + * Define the format specifier of intmax_t or long long for + * fprintf( fp_debug,). + * Both of target COMPILER and HOST_COMPILER should have long long. + */ +#if HAVE_LONG_LONG +#if HOST_COMPILER == BORLANDC \ + || (HOST_COMPILER == MSC && _MSC_VER < 1400) \ + || HOST_SYSTEM == SYS_MINGW +#define LL_FORM "I64" /* Format specifier for __int64 */ +#endif +#ifndef LL_FORM +#define LL_FORM "ll" /* C99: for long long, "j" for intmax_t */ +#endif +#endif + +#ifndef HOST_HAVE_STPCPY +#define HOST_HAVE_STPCPY FALSE +#endif + +/* + * Declaration of standard library functions and macros. + */ + +/* stdin, stdout, stderr, SIOHandle, NULL, fgets(), fputs() and other functions. */ +#include "stdio.h" + +/* PATHMAX is the maximum length of path-list on the host system. */ +/* _POSIX_* only to get PATH_MAX */ +#define _POSIX_ 1 +#define _POSIX_SOURCE 1 +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 1 +#define _POSIX_C_SOURCE_defined 1 +#endif +#include "limits.h" +#undef _POSIX_ +#undef _POSIX_SOURCE +#ifdef _POSIX_C_SOURCE_defined +#undef _POSIX_C_SOURCE +#undef _POSIX_C_SOURCE_defined +#endif +#ifdef PATH_MAX +#define PATHMAX PATH_MAX /* Posix macro */ +#else +#define PATHMAX FILENAME_MAX +#endif + +/* islower(), isupper(), toupper(), isdigit(), isxdigit(), iscntrl() */ +#include "ctype.h" + +/* errno */ +#include "errno.h" + +#include "string.h" +#include "stdlib.h" +#include "time.h" +#include "setjmp.h" + +/* For debugging malloc systems by kmatsui */ +#if defined(KMMALLOC) && _MEM_DEBUG +#include "xalloc.h" +#endif + diff --git a/Samples/PK-MCPP/pk_mcpp_bridge.cpp b/Samples/PK-MCPP/pk_mcpp_bridge.cpp new file mode 100644 index 00000000..044f7d20 --- /dev/null +++ b/Samples/PK-MCPP/pk_mcpp_bridge.cpp @@ -0,0 +1,369 @@ + +#include "precompiled.h" +#include "pk_mcpp_bridge.h" +#include +#include + +#if defined(PK_DESKTOP) +# if defined(PK_WINDOWS) +# include +#define PK_GET_CWD _getcwd +#define PK_STAT _stat +#define PK_VSPRINTF _vsnprintf +# else +# include +# include +#define PK_GET_CWD getcwd +#define PK_STAT stat +#define PK_VSPRINTF vsnprintf +# endif +#endif + +SMCPPGlobalData *g_global_data = null; +SMCPPInternalData *g_internal_data = null; +SMCPPSystemData *g_system_data = null; + +SMCPPSystemData::SMCPPSystemData() +{ + sharp_filename = NULL; + incend = incdir = NULL; + fnamelist = once_list = NULL; + search_rule = SEARCH_INIT; + mb_changed = nflag = ansi = compat_mode = FALSE; + mkdep_fp = NULL; + mkdep_target = mkdep_mf = mkdep_md = mkdep_mq = mkdep_mt = NULL; + std_val = -1L; + def_cnt = undef_cnt = 0; + mcpp_optind = mcpp_opterr = 1; +#if COMPILER == GNUC + sys_dirp = NULL; + sysroot = NULL; + gcc_work_dir = i_split = FALSE; + quote_dir_end = quote_dir; + dDflag = dMflag = FALSE; +#endif +#if COMPILER == MSC + wchar_t_modified = FALSE; +#endif +#if COMPILER == GNUC || COMPILER == MSC + preinc_end = preinclude; +#endif +#if SYSTEM == SYS_CYGWIN + no_cygwin = FALSE; +#elif SYSTEM == SYS_MAC + num_framework = sys_framework = 0; + to_search_framework = NULL; +#endif +#if NO_DIR + no_dir = FALSE; +#endif +} + +SMCPPSystemData::~SMCPPSystemData() +{ + if (sharp_filename) + free(sharp_filename); +} + +SMCPPInternalBase::std_limits_::std_limits_() +{ + Mem::Clear(*this); + str_len = NBUFF; + id_len = IDMAX; + n_mac_pars = NMACPARS; +} + +SMCPPInternalBase::option_flags_::option_flags_() +{ + Mem::Clear(*this); + c = FALSE; + k = FALSE; + z = FALSE; + p = FALSE; + q = FALSE; + v = FALSE; + trig = TRIGRAPHS_INIT; + dig = DIGRAPHS_INIT; + lang_asm = FALSE; + no_source_line = FALSE; + dollar_in_name = FALSE; +} + +SMCPPInternalBase::SMCPPInternalBase() +{ + Mem::Clear(*this); + empty_str = ""; + mcpp_mode = STD; + cplus_val = stdc_ver = 0L; + stdc_val = 0; + standard = TRUE; + std_line_prefix = STD_LINE_PREFIX; + errors = src_col = 0; + warn_level = -1; + infile = NULL; + in_directive = in_define = in_getarg = in_include = in_if = FALSE; + src_line = macro_line = in_asm = 0L; + macro_name = NULL; + mcpp_debug = mkdep = no_output = keep_comments = keep_spaces = 0; + include_nest = 0; + insert_sep = NO_SEP; + mbchar = MBCHAR; + ifptr = ifstack; + ifstack[0].stat = WAS_COMPILING; + ifstack[0].ifline = ifstack[0].elseline = 0L; + std_limits.str_len = NBUFF; + std_limits.id_len = IDMAX; + std_limits.n_mac_pars = NMACPARS; + option_flags.c = option_flags.k = option_flags.z = option_flags.p + = option_flags.q = option_flags.v = option_flags.lang_asm + = option_flags.no_source_line = option_flags.dollar_in_name + = FALSE; + option_flags.trig = TRIGRAPHS_INIT; + option_flags.dig = DIGRAPHS_INIT; + sh_file = NULL; + sh_line = 0; +} + +SMCPPInternalData::SMCPPInternalData() +: work_end(&work_buf[NWORK]) +{ + Mem::Clear(work_buf); +} + +SMCPPGlobalData::SMCPPGlobalData() +: m_std_in("") +, m_std_out("") +, m_std_err("") +{ +} + + +SIOHandle *pk_fopen(const char *filename, const char *accessMode) +{ + if (strcmp(filename, INPUT_FILE_PATH) == 0) + { + g_global_data->m_input_file.m_CurChar = 0; + return &g_global_data->m_input_file; + } + else if (strcmp(filename, OUTPUT_FILE_PATH) == 0) + { + g_global_data->m_output_file.m_CurChar = 0; + return &g_global_data->m_output_file; + } + else + { + FILE *handler = NULL; + if (!CFilePath::IsAbsolute(filename)) + { + CString absoluteFilePath = CString(g_global_data->m_cwd) / filename; + handler = fopen(absoluteFilePath.Data(), accessMode); + if (handler != NULL && + !g_global_data->m_dependencies.Contains(absoluteFilePath) && + strcmp(accessMode, "r") == 0) + { + g_global_data->m_dependencies.PushBack(absoluteFilePath); + } + } + else + { + handler = fopen(filename, accessMode); + if (handler != NULL && + !g_global_data->m_dependencies.Contains(filename) && + strcmp(accessMode, "r") == 0) + { + g_global_data->m_dependencies.PushBack(filename); + } + } + + if (handler == NULL) + return NULL; + SIOHandle *pkHandle = PK_NEW(SIOHandle(filename, handler)); + return pkHandle; + } +} + +int pk_stat(const char *path, PK_STAT_TYPE *buf) +{ + if (!CFilePath::IsAbsolute(path)) + { + CString absoluteFilePath = CString(g_global_data->m_cwd) / path; + return PK_STAT(absoluteFilePath.Data(), buf); + } + return PK_STAT(path, buf); +} + +int pk_fclose(SIOHandle *stream) +{ + if (stream->m_Handler != null) + { + fclose(stream->m_Handler); + PK_DELETE(stream); + } + return 0; +} + +int pk_fseek(SIOHandle *stream, long offset, int whence) +{ + PK_ASSERT(whence == SEEK_SET); + + if (stream->m_Handler != null) + return fseek(stream->m_Handler, offset, whence); + else + stream->m_CurChar = offset; + return 0; +} + +long int pk_ftell(SIOHandle *stream) +{ + if (stream->m_Handler != null) + return ftell(stream->m_Handler); + else + return stream->m_CurChar; +} + +int pk_fputc(int character, SIOHandle *stream) +{ + if (stream->m_Handler != null) + return fputc(character, stream->m_Handler); + else + { + if (stream->m_CurChar == stream->m_Content.Length()) + { + char str[] = { (char)character, 0 }; + stream->m_Content.Append(str); + stream->m_CurChar += 1; + } + else + { + stream->m_Content.RawDataForWriting()[stream->m_CurChar] = (char)character; + stream->m_CurChar += 1; + } + } + return 0; +} + +int pk_fputs(const char *string, SIOHandle *stream) +{ + if (stream->m_Handler != null) + return fputs(string, stream->m_Handler); + else + { + if (stream->m_CurChar == stream->m_Content.Length()) + { + stream->m_Content.Append(string); + stream->m_CurChar += (u32)strlen(string); + } + else + { + const u32 len = (u32)strlen(string); + for (u32 i = 0; i < len; ++i) + { + if (stream->m_CurChar == stream->m_Content.Length()) + { + stream->m_Content.Append(string + i); + stream->m_CurChar += (u32)strlen(string + i); + break; + } + stream->m_Content.RawDataForWriting()[stream->m_CurChar] = string[i]; + stream->m_CurChar += 1; + } + } + } + return 0; +} + +char *pk_fgets(char *string, int maxLength, SIOHandle *stream) +{ + if (stream->m_Handler != null) + return fgets(string, maxLength, stream->m_Handler); + else + { + if (stream->m_CurChar == stream->m_Content.Length() || maxLength == 0) + return null; + + const ureg cpyLen = PKMin(stream->m_Content.Length() - stream->m_CurChar, (u32)maxLength - 1); + u32 charIdx = 0; + + while (charIdx < cpyLen) + { + const char curChar = stream->m_Content[stream->m_CurChar + charIdx]; + string[charIdx] = curChar; + ++charIdx; + if (curChar == '\n') + break; + } + stream->m_CurChar += charIdx; + string[charIdx] = 0; + return string; + } +} + +int pk_fflush(SIOHandle * stream) +{ + if (stream->m_Handler != null) + return fflush(stream->m_Handler); + return 0; +} + +int pk_ferror(SIOHandle * stream) +{ + if (stream->m_Handler != null) + return ferror(stream->m_Handler); + return 0; +} + +char *pk_getcwd(char *buf, size_t size) +{ + if (g_global_data->m_cwd.Empty()) + return PK_GET_CWD(buf, (int)size); + const ureg buffLen = PKMin((ureg)size - 1, g_global_data->m_cwd.Length()); + Mem::Copy(buf, g_global_data->m_cwd.Data(), buffLen); + buf[buffLen] = 0; + return buf; +} + +int pk_getc(SIOHandle *stream) +{ + if (stream->m_Handler != null) + return getc(stream->m_Handler); + else + { + if (stream->m_Content.Length() == stream->m_CurChar) + return EOF; + int c = (int)stream->m_Content[stream->m_CurChar]; + stream->m_CurChar += 1; + return c; + } +} + +int pk_ungetc(int c, SIOHandle *stream) +{ + if (stream->m_Handler != null) + return ungetc(c, stream->m_Handler); + else + { + if (stream->m_CurChar == 0) + { + char toPrepend[] = { (char)c, 0 }; + stream->m_Content.Prepend(toPrepend); + return c; + } + stream->m_CurChar -= 1; + stream->m_Content.RawDataForWriting()[stream->m_CurChar] = (char)c; + return c; + } +} + +int pk_vfprintf(SIOHandle *stream, const char * format, va_list arg) +{ + if (stream->m_Handler != null) + return vfprintf(stream->m_Handler, format, arg); + else + { + char buffer[3200]; + PK_VSPRINTF(buffer, sizeof(buffer) - 1, format, arg); + buffer[sizeof(buffer) - 1] = 0; + pk_fputs(buffer, stream); + } + return 0; +} diff --git a/Samples/PK-MCPP/pk_mcpp_bridge.h b/Samples/PK-MCPP/pk_mcpp_bridge.h new file mode 100644 index 00000000..d9b406eb --- /dev/null +++ b/Samples/PK-MCPP/pk_mcpp_bridge.h @@ -0,0 +1,292 @@ +#pragma once + +#include + +struct SIOHandle; + +#include "system.h" +#include "internal.h" + +using namespace PopcornFX; + +#define INPUT_FILE_PATH "##InputPath##" +#define OUTPUT_FILE_PATH "##OutputPath##" + +struct SIOHandle +{ + CString m_Path; + + // Either a real file handler or just a string: + FILE *m_Handler; + + CString m_Content; + u32 m_CurChar; + + SIOHandle(const CString &path = CString::EmptyString, FILE *handler = null) + : m_Path(path) + , m_Handler(handler) + , m_CurChar(0) + { + } + + SIOHandle(const CString &path, const CString &content) + : m_Path(path) + , m_Handler(NULL) + , m_Content(content) + , m_CurChar(0) + { + } +}; + +struct SMCPPInternalBase +{ + /* The minimum translation limits specified by the Standards. */ + struct std_limits_ { + long str_len; /* Least maximum of string len. */ + size_t id_len; /* Least maximum of ident len. */ + int n_mac_pars; /* Least maximum of num of pars.*/ + int exp_nest; /* Least maximum of expr nest */ + int blk_nest; /* Least maximum of block nest */ + int inc_nest; /* Least maximum of include nest*/ + long n_macro; /* Least maximum of num of macro*/ + long line_num; /* Maximum source line number */ + + std_limits_(); + } std_limits; + /* The boolean flags specified by the execution options. */ + struct option_flags_ { + int c; /* -C option (keep comments) */ + int k; /* -k option (keep white spaces)*/ + int z; /* -z option (no-output of included file) */ + int p; /* -P option (no #line output) */ + int q; /* -Q option (diag to mcpp.err) */ + int v; /* -v option (verbose) */ + int trig; /* -3 option (toggle trigraphs) */ + int dig; /* -2 option (toggle digraphs) */ + int lang_asm; /* -a option (assembler source) */ + int no_source_line; /* Do not output line in diag. */ + int dollar_in_name; /* Allow $ in identifiers */ + + option_flags_(); + } option_flags; + + int mcpp_mode; /* Mode of preprocessing */ + int stdc_val; /* Value of __STDC__ */ + long stdc_ver; /* Value of __STDC_VERSION__ */ + long cplus_val; /* Value of __cplusplus for C++ */ + int stdc2; /* cplus_val or (stdc_ver >= 199901L) */ + int stdc3; /* (stdc_ver or cplus_val) >= 199901L */ + int standard; /* mcpp_mode is STD or POST_STD */ + int std_line_prefix; /* #line in C source style */ + int warn_level; /* Level of warning */ + int errors; /* Error counter */ + long src_line; /* Current source line number */ + int wrong_line; /* Force #line to compiler */ + int newlines; /* Count of blank lines */ + int keep_comments; /* Don't remove comments */ + int keep_spaces; /* Don't remove white spaces */ + int include_nest; /* Nesting level of #include */ + const char * empty_str; /* "" string for convenience */ + const char ** inc_dirp; /* Directory of #includer */ + const char * cur_fname; /* Current source file name */ + int no_output; /* Don't output included file */ + int in_directive; /* In process of #directive */ + int in_define; /* In #define line */ + int in_getarg; /* Collecting arguments of macro*/ + int in_include; /* In #include line */ + int in_if; /* In #if and non-skipped expr. */ + long macro_line; /* Line number of macro call */ + char * macro_name; /* Currently expanding macro */ + int openum; /* Number of operator or punct. */ + IFINFO * ifptr; /* -> current ifstack item */ + FILEINFO * infile; /* Current input file or macro */ + SIOHandle * fp_in; /* Input stream to preprocess */ + SIOHandle * fp_out; /* Output stream preprocessed */ + SIOHandle * fp_err; /* Diagnostics stream */ + SIOHandle * fp_debug; /* Debugging information stream */ + int insert_sep; /* Inserted token separator flag*/ + int mkdep; /* Output source file dependency*/ + int mbchar; /* Encoding of multi-byte char */ + int mbchk; /* Possible multi-byte char */ + int bsl_in_mbchar; /* 2nd byte of mbchar has '\\' */ + int bsl_need_escape; /* '\\' in mbchar should be escaped */ + int mcpp_debug; /* Class of debug information */ + long in_asm; /* In #asm - #endasm block */ + jmp_buf error_exit; /* Exit on fatal error */ + const char * cur_fullname; /* Full name of current source */ + short * char_type; /* Character classifier */ + char * workp; /* Free space in work[] */ + char identifier[IDMAX + IDMAX/8]; /* Lastly scanned name */ + IFINFO ifstack[BLK_NEST + 1]; /* Information of #if nesting */ + FILEINFO * sh_file; + int sh_line; + int src_col; /* Column number of source line */ + + /* Function pointer to expand_macro() functions. */ + char * (*expand_macro)( DEFBUF * defp, char * out, char * out_end, LINE_COL line_col, int * pragma_op); + /* Function pointer to mb_read_*() functions. */ + size_t (*mb_read)( int c1, char ** in_pp, char ** out_pp); + + SMCPPInternalBase(); +}; + +struct SMCPPInternalData : public SMCPPInternalBase +{ + char work_buf[NWORK + IDMAX]; + char *work_end; /* End of work[] buffer */ + + SMCPPInternalData(); +}; + +struct SMCPPSystemData +{ + /* for mcpp_getopt() */ + int mcpp_optind = 1; + int mcpp_opterr = 1; + int mcpp_optopt; + char * mcpp_optarg; + + int mb_changed = FALSE; /* Flag of -e option */ + char cur_work_dir[ PATHMAX + 1]; /* Current working directory*/ + + /* + * incdir[] stores the -I directories (and the system-specific #include <...> + * directories). This is set by set_a_dir(). A trailing PATH_DELIM is + * appended if absent. + */ + const char ** incdir; /* Include directories */ + const char ** incend; /* -> active end of incdir */ + int max_inc; /* Number of incdir[] */ + + /* + * fnamelist[] stores the souce file names opened by #include directive for + * debugging information. + */ + INC_LIST * fnamelist; /* Source file names */ + INC_LIST * fname_end; /* -> active end of fnamelist */ + int max_fnamelist; /* Number of fnamelist[] */ + + /* once_list[] stores the #pragma once file names. */ + INC_LIST * once_list; /* Once opened file */ + INC_LIST * once_end; /* -> active end of once_list */ + int max_once; /* Number of once_list[] */ + + /* + * 'search_rule' holds searching rule of #include "header.h" to search first + * before searching user specified or system-specific include directories. + * 'search_rule' is initialized to SEARCH_INIT. It can be changed by -I1, -I2 + * or -I3 option. -I1 specifies CURRENT, -I2 SOURCE and -I3 both. + */ + + int search_rule = SEARCH_INIT; /* Rule to search include file */ + int nflag = FALSE; /* Flag of -N (-undef) option */ + long std_val = -1L; /* Value of __STDC_VERSION__ or __cplusplus */ + + char * def_list[ MAX_DEF]; /* Macros to be defined */ + char * undef_list[ MAX_UNDEF]; /* Macros to be undefined */ + int def_cnt; /* Count of def_list */ + int undef_cnt; /* Count of undef_list */ + + + SIOHandle * mkdep_fp; /* For -Mx option */ + char * mkdep_target; + /* For -MT TARGET option and for GCC's queer environment variables. */ + char * mkdep_mf; /* Argument of -MF option */ + char * mkdep_md; /* Argument of -MD option */ + char * mkdep_mq; /* Argument of -MQ option */ + char * mkdep_mt; /* Argument of -MT option */ + /* sharp_filename is filename for #line line, used only in cur_file() */ + char * sharp_filename = NULL; + char * argv0; /* argv[ 0] for usage() and version() */ + int ansi; /* __STRICT_ANSI__ flag for GNUC */ + int compat_mode; + /* "Compatible" mode of recursive macro expansion */ + char arch[ MAX_ARCH_LEN]; /* -arch or -m64, -m32 options */ +#if COMPILER == GNUC + /* quote_dir[]: Include directories for "header" specified by -iquote */ + /* quote_dir_end: Active end of quote_dir */ + const char * quote_dir[ N_QUOTE_DIR]; + const char ** quote_dir_end = quote_dir; + /* sys_dirp indicates the first directory to search for system headers. */ + const char ** sys_dirp = NULL; /* System header directory */ + const char * sysroot = NULL; /* Logical root directory of header */ + int i_split = FALSE; /* For -I- option */ + int gcc_work_dir = FALSE; /* For -fworking-directory */ + int gcc_maj_ver; /* __GNUC__ */ + int gcc_min_ver; /* __GNUC_MINOR__ */ + int dDflag = FALSE; /* Flag of -dD option */ + int dMflag = FALSE; /* Flag of -dM option */ +#endif +#if COMPILER == GNUC || COMPILER == MSC + char * preinclude[ NPREINCLUDE]; /* File to pre-include */ + char ** preinc_end = preinclude; /* -> active end of preinclude */ +#endif +#if COMPILER == MSC + int wchar_t_modified = FALSE; /* -Zc:wchar_t flag */ +#endif +#if COMPILER == LCC + const char * optim_name = "__LCCOPTIMLEVEL"; +#endif +#if SYSTEM == SYS_CYGWIN + int no_cygwin = FALSE; /* -mno-cygwin */ +#elif SYSTEM == SYS_MAC +#define MAX_FRAMEWORK 8 + char * framework[ MAX_FRAMEWORK]; /* Framework directories*/ + int num_framework; /* Current number of framework[] */ + int sys_framework; /* System framework dir */ + const char ** to_search_framework; + /* Search framework[] next to the directory */ + int in_import; /* #import rather than #include */ +#endif +#if NO_DIR +/* Unofficial feature to strip directory part of include file */ + int no_dir; +#endif + + SMCPPSystemData(); + ~SMCPPSystemData(); +}; + +struct SMCPPGlobalData +{ + SIOHandle m_input_file; + SIOHandle m_output_file; + + SIOHandle m_std_in; + SIOHandle m_std_out; + SIOHandle m_std_err; + + CString m_cwd; + + TArray m_dependencies; + + SMCPPGlobalData(); +}; + +extern SMCPPGlobalData *g_global_data; +extern SMCPPInternalData *g_internal_data; +extern SMCPPSystemData *g_system_data; + +#include + +#if HOST_COMPILER == MSC +# define PK_STAT_TYPE struct _stat +#else +# define PK_STAT_TYPE struct stat +#endif + +SIOHandle *pk_fopen(const char *filename, const char *accessMode); +int pk_stat(const char *path, PK_STAT_TYPE *buf); + +int pk_fclose(SIOHandle *stream); +int pk_fseek(SIOHandle *stream, long offset, int whence); +long int pk_ftell(SIOHandle *stream); +int pk_fputc(int character, SIOHandle *stream); +int pk_fputs(const char *string, SIOHandle *stream); +char *pk_fgets(char *string, int maxLength, SIOHandle *stream); +int pk_fflush(SIOHandle * stream); +int pk_ferror(SIOHandle * stream); +char *pk_getcwd(char *buf, size_t size); +int pk_getc(SIOHandle *stream); +int pk_ungetc(int c, SIOHandle *stream); +int pk_vfprintf(SIOHandle *stream, const char * format, va_list arg); diff --git a/Samples/PK-MCPP/pk_preprocessor.cpp b/Samples/PK-MCPP/pk_preprocessor.cpp new file mode 100644 index 00000000..53a4efef --- /dev/null +++ b/Samples/PK-MCPP/pk_preprocessor.cpp @@ -0,0 +1,257 @@ + +#include "precompiled.h" +#include "pk_preprocessor.h" +#include "pk_mcpp_bridge.h" + +#include "mcpp_lib.h" + +#include + +__PK_API_BEGIN +//---------------------------------------------------------------------------- + +Threads::CCriticalSection CPreprocessor::m_Lock; + +//---------------------------------------------------------------------------- + +bool CPreprocessor::PreprocessString(TArray &defines, + const CString &input, + const CString &execDirectory, + SPreprocessOutput &output) +{ + u32 argOffset = 4; + TArray argv; + // mcpp_main uses char* as input, need to copy the const static char* + CString inputFilePath = INPUT_FILE_PATH; + CString outputFilePath = OUTPUT_FILE_PATH; + CString defineOption = "-D"; + CString noLineOutputOption = "-P"; + // MCPP never reads argv[0], we set it to "mcpp" + CString mcppOption = "mcpp"; + + if (!PK_VERIFY(argv.Resize(defines.Count() * 2 + argOffset))) + return false; + + argv[0] = mcppOption.RawDataForWriting(); + argv[1] = inputFilePath.RawDataForWriting(); + argv[2] = outputFilePath.RawDataForWriting(); + argv[3] = noLineOutputOption.RawDataForWriting(); + for (u32 i = 0; i < defines.Count(); ++i) + { + argv[2 * i + argOffset] = defineOption.RawDataForWriting(); + argv[2 * i + argOffset + 1] = defines[i].RawDataForWriting(); + } + + SMCPPGlobalData globalData; + SMCPPInternalData internalData; + SMCPPSystemData systemData; + + globalData.m_cwd = null; + if (!execDirectory.Empty()) + globalData.m_cwd = execDirectory.Data(); + + // We create input and output files here: + SIOHandle &inputFile = globalData.m_input_file; + inputFile.m_Path = INPUT_FILE_PATH; + inputFile.m_Handler = NULL; + inputFile.m_Content = input; + + SIOHandle &outputFile = globalData.m_output_file; + outputFile.m_Path = OUTPUT_FILE_PATH; + outputFile.m_Handler = NULL; + + int exitValue = 0; + + { + PK_SCOPEDLOCK(m_Lock); + + g_global_data = &globalData; + g_internal_data = &internalData; + g_system_data = &systemData; + + exitValue = mcpp_lib_main(argv.Count(), argv.RawDataPointer()); + + g_global_data = null; + g_internal_data = null; + g_system_data = null; + } + + output.m_Output = outputFile.m_Content; + output.m_Error = globalData.m_std_err.m_Content; + output.m_Info = globalData.m_std_out.m_Content; + output.m_Dependencies = globalData.m_dependencies; + return exitValue == EXIT_SUCCESS; +} + +//---------------------------------------------------------------------------- + +#define IS_OPEN_QUOTE(c) (c == '<' || c == '"') +#define IS_CLOSE_QUOTE(c) (c == '>' || c == '"') + +#define ADVANCE_UNTIL_CONDITION(_cond) while (src < srcEnd && _cond(*src)) { if (*src == '\\') src += 2 else src += 1; + +//---------------------------------------------------------------------------- + +static bool IsSpace(const char *curPtr, const char *endPtr) +{ + (void)endPtr; + return KR_BUFFER_IS_SPACE(*curPtr) != 0; +} + +//---------------------------------------------------------------------------- + +static bool IsNotNewLine(const char *curPtr, const char *endPtr) +{ + // Handle \r\n: + if (curPtr + 1 < endPtr) + { + const u16 eol = KR_BUFFER_2CHAR_UNALIGNED_LOAD(curPtr); + if (eol == SBufferParsingUtils::Newline1 || eol == SBufferParsingUtils::Newline2) + return false; + } + return !KR_BUFFER_IS_VSPACE(*curPtr); +} + +//---------------------------------------------------------------------------- + +template +static const char *SkipWhileCondition(const char *curPtr, const char *endPtr) +{ + // Skip characters while condition: + do + { + // Process all comments and backslashes + bool moreToProcess = true; + while (moreToProcess) + { + if (curPtr + 1 < endPtr && (*curPtr == '/' && *(curPtr + 1) == '*')) // Comment starting (/*) + { + curPtr += 2; + // Jump to end of comment (*/): + while (curPtr + 1 < endPtr) + { + if (*curPtr == '*' && *(curPtr + 1) == '/') + { + curPtr += 2; + break; + } + else + ++curPtr; + } + } + else if (curPtr + 1 < endPtr && (*curPtr == '/' && *(curPtr + 1) == '/')) // Comment starting (//) + { + while (curPtr < endPtr && *curPtr != '\n') + { + // Ignore \n with backslash + if (curPtr + 1 < endPtr && (*curPtr == '\\' && KR_BUFFER_IS_VSPACE(*(curPtr + 1)))) + curPtr += 2; + else if (curPtr + 2 < endPtr && (*curPtr == '\\' && !IsNotNewLine(curPtr + 1, endPtr))) + curPtr += 3; + else + ++curPtr; + } + } + else if (curPtr + 1 < endPtr && (*curPtr == '\\' && KR_BUFFER_IS_VSPACE(*(curPtr + 1)))) // Ignore \n with backslash + { + curPtr += 2; + } + else if (curPtr + 2 < endPtr && (*curPtr == '\\' && !IsNotNewLine(curPtr + 1, endPtr))) // Ignore \r\n with backslash + { + curPtr += 3; + } + else + { + moreToProcess = false; + } + } + } while (curPtr < endPtr && _Cond(curPtr, endPtr) && ++curPtr); + return curPtr; +} + +//---------------------------------------------------------------------------- +// Ultra lightweight function to gather shader dependencies: +// This just handles: +// '/* */' and '//' comments +// '\' to skip end of lines +// #include at beginning of lines + +bool CPreprocessor::FindShaderDependencies( const CString &input, + const CString &execDirectory, + TArray &outDep, + IFileSystem *controller) +{ + const u32 startDepIdx = outDep.Count(); + const CStringView includeStr = "include"; + const char *src = input.Data(); + const char *srcEnd = src + input.Length(); + + // For each line: + while (src < srcEnd) + { + // Skip spaces + src = SkipWhileCondition(src, srcEnd); + // If we find a sharp: preprocessor directive + if (src < srcEnd && *src == '#') + { + u32 i = 0; + // Skip sharp + ++src; + // Skip spaces + src = SkipWhileCondition(src, srcEnd); + // strcmp with "include" + while (src < srcEnd && i < includeStr.Length() && *src == includeStr[i]) + { + ++src; + ++i; + } + // If it is followed by the "include" directive + if (src < srcEnd && i == includeStr.Length()) + { + src = SkipWhileCondition(src, srcEnd); + if (src < srcEnd && IS_OPEN_QUOTE(*src)) + { + // Skip open quote + ++src; + const char *pathStart = src; + while (src < srcEnd && !IS_CLOSE_QUOTE(*src)) + ++src; + if (src < srcEnd && IS_CLOSE_QUOTE(*src)) + { + const CStringView includePath = CStringView(pathStart, (u32)(src - pathStart)); + const CString actualPath = CFilePath::IsAbsolute(includePath) ? includePath.ToString() : execDirectory / includePath; + if (!outDep.Contains(actualPath) && controller->Exists(actualPath)) + { + if (!outDep.PushBack(actualPath).Valid()) + return false; + } + // Skip close quote + ++src; + } + } + } + } + src = SkipWhileCondition(src, srcEnd); + ++src; // Skip the new line + } + + const u32 stopDepIdx = outDep.Count(); + + // Parse all included files to find their own dependencies: + for (u32 i = startDepIdx; i < stopDepIdx; ++i) + { + // Load the file: + const CString filePath = outDep[i]; + const CString fileContent = controller->BufferizeToString(filePath, CFilePath::IsAbsolute(filePath)); + if (!fileContent.Empty()) + { + // Search for other dependencies in this file: + if (!FindShaderDependencies(fileContent, CFilePath::StripFilename(filePath), outDep, controller)) + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- +__PK_API_END diff --git a/Samples/PK-MCPP/pk_preprocessor.h b/Samples/PK-MCPP/pk_preprocessor.h new file mode 100644 index 00000000..9541b3b8 --- /dev/null +++ b/Samples/PK-MCPP/pk_preprocessor.h @@ -0,0 +1,34 @@ +#pragma once + +#include + +__PK_API_BEGIN + +class CPreprocessor +{ +public: + struct SPreprocessOutput + { + CString m_Output; + CString m_Error; + CString m_Info; + TArray m_Dependencies; + }; + + static bool PreprocessString( TArray &mcppCommandLine, + const CString &input, + const CString &execDirectory, + SPreprocessOutput &output); + + static bool FindShaderDependencies( const CString &input, + const CString &execDirectory, + TArray &outDep, + IFileSystem *controller); + +private: + // Ugly global lock still use because mcpp still uses global vars: + static Threads::CCriticalSection m_Lock; +}; + + +__PK_API_END diff --git a/Samples/PK-MCPP/precompiled.cpp b/Samples/PK-MCPP/precompiled.cpp new file mode 100644 index 00000000..5f656a45 --- /dev/null +++ b/Samples/PK-MCPP/precompiled.cpp @@ -0,0 +1 @@ +#include "precompiled.h" diff --git a/Samples/PK-MCPP/precompiled.h b/Samples/PK-MCPP/precompiled.h new file mode 100644 index 00000000..4fc31187 --- /dev/null +++ b/Samples/PK-MCPP/precompiled.h @@ -0,0 +1,11 @@ +#undef PV_MODULE_NAME +#undef PV_MODULE_SYM +#define PV_MODULE_NAME "MCPP" +#define PV_MODULE_SYM MCPP + +#include "pkapi/include/pk_precompiled_default.h" +PK_LOG_MODULE_DEFINE(); + +using namespace PK_NAMESPACE; + +//---------------------------------------------------------------------------- diff --git a/Samples/PK-MCPP/support.cpp b/Samples/PK-MCPP/support.cpp new file mode 100644 index 00000000..96cb4b07 --- /dev/null +++ b/Samples/PK-MCPP/support.cpp @@ -0,0 +1,2831 @@ +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * S U P P O R T . C + * S u p p o r t R o u t i n e s + * + * The common routines used by several source files are placed here. + */ + +/* + * The following are global functions. + * + * get_unexpandable() Gets the next unexpandable token in the line, expanding + * macros. + * Called from #if, #line and #include processing routines. + * skip_nl() Skips over a line. + * skip_ws() Skips over white spaces but not skip over the end of the line. + * skip_ws() skips also COM_SEP and TOK_SEP. + * scan_token() Reads the next token of any type into the specified output + * pointer, advances the pointer, returns the type of token. + * scan_quote() Reads a string literal, character constant or header-name from + * the input stream, writes out to the specified buffer and + * returns the advanced output pointer. + * get_ch() Reads the next byte from the current input stream, handling + * end of (macro/file) input and embedded comments appropriately. + * cnv_trigraph() Maps trigraph sequence to C character. + * cnv_digraph() Maps digraph sequence to C character. + * id_operator() See whether the identifier is an operator in C++. + * unget_ch() Pushs last gotten character back on the input stream. + * unget_string() Pushs sequence on the input stream. + * save_string() Saves a string in malloc() memory. + * get_file() Initializes a new FILEINFO structure, called when #include + * opens a new file, or from unget_string(). + * xmalloc() Gets a specified number of bytes from heap memory. + * If malloc() returns NULL, exits with a message. + * xrealloc() realloc(). If it fails, exits with a message. + * get_src_location() Trace back line-column datum into pre-line-splicing + * phase. A function for -K option. + * cfatal(), cerror(), cwarn() + * These routines format print messages to the user. + * mcpp_fputc(), mcpp_fputs(), mcpp_fprintf() + * Wrap library functions to support alternate output to memory + * buffer. + */ + +#include "precompiled.h" +#include "pk_mcpp_bridge.h" + +#if defined(PK_COMPILER_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4102) +# pragma warning( disable : 4703) +# pragma warning( disable : 4702) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wimplicit-fallthrough" +# pragma clang diagnostic ignored "-Wunused-label" +# pragma clang diagnostic ignored "-Wtype-limits" +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +# pragma GCC diagnostic ignored "-Wunused-label" +# pragma GCC diagnostic ignored "-Wtype-limits" +#endif + +static void scan_id( int c); + /* Scan an identifier */ +static char * scan_number( int c, char * out, char * out_end); + /* Scan a preprocessing number */ +static char * scan_number_prestd( int c, char * out, char * out_end); + /* scan_number() for pre-Standard mode */ +#if OK_UCN +static char * scan_ucn( int cnt, char * out); + /* Scan an UCN sequence */ +#endif +static char * scan_op( int c, char * out); + /* Scan an operator or a punctuator */ +static char * parse_line( void); + /* Parse a logical line and convert comments */ +static char * read_a_comment( char * sp, size_t * sizp); + /* Read over a comment */ +static char * get_line( int in_comment); + /* Get a logical line from file, handle line-splicing */ +static char * at_eof( int in_comment); + /* Check erroneous end of file */ +static void do_msg( const char * severity, const char * format + , const char * arg1, long arg2, const char * arg3); + /* Putout diagnostic message */ +static char * cat_line( int del_bsl); + /* Splice the line */ +static void put_line( char * out, SIOHandle * fp); + /* Put out a logical line */ +static void dump_token( int token_type, const char * cp); + /* Dump a token and its type */ + +#define EXP_MAC_IND_MAX 16 +/* Information of current expanding macros for diagnostic */ +static struct { + const char * name; /* Name of the macro just expanded */ + int to_be_freed; /* Name should be freed later */ +} expanding_macro[ EXP_MAC_IND_MAX]; +static int exp_mac_ind = 0; /* Index into expanding_macro[] */ + +static int in_token = FALSE; /* For token scanning functions */ +static int in_string = FALSE; /* For get_ch() and parse_line()*/ +static int squeezews = FALSE; + +#define MAX_CAT_LINE 256 +/* Information on line catenated by */ +/* and by line-crossing comment. This is for -K option. */ +typedef struct catenated_line { + long start_line; /* Starting line of catenation */ + long last_line; /* Ending line of catanation */ + size_t len[ MAX_CAT_LINE + 1]; + /* Length of successively catenated lines */ +} CAT_LINE; +static CAT_LINE bsl_cat_line; + /* Datum on the last catenated line by */ +static CAT_LINE com_cat_line; + /* Datum on the last catenated line by a line-crossing comment */ + +#if MCPP_LIB +static int use_mem_buffers = FALSE; + +void init_support( void) +{ + in_token = in_string = squeezews = FALSE; + bsl_cat_line.len[ 0] = com_cat_line.len[ 0] = 0; + clear_exp_mac(); +} + +typedef struct mem_buf { + char * buffer; + char * entry_pt; + size_t size; + size_t bytes_avail; +} MEMBUF; + +static MEMBUF mem_buffers[ NUM_OUTDEST]; + +void mcpp_use_mem_buffers( + int tf +) +{ + int i; + + use_mem_buffers = tf ? TRUE : FALSE; + + for (i = 0; i < NUM_OUTDEST; ++i) { + if (mem_buffers[ i].buffer) + /* Free previously allocated memory buffer */ + free( mem_buffers[ i].buffer); + if (use_mem_buffers) { + /* Output to memory buffers instead of files */ + mem_buffers[ i].buffer = NULL; + mem_buffers[ i].entry_pt = NULL; + mem_buffers[ i].size = 0; + mem_buffers[ i].bytes_avail = 0; + } + } +} + +int using_mem_buffers( void) +{ + return use_mem_buffers; +} + +#define BUF_INCR_SIZE (NWORK * 2) +#define MAX( a, b) (((a) > (b)) ? (a) : (b)) + +static char * append_to_buffer( + MEMBUF * mem_buf_p, + const char * string, + size_t length +) +{ + if (mem_buf_p->bytes_avail < length + 1) { /* Need to allocate more memory */ + size_t size = MAX( BUF_INCR_SIZE, length); + + if (mem_buf_p->buffer == NULL) { /* 1st append */ + mem_buf_p->size = size; + mem_buf_p->bytes_avail = size; + mem_buf_p->buffer = xmalloc( mem_buf_p->size); + mem_buf_p->entry_pt = mem_buf_p->buffer; + } else { + mem_buf_p->size += size; + mem_buf_p->bytes_avail += size; + mem_buf_p->buffer = xrealloc( mem_buf_p->buffer, mem_buf_p->size); + mem_buf_p->entry_pt = mem_buf_p->buffer + mem_buf_p->size + - mem_buf_p->bytes_avail; + } + } + + /* Append the string to the tail of the buffer */ + memcpy( mem_buf_p->entry_pt, string, length); + mem_buf_p->entry_pt += length; + mem_buf_p->entry_pt[ 0] = '\0'; /* Terminate the string buffer */ + mem_buf_p->bytes_avail -= length; + + return mem_buf_p->buffer; +} + +static int mem_putc( + int c, + OUTDEST od +) +{ + char string[ 1]; + + string[ 0] = (char) c; + + if (append_to_buffer( &(mem_buffers[ od]), string, 1) != NULL) + return 0; + else + return !0; +} + +static int mem_puts( + const char * s, + OUTDEST od +) +{ + if (append_to_buffer( &(mem_buffers[od]), s, strlen(s)) != NULL) + return 0; + else + return !0; +} + +char * mcpp_get_mem_buffer( + OUTDEST od +) +{ + return mem_buffers[ od].buffer; +} + +#endif /* MCPP_LIB */ + +#define DEST2FP(od) \ + (od == DEST_OUT) ? g_internal_data->fp_out : \ + ((od == DEST_ERR) ? g_internal_data->fp_err : \ + ((od == DEST_DBG) ? g_internal_data->fp_debug : \ + (NULL))) + +/* + * The following mcpp_*() wrapper functions are intended to centralize + * the output generated by MCPP. They support memory buffer alternates to + * each of the primary output streams: out, err, debug. The memory buffer + * output option would be used in a setup where MCPP has been built as a + * function call - i.e. mcpp_lib_main(). + */ + +int mcpp_lib_fputc( + int c, + OUTDEST od +) +{ +#if MCPP_LIB + if (use_mem_buffers) { + return mem_putc( c, od); + } else { +#endif + SIOHandle * stream = DEST2FP( od); + + return (stream != NULL) ? pk_fputc( c, stream) : EOF; +#if MCPP_LIB + } +#endif +} + +int (* mcpp_fputc)( int c, OUTDEST od) = mcpp_lib_fputc; + +int mcpp_lib_fputs( + const char * s, + OUTDEST od +) +{ +#if MCPP_LIB + if (use_mem_buffers) { + return mem_puts( s, od); + } else { +#endif + SIOHandle * stream = DEST2FP( od); + + return (stream != NULL) ? pk_fputs( s, stream) : EOF; +#if MCPP_LIB + } +#endif +} + +int (* mcpp_fputs)( const char * s, OUTDEST od) = mcpp_lib_fputs; + +#include + +int mcpp_lib_fprintf( + OUTDEST od, + const char * format, + ... +) +{ + va_list ap; + SIOHandle * stream = DEST2FP( od); + + if (stream != NULL) { + int rc; + + va_start( ap, format); +#if MCPP_LIB + if (use_mem_buffers) { + static char mem_buffer[ NWORK]; + + rc = vsprintf( mem_buffer, format, ap); + + if (rc != 0) { + rc = mem_puts( mem_buffer, od); + } + } else { +#endif + rc = pk_vfprintf( stream, format, ap); +#if MCPP_LIB + } +#endif + va_end( ap); + + return rc; + + } else { + return EOF; + } +} + +int (* mcpp_fprintf)( OUTDEST od, const char * format, ...) = mcpp_lib_fprintf; + +#if MCPP_LIB +void mcpp_reset_def_out_func( void) +{ + mcpp_fputc = mcpp_lib_fputc; + mcpp_fputs = mcpp_lib_fputs; + mcpp_fprintf = mcpp_lib_fprintf; +} + +void mcpp_set_out_func( + int (* func_fputc)( int c, OUTDEST od), + int (* func_fputs)( const char * s, OUTDEST od), + int (* func_fprintf)( OUTDEST od, const char * format, ...) +) +{ + mcpp_fputc = func_fputc; + mcpp_fputs = func_fputs; + mcpp_fprintf = func_fprintf; +} +#endif + +int get_unexpandable( + int c, /* First char of token */ + int diag /* Flag of diagnosis */ +) +/* + * Get the next unexpandable token in the line, expanding macros. + * Return the token type. The token is written in work_buf[]. + * The once expanded macro is never expanded again. + * Called only from the routines processing #if (#elif, #assert), #line and + * #include directives in order to diagnose some subtle macro expansions. + */ +{ + DEFBUF * defp = NULL; + FILEINFO * file; + SIOHandle * fp = NULL; + LINE_COL line_col = { 0L, 0}; + int token_type = NO_TOKEN; + int has_pragma; + + while (c != EOS && c != '\n' /* In a line */ + && (fp = g_internal_data->infile->fp /* Preserve current state */ + , (token_type + = scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end)) + == NAM) /* Identifier */ + && fp != NULL /* In source ! */ + && (defp = is_macro( NULL)) != NULL) { /* Macro */ + g_internal_data->expand_macro( defp, g_internal_data->work_buf, g_internal_data->work_end, line_col, & has_pragma); + /* Expand macro */ + if (has_pragma) + cerror( "_Pragma operator found in directive line" /* _E_ */ + , NULL, 0L, NULL); + file = unget_string( g_internal_data->work_buf, defp->name); /* Stack to re-read */ + c = skip_ws(); /* Skip TOK_SEP */ + if (file != g_internal_data->infile && g_internal_data->macro_line != MACRO_ERROR && (g_internal_data->warn_level & 1)) { + /* This diagnostic is issued even if "diag" is FALSE. */ + cwarn( "Macro \"%s\" is expanded to 0 token" /* _W1_ */ + , defp->name, 0L, NULL); + if (! g_internal_data->option_flags.no_source_line) + dump_a_def( " macro", defp, FALSE, TRUE, g_internal_data->fp_err); + } + } + + if (c == '\n' || c == EOS) { + unget_ch(); + return NO_TOKEN; + } + + if (diag && fp == NULL && defp && (g_internal_data->warn_level & 1)) { + char tmp[ NWORK + 16]; + char * tmp_end = tmp + NWORK; + char * tmp_p; + file = unget_string( g_internal_data->infile->buffer, defp->name); /* To diagnose */ + c = get_ch(); + while (file == g_internal_data->infile) { /* Search the expanded macro */ + if (scan_token( c, (tmp_p = tmp, &tmp_p), tmp_end) != NAM) { + c = get_ch(); + continue; + } + if (g_internal_data->standard && str_eq( g_internal_data->identifier, "defined")) { + cwarn( "Macro \"%s\" is expanded to \"defined\"" /* _W1_ */ + , defp->name, 0L, NULL); + break; + } + if (! g_internal_data->standard && str_eq( g_internal_data->identifier, "sizeof")) { + cwarn( "Macro \"%s\" is expanded to \"sizeof\"" /* _W1_ */ + , defp->name, 0L, NULL); + break; + } + c = get_ch(); + } + if (file == g_internal_data->infile) { + g_internal_data->infile->bptr += strlen( g_internal_data->infile->bptr); + get_ch(); + } + unget_ch(); + if (token_type == OPE) { + unget_string( g_internal_data->work_buf, NULL); /* Set again 'openum' */ + scan_token( get_ch(), (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end); + } + } + + return token_type; +} + +void skip_nl( void) +/* + * Skip to the end of the current input line. + */ +{ + g_internal_data->insert_sep = NO_SEP; + while (g_internal_data->infile && g_internal_data->infile->fp == NULL) { /* Stacked text */ + g_internal_data->infile->bptr += strlen( g_internal_data->infile->bptr); + get_ch(); /* To the parent */ + } + if (g_internal_data->infile) + g_internal_data->infile->bptr += strlen( g_internal_data->infile->bptr); /* Source line */ +} + +int skip_ws( void) +/* + * Skip over horizontal whitespaces. + */ +{ + int c; + + do { + c = get_ch(); + } while (g_internal_data->char_type[ c] & HSP); + + return c; +} + +#define MBMASK 0xFF /* Mask to hide multibyte char */ + +int scan_token( + int c, /* The first character of the token */ + char ** out_pp, /* Pointer to pointer to output buf */ + char * out_end /* End of output buffer */ +) +/* + * Scan the next token of any type. + * The token is written out to the specified buffer and the output pointer + * is advanced. Token is terminated by EOS. Return the type of token. + * If the token is an identifier, the token is also in identifier[]. + * If the token is a operator or punctuator, return OPE. + * If 'c' is token separator, then return SEP. + * If 'c' is not the first character of any known token and not a token + * separator, return SPE. + * In POST_STD mode, inserts token separator (a space) between any tokens of + * source. + */ +{ + char * out = *out_pp; /* Output pointer */ + int ch_type; /* Type of character */ + int token_type = 0; /* Type of token */ + int ch; + + if (g_internal_data->standard) + in_token = TRUE; /* While a token is scanned */ + c = c & UCHARMAX; + ch_type = g_internal_data->char_type[ c] & MBMASK; + + switch (ch_type) { + case LET: /* Probably an identifier */ + switch (c) { + case 'L': + if (! g_internal_data->standard) + goto ident; + ch = get_ch(); + if (g_internal_data->char_type[ ch] & QUO) { /* char_type[ ch] == QUO */ + if (ch == '"') + token_type = WSTR; /* Wide-char string literal */ + else + token_type = WCHR; /* Wide-char constant */ + c = ch; + *out++ = 'L'; + break; /* Fall down to "case QUO:" */ + } else { + unget_ch(); + } /* Fall through */ + default: /* An identifier */ +ident: + scan_id( c); + out = stpcpy( out, g_internal_data->identifier); + token_type = NAM; + break; + } + if (token_type == NAM) + break; + /* Else fall through -- i.e. WSTR, WCHR */ + case QUO: /* String or character constant */ + out = scan_quote( c, out, out_end, FALSE); + if (token_type == 0) { /* Without prefix L */ + if (c == '"') + token_type = STR; + else + token_type = CHR; + } /* Else WSTR or WCHR */ + break; + case DOT: + ch = get_ch(); + unget_ch(); + if ((g_internal_data->char_type[ ch] & DIG) == 0) /* Operator '.' or '...' */ + goto operat; + /* Else fall through */ + case DIG: /* Preprocessing number */ + out = (g_internal_data->standard ? scan_number( c, out, out_end) + : scan_number_prestd( c, out, out_end)); + token_type = NUM; + break; + case PUNC: +operat: out = scan_op( c, out); /* Operator or punctuator */ + token_type = OPE; /* Number is set in global "openum" */ + break; + default: /* Special tokens or special characters */ +#if OK_UCN + if (g_internal_data->mcpp_mode == STD && c == '\\' && g_internal_data->stdc2) { + ch = get_ch(); + unget_ch(); + if (ch == 'U' || ch == 'u') + goto ident; /* Universal-Characte-Name */ + } +#endif +#if OK_MBIDENT + if (g_internal_data->mcpp_mode == STD && (g_internal_data->char_type[ c] & g_internal_data->mbchk) && stdc3) { + char * bptr = g_internal_data->infile->bptr; + g_internal_data->mb_read( c, &g_internal_data->infile->bptr, &out); + g_internal_data->infile->bptr = bptr; + out = *out_pp; + goto ident; /* An identifier with multi-byte characters */ + /* Mbchar cheking has been done in scan_quote() and others. */ + } +#endif + if ((g_internal_data->standard && (c == CAT || c == ST_QUOTE)) || (g_internal_data->char_type[ c] & SPA)) + token_type = SEP; /* Token separator or magic char*/ + else + token_type = SPE; + /* Unkown token ($, @, multi-byte character or Latin */ + *out++ = (char)c; + *out = EOS; + break; + } + + if (out_end < out) + cfatal( "Buffer overflow scanning token \"%s\"" /* _F_ */ + , *out_pp, 0L, NULL); + if (g_internal_data->mcpp_debug & TOKEN) + dump_token( token_type, *out_pp); + if (g_internal_data->mcpp_mode == POST_STD && token_type != SEP && g_internal_data->infile->fp != NULL + && (g_internal_data->char_type[ *g_internal_data->infile->bptr & UCHARMAX] & SPA) == 0) + g_internal_data->insert_sep = INSERT_SEP; /* Insert token separator */ + *out_pp = out; + + in_token = FALSE; /* Token scanning has been done */ + return token_type; +} + +static void scan_id( + int c /* First char of id */ +) +/* + * Reads the next identifier and put it into identifier[]. + * The caller has already read the first character of the identifier. + */ +{ + const char * const limit = &g_internal_data->identifier[ IDMAX]; + static int dollar_diagnosed = FALSE; /* Flag of diagnosing '$' */ +#if OK_UCN + int uc2 = 0, uc4 = 0; /* Count of UCN16, UCN32 */ +#endif +#if OK_MBIDENT + int mb = 0; /* Count of MBCHAR */ +#endif + size_t len; /* Length of identifier */ + char * bp = g_internal_data->identifier; + + if (c == IN_SRC) { /* Magic character */ + *bp++ = (char)c; + if ((g_internal_data->mcpp_debug & MACRO_CALL) && ! g_internal_data->in_directive) { + *bp++ = (char)get_ch(); /* Its 2-bytes */ + *bp++ = (char)get_ch(); /* argument */ + } + c = get_ch(); + } + + do { + if (bp < limit) + *bp++ = (char)c; +#if OK_UCN + if (g_internal_data->mcpp_mode == STD && c == '\\' && g_internal_data->stdc2) { + int cnt; + char * tp = bp; + + if ((c = get_ch()) == 'u') { + cnt = 4; + } else if (c == 'U') { + cnt = 8; + } else { + unget_ch(); + bp--; + break; + } + *bp++ = (char)c; + if ((bp = scan_ucn( cnt, bp)) == NULL) /* Error */ + return; + if (cnt == 4) + uc2++; + else if (cnt == 8) + uc4++; + if (limit <= tp) /* Too long identifier */ + bp = tp; /* Back the pointer */ + goto next_c; + } +#endif /* OK_UCN */ +#if OK_MBIDENT + if (g_internal_data->mcpp_mode == STD && (g_internal_data->char_type[ c] & g_internal_data->mbchk) && stdc3) { + len = g_internal_data->mb_read( c, &g_internal_data->infile->bptr, &bp); + if (len & MB_ERROR) { + if (g_internal_data->infile->fp) + cerror( + "Illegal multi-byte character sequence." /* _E_ */ + , NULL, 0L, NULL); + } else { + mb += len; + } + } +#endif /* OK_MBIDENT */ +#if OK_UCN +next_c: +#endif + c = get_ch(); + } while ((g_internal_data->char_type[ c] & (LET | DIG)) /* Letter or digit */ +#if OK_UCN + || (g_internal_data->mcpp_mode == STD && c == '\\' && g_internal_data->stdc2) +#endif +#if OK_MBIDENT + || (g_internal_data->mcpp_mode == STD && (g_internal_data->char_type[ c] & g_internal_data->mbchk) && stdc3) +#endif + ); + + unget_ch(); + *bp = EOS; + + if (bp >= limit && (g_internal_data->warn_level & 1)) /* Limit of token */ + cwarn( "Too long identifier truncated to \"%s\"" /* _W1_ */ + , g_internal_data->identifier, 0L, NULL); + + len = bp - g_internal_data->identifier; +#if IDMAX > IDLEN90MIN + /* UCN16, UCN32, MBCHAR are counted as one character for each. */ +#if OK_UCN + if (g_internal_data->mcpp_mode == STD) + len -= (uc2 * 5) - (uc4 * 9); +#endif +#if OK_MBIDENT + if (g_internal_data->mcpp_mode == STD) + len -= mb; +#endif + if (g_internal_data->standard && g_internal_data->infile->fp && len > g_internal_data->std_limits.id_len && (g_internal_data->warn_level & 4)) + cwarn( "Identifier longer than %.0s%ld characters \"%s\"" /* _W4_ */ + , NULL, (long) g_internal_data->std_limits.id_len, g_internal_data->identifier); +#endif /* IDMAX > IDLEN90MIN */ + + if (g_internal_data->option_flags.dollar_in_name && dollar_diagnosed == FALSE + && (g_internal_data->warn_level & 2) && strchr( g_internal_data->identifier, '$') != NULL) { + cwarn( "'$' in identifier \"%s\"", g_internal_data->identifier, 0L, NULL); /* _W2_ */ + dollar_diagnosed = TRUE; /* Diagnose only once */ + } +} + +char * scan_quote( + int delim, /* ', " or < (header-name) */ + char * out, /* Output buffer */ + char * out_end, /* End of output buffer */ + int diag /* Diagnostic should be output */ +) +/* + * Scan off a string literal or character constant to the output buffer. + * Report diagnosis if the quotation is terminated by newline or character + * constant is empty (provided 'diag' is TRUE). + * Return the next output pointer or NULL (on error). + */ +{ + const char * const skip_line = ", skipped the line"; /* _E_ */ + const char * const unterm_string + = "Unterminated string literal%s"; + const char * const unterm_char + = "Unterminated character constant %s%.0ld%s"; + const char * const empty_const + = "Empty character constant %s%.0ld%s"; + const char * skip; + size_t len; + int c; + char * out_p = out; + + /* Set again in case of called from routines other than scan_token(). */ + if (g_internal_data->standard) + in_token = TRUE; + *out_p++ = (char)delim; + if (delim == '<') + delim = '>'; + +scan: + while ((c = get_ch()) != EOS) { + +#if MBCHAR + if (g_internal_data->char_type[ c] & g_internal_data->mbchk) { + /* First of multi-byte character (or shift-sequence) */ + char * bptr = g_internal_data->infile->bptr; + len = g_internal_data->mb_read( c, &g_internal_data->infile->bptr, (*out_p++ = (char)c, &out_p)); + if (len & MB_ERROR) { + if (g_internal_data->infile->fp != NULL && compiling && diag) { + if (g_internal_data->warn_level & 1) { + char * buf; + size_t chlen; + buf = xmalloc( chlen = g_internal_data->infile->bptr - bptr + 2); + memcpy( buf, bptr, chlen - 1); + buf[ chlen - 1] = EOS; + cwarn( + "Illegal multi-byte character sequence \"%s\" in quotation", /* _W1_ */ + buf, 0L, NULL); + free( buf); + } + } + continue; + } else { /* Valid multi-byte character (or sequence) */ + goto chk_limit; + } + } +#endif + if (c == delim) { + break; + } else if (c == '\\' && delim != '>') { /* In string literal */ +#if OK_UCN + if (g_internal_data->mcpp_mode == STD && g_internal_data->stdc2) { + int cnt; + char * tp; + + *out_p++ = (char)c; + if ((c = get_ch()) == 'u') { + cnt = 4; + } else if (c == 'U') { + cnt = 8; + } else { + goto escape; + } + *out_p++ = (char)c; + if ((tp = scan_ucn( cnt, out_p)) != NULL) + out_p = tp; + /* Else error */ + continue; /* Error or not, anyway continue */ + } +#endif /* OK_UCN */ + *out_p++ = (char)c; /* Escape sequence */ + c = get_ch(); +escape: +#if MBCHAR + if (g_internal_data->char_type[ c] & g_internal_data->mbchk) { + /* '\\' followed by multi-byte char */ + unget_ch(); + continue; + } +#endif + if (! g_internal_data->standard && c == '\n') { /* */ + out_p--; /* Splice the lines */ + if (cat_line( TRUE) == NULL) /* End of file */ + break; + c = get_ch(); + } + } else if (g_internal_data->mcpp_mode == POST_STD && c == ' ' && delim == '>' + && g_internal_data->infile->fp == NULL) { + continue; /* Skip space possibly inserted by macro expansion */ + } else if (c == '\n') { + break; + } + if (diag && iscntrl( c) && ((g_internal_data->char_type[ c] & SPA) == 0) + && (g_internal_data->warn_level & 1)) + cwarn( + "Illegal control character %.0s0lx%02x in quotation" /* _W1_ */ + , NULL, (long) c, NULL); + *out_p++ = (char)c; +chk_limit: + if (out_end < out_p) { + *out_end = EOS; + cfatal( "Too long quotation", NULL, 0L, NULL); /* _F_ */ + } + } + + if (c == '\n' || c == EOS) + unget_ch(); + if (c == delim) + *out_p++ = (char)delim; + *out_p = EOS; + if (diag) { /* At translation phase 3 */ + skip = (g_internal_data->infile->fp == NULL) ? NULL : skip_line; + if (c != delim) { + if (g_internal_data->mcpp_mode == OLD_PREP /* Implicit closing of quote*/ + && (delim == '"' || delim == '\'')) + goto done; + if (delim == '"') { + if (g_internal_data->mcpp_mode != POST_STD && g_internal_data->option_flags.lang_asm) { + /* STD, KR */ + /* Concatenate the unterminated string to the next line */ + if (g_internal_data->warn_level & 1) + cwarn( unterm_string + , ", catenated to the next line" /* _W1_ */ + , 0L, NULL); + if (cat_line( FALSE) != NULL) + goto scan; /* Splice the lines */ + /* Else end of file */ + } else { + cerror( unterm_string, skip, 0L, NULL); /* _E_ */ + } + } else if (delim == '\'') { + if (g_internal_data->mcpp_mode != POST_STD && g_internal_data->option_flags.lang_asm) { + /* STD, KR */ + if (g_internal_data->warn_level & 1) + cwarn( unterm_char, out, 0L, NULL); /* _W1_ */ + goto done; + } else { + cerror( unterm_char, out, 0L, skip); /* _E_ */ + } + } else { + cerror( "Unterminated header name %s%.0ld%s" /* _E_ */ + , out, 0L, skip); + } + out_p = NULL; + } else if (delim == '\'' && out_p - out <= 2) { + if (g_internal_data->mcpp_mode != POST_STD && g_internal_data->option_flags.lang_asm) { + /* STD, KR */ + if (g_internal_data->warn_level & 1) + cwarn( empty_const, out, 0L, skip); /* _W1_ */ + } else { + cerror( empty_const, out, 0L, skip); /* _E_ */ + out_p = NULL; + goto done; + } + } else if (g_internal_data->mcpp_mode == POST_STD && delim == '>' && (g_internal_data->warn_level & 2)) { + cwarn( + "Header-name enclosed by <, > is an obsolescent feature %s" /* _W2_ */ + , out, 0L, skip); + } +#if NWORK-2 > SLEN90MIN + if (g_internal_data->standard && out_p - out > g_internal_data->std_limits.str_len && (g_internal_data->warn_level & 4)) + cwarn( "Quotation longer than %.0s%ld bytes" /* _W4_ */ + , NULL, g_internal_data->std_limits.str_len, NULL); +#endif + } + +done: + in_token = FALSE; + return out_p; +} + +static char * cat_line( + int del_bsl /* Delete the ? */ +) +/* + * If del_bsl == TRUE: + * Delete sequence in string literal. + * FALSE: Overwrite the with 'n'. + * Return NULL on end of file. Called only from scan_quote(). + * This routine is never called in POST_STD mode. + */ +{ + size_t len; + char * save1, * save2; + + if (del_bsl) { /* Delete the */ + g_internal_data->infile->bptr -= 2; + len = g_internal_data->infile->bptr - g_internal_data->infile->buffer; + } else { /* Overwrite the with 'n' */ + strcpy( g_internal_data->infile->bptr, "\\n"); + len = strlen( g_internal_data->infile->buffer); + } + save1 = save_string( g_internal_data->infile->buffer); + save2 = get_line( FALSE); /* g_internal_data->infile->buffer is overwritten */ + if (save2 == NULL) { + free( save1); + return NULL; + } + save2 = save_string( g_internal_data->infile->buffer); + memcpy( g_internal_data->infile->buffer, save1, len); + strcpy( g_internal_data->infile->buffer + len, save2); /* Catenate */ + free( save1); + free( save2); + if (! del_bsl) + len -= 2; + g_internal_data->infile->bptr = g_internal_data->infile->buffer + len; + return g_internal_data->infile->bptr; +} + +static char * scan_number( + int c, /* First char of number */ + char * out, /* Output buffer */ + char * out_end /* Limit of output buffer */ +) +/* + * Read a preprocessing number. + * By scan_token() we know already that the first c is from 0 to 9 or dot, + * and if c is dot then the second character is digit. + * Returns the advanced output pointer. + * Note: preprocessing number permits non-numeric forms such as 3E+xy, + * which are used in stringization or token-concatenation. + */ +{ + char * out_p = out; /* Current output pointer */ + + do { + *out_p++ = (char)c; + if (c == 'E' || c == 'e' /* Sign should follow 'E', 'e', */ + || (g_internal_data->stdc3 && (c == 'P' || c == 'p')) + /* 'P' or 'p'. */ + ) { + c = get_ch(); + if (c == '+' || c == '-') { + *out_p++ = (char)c; + c = get_ch(); + } +#if OK_UCN + } else if (g_internal_data->mcpp_mode == STD && c == '\\' && g_internal_data->stdc3) { + int cnt; + char * tp; + + if ((c = get_ch()) == 'u') { + cnt = 4; + } else if (c == 'U') { + cnt = 8; + } else { + unget_ch(); + out_p--; + break; + } + *out_p++ = (char)c; + if ((tp = scan_ucn( cnt, out_p)) == NULL) /* Error */ + break; + else + out_p = tp; + c = get_ch(); +#endif /* OK_UCN */ +#if OK_MBIDENT + } else if (g_internal_data->mcpp_mode == STD && (g_internal_data->char_type[ c] & g_internal_data->mbchk) && g_internal_data->stdc3) { + len = g_internal_data->mb_read( c, &g_internal_data->infile->bptr, &out_p); + if (len & MB_ERROR) { + if (g_internal_data->infile->fp) + cerror( + "Illegal multi-byte character sequence." /* _E_ */ + , NULL, 0L, NULL); + } +#endif /* OK_MBIDENT */ + } else { + c = get_ch(); + } + } while ((g_internal_data->char_type[ c] & (DIG | DOT | LET)) /* Digit, dot or letter */ +#if OK_UCN + || (g_internal_data->mcpp_mode == STD && c == '\\' && g_internal_data->stdc3) +#endif +#if OK_MBIDENT + || (g_internal_data->mcpp_mode == STD && (g_internal_data->char_type[ c] & g_internal_data->mbchk) && g_internal_data->stdc3) +#endif + ); + + *out_p = EOS; + if (out_end < out_p) + cfatal( "Too long pp-number token \"%s\"" /* _F_ */ + , out, 0L, NULL); + unget_ch(); + return out_p; +} + +/* Original version of DECUS CPP with slight modifications, */ +/* too exact for Standard preprocessing. */ +static char * scan_number_prestd( + int c, /* First char of number */ + char * out, /* Output buffer */ + char * out_end /* Limit of output buffer */ +) +/* + * Process a number. We know that c is from 0 to 9 or dot. + * Algorithm from Dave Conroy's Decus C. + * Returns the advanced output pointer. + */ +{ + char * const out_s = out; /* For diagnostics */ + int radix; /* 8, 10, or 16 */ + int expseen; /* 'e' seen in floater */ + int octal89; /* For bad octal test */ + int dotflag; /* TRUE if '.' was seen */ + + expseen = FALSE; /* No exponent seen yet */ + octal89 = FALSE; /* No bad octal yet */ + radix = 10; /* Assume decimal */ + if ((dotflag = (c == '.')) != FALSE) { /* . something? */ + *out++ = '.'; /* Always out the dot */ + if ((g_internal_data->char_type[(c = get_ch())] & DIG) == 0) { + /* If not a float numb, */ + goto nomore; /* All done for now */ + } + } /* End of float test */ + else if (c == '0') { /* Octal or hex? */ + *out++ = (char)c; /* Stuff initial zero */ + radix = 8; /* Assume it's octal */ + c = get_ch(); /* Look for an 'x' */ + if (c == 'x' || c == 'X') { /* Did we get one? */ + radix = 16; /* Remember new radix */ + *out++ = (char)c; /* Stuff the 'x' */ + c = get_ch(); /* Get next character */ + } + } + while (1) { /* Process curr. char. */ + /* + * Note that this algorithm accepts "012e4" and "03.4" + * as legitimate floating-point numbers. + */ + if (radix != 16 && (c == 'e' || c == 'E')) { + if (expseen) /* Already saw 'E'? */ + break; /* Exit loop, bad nbr. */ + expseen = TRUE; /* Set exponent seen */ + radix = 10; /* Decimal exponent */ + *out++ = (char)c; /* Output the 'e' */ + if ((c = get_ch()) != '+' && c != '-') + continue; + } + else if (radix != 16 && c == '.') { + if (dotflag) /* Saw dot already? */ + break; /* Exit loop, two dots */ + dotflag = TRUE; /* Remember the dot */ + radix = 10; /* Decimal fraction */ + } + else { /* Check the digit */ + switch (c) { + case '8': case '9': /* Sometimes wrong */ + octal89 = TRUE; /* Do check later */ + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + break; /* Always ok */ + + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + if (radix == 16) /* Alpha's are ok only */ + break; /* if reading hex. */ + default: /* At number end */ + goto done; /* Break from for loop */ + } /* End of switch */ + } /* End general case */ + *out++ = (char)c; /* Accept the character */ + c = get_ch(); /* Read another char */ + } /* End of scan loop */ + + if (out_end < out) /* Buffer overflow */ + goto nomore; + /* + * When we break out of the scan loop, c contains the first + * character (maybe) not in the number. If the number is an + * integer, allow a trailing 'L' for long. If not those, push + * the trailing character back on the input stream. + * Floating point numbers accept a trailing 'L' for "long double". + */ +done: + if (! (dotflag || expseen)) { /* Not floating point */ + /* + * We know that dotflag and expseen are both zero, now: + * dotflag signals "saw 'L'". + */ + for (;;) { + switch (c) { + case 'l': + case 'L': + if (dotflag) + goto nomore; + dotflag = TRUE; + break; + default: + goto nomore; + } + *out++ = (char)c; /* Got 'L' . */ + c = get_ch(); /* Look at next, too. */ + } + } + +nomore: *out = EOS; + if (out_end < out) + goto overflow; + unget_ch(); /* Not part of a number */ + if (octal89 && radix == 8 && (g_internal_data->warn_level & 1)) + cwarn( "Illegal digit in octal number \"%s\"" /* _W1_ */ + , out_s, 0L, NULL); + return out; + +overflow: + cfatal( "Too long number token \"%s\"", out_s, 0L, NULL); /* _F_ */ + return out; +} + +#if OK_UCN +static char * scan_ucn( + int cnt, /* Bytes of sequence */ + char * out /* Output buffer */ +) +/* + * Scan an UCN sequence and put the sequence to 'out'. + * Return the advanced pointer or NULL on failure. + * This routine is never called in POST_STD mode. + */ +{ + uexpr_t value; /* Value of UCN */ + int i, c; + + value = 0L; + for (i = 0; i < cnt; i++) { + c = get_ch(); + if (! isxdigit( c)) { + if (g_internal_data->infile->fp) + cerror( "Illegal UCN sequence" /* _E_ */ + , NULL, 0L, NULL); + *out = EOS; + unget_ch(); + return NULL; + } + c = tolower( c); + *out++ = (char)c; + c = (isdigit( c) ? (c - '0') : (c - 'a' + 10)); + value = (value << 4) | c; + } + if (g_internal_data->infile->fp /* In source */ + && ((value >= 0L && value <= 0x9FL + && value != 0x24L && value != 0x40L && value != 0x60L) + /* Basic source character */ + || (g_internal_data->stdc3 && (value >= 0xD800L && value <= 0xDFFFL)))) + /* Reserved for special chars */ + cerror( "UCN cannot specify the value %.0s\"%08lx\"" /* _E_ */ + , NULL, (long) value, NULL); + return out; +} +#endif /* OK_UCN */ + +static char * scan_op( + int c, /* First char of the token */ + char * out /* Output buffer */ +) +/* + * Scan C operator or punctuator into the specified buffer. + * Return the advanced output pointer. + * The code-number of the operator is stored to global variable 'openum'. + * Note: '#' is not an operator nor a punctuator in other than directive line, + * nevertheless is handled as a punctuator in this cpp for convenience. + */ +{ + int c2, c3, c4; + + *out++ = (char)c; + + switch (c) { + case '~': g_internal_data->openum = OP_COM; break; + case '(': g_internal_data->openum = OP_LPA; break; + case ')': g_internal_data->openum = OP_RPA; break; + case '?': g_internal_data->openum = OP_QUE; break; + case ';': case '[': case ']': case '{': + case '}': case ',': + g_internal_data->openum = OP_1; + break; + default: + g_internal_data->openum = OP_2; /* Tentative guess */ + } + + if (g_internal_data->openum != OP_2) { /* Single byte operators */ + *out = EOS; + return out; + } + + c2 = get_ch(); /* Possibly two bytes ops */ + *out++ = (char)c2; + + switch (c) { + case '=': + g_internal_data->openum = ((c2 == '=') ? OP_EQ : OP_1); /* ==, = */ + break; + case '!': + g_internal_data->openum = ((c2 == '=') ? OP_NE : OP_NOT); /* !=, ! */ + break; + case '&': + switch (c2) { + case '&': g_internal_data->openum = OP_ANA; break; /* && */ + case '=': /* openum = OP_2; */ break; /* &= */ + default : g_internal_data->openum = OP_AND; break; /* & */ + } + break; + case '|': + switch (c2) { + case '|': g_internal_data->openum = OP_ORO; break; /* || */ + case '=': /* openum = OP_2; */ break; /* |= */ + default : g_internal_data->openum = OP_OR; break; /* | */ + } + break; + case '<': + switch (c2) { + case '<': c3 = get_ch(); + if (c3 == '=') { + g_internal_data->openum = OP_3; /* <<= */ + *out++ = (char)c3; + } else { + g_internal_data->openum = OP_SL; /* << */ + unget_ch(); + } + break; + case '=': g_internal_data->openum = OP_LE; break; /* <= */ + case ':': /* <: i.e. [ */ + if (g_internal_data->mcpp_mode == STD && g_internal_data->option_flags.dig) + g_internal_data->openum = OP_LBRCK_D; + else + g_internal_data->openum = OP_LT; + break; + case '%': /* <% i.e. { */ + if (g_internal_data->mcpp_mode == STD && g_internal_data->option_flags.dig) + g_internal_data->openum = OP_LBRACE_D; + else + g_internal_data->openum = OP_LT; + break; + default : g_internal_data->openum = OP_LT; break; /* < */ + } + break; + case '>': + switch (c2) { + case '>': c3 = get_ch(); + if (c3 == '=') { + g_internal_data->openum = OP_3; /* >>= */ + *out++ = (char)c3; + } else { + g_internal_data->openum = OP_SR; /* >> */ + unget_ch(); + } + break; + case '=': g_internal_data->openum = OP_GE; break; /* >= */ + default : g_internal_data->openum = OP_GT; break; /* > */ + } + break; + case '#': + if (g_internal_data->standard && (g_internal_data->in_define || g_internal_data->macro_line)) /* in #define or macro */ + g_internal_data->openum = ((c2 == '#') ? OP_CAT : OP_STR); /* ##, # */ + else + g_internal_data->openum = OP_1; /* # */ + break; + case '+': + switch (c2) { + case '+': /* ++ */ + case '=': /* openum = OP_2; */ break; /* += */ + default : g_internal_data->openum = OP_ADD; break; /* + */ + } + break; + case '-': + switch (c2) { + case '-': /* -- */ + case '=': /* -= */ + /* openum = OP_2; */ + break; + case '>': + if (g_internal_data->cplus_val) { + if ((c3 = get_ch()) == '*') { /* ->* */ + g_internal_data->openum = OP_3; + *out++ = (char)c3; + } else { + /* openum = OP_2; */ + unget_ch(); + } + } /* else openum = OP_2; */ /* -> */ + /* else openum = OP_2; */ + break; + default : g_internal_data->openum = OP_SUB; break; /* - */ + } + break; + case '%': + switch (c2) { + case '=': break; /* %= */ + case '>': /* %> i.e. } */ + if (g_internal_data->mcpp_mode == STD && g_internal_data->option_flags.dig) + g_internal_data->openum = OP_RBRACE_D; + else + g_internal_data->openum = OP_MOD; + break; + case ':': + if (g_internal_data->mcpp_mode == STD && g_internal_data->option_flags.dig) { + if ((c3 = get_ch()) == '%') { + if ((c4 = get_ch()) == ':') { /* %:%: i.e. ## */ + g_internal_data->openum = OP_DSHARP_D; + *out++ = (char)c3; + *out++ = (char)c4; + } else { + unget_ch(); + unget_ch(); + g_internal_data->openum = OP_SHARP_D; /* %: i.e. # */ + } + } else { + unget_ch(); + g_internal_data->openum = OP_SHARP_D; /* %: i.e. # */ + } + if (g_internal_data->in_define) { /* in #define */ + if (g_internal_data->openum == OP_DSHARP_D) + g_internal_data->openum = OP_CAT; + else + g_internal_data->openum = OP_STR; + } + } else { + g_internal_data->openum = OP_MOD; + } + break; + default : g_internal_data->openum = OP_MOD; break; /* % */ + } + break; + case '*': + if (c2 != '=') /* * */ + g_internal_data->openum = OP_MUL; + /* else openum = OP_2; */ /* *= */ + break; + case '/': + if (c2 != '=') /* / */ + g_internal_data->openum = OP_DIV; + /* else openum = OP_2; */ /* /= */ + break; + case '^': + if (c2 != '=') /* ^ */ + g_internal_data->openum = OP_XOR; + /* else openum = OP_2; */ /* ^= */ + break; + case '.': + if (g_internal_data->standard) { + if (c2 == '.') { + c3 = get_ch(); + if (c3 == '.') { + g_internal_data->openum = OP_ELL; /* ... */ + *out++ = (char)c3; + break; + } else { + unget_ch(); + g_internal_data->openum = OP_1; + } + } else if (g_internal_data->cplus_val && c2 == '*') { /* .* */ + /* openum = OP_2 */ ; + } else { /* . */ + g_internal_data->openum = OP_1; + } + } else { + g_internal_data->openum = OP_1; + } + break; + case ':': + if (g_internal_data->cplus_val && c2 == ':') /* :: */ + /* openum = OP_2 */ ; + else if (g_internal_data->mcpp_mode == STD && c2 == '>' && g_internal_data->option_flags.dig) + g_internal_data->openum = OP_RBRCK_D; /* :> i.e. ] */ + else /* : */ + g_internal_data->openum = OP_COL; + break; + default: /* Never reach here */ + cfatal( "Bug: Punctuator is mis-implemented %.0s0lx%x" /* _F_ */ + , NULL, (long) c, NULL); + g_internal_data->openum = OP_1; + break; + } + + switch (g_internal_data->openum) { + case OP_STR: + if (g_internal_data->mcpp_mode == STD && c == '%') break; /* %: */ + case OP_1: + case OP_NOT: case OP_AND: case OP_OR: case OP_LT: + case OP_GT: case OP_ADD: case OP_SUB: case OP_MOD: + case OP_MUL: case OP_DIV: case OP_XOR: case OP_COM: + case OP_COL: /* Any single byte operator or punctuator */ + unget_ch(); + out--; + break; + default: /* Two or more bytes operators or punctuators */ + break; + } + + *out = EOS; + return out; +} + +int id_operator( + const char * name +) +/* + * Check whether the name is identifier-like operator in C++. + * Return the operator number if matched, return 0 if not matched. + * Note: these identifiers are defined as macros in in C95. + * This routine is never called in POST_STD mode. + */ +{ + typedef struct id_op { + const char * name; + int op_num; + } ID_OP; + + ID_OP id_ops[] = { + { "and", OP_ANA}, + { "and_eq", OP_2}, + { "bitand", OP_AND}, + { "bitor", OP_OR}, + { "compl", OP_COM}, + { "not", OP_NOT}, + { "not_eq", OP_NE}, + { "or", OP_ORO}, + { "or_eq", OP_2}, + { "xor", OP_XOR}, + { "xor_eq", OP_2}, + { NULL, 0}, + }; + + ID_OP * id_p = id_ops; + + while (id_p->name != NULL) { + if (str_eq( name, id_p->name)) + return id_p->op_num; + id_p++; + } + return 0; +} + +void expanding( + const char * name, /* The name of (nested) macro just expanded. */ + int to_be_freed /* The name should be freed later. */ +) +/* + * Remember used macro name for diagnostic. + */ +{ + if (exp_mac_ind < EXP_MAC_IND_MAX - 1) { + exp_mac_ind++; + } else { + clear_exp_mac(); + exp_mac_ind++; + } + expanding_macro[ exp_mac_ind].name = name; + expanding_macro[ exp_mac_ind].to_be_freed = to_be_freed; +} + +void clear_exp_mac( void) +/* + * Initialize expanding_macro[] freeing names registered in + * name_to_be_freed[]. + */ +{ + int i; + + for (i = 1; i < EXP_MAC_IND_MAX; i++) { + if (expanding_macro[ i].to_be_freed) { + free( (void *) expanding_macro[ i].name); + expanding_macro[ i].to_be_freed = FALSE; + } + } + exp_mac_ind = 0; +} + +int get_ch( void) +/* + * Return the next character from a macro or the current file. + * Always return the value representable by unsigned char. + */ +{ + int len; + int c; + FILEINFO * file; + + /* + * 'in_token' is set to TRUE while scan_token() is executed (and + * scan_id(), scan_quote(), scan_number(), scan_ucn() and scan_op() + * via scan_token()) in Standard mode to simplify tokenization. + * Any token cannot cross "file"s. + */ + if (in_token) + return (*g_internal_data->infile->bptr++ & UCHARMAX); + + if ((file = g_internal_data->infile) == NULL) + return CHAR_EOF; /* End of all input */ + + if (g_internal_data->mcpp_mode == POST_STD && file->fp) { /* In a source file */ + switch (g_internal_data->insert_sep) { + case NO_SEP: + break; + case INSERT_SEP: /* Insert a token separator */ + g_internal_data->insert_sep = INSERTED_SEP; /* Remember this fact */ + return ' '; /* for unget_ch(). */ + case INSERTED_SEP: /* Has just inserted */ + g_internal_data->insert_sep = NO_SEP; /* Clear the flag */ + break; + } + } + if (! g_internal_data->standard && squeezews) { + if (*file->bptr == ' ') + file->bptr++; /* Squeeze white spaces */ + squeezews = FALSE; + } + + if (g_internal_data->mcpp_debug & GETC) { + mcpp_fprintf( DEST_DBG, "get_ch(%s) '%c' line %ld, bptr = %d, buffer" + , file->fp ? g_internal_data->cur_fullname : file->real_fname ? file->real_fname + : file->filename ? file->filename : "NULL" + , *file->bptr & UCHARMAX + , g_internal_data->src_line, (int) (file->bptr - file->buffer)); + dump_string( NULL, file->buffer); + dump_unget( "get entrance"); + } + + /* + * Read a character from the current input logical line or macro. + * At EOS, either finish the current macro (freeing temporary storage) + * or get another logical line by parse_line(). + * At EOF, exit the current file (#included) or, at EOF from the MCPP input + * file, return CHAR_EOF to finish processing. + * The character is converted to int with no sign-extension. + */ + if ((c = (*file->bptr++ & UCHARMAX)) != EOS) { + if (g_internal_data->standard) + return c; /* Just a character */ + if (! in_string && c == '\\' && *file->bptr == '\n' + && g_internal_data->in_define /* '\\''\n' is deleted in #define line, */ + /* provided the '\\' is not the 2nd byte of mbchar. */ + && ! last_is_mbchar( file->buffer, strlen( file->buffer) - 2 + && ! g_internal_data->keep_spaces) + ) { + if (*(file->bptr - 2) == ' ') + squeezews = TRUE; + } else { + return c; + } + } + + /* + * Nothing in current line or macro. Get next line (if input from a + * file), or do end of file/macro processing, and reenter get_ch() to + * restart from the top. + */ + if (file->fp && /* In source file */ + parse_line() != NULL) /* Get line from file */ + return get_ch(); + /* + * Free up space used by the (finished) file or macro and restart + * input from the parent file/macro, if any. + */ + g_internal_data->infile = file->parent; /* Unwind file chain */ + free( file->buffer); /* Free buffer */ + if (g_internal_data->infile == NULL) { /* If at end of input */ + free( file->filename); + free( (char*)file->src_dir); + free( file); /* full_fname is the same with filename for main file*/ + return CHAR_EOF; /* Return end of file */ + } + if (file->fp) { /* Source file included */ + free( file->filename); /* Free filename */ + free( (char*)file->src_dir); /* Free src_dir */ + pk_fclose( file->fp); /* Close finished file */ + /* Do not free file->real_fname and file->full_fname */ + g_internal_data->cur_fullname = (char*)g_internal_data->infile->full_fname; + g_internal_data->cur_fname = g_internal_data->infile->real_fname; /* Restore current fname*/ + if (g_internal_data->infile->pos != 0L) { /* Includer was closed */ + g_internal_data->infile->fp = pk_fopen( g_internal_data->cur_fullname, "r"); + pk_fseek( g_internal_data->infile->fp, g_internal_data->infile->pos, SEEK_SET); + } /* Re-open the includer and restore the file-position */ + len = (int) (g_internal_data->infile->bptr - g_internal_data->infile->buffer); + g_internal_data->infile->buffer = xrealloc( g_internal_data->infile->buffer, NBUFF); + /* Restore full size buffer to get the next line */ + g_internal_data->infile->bptr = g_internal_data->infile->buffer + len; + g_internal_data->src_line = g_internal_data->infile->line; /* Reset line number */ + g_internal_data->inc_dirp = g_internal_data->infile->dirp; /* Includer's directory */ +#if MCPP_LIB + mcpp_set_out_func( g_internal_data->infile->last_fputc, g_internal_data->infile->last_fputs, + g_internal_data->infile->last_fprintf); +#endif + g_internal_data->include_nest--; + g_internal_data->src_line++; /* Next line to #include*/ + sharp( NULL, g_internal_data->infile->include_opt ? 1 : (file->include_opt ? 0 : 2)); + /* Need a #line now. Marker depends on include_opt. */ + /* The file of include_opt should be marked as 1. */ + /* Else if returned from include_opt file, it is the */ + /* main input file, and should not be marked. */ + /* Else, it is normal includer file, and marked as 2. */ + g_internal_data->src_line--; + g_internal_data->newlines = 0; /* Clear the blank lines*/ + if (g_internal_data->mcpp_debug & MACRO_CALL) /* Should be re-initialized */ + com_cat_line.last_line = bsl_cat_line.last_line = 0L; + } else if (file->filename) { /* Expanding macro */ + if (g_internal_data->macro_name) /* file->filename should be freed later */ + expanding( file->filename, TRUE); + else + free( file->filename); + } + free( file); /* Free file space */ + return get_ch(); /* Get from the parent */ +} + +static char * parse_line( void) +/* + * ANSI (ISO) C: translation phase 3. + * Parse a logical line. + * Check illegal control characters. + * Check unterminated string literal, character constant or comment. + * Convert each comment to one space (or spaces of the comment length on + * 'keep_spaces' mode).. + * Squeeze succeding white spaces other than (including comments) to + * one space (unless keep_spaces == TRUE). + * The lines might be spliced by comments which cross the lines. + */ +{ + char * temp; /* Temporary buffer */ + char * limit; /* Buffer end */ + char * tp; /* Current pointer into temporary buffer */ + char * sp; /* Pointer into input buffer */ + size_t com_size = 0; + int c; + + if ((sp = get_line( FALSE)) == NULL) /* Next logical line */ + return NULL; /* End of a file */ + if (g_internal_data->in_asm) { /* In #asm block */ + while (g_internal_data->char_type[ *sp++ & UCHARMAX] & SPA) + ; + if (*--sp == '#') /* Directive line */ + g_internal_data->infile->bptr = sp; + return g_internal_data->infile->bptr; /* Don't tokenize */ + } + tp = temp = xmalloc( (size_t) NBUFF); + limit = temp + NBUFF - 2; + + while (g_internal_data->char_type[ c = *sp++ & UCHARMAX] & HSP) { + if (g_internal_data->mcpp_mode != POST_STD) + /* Preserve line top horizontal white spaces */ + /* as they are for human-readability */ + *tp++ = (char)c; + /* Else skip the line top spaces */ + } + sp--; + + while ((c = *sp++ & UCHARMAX) != '\n') { + + switch (c) { + case '/': + switch (*sp++) { + case '*': /* Start of a comment */ +com_start: + if ((sp = read_a_comment( sp, &com_size)) == NULL) { + free( temp); /* End of file with un- */ + return NULL; /* terminated comment */ + } + if (g_internal_data->keep_spaces && g_internal_data->mcpp_mode != OLD_PREP) { + if (tp + com_size >= limit - 1) /* Too long comment */ + com_size = limit - tp - 1; /* Truncate */ + while (com_size--) + *tp++ = ' '; /* Spaces of the comment length */ + break; + } + switch (g_internal_data->mcpp_mode) { + case POST_STD: + if (temp < tp && *(tp - 1) != ' ') + *tp++ = ' '; /* Squeeze white spaces */ + break; + case OLD_PREP: + if (temp == tp + || ! (g_internal_data->char_type[ *(tp - 1) & UCHARMAX] & HSP)) + *tp++ = COM_SEP; /* Convert to magic character */ + break; + default: + if (temp == tp || + ! (g_internal_data->char_type[ *(tp - 1) & UCHARMAX] & HSP)) + *tp++ = ' '; /* Squeeze white spaces */ + break; + } + break; + case '/': /* // */ + if (! g_internal_data->standard) + goto not_comment; + /* Comment when C++ or __STDC_VERSION__ >= 199901L */ + /* Need not to convert to a space because '\n' follows */ + if (! g_internal_data->stdc2 && (g_internal_data->warn_level & 2)) + cwarn( "Parsed \"//\" as comment" /* _W2_ */ + , NULL, 0L, NULL); + if (g_internal_data->keep_comments) { + sp -= 2; + while (*sp != '\n') /* Until end of line */ + mcpp_fputc( *sp++, DEST_OUT); + mcpp_fputc('\n', DEST_OUT); + g_internal_data->wrong_line = TRUE; + } + goto end_line; + default: /* Not a comment */ +not_comment: + *tp++ = '/'; + sp--; /* To re-read */ + break; + } + break; + case '\r': /* Vertical white spaces*/ + /* Note that [CR+LF] is already converted to [LF]. */ + case '\f': + case '\v': + if (g_internal_data->warn_level & 4) + cwarn( "Converted %.0s0x%02lx to a space" /* _W4_ */ + , NULL, (long) c, NULL); + case '\t': /* Horizontal space */ + case ' ': + if (g_internal_data->keep_spaces) { + if (c == '\t') + *tp++ = '\t'; + else + *tp++ = ' '; /* Convert to ' ' */ + } else if (! (g_internal_data->char_type[ *(tp - 1) & UCHARMAX] & HSP)) { + *tp++ = ' '; /* Squeeze white spaces */ + } else if (g_internal_data->mcpp_mode == OLD_PREP && *(tp - 1) == COM_SEP) { + *(tp - 1) = ' '; /* Replace COM_SEP with ' ' */ + } + break; + case '"': /* String literal */ + case '\'': /* Character constant */ + g_internal_data->infile->bptr = sp; + if (g_internal_data->standard) { + tp = scan_quote( c, tp, limit, TRUE); + } else { + in_string = TRUE; /* Enable line splicing by scan_quote() */ + tp = scan_quote( c, tp, limit, TRUE); /* (not by get_ch())*/ + in_string = FALSE; + } + if (tp == NULL) { + free( temp); /* Unbalanced quotation */ + return parse_line(); /* Skip the line */ + } + sp = g_internal_data->infile->bptr; + break; + default: + if (iscntrl( c)) { + cerror( /* Skip the control character */ + "Illegal control character %.0s0x%lx, skipped the character" /* _E_ */ + , NULL, (long) c, NULL); + } else { /* Any valid character */ + *tp++ = (char)c; + } + break; + } + + if (limit < tp) { + *tp = EOS; + cfatal( "Too long line spliced by comments" /* _F_ */ + , NULL, 0L, NULL); + } + } + +end_line: + if (temp < tp && (g_internal_data->char_type[ *(tp - 1) & UCHARMAX] & HSP)) + tp--; /* Remove trailing white space */ + *tp++ = '\n'; + *tp = EOS; + g_internal_data->infile->bptr = strcpy( g_internal_data->infile->buffer, temp); /* Write back to buffer */ + free( temp); + if (g_internal_data->macro_line != 0 && g_internal_data->macro_line != MACRO_ERROR) { /* Expanding macro */ + temp = g_internal_data->infile->buffer; + while (g_internal_data->char_type[ *temp & UCHARMAX] & HSP) + temp++; + if (*temp == '#' /* This line starts with # token */ + || (g_internal_data->mcpp_mode == STD && *temp == '%' && *(temp + 1) == ':')) + if (g_internal_data->warn_level & 1) + cwarn( + "Macro started at line %.0s%ld swallowed directive-like line" /* _W1_ */ + , NULL, g_internal_data->macro_line, NULL); + } + return g_internal_data->infile->buffer; +} + +static char * read_a_comment( + char * sp, /* Source */ + size_t * sizp /* Size of the comment */ +) +/* + * Read over a comment (which may cross the lines). + */ +{ + int c; + char * saved_sp = NULL; + int cat_line = 0; /* Number of catenated lines */ + + if (g_internal_data->keep_spaces) { + saved_sp = sp - 2; /* '-2' for beginning / and * */ + *sizp = 0; + } + if (g_internal_data->keep_comments) /* If writing comments */ + mcpp_fputs( "/*", DEST_OUT); /* Write the initializer*/ + c = *sp++; + + while (1) { /* Eat a comment */ + if (g_internal_data->keep_comments) + mcpp_fputc( c, DEST_OUT); + + switch (c) { + case '/': + if ((c = *sp++) != '*') /* Don't let comments */ + continue; /* nest. */ + if (g_internal_data->warn_level & 1) + cwarn( "\"/*\" within comment", NULL, 0L, NULL); /* _W1_ */ + if (g_internal_data->keep_comments) + mcpp_fputc( c, DEST_OUT); + /* Fall into * stuff */ + case '*': + if ((c = *sp++) != '/') /* If comment doesn't */ + continue; /* end, look at next. */ + if (g_internal_data->keep_comments) { /* Put out comment */ + mcpp_fputc( c, DEST_OUT); /* terminator, too. */ + mcpp_fputc( '\n', DEST_OUT); /* Append '\n' to avoid */ + /* trouble on some other tools such as rpcgen. */ + g_internal_data->wrong_line = TRUE; + } + if (g_internal_data->keep_spaces) /* Save the length */ + *sizp = *sizp + (sp - saved_sp); + if ((g_internal_data->mcpp_debug & MACRO_CALL) && compiling) { + if (cat_line) { + cat_line++; + com_cat_line.len[ cat_line] /* Catenated length */ + = com_cat_line.len[ cat_line - 1] + + strlen( g_internal_data->infile->buffer) - 1; + /* '-1' for '\n' */ + com_cat_line.last_line = g_internal_data->src_line; + } + } + return sp; /* End of comment */ + case '\n': /* Line-crossing comment*/ + if (g_internal_data->keep_spaces) /* Save the length */ + *sizp = *sizp + (sp - saved_sp) - 1; /* '-1' for '\n' */ + if ((g_internal_data->mcpp_debug & MACRO_CALL) && compiling) { + /* Save location informations */ + if (cat_line == 0) /* First line of catenation */ + com_cat_line.start_line = g_internal_data->src_line; + if (cat_line >= MAX_CAT_LINE - 1) { + *sizp = 0; /* Discard the too long comment */ + cat_line = 0; + if (g_internal_data->warn_level & 4) + cwarn( + "Too long comment, discarded up to here" /* _W4_ */ + , NULL, 0L, NULL); + } + cat_line++; + com_cat_line.len[ cat_line] + = com_cat_line.len[ cat_line - 1] + + strlen( g_internal_data->infile->buffer) - 1; + } + if ((saved_sp = sp = get_line( TRUE)) == NULL) + return NULL; /* End of file within comment */ + /* Never happen, because at_eof() supplement closing*/ + g_internal_data->wrong_line = TRUE; /* We'll need a #line later */ + break; + default: /* Anything else is */ + break; /* just a character */ + } /* End switch */ + + c = *sp++; + } /* End comment loop */ + + return sp; /* Never reach here */ +} + +static char * mcpp_fgets( + char * s, + int size, + SIOHandle * stream +) +{ + return pk_fgets( s, size, stream); +} + +static char * get_line( + int in_comment +) +/* + * ANSI (ISO) C: translation phase 1, 2. + * Get the next logical line from source file. + * Convert [CR+LF] to [LF]. + */ +{ +#if COMPILER == INDEPENDENT +#define cr_warn_level 1 +#else +#define cr_warn_level 2 +#endif + static int cr_converted; + int converted = FALSE; + int len; /* Line length - alpha */ + char * ptr; + int cat_line = 0; /* Number of catenated lines */ + + if (g_internal_data->infile == NULL) /* End of a source file */ + return NULL; + ptr = g_internal_data->infile->bptr = g_internal_data->infile->buffer; + if ((g_internal_data->mcpp_debug & MACRO_CALL) && g_internal_data->src_line == 0) /* Initialize */ + com_cat_line.last_line = bsl_cat_line.last_line = 0L; + + while (mcpp_fgets( ptr, (int) (g_internal_data->infile->buffer + NBUFF - ptr), g_internal_data->infile->fp) + != NULL) { + /* Translation phase 1 */ + g_internal_data->src_line++; /* Gotten next physical line */ + if (g_internal_data->standard && g_internal_data->src_line == g_internal_data->std_limits.line_num + 1 + && (g_internal_data->warn_level & 1)) + cwarn( "Line number %.0s\"%ld\" got beyond range" /* _W1_ */ + , NULL, g_internal_data->src_line, NULL); + if (g_internal_data->mcpp_debug & (TOKEN | GETC)) { /* Dump it to DEST_DBG */ + mcpp_fprintf( DEST_DBG, "\n#line %ld (%s)", g_internal_data->src_line, g_internal_data->cur_fullname); + dump_string( NULL, ptr); + } + len = (int)strlen( ptr); + if (NBUFF - 1 <= ptr - g_internal_data->infile->buffer + len + && *(ptr + len - 1) != '\n') { + /* The line does not yet end, though the buffer is full. */ + if (NBUFF - 1 <= len) + cfatal( "Too long source line" /* _F_ */ + , NULL, 0L, NULL); + else + cfatal( "Too long logical line" /* _F_ */ + , NULL, 0L, NULL); + } + if (*(ptr + len - 1) != '\n') /* Unterminated source line */ + break; + if (len >= 2 && *(ptr + len - 2) == '\r') { /* [CR+LF] */ + *(ptr + len - 2) = '\n'; + *(ptr + --len) = EOS; + if (! cr_converted && (g_internal_data->warn_level & cr_warn_level)) { + cwarn( "Converted [CR+LF] to [LF]" /* _W1_ _W2_ */ + , NULL, 0L, NULL); + cr_converted = TRUE; + } + } + if (g_internal_data->standard) { + if (g_internal_data->option_flags.trig) + converted = cnv_trigraph( ptr); + if (g_internal_data->mcpp_mode == POST_STD && g_internal_data->option_flags.dig) + converted += cnv_digraph( ptr); + if (converted) + len = (int)strlen( ptr); + /* Translation phase 2 */ + len -= 2; + if (len >= 0) { + if ((*(ptr + len) == '\\') && ! last_is_mbchar( ptr, len)) { + /* (not MBCHAR) */ + ptr = g_internal_data->infile->bptr += len; /* Splice the lines */ + g_internal_data->wrong_line = TRUE; + if ((g_internal_data->mcpp_debug & MACRO_CALL) && compiling) { + /* Save location informations */ + if (cat_line == 0) /* First line of catenation */ + bsl_cat_line.start_line = g_internal_data->src_line; + if (cat_line < MAX_CAT_LINE) + /* Record the catenated length */ + bsl_cat_line.len[ ++cat_line] + = strlen( g_internal_data->infile->buffer) - 2; + /* Else ignore */ + } + continue; + } + } +#if NBUFF-2 > SLEN90MIN + if (ptr - g_internal_data->infile->buffer + len + 2 > g_internal_data->std_limits.str_len + 1 + && (g_internal_data->warn_level & 4)) /* +1 for '\n' */ + cwarn( "Logical source line longer than %.0s%ld bytes" /* _W4_ */ + , NULL, g_internal_data->std_limits.str_len, NULL); +#endif + } + if ((g_internal_data->mcpp_debug & MACRO_CALL) && compiling) { + if (cat_line && cat_line < MAX_CAT_LINE) { + bsl_cat_line.len[ ++cat_line] = strlen( g_internal_data->infile->buffer) - 1; + /* Catenated length: '-1' for '\n' */ + bsl_cat_line.last_line = g_internal_data->src_line; + } + } + return g_internal_data->infile->bptr = g_internal_data->infile->buffer; /* Logical line */ + } + + /* End of a (possibly included) source file */ + if (pk_ferror( g_internal_data->infile->fp)) + cfatal( "File read error", NULL, 0L, NULL); /* _F_ */ + if ((ptr = at_eof( in_comment)) != NULL) /* Check at end of file */ + return ptr; /* Partial line supplemented */ + if (g_internal_data->option_flags.z) { + g_internal_data->no_output--; /* End of included file */ + g_internal_data->keep_comments = g_internal_data->option_flags.c && compiling && !g_internal_data->no_output; + } + return NULL; +} + +#define TRIOFFSET 10 + +int cnv_trigraph( + char * in +) +/* + * Perform in-place trigraph replacement on a physical line. This was added + * to the C90. In an input text line, the sequence ??[something] is + * transformed to a character (which might not appear on the input keyboard). + */ +{ + const char * const tritext = "=(/)'-\0#[\\]^{|}~"; + /* ^ ^ + * +----------+ + * this becomes this + */ + int count = 0; + const char * tp; + + while ((in = strchr( in, '?')) != NULL) { + if (*++in != '?') + continue; + while (*++in == '?') + ; + if ((tp = strchr( tritext, *in)) == NULL) + continue; + *(in - 2) = *(tp + TRIOFFSET); + in--; + memmove( in, in + 2, strlen( in + 1)); + count++; + } + + if (count && (g_internal_data->warn_level & 16)) + cwarn( "%.0s%ld trigraph(s) converted" /* _W16_ */ + , NULL, (long) count, NULL); + return count; +} + +int cnv_digraph( + char * in +) +/* + * Perform in-place digraph replacement on a physical line. + * Called only in POST_STD mode. + */ +{ + int count = 0; + int i; + int c1, c2; + + while ((i = (int)strcspn( in, "%:<")), (c1 = *(in + i)) != '\0') { + in += i + 1; + c2 = *in; + switch (c1) { + case '%' : + switch (c2) { + case ':' : *(in - 1) = '#'; break; + case '>' : *(in - 1) = '}'; break; + default : continue; + } + break; + case ':' : + switch (c2) { + case '>' : *(in - 1) = ']'; break; + default : continue; + } + break; + case '<' : + switch (c2) { + case '%' : *(in - 1) = '{'; break; + case ':' : *(in - 1) = '['; break; + default : continue; + } + break; + } + memmove( in, in + 1, strlen( in)); + count++; + } + + if (count && (g_internal_data->warn_level & 16)) + cwarn( "%.0s%ld digraph(s) converted" /* _W16_ */ + , NULL, (long) count, NULL); + return count; +} + +static char * at_eof( + int in_comment +) +/* + * Check the partial line, unterminated comment, unbalanced #if block, + * uncompleted macro call at end of a file or at end of input. + * Supplement the line terminator, if possible. + * Return the supplemented line or NULL on unrecoverable error. + */ +{ + const char * const format + = "End of %s with %.0ld%s"; /* _E_ _W1_ */ + const char * const unterm_if_format += "End of %s within #if (#ifdef) section started at line %ld"; /* _E_ _W1_ */ + const char * const unterm_macro_format + = "End of %s within macro call started at line %ld";/* _E_ _W1_ */ + const char * const input + = g_internal_data->infile->parent ? "file" : "input"; /* _E_ _W1_ */ + const char * const no_newline + = "no newline, supplemented newline"; /* _W1_ */ + const char * const unterm_com + = "unterminated comment, terminated the comment"; /* _W1_ */ + const char * const backsl = "\\, deleted the \\"; /* _W1_ */ + const char * const unterm_asm_format += "End of %s with unterminated #asm block started at line %ld"; /* _E_ _W1_ */ + size_t len; + char * cp; + + cp = g_internal_data->infile->buffer; + len = strlen( cp); + if (len && *(cp += (len - 1)) != '\n') { + *++cp = '\n'; /* Supplement */ + *++cp = EOS; + if (g_internal_data->mcpp_mode != OLD_PREP && (g_internal_data->warn_level & 1)) + cwarn( format, input, 0L, no_newline); + return g_internal_data->infile->bptr = g_internal_data->infile->buffer; + } + if (g_internal_data->standard && g_internal_data->infile->buffer < g_internal_data->infile->bptr) { + /* No line after */ + cp = g_internal_data->infile->bptr; + *cp++ = '\n'; /* Delete the \\ */ + *cp = EOS; + if (g_internal_data->warn_level & 1) + cwarn( format, input, 0L, backsl); + return g_internal_data->infile->bptr = g_internal_data->infile->buffer; + } + if (in_comment) { /* End of file within a comment */ + if (g_internal_data->mcpp_mode != OLD_PREP && (g_internal_data->warn_level & 1)) + cwarn( format, input, 0L, unterm_com); + /* The partial comment line has been already read by */ + /* read_a_comment(), so supplement the next line. */ + strcpy( g_internal_data->infile->buffer, "*/\n"); + return g_internal_data->infile->bptr = g_internal_data->infile->buffer; + } + + if (g_internal_data->infile->initif < g_internal_data->ifptr) { + IFINFO * ifp = g_internal_data->infile->initif + 1; + if (g_internal_data->standard) { + cerror( unterm_if_format, input, ifp->ifline, NULL); + g_internal_data->ifptr = g_internal_data->infile->initif; /* Clear information of */ + compiling = g_internal_data->ifptr->stat; /* erroneous grouping */ + } else if (g_internal_data->mcpp_mode == KR && (g_internal_data->warn_level & 1)) { + cwarn( unterm_if_format, input, ifp->ifline, NULL); + } + } + + if (g_internal_data->macro_line != 0 && g_internal_data->macro_line != MACRO_ERROR + && ((g_internal_data->mcpp_mode == STD && g_internal_data->in_getarg) || ! g_internal_data->standard)) { + if (g_internal_data->standard) { + cerror( unterm_macro_format, input, g_internal_data->macro_line, NULL); + g_internal_data->macro_line = MACRO_ERROR; + } else if (g_internal_data->warn_level & 1) { + cwarn( unterm_macro_format, input, g_internal_data->macro_line, NULL); + } + } + + if (g_internal_data->in_asm && g_internal_data->mcpp_mode == KR && (g_internal_data->warn_level & 1)) + cwarn( unterm_asm_format, input, g_internal_data->in_asm, NULL); + + return NULL; +} + +void unget_ch( void) +/* + * Back the pointer to reread the last character. Fatal error (code bug) + * if we back too far. unget_ch() may be called, without problems, at end of + * file. Only one character may be ungotten. If you need to unget more, + * call unget_string(). + */ +{ + if (in_token) { + g_internal_data->infile->bptr--; + return; + } + + if (g_internal_data->infile != NULL) { + if (g_internal_data->mcpp_mode == POST_STD && g_internal_data->infile->fp) { + switch (g_internal_data->insert_sep) { + case INSERTED_SEP: /* Have just read an inserted separator */ + g_internal_data->insert_sep = INSERT_SEP; + return; + case INSERT_SEP: + cfatal( "Bug: unget_ch() just after scan_token()" /* _F_ */ + , NULL, 0L, NULL); + break; + default: + break; + } + } + --g_internal_data->infile->bptr; + if (g_internal_data->infile->bptr < g_internal_data->infile->buffer) /* Shouldn't happen */ + cfatal( "Bug: Too much pushback", NULL, 0L, NULL); /* _F_ */ + } + + if (g_internal_data->mcpp_debug & GETC) + dump_unget( "after unget"); +} + +FILEINFO * unget_string( + const char * text, /* Text to unget */ + const char * name /* Name of the macro, if any*/ +) +/* + * Push a string back on the input stream. This is done by treating + * the text as if it were a macro or a file. + */ +{ + FILEINFO * file; + size_t size; + + if (text) + size = strlen( text) + 1; + else + size = 1; + file = get_file( name, NULL, NULL, size, FALSE); + if (text) + memcpy( file->buffer, text, size); + else + *file->buffer = EOS; + return file; +} + +char * save_string( + const char * text +) +/* + * Store a string into free memory. + */ +{ + char * result; + size_t size; + + size = strlen( text) + 1; + result = xmalloc( size); + memcpy( result, text, size); + return result; +} + +FILEINFO * get_file( + const char * name, /* File or macro name */ + const char * src_dir, /* Source file directory*/ + const char * fullname, /* Full path list */ + size_t bufsize, /* Line buffer size */ + int include_opt /* Specified by -include opt (for GCC) */ +) +/* + * Common FILEINFO buffer initialization for a new file or macro. + */ +{ + FILEINFO * file; + + file = (FILEINFO *) xmalloc( sizeof (FILEINFO)); + file->buffer = xmalloc( bufsize); + file->bptr = file->buffer; /* Initialize line ptr */ + file->buffer[ 0] = EOS; /* Force first read */ + file->line = 0L; /* (Not used just yet) */ + file->fp = NULL; /* No file yet */ + file->pos = 0L; /* No pos to remember */ + file->parent = g_internal_data->infile; /* Chain files together */ + file->initif = g_internal_data->ifptr; /* Initial ifstack */ + file->include_opt = include_opt; /* Specified by -include*/ + file->dirp = NULL; /* No include dir yet */ + file->real_fname = name; /* Save file/macro name */ + file->full_fname = fullname; /* Full path list */ + if (name) { + file->filename = xmalloc( strlen( name) + 1); + strcpy( file->filename, name); /* Copy for #line */ + } else { + file->filename = NULL; + } + if (src_dir) { + file->src_dir = xmalloc( strlen( src_dir) + 1); + strcpy( (char*)file->src_dir, src_dir); + } else { + file->src_dir = NULL; + } +#if MCPP_LIB + file->last_fputc = mcpp_lib_fputc; + file->last_fputs = mcpp_lib_fputs; + file->last_fprintf = mcpp_lib_fprintf; +#endif + if (g_internal_data->infile != NULL) { /* If #include file */ + g_internal_data->infile->line = g_internal_data->src_line; /* Save current line */ +#if MCPP_LIB + g_internal_data->infile->last_fputc = mcpp_fputc; + g_internal_data->infile->last_fputs = mcpp_fputs; + g_internal_data->infile->last_fprintf = mcpp_fprintf; +#endif + } + g_internal_data->infile = file; /* New current file */ + + return file; /* All done. */ +} + +static const char * const out_of_memory + = "Out of memory (required size is %.0s0x%lx bytes)"; /* _F_ */ + +char * +(xmalloc)( + size_t size +) +/* + * Get a block of free memory. + */ +{ + char * result; + + if ((result = (char *) malloc( size)) == NULL) { + if (g_internal_data->mcpp_debug & MEMORY) + print_heap(); + cfatal( out_of_memory, NULL, (long) size, NULL); + } + return result; +} + +char * (xrealloc)( + char * ptr, + size_t size +) +/* + * Reallocate malloc()ed memory. + */ +{ + char * result; + + if ((result = (char *) realloc( ptr, size)) == NULL && size != 0) { + /* 'size != 0' is necessary to cope with some */ + /* implementation of realloc( ptr, 0) which returns NULL. */ + if (g_internal_data->mcpp_debug & MEMORY) + print_heap(); + cfatal( out_of_memory, NULL, (long) size, NULL); + } + return result; +} + +LINE_COL * get_src_location( + LINE_COL * p_line_col /* Line and column on phase 4 */ +) +/* + * Convert line-column datum of just after translation phase 3 into that of + * phase 2, tracing back line splicing by a comment and . + * Note: This conversion does not give correct datum on a line catenated by + * both of and line-crossing-comment at the same time. + * + * com_cat_line and bsl_cat_line have data only on last catenated line. + * com_cat_line.len[] and bsl_cat_line.len[] have the length of catenated + * line, and len[ 0] is always 0, followed by len[ 1], len[ 2], ..., as + * accumulated length of successively catenated lines. + */ +{ + long line; + size_t col; + size_t * cols; + CAT_LINE * l_col_p; + int i; + + line = p_line_col->line; + col = p_line_col->col; + + for (i = 0; i <= 1; i++) { + l_col_p = i ? & bsl_cat_line : & com_cat_line; + if (l_col_p->last_line != line) + continue; + /* Else just catenated line */ + cols = l_col_p->len + 1; + while (*cols < col) + cols++; + if (col <= *cols) { + cols--; + col -= *cols; + } + line = l_col_p->start_line + (long)(cols - l_col_p->len); + } + + p_line_col->line = line; + p_line_col->col = col + 1; + /* col internally start at 0, output start at 1 */ + + return p_line_col; +} + +static void put_line( + char * out, + SIOHandle * fp +) +/* + * Put out a logical source line. + * This routine is called only in OLD_PREP mode. + */ +{ + int c; + + while ((c = *out++) != EOS) { + if (c != COM_SEP) /* Skip 0-length comment */ + mcpp_fputc( c, FP2DEST( fp)); + } +} + +static void do_msg( + const char * severity, /* "fatal", "error", "warning" */ + const char * format, /* Format for the error message */ + const char * arg1, /* String arg. for the message */ + long arg2, /* Integer argument */ + const char * arg3 /* Second string argument */ +) +/* + * Print filenames, macro names, line numbers and error messages. + * Also print macro definitions on macro expansion problems. + */ +{ + FILEINFO * file; + DEFBUF * defp; + int i; + size_t slen; + const char * arg_s[ 2]; + char * arg_t[ 2]; + char * tp; + const char * sp; + int c; + int ind; + + pk_fflush( g_internal_data->fp_out); /* Synchronize output and diagnostics */ + arg_s[ 0] = arg1; arg_s[ 1] = arg3; + + for (i = 0; i < 2; i++) { /* Convert special characters to visible */ + sp = arg_s[ i]; + if (sp != NULL) + slen = strlen( sp) + 1; + else + slen = 1; + tp = arg_t[ i] = (char *) malloc( slen); + /* Don't use xmalloc() so as not to cause infinite recursion */ + if (sp == NULL || *sp == EOS) { + *tp = EOS; + continue; + } + + while ((c = *sp++) != EOS) { + switch (c) { + case TOK_SEP: + if (g_internal_data->mcpp_mode == OLD_PREP) /* COM_SEP */ + break; /* Skip magic characters */ + /* Else fall through */ + case RT_END: + case CAT: + case ST_QUOTE: + case DEF_MAGIC: + if (! g_internal_data->standard) + *tp++ = ' '; + break; /* Skip the magic characters*/ + case IN_SRC: + if (! g_internal_data->standard) + *tp++ = ' '; + if ((g_internal_data->mcpp_debug & MACRO_CALL) && ! g_internal_data->in_directive) + sp += 2; /* Skip two more bytes */ + break; + case MAC_INF: + if (g_internal_data->mcpp_mode != STD) { + *tp++ = ' '; + /* Illegal control character, convert to a space*/ + } else { + switch (*sp++) { /* Skip the magic characters*/ + case MAC_ARG_START : + sp++; + /* Fall through */ + case MAC_CALL_START : + sp += 2; + break; + case MAC_ARG_END : + if (! g_internal_data->option_flags.v) + break; + else + sp++; + /* Fall through */ + case MAC_CALL_END : + if (g_internal_data->option_flags.v) + sp += 2; + break; + } + } + break; + case '\n': + *tp++ = ' '; /* Convert '\n' to a space */ + break; + default: + *tp++ = (char)c; + break; + } + } + + if (*(sp - 2) == '\n') + tp--; + *tp = EOS; + } + + /* Print source location and diagnostic */ + file = g_internal_data->infile; + while (file != NULL && (file->fp == NULL || file->fp == (SIOHandle *)-1)) + file = file->parent; /* Skip macro */ + if (file != NULL) { + file->line = g_internal_data->src_line; + mcpp_fprintf( DEST_ERR, "%s:%ld: %s: ", g_internal_data->cur_fullname, g_internal_data->src_line, severity); + } + mcpp_fprintf( DEST_ERR, format, arg_t[ 0], arg2, arg_t[ 1]); + mcpp_fputc( '\n', DEST_ERR); + if (g_internal_data->option_flags.no_source_line) + goto free_arg; + + /* Print source line, includers and expanding macros */ + file = g_internal_data->infile; + if (file != NULL && file->fp != NULL) { + if (g_internal_data->mcpp_mode == OLD_PREP) { + mcpp_fputs( " ", DEST_ERR); + put_line( file->buffer, g_internal_data->fp_err); + } else { + mcpp_fprintf( DEST_ERR, " %s", file->buffer); + /* Current source line */ + } + file = file->parent; + } + while (file != NULL) { /* Print #includes, too */ + if (file->fp == NULL) { /* Macro */ + if (file->filename) { + defp = look_id( file->filename); + if ((defp->nargs > DEF_NOARGS_STANDARD) + && ! (file->parent && file->parent->filename + && str_eq( file->filename, file->parent->filename))) + /* If the name is not duplicate of parent */ + dump_a_def( " macro", defp, FALSE, TRUE, g_internal_data->fp_err); + } + } else { /* Source file */ + if (file->buffer[ 0] == '\0') + strcpy( file->buffer, "\n"); + if (g_internal_data->mcpp_mode != OLD_PREP) { + mcpp_fprintf( DEST_ERR, " from %s: %ld: %s", + file->line ? file->full_fname /* Full-path-list */ + : "", /* Included by -include */ + file->line, /* Current line number */ + file->buffer); /* The source line */ + } else { + mcpp_fprintf( DEST_ERR, " from %s: %ld: ", file->full_fname + , file->line); + put_line( file->buffer, g_internal_data->fp_err); + } + } + file = file->parent; + } + + if (! g_internal_data->macro_name) + goto free_arg; + /* Additional information of macro definitions */ + expanding_macro[ 0].name = g_internal_data->macro_name; + for (ind = 0; ind <= exp_mac_ind; ind++) { + int ind_done; + + for (ind_done = 0; ind_done < ind; ind_done++) + if (str_eq( expanding_macro[ ind].name + , expanding_macro[ ind_done].name)) + break; /* Already reported */ + if (ind_done < ind) + continue; + for (file = g_internal_data->infile; file; file = file->parent) + if (file->fp == NULL && file->filename + && str_eq( expanding_macro[ ind].name, file->filename)) + break; /* Already reported */ + if (file) + continue; + if ((defp = look_id( expanding_macro[ ind].name)) != NULL) { + if (defp->nargs <= DEF_NOARGS_STANDARD) + continue; /* Standard predefined */ + dump_a_def( " macro", defp, FALSE, TRUE, g_internal_data->fp_err); + /* Macro already read over */ + } + } + +free_arg: + for (i = 0; i < 2; i++) + free( arg_t[ i]); +} + +void cfatal( + const char * format, + const char * arg1, + long arg2, + const char * arg3 +) +/* + * A real disaster. + */ +{ + do_msg( "fatal error", format, arg1, arg2, arg3); + longjmp( g_internal_data->error_exit, -1); +} + +void cerror( + const char * format, + const char * arg1, + long arg2, + const char * arg3 +) +/* + * Print a error message. + */ +{ + do_msg( "error", format, arg1, arg2, arg3); + g_internal_data->errors++; +} + +void cwarn( + const char * format, + const char * arg1, + long arg2, + const char * arg3 +) +/* + * Maybe an error. + */ +{ + do_msg( "warning", format, arg1, arg2, arg3); +} + +void dump_string( + const char * why, + const char * text +) +/* + * Dump text readably. + * Bug: macro argument number may be putout as a control character or any + * other character, just after MAC_PARM has been read away. + */ +{ + const char * cp; + const char * chr; + int c, c1, c2; + + if (why != NULL) + mcpp_fprintf( DEST_DBG, " (%s)", why); + mcpp_fputs( " => ", DEST_DBG); + + if (text == NULL) { + mcpp_fputs( "NULL", DEST_DBG); + return; + } + + for (cp = text; (c = *cp++ & UCHARMAX) != EOS; ) { + chr = NULL; + + switch (c) { + case MAC_PARM: + c = *cp++ & UCHARMAX; /* Macro parameter number */ + mcpp_fprintf( DEST_DBG, "<%d>", c); + break; + case MAC_INF: + if (! (g_internal_data->mcpp_mode == STD && (g_internal_data->mcpp_debug & MACRO_CALL))) + goto no_magic; + /* Macro informations inserted by -K option */ + c2 = *cp++ & UCHARMAX; + if (g_internal_data->option_flags.v || c2 == MAC_CALL_START + || c2 == MAC_ARG_START) { + c = ((*cp++ & UCHARMAX) - 1) * UCHARMAX; + c += (*cp++ & UCHARMAX) - 1; + } + switch (c2) { + case MAC_CALL_START: + mcpp_fprintf( DEST_DBG, "", c); + break; + case MAC_CALL_END: + if (g_internal_data->option_flags.v) + mcpp_fprintf( DEST_DBG, "", c); + else + chr = ""; + break; + case MAC_ARG_START: + c1 = *cp++ & UCHARMAX; + mcpp_fprintf( DEST_DBG, "", c, c1 - 1); + break; + case MAC_ARG_END: + if (g_internal_data->option_flags.v) { + c1 = *cp++ & UCHARMAX; + mcpp_fprintf( DEST_DBG, "", c, c1 - 1); + } else { + chr = ""; + } + break; + } + break; + case DEF_MAGIC: + if (g_internal_data->standard) { + chr = ""; + break; + } /* Else fall through */ + case CAT: + if (g_internal_data->standard) { + chr = "##"; + break; + } /* Else fall through */ + case ST_QUOTE: + if (g_internal_data->standard) { + chr = "#"; + break; + } /* Else fall through */ + case RT_END: + if (g_internal_data->standard) { + chr = ""; + break; + } /* Else fall through */ + case IN_SRC: + if (g_internal_data->standard) { + if ((g_internal_data->mcpp_debug & MACRO_CALL) && ! g_internal_data->in_directive) { + int num; + num = ((*cp++ & UCHARMAX) - 1) * UCHARMAX; + num += (*cp++ & UCHARMAX) - 1; + mcpp_fprintf( DEST_DBG, "", num); + } else { + chr = ""; + } + } else { /* Control character */ + mcpp_fprintf( DEST_DBG, "<^%c>", c + '@'); + } + break; + case TOK_SEP: + if (g_internal_data->mcpp_mode == STD) { + chr = ""; + break; + } else if (g_internal_data->mcpp_mode == OLD_PREP) { /* COM_SEP */ + chr = ""; + break; + } /* Else fall through */ + default: +no_magic: + if (c < ' ') + mcpp_fprintf( DEST_DBG, "<^%c>", c + '@'); + else + mcpp_fputc( c, DEST_DBG); + break; + } + + if (chr) + mcpp_fputs( chr, DEST_DBG); + } + + mcpp_fputc( '\n', DEST_DBG); +} + +void dump_unget( + const char * why +) +/* + * Dump all ungotten junk (pending macros and current input lines). + */ +{ + const FILEINFO * file; + + mcpp_fputs( "dump of pending input text", DEST_DBG); + if (why != NULL) { + mcpp_fputs( "-- ", DEST_DBG); + mcpp_fputs( why, DEST_DBG); + } + mcpp_fputc( '\n', DEST_DBG); + + for (file = g_internal_data->infile; file != NULL; file = file->parent) + dump_string( file->real_fname ? file->real_fname + : file->filename ? file->filename : "NULL", file->bptr); +} + +static void dump_token( + int token_type, + const char * cp /* Token */ +) +/* + * Dump a token. + */ +{ + static const char * const t_type[] + = { "NAM", "NUM", "STR", "WSTR", "CHR", "WCHR", "OPE", "SPE" + , "SEP", }; + + mcpp_fputs( "token", DEST_DBG); + dump_string( t_type[ token_type - NAM], cp); +} + +#if defined(PK_COMPILER_MSVC) +# pragma warning( pop ) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic pop +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic pop +#endif diff --git a/Samples/PK-MCPP/system.cpp b/Samples/PK-MCPP/system.cpp new file mode 100644 index 00000000..3f23678f --- /dev/null +++ b/Samples/PK-MCPP/system.cpp @@ -0,0 +1,4783 @@ +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * S Y S T E M . C + * S y s t e m D e p e n d e n t R o u t i n e s + * + * Routines dependent on O.S., compiler or compiler-driver. + * To port MCPP for the systems not yet ported, you must + * 1. specify the constants in "configed.h" or "noconfig.h", + * 2. append the system-dependent routines in this file. + */ + +#include "precompiled.h" +#include "pk_mcpp_bridge.h" + +#if HOST_SYS_FAMILY == SYS_UNIX +#include "unistd.h" /* For getcwd(), readlink() */ +#elif HOST_COMPILER == MSC || HOST_COMPILER == LCC +#include "direct.h" +#elif HOST_COMPILER == BORLANDC +#include "dir.h" +#endif + +#if defined(PK_COMPILER_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4101) +# pragma warning( disable : 4100) +# pragma warning( disable : 4102) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunused-parameter" +# pragma clang diagnostic ignored "-Wunused-variable" +# pragma clang diagnostic ignored "-Wunused-label" +# pragma clang diagnostic ignored "-Wwrite-strings" +# pragma clang diagnostic ignored "-Wimplicit-fallthrough" +# pragma clang diagnostic ignored "-Wundef" +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wunused-label" +# pragma GCC diagnostic ignored "-Wwrite-strings" +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +# pragma GCC diagnostic ignored "-Wundef" +#endif + +#include "sys/types.h" +#include "sys/stat.h" /* For stat() */ +#if ! defined( S_ISREG) +#define S_ISREG( mode) (mode & S_IFREG) +#define S_ISDIR( mode) (mode & S_IFDIR) +#endif +#if HOST_COMPILER == MSC +#define S_IFREG _S_IFREG +#define S_IFDIR _S_IFDIR +#endif + +/* Function to compare path-list */ +#if FNAME_FOLD +#if HOST_COMPILER == GNUC /* CYGWIN, MINGW, MAC */ +#include /* POSIX 1, 2001 */ +#define str_case_eq( str1, str2) (strcasecmp( str1, str2) == 0) +#else /* MSC, BORLANDC, LCC */ +#if HOST_COMPILER == MSC +#define stricmp( str1, str2) _stricmp( str1, str2) +#endif +#define str_case_eq( str1, str2) (stricmp( str1, str2) == 0) +#endif +#else /* ! FNAME_FOLD */ +#define str_case_eq( str1, str2) (strcmp( str1, str2) == 0) +#endif + +/* + * PATH_DELIM is defined for the O.S. which has single byte path-delimiter. + * Note: '\\' or any other character identical to second byte of MBCHAR should + * not be used for PATH_DELIM for convenience of path-list parsing. + */ +#if SYS_FAMILY == SYS_UNIX || SYS_FAMILY == SYS_WIN || SYSTEM == SYS_UNKNOWN +#define PATH_DELIM '/' +#define SPECIAL_PATH_DELIM FALSE +#else /* Any other path-delimiter, define PATH_DELIM by yourself */ +#define SPECIAL_PATH_DELIM TRUE /* Any path-delimiter other than '/' */ +#endif + +/* + * OBJEXT is the suffix to denote "object" file. + */ +#ifndef OBJEXT +#if SYS_FAMILY == SYS_UNIX || HOST_COMPILER == GNUC +#define OBJEXT "o" +#elif SYS_FAMILY == SYS_WIN +#define OBJEXT "obj" +#elif 1 +/* Add here appropriate definitions for other systems. */ +#endif +#endif + +static void version( void); + /* Print version message */ +static void usage( int opt); + /* Putout usage of MCPP */ +static void set_opt_list( char * optlist); + /* Set list of legal option chars */ +static int parse_warn_level( const char * mcpp_optarg, int opt); + /* Parse warning level option */ +static void def_a_macro( int opt, char * def); + /* Do a -D option */ +static void chk_opts( int sflag, int trad); + /* Check consistency of options */ +#if COMPILER != GNUC +static void init_cpu_macro( int gval, int sse); + /* Predefine CPU-dependent macros */ +#endif +static void init_predefines( void); + /* Set and unset predefined macros */ +static void init_std_defines( void); + /* Predefine Standard macros */ +static void set_limit( void); + /* Set minimum translation limits */ +static void set_pragma_op( void); + /* Set the _Pragma() operator */ +static void put_info( FILEINFO * sharp_file); + /* Print compiler-specific-inf */ +static char * set_files( int argc, char ** argv, char ** in_pp + , char ** out_pp); + /* Set input, output, diagnostic */ +static void set_sys_dirs( int set_cplus_dir); + /* Set system-specific include dirs */ +static void set_env_dirs( void); + /* Set user-defined include dirs */ +static void parse_env( const char * env); + /* Parse environment variables */ +static void set_a_dir( const char * dirname); + /* Append an include directory */ +static char * norm_dir( const char * dirname, int framework); + /* Normalize include directory path */ +static char * norm_path( const char * dir, const char * fname, int inf + , int hmap); /* Normalize pathname to compare */ +#if SYS_FAMILY == SYS_UNIX +static void deref_syml( char * slbuf1, char * slbuf2, char * chk_start); + /* Dereference symbolic linked directory and file */ +#endif +#if COMPILER == GNUC +static void init_gcc_macro( void); + /* Predefine GCC-specific macros */ +static void chk_env( void); + /* Check the environment variables */ +#elif COMPILER == MSC +static void init_msc_macro( void); + /* Predefine Visual C-specific macros */ +#endif +static void def_macros( void); + /* Define macros specified by -D */ +static void undef_macros( void); + /* Undefine macros specified by -U */ +static char * md_init( const char * filename, char * output); + /* Initialize makefile dependency */ +static char * md_quote( char * output); + /* 'Quote' special characters */ +static int open_include( char * filename, int searchlocal, int next); + /* Open the file to include */ +static int has_directory( const char * source, char * directory); + /* Get directory part of fname */ +static int is_full_path( const char * path); + /* The path is absolute path list ? */ +static int search_dir( char * filename, int searchlocal, int next); + /* Search the include directories */ +static int open_file( const char ** dirp, const char * src_dir + , const char * filename, int local, int include_opt, int sys_frame); + /* Open a source file */ +static const char * set_fname( const char * filename); + /* Remember the source filename */ +#if SYSTEM == SYS_MAC +#if COMPILER == GNUC +static char * search_header_map( const char * hmap_file + , const char * filename, char * pathlist); + /* Search header map file for a header */ +static unsigned hmap_hash( const char * fname); + /* Get hash value for the fname */ +#endif +static void init_framework( void); + /* Initialize framework[] */ +static int search_framework( char * filename); + /* Search "Framework" directories */ +static int search_subdir( char * fullname, char * cp, char * frame + , char * fname, int sys_frame); + /* Search "Headers" and other dirs */ +#endif /* SYSTEM == SYS_MAC */ +#if 0 /* This function is only for debugging use */ +static int chk_dirp( const char ** dirp); + /* Check validity of dirp arg for open_file() */ +#endif +static void cur_file( FILEINFO * file, FILEINFO * sharp_file, int marker); + /* Output current source file name */ +#if SYS_FAMILY == SYS_WIN +static char * bsl2sl( char * filename); + /* Convert \ to / in path-list */ +#endif +static int is_junk( void); + /* The directive has trailing junk? */ +static void do_once( const char * fullname); + /* Process #pragma once */ +static int included( const char * fullname); + /* The file has been once included? */ +static void push_or_pop( int direction); + /* Push or pop a macro definition */ +static int do_prestd_directive( void); + /* Process pre-Standard directives */ +static void do_preprocessed( void); + /* Process preprocessed file */ +static int do_debug( int set); + /* #pragma MCPP debug, #debug */ +static void dump_path( void); + /* Print include search path */ +static void do_asm( int asm_start); + /* Process #asm, #endasm */ +static int mcpp_getopt( int argc, char * const * argv, const char * opts); + /* getopt() to prevent linking of glibc getopt */ + +#define OPTLISTLEN 80 + +void do_options( + int argc, + char ** argv, + char ** in_pp, /* Input file name */ + char ** out_pp /* Output file name */ +) +/* + * Process command line arguments, called only at MCPP startup. + */ +{ + char optlist[ OPTLISTLEN]; /* List of option letter*/ + const char * warning = "warning: -%c%s option is ignored\n"; + int opt; + int unset_sys_dirs; + /* Unset system-specific and site-specific include directories ? */ + int set_cplus_dir; /* Set C++ include directory ? (for GCC)*/ + int show_path; /* Show include directory list */ + DEFBUF * defp; + VAL_SIGN * valp; + int sflag; /* -S option or similar */ + int trad; /* -traditional */ + int old_mode; /* backup of 'mcpp_mode'*/ + int gval, sse; + char * cp; + int i; +#if COMPILER == GNUC +#define NSYSDIR 8 + /* System include directory specified by -isystem */ + char * sysdir[ NSYSDIR] = { NULL, }; + char ** sysdir_end = sysdir; + int integrated_cpp; /* Flag of cc1 which integrates cpp in it */ +#elif COMPILER == LCC + const char * debug_name = "__LCCDEBUGLEVEL"; +#endif + + g_system_data->argv0 = argv[ 0]; + g_system_data->nflag = unset_sys_dirs = show_path = sflag = trad = FALSE; + g_system_data->arch[ 0] = 0; + gval = sse = 0; + set_cplus_dir = TRUE; + + /* Get current directory for -I option and #pragma once */ + pk_getcwd( g_system_data->cur_work_dir, PATHMAX); +#if SYS_FAMILY == SYS_WIN + bsl2sl( g_system_data->cur_work_dir); +#endif + sprintf( g_system_data->cur_work_dir + strlen( g_system_data->cur_work_dir), "%c%c", PATH_DELIM, EOS); + /* Append trailing path-delimiter */ + +#if COMPILER == GNUC + defp = look_id( "__GNUC__"); /* Already defined by init_defines() */ + gcc_maj_ver = atoi( defp->repl); + defp = look_id( "__GNUC_MINOR__"); + gcc_min_ver = atoi( defp->repl); + integrated_cpp = ((gcc_maj_ver == 3 && gcc_min_ver >= 3) + || gcc_maj_ver == 4); +#endif +#if COMPILER == GNUC || COMPILER == MSC + g_internal_data->option_flags.dollar_in_name = TRUE; + /* GCC and Visual C allows '$' in name by default */ +#endif + + set_opt_list( optlist); + +opt_search: ; + while (g_system_data->mcpp_optind < argc + && (opt = mcpp_getopt( argc, argv, optlist)) != EOF) { + + switch (opt) { /* Command line option character */ + +#if COMPILER == GNUC + case '$': /* Forbid '$' in identifier */ + g_internal_data->option_flags.dollar_in_name = FALSE; + break; +#endif + + case '+': +#if COMPILER == GNUC +plus: +#endif + if (g_internal_data->cplus_val || sflag) { + mcpp_fputs( "warning: -+ option is ignored\n", DEST_ERR); + break; + } + g_internal_data->cplus_val = CPLUS; + break; +#if COMPILER == GNUC + case '-': + if (memcmp( g_system_data->mcpp_optarg, "sysroot", 7) == 0) { + if (g_system_data->mcpp_optarg[ 7] == '=') /* --sysroot=DIR */ + sysroot = g_system_data->mcpp_optarg + 8; + else if (g_system_data->mcpp_optarg[ 7] == EOS) /* --sysroot DIR */ + sysroot = argv[ g_system_data->mcpp_optind++]; + else + usage( opt); + break; + } else { + usage( opt); + } +#endif + case '2': /* Reverse digraphs recognition */ + g_internal_data->option_flags.dig = ! g_internal_data->option_flags.dig; + break; + case '3': /* Reverse trigraph recogniion */ + g_internal_data->option_flags.trig = ! g_internal_data->option_flags.trig; + break; + + case '@': /* Special preprocessing mode */ + old_mode = g_internal_data->mcpp_mode; + if (str_eq( g_system_data->mcpp_optarg, "post") + || str_eq( g_system_data->mcpp_optarg, "poststd")) + g_internal_data->mcpp_mode = POST_STD; /* 'post-Standard' mode */ + else if (str_eq( g_system_data->mcpp_optarg, "old") + || str_eq( g_system_data->mcpp_optarg, "oldprep")) + g_internal_data->mcpp_mode = OLD_PREP; /* 'old-Preprocessor' mode */ + else if (str_eq( g_system_data->mcpp_optarg, "kr")) + g_internal_data->mcpp_mode = KR; /* 'K&R 1st' mode */ + else if (str_eq( g_system_data->mcpp_optarg, "std")) + g_internal_data->mcpp_mode = STD; /* 'Standard' mode (default)*/ + else if (str_eq( g_system_data->mcpp_optarg, "compat")) { + g_system_data->compat_mode = TRUE; /* 'compatible' mode */ + g_internal_data->mcpp_mode = STD; + } + else + usage( opt); + g_internal_data->standard = (g_internal_data->mcpp_mode == STD || g_internal_data->mcpp_mode == POST_STD); + if (old_mode != STD && old_mode != g_internal_data->mcpp_mode) + mcpp_fprintf( DEST_ERR, "Mode is redefined to: %s\n", g_system_data->mcpp_optarg); + break; + +#if COMPILER == GNUC + case 'A': /* Ignore -A system(gnu), -A cpu(vax) or so */ + break; + case 'a': + if (str_eq( g_system_data->mcpp_optarg, "nsi")) { /* -ansi */ + look_and_install( "__STRICT_ANSI__", DEF_NOARGS_PREDEF, null + , "1"); + g_system_data->ansi = TRUE; + break; + } else if (memcmp( g_system_data->mcpp_optarg, "uxbase", 6) == 0) { + g_system_data->mcpp_optind++; + break; /* Ignore '-auxbase some' or such nonsence */ +#if SYSTEM == SYS_MAC + } else if (str_eq( g_system_data->mcpp_optarg, "rch")) { /* -arch */ + strcpy( g_system_data->arch, argv[ g_system_data->mcpp_optind++]); + if (str_eq( g_system_data->arch, "ppc") || str_eq( g_system_data->arch, "ppc7400") + || str_eq( g_system_data->arch, "ppc64") + || str_eq( g_system_data->arch, "i386") || str_eq( g_system_data->arch, "i686") + || str_eq( g_system_data->arch, "x86_64") || str_eq( g_system_data->arch, "amd64")) { + if (str_eq( g_system_data->arch, "i686")) + strcpy( g_system_data->arch, "i386"); + else if (str_eq( g_system_data->arch, "amd64")) + strcpy( g_system_data->arch, "x86_64"); + else if (str_eq( g_system_data->arch, "ppc7400")) + strcpy( g_system_data->arch, "ppc"); + break; + } /* Else usage() */ +#endif + } + usage( opt); +#elif COMPILER == MSC + case 'a': + if (memcmp( g_system_data->mcpp_optarg, "rch", 3) == 0) { + if (str_eq( g_system_data->mcpp_optarg + 3, ":SSE") /* -arch:SSE */ + || str_eq( g_system_data->mcpp_optarg + 3, ":sse")) + sse = 1; + else if (str_eq( g_system_data->mcpp_optarg + 3, ":SSE2") /* -arch:SSE2 */ + || str_eq( g_system_data->mcpp_optarg + 3, ":sse2")) + sse = 2; + /* Else ignore */ + } else { + usage( opt); + } + break; + + case 'A': + g_internal_data->option_flags.lang_asm = TRUE; /* "assembler" source */ + break; +#else + case 'a': + g_internal_data->option_flags.lang_asm = TRUE; /* "assembler" source */ + break; +#endif + +#if ! STD_LINE_PREFIX + case 'b': + g_internal_data->std_line_prefix = TRUE; /* Putout line and file infor- */ + break; /* mation in C source style. */ +#endif + + case 'C': /* Keep comments */ + g_internal_data->option_flags.c = TRUE; + break; + +#if COMPILER == GNUC + case 'c': + if (! g_system_data->integrated_cpp) + usage( opt); + break; /* Else ignore this option */ + case 'd': + if (str_eq( g_system_data->mcpp_optarg, "M")) { /* -dM */ + g_system_data->dMflag = TRUE; + g_system_data->no_output++; + } else if (str_eq( g_system_data->mcpp_optarg, "D")) { /* -dD */ + g_system_data->dDflag = TRUE; + } else if (str_eq( g_system_data->mcpp_optarg, "igraphs")) { /* -digraphs */ + g_internal_data->option_flags.dig = TRUE; + } else if (str_eq( g_system_data->mcpp_optarg, "umpbase")) { /* -dumpbase */ + ; /* Ignore */ + } else { + usage( opt); + } + break; +#endif /* COMPILER == GNUC */ + + case 'D': /* Define symbol */ + if (g_system_data->def_cnt >= MAX_DEF) { + mcpp_fputs( "Too many -D options.\n", DEST_ERR); + longjmp( g_internal_data->error_exit, -1); + } + g_system_data->def_list[ g_system_data->def_cnt++] = g_system_data->mcpp_optarg; + break; + + case 'e': + /* Change the default MBCHAR encoding */ + if (set_encoding( g_system_data->mcpp_optarg, FALSE, 0) == NULL) + usage( opt); + g_system_data->mb_changed = TRUE; + break; + +#if COMPILER == GNUC + case 'E': + if (! integrated_cpp) + usage( opt); + break; /* Ignore this option */ + case 'f': + if (memcmp( g_system_data->mcpp_optarg, "input-charset=", 14) == 0) { + /* Treat -finput-charset= as the same option as -e */ + if (set_encoding( g_system_data->mcpp_optarg + 14, FALSE, 0) == NULL) + usage( opt); + g_system_data->mb_changed = TRUE; + } else if (str_eq( g_system_data->mcpp_optarg, "working-directory")) { + g_system_data->gcc_work_dir = TRUE; + } else if (str_eq( g_system_data->mcpp_optarg, "no-working-directory")) { + g_system_data->gcc_work_dir = FALSE; + } else if (str_eq( g_system_data->mcpp_optarg, "stack-protector")) { + look_and_install( "__SSP__", DEF_NOARGS_PREDEF, null, "1"); + } else if (str_eq( g_system_data->mcpp_optarg, "stack-protector-all")) { + look_and_install( "__SSP_ALL__", DEF_NOARGS_PREDEF, null, "2"); + } else if (str_eq( g_system_data->mcpp_optarg, "exceptions")) { + look_and_install( "__EXCEPTIONS", DEF_NOARGS_PREDEF, null + , "1"); + } else if (str_eq( g_system_data->mcpp_optarg, "no-exceptions")) { + g_system_data->undef_list[ g_system_data->undef_cnt++] = "__EXCEPTIONS"; + } else if (str_eq( g_system_data->mcpp_optarg, "PIC") + || str_eq( g_system_data->mcpp_optarg, "pic") + || str_eq( g_system_data->mcpp_optarg, "PIE") + || str_eq( g_system_data->mcpp_optarg, "pie")) { + look_and_install( "__PIC__", DEF_NOARGS_PREDEF, null, "1"); + look_and_install( "__pic__", DEF_NOARGS_PREDEF, null, "1"); + } else if (str_eq( g_system_data->mcpp_optarg, "no-dollars-in-identifiers")) { + g_internal_data->option_flags.dollar_in_name = FALSE; + } else if (str_eq(g_system_data-> mcpp_optarg, "no-show-column")) { + ; /* Ignore this option */ + } else if (! integrated_cpp) { + usage( opt); + } + break; + + case 'g': + if (!isdigit( *g_system_data->mcpp_optarg) + && str_eq( argv[ g_system_data->mcpp_optind - 2], "-g")) + /* Neither '-g 0' nor '-ggdb' -- No argument */ + g_system_data->mcpp_optind--; + break; /* Ignore the option */ +#elif COMPILER == LCC + case 'g': /* Define __LCCDEBUGLEVEL as */ + if (*(g_system_data->mcpp_optarg + 1) == EOS && isdigit( *g_system_data->mcpp_optarg)) { + defp = look_id( debug_name); + strcpy( defp->repl, g_system_data->mcpp_optarg); + } else { + usage( opt); + } + break; +#elif COMPILER == MSC + case 'G': + if (*(g_system_data->mcpp_optarg + 1) == EOS) { /* -Gx */ + switch (*g_system_data->mcpp_optarg) { + case '3': case '4': case '5': case '6': + gval = *g_system_data->mcpp_optarg; + break; + case 'B': /* -GB */ + gval = '6'; + break; + case 'R': + look_and_install( "_CPPRTTI", DEF_NOARGS_PREDEF, null + , "1"); + break; + case 'X': + look_and_install( "_CPPUNWIND", DEF_NOARGS_PREDEF, null + , "1"); + break; + case 'Z': + look_and_install( "__MSVC_RUNTIME_CHECKS" + , DEF_NOARGS_PREDEF, null, "1"); + break; + default : + mcpp_fprintf( DEST_ERR, warning, opt, g_system_data->mcpp_optarg); + } + } else { + usage( opt); + } + break; +#endif + +#if SYSTEM == SYS_MAC + case 'F': + g_system_data->framework[ g_system_data->num_framework++] = g_system_data->mcpp_optarg; + break; +#endif + + case 'h': + if (*(g_system_data->mcpp_optarg + 1) == EOS && isdigit( *g_system_data->mcpp_optarg)) + /* a digit */ + look_and_install( "__STDC_HOSTED__", DEF_NOARGS_PREDEF, g_internal_data->empty_str + , g_system_data->mcpp_optarg); + else + usage( opt); + break; + +#if COMPILER == MSC + case 'X': + unset_sys_dirs = TRUE; + break; +#endif + case 'I': /* Include directory */ + if (str_eq( g_system_data->mcpp_optarg, "-")) { /* -I- */ +#if COMPILER == GNUC + sys_dirp = g_system_data->incend; /* Split include directories */ + i_split = TRUE; +#else + unset_sys_dirs = TRUE; + /* Unset pre-specified include directories */ +#endif + } else if (*(g_system_data->mcpp_optarg + 1) == EOS && isdigit( *g_system_data->mcpp_optarg) + && (i = *g_system_data->mcpp_optarg - '0') != 0 + && (i & ~(CURRENT | SOURCE)) == 0) { + g_system_data->search_rule = i; /* -I1, -I2 or -I3 */ + } else { /* Not '-' nor a digit */ + set_a_dir( g_system_data->mcpp_optarg); /* User-defined dir */ + } + break; + +#if COMPILER == MSC + case 'F': + if (str_eq( g_system_data->mcpp_optarg, "l")) { /* -Fl */ + if (g_system_data->preinc_end >= &g_system_data->preinclude[ NPREINCLUDE]) { + mcpp_fputs( "Too many -Fl options.\n", DEST_ERR); + longjmp( g_internal_data->error_exit, -1); + } + *g_system_data->preinc_end++ = argv[ g_system_data->mcpp_optind++]; + } else { + usage( opt); + } + break; +#endif + +#if COMPILER == GNUC + case 'i': + if (str_eq( g_system_data->mcpp_optarg, "nclude")) { /* -include */ + if (g_system_data->preinc_end >= &g_system_data->preinclude[ NPREINCLUDE]) { + mcpp_fputs( "Too many -include options.\n", DEST_ERR); + longjmp( g_internal_data->error_exit, -1); + } + *g_system_data->preinc_end++ = argv[ g_system_data->mcpp_optind++]; + } else if (str_eq( g_system_data->mcpp_optarg, "system")) { /* -isystem */ + if (sysdir_end >= &sysdir[ NSYSDIR]) { + mcpp_fputs( "Too many -isystem options.\n", DEST_ERR); + longjmp( g_internal_data->error_exit, -1); + } + *sysdir_end++ = argv[ g_system_data->mcpp_optind++]; + /* Add the directory before system include directory*/ + } else if (str_eq( g_system_data->mcpp_optarg, "quote")) { /* -iquote */ + if (quote_dir_end >= "e_dir[ N_QUOTE_DIR]) { + mcpp_fputs( "Too many -iquote options.\n", DEST_ERR); + longjmp( g_internal_data->error_exit, -1); + } + *quote_dir_end++ = argv[ g_system_data->mcpp_optind++]; + /* Add the directory for #include "header" */ + } else if (memcmp( g_system_data->mcpp_optarg, "sysroot", 7) == 0) { + if (g_system_data->mcpp_optarg[ 7] == '=') /* -isysroot=DIR */ + sysroot = g_system_data->mcpp_optarg + 8; + else if (g_system_data->mcpp_optarg[ 7] == EOS) /* -isysroot DIR */ + sysroot = argv[ g_system_data->mcpp_optind++]; + else + usage( opt); + } else if (str_eq( g_system_data->mcpp_optarg, "prefix") /* -iprefix */ + || str_eq( g_system_data->mcpp_optarg, "withprefix") /* -iwithprefix */ + || str_eq( g_system_data->mcpp_optarg, "withprefixbefore") + /* -iwithprefixbefore */ + || str_eq( g_system_data->mcpp_optarg, "dirafter") /* -idirafter */ + || str_eq( g_system_data->mcpp_optarg, "multilib")) { /* -imultilib */ + g_system_data->mcpp_optind++; /* Skip the argument */ + /* Ignore these options */ + } else { + usage( opt); + } + break; +#endif + + case 'j': + g_internal_data->option_flags.no_source_line = TRUE; + break; /* Do not output the source line in diagnostics */ + +#if COMPILER == MSC + case 'J': + look_and_install( "_CHAR_UNSIGNED", DEF_NOARGS_PREDEF, null, "1"); + break; +#endif + + case 'K': + g_internal_data->mcpp_debug |= MACRO_CALL; + /* + * Putout macro expansion informations embedded in comments. + * Same with '#pragma MCPP debug macro_call'. + */ + /* Enable white spaces preservation, too */ + /* Fall through */ + case 'k': + g_internal_data->option_flags.k = TRUE; + /* Keep white spaces of input lines as they are */ + break; + +#if COMPILER == GNUC + case 'l': + if (memcmp( g_system_data->mcpp_optarg, "ang-", 4) != 0) { + usage( opt); + } else if (str_eq( g_system_data->mcpp_optarg + 4, "c")) { /* -lang-c */ + ; /* Ignore this option */ + } else if (str_eq( g_system_data->mcpp_optarg + 4, "c99") /* -lang-c99*/ + || str_eq( g_system_data->mcpp_optarg + 4, "c9x")) { /* -lang-c9x*/ + if (! sflag) { + g_internal_data->stdc_val = 1; /* Define __STDC__ to 1 */ + g_system_data->std_val = 199901L; + sflag = TRUE; + } + } else if (str_eq( g_system_data->mcpp_optarg + 4, "c89")) { /* -lang-c89*/ + if (! sflag) { + g_internal_data->stdc_val = 1; /* Define __STDC__ to 1 */ + sflag = TRUE; + } + } else if (str_eq( g_system_data->mcpp_optarg + 4, "c++")) { /* -lang-c++*/ + goto plus; + } else if (str_eq( g_system_data->mcpp_optarg + 4, "asm")) { /* -lang-asm*/ + g_internal_data->option_flags.lang_asm = TRUE; + } else { + usage( opt); + } + break; +#endif /* COMPILER == GNUC */ + + case 'M': /* Output source file dependency line */ + if (str_eq( g_system_data->mcpp_optarg, "M")) { /* -MM */ + ; + } else if (str_eq( g_system_data->mcpp_optarg, "D")) { /* -MD */ + g_internal_data->mkdep |= (MD_SYSHEADER | MD_FILE); + } else if (str_eq( g_system_data->mcpp_optarg, "MD")) { /* -MMD */ + g_internal_data->mkdep |= MD_FILE; + } else if (str_eq( g_system_data->mcpp_optarg, "P")) { /* -MP */ + g_internal_data->mkdep |= MD_PHONY; + } else if (str_eq( g_system_data->mcpp_optarg, "Q")) { /* -MQ target */ + g_internal_data->mkdep |= MD_QUOTE; + g_system_data->mkdep_mq = argv[ g_system_data->mcpp_optind++]; + } else if (str_eq( g_system_data->mcpp_optarg, "T")) { /* -MT target */ + g_system_data->mkdep_mt = argv[ g_system_data->mcpp_optind++]; + } else if (str_eq( g_system_data->mcpp_optarg, "F")) { /* -MF file */ + g_system_data->mkdep_mf = argv[ g_system_data->mcpp_optind++]; + } else if (argv[ g_system_data->mcpp_optind - 1] == g_system_data->mcpp_optarg) { /* -M */ + g_internal_data->mkdep |= MD_SYSHEADER; + g_system_data->mcpp_optind--; + } else { + usage( opt); + } + if (str_eq( g_system_data->mcpp_optarg, "D") || str_eq( g_system_data->mcpp_optarg, "MD")) { + cp = argv[ g_system_data->mcpp_optind]; + if (cp && *cp != '-') /* -MD (-MMD) file */ + g_system_data->mkdep_md = argv[ g_system_data->mcpp_optind++]; + } + g_internal_data->mkdep |= MD_MKDEP; + break; + +#if SYS_FAMILY == SYS_UNIX + case 'm': + if (str_eq( g_system_data->mcpp_optarg, "64")) { /* -m64 */ + if (str_eq( CPU, "i386")) + strcpy( g_system_data->arch, "x86_64"); + else if (str_eq( CPU, "ppc")) + strcpy( g_system_data->arch, "ppc64"); + /* Else ignore */ + break; + } else if (str_eq( g_system_data->mcpp_optarg, "32")) { /* -m32 */ + if (str_eq( CPU, "x86_64")) + strcpy( g_system_data->arch, "i386"); + else if (str_eq( CPU, "ppc64")) + strcpy( g_system_data->arch, "ppc"); + /* Else ignore */ + break; + } else if (str_eq( g_system_data->mcpp_optarg, "mmx")) { /* -mmmx */ + look_and_install( "__MMX__", DEF_NOARGS_PREDEF, null, "1"); + break; + } else if (str_eq( g_system_data->mcpp_optarg, "no-mmx")) { /* -mno-mmx */ + g_system_data->undef_list[ g_system_data->undef_cnt++] = "__MMX__"; + break; + } +#endif /* SYS_FAMILY == UNIX */ +#if COMPILER == GNUC +#if SYSTEM == SYS_CYGWIN + if (str_eq( g_system_data->mcpp_optarg, "no-cygwin")) { /* -mno-cygwin */ + g_system_data->no_cygwin = TRUE; + break; + } +#endif + if (! integrated_cpp) + usage( opt); + break; + + case 'u': + if (! str_eq( g_system_data->mcpp_optarg, "ndef")) /* -undef */ + usage( opt); /* Else fall through */ +#endif /* COMPILER == GNUC */ + +#if COMPILER == MSC + case 'u': +#endif + case 'N': + /* No predefines: remove "unix", "__unix__" and friends. */ + g_system_data->nflag = TRUE; + break; + +#if COMPILER == GNUC || NO_DIR + case 'n': +#if NO_DIR + if (str_eq( g_system_data->mcpp_optarg, "odir")) { /* -nodir */ + g_system_data->no_dir = TRUE; + } +#endif +#if COMPILER == GNUC + if (str_eq( g_system_data->mcpp_optarg, "ostdinc")) { /* -nostdinc */ + unset_sys_dirs = TRUE; /* Unset pre-specified directories */ + } else if (str_eq( g_system_data->mcpp_optarg, "ostdinc++")) { /* -nostdinc++ */ + set_cplus_dir = FALSE; /* Unset C++-specific directories */ + } else if (str_eq( g_system_data->mcpp_optarg, "oprecomp")) { /* -noprecomp */ + mcpp_fprintf( DEST_ERR, warning, opt, g_system_data->mcpp_optarg); + break; + } +#endif + else { + usage( opt); + } + break; +#endif + +#if COMPILER == GNUC + case 'O': + if (integrated_cpp) { + if (*g_system_data->mcpp_optarg == '-') /* No argument */ + g_system_data->mcpp_optind--; + else if ((isdigit( *g_system_data->mcpp_optarg) && *g_system_data->mcpp_optarg != '0') + || *g_system_data->mcpp_optarg == 's' || *g_system_data->mcpp_optarg == 'z') + /* -O1, -O2 -Os, -Oz */ + look_and_install( "__OPTIMIZE__", DEF_NOARGS_PREDEF, null + , "1"); + else if (! isdigit( *g_system_data->mcpp_optarg)) + usage( opt); + /* Else -O0: ignore */ + } else { + usage( opt); + } + break; /* Else ignore -Ox option */ +#elif COMPILER == LCC + case 'O': /* Define __LCCOPTIMLEVEL as 1 */ + defp = look_id( g_system_data->optim_name); + strcpy( defp->repl, "1"); + break; +#endif + + case 'o': + *out_pp = g_system_data->mcpp_optarg; /* Output file name */ + break; + + case 'P': /* No #line output */ + g_internal_data->option_flags.p = TRUE; + break; + +#if COMPILER == GNUC + case 'p': + if (str_eq( g_system_data->mcpp_optarg, "edantic") /* -pedantic */ + || str_eq( g_system_data->mcpp_optarg, "edantic-errors")) { + /* -pedantic-errors */ + /* This option does not imply -ansi */ + if (g_internal_data->warn_level == -1) + g_internal_data->warn_level = 0; + g_internal_data->warn_level |= (1 | 2 | 4); + if (! sflag && ! g_internal_data->cplus_val) { + g_internal_data->stdc_val = 1; + sflag = TRUE; + } + } else { + usage( opt); + } + break; + case 'q': + if (str_eq( g_system_data->mcpp_optarg, "uiet")) + /* -quiet: GCC's undocumented, yet frequently specified opt */ + break; /* Ignore the option */ + else + usage( opt); + break; +#endif /* COMPILER == GNUC */ + + case 'Q': + g_internal_data->option_flags.q = TRUE; + break; + +#if COMPILER == MSC + case 'R': /* -RTC1, -RTCc, -RTCs, -RTCu, etc. */ + if (memcmp( g_system_data->mcpp_optarg, "TC", 2) == 0 + && *(g_system_data->mcpp_optarg + 2) != EOS) + look_and_install( "__MSVC_RUNTIME_CHECKS", DEF_NOARGS_PREDEF + , null, "1"); + else + usage( opt); + break; +#endif + + case 'S': + if (g_internal_data->cplus_val || sflag) { /* C++ or the second time */ + mcpp_fprintf( DEST_ERR, warning, opt, g_system_data->mcpp_optarg); + break; + } + i = *g_system_data->mcpp_optarg; + if (! isdigit( i) || *(g_system_data->mcpp_optarg + 1) != EOS) + usage( opt); + g_internal_data->stdc_val = i - '0'; + sflag = TRUE; + break; + +#if COMPILER == GNUC + case 'r': + if (str_eq( g_system_data->mcpp_optarg, "emap")) + mcpp_fprintf( DEST_ERR, warning, opt, g_system_data->mcpp_optarg); + /* Ignore -remap option */ + else + usage( opt); + break; + + case 's': + if (memcmp( g_system_data->mcpp_optarg, "td=", 3) == 0 + && strlen( g_system_data->mcpp_optarg) > 3) { /* -std=STANDARD*/ + cp = g_system_data->mcpp_optarg + 3; + if (str_eq( cp, "c89") /* std=c89 */ + || str_eq( cp, "c90") /* std=c90 */ + || str_eq( cp, "gnu89") /* std=gnu89 */ + || str_eq( cp, "iso9899:1990")) { + g_system_data->std_val = 0L; /* C90 + extensions */ + } else if (str_eq( cp, "c99") /* std=c99 */ + || str_eq( cp, "c9x") /* std=c9x */ + || str_eq( cp, "gnu99") /* std=gnu99 */ + || str_eq( cp, "gnu9x") /* std=gnu9x */ + || str_eq( cp, "iso9899:1999") + || str_eq( cp, "iso9899:199x")) { + g_system_data->std_val = 199901L; + } else if (str_eq( cp, "c++98")) { /* std=c++98 */ + g_internal_data->cplus_val = g_system_data->std_val = 199711L; + } else if (memcmp( cp, "iso9899:", 8) == 0 + && strlen( cp) >= 14) { /* std=iso9899:199409, etc. */ + g_system_data->mcpp_optarg = cp + 8; + look_and_install( "__STRICT_ANSI__", DEF_NOARGS_PREDEF + , null, "1"); + g_system_data->ansi = TRUE; + goto Version; + } else if (memcmp( cp, "iso14882", 8) == 0) { + cp += 8; + g_system_data->ansi = TRUE; + if (cp && *cp == ':' && strlen( cp) >= 7) { + /* std=iso14882:199711, etc. */ + g_internal_data->cplus_val = CPLUS; + mcpp_optarg = cp + 1; + goto Version; + } else { + goto plus; + } + } else { + usage( opt); + } + if (! g_internal_data->cplus_val && memcmp( cp, "gnu", 3) != 0) { + /* 'std=gnu*' does not imply -ansi */ + look_and_install( "__STRICT_ANSI__", DEF_NOARGS_PREDEF + , null, "1"); + g_system_data->ansi = TRUE; + } + g_internal_data->stdc_val = 1; + sflag = TRUE; + } else { + usage( opt); + } + break; + + case 't': + if (str_eq( mcpp_optarg, "raditional") + || str_eq( mcpp_optarg, "raditional-cpp")) { + /* -traditional, -traditional-cpp */ + trad = TRUE; + g_internal_data->mcpp_mode = OLD_PREP; + } else if (str_eq( mcpp_optarg, "rigraphs")) { + g_internal_data->option_flags.trig = TRUE; /* -trigraphs */ + } else { + usage( opt); + } + break; +#endif /* COMPILER == GNUC */ + +#if COMPILER == MSC + case 'T': + if (strlen( g_system_data->mcpp_optarg) > 1) + usage( opt); + i = tolower( *g_system_data->mcpp_optarg); /* Fold case */ + if (i == 'c') { + ; /* Ignore this option */ + } else if (i == 'p') { + g_internal_data->cplus_val = CPLUS; + } else { + usage( opt); + } + break; +#endif + + case 'U': /* Undefine macro */ + if (g_system_data->undef_cnt >= MAX_UNDEF) { + mcpp_fputs( "Too many -U options.\n", DEST_ERR); + longjmp( g_internal_data->error_exit, -1); + } + g_system_data->undef_list[ g_system_data->undef_cnt++] = g_system_data->mcpp_optarg; + break; + + case 'V': +#if COMPILER == GNUC +Version: +#endif + valp = eval_num( g_system_data->mcpp_optarg); + if (valp->sign == VAL_ERROR) + usage( opt); + g_system_data->std_val = (long) valp->val; + break; + + case 'v': + g_internal_data->option_flags.v = TRUE; + show_path = TRUE; + break; + + case 'W': /* warning level */ + if (g_internal_data->warn_level == -1) /* Have to initialize */ + g_internal_data->warn_level = 0; +#if COMPILER == GNUC + if (argv[ g_system_data->mcpp_optind - 1] == g_system_data->mcpp_optarg) { /* No argument */ + /* + * Note: -W without argument is not officially supported. + * It may cause an error. + */ + g_internal_data->warn_level |= (1 | 2 | 4 | 16); + g_system_data->mcpp_optind--; + } else if (str_eq( g_system_data->mcpp_optarg, "comment") + || str_eq( g_system_data->mcpp_optarg, "comments") + || str_eq( g_system_data->mcpp_optarg, "sign-compare")) { + g_internal_data->warn_level |= 1; + } else if (str_eq( g_system_data->mcpp_optarg, "undef")) { + g_internal_data->warn_level |= 4; + } else if (str_eq( g_system_data->mcpp_optarg, "all")) { + g_internal_data->warn_level |= (1 | 16); /* Convert -Wall to -W17*/ + } else if (str_eq( g_system_data->mcpp_optarg, "trigraphs")) { + g_internal_data->warn_level |= 16; + } +#endif /* COMPILER == GNUC */ +#if COMPILER == MSC + if (str_eq( g_system_data->mcpp_optarg, "all")) { + g_internal_data->warn_level |= (1 | 16); /* Convert -Wall to -W17*/ + } else if (str_eq( g_system_data->mcpp_optarg, "L")) { + g_internal_data->option_flags.no_source_line = TRUE; + /* Single-line diagnostic */ + } +#endif + if (isdigit( *g_system_data->mcpp_optarg)) { + g_internal_data->warn_level |= parse_warn_level( g_system_data->mcpp_optarg, opt); + if (g_internal_data->warn_level > 31 || g_internal_data->warn_level < 0) + usage( opt); + } + if (g_internal_data->warn_level == 0) + g_internal_data->warn_level = 0xFF; /* Remember this option */ + /* Else ignore the option */ + break; + +#if COMPILER == GNUC || COMPILER == MSC + case 'w': /* Same as -W0 */ + g_internal_data->warn_level = 0xFF; /* Remenber this option */ + break; +#endif + +#if COMPILER == GNUC + case 'x': + if (str_eq( g_system_data->mcpp_optarg, "c")) { + break; /* -x c -- ignore this */ + } else if (str_eq( g_system_data->mcpp_optarg, "c++")) { + goto plus; + } else if (str_eq( g_system_data->mcpp_optarg, "assembler-with-cpp")) { + g_internal_data->option_flags.lang_asm = TRUE; + break; + } else { + usage( opt); + } + break; +#endif + +#if COMPILER == MSC + case 'Z': + if (str_eq( g_system_data->mcpp_optarg, "c:wchar_t")) { /* -Zc:wchar_t */ + look_and_install( "_NATIVE_WCHAR_T_DEFINED", DEF_NOARGS_PREDEF + , null, "1"); + look_and_install( "_WCHAR_T_DEFINED", DEF_NOARGS_PREDEF, null + , "1"); + g_system_data->wchar_t_modified = TRUE; + } else if (str_eq( g_system_data->mcpp_optarg, "c:wchar_t-")) {/* -Zc:wchar_t- */ + g_system_data->wchar_t_modified = TRUE; /* Do not define the macros */ + } else if (str_eq( g_system_data->mcpp_optarg, "l")) { + look_and_install( "_VC_NODEFAULTLIB", DEF_NOARGS_PREDEF, null + , "1"); + } else if (str_eq( g_system_data->mcpp_optarg, "a")) { /* -Za */ + undefine( "_MSC_EXTENSIONS"); + g_internal_data->option_flags.dollar_in_name = FALSE; + } else if (str_eq( g_system_data->mcpp_optarg, "e")) { + /* Ignore -Ze silently */ + break; + } else if (*(g_system_data->mcpp_optarg + 1) == EOS) { + /* -Z followed by one char */ + mcpp_fprintf( DEST_ERR, warning, opt, g_system_data->mcpp_optarg); + /* Ignore the option with warning */ + } else { + usage( opt); + } + break; +#endif + + case 'z': + g_internal_data->option_flags.z = TRUE; /* No output of included file */ + break; + + default: /* What is this one? */ + usage( opt); + break; + } /* Switch on all options */ + + } /* For all arguments */ + + if (g_system_data->mcpp_optind < argc && set_files( argc, argv, in_pp, out_pp) != NULL) + goto opt_search; /* More options after the filename */ + + /* Check consistency of specified options, set some variables */ + chk_opts( sflag, trad); + + if (g_internal_data->warn_level == -1) /* No -W option */ + g_internal_data->warn_level = 1; /* Default warning level */ + else if (g_internal_data->warn_level == 0xFF) + g_internal_data->warn_level = 0; /* -W0 has high precedence */ + +#if SYSTEM == SYS_MAC + set_a_dir( NULL); /* Initialize incdir[] */ + g_system_data->to_search_framework = g_system_data->incend; + /* Search framework[] next to the directory */ +#endif + +#if COMPILER == GNUC && SYSTEM == SYS_MAC + if (g_system_data->arch[ 0]) { /* -arch option has been specified */ + if (((str_eq( CPU, "i386") || str_eq( CPU, "x86_64")) + && (! str_eq( g_system_data->arch, "i386") && ! str_eq( g_system_data->arch, "x86_64"))) + || ((str_eq( CPU, "ppc") || str_eq( CPU, "ppc64")) + && (! str_eq( g_system_data->arch, "ppc") && ! str_eq( g_system_data->arch, "ppc64")))) { + mcpp_fprintf( DEST_ERR, "Wrong argument of -arch option: %s\n", g_system_data->arch); + longjmp( g_internal_data->error_exit, -1); + } + } +#endif + if (! g_system_data->arch[ 0]) { + /* None of -arch, -m32 or -m64 options has been specified. */ + /* The CPU-specific-macros will be defined in init_cpu_macro(). */ + strcpy( g_system_data->arch, CPU); + } +#if COMPILER != GNUC + init_cpu_macro( gval, sse); +#endif + +#if COMPILER == GNUC + if (sysdir < sysdir_end) { + char ** dp = sysdir; + if (! sys_dirp || sys_dirp == g_system_data->incdir) + sys_dirp = dp; + while (dp < sysdir_end) + set_a_dir( *dp++); + } + if (*in_pp && str_eq( (*in_pp) + strlen( *in_pp) - 2, ".S")) + g_internal_data->option_flags.lang_asm = TRUE; /* Input file name is *.S */ + if (g_internal_data->option_flags.lang_asm) { + look_and_install( "__ASSEMBLER__", DEF_NOARGS_PREDEF, null, "1"); + g_internal_data->option_flags.dollar_in_name = FALSE; /* Disable '$' in name */ + } + if (! sys_dirp || sys_dirp == g_system_data->incdir) + sys_dirp = g_system_data->incend; +#endif +#if SYSTEM == SYS_MAC + init_framework(); /* After setting sys_dirp */ +#endif + set_env_dirs(); + if (! unset_sys_dirs) + set_sys_dirs( set_cplus_dir); + + if (g_system_data->mkdep_mf) { /* -MF overrides -MD */ + g_system_data->mkdep_fp = pk_fopen( g_system_data->mkdep_mf, "w"); + } else if (g_system_data->mkdep_md) { + g_system_data->mkdep_fp = pk_fopen( g_system_data->mkdep_md, "w"); + } + if (g_system_data->mkdep_mq) /* -MQ overrides -MT */ + g_system_data->mkdep_target = g_system_data->mkdep_mq; + else if (g_system_data->mkdep_mt) + g_system_data->mkdep_target = g_system_data->mkdep_mt; + + /* Normalize the path-list */ + if (*in_pp && ! str_eq( *in_pp, "-")) { + char * tmp = norm_path( g_internal_data->empty_str, *in_pp, FALSE, FALSE); + if (tmp) /* The file exists */ + *in_pp = tmp; + /* Else mcpp_main() will diagnose *in_pp and exit */ + } + if (! (g_internal_data->mcpp_debug & MACRO_CALL)) { + /* -K option alters behavior of -v option */ + if (g_internal_data->option_flags.v) + version(); + if (show_path) { + g_internal_data->fp_debug = &g_global_data->m_std_err; + dump_path(); + g_internal_data->fp_debug = &g_global_data->m_std_out; + } + } +} + +static void version( void) +/* + * Print version message. + */ +{ + const char * mes[] = { + +#if MCPP_LIB +/* Write messages here, for example, "MySomeTool with ". */ +#endif + +#ifdef VERSION_MSG + "MCPP V.2.7.2-ned (2017/02) " +#else + "MCPP V.", VERSION, "-ned (", DATE, ") " +#endif +#if COMPILER == INDEPENDENT + , "compiler-independent-build " +#else +#ifdef CMP_NAME + , "for ", CMP_NAME, " " +#endif +#endif + , "compiled by " +#ifdef VERSION_MSG + , VERSION_MSG +#else +#ifdef HOST_CMP_NAME + , HOST_CMP_NAME +#if HOST_COMPILER == GNUC + , " V.", GCC_MAJOR_VERSION, ".", GCC_MINOR_VERSION +#endif +#endif +#endif + , "\n", + NULL + }; + + const char ** mpp = mes; + while (*mpp) + mcpp_fputs( *mpp++, DEST_ERR); +} + +static void usage( + int opt +) +/* + * Print usage. + */ +{ + const char * mes[] = { + +"Usage: ", +"mcpp", +" [- [-]] [ [-] [] [-]]\n", +" defaults to stdin and defaults to stdout.\n", + +"\nCommonly used options:\n", + +"-@MODE Specify preprocessing mode. MODE should be one of these 4:\n", +" -@std Standard conforming mode. (default)\n", +" -@poststd, -@post special 'post-Standard' mode.\n", +" -@kr K&R 1st mode.\n", +" -@oldprep, -@old 'old_preprocessor' mode (i.e. 'Reiser model' cpp).\n", + +#if COMPILER == MSC +"-arch:SSE, -arch:SSE2 Define the macro _M_IX86_FP as 1, 2 respectively.\n", +#endif +#if SYSTEM == SYS_MAC && COMPILER == GNUC +"-arch Change the target to (i386, x86_64, ppc, ppc64).\n", +#endif + +#if ! STD_LINE_PREFIX +"-b Output #line lines in C source style.\n", +#endif + +"-C Output also comments.\n", +"-D [=] Define as (default:1).\n", +"-D [=] Define as .\n", +"-e Change the default multi-byte character encoding to one of:\n", +" euc_jp, gb2312, ksc5601, big5, sjis, iso2022_jp, utf8.\n", + +#if SYSTEM == SYS_MAC +"-F Add to top of framework directory list.\n", +#endif +#if COMPILER == GNUC +"-finput-charset= Same as -e .\n", +" (Don't insert spaces around '=').\n", +#endif +#if COMPILER == MSC +"-Fl Include the prior to the main input file.\n", +"-G Define the macro _M_IX86 according to .\n", +#endif +#if COMPILER == LCC +"-g Define the macro __LCCDEBUGLEVEL as .\n", +#endif + +"-I Add to the #include search list.\n", + +#if COMPILER == GNUC +"-isysroot Change root of system header directory to .\n", +"-include Include the prior to the main input file.\n", +#else +"-I- Unset system or site specific include directories.\n", +#endif +#if COMPILER == MSC +"-J Define the macro _CHAR_UNSIGNED as 1.\n", +#endif + +"-j Don't output the source line in diagnostics.\n", +"-M, -MM, -MD, -MMD, -MP, -MQ target, -MT target, -MF file\n", +" Output source file dependency line for makefile.\n", +#if SYS_FAMILY == SYS_UNIX +"-m32 Change target CPU from x86_64, ppc64 to i386, ppc, respectively.\n", +"-m64 Change target CPU from i386, ppc to x86_64, ppc64, respectively.\n", +#endif +"-N Don't predefine any non-standard macros.\n", + +#if COMPILER == GNUC +"-nostdinc Unset system or site specific include directories.\n", +#endif +#if COMPILER == LCC +"-O Define the macro __LCCOPTIMLEVEL as 1.\n", +#endif + +"-o Output to .\n", +"-P Don't output #line lines.\n", +"-Q Output diagnostics to \"mcpp.err\" (default:stderr).\n", +#if COMPILER == MSC +"-RTC* Define the macro __MSVC_RUNTIME_CHECKS as 1.\n", +#endif +#if COMPILER == GNUC +"-traditional, -traditional-cpp Same as -@oldprep.\n", +#endif +"-U Undefine .\n", + +#if COMPILER == GNUC +"-undef Same as -N.\n", +#endif +#if COMPILER == MSC +"-u Same as -N.\n", +#endif + +"-v Show version and include directories of mcpp.\n", +"-W Set warning level to (OR of {0,1,2,4,8,16}, default:1).\n", + +#if COMPILER == MSC +"-WL Same as -j.\n", +#endif +#if COMPILER == MSC || COMPILER == GNUC +"-w Same as -W0.\n", +#endif +#if COMPILER == MSC +"-X Same as -I-.\n", +"-Zc:wchar_t Define _NATIVE_WCHAR_T_DEFINED and _WCHAR_T_DEFINED as 1.\n", +"-Zl Define the macro _VC_NODEFAULTLIB as 1.\n", +#endif + +"-z Don't output the included file, only defining macros.\n", + +"\nOptions available with -@std (default) or -@poststd options:\n", + +"-+ Process C++ source.\n", + +#if DIGRAPHS_INIT +"-2 Disable digraphs.\n", +#else +"-2 Enable digraphs.\n", +#endif +#if COMPILER == GNUC +"-digraphs Enable digraphs.\n", +#endif + +"-h Re-define the pre-defined macro __STDC_HOSTED__ as .\n", + +#if COMPILER == GNUC +"-lang-c89 Same as -S1.\n", +"-lang-c++ Same as -+.\n", +"-pedantic, -pedantic-errors Same as -W7.\n", +"-S Redefine __STDC__ to .\n", +#else +"-S Redefine __STDC__ to , undefine old style macros.\n", +#endif + +#if COMPILER == GNUC +"-std= Specify the standard to which the code should conform.\n", +" may be one of: c90, c99, iso9899:1990, iso14882, etc.\n", +" iso9899:, iso14882: : Same as -V (long in decimals).\n", +#endif +#if COMPILER == MSC +"-Tp Same as -+.\n", +#endif + +"-V Redefine __STDC_VERSION__ or __cplusplus to .\n", +" C with -V199901L specifies C99 specs.\n", +" C++ with -V199901L specifies C99 compatible specs.\n", + +#if COMPILER == GNUC +"-x c++ Same as -+.\n", +#endif + +"\nOptions available with only -@std (default) option:\n", + +"-@compat Expand recursive macro more than Standard.\n", +#if TRIGRAPHS_INIT +"-3 Disable trigraphs.\n", +#else +"-3 Enable trigraphs.\n", +#endif +"-K Output macro annotations embedding in comments.\n", +#if COMPILER == GNUC +"-trigraphs Enable trigraphs.\n", +#endif + +"\nOptions available with -@std (default), -@kr or -@oldprep options:\n", + +#if COMPILER == GNUC +"-lang-asm Same as -x assembler-with-cpp.\n", +"-x assembler-with-cpp Process \"assembler\" source.\n", +#elif COMPILER == MSC +"-A Process \"assembler\" source.\n", +#else +"-a Process \"assembler\" source.\n", +#endif + +"-k Keep white spaces of input lines as they are.\n", + +"\nFor further details see mcpp-manual.html.\n", + NULL, + }; + + const char * illegopt = "Incorrect option -%c%s\n"; + const char * const * mpp = mes; + + if (opt != '?') + mcpp_fprintf( DEST_ERR, illegopt, opt, g_system_data->mcpp_optarg ? g_system_data->mcpp_optarg : g_internal_data->empty_str); + version(); +#if MCPP_LIB + mes[ 1] = g_system_data->argv0; +#endif + while (*mpp) + mcpp_fputs( *mpp++, DEST_ERR); + longjmp( g_internal_data->error_exit, -1); +} + +static void set_opt_list( + char * optlist +) +/* + * Set list of legal option characters. + */ +{ + const char * list[] = { + +#if ! STD_LINE_PREFIX + "b", +#endif + +#if SYS_FAMILY == SYS_UNIX + "m:", +#endif + +#if COMPILER == GNUC + "$A:a:cd:Ef:g:i:l:r:s:t:u:O:p:q:wx:", +#elif COMPILER == MSC + "Aa:F:G:JR:T:XZ:uw", +#elif COMPILER == LCC + "g:O", +#endif + +#if COMPILER != GNUC && COMPILER != MSC + "a", +#endif +#if SYSTEM == SYS_MAC + "F:-:", +#endif + + NULL + }; + + const char * const * lp = & list[ 0]; + + strcpy( optlist, "23+@:e:h:jkn:o:vzCD:I:KM:NPQS:U:V:W:"); + /* Default options */ + while (*lp) + strcat( optlist, *lp++); + if (strlen( optlist) >= OPTLISTLEN) + cfatal( "Bug: Too long option list", NULL, 0L, NULL); /* _F_ */ +} + +static int parse_warn_level( + const char * p_mcpp_optarg, + int opt +) +/* + * Parse warn level option. + * Warning level option is specified as '19' or '1|2|16' or even '3|16'. + * Even spaces are allowed as ' 1 | 2|16 '. + */ +{ + const char * cp = p_mcpp_optarg; + int w, i; + + w = i = 0; + while( *cp != EOS) { + while( *cp == ' ') + cp++; /* Skip spaces */ + if (! isdigit( *cp)) + break; /* Error */ + while (isdigit( *cp)) { + i *= 10; + i += (*cp++ - '0'); + } + while (*cp == ' ') + cp++; + if (*cp == '|') { /* Only digits or '|' are allowed */ + w |= i; /* Take OR of the args */ + i = 0; + cp++; + } + } + if (*cp != EOS) { /* Not ending with digit */ + mcpp_fprintf( DEST_ERR, "Illegal warning level option \"%s\"\n" + , p_mcpp_optarg); + usage( opt); + } + w |= i; /* Take the last arg */ + return w; +} + +static void def_a_macro( + int opt, /* 'D' */ + char * def /* Argument of -D option */ +) +/* + * Define a macro specified by -D option. + * The macro maybe either object-like or function-like (with parameter). + */ +{ + DEFBUF * defp; + char * definition; /* Argument of -D option */ + char * cp; + int i; + + /* Convert trigraphs for the environment which need trigraphs */ + if (g_internal_data->mcpp_mode == STD && g_internal_data->option_flags.trig) + cnv_trigraph( def); + if (g_internal_data->mcpp_mode == POST_STD && g_internal_data->option_flags.dig) + cnv_digraph( def); /* Convert prior to installing macro */ + definition = xmalloc( strlen( def) + 4); + strcpy( definition, def); + if ((cp = strchr( definition, '=')) != NULL) { + *cp = ' '; /* Remove the '=' */ + cp = const_cast("\n"); /* Append */ + } else { + cp = const_cast(" 1\n"); /* With definition "1" */ + } + strcat( definition, cp); + cp = definition; + while ((g_internal_data->char_type[ *cp & UCHARMAX] & SPA) == 0) + cp++; + i = *cp; + *cp = EOS; + if ((defp = look_id( definition)) != NULL) /* Pre-defined */ + undefine( definition); + *cp = (char)i; + /* Now, save the definition. */ + unget_string( definition, NULL); + if (do_define( FALSE, 0) == NULL) /* Define a macro */ + usage( opt); + *cp = EOS; + if (str_eq( definition, "__STDC__")) { + defp = look_id( definition); + defp->nargs = DEF_NOARGS_STANDARD; + /* Restore Standard-predefinedness */ + } + free( definition); + skip_nl(); /* Clear the appended */ +} + +static void chk_opts( + int sflag, /* Flag of Standard or post-Standard mode */ + int trad /* -traditional (GCC only) */ +) +/* + * Check consistency between the specified options. + * Set default value of some variables for each 'mcpp_mode'. + */ +{ + int incompat = FALSE; + + switch (g_internal_data->mcpp_mode) { + case STD : + case POST_STD : + if (trad) + incompat = TRUE; + if (! g_internal_data->stdc_val) + g_internal_data->stdc_val = STDC; + break; + case KR : + case OLD_PREP : +#if COMPILER == GNUC + if (sflag || g_internal_data->cplus_val || g_system_data->ansi || g_system_data->std_val != -1L) +#else + if (sflag || g_internal_data->cplus_val || g_system_data->std_val != -1L) +#endif + incompat = TRUE; + if (g_internal_data->option_flags.dig) { + if (g_internal_data->option_flags.dig != DIGRAPHS_INIT) + incompat = TRUE; + else + g_internal_data->option_flags.dig = 0; + } + break; + } + + if (g_internal_data->mcpp_mode == POST_STD + && (g_internal_data->option_flags.lang_asm || g_system_data->compat_mode || g_internal_data->option_flags.k)) + incompat = TRUE; + if (g_internal_data->mcpp_mode != STD && g_internal_data->option_flags.trig) { + if (g_internal_data->option_flags.trig != TRIGRAPHS_INIT) + incompat = TRUE; + else + g_internal_data->option_flags.trig = FALSE; + } + if (g_internal_data->mcpp_mode != STD && (g_internal_data->mcpp_debug & MACRO_CALL)) + incompat = TRUE; + if ((g_internal_data->mcpp_debug & MACRO_CALL) + && (g_internal_data->option_flags.lang_asm || g_internal_data->option_flags.c)) { + mcpp_fputs( "Disabled -K option.\n", DEST_ERR); + g_internal_data->mcpp_debug &= ~MACRO_CALL; + /* -a and -C options do not co-exist with -K */ + } + if (incompat) { + mcpp_fputs( "Incompatible options are specified.\n", DEST_ERR); + usage( '?'); + } + + g_internal_data->standard = (g_internal_data->mcpp_mode == STD || g_internal_data->mcpp_mode == POST_STD); + /* Modify magic characters in character type table. */ + if (! g_internal_data->standard) + g_internal_data->char_type[ DEF_MAGIC] = 0; + if (g_internal_data->mcpp_mode != STD) + g_internal_data->char_type[ IN_SRC] = 0; + if (g_internal_data->mcpp_mode == POST_STD || g_internal_data->mcpp_mode == KR) + g_internal_data->char_type[ TOK_SEP] = 0; /* TOK_SEP equals to COM_SEP */ + if (g_internal_data->mcpp_mode != STD) + g_internal_data->char_type[ MAC_INF] = 0; + + expand_init(); + /* Set function pointer to macro expansion routine */ +} + +#if COMPILER != GNUC + +static void init_cpu_macro ( + int gval, /* Argument of -G option for MSC */ + int sse /* Argument of -sse: option for MSC */ +) +/* + * Set predefined macros for CPU. + * This routine is called from do_options() only once. + * GCC-specific-build defines these macro by init_gcc_macro(). + */ +{ + const char * cpu_macro[][ 7] = { +#if SYS_FAMILY == SYS_UNIX + { "__i386__" +#if SYSTEM == SYS_CYGWIN + , "_X86_" +#endif + , NULL,}, + { "__x86_64__", "__amd64__", NULL,}, + { "__ppc__", "__powerpc__", NULL,}, + { "__ppc64__", "__powerpc64__", NULL,} +#elif SYS_FAMILY == SYS_WIN + { "_WIN32", "__WIN32__", "_X86_" +#if SYSTEM == SYS_MINGW + , "__i386__" +#endif + , NULL,}, + { "_WIN32", "_WIN64", "__WIN64__", "_M_AMD64", "_AMD64_", "_X64_" + , NULL,}, /* "_WIN32" is defined even on Windows 64 */ + { NULL,}, /* Not supported */ + { NULL,} /* Not supported */ +#endif + }; + const char ** macro; + int index; + + if (str_eq( g_system_data->arch, "i386")) + index = 0; + else if (str_eq( g_system_data->arch, "x86_64")) + index = 1; + else if (str_eq( g_system_data->arch, "ppc")) + index = 2; + else if (str_eq( g_system_data->arch, "ppc64")) + index = 3; + else + index = 9; + + if (index == 9) { /* Unknown CPU */ + look_and_install( "__" CPU "__", DEF_NOARGS_PREDEF, g_internal_data->empty_str, "1"); + return; + } + macro = cpu_macro[ index]; + while (*macro) + look_and_install( *macro++, DEF_NOARGS_PREDEF, g_internal_data->empty_str, "1"); +#if SYS_FAMILY == SYS_WIN + if (index == 0) { + char val[] = "600"; + if (gval) + val[ 0] = (char)gval; + look_and_install( "_M_IX86", DEF_NOARGS_PREDEF, g_internal_data->empty_str, val); + val[ 0] = '0' + (char)sse; + val[ 1] = '\0'; + look_and_install( "_M_IX86_FP", DEF_NOARGS_PREDEF, g_internal_data->empty_str, val); + } +#endif +} +#endif /* COMPILER != GNUC */ + +static void init_predefines( void) +/* + * Set or unset predefined macros. + */ +{ + char tmp[ 16]; + + if (g_system_data->std_val != -1L) { /* Version is specified */ + if (g_internal_data->cplus_val) + g_internal_data->cplus_val = g_system_data->std_val; /* Value of __cplusplus */ + else + g_internal_data->stdc_ver = g_system_data->std_val; /* Value of __STDC_VERSION__ */ + } else { + if (! g_internal_data->cplus_val) + g_internal_data->stdc_ver = g_internal_data->stdc_val ? STDC_VERSION : 0L; + } + + if (g_system_data->nflag) { + un_predefine( TRUE); + } else if (g_internal_data->stdc_val || g_internal_data->cplus_val) { +#if COMPILER != GNUC + un_predefine( FALSE); /* Undefine "unix" or so */ +#endif + } + sprintf( tmp, "%ldL", g_internal_data->cplus_val ? g_internal_data->cplus_val : g_internal_data->stdc_ver); + if (g_internal_data->cplus_val) { + look_and_install( "__cplusplus", DEF_NOARGS_STANDARD, g_internal_data->empty_str, tmp); + } else { + if (g_internal_data->stdc_ver) + look_and_install( "__STDC_VERSION__", DEF_NOARGS_STANDARD, g_internal_data->empty_str + , tmp); +#ifdef COMPILER_CPLUS + if (! g_system_data->nflag) /* Undefine pre-defined macro for C++ */ + undefine( COMPILER_CPLUS); +#endif + } + set_limit(); + g_internal_data->stdc2 = g_internal_data->cplus_val || g_internal_data->stdc_ver >= 199901L; + g_internal_data->stdc3 = (g_internal_data->cplus_val >= 199901L) || (g_internal_data->stdc_ver >= 199901L); + /* (cplus_val >= 199901L) makes C++ C99-compatible specs */ + if (g_internal_data->standard) + init_std_defines(); + if (g_internal_data->stdc3) + set_pragma_op(); +} + +static void init_std_defines( void) +/* + * For STD and POST_STD modes. + * The magic pre-defines are initialized with magic argument counts. + * expand_macro() notices this and calls the appropriate routine. + * DEF_NOARGS is one greater than the first "magic" definition. + * 'DEF_NOARGS - n' are reserved for pre-defined macros. + * __STDC_VERSION__ and __cplusplus are defined by chk_opts() and set_cplus(). + */ +{ + char tmp[ 16]; + char timestr[ 14]; + time_t tvec; + char * tstring; + + look_and_install( "__LINE__", DEF_NOARGS_DYNAMIC - 1, g_internal_data->empty_str, "-1234567890"); + /* Room for 11 chars (10 for long and 1 for '-' in case of wrap round. */ + look_and_install( "__FILE__", DEF_NOARGS_DYNAMIC - 2, g_internal_data->empty_str, g_internal_data->empty_str); + /* Should be stuffed */ + + /* Define __DATE__, __TIME__ as present date and time. */ + time( &tvec); + tstring = ctime( &tvec); + sprintf( timestr, "\"%.3s %c%c %.4s\"", + tstring + 4, + *(tstring + 8) == '0' ? ' ' : *(tstring + 8), + *(tstring + 9), + tstring + 20); + look_and_install( "__DATE__", DEF_NOARGS_DYNAMIC, g_internal_data->empty_str, timestr); + sprintf( timestr, "\"%.8s\"", tstring + 11); + look_and_install( "__TIME__", DEF_NOARGS_DYNAMIC, g_internal_data->empty_str, timestr); + + if (! look_id( "__STDC_HOSTED__")) { + /* + * Some compilers, e.g. GCC older than 3.3, define this macro by + * -D option. + */ + sprintf( tmp, "%d", STDC_HOSTED); + look_and_install( "__STDC_HOSTED__", DEF_NOARGS_PREDEF, g_internal_data->empty_str, tmp); + } +#if COMPILER != GNUC /* GCC do not undefine __STDC__ on C++ */ + if (g_internal_data->cplus_val) + return; +#endif + /* Define __STDC__ as 1 or such for Standard conforming compiler. */ + if (! look_id( "__STDC__")) { + sprintf( tmp, "%d", g_internal_data->stdc_val); + look_and_install( "__STDC__", DEF_NOARGS_STANDARD, g_internal_data->empty_str, tmp); + } +} + +#define LINE90LIMIT 32767 +#define LINE_CPLUS_LIMIT 32767 + +static void set_limit( void) +/* + * Set the minimum translation limits specified by the Standards. + */ +{ + if (g_internal_data->cplus_val) { /* Specified by C++ 1998 Standard */ + g_internal_data->std_limits.str_len = SLEN_CPLUS_MIN; + g_internal_data->std_limits.id_len = IDLEN_CPLUS_MIN; + g_internal_data->std_limits.n_mac_pars = NMACPARS_CPLUS_MIN; + g_internal_data->std_limits.exp_nest = EXP_NEST_CPLUS_MIN; + g_internal_data->std_limits.blk_nest = BLK_NEST_CPLUS_MIN; + g_internal_data->std_limits.inc_nest = INCLUDE_NEST_CPLUS_MIN; + g_internal_data->std_limits.n_macro = NMACRO_CPLUS_MIN; + g_internal_data->std_limits.line_num = LINE_CPLUS_LIMIT; + } else if (g_internal_data->stdc_ver >= 199901L) { /* Specified by C 1999 Standard */ + g_internal_data->std_limits.str_len = SLEN99MIN; + g_internal_data->std_limits.id_len = IDLEN99MIN; + g_internal_data->std_limits.n_mac_pars = NMACPARS99MIN; + g_internal_data->std_limits.exp_nest = EXP_NEST99MIN; + g_internal_data->std_limits.blk_nest = BLK_NEST99MIN; + g_internal_data->std_limits.inc_nest = INCLUDE_NEST99MIN; + g_internal_data->std_limits.n_macro = NMACRO99MIN; + g_internal_data->std_limits.line_num = LINE99LIMIT; + } else if (g_internal_data->standard) { /* Specified by C 1990 Standard */ + g_internal_data->std_limits.str_len = SLEN90MIN; + g_internal_data->std_limits.id_len = IDLEN90MIN; + g_internal_data->std_limits.n_mac_pars = NMACPARS90MIN; + g_internal_data->std_limits.exp_nest = EXP_NEST90MIN; + g_internal_data->std_limits.blk_nest = BLK_NEST90MIN; + g_internal_data->std_limits.inc_nest = INCLUDE_NEST90MIN; + g_internal_data->std_limits.n_macro = NMACRO90MIN; + g_internal_data->std_limits.line_num = LINE90LIMIT; + } + /* Else pre-Standard mode */ +} + +static void set_pragma_op( void) +/* + * #define _Pragma(a) _Pragma ( a ) + * Define _Pragma() operator as a special macro so as to be searched + * easily. The unusual 'DEF_PRAGMA' is a marker of this psuedo + * macro. + */ +{ + const char * name = "_Pragma"; + char tmp[ 16]; + + sprintf( tmp, "%c%s ( %c%c )", DEF_MAGIC, name, MAC_PARM, 1); + /* Replacement text */ + look_and_install( name, DEF_PRAGMA, "a", tmp); +} + +void init_sys_macro( void) +/* + * Define system-specific macros and some Standard required macros + * and undefine macros specified by -U options. + */ +{ + /* This order is important. */ + def_macros(); /* Define macros specified by -D */ +#if COMPILER == GNUC + chk_env(); +#endif + init_predefines(); /* Define predefined macros */ +#if COMPILER == GNUC + init_gcc_macro(); +#elif COMPILER == MSC + init_msc_macro(); +#endif + undef_macros(); /* Undefine macros specified by -U */ + if (g_internal_data->mcpp_debug & MACRO_CALL) + dump_def( FALSE, TRUE); /* Finally putout current macro names */ +} + +void at_start( void) +/* + * Do the commands prior to processing main source file after do_options(). + */ +{ + char * env; + FILEINFO * file_saved = g_internal_data->infile; + + /* + * Set multi-byte character encoding according to environment variables + * LC_ALL, LC_CTYPE and LANG -- with preference in this order. + */ + if (! g_system_data->mb_changed) { /* -m option precedes */ + if ((env = getenv( "LC_ALL")) != NULL) + set_encoding( env, "LC_ALL", 0); + else if ((env = getenv( "LC_CTYPE")) != NULL) + set_encoding( env, "LC_CTYPE", 0); + else if ((env = getenv( "LANG")) != NULL) + set_encoding( env, "LANG", 0); + } + +#if COMPILER == GNUC || COMPILER == MSC + if (g_internal_data->option_flags.dollar_in_name) + g_internal_data->char_type[ 0x24] |= LET; /* Enable '$' in identifiers */ + /* + * Do the -include (-Fl for MSC) options in the specified order. + * Note: This functionality is implemented as nested #includes + * which results the same effect as sequential #includes. + */ + { + char ** preinc; + /* + * Note: Here, 'infile' is the main input file, which is pseudo- + * parent file of the files to pre-include. So, we must + * temporarily set the infile's directory to the current directory + * in order to preinclude the files relative to it. + */ + preinc = g_system_data->preinc_end; + while (g_system_data->preinclude <= --preinc && *preinc != NULL) + open_file( &g_internal_data->empty_str, NULL, *preinc, TRUE, TRUE, FALSE); + } +#endif + + put_info( file_saved); +} + +static void put_info( + FILEINFO * sharp_file +) +/* + * Putout compiler-specific information. + */ +{ + if (g_internal_data->no_output || g_internal_data->option_flags.p) + return; + sharp_file->line++; + sharp( sharp_file, 0); + sharp_file->line--; +#if COMPILER == GNUC + if (gcc_work_dir) + mcpp_fprintf( DEST_OUT, "%s%ld \"%s%c\"\n" + , g_internal_data->std_line_prefix ? "#line " : LINE_PREFIX + , 1, g_system_data->cur_work_dir, '/'); + /* Putout the current directory as a #line line as: */ + /* '# 1 "/abs-path/cur_dir//"'. */ + mcpp_fprintf( DEST_OUT, "%s%ld \"\"\n" + , g_internal_data->std_line_prefix ? "#line " : LINE_PREFIX , 1); + mcpp_fprintf( DEST_OUT, "%s%ld \"\"\n" + , g_internal_data->std_line_prefix ? "#line " : LINE_PREFIX , 1); + mcpp_fprintf( DEST_OUT, "%s%ld \"%s\"%s\n" + , g_internal_data->std_line_prefix ? "#line " : LINE_PREFIX, 1, g_internal_data->cur_fullname + , ! str_eq( g_internal_data->cur_fullname, sharp_file->full_fname) ? " 1" : null); + /* Suffix " 1" for the file specified by -include */ +#endif +} + +static char * set_files( + int argc, + char ** argv, + char ** in_pp, + char ** out_pp +) +/* + * Set input and/or output files. + */ +{ + char * cp; + + if (*in_pp == NULL) { /* Input file */ + cp = argv[ g_system_data->mcpp_optind++]; +#if SYS_FAMILY == SYS_WIN + cp = bsl2sl( cp); +#endif + *in_pp = cp; + } + if (g_system_data->mcpp_optind < argc && argv[ g_system_data->mcpp_optind][ 0] != '-' + && *out_pp == NULL) { + cp = argv[ g_system_data->mcpp_optind++]; +#if SYS_FAMILY == SYS_WIN + cp = bsl2sl( cp); +#endif + *out_pp = cp; /* Output file */ + } + if (g_system_data->mcpp_optind >= argc) + return NULL; /* Exhausted command line arguments */ + if (argv[ g_system_data->mcpp_optind][ 0] == '-') + return argv[ g_system_data->mcpp_optind]; /* More options */ + cfatal( "Excessive file argument \"%s\"", argv[ g_system_data->mcpp_optind], 0L , NULL); + return NULL; +} + +static void set_env_dirs( void) +/* + * Add to include path those specified by environment variables. + */ +{ + const char * env; + + if (g_internal_data->cplus_val) { + if ((env = getenv( ENV_CPLUS_INCLUDE_DIR)) != NULL) + parse_env( env); + } + if ((env = getenv( ENV_C_INCLUDE_DIR)) != NULL) + parse_env( env); +} + +static void parse_env( + const char * env +) +/* + * Parse environmental variable and append the path to include-dir-list. + */ +{ + char * save; + char * save_start; + char * p; + int sep; + + save = save_start = save_string( env); + while (*save) { + p = save; + while (*p && *p != ENV_SEP) + p++; + if (p != save) { /* Variable separator */ + sep = *p; + *p = EOS; + set_a_dir( save); + if (sep == EOS) + break; + save = ++p; + } + while (*save == ENV_SEP) + ++save; + } + free( save_start); +} + +static void set_sys_dirs( + int set_cplus_dir /* Set C++ include-directory too */ +) +/* + * Set site-specific and system-specific directories to the include directory + * list. + */ +{ + if (g_internal_data->cplus_val && set_cplus_dir) { +#ifdef CPLUS_INCLUDE_DIR1 + set_a_dir( CPLUS_INCLUDE_DIR1); +#endif +#ifdef CPLUS_INCLUDE_DIR2 + set_a_dir( CPLUS_INCLUDE_DIR2); +#endif +#ifdef CPLUS_INCLUDE_DIR3 + set_a_dir( CPLUS_INCLUDE_DIR3); +#endif +#ifdef CPLUS_INCLUDE_DIR4 + set_a_dir( CPLUS_INCLUDE_DIR4); +#endif + } + +#if SYS_FAMILY == SYS_UNIX + set_a_dir( "/usr/local/include"); +#endif + +#ifdef C_INCLUDE_DIR1 + set_a_dir( C_INCLUDE_DIR1); +#endif +#ifdef C_INCLUDE_DIR2 + set_a_dir( C_INCLUDE_DIR2); +#endif + +#if SYS_FAMILY == SYS_UNIX +#if SYSTEM == SYS_CYGWIN + if (no_cygwin) /* -mno-cygwin */ + set_a_dir( "/usr/include/mingw"); + else + set_a_dir( "/usr/include"); +#else + set_a_dir( "/usr/include"); /* Should be placed after C_INCLUDE_DIR? */ +#endif +#endif +} + +static void set_a_dir( + const char * dirname /* The path-name */ +) +/* + * Append an include directory. + * This routine is called from the following routines (in this order). + * 1. do_options() by -I option. + * 2. do_options() by -isystem option (for GNUC). + * 3. set_env_dirs() by environment variables. + * 4. set_sys_dirs() by CPLUS_INCLUDE_DIR?, C_INCLUDE_DIR? and system- + * specifics (unless -I- or -nostdinc option is specified). + * Ignore non-existent directory. + * Note that this routine should be called only in initializing steps, + * because increase of include dirs causes reallocation of incdir[]. + * Note: a trailing PATH-DELIM is appended by norm_path(). + */ +{ + char * norm_name; + const char ** ip; + + if (g_system_data->incdir == NULL) { /* Should be initialized */ + g_system_data->max_inc = INIT_NUM_INCLUDE; + g_system_data->incdir = (const char **) xmalloc( sizeof (char *) * g_system_data->max_inc); + g_system_data->incend = &g_system_data->incdir[ 0]; + } else if (g_system_data->incend - g_system_data->incdir >= g_system_data->max_inc) { /* Buffer full */ +#if SYSTEM == SYS_MAC + size_t framework_pos = g_system_data->to_search_framework - g_system_data->incdir; +#endif +#if COMPILER == GNUC + size_t sys_pos = 0; + if (sys_dirp) + sys_pos = sys_dirp - g_system_data->incdir; +#endif + g_system_data->incdir = (const char **) xrealloc( (char *) g_system_data->incdir + , sizeof (char *) * g_system_data->max_inc * 2); + g_system_data->incend = &g_system_data->incdir[ g_system_data->max_inc]; +#if COMPILER == GNUC + if (sys_pos) + sys_dirp = &g_system_data->incdir[ sys_pos]; +#endif +#if SYSTEM == SYS_MAC + g_system_data->to_search_framework = &g_system_data->incdir[ framework_pos]; +#endif + g_system_data->max_inc *= 2; + } + + if (dirname == NULL) + return; /* Only to initialize incdir[] */ + norm_name = norm_dir( dirname, FALSE); + if (! norm_name) /* Non-existent */ + return; + for (ip = g_system_data->incdir; ip < g_system_data->incend; ip++) { + if (str_case_eq( *ip, norm_name)) { + if (g_internal_data->option_flags.v && ! (g_internal_data->mcpp_debug & MACRO_CALL)) + mcpp_fprintf( DEST_ERR, "Duplicate directory \"%s\" is ignored\n" + , norm_name); + free( norm_name); /* Already registered */ + return; + } + } + /* Register new directory */ + *g_system_data->incend++ = norm_name; +} + +#if SYSTEM == SYS_MAC && COMPILER == GNUC +/* Definitions for "header map" file of Xcode / Apple-GCC. */ +/* These definitions were taken from cpplib.h of Apple-GCC-4.0.1 */ + +#define HMAP_SAME_ENDIANNESS_MAGIC \ + (((((('h' << 8) | 'm') << 8) | 'a') << 8) | 'p') + +typedef unsigned short uint16; +typedef unsigned int uint32; + +struct hmap_bucket +{ + uint32 key; /* Offset (into strings) of key */ + struct { + uint32 prefix; /* Offset (into strings) of value prefix */ + uint32 suffix; /* Offset (into strings) of value suffix */ + } value; /* Value (prefix- and suffix-strings) */ +}; + +struct hmap_header_map +{ + uint32 magic; /* Magic word, also indicates byte order */ + uint16 version; /* Version number -- currently 1 */ + uint16 _reserved; /* Reserved for future use -- zero for now */ + uint32 strings_offset; /* Offset to start of string pool */ + uint32 count; /* Number of entries in the string table */ + uint32 capacity; /* Number of buckets (always a power of 2) */ + uint32 max_value_length; + /* Length of longest result path (excl. '\0') */ + struct hmap_bucket buckets[1]; + /* Inline array of 'capacity' maptable buckets */ + /* Strings follow the buckets, at strings_offset. */ +}; +#endif + +static char * norm_dir( + const char * dirname, /* Directory path to normalize */ + int framework /* Setting a framework directory*/ +) +/* + * Normalize include directory path. + * Handle -isysroot option for GCC, including framework directory for SYS_MAC. + */ +{ + char * norm_name; + +#if COMPILER == GNUC + if (sysroot && sys_dirp) { + /* Logical system root specified and dirname is system header dir */ + char delim[ 2] = { EOS, EOS}; + char * dir; +#if SYSTEM == SYS_MAC + if (! framework && memcmp( dirname, "/usr/", 5) != 0) + return NULL; /* /Developer/usr/lib/gcc/ */ +#endif + if (dirname[ 0] != PATH_DELIM) + delim[ 0] = PATH_DELIM; + dir = xmalloc( strlen( sysroot) + strlen( dirname) + 2); + sprintf( dir, "%s%s%s", sysroot, delim, dirname); + dirname = dir; + } +#endif +#if SYSTEM == SYS_MAC && COMPILER == GNUC + if (strlen( dirname) > 5 + && str_case_eq( dirname + strlen( dirname) - 5, ".hmap")) { + /* "header map" file (not an include directory) */ + norm_name = norm_path( null, dirname, FALSE, TRUE); + if (! norm_name && g_internal_data->option_flags.v) + mcpp_fprintf( DEST_ERR, "Invalid header map file \"%s\" is ignored\n" + , dirname); + } else +#endif + { + norm_name = norm_path( dirname, NULL, FALSE, FALSE); + /* Normalize the pathname to compare */ + if (! norm_name && g_internal_data->option_flags.v && ! (g_internal_data->mcpp_debug & MACRO_CALL)) + mcpp_fprintf( DEST_ERR, "Non-existent directory \"%s\" is ignored\n" + , dirname); + } +#if COMPILER == GNUC + if (sysroot && sys_dirp) + free( dirname); +#endif + + return norm_name; +} + +static char * norm_path( + const char * dir, /* Include directory (maybe "", never NULL) */ + const char * fname, + /* Filename (possibly has directory part, or maybe NULL) */ + int inf, /* If TRUE, output some infs when (mcpp_debug & PATH) */ + int hmap /* "header map" file of Apple-GCC */ +) +/* + * Normalize the pathname removing redundant components such as + * "foo/../", "./" and trailing "/.". + * Append trailing "/" if 'fname' is NULL. + * Change relative path to absolute path. + * Dereference a symbolic linked file (or directory) to a real directory/file. + * Return a malloc'ed buffer, if the directory/file exists. + * Return NULL, if the specified directory/file does not exist or 'dir' is + * not a directory or 'fname' is not a regular file. + * This routine is called from set_a_dir(), init_gcc_macro(), do_once() and + * open_file(). + */ +{ + char * norm_name; /* The path-list converted */ + char * start; + char * cp1; + char * cp2; + char * abs_path; + int len; /* Should not be size_t */ + size_t start_pos = 0; + char slbuf1[ PATHMAX+1]; /* Working buffer */ +#if SYS_FAMILY == SYS_UNIX + char slbuf2[ PATHMAX+1]; /* Working buffer for dereferencing */ +#endif +#if SYSTEM == SYS_CYGWIN || SYSTEM == SYS_MINGW + static char * root_dir; + /* System's root directory in Windows file system */ + static size_t root_dir_len; +#if SYSTEM == SYS_CYGWIN + static char * cygdrive = "/cygdrive/"; /* Prefix for drive letter */ +#else + static char * mingw_dir; /* "/mingw" dir in Windows */ + static size_t mingw_dir_len; +#endif +#endif +#if HOST_COMPILER == MSC + struct _stat st_buf; +#else + struct stat st_buf; +#endif + + if (! dir || (*dir && is_full_path( fname))) + cfatal( "Bug: Wrong argument to norm_path()" /* _F_ */ + , NULL, 0L, NULL); + inf = inf && (g_internal_data->mcpp_debug & PATH); /* Output information */ + + strcpy( slbuf1, dir); /* Include directory */ + len = (int)strlen( slbuf1); + if (fname && len && slbuf1[ len - 1] != PATH_DELIM) { + slbuf1[ len] = PATH_DELIM; /* Append PATH_DELIM */ + slbuf1[ ++len] = EOS; + } else if (! fname && len && slbuf1[ len - 1] == PATH_DELIM) { + /* stat() of some systems do not like trailing '/' */ + slbuf1[ --len] = EOS; + } + if (fname) + strcat( slbuf1, fname); + if (pk_stat( slbuf1, & st_buf) != 0 /* Non-existent */ + || (! fname && ! S_ISDIR( st_buf.st_mode)) + /* Not a directory though 'fname' is not specified */ + || (fname && ! S_ISREG( st_buf.st_mode))) + /* Not a regular file though 'fname' is specified */ + return NULL; +#if SYSTEM == SYS_MAC && COMPILER == GNUC + if (hmap) { /* Dirty "header map" file */ + struct hmap_header_map hmap; + size_t cnt; + SIOHandle * fp; + fp = fopen( fname, "r"); + cnt = fread( & hmap, sizeof (struct hmap_header_map), 1, fp); + pk_fclose( fp); + if (cnt == 0 || hmap.magic != HMAP_SAME_ENDIANNESS_MAGIC) + return NULL; + } +#endif + if (! fname) { + slbuf1[ len] = PATH_DELIM; /* Append PATH_DELIM */ + slbuf1[ ++len] = EOS; + } +#if SYS_FAMILY == SYS_UNIX + /* Dereference symbolic linked directory or file, if any */ + slbuf1[ len] = EOS; /* Truncate PATH_DELIM and 'fname' part, if any */ + slbuf2[ 0] = EOS; + if (*dir && ! fname) { /* Registering include directory */ + /* Symbolic link check of directories are required */ + deref_syml( slbuf1, slbuf2, slbuf1); + } else if (fname) { /* Regular file */ + len = strlen( slbuf1); + strcat( slbuf1, fname); + deref_syml( slbuf1, slbuf2, slbuf1 + len); + /* Symbolic link check of directory */ + if ((len = readlink( slbuf1, slbuf2, PATHMAX)) > 0) { + /* Dereference symbolic linked file (not directory) */ + *(slbuf2 + len) = EOS; + cp1 = slbuf1; + if (slbuf2[ 0] != PATH_DELIM) { /* Relative path */ + cp2 = strrchr( slbuf1, PATH_DELIM); + if (cp2) /* Append to the source directory */ + cp1 = cp2 + 1; + } + strcpy( cp1, slbuf2); + } + } + if (inf) { + if (slbuf2[ 0]) + mcpp_fprintf( DEST_DBG, "Dereferenced \"%s%s\" to \"%s\"\n" + , dir, fname ? fname : null, slbuf1); + } +#endif + len = (int)strlen( slbuf1); + start = norm_name = xmalloc( len + 1); /* Need a new buffer */ + strcpy( norm_name, slbuf1); +#if SYS_FAMILY == SYS_WIN + bsl2sl( norm_name); +#endif +#if SPECIAL_PATH_DELIM /* ':' ? */ + for (cp1 = norm_name; *cp1 != EOS; cp1++) { + if (*cp1 == PATH_DELIM) + *cp1 = '/'; + } +#endif + cp1 = norm_name; + +#if SYSTEM == SYS_CYGWIN + /* Convert to "/cygdirve/x/dir" style of absolute path-list */ + if (len >= 8 && (memcmp( cp1, "/usr/bin", 8) == 0 + || memcmp( cp1, "/usr/lib", 8) == 0)) { + memmove( cp1, cp1 + 4, len - 4 + 1); /* Remove "/usr" */ + len -= 4; + } + if (*cp1 == '/' && (len < 10 || memcmp( cp1, cygdrive, 10) != 0)) { + /* /dir, not /cygdrive/ */ + if (! root_dir_len) { /* Should be initialized */ + /* Convert "X:\DIR-list" to "/cygdrive/x/dir-list" */ + root_dir = xmalloc( strlen( CYGWIN_ROOT_DIRECTORY) + 1); + strcpy( root_dir, CYGWIN_ROOT_DIRECTORY); + *(root_dir + 1) = *root_dir; /* "x:/" to " x/" */ + cp1 = xmalloc( strlen( cygdrive) + strlen( root_dir)); + strcpy( cp1, cygdrive); + strcat( cp1, root_dir + 1); + free( root_dir); + root_dir = cp1; + root_dir_len = strlen( root_dir); + } + cp1 = xmalloc( root_dir_len + len + 1); + strcpy( cp1, root_dir); + strcat( cp1, norm_name); /* Convert to absolute path */ + free( norm_name); + norm_name = start = cp1; + len += root_dir_len; + } +#endif + +#if SYSTEM == SYS_MINGW + /* Handle the mess of MinGW's path-list */ + /* Convert to "x:/dir" style of absolute path-list */ + if (*cp1 == PATH_DELIM && isalpha( *(cp1 + 1)) + && *(cp1 + 2) == PATH_DELIM) { /* /c/, /d/, etc*/ + *cp1 = *(cp1 + 1); + *(cp1 + 1) = ':'; /* Convert to c:/, d:/, etc */ + } else if (memcmp( cp1, "/mingw", 6) == 0) { + if (! mingw_dir_len) { /* Should be initialized */ + mingw_dir_len = strlen( MINGW_DIRECTORY); + mingw_dir = xmalloc( mingw_dir_len + 1); + strcpy( mingw_dir, MINGW_DIRECTORY); + } + cp1 = xmalloc( mingw_dir_len + len + 1); + strcpy( cp1, mingw_dir); + strcat( cp1, norm_name + 6); /* Convert to absolute path */ + free( norm_name); + norm_name = start = cp1; + len += mingw_dir_len; + } else if (memcmp( cp1, "/usr", 4) == 0) { + memmove( cp1, cp1 + 4, len - 4 + 1); /* Remove "/usr" */ + len -= 4; + } + if (*cp1 == '/') { /* /dir or / */ + if (! root_dir_len) { /* Should be initialized */ + root_dir_len = strlen( MSYS_ROOT_DIRECTORY); + root_dir = xmalloc( root_dir_len + 1); + strcpy( root_dir, MSYS_ROOT_DIRECTORY); + } + cp1 = xmalloc( root_dir_len + len + 1); + strcpy( cp1, root_dir); + strcat( cp1, norm_name); /* Convert to absolute path */ + free( norm_name); + norm_name = start = cp1; + len += root_dir_len; + } +#endif + +#if SYS_FAMILY == SYS_WIN + if (*(cp1 + 1) == ':') + start = cp1 += 2; /* Next to the drive letter */ + start_pos = 2; +#endif + if (len == 1 && *norm_name == '/') /* Only "/" */ + return norm_name; + + if (strncmp( cp1, "./", 2) == 0) /* Remove beginning "./" */ + memmove( cp1, cp1 + 2, strlen( cp1 + 2) + 1); /* +1 for EOS */ + if (*start != '/') { /* Relative path to current directory */ + /* Make absolute path */ + abs_path = xmalloc( len + strlen( g_system_data->cur_work_dir) + 1); + cp1 = stpcpy( abs_path, g_system_data->cur_work_dir); + strcpy( cp1, start); + free( norm_name); + norm_name = abs_path; + start = cp1 = norm_name + start_pos; + } + + while ((cp1 = strstr( cp1, "/./")) != NULL) + memmove( cp1, cp1 + 2, strlen( cp1 + 2) + 1); + /* Remove "/." of "/./" */ + cp1 = start; + /* Remove redundant "foo/../" */ + while ((cp1 = strstr( cp1, "/../")) != NULL) { + *cp1 = EOS; + if ((cp2 = strrchr( start, '/')) != NULL) { + if (*(cp1 - 1) != '.') { + memmove( cp2 + 1, cp1 + 4, strlen( cp1 + 4) + 1); + /* Remove "foo/../" */ + cp1 = cp2; + } else { /* Impossible */ + break; + } + } else { /* Impossible */ + break; + } + } + +#if SPECIAL_PATH_DELIM + for (cp1 = start; *cp1 != EOS; cp1++) { + if (*cp1 == '/') + *cp1 = PATH_DELIM; + } +#endif + if (inf) { + char debug_buf[ PATHMAX+1]; + strcpy( debug_buf, dir); + strcat( debug_buf, fname ? fname : g_internal_data->empty_str); +#if SYS_FAMILY == SYS_WIN + bsl2sl( debug_buf); +#endif + if (! str_eq( debug_buf, norm_name)) + mcpp_fprintf( DEST_DBG, "Normalized the path \"%s\" to \"%s\"\n" + , debug_buf, norm_name); + } + + return norm_name; +} + +#if SYS_FAMILY == SYS_UNIX + +static void deref_syml( + char * slbuf1, /* Original path-list */ + char * slbuf2, /* Working buffer */ + char * chk_start /* Pointer into slbuf1 */ +) +/* Dereference symbolic linked directory */ +{ + char * cp2; + int len; /* Should be int, not size_t */ + + while ((chk_start = strchr( chk_start, PATH_DELIM)) != NULL) { + *chk_start = EOS; + if ((len = readlink( slbuf1, slbuf2, PATHMAX)) > 0) { + /* Dereference symbolic linked directory */ + cp2 = strrchr( slbuf1, PATH_DELIM); /* Previous delimiter */ + *chk_start = PATH_DELIM; + strcpy( slbuf2 + len, chk_start); + if (slbuf2[ 0] == PATH_DELIM) { /* Absolute path */ + strcpy( slbuf1, slbuf2); + chk_start = slbuf1 + len + 1; + } else { + if (cp2) + chk_start = cp2 + 1; + else + chk_start = slbuf1; + strcpy( chk_start, slbuf2); /* Rewrite the path */ + chk_start += len; + } + } else { + *chk_start++ = PATH_DELIM; + } + } +} +#endif + +#if COMPILER == GNUC + +static void init_gcc_macro( void) +/* + * Predefine GCC macros. + * This routine should be called after opening output file in order to putout + * macro informations by -K option into the file. + * Also this routine should be called before undef_macros() in order to + * permit undefining a macro by -U option. + */ +{ + char fname[ BUFSIZ]; + char lbuf[ BUFSIZ]; + char * include_dir; /* The version-specific include directory */ + char * tmp; + SIOHandle * fp; + DEFBUF * defp; + const char * cp; + char * tp; + int i; + + if (g_system_data->nflag) /* -undef option */ + goto undef_special; + + tmp = xmalloc( strlen( INC_DIR) + strlen( "/mingw/mcpp-gcc-") + + strlen( g_system_data->arch) + 1); +#if SYSTEM == SYS_CYGWIN + if (no_cygwin) { + sprintf( tmp, "%s/mingw/mcpp-gcc-%s", INC_DIR, g_system_data->arch); + } else { + sprintf( tmp, "%s/mcpp-gcc-%s", INC_DIR, g_system_data->arch); + } +#else + sprintf( tmp, "%s/mcpp-gcc-%s", INC_DIR, g_system_data->arch); +#endif + include_dir = norm_path( tmp, NULL, TRUE, FALSE); + free( tmp); + + for (i = 0; i <= 1; i++) { + int nargs; + + if ((g_internal_data->mcpp_mode == POST_STD || g_system_data->ansi) && i == 0) + continue; /* POST_STD or __STRICT_ANSI__ does not */ + /* predefine non-conforming macros */ + /* The predefined macro file */ + cp = i ? "std" : "old"; + sprintf( fname, "%sg%s%d%d_predef_%s.h" + , include_dir, g_internal_data->cplus_val ? "xx" : "cc" + , gcc_maj_ver, gcc_min_ver, cp); + /* Note that norm_path() append a PATH_DELIM. */ + if ((fp = fopen( fname, "r")) == NULL) { + mcpp_fprintf( DEST_ERR, "The mode for %s has not been installed.\n" + , g_system_data->arch); + longjmp( g_internal_data->error_exit, -1); + } + nargs = i ? 0 : DEF_NOARGS_PREDEF_OLD; + /* g*_predef_std.h has DEF_NOARGS_PREDEF or non-negative args */ + /* while g*_predef_old.h has only DEF_NOARGS_PREDEF_OLD args */ + while (fgets( lbuf, BUFSIZ, fp) != NULL) { + unget_string( lbuf, "gcc_predefine"); + if (skip_ws() == '#' + && scan_token( skip_ws(), (tp = g_internal_data->work_buf, &tp), g_internal_data->work_end) + == NAM + && str_eq( g_internal_data->work_buf, "define")) { + defp = do_define( TRUE, nargs); /* Ignore re-definition */ + } + skip_nl(); + } + } + free( include_dir); + +undef_special: + if (look_id( "__OPTIMIZE__")) /* -O option is specified */ + undefine( "__NO_INLINE__"); +} + +static void chk_env( void) +/* + * Check the environment variables to specify output of dependency lines. + */ +{ + char * env; + char * cp; + + /* Output of dependency lines */ + if ((env = getenv( "DEPENDENCIES_OUTPUT")) == NULL) { + if ((env = getenv( "SUNPRO_DEPENDENCIES")) == NULL) + return; + else + g_internal_data->mkdep |= MD_SYSHEADER; + } + g_internal_data->mkdep |= MD_MKDEP; + if ((cp = strchr( env, ' ')) != NULL) { + *cp++ = EOS; + while (*cp == ' ') + cp++; + } + if (! g_system_data->mkdep_fp) /* Command line option precedes */ + g_system_data->mkdep_fp = fopen( env, "a"); + if (! g_system_data->mkdep_target) + g_system_data->mkdep_target = cp; +} + +#elif COMPILER == MSC + +static void init_msc_macro( void) +/* + * Define a few MSC-specific predefined macros. + */ +{ + DEFBUF * defp; + int i; + + defp = look_id( "_MSC_VER"); + i = atoi( defp->repl); + if (i >= 1400) { /* _MSC_VER >= 1400 */ + look_and_install( "_MT", DEF_NOARGS_PREDEF, null, "1"); + if (g_internal_data->cplus_val && ! g_system_data->wchar_t_modified) { + /* -Zc:wchar_t- was not specified */ + look_and_install( "_NATIVE_WCHAR_T_DEFINED", DEF_NOARGS_PREDEF + , null, "1"); + look_and_install( "_WCHAR_T_DEFINED", DEF_NOARGS_PREDEF, null + , "1"); + } + } +} + +#endif + +static void def_macros( void) +/* + * Define macros specified by -D option. + * This routine should be called before undef_macros(). + */ +{ + int i; + + for (i = 0; i < g_system_data->def_cnt; i++) + def_a_macro( 'D', g_system_data->def_list[ i]); +} + +static void undef_macros( void) +/* + * Undefine macros specified by -U option. + * This routine should be called after init_predefine(). + */ +{ + char * name; + int i; + + for (i = 0; i < g_system_data->undef_cnt; i++) { + name = g_system_data->undef_list[ i]; + if (look_id( name) != NULL) + undefine( name); + else if (g_internal_data->warn_level & 8) + mcpp_fprintf( DEST_ERR, "\"%s\" wasn't defined\n", name); + } +} + +void put_depend( + const char * filename +) +/* + * Append a header name to the source file dependency line. + */ +{ +#define MAX_OUT_LEN 76 /* Maximum length of output line */ +#define MKDEP_INITLEN (MKDEP_INIT * 0x100) +#define MKDEP_MAX (MKDEP_INIT * 0x10) +#define MKDEP_MAXLEN (MKDEP_INITLEN * 0x10) + + static char * output = NULL; /* File names */ + static size_t * pos = NULL; /* Offset to filenames */ + static int pos_num; /* Index of pos[] */ + static char * out_p; /* Pointer to output[] */ + static size_t mkdep_len; /* Size of output[] */ + static size_t pos_max; /* Size of pos[] */ + static SIOHandle * fp; /* Path to output dependency line */ + static size_t llen; /* Length of current physical output line */ + size_t * pos_p; /* Index into pos[] */ + size_t fnamlen; /* Length of filename */ + + if (fp == NULL) { /* Main source file. Have to initialize. */ +#if MCPP_LIB + if (output != NULL) { + free( output); + free( pos); + } +#endif + output = xmalloc( mkdep_len = MKDEP_INITLEN); + pos = (size_t *) xmalloc( (pos_max = MKDEP_INIT) * sizeof (size_t)); + out_p = md_init( filename, output); + fp = g_system_data->mkdep_fp; + llen = strlen( output); + pos_num = 0; /* Initialize for MCPP_LIB build */ + } else if (filename == NULL) { /* End of input */ + out_p = stpcpy( out_p, "\n\n"); + if (g_internal_data->mkdep & MD_PHONY) { + /* Output the phony target line for each recorded header files. */ + char * cp; + int c; + + if (strlen( output) * 2 + (pos_num * 2) >= MKDEP_MAXLEN) { + cerror( "Too long dependency line" /* _E_ */ + , NULL, 0L, NULL); + if (fp == g_internal_data->fp_out) + mcpp_fputs( output, DEST_OUT); + else + pk_fputs( output, fp); + return; + } else if (strlen( output) * 2 + (pos_num * 2) >= mkdep_len) { + /* Enlarge the buffer */ + size_t len = out_p - output; + output = xrealloc( output, mkdep_len *= 2); + out_p = output + len; + } + pos_num--; + for (pos_p = &pos[ 0]; pos_p <= &pos[ pos_num]; pos_p++) { + if (pos_p == &pos[ pos_num]) { /* End of output */ + for (cp = output + *pos_p; *cp != '\n'; cp++) + ; + c = '\n'; /* Append newline */ + } else { + cp = output + *(pos_p + 1) - 1; + while( *cp == ' ' || *cp == '\\' || *cp == '\n') + cp--; /* Remove trailing spaces */ + c = *(++cp); + } + *cp = EOS; + out_p = stpcpy( out_p, output + *pos_p); + out_p = stpcpy( out_p, ":\n\n"); + *cp = (char)c; + } + } + if (fp == g_internal_data->fp_out) { /* To the same path with normal preprocessing */ + mcpp_fputs( output, DEST_OUT); + } else { /* To the file specified by -MF, -MD, -MMD options */ + pk_fputs( output, fp); + pk_fclose( fp); + } + fp = NULL; /* Clear for the next call in MCPP_LIB build */ + return; + } + + fnamlen = strlen( filename); + /* Check the recorded filename */ + for (pos_p = pos; pos_p < &pos[ pos_num]; pos_p++) { + if (memcmp( output + *pos_p, filename, fnamlen) == 0) + return; /* Already recorded filename */ + } + /* Any new header. Append its name to output. */ + if (llen + fnamlen > MAX_OUT_LEN) { /* Line is long */ + out_p = stpcpy( out_p, " \\\n "); /* Fold it */ + llen = 1; + } + llen += fnamlen + 1; + if (pos_num >= MKDEP_MAX + || out_p + fnamlen + 1 >= output + MKDEP_MAXLEN) + cfatal( "Too long dependency line: %s", output, 0L, NULL); + /* Need to enlarge the buffer */ + if ((size_t)pos_num >= pos_max) { + pos = (size_t *) xrealloc( (char *) pos + , (pos_max *= 2) * sizeof (size_t *)); + } + if (output + mkdep_len <= out_p + fnamlen + 1) { + size_t len = out_p - output; + output = xrealloc( output, mkdep_len *= 2); + out_p = output + len; + } + *out_p++ = ' '; + pos[ pos_num++] = out_p - output; /* Remember the offset */ + /* Don't use pointer, since 'output' may be reallocated later. */ + out_p = stpcpy( out_p, filename); +} + +static char * md_init( + const char * filename, /* The source file name */ + char * output /* Output to dependency file */ +) +/* + * Initialize output file and target. + */ +{ + char prefix[ PATHMAX]; + char * cp = NULL; + size_t len; + char * out_p; + const char * target = filename; + const char * cp0; + + if (! g_system_data->mkdep_target || ! g_system_data->mkdep_fp) { /* Make target name */ +#ifdef PATH_DELIM + if ((cp0 = strrchr( target, PATH_DELIM)) != NULL) + target = cp0 + 1; +#endif + if ((cp0 = strrchr( target, '.')) == NULL) + len = strlen( target); + else + len = (size_t) (cp0 - target); + memcpy( prefix, target, len); + cp = prefix + len; + *cp++ = '.'; + } + + if (! g_system_data->mkdep_fp) { /* Unless already opened by -MF, -MD, -MMD options */ + if (g_internal_data->mkdep & MD_FILE) { + strcpy( cp, "d"); + g_system_data->mkdep_fp = pk_fopen( prefix, "w"); + } else { + g_system_data->mkdep_fp = g_internal_data->fp_out; /* Output dependency line to normal output */ + g_internal_data->no_output++; /* Without normal output */ + } + } + + if (g_system_data->mkdep_target) { /* -MT or -MQ option is specified */ + if (g_internal_data->mkdep & MD_QUOTE) { /* 'Quote' $, \t and space */ + out_p = md_quote( output); + } else { + out_p = stpcpy( output, g_system_data->mkdep_target); + } + } else { + strcpy( cp, OBJEXT); + out_p = stpcpy( output, prefix); + } + + *out_p++ = ':'; + *out_p = EOS; + return out_p; +} + +static char * md_quote( + char * output +) +/* + * 'Quote' $, tab and space. + * This function was written referring to GCC V.3.2 source. + */ +{ + char * p; + char * q; + + for (p = g_system_data->mkdep_target; *p; p++, output++) { + switch (*p) { + case ' ': + case '\t': + /* GNU-make treats backslash-space sequence peculiarly */ + for (q = p - 1; g_system_data->mkdep_target <= q && *q == '\\'; q--) + *output++ = '\\'; + *output++ = '\\'; + break; + case '$': + *output++ = '$'; + break; + default: + break; + } + *output = *p; + } + *output = EOS; + return output; +} + +static const char * toolong_fname = + "Too long header name \"%s%.0ld%s\""; /* _F_ */ +static const char * excess_token = + "Excessive token sequence \"%s\""; /* _E_, _W1_ */ + +int do_include( + int next /* TRUE if the directive is #include_next */ +) +/* + * Process the #include line. + * There are three variations: + * #include "file" search somewhere relative to the + * current (or source) directory, if not + * found, treat as #include . + * #include Search in an implementation-dependent + * list of places. + * #include macro-call Expand the macro call, it must be one of + * "file" or , process as such. + * On success : return TRUE; + * On failure of syntax : return FALSE; + * On failure of file opening : return FALSE. + * do_include() always absorbs the line (including the ). + */ +{ + const char * const no_name = "No header name"; /* _E_ */ + char header[ PATHMAX + 16]; + int token_type; + char * fname; + char * filename; + int delim; /* " or <, > */ + + if ((delim = skip_ws()) == '\n') { /* No argument */ + cerror( no_name, NULL, 0L, NULL); + return FALSE; + } + fname = g_internal_data->infile->bptr - 1; /* Current token for diagnosis */ + + if (g_internal_data->standard && (g_internal_data->char_type[ delim] & LET)) { /* Maybe macro */ + int c; + char *hp; + + hp = header; + *hp = EOS; + c = delim; + while (get_unexpandable( c, FALSE) != NO_TOKEN) { + /* Expand any macros in the line */ + if (header + PATHMAX < hp + (int) (g_internal_data->workp - g_internal_data->work_buf)) + cfatal( toolong_fname, header, 0L, g_internal_data->work_buf); + hp = stpcpy( hp, g_internal_data->work_buf); + while (g_internal_data->char_type[ c = get_ch()] & HSP) + *hp++ = (char)c; + } + *hp = EOS; /* Ensure to terminate */ + if (g_internal_data->macro_line == MACRO_ERROR) /* Unterminated macro */ + return FALSE; /* already diagnosed. */ + unget_string( header, NULL); /* To re-read */ + delim = skip_ws(); + if (delim == '\n') { + cerror( no_name, NULL, 0L, NULL); /* Expanded to */ + return FALSE; /* 0 token. */ + } + } + + token_type = scan_token( delim, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp) + , g_internal_data->work_buf + PATHMAX); + if (token_type == STR) /* String literal form */ + goto found_name; + else if (token_type == OPE && g_internal_data->openum == OP_LT) /* '<' */ + g_internal_data->workp = scan_quote( delim, g_internal_data->work_buf, g_internal_data->work_buf + PATHMAX, TRUE); + /* Re-construct or diagnose */ + else /* Any other token in- */ + goto not_header; /* cluding <=, <<, <% */ + + if (g_internal_data->workp == NULL) /* Missing closing '>' */ + goto syntax_error; + +found_name: + *--g_internal_data->workp = EOS; /* Remove the closing and */ + fname = save_string( &g_internal_data->work_buf[ 1]); /* the starting delimiter. */ + + if (skip_ws() != '\n') { + if (g_internal_data->standard) { + cerror( excess_token, g_internal_data->infile->bptr-1, 0L, NULL); + skip_nl(); + goto error; + } else if (g_internal_data->mcpp_mode == OLD_PREP) { + skip_nl(); + } else { + if (g_internal_data->warn_level & 1) + cwarn( excess_token, g_internal_data->infile->bptr-1, 0L, NULL); + skip_nl(); + } + } + +#if SYS_FAMILY == SYS_WIN + bsl2sl( fname); +#endif + filename = fname; +#if NO_DIR /* Unofficial feature */ + if (no_dir) { /* Strip directory components */ + char src_dir[ PATHMAX] = { EOS, }; + if (has_directory( fname, src_dir)) + filename = fname + strlen( src_dir); + delim = '"'; /* Even a system header is handled as a local one */ + } +#endif + if (open_include( filename, (delim == '"'), next)) { + /* 'fname' should not be free()ed, it is used as file-> */ + /* real_fname and has been registered into fnamelist[] */ + return TRUE; + } + + cerror( "Can't open include file \"%s\"", filename, 0L, NULL); /* _E_ */ +error: + free( fname); + return FALSE; + +not_header: + cerror( "Not a header name \"%s\"", fname, 0L, NULL); /* _E_ */ +syntax_error: + skip_nl(); + return FALSE; +} + +static int open_include( + char * filename, /* File name to include */ + int searchlocal, /* TRUE if #include "file" */ + int next /* TRUE if #include_next */ +) +/* + * Open an include file. This routine is only called from do_include() above. + * It searches the list of directories via search_dir() and opens the file + * via open_file(), linking it into the list of active files. + * Returns TRUE if the file was opened, FALSE if it fails. + */ +{ + char src_dir[ PATHMAX] = { EOS, }; /* Directory part of includer */ + int full_path; /* Filename is full-path-list */ + int has_dir = FALSE; /* Includer has directory part */ + int has_dir_src = FALSE; + int has_dir_fname = FALSE; + + full_path = is_full_path( filename); + + if (!full_path && searchlocal && (g_system_data->search_rule & SOURCE)) { + has_dir_src = has_directory( g_internal_data->infile->src_dir, src_dir); + has_dir_fname = has_directory( g_internal_data->infile->real_fname + , src_dir + strlen( src_dir)); + /* Get directory part of the parent file of the file to include.*/ + /* Note that g_internal_data->infile->dirp of main input file is set to "" and */ + /* remains the same even if -include options are processed. */ + has_dir = has_dir_src || has_dir_fname + || (**(g_internal_data->infile->dirp) != EOS); + } + if (g_internal_data->mcpp_debug & PATH) + mcpp_fprintf( DEST_DBG, "filename: %s\n", filename); + +#if COMPILER == GNUC + if (! full_path) { + if (i_split /* -I- option is specified */ + || next) /* or #include_next */ + goto search_dirs; + } +#endif + + if ((searchlocal && ((g_system_data->search_rule & CURRENT) || !has_dir)) || full_path) { + /* + * Look in local directory first. + * Try to open filename relative to the "current directory". + */ + if (open_file( &g_internal_data->empty_str, NULL, filename, searchlocal && !full_path + , FALSE, FALSE)) + return TRUE; + if (full_path) + return FALSE; + } + + if (searchlocal && (g_system_data->search_rule & SOURCE) && has_dir) { + /* + * Look in local directory of source file. + * Try to open filename relative to the "source directory". + */ + if (open_file( g_internal_data->infile->dirp, src_dir, filename, TRUE, FALSE, FALSE)) + return TRUE; + } + +#if COMPILER == MSC + if (searchlocal) { + /* Visual C searches ancestor source's directory, too. */ + FILEINFO * file = g_internal_data->infile; + while ((file = file->parent) != NULL) { + /* Search each parent includer's directory */ + if (open_file( file->dirp, src_dir, filename, TRUE, FALSE, FALSE)) + return TRUE; + } + } +#endif +#if COMPILER == GNUC +search_dirs: + if (searchlocal) { + /* Search the directories specified by -iquote option, if any. */ + const char ** qdir; + for (qdir = quote_dir; qdir < quote_dir_end; qdir++) { + if (open_file( qdir, NULL, filename, FALSE, FALSE, FALSE)) + return TRUE; + } + } +#endif + /* Search the include directories */ + if (search_dir( filename, searchlocal, next)) + return TRUE; + + return FALSE; +} + +static int has_directory( + const char * source, /* Filename to examine */ + char * directory /* Put directory stuff here */ +) +/* + * If a directory is found in the 'source' filename string (i.e. "includer"), + * the directory part of the string is copied to 'directory' and + * has_directory() returns TRUE. + * Else, nothing is copied and it returns FALSE. + */ +{ + const char * sp; + size_t len; + + if (! source) + return FALSE; + if ((sp = strrchr( source, PATH_DELIM)) == NULL) { + return FALSE; + } else { + len = (size_t)(sp - source) + 1; /* With path-delimiter */ + memcpy( directory, source, len); + directory[ len] = EOS; + return TRUE; + } +} + +static int is_full_path( + const char * path +) +/* + * Check whether the path is a full (absolute) path list or not. + */ +{ + if (! path) + return FALSE; +#if SYS_FAMILY == SYS_UNIX + if (path[0] == PATH_DELIM) +#elif SYS_FAMILY == SYS_WIN + if ((path[1] == ':' && path[2] == PATH_DELIM) /* "C:/path" */ + || path[0] == PATH_DELIM) /* Root dir of current drive */ +#elif 1 +/* For other systems you should write code here. */ + if (path[0] == PATH_DELIM) +#endif + return TRUE; + else + return FALSE; +} + +static int search_dir( + char * filename, /* File name to include */ + int searchlocal, /* #include "header.h" */ + int next /* TRUE if #include_next */ +) +/* + * Look in any directories specified by -I command line arguments, + * specified by environment variable, then in the builtin search list. + */ +{ + const char ** incptr; /* -> inlcude directory */ + + incptr = g_system_data->incdir; +#if COMPILER == GNUC + if (next && **g_internal_data->inc_dirp != EOS) + incptr = g_internal_data->inc_dirp + 1; + /* In case of include_next search after the includer's directory */ +#endif + + for ( ; incptr < g_system_data->incend; incptr++) { + if (strlen( *incptr) + strlen( filename) >= PATHMAX) + cfatal( toolong_fname, *incptr, 0L, filename); /* _F_ */ +#if SYSTEM == SYS_MAC + if (incptr == g_system_data->to_search_framework && ! searchlocal) { + /* Now search the framework dirs */ + if (search_framework( filename)) { /* Found */ + if (g_system_data->in_import) /* "#import"ed file is once only */ + do_once( g_internal_data->infile->full_fname); + return TRUE; + } + /* Else continue to search incptr */ + } +#endif + if (open_file( incptr, NULL, filename, FALSE, FALSE, FALSE)) + /* Now infile has been renewed */ + return TRUE; + } + + return FALSE; +} + +static int open_file( + const char ** dirp, /* Pointer to include directory */ + const char * src_dir, /* Source directory of includer */ + const char * filename, /* Filename (possibly has directory) */ + int local, /* #include "file" */ + int include_opt, /* Specified by -include option */ + int sys_frame /* System framework header (for SYS_MAC)*/ +) +/* + * Open a file, add it to the linked list of open files, close the includer + * if nessesary and truncate the includer's buffer. + * This is called from open_include() and at_start(). + */ +{ + char dir_fname[ PATHMAX] = { EOS, }; +#if HOST_COMPILER == BORLANDC + /* Borland's fopen() does not set errno. */ + static int max_open = FOPEN_MAX - 5; +#else + static int max_open; +#endif + int len; + FILEINFO * file = g_internal_data->infile; + SIOHandle * fp; + char * fullname; + const char * fname; + + errno = 0; /* Clear errno possibly set by path searching */ +#if SYSTEM == SYS_MAC && COMPILER == GNUC + if (strlen( *dirp) > 5 + && str_case_eq( *dirp + strlen( *dirp) - 5, ".hmap")) { + /* Search header map file for a header */ + if (! search_header_map( *dirp, filename, dir_fname)) + return NULL; + fname = dir_fname; /* Found a path-list */ + dirp = &null; + goto search; + } else +#endif + { + if (g_internal_data->mcpp_debug & PATH) + mcpp_fprintf( DEST_DBG, "Searching %s%s%s\n", *dirp + , src_dir ? src_dir : g_internal_data->empty_str, filename); + } + /* src_dir is usually NULL. This is specified to */ + /* search the source directory of the includer. */ + if (src_dir && *src_dir != EOS) { + strcpy( dir_fname, src_dir); + strcat( dir_fname, filename); + fname = dir_fname; + } else { + fname = filename; + } +search: + fullname = norm_path( *dirp, fname, TRUE, FALSE); + /* Convert to absolute path */ + if (! fullname) /* Non-existent or directory */ + return FALSE; + if (g_internal_data->standard && included( fullname)) /* Once included */ + goto label_true; + + if ((max_open != 0 && max_open <= g_internal_data->include_nest) + /* Exceed the known limit of open files */ + || ((fp = pk_fopen( fullname, "r")) == NULL && errno == EMFILE)) { + /* Reached the limit for the first time */ + if (g_internal_data->mcpp_debug & PATH) { +#if HOST_COMPILER == BORLANDC + if (g_internal_data->include_nest == FOPEN_MAX - 5) +#else + if (max_open == 0) +#endif + mcpp_fprintf( DEST_DBG, + "#include nest reached at the maximum of system: %d, returned errno: %d\n" + , g_internal_data->include_nest, errno); + } + /* + * Table of open files is full. + * Remember the file position and close the includer. + * The state will be restored by get_line() on end of the included. + */ + file->pos = pk_ftell( file->fp); + pk_fclose( file->fp); + /* In case of failure, re-open the includer */ + if ((fp = pk_fopen( fullname, "r")) == NULL) { + file->fp = pk_fopen( g_internal_data->cur_fullname, "r"); + pk_fseek( file->fp, file->pos, SEEK_SET); + goto label_false; + } + if (max_open == 0) /* Remember the limit of the system */ + max_open = g_internal_data->include_nest; + } else if (fp == NULL) /* No read permission */ + goto label_false; + /* Truncate buffer of the includer to save memory */ + len = (int) (file->bptr - file->buffer); + if (len) { + file->buffer = xrealloc( file->buffer, len + 1); + file->bptr = file->buffer + len; + } + + if (! include_opt) + sharp( NULL, 0); /* Print includer's line num and fname */ + add_file( fp, src_dir, filename, fullname, include_opt); + /* Add file-info to the linked list. 'infile' has been just renewed */ + /* + * Remember the directory for #include_next. + * Note: inc_dirp is restored to the parent includer's directory + * by get_ch() when the current includer is finished. + */ + g_internal_data->infile->dirp = g_internal_data->inc_dirp = dirp; +#if 0 /* This part is only for debugging */ + chk_dirp( dirp); +#endif +#if COMPILER == GNUC + if ((**dirp != EOS && sys_dirp <= dirp && dirp <= g_system_data->incend) +#if SYSTEM == SYS_MAC + || sys_frame +#endif + ) + g_internal_data->infile->sys_header = TRUE; /* Found in a system header dir */ + else + g_internal_data->infile->sys_header = FALSE; +#endif + g_internal_data->cur_fullname = fullname; + + if (g_internal_data->option_flags.z) { + g_internal_data->no_output++; /* Don't output the included file */ + if (g_internal_data->include_nest == 2) + mcpp_fprintf( DEST_OUT, "#include \"%s\"\n", fullname); + /* Output #include line instead, if it is in main source file */ + } else if (! include_opt) { /* Do not sharp() on -include */ + g_internal_data->src_line = 1; /* Working on line 1 now */ + sharp( NULL, 1); /* Print out the included file name */ + } + g_internal_data->src_line = 0; /* To read the first line */ + + if (g_internal_data->mkdep && ((g_internal_data->mkdep & MD_SYSHEADER) || ! g_internal_data->infile->sys_header)) + put_depend( fullname); /* Output dependency line */ + +label_true: + return TRUE; +label_false: + free( fullname); + return FALSE; +} + +void add_file( + SIOHandle * fp, /* Open file pointer */ + const char * src_dir, /* Directory of source */ + const char * filename, /* Name of the file */ + const char * fullname, /* Full path list */ + int include_opt /* File specified by -include option */ +) +/* + * Initialize tables for this open file. This is called from open_file() + * (for #include files), and from the entry to MCPP to open the main input + * file. It calls a common routine get_file() to build the FILEINFO + * structure which is used to read characters. + */ +{ + FILEINFO * file; + const char * too_many_include_nest = + "More than %.0s%ld nesting of #include"; /* _F_ _W4_ */ + + // + // When encoding is UTF-8, skip BOM if present. + // + if(fp != NULL && pk_ftell(fp) == 0) + { + const unsigned char UTF8_BOM[3] = {0xEF, 0xBB, 0xBF}; + unsigned char FILE_HEAD[3] = {0, 0, 0}; + int i; + for(i = 0; i < 3; ++i) + { + FILE_HEAD[i] = (unsigned char)pk_getc(fp); + if(FILE_HEAD[i] != UTF8_BOM[i]) + { + if(FILE_HEAD[i] == (unsigned char)EOF) + { + i--; + } + for(; i >= 0; --i) + { + pk_ungetc(FILE_HEAD[i], fp); + } + break; + } + } + } + + filename = set_fname( filename); /* Search or append to fnamelist[] */ + fullname = set_fname( fullname); /* Search or append to fnamelist[] */ + file = get_file( filename, src_dir, fullname, (size_t) NBUFF, include_opt); + /* file == infile */ + file->fp = fp; /* Better remember SIOHandle * */ + g_internal_data->cur_fname = filename; + + if (g_internal_data->include_nest >= INCLUDE_NEST) /* Probably recursive #include */ + cfatal( too_many_include_nest, NULL, (long) INCLUDE_NEST, NULL); + if (g_internal_data->standard && (g_internal_data->warn_level & 4) + && g_internal_data->include_nest == g_internal_data->std_limits.inc_nest + 1) + cwarn( too_many_include_nest, NULL, (long) g_internal_data->std_limits.inc_nest, NULL); + g_internal_data->include_nest++; +} + +static const char * set_fname( + const char * filename +) +/* + * Register the source filename to fnamelist[]. + * Search fnamelist[] for filename or append filename to fnamelist[]. + * Returns the pointer. + * file->real_fname and file->full_fname points into fnamelist[]. + */ +{ + INC_LIST * fnamep; + size_t fnamelen; + + if (g_system_data->fnamelist == NULL) { /* Should be initialized */ + g_system_data->max_fnamelist = INIT_NUM_FNAMELIST; + g_system_data->fnamelist = (INC_LIST *) xmalloc( sizeof (INC_LIST) * g_system_data->max_fnamelist); + g_system_data->fname_end = &g_system_data->fnamelist[ 0]; + } else if (g_system_data->fname_end - g_system_data->fnamelist >= g_system_data->max_fnamelist) { + /* Buffer full: double the elements */ + g_system_data->fnamelist = (INC_LIST *) xrealloc( (char *) g_system_data->fnamelist + , sizeof (INC_LIST) * g_system_data->max_fnamelist * 2); + g_system_data->fname_end = &g_system_data->fnamelist[ g_system_data->max_fnamelist]; + g_system_data->max_fnamelist *= 2; + } + + /* Register the filename in fnamelist[] */ + fnamelen = strlen( filename); + for (fnamep = g_system_data->fnamelist; fnamep < g_system_data->fname_end; fnamep++) { + if (fnamep->len == fnamelen && str_case_eq( fnamep->name, filename)) + return filename; /* Already registered */ + } + g_system_data->fname_end->name = xmalloc( fnamelen + 1); + filename = strcpy( g_system_data->fname_end->name, filename); + /* Global pointer for get_file() */ + g_system_data->fname_end->len = fnamelen; + g_system_data->fname_end++; + + return filename; +} + +#if SYSTEM == SYS_MAC +#if COMPILER == GNUC + +/* Routines to search "header map" file of Xcode / Apple-GCC. */ +/* search_header_map() and hmap_hash() were written referring to */ +/* c-incpath.c of Apple-GCC-4.0.1. */ + +static char * search_header_map( + const char * hmap_file, /* Header map file */ + const char * filename, /* Filename to search */ + char * pathlist /* Buffer for a found pathlist */ +) +/* + * Search a table in "header map" file for a header. + */ +{ + struct stat stat_buf; + SIOHandle * fp; + size_t fsize; + const char * contents; + struct hmap_header_map * hmap; + struct hmap_bucket * buckets; + const char * strings; + uint32 mask; + uint32 key_offs; + uint32 i; + + pk_stat( hmap_file, &stat_buf); /* Get size of the file */ + fsize = stat_buf.st_size; + contents = xmalloc( fsize + 1); + fp = fopen( hmap_file, "r"); + fread( contents, fsize, 1, fp); /* Read whole of the file at once */ + hmap = (struct hmap_header_map *) contents; + + strings = ((const char *) hmap) + hmap->strings_offset; + buckets = hmap->buckets; + mask = hmap->capacity - 1; + i = hmap_hash( filename) & mask; + while ((key_offs = buckets[ i].key) != 0) { + if (str_case_eq( filename, strings + key_offs)) { + /* The names match. Make path-list. */ + char * cp = stpcpy( pathlist, strings + buckets[ i].value.prefix); + strcpy( cp, strings + buckets[ i].value.suffix); + break; + } + i = ++i & mask; + } + free( contents); + return key_offs ? pathlist : NULL; +} + +static unsigned hmap_hash( + const char * fname /* header name */ +) +/* + * Get hash value for the fname. + */ +{ + const char * sp; + unsigned hash_code = 0; + + for (sp = fname; *sp; sp++) + hash_code += tolower( *sp & 0xFF) * 13; + return hash_code; +} +#endif /* COMPILER == GNUC */ + +static void init_framework( void) +/* + * Initialize framework[]. + */ +{ + char * framework_dir; + /* Some frameworks may have been already specified by -F option. */ + g_system_data->sys_framework = g_system_data->num_framework; /* These are system frameworks */ +#ifdef FRAMEWORK1 + framework_dir = norm_dir( FRAMEWORK1, TRUE); + if (framework_dir) + g_system_data->framework[ g_system_data->num_framework++] = framework_dir; +#endif +#ifdef FRAMEWORK2 + framework_dir = norm_dir( FRAMEWORK2, TRUE); + if (framework_dir) + g_system_data->framework[ g_system_data->num_framework++] = framework_dir; +#endif +#ifdef FRAMEWORK3 + framework_dir = norm_dir( FRAMEWORK3, TRUE); + if (framework_dir) + g_system_data->framework[ g_system_data->num_framework++] = framework_dir; +#endif + if (g_system_data->num_framework >= MAX_FRAMEWORK) { + mcpp_fputs( "Too many Framework directories.", DEST_ERR); + longjmp( g_internal_data->error_exit, -1); + } +} + +static const char * dot_frame = ".framework"; + +static int search_framework( + char * filename +) +/* + * Search "Framework" directories. + * 'frame/header.h' is converted to + * '/System/Library/Frameworks/frame.framework/Headers/header.h', + * '/System/Library/Frameworks/frame.framework/PrivateHeaders/header.h', + * and so on. + */ +{ + char fullname[ PATHMAX + 1]; + FILEINFO * file; + char * frame, * fname, * cp1, * cp2; + int sys_frame = FALSE; + int i; + + cp1 = cp2 = strchr( filename, PATH_DELIM); + /* + * 'filename' should be format or sometimes + * . + * e.g.: , + * or . + */ + if (! cp1) + return FALSE; + *cp1 = EOS; + frame = filename; + fname = cp1 + 1; + + /* Search framework[] directories */ + for (i = 0; i < g_system_data->num_framework; i++) { + cp1 = stpcpy( fullname, g_system_data->framework[ i]); + /* 'fullname' e.g.: /System/Library/Frameworks/ */ + if (search_subdir( fullname, cp1, frame, fname, g_system_data->sys_framework <= i)) + return TRUE; + } + + /* + * Search subframework dirs searching its possible parent framework + * starting from current file's directory to its ancestors. + * Header file in subframework directories should be included only + * by its parent or sibling framework headers. + */ + for (i = g_system_data->sys_framework; i < g_system_data->num_framework; i++) { + size_t frame_len, fname_len; + frame_len = strlen( g_system_data->framework[ i]); + fname_len = strlen( g_internal_data->infile->real_fname); + if (fname_len <= frame_len) + continue; + if (memcmp( g_system_data->framework[ i], g_internal_data->infile->real_fname, frame_len) == 0) { + sys_frame = TRUE; + break; + } + } + for (file = g_internal_data->infile; file; file = file->parent) { + const char * dot; + size_t len; + + if (! file->fp) + continue; + dot = strstr( file->real_fname, dot_frame); + if (! dot) + continue; + len = dot - file->real_fname + strlen( dot_frame) + 1; + memcpy( fullname, file->real_fname, len); + cp1 = fullname + len; + cp1 = stpcpy( cp1, "Frameworks/"); + /* 'fullname' e.g.: */ + /* /System/Library/Frameworks/Foundation.framework/Frameworks/ */ + if (search_subdir( fullname, cp1, frame, fname, sys_frame)) + return TRUE; + } + + *cp2 = PATH_DELIM; /* Restore original include file format */ + + return FALSE; +} + +static int search_subdir( + char * fullname, /* Buffer for path-list to open */ + char * cp, /* Latter half of 'fullname' */ + char * frame, /* 'frame' of */ + char * fname, /* 'header' of */ + /* or sometimes 'dir/header' of */ + int sys_frame /* System framework header ? */ +) +/* + * Make path-list and try to open. + */ +{ + static const char * subdir[] = { "Headers", "PrivateHeaders", NULL}; + int j, n; + + cp += sprintf( cp, "%s%s%c", frame, dot_frame, PATH_DELIM); + for (j = 0; subdir[ j] != NULL; j++) { + n = sprintf( cp, "%s%c%s", subdir[ j], PATH_DELIM, fname); + /* + * 'fullname' is for example: + * /System/Library/Frameworks/Foundation.framework/Headers/ + * Foundation.h, + * /System/Library/Frameworks/Foundation.framework/Frameworks/ + * CarbonCore.framework/Headers/OSUtils.h, + * or /System/Library/Frameworks/IOKit.framework/Headers/ + * pwr_mgt/IOPMLib.h. + * Pass this as one filename argument to open_file() rather than + * deviding to directory part and file part. The first argument to + * open_file() which is a pointer to the directory part is remembered + * by FILEINFO struct. But, 'fullname' is over-written each time, + * and the former path-list is lost soon. Therefore, it cannot be + * passed as the first argument. In addition, though the first + * argument to open_file() is needed for #include_next, this directive + * has no meaning in framework. + */ + if ((cp - fullname) + n > PATHMAX) + cfatal( "Too long framework path", NULL, 0L, NULL); /* _F_ */ + if (open_file( &g_internal_data->empty_str, NULL, fullname, FALSE, FALSE, sys_frame)) + return TRUE; + } + return FALSE; +} + +#endif /* SYSTEM == SYS_MAC */ + +#if 0 /* This part is only for debugging */ +static int chk_dirp( + const char ** dirp +) +/* + * Check the validity of include directory specified for open_file(). + * Called only from open_file(). + */ +{ + const char ** ip; + + if (dirp == &null) + return TRUE; + + for (ip = g_system_data->incdir; ip < g_system_data->incend; ip++) + if (dirp == ip) + break; + if (ip == g_system_data->incend) { +#if COMPILER == MSC + FILEINFO * pfile = g_internal_data->infile->parent; + if (pfile) { + while ((pfile = pfile->parent) != NULL) { + /* Search each parent includer's directory */ + if (dirp == pfile->dirp) + break; + } + } + if (! pfile) +#endif +#if COMPILER == GNUC + const char ** qdir; + for (qdir = quote_dir; qdir < quote_dir_end; qdir++) { + if (dirp == qdir) + break; + } + if (qdir == quote_dir_end) +#endif + { + cfatal( "Bug: *dirp:%s is invalid", *dirp, 0L, NULL); + return FALSE; + } + } + return TRUE; +} +#endif + +void sharp( + FILEINFO * sharp_file, + int flag /* Flag to append to the line for GCC */ +) +/* + * Output a line number line. + * 'file' is 'sharp_file' if specified, + * else (i.e. 'sharp_file' is NULL) 'infile'. + */ +{ + FILEINFO * file; + int line; + + file = sharp_file ? sharp_file : g_internal_data->infile; + if (! file) + return; + while (! file->fp) + file = file->parent; + line = sharp_file ? sharp_file->line : g_internal_data->src_line; + if (g_internal_data->no_output || g_internal_data->option_flags.p || file == NULL + || (file == g_internal_data->sh_file && line == g_internal_data->sh_line)) + goto sharp_exit; + g_internal_data->sh_file = file; + g_internal_data->sh_line = line; + if (g_internal_data->keep_comments) + mcpp_fputc( '\n', DEST_OUT); /* Ensure to be on line top */ + if (g_internal_data->std_line_prefix) + mcpp_fprintf( DEST_OUT, "#line %ld", line); + else + mcpp_fprintf( DEST_OUT, "%s%ld", LINE_PREFIX, line); + cur_file( file, sharp_file, flag); + mcpp_fputc( '\n', DEST_OUT); +sharp_exit: + g_internal_data->wrong_line = FALSE; +} + +static void cur_file( + FILEINFO * file, /* infile or sharp_file */ + FILEINFO * sharp_file, /* The 'file' or NULL */ + int flag /* Flag to append for GCC */ +) +/* + * Output current source file name and line number. + * Called only from sharp() above. + */ +{ + const char * name; + + if (g_internal_data->mcpp_debug & MACRO_CALL) { /* In macro notification mode */ + if (sharp_file) /* Main input file */ + name = file->filename; + else /* Output full-path-list, normalized */ + name = g_internal_data->cur_fullname; + } else { /* Usually, the path not "normalized" */ + if (sharp_file) { /* Main input file */ + name = file->filename; + } else if (str_eq( file->filename, file->real_fname)) { + sprintf( g_internal_data->work_buf, "%s%s", *(file->dirp), g_internal_data->cur_fname); + name = g_internal_data->work_buf; + } else { /* Changed by '#line fname' directive */ + name = file->filename; + } + } + if (g_system_data->sharp_filename == NULL || ! str_eq( name, g_system_data->sharp_filename)) { + if (g_system_data->sharp_filename != NULL) + free( g_system_data->sharp_filename); + g_system_data->sharp_filename = save_string( name); + } + mcpp_fprintf( DEST_OUT, " \"%s\"", name); +#if COMPILER == GNUC + if (! g_internal_data->std_line_prefix) { + if (flag) { + mcpp_fputc( ' ', DEST_OUT); + mcpp_fputc( '0' + flag, DEST_OUT); + } + if (file->sys_header) + mcpp_fputs( " 3", DEST_OUT); + } +#endif +} + +#if SYS_FAMILY == SYS_WIN + +static char * bsl2sl( + char * filename +) +/* + * Convert '\\' in the path-list to '/'. + */ +{ + static int diagnosed = FALSE; + char * cp; + + cp = filename; + + while (*cp) { + if (g_internal_data->bsl_in_mbchar) { + int c; + c = *cp & UCHARMAX; + if (g_internal_data->char_type[ c] & g_internal_data->mbchk) { /* First byte of MBCHAR */ + char tmp[ PATHMAX]; + char * tp = tmp; + *tp++ = *cp++; + g_internal_data->mb_read( c, &cp, &tp); + /* Read over the multi-byte characters */ + continue; + } + } + if (*cp == '\\') { + *cp++ = PATH_DELIM; + if (!diagnosed && (g_internal_data->warn_level & 2) && (g_internal_data->warn_level != -1)) { + /* Backslash in source program */ + cwarn( "Converted \\ to %s", "/", 0L, NULL); /* _W2_ */ + diagnosed = TRUE; /* Diagnose only once */ + } + } else { + cp++; + } + } + + return filename; +} + +#endif /* SYS_FAMILY == SYS_WIN */ + +static const char * const unknown_arg = + "Unknown argument \"%s\""; /*_W1_*/ +static const char * const not_ident = + "Not an identifier \"%s\""; /*_W1_*/ + +static int is_junk( void) +/* + * Check the trailing junk in a directive line. + * This routine is never called in OLD_PREP mode. + */ +{ + int c; + + c = skip_ws(); + unget_ch(); + if (c != '\n') { /* Trailing junk */ + if (g_internal_data->warn_level & 1) + cwarn( unknown_arg, g_internal_data->infile->bptr, 0L, NULL); + return TRUE; + } else { + return FALSE; + } +} + +#define PUSH 1 +#define POP -1 + +#define __SETLOCALE 1 /* #pragma __setlocale( "encoding") */ +#define SETLOCALE 2 /* #pragma setlocale( "encoding") */ + +void do_pragma( void) +/* + * Process the #pragma lines. + * 1. Process the sub-directive for MCPP. + * 2. Pass the line to the compiler-proper. + * #pragma MCPP put_defines, #pragma MCPP preprocess, + * #pragma MCPP preprocessed and #pragma once are, however, not put + * out so as not to duplicate output when re-preprocessed. + * When EXPAND_PRAGMA == TRUE and (__STDC_VERSION__ >= 199901L or + * __cplusplus >= 199901L), the line is subject to macro expansion unless + * the next to 'pragma' token is one of 'STDC', 'GCC' or 'MCPP'. + */ +{ + int c; + int warn = FALSE; /* Necessity of warning */ + int token_type; + char * bp; /* Pointer to argument */ + char * tp; + FILEINFO * file; + + g_internal_data->wrong_line = TRUE; /* In case of error */ + c = skip_ws(); + bp = g_internal_data->infile->bptr - 1; /* Remember token to pass to compiler */ + if (c == '\n') { + if (g_internal_data->warn_level & 1) + cwarn( "No sub-directive", NULL, 0L, NULL); /* _W1_ */ + unget_ch(); + return; + } + token_type = scan_token( c, (tp = g_internal_data->work_buf, &tp), g_internal_data->work_end); +#if EXPAND_PRAGMA +#if COMPILER == MSC + if (token_type == NAM + && !str_eq( g_internal_data->identifier, "STDC") && !str_eq( g_internal_data->identifier, "MCPP")) { +#else + if (g_internal_data->stdc3 && token_type == NAM + && !str_eq( g_internal_data->identifier, "STDC") && !str_eq( g_internal_data->identifier, "MCPP")) { +#endif + DEFBUF * defp; + char * mp; + char * mp_end; + LINE_COL line_col = { 0L, 0}; + + bp = mp = xmalloc( (size_t)(NMACWORK + IDMAX)); + /* Buffer for macro expansion */ + mp_end = mp + NMACWORK; + tp = stpcpy( mp, g_internal_data->identifier); + do { /* Expand all the macros in the line */ + int has_pragma; + if (token_type == NAM && (defp = is_macro( &tp)) != NULL) { + tp = g_internal_data->expand_macro( defp, bp, mp_end, line_col, & has_pragma); + if (has_pragma) + cerror( "_Pragma operator found in #pragma line" /* _E_ */ + , NULL, 0L, NULL); + if (! g_internal_data->stdc3 && (g_internal_data->warn_level & 2)) + cwarn( + "\"%s\" is macro expanded in other than C99 mode" /* _W2_ */ + , g_internal_data->identifier, 0L, NULL); + } + token_type = scan_token( c = get_ch(), (bp = tp, &tp), mp_end); + } while (c != '\n'); + unget_string( mp, NULL); /* To re-read */ + free( mp); + c = skip_ws(); + bp = g_internal_data->infile->bptr - 1; + token_type = scan_token( c, (tp = g_internal_data->work_buf, &tp), g_internal_data->work_end); + } +#endif + if (token_type != NAM) { + if (g_internal_data->warn_level & 1) + cwarn( not_ident, g_internal_data->work_buf, 0L, NULL); + goto skip_nl; + } else if (str_eq( g_internal_data->identifier, "once")) { /* #pragma once */ + if (! is_junk()) { + file = g_internal_data->infile; + while (file->fp == NULL) + file = file->parent; + do_once( file->full_fname); + goto skip_nl; + } + } else if (str_eq( g_internal_data->identifier, "MCPP")) { + if (scan_token( skip_ws(), (tp = g_internal_data->work_buf, &tp), g_internal_data->work_end) != NAM) { + if (g_internal_data->warn_level & 1) + cwarn( not_ident, g_internal_data->work_buf, 0L, NULL); + } + if (str_eq( g_internal_data->identifier, "put_defines")) { + if (! is_junk()) + dump_def( TRUE, FALSE); /* #pragma MCPP put_defines */ + } else if (str_eq( g_internal_data->identifier, "preprocess")) { + if (! is_junk()) /* #pragma MCPP preprocess */ + mcpp_fputs( "#pragma MCPP preprocessed\n", DEST_OUT); + /* Just putout the directive */ + } else if (str_eq( g_internal_data->identifier, "preprocessed")) { + if (! is_junk()) { /* #pragma MCPP preprocessed*/ + skip_nl(); + do_preprocessed(); + return; + } + } else if (str_eq( g_internal_data->identifier, "warning")) { + /* #pragma MCPP warning */ + cwarn( g_internal_data->infile->buffer, NULL, 0L, NULL); + } else if (str_eq( g_internal_data->identifier, "push_macro")) { + push_or_pop( PUSH); /* #pragma MCPP push_macro */ + } else if (str_eq( g_internal_data->identifier, "pop_macro")) { + push_or_pop( POP); /* #pragma MCPP pop_macro */ + } else if (str_eq( g_internal_data->identifier, "debug")) { + do_debug( TRUE); /* #pragma MCPP debug */ + } else if (str_eq( g_internal_data->identifier, "end_debug")) { + do_debug( FALSE); /* #pragma MCPP end_debug */ + } else { + warn = TRUE; + } + if (warn && (g_internal_data->warn_level & 1)) + cwarn( unknown_arg, g_internal_data->identifier, 0L, NULL); + goto skip_nl; /* Do not putout the line */ +#if COMPILER == GNUC + /* The #pragma lines for GCC is skipped not to confuse cc1. */ + } else if (str_eq( g_internal_data->identifier, "GCC")) { /* #pragma GCC * */ + if (scan_token( skip_ws(), (tp = g_internal_data->work_buf, &tp), g_internal_data->work_end) == NAM) { + if (str_eq( g_internal_data->identifier, "poison") + || str_eq( g_internal_data->identifier, "dependency")) { + if (g_internal_data->warn_level & 2) + cwarn( "Skipped the #pragma line" /*_W2_ */ + , NULL, 0L, NULL); + goto skip_nl; + } else if (str_eq( g_internal_data->identifier, "system_header")) { + g_internal_data->infile->sys_header = TRUE; /* Mark as a system header */ + goto skip_nl; + } + } +#endif + +#if COMPILER == MSC + } else if (str_eq( g_internal_data->identifier, "setlocale")) { + if (skip_ws() == '(' + && scan_token( skip_ws(), (tp = g_internal_data->work_buf, &tp), g_internal_data->work_end) + == STR + && skip_ws() == ')') { + if (! is_junk()) { + g_internal_data->work_buf[ 0] = *(tp - 1) = '\0'; + set_encoding( g_internal_data->work_buf + 1, NULL, SETLOCALE); + g_internal_data->work_buf[ 0] = *(tp - 1) = '"'; + } /* else warned by is_junk() */ + } else { + warn = TRUE; + } +#else /* COMPILER != MSC */ + } else if (str_eq( g_internal_data->identifier, "__setlocale")) { + if (skip_ws() == '(' + && scan_token( skip_ws(), (tp = g_internal_data->work_buf, &tp), g_internal_data->work_end) + == STR + && skip_ws() == ')') { + if (! is_junk()) { /* #pragma __setlocale */ + g_internal_data->work_buf[ 0] = *(tp - 1) = '\0'; + set_encoding( g_internal_data->work_buf + 1, NULL, __SETLOCALE); + g_internal_data->work_buf[ 0] = *(tp - 1) = '"'; + } /* else warned by is_junk() */ + } else { + warn = TRUE; + } +#endif + +#if COMPILER == MSC + } else if (str_eq( g_internal_data->identifier, "push_macro")) { + push_or_pop( PUSH); + goto skip_nl; + } else if (str_eq( g_internal_data->identifier, "pop_macro")) { + push_or_pop( POP); + goto skip_nl; +#endif + +#if COMPILER == LCC + } else if (str_eq( g_internal_data->identifier, "optimize") + && (skip_ws() == '(') + && (char_type[ (c = skip_ws()) & UCHARMAX] == DIG) + && (skip_ws() == ')')) { + char tmp[ 2]; + + tmp[ 0] = c; + tmp[ 1] = EOS; + look_and_install( optim_name, DEF_NOARGS_PREDEF, null, tmp); +#endif + +#if COMPILER == COMPILER_UNKNOWN + /* + * Write here any compiler-specific #pragma sub-directive which should + * be processed by preprocessor. + */ +#endif + } + + if (warn) { + if (g_internal_data->warn_level & 1) + cwarn( unknown_arg, g_internal_data->identifier, 0L, NULL); + goto skip_nl; /* Do not putout the line */ + } + + sharp( NULL, 0); /* Synchronize line number before output */ + if (! g_internal_data->no_output) { + mcpp_fputs( "#pragma ", DEST_OUT); + mcpp_fputs( bp, DEST_OUT); /* Line is put out */ + } +skip_nl: /* Don't use skip_nl() which skips to the newline in source file */ + while (get_ch() != '\n') + ; +} + +static void do_once( + const char * fullname /* Full-path-list of the header */ +) +/* + * Process #pragma once so as not to re-include the file later. + * This directive has been imported from GCC V.1.* / cpp as an extension. + */ +{ + if (g_system_data->once_list == NULL) { /* Should initialize */ + g_system_data->max_once = INIT_NUM_ONCE; + g_system_data->once_list = (INC_LIST *) xmalloc( sizeof (INC_LIST) * g_system_data->max_once); + g_system_data->once_end = &g_system_data->once_list[ 0]; + } else if (g_system_data->once_end - g_system_data->once_list >= g_system_data->max_once) { + /* Double the elements */ + g_system_data->once_list = (INC_LIST *) xrealloc( (char *) g_system_data->once_list + , sizeof (INC_LIST) * g_system_data->max_once * 2); + g_system_data->once_end = &g_system_data->once_list[ g_system_data->max_once]; + g_system_data->max_once *= 2; + } + g_system_data->once_end->name = (char*)fullname; + g_system_data->once_end->len = strlen( fullname); + g_system_data->once_end++; +} + +static int included( + const char * fullname +) +/* + * Has the file been once included ? + * This routine is only called from open_file(). + */ +{ + INC_LIST * inc; + size_t fnamelen; + + if (g_system_data->once_list == NULL) /* No once file registered */ + return FALSE; + fnamelen = strlen( fullname); + for (inc = g_system_data->once_list; inc < g_system_data->once_end; inc++) { + if (inc->len == fnamelen && str_case_eq( inc->name, fullname)) { + /* Already included */ + if (g_internal_data->mcpp_debug & PATH) + mcpp_fprintf( DEST_DBG, "Once included \"%s\"\n", fullname); + return TRUE; + } + } + return FALSE; /* Not yet included */ +} + +static void push_or_pop( + int direction +) +/* Process #pragma MCPP push_macro( "MACRO"), + * #pragma MCPP pop_macro( "MACRO") for other compilers than Visual C, + * and #pragma push_macro( "MACRO"), #pragma pop_macro( "MACRO") for Visual C. + * Note:1. "push" count is set in defp->push. + * 2. pushed definitions are inserted immediatly after the current + * definition of the same name. + * 3. the definitions of a same name macro can be pushed multiple times. + */ +{ + char * tp; + DEFBUF ** prevp; + DEFBUF * defp; + DEFBUF * dp; + int cmp; + size_t s_name, s_def; + + if (skip_ws() == '(' + && scan_token( skip_ws(), (tp = g_internal_data->work_buf, &tp), g_internal_data->work_end) == STR + && skip_ws() == ')') { /* Correct syntax */ + + if (is_junk()) + return; + s_name = strlen( g_internal_data->work_buf) - 2; + *(g_internal_data->work_buf + s_name + 1) = '\0'; + memcpy( g_internal_data->identifier, g_internal_data->work_buf + 1, s_name + 1); + /* Remove enclosing '"' */ + prevp = look_prev( g_internal_data->identifier, &cmp); + if (cmp == 0) { /* Current definition or pushed definition exists */ + defp = *prevp; + if (direction == PUSH) {/* #pragma push_macro( "MACRO") */ + if (defp->push) { /* No current definition*/ + if (g_internal_data->warn_level & 1) + cwarn( "\"%s\" is already pushed" /* _W1_ */ + , g_internal_data->identifier, 0L, NULL); + return; + } + /* Else the current definition exists. Push it */ + s_def = sizeof (DEFBUF) + 3 + s_name + + strlen( defp->repl) + strlen( defp->fname); + if (g_internal_data->mcpp_mode == STD) + s_def += strlen( defp->parmnames); + dp = (DEFBUF *) xmalloc( s_def); + memcpy( dp, defp, s_def); /* Copy the definition */ + dp->link = *prevp; /* Insert to linked-list*/ + *prevp = dp; /* the pushed def */ + prevp = &dp->link; /* Next link to search */ + } else { /* #pragma pop_macro( "MACRO") */ + if (defp->push == 0) { /* Current definition */ + if (defp->link == NULL + || ! str_eq( g_internal_data->identifier, defp->link->name)) { + if (g_internal_data->warn_level & 1) + cwarn( "\"%s\" has not been pushed" /* _W1_ */ + , g_internal_data->identifier, 0L, NULL); + return; + } else { + *prevp = defp->link; + /* Link the previous and the next */ + free( defp); + /* Delete the definition to enable popped def */ + } + } /* Else no current definition exists */ + } + while ((defp = *prevp) != NULL) { + /* Increment or decrement "push" count of all pushed defs */ + if ((cmp = memcmp( defp->name, g_internal_data->identifier, s_name)) > 0) + break; + defp->push += (char)direction; /* Increment or decrement */ + prevp = &defp->link; + } + } else { /* No current definition nor pushed definition */ + if (g_internal_data->warn_level & 1) + cwarn( "\"%s\" has not been defined" /* _W1_ */ + , g_internal_data->identifier, 0L, NULL); + } + } else { /* Wrong syntax */ + if (g_internal_data->warn_level & 1) + cwarn( "Bad %s syntax", direction == PUSH /* _W1_ */ + ? "push_macro" : "pop_macro", 0L, NULL); + } +} + +static void do_asm( + int asm_start /* #asm ? */ +) +/* + * #asm, #endasm + * Originally written for OS-9/09 Microware C. + */ +{ + if (! compiling) + return; + if (asm_start == (g_internal_data->in_asm != 0L)) { + if (g_internal_data->in_asm) + cerror( "In #asm block started at line %.0s%ld" /* _E_ */ + , NULL, g_internal_data->in_asm, NULL); + else + cerror( "Without #asm", NULL, 0L, NULL); /* _E_ */ + skip_nl(); + unget_ch(); + return; + } + g_internal_data->in_asm = asm_start ? g_internal_data->src_line : 0L; +} + +void do_old( void) +/* + * Process the out-of-standard directives. + * GCC permits #include_next and #warning even in STANDARD mode. + */ +{ + static const char * const unknown + = "Unknown #directive \"%s\"%.0ld%s"; /* _E_ _W8_ */ + static const char * const ext + = "%s is not allowed by Standard%.0ld%s"; /* _W2_ _W8_*/ + +#if COMPILER == GNUC + if (str_eq( g_internal_data->identifier, "include_next")) { + if ((compiling && (g_internal_data->warn_level & 2)) + || (! compiling && (g_internal_data->warn_level & 8))) + cwarn( ext, "#include_next", 0L + , compiling ? NULL : " (in skipped block)"); + if (! compiling) + return; + g_internal_data->in_include = TRUE; + do_include( TRUE); + g_internal_data->in_include = FALSE; + return; + } else if (str_eq( g_internal_data->identifier, "warning")) { + if ((compiling && (g_internal_data->warn_level & 2)) + || (! compiling && (g_internal_data->warn_level & 8))) + cwarn( ext, "#warning", 0L + , compiling ? NULL : " (in skipped block)"); + if (! compiling) + return; + cwarn( g_internal_data->infile->buffer, NULL, 0L, NULL); + /* Always output the warning */ + skip_nl(); + unget_ch(); + return; + } else if (str_eq( g_internal_data->identifier, "ident") || str_eq( g_internal_data->identifier, "sccs")) { + if ((compiling && (g_internal_data->warn_level & 1)) + || (! compiling && (g_internal_data->warn_level & 8))) { + if (str_eq( g_internal_data->identifier, "ident")) + cwarn( + compiling ? "Ignored #ident" : "#ident (in skipped block)" /* _W1_ _W8_*/ + , NULL, 0L, NULL); + else + cwarn( + compiling ? "Ignored #sccs" : "#sccs (in skipped block)" /* _W1_ _W8_*/ + , NULL, 0L, NULL); + } + if (! compiling) + return; + skip_nl(); + unget_ch(); + return; + } +#endif /* COMPILER == GNUC */ + +#if COMPILER == MSC + if (str_eq( g_internal_data->identifier, "using") || str_eq( g_internal_data->identifier, "import")) { + /* #using or #import */ + if (! compiling) + return; + mcpp_fputs( g_internal_data->infile->buffer, DEST_OUT); /* Putout the line as is*/ + skip_nl(); + unget_ch(); + return; + } +#endif + +#if SYSTEM == SYS_MAC + if (str_eq( g_internal_data->identifier, "import")) { + if ((compiling && (g_internal_data->warn_level & 2)) + || (! compiling && (g_internal_data->warn_level & 8))) + cwarn( ext, "#import", 0L + , compiling ? NULL : " (in skipped block)"); + if (! compiling) + return; + g_system_data->in_import = g_internal_data->in_include = TRUE; + do_include( FALSE); + g_system_data->in_import = g_internal_data->in_include = FALSE; + return; + } +#endif + + if (! g_internal_data->standard && do_prestd_directive()) + return; + + if (compiling) { + if (g_internal_data->option_flags.lang_asm) { /* "Assembler" source */ + if (g_internal_data->warn_level & 1) + cwarn( unknown, g_internal_data->identifier, 0L, NULL); + mcpp_fputs( g_internal_data->infile->buffer, DEST_OUT); /* Putout the line */ + } else { + cerror( unknown, g_internal_data->identifier, 0L, NULL); + } + } else if (g_internal_data->warn_level & 8) { + cwarn( unknown, g_internal_data->identifier, 0L, " (in skipped block)"); + } + skip_nl(); + unget_ch(); + return; +} + +static int do_prestd_directive( void) +/* + * Process directives for pre-Standard mode. + */ +{ +#if COMPILER != GNUC + if (str_eq( g_internal_data->identifier, "assert")) { /* #assert */ + if (! compiling) /* Only validity check */ + return TRUE; + if (eval_if() == 0L) { /* Assert expression */ + cerror( "Preprocessing assertion failed" /* _E_ */ + , NULL, 0L, NULL); + skip_nl(); + unget_ch(); + } + return TRUE; + } else +#endif + if (str_eq( g_internal_data->identifier, "put_defines")) { + if (! compiling) /* Only validity check */ + return TRUE; + if (g_internal_data->mcpp_mode != OLD_PREP && ! is_junk()) + dump_def( TRUE, FALSE); /* #put_defines */ + skip_nl(); + unget_ch(); + return TRUE; + } else if (str_eq( g_internal_data->identifier, "preprocess")) { + if (! compiling) /* Only validity check */ + return TRUE; + if (g_internal_data->mcpp_mode != OLD_PREP && ! is_junk()) + /* Just putout the directive for the succeding preprocessor */ + mcpp_fputs( "#preprocessed\n", DEST_OUT); + skip_nl(); + unget_ch(); + return TRUE; + } else if (str_eq( g_internal_data->identifier, "preprocessed")) { + if (! compiling) /* Only validity check */ + return TRUE; + if (g_internal_data->mcpp_mode != OLD_PREP && ! is_junk()) { + skip_nl(); + do_preprocessed(); /* #preprocessed */ + return TRUE; + } + skip_nl(); + unget_ch(); + return TRUE; + } + + if (str_eq( g_internal_data->identifier, "debug")) { /* #debug */ + if (! compiling) /* Only validity check */ + return TRUE; + do_debug( TRUE); + return TRUE; + } else if (str_eq( g_internal_data->identifier, "end_debug")) { + if (! compiling) + return TRUE; + do_debug( FALSE); /* #end_debug */ + return TRUE; + } + + if (str_eq( g_internal_data->identifier, "asm")) { /* #asm */ + do_asm( TRUE); + return TRUE; + } + if (str_eq( g_internal_data->identifier, "endasm")) { /* #endasm */ + do_asm( FALSE); + skip_nl(); /* Skip comments, etc. */ + unget_ch(); + return TRUE; + } + + return FALSE; /* Unknown directive */ +} + +static void do_preprocessed( void) +/* + * The source file has been already preprocessed. + * Copy the lines to output. + * Install macros according the #define directives. + */ +{ + const char * corrupted = + "This preprocessed file is corrupted"; /* _F_ */ + FILEINFO * file; + char * lbuf; + char * cp; + const char ** incptr; + char * comment = NULL; + char * colon = NULL; + const char * dir; +#if STD_LINE_PREFIX == FALSE + char conv[ NBUFF]; + char * arg; + + /* + * Compiler cannot accept C source style #line. + * Convert it to the compiler-specific format. + */ + strcpy( conv, LINE_PREFIX); + arg = conv + strlen( conv); +#endif + file = g_internal_data->infile; + lbuf = file->bptr = file->buffer; /* Reset file->bptr */ + + /* Copy the input to output until a comment line appears. */ + while (pk_fgets( lbuf, NBUFF, file->fp) != NULL + && memcmp( lbuf, "/*", 2) != 0) { +#if STD_LINE_PREFIX == FALSE + if (memcmp( lbuf, "#line ", 6) == 0) { + strcpy( arg, lbuf + 6); + mcpp_fputs( conv, DEST_OUT); + } else +#endif + { + mcpp_fputs( lbuf, DEST_OUT); + } + } + if (! str_eq( lbuf, "/* Currently defined macros. */\n")) + cfatal( "This is not a preprocessed source" /* _F_ */ + , NULL, 0L, NULL); + + /* Define macros according to the #define lines. */ + while (pk_fgets( lbuf, NWORK, file->fp) != NULL) { + if (memcmp( lbuf, "/*", 2) == 0) { + /* Standard predefined macro */ + continue; + } + if (memcmp( lbuf, "#define ", 8) != 0) { + if (memcmp( lbuf, "#line", 5) == 0) + continue; + else + cfatal( corrupted, NULL, 0L, NULL); + } + /* Filename and line-number information in comment as: */ + /* dir/fname:1234\t*/ + cp = lbuf + strlen( lbuf); + if ((memcmp( cp - 4, "\t*/\n", 4) != 0) + || (*(cp - 4) = EOS + , (comment = strrchr( lbuf, '*')) == NULL) + || (memcmp( --comment, "/* ", 3) != 0) + || ((colon = strrchr( comment, ':')) == NULL)) + cfatal( corrupted, NULL, 0L, NULL); + g_internal_data->src_line = atol( colon + 1); /* Pseudo line number */ + *colon = EOS; + dir = comment + 3; + g_internal_data->inc_dirp = &g_internal_data->empty_str; + /* Search the include directory list */ + for (incptr = g_system_data->incdir ; incptr < g_system_data->incend; incptr++) { + if (memcmp( *incptr, dir, strlen( *incptr)) == 0) { + g_internal_data->inc_dirp = incptr; + break; + } + } + /* Register the filename to fnamelist[] */ + /* inc_dirp may be NULL, and cur_fname may be "(predefined)" */ + g_internal_data->cur_fname = set_fname( dir + strlen( *g_internal_data->inc_dirp)); + strcpy( comment - 2, "\n"); /* Remove the comment */ + unget_string( lbuf + 8, NULL); + do_define( FALSE, 0); + get_ch(); /* '\n' */ + get_ch(); /* Clear the "file" */ + unget_ch(); /* infile == file */ + } + file->bptr = file->buffer + strlen( file->buffer); +} + +static int do_debug( + int set /* TRUE to set debugging */ +) +/* + * #pragma MCPP debug, #pragma MCPP end_debug, #debug, #end_debug + * Return TRUE when diagnostic is issued else return FALSE. + */ +{ + struct Debug_arg { + const char * arg_name; /* Name of option */ + int arg_num; /* Value of 'debug' */ + }; + static struct Debug_arg debug_args[] = { + { "path", PATH }, + { "token", TOKEN }, + { "expand", EXPAND }, + { "macro_call", MACRO_CALL }, /* Implemented only in STD mode */ + { "if", IF }, + { "expression", EXPRESSION }, + { "getc", GETC }, + { "memory", MEMORY }, + { NULL, 0 }, + }; + struct Debug_arg *argp; + int num = 0; + int c; + + c = skip_ws(); + if (c == '\n') { + unget_ch(); + if (set) { + if (g_internal_data->warn_level & 1) + cwarn( "No argument", NULL, 0L, NULL); /* _W1_ */ + return TRUE; + } else { + g_internal_data->mcpp_debug = 0; /* Clear all the flags */ + return FALSE; + } + } + while (scan_token( c, (g_internal_data->workp = g_internal_data->work_buf, &g_internal_data->workp), g_internal_data->work_end) == NAM) { + argp = debug_args; + while (argp->arg_name) { + if (str_eq( argp->arg_name, g_internal_data->work_buf)) + break; + argp++; + } + if (argp->arg_name == NULL) { + if (g_internal_data->warn_level & 1) + cwarn( unknown_arg, g_internal_data->work_buf, 0L, NULL); + goto diagnosed; + } else { + num = argp->arg_num; + if (set) { + g_internal_data->mcpp_debug |= num; + if (num == PATH) + dump_path(); + else if (num == MEMORY) + print_heap(); + else if (num == MACRO_CALL) + g_internal_data->option_flags.k = TRUE; /* This pragma needs this mode */ + } else { + g_internal_data->mcpp_debug &= ~num; + } + } + c = skip_ws(); + } + if ((g_internal_data->mcpp_mode != STD && (g_internal_data->mcpp_debug & MACRO_CALL)) || c != '\n') { + if (g_internal_data->warn_level & 1) { + if (c != '\n') { + cwarn( not_ident, g_internal_data->work_buf, 0L, NULL); + } else { + cwarn( unknown_arg, g_internal_data->work_buf, 0L, NULL); + g_internal_data->mcpp_debug &= ~num; /* Disable */ + } + } + skip_nl(); + unget_ch(); + goto diagnosed; + } + unget_ch(); + return FALSE; +diagnosed: + return TRUE; +} + +void put_asm( void) +/* + * Put out source line as it is. + */ +{ +#if 0 + mcpp_fputs( "#2\n", DEST_OUT); + mcpp_fputs( g_internal_data->infile->buffer, DEST_OUT); + skip_nl(); +#endif +} + +static void dump_path( void) +/* + * Show the include directories. + */ +{ + const char ** incptr; + const char * inc_dir; + const char * dir = "./"; + int i; + + mcpp_fputs( "Include paths are as follows --\n", DEST_DBG); + for (incptr = g_system_data->incdir; incptr < g_system_data->incend; incptr++) { + inc_dir = *incptr; + if (*inc_dir == '\0') + inc_dir = dir; + mcpp_fprintf( DEST_DBG, " %s\n", inc_dir); + } + mcpp_fputs( "End of include path list.\n", DEST_DBG); +#if SYSTEM == SYS_MAC + mcpp_fputs( "Framework paths are as follows --\n", DEST_DBG); + for (i = 0; i < g_system_data->num_framework; i++ ) + mcpp_fprintf( DEST_DBG, " %s\n", g_system_data->framework[ i]); + mcpp_fputs( "End of framework path list.\n", DEST_DBG); +#endif +} + +/* + * Note: The getopt() of glibc should not be used since the specification + * differs from the standard one. + * Use this mcpp_getopt() for mcpp. + */ + +/* Based on the public-domain-software released by AT&T in 1985. */ + +#define OPTERR( s, c) if (g_system_data->mcpp_opterr) { \ + mcpp_fputs( argv[0], DEST_ERR); \ + mcpp_fputs( s, DEST_ERR); \ + mcpp_fputc( c, DEST_ERR); \ + mcpp_fputc( '\n', DEST_ERR); \ + } + +static int mcpp_getopt( + int argc, + char * const * argv, + const char * opts +) +/* + * Get the next option (and it's argument) from the command line. + */ +{ + const char * const error1 = ": option requires an argument --"; + const char * const error2 = ": illegal option --"; + static int sp = 1; + int c; + const char * cp; + + if (sp == 1) { + if (argc <= g_system_data->mcpp_optind || + argv[ g_system_data->mcpp_optind][ 0] != '-' + || argv[ g_system_data->mcpp_optind][ 1] == '\0') { + return EOF; + } else if (strcmp( argv[ g_system_data->mcpp_optind], "--") == 0) { + g_system_data->mcpp_optind++; + return EOF; + } + } +/* g_system_data->mcpp_optopt = c = (unsigned char) argv[ g_system_data->mcpp_optind][ sp]; */ + g_system_data->mcpp_optopt = c = argv[ g_system_data->mcpp_optind][ sp] & UCHARMAX; + if (c == ':' || (cp = strchr( opts, c)) == NULL) { + OPTERR( error2, c) + if (argv[ g_system_data->mcpp_optind][ ++sp] == '\0') { + g_system_data->mcpp_optind++; + sp = 1; + } + return '?'; + } + if (*++cp == ':') { + if (argv[ g_system_data->mcpp_optind][ sp+1] != '\0') { + g_system_data->mcpp_optarg = &argv[ g_system_data->mcpp_optind++][ sp+1]; + } else if (argc <= ++g_system_data->mcpp_optind) { + OPTERR( error1, c) + sp = 1; + return '?'; + } else { + g_system_data->mcpp_optarg = argv[ g_system_data->mcpp_optind++]; + } + sp = 1; + } else { + if (argv[ g_system_data->mcpp_optind][ ++sp] == '\0') { + sp = 1; + g_system_data->mcpp_optind++; + } + g_system_data->mcpp_optarg = NULL; + } + return c; +} + +#if ! HOST_HAVE_STPCPY +char * stpcpy( + char * dest, + const char * src +) +/* + * Copy the string and return the advanced pointer. + */ +{ + const char * s; + char * d; + + for (s = src, d = dest; (*d++ = *s++) != '\0'; ) + ; + return d - 1; +} +#endif + +/* + * list_heap() is a function to print out information of heap-memory. + * See "kmmalloc-2.5.3.zip" by kmatsui. + */ +#if defined(KMMALLOC) + int list_heap( int); +#elif defined(BSD_MALLOC) + int list_heap( char *); +#elif defined(DB_MALLOC) || defined(DMALLOC) + int list_heap( SIOHandle *); +#endif + +void print_heap( void) +{ +#if defined(KMMALLOC) + list_heap( 1); +#elif defined(BSD_MALLOC) + list_heap( ":cpp"); +#elif defined(DB_MALLOC) || defined(DMALLOC) || defined(PHK_MALLOC) || defined(DLMALLOC) + list_heap( g_internal_data->fp_debug); +#endif +} + +void at_end( void) +/* + * Handle the commands to be executed at the end of processing. + */ +{ +#if COMPILER == GNUC + if (dMflag || dDflag) + dump_def( FALSE, FALSE); +#endif +} + +#if MCPP_LIB +void clear_filelist( void) +/* + * Free malloced memory for filename-list and directory-list. + */ +{ + const char ** incp; + INC_LIST * namep; + + for (incp = g_system_data->incdir; incp < g_system_data->incend; incp++) + free( (void *) *incp); + free( (void *) g_system_data->incdir); + for (namep = g_system_data->fnamelist; namep < g_system_data->fname_end; namep++) + free( (void *) namep->name); + free( (void *) g_system_data->fnamelist); + if (g_internal_data->standard) + free( (void *) g_system_data->once_list); +} +#endif + +#if defined(PK_COMPILER_MSVC) +# pragma warning( pop ) +#elif defined(PK_COMPILER_CLANG) +# pragma clang diagnostic pop +#elif defined(PK_COMPILER_GCC) +# pragma GCC diagnostic pop +#endif diff --git a/Samples/PK-MCPP/system.h b/Samples/PK-MCPP/system.h new file mode 100644 index 00000000..fa5ee72c --- /dev/null +++ b/Samples/PK-MCPP/system.h @@ -0,0 +1,414 @@ +#pragma once + +/*- + * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui + * All rights reserved. + * + * Some parts of this code are derived from the public domain software + * DECUS cpp (1984,1985) written by Martin Minow. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * S Y S T E M . H + * S y s t e m D e p e n d e n t + * D e f i n i t i o n s f o r M C P P + * + * Definitions in this file may be edited to configure MCPP for particular + * operating systems and compiler configurations. + * + * Note: MCPP assumes the system implement the Ascii character set. + * If this is not the case, you will have to do some editing here and there. + */ + +#define SYSTEM_H + +#include "noconfig.h" + +/* Some system has a wrong definition of UCHAR_MAX. See cpp-test.html#5.1.3 */ +#if UCHARMAX < -255 +/* The definition of UCHARMAX (possibly UCHAR_MAX too) is wrong. */ +/* Define it as a signed int value, not as an unsigned value. */ +#undef UCHARMAX +#define UCHARMAX ((1 << CHAR_BIT) - 1) +#endif + +// Internal macros: +#define INIT_NUM_INCLUDE 32 /* Initial number of incdir[] */ +#define INIT_NUM_FNAMELIST 256 /* Initial number of fnamelist[] */ +#define INIT_NUM_ONCE 64 /* Initial number of once_list[] */ +/* Values of mkdep. */ +#define MD_MKDEP 1 /* Output source file dependency line */ +#define MD_SYSHEADER 2 /* Print also system-header names */ +#define MD_FILE 4 /* Output to the file named *.d */ +#define MD_PHONY 8 /* Print also phony targets for each header */ +#define MD_QUOTE 16 /* 'Quote' $ and space in target name */ +#define MAX_ARCH_LEN 16 +#define MAX_DEF 256 +#define MAX_UNDEF (MAX_DEF/4) +#define NO_DIR FALSE +#if COMPILER == GNUC +#define N_QUOTE_DIR 8 +#endif +#if COMPILER == GNUC || COMPILER == MSC + /* + * preinclude points to the file specified by -include (-Fl for MSC) option, + * which is included prior to the main input file. + */ + #define NPREINCLUDE 8 +#endif + +typedef struct inc_list { /* List of directories or files */ + char * name; /* Filename or directory-name */ + size_t len; /* Length of 'name' */ +} INC_LIST; + +/* + * PART 1 and PART 2 are defined in the above header files. + */ + +/* + * P A R T 1 Configurations for target-operating-system + * and target-compiler. + */ + +/* + * P A R T 2 Configurations for host-compiler. + */ + +/* + * P A R T 3 Configurations for default settings, typedefs and + * translation limits. + */ + +/* + * The variable 'mcpp_mode' specifies the mode of preprocessing as one of + * OLD_PREP, KR, STD, or POST_STD. + * Those modes have many differences each other -- + * i.e. handling of translation phases; handling of some + * preprocessing tokens; availability of some directives; way of + * macro expansion; + * -- as follows. + * + * KR Actual arguments of a macro are expanded (after substitution) + * with rest of the replacement text and the subsequent source text. + * ## in macro definition has no significance to cpp. The surrounding + * tokens are macro-expanded separately. Also, # has no significance + * to cpp. The following token is expanded. + * Directly or intermediately recursive macro call causes an error. + * sequence is deleted only in string literals + * and in #define directive lines. + * sizeof (type) can be used in #if line. + * KR corresponds to the "K&R 1st." + * + * OLD_PREP In addition to the KR specifications, this mode has the + * following characteristics (and some others). + * Converts comment to 0 space instead of 1 space. + * Expands the parameter like spelling in string literal as a macro. + * Does not check unmatched pair of '"' or '\''. + * OLD_PREP corresponts to "Reiser model" cpp. + * + * STD Standard conforming mode. + * sequence is always deleted after trigraph + * conversion and before tokenization. + * Digraph sequences are recognized as tokens. + * Actual arguments of a macro are expanded separately prior to + * re-scanning of the replacement text. + * The name in the replacement text once expanded is not re-expanded, + * thus preventing recursive death. + * ## in macro definition concatenates tokens. The tokens are not + * expanded. The concatenated token is expanded by rescanning. + * # in macro definition stringizes the following argument. The argument + * is not expanded. \ is inserted before " and \ in or surrounding + * the string literal or character constant. + * An expanded macro is surrounded by spaces to prevent unintended + * token merging. + * + * POST_STD This mode simplifies the behavior of STD mode as follows. + * 1. Digraph sequences are converted in translation phase 1, as + * alternate characters rather than as tokens. + * 2. A space is inserted as a token separator between any tokens in + * a source (except a macro name and the next '(' in macro + * definition): thus simplifying tokenization, test of macro + * redefinition and macro expansion, especially "stringization". + * 3. Test of macro redefinition ignores difference of parameter names, + * test of which has little utility and not a little overhead. + * 4. #if expression forbids character constants, which have little + * portability, little utility and not a little overhead. + * 5. Rescanning of a macro expansion is limited in the replacement + * text, rest of the source file is not scanned, thus making the + * syntax of "function-like" macro call more similar to that of + * function call. + * 6. Argument of #include directive in form is an obsolescent + * feature. + * 7. '$' or so are not treated specially in #define directive. + * 8. Trigraphs, UCN (universal-character name) are not recognized. + * 9. Multi-byte characters in an identifier are not recognized. + * + * The following specifications are available when mode is STD or POST_STD. + * preprocessing number token, digraphs, + * #pragma (#pragma MCPP put_defines, #pragma MCPP warning + * , #pragma MCPP debug) directive, + * #error directive, + * #if defined operator, #elif directive, + * predefined macros __FILE__, __LINE__, __DATE__, __TIME__ + * , __STDC__, __STDC_VERSION__, __STDC_HOSTED__, + * wide character constant, wide character string literal, + * _Pragma() operator, variable-arguments macro, + * macro as an argument of #include, #line directives, + * escape sequences \x[hex-digits], \a, \v, + * '+' option (C++ preprocessing), + * 'S' option (re-defines __STDC__ as , unpredefine some macros), + * 'V' option (re-defines __STDC_VERSION__ or __cplusplus as ), + * 'h' option (re-defines __STDC_HOSTED__ as ). + * The following specifications are available only in STD mode. + * Trigraphs and UCN, + * Multi-byte characters in an identifier. + * The following specifications are available only in KR and OLD_PREP modes. + * #assert, #asm, #endasm, #put_defines, #debug and some other older + * directives, + * argument of #line directive other than decimal-digits. + */ + +/* The values of 'mcpp_mode'. */ +#define OLD_PREP 1 /* "Reiser" cpp mode */ +#define KR 2 /* K&R 1st mode */ +#define STD 3 /* Standard moce */ +#define POST_STD 9 /* Special mode of MCPP */ + +/* + * TRIGRAPHS_INIT Initial value for the -3 option. If TRUE -3 + * disables trigraphs, if FALSE -3 enables them. + * DIGRAPHS_INIT Initial value for the -2 option. If TRUE -2 + * disables digraphs, if FALSE -2 enables them. + * OK_UCN Enable recognition of Universal-Character-Name sequence + * by -V199901L option. + * OK_MBIDENT Enable multi-byte characters in identifier by -V199901L + * option. + * EXPAND_PRAGMA Enable macro expansion of #pragma line (even in modes + * other than C99). + * expr_t, uexpr_t Type of maximum integer: + * long long (unsigned long long) or longer. + * EXPR_MAX should be defined to the maximum value of uexpr_t. + */ +#define TRIGRAPHS_INIT FALSE +#define DIGRAPHS_INIT FALSE +#ifndef EXPAND_PRAGMA +#define EXPAND_PRAGMA FALSE +#endif +#define OK_UCN TRUE +#define OK_MBIDENT FALSE + +#if HAVE_LONG_LONG +# if (HOST_COMPILER == MSC && _MSC_VER < 1500) || HOST_COMPILER == BORLANDC +typedef __int64 expr_t; +typedef unsigned __int64 uexpr_t; +# else +typedef long long expr_t; +typedef unsigned long long uexpr_t; +# endif +#else /* !HAVE_LONG_LONG */ +typedef unsigned long uexpr_t; +typedef long expr_t; +#endif /* HAVE_LONG_LONG */ + +#if HAVE_INTMAX_T +#define EXPR_MAX UINTMAX_MAX +#elif HAVE_LONG_LONG +#if (HOST_COMPILER == MSC && _MSC_VER < 1400) || HOST_COMPILER == BORLANDC +#define EXPR_MAX 0xFFFFFFFFFFFFFFFFui64 +#else +#define EXPR_MAX 0xFFFFFFFFFFFFFFFFULL +#endif +#else +#define EXPR_MAX 4294967295UL +#endif + +/* + * Translation limits. + * The following definitions are used to allocate memory for work buffers. + * + * NWORK Output buffer size. Set this size according to your compiler- + * proper. Length of string literal should be less than NWORK + * - 1. + * Nevertheless, when COMPILER == GNUC || COMPILER == MSC, mcpp + * uses NMACWORK as output buffer size because GNUC and Visual C + * can accept very long line. + * NBUFF Input buffer size after line concatenation by + * . + * NMACWORK Internal work buffer size for macro definition and expansion. + * IDMAX The longest identifier length. + * NMACPARS The maximum number of #define parameters. + * NOTE: Must be NMACPARS <= UCHARMAX. + * NEXP The maximum nesting depth of #if expressions. + * BLK_NEST The number of nested #if's permitted. + * INCLUDE_NEST The maximum nesting depth of #include. This is needed to + * prevent infinite recursive inclusion. + * RESCAN_LIMIT The maximum rescan times of macro expansion in STD or POST_STD + * modes. + * PRESTD_RESCAN_LIMIT The maximum rescan times of macro expansion in KR or + * OLD_PREP modes.. + * + * NBUFF should not be smaller than NWORK. + * NMACWORK should not be smaller than NWORK * 2. + * + * SBSIZE defines the number of hash-table slots for the macro symbol table. + * It must be a power of 2. + * + * MKDEP_INIT The initial maximum number of filenames in a dependency line + * of output of -M* option. The maximum number is dynamically + * enlarged in execution. + */ + +#ifndef IDMAX +#define IDMAX 0x400 +#endif +#ifndef NMACPARS +#define NMACPARS 0xFF +#endif +#ifndef NEXP +#define NEXP 0x100 +#endif +#ifndef BLK_NEST +#define BLK_NEST 0x100 +#endif +#ifndef INCLUDE_NEST +#define INCLUDE_NEST 0x100 +#endif +#ifndef RESCAN_LIMIT +#define RESCAN_LIMIT 0x40 +#endif +#ifndef PRESTD_RESCAN_LIMIT +#define PRESTD_RESCAN_LIMIT 0x100 +#endif +#ifndef NBUFF +#define NBUFF 0x10000 /* Must be NWORK <= NBUFF */ +#endif +#ifndef NWORK +#define NWORK NBUFF /* 0x1000, 0x4000, 0x10000, .. */ +#endif +#ifndef NMACWORK +#define NMACWORK (NWORK * 4) /* Must be NWORK * 2 <= NMACWORK */ +#endif +#ifndef SBSIZE +#define SBSIZE 0x400 +#endif +#ifndef MKDEP_INIT +#define MKDEP_INIT 0x100 +#endif + +#if UCHARMAX < NMACPARS + #error "NMACPARS should not be greater than UCHARMAX" +#endif + +#if NBUFF < NWORK + #error "NBUFF must be same or greater than NWORK" +#endif +#if NMACWORK < NWORK * 2 + #error "NMACWORK must be same or greater than NWORK * 2" +#endif + +#define SBMASK (SBSIZE - 1) +#if (SBSIZE ^ SBMASK) != ((SBSIZE * 2) - 1) + #error "SBSIZE must be a power of 2 !" +#endif + +/* + * Translation limits required by the Standard. + * + * *90MIN limits specified by C90. + * *99MIN limits specified by C99. + * *_CPLUS_MIN limits recommended by C++ (ISO 1998/07 Standard). + * + * SLEN*MIN Characters in a logical source line + * and characters in a string literal or wide string literal + * (after concatenation). + * IDLEN*MIN Significant initial characters in an internal identifier + * or a macro name. + * NMACPARS*MIN Parameters in one macro definition. + * Arguments in one macro invocation. + * EXP_NEST*MIN Nesting levels of parenthesized expressions in a full + * expression. + * BLK_NEST*MIN Nesting levels of conditional inclusion. + * INCLUDE_NEST*MIN Nesting levels for #include files. + * NMACRO*MIN Macro identifiers simultaneously defined in one translation + * unit. + */ +#define SLEN90MIN 0x1FD +#define IDLEN90MIN 0x1F +#define NMACPARS90MIN 0x1F +#define EXP_NEST90MIN 0x20 +#define BLK_NEST90MIN 8 +#define INCLUDE_NEST90MIN 8 +#define NMACRO90MIN 0x400 + +#define SLEN99MIN 0xFFF +#define IDLEN99MIN 0x3F +#define NMACPARS99MIN 0x7F +#define EXP_NEST99MIN 0x3F +#define BLK_NEST99MIN 0x3F +#define INCLUDE_NEST99MIN 0xF +#define NMACRO99MIN 0xFFF + +#define SLEN_CPLUS_MIN 0x10000 +#define IDLEN_CPLUS_MIN 0x400 +#define NMACPARS_CPLUS_MIN 0x100 +#define EXP_NEST_CPLUS_MIN 0x100 +#define BLK_NEST_CPLUS_MIN 0x100 +#define INCLUDE_NEST_CPLUS_MIN 0x100 +#define NMACRO_CPLUS_MIN 0x10000 + +/* LINE99LIMIT means the line number limit of C99 */ +#define LINE99LIMIT 0x7FFFFFFF + +/* + * STDC This macro is used for the predefined __STDC__. + * STDC_VERSION is used for the value of __STDC_VERSION__. + * STDC_HOSTED is used for the value of __STDC_HOSTED__. + */ +#if IDMAX < IDLEN90MIN || NBUFF < SLEN90MIN + 3 + || NWORK < SLEN90MIN + 2 || NMACPARS < NMACPARS90MIN + || NEXP < EXP_NEST90MIN || BLK_NEST < BLK_NEST90MIN +#define STDC 0 +#endif +#ifndef STDC +#define STDC 1 /* 1 : for ISO 9899:1990 or later */ +#endif + +#ifndef STDC_VERSION +#define STDC_VERSION 0L /* 199409L : For conforming + implementation to ISO 9899:1990 / Amendment 1:1995 + 199901L : For C99 */ +#endif +#ifndef STDC_HOSTED +#define STDC_HOSTED 1 /* 1 : for hosted implementation, + 0 : for free-standing implementation (C99 specification) */ +#endif + +/* + * CPLUS specifies the default value of the pre-defined macro __cplusplus + * for C++ processing. + * The value can be changed by -V option. + */ +#define CPLUS 1 /* 199711L for C++ Standard */ + diff --git a/Samples/PK-SampleLib/ApiContext/D3D/D3D11Context.cpp b/Samples/PK-SampleLib/ApiContext/D3D/D3D11Context.cpp new file mode 100644 index 00000000..f98e25b1 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/D3D/D3D11Context.cpp @@ -0,0 +1,550 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_D3D11_SUPPORT != 0) && defined(PK_WINDOWS) + +#include +#include + +#include // needed for d3d11 +#include + +#include + +#if (PK_BUILD_WITH_SDL != 0) +# if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpragma-pack" +# endif // defined(PK_COMPILER_CLANG_CL) +# include +# if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic pop +# endif // defined(PK_COMPILER_CLANG_CL) +#endif // (PK_BUILD_WITH_SDL != 0) + +#include "D3D11Context.h" +#include +#include +#include +#include + +#if defined(PK_DEBUG) +# define USE_DEBUG_DXGI 1 +# define BREAK_ON_D3D_ERROR 0 // disabled by default, enable for break on D3D errors during API calls +# define BREAK_ON_D3D_WARN 0 // disabled by default, enable for break on D3D errors during API calls +#else +# define USE_DEBUG_DXGI 0 +# define BREAK_ON_D3D_ERROR 0 +# define BREAK_ON_D3D_WARN 0 +#endif + +#if (USE_DEBUG_DXGI != 0) || (BREAK_ON_D3D_WARN != 0) || (BREAK_ON_D3D_ERROR != 0) +# include // debug +# pragma comment(lib, "DXGI.lib") +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +PK_DECLARE_REFPTRCLASS(SdlContext); +#endif + +struct SD3D11PlatformContext +{ + IDXGIFactory1 *m_Factory = null; + IDXGIAdapter1 *m_HardwareAdapter = null; + + TArray m_SwapChains; + +#if (USE_DEBUG_DXGI != 0) + IDXGIDebug *m_Debug = null; +#endif + + PFN_D3D11_CREATE_DEVICE m_CreateDeviceFunc; + HMODULE m_D3DModule = 0; + HMODULE m_DXGIModule = 0; + + SD3D11PlatformContext() {} + ~SD3D11PlatformContext() + { + for (IDXGISwapChain *swapChain : m_SwapChains) + { + if (swapChain != null) + swapChain->Release(); + } + m_SwapChains.Clear(); + + if (m_Factory != null) + m_Factory->Release(); + if (m_HardwareAdapter != null) + m_HardwareAdapter->Release(); +#if (USE_DEBUG_DXGI != 0) + if (m_Debug != null) + { + m_Debug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL); + m_Debug->Release(); + } +#endif + if (m_D3DModule != null) + FreeLibrary(m_D3DModule); + if (m_DXGIModule != null) + FreeLibrary(m_DXGIModule); + } +}; + +//---------------------------------------------------------------------------- + +CD3D11Context::CD3D11Context() +: m_Context(PK_NEW(SD3D11PlatformContext)) +{ +} + +//---------------------------------------------------------------------------- + +CD3D11Context::~CD3D11Context() +{ + m_ApiData.m_SwapChainRenderTargets.Clear(); + if (m_ApiData.m_ImmediateDeviceContext != null) + m_ApiData.m_ImmediateDeviceContext->Release(); + if (m_ApiData.m_Device != null) + m_ApiData.m_Device->Release(); + + PK_DELETE(m_Context); +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) +{ + if (!InitContext(debug)) + return false; + + if (windowApi->GetContextApi() == PKSample::Context_Sdl) + { +#if (PK_BUILD_WITH_SDL != 0) + PSdlContext sdlWindowApi = static_cast(windowApi.Get()); + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + SDL_GetWindowWMInfo(sdlWindowApi->SdlGetWindow(), &info); +#if defined(PK_UWP) + return AddSwapchain(info.info.winrt.window, sdlWindowApi->GetDrawableSize()); +#elif defined(PK_WINDOWS) + return AddSwapChain(info.info.win.window, sdlWindowApi->GetDrawableSize()); +#endif // defined(PK_UWP) +#else + return false; +#endif // (PK_BUILD_WITH_SDL != 0) + } + else if (windowApi->GetContextApi() == PKSample::Context_Offscreen) + { + return CreateOffscreenRenderTarget(windowApi->GetDrawableSize()); + } + else + { // Does not implement another way to get window handle + return false; + } +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::LoadDynamicLibrary() +{ + PK_ASSERT(m_Context != null); + m_Context->m_D3DModule = ::LoadLibraryA("d3d11.dll"); + if (m_Context->m_D3DModule == null) + return false; + m_Context->m_DXGIModule = ::LoadLibraryA("dxgi.dll"); + if (m_Context->m_DXGIModule == null) + return false; + m_Context->m_CreateDeviceFunc = (PFN_D3D11_CREATE_DEVICE)::GetProcAddress(m_Context->m_D3DModule, "D3D11CreateDevice"); + + return m_Context->m_CreateDeviceFunc != null; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::InitContext(bool debug) +{ + if (m_Context == null) + return false; + m_ApiData.m_Api = RHI::GApi_D3D11; + m_ApiData.m_SwapChainCount = 0; + + if (!LoadDynamicLibrary()) + return false; + + // try grabbing CreateDXGIFactory1: + typedef HRESULT (WINAPI *FnCreateDXGIFactory1)( REFIID riid, + _COM_Outptr_ void **ppFactory); + + FnCreateDXGIFactory1 fnCreateDXGIFactory1 = (FnCreateDXGIFactory1)::GetProcAddress(m_Context->m_DXGIModule, "CreateDXGIFactory1"); + // if not found, this is not fatal, it will fallback (ie: on vista & xp) + if (fnCreateDXGIFactory1 == null) + { + CLog::Log(PK_INFO, "DXGI API 'CreateDXGIFactory1' not found, cannot create D3D11 context."); + return false; + } + + if (!PK_D3D11_OK(fnCreateDXGIFactory1(IID_PPV_ARGS(&m_Context->m_Factory))) || + !CreateDevice(debug)) + return false; + + if (debug) + EnableDebugLayer(); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::WaitAllRenderFinished() +{ + return true; +} + +//---------------------------------------------------------------------------- + +CGuid CD3D11Context::BeginFrame() +{ + return BeginFrame(0u); +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::EndFrame(void *renderToWait) +{ + (void)renderToWait; + return EndFrame(0u); +} + +//---------------------------------------------------------------------------- + +CGuid CD3D11Context::BeginFrame(u32 swapChainIdx) +{ + (void)swapChainIdx; + return 0; //m_Context->m_SwapChains[swapChainIdx]->GetCurrentBackBufferIndex(); +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::EndFrame(u32 swapChainIdx) +{ + // offscreen context does not create swapchain instance + if (m_Context->m_SwapChains[swapChainIdx] == null) + return true; + + const HRESULT hr = m_Context->m_SwapChains[swapChainIdx]->Present(0, 0); +// if (FAILED(hr)) +// return false; + if (hr == DXGI_ERROR_DEVICE_RESET || + hr == DXGI_ERROR_DEVICE_REMOVED) + return false; + if (hr == DXGI_STATUS_OCCLUDED) + return true; + + return PK_D3D11_OK(hr); +} + +//---------------------------------------------------------------------------- + +RHI::SApiContext *CD3D11Context::GetRenderApiContext() +{ + return &m_ApiData; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::RecreateSwapChain(const CUint2 &ctxSize) +{ + PK_ASSERT(m_ApiData.m_SwapChainRenderTargets.Count() == 1); + if (!PK_VERIFY(!m_ApiData.m_SwapChainRenderTargets.Empty())) + return false; + return RecreateSwapChain(0, ctxSize); +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::RecreateSwapChain(u32 swapChainIdx, const CUint2 &ctxSize) +{ + if (!PK_VERIFY(swapChainIdx < m_Context->m_SwapChains.Count())) + return false; + m_ApiData.m_ImmediateDeviceContext->OMSetRenderTargets(0, null, null); + m_ApiData.m_ImmediateDeviceContext->ClearState(); + RHI::PD3D11RenderTarget rt = CastD3D11(m_ApiData.m_SwapChainRenderTargets[swapChainIdx]); + PK_FOREACH(it, m_ApiData.m_DeferredCommandBuffer) + { + RHI::CD3D11CommandBuffer *cmdBuff = it->Get(); + if (cmdBuff->IsBackBufferUsed(rt)) + cmdBuff->D3D11ReleaseCommandList(); + } + rt->ReleaseResources(); + if (PK_D3D11_FAILED(m_Context->m_SwapChains[swapChainIdx]->ResizeBuffers(kFrameCount, ctxSize.x(), ctxSize.y(), DXGI_FORMAT_B8G8R8A8_UNORM, 0))) + { + return false; + } + if (!CreateRenderTargets(swapChainIdx, ctxSize, null)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +TMemoryView CD3D11Context::GetCurrentSwapChain() +{ + return m_ApiData.m_SwapChainRenderTargets; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::EnableDebugLayer() +{ + PK_ASSERT(m_ApiData.m_Device != null); + +#if (USE_DEBUG_DXGI != 0) + if (PK_D3D11_FAILED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(&m_Context->m_Debug)))) + return false; +#endif + +#if (BREAK_ON_D3D_ERROR != 0) || (BREAK_ON_D3D_WARN != 0) + ID3D11InfoQueue *infoQueue = null; + m_ApiData.m_Device->QueryInterface(&infoQueue); + if (infoQueue != null) + { + PK_D3D11_OK(infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, TRUE)); + PK_D3D11_OK(infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, TRUE)); +# if (BREAK_ON_D3D_WARN != 0) + PK_D3D11_OK(infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, TRUE)); +# endif + infoQueue->Release(); + } +#endif + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::CreateDevice(bool debug) +{ + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + }; + if (!PickHardwareAdapter()) + { + CLog::Log(PK_ERROR, "D3D11: Couldn't pick hardware adapter"); + return false; + } + if (!PK_D3D11_OK(m_Context->m_CreateDeviceFunc( m_Context->m_HardwareAdapter, + D3D_DRIVER_TYPE_UNKNOWN, + null, + debug ? D3D11_CREATE_DEVICE_DEBUG : 0, + featureLevels, + _countof(featureLevels), + D3D11_SDK_VERSION, + &m_ApiData.m_Device, + &m_ApiData.m_FeatureLevel, + &m_ApiData.m_ImmediateDeviceContext))) + { + CLog::Log(PK_ERROR, "D3D12: Couldn't create device"); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::PickHardwareAdapter() +{ + IDXGIFactory1 *&factory = m_Context->m_Factory; + IDXGIAdapter1 *&adapter = m_Context->m_HardwareAdapter; + adapter = 0; + for (u32 idx = 0; factory->EnumAdapters1(idx, &adapter) != DXGI_ERROR_NOT_FOUND; ++idx) + { + DXGI_ADAPTER_DESC1 desc; + adapter->GetDesc1(&desc); + + if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) + { + // Don't select the Basic Render Driver adapter. + // If you want a software adapter, pass in "/warp" on the command line. + continue; + } + + // Check to see if the adapter supports Direct3D 12, but don't create the + // actual device yet. + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + }; + if (SUCCEEDED(m_Context->m_CreateDeviceFunc(adapter, D3D_DRIVER_TYPE_UNKNOWN, null, 0, featureLevels, _countof(featureLevels), D3D11_SDK_VERSION, null, null, null))) + { + return true; + } + } + adapter = 0; + return false; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::AddSwapChain(HWND winHandle, CUint2 winSize, TMemoryView *view /*= null*/) +{ + const CGuid idx = m_Context->m_SwapChains.PushBack(null); + + if (!PK_VERIFY(idx.Valid()) || + !PK_VERIFY(m_ApiData.m_SwapChainRenderTargets.PushBack() == idx)) + return false; + + if (!CreateSwapChain(idx, winHandle, winSize, view)) + return false; + + m_ApiData.m_SwapChainCount++; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::CreateSwapChain(u32 swapChainIdx, HWND winHandle, CUint2 winSize, TMemoryView *view) +{ +#if defined(PK_WINDOWS) + IDXGISwapChain *swapChain = null; + DXGI_SWAP_CHAIN_DESC swapChainDesc = {}; + swapChainDesc.BufferDesc.Width = winSize.x(); + swapChainDesc.BufferDesc.Height = winSize.y(); + swapChainDesc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_STRETCHED; + swapChainDesc.SampleDesc.Count = 1; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swapChainDesc.BufferCount = kFrameCount; + swapChainDesc.OutputWindow = winHandle; + swapChainDesc.Windowed = TRUE; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + + if (PK_D3D11_FAILED(m_Context->m_Factory->CreateSwapChain(m_ApiData.m_Device, &swapChainDesc, &swapChain))) + return false; + m_Context->m_SwapChains[swapChainIdx] = swapChain; + return CreateRenderTargets(swapChainIdx, winSize, view); +#else + m_Context->m_SwapChains[swapChainIdx] = null; + return false; +#endif +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::CreateRenderTargets(u32 swapChainIdx, CUint2 winSize, TMemoryView *view) +{ + // Offscreen rendering could leave a swapchain empty + if (m_Context->m_SwapChains[swapChainIdx] == null) + return false; + m_ApiData.m_BufferingMode = RHI::ContextDoubleBuffering;// static_cast(kFrameCount); + + ID3D11Resource *rtResource = null; + if (PK_D3D11_FAILED(m_Context->m_SwapChains[swapChainIdx]->GetBuffer(0, IID_PPV_ARGS(&rtResource)))) + return false; + RHI::CD3D11RenderTarget * rhiRT = PK_NEW(RHI::CD3D11RenderTarget(RHI::SRHIResourceInfos("D3D11Context Swap Chain"))); + if (rhiRT == null) + return false; + rhiRT->D3D11SetRenderTarget(rtResource, RHI::FormatSrgb8BGRA, winSize, true); + m_ApiData.m_SwapChainRenderTargets[swapChainIdx] = rhiRT; + if (view != null) + *view = TMemoryView(m_ApiData.m_SwapChainRenderTargets.Last()); + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D11Context::CreateOffscreenRenderTarget(const CUint2 &winSize) +{ + ID3D11Texture2D *rtResource = null; + D3D11_TEXTURE2D_DESC textureDesc = {}; + textureDesc.Width = winSize.x(); + textureDesc.Height = winSize.y(); + textureDesc.ArraySize = 1; + textureDesc.SampleDesc.Count = 1; + textureDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; + textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET; + + if (PK_D3D11_FAILED(m_ApiData.m_Device->CreateTexture2D(&textureDesc, null, &rtResource))) + return false; + + m_ApiData.m_BufferingMode = RHI::ContextDoubleBuffering; + + RHI::CD3D11RenderTarget *rhiRT = PK_NEW(RHI::CD3D11RenderTarget(RHI::SRHIResourceInfos("D3D11Context Offscreen Swap Chain"))); + if (rhiRT == null) + return false; + + // create a fake swapchain + const CGuid swapChainIdx = m_Context->m_SwapChains.PushBack(null); + + if (!PK_VERIFY(swapChainIdx.Valid()) || + !PK_VERIFY(m_ApiData.m_SwapChainRenderTargets.PushBack() == swapChainIdx)) + return false; + m_ApiData.m_SwapChainCount++; + + // add render target + rhiRT->D3D11SetRenderTarget(rtResource, RHI::FormatSrgb8BGRA, winSize); + m_ApiData.m_SwapChainRenderTargets[swapChainIdx] = rhiRT; + + return true; +} + +//---------------------------------------------------------------------------- + +#define SAFE_RELEASE(_x) do { if ((_x) != null) { (_x)->Release(); (_x) = null; } } while (0); + +bool CD3D11Context::DestroySwapChain(u32 swapChainIdx) +{ + if (!PK_VERIFY(swapChainIdx < m_Context->m_SwapChains.Count())) + return false; + m_ApiData.m_ImmediateDeviceContext->OMSetRenderTargets(0, null, null); + m_ApiData.m_ImmediateDeviceContext->ClearState(); + + RHI::PD3D11RenderTarget rt = CastD3D11(m_ApiData.m_SwapChainRenderTargets[swapChainIdx]); + PK_FOREACH(it, m_ApiData.m_DeferredCommandBuffer) + { + RHI::CD3D11CommandBuffer *cmdBuff = it->Get(); + if (cmdBuff->IsBackBufferUsed(rt)) + cmdBuff->D3D11ReleaseCommandList(); + } + rt->ReleaseResources(); + + m_ApiData.m_SwapChainRenderTargets.Remove(swapChainIdx); + SAFE_RELEASE(m_Context->m_SwapChains[swapChainIdx]); + m_Context->m_SwapChains.Remove(swapChainIdx); + m_ApiData.m_SwapChainCount--; + return true; +} + +#undef SAFE_RELEASE + +//---------------------------------------------------------------------------- + +RHI::SD3D11BasicContext *CD3D11Context::GetD3D11Context() +{ + return &m_ApiData; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif diff --git a/Samples/PK-SampleLib/ApiContext/D3D/D3D11Context.h b/Samples/PK-SampleLib/ApiContext/D3D/D3D11Context.h new file mode 100644 index 00000000..48e038da --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/D3D/D3D11Context.h @@ -0,0 +1,82 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/ApiContextConfig.h" +#include "PK-SampleLib/ApiContext/IApiContext.h" +#include "PK-SampleLib/WindowContext/AWindowContext.h" + +#if (PK_BUILD_WITH_D3D11_SUPPORT != 0) && defined(PK_WINDOWS) + +#include + +struct SDL_Window; + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SD3D11PlatformContext; + +//---------------------------------------------------------------------------- + +class CD3D11Context : public IApiContext +{ +public: + CD3D11Context(); + ~CD3D11Context(); + + virtual bool InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) override; + virtual bool WaitAllRenderFinished() override; + virtual CGuid BeginFrame() override; + virtual bool EndFrame(void *renderToWait) override; + virtual RHI::SApiContext *GetRenderApiContext() override; + virtual bool RecreateSwapChain(const CUint2 &ctxSize) override; + virtual TMemoryView GetCurrentSwapChain() override; + + static const u32 kFrameCount = 2; + + RHI::SD3D11BasicContext *GetD3D11Context(); + + bool InitContext(bool debug); +#if defined(PK_WINDOWS) + bool AddSwapChain(HWND winHandle, CUint2 winSize, TMemoryView *view = null); +#endif + + CGuid BeginFrame(u32 swapchainIdx); + bool EndFrame(u32 swapchainIdx); + + + bool DestroySwapChain(u32 swapChainIdx); + bool RecreateSwapChain(u32 swapChainIdx, const CUint2 &ctxSize); + +private: + bool LoadDynamicLibrary(); + + bool EnableDebugLayer(); + bool CreateDevice(bool debug); + bool PickHardwareAdapter(); + + bool CreateSwapChain(u32 swapChainIdx, HWND winHandle, CUint2 winSize, TMemoryView *view); + bool CreateRenderTargets(u32 swapChainIdx, CUint2 winSize, TMemoryView *view); + bool CreateOffscreenRenderTarget(const CUint2 &winSize); + + +private: + SD3D11PlatformContext *m_Context; + RHI::SD3D11BasicContext m_ApiData; + CGuid m_BufferIndex; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_D3D12_SUPPORT != 0) + diff --git a/Samples/PK-SampleLib/ApiContext/D3D/D3D12Context.cpp b/Samples/PK-SampleLib/ApiContext/D3D/D3D12Context.cpp new file mode 100644 index 00000000..14443b80 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/D3D/D3D12Context.cpp @@ -0,0 +1,899 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_D3D12_SUPPORT != 0) && defined(PK_WINDOWS) + +#pragma warning(push) +#pragma warning(disable : 4668) // C4668 (level 4) 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' +# include +#pragma warning(pop) + +#include + +#include + +#if (PK_BUILD_WITH_SDL != 0) +# if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpragma-pack" +# endif // defined(PK_COMPILER_CLANG_CL) +# include +# if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic pop +# endif // defined(PK_COMPILER_CLANG_CL) +#endif // (PK_BUILD_WITH_SDL != 0) + +#include "D3D12Context.h" +#include +#include +#include +#include +#include + +#if defined(PK_DEBUG) +# define PK_ENABLE_DEBUG_LAYER 1 +#else +# define PK_ENABLE_DEBUG_LAYER 0 // disabled by default, set to 1 to enable debug layer controls in Release/Retail. +#endif // defined(PK_DEBUG) + +#if (PK_ENABLE_DEBUG_LAYER != 0) +# define USE_DEBUG_DXGI 1 // disabled by default, not available everywhere +# define USE_GPU_BASED_DEBUG 0 // disabled by default, not available everywhere +# define ENABLE_INFO_DEBUG_LVL 0 // disabled by default, change it for debug when specifically needed +# define USE_DRED 0 // disabled by default, not available everywhere +# define BREAK_ON_D3D_ERROR 0 // disabled by default, enable for break on D3D errors during API calls +# define BREAK_ON_D3D_WARN 0 // disabled by default, enable for break on D3D warnings during API calls +# if (USE_DEBUG_DXGI != 0) +# pragma comment(lib, "dxguid.lib") +# include "d3d12sdklayers.h" +# endif // (USE_DEBUG_DXGI != 0) +#else +# define USE_DEBUG_DXGI 0 +# define USE_GPU_BASED_DEBUG 0 +# define ENABLE_INFO_DEBUG_LVL 0 // useless to change this, debug layers shouldn't be enable +# define USE_DRED 0 +# define BREAK_ON_D3D_ERROR 0 +# define BREAK_ON_D3D_WARN 0 +#endif + +#if (USE_DEBUG_DXGI != 0) +# include +#endif + +#if (USE_DRED != 0) +# include "pk_kernel/include/kr_string_unicode.h" +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +PK_DECLARE_REFPTRCLASS(SdlContext); +#endif + +class CD3D12SwapChain : public RHI::ID3D12SwapChain +{ +public: + IDXGISwapChain3 *m_SwapChain; + CGuid m_BufferIndex; + RHI::PD3D12RenderTarget m_RenderTargets[CD3D12Context::kFrameCount]; + + CD3D12SwapChain() + : m_SwapChain(null) + { + } + + ~CD3D12SwapChain() + { + if (m_SwapChain != null) + m_SwapChain->Release(); + } + + CGuid BeginFrame(ID3D12CommandQueue *commandQueue) + { + (void)commandQueue; + + if (m_SwapChain != null) + { + m_BufferIndex = m_SwapChain->GetCurrentBackBufferIndex(); + return m_BufferIndex; + } + + // the case of offscreen rendering + return 0; + } + + virtual TMemoryView GetD3D12RenderTargets() const + { + return TMemoryView(m_RenderTargets); + } + + virtual TMemoryView GetRenderTargets() const + { + return TMemoryView(GetD3D12RenderTargets()); + } +}; + +//---------------------------------------------------------------------------- + +struct SD3D12PlatformContext +{ + IDXGIFactory4 *m_Factory; + IDXGIAdapter1 *m_HardwareAdapter; + + TArray m_SwapChains; + +#if (USE_DEBUG_DXGI != 0) + IDXGIDebug1 *m_Debug; +#endif + + PFN_D3D12_CREATE_DEVICE m_CreateDeviceFunc; + PFN_D3D12_GET_DEBUG_INTERFACE m_GetDebugInterfaceFunc; + HMODULE m_D3DModule; + HMODULE m_DXGIModule; + + SD3D12PlatformContext() + : m_Factory(null) + , m_HardwareAdapter(null) +#if (USE_DEBUG_DXGI != 0) + , m_Debug(null) +#endif + , m_D3DModule(0) + , m_DXGIModule(0) + { + } + + ~SD3D12PlatformContext() + { + if (m_Factory != null) + m_Factory->Release(); + if (m_HardwareAdapter != null) + m_HardwareAdapter->Release(); + +#if (USE_DEBUG_DXGI != 0) + if (m_Debug != null) + { + m_Debug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL); + m_Debug->Release(); + } +#endif + if (m_D3DModule != null) + FreeLibrary(m_D3DModule); + if (m_DXGIModule != null) + FreeLibrary(m_DXGIModule); + } +}; + +//---------------------------------------------------------------------------- + +CD3D12Context::CD3D12Context() +: m_Context(PK_NEW(SD3D12PlatformContext)) +{ +} + +//---------------------------------------------------------------------------- + +CD3D12Context::~CD3D12Context() +{ + m_ApiData.m_SwapChains.Clear(); + + // Warning: clear swapchains before clear descriptor allocators + if (m_Context != null) + { + for (u32 i = 0; i < m_Context->m_SwapChains.Count(); i++) + PK_SAFE_DELETE(m_Context->m_SwapChains[i]); + m_Context->m_SwapChains.Clear(); + } + + // Release allocator + while (m_ApiData.m_DescriptorAllocators.Count()) + { + PK_DELETE(m_ApiData.m_DescriptorAllocators.PopBack()); + } + m_ApiData.m_DescriptorAllocators.Clean(); + + if (m_ApiData.m_CommandQueue != null) + { + m_ApiData.m_CommandQueue->Release(); + m_ApiData.m_CommandQueue = null; + } + if (m_ApiData.m_CopyCommandQueue != null) + { + m_ApiData.m_CopyCommandQueue->Release(); + m_ApiData.m_CopyCommandQueue = null; + } + if (m_ApiData.m_ComputeCommandQueue != null) + { + m_ApiData.m_ComputeCommandQueue->Release(); + m_ApiData.m_ComputeCommandQueue = null; + } + if (m_ApiData.m_Device != null) + { +#if (ENABLE_INFO_DEBUG_LVL != 0) + ULONG count = m_ApiData.m_Device->Release(); + if (!PK_VERIFY(count == 0)) + CLog::Log(PK_DBG, "ID3D12Device still referenced %ul times", count); +#else + m_ApiData.m_Device->Release(); +#endif + m_ApiData.m_Device = null; + } + + PK_DELETE(m_Context); +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) +{ + if (!InitContext(debug)) + return false; + + if (windowApi->GetContextApi() == PKSample::Context_Sdl) + { +#if (PK_BUILD_WITH_SDL != 0) + PSdlContext sdlWindowApi = static_cast(windowApi.Get()); + + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + SDL_GetWindowWMInfo(sdlWindowApi->SdlGetWindow(), &info); +#if defined(PK_UWP) + return AddSwapchain(info.info.winrt.window, sdlWindowApi->GetDrawableSize()); +#elif defined(PK_WINDOWS) + return AddSwapChain(info.info.win.window, sdlWindowApi->GetDrawableSize()); +#endif +#else + return false; +#endif + } + else if (windowApi->GetContextApi() == PKSample::Context_Offscreen) + { + return CreateOffscreenRenderTarget(windowApi->GetDrawableSize()); + } + else + { // Does not implement another way to get window handle + return false; + } +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::LoadDynamicLibrary() +{ + PK_ASSERT(m_Context != null); + m_Context->m_D3DModule = ::LoadLibraryA("d3d12.dll"); + if (m_Context->m_D3DModule == null) + return false; + m_Context->m_DXGIModule = ::LoadLibraryA("dxgi.dll"); + if (m_Context->m_DXGIModule == null) + return false; + + m_Context->m_CreateDeviceFunc = (PFN_D3D12_CREATE_DEVICE)::GetProcAddress(m_Context->m_D3DModule, "D3D12CreateDevice"); + m_Context->m_GetDebugInterfaceFunc = (PFN_D3D12_GET_DEBUG_INTERFACE)::GetProcAddress(m_Context->m_D3DModule, "D3D12GetDebugInterface"); + m_ApiData.m_SerializeRootSignatureFunc = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)::GetProcAddress(m_Context->m_D3DModule, "D3D12SerializeRootSignature"); + + return m_Context->m_CreateDeviceFunc != null && + m_Context->m_GetDebugInterfaceFunc != null && + m_ApiData.m_SerializeRootSignatureFunc != null; +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::InitContext(bool debug) +{ + (void)debug; + if (m_Context == null) + return false; + m_ApiData.m_Api = RHI::GApi_D3D12; + m_ApiData.m_SwapChainCount = 0; + m_ApiData.m_BufferingMode = RHI::ContextDoubleBuffering; + + if (!LoadDynamicLibrary()) + return false; + +#if (PK_ENABLE_DEBUG_LAYER == 0) + if (debug) +#endif // (PK_ENABLE_DEBUG_LAYER == 0) + EnableDebugLayer(); + + // try grabbing CreateDXGIFactory2: + typedef HRESULT (WINAPI *FnCreateDXGIFactory2)( UINT Flags, + REFIID riid, + _COM_Outptr_ void **ppFactory); + + FnCreateDXGIFactory2 fnCreateDXGIFactory2 = (FnCreateDXGIFactory2)::GetProcAddress(m_Context->m_DXGIModule, "CreateDXGIFactory2"); + // if not found, this is not fatal, it will fallback (ie: on vista & xp) + if (fnCreateDXGIFactory2 == null) + { + CLog::Log(PK_INFO, "DXGI API 'CreateDXGIFactory2' not found, cannot create D3D12 context."); + return false; + } + + return PK_D3D_OK(fnCreateDXGIFactory2(debug ? DXGI_CREATE_FACTORY_DEBUG : 0, IID_PPV_ARGS(&m_Context->m_Factory))) && + CreateDevice(debug) && + CreateCommandQueue() && + CreateDescriptorAllocator(); +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::WaitAllRenderFinished() +{ + if (m_ApiData.m_Fence == null) + return false; + if (!m_ApiData.m_Fence->Reset()) + return false; + // Note (Alex) : use different value than previously used to avoid to wait partially + if (!m_ApiData.m_Fence->Signal(~0u)) + return false; + if (!m_ApiData.m_Fence->Wait(~0u)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +CGuid CD3D12Context::BeginFrame() +{ + return BeginFrame(0u); +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::EndFrame(void *renderToWait) +{ + (void)renderToWait; + return EndFrame(0u); +} + +//---------------------------------------------------------------------------- + +CGuid CD3D12Context::BeginFrame(u32 swapChainIdx) +{ + CD3D12SwapChain *swapchain = m_Context->m_SwapChains[swapChainIdx]; + PK_ASSERT(swapchain != null); + return swapchain->BeginFrame(m_ApiData.m_CommandQueue); +} + +//---------------------------------------------------------------------------- + +#if (USE_DRED != 0) +const char *KOp[] = { + "OP_SETMARKER", + "OP_BEGINEVENT", + "OP_ENDEVENT", + "OP_DRAWINSTANCED", + "OP_DRAWINDEXEDINSTANCED", + "OP_EXECUTEINDIRECT", + "OP_DISPATCH", + "OP_COPYBUFFERREGION", + "OP_COPYTEXTUREREGION", + "OP_COPYRESOURCE", + "OP_COPYTILES", + "OP_RESOLVESUBRESOURCE", + "OP_CLEARRENDERTARGETVIEW", + "OP_CLEARUNORDEREDACCESSVIEW", + "OP_CLEARDEPTHSTENCILVIEW", + "OP_RESOURCEBARRIER", + "OP_EXECUTEBUNDLE", + "OP_PRESENT", + "OP_RESOLVEQUERYDATA", + "OP_BEGINSUBMISSION", + "OP_ENDSUBMISSION", + "OP_DECODEFRAME", + "OP_PROCESSFRAMES", + "OP_ATOMICCOPYBUFFERUINT", + "OP_ATOMICCOPYBUFFERUINT64", + "OP_RESOLVESUBRESOURCEREGION", + "OP_WRITEBUFFERIMMEDIATE", + "OP_DECODEFRAME1", + "OP_SETPROTECTEDRESOURCESESSION", + "OP_DECODEFRAME2", + "OP_PROCESSFRAMES1", + "OP_BUILDRAYTRACINGACCELERATIONSTRUCTURE", + "OP_EMITRAYTRACINGACCELERATIONSTRUCTUREPOSTBUIL", + "OP_COPYRAYTRACINGACCELERATIONSTRUCTURE", + "OP_DISPATCHRAYS", + "OP_INITIALIZEMETACOMMAND", + "OP_EXECUTEMETACOMMAND", + "OP_ESTIMATEMOTION", + "OP_RESOLVEMOTIONVECTORHEAP", + "OP_SETPIPELINESTATE1", + "OP_INITIALIZEEXTENSIONCOMMAND", + "OP_EXECUTEEXTENSIONCOMMAND", +}; +#endif + +//---------------------------------------------------------------------------- + +bool CD3D12Context::EndFrame(u32 swapchainIdx) +{ + CD3D12SwapChain *swapchain = m_Context->m_SwapChains[swapchainIdx]; + PK_ASSERT(swapchain != null); +#if 1 + // offscreen rendering does not have swapchain instance + if (swapchain->m_SwapChain == null) + return true; + + const HRESULT hr = swapchain->m_SwapChain->Present(0, 0); + if (hr == DXGI_ERROR_DEVICE_RESET || + hr == DXGI_ERROR_DEVICE_REMOVED) + { + PK_D3D_OK(m_ApiData.m_Device->GetDeviceRemovedReason()); + +#if (USE_DRED != 0) + + // Gather extended device remove data + ID3D12DeviceRemovedExtendedData *dred = null; + if (S_OK == m_ApiData.m_Device->QueryInterface(IID_PPV_ARGS(&dred))) + { + D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT DredAutoBreadcrumbsOutput; + D3D12_DRED_PAGE_FAULT_OUTPUT DredPageFaultOutput; + dred->GetAutoBreadcrumbsOutput(&DredAutoBreadcrumbsOutput); + dred->GetPageFaultAllocationOutput(&DredPageFaultOutput); + + const D3D12_AUTO_BREADCRUMB_NODE * node = DredAutoBreadcrumbsOutput.pHeadAutoBreadcrumbNode; + CLog::Log(PK_DBG, "AUTO BREADCRUMNS:"); + while (node != null) + { + const char *name = node->pCommandListDebugNameA; + CString tmp; + if (name == null && node->pCommandListDebugNameW != null) + { + CStringUnicode n(node->pCommandListDebugNameW); + tmp = n.ToAscii(); + name = tmp.Data(); + } + for (u32 i = 0; i < node->BreadcrumbCount; ++i) + { + const char *op = KOp[node->pCommandHistory[i]]; + CLog::Log(PK_DBG, "%s - %s", op, name); + } + node = node->pNext; + } + + PK_BREAKPOINT(); + + dred->Release(); + } +#endif + + return false; + } + if (hr == DXGI_STATUS_OCCLUDED) + return true; + + return PK_D3D_OK(hr);//!FAILED(hr); +#else + if (PK_D3D_FAILED(swapchain->m_SwapChain->Present(0, 0))) + return false; + return true; +#endif +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::RecreateSwapChain(const CUint2 &ctxSize) +{ + PK_ASSERT(m_ApiData.m_SwapChains.Count() == 1); + if (!PK_VERIFY(!m_ApiData.m_SwapChains.Empty())) + return false; + return RecreateSwapChain(0, ctxSize); +} + +//---------------------------------------------------------------------------- + +TMemoryView CD3D12Context::GetCurrentSwapChain() +{ + if (PK_VERIFY(!m_ApiData.m_SwapChains.Empty())) + return m_ApiData.m_SwapChains[0]->GetRenderTargets(); + + return TMemoryView(); +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::EnableDebugLayer() +{ + ID3D12Debug *debugController = null; + if (PK_D3D_FAILED(m_Context->m_GetDebugInterfaceFunc(IID_PPV_ARGS(&debugController)))) + return false; + debugController->EnableDebugLayer(); +#if (USE_DEBUG_DXGI != 0) + // try grabbing DXGIGetDebugInterface1: + typedef HRESULT (WINAPI *FnDXGIGetDebugInterface1)(UINT Flags, REFIID riid, _COM_Outptr_ void **pDebug); + FnDXGIGetDebugInterface1 fnDXGIGetDebugInterface1 = (FnDXGIGetDebugInterface1)::GetProcAddress(m_Context->m_DXGIModule, "DXGIGetDebugInterface1"); + + if (PK_D3D_FAILED(fnDXGIGetDebugInterface1(0, IID_PPV_ARGS(&m_Context->m_Debug)))) + return false; + m_Context->m_Debug->EnableLeakTrackingForThread(); +#endif +#if (USE_GPU_BASED_DEBUG != 0) + ID3D12Debug1 *debugController1 = null; + if (PK_D3D_FAILED(m_Context->m_GetDebugInterfaceFunc(IID_PPV_ARGS(&debugController1)))) + return false; + debugController1->SetEnableGPUBasedValidation(TRUE); +#endif +#if (USE_DRED != 0) + ID3D12DeviceRemovedExtendedDataSettings *dredSettings = null; + if (PK_D3D_FAILED(m_Context->m_GetDebugInterfaceFunc(IID_PPV_ARGS(&dredSettings)))) + return false; + dredSettings->SetAutoBreadcrumbsEnablement(D3D12_DRED_ENABLEMENT_FORCED_ON); + dredSettings->SetPageFaultEnablement(D3D12_DRED_ENABLEMENT_FORCED_ON); + dredSettings->Release(); +#endif + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::CreateDevice(bool debug) +{ + (void)debug; + if (!PickHardwareAdapter()) + { + CLog::Log(PK_ERROR, "D3D12: Couldn't pick hardware adapter"); + return false; + } + if (!PK_D3D_OK(m_Context->m_CreateDeviceFunc(m_Context->m_HardwareAdapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_ApiData.m_Device)))) + { + CLog::Log(PK_ERROR, "D3D12: Couldn't create device"); + return false; + } + + D3D12_FEATURE_DATA_FEATURE_LEVELS levelFeature = {}; + const D3D_FEATURE_LEVEL levels[] = + { + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_12_0, + D3D_FEATURE_LEVEL_12_1 + }; + levelFeature.NumFeatureLevels = PK_ARRAY_COUNT(levels); + levelFeature.pFeatureLevelsRequested = levels; + m_ApiData.m_Device->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &levelFeature, sizeof(levelFeature)); + + if (levelFeature.MaxSupportedFeatureLevel > D3D_FEATURE_LEVEL_11_0) + { + m_ApiData.m_Device->Release(); + m_ApiData.m_Device = null; + if (!PK_D3D_OK(m_Context->m_CreateDeviceFunc(m_Context->m_HardwareAdapter, levelFeature.MaxSupportedFeatureLevel, IID_PPV_ARGS(&m_ApiData.m_Device)))) + { + PK_ASSERT_NOT_REACHED_MESSAGE("Internal error when creating d3d12 device."); + return false; + } + } + +#if (PK_ENABLE_DEBUG_LAYER == 0) + if (debug) +#endif // (PK_ENABLE_DEBUG_LAYER == 0) + AdditionalFilterForDebugLayer(); + + return true; +} + +//---------------------------------------------------------------------------- + +void CD3D12Context::AdditionalFilterForDebugLayer() +{ + ID3D12InfoQueue *infoQueue = null; + m_ApiData.m_Device->QueryInterface(&infoQueue); + if (infoQueue == null) + return; + D3D12_INFO_QUEUE_FILTER filter; + Mem::Clear(filter); +#if (ENABLE_INFO_DEBUG_LVL == 0) + D3D12_MESSAGE_SEVERITY denySeverity[] = { D3D12_MESSAGE_SEVERITY_INFO }; // deny info level + filter.DenyList.NumSeverities = PK_ARRAY_COUNT(denySeverity); + filter.DenyList.pSeverityList = denySeverity; +#endif + D3D12_MESSAGE_ID denyIDs[] = { D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE }; // deny clear warning on RT + filter.DenyList.NumIDs = PK_ARRAY_COUNT(denyIDs); + filter.DenyList.pIDList = denyIDs; + PK_D3D_OK(infoQueue->PushStorageFilter(&filter)); + +#if (BREAK_ON_D3D_ERROR != 0) || (BREAK_ON_D3D_WARN != 0) + PK_D3D_OK(infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, TRUE)); + PK_D3D_OK(infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, TRUE)); +# if (BREAK_ON_D3D_WARN != 0) + PK_D3D_OK(infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING, TRUE)); +# endif // (BREAK_ON_D3D_WARN != 0) +#endif // (BREAK_ON_D3D_ERROR != 0) || (BREAK_ON_D3D_WARN != 0) + + infoQueue->Release(); +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::PickHardwareAdapter() +{ + IDXGIFactory4 *&factory = m_Context->m_Factory; + IDXGIAdapter1 *&adapter = m_Context->m_HardwareAdapter; + adapter = 0; + for (u32 idx = 0; factory->EnumAdapters1(idx, &adapter) != DXGI_ERROR_NOT_FOUND; ++idx) + { + DXGI_ADAPTER_DESC1 desc; + adapter->GetDesc1(&desc); + + if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) + { + // Don't select the Basic Render Driver adapter. + // If you want a software adapter, pass in "/warp" on the command line. + continue; + } + + // Check to see if the adapter supports Direct3D 12, but don't create the + // actual device yet. + if (SUCCEEDED(m_Context->m_CreateDeviceFunc(adapter, D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), null))) + { + return true; + } + } + adapter = 0; + return false; +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::CreateDescriptorAllocator() +{ + // Create allocators if not exists or missing + TArray & allocators = m_ApiData.m_DescriptorAllocators; + u32 count = allocators.Count(); + if (count < D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES) + { + if (!allocators.Resize(D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES)) + return false; + for (u32 i = 0; i < D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES; ++i) + { + u32 batchCount = (i >= D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER) ? 64u : 8192u; + allocators[i] = PK_NEW(RHI::CD3D12DescriptorAllocator(m_ApiData.m_Device, static_cast(i), batchCount)); + if (allocators[i] == null) + return false; + } + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::CreateCommandQueue() +{ + D3D12_COMMAND_QUEUE_DESC graphicsCmdQueueDesc = {}; + graphicsCmdQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; + graphicsCmdQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT; // Disable TDR for compute + graphicsCmdQueueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL; + + D3D12_COMMAND_QUEUE_DESC copyCmdQueueDesc = {}; + copyCmdQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_COPY; + copyCmdQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT; // Disable TDR for compute + copyCmdQueueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL; + + D3D12_COMMAND_QUEUE_DESC computeCmdQueueDesc = {}; + computeCmdQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_COMPUTE; + computeCmdQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT; // Disable TDR for compute + computeCmdQueueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL; + + return PK_D3D_OK(m_ApiData.m_Device->CreateCommandQueue(&graphicsCmdQueueDesc, IID_PPV_ARGS(&m_ApiData.m_CommandQueue))) && + PK_D3D_OK(m_ApiData.m_Device->CreateCommandQueue(©CmdQueueDesc, IID_PPV_ARGS(&m_ApiData.m_CopyCommandQueue))) && + PK_D3D_OK(m_ApiData.m_Device->CreateCommandQueue(&computeCmdQueueDesc, IID_PPV_ARGS(&m_ApiData.m_ComputeCommandQueue))); +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::RecreateSwapChain(u32 swapChainIdx, const CUint2 &ctxSize) +{ + WaitAllRenderFinished(); + if (!PK_VERIFY(swapChainIdx < m_Context->m_SwapChains.Count())) + return false; + + CD3D12SwapChain *swapchain = m_Context->m_SwapChains[swapChainIdx]; + PK_ASSERT(swapchain != null); + + for (u32 i = 0; i < kFrameCount; ++i) + { + RHI::PD3D12RenderTarget &rt = swapchain->m_RenderTargets[i]; + PK_FOREACH(it, m_ApiData.m_DeferredCommandBuffer) + { + RHI::CD3D12CommandBuffer *cmdBuff = it->Get(); + if (cmdBuff->IsBackBufferUsed(rt)) + cmdBuff->D3D12ReleaseCommandList(); + } + rt->ReleaseResources(); + } + + if (PK_D3D_FAILED(swapchain->m_SwapChain->ResizeBuffers(kFrameCount, ctxSize.x(), ctxSize.y(), DXGI_FORMAT_B8G8R8A8_UNORM, 0))) + { + return false; + } + if (!CreateRenderTargets(swapChainIdx, ctxSize, null)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::DestroySwapChain(u32 swapChainIdx) +{ + if (!PK_VERIFY(swapChainIdx < m_Context->m_SwapChains.Count())) + return false; + + CD3D12SwapChain *swapchain = m_Context->m_SwapChains[swapChainIdx]; + PK_ASSERT(swapchain != null); + + for (u32 i = 0; i < kFrameCount; ++i) + { + RHI::PD3D12RenderTarget &rt = swapchain->m_RenderTargets[i]; + PK_FOREACH(it, m_ApiData.m_DeferredCommandBuffer) + { + RHI::CD3D12CommandBuffer *cmdBuff = it->Get(); + if (cmdBuff->IsBackBufferUsed(rt)) + cmdBuff->D3D12ReleaseCommandList(); + } + rt->ReleaseResources(); + } + m_Context->m_SwapChains.Remove(swapChainIdx); + PK_SAFE_DELETE(swapchain); + m_ApiData.m_SwapChainCount--; + m_ApiData.m_SwapChains = TMemoryView(m_Context->m_SwapChains.ViewForWriting()); + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::AddSwapChain(HWND winHandle, CUint2 winSize, TMemoryView *view /*= null*/) +{ + CD3D12SwapChain *swapchain = PK_NEW(CD3D12SwapChain()); + if (swapchain == null) + return false; + + const CGuid idx = m_Context->m_SwapChains.PushBack(swapchain); + if (!PK_VERIFY(idx.Valid())) + { + PK_DELETE(swapchain); + return false; + } + + m_ApiData.m_SwapChainCount++; + m_ApiData.m_SwapChains = TMemoryView(m_Context->m_SwapChains.ViewForWriting()); + + if (!CreateSwapChain(idx, winHandle, winSize, view)) + { + // NOTE(Julien) : This feels sloppy. what behavior should a failure to create the swapchain have? doesn't seem clear + // when 'AddSwapChain' returns false, in theory, there shouldn't be a new element in 'm_SwapChains' + // it's the case currently if we don't run the code below. + // If that's the behavior we want, it needs to be homogenized with the 'RecreateSwapChain' function above + // to behave consistently across the different swapchain manipulation calls. +#if 0 + m_Context->m_SwapChains.Remove(idx); + PK_SAFE_DELETE(swapchain); + m_ApiData.m_SwapChainCount--; + m_ApiData.m_SwapChains = TMemoryView(m_Context->m_SwapChains.ViewForWriting()); +#endif + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::CreateSwapChain(u32 swapChainIdx, HWND winHandle, CUint2 winSize, TMemoryView *view) +{ + CD3D12SwapChain *swapchain = m_Context->m_SwapChains[swapChainIdx]; + PK_ASSERT(swapchain != null); + + DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {}; + swapChainDesc.Width = winSize.x(); + swapChainDesc.Height = winSize.y(); + swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + swapChainDesc.Stereo = FALSE; + swapChainDesc.SampleDesc.Count = 1; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swapChainDesc.BufferCount = kFrameCount; + swapChainDesc.Scaling = DXGI_SCALING_NONE; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + + IDXGISwapChain1 *dxswapChain = null; +#if defined(PK_WINDOWS) + if (PK_D3D_FAILED(m_Context->m_Factory->CreateSwapChainForHwnd(m_ApiData.m_CommandQueue, winHandle, &swapChainDesc, null, null, &dxswapChain))) +#endif + return false; + if (PK_D3D_FAILED(dxswapChain->QueryInterface(&swapchain->m_SwapChain))) + return false; + dxswapChain->Release(); + return CreateRenderTargets(swapChainIdx, winSize, view); +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::CreateRenderTargets(u32 swapChainIdx, CUint2 winSize, TMemoryView *view) +{ + CD3D12SwapChain *swapchain = m_Context->m_SwapChains[swapChainIdx]; + PK_ASSERT(swapchain != null); + + for (u32 i = 0; i < kFrameCount; ++i) + { + ID3D12Resource *rtResource = null; + if (PK_D3D_FAILED(swapchain->m_SwapChain->GetBuffer(i, IID_PPV_ARGS(&rtResource)))) + return false; + RHI::CD3D12RenderTarget * rhiRT = swapchain->m_RenderTargets[i] != null ? swapchain->m_RenderTargets[i].Get() : PK_NEW(RHI::CD3D12RenderTarget(RHI::SRHIResourceInfos("D3D12Context Swap Chain"))); + if (rhiRT == null) + return false; + rhiRT->D3D12SetRenderTarget(rtResource, RHI::FormatSrgb8BGRA, winSize, true); + rhiRT->D3D12SetResourceState(D3D12_RESOURCE_STATE_PRESENT); + swapchain->m_RenderTargets[i] = rhiRT; + RHI::D3D12SetDebugObjectName(rtResource, rhiRT->DebugName()); + } + + if (view != null) + *view = swapchain->GetRenderTargets(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CD3D12Context::CreateOffscreenRenderTarget(const CUint2 &winSize) +{ + D3D12_HEAP_PROPERTIES heapProps = { D3D12_HEAP_TYPE_DEFAULT }; + D3D12_RESOURCE_DESC textureDesc = {}; + textureDesc.Width = winSize.x(); + textureDesc.Height = winSize.y(); + textureDesc.DepthOrArraySize = 1; + textureDesc.SampleDesc.Count = 1; + textureDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + textureDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + textureDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + + // create a fake swapchain + CD3D12SwapChain *swapchain = PK_NEW(CD3D12SwapChain()); + PK_ASSERT(swapchain != null); + + const CGuid idx = m_Context->m_SwapChains.PushBack(swapchain); + if (!PK_VERIFY(idx.Valid())) + { + PK_DELETE(swapchain); + return false; + } + + m_ApiData.m_SwapChainCount++; + m_ApiData.m_SwapChains = TMemoryView(m_Context->m_SwapChains.ViewForWriting()); + m_ApiData.m_BufferingMode = RHI::ContextDoubleBuffering; + + for (u32 i = 0; i < kFrameCount; ++i) + { + RHI::CD3D12RenderTarget * rhiRT = swapchain->m_RenderTargets[i] != null ? swapchain->m_RenderTargets[i].Get() : PK_NEW(RHI::CD3D12RenderTarget(RHI::SRHIResourceInfos("D3D12Context Offscreen Swap Chain"))); + if (rhiRT == null) + return false; + + ID3D12Resource *rtResource = null; + if (PK_D3D_FAILED(m_ApiData.m_Device->CreateCommittedResource( &heapProps, + D3D12_HEAP_FLAG_NONE, + &textureDesc, + D3D12_RESOURCE_STATE_PRESENT, + null, + IID_PPV_ARGS(&rtResource)))) + return false; + + rhiRT->D3D12SetRenderTarget(rtResource, RHI::FormatSrgb8BGRA, winSize); + rhiRT->D3D12SetResourceState(D3D12_RESOURCE_STATE_PRESENT); + swapchain->m_RenderTargets[i] = rhiRT; + } + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_D3D12_SUPPORT != 0) && defined(PK_WINDOWS) diff --git a/Samples/PK-SampleLib/ApiContext/D3D/D3D12Context.h b/Samples/PK-SampleLib/ApiContext/D3D/D3D12Context.h new file mode 100644 index 00000000..5ce8b74d --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/D3D/D3D12Context.h @@ -0,0 +1,83 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/ApiContextConfig.h" + +#if (PK_BUILD_WITH_D3D12_SUPPORT != 0) && defined(PK_WINDOWS) + +#include +#include +#include "PK-SampleLib/ApiContext/IApiContext.h" +#include "PK-SampleLib/WindowContext/AWindowContext.h" + +struct SDL_Window; + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SD3D12PlatformContext; + +//---------------------------------------------------------------------------- + +class CD3D12Context : public IApiContext +{ +public: + CD3D12Context(); + ~CD3D12Context(); + + virtual bool InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) override; + virtual bool WaitAllRenderFinished() override; + virtual CGuid BeginFrame() override; + virtual bool EndFrame(void *renderToWait) override; + virtual RHI::SApiContext *GetRenderApiContext() override { return &m_ApiData; } + virtual bool RecreateSwapChain(const CUint2 &ctxSize) override; + virtual TMemoryView GetCurrentSwapChain() override; + + static const u32 kFrameCount = 3; + + RHI::SD3D12BasicContext *GetD3D12Context() { return &m_ApiData; } + const RHI::SD3D12BasicContext *GetD3D12Context() const { return &m_ApiData; } + + bool InitContext(bool debug); +#if defined(PK_WINDOWS) + bool AddSwapChain(HWND winHandle, CUint2 winSize, TMemoryView *view = null); +#endif + + CGuid BeginFrame(u32 swapchainIdx); + bool EndFrame(u32 swapchainIdx); + + bool DestroySwapChain(u32 swapChainIdx); + bool RecreateSwapChain(u32 swapChainIdx, const CUint2 &ctxSize); + +private: + bool LoadDynamicLibrary(); + + bool EnableDebugLayer(); + bool CreateDevice(bool debug); + void AdditionalFilterForDebugLayer(); + bool CreateCommandQueue(); + bool PickHardwareAdapter(); + bool CreateDescriptorAllocator(); + + bool CreateSwapChain(u32 swapChainIdx, HWND winHandle, CUint2 winSize, TMemoryView *view); + bool CreateRenderTargets(u32 swapChainIdx, CUint2 winSize, TMemoryView *view); + bool CreateOffscreenRenderTarget(const CUint2 &winSize); + + SD3D12PlatformContext *m_Context; + RHI::SD3D12BasicContext m_ApiData; +}; +PK_DECLARE_REFPTRCLASS(D3D12Context); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_D3D12_SUPPORT != 0) && defined(PK_WINDOWS) diff --git a/Samples/PK-SampleLib/ApiContext/IApiContext.h b/Samples/PK-SampleLib/ApiContext/IApiContext.h new file mode 100644 index 00000000..cfed0011 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/IApiContext.h @@ -0,0 +1,46 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#include +#include + +__PK_RHI_API_BEGIN +struct SApiContext; +__PK_RHI_API_END + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +PK_FORWARD_DECLARE(AbstractWindowContext); + +//---------------------------------------------------------------------------- + +class IApiContext : public CRefCountedObject +{ +public: + IApiContext() { } + virtual ~IApiContext() { } + + virtual bool InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) = 0; + virtual bool WaitAllRenderFinished() = 0; + virtual CGuid BeginFrame() = 0; + virtual bool EndFrame(void *renderToWait) = 0; + virtual RHI::SApiContext *GetRenderApiContext() = 0; + virtual bool RecreateSwapChain(const CUint2 &ctxSize) = 0; + virtual TMemoryView GetCurrentSwapChain() = 0; +}; +PK_DECLARE_REFPTRINTERFACE(ApiContext); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ApiContext/Metal/MetalContext.h b/Samples/PK-SampleLib/ApiContext/Metal/MetalContext.h new file mode 100644 index 00000000..34679eea --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/Metal/MetalContext.h @@ -0,0 +1,103 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/ApiContextConfig.h" +#include "PK-SampleLib/ApiContext/IApiContext.h" +#include "PK-SampleLib/WindowContext/AWindowContext.h" + +#include + +#if (PK_BUILD_WITH_METAL_SUPPORT != 0) && defined(PK_MACOSX) + +//---------------------------------------------------------------------------- + +@interface PKMetalView : NSView + +- (instancetype)initWithFrame:(NSRect)frame + highDPI:(BOOL)highDPI; + +@property (nonatomic) BOOL highDPI; + +@end + +//---------------------------------------------------------------------------- + +__PK_RHI_API_BEGIN + struct SWaitAllSwapChains; + PK_FORWARD_DECLARE(MetalRenderTarget); +__PK_RHI_API_END + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CMetalContext : public IApiContext +{ +public: + CMetalContext(); + ~CMetalContext(); + + virtual bool InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) override; + virtual bool WaitAllRenderFinished() override; + virtual CGuid BeginFrame() override; + virtual bool EndFrame(void *renderToWait) override; + virtual RHI::SApiContext *GetRenderApiContext() override; + virtual bool RecreateSwapChain(const CUint2 &ctxSize) override; + virtual TMemoryView GetCurrentSwapChain() override; + + // Create final flip render state / render pass: + struct SFinalBlit + { + MTLRenderPassDescriptor *m_RenderPassDesc; + id m_Library; + id m_VertexFunc; + id m_FragmentFunc; + id m_PipelineState; + }; + + static bool CreateFinalBlitData(id device, + SFinalBlit &finalBlit, + RHI::EPixelFormat pxlFormat = RHI::FormatSrgb8BGRA); + static void DestroyFinalBlitData(SFinalBlit &finalBlit); + + static bool EndFrame( id queue, + const TMemoryView &swapChains, + const SFinalBlit &finalBlit, + RHI::SWaitAllSwapChains *syncInfo, + bool isOffScreen, + const RHI::PRenderTarget renderTarget = null); + static bool MetalCreateView(NSView *currentView, PKMetalView *&pkView, bool highDPI); + static void MetalRemoveView(PKMetalView *&pkView); + static bool MetalSetupLayer(id device, + PKMetalView *&pkView, + const CUint2 &ctxSize, + RHI::EPixelFormat pxlFormat = RHI::FormatSrgb8BGRA); + static RHI::PMetalRenderTarget MetalCreateRenderTarget(id device, + const CUint2 &ctxSize, + RHI::EPixelFormat pxlFormat = RHI::FormatSrgb8BGRA, + bool cpuAccessible = false); + +private: + // Cannot directly have the SMetalBasicContext as we cannot include it in a cpp file + // the goal is that most include should be able to be included in cpp files... + RHI::SMetalBasicContext m_ApiData; + RHI::PMetalRenderTarget m_SwapChainRT; + + SFinalBlit m_FinalBlit; + + PKMetalView *m_CurrentView; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_METAL_SUPPORT != 0) + diff --git a/Samples/PK-SampleLib/ApiContext/Metal/MetalContext.mm b/Samples/PK-SampleLib/ApiContext/Metal/MetalContext.mm new file mode 100644 index 00000000..307dc5cb --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/Metal/MetalContext.mm @@ -0,0 +1,427 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "MetalContext.h" +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_METAL_SUPPORT != 0) && defined(PK_MACOSX) + +#import +#import + +#include +#include + +#include +#include +#include +#include + +#include "MetalFinalBlitShader.h" + +@implementation PKMetalView + ++ (Class)layerClass +{ + return NSClassFromString(@"CAMetalLayer"); +} + +- (BOOL)wantsUpdateLayer +{ + return YES; +} + +- (CALayer*)makeBackingLayer +{ + return [self.class.layerClass layer]; +} + +- (instancetype)initWithFrame:(NSRect)frame + highDPI:(BOOL)highDPI +{ + if ((self = [super initWithFrame:frame])) + { + self.highDPI = highDPI; + self.wantsLayer = YES; + self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + [self updateDrawableSize]; + } + return self; +} + +- (void)updateDrawableSize +{ + CAMetalLayer *metalLayer = (CAMetalLayer *)self.layer; + CGSize size = self.bounds.size; + CGSize backingSize = size; + + if (self.highDPI) + { + backingSize = [self convertSizeToBacking:size]; + } + + metalLayer.contentsScale = backingSize.height / size.height; + metalLayer.drawableSize = backingSize; +} + +- (void)resizeWithOldSuperviewSize:(NSSize)oldSize +{ + [super resizeWithOldSuperviewSize:oldSize]; + [self updateDrawableSize]; +} + +@end + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +PK_DECLARE_REFPTRCLASS(SdlContext); +#endif + +//---------------------------------------------------------------------------- + +CMetalContext::CMetalContext() +: m_CurrentView(null) +{ +} + +//---------------------------------------------------------------------------- + +CMetalContext::~CMetalContext() +{ + DestroyFinalBlitData(m_FinalBlit); +} + +//---------------------------------------------------------------------------- + +bool CMetalContext::InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) +{ + (void)debug; + + // Create the device and the queue: + id device = MTLCreateSystemDefaultDevice(); + + if (!PK_VERIFY(device != null)) + return false; + + id queue = [device newCommandQueue]; + + if (!PK_VERIFY(queue != null)) + return false; + + m_ApiData.m_Api = RHI::GApi_Metal; + // Fill the api data with the metal data: + m_ApiData.m_Device = device; + m_ApiData.m_Queue = queue; + m_ApiData.m_SwapChainCount = 1; + + if (!PK_VERIFY(m_ApiData.m_SwapChains.Resize(1))) + return false; + +#if (PK_BUILD_WITH_SDL != 0) + if (windowApi->GetContextApi() == PKSample::Context_Sdl) + { + // Get the window native info: + PSdlContext sdlWindowApi = static_cast(windowApi.Get()); + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + SDL_GetWindowWMInfo(sdlWindowApi->SdlGetWindow(), &info); + + // Attach the metal layer to the sdl window: + NSView *view = info.info.cocoa.window.contentView; + + if (!PK_VERIFY(MetalCreateView(view, m_CurrentView, sdlWindowApi->HasHighDPI()))) + return false; + + if (!PK_VERIFY(RecreateSwapChain(windowApi->GetDrawableSize()))) + return false; + + m_ApiData.m_SwapChains.First().m_Layer = (CAMetalLayer*)m_CurrentView.layer; + } + else if (windowApi->GetContextApi() == PKSample::Context_Offscreen) +#else + if (windowApi->GetContextApi() == PKSample::Context_Offscreen) +#endif + { + if (!PK_VERIFY(RecreateSwapChain(windowApi->GetDrawableSize()))) + return false; + + m_ApiData.m_SwapChains.First().m_RenderTarget = m_SwapChainRT; + } + else + { + // Does not implement any other way to get window handle + return false; + } + + if (!PK_VERIFY(CreateFinalBlitData(device, m_FinalBlit))) + return false; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CMetalContext::WaitAllRenderFinished() +{ + return true; +} + +//---------------------------------------------------------------------------- + +CGuid CMetalContext::BeginFrame() +{ + return 0; +} + +//---------------------------------------------------------------------------- + +bool CMetalContext::EndFrame(void *renderToWait) +{ + RHI::SWaitAllSwapChains *syncInfo = reinterpret_cast(renderToWait); + bool isOffScreen = (m_CurrentView == null); + + return EndFrame(m_ApiData.m_Queue, m_ApiData.m_SwapChains, m_FinalBlit, syncInfo, isOffScreen); +} + +//---------------------------------------------------------------------------- + +RHI::SApiContext *CMetalContext::GetRenderApiContext() +{ + return &m_ApiData; +} + +//---------------------------------------------------------------------------- + +bool CMetalContext::RecreateSwapChain(const CUint2 &ctxSize) +{ + PK_ASSERT(m_ApiData.m_SwapChains.Count() == 1); + if (!PK_VERIFY(!m_ApiData.m_SwapChains.Empty())) + return false; + + // offscreen rendering does not have a view instance + if (m_CurrentView != null && !PK_VERIFY(MetalSetupLayer(m_ApiData.m_Device, m_CurrentView, ctxSize))) + return false; + + m_SwapChainRT = MetalCreateRenderTarget(m_ApiData.m_Device, ctxSize); + + if (m_SwapChainRT == null) + return false; + + m_ApiData.m_SwapChains.First().m_RenderTarget = m_SwapChainRT; + return true; +} + +//---------------------------------------------------------------------------- + +TMemoryView CMetalContext::GetCurrentSwapChain() +{ + return TMemoryView(m_SwapChainRT); +} + +//---------------------------------------------------------------------------- + +bool CMetalContext::CreateFinalBlitData(id device, SFinalBlit &finalBlit, RHI::EPixelFormat pxlFormat) +{ + // Create the shader functions: + NSString *vertexFunc = [[NSString alloc] initWithUTF8String:"vert_main"]; + NSString *fragFunc = [[NSString alloc] initWithUTF8String:"frag_main"]; + NSError *errorData = null; + dispatch_data_t binData = dispatch_data_create(MetalFinalBlitShader_metallib, MetalFinalBlitShader_metallib_len, dispatch_get_main_queue(), DISPATCH_DATA_DESTRUCTOR_DEFAULT); + + finalBlit.m_Library = [device newLibraryWithData:binData error:&errorData]; + + if (!PK_VERIFY(errorData == null)) + return false; + + finalBlit.m_VertexFunc = [finalBlit.m_Library newFunctionWithName:vertexFunc]; + finalBlit.m_FragmentFunc = [finalBlit.m_Library newFunctionWithName:fragFunc]; + + if (!PK_VERIFY(finalBlit.m_VertexFunc != null && finalBlit.m_FragmentFunc != null)) + return false; + + // Create the render pass descriptor for the final blit: + finalBlit.m_RenderPassDesc = [MTLRenderPassDescriptor renderPassDescriptor]; + finalBlit.m_RenderPassDesc.colorAttachments[0].loadAction = MTLLoadActionDontCare; + finalBlit.m_RenderPassDesc.colorAttachments[0].storeAction = MTLStoreActionStore; + + // Create the pipeline state: + MTLRenderPipelineDescriptor *pipelineStateDescriptor = [[MTLRenderPipelineDescriptor alloc] init]; + + if (!PK_VERIFY(pipelineStateDescriptor != nil)) + return false; + + pipelineStateDescriptor.label = @"Final blit pipeline state"; + pipelineStateDescriptor.supportIndirectCommandBuffers = NO; + pipelineStateDescriptor.vertexFunction = finalBlit.m_VertexFunc; + pipelineStateDescriptor.fragmentFunction = finalBlit.m_FragmentFunc; + pipelineStateDescriptor.colorAttachments[0].pixelFormat = RHI::MetalConversion::PopcornToMetalPixelFormat(pxlFormat); + + finalBlit.m_PipelineState = [device newRenderPipelineStateWithDescriptor:pipelineStateDescriptor error:&errorData]; + + if (!PK_VERIFY(errorData == null)) + return false; + + [finalBlit.m_RenderPassDesc retain]; + [finalBlit.m_Library retain]; + [finalBlit.m_VertexFunc retain]; + [finalBlit.m_FragmentFunc retain]; + [finalBlit.m_PipelineState retain]; + return true; +} + +//---------------------------------------------------------------------------- + +void CMetalContext::DestroyFinalBlitData(SFinalBlit &finalBlit) +{ + [finalBlit.m_RenderPassDesc autorelease]; + [finalBlit.m_Library autorelease]; + [finalBlit.m_VertexFunc autorelease]; + [finalBlit.m_FragmentFunc autorelease]; + [finalBlit.m_PipelineState autorelease]; +} + +//---------------------------------------------------------------------------- + +bool CMetalContext::EndFrame(id queue, + const TMemoryView &swapChains, + const SFinalBlit &finalBlit, + RHI::SWaitAllSwapChains *syncInfo, + bool isOffScreen, + const RHI::PRenderTarget renderTarget) +{ + PK_FOREACH(curSwap, swapChains) + { + id mtlRt = CastMetal(curSwap->m_RenderTarget)->MetalGetTexture(); + + // We create a command buffer for the final blit: + id cmdBuff = [queue commandBuffer]; + id drawable; + + if (curSwap->m_Layer != null) + { + drawable = [curSwap->m_Layer nextDrawable]; + finalBlit.m_RenderPassDesc.colorAttachments[0].texture = drawable.texture; + } + else + { + PK_ASSERT(renderTarget != null); + finalBlit.m_RenderPassDesc.colorAttachments[0].texture = CastMetal(renderTarget)->MetalGetTexture(); + } + + id encoder = [cmdBuff renderCommandEncoderWithDescriptor:finalBlit.m_RenderPassDesc]; + + [encoder setRenderPipelineState:finalBlit.m_PipelineState]; + + [encoder setFragmentTexture:mtlRt atIndex:0]; + + [encoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:6]; + + [encoder endEncoding]; + + if (curSwap->m_Layer != null && !isOffScreen) + { + [cmdBuff presentDrawable:drawable]; + } + else + { + id blitEncoder = [cmdBuff blitCommandEncoder]; + [blitEncoder synchronizeTexture:CastMetal(renderTarget)->MetalGetTexture() slice:0 level:0]; + [blitEncoder endEncoding]; + } + + // Notify the sync info that the present is finished: + [cmdBuff addCompletedHandler:^(id commandBuffer) + { + (void)commandBuffer; + PK_SCOPEDLOCK(syncInfo->m_SwapChainDoneCountLock); + ++syncInfo->m_SwapChainDoneCount; + if (syncInfo->m_SwapChainDoneCount == syncInfo->m_SwapChainToWait) + syncInfo->m_CondVar.NotifyAll(); + }]; + + [cmdBuff commit]; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CMetalContext::MetalCreateView(NSView *currentView, PKMetalView *&pkView, bool highDPI) +{ + MetalRemoveView(pkView); + pkView = [[PKMetalView alloc] initWithFrame:currentView.frame highDPI:highDPI]; + + if (!PK_VERIFY(pkView != nil)) + return false; + + [pkView retain]; + [currentView addSubview:pkView]; + return true; +} + +//---------------------------------------------------------------------------- + +void CMetalContext::MetalRemoveView(PKMetalView *&pkView) +{ + if (pkView != null) + { + [pkView removeFromSuperview]; + [pkView autorelease]; + } +} + +//---------------------------------------------------------------------------- + +bool CMetalContext::MetalSetupLayer( id device, + PKMetalView *&pkView, + const CUint2 &ctxSize, + RHI::EPixelFormat pxlFormat) +{ + CAMetalLayer *metalLayer = (CAMetalLayer*)pkView.layer; + + if (!PK_VERIFY(metalLayer != null)) + return false; + + metalLayer.device = device; + metalLayer.pixelFormat = RHI::MetalConversion::PopcornToMetalPixelFormat(pxlFormat); + metalLayer.framebufferOnly = true; + metalLayer.drawableSize = NSMakeSize(ctxSize.x(), ctxSize.y()); + return true; +} + +//---------------------------------------------------------------------------- + +RHI::PMetalRenderTarget CMetalContext::MetalCreateRenderTarget( id device, + const CUint2 &ctxSize, + RHI::EPixelFormat pxlFormat, + bool cpuAccessible) +{ + RHI::PMetalRenderTarget mtlRt = PK_NEW(RHI::CMetalRenderTarget(RHI::SRHIResourceInfos("Metal Context Render Target"), null)); + + if (!PK_VERIFY(mtlRt != null)) + return null; + if (!PK_VERIFY(mtlRt->MetalCreateRenderTarget( ctxSize, + pxlFormat, + true, + RHI::SampleCount1, + device, + cpuAccessible))) + return null; + return mtlRt; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif diff --git a/Samples/PK-SampleLib/ApiContext/Metal/MetalContextFactory.h b/Samples/PK-SampleLib/ApiContext/Metal/MetalContextFactory.h new file mode 100644 index 00000000..be7495c0 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/Metal/MetalContextFactory.h @@ -0,0 +1,21 @@ +#pragma once + +#if (PK_BUILD_WITH_METAL_SUPPORT != 0) + +__PK_RHI_API_BEGIN +PK_FORWARD_DECLARE_INTERFACE(ApiManager); +__PK_RHI_API_END + +__PK_SAMPLE_API_BEGIN + +PK_FORWARD_DECLARE_INTERFACE(ApiContext); + +namespace MetalFactory +{ + PApiContext CreateContext(); + RHI::PApiManager CreateApiManager(); +} + +__PK_SAMPLE_API_END + +#endif // PK_BUILD_WITH_METAL_SUPPORT diff --git a/Samples/PK-SampleLib/ApiContext/Metal/MetalContextFactory.mm b/Samples/PK-SampleLib/ApiContext/Metal/MetalContextFactory.mm new file mode 100644 index 00000000..36fe3b9a --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/Metal/MetalContextFactory.mm @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#if (PK_BUILD_WITH_METAL_SUPPORT != 0) + +#include "pk_rhi/include/metal/MetalApiManager.h" +#include "ApiContext/Metal/MetalContext.h" + +__PK_SAMPLE_API_BEGIN + +namespace MetalFactory +{ + PApiContext CreateContext() + { + return PK_NEW(CMetalContext); + } + + RHI::PApiManager CreateApiManager() + { + return PK_NEW(RHI::CMetalApiManager); + } +} + +__PK_SAMPLE_API_END + +#endif // PK_BUILD_WITH_METAL_SUPPORT diff --git a/Samples/PK-SampleLib/ApiContext/Metal/MetalFinalBlitShader.h b/Samples/PK-SampleLib/ApiContext/Metal/MetalFinalBlitShader.h new file mode 100644 index 00000000..e948a0a3 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/Metal/MetalFinalBlitShader.h @@ -0,0 +1,587 @@ +unsigned char MetalFinalBlitShader_metallib[] = { + 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x80, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x19, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x0a, 0x00, 0x76, 0x65, 0x72, 0x74, 0x5f, 0x6d, + 0x61, 0x69, 0x6e, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, + 0x41, 0x53, 0x48, 0x20, 0x00, 0x51, 0xfc, 0xc1, 0xbb, 0x34, 0x56, 0x22, + 0x20, 0x6c, 0x0a, 0x38, 0xee, 0x08, 0xf5, 0x52, 0x7e, 0x40, 0x3e, 0xd0, + 0x8b, 0xc5, 0xd5, 0x15, 0xd0, 0x1a, 0xcb, 0x01, 0xc0, 0xf3, 0x9b, 0xaf, + 0x9a, 0x4d, 0x44, 0x53, 0x5a, 0x08, 0x00, 0x70, 0x0d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, + 0x53, 0x08, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x45, + 0x4e, 0x44, 0x54, 0x7f, 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x0a, + 0x00, 0x66, 0x72, 0x61, 0x67, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x54, + 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, + 0xd6, 0xff, 0x2e, 0xeb, 0xc3, 0xff, 0x1a, 0x06, 0x42, 0x9a, 0x7b, 0x87, + 0x84, 0x9f, 0xe8, 0x01, 0x0f, 0xd1, 0x56, 0x0c, 0x28, 0x71, 0x50, 0xce, + 0xb5, 0x7a, 0xfa, 0x45, 0x73, 0xc0, 0x11, 0xbd, 0x4d, 0x44, 0x53, 0x5a, + 0x08, 0x00, 0x70, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0d, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x45, 0x4e, + 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, + 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, + 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, + 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x5c, 0x0d, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x35, 0x14, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x62, 0x0c, 0x30, 0x24, 0x80, 0x10, + 0x05, 0xc8, 0x14, 0x00, 0x00, 0x00, 0x21, 0x0c, 0x00, 0x00, 0x09, 0x03, + 0x00, 0x00, 0x0b, 0x02, 0x21, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, + 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, + 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, + 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, + 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, + 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0x04, 0x49, + 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, + 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x87, 0x00, + 0x00, 0x00, 0x1b, 0xc8, 0x25, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, + 0x00, 0x8a, 0x18, 0x87, 0x77, 0x90, 0x07, 0x79, 0x28, 0x87, 0x71, 0xa0, + 0x07, 0x76, 0xc8, 0x87, 0x36, 0x90, 0x87, 0x77, 0xa8, 0x07, 0x77, 0x20, + 0x87, 0x72, 0x20, 0x87, 0x36, 0x20, 0x87, 0x74, 0xb0, 0x87, 0x74, 0x20, + 0x87, 0x72, 0x68, 0x83, 0x79, 0x88, 0x07, 0x79, 0xa0, 0x87, 0x36, 0x30, + 0x07, 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0xc0, 0x1c, + 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1c, 0xd2, 0x61, 0x1e, + 0xc2, 0x41, 0x1c, 0xd8, 0xa1, 0x1c, 0xda, 0x80, 0x1e, 0xc2, 0x21, 0x1d, + 0xd8, 0xa1, 0x0d, 0xc6, 0x21, 0x1c, 0xd8, 0x81, 0x1d, 0xe6, 0x01, 0x30, + 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x80, 0x60, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x68, 0x03, 0x78, 0x90, 0x87, 0x72, 0x18, 0x87, 0x74, 0x98, + 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x76, 0x08, 0x07, 0x72, 0x00, + 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, + 0xda, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, + 0xde, 0x21, 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, + 0xd8, 0x21, 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, + 0x06, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, + 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, + 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, + 0x07, 0x77, 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, + 0x87, 0x77, 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, + 0x07, 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, + 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, + 0xea, 0xa1, 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, + 0xca, 0x61, 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, + 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, + 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, + 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, + 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, + 0x07, 0x80, 0x70, 0x87, 0x77, 0x68, 0x03, 0x7a, 0x90, 0x87, 0x70, 0x80, + 0x07, 0x78, 0x48, 0x07, 0x77, 0x38, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, + 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0x62, 0x1e, + 0xe8, 0x21, 0x1c, 0xc6, 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d, + 0xe8, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c, + 0xea, 0xc1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, + 0xf4, 0xa1, 0x1c, 0x00, 0x3c, 0x00, 0x88, 0x7a, 0x70, 0x87, 0x79, 0x08, + 0x07, 0x73, 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x83, 0x76, 0x08, + 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, + 0xea, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xe6, 0xe1, 0x1d, 0xcc, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xd8, 0xe1, 0x1d, 0xc2, 0x81, 0x1e, 0x00, 0x73, 0x08, + 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x36, 0x18, 0xc2, 0xff, 0xff, 0xff, + 0xff, 0x0f, 0x40, 0x1b, 0x00, 0xd2, 0x06, 0x62, 0x10, 0x80, 0x65, 0x03, + 0x41, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0x48, 0x1b, 0x88, 0x42, 0x00, + 0xce, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, + 0x60, 0x82, 0x20, 0x0c, 0x13, 0x04, 0xa2, 0x00, 0x00, 0x00, 0x89, 0x20, + 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, + 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, + 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x58, + 0x33, 0x00, 0xc3, 0x08, 0x02, 0x30, 0x8c, 0x40, 0x00, 0xb7, 0x49, 0x53, + 0x44, 0x09, 0x93, 0xcf, 0xbe, 0x44, 0x34, 0x11, 0x17, 0x4a, 0x4d, 0x0f, + 0x35, 0xf9, 0x0f, 0x20, 0x28, 0xc4, 0x80, 0x85, 0x20, 0xe6, 0x08, 0xc0, + 0xa0, 0x08, 0x83, 0x50, 0x19, 0x01, 0x98, 0x23, 0x00, 0x85, 0x39, 0x02, + 0x84, 0x52, 0x19, 0x0e, 0x52, 0xb4, 0x06, 0x02, 0x52, 0x80, 0xa4, 0x01, + 0xa1, 0x97, 0x04, 0x81, 0x22, 0x11, 0x0a, 0xc3, 0x08, 0x04, 0x01, 0x00, + 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, + 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, + 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, + 0x83, 0x3a, 0x70, 0x03, 0x38, 0xd8, 0x70, 0x1b, 0xe5, 0xd0, 0x06, 0xf0, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, + 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, + 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, + 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x11, 0xc2, 0x90, 0x49, 0x45, + 0x44, 0xd3, 0xcf, 0x00, 0x48, 0x33, 0x24, 0x02, 0x92, 0x02, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x86, 0x44, 0x89, 0xb5, + 0x00, 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, + 0xe8, 0xc3, 0x16, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x90, 0xd8, 0x20, 0x50, 0x74, 0x61, 0x00, 0x00, 0x20, 0x0b, 0x04, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, + 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x45, 0x50, + 0x02, 0x85, 0x30, 0x02, 0x40, 0x68, 0x04, 0x80, 0xdc, 0x58, 0x82, 0xf2, + 0x00, 0x00, 0xb1, 0x18, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x33, 0x08, + 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, + 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, + 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, + 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, + 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, + 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, + 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, + 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, + 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, + 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, + 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, + 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, + 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, + 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, + 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, + 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, + 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, + 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, + 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, + 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, + 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, + 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, + 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, + 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, + 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, + 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, + 0x0f, 0xf0, 0x50, 0x0e, 0x33, 0x1e, 0x6a, 0x1e, 0xca, 0x61, 0x1c, 0xe8, + 0x21, 0x1d, 0xde, 0xc1, 0x1d, 0x7e, 0x01, 0x1e, 0xe4, 0xa1, 0x1c, 0xcc, + 0x21, 0x1d, 0xf0, 0x61, 0x06, 0x54, 0x85, 0x83, 0x38, 0xcc, 0xc3, 0x3b, + 0xb0, 0x43, 0x3d, 0xd0, 0x43, 0x39, 0xfc, 0xc2, 0x3c, 0xe4, 0x43, 0x3b, + 0x88, 0xc3, 0x3b, 0xb0, 0xc3, 0x8c, 0xc5, 0x0a, 0x87, 0x79, 0x98, 0x87, + 0x77, 0x18, 0x87, 0x74, 0x08, 0x07, 0x7a, 0x28, 0x07, 0x72, 0x00, 0x00, + 0x00, 0x00, 0x79, 0x20, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0x62, 0x1e, + 0x48, 0x20, 0x43, 0x88, 0x0c, 0x19, 0x39, 0x19, 0x24, 0x90, 0x91, 0x40, + 0xc6, 0xc8, 0xc8, 0x68, 0x22, 0x50, 0x08, 0x14, 0x32, 0x9e, 0x18, 0x19, + 0x21, 0x47, 0xc8, 0x90, 0x51, 0xb4, 0xb0, 0xb5, 0x01, 0x00, 0x8b, 0xb2, + 0x06, 0xc5, 0xc6, 0x95, 0x41, 0x18, 0x90, 0xc1, 0x19, 0x44, 0x50, 0x64, + 0x30, 0x09, 0x63, 0x38, 0x0d, 0x81, 0x00, 0x00, 0x00, 0x00, 0x53, 0x44, + 0x4b, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x77, 0x63, 0x68, + 0x61, 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x65, + 0x20, 0x4c, 0x4c, 0x56, 0x4d, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x20, 0x39, 0x30, 0x32, 0x2e, 0x39, 0x20, 0x28, 0x6d, 0x65, 0x74, + 0x61, 0x6c, 0x66, 0x65, 0x2d, 0x39, 0x30, 0x32, 0x2e, 0x39, 0x2e, 0x36, + 0x34, 0x29, 0x4d, 0x65, 0x74, 0x61, 0x6c, 0x61, 0x69, 0x72, 0x2e, 0x63, + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x6e, 0x6f, 0x72, + 0x6d, 0x73, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x61, 0x69, + 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, + 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, + 0x65, 0x2e, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x62, 0x75, 0x66, 0x66, 0x65, + 0x72, 0x5f, 0x66, 0x65, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, + 0x6c, 0x65, 0x2e, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x6f, + 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, + 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, 0x6f, 0x6e, 0x67, 0x5f, + 0x6c, 0x6f, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, + 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x77, 0x69, 0x64, 0x65, 0x5f, + 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x5f, 0x64, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x75, 0x73, 0x65, 0x72, + 0x28, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x30, 0x29, + 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x61, + 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x54, + 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x73, 0x61, 0x69, 0x72, 0x2e, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x66, 0x6c, 0x6f, 0x61, + 0x74, 0x34, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x50, 0x6f, 0x73, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, + 0x65, 0x78, 0x5f, 0x69, 0x64, 0x75, 0x69, 0x6e, 0x74, 0x76, 0x65, 0x72, + 0x74, 0x65, 0x78, 0x49, 0x44, 0x00, 0x23, 0x08, 0xc4, 0x30, 0x82, 0xe0, + 0x20, 0x23, 0x08, 0x04, 0x31, 0x82, 0x40, 0x14, 0x23, 0x08, 0x84, 0x31, + 0x82, 0x60, 0x00, 0x33, 0x0c, 0x57, 0x80, 0xcd, 0x30, 0x64, 0x82, 0x36, + 0x43, 0x30, 0xcc, 0x30, 0x5c, 0xd7, 0x36, 0x03, 0x41, 0x5c, 0xd7, 0x36, + 0x43, 0x50, 0xcc, 0x10, 0x18, 0x33, 0x04, 0xc7, 0x0c, 0x01, 0x32, 0x43, + 0x90, 0xcc, 0x10, 0x28, 0x33, 0x18, 0x0b, 0xd3, 0x38, 0x0f, 0x34, 0x43, + 0x11, 0x35, 0xd2, 0x33, 0xcd, 0x20, 0xa0, 0x41, 0x1a, 0xcc, 0x60, 0x6c, + 0x54, 0x53, 0x3d, 0xd6, 0x0c, 0xc1, 0x1a, 0xcc, 0x30, 0x70, 0x6a, 0xc0, + 0x06, 0x32, 0x12, 0x98, 0xa0, 0x8c, 0xd8, 0xd8, 0xec, 0xda, 0x5c, 0xda, + 0xde, 0xc8, 0xea, 0xd8, 0xca, 0x5c, 0xcc, 0xd8, 0xc2, 0xce, 0xe6, 0x46, + 0x11, 0xb8, 0x2e, 0x15, 0x36, 0x36, 0xbb, 0x36, 0x97, 0x34, 0xb2, 0x32, + 0x37, 0xba, 0x51, 0x02, 0x2f, 0x97, 0xb0, 0x34, 0x39, 0x17, 0xbb, 0x32, + 0xb9, 0xb9, 0xb4, 0x37, 0xb7, 0x51, 0x82, 0x2f, 0xa9, 0xb0, 0x34, 0x39, + 0x17, 0xb6, 0x30, 0xb7, 0xb3, 0xba, 0xb0, 0xb3, 0xb2, 0x2f, 0xbb, 0x32, + 0xb9, 0xb9, 0xb4, 0x37, 0xb7, 0x51, 0x02, 0x30, 0xc8, 0x29, 0x2c, 0x4d, + 0xce, 0x65, 0xec, 0xad, 0x0d, 0x2e, 0x8d, 0xad, 0xec, 0xeb, 0x0d, 0x8e, + 0x2e, 0xed, 0xcd, 0x6d, 0x6e, 0x14, 0x23, 0x0c, 0xc4, 0x60, 0x0c, 0xc8, + 0xa0, 0x0c, 0xcc, 0x20, 0x95, 0xb0, 0x34, 0x39, 0x17, 0xbb, 0x32, 0x39, + 0xba, 0x32, 0xbc, 0x51, 0x02, 0x36, 0x00, 0x00, 0x00, 0x00, 0xa9, 0x18, + 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x72, 0x28, 0x87, 0x77, + 0x80, 0x07, 0x7a, 0x58, 0x70, 0x98, 0x43, 0x3d, 0xb8, 0xc3, 0x38, 0xb0, + 0x43, 0x39, 0xd0, 0xc3, 0x82, 0xe6, 0x1c, 0xc6, 0xa1, 0x0d, 0xe8, 0x41, + 0x1e, 0xc2, 0xc1, 0x1d, 0xe6, 0x21, 0x1d, 0xe8, 0x21, 0x1d, 0xde, 0xc1, + 0x1d, 0x00, 0xd1, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0xcc, + 0x3c, 0xa4, 0x83, 0x3b, 0x9c, 0x03, 0x3b, 0x94, 0x03, 0x3d, 0xa0, 0x83, + 0x3c, 0x94, 0x43, 0x38, 0x90, 0xc3, 0x01, 0x00, 0x00, 0x00, 0x61, 0x20, + 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, + 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x44, 0x66, 0x00, 0xca, 0x80, 0x50, + 0x01, 0x95, 0x40, 0x11, 0x94, 0x41, 0xc1, 0x14, 0x42, 0x29, 0x50, 0x9d, + 0x83, 0x30, 0x08, 0x45, 0x19, 0x8b, 0x00, 0x02, 0xe3, 0x20, 0x30, 0x03, + 0x30, 0x02, 0x30, 0x46, 0x00, 0x82, 0x20, 0x88, 0x7f, 0x14, 0xc6, 0x12, + 0x40, 0x10, 0x04, 0xf1, 0x0f, 0x04, 0x41, 0x10, 0xff, 0xc6, 0x12, 0x40, + 0x10, 0x04, 0xf1, 0x5f, 0x00, 0x41, 0x10, 0xc4, 0x7f, 0x61, 0x2c, 0x01, + 0x04, 0x41, 0x10, 0xff, 0x05, 0x10, 0x04, 0x41, 0xfc, 0x1b, 0x4b, 0x00, + 0x41, 0x10, 0xc4, 0x3f, 0x10, 0x04, 0x41, 0xfc, 0x17, 0x46, 0x00, 0xc6, + 0x12, 0x00, 0x10, 0x04, 0x41, 0xfc, 0x1b, 0x4b, 0x00, 0x41, 0x10, 0xc4, + 0x3f, 0x60, 0x06, 0x80, 0xc4, 0x1c, 0x44, 0x55, 0x59, 0x17, 0x8d, 0x19, + 0x00, 0x00, 0xf1, 0x30, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x22, 0x47, + 0xc8, 0x90, 0x51, 0x0e, 0x44, 0x19, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xf3, + 0x00, 0x00, 0x69, 0x6e, 0x74, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, + 0x65, 0x6e, 0x74, 0x20, 0x63, 0x68, 0x61, 0x72, 0x53, 0x69, 0x6d, 0x70, + 0x6c, 0x65, 0x20, 0x43, 0x2b, 0x2b, 0x20, 0x54, 0x42, 0x41, 0x41, 0x00, + 0x00, 0x00, 0x13, 0x04, 0xe4, 0xd8, 0x10, 0xc0, 0xc1, 0x86, 0xe1, 0x0d, + 0xe4, 0x20, 0x0e, 0x36, 0x0c, 0x6e, 0x30, 0x07, 0x71, 0xb0, 0x61, 0xa0, + 0x03, 0x3a, 0x88, 0x83, 0x0d, 0xc3, 0x1c, 0xcc, 0x41, 0x1c, 0x00, 0x00, + 0x00, 0x00, 0x33, 0x11, 0x0f, 0x41, 0x8c, 0xc2, 0x4c, 0x44, 0x44, 0x10, + 0xa4, 0x30, 0x13, 0x11, 0x11, 0x04, 0x29, 0xdc, 0xa0, 0x76, 0xc4, 0xc0, + 0x18, 0x40, 0x10, 0x0c, 0x16, 0x32, 0xb0, 0x82, 0xfd, 0x06, 0xe2, 0xfb, + 0x86, 0x0d, 0x88, 0x20, 0x0c, 0x06, 0x60, 0xbf, 0xa1, 0x00, 0x03, 0x6d, + 0xd8, 0x80, 0x08, 0xc8, 0x60, 0x00, 0xf6, 0x1b, 0x8c, 0x30, 0xd0, 0x86, + 0x0d, 0x88, 0xc0, 0x0c, 0x06, 0x60, 0xbf, 0xe1, 0x10, 0x03, 0x6d, 0xd8, + 0x80, 0x08, 0xcc, 0x60, 0x00, 0xf6, 0x1b, 0x90, 0x31, 0xc8, 0x86, 0x0d, + 0x88, 0x00, 0x0c, 0x06, 0x60, 0xbf, 0x21, 0x21, 0x83, 0x6c, 0xd8, 0x80, + 0x08, 0xd2, 0x60, 0x00, 0x2e, 0x51, 0x3b, 0x62, 0x60, 0x0c, 0x20, 0x08, + 0x06, 0xcb, 0x1a, 0x84, 0x41, 0xb0, 0xe3, 0xa0, 0x98, 0x81, 0x19, 0x0c, + 0x1b, 0x10, 0x41, 0x45, 0x00, 0x3b, 0x0e, 0xcb, 0x19, 0x84, 0xc1, 0xb0, + 0x01, 0x11, 0x54, 0x04, 0xb0, 0xe3, 0xc0, 0xa0, 0x41, 0x18, 0x0c, 0x1b, + 0x10, 0x41, 0x45, 0x00, 0x3b, 0x0e, 0x4d, 0x1a, 0x84, 0xc1, 0xb0, 0x01, + 0x11, 0x64, 0x04, 0x70, 0x8d, 0xda, 0x11, 0x03, 0x63, 0x00, 0x41, 0x30, + 0x58, 0xe0, 0xc0, 0x0c, 0x82, 0x1d, 0x07, 0x67, 0x0d, 0xd6, 0x60, 0xd8, + 0x80, 0x08, 0x2e, 0x02, 0xd8, 0x71, 0x78, 0xd8, 0xc0, 0x0c, 0x86, 0x0d, + 0x88, 0xe0, 0x22, 0x80, 0x1d, 0x07, 0xa8, 0x0d, 0xcc, 0x60, 0xd8, 0x80, + 0x08, 0x2e, 0x02, 0xd8, 0x71, 0x88, 0xdc, 0xc0, 0x0c, 0x86, 0x0d, 0x88, + 0xc0, 0x23, 0x80, 0x6b, 0x03, 0x14, 0xfb, 0x0d, 0x15, 0x1c, 0x04, 0x14, + 0x90, 0x71, 0x01, 0x8a, 0x1d, 0x07, 0x6b, 0x0e, 0x02, 0x0a, 0x02, 0xd9, + 0x71, 0xc8, 0xea, 0x60, 0xa0, 0x20, 0x90, 0x41, 0x86, 0xe0, 0x5b, 0x83, + 0x41, 0x86, 0xe0, 0x5b, 0x83, 0x11, 0x03, 0x63, 0x00, 0x41, 0x30, 0x58, + 0xfe, 0x80, 0x0e, 0x9e, 0x11, 0x03, 0x63, 0x00, 0x41, 0x30, 0x58, 0xfe, + 0x80, 0x0e, 0xa8, 0x11, 0x03, 0x63, 0x00, 0x41, 0x30, 0x58, 0xfe, 0x00, + 0x0e, 0xb6, 0xd9, 0x86, 0xaf, 0x00, 0x66, 0x1b, 0x02, 0x21, 0xc8, 0x20, + 0x20, 0x06, 0x16, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x23, 0xa0, 0x83, 0x2d, + 0x03, 0x12, 0xd0, 0xc1, 0x96, 0x41, 0x09, 0xe8, 0x60, 0xcb, 0xc0, 0x04, + 0x74, 0xb0, 0x65, 0x70, 0x02, 0x3a, 0xd8, 0x32, 0x40, 0x01, 0x1d, 0x6c, + 0x19, 0xa8, 0xa0, 0x0e, 0xb6, 0x0c, 0x56, 0x50, 0x07, 0x5b, 0x06, 0x2c, + 0xa8, 0x83, 0x2d, 0x83, 0x16, 0xd4, 0xc1, 0x96, 0xc1, 0x0b, 0xea, 0x60, + 0xcb, 0x00, 0x06, 0x41, 0x1d, 0x6c, 0x19, 0xc4, 0x20, 0xa8, 0x83, 0x2d, + 0x03, 0x19, 0x04, 0x75, 0xb0, 0x65, 0x38, 0x83, 0x80, 0x0e, 0xb6, 0x0c, + 0x6a, 0x10, 0xd4, 0xc1, 0x96, 0x81, 0x0d, 0x82, 0x3a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x32, 0x0e, + 0x10, 0x22, 0x84, 0x00, 0xee, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x12, 0x03, + 0x94, 0x38, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x24, + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x09, 0x00, + 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x08, 0x2c, + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1f, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x08, 0x2c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x0c, 0x00, 0x00, 0x19, 0x00, + 0x00, 0x00, 0x12, 0x03, 0x94, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x76, 0x65, + 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x6c, 0x76, 0x6d, 0x2e, + 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x65, 0x6e, 0x64, + 0x2e, 0x70, 0x30, 0x69, 0x38, 0x6c, 0x6c, 0x76, 0x6d, 0x2e, 0x6c, 0x69, + 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x2e, 0x70, 0x30, 0x69, 0x38, 0x39, 0x30, 0x32, 0x2e, 0x39, 0x2e, 0x36, + 0x34, 0x61, 0x69, 0x72, 0x36, 0x34, 0x2d, 0x61, 0x70, 0x70, 0x6c, 0x65, + 0x2d, 0x6d, 0x61, 0x63, 0x6f, 0x73, 0x78, 0x31, 0x30, 0x2e, 0x31, 0x35, + 0x2e, 0x30, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x50, 0x0c, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x35, 0x14, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x62, 0x0c, 0x30, 0x24, 0x80, 0x10, 0x05, 0xc8, 0x14, 0x00, + 0x00, 0x00, 0x21, 0x0c, 0x00, 0x00, 0xc6, 0x02, 0x00, 0x00, 0x0b, 0x02, + 0x21, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, + 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, + 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, + 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, + 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, + 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0x04, 0x49, 0x0e, 0x90, 0x91, 0x22, + 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, + 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x1b, 0xcc, + 0x25, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x01, 0x58, 0x03, 0x40, 0x02, 0x2a, + 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, + 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0x30, 0x87, + 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x80, 0x70, 0x87, 0x77, 0x68, 0x03, + 0x73, 0x90, 0x87, 0x70, 0x68, 0x87, 0x72, 0x68, 0x03, 0x78, 0x78, 0x87, + 0x74, 0x70, 0x07, 0x7a, 0x28, 0x07, 0x79, 0x68, 0x83, 0x72, 0x60, 0x87, + 0x74, 0x68, 0x07, 0x80, 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x18, 0xdc, + 0xe1, 0x1d, 0xda, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, + 0x00, 0x1e, 0xde, 0x21, 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, + 0xa0, 0x1c, 0xd8, 0x21, 0x1d, 0xda, 0xa1, 0x0d, 0xdc, 0xe1, 0x1d, 0xdc, + 0xa1, 0x0d, 0xd8, 0xa1, 0x1c, 0xc2, 0xc1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xd2, 0xc1, 0x1d, 0xcc, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, + 0x7a, 0x28, 0x07, 0x80, 0x70, 0x87, 0x77, 0x68, 0x03, 0x75, 0xa8, 0x87, + 0x76, 0x80, 0x87, 0x36, 0xa0, 0x87, 0x70, 0x10, 0x07, 0x76, 0x28, 0x87, + 0x79, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xdc, + 0xe1, 0x1d, 0xda, 0xc0, 0x1d, 0xc2, 0xc1, 0x1d, 0xe6, 0xa1, 0x0d, 0xcc, + 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x98, 0x87, + 0x74, 0x38, 0x07, 0x77, 0x28, 0x07, 0x72, 0x68, 0x03, 0x7d, 0x28, 0x07, + 0x79, 0x78, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, + 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, + 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe8, 0x41, 0x1e, 0xc2, 0x01, 0x1e, 0xe0, + 0x21, 0x1d, 0xdc, 0xe1, 0x1c, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, + 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, + 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, + 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, + 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, + 0x72, 0x00, 0xf0, 0x00, 0x20, 0xea, 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, + 0xa1, 0x1c, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, + 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, + 0x79, 0x28, 0x87, 0x36, 0x98, 0x87, 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, + 0x73, 0x60, 0x87, 0x77, 0x08, 0x07, 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, + 0x61, 0x1e, 0xca, 0x01, 0xd8, 0x60, 0x08, 0x03, 0xb0, 0x00, 0xd5, 0x06, + 0x65, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x01, 0x68, 0x03, 0x60, 0x0d, 0x00, + 0x09, 0xa8, 0x36, 0x18, 0x44, 0x00, 0x2c, 0x40, 0xb5, 0xc1, 0x28, 0x04, + 0x60, 0x01, 0x2a, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x13, 0x84, 0x40, 0x98, 0x30, 0x0c, 0x44, 0x01, 0x89, 0x20, + 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, + 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, + 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x58, + 0x73, 0x04, 0xa0, 0x30, 0x88, 0x00, 0x08, 0x33, 0x00, 0xc3, 0x08, 0x84, + 0x70, 0x96, 0x34, 0x45, 0x94, 0x30, 0xf9, 0xec, 0x17, 0x01, 0x06, 0x43, + 0x34, 0x13, 0x4a, 0x4d, 0x0f, 0x35, 0xa1, 0x60, 0x0c, 0x23, 0x08, 0xc2, + 0x51, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xff, 0x13, 0x71, 0x4d, 0x54, 0x44, + 0xfc, 0xf6, 0xf0, 0x4f, 0x63, 0x04, 0xc0, 0x20, 0x82, 0x11, 0x14, 0x82, + 0x94, 0x71, 0x08, 0xcd, 0x11, 0x20, 0x46, 0x18, 0xea, 0x22, 0x69, 0x8a, + 0x28, 0x61, 0xf2, 0x7f, 0x09, 0x60, 0x9e, 0x85, 0x88, 0xfe, 0x69, 0x8c, + 0x00, 0x18, 0x44, 0x60, 0x84, 0x39, 0x82, 0x60, 0x8e, 0x00, 0x0c, 0x86, + 0x11, 0x84, 0xa7, 0x28, 0xeb, 0xb4, 0xe2, 0xa0, 0x13, 0xe2, 0x51, 0x1c, + 0x08, 0x48, 0x81, 0x37, 0x02, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, + 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, + 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, + 0x80, 0x03, 0x37, 0x88, 0x83, 0x3a, 0x70, 0x03, 0x38, 0xd8, 0x70, 0x1b, + 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, + 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, + 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, + 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, + 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, + 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, + 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, + 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0xe0, 0x0e, + 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0xf4, + 0x80, 0x10, 0x21, 0x01, 0x64, 0xc8, 0x48, 0x91, 0x11, 0x40, 0x23, 0x84, + 0x61, 0x93, 0x22, 0x02, 0x8c, 0x9f, 0x01, 0x90, 0x86, 0x00, 0x13, 0x0b, + 0x31, 0x38, 0x24, 0x9a, 0x12, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x86, 0x44, 0xdc, 0x16, 0x01, 0x01, 0x20, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0xc4, 0x06, 0x81, 0xc2, 0xc8, + 0x02, 0x00, 0x00, 0x59, 0x20, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, + 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, + 0x43, 0x02, 0xf5, 0x6e, 0xdd, 0xfb, 0xff, 0xff, 0x0b, 0x48, 0xf8, 0x1f, + 0x40, 0xaf, 0x08, 0x4a, 0xa0, 0x10, 0x46, 0x00, 0x88, 0x8e, 0x25, 0x28, + 0x0f, 0x00, 0xb1, 0x18, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x33, 0x08, + 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, + 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, + 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, + 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, + 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, + 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, + 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, + 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, + 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, + 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, + 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, + 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, + 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, + 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, + 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, + 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, + 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, + 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, + 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, + 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, + 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, + 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, + 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, + 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, + 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, + 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, + 0x0f, 0xf0, 0x50, 0x0e, 0x33, 0x1e, 0x6a, 0x1e, 0xca, 0x61, 0x1c, 0xe8, + 0x21, 0x1d, 0xde, 0xc1, 0x1d, 0x7e, 0x01, 0x1e, 0xe4, 0xa1, 0x1c, 0xcc, + 0x21, 0x1d, 0xf0, 0x61, 0x06, 0x54, 0x85, 0x83, 0x38, 0xcc, 0xc3, 0x3b, + 0xb0, 0x43, 0x3d, 0xd0, 0x43, 0x39, 0xfc, 0xc2, 0x3c, 0xe4, 0x43, 0x3b, + 0x88, 0xc3, 0x3b, 0xb0, 0xc3, 0x8c, 0xc5, 0x0a, 0x87, 0x79, 0x98, 0x87, + 0x77, 0x18, 0x87, 0x74, 0x08, 0x07, 0x7a, 0x28, 0x07, 0x72, 0x00, 0x00, + 0x00, 0x00, 0x79, 0x20, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x62, 0x1e, + 0x48, 0x20, 0x43, 0x88, 0x0c, 0x19, 0x39, 0x19, 0x24, 0x90, 0x91, 0x40, + 0xc6, 0xc8, 0xc8, 0x68, 0x22, 0x50, 0x08, 0x14, 0x32, 0x9e, 0x18, 0x19, + 0x21, 0x47, 0xc8, 0x90, 0x51, 0xf4, 0xb8, 0x3c, 0x02, 0x00, 0x8b, 0xb2, + 0x06, 0xc5, 0xc6, 0x95, 0x41, 0x18, 0x90, 0xc1, 0x19, 0x44, 0x91, 0xc1, + 0x20, 0x12, 0xa4, 0x3c, 0x46, 0xc2, 0x48, 0xce, 0x22, 0x29, 0x98, 0x13, + 0x01, 0x00, 0x53, 0x44, 0x4b, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x77, 0x63, 0x68, 0x61, 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x41, + 0x70, 0x70, 0x6c, 0x65, 0x20, 0x4c, 0x4c, 0x56, 0x4d, 0x20, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x39, 0x30, 0x32, 0x2e, 0x39, 0x20, + 0x28, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x66, 0x65, 0x2d, 0x39, 0x30, 0x32, + 0x2e, 0x39, 0x2e, 0x36, 0x34, 0x29, 0x4d, 0x65, 0x74, 0x61, 0x6c, 0x61, + 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x64, + 0x65, 0x6e, 0x6f, 0x72, 0x6d, 0x73, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, + 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, + 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, + 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x62, + 0x75, 0x66, 0x66, 0x65, 0x72, 0x5f, 0x66, 0x65, 0x74, 0x63, 0x68, 0x5f, + 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x63, + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x6e, 0x61, 0x74, 0x69, 0x76, + 0x65, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, + 0x69, 0x6c, 0x65, 0x2e, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, + 0x6f, 0x6e, 0x67, 0x5f, 0x6c, 0x6f, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, + 0x69, 0x6c, 0x65, 0x2e, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x77, + 0x69, 0x64, 0x65, 0x5f, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x5f, + 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x72, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x61, + 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x66, + 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x75, 0x73, 0x65, 0x72, 0x28, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x30, 0x29, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x65, 0x6e, + 0x74, 0x65, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x65, 0x72, 0x73, 0x70, + 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, + 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x73, 0x61, 0x69, 0x72, + 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x69, 0x72, + 0x2e, 0x6e, 0x6f, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x70, 0x65, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x50, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x69, 0x72, 0x2e, 0x74, 0x65, 0x78, + 0x74, 0x75, 0x72, 0x65, 0x61, 0x69, 0x72, 0x2e, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x61, 0x69, + 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x78, 0x74, + 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x2c, + 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3e, 0x66, 0x69, 0x6e, 0x61, + 0x6c, 0x52, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x61, 0x69, + 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x06, 0x3e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x82, 0xf0, 0x10, 0x23, 0x08, 0x14, 0x32, 0x82, 0xf0, + 0x14, 0x23, 0x08, 0x8f, 0x31, 0x82, 0xf0, 0x1c, 0x23, 0x08, 0x49, 0x30, + 0x82, 0x10, 0x00, 0x33, 0x0c, 0x5f, 0x00, 0x06, 0x33, 0x0c, 0x61, 0x20, + 0x88, 0xc1, 0x0c, 0xc1, 0x30, 0xc3, 0xf0, 0x7d, 0x63, 0x30, 0x03, 0x41, + 0x7c, 0xdf, 0x18, 0xcc, 0x10, 0x14, 0x33, 0x04, 0xc6, 0x0c, 0xc1, 0x31, + 0x43, 0x80, 0xcc, 0x10, 0x24, 0x33, 0x04, 0xca, 0x0c, 0xc7, 0x32, 0x06, + 0x63, 0xc0, 0x34, 0xce, 0x33, 0x43, 0x10, 0x07, 0x33, 0x24, 0x63, 0x00, + 0x45, 0xd2, 0xc4, 0x50, 0x4e, 0x35, 0x03, 0x12, 0x06, 0x96, 0x74, 0x31, + 0x8d, 0x83, 0xcd, 0xa0, 0x7c, 0x99, 0x36, 0x06, 0x61, 0xb0, 0x31, 0x9c, + 0xd3, 0xcd, 0x30, 0xcc, 0x01, 0x1d, 0xd4, 0xc1, 0x0c, 0x03, 0x19, 0xc8, + 0x81, 0x1d, 0xcc, 0x20, 0x78, 0x65, 0x70, 0x1a, 0xc0, 0x71, 0x1c, 0xc7, + 0x71, 0x1c, 0x1a, 0xb8, 0x81, 0x85, 0x06, 0x6e, 0x60, 0x59, 0x96, 0x65, + 0x59, 0xa6, 0xc0, 0xb1, 0x82, 0x29, 0xe0, 0x02, 0x1d, 0xd0, 0x81, 0x8c, + 0x04, 0x26, 0x28, 0x23, 0x36, 0x36, 0xbb, 0x36, 0x97, 0xb6, 0x37, 0xb2, + 0x3a, 0xb6, 0x32, 0x17, 0x33, 0xb6, 0xb0, 0xb3, 0xb9, 0x51, 0x84, 0x32, + 0x30, 0x83, 0x54, 0xd8, 0xd8, 0xec, 0xda, 0x5c, 0xd2, 0xc8, 0xca, 0xdc, + 0xe8, 0x46, 0x09, 0xce, 0x20, 0x97, 0xb0, 0x34, 0x39, 0x17, 0xbb, 0x32, + 0xb9, 0xb9, 0xb4, 0x37, 0xb7, 0x51, 0x02, 0x34, 0x48, 0x2a, 0x2c, 0x4d, + 0xce, 0x85, 0x2d, 0xcc, 0xed, 0xac, 0x2e, 0xec, 0xac, 0xec, 0xcb, 0xae, + 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x6d, 0x94, 0x20, 0x0d, 0x72, 0x0a, 0x4b, + 0x93, 0x73, 0x19, 0x7b, 0x6b, 0x83, 0x4b, 0x63, 0x2b, 0xfb, 0x7a, 0x83, + 0xa3, 0x4b, 0x7b, 0x73, 0x9b, 0x1b, 0xc5, 0x50, 0x83, 0x35, 0x60, 0x83, + 0x36, 0x70, 0x83, 0x37, 0x48, 0x26, 0x2c, 0x4d, 0xce, 0xc5, 0x4c, 0x2e, + 0xec, 0xac, 0xad, 0xcc, 0x8d, 0x6e, 0x94, 0xc0, 0x0e, 0x52, 0x0a, 0x4b, + 0x93, 0x73, 0x99, 0x0b, 0x6b, 0x83, 0x63, 0x2b, 0x93, 0xfb, 0x9a, 0xa3, + 0x0b, 0xa3, 0x2b, 0x9b, 0x1b, 0x25, 0xb8, 0x03, 0x00, 0x00, 0xa9, 0x18, + 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x72, 0x28, 0x87, 0x77, + 0x80, 0x07, 0x7a, 0x58, 0x70, 0x98, 0x43, 0x3d, 0xb8, 0xc3, 0x38, 0xb0, + 0x43, 0x39, 0xd0, 0xc3, 0x82, 0xe6, 0x1c, 0xc6, 0xa1, 0x0d, 0xe8, 0x41, + 0x1e, 0xc2, 0xc1, 0x1d, 0xe6, 0x21, 0x1d, 0xe8, 0x21, 0x1d, 0xde, 0xc1, + 0x1d, 0x00, 0xd1, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0xcc, + 0x3c, 0xa4, 0x83, 0x3b, 0x9c, 0x03, 0x3b, 0x94, 0x03, 0x3d, 0xa0, 0x83, + 0x3c, 0x94, 0x43, 0x38, 0x90, 0xc3, 0x01, 0x00, 0x00, 0x00, 0x61, 0x20, + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xe4, 0x6a, 0x60, 0x04, 0x80, 0xe0, + 0x08, 0x00, 0x89, 0x11, 0x00, 0x22, 0x33, 0x00, 0xd4, 0x6c, 0x03, 0x00, + 0x00, 0x00, 0x23, 0x06, 0x8d, 0x10, 0x82, 0x60, 0x10, 0x41, 0x47, 0x90, + 0x18, 0x44, 0x31, 0x0c, 0xcb, 0x68, 0x42, 0x00, 0xcc, 0x36, 0x10, 0x01, + 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x32, 0x0e, 0x10, 0x22, 0x84, 0x01, 0xb7, 0x05, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x29, 0x00, + 0x00, 0x00, 0x12, 0x03, 0x94, 0x38, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x44, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x98, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x19, 0x00, + 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x58, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x09, 0x00, + 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0x00, 0x24, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1b, 0x00, + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0x08, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x0c, + 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x12, 0x03, 0x94, 0xb8, 0x00, 0x00, + 0x00, 0x00, 0x5f, 0x5f, 0x61, 0x69, 0x72, 0x5f, 0x73, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x72, 0x61, + 0x67, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x61, 0x69, 0x72, 0x2e, 0x73, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, + 0x5f, 0x32, 0x64, 0x2e, 0x76, 0x34, 0x66, 0x33, 0x32, 0x39, 0x30, 0x32, + 0x2e, 0x39, 0x2e, 0x36, 0x34, 0x61, 0x69, 0x72, 0x36, 0x34, 0x2d, 0x61, + 0x70, 0x70, 0x6c, 0x65, 0x2d, 0x6d, 0x61, 0x63, 0x6f, 0x73, 0x78, 0x31, + 0x30, 0x2e, 0x31, 0x35, 0x2e, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; +unsigned int MetalFinalBlitShader_metallib_len = 7006; diff --git a/Samples/PK-SampleLib/ApiContext/Metal/MetalFinalBlitShader.metal b/Samples/PK-SampleLib/ApiContext/Metal/MetalFinalBlitShader.metal new file mode 100644 index 00000000..cf573323 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/Metal/MetalFinalBlitShader.metal @@ -0,0 +1,52 @@ +#include +using namespace metal; + +struct SVertexOutput +{ + float2 TexCoords [[user(attribute0)]]; + float4 VertexPosition [[position]]; +}; + +vertex SVertexOutput vert_main(uint vertexID [[vertex_id]]) +{ + uint indices[6] = { + 0, 1, 2, + 1, 3, 2 + }; + float2 positions[4] = { + float2 (-1.0, -1.0), + float2 (-1.0, 1.0), + float2 (1.0, -1.0), + float2 (1.0, 1.0), + }; + float2 uvs[4] = { + float2 (0.0, 0.0), + float2 (0.0, 1.0), + float2 (1.0, 0.0), + float2 (1.0, 1.0), + }; + + SVertexOutput out; + + uint curIdx = indices[vertexID]; + + out.TexCoords = uvs[curIdx]; + out.VertexPosition = float4(positions[curIdx], 0, 1); + return out; +} + +struct SFragmentOutput +{ + float4 outColor [[color(0)]]; +}; + +fragment SFragmentOutput frag_main(SVertexOutput fInput [[stage_in]], texture2d finalRendering [[texture(0)]]) +{ + SFragmentOutput out; + constexpr sampler linearSampler ( mip_filter::linear, + mag_filter::linear, + min_filter::linear); + + out.outColor = finalRendering.sample(linearSampler, fInput.TexCoords); + return out; +} \ No newline at end of file diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/EGLContext.cpp b/Samples/PK-SampleLib/ApiContext/OpenGL/EGLContext.cpp new file mode 100644 index 00000000..b79dab56 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/EGLContext.cpp @@ -0,0 +1,250 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OPENGL_EGL != 0) + +#include "EGLContext.h" + +#include +#include + +#if (PK_BUILD_WITH_SDL != 0) +#include "WindowContext/SdlContext/SdlContext.h" +#include +#include +#endif + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +PK_DECLARE_REFPTRCLASS(SdlContext); +#endif + +namespace +{ + // Function handle error from native glxMakeCurrent + bool _MakeCurrent(EGLDisplay display, EGLSurface surface, EGLContext context) + { + bool err = (eglMakeCurrent(display, surface, surface, context) == EGL_TRUE); + return PK_VERIFY_MESSAGE(err, "GLX make current context failed"); + } +} + +//---------------------------------------------------------------------------- + +struct SEGLPlatformContext +{ + EGLDisplay m_DeviceHandle; + EGLSurface m_Surface; + EGLContext m_GLContext; + + SEGLPlatformContext() : m_DeviceHandle(0), m_Surface(0), m_GLContext(0) {} +}; + +//---------------------------------------------------------------------------- + +CEGLContext::CEGLContext() +: m_Context(PK_NEW(SEGLPlatformContext)) +{ +} + +//---------------------------------------------------------------------------- + +CEGLContext::~CEGLContext() +{ + if (m_Context->m_GLContext != null) + { + _MakeCurrent(m_Context->m_DeviceHandle, EGL_NO_SURFACE, EGL_NO_CONTEXT); + (void)PK_VERIFY_MESSAGE(eglDestroyContext(m_Context->m_DeviceHandle, m_Context->m_GLContext) == EGL_TRUE, "EGL destroy context failed"); + (void)PK_VERIFY_MESSAGE(eglTerminate(m_Context->m_DeviceHandle) == EGL_TRUE, "EGL terminate connection failed"); + } +} + +//---------------------------------------------------------------------------- + +void CEGLContext::SwapInterval(s32 interval) +{ + (void)PK_VERIFY_MESSAGE(eglSwapInterval(m_Context->m_DeviceHandle, interval) == EGL_TRUE, "EGL failed to set swap interval"); +} + +//---------------------------------------------------------------------------- + +bool CEGLContext::SwapBuffers() +{ + return eglSwapBuffers(m_Context->m_DeviceHandle, m_Context->m_Surface) == EGL_TRUE; +} + +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) + +namespace +{ + //---------------------------------------------------------------------------- + + static const EGLint kConfigAttribsListGL[] = + { + EGL_CONFORMANT, EGL_OPENGL_BIT, + EGL_RED_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_BUFFER_SIZE, 32, + EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER, + EGL_DEPTH_SIZE, 0, + EGL_STENCIL_SIZE, 0, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_NONE, + }; + + //---------------------------------------------------------------------------- + + static const EGLint kConfigAttribsListGLES[] = + { + EGL_CONFORMANT, EGL_OPENGL_BIT | EGL_OPENGL_ES3_BIT, + EGL_RED_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_BUFFER_SIZE, 32, + EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER, + EGL_DEPTH_SIZE, 0, + EGL_STENCIL_SIZE, 0, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_NONE, + }; + + //---------------------------------------------------------------------------- + + static const EGLint kSurfaceAttribsList[] = // FIXME(Julien): Not const? + { + EGL_RENDER_BUFFER, EGL_BACK_BUFFER, + EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_SRGB, + EGL_NONE, + }; + + //---------------------------------------------------------------------------- + + static const EGLint kContextAttribsGL[] = + { + EGL_CONTEXT_MAJOR_VERSION, 3, + EGL_CONTEXT_MINOR_VERSION, 3, +#if defined(PKSAMPLE_CONTEXT_CORE_ONLY) + EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT, +#else + EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT, +#endif +#if !defined(PK_LINUX) // not supported on all linux driver, need check on other platforms + EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE, EGL_TRUE, +# if defined(PK_DEBUG) + EGL_CONTEXT_OPENGL_DEBUG, EGL_TRUE, +# endif +#endif + EGL_NONE + }; + + //---------------------------------------------------------------------------- + + static const EGLint kContextAttribsGLES[] = + { + EGL_CONTEXT_MAJOR_VERSION, 3, + EGL_CONTEXT_MINOR_VERSION, 2, +//#if defined(PKSAMPLE_CONTEXT_CORE_ONLY) +// EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT, +//#else +// EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT, +//#endif +#if defined(PK_DEBUG) && !defined(PK_LINUX) // not supported on all linux driver, need check on other platforms + EGL_CONTEXT_OPENGL_DEBUG, EGL_TRUE, +#endif + EGL_NONE, + }; + +} + +//---------------------------------------------------------------------------- + +bool CEGLContext::GetContextFromSDLWindow(SDL_Window * window, CGLContext::GLApi targetApi) +{ + if (m_Context == null) + return false; + // Get Display + { + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + SDL_GetWindowWMInfo(window, &info); + + EGLNativeDisplayType nativeDisplay = EGL_DEFAULT_DISPLAY; + EGLNativeWindowType nativeWindow = 0; + +#if defined(SDL_VIDEO_DRIVER_X11) + if (info.subsystem == SDL_SYSWM_X11) + { + nativeDisplay = info.info.x11.display; + nativeWindow = info.info.x11.window; + } +#endif + PFNEGLGETDISPLAYPROC ___eglGetDisplay = (PFNEGLGETDISPLAYPROC) eglGetProcAddress("eglGetDisplay"); + m_Context->m_DeviceHandle = ___eglGetDisplay(nativeDisplay); + if (!PK_VERIFY_MESSAGE(m_Context->m_DeviceHandle != EGL_NO_DISPLAY, "EGL get display failed")) + return false; + + if (!PK_VERIFY_MESSAGE(eglewInit(m_Context->m_DeviceHandle) == GLEW_OK, "EGLew initialization failed")) + return false; + + EGLint v[2]; + if (!PK_VERIFY_MESSAGE(eglInitialize(m_Context->m_DeviceHandle, &v[0], &v[1]) == EGL_TRUE, "EGL initialize failed")) + return false; + + EGLConfig config; + EGLint numConfig; + if (!PK_VERIFY_MESSAGE(eglChooseConfig(m_Context->m_DeviceHandle, (targetApi == CGLContext::GL_OpenGLES) ? kConfigAttribsListGLES : kConfigAttribsListGL, &config, 1, &numConfig) == EGL_TRUE, "EGL choose config failed")) + return false; + + // Create surface + m_Context->m_Surface = eglCreateWindowSurface(m_Context->m_DeviceHandle, config, nativeWindow, kSurfaceAttribsList); + + // Explicit bind apidl + if (!PK_VERIFY_MESSAGE(eglBindAPI(targetApi == CGLContext::GL_OpenGLES ? EGL_OPENGL_ES_API : EGL_OPENGL_API) == EGL_TRUE, "EGL bind api failed")) + return false; + + // Create context + m_Context->m_GLContext = eglCreateContext(m_Context->m_DeviceHandle, config, EGL_NO_CONTEXT, targetApi == CGLContext::GL_OpenGLES ? kContextAttribsGLES : kContextGLAttribsGL); + // Make current + if (!PK_VERIFY_MESSAGE(m_Context->m_Surface != EGL_NO_SURFACE, "EGL surface creation failed") || + !PK_VERIFY_MESSAGE(m_Context->m_GLContext != EGL_NO_CONTEXT, "EGL context creation failed") || + !_MakeCurrent(m_Context->m_DeviceHandle, m_Context->m_Surface, m_Context->m_GLContext)) + return false; + } + + return true; +} + +#endif + +//---------------------------------------------------------------------------- + +bool CEGLContext::ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) +{ + (void)targetApi; (void)&sRGBCapable; + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OPENGL_WGL != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/EGLContext.h b/Samples/PK-SampleLib/ApiContext/OpenGL/EGLContext.h new file mode 100644 index 00000000..3b5a379e --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/EGLContext.h @@ -0,0 +1,51 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OPENGL_EGL != 0) + +#include "ApiContext/OpenGL/GLContext.h" +#include "WindowContext/AWindowContext.h" + +struct SDL_Window; + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SEGLPlatformContext; + +//---------------------------------------------------------------------------- + +class CEGLContext : public IGLContext +{ +public: + CEGLContext(); + ~CEGLContext(); + +#if (PK_BUILD_WITH_SDL != 0) + virtual bool GetContextFromSDLWindow(SDL_Window * window, CGLContext::GLApi targetApi) override; +#endif + virtual bool ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) override; + + virtual void SwapInterval(s32 interval) override; + virtual bool SwapBuffers() override; +private: + bool GetContextWithAttribs(CGLContext::GLApi targetApi); + + SEGLPlatformContext *m_Context; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OPENGL_EGL != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/GLContext.cpp b/Samples/PK-SampleLib/ApiContext/OpenGL/GLContext.cpp new file mode 100644 index 00000000..958d372a --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/GLContext.cpp @@ -0,0 +1,321 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OGL_SUPPORT != 0) + +#include "GLContext.h" +#include "WindowContext/SdlContext/SdlContext.h" + +#include "pk_rhi/include/Enums.h" +#include "pk_rhi/include/opengl/OpenGLRenderTarget.h" +#include "pk_rhi/include/opengl/OpenGLTexture.h" +#include "pk_rhi/include/opengl/OpenGLPopcornEnumConversion.h" +#include "pk_rhi/include/opengl/OpenGLShaderModule.h" +#include "pk_rhi/include/opengl/OpenGLShaderProgram.h" + +#include +#include + +#if (PK_BUILD_WITH_OPENGL_WGL != 0) +# include "ApiContext/OpenGL/WGLContext.h" +#elif (PK_BUILD_WITH_OPENGL_EGL != 0) +# include "ApiContext/OpenGL/EGLContext.h" +#elif (PK_BUILD_WITH_OPENGL_GLX != 0) +# include "ApiContext/OpenGL/GLXContext.h" +#elif (PK_BUILD_WITH_OPENGL_NSGL != 0) +# include "ApiContext/OpenGL/NSGLContext.h" +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +PK_DECLARE_REFPTRCLASS(SdlContext); +#endif + +CGLContext::CGLContext(GLApi requestApi) +: m_TargetApi(requestApi) +, m_SRGBCapable(true) +, m_WindowSize(0) +, m_PixelRatio(1.0f) +{ +#if (PK_BUILD_WITH_OPENGL_WGL != 0) + m_Interface = PK_NEW(CWGLContext); +#elif (PK_BUILD_WITH_OPENGL_EGL != 0) + m_Interface = PK_NEW(CEGLContext); +#elif (PK_BUILD_WITH_OPENGL_GLX != 0) + m_Interface = PK_NEW(CGLXContext); +#elif (PK_BUILD_WITH_OPENGL_NSGL != 0) + m_Interface = PK_NEW(CNSGLContext); +#else + m_Interface = null; +#endif +} + +//---------------------------------------------------------------------------- + +CGLContext::~CGLContext() +{ + glDeleteVertexArrays(1, &m_VAOID); + PK_DELETE(m_Interface); +} + +//---------------------------------------------------------------------------- + +bool CGLContext::InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) +{ + (void)debug; + if (m_Interface == null) + return false; + if (windowApi->GetContextApi() == PKSample::Context_Sdl) + { +#if (PK_BUILD_WITH_SDL != 0) + PSdlContext sdlWindowApi = static_cast(windowApi.Get()); + if (!m_Interface->GetContextFromSDLWindow(sdlWindowApi->SdlGetWindow(), m_TargetApi)) +#endif + return false; + } + else if (windowApi->GetContextApi() == PKSample::Context_Offscreen) + { + CLog::Log(PK_ERROR, "We do not support offscreen context for OpenGL. Please try with other graphics API."); + return false; + } + else + { + return false; + } +#if (PK_BUILD_WITH_SDL != 0) + m_ApiData.m_Api = m_TargetApi == GL_OpenGLES ? RHI::GApi_OES : RHI::GApi_OpenGL; + glewExperimental = GL_TRUE; + if (!PK_VERIFY_MESSAGE(glewInit() == GLEW_OK, "Glew initialization failed")) + return false; + // Get GL Version + { + int glVersion[2] = { -1,-1 }; + glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]); + glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]); + PK_ASSERT_MESSAGE(glVersion[1] < 10, "Error when getting opengl minor version"); + m_ApiData.m_Version = glVersion[0] + glVersion[1] * 0.1f; + } + + m_WindowSize = windowApi->GetWindowSize(); + m_PixelRatio = windowApi->GetPixelRatio(); + + m_ApiData.m_SwapChainsRenderTarget.PushBack(null); + if (!m_Interface->ChoosePixelFormatSRGB(m_TargetApi, m_SRGBCapable) || + !CreateSwapChain(m_WindowSize, m_SRGBCapable, m_RenderTexture, m_ApiData.m_SwapChainsRenderTarget[0], m_FrameBuffer) || + !CreateFlipShader(m_Program, m_SamplerLocation)) + return false; + glGenVertexArrays(1, &m_VAOID); + + // HINTS, check no needed + m_Interface->SwapInterval(0); + return true; +#endif // (PK_BUILD_WITH_SDL != 0) +} + +//---------------------------------------------------------------------------- + +bool CGLContext::WaitAllRenderFinished() +{ + glFinish(); + return true; +} + +//---------------------------------------------------------------------------- + +CGuid CGLContext::BeginFrame() +{ + return 0; +} + +//---------------------------------------------------------------------------- + +bool CGLContext::EndFrame(void *renderToWait) +{ + (void)renderToWait; + CGLContext::EndFrame(m_VAOID, m_ApiData.m_SwapChainsRenderTarget[0], m_RenderTexture, m_Program, m_SamplerLocation, m_WindowSize * m_PixelRatio); + + return m_Interface->SwapBuffers(); +} + +//---------------------------------------------------------------------------- + +RHI::SApiContext *CGLContext::GetRenderApiContext() +{ + return &m_ApiData; +} + +//---------------------------------------------------------------------------- + +bool CGLContext::RecreateSwapChain(const CUint2 &ctxSize) +{ + PK_ASSERT(m_ApiData.m_SwapChainsRenderTarget.Count() == 1); + if (!PK_VERIFY(!m_ApiData.m_SwapChainsRenderTarget.Empty())) + return false; + PK_ASSERT(m_Interface != null); + m_WindowSize = ctxSize / m_PixelRatio; + m_Interface->OnSwapchainUpdate(); + return CreateSwapChain(ctxSize / m_PixelRatio, m_SRGBCapable, m_RenderTexture, m_ApiData.m_SwapChainsRenderTarget[0], m_FrameBuffer); +} + +//---------------------------------------------------------------------------- + +TMemoryView CGLContext::GetCurrentSwapChain() +{ + return TMemoryView(TMemoryView(&m_ApiData.m_SwapChainsRenderTarget[0], 1)); +} + +//---------------------------------------------------------------------------- + +bool CGLContext::CreateSwapChain(const CUint2 &size, + bool scRGBCapable, + RHI::POpenGLTexture &scRenderTexture, + RHI::POpenGLRenderTarget &scRenderTarget, + CGuid &scFrameBuffer) +{ + if (scRGBCapable) + glEnable(GL_FRAMEBUFFER_SRGB); + + scRenderTexture = PK_NEW(RHI::COpenGLTexture(RHI::SRHIResourceInfos("GLContext Swap Chain"))); + if (scRenderTexture == null) + return false; + + const RHI::EPixelFormat format = scRGBCapable ? RHI::FormatSrgb8BGRA : RHI::FormatUnorm8BGRA; + const CUint3 size3 = size.xy1(); + + scRenderTexture->OpenGLInitTexture(format, RHI::OpenGLConversion::PopcornToOpenGLPixelFormat(format), RHI::Texture2D, size3, 1, RHI::SampleCount1); + + scRenderTarget = PK_NEW(RHI::COpenGLRenderTarget(RHI::SRHIResourceInfos("GLContext Render Target"))); + if (scRenderTarget == null) + return false; + + scRenderTarget->OpenGLSetRenderTexture(scRenderTexture, size3, format, RHI::SampleCount1); + + if (scFrameBuffer.Valid()) + glDeleteFramebuffers(1, &scFrameBuffer.Get()); + + GLuint frameBuffer = 0; + glGenFramebuffers(1, &frameBuffer); + glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBuffer); + scRenderTarget->OpenGLAttachToFrameBuffer(GL_COLOR_ATTACHMENT0, GL_READ_FRAMEBUFFER); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + scFrameBuffer = frameBuffer; + return true; +} + +//---------------------------------------------------------------------------- + +bool CGLContext::CreateFlipShader(RHI::POpenGLShaderProgram &blitShaderProgram, s32 &samplerLocation) +{ + const char *kVertexCode = +#if defined(PK_ANDROID) + "#version 310 es\n" +#else + "#version 330\n" +#endif + "#extension GL_ARB_separate_shader_objects : enable\n" + "layout(location = 0) out vec2 texCoords;" + "vec2 positions[3] = vec2[](" + "vec2(-1., -1.)," + "vec2( 3., -1.)," + "vec2(-1., 3.)" + ");" + "vec2 uvs[3] = vec2[](" + "vec2(0., 1.)," + "vec2(2., 1.)," + "vec2(0., -1.)" + ");" + "void main()" + "{" + "gl_Position = vec4(positions[gl_VertexID], 0.0, 1.0);" + "texCoords = uvs[gl_VertexID];" + "}"; + const char *kFragCode = +#if defined(PK_ANDROID) + "#version 310 es\n" +#else + "#version 330\n" +#endif + "#extension GL_ARB_separate_shader_objects : enable\n" + "precision highp float;\n" + "layout(location = 0) in vec2 texCoords;" + "/*layout(binding = 1)*/ uniform sampler2D texSampler;" + "layout(location = 0) out vec4 outColor;" + "void main()" + "{" + "outColor = texture(texSampler, texCoords);" + "}"; + + RHI::POpenGLShaderModule vertex = PK_NEW(RHI::COpenGLShaderModule(RHI::SRHIResourceInfos("PK-RHI Flip vertex shader"))); + RHI::POpenGLShaderModule frag = PK_NEW(RHI::COpenGLShaderModule(RHI::SRHIResourceInfos("PK-RHI Flip fragment shader"))); + + blitShaderProgram = PK_NEW(RHI::COpenGLShaderProgram(RHI::SRHIResourceInfos("PK-RHI Flip shader program"))); + + if (vertex == null || frag == null || blitShaderProgram == null) + return false; + + if (!vertex->CompileFromCode(kVertexCode, static_cast(strlen(kVertexCode)), RHI::VertexShaderStage) || + !frag->CompileFromCode(kFragCode, static_cast(strlen(kFragCode)), RHI::FragmentShaderStage) || + !blitShaderProgram->CreateFromShaderModules(vertex, null, frag)) + return false; + + samplerLocation = blitShaderProgram->OpenGLGetUniformLocation("texSampler"); + + return true; +} + +//---------------------------------------------------------------------------- + +void CGLContext::EndFrame(u32 vaoID, const RHI::POpenGLRenderTarget &fbo, const RHI::POpenGLTexture &renderTexture, const RHI::POpenGLShaderProgram &flipProgram, s32 samplerLocation, CUint2 backBufferSize) +{ + (void)fbo; + glBindVertexArray(vaoID); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + GLenum drawBuff = GL_BACK; + glDrawBuffers(1, &drawBuff); + + glEnable(GL_SCISSOR_TEST); + glScissor(0, 0, backBufferSize.x(), backBufferSize.y()); + glViewport(0, 0, backBufferSize.x(), backBufferSize.y()); + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_STENCIL_TEST); + glDisable(GL_BLEND); + + flipProgram->OpenGLUseProgram(); + + glBindSampler(0, 0); + + glActiveTexture(GL_TEXTURE0 + samplerLocation); + renderTexture->OpenGLBindTexture(); + + glDrawArrays(GL_TRIANGLES, 0, 3); +} + +//---------------------------------------------------------------------------- + +void CGLContext::CopyBackbufferToTexture(const RHI::POpenGLTexture &texture, const CUint2 &size) +{ + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glReadBuffer(GL_BACK); + glActiveTexture(GL_TEXTURE0); + texture->OpenGLBindTexture(); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, size.x(), size.y()); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OGL_SUPPORT != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/GLContext.h b/Samples/PK-SampleLib/ApiContext/OpenGL/GLContext.h new file mode 100644 index 00000000..10ddbeef --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/GLContext.h @@ -0,0 +1,104 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/ApiContextConfig.h" + +#if (PK_BUILD_WITH_OGL_SUPPORT != 0) + +#include +#include "PK-SampleLib/ApiContext/IApiContext.h" +#include "PK-SampleLib/WindowContext/AWindowContext.h" + +//#define PKSAMPLE_CONTEXT_CORE_ONLY + +PK_FORWARD_DECLARE(OpenGLShaderProgram); + +struct SDL_Window; + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class IGLContext; + +//---------------------------------------------------------------------------- + +class CGLContext : public IApiContext +{ +public: + enum GLApi + { + GL_OpenGL, + GL_OpenGLES, + }; + +public: + CGLContext(GLApi api); + ~CGLContext(); + + virtual bool InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) override; + virtual bool WaitAllRenderFinished() override; + virtual CGuid BeginFrame() override; + virtual bool EndFrame(void *renderToWait) override; + virtual RHI::SApiContext *GetRenderApiContext() override; + virtual bool RecreateSwapChain(const CUint2 &ctxSize) override; + virtual TMemoryView GetCurrentSwapChain() override; + + static bool CreateSwapChain(const CUint2 &size, + bool scRGBCapable, + RHI::POpenGLTexture &scRenderTexture, + RHI::POpenGLRenderTarget &scRenderTarget, + CGuid &scFrameBuffer); + static bool CreateFlipShader(RHI::POpenGLShaderProgram &blitShaderProgram, s32 &samplerLocation); + static void EndFrame(u32 vaoID, const RHI::POpenGLRenderTarget &fbo, const RHI::POpenGLTexture &renderTexture, const RHI::POpenGLShaderProgram &flipProgram, s32 samplerLocation, CUint2 backBufferSize); + static void CopyBackbufferToTexture(const RHI::POpenGLTexture &renderTexture, const CUint2 &size); + +protected: + // Default + GLuint m_VAOID; + + GLApi m_TargetApi; + bool m_SRGBCapable; + IGLContext *m_Interface; + CGuid m_FrameBuffer; + RHI::POpenGLTexture m_RenderTexture; + RHI::POpenGLShaderProgram m_Program; + s32 m_SamplerLocation; + + //This struct is the actual data that is shared between the Api context and the Api manager + RHI::SOpenGLBasicContext m_ApiData; + + CUint2 m_WindowSize; + float m_PixelRatio; +}; + +//---------------------------------------------------------------------------- + +class IGLContext +{ +public: + virtual~IGLContext() {} + +#if (PK_BUILD_WITH_SDL != 0) + virtual bool GetContextFromSDLWindow(SDL_Window *window, CGLContext::GLApi targetApi) = 0; +#endif + virtual bool ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) = 0; + + virtual void SwapInterval(s32 interval) = 0; + virtual bool SwapBuffers() = 0; + + virtual void OnSwapchainUpdate() {} +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OGL_SUPPORT != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/GLXContext.cpp b/Samples/PK-SampleLib/ApiContext/OpenGL/GLXContext.cpp new file mode 100644 index 00000000..a21358dc --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/GLXContext.cpp @@ -0,0 +1,234 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OPENGL_GLX != 0) + +#include "GLXContext.h" + +#include +#include + +#if (PK_BUILD_WITH_SDL != 0) +#include "WindowContext/SdlContext/SdlContext.h" +#include +#include +#endif + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +PK_DECLARE_REFPTRCLASS(SdlContext); +#endif + +namespace +{ + // Function handle error from native glxMakeCurrent + bool _MakeCurrent(Display *dc, GLXDrawable drawable, GLXContext glc) + { + bool err = (glXMakeCurrent(dc, drawable, glc) == True); + return PK_VERIFY_MESSAGE(err, "GLX make current context failed"); + } +} + +//---------------------------------------------------------------------------- + +struct SGLXPlatformContext +{ + Display *m_DeviceHandle; + GLXDrawable m_Drawable; + GLXContext m_GLContext; + + SGLXPlatformContext() : m_DeviceHandle(0), m_Drawable(0), m_GLContext(0) {} +}; + +//---------------------------------------------------------------------------- + +CGLXContext::CGLXContext() +{ + m_Context = PK_NEW(SGLXPlatformContext); +} + +//---------------------------------------------------------------------------- + +CGLXContext::~CGLXContext() +{ + if (m_Context->m_GLContext != null) + { + glXDestroyContext(m_Context->m_DeviceHandle, m_Context->m_GLContext); + _MakeCurrent(m_Context->m_DeviceHandle, 0, 0); + } + PK_SAFE_DELETE(m_Context); +} + +//---------------------------------------------------------------------------- + +void CGLXContext::SwapInterval(s32 interval) +{ + (void)interval; + glXSwapIntervalEXT(m_Context->m_DeviceHandle, m_Context->m_Drawable, 0); +} + +//---------------------------------------------------------------------------- + +bool CGLXContext::SwapBuffers() +{ + glXSwapBuffers(m_Context->m_DeviceHandle, m_Context->m_Drawable); + return true; +} + +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +bool CGLXContext::GetContextFromSDLWindow(SDL_Window *window, CGLContext::GLApi targetApi) +{ + if (m_Context == null) + return false; + // Get context from HDC + { + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + SDL_GetWindowWMInfo(window, &info); + m_Context->m_DeviceHandle = info.info.x11.display; + m_Context->m_Drawable = info.info.x11.window; + + XVisualInfo visualInfo; + if (!PK_VERIFY_MESSAGE( XMatchVisualInfo(m_Context->m_DeviceHandle, DefaultScreen(m_Context->m_DeviceHandle), 24, TrueColor, &visualInfo) != 0 , "Match XVisualInfo failed")) + return false; + // Create default context + m_Context->m_GLContext = glXCreateContext(m_Context->m_DeviceHandle, &visualInfo, NULL, True); + // Make current + if (!PK_VERIFY_MESSAGE(m_Context->m_GLContext != 0, "GLX context creation failed") || + !_MakeCurrent(m_Context->m_DeviceHandle, m_Context->m_Drawable, m_Context->m_GLContext)) + return false; + } + + if (!PK_VERIFY_MESSAGE(glxewInit() == GLEW_OK, "GLXew initialization failed")) + return false; + return GetContextWithAttribs(targetApi); +} +#endif + +//---------------------------------------------------------------------------- + +namespace +{ + static const int kAttribListGL[] = + { + GLX_CONTEXT_MAJOR_VERSION_ARB, 3, + GLX_CONTEXT_MINOR_VERSION_ARB, 3, +#if defined(PKSAMPLE_CONTEXT_CORE_ONLY) + GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, +#else + GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, +#endif +#if defined(PK_DEBUG) + GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, +#else + GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, +#endif + 0, + }; + + //---------------------------------------------------------------------------- + + static const int kAttribListGLES[] = + { + GLX_CONTEXT_MAJOR_VERSION_ARB, 2, + GLX_CONTEXT_MINOR_VERSION_ARB, 0, + GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT, +#if defined(PK_DEBUG) + GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB, +#endif + 0, + }; + + //---------------------------------------------------------------------------- + + static const int kVisualAttribs[] = + { + GLX_X_RENDERABLE, True, + GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, + GLX_RENDER_TYPE, GLX_RGBA_BIT, + GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_ALPHA_SIZE, 8, + GLX_DEPTH_SIZE, 24, + GLX_STENCIL_SIZE, 8, + GLX_DOUBLEBUFFER, True, + //GLX_SAMPLE_BUFFERS, 1, + //GLX_SAMPLES, 4, + None + }; +} + +//---------------------------------------------------------------------------- + +// Create new context with OpenGL ES profile +bool CGLXContext::GetContextWithAttribs(CGLContext::GLApi targetApi) +{ + const int *attribList = kAttribListGL; + if (targetApi == CGLContext::GL_OpenGLES) + { + // Check first the support of extensions + const bool support = glxewIsSupported("GLX_ARB_create_context") && + glxewIsSupported("GLX_EXT_create_context_es2_profile"); + if (!PK_VERIFY_MESSAGE(support, "GLX extensions for ES profile is not supported.")) + return false; + attribList = kAttribListGLES; + } + + // Create with extended creation function with attributes + { + // Get a matching FB config + int fbcount; + GLXFBConfig *fbc = glXChooseFBConfig(m_Context->m_DeviceHandle, DefaultScreen(m_Context->m_DeviceHandle), kVisualAttribs, &fbcount); + if (!PK_VERIFY(fbc != null)) + return false; + + GLXContext newContext = glXCreateContextAttribsARB(m_Context->m_DeviceHandle, fbc[0], 0, True, attribList); + + XFree(fbc); + fbc = null; + + if (!PK_VERIFY_MESSAGE(newContext != 0, "Context creation with attribs failed")) + return false; + + // Make current the new one, avoid error with old one at deletion + if (!_MakeCurrent(m_Context->m_DeviceHandle, m_Context->m_Drawable, m_Context->m_GLContext)) + return false; + + glXDestroyContext(m_Context->m_DeviceHandle, m_Context->m_GLContext); + m_Context->m_GLContext = newContext; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CGLXContext::ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) +{ + (void)targetApi; + sRGBCapable = true; + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OPENGL_WGL != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/GLXContext.h b/Samples/PK-SampleLib/ApiContext/OpenGL/GLXContext.h new file mode 100644 index 00000000..a82f7d20 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/GLXContext.h @@ -0,0 +1,51 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OPENGL_GLX != 0) + +#include "ApiContext/OpenGL/GLContext.h" +#include "WindowContext/AWindowContext.h" + +struct SDL_Window; + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SGLXPlatformContext; + +//---------------------------------------------------------------------------- + +class CGLXContext : public IGLContext +{ +public: + CGLXContext(); + ~CGLXContext(); + +#if (PK_BUILD_WITH_SDL != 0) + virtual bool GetContextFromSDLWindow(SDL_Window *window, CGLContext::GLApi targetApi) override; +#endif + virtual bool ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) override; + + virtual void SwapInterval(s32 interval) override; + virtual bool SwapBuffers() override; +private: + bool GetContextWithAttribs(CGLContext::GLApi targetApi); + + SGLXPlatformContext *m_Context; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OPENGL_GLX != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/NSGLContext.h b/Samples/PK-SampleLib/ApiContext/OpenGL/NSGLContext.h new file mode 100644 index 00000000..75768d61 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/NSGLContext.h @@ -0,0 +1,51 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OPENGL_NSGL != 0) + +#include "ApiContext/OpenGL/GLContext.h" +#include "WindowContext/AWindowContext.h" + +struct SDL_Window; + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SNSGLPlatformContext; + +//---------------------------------------------------------------------------- + +class CNSGLContext : public IGLContext +{ +public: + CNSGLContext(); + ~CNSGLContext(); + +#if (PK_BUILD_WITH_SDL != 0) + virtual bool GetContextFromSDLWindow(SDL_Window *window, CGLContext::GLApi targetApi) override; +#endif + virtual bool ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) override; + + virtual void SwapInterval(s32 interval) override; + virtual bool SwapBuffers() override; + + virtual void OnSwapchainUpdate() override; + + SNSGLPlatformContext *m_Context; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OPENGL_NSGL != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/NSGLContext.mm b/Samples/PK-SampleLib/ApiContext/OpenGL/NSGLContext.mm new file mode 100644 index 00000000..0cb0657c --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/NSGLContext.mm @@ -0,0 +1,135 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OPENGL_NSGL != 0) + +// The new MacOS versions declare OpenGL context as deprecated, this define just remove the compilation warnings: +#define GL_SILENCE_DEPRECATION + +#include "NSGLContext.h" + +#if (PK_BUILD_WITH_SDL != 0) +#include "WindowContext/SdlContext/SdlContext.h" +#include +#include +#endif + +#include + +#import + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +PK_DECLARE_REFPTRCLASS(SdlContext); +#endif + +//---------------------------------------------------------------------------- + +struct SNSGLPlatformContext +{ + NSOpenGLContext *m_GLContext; + NSWindow *m_NSWindow; + + SNSGLPlatformContext() : m_GLContext(null), m_NSWindow(null) {} +}; + +//---------------------------------------------------------------------------- + +CNSGLContext::CNSGLContext() +{ + m_Context = PK_NEW(SNSGLPlatformContext); +} + +//---------------------------------------------------------------------------- + +CNSGLContext::~CNSGLContext() +{ + PK_SAFE_DELETE(m_Context); +} + +//---------------------------------------------------------------------------- + +void CNSGLContext::SwapInterval(s32 interval) +{ + (void)interval; +} + +//---------------------------------------------------------------------------- + +bool CNSGLContext::SwapBuffers() +{ + glFlush(); + [m_Context->m_GLContext flushBuffer]; + return true; +} + +//---------------------------------------------------------------------------- + +static NSOpenGLPixelFormatAttribute glAttributes[] = +{ + NSOpenGLPFAAccelerated, + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFAAlphaSize, 8, + 0 +}; + +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +bool CNSGLContext::GetContextFromSDLWindow(SDL_Window *window, CGLContext::GLApi targetApi) +{ + (void)targetApi; + if (m_Context == null) + return false; + + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + SDL_GetWindowWMInfo(window, &info); + m_Context->m_NSWindow = info.info.cocoa.window; + + NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:glAttributes]; + if (!PK_VERIFY_MESSAGE(pixelFormat != nil, "NSOpenGLPixelFormat init failed")) + return false; + m_Context->m_GLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil]; + if (!PK_VERIFY_MESSAGE(m_Context->m_GLContext != nil, "NSOpenGLContext init failed")) + return false; + [m_Context->m_GLContext setView:[m_Context->m_NSWindow contentView]]; + [m_Context->m_GLContext makeCurrentContext]; + return true; +} +#endif + +//---------------------------------------------------------------------------- + +bool CNSGLContext::ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) +{ + (void)targetApi; + sRGBCapable = true; + return true; +} + +//---------------------------------------------------------------------------- + +void CNSGLContext::OnSwapchainUpdate() +{ + [m_Context->m_GLContext update]; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OPENGL_NSGL != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/WGLContext.cpp b/Samples/PK-SampleLib/ApiContext/OpenGL/WGLContext.cpp new file mode 100644 index 00000000..ae152767 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/WGLContext.cpp @@ -0,0 +1,246 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + + +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OPENGL_WGL != 0) + +#undef NOGDI +#undef NOCTLMGR +#pragma warning(push) +#pragma warning(disable : 4668) // C4668 (level 4) 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' +#include +#pragma warning(pop) +#include + +#include "precompiled.h" +#include "WGLContext.h" + +#include "WindowContext/SdlContext/SdlContext.h" +#if (PK_BUILD_WITH_SDL != 0) +# if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpragma-pack" +# endif // defined(PK_COMPILER_CLANG_CL) +# include +# if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic pop +# endif // defined(PK_COMPILER_CLANG_CL) +#endif // (PK_BUILD_WITH_SDL != 0) + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +PK_DECLARE_REFPTRCLASS(SdlContext); +#endif + +namespace +{ + // Function handle error from native wglMakeCurrent + bool _MakeCurrent(HDC dc, HGLRC glc) + { + bool err = (wglMakeCurrent(dc, glc) == TRUE); + return PK_VERIFY_MESSAGE(err, "WGL make current context failed"); + } +} + +//---------------------------------------------------------------------------- + +struct SWGLPlatformContext +{ + HDC m_DeviceHandle; + HGLRC m_GLContext; + PIXELFORMATDESCRIPTOR m_PixelFormatDescriptor; + + SWGLPlatformContext() : m_DeviceHandle(0), m_GLContext(0) { Mem::Clear(m_PixelFormatDescriptor); } +}; + +//---------------------------------------------------------------------------- + +CWGLContext::CWGLContext() +{ + m_Context = PK_NEW(SWGLPlatformContext); +} + +//---------------------------------------------------------------------------- + +CWGLContext::~CWGLContext() +{ + if (m_Context->m_GLContext != null) + { + _MakeCurrent(NULL, NULL); + wglDeleteContext(m_Context->m_GLContext); + } + PK_SAFE_DELETE(m_Context); +} + +//---------------------------------------------------------------------------- + +void CWGLContext::SwapInterval(s32 interval) +{ + wglSwapIntervalEXT(interval); +} + +//---------------------------------------------------------------------------- + +bool CWGLContext::SwapBuffers() +{ + return wglSwapLayerBuffers(m_Context->m_DeviceHandle, WGL_SWAP_MAIN_PLANE) == TRUE; +} + +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_SDL != 0) +bool CWGLContext::GetContextFromSDLWindow(SDL_Window *window, CGLContext::GLApi targetApi) +{ + if (m_Context == null) + return false; + HGLRC &glContext = m_Context->m_GLContext; + // Get context from HDC + { + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + SDL_GetWindowWMInfo(window, &info); + m_Context->m_DeviceHandle = info.info.win.hdc; + glContext = wglCreateContext(m_Context->m_DeviceHandle); + if (!PK_VERIFY_MESSAGE(glContext != null, "WGL context creation failed")) + return false; + if (!_MakeCurrent(m_Context->m_DeviceHandle, glContext)) + return false; + } + + // Init glew for futur use + if (!PK_VERIFY_MESSAGE(wglewInit() == GLEW_OK, "WGLew initialization failed")) + return false; + return GetContextWithAttribs(targetApi); +} +#endif + +//---------------------------------------------------------------------------- + +namespace +{ + + static const int kAttribListGLES[] = + { + WGL_CONTEXT_MAJOR_VERSION_ARB, 2, + WGL_CONTEXT_MINOR_VERSION_ARB, 0, + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_ES2_PROFILE_BIT_EXT , +#if defined(PK_DEBUG) + WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB, +#endif + 0, + }; + + //---------------------------------------------------------------------------- + + static const int kAttribListGL[] = + { + WGL_CONTEXT_MAJOR_VERSION_ARB, 3, + WGL_CONTEXT_MINOR_VERSION_ARB, 3, +#if defined(PKSAMPLE_CONTEXT_CORE_ONLY) + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, +#else + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, +#endif +#if defined(PK_DEBUG) + WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB | WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, +#else + WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, +#endif + 0, + }; + + //---------------------------------------------------------------------------- + + static const int kAttribList[] = + { + WGL_DRAW_TO_WINDOW_ARB, GL_TRUE, + WGL_SUPPORT_OPENGL_ARB, GL_TRUE, + WGL_DOUBLE_BUFFER_ARB, GL_TRUE, + WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, GL_TRUE, + WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, + WGL_COLOR_BITS_ARB, 32, + WGL_DEPTH_BITS_ARB, 0, + WGL_STENCIL_BITS_ARB, 0, + 0, //End + }; + +} + +//---------------------------------------------------------------------------- + +// Create new context with OpenGL ES profile +bool CWGLContext::GetContextWithAttribs(CGLContext::GLApi targetApi) +{ + const int *attribList = kAttribListGL; + if (targetApi == CGLContext::GL_OpenGLES) + { + // Check first the support of extensions + const bool support = wglewIsSupported("WGL_ARB_create_context") && + wglewIsSupported("WGL_EXT_create_context_es2_profile"); + if (!PK_VERIFY_MESSAGE(support, "WGL extensions for ES profile is not supported.")) + return false; + attribList = kAttribListGLES; + } + + // Create with extended creation function with attributes + { + HGLRC newContext = wglCreateContextAttribsARB(m_Context->m_DeviceHandle, 0, attribList); + if (!PK_VERIFY_MESSAGE(newContext != null, "Context creation with attribs failed")) + return false; + + // Make current the new one, avoid error with old one at deletion + if (!_MakeCurrent(m_Context->m_DeviceHandle, newContext)) + return false; + + // Delete old one and replace with the new context + wglDeleteContext(m_Context->m_GLContext); + m_Context->m_GLContext = newContext; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CWGLContext::ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) +{ + int pixelFormats[512]; + UINT numFormats = 0; + + wglChoosePixelFormatARB(m_Context->m_DeviceHandle, kAttribList, NULL, 512, pixelFormats, &numFormats); + + for (u32 i = 0; i < numFormats; ++i) + { + int attrib = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB; + int result = GL_TRUE; + if (wglGetPixelFormatAttribivARB(m_Context->m_DeviceHandle, pixelFormats[i], 0, 1, &attrib, &result) == FALSE) + return false; + + // Added check with OpenGLES, because of a weird behavior: SRGB is not enabled when the WGL api ensure to be enabled. + sRGBCapable = (result == GL_TRUE) && targetApi != CGLContext::GL_OpenGLES; + + DescribePixelFormat(m_Context->m_DeviceHandle, pixelFormats[i], sizeof(m_Context->m_PixelFormatDescriptor), &m_Context->m_PixelFormatDescriptor); + if (SetPixelFormat(m_Context->m_DeviceHandle, pixelFormats[i], &m_Context->m_PixelFormatDescriptor) == TRUE) + return true; + } + CLog::Log(PK_ERROR, "Could not find any suitable pixel format for the back buffer"); + return false; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OPENGL_WGL != 0) diff --git a/Samples/PK-SampleLib/ApiContext/OpenGL/WGLContext.h b/Samples/PK-SampleLib/ApiContext/OpenGL/WGLContext.h new file mode 100644 index 00000000..f0261ea5 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/OpenGL/WGLContext.h @@ -0,0 +1,52 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_OPENGL_WGL != 0) + +#include "ApiContext/OpenGL/GLContext.h" +#include "WindowContext/AWindowContext.h" + +struct SDL_Window; + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SWGLPlatformContext; + +//---------------------------------------------------------------------------- + +class CWGLContext : public IGLContext +{ +public: + CWGLContext(); + ~CWGLContext(); + +#if (PK_BUILD_WITH_SDL != 0) + virtual bool GetContextFromSDLWindow(SDL_Window *window, CGLContext::GLApi targetApi) override; +#endif + virtual bool ChoosePixelFormatSRGB(CGLContext::GLApi targetApi, bool &sRGBCapable) override; + + virtual void SwapInterval(s32 interval) override; + virtual bool SwapBuffers() override; + +private: + bool GetContextWithAttribs(CGLContext::GLApi targetApi); + + SWGLPlatformContext *m_Context; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_OPENGL_WGL != 0) diff --git a/Samples/PK-SampleLib/ApiContext/Vulkan/VulkanContext.cpp b/Samples/PK-SampleLib/ApiContext/Vulkan/VulkanContext.cpp new file mode 100644 index 00000000..720f1071 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/Vulkan/VulkanContext.cpp @@ -0,0 +1,1506 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ApiContextConfig.h" + +#if (PK_BUILD_WITH_VULKAN_SUPPORT != 0) + +#include "VulkanContext.h" + +#include +#include + +#include +#include + +#include "WindowContext/SdlContext/SdlContext.h" + +#if (PK_BUILD_WITH_SDL != 0) +# if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpragma-pack" +# endif // defined(PK_COMPILER_CLANG_CL) +# include +# if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic pop +# endif // defined(PK_COMPILER_CLANG_CL) +#endif // (PK_BUILD_WITH_SDL != 0) + +#define USE_CUSTOM_ALLOCATOR + +//---------------------------------------------------------------------------- + +#if defined(PK_GGP) + +#define VK_GET_INSTANCE_PROC_ADDR(functionPointer, instance, functionName) \ + static PFN_##functionName functionPointer; \ + \ + if (functionPointer == null) \ + { \ + functionPointer = (PFN_##functionName)vkGetInstanceProcAddr(instance, #functionName); \ + if (functionPointer == null) \ + CLog::Log(PK_ERROR, "Error getting VkInstance function: %s", #functionName); \ + } + +#endif + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +namespace MacOSxUtils +{ + void MakeViewMetalCompatible(void *nsview); + void *SDLViewFromWindow(void *window); +} + +//---------------------------------------------------------------------------- + +static void *kVulkanInvalidMallocValue = reinterpret_cast(static_cast(0xFFFFFFFF)); + +//---------------------------------------------------------------------------- + +#if (KR_PROFILER_ENABLED != 0) +static const char *_VulkanGetAllocationScope(VkSystemAllocationScope allocationScope) +{ + const char *scope = null; + + switch (allocationScope) + { + case VK_SYSTEM_ALLOCATION_SCOPE_COMMAND: + scope = "VK_SYSTEM_ALLOCATION_SCOPE_COMMAND"; + break; + case VK_SYSTEM_ALLOCATION_SCOPE_OBJECT: + scope = "VK_SYSTEM_ALLOCATION_SCOPE_OBJECT"; + break; + case VK_SYSTEM_ALLOCATION_SCOPE_CACHE: + scope = "VK_SYSTEM_ALLOCATION_SCOPE_CACHE"; + break; + case VK_SYSTEM_ALLOCATION_SCOPE_DEVICE: + scope = "VK_SYSTEM_ALLOCATION_SCOPE_DEVICE"; + break; + case VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE: + scope = "VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE"; + break; + default: + break; + } + return scope; +} +#endif // (KR_PROFILER_ENABLED == 0) + +//---------------------------------------------------------------------------- + +VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugMessengerCallback( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + VkDebugUtilsMessageTypeFlagsEXT messageTypes, + const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, + void *pUserData) +{ + (void)pUserData; + CLog::ELogLevel logLevel = CLog::Level_Info; + const char *levelName = "???"; + + if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) != 0) + { + levelName = "Error"; + logLevel = PKMax(logLevel, CLog::Level_Error); + } + else if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) != 0) + { + levelName = "Warn"; + logLevel = PKMax(logLevel, CLog::Level_Warning); + } + else if ((messageTypes & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) != 0) + { + levelName = "Perf"; + logLevel = PKMax(logLevel, CLog::Level_Warning); + } + else if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT) != 0) + { + levelName = "Info"; + logLevel = PKMax(logLevel, CLog::Level_Info); + } + else + { + levelName = "????"; + logLevel = PKMax(logLevel, CLog::Level_Warning); + } + + const CString message = CString::Format("Vulkan %s (%s code %d): %s", levelName, pCallbackData->pMessageIdName, pCallbackData->messageIdNumber, pCallbackData->pMessage); + + CLog::Log(logLevel, PK_LOG_MODULE_CLASS_GUID_NAME(), "%s", message.Data()); + + const bool isVulkanError = (logLevel == CLog::Level_Error); + + if (isVulkanError) + { + PK_RELEASE_ASSERT_MESSAGE(!isVulkanError, "%s", message.Data()); +// return VK_TRUE; // abort ! + return VK_FALSE; //For the moment, we do not abort because there is a bug in the validation layer with my drivers + } + + return VK_FALSE; +} + +//---------------------------------------------------------------------------- + +VKAPI_ATTR void* VKAPI_CALL VulkanAllocate(void *pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope) +{ + (void)pUserData; (void)allocationScope; + PK_NAMEDSCOPEDPROFILE_C(_VulkanGetAllocationScope(allocationScope), CFloat3(1, 1, 1)); + if (size != 0) + return PK_MALLOC_ALIGNED(static_cast(size), static_cast(alignment)); + else + return kVulkanInvalidMallocValue; +} + +//---------------------------------------------------------------------------- + +VKAPI_ATTR void* VKAPI_CALL VulkanReallocate(void *pUserData, void *pOriginal, size_t size, size_t alignment, VkSystemAllocationScope allocationScope) +{ + (void)pUserData; (void)allocationScope; + PK_NAMEDSCOPEDPROFILE_C(_VulkanGetAllocationScope(allocationScope), CFloat3(1, 1, 1)); + + if (pOriginal == kVulkanInvalidMallocValue) + { + if (size == 0) + return kVulkanInvalidMallocValue; + else + return PK_MALLOC_ALIGNED(static_cast(size), static_cast(alignment)); + } + else + { + if (size == 0) + { + PK_FREE(pOriginal); + return kVulkanInvalidMallocValue; + } + else + { + return PK_REALLOC_ALIGNED(pOriginal, static_cast(size), static_cast(alignment)); + } + } +} + +//---------------------------------------------------------------------------- + +VKAPI_ATTR void VKAPI_CALL VulkanFree(void *pUserData, void *pMemory) +{ + (void)pUserData; + if (pMemory != kVulkanInvalidMallocValue) + PK_FREE(pMemory); +} + +//---------------------------------------------------------------------------- + +CVulkanContext::CVulkanContext() +: m_DebugUtilsMessenger(VK_NULL_HANDLE) +, m_FnVkDestroyDebugUtilsMessengerEXT(VK_NULL_HANDLE) +, m_IsOffscreen(false) +{ + m_ApiData.m_Api = RHI::GApi_Vulkan; +} + +//---------------------------------------------------------------------------- + +CVulkanContext::~CVulkanContext() +{ + if (m_DebugUtilsMessenger != VK_NULL_HANDLE && m_FnVkDestroyDebugUtilsMessengerEXT != null) + { + m_FnVkDestroyDebugUtilsMessengerEXT(m_ApiData.m_Instance, m_DebugUtilsMessenger, m_ApiData.m_Allocator); + m_DebugUtilsMessenger = VK_NULL_HANDLE; + } + DestroyApiData(m_ApiData); +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) +{ + (void)debug; + bool err = false; + CUint2 windowSize = windowApi->GetDrawableSize(); + + // Init the Api data + m_ApiData.m_Instance = VK_NULL_HANDLE; + m_ApiData.m_PhysicalDevice = VK_NULL_HANDLE; + m_ApiData.m_LogicalDevice = VK_NULL_HANDLE; + m_ApiData.m_GraphicalQueue = VK_NULL_HANDLE; + m_ApiData.m_GraphicalQueueFamily = -1; + m_ApiData.m_PresentQueue = VK_NULL_HANDLE; + m_ApiData.m_PresentQueueFamily = -1; + m_ApiData.m_Allocator = null; + m_ApiData.m_UsePipelineCache = true; +#ifdef USE_CUSTOM_ALLOCATOR + m_ApiData.m_Allocator = PK_NEW(VkAllocationCallbacks); + m_ApiData.m_Allocator->pfnAllocation = VulkanAllocate; + m_ApiData.m_Allocator->pfnReallocation = VulkanReallocate; + m_ApiData.m_Allocator->pfnFree = VulkanFree; +#endif + // Init Vulkan + bool enableValidationLayer = false; + bool enableDebugNames = false; + bool performanceWarnings = false; + TArray instanceExtensions; + TArray deviceExtensions; + TArray layers; + +#ifndef PK_RETAIL + enableDebugNames = true; +#endif +#ifdef PK_DEBUG + enableValidationLayer = true; +#endif + m_VSync = false; + + if (windowApi->GetContextApi() == PKSample::Context_Offscreen) + { + m_IsOffscreen = true; + } + else + { + deviceExtensions.PushBack(VK_KHR_SWAPCHAIN_EXTENSION_NAME); + } + + // First we get the extensions to enable in the Vulkan instance + if (!GetInstanceExtensionsToEnable(instanceExtensions, enableValidationLayer, enableDebugNames, m_IsOffscreen)) + return false; + // We then get the layers to enable in the instance + if (enableValidationLayer) + { + if (!GetInstanceValidationLayersToEnable(layers)) + enableValidationLayer = false; + } + // We then create the instance using those extensions and layers + err = CreateInstance(m_ApiData, instanceExtensions, layers, "PopcornFX Sample", 1, "PopcornFX", 2); + if (err == false) + return false; + if (windowApi->GetContextApi() == PKSample::Context_Sdl) + { +#if (PK_BUILD_WITH_SDL != 0) + SDL_SysWMinfo info; + SDL_Window *window = static_cast(windowApi.Get())->SdlGetWindow(); + + SDL_VERSION(&info.version); + SDL_GetWindowWMInfo(window, &info); + +# if defined(PK_WINDOWS) + err = CreateWindowSurface(m_ApiData, GetModuleHandle(null), info.info.win.window); +# elif defined(PK_LINUX) + err = CreateWindowSurface(m_ApiData, (ureg)info.info.x11.display, (ureg)info.info.x11.window); +# elif defined(PK_MACOSX) + err = CreateWindowSurface(m_ApiData, MacOSxUtils::SDLViewFromWindow(info.info.cocoa.window)); +# else +# error not implemented +# endif + +#endif // (PK_BUILD_WITH_SDL != 0) + } +#if defined(PK_GGP) + else if (windowApi->GetContextApi() == PKSample::Context_Glfw) + { + err = CreateWindowSurface(m_ApiData); + } +#endif + else if (windowApi->GetContextApi() == PKSample::Context_Offscreen) + { + if (!m_ApiData.m_SwapChains.PushBack().Valid()) + return false; + m_ApiData.m_SwapChainCount = m_ApiData.m_SwapChains.Count(); + } + else + { + CLog::Log(PK_ERROR, "Vulkan does not handle window context of this type"); + return false; + } + if (err == false) + return false; + err = PickPhysicalDevice(m_ApiData, layers, deviceExtensions, enableValidationLayer, m_IsOffscreen); + if (err == false) + return false; + if (enableValidationLayer) + { + err = CreateValidationLayerCallback(m_ApiData, + performanceWarnings, + VulkanDebugMessengerCallback, + m_FnVkDestroyDebugUtilsMessengerEXT, + m_DebugUtilsMessenger); + if (err == false) + return false; + } + err = CreateQueueAndLogicalDevice(m_ApiData, deviceExtensions, layers, m_IsOffscreen); + if (err == false) + return false; + + return CreateSwapChain(m_ApiData, windowSize, true, m_VSync, m_ApiData.m_SwapChainCount - 1, m_IsOffscreen) == CVulkanContext::SwapChainOp_Success; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::WaitAllRenderFinished() +{ + if (m_ApiData.m_LogicalDevice != VK_NULL_HANDLE && + vkDeviceWaitIdle(m_ApiData.m_LogicalDevice) != VK_SUCCESS) + { + CLog::Log(PK_INFO, "vkDeviceWaitIdle failure"); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +CGuid CVulkanContext::BeginFrame() +{ +#if defined(PK_GGP) + m_ApiData.m_PlatformSpecificData.m_FrameToken = GgpIssueFrameToken(); +#endif + if (m_IsOffscreen) + { + m_CurrentSwapChainImage = (m_CurrentSwapChainImage + 1) % 2; + return m_CurrentSwapChainImage; + } + + VkResult res; + + res = vkAcquireNextImageKHR(m_ApiData.m_LogicalDevice, + m_ApiData.m_SwapChains[0].m_SwapChain, + TNumericTraits::Max(), + m_ApiData.m_SwapChains[0].m_SwapChainImageAvailable, + VK_NULL_HANDLE, &m_CurrentSwapChainImage); + if (res == VK_SUBOPTIMAL_KHR) + { + CLog::Log(PK_ERROR, "vkAcquireNextImageKHR sub optimal"); + return CGuid::INVALID; + } + else if (PK_VK_FAILED_STR(res, "vkAcquireNextImageKHR")) + { + return CGuid::INVALID; + } + return m_CurrentSwapChainImage; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::EndFrame(void *renderToWait) +{ + if (m_IsOffscreen) + return true; + // Present the RT + VkSwapchainKHR swapChains[] = { m_ApiData.m_SwapChains[0].m_SwapChain }; + VkPresentInfoKHR presentInfo = {}; + VkSemaphore renderFinished; + + renderFinished = *static_cast(renderToWait); + presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; + presentInfo.waitSemaphoreCount = 1; + presentInfo.pWaitSemaphores = &renderFinished; + presentInfo.swapchainCount = 1; + presentInfo.pSwapchains = swapChains; + presentInfo.pImageIndices = &m_CurrentSwapChainImage; + presentInfo.pResults = null; + +#if defined(PK_GGP) + VkPresentFrameTokenGGP frameTokenMetadata = {}; + + frameTokenMetadata.sType = VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP; + frameTokenMetadata.pNext = null; + frameTokenMetadata.frameToken = m_ApiData.m_PlatformSpecificData.m_FrameToken; + + presentInfo.pNext = &frameTokenMetadata; +#endif + + if (PK_VK_FAILED(vkQueuePresentKHR(m_ApiData.m_PresentQueue, &presentInfo))) + return false; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::RecreateSwapChain(const CUint2 &ctxSize) +{ + PK_ASSERT(m_ApiData.m_SwapChains.Count() == 1); + if (!PK_VERIFY(!m_ApiData.m_SwapChains.Empty())) + return false; + // We wait for the device to be Idle before recreating the swap chain + if (PK_VK_FAILED(vkDeviceWaitIdle(m_ApiData.m_LogicalDevice))) + return false; + if (CreateSwapChain(m_ApiData, ctxSize, true, m_VSync, 0, m_IsOffscreen) == false) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +TMemoryView CVulkanContext::GetCurrentSwapChain() +{ + return m_ApiData.m_SwapChains[0].m_SwapChainRenderTargets; +} + +//---------------------------------------------------------------------------- + +RHI::SApiContext *CVulkanContext::GetRenderApiContext() +{ + return &m_ApiData; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::CreateInstance( RHI::SVulkanBasicContext &basicCtx, + const TMemoryView &extensionsToEnable, + const TMemoryView &layersToEnable, + char const *appName, + u32 appVersion, + char const *engineName, + u32 engineVersion) +{ + VkApplicationInfo appInfo = {}; + appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + appInfo.pApplicationName = appName; + appInfo.applicationVersion = appVersion; + appInfo.pEngineName = engineName; + appInfo.engineVersion = engineVersion; + appInfo.apiVersion = VK_API_VERSION_1_0; + + VkInstanceCreateInfo createInfo = {}; + createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + createInfo.pApplicationInfo = &appInfo; + if (!layersToEnable.Empty()) + { + createInfo.enabledLayerCount = layersToEnable.Count(); + createInfo.ppEnabledLayerNames = layersToEnable.Data(); + } + createInfo.enabledExtensionCount = extensionsToEnable.Count(); + createInfo.ppEnabledExtensionNames = extensionsToEnable.Data(); + + VkResult err; + err = vkCreateInstance(&createInfo, basicCtx.m_Allocator, &basicCtx.m_Instance); + if (err != VK_SUCCESS) + { + if (err == VK_ERROR_INCOMPATIBLE_DRIVER) + CLog::Log(PK_ERROR, "vkCreateInstance Failure: Cannot find a compatible Vulkan installable client driver."); + else if (err == VK_ERROR_EXTENSION_NOT_PRESENT) + CLog::Log(PK_ERROR, "vkCreateInstance Failure: Cannot find a specified extension library."); + else + CLog::Log(PK_ERROR, "vkCreateInstance Failure: %s: Do you have a compatible Vulkan installable client driver (ICD) installed?.", RHI::VkResultToString(err)); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::PickPhysicalDevice( RHI::SVulkanBasicContext &basicCtx, + const TMemoryView &layersToEnable, + const TMemoryView &extensionsToEnable, + bool &debugLayersEnabled, + bool isOffscreen) +{ + u32 gpuCount = 0; + bool deviceFound = false; + + if (PK_VK_FAILED(vkEnumeratePhysicalDevices(basicCtx.m_Instance, &gpuCount, null))) + return false; + + if (!PK_VERIFY_MESSAGE(gpuCount > 0, "vkEnumeratePhysicalDevices reported zero accessible devices.")) + return false; + + TSemiDynamicArray physicalDevices; + if (!physicalDevices.Resize(gpuCount)) + return false; + + if (PK_VK_FAILED(vkEnumeratePhysicalDevices(basicCtx.m_Instance, &gpuCount, physicalDevices.RawDataPointer()))) + gpuCount = 0; + + CGuid bestPhysicalDevice; + + for (u32 i = 0; i < gpuCount && deviceFound == false; ++i) + { + // We are not going to use those here + VkSurfaceCapabilitiesKHR capabilities; + TArray surfaceFormats; + TArray presentModes; + + // Check that the required extensions and layers are supported by the device + bool extensionSupported = ExtensionsSupportedByDevice(physicalDevices[i], extensionsToEnable); + bool layerSupported = InstanceLayersSupportedByDevice(physicalDevices[i], layersToEnable); + bool swapChainSupported = isOffscreen ? true : SwapChainSupportedByDevice(basicCtx, physicalDevices[i], capabilities, surfaceFormats, presentModes, 0); + + if (extensionSupported && swapChainSupported) + { + if (layerSupported) + { + basicCtx.m_PhysicalDevice = physicalDevices[i]; + deviceFound = true; + } + else + { + // If the debug layers are not handled, we don't really care we can still use this GPU if we don't find any other: + bestPhysicalDevice = i; + } + } + } + + if (deviceFound == false) + { + if (bestPhysicalDevice.Valid()) + { + // We found a device but it does not support the validation layers: + debugLayersEnabled = false; + basicCtx.m_PhysicalDevice = physicalDevices[bestPhysicalDevice]; + CLog::Log(PK_WARN, "GPU does not support the validation layers"); + } + else + { + CLog::Log(PK_ERROR, "Could not find any suitable physical device"); + return false; + } + } + + vkGetPhysicalDeviceProperties(basicCtx.m_PhysicalDevice, &basicCtx.m_DeviceProperties); // Unused for the moment + vkGetPhysicalDeviceMemoryProperties(basicCtx.m_PhysicalDevice, &basicCtx.m_DeviceMemoryProperties); + return true; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::CreateValidationLayerCallback( RHI::SVulkanBasicContext &basicCtx, + bool performanceWarning, + PFN_vkDebugUtilsMessengerCallbackEXT debugCallbackToUse, + PFN_vkDestroyDebugUtilsMessengerEXT &vkDestroyDebugMessengerCallback, + VkDebugUtilsMessengerEXT &debugMessenger) +{ + PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessenger; + + vkCreateDebugUtilsMessenger = reinterpret_cast(vkGetInstanceProcAddr(basicCtx.m_Instance, "vkCreateDebugUtilsMessengerEXT")); + vkDestroyDebugMessengerCallback = reinterpret_cast(vkGetInstanceProcAddr(basicCtx.m_Instance, "vkDestroyDebugUtilsMessengerEXT")); + if (!PK_VERIFY_MESSAGE(vkCreateDebugUtilsMessenger != null, "GetProcAddr: Unable to find vkCreateDebugUtilsMessengerEXT")) + return false; + if (!PK_VERIFY_MESSAGE(vkDestroyDebugMessengerCallback != null, "GetProcAddr: Unable to find vkDestroyDebugUtilsMessengerEXT")) + return false; + + //m_vkDebugReportMessage = (PFN_vkDebugReportMessageEXT)vkGetInstanceProcAddr(basicCtx.m_Instance, "vkDebugReportMessageEXT"); + //if (m_vkDebugReportMessage == null) + //{ + // CLog::Log(PK_WARN, "GetProcAddr: Unable to find vkDebugReportMessageEXT"); + //} + + VkDebugUtilsMessengerCreateInfoEXT dbgCreateInfo{}; + dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; + + dbgCreateInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT; + if (performanceWarning) + dbgCreateInfo.messageSeverity |= VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT; + //dbgCreateInfo.flags |= VK_DEBUG_REPORT_INFORMATION_BIT_EXT; + //dbgCreateInfo.flags |= VK_DEBUG_REPORT_DEBUG_BIT_EXT; + dbgCreateInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT; + + dbgCreateInfo.pfnUserCallback = debugCallbackToUse; + dbgCreateInfo.pUserData = null; + dbgCreateInfo.pNext = null; + if (PK_VK_FAILED(vkCreateDebugUtilsMessenger(basicCtx.m_Instance, &dbgCreateInfo, basicCtx.m_Allocator, &debugMessenger))) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +static bool _BeforeSurfaceCreation(RHI::SVulkanBasicContext &basicCtx) +{ + if (!basicCtx.m_SwapChains.PushBack().Valid()) + return false; + basicCtx.m_SwapChainCount = basicCtx.m_SwapChains.Count(); + return true; +} + +//---------------------------------------------------------------------------- + +static bool _AfterSurfaceCreation(RHI::SVulkanBasicContext &basicCtx) +{ + // If the physical device was already chosen + if (basicCtx.m_PhysicalDevice != VK_NULL_HANDLE) + { + // We check if the swap chain is compatible with the physical device + VkBool32 supported; + + if (PK_VK_FAILED(vkGetPhysicalDeviceSurfaceSupportKHR( basicCtx.m_PhysicalDevice, + basicCtx.m_GraphicalQueueFamily, + basicCtx.m_SwapChains.Last().m_Surface, + &supported))) + return false; + return supported == VK_TRUE; + } + return true; +} + +//---------------------------------------------------------------------------- + +#if defined(PK_WINDOWS) + +bool CVulkanContext::CreateWindowSurface(RHI::SVulkanBasicContext &basicCtx, HINSTANCE moduleHandle, HWND windowHandle) +{ + if (!_BeforeSurfaceCreation(basicCtx)) + return false; + VkWin32SurfaceCreateInfoKHR createInfo; + + createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = null; + createInfo.flags = 0; + createInfo.hinstance = moduleHandle; + createInfo.hwnd = windowHandle; + + if (PK_VK_FAILED(vkCreateWin32SurfaceKHR(basicCtx.m_Instance, &createInfo, basicCtx.m_Allocator, &basicCtx.m_SwapChains.Last().m_Surface))) + return false; + return _AfterSurfaceCreation(basicCtx); +} + +#elif defined(PK_LINUX) && !defined(PK_GGP) + +bool CVulkanContext::CreateWindowSurface(RHI::SVulkanBasicContext &basicCtx, ureg display, ureg window) +{ + if (!_BeforeSurfaceCreation(basicCtx)) + return false; + VkXlibSurfaceCreateInfoKHR createInfo; + + createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = null; + createInfo.flags = 0; + createInfo.dpy = (Display *)display; + createInfo.window = (Window)window; + + if (PK_VK_FAILED(vkCreateXlibSurfaceKHR(basicCtx.m_Instance, &createInfo, basicCtx.m_Allocator, &basicCtx.m_SwapChains.Last().m_Surface))) + return false; + return _AfterSurfaceCreation(basicCtx); +} + +#elif defined(PK_MACOSX) + +bool CVulkanContext::CreateWindowSurface(RHI::SVulkanBasicContext &basicCtx, void *view) +{ + if (!_BeforeSurfaceCreation(basicCtx)) + return false; + VkMacOSSurfaceCreateInfoMVK createInfo; + + createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; + createInfo.pNext = null; + createInfo.flags = 0; + MacOSxUtils::MakeViewMetalCompatible(view); + createInfo.pView = view; + + if (PK_VK_FAILED(vkCreateMacOSSurfaceMVK(basicCtx.m_Instance, &createInfo, basicCtx.m_Allocator, &basicCtx.m_SwapChains.Last().m_Surface))) + return false; + return _AfterSurfaceCreation(basicCtx); +} + +#elif defined(PK_GGP) + +bool CVulkanContext::CreateWindowSurface(RHI::SVulkanBasicContext &basicCtx) +{ + if (!_BeforeSurfaceCreation(basicCtx)) + return false; + + VkStreamDescriptorSurfaceCreateInfoGGP createInfo; + + createInfo.sType = VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP; + createInfo.pNext = null; + createInfo.flags = 0; + createInfo.streamDescriptor = 1; + + VK_GET_INSTANCE_PROC_ADDR(fpCreateStreamDescriptorSurfaceGGP, basicCtx.m_Instance, vkCreateStreamDescriptorSurfaceGGP); + + if (PK_VK_FAILED(fpCreateStreamDescriptorSurfaceGGP(basicCtx.m_Instance, &createInfo, basicCtx.m_Allocator, &basicCtx.m_SwapChains.Last().m_Surface))) + return false; + + return _AfterSurfaceCreation(basicCtx); +} + +#else +# error not implemented +#endif + +//---------------------------------------------------------------------------- + +bool CVulkanContext::CreateQueueAndLogicalDevice(RHI::SVulkanBasicContext &basicCtx, + const TMemoryView &extensionsToEnable, + const TMemoryView &layersToEnable, + bool isOffscreen) +{ + + TSemiDynamicArray queueCreateInfo; + TSemiDynamicArray queueFamilies; + float queuePriority = 1.0f; + TArray queueFamilyProperties; + + // Check if we can find a queue that supports graphics and present + basicCtx.m_PresentQueueFamily = basicCtx.m_GraphicalQueueFamily = GetQueueFamilyIdx(basicCtx, queueFamilyProperties, !isOffscreen, VK_QUEUE_GRAPHICS_BIT); + // If it does not exist, create two queues + if (basicCtx.m_GraphicalQueueFamily == -1) + { + if (!queueFamilies.Resize(2)) + return false; + basicCtx.m_PresentQueueFamily = GetQueueFamilyIdx(basicCtx, queueFamilyProperties, true); + basicCtx.m_GraphicalQueueFamily = GetQueueFamilyIdx(basicCtx, queueFamilyProperties, false, VK_QUEUE_GRAPHICS_BIT); + queueFamilies[0] = basicCtx.m_PresentQueueFamily; + queueFamilies[1] = basicCtx.m_GraphicalQueueFamily; + } + else // Create only one queue that supports both + { + if (!queueFamilies.PushBack(basicCtx.m_PresentQueueFamily).Valid()) + return false; + } + + // Use of multiple transfer queue not handled for the moment + + //int transferQueue = GetQueueFamilyIdx(false, VK_QUEUE_TRANSFER_BIT, VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT); + //if (transferQueue != -1) + //{ + // queueFamilies.PushBack(transferQueue); + // m_ApiData.m_TransferQueueFamilies.PushBack(transferQueue); + //} + + //if (m_ApiData.m_TransferQueueFamilies.Empty()) + // m_ApiData.m_TransferQueueFamilies.PushBack(m_ApiData.m_GraphicalQueueFamily); + + if (!queueCreateInfo.Resize(queueFamilies.Count())) + return false; + Mem::Clear(queueCreateInfo.RawDataPointer(), queueCreateInfo.SizeInBytes()); + for (u32 i = 0; i < queueCreateInfo.Count(); ++i) + { + queueCreateInfo[i].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; + queueCreateInfo[i].queueFamilyIndex = queueFamilies[i]; + queueCreateInfo[i].queueCount = 1; + queueCreateInfo[i].pQueuePriorities = &queuePriority; + } + + // We do not need any specific device feature + VkPhysicalDeviceFeatures deviceFeatures = {}; + + deviceFeatures.wideLines = VK_TRUE; + deviceFeatures.fillModeNonSolid = VK_TRUE; + deviceFeatures.geometryShader = VK_TRUE; + deviceFeatures.samplerAnisotropy = VK_TRUE; + deviceFeatures.textureCompressionBC = VK_TRUE; + deviceFeatures.depthClamp = VK_TRUE; + deviceFeatures.shaderStorageImageWriteWithoutFormat = VK_TRUE; + + VkDeviceCreateInfo createInfo = {}; + createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; + createInfo.queueCreateInfoCount = queueCreateInfo.Count(); + createInfo.pQueueCreateInfos = queueCreateInfo.RawDataPointer(); + createInfo.pEnabledFeatures = &deviceFeatures; + // We create the appropriate logical device with the right extensions (especially VK_KHR_SWAPCHAIN_EXTENSION_NAME) + createInfo.enabledExtensionCount = extensionsToEnable.Count(); + createInfo.ppEnabledExtensionNames = extensionsToEnable.Data(); + // and the validation layer that we got from VulkanGetInstanceValidationLayersToEnable + createInfo.enabledLayerCount = layersToEnable.Count(); + createInfo.ppEnabledLayerNames = layersToEnable.Data(); + + if (PK_VK_FAILED(vkCreateDevice(basicCtx.m_PhysicalDevice, &createInfo, basicCtx.m_Allocator, &basicCtx.m_LogicalDevice))) + return false; + + vkGetDeviceQueue(basicCtx.m_LogicalDevice, basicCtx.m_GraphicalQueueFamily, 0, &basicCtx.m_GraphicalQueue); + vkGetDeviceQueue(basicCtx.m_LogicalDevice, basicCtx.m_PresentQueueFamily, 0, &basicCtx.m_PresentQueue); + //m_ApiData.m_TransferQueues.Resize(m_ApiData.m_TransferQueueFamilies.Count()); + //for (u32 i = 0; i < m_ApiData.m_TransferQueueFamilies.Count(); ++i) + //{ + // vkGetDeviceQueue(m_ApiData.m_LogicalDevice, m_ApiData.m_TransferQueueFamilies[i], 0, &m_ApiData.m_TransferQueues[i]); + //} + return PK_VERIFY(LoadExtensionFunctionPointers(basicCtx)); +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::LoadExtensionFunctionPointers(RHI::SVulkanBasicContext &basicCtx) +{ +#ifndef PK_RETAIL + basicCtx.m_PfnSetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)vkGetInstanceProcAddr(basicCtx.m_Instance, "vkSetDebugUtilsObjectNameEXT"); + if (!PK_VERIFY_MESSAGE(basicCtx.m_PfnSetDebugUtilsObjectNameEXT != null, "GetProcAddr: Unable to find vkCreateDebugUtilsMessengerEXT")) + return false; +#else + (void)basicCtx; +#endif + return true; +} + +//---------------------------------------------------------------------------- + +CVulkanContext::ESwapChainOpResult CVulkanContext::CreateSwapChain(RHI::SVulkanBasicContext &basicCtx, + const CUint2 &windowSize, + bool srgb, + bool vSync, + u32 swapChainIdx, + bool isOffscreen) +{ + if (isOffscreen) + { + return CreateOffscreenSwapChain(basicCtx, windowSize, srgb, swapChainIdx); + } + VkSurfaceCapabilitiesKHR capabilities; + TArray surfaceFormats; + TArray presentModes; + TSemiDynamicArray swapChainImages; + TSemiDynamicArray swapChainImageViews; + + // If the swap chain already exist, we need to get once again all the options + if (!SwapChainSupportedByDevice(basicCtx, basicCtx.m_PhysicalDevice, capabilities, surfaceFormats, presentModes, swapChainIdx)) + return SwapChainOp_CriticalError; + VkSurfaceFormatKHR surfaceFormat = GetOptimalSurfaceFormat(surfaceFormats, srgb); + VkPresentModeKHR presentMode = GetOptimalPresentationMode(presentModes, vSync); + VkExtent2D extent = GetOptimalSwapChainExtent(capabilities, windowSize.x(), windowSize.y()); + + u32 imageCount = capabilities.minImageCount + 1; + if (capabilities.maxImageCount > 0 && imageCount > capabilities.maxImageCount) + { + imageCount = capabilities.maxImageCount; + } + + VkSwapchainKHR newSwapChain; + PK_ASSERT(basicCtx.m_GraphicalQueueFamily >= 0 && basicCtx.m_PresentQueueFamily >= 0); + u32 queues[2] = { u32(basicCtx.m_GraphicalQueueFamily), u32(basicCtx.m_PresentQueueFamily) }; + VkSwapchainCreateInfoKHR createInfo = {}; + + createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; + createInfo.surface = basicCtx.m_SwapChains[swapChainIdx].m_Surface; + createInfo.minImageCount = imageCount; + createInfo.imageFormat = surfaceFormat.format; + createInfo.imageColorSpace = surfaceFormat.colorSpace; + createInfo.imageExtent = extent; + createInfo.imageArrayLayers = 1; + createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + if (basicCtx.m_GraphicalQueueFamily != basicCtx.m_PresentQueueFamily) + { + createInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT; + createInfo.queueFamilyIndexCount = 2; + createInfo.pQueueFamilyIndices = queues; + } + else + { + createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; + } + createInfo.preTransform = capabilities.currentTransform; + createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; + createInfo.presentMode = presentMode; + createInfo.clipped = VK_TRUE; + createInfo.oldSwapchain = basicCtx.m_SwapChains[swapChainIdx].m_SwapChain; + + // Create the semaphore to synchronize the swap-chain + if (basicCtx.m_SwapChains[swapChainIdx].m_SwapChainImageAvailable == VK_NULL_HANDLE) + { + VkSemaphoreCreateInfo semaphoreInfo = {}; + + semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + if (PK_VK_FAILED(vkCreateSemaphore( basicCtx.m_LogicalDevice, + &semaphoreInfo, + basicCtx.m_Allocator, + &basicCtx.m_SwapChains[swapChainIdx].m_SwapChainImageAvailable))) + return SwapChainOp_CriticalError; + } + + // We raise a fatal error when we cannot create the swap-chain and the device is lost + VkResult createSwapChainResult = vkCreateSwapchainKHR(basicCtx.m_LogicalDevice, &createInfo, basicCtx.m_Allocator, &newSwapChain); + if (createSwapChainResult == VK_ERROR_DEVICE_LOST) + return SwapChainOp_DeviceLost; + else if (createSwapChainResult == VK_ERROR_INITIALIZATION_FAILED) + return SwapChainOp_Failed; + else if (createSwapChainResult != VK_SUCCESS) + return SwapChainOp_CriticalError; + + if (PK_VK_FAILED(vkGetSwapchainImagesKHR(basicCtx.m_LogicalDevice, newSwapChain, &imageCount, null))) + return SwapChainOp_CriticalError; + + if (!swapChainImages.Resize(imageCount)) + return SwapChainOp_CriticalError; + + if (PK_VK_FAILED(vkGetSwapchainImagesKHR(basicCtx.m_LogicalDevice, newSwapChain, &imageCount, swapChainImages.RawDataPointer()))) + return SwapChainOp_CriticalError; + + if (basicCtx.m_SwapChains[swapChainIdx].m_SwapChain != VK_NULL_HANDLE) + { + vkDestroySwapchainKHR(basicCtx.m_LogicalDevice, basicCtx.m_SwapChains[swapChainIdx].m_SwapChain, basicCtx.m_Allocator); + } + + basicCtx.m_SwapChains[swapChainIdx].m_SwapChain = newSwapChain; + basicCtx.m_SwapChains[swapChainIdx].m_SwapChainFormat = surfaceFormat; + basicCtx.m_SwapChains[swapChainIdx].m_SwapChainExtent = extent; + + if (!CreateSwapChainImageViews(basicCtx, swapChainImages, swapChainImageViews, swapChainIdx)) + return SwapChainOp_CriticalError; + + // We then construct the swap chain render target list + if (!basicCtx.m_SwapChains[swapChainIdx].m_SwapChainRenderTargets.Resize(imageCount)) + return SwapChainOp_CriticalError; + for (u32 i = 0; i < imageCount; ++i) + { + RHI::CVulkanRenderTarget *toAdd = PK_NEW(RHI::CVulkanRenderTarget(RHI::SRHIResourceInfos("VulkanContext Swap Chain"))); + toAdd->VulkanSetRenderTarget(swapChainImageViews[i], surfaceFormat.format, extent, true); + basicCtx.m_SwapChains[swapChainIdx].m_SwapChainRenderTargets[i] = toAdd; + } + basicCtx.m_BufferingMode = RHI::ContextDoubleBuffering; + return SwapChainOp_Success; +} + +//---------------------------------------------------------------------------- + +CVulkanContext::ESwapChainOpResult CVulkanContext::CreateOffscreenSwapChain(RHI::SVulkanBasicContext &basicCtx, + const CUint2 &windowSize, + bool srgb, + u32 swapChainIdx) +{ + TSemiDynamicArray &m_OffscreenSwapchainImages = basicCtx.m_SwapChains[swapChainIdx].m_OffscreenSwapchainImages; + TSemiDynamicArray &m_OffscreenSwapchainImagesMemory = basicCtx.m_SwapChains[swapChainIdx].m_OffscreenSwapchainImagesMemory; + TSemiDynamicArray offscreenSwapchainImageViews; + const u32 imageCount = 2; + const VkFormat defaultFormat = srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM; + const VkSurfaceFormatKHR offscreenFormat{ defaultFormat, VK_COLORSPACE_SRGB_NONLINEAR_KHR }; + const VkExtent3D extent{ windowSize.x(), windowSize.y(), 1 }; + const u32 queue = u32(basicCtx.m_GraphicalQueueFamily); + + basicCtx.m_SwapChains[swapChainIdx].m_SwapChainFormat = offscreenFormat; + basicCtx.m_SwapChains[swapChainIdx].m_SwapChainExtent = VkExtent2D{ extent.width, extent.height }; + + if (!(m_OffscreenSwapchainImages.Resize(imageCount) && m_OffscreenSwapchainImagesMemory.Resize(imageCount) && offscreenSwapchainImageViews.Resize(imageCount))) + return SwapChainOp_CriticalError; + + VkImageCreateInfo imageInfo{}; + imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; + imageInfo.imageType = VK_IMAGE_TYPE_2D; + imageInfo.format = offscreenFormat.format; + imageInfo.extent = extent; + imageInfo.mipLevels = 1; + imageInfo.arrayLayers = 1; + imageInfo.samples = VK_SAMPLE_COUNT_1_BIT; + imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + imageInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + imageInfo.queueFamilyIndexCount = 1; + imageInfo.pQueueFamilyIndices = &queue; + imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + + for (u32 i = 0; i < imageCount; i++) + { + vkCreateImage(basicCtx.m_LogicalDevice, &imageInfo, basicCtx.m_Allocator, &m_OffscreenSwapchainImages[i]); + + VkMemoryRequirements memRequirements; + vkGetImageMemoryRequirements(basicCtx.m_LogicalDevice, m_OffscreenSwapchainImages[i], &memRequirements); + VkMemoryAllocateInfo allocInfo = {}; + allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; + allocInfo.allocationSize = memRequirements.size; + + CGuid memoryTypeIndex; + for (u32 j = 0; j < basicCtx.m_DeviceMemoryProperties.memoryTypeCount; j++) + { + if ((memRequirements.memoryTypeBits & (1 << j)) && + (basicCtx.m_DeviceMemoryProperties.memoryTypes[j].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) + { + memoryTypeIndex = j; + } + } + if (!PK_VERIFY(memoryTypeIndex.Valid())) + return SwapChainOp_CriticalError; + + allocInfo.memoryTypeIndex = memoryTypeIndex; + if (PK_VK_FAILED(vkAllocateMemory(basicCtx.m_LogicalDevice, &allocInfo, basicCtx.m_Allocator, &m_OffscreenSwapchainImagesMemory[i]))) + return SwapChainOp_CriticalError; + if (PK_VK_FAILED(vkBindImageMemory(basicCtx.m_LogicalDevice, m_OffscreenSwapchainImages[i], m_OffscreenSwapchainImagesMemory[i], 0))) + return SwapChainOp_CriticalError; + } + + if (!CreateSwapChainImageViews(basicCtx, TMemoryView(m_OffscreenSwapchainImages), offscreenSwapchainImageViews, swapChainIdx)) + return SwapChainOp_CriticalError; + + if (!basicCtx.m_SwapChains[swapChainIdx].m_SwapChainRenderTargets.Resize(imageCount)) + return SwapChainOp_CriticalError; + + for (u32 i = 0; i < imageCount; ++i) + { + RHI::CVulkanRenderTarget *toAdd = PK_NEW(RHI::CVulkanRenderTarget(RHI::SRHIResourceInfos("VulkanContext Offscreen Render Target"))); + toAdd->VulkanSetRenderTarget(offscreenSwapchainImageViews[i], basicCtx.m_SwapChains[swapChainIdx].m_SwapChainFormat.format, basicCtx.m_SwapChains[swapChainIdx].m_SwapChainExtent, true); + basicCtx.m_SwapChains[swapChainIdx].m_SwapChainRenderTargets[i] = toAdd; + } + basicCtx.m_BufferingMode = RHI::ContextDoubleBuffering; + + if (basicCtx.m_SwapChains[swapChainIdx].m_SwapChainImageAvailable == VK_NULL_HANDLE) + { + VkSemaphoreCreateInfo semaphoreInfo = {}; + + semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + if (PK_VK_FAILED(vkCreateSemaphore( basicCtx.m_LogicalDevice, + &semaphoreInfo, + basicCtx.m_Allocator, + &basicCtx.m_SwapChains[swapChainIdx].m_SwapChainImageAvailable))) + return SwapChainOp_CriticalError; + } + return SwapChainOp_Success; +} + +//---------------------------------------------------------------------------- + +void CVulkanContext::DestroyApiData( RHI::SVulkanBasicContext &basicCtx) +{ + for (u32 i = 0; i < basicCtx.m_SwapChains.Count(); ++i) + { + DestroySwapChain(basicCtx, i); + } + + RHI::SVulkanBasicContext::SUnsafePools &unsafePool = basicCtx.m_Pool; + + if (unsafePool.m_CmdPool != VK_NULL_HANDLE) + { + vkDestroyCommandPool(basicCtx.m_LogicalDevice, unsafePool.m_CmdPool, basicCtx.m_Allocator); + unsafePool.m_CmdPool = VK_NULL_HANDLE; + } + if (unsafePool.m_CmdPoolTransient != VK_NULL_HANDLE) + { + vkDestroyCommandPool(basicCtx.m_LogicalDevice, unsafePool.m_CmdPoolTransient, basicCtx.m_Allocator); + unsafePool.m_CmdPoolTransient = VK_NULL_HANDLE; + } + if (unsafePool.m_CmdPoolTransientReset != VK_NULL_HANDLE) + { + vkDestroyCommandPool(basicCtx.m_LogicalDevice, unsafePool.m_CmdPoolTransientReset, basicCtx.m_Allocator); + unsafePool.m_CmdPoolTransientReset = VK_NULL_HANDLE; + } + if (unsafePool.m_DescriptorPool != VK_NULL_HANDLE) + { + vkDestroyDescriptorPool(basicCtx.m_LogicalDevice, unsafePool.m_DescriptorPool, basicCtx.m_Allocator); + unsafePool.m_DescriptorPool = VK_NULL_HANDLE; + } + vkDestroyDevice(basicCtx.m_LogicalDevice, basicCtx.m_Allocator); + basicCtx.m_LogicalDevice = VK_NULL_HANDLE; + // We then destroy the instance + vkDestroyInstance(basicCtx.m_Instance, basicCtx.m_Allocator); + basicCtx.m_Instance = VK_NULL_HANDLE; + PK_SAFE_DELETE(basicCtx.m_Allocator); + +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::DestroySwapChain(RHI::SVulkanBasicContext &basicCtx, u32 idx) +{ + if (basicCtx.m_SwapChains[idx].m_SwapChainImageAvailable != VK_NULL_HANDLE) + { + vkDestroySemaphore(basicCtx.m_LogicalDevice, basicCtx.m_SwapChains[idx].m_SwapChainImageAvailable, basicCtx.m_Allocator); + basicCtx.m_SwapChains[idx].m_SwapChainImageAvailable = VK_NULL_HANDLE; + } + + // Offscren Images + for (VkImage &image: basicCtx.m_SwapChains[idx].m_OffscreenSwapchainImages) + { + if (image != VK_NULL_HANDLE) + { + vkDestroyImage(basicCtx.m_LogicalDevice, image, null); + image = VK_NULL_HANDLE; + } + } + for (VkDeviceMemory &memory: basicCtx.m_SwapChains[idx].m_OffscreenSwapchainImagesMemory) + { + if (memory != VK_NULL_HANDLE) + { + vkFreeMemory(basicCtx.m_LogicalDevice, memory, null); + memory = VK_NULL_HANDLE; + } + } + + // We destroy everything before the Vulkan instance + basicCtx.m_SwapChains[idx].m_SwapChainRenderTargets.Clear(); + + if (basicCtx.m_SwapChains[idx].m_SwapChain != VK_NULL_HANDLE) + { + vkDestroySwapchainKHR(basicCtx.m_LogicalDevice, basicCtx.m_SwapChains[idx].m_SwapChain, basicCtx.m_Allocator); + basicCtx.m_SwapChains[idx].m_SwapChain = VK_NULL_HANDLE; + } + + if (basicCtx.m_SwapChains[idx].m_Surface != VK_NULL_HANDLE) + { + vkDestroySurfaceKHR(basicCtx.m_Instance, basicCtx.m_SwapChains[idx].m_Surface, basicCtx.m_Allocator); + basicCtx.m_SwapChains[idx].m_Surface = VK_NULL_HANDLE; + } + + basicCtx.m_SwapChains.Remove(idx); + basicCtx.m_SwapChainCount = basicCtx.m_SwapChains.Count(); + return true; +} + +//---------------------------------------------------------------------------- +// +// Private members +// +//---------------------------------------------------------------------------- + +bool CVulkanContext::GetInstanceExtensionsToEnable(TArray &extensions, bool enableValidationLayer, bool enableDebugNames, bool isOffscreen /* = false*/) +{ + bool instanceExtensionsFound = false; + u32 instanceExtensionCount = 0; + + TArray requiredInstanceExtensions; + + if (!isOffscreen) + { + requiredInstanceExtensions.PushBack(VK_KHR_SURFACE_EXTENSION_NAME); + requiredInstanceExtensions.PushBack(PLATFORM_SURFACE_EXTENSION_NAME); + } + if (enableValidationLayer || enableDebugNames) + { + requiredInstanceExtensions.PushBack(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + } + + if (PK_VK_FAILED(vkEnumerateInstanceExtensionProperties(null, &instanceExtensionCount, null))) + return false; + + if (instanceExtensionCount > 0) + { + TArray instanceExtensions; + + if (!instanceExtensions.Resize(instanceExtensionCount)) + return false; + if (PK_VK_FAILED(vkEnumerateInstanceExtensionProperties(null, &instanceExtensionCount, instanceExtensions.RawDataPointer()))) + return false; + instanceExtensionsFound = CheckExtensionNamesExist(requiredInstanceExtensions, instanceExtensions); + + if (instanceExtensionsFound) + { + if (!extensions.Resize(requiredInstanceExtensions.Count())) + return false; + for (u32 i = 0; i < extensions.Count(); ++i) + { + extensions[i] = requiredInstanceExtensions[i]; + } + } + } + else + { + CLog::Log(PK_ERROR, "vkEnumerateInstanceExtensionProperties failed to find required extensions."); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::GetInstanceValidationLayersToEnable(TArray &layers) +{ + bool validationLayerFound = false; + u32 instanceLayerCount = 0; + + if (PK_VK_FAILED(vkEnumerateInstanceLayerProperties(&instanceLayerCount, null))) + return false; + + static char const *validationLayersToEnable[] = + { + "VK_LAYER_LUNARG_standard_validation", + "VK_LAYER_LUNARG_core_validation", + "VK_LAYER_GOOGLE_threading", + "VK_LAYER_LUNARG_parameter_validation", + "VK_LAYER_LUNARG_device_limits", + "VK_LAYER_LUNARG_object_tracker", + "VK_LAYER_LUNARG_image", + "VK_LAYER_LUNARG_core_validation", + "VK_LAYER_LUNARG_swapchain", + "VK_LAYER_GOOGLE_unique_objects", + "VK_LAYER_KHRONOS_validation" + }; + + if (instanceLayerCount > 0) + { + TArray instanceLayers; + + if (!instanceLayers.Resize(instanceLayerCount)) + return false; + if (PK_VK_FAILED(vkEnumerateInstanceLayerProperties(&instanceLayerCount, instanceLayers.RawDataPointer()))) + return false; + + for (u32 j = 0; j < PK_ARRAY_COUNT(validationLayersToEnable); ++j) + { + if (CheckLayerNamesExist(TMemoryView(validationLayersToEnable[j]), instanceLayers)) + { + if (!layers.PushBack(validationLayersToEnable[j]).Valid()) + return false; + validationLayerFound = true; + } + } + } + if (validationLayerFound == false) + { + CLog::Log(PK_ERROR, "vkEnumerateInstanceLayerProperties failed to find any requested validation layer."); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::ExtensionsSupportedByDevice(VkPhysicalDevice device, const TMemoryView &extensionsToEnable) +{ + u32 deviceExtensionCount = 0; + + if (PK_VK_FAILED(vkEnumerateDeviceExtensionProperties(device, null, &deviceExtensionCount, null))) + return false; + if (deviceExtensionCount > 0) + { + TArray deviceExtensions; + + if (!deviceExtensions.Resize(deviceExtensionCount)) + return false; + if (PK_VK_FAILED(vkEnumerateDeviceExtensionProperties(device, null, &deviceExtensionCount, deviceExtensions.RawDataPointer()))) + return false; + return CheckExtensionNamesExist(extensionsToEnable, deviceExtensions); + } + return extensionsToEnable.Empty(); +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::InstanceLayersSupportedByDevice(VkPhysicalDevice device, const TMemoryView &enabledLayers) +{ + u32 deviceLayerCount = 0; + + if (PK_VK_FAILED(vkEnumerateDeviceLayerProperties(device, &deviceLayerCount, null))) + return false; + if (deviceLayerCount > 0) + { + TArray deviceLayers; + + if (!deviceLayers.Resize(deviceLayerCount)) + return false; + if (PK_VK_FAILED(vkEnumerateDeviceLayerProperties(device, &deviceLayerCount, deviceLayers.RawDataPointer()))) + return false; + return CheckLayerNamesExist(enabledLayers, deviceLayers); + } + return enabledLayers.Empty(); +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::SwapChainSupportedByDevice( const RHI::SVulkanBasicContext &basicCtx, + VkPhysicalDevice device, + VkSurfaceCapabilitiesKHR &capabilities, + TArray &surfaceFormats, + TArray &presentModes, + u32 swapChainIdx) +{ + vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device, basicCtx.m_SwapChains[swapChainIdx].m_Surface, &capabilities); + + u32 formatCount = 0; + vkGetPhysicalDeviceSurfaceFormatsKHR(device, basicCtx.m_SwapChains[swapChainIdx].m_Surface, &formatCount, null); + + if (formatCount != 0) + { + if (!surfaceFormats.Resize(formatCount)) + return false; + vkGetPhysicalDeviceSurfaceFormatsKHR(device, basicCtx.m_SwapChains[swapChainIdx].m_Surface, &formatCount, surfaceFormats.RawDataPointer()); + } + else + { + return false; + } + + u32 presentModeCount = 0; + vkGetPhysicalDeviceSurfacePresentModesKHR(device, basicCtx.m_SwapChains[swapChainIdx].m_Surface, &presentModeCount, null); + + if (presentModeCount != 0) + { + if (!presentModes.Resize(presentModeCount)) + return false; + vkGetPhysicalDeviceSurfacePresentModesKHR(device, basicCtx.m_SwapChains[swapChainIdx].m_Surface, &presentModeCount, presentModes.RawDataPointer()); + } + else + { + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +int CVulkanContext::GetQueueFamilyIdx( const RHI::SVulkanBasicContext &basicCtx, + TArray &queueFamilyProperties, + bool supportPresent, + u32 queueFamilyFlags, + u32 shouldNotSupport) +{ + if (queueFamilyProperties.Empty()) + { + u32 queueCount = 0; + vkGetPhysicalDeviceQueueFamilyProperties(basicCtx.m_PhysicalDevice, &queueCount, null); + if (!queueFamilyProperties.Resize(queueCount)) + return -1; + vkGetPhysicalDeviceQueueFamilyProperties(basicCtx.m_PhysicalDevice, &queueCount, queueFamilyProperties.RawDataPointer()); + } + for (u32 i = 0; i < queueFamilyProperties.Count(); ++i) + { + VkQueueFamilyProperties ¤tFamily = queueFamilyProperties[i]; + // We just require a graphic queue + if (currentFamily.queueCount > 0 && (currentFamily.queueFlags & queueFamilyFlags) != 0 && (currentFamily.queueFlags & shouldNotSupport) == 0) + { + VkBool32 supported; + if (!supportPresent || + (!PK_VK_FAILED(vkGetPhysicalDeviceSurfaceSupportKHR(basicCtx.m_PhysicalDevice, i, basicCtx.m_SwapChains[0].m_Surface, &supported)) && + supported)) + { + return i; + } + } + } + return -1; +} + +//---------------------------------------------------------------------------- + +VkSurfaceFormatKHR CVulkanContext::GetOptimalSurfaceFormat(const TMemoryView &surfaceFormats, bool srgb) +{ + const VkFormat defaultFormat = srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM; + if (surfaceFormats.Count() == 1 && surfaceFormats[0].format == VK_FORMAT_UNDEFINED) + { + VkSurfaceFormatKHR surfaceFormat; + surfaceFormat.format = defaultFormat; + surfaceFormat.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + return surfaceFormat; + } + + for (u32 i = 0; i < surfaceFormats.Count(); ++i) + { + if (surfaceFormats[i].format == defaultFormat && surfaceFormats[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) + { + return surfaceFormats[i]; + } + } + return surfaceFormats[0]; +} + +//---------------------------------------------------------------------------- + +VkPresentModeKHR CVulkanContext::GetOptimalPresentationMode(const TMemoryView &presentModes, bool vSync) +{ + if (vSync) + return VK_PRESENT_MODE_FIFO_KHR; + for (u32 i = 0; i < presentModes.Count(); ++i) + { + if (presentModes[i] == VK_PRESENT_MODE_MAILBOX_KHR) + { + return presentModes[i]; + } + if (presentModes[i] == VK_PRESENT_MODE_IMMEDIATE_KHR) + { + return presentModes[i]; + } + } + return VK_PRESENT_MODE_FIFO_KHR; +} + +//---------------------------------------------------------------------------- + +VkExtent2D CVulkanContext::GetOptimalSwapChainExtent( const VkSurfaceCapabilitiesKHR &capabilities, + u32 windowsWidth, + u32 windowsHeight) +{ + if (capabilities.currentExtent.width != TNumericTraits::Max()) + { + return capabilities.currentExtent; + } + else + { + VkExtent2D actualExtent; + actualExtent.width = PKClamp(windowsWidth, capabilities.minImageExtent.width, capabilities.maxImageExtent.width); + actualExtent.height = PKClamp(windowsHeight, capabilities.minImageExtent.height, capabilities.maxImageExtent.height); + return actualExtent; + } +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::CreateSwapChainImageViews( const RHI::SVulkanBasicContext &basicCtx, + const TMemoryView &scImages, + TSemiDynamicArray &scImageViews, + u32 swapChainIdx) +{ + if (!scImageViews.Resize(scImages.Count())) + return false; + + for (u32 i = 0; i < scImages.Count(); i++) + { + VkImageViewCreateInfo createInfo = {}; + createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + createInfo.image = scImages[i]; + createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; + createInfo.format = basicCtx.m_SwapChains[swapChainIdx].m_SwapChainFormat.format; + createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; + createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; + createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; + createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; + createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + createInfo.subresourceRange.baseMipLevel = 0; + createInfo.subresourceRange.levelCount = 1; + createInfo.subresourceRange.baseArrayLayer = 0; + createInfo.subresourceRange.layerCount = 1; + + if (PK_VK_FAILED(vkCreateImageView(basicCtx.m_LogicalDevice, &createInfo, basicCtx.m_Allocator, &scImageViews[i]))) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::CheckLayerNamesExist( const TMemoryView &toCheckNames, + const TMemoryView &layers) +{ + for (u32 i = 0; i < toCheckNames.Count(); i++) + { + bool found = false; + for (u32 j = 0; j < layers.Count(); j++) + { + if (!strcmp(toCheckNames[i], layers[j].layerName)) + { + found = true; + break; + } + } + if (!found) + { + CLog::Log(PK_ERROR, "Cannot find layer: %s", toCheckNames[i]); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CVulkanContext::CheckExtensionNamesExist( const TMemoryView &toCheckNames, + const TMemoryView &extensions) +{ + for (u32 i = 0; i < toCheckNames.Count(); i++) + { + bool found = false; + for (u32 j = 0; j < extensions.Count(); j++) + { + if (!strcmp(toCheckNames[i], extensions[j].extensionName)) + { + found = true; + break; + } + } + if (!found) + { + CLog::Log(PK_ERROR, "Cannot find extension: %s", toCheckNames[i]); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_VULKAN != 0) diff --git a/Samples/PK-SampleLib/ApiContext/Vulkan/VulkanContext.h b/Samples/PK-SampleLib/ApiContext/Vulkan/VulkanContext.h new file mode 100644 index 00000000..5c51043e --- /dev/null +++ b/Samples/PK-SampleLib/ApiContext/Vulkan/VulkanContext.h @@ -0,0 +1,215 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#if (PK_BUILD_WITH_VULKAN_SUPPORT != 0) + +#if defined(PK_WINDOWS) +# define PLATFORM_SURFACE_EXTENSION_NAME VK_KHR_WIN32_SURFACE_EXTENSION_NAME +# define VK_USE_PLATFORM_WIN32_KHR +#elif defined(PK_LINUX) && !defined(PK_GGP) +# define PLATFORM_SURFACE_EXTENSION_NAME VK_KHR_XLIB_SURFACE_EXTENSION_NAME +# define VK_USE_PLATFORM_XLIB_KHR +#elif defined(PK_MACOSX) +# define PLATFORM_SURFACE_EXTENSION_NAME VK_MVK_MACOS_SURFACE_EXTENSION_NAME +# define VK_USE_PLATFORM_MACOS_MVK +#elif defined(PK_GGP) +# define PLATFORM_SURFACE_EXTENSION_NAME VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME +# define VK_USE_PLATFORM_GGP +#else +# error Unrecognized Vulkan platform +#endif + +#include +#include +#include + +struct SDL_Window; + +#define MAX_ENABLED_EXTENSIONS 16 + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugMessengerCallback( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + VkDebugUtilsMessageTypeFlagsEXT messageTypes, + const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, + void *pUserData); +VKAPI_ATTR void* VKAPI_CALL VulkanAllocate( void *pUserData, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); +VKAPI_ATTR void* VKAPI_CALL VulkanReallocate( void *pUserData, + void *pOriginal, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); +VKAPI_ATTR void VKAPI_CALL VulkanFree(void *pUserData, void *pMemory); + +//---------------------------------------------------------------------------- + +class CVulkanContext : public IApiContext +{ +public: + CVulkanContext(); + ~CVulkanContext(); + + virtual bool InitRenderApiContext(bool debug, PAbstractWindowContext windowApi) override; + virtual bool WaitAllRenderFinished() override; + virtual CGuid BeginFrame() override; + virtual bool EndFrame(void *renderToWait) override; + virtual RHI::SApiContext *GetRenderApiContext() override; + // Add the index of the swap-chain to recreate here + virtual bool RecreateSwapChain(const CUint2 &ctxSize) override; + virtual TMemoryView GetCurrentSwapChain() override; + + // + // THE FOLLOWING FUNCTIONS SHOULD BE CALLED IN THIS ORDER: + // + + enum ESwapChainOpResult + { + SwapChainOp_CriticalError, + SwapChainOp_DeviceLost, + SwapChainOp_Failed, + SwapChainOp_Success, + }; + + // Utils to create the actual vkInstance object + static bool CreateInstance( RHI::SVulkanBasicContext &basicCtx, + const TMemoryView &extensionsToEnable, + const TMemoryView &layersToEnable, + char const *appName, + u32 appVersion, + char const *engineName, + u32 engineVersion); + // Utils to find the appropriate physical device and check its extensions & layers + static bool PickPhysicalDevice( RHI::SVulkanBasicContext &basicCtx, + const TMemoryView &layersToEnable, + const TMemoryView &extensionsToEnable, + bool &outDebugLayersEnabled, + bool isOffscreen); + // Bind a callback to the validation layer to display warnings and error messages + static bool CreateValidationLayerCallback( RHI::SVulkanBasicContext &basicCtx, + bool performanceWarning, + PFN_vkDebugUtilsMessengerCallbackEXT debugCallbackToUse, + PFN_vkDestroyDebugUtilsMessengerEXT &vkDestroyDebugMessengerCallback, + VkDebugUtilsMessengerEXT &debugMessenger); + // Creates the window surface +#if defined(PK_WINDOWS) + static bool CreateWindowSurface(RHI::SVulkanBasicContext &basicCtx, HINSTANCE moduleHandle, HWND windowHandle); +#elif defined(PK_LINUX) && !defined(PK_GGP) + static bool CreateWindowSurface(RHI::SVulkanBasicContext &basicCtx, ureg display, ureg window); +#elif defined(PK_MACOSX) + static bool CreateWindowSurface(RHI::SVulkanBasicContext &basicCtx, void *view); +#elif defined(PK_GGP) + static bool CreateWindowSurface(RHI::SVulkanBasicContext &basicCtx); +#else +# error not implemented +#endif + + // Creates the queue and logical device + static bool CreateQueueAndLogicalDevice(RHI::SVulkanBasicContext &basicCtx, + const TMemoryView &extensionsToEnable, + const TMemoryView &layersToEnable, + bool isOffscreen); + + static bool LoadExtensionFunctionPointers(RHI::SVulkanBasicContext &basicCtx); + // Creates the swap-chain + static ESwapChainOpResult CreateSwapChain(RHI::SVulkanBasicContext &basicCtx, + const CUint2 &windowSize, + bool srgb, + bool vSync, + u32 swapChainIdx, + bool isOffscreen); + + static void DestroyApiData( RHI::SVulkanBasicContext &basicCtx); + + static bool DestroySwapChain(RHI::SVulkanBasicContext &basicCtx, u32 idx); + + // + // Utils: + // + + // Utils to get the instance creation options + static bool GetInstanceExtensionsToEnable(TArray &extensions, bool enableValidationLayer, bool enableDebugNames, bool isOffscreen = false); + static bool GetInstanceValidationLayersToEnable(TArray &layers); + static bool ExtensionsSupportedByDevice(VkPhysicalDevice device, const TMemoryView &extensionsToEnable); + static bool InstanceLayersSupportedByDevice(VkPhysicalDevice device, const TMemoryView &enabledLayers); + static bool SwapChainSupportedByDevice( const RHI::SVulkanBasicContext &basicCtx, + VkPhysicalDevice device, + VkSurfaceCapabilitiesKHR &capabilities, + TArray &surfaceFormats, + TArray &presentModes, + u32 swapChainIdx); + + // Find the index of a queue that supports the flags and IFN the presentation + static int GetQueueFamilyIdx( const RHI::SVulkanBasicContext &basicCtx, + TArray &queueFamilyProperties, + bool supportPresent, + u32 queueFamilyFlags = 0xFFFFFFFF, + u32 shouldNotSupport = 0); + // Utils to create the swap-chain + static VkSurfaceFormatKHR GetOptimalSurfaceFormat(const TMemoryView &surfaceFormats, bool srgb); + static VkPresentModeKHR GetOptimalPresentationMode(const TMemoryView &presentModes, bool vSync); + static VkExtent2D GetOptimalSwapChainExtent( const VkSurfaceCapabilitiesKHR &capabilities, + u32 windowsWidth, + u32 windowsHeight); + // Create the image views for the swap-chain + static bool CreateSwapChainImageViews( const RHI::SVulkanBasicContext &basicCtx, + const TMemoryView &scImages, + TSemiDynamicArray &scImageViews, + u32 swapChainIdx); + + // Check if all the specified layers in "toCheckNames" exist in the "layers" parameter (can be VkLayerProperties or VkExtensionProperties) + static bool CheckLayerNamesExist( const TMemoryView &toCheckNames, + const TMemoryView &layers); + static bool CheckExtensionNamesExist( const TMemoryView &toCheckNames, + const TMemoryView &extensions); + + // + // Variables: + // + + // Validation layer callback + VkDebugUtilsMessengerEXT m_DebugUtilsMessenger; + + // Information about the available queues in the device + TArray m_QueueFamilyProperties; + + // The device supported swap-chains + TSemiDynamicArray m_SwapChainImages; + TSemiDynamicArray m_SwapChainImageViews; + + u32 m_CurrentSwapChainImage; + + // Dynamically loaded Vulkan functions for validation layer + PFN_vkDestroyDebugUtilsMessengerEXT m_FnVkDestroyDebugUtilsMessengerEXT; +// PFN_vkDebugReportMessageEXT m_vkDebugReportMessage; + + //This struct is the actual data that is shared between the Api context and the Api manager + RHI::SVulkanBasicContext m_ApiData; + + bool m_VSync; + bool m_IsOffscreen; +private: + static ESwapChainOpResult CreateOffscreenSwapChain(RHI::SVulkanBasicContext &basicCtx, + const CUint2 &windowSize, + bool srgb, + u32 swapChainIdx); +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_VULKAN_SUPPORT != 0) diff --git a/Samples/PK-SampleLib/ApiContextConfig.h b/Samples/PK-SampleLib/ApiContextConfig.h new file mode 100644 index 00000000..fc71fa07 --- /dev/null +++ b/Samples/PK-SampleLib/ApiContextConfig.h @@ -0,0 +1,92 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- +// Raw config, must not depend on PopcornFX defines + +#if !defined(PK_BUILD_WITH_ORBIS_SUPPORT) +# define PK_BUILD_WITH_ORBIS_SUPPORT 0 +#endif +#if !defined(PK_BUILD_WITH_VULKAN_SUPPORT) +# define PK_BUILD_WITH_VULKAN_SUPPORT 0 +#endif +#if !defined(PK_BUILD_WITH_OGL_SUPPORT) +# define PK_BUILD_WITH_OGL_SUPPORT 0 +#endif +#if !defined(PK_BUILD_WITH_D3D11_SUPPORT) +# define PK_BUILD_WITH_D3D11_SUPPORT 0 +#endif +#if !defined(PK_BUILD_WITH_D3D12_SUPPORT) +# define PK_BUILD_WITH_D3D12_SUPPORT 0 +#endif +#if !defined(PK_BUILD_WITH_METAL_SUPPORT) +# define PK_BUILD_WITH_METAL_SUPPORT 0 +#endif +#if !defined(PK_BUILD_WITH_UNKNOWN2_SUPPORT) +# define PK_BUILD_WITH_UNKNOWN2_SUPPORT 0 +#endif + +//---------------------------------------------------------------------------- + +#if (PK_BUILD_WITH_OGL_SUPPORT != 0) +# ifndef PK_BUILD_WITH_OPENGL_WGL +# if defined(_WIN32) +# define PK_BUILD_WITH_OPENGL_WGL 1 +# else +# define PK_BUILD_WITH_OPENGL_WGL 0 +# endif +# endif + +# ifndef PK_BUILD_WITH_OPENGL_EGL +# if defined(GLEW_EGL) +# define PK_BUILD_WITH_OPENGL_EGL 1 +# else +# define PK_BUILD_WITH_OPENGL_EGL 0 +# endif +# endif + +# ifndef PK_BUILD_WITH_OPENGL_GLX +# if (PK_BUILD_WITH_OPENGL_EGL == 0) && (defined(LINUX) || defined(_LINUX) || defined(__LINUX__) || defined(__linux__)) +# define PK_BUILD_WITH_OPENGL_GLX 1 +# else +# define PK_BUILD_WITH_OPENGL_GLX 0 +# endif +# endif + +# ifndef PK_BUILD_WITH_OPENGL_NSGL +# if (defined(MACOSX) || defined(__APPLE__) || defined(__apple__) || defined(macosx) || defined(MACOS_X)) +# define PK_BUILD_WITH_OPENGL_NSGL 1 +# else +# define PK_BUILD_WITH_OPENGL_NSGL 0 +# endif +# endif + +#else +# define PK_BUILD_WITH_OPENGL_WGL 0 +# define PK_BUILD_WITH_OPENGL_EGL 0 +# define PK_BUILD_WITH_OPENGL_GLX 0 +# define PK_BUILD_WITH_OPENGL_NSGL 0 +#endif + +//---------------------------------------------------------------------------- + +#if !defined(PK_BUILD_WITH_PSSL_GENERATOR) +# define PK_BUILD_WITH_PSSL_GENERATOR 0 +#endif + +//---------------------------------------------------------------------------- + +#if !defined(PK_BUILD_WITH_SDL) +# error PK_BUILD_WITH_SDL should be defined +#endif + +//---------------------------------------------------------------------------- diff --git a/Samples/PK-SampleLib/Assets/Meshes/default.fbx b/Samples/PK-SampleLib/Assets/Meshes/default.fbx new file mode 100644 index 00000000..91568102 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Meshes/default.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47bc41dd798158f33e8f7b3d52586e16d52dd63660c95c1ad967ccf286e055e0 +size 174594 diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/gen_shaders_header b/Samples/PK-SampleLib/Assets/ShaderIncludes/gen_shaders_header new file mode 100755 index 00000000..7910c6a4 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/gen_shaders_header @@ -0,0 +1,18 @@ +#!/bin/bash + +case "`uname`" in + CYGWIN*|MINGW*) python_bin=python ;; +esac + +command="`dirname "$0"`/../../../../../Python/gen_shader_header.py" + +if [ $# -ne 0 ]; then + ${python_bin} "${command}" "$@" +else + out_dir="./generated" + + mkdir -p "${out_dir}" + + ${python_bin} ${command} `ls sources/*` "-o${out_dir}" +fi + diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/gen_shaders_header.cmd b/Samples/PK-SampleLib/Assets/ShaderIncludes/gen_shaders_header.cmd new file mode 100644 index 00000000..2b80f75c --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/gen_shaders_header.cmd @@ -0,0 +1,9 @@ +@echo off + +if "%~1"=="" ( + FOR /R "%~dp0sources\" %%A IN (*.*) do ( + python "%~dp0\..\..\..\..\..\Python\gen_shader_header.py" "-o%~dp0/generated" "%%A" + ) +) else ( + python "%~dp0\..\..\..\..\..\Python\gen_shader_header.py" %* +) diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Billboard.geom.h b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Billboard.geom.h new file mode 100755 index 00000000..a927983a --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Billboard.geom.h @@ -0,0 +1,549 @@ +#pragma once + +extern const char g_Billboard_geom_data[16256]; + +const char g_Billboard_geom_data[16256] = +{ + 35,105,102,32,66,66,95,70,101,97,116,117,114,101,67,48,10,35,9,100,101,102,105,110,101,32,66,66,95,83, + 99,114,101,101,110,65,108,105,103,110,101,100,9,9,9,9,49,85,10,35,9,100,101,102,105,110,101,32,66,66, + 95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,9,9,9,50,85,10,35,9,105,102,32,33,100,101,102, + 105,110,101,100,40,71,73,78,80,85,84,95,103,101,111,109,83,105,122,101,41,10,35,9,9,101,114,114,111,114, + 32,109,105,115,115,105,110,103,32,105,110,112,117,116,10,35,9,101,110,100,105,102,10,35,101,108,115,101,10,35, + 9,101,114,114,111,114,32,99,111,110,102,105,103,32,101,114,114,111,114,10,35,101,110,100,105,102,10,10,35,105, + 102,32,66,66,95,70,101,97,116,117,114,101,67,49,10,35,9,100,101,102,105,110,101,32,78,79,82,77,65,76, + 73,90,69,82,95,69,80,83,73,76,79,78,9,9,49,46,48,101,45,56,102,10,35,9,100,101,102,105,110,101, + 32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,9,9,9,51,85,10,35,9,100,101,102,105,110,101,32, + 66,66,95,65,120,105,115,65,108,105,103,110,101,100,83,112,104,101,114,111,105,100,9,52,85,10,35,9,105,102, + 32,33,100,101,102,105,110,101,100,40,71,73,78,80,85,84,95,103,101,111,109,65,120,105,115,48,41,10,35,9, + 9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,105,110,112,117,116,10,35,9,101,110,100,105,102,10,35, + 101,110,100,105,102,10,10,35,105,102,32,66,66,95,70,101,97,116,117,114,101,67,49,95,67,97,112,115,117,108, + 101,10,35,9,100,101,102,105,110,101,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117, + 108,101,9,53,85,10,35,101,110,100,105,102,10,10,35,105,102,32,66,66,95,70,101,97,116,117,114,101,67,50, + 10,35,9,100,101,102,105,110,101,32,66,66,95,80,108,97,110,101,65,108,105,103,110,101,100,9,9,9,54,85, + 10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,71,73,78,80,85,84,95,103,101,111,109,65,120,105,115, + 49,41,10,35,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,105,110,112,117,116,10,35,9,101,110, + 100,105,102,10,35,101,110,100,105,102,10,10,35,100,101,102,105,110,101,9,70,76,73,80,95,66,73,76,76,66, + 79,65,82,68,73,78,71,95,65,88,73,83,9,9,49,10,10,35,105,102,9,33,100,101,102,105,110,101,100,40, + 67,79,78,83,84,95,66,105,108,108,98,111,97,114,100,73,110,102,111,95,68,114,97,119,82,101,113,117,101,115, + 116,41,10,35,101,114,114,111,114,32,34,77,105,115,115,105,110,103,32,99,111,110,115,116,97,110,116,32,119,105, + 116,104,32,105,110,102,111,115,32,102,111,114,32,98,105,108,108,98,111,97,114,100,34,10,35,101,110,100,105,102, + 10,10,35,105,102,32,100,101,102,105,110,101,100,40,67,79,78,83,84,95,66,105,108,108,98,111,97,114,100,73, + 110,102,111,95,68,114,97,119,82,101,113,117,101,115,116,41,10,35,9,100,101,102,105,110,101,9,66,66,95,70, + 108,97,103,95,66,105,108,108,98,111,97,114,100,77,97,115,107,9,55,85,9,47,47,32,51,32,102,105,114,115, + 116,115,32,98,105,116,115,10,35,9,100,101,102,105,110,101,9,66,66,95,70,108,97,103,95,70,108,105,112,86, + 9,9,9,56,85,9,47,47,32,52,116,104,32,98,105,116,10,35,9,100,101,102,105,110,101,9,66,66,95,70, + 108,97,103,95,83,111,102,116,65,110,105,109,66,108,101,110,100,9,49,54,85,32,47,47,32,53,116,104,32,98, + 105,116,10,35,9,100,101,102,105,110,101,9,66,66,95,70,108,97,103,95,70,108,105,112,85,9,9,9,51,50, + 85,9,47,47,32,54,116,104,32,98,105,116,10,35,101,110,100,105,102,10,10,47,47,9,68,114,97,119,82,101, + 113,117,101,115,116,58,10,47,47,32,120,58,32,70,108,97,103,115,10,47,47,32,121,58,32,78,111,114,109,97, + 108,115,66,101,110,100,105,110,103,70,97,99,116,111,114,10,10,47,47,32,82,105,103,104,116,72,97,110,100,101, + 100,47,76,101,102,116,72,97,110,100,101,100,58,10,35,100,101,102,105,110,101,9,109,121,67,114,111,115,115,40, + 97,44,32,98,41,32,32,99,114,111,115,115,40,97,44,32,98,41,32,42,32,71,69,84,95,67,79,78,83,84, + 65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,72,97,110,100,101,100,110,101,115,115,41,10,10,118,111, + 105,100,9,115,119,97,112,40,105,110,111,117,116,32,118,101,99,50,32,97,44,32,105,110,111,117,116,32,118,101, + 99,50,32,98,41,10,123,10,9,118,101,99,50,9,115,32,61,32,97,59,10,9,97,32,61,32,98,59,10,9, + 98,32,61,32,115,59,10,125,10,10,118,111,105,100,9,115,119,97,112,40,105,110,111,117,116,32,118,101,99,52, + 32,97,44,32,105,110,111,117,116,32,118,101,99,52,32,98,41,10,123,10,9,118,101,99,52,9,115,32,61,32, + 97,59,10,9,97,32,61,32,98,59,10,9,98,32,61,32,115,59,10,125,10,10,118,101,99,50,9,103,101,116, + 95,114,97,100,105,117,115,40,105,110,32,83,80,114,105,109,105,116,105,118,101,115,32,103,73,110,112,117,116,41, + 10,123,10,35,105,102,9,9,100,101,102,105,110,101,100,40,72,65,83,95,83,105,122,101,70,108,111,97,116,50, + 41,10,9,114,101,116,117,114,110,32,103,73,110,112,117,116,46,103,101,111,109,83,105,122,101,59,10,35,101,108, + 115,101,10,9,114,101,116,117,114,110,32,118,101,99,50,40,103,73,110,112,117,116,46,103,101,111,109,83,105,122, + 101,44,32,103,73,110,112,117,116,46,103,101,111,109,83,105,122,101,41,59,10,35,101,110,100,105,102,10,125,10, + 10,35,105,102,32,100,101,102,105,110,101,100,40,66,66,95,83,99,114,101,101,110,65,108,105,103,110,101,100,41, + 32,124,124,32,100,101,102,105,110,101,100,40,66,66,95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,41, + 32,124,124,32,100,101,102,105,110,101,100,40,66,66,95,80,108,97,110,101,65,108,105,103,110,101,100,41,10,118, + 111,105,100,9,114,111,116,97,116,101,95,97,120,105,115,40,105,110,32,83,80,114,105,109,105,116,105,118,101,115, + 32,103,73,110,112,117,116,44,32,105,110,111,117,116,32,118,101,99,51,32,120,65,120,105,115,44,32,105,110,111, + 117,116,32,118,101,99,51,32,121,65,120,105,115,41,10,123,10,35,105,102,9,9,100,101,102,105,110,101,100,40, + 71,73,78,80,85,84,95,103,101,111,109,82,111,116,97,116,105,111,110,41,10,9,102,108,111,97,116,9,99,32, + 61,32,99,111,115,40,103,73,110,112,117,116,46,103,101,111,109,82,111,116,97,116,105,111,110,41,59,10,9,102, + 108,111,97,116,9,115,32,61,32,115,105,110,40,103,73,110,112,117,116,46,103,101,111,109,82,111,116,97,116,105, + 111,110,41,59,10,9,118,101,99,51,9,120,97,32,61,32,120,65,120,105,115,59,10,9,120,65,120,105,115,32, + 61,32,121,65,120,105,115,32,42,32,115,32,43,32,120,65,120,105,115,32,42,32,99,59,10,9,121,65,120,105, + 115,32,61,32,121,65,120,105,115,32,42,32,99,32,45,32,120,97,32,42,32,115,59,10,35,101,110,100,105,102, + 10,125,10,35,101,110,100,105,102,10,10,35,105,102,9,66,66,95,83,99,114,101,101,110,65,108,105,103,110,101, + 100,10,118,111,105,100,9,98,98,95,83,99,114,101,101,110,65,108,105,103,110,101,100,81,117,97,100,40,105,110, + 32,83,80,114,105,109,105,116,105,118,101,115,32,103,73,110,112,117,116,44,32,111,117,116,32,118,101,99,51,32, + 120,65,120,105,115,44,32,111,117,116,32,118,101,99,51,32,121,65,120,105,115,44,32,111,117,116,32,118,101,99, + 51,32,110,65,120,105,115,41,10,123,10,35,105,102,9,9,33,100,101,102,105,110,101,100,40,67,79,78,83,84, + 95,83,99,101,110,101,73,110,102,111,95,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,10,35, + 101,114,114,111,114,32,34,77,105,115,115,105,110,103,32,86,105,101,119,32,109,97,116,114,105,120,32,105,110,32, + 83,99,101,110,101,73,110,102,111,34,10,35,101,110,100,105,102,10,9,120,65,120,105,115,32,61,32,71,69,84, + 95,77,65,84,82,73,88,95,88,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99, + 101,110,101,73,110,102,111,44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121, + 122,59,10,9,121,65,120,105,115,32,61,32,71,69,84,95,77,65,84,82,73,88,95,89,95,65,88,73,83,40, + 71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,66,105,108,108,98,111, + 97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,9,114,111,116,97,116,101,95,97,120,105,115, + 40,103,73,110,112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,41,59,10,9,118,101,99,50,9, + 114,97,100,105,117,115,32,61,32,103,101,116,95,114,97,100,105,117,115,40,103,73,110,112,117,116,41,59,10,9, + 120,65,120,105,115,32,42,61,32,114,97,100,105,117,115,46,120,59,10,9,121,65,120,105,115,32,42,61,32,114, + 97,100,105,117,115,46,121,59,10,9,110,65,120,105,115,32,61,32,71,69,84,95,77,65,84,82,73,88,95,90, + 95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32, + 66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,125,10,35,101,110,100, + 105,102,10,10,35,105,102,9,66,66,95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,10,118,111,105,100, + 9,98,98,95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,81,117,97,100,40,105,110,32,83,80,114,105, + 109,105,116,105,118,101,115,32,103,73,110,112,117,116,44,32,111,117,116,32,118,101,99,51,32,120,65,120,105,115, + 44,32,111,117,116,32,118,101,99,51,32,121,65,120,105,115,44,32,111,117,116,32,118,101,99,51,32,110,65,120, + 105,115,41,10,123,10,35,105,102,9,9,33,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99,101,110, + 101,73,110,102,111,95,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,10,35,101,114,114,111,114, + 32,34,77,105,115,115,105,110,103,32,86,105,101,119,32,109,97,116,114,105,120,32,105,110,32,83,99,101,110,101, + 73,110,102,111,34,10,35,101,110,100,105,102,10,9,118,101,99,51,9,118,105,101,119,80,111,115,32,61,32,71, + 69,84,95,77,65,84,82,73,88,95,87,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40, + 83,99,101,110,101,73,110,102,111,44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46, + 120,121,122,59,10,9,118,101,99,51,9,118,105,101,119,85,112,65,120,105,115,32,61,32,71,69,84,95,77,65, + 84,82,73,88,95,89,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101, + 73,110,102,111,44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10, + 9,118,101,99,51,9,99,97,109,84,111,80,97,114,116,105,99,108,101,32,61,32,110,111,114,109,97,108,105,122, + 101,40,103,73,110,112,117,116,46,86,101,114,116,101,120,80,111,115,105,116,105,111,110,46,120,121,122,32,45,32, + 118,105,101,119,80,111,115,41,59,10,9,118,101,99,51,9,117,112,86,101,99,116,111,114,73,110,116,101,114,109, + 32,61,32,118,105,101,119,85,112,65,120,105,115,32,45,32,49,46,101,45,53,102,32,42,32,99,97,109,84,111, + 80,97,114,116,105,99,108,101,46,120,122,121,59,10,10,9,120,65,120,105,115,32,61,32,110,111,114,109,97,108, + 105,122,101,40,109,121,67,114,111,115,115,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,117,112,86, + 101,99,116,111,114,73,110,116,101,114,109,41,41,59,10,9,121,65,120,105,115,32,61,32,109,121,67,114,111,115, + 115,40,120,65,120,105,115,44,32,99,97,109,84,111,80,97,114,116,105,99,108,101,41,59,10,9,114,111,116,97, + 116,101,95,97,120,105,115,40,103,73,110,112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,41,59, + 10,10,9,118,101,99,50,9,114,97,100,105,117,115,32,61,32,103,101,116,95,114,97,100,105,117,115,40,103,73, + 110,112,117,116,41,59,10,9,120,65,120,105,115,32,42,61,32,114,97,100,105,117,115,46,120,59,10,9,121,65, + 120,105,115,32,42,61,32,114,97,100,105,117,115,46,121,59,10,9,110,65,120,105,115,32,61,32,45,99,97,109, + 84,111,80,97,114,116,105,99,108,101,59,10,125,10,35,101,110,100,105,102,10,10,35,105,102,9,66,66,95,65, + 120,105,115,65,108,105,103,110,101,100,10,118,111,105,100,9,98,98,95,86,101,108,111,99,105,116,121,65,120,105, + 115,65,108,105,103,110,101,100,40,105,110,32,83,80,114,105,109,105,116,105,118,101,115,32,103,73,110,112,117,116, + 44,32,111,117,116,32,118,101,99,51,32,120,65,120,105,115,44,32,111,117,116,32,118,101,99,51,32,121,65,120, + 105,115,44,32,111,117,116,32,118,101,99,51,32,110,65,120,105,115,41,10,123,10,35,105,102,9,9,33,100,101, + 102,105,110,101,100,40,67,79,78,83,84,95,83,99,101,110,101,73,110,102,111,95,66,105,108,108,98,111,97,114, + 100,105,110,103,86,105,101,119,41,10,35,101,114,114,111,114,32,34,77,105,115,115,105,110,103,32,86,105,101,119, + 32,109,97,116,114,105,120,32,105,110,32,83,99,101,110,101,73,110,102,111,34,10,35,101,110,100,105,102,10,9, + 118,101,99,51,9,118,105,101,119,80,111,115,32,61,32,71,69,84,95,77,65,84,82,73,88,95,87,95,65,88, + 73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,66,105,108, + 108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,10,9,118,101,99,51,9,99,97, + 109,84,111,80,97,114,116,105,99,108,101,32,61,32,110,111,114,109,97,108,105,122,101,40,103,73,110,112,117,116, + 46,86,101,114,116,101,120,80,111,115,105,116,105,111,110,46,120,121,122,32,45,32,118,105,101,119,80,111,115,41, + 59,10,9,118,101,99,50,9,114,97,100,105,117,115,32,61,32,103,101,116,95,114,97,100,105,117,115,40,103,73, + 110,112,117,116,41,59,10,9,118,101,99,51,9,115,105,100,101,32,61,32,71,69,84,95,67,79,78,83,84,65, + 78,84,40,83,99,101,110,101,73,110,102,111,44,32,83,105,100,101,86,101,99,116,111,114,41,46,120,121,122,59, + 10,9,118,101,99,51,9,100,101,112,116,104,32,61,32,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99, + 101,110,101,73,110,102,111,44,32,68,101,112,116,104,86,101,99,116,111,114,41,46,120,121,122,59,10,10,9,120, + 65,120,105,115,32,61,32,109,121,67,114,111,115,115,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32, + 103,73,110,112,117,116,46,103,101,111,109,65,120,105,115,48,41,59,10,9,105,102,32,40,100,111,116,40,120,65, + 120,105,115,44,32,120,65,120,105,115,41,32,62,32,78,79,82,77,65,76,73,90,69,82,95,69,80,83,73,76, + 79,78,41,10,9,9,120,65,120,105,115,32,61,32,110,111,114,109,97,108,105,122,101,40,120,65,120,105,115,41, + 59,10,9,101,108,115,101,10,9,123,10,9,9,118,101,99,51,9,118,32,61,32,45,115,105,100,101,32,42,32, + 100,111,116,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,100,101,112,116,104,41,32,43,32,100,101, + 112,116,104,32,42,32,40,100,111,116,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,115,105,100,101, + 41,32,43,32,48,46,48,49,102,41,59,10,9,9,120,65,120,105,115,32,61,32,110,111,114,109,97,108,105,122, + 101,40,109,121,67,114,111,115,115,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,118,41,41,59,10, + 9,9,47,47,32,84,104,105,115,32,105,115,32,99,111,110,115,105,115,116,101,110,116,32,119,105,116,104,32,67, + 80,85,32,98,117,116,32,119,101,32,115,116,105,108,108,32,102,108,105,112,32,116,104,101,32,97,120,105,115,10, + 9,9,47,47,32,116,111,32,99,97,110,99,101,108,32,71,80,85,32,98,98,32,102,108,105,112,44,32,100,117, + 101,32,116,111,32,70,76,73,80,95,66,73,76,76,66,79,65,82,68,73,78,71,95,65,88,73,83,46,10,9, + 9,120,65,120,105,115,32,61,32,45,120,65,120,105,115,59,10,9,125,10,9,120,65,120,105,115,32,42,61,32, + 114,97,100,105,117,115,46,120,59,10,10,9,121,65,120,105,115,32,61,32,103,73,110,112,117,116,46,103,101,111, + 109,65,120,105,115,48,32,42,32,48,46,53,102,59,10,9,110,65,120,105,115,32,61,32,45,99,97,109,84,111, + 80,97,114,116,105,99,108,101,59,10,125,10,35,101,110,100,105,102,10,10,35,105,102,9,66,66,95,65,120,105, + 115,65,108,105,103,110,101,100,83,112,104,101,114,111,105,100,10,118,111,105,100,9,98,98,95,86,101,108,111,99, + 105,116,121,83,112,104,101,114,111,105,100,97,108,65,108,105,103,110,40,105,110,32,83,80,114,105,109,105,116,105, + 118,101,115,32,103,73,110,112,117,116,44,32,111,117,116,32,118,101,99,51,32,120,65,120,105,115,44,32,111,117, + 116,32,118,101,99,51,32,121,65,120,105,115,44,32,111,117,116,32,118,101,99,51,32,110,65,120,105,115,41,10, + 123,10,35,105,102,9,9,33,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99,101,110,101,73,110,102, + 111,95,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,10,35,101,114,114,111,114,32,34,77,105, + 115,115,105,110,103,32,86,105,101,119,32,109,97,116,114,105,120,32,105,110,32,83,99,101,110,101,73,110,102,111, + 34,10,35,101,110,100,105,102,10,9,118,101,99,51,9,118,105,101,119,80,111,115,32,61,32,71,69,84,95,77, + 65,84,82,73,88,95,87,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110, + 101,73,110,102,111,44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59, + 10,10,9,118,101,99,51,9,99,97,109,84,111,80,97,114,116,105,99,108,101,32,61,32,110,111,114,109,97,108, + 105,122,101,40,103,73,110,112,117,116,46,86,101,114,116,101,120,80,111,115,105,116,105,111,110,46,120,121,122,32, + 45,32,118,105,101,119,80,111,115,41,59,10,9,118,101,99,50,9,114,97,100,105,117,115,32,61,32,103,101,116, + 95,114,97,100,105,117,115,40,103,73,110,112,117,116,41,59,10,9,118,101,99,51,9,115,105,100,101,32,61,32, + 71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,83,105,100,101,86,101, + 99,116,111,114,41,46,120,121,122,59,10,9,118,101,99,51,9,100,101,112,116,104,32,61,32,71,69,84,95,67, + 79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,68,101,112,116,104,86,101,99,116,111,114, + 41,46,120,121,122,59,10,10,9,118,101,99,51,9,115,105,100,101,86,101,99,32,61,32,109,121,67,114,111,115, + 115,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,103,73,110,112,117,116,46,103,101,111,109,65,120, + 105,115,48,41,59,10,9,105,102,32,40,100,111,116,40,115,105,100,101,86,101,99,44,32,115,105,100,101,86,101, + 99,41,32,62,32,78,79,82,77,65,76,73,90,69,82,95,69,80,83,73,76,79,78,41,10,9,9,115,105,100, + 101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,115,105,100,101,86,101,99,41,59,10,9,101,108, + 115,101,10,9,123,10,9,9,118,101,99,51,9,118,32,61,32,45,115,105,100,101,32,42,32,100,111,116,40,99, + 97,109,84,111,80,97,114,116,105,99,108,101,44,32,100,101,112,116,104,41,32,43,32,100,101,112,116,104,32,42, + 32,40,100,111,116,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,115,105,100,101,41,32,43,32,48, + 46,48,49,102,41,59,10,9,9,115,105,100,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,109, + 121,67,114,111,115,115,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,118,41,41,59,10,9,9,47, + 47,32,84,104,105,115,32,99,111,109,112,117,116,97,116,105,111,110,32,105,115,32,99,111,110,115,105,115,116,101, + 110,116,32,119,105,116,104,32,67,80,85,32,66,85,84,32,119,101,32,102,108,105,112,32,116,104,101,32,97,120, + 105,115,10,9,9,47,47,32,116,111,32,99,97,110,99,101,108,32,71,80,85,32,98,98,32,102,108,105,112,44, + 32,100,117,101,32,116,111,32,70,76,73,80,95,66,73,76,76,66,79,65,82,68,73,78,71,95,65,88,73,83, + 46,10,9,9,115,105,100,101,86,101,99,32,61,32,45,115,105,100,101,86,101,99,59,10,9,125,10,9,115,105, + 100,101,86,101,99,32,42,61,32,114,97,100,105,117,115,46,120,59,10,10,9,120,65,120,105,115,32,61,32,115, + 105,100,101,86,101,99,59,10,9,121,65,120,105,115,32,61,32,103,73,110,112,117,116,46,103,101,111,109,65,120, + 105,115,48,32,42,32,48,46,53,102,32,43,32,109,121,67,114,111,115,115,40,115,105,100,101,86,101,99,44,32, + 99,97,109,84,111,80,97,114,116,105,99,108,101,41,59,10,9,47,47,32,87,97,114,110,105,110,103,58,32,120, + 65,120,105,115,32,97,110,100,32,121,65,120,105,115,32,97,114,101,32,110,111,116,32,111,114,116,104,111,103,111, + 110,97,108,46,10,9,110,65,120,105,115,32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114,111,115, + 115,40,120,65,120,105,115,44,32,121,65,120,105,115,41,41,59,10,125,10,35,101,110,100,105,102,10,10,35,105, + 102,9,66,66,95,80,108,97,110,101,65,108,105,103,110,101,100,10,118,111,105,100,9,98,98,95,80,108,97,110, + 97,114,65,108,105,103,110,101,100,81,117,97,100,40,105,110,32,83,80,114,105,109,105,116,105,118,101,115,32,103, + 73,110,112,117,116,44,32,111,117,116,32,118,101,99,51,32,120,65,120,105,115,44,32,111,117,116,32,118,101,99, + 51,32,121,65,120,105,115,44,32,111,117,116,32,118,101,99,51,32,110,65,120,105,115,41,10,123,10,9,118,101, + 99,51,9,99,101,110,116,101,114,32,61,32,103,73,110,112,117,116,46,86,101,114,116,101,120,80,111,115,105,116, + 105,111,110,46,120,121,122,59,10,9,118,101,99,51,9,97,120,105,115,95,102,119,100,32,61,32,103,73,110,112, + 117,116,46,103,101,111,109,65,120,105,115,48,59,10,9,118,101,99,51,9,97,120,105,115,95,110,114,109,32,61, + 32,103,73,110,112,117,116,46,103,101,111,109,65,120,105,115,49,59,10,9,118,101,99,51,9,115,105,100,101,32, + 61,32,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,83,105,100,101, + 86,101,99,116,111,114,41,46,120,121,122,59,10,9,118,101,99,51,9,100,101,112,116,104,32,61,32,71,69,84, + 95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,68,101,112,116,104,86,101,99,116, + 111,114,41,46,120,121,122,59,10,10,9,120,65,120,105,115,32,61,32,109,121,67,114,111,115,115,40,97,120,105, + 115,95,110,114,109,44,32,97,120,105,115,95,102,119,100,41,59,10,9,105,102,32,40,100,111,116,40,120,65,120, + 105,115,44,32,120,65,120,105,115,41,32,62,32,78,79,82,77,65,76,73,90,69,82,95,69,80,83,73,76,79, + 78,41,10,9,9,120,65,120,105,115,32,61,32,110,111,114,109,97,108,105,122,101,40,120,65,120,105,115,41,59, + 10,9,101,108,115,101,10,9,123,10,9,9,118,101,99,51,9,118,32,61,32,45,115,105,100,101,32,42,32,100, + 111,116,40,97,120,105,115,95,110,114,109,44,32,100,101,112,116,104,41,32,43,32,100,101,112,116,104,32,42,32, + 40,100,111,116,40,97,120,105,115,95,110,114,109,44,32,115,105,100,101,41,32,43,32,48,46,48,49,102,41,59, + 10,9,9,47,47,32,99,114,111,115,115,40,41,44,32,110,111,116,32,109,121,67,114,111,115,115,40,41,58,32, + 105,110,32,98,105,108,108,98,111,97,114,100,115,95,112,108,97,110,97,114,95,113,117,97,100,46,99,112,112,44, + 32,102,97,108,108,98,97,99,107,32,97,120,105,115,32,105,103,110,111,114,101,115,32,116,104,101,32,104,97,110, + 100,101,100,110,101,115,115,10,9,9,120,65,120,105,115,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114, + 111,115,115,40,97,120,105,115,95,110,114,109,44,32,118,41,41,59,10,9,9,47,47,32,84,104,105,115,32,99, + 111,109,112,117,116,97,116,105,111,110,32,105,115,32,99,111,110,115,105,115,116,101,110,116,32,119,105,116,104,32, + 67,80,85,32,66,85,84,32,119,101,32,102,108,105,112,32,116,104,101,32,97,120,105,115,10,9,9,47,47,32, + 116,111,32,99,97,110,99,101,108,32,71,80,85,32,98,98,32,102,108,105,112,44,32,100,117,101,32,116,111,32, + 70,76,73,80,95,66,73,76,76,66,79,65,82,68,73,78,71,95,65,88,73,83,46,10,9,9,120,65,120,105, + 115,32,61,32,45,120,65,120,105,115,59,10,9,125,10,9,121,65,120,105,115,32,61,32,109,121,67,114,111,115, + 115,40,120,65,120,105,115,44,32,97,120,105,115,95,110,114,109,41,59,10,9,114,111,116,97,116,101,95,97,120, + 105,115,40,103,73,110,112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,41,59,10,10,9,118,101, + 99,50,9,114,97,100,105,117,115,32,61,32,103,101,116,95,114,97,100,105,117,115,40,103,73,110,112,117,116,41, + 59,10,9,120,65,120,105,115,32,42,61,32,114,97,100,105,117,115,46,120,59,10,9,121,65,120,105,115,32,42, + 61,32,114,97,100,105,117,115,46,121,59,10,9,110,65,120,105,115,32,61,32,97,120,105,115,95,110,114,109,59, + 10,10,9,47,47,32,83,112,101,99,105,102,105,99,32,116,111,32,112,108,97,110,97,114,32,97,108,105,103,110, + 101,100,32,113,117,97,100,115,44,32,102,108,105,112,32,88,10,9,120,65,120,105,115,32,61,32,45,120,65,120, + 105,115,59,10,125,10,35,101,110,100,105,102,10,10,35,105,102,9,66,66,95,65,120,105,115,65,108,105,103,110, + 101,100,67,97,112,115,117,108,101,10,118,111,105,100,9,98,98,95,86,101,108,111,99,105,116,121,67,97,112,115, + 117,108,101,65,108,105,103,110,40,105,110,32,83,80,114,105,109,105,116,105,118,101,115,32,103,73,110,112,117,116, + 44,32,111,117,116,32,118,101,99,51,32,120,65,120,105,115,44,32,111,117,116,32,118,101,99,51,32,121,65,120, + 105,115,44,32,111,117,116,32,118,101,99,51,32,117,112,86,101,99,44,32,111,117,116,32,118,101,99,51,32,110, + 65,120,105,115,41,10,123,10,35,105,102,9,9,33,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99, + 101,110,101,73,110,102,111,95,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,10,35,101,114,114, + 111,114,32,34,77,105,115,115,105,110,103,32,86,105,101,119,32,109,97,116,114,105,120,32,105,110,32,83,99,101, + 110,101,73,110,102,111,34,10,35,101,110,100,105,102,10,9,118,101,99,51,9,118,105,101,119,80,111,115,32,61, + 32,71,69,84,95,77,65,84,82,73,88,95,87,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78, + 84,40,83,99,101,110,101,73,110,102,111,44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41, + 41,46,120,121,122,59,10,10,9,118,101,99,51,9,99,97,109,84,111,80,97,114,116,105,99,108,101,32,61,32, + 110,111,114,109,97,108,105,122,101,40,103,73,110,112,117,116,46,86,101,114,116,101,120,80,111,115,105,116,105,111, + 110,46,120,121,122,32,45,32,118,105,101,119,80,111,115,41,59,10,9,118,101,99,50,9,114,97,100,105,117,115, + 32,61,32,103,101,116,95,114,97,100,105,117,115,40,103,73,110,112,117,116,41,59,10,9,118,101,99,51,9,115, + 105,100,101,32,61,32,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32, + 83,105,100,101,86,101,99,116,111,114,41,46,120,121,122,59,10,9,118,101,99,51,9,100,101,112,116,104,32,61, + 32,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,68,101,112,116,104, + 86,101,99,116,111,114,41,46,120,121,122,59,10,10,9,118,101,99,51,9,115,105,100,101,86,101,99,32,61,32, + 109,121,67,114,111,115,115,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,103,73,110,112,117,116,46, + 103,101,111,109,65,120,105,115,48,41,59,10,9,105,102,32,40,100,111,116,40,115,105,100,101,86,101,99,44,32, + 115,105,100,101,86,101,99,41,32,62,32,78,79,82,77,65,76,73,90,69,82,95,69,80,83,73,76,79,78,41, + 10,9,9,115,105,100,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,115,105,100,101,86,101,99, + 41,59,10,9,101,108,115,101,10,9,123,10,9,9,118,101,99,51,9,118,32,61,32,45,115,105,100,101,32,42, + 32,100,111,116,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,100,101,112,116,104,41,32,43,32,100, + 101,112,116,104,32,42,32,40,100,111,116,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,115,105,100, + 101,41,32,43,32,48,46,48,49,102,41,59,10,9,9,115,105,100,101,86,101,99,32,61,32,110,111,114,109,97, + 108,105,122,101,40,109,121,67,114,111,115,115,40,99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,118,41, + 41,59,10,9,9,47,47,32,84,104,105,115,32,99,111,109,112,117,116,97,116,105,111,110,32,105,115,32,99,111, + 110,115,105,115,116,101,110,116,32,119,105,116,104,32,67,80,85,32,66,85,84,32,119,101,32,102,108,105,112,32, + 116,104,101,32,97,120,105,115,10,9,9,47,47,32,116,111,32,99,97,110,99,101,108,32,71,80,85,32,98,98, + 32,102,108,105,112,44,32,100,117,101,32,116,111,32,70,76,73,80,95,66,73,76,76,66,79,65,82,68,73,78, + 71,95,65,88,73,83,46,10,9,9,115,105,100,101,86,101,99,32,61,32,45,115,105,100,101,86,101,99,59,10, + 9,125,10,9,115,105,100,101,86,101,99,32,42,61,32,115,113,114,116,40,50,46,102,41,32,42,32,114,97,100, + 105,117,115,46,120,59,10,10,9,117,112,86,101,99,32,61,32,109,121,67,114,111,115,115,40,115,105,100,101,86, + 101,99,44,32,99,97,109,84,111,80,97,114,116,105,99,108,101,41,59,10,9,120,65,120,105,115,32,61,32,115, + 105,100,101,86,101,99,59,10,35,105,102,32,70,76,73,80,95,66,73,76,76,66,79,65,82,68,73,78,71,95, + 65,88,73,83,10,9,120,65,120,105,115,32,42,61,32,45,49,46,48,102,59,10,35,101,110,100,105,102,10,9, + 121,65,120,105,115,32,61,32,103,73,110,112,117,116,46,103,101,111,109,65,120,105,115,48,32,42,32,48,46,53, + 102,59,10,9,110,65,120,105,115,32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114,111,115,115,40, + 115,105,100,101,86,101,99,44,32,121,65,120,105,115,41,41,59,10,125,10,35,101,110,100,105,102,10,10,118,111, + 105,100,9,98,105,108,108,98,111,97,114,100,95,113,117,97,100,40,105,110,32,83,80,114,105,109,105,116,105,118, + 101,115,32,103,73,110,112,117,116,44,32,117,105,110,116,32,98,98,44,32,111,117,116,32,118,101,99,51,32,120, + 65,120,105,115,44,32,111,117,116,32,118,101,99,51,32,121,65,120,105,115,44,32,111,117,116,32,118,101,99,51, + 32,110,65,120,105,115,41,10,123,10,35,105,102,32,48,10,9,98,98,95,83,99,114,101,101,110,65,108,105,103, + 110,101,100,81,117,97,100,40,103,73,110,112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32, + 110,65,120,105,115,41,59,10,35,101,108,115,101,10,9,115,119,105,116,99,104,32,40,98,98,41,10,9,123,10, + 35,105,102,32,66,66,95,83,99,114,101,101,110,65,108,105,103,110,101,100,10,9,99,97,115,101,32,66,66,95, + 83,99,114,101,101,110,65,108,105,103,110,101,100,58,10,9,9,98,98,95,83,99,114,101,101,110,65,108,105,103, + 110,101,100,81,117,97,100,40,103,73,110,112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32, + 110,65,120,105,115,41,59,10,9,9,98,114,101,97,107,59,10,35,101,110,100,105,102,10,35,105,102,32,66,66, + 95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,10,9,99,97,115,101,32,66,66,95,86,105,101,119,112, + 111,115,65,108,105,103,110,101,100,58,10,9,9,98,98,95,86,105,101,119,112,111,115,65,108,105,103,110,101,100, + 81,117,97,100,40,103,73,110,112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32,110,65,120, + 105,115,41,59,10,9,9,98,114,101,97,107,59,10,35,101,110,100,105,102,10,35,105,102,32,66,66,95,65,120, + 105,115,65,108,105,103,110,101,100,10,9,99,97,115,101,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100, + 58,10,9,9,98,98,95,86,101,108,111,99,105,116,121,65,120,105,115,65,108,105,103,110,101,100,40,103,73,110, + 112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32,110,65,120,105,115,41,59,10,9,9,98, + 114,101,97,107,59,10,35,101,110,100,105,102,10,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101, + 100,83,112,104,101,114,111,105,100,10,9,99,97,115,101,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100, + 83,112,104,101,114,111,105,100,58,10,9,9,98,98,95,86,101,108,111,99,105,116,121,83,112,104,101,114,111,105, + 100,97,108,65,108,105,103,110,40,103,73,110,112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44, + 32,110,65,120,105,115,41,59,10,9,9,98,114,101,97,107,59,10,35,101,110,100,105,102,10,35,105,102,32,66, + 66,95,80,108,97,110,101,65,108,105,103,110,101,100,10,9,99,97,115,101,32,66,66,95,80,108,97,110,101,65, + 108,105,103,110,101,100,58,10,9,9,98,98,95,80,108,97,110,97,114,65,108,105,103,110,101,100,81,117,97,100, + 40,103,73,110,112,117,116,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32,110,65,120,105,115,41,59, + 10,9,9,98,114,101,97,107,59,10,35,101,110,100,105,102,10,9,100,101,102,97,117,108,116,58,10,9,9,98, + 98,95,83,99,114,101,101,110,65,108,105,103,110,101,100,81,117,97,100,40,103,73,110,112,117,116,44,32,120,65, + 120,105,115,44,32,121,65,120,105,115,44,32,110,65,120,105,115,41,59,10,9,9,98,114,101,97,107,59,10,9, + 125,10,35,101,110,100,105,102,10,35,105,102,32,70,76,73,80,95,66,73,76,76,66,79,65,82,68,73,78,71, + 95,65,88,73,83,10,9,121,65,120,105,115,32,42,61,32,45,49,46,48,102,59,32,47,47,32,87,101,32,110, + 101,101,100,32,116,111,32,102,108,105,112,32,116,104,101,32,121,32,97,120,105,115,32,116,111,32,103,101,116,32, + 116,104,101,32,115,97,109,101,32,114,101,115,117,108,116,32,97,115,32,116,104,101,32,67,80,85,32,98,105,108, + 108,98,111,97,114,100,101,114,115,10,35,101,110,100,105,102,10,125,10,10,118,101,99,52,9,112,114,111,106,95, + 112,111,115,105,116,105,111,110,40,118,101,99,51,32,112,111,115,105,116,105,111,110,41,10,123,10,35,105,102,9, + 9,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99,101,110,101,73,110,102,111,95,86,105,101,119,80, + 114,111,106,41,10,9,114,101,116,117,114,110,32,109,117,108,40,71,69,84,95,67,79,78,83,84,65,78,84,40, + 83,99,101,110,101,73,110,102,111,44,32,86,105,101,119,80,114,111,106,41,44,32,118,101,99,52,40,112,111,115, + 105,116,105,111,110,44,32,49,46,48,102,41,41,59,10,35,101,108,115,101,10,9,114,101,116,117,114,110,32,118, + 101,99,52,40,112,111,115,105,116,105,111,110,44,32,49,46,48,102,41,59,10,35,101,110,100,105,102,10,125,10, + 10,35,105,102,32,9,100,101,102,105,110,101,100,40,71,79,85,84,80,85,84,95,102,114,97,103,85,86,48,41, + 32,38,38,32,100,101,102,105,110,101,100,40,71,79,85,84,80,85,84,95,102,114,97,103,85,86,49,41,10,118, + 111,105,100,9,98,98,95,98,105,108,108,98,111,97,114,100,85,86,40,105,110,32,83,80,114,105,109,105,116,105, + 118,101,115,32,103,73,110,112,117,116,44,32,105,110,111,117,116,32,118,101,99,52,32,99,48,48,44,32,105,110, + 111,117,116,32,118,101,99,52,32,99,48,49,44,32,105,110,111,117,116,32,118,101,99,52,32,99,49,48,44,32, + 105,110,111,117,116,32,118,101,99,52,32,99,49,49,44,32,105,110,111,117,116,32,102,108,111,97,116,32,97,116, + 108,97,115,73,100,44,32,105,110,111,117,116,32,118,101,99,52,32,114,101,99,116,65,44,32,105,110,111,117,116, + 32,118,101,99,52,32,114,101,99,116,66,41,10,35,101,108,115,101,10,118,111,105,100,9,98,98,95,98,105,108, + 108,98,111,97,114,100,85,86,40,105,110,32,83,80,114,105,109,105,116,105,118,101,115,32,103,73,110,112,117,116, + 44,32,105,110,111,117,116,32,118,101,99,50,32,99,48,48,44,32,105,110,111,117,116,32,118,101,99,50,32,99, + 48,49,44,32,105,110,111,117,116,32,118,101,99,50,32,99,49,48,44,32,105,110,111,117,116,32,118,101,99,50, + 32,99,49,49,44,32,105,110,111,117,116,32,118,101,99,52,32,114,101,99,116,65,41,10,35,101,110,100,105,102, + 10,123,10,9,117,105,110,116,9,100,114,73,100,32,61,32,97,115,117,105,110,116,40,103,73,110,112,117,116,46, + 86,101,114,116,101,120,80,111,115,105,116,105,111,110,46,119,41,59,10,9,117,105,110,116,9,102,108,97,103,115, + 32,61,32,97,115,117,105,110,116,40,71,69,84,95,67,79,78,83,84,65,78,84,40,66,105,108,108,98,111,97, + 114,100,73,110,102,111,44,32,68,114,97,119,82,101,113,117,101,115,116,41,91,100,114,73,100,93,46,120,41,59, + 10,35,105,102,32,66,66,95,70,101,97,116,117,114,101,95,65,116,108,97,115,10,9,102,108,111,97,116,9,105, + 100,102,32,61,32,103,73,110,112,117,116,46,103,101,111,109,65,116,108,97,115,95,84,101,120,116,117,114,101,73, + 68,59,10,9,117,105,110,116,9,109,97,120,65,116,108,97,115,73,100,120,32,61,32,76,79,65,68,85,40,71, + 69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,116,108,97,115,41,44,32,82,65,87,95,66,85,70,70, + 69,82,95,73,78,68,69,88,40,48,41,41,32,45,32,49,85,59,10,9,117,105,110,116,9,105,100,65,32,61, + 32,109,105,110,40,117,105,110,116,40,102,108,111,111,114,40,105,100,102,41,41,44,32,109,97,120,65,116,108,97, + 115,73,100,120,41,59,10,9,114,101,99,116,65,32,61,32,76,79,65,68,70,52,40,71,69,84,95,82,65,87, + 95,66,85,70,70,69,82,40,65,116,108,97,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68, + 69,88,40,105,100,65,32,42,32,52,32,43,32,49,41,41,59,10,35,9,105,102,32,100,101,102,105,110,101,100, + 40,71,79,85,84,80,85,84,95,102,114,97,103,85,86,49,41,10,9,117,105,110,116,9,105,100,66,32,61,32, + 109,105,110,40,105,100,65,32,43,32,49,85,44,32,109,97,120,65,116,108,97,115,73,100,120,41,59,10,9,114, + 101,99,116,66,32,61,32,76,79,65,68,70,52,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65, + 116,108,97,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,105,100,66,32,42,32, + 52,32,43,32,49,41,41,59,10,9,118,101,99,52,9,109,97,100,100,109,32,61,32,118,101,99,52,40,114,101, + 99,116,65,46,120,121,44,32,114,101,99,116,66,46,120,121,41,59,10,9,118,101,99,52,9,109,97,100,100,97, + 32,61,32,118,101,99,52,40,114,101,99,116,65,46,122,119,44,32,114,101,99,116,66,46,122,119,41,59,10,9, + 102,108,111,97,116,9,98,108,101,110,100,87,101,105,103,104,116,32,61,32,40,102,108,97,103,115,32,38,32,66, + 66,95,70,108,97,103,95,83,111,102,116,65,110,105,109,66,108,101,110,100,41,32,33,61,32,48,85,32,63,32, + 49,46,48,102,32,58,32,48,46,48,102,59,10,9,97,116,108,97,115,73,100,32,61,32,102,114,97,99,116,40, + 105,100,102,41,32,42,32,98,108,101,110,100,87,101,105,103,104,116,59,10,35,9,101,108,115,101,10,9,118,101, + 99,50,9,109,97,100,100,109,32,61,32,114,101,99,116,65,46,120,121,59,10,9,118,101,99,50,9,109,97,100, + 100,97,32,61,32,114,101,99,116,65,46,122,119,59,10,35,9,101,110,100,105,102,10,9,99,48,48,32,61,32, + 99,48,48,32,42,32,109,97,100,100,109,32,43,32,109,97,100,100,97,59,10,9,99,48,49,32,61,32,99,48, + 49,32,42,32,109,97,100,100,109,32,43,32,109,97,100,100,97,59,10,9,99,49,48,32,61,32,99,49,48,32, + 42,32,109,97,100,100,109,32,43,32,109,97,100,100,97,59,10,9,99,49,49,32,61,32,99,49,49,32,42,32, + 109,97,100,100,109,32,43,32,109,97,100,100,97,59,10,35,101,110,100,105,102,10,10,9,105,102,32,40,40,102, + 108,97,103,115,32,38,32,66,66,95,70,108,97,103,95,70,108,105,112,86,41,32,33,61,32,48,85,41,10,9, + 123,10,9,9,115,119,97,112,40,99,48,48,44,32,99,48,49,41,59,10,9,9,115,119,97,112,40,99,49,48, + 44,32,99,49,49,41,59,10,9,125,10,9,105,102,32,40,40,102,108,97,103,115,32,38,32,66,66,95,70,108, + 97,103,95,70,108,105,112,85,41,32,33,61,32,48,85,41,10,9,123,10,9,9,115,119,97,112,40,99,48,48, + 44,32,99,49,48,41,59,10,9,9,115,119,97,112,40,99,48,49,44,32,99,49,49,41,59,10,9,125,10,125, + 10,10,118,111,105,100,9,98,98,95,98,105,108,108,98,111,97,114,100,78,111,114,109,97,108,40,10,9,102,108, + 111,97,116,32,110,70,97,99,116,111,114,44,10,9,111,117,116,32,118,101,99,51,32,110,48,44,32,111,117,116, + 32,118,101,99,51,32,110,49,44,32,111,117,116,32,118,101,99,51,32,110,50,44,32,111,117,116,32,118,101,99, + 51,32,110,51,44,10,9,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117, + 108,101,10,9,111,117,116,32,118,101,99,51,32,110,52,44,32,111,117,116,32,118,101,99,51,32,110,53,44,10, + 9,35,101,110,100,105,102,10,9,105,110,32,118,101,99,51,32,120,65,120,105,115,44,32,105,110,32,118,101,99, + 51,32,121,65,120,105,115,44,32,105,110,32,118,101,99,51,32,110,65,120,105,115,41,10,123,10,9,102,108,111, + 97,116,9,110,119,32,61,32,40,49,46,48,102,32,45,32,110,70,97,99,116,111,114,41,59,32,47,47,32,119, + 101,105,103,104,116,10,9,118,101,99,51,9,120,65,120,105,115,78,111,114,109,32,61,32,110,111,114,109,97,108, + 105,122,101,40,120,65,120,105,115,41,59,10,9,118,101,99,51,9,121,65,120,105,115,78,111,114,109,32,61,32, + 110,111,114,109,97,108,105,122,101,40,121,65,120,105,115,41,59,10,9,118,101,99,51,9,110,32,61,32,110,65, + 120,105,115,32,42,32,110,119,59,32,47,47,32,110,111,114,109,97,108,32,119,101,105,103,104,116,101,100,10,10, + 9,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,10,9,102,108, + 111,97,116,9,114,108,101,110,32,61,32,114,115,113,114,116,40,110,119,32,42,32,110,119,32,43,32,110,70,97, + 99,116,111,114,32,42,32,110,70,97,99,116,111,114,41,59,10,9,120,65,120,105,115,78,111,114,109,32,42,61, + 32,110,70,97,99,116,111,114,32,42,32,114,108,101,110,59,10,9,121,65,120,105,115,78,111,114,109,32,42,61, + 32,110,70,97,99,116,111,114,32,42,32,114,108,101,110,59,10,9,110,32,42,61,32,114,108,101,110,59,10,9, + 110,48,32,61,32,110,32,43,32,120,65,120,105,115,78,111,114,109,59,10,9,110,49,32,61,32,110,32,45,32, + 120,65,120,105,115,78,111,114,109,59,10,9,110,50,32,61,32,110,32,43,32,120,65,120,105,115,78,111,114,109, + 59,10,9,110,51,32,61,32,110,32,45,32,120,65,120,105,115,78,111,114,109,59,10,9,110,52,32,61,32,110, + 32,45,32,121,65,120,105,115,78,111,114,109,59,10,9,110,53,32,61,32,110,32,43,32,121,65,120,105,115,78, + 111,114,109,59,10,9,35,101,108,115,101,10,9,118,101,99,51,9,120,112,121,32,61,32,40,120,65,120,105,115, + 78,111,114,109,32,43,32,121,65,120,105,115,78,111,114,109,41,32,42,32,110,70,97,99,116,111,114,59,10,9, + 118,101,99,51,9,120,109,121,32,61,32,40,120,65,120,105,115,78,111,114,109,32,45,32,121,65,120,105,115,78, + 111,114,109,41,32,42,32,110,70,97,99,116,111,114,59,10,9,110,48,32,61,32,110,111,114,109,97,108,105,122, + 101,40,110,32,43,32,120,112,121,41,59,10,9,110,49,32,61,32,110,111,114,109,97,108,105,122,101,40,110,32, + 43,32,120,109,121,41,59,10,9,110,50,32,61,32,110,111,114,109,97,108,105,122,101,40,110,32,45,32,120,109, + 121,41,59,10,9,110,51,32,61,32,110,111,114,109,97,108,105,122,101,40,110,32,45,32,120,112,121,41,59,10, + 9,35,101,110,100,105,102,10,125,10,10,118,111,105,100,9,98,98,95,98,105,108,108,98,111,97,114,100,84,97, + 110,103,101,110,116,40,10,9,102,108,111,97,116,32,110,70,97,99,116,111,114,44,10,9,111,117,116,32,118,101, + 99,52,32,116,48,44,32,111,117,116,32,118,101,99,52,32,116,49,44,32,111,117,116,32,118,101,99,52,32,116, + 50,44,32,111,117,116,32,118,101,99,52,32,116,51,44,10,9,35,105,102,32,66,66,95,65,120,105,115,65,108, + 105,103,110,101,100,67,97,112,115,117,108,101,10,9,111,117,116,32,118,101,99,52,32,116,52,44,32,111,117,116, + 32,118,101,99,52,32,116,53,44,10,9,35,101,110,100,105,102,10,9,105,110,32,118,101,99,51,32,120,65,120, + 105,115,44,32,105,110,32,118,101,99,51,32,121,65,120,105,115,44,32,105,110,32,118,101,99,51,32,110,65,120, + 105,115,44,32,105,110,32,98,111,111,108,32,102,108,105,112,85,44,32,105,110,32,98,111,111,108,32,102,108,105, + 112,86,41,10,123,10,9,102,108,111,97,116,9,110,119,32,61,32,40,49,46,48,102,32,45,32,110,70,97,99, + 116,111,114,41,59,32,47,47,32,119,101,105,103,104,116,10,9,118,101,99,51,9,120,65,120,105,115,78,111,114, + 109,32,61,32,110,111,114,109,97,108,105,122,101,40,120,65,120,105,115,41,59,10,9,118,101,99,51,9,121,65, + 120,105,115,78,111,114,109,32,61,32,110,111,114,109,97,108,105,122,101,40,121,65,120,105,115,41,59,10,9,118, + 101,99,51,9,110,32,61,32,110,65,120,105,115,59,32,47,47,32,110,111,114,109,97,108,10,10,9,35,105,102, + 32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,10,9,118,101,99,51,9,116, + 32,61,32,110,111,114,109,97,108,105,122,101,40,120,65,120,105,115,78,111,114,109,32,43,32,121,65,120,105,115, + 78,111,114,109,41,32,42,32,110,119,59,10,9,102,108,111,97,116,9,114,108,101,110,32,61,32,114,115,113,114, + 116,40,110,119,32,42,32,110,119,32,43,32,50,46,48,102,32,42,32,110,70,97,99,116,111,114,32,42,32,110, + 70,97,99,116,111,114,41,59,10,9,116,32,42,61,32,114,108,101,110,59,10,9,110,32,42,61,32,110,70,97, + 99,116,111,114,32,42,32,114,108,101,110,59,10,9,120,65,120,105,115,78,111,114,109,32,42,61,32,110,70,97, + 99,116,111,114,32,42,32,114,108,101,110,59,10,9,121,65,120,105,115,78,111,114,109,32,42,61,32,110,70,97, + 99,116,111,114,32,42,32,114,108,101,110,59,10,9,102,108,111,97,116,9,116,97,110,103,101,110,116,87,32,61, + 32,102,108,105,112,85,32,33,61,32,102,108,105,112,86,32,63,32,45,49,46,48,102,32,58,32,49,46,48,102, + 59,10,9,102,108,111,97,116,9,116,97,110,103,101,110,116,68,105,114,32,61,32,102,108,105,112,85,32,63,32, + 45,49,46,48,102,32,58,32,49,46,48,102,59,10,9,116,48,32,61,32,118,101,99,52,40,116,32,45,32,110, + 32,43,32,121,65,120,105,115,78,111,114,109,32,42,32,116,97,110,103,101,110,116,68,105,114,44,32,116,97,110, + 103,101,110,116,87,41,59,10,9,116,50,32,61,32,116,48,59,10,9,116,49,32,61,32,118,101,99,52,40,116, + 32,43,32,110,32,43,32,121,65,120,105,115,78,111,114,109,32,42,32,116,97,110,103,101,110,116,68,105,114,44, + 32,116,97,110,103,101,110,116,87,41,59,10,9,116,51,32,61,32,116,49,59,10,9,116,52,32,61,32,118,101, + 99,52,40,116,32,43,32,110,32,43,32,120,65,120,105,115,78,111,114,109,32,42,32,116,97,110,103,101,110,116, + 68,105,114,44,32,116,97,110,103,101,110,116,87,41,59,10,9,116,53,32,61,32,118,101,99,52,40,116,32,45, + 32,110,32,43,32,120,65,120,105,115,78,111,114,109,32,42,32,116,97,110,103,101,110,116,68,105,114,44,32,116, + 97,110,103,101,110,116,87,41,59,10,9,35,101,108,115,101,10,9,118,101,99,51,9,116,32,61,32,120,65,120, + 105,115,78,111,114,109,32,42,32,110,119,59,10,9,110,32,42,61,32,110,70,97,99,116,111,114,59,10,9,120, + 65,120,105,115,78,111,114,109,32,42,61,32,110,70,97,99,116,111,114,59,10,9,121,65,120,105,115,78,111,114, + 109,32,42,61,32,110,70,97,99,116,111,114,59,10,9,102,108,111,97,116,9,116,97,110,103,101,110,116,87,32, + 61,32,102,108,105,112,85,32,33,61,32,102,108,105,112,86,32,63,32,49,46,48,102,32,58,32,45,49,46,48, + 102,59,10,9,102,108,111,97,116,9,116,97,110,103,101,110,116,68,105,114,32,61,32,102,108,105,112,85,32,63, + 32,45,49,46,48,102,32,58,32,49,46,48,102,59,10,9,116,48,32,61,32,118,101,99,52,40,110,111,114,109, + 97,108,105,122,101,40,116,32,45,32,110,32,43,32,120,65,120,105,115,78,111,114,109,32,45,32,121,65,120,105, + 115,78,111,114,109,41,32,42,32,116,97,110,103,101,110,116,68,105,114,44,32,116,97,110,103,101,110,116,87,41, + 59,10,9,116,49,32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40,116,32,45,32,110,32,43, + 32,120,65,120,105,115,78,111,114,109,32,43,32,121,65,120,105,115,78,111,114,109,41,32,42,32,116,97,110,103, + 101,110,116,68,105,114,44,32,116,97,110,103,101,110,116,87,41,59,10,9,116,50,32,61,32,118,101,99,52,40, + 110,111,114,109,97,108,105,122,101,40,116,32,43,32,110,32,43,32,120,65,120,105,115,78,111,114,109,32,43,32, + 121,65,120,105,115,78,111,114,109,41,32,42,32,116,97,110,103,101,110,116,68,105,114,44,32,116,97,110,103,101, + 110,116,87,41,59,10,9,116,51,32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40,116,32,43, + 32,110,32,43,32,120,65,120,105,115,78,111,114,109,32,45,32,121,65,120,105,115,78,111,114,109,41,32,42,32, + 116,97,110,103,101,110,116,68,105,114,44,32,116,97,110,103,101,110,116,87,41,59,10,9,35,101,110,100,105,102, + 10,125,10,10,118,111,105,100,32,9,71,101,111,109,101,116,114,121,66,105,108,108,98,111,97,114,100,40,105,110, + 32,83,71,101,111,109,101,116,114,121,73,110,112,117,116,32,103,73,110,112,117,116,44,32,83,71,101,111,109,101, + 116,114,121,79,117,116,112,117,116,32,103,79,117,116,112,117,116,32,71,83,95,65,82,71,83,41,10,123,10,9, + 117,105,110,116,9,100,114,73,100,32,61,32,97,115,117,105,110,116,40,103,73,110,112,117,116,46,80,114,105,109, + 105,116,105,118,101,115,91,48,93,46,86,101,114,116,101,120,80,111,115,105,116,105,111,110,46,119,41,59,10,9, + 117,105,110,116,9,102,108,97,103,115,32,61,32,97,115,117,105,110,116,40,71,69,84,95,67,79,78,83,84,65, + 78,84,40,66,105,108,108,98,111,97,114,100,73,110,102,111,44,32,68,114,97,119,82,101,113,117,101,115,116,41, + 91,100,114,73,100,93,46,120,41,59,10,9,10,9,98,111,111,108,9,102,108,105,112,85,32,61,32,40,102,108, + 97,103,115,32,38,32,66,66,95,70,108,97,103,95,70,108,105,112,85,41,32,33,61,32,48,85,59,10,9,98, + 111,111,108,9,102,108,105,112,86,32,61,32,40,102,108,97,103,115,32,38,32,66,66,95,70,108,97,103,95,70, + 108,105,112,86,41,32,33,61,32,48,85,59,10,9,102,108,111,97,116,9,116,97,110,103,101,110,116,87,32,61, + 32,49,46,48,102,59,10,9,47,47,32,85,86,10,35,105,102,32,9,100,101,102,105,110,101,100,40,71,79,85, + 84,80,85,84,95,102,114,97,103,85,86,48,41,32,38,38,32,100,101,102,105,110,101,100,40,71,79,85,84,80, + 85,84,95,102,114,97,103,85,86,49,41,10,35,32,100,101,102,105,110,101,9,115,101,116,85,86,48,40,95,117, + 118,44,32,95,118,97,108,117,101,41,9,95,117,118,32,61,32,95,118,97,108,117,101,46,120,121,59,10,35,32, + 100,101,102,105,110,101,9,115,101,116,85,86,49,40,95,117,118,44,32,95,118,97,108,117,101,41,9,95,117,118, + 32,61,32,95,118,97,108,117,101,46,122,119,59,10,9,118,101,99,52,9,99,48,48,32,61,32,118,101,99,52, + 40,48,44,32,48,44,32,48,44,32,48,41,59,10,9,118,101,99,52,9,99,48,49,32,61,32,118,101,99,52, + 40,48,44,32,49,44,32,48,44,32,49,41,59,10,9,118,101,99,52,9,99,49,48,32,61,32,118,101,99,52, + 40,49,44,32,48,44,32,49,44,32,48,41,59,10,9,118,101,99,52,9,99,49,49,32,61,32,118,101,99,52, + 40,49,44,32,49,44,32,49,44,32,49,41,59,10,9,118,101,99,52,9,114,101,99,116,48,32,61,32,118,101, + 99,52,40,48,44,32,48,44,32,48,44,32,48,41,59,10,9,118,101,99,52,9,114,101,99,116,49,32,61,32, + 118,101,99,52,40,48,44,32,48,44,32,48,44,32,48,41,59,59,10,9,98,98,95,98,105,108,108,98,111,97, + 114,100,85,86,40,103,73,110,112,117,116,46,80,114,105,109,105,116,105,118,101,115,91,48,93,44,32,99,48,48, + 44,32,99,48,49,44,32,99,49,48,44,32,99,49,49,44,32,103,79,117,116,112,117,116,46,102,114,97,103,65, + 116,108,97,115,73,68,44,32,114,101,99,116,48,44,32,114,101,99,116,49,41,59,10,35,101,108,105,102,32,9, + 100,101,102,105,110,101,100,40,71,79,85,84,80,85,84,95,102,114,97,103,85,86,48,41,10,35,32,100,101,102, + 105,110,101,9,115,101,116,85,86,48,40,95,117,118,44,32,95,118,97,108,117,101,41,9,95,117,118,32,61,32, + 95,118,97,108,117,101,59,10,35,32,100,101,102,105,110,101,9,115,101,116,85,86,49,40,95,117,118,44,32,95, + 118,97,108,117,101,41,10,9,118,101,99,50,9,99,48,48,32,61,32,118,101,99,50,40,48,44,32,48,41,59, + 10,9,118,101,99,50,9,99,48,49,32,61,32,118,101,99,50,40,48,44,32,49,41,59,10,9,118,101,99,50, + 9,99,49,48,32,61,32,118,101,99,50,40,49,44,32,48,41,59,10,9,118,101,99,50,9,99,49,49,32,61, + 32,118,101,99,50,40,49,44,32,49,41,59,10,9,118,101,99,52,9,114,101,99,116,48,32,61,32,118,101,99, + 52,40,48,44,32,48,44,32,48,44,32,48,41,59,10,9,98,98,95,98,105,108,108,98,111,97,114,100,85,86, + 40,103,73,110,112,117,116,46,80,114,105,109,105,116,105,118,101,115,91,48,93,44,32,99,48,48,44,32,99,48, + 49,44,32,99,49,48,44,32,99,49,49,44,32,114,101,99,116,48,41,59,10,35,101,108,115,101,10,35,32,100, + 101,102,105,110,101,9,115,101,116,85,86,48,40,95,117,118,44,32,95,118,97,108,117,101,41,10,35,32,100,101, + 102,105,110,101,9,115,101,116,85,86,49,40,95,117,118,44,32,95,118,97,108,117,101,41,10,35,101,110,100,105, + 102,10,10,9,47,47,32,65,120,105,115,32,121,47,120,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32, + 113,117,97,100,32,43,32,110,111,114,109,97,108,10,9,118,101,99,51,9,99,101,110,116,101,114,32,61,32,103, + 73,110,112,117,116,46,80,114,105,109,105,116,105,118,101,115,91,48,93,46,86,101,114,116,101,120,80,111,115,105, + 116,105,111,110,46,120,121,122,59,10,9,118,101,99,51,9,120,65,120,105,115,32,61,32,118,101,99,51,40,48, + 44,32,48,44,32,48,41,59,10,9,118,101,99,51,9,121,65,120,105,115,32,61,32,118,101,99,51,40,48,44, + 32,48,44,32,48,41,59,10,9,118,101,99,51,9,110,65,120,105,115,32,61,32,118,101,99,51,40,48,44,32, + 48,44,32,48,41,59,10,10,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115, + 117,108,101,10,9,118,101,99,51,9,117,112,86,101,99,32,61,32,118,101,99,51,40,48,44,32,48,44,32,48, + 41,59,10,9,98,98,95,86,101,108,111,99,105,116,121,67,97,112,115,117,108,101,65,108,105,103,110,40,103,73, + 110,112,117,116,46,80,114,105,109,105,116,105,118,101,115,91,48,93,44,32,120,65,120,105,115,44,32,121,65,120, + 105,115,44,32,117,112,86,101,99,44,32,110,65,120,105,115,41,59,10,35,101,108,115,101,10,9,98,105,108,108, + 98,111,97,114,100,95,113,117,97,100,40,103,73,110,112,117,116,46,80,114,105,109,105,116,105,118,101,115,91,48, + 93,44,32,102,108,97,103,115,32,38,32,66,66,95,70,108,97,103,95,66,105,108,108,98,111,97,114,100,77,97, + 115,107,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32,110,65,120,105,115,41,59,10,35,101,110,100, + 105,102,10,10,9,118,101,99,51,9,120,112,121,32,61,32,120,65,120,105,115,32,43,32,121,65,120,105,115,59, + 10,9,118,101,99,51,9,120,109,121,32,61,32,120,65,120,105,115,32,45,32,121,65,120,105,115,59,10,10,9, + 47,47,32,102,114,97,103,86,105,101,119,80,114,111,106,80,111,115,105,116,105,111,110,10,35,105,102,9,9,100, + 101,102,105,110,101,100,40,71,79,85,84,80,85,84,95,102,114,97,103,86,105,101,119,80,114,111,106,80,111,115, + 105,116,105,111,110,41,10,9,35,100,101,102,105,110,101,9,115,101,116,86,105,101,119,80,114,111,106,80,111,115, + 105,116,105,111,110,40,95,112,111,115,105,116,105,111,110,44,32,95,118,97,108,117,101,41,9,95,112,111,115,105, + 116,105,111,110,32,61,32,95,118,97,108,117,101,59,10,35,101,108,115,101,10,9,35,100,101,102,105,110,101,9, + 115,101,116,86,105,101,119,80,114,111,106,80,111,115,105,116,105,111,110,40,95,112,111,115,105,116,105,111,110,44, + 32,95,118,97,108,117,101,41,10,35,101,110,100,105,102,10,10,9,47,47,32,102,114,97,103,87,111,114,108,100, + 80,111,115,105,116,105,111,110,10,35,105,102,9,9,100,101,102,105,110,101,100,40,71,79,85,84,80,85,84,95, + 102,114,97,103,87,111,114,108,100,80,111,115,105,116,105,111,110,41,10,9,35,100,101,102,105,110,101,9,115,101, + 116,87,111,114,108,100,80,111,115,105,116,105,111,110,40,95,112,111,115,105,116,105,111,110,44,32,95,118,97,108, + 117,101,41,9,9,95,112,111,115,105,116,105,111,110,32,61,32,95,118,97,108,117,101,59,10,35,101,108,115,101, + 10,9,35,100,101,102,105,110,101,9,115,101,116,87,111,114,108,100,80,111,115,105,116,105,111,110,40,95,112,111, + 115,105,116,105,111,110,44,32,95,118,97,108,117,101,41,10,35,101,110,100,105,102,10,10,35,105,102,9,9,100, + 101,102,105,110,101,100,40,71,79,85,84,80,85,84,95,102,114,97,103,78,111,114,109,97,108,41,32,124,124,32, + 100,101,102,105,110,101,100,40,71,79,85,84,80,85,84,95,102,114,97,103,84,97,110,103,101,110,116,41,10,9, + 102,108,111,97,116,9,110,70,97,99,116,111,114,32,61,32,71,69,84,95,67,79,78,83,84,65,78,84,40,66, + 105,108,108,98,111,97,114,100,73,110,102,111,44,32,68,114,97,119,82,101,113,117,101,115,116,41,91,100,114,73, + 100,93,46,121,59,10,35,101,110,100,105,102,10,10,9,47,47,32,78,111,114,109,97,108,115,10,35,105,102,9, + 9,100,101,102,105,110,101,100,40,71,79,85,84,80,85,84,95,102,114,97,103,78,111,114,109,97,108,41,10,35, + 100,101,102,105,110,101,9,115,101,116,78,111,114,109,97,108,40,95,110,111,114,109,97,108,44,32,95,118,97,108, + 117,101,41,9,95,110,111,114,109,97,108,32,61,32,95,118,97,108,117,101,59,10,9,118,101,99,51,9,110,48, + 44,32,110,49,44,32,110,50,44,32,110,51,59,10,9,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103, + 110,101,100,67,97,112,115,117,108,101,10,9,9,118,101,99,51,9,110,52,44,32,110,53,59,10,9,9,98,98, + 95,98,105,108,108,98,111,97,114,100,78,111,114,109,97,108,40,110,70,97,99,116,111,114,44,32,110,48,44,32, + 110,49,44,32,110,50,44,32,110,51,44,32,110,52,44,32,110,53,44,32,120,65,120,105,115,44,32,121,65,120, + 105,115,44,32,110,65,120,105,115,41,59,10,9,35,101,108,115,101,10,9,9,98,98,95,98,105,108,108,98,111, + 97,114,100,78,111,114,109,97,108,40,110,70,97,99,116,111,114,44,32,110,48,44,32,110,49,44,32,110,50,44, + 32,110,51,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32,110,65,120,105,115,41,59,10,9,35,101, + 110,100,105,102,10,35,101,108,115,101,10,35,100,101,102,105,110,101,9,115,101,116,78,111,114,109,97,108,40,95, + 110,111,114,109,97,108,44,32,95,118,97,108,117,101,41,10,35,101,110,100,105,102,10,10,9,47,47,32,84,97, + 110,103,101,110,116,10,35,105,102,9,9,100,101,102,105,110,101,100,40,71,79,85,84,80,85,84,95,102,114,97, + 103,84,97,110,103,101,110,116,41,10,35,100,101,102,105,110,101,9,115,101,116,84,97,110,103,101,110,116,40,95, + 116,97,110,103,101,110,116,44,32,95,118,97,108,117,101,41,9,95,116,97,110,103,101,110,116,32,61,32,95,118, + 97,108,117,101,59,10,9,118,101,99,52,9,116,48,44,32,116,49,44,32,116,50,44,32,116,51,59,10,9,35, + 105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,10,9,9,118,101,99, + 52,9,116,52,44,32,116,53,59,10,9,9,98,98,95,98,105,108,108,98,111,97,114,100,84,97,110,103,101,110, + 116,40,110,70,97,99,116,111,114,44,32,116,48,44,32,116,49,44,32,116,50,44,32,116,51,44,32,116,52,44, + 32,116,53,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32,110,65,120,105,115,44,32,102,108,105,112, + 85,44,32,102,108,105,112,86,41,59,10,9,35,101,108,115,101,10,9,9,98,98,95,98,105,108,108,98,111,97, + 114,100,84,97,110,103,101,110,116,40,110,70,97,99,116,111,114,44,32,116,48,44,32,116,49,44,32,116,50,44, + 32,116,51,44,32,120,65,120,105,115,44,32,121,65,120,105,115,44,32,110,65,120,105,115,44,32,102,108,105,112, + 85,44,32,102,108,105,112,86,41,59,10,9,35,101,110,100,105,102,10,35,101,108,115,101,10,35,100,101,102,105, + 110,101,9,115,101,116,84,97,110,103,101,110,116,40,95,116,97,110,103,101,110,116,44,32,95,118,97,108,117,101, + 41,10,35,101,110,100,105,102,10,10,9,47,47,32,69,109,105,116,32,52,32,47,32,54,32,118,101,114,116,101, + 120,10,10,35,100,101,102,105,110,101,32,101,109,105,116,116,114,40,112,111,115,44,32,117,118,44,32,110,111,114, + 109,97,108,44,32,116,97,110,103,101,110,116,41,9,92,10,9,103,79,117,116,112,117,116,46,86,101,114,116,101, + 120,80,111,115,105,116,105,111,110,32,61,32,112,114,111,106,95,112,111,115,105,116,105,111,110,40,112,111,115,41, + 59,32,92,10,9,115,101,116,86,105,101,119,80,114,111,106,80,111,115,105,116,105,111,110,40,103,79,117,116,112, + 117,116,46,102,114,97,103,86,105,101,119,80,114,111,106,80,111,115,105,116,105,111,110,44,32,103,79,117,116,112, + 117,116,46,86,101,114,116,101,120,80,111,115,105,116,105,111,110,41,59,32,92,10,9,115,101,116,87,111,114,108, + 100,80,111,115,105,116,105,111,110,40,103,79,117,116,112,117,116,46,102,114,97,103,87,111,114,108,100,80,111,115, + 105,116,105,111,110,44,32,112,111,115,41,59,32,92,10,9,115,101,116,85,86,48,40,103,79,117,116,112,117,116, + 46,102,114,97,103,85,86,48,44,32,117,118,41,59,32,92,10,9,115,101,116,85,86,49,40,103,79,117,116,112, + 117,116,46,102,114,97,103,85,86,49,44,32,117,118,41,59,32,92,10,9,115,101,116,78,111,114,109,97,108,40, + 103,79,117,116,112,117,116,46,102,114,97,103,78,111,114,109,97,108,44,32,110,111,114,109,97,108,41,59,32,92, + 10,9,115,101,116,84,97,110,103,101,110,116,40,103,79,117,116,112,117,116,46,102,114,97,103,84,97,110,103,101, + 110,116,44,32,116,97,110,103,101,110,116,41,59,32,92,10,9,65,112,112,101,110,100,86,101,114,116,101,120,40, + 103,79,117,116,112,117,116,32,71,83,95,80,65,82,65,77,83,41,59,10,10,35,105,102,32,66,66,95,65,120, + 105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,10,9,101,109,105,116,116,114,40,99,101,110,116,101, + 114,32,43,32,121,65,120,105,115,32,43,32,117,112,86,101,99,44,32,99,49,48,44,32,110,53,44,32,116,53, + 41,59,10,9,101,109,105,116,116,114,40,99,101,110,116,101,114,32,43,32,120,112,121,44,32,99,49,49,44,32, + 110,48,44,32,116,48,41,59,32,47,47,32,43,120,43,121,10,9,101,109,105,116,116,114,40,99,101,110,116,101, + 114,32,45,32,120,109,121,44,32,99,48,48,44,32,110,49,44,32,116,49,41,59,32,47,47,32,45,120,43,121, + 10,9,101,109,105,116,116,114,40,99,101,110,116,101,114,32,43,32,120,109,121,44,32,99,49,49,44,32,110,50, + 44,32,116,50,41,59,32,47,47,32,43,120,45,121,10,9,101,109,105,116,116,114,40,99,101,110,116,101,114,32, + 45,32,120,112,121,44,32,99,48,48,44,32,110,51,44,32,116,51,41,59,32,47,47,32,45,120,45,121,10,9, + 101,109,105,116,116,114,40,99,101,110,116,101,114,32,45,32,121,65,120,105,115,32,45,32,117,112,86,101,99,44, + 32,99,48,49,44,32,110,52,44,32,116,52,41,59,10,35,101,108,115,101,10,9,101,109,105,116,116,114,40,99, + 101,110,116,101,114,32,43,32,120,112,121,44,32,99,49,49,44,32,110,48,44,32,116,48,41,59,32,47,47,32, + 43,120,43,121,10,9,101,109,105,116,116,114,40,99,101,110,116,101,114,32,43,32,120,109,121,44,32,99,49,48, + 44,32,110,49,44,32,116,49,41,59,32,47,47,32,43,120,45,121,10,9,101,109,105,116,116,114,40,99,101,110, + 116,101,114,32,45,32,120,109,121,44,32,99,48,49,44,32,110,50,44,32,116,50,41,59,32,47,47,32,45,120, + 43,121,10,9,101,109,105,116,116,114,40,99,101,110,116,101,114,32,45,32,120,112,121,44,32,99,48,48,44,32, + 110,51,44,32,116,51,41,59,32,47,47,32,45,120,45,121,10,35,101,110,100,105,102,10,125,10, +}; diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Billboard.vert.h b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Billboard.vert.h new file mode 100644 index 00000000..72708818 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Billboard.vert.h @@ -0,0 +1,579 @@ +#pragma once + +extern const char g_Billboard_vert_data[17137]; + +const char g_Billboard_vert_data[17137] = +{ + 35,105,102,32,66,66,95,70,101,97,116,117,114,101,67,48,10,35,9,100,101,102,105,110,101,32,66,66,95,83, + 99,114,101,101,110,65,108,105,103,110,101,100,9,9,9,9,49,85,10,35,9,100,101,102,105,110,101,32,66,66, + 95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,9,9,9,50,85,10,35,9,105,102,32,33,100,101,102, + 105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,80,111,115,105,116,105,111,110,115,79,102,102,115,101,116, + 115,41,32,38,38,32,100,101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9,9,101, + 114,114,111,114,32,109,105,115,115,105,110,103,32,80,111,115,105,116,105,111,110,115,79,102,102,115,101,116,115,32, + 83,82,86,10,35,9,101,110,100,105,102,10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69,83, + 79,85,82,67,69,95,80,111,115,105,116,105,111,110,115,41,32,38,38,32,33,100,101,102,105,110,101,100,40,66, + 66,95,71,80,85,95,83,73,77,41,10,35,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,80,111, + 115,105,116,105,111,110,115,32,83,82,86,10,35,9,101,110,100,105,102,10,35,9,105,102,32,33,100,101,102,105, + 110,101,100,40,86,82,69,83,79,85,82,67,69,95,73,110,100,105,99,101,115,41,32,38,38,32,33,100,101,102, + 105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9,9,101,114,114,111,114,32,109,105,115,115, + 105,110,103,32,73,110,100,105,99,101,115,32,83,82,86,9,47,47,32,77,97,110,100,97,116,111,114,121,32,102, + 111,114,32,110,111,119,10,35,9,101,110,100,105,102,10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,86, + 82,69,83,79,85,82,67,69,95,83,105,122,101,115,79,102,102,115,101,116,115,41,32,38,38,32,33,100,101,102, + 105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,83,105,122,101,50,115,79,102,102,115,101,116,115,41,32, + 38,38,32,100,101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9,9,101,114,114,111, + 114,32,109,105,115,115,105,110,103,32,83,105,122,101,115,79,102,102,115,101,116,115,32,111,114,32,83,105,122,101, + 50,115,79,102,102,115,101,116,115,32,83,82,86,10,35,9,101,110,100,105,102,10,35,9,105,102,32,33,100,101, + 102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,83,105,122,101,115,41,32,38,38,32,33,100,101,102, + 105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,83,105,122,101,50,115,41,32,38,38,32,33,100,101,102, + 105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9,9,101,114,114,111,114,32,109,105,115,115, + 105,110,103,32,83,105,122,101,115,32,83,82,86,10,35,9,101,110,100,105,102,10,35,101,108,115,101,10,35,9, + 101,114,114,111,114,32,99,111,110,102,105,103,32,101,114,114,111,114,10,35,101,110,100,105,102,10,10,35,105,102, + 32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,85,86,49,41,10,35,9,105,102, + 32,33,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,65,116,108,97,115,73,68,41, + 10,35,9,9,101,114,114,111,114,32,34,99,111,110,102,105,103,32,101,114,114,111,114,34,10,35,9,101,110,100, + 105,102,10,35,101,108,115,101,10,35,9,105,102,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95, + 102,114,97,103,65,116,108,97,115,73,68,41,10,35,9,9,101,114,114,111,114,32,34,99,111,110,102,105,103,32, + 101,114,114,111,114,34,10,35,9,101,110,100,105,102,10,35,101,110,100,105,102,10,35,105,102,32,66,66,95,70, + 101,97,116,117,114,101,95,65,116,108,97,115,10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69, + 83,79,85,82,67,69,95,65,116,108,97,115,95,84,101,120,116,117,114,101,73,68,115,79,102,102,115,101,116,115, + 41,32,38,38,32,100,101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9,9,101,114, + 114,111,114,32,109,105,115,115,105,110,103,32,84,101,120,116,117,114,101,73,68,115,79,102,102,115,101,116,115,32, + 83,82,86,10,35,9,101,110,100,105,102,10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69,83, + 79,85,82,67,69,95,65,116,108,97,115,95,84,101,120,116,117,114,101,73,68,115,41,32,38,38,32,33,100,101, + 102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9,9,101,114,114,111,114,32,34,99,111, + 110,102,105,103,32,101,114,114,111,114,34,10,35,9,101,110,100,105,102,10,35,101,110,100,105,102,10,10,35,105, + 102,32,66,66,95,70,101,97,116,117,114,101,67,49,10,35,9,100,101,102,105,110,101,32,78,79,82,77,65,76, + 73,90,69,82,95,69,80,83,73,76,79,78,9,9,9,9,49,46,48,101,45,56,102,10,35,9,100,101,102,105, + 110,101,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,9,9,9,51,85,10,35,9,100,101,102,105,110, + 101,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,83,112,104,101,114,111,105,100,9,52,85,10,35,9, + 105,102,32,33,100,101,102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,65,120,105,115,48,115,79,102, + 102,115,101,116,115,41,32,38,38,32,100,101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10, + 35,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,65,120,105,115,48,115,79,102,102,115,101,116,115, + 32,83,82,86,10,35,9,101,110,100,105,102,10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69, + 83,79,85,82,67,69,95,65,120,105,115,48,115,41,32,38,38,32,33,100,101,102,105,110,101,100,40,66,66,95, + 71,80,85,95,83,73,77,41,10,35,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,65,120,105,115, + 48,115,32,83,82,86,10,35,9,101,110,100,105,102,10,35,101,110,100,105,102,10,10,35,105,102,32,66,66,95, + 70,101,97,116,117,114,101,67,49,95,67,97,112,115,117,108,101,10,35,9,100,101,102,105,110,101,32,66,66,95, + 65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,9,53,85,10,35,101,110,100,105,102,10,10, + 35,105,102,32,66,66,95,70,101,97,116,117,114,101,67,50,10,35,9,100,101,102,105,110,101,32,66,66,95,80, + 108,97,110,101,65,108,105,103,110,101,100,9,9,9,54,85,10,35,9,105,102,32,33,100,101,102,105,110,101,100, + 40,86,82,69,83,79,85,82,67,69,95,65,120,105,115,49,115,79,102,102,115,101,116,115,41,32,38,38,32,100, + 101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9,9,101,114,114,111,114,32,109,105, + 115,115,105,110,103,32,65,120,105,115,49,115,79,102,102,115,101,116,115,32,83,82,86,10,35,9,101,110,100,105, + 102,10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,65,120,105,115, + 49,115,41,32,38,38,32,33,100,101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9, + 9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,65,120,105,115,49,115,32,83,82,86,10,35,9,101,110, + 100,105,102,10,35,101,110,100,105,102,10,10,35,100,101,102,105,110,101,9,70,76,73,80,95,66,73,76,76,66, + 79,65,82,68,73,78,71,95,65,88,73,83,9,9,49,10,10,35,105,102,9,33,100,101,102,105,110,101,100,40, + 67,79,78,83,84,95,66,105,108,108,98,111,97,114,100,73,110,102,111,95,68,114,97,119,82,101,113,117,101,115, + 116,41,10,35,101,114,114,111,114,32,34,77,105,115,115,105,110,103,32,99,111,110,115,116,97,110,116,32,119,105, + 116,104,32,105,110,102,111,115,32,102,111,114,32,98,105,108,108,98,111,97,114,100,34,10,35,101,110,100,105,102, + 10,10,35,105,102,32,100,101,102,105,110,101,100,40,67,79,78,83,84,95,66,105,108,108,98,111,97,114,100,73, + 110,102,111,95,68,114,97,119,82,101,113,117,101,115,116,41,10,35,9,100,101,102,105,110,101,9,66,66,95,70, + 108,97,103,95,66,105,108,108,98,111,97,114,100,77,97,115,107,9,55,85,9,47,47,32,51,32,102,105,114,115, + 116,115,32,98,105,116,115,10,35,9,100,101,102,105,110,101,9,66,66,95,70,108,97,103,95,70,108,105,112,86, + 9,9,9,56,85,9,47,47,32,52,116,104,32,98,105,116,10,35,9,100,101,102,105,110,101,9,66,66,95,70, + 108,97,103,95,83,111,102,116,65,110,105,109,66,108,101,110,100,9,49,54,85,32,47,47,32,53,116,104,32,98, + 105,116,10,35,9,100,101,102,105,110,101,9,66,66,95,70,108,97,103,95,70,108,105,112,85,9,9,9,51,50, + 85,9,47,47,32,54,116,104,32,98,105,116,10,35,101,110,100,105,102,10,10,47,47,9,68,114,97,119,82,101, + 113,117,101,115,116,58,10,47,47,32,120,58,32,70,108,97,103,115,10,47,47,32,121,58,32,78,111,114,109,97, + 108,115,66,101,110,100,105,110,103,70,97,99,116,111,114,10,10,47,47,32,82,105,103,104,116,72,97,110,100,101, + 100,47,76,101,102,116,72,97,110,100,101,100,58,10,35,100,101,102,105,110,101,9,109,121,67,114,111,115,115,40, + 97,44,32,98,41,32,32,99,114,111,115,115,40,97,44,32,98,41,32,42,32,71,69,84,95,67,79,78,83,84, + 65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,72,97,110,100,101,100,110,101,115,115,41,10,10,118,101, + 99,50,9,103,101,116,95,114,97,100,105,117,115,40,117,105,110,116,32,112,97,114,116,105,99,108,101,73,68,32, + 86,83,95,65,82,71,83,41,10,123,10,9,102,108,111,97,116,9,101,110,97,98,108,101,100,32,61,32,49,46, + 48,102,59,10,10,35,105,102,32,66,66,95,71,80,85,95,83,73,77,10,35,9,105,102,9,32,100,101,102,105, + 110,101,100,40,86,82,69,83,79,85,82,67,69,95,69,110,97,98,108,101,100,115,79,102,102,115,101,116,115,41, + 10,9,99,111,110,115,116,32,117,105,110,116,9,101,32,61,32,76,79,65,68,85,40,71,69,84,95,82,65,87, + 95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84, + 95,82,65,87,95,66,85,70,70,69,82,40,69,110,97,98,108,101,100,115,79,102,102,115,101,116,115,41,44,32, + 82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,71,69,84,95,67,79,78,83,84,65,78,84,40, + 71,80,85,66,105,108,108,98,111,97,114,100,80,117,115,104,67,111,110,115,116,97,110,116,115,44,32,83,116,114, + 101,97,109,79,102,102,115,101,116,115,73,110,100,101,120,41,41,41,32,43,32,82,65,87,95,66,85,70,70,69, + 82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,41,41,59,10,9,101,110,97,98,108,101,100, + 32,61,32,101,32,33,61,32,48,32,63,32,49,46,48,102,32,58,32,48,46,48,102,59,10,35,9,101,110,100, + 105,102,10,10,35,9,105,102,9,9,100,101,102,105,110,101,100,40,72,65,83,95,83,105,122,101,70,108,111,97, + 116,50,41,10,9,114,101,116,117,114,110,32,76,79,65,68,70,50,40,71,69,84,95,82,65,87,95,66,85,70, + 70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84,95,82,65,87, + 95,66,85,70,70,69,82,40,83,105,122,101,50,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85, + 70,70,69,82,95,73,78,68,69,88,40,71,69,84,95,67,79,78,83,84,65,78,84,40,71,80,85,66,105,108, + 108,98,111,97,114,100,80,117,115,104,67,111,110,115,116,97,110,116,115,44,32,83,116,114,101,97,109,79,102,102, + 115,101,116,115,73,110,100,101,120,41,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69, + 88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,50,41,41,32,42,32,101,110,97,98,108,101,100,59,10, + 35,9,101,108,115,101,10,9,102,108,111,97,116,9,95,114,97,100,105,117,115,32,61,32,76,79,65,68,70,40, + 71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79, + 65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,83,105,122,101,115,79,102,102,115,101,116, + 115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,71,69,84,95,67,79,78,83,84, + 65,78,84,40,71,80,85,66,105,108,108,98,111,97,114,100,80,117,115,104,67,111,110,115,116,97,110,116,115,44, + 32,83,116,114,101,97,109,79,102,102,115,101,116,115,73,110,100,101,120,41,41,41,32,43,32,82,65,87,95,66, + 85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,41,41,59,10,9,114,101,116, + 117,114,110,32,118,101,99,50,40,95,114,97,100,105,117,115,44,32,95,114,97,100,105,117,115,41,32,42,32,101, + 110,97,98,108,101,100,59,10,35,9,101,110,100,105,102,10,35,101,108,115,101,10,35,9,105,102,9,9,100,101, + 102,105,110,101,100,40,72,65,83,95,83,105,122,101,70,108,111,97,116,50,41,10,9,114,101,116,117,114,110,32, + 76,79,65,68,70,50,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,83,105,122,101,50,115,41,44, + 32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42, + 32,50,41,41,32,42,32,101,110,97,98,108,101,100,59,10,35,9,101,108,115,101,10,9,102,108,111,97,116,9, + 95,114,97,100,105,117,115,32,61,32,76,79,65,68,70,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82, + 40,83,105,122,101,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116, + 105,99,108,101,73,68,41,41,59,10,9,114,101,116,117,114,110,32,118,101,99,50,40,95,114,97,100,105,117,115, + 44,32,95,114,97,100,105,117,115,41,32,42,32,101,110,97,98,108,101,100,59,10,35,9,101,110,100,105,102,10, + 35,101,110,100,105,102,32,47,47,32,66,66,95,71,80,85,95,83,73,77,10,125,10,10,35,105,102,32,100,101, + 102,105,110,101,100,40,66,66,95,83,99,114,101,101,110,65,108,105,103,110,101,100,41,32,124,124,32,100,101,102, + 105,110,101,100,40,66,66,95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,41,32,124,124,32,100,101,102, + 105,110,101,100,40,66,66,95,80,108,97,110,101,65,108,105,103,110,101,100,41,10,118,111,105,100,9,82,111,116, + 97,116,101,84,97,110,103,101,110,116,115,40,117,105,110,116,32,112,97,114,116,105,99,108,101,73,68,44,32,73, + 78,79,85,84,40,118,101,99,51,41,32,116,97,110,103,101,110,116,48,44,32,73,78,79,85,84,40,118,101,99, + 51,41,32,116,97,110,103,101,110,116,49,32,86,83,95,65,82,71,83,41,10,123,10,35,105,102,32,100,101,102, + 105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,82,111,116,97,116,105,111,110,115,41,32,124,124,32,100, + 101,102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,82,111,116,97,116,105,111,110,115,79,102,102,115, + 101,116,115,41,10,35,9,105,102,32,66,66,95,71,80,85,95,83,73,77,10,35,9,9,105,102,32,33,100,101, + 102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,82,111,116,97,116,105,111,110,115,79,102,102,115,101, + 116,115,41,10,35,9,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,82,111,116,97,116,105,111,110, + 115,79,102,102,115,101,116,115,32,83,82,86,10,35,9,9,101,110,100,105,102,32,47,47,32,33,100,101,102,105, + 110,101,100,40,86,82,69,83,79,85,82,67,69,95,82,111,116,97,116,105,111,110,115,41,10,9,99,111,110,115, + 116,32,102,108,111,97,116,9,114,111,116,97,116,105,111,110,32,61,32,76,79,65,68,70,40,71,69,84,95,82, + 65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71, + 69,84,95,82,65,87,95,66,85,70,70,69,82,40,82,111,116,97,116,105,111,110,115,79,102,102,115,101,116,115, + 41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,71,69,84,95,67,79,78,83,84,65, + 78,84,40,71,80,85,66,105,108,108,98,111,97,114,100,80,117,115,104,67,111,110,115,116,97,110,116,115,44,32, + 83,116,114,101,97,109,79,102,102,115,101,116,115,73,110,100,101,120,41,41,41,32,43,32,82,65,87,95,66,85, + 70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,41,41,59,10,35,9,101,108,115, + 101,10,35,9,9,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,82,111,116, + 97,116,105,111,110,115,41,10,35,9,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,82,111,116,97, + 116,105,111,110,115,32,83,82,86,10,35,9,9,101,110,100,105,102,32,47,47,32,33,100,101,102,105,110,101,100, + 40,86,82,69,83,79,85,82,67,69,95,82,111,116,97,116,105,111,110,115,41,10,9,99,111,110,115,116,32,102, + 108,111,97,116,9,114,111,116,97,116,105,111,110,32,61,32,76,79,65,68,70,40,71,69,84,95,82,65,87,95, + 66,85,70,70,69,82,40,82,111,116,97,116,105,111,110,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95, + 73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,41,41,59,10,35,9,101,110,100,105,102,32,47,47, + 32,66,66,95,71,80,85,95,83,73,77,10,10,9,99,111,110,115,116,32,102,108,111,97,116,9,114,111,116,67, + 111,115,32,61,32,99,111,115,40,114,111,116,97,116,105,111,110,41,59,10,9,99,111,110,115,116,32,102,108,111, + 97,116,9,114,111,116,83,105,110,32,61,32,115,105,110,40,114,111,116,97,116,105,111,110,41,59,10,9,99,111, + 110,115,116,32,118,101,99,51,9,95,116,97,110,103,101,110,116,48,32,61,32,116,97,110,103,101,110,116,48,59, + 10,10,9,116,97,110,103,101,110,116,48,32,61,32,116,97,110,103,101,110,116,49,32,42,32,114,111,116,83,105, + 110,32,43,32,116,97,110,103,101,110,116,48,32,42,32,114,111,116,67,111,115,59,10,9,116,97,110,103,101,110, + 116,49,32,61,32,116,97,110,103,101,110,116,49,32,42,32,114,111,116,67,111,115,32,45,32,95,116,97,110,103, + 101,110,116,48,32,42,32,114,111,116,83,105,110,59,10,35,101,110,100,105,102,32,47,47,32,100,101,102,105,110, + 101,100,40,86,82,69,83,79,85,82,67,69,95,82,111,116,97,116,105,111,110,115,41,32,124,124,32,100,101,102, + 105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,82,111,116,97,116,105,111,110,115,79,102,102,115,101,116, + 115,41,10,125,10,35,101,110,100,105,102,10,10,118,101,99,52,9,112,114,111,106,95,112,111,115,105,116,105,111, + 110,40,73,78,40,118,101,99,51,41,32,112,111,115,105,116,105,111,110,32,86,83,95,65,82,71,83,41,10,123, + 10,35,105,102,9,9,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99,101,110,101,73,110,102,111,95, + 86,105,101,119,80,114,111,106,41,10,9,114,101,116,117,114,110,32,109,117,108,40,71,69,84,95,67,79,78,83, + 84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,86,105,101,119,80,114,111,106,41,44,32,118,101,99, + 52,40,112,111,115,105,116,105,111,110,44,32,49,46,48,102,41,41,59,10,35,101,108,115,101,10,9,114,101,116, + 117,114,110,32,118,101,99,52,40,112,111,115,105,116,105,111,110,44,32,49,46,48,102,41,59,10,35,101,110,100, + 105,102,10,125,10,10,35,105,102,32,66,66,95,70,101,97,116,117,114,101,67,49,10,118,101,99,51,9,67,111, + 109,112,117,116,101,84,97,110,103,101,110,116,49,40,73,78,40,118,101,99,51,41,32,110,114,109,44,32,73,78, + 40,118,101,99,51,41,32,116,97,110,103,101,110,116,48,32,86,83,95,65,82,71,83,41,10,123,10,9,118,101, + 99,51,9,115,105,100,101,32,61,32,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110, + 102,111,44,32,83,105,100,101,86,101,99,116,111,114,41,46,120,121,122,59,10,9,118,101,99,51,9,100,101,112, + 116,104,32,61,32,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,68, + 101,112,116,104,86,101,99,116,111,114,41,46,120,121,122,59,10,10,9,118,101,99,51,9,116,97,110,103,101,110, + 116,49,32,61,32,109,121,67,114,111,115,115,40,110,114,109,44,32,116,97,110,103,101,110,116,48,41,59,10,9, + 105,102,32,40,100,111,116,40,116,97,110,103,101,110,116,49,44,32,116,97,110,103,101,110,116,49,41,32,62,32, + 78,79,82,77,65,76,73,90,69,82,95,69,80,83,73,76,79,78,41,10,9,9,116,97,110,103,101,110,116,49, + 32,61,32,110,111,114,109,97,108,105,122,101,40,116,97,110,103,101,110,116,49,41,59,10,9,101,108,115,101,10, + 9,123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,118,32,61,32,45,115,105,100,101,32,42,32,100,111, + 116,40,110,114,109,44,32,100,101,112,116,104,41,32,43,32,100,101,112,116,104,32,42,32,40,100,111,116,40,110, + 114,109,44,32,115,105,100,101,41,32,43,32,48,46,48,49,102,41,59,10,9,9,47,47,32,99,114,111,115,115, + 40,41,44,32,110,111,116,32,109,121,67,114,111,115,115,40,41,58,32,105,110,32,98,105,108,108,98,111,97,114, + 100,115,95,112,108,97,110,97,114,95,113,117,97,100,46,99,112,112,44,32,102,97,108,108,98,97,99,107,32,97, + 120,105,115,32,105,103,110,111,114,101,115,32,116,104,101,32,104,97,110,100,101,100,110,101,115,115,10,9,9,116, + 97,110,103,101,110,116,49,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114,111,115,115,40,110,114,109,44, + 32,118,41,41,59,10,9,9,47,47,32,84,104,105,115,32,99,111,109,112,117,116,97,116,105,111,110,32,105,115, + 32,99,111,110,115,105,115,116,101,110,116,32,119,105,116,104,32,67,80,85,32,66,85,84,32,119,101,32,102,108, + 105,112,32,116,104,101,32,97,120,105,115,10,9,9,47,47,32,116,111,32,99,97,110,99,101,108,32,71,80,85, + 32,98,98,32,102,108,105,112,44,32,100,117,101,32,116,111,32,70,76,73,80,95,66,73,76,76,66,79,65,82, + 68,73,78,71,95,65,88,73,83,46,10,9,9,116,97,110,103,101,110,116,49,32,61,32,45,116,97,110,103,101, + 110,116,49,59,10,9,125,10,9,114,101,116,117,114,110,32,116,97,110,103,101,110,116,49,59,10,125,10,35,101, + 110,100,105,102,10,10,118,111,105,100,32,9,86,101,114,116,101,120,66,105,108,108,98,111,97,114,100,40,73,78, + 40,83,86,101,114,116,101,120,73,110,112,117,116,41,32,118,73,110,112,117,116,44,32,73,78,79,85,84,40,83, + 86,101,114,116,101,120,79,117,116,112,117,116,41,32,118,79,117,116,112,117,116,44,32,117,105,110,116,32,112,97, + 114,116,105,99,108,101,73,68,32,86,83,95,65,82,71,83,41,10,123,10,35,105,102,32,66,66,95,71,80,85, + 95,83,73,77,10,9,99,111,110,115,116,32,117,105,110,116,9,9,115,116,111,114,97,103,101,73,100,32,61,32, + 71,69,84,95,67,79,78,83,84,65,78,84,40,71,80,85,66,105,108,108,98,111,97,114,100,80,117,115,104,67, + 111,110,115,116,97,110,116,115,44,32,83,116,114,101,97,109,79,102,102,115,101,116,115,73,110,100,101,120,41,59, + 10,9,99,111,110,115,116,32,118,101,99,51,9,9,119,111,114,108,100,80,111,115,32,61,32,76,79,65,68,70, + 51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32, + 76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,80,111,115,105,116,105,111,110,115, + 79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115,116,111, + 114,97,103,101,73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97, + 114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,9,99,111,110,115,116,32,117,105,110,116,9,9,100, + 114,73,100,32,61,32,48,59,32,47,47,32,78,111,32,98,97,116,99,104,105,110,103,32,121,101,116,32,102,111, + 114,32,71,80,85,32,112,97,114,116,105,99,108,101,115,10,35,101,108,115,101,10,9,99,111,110,115,116,32,118, + 101,99,52,9,9,119,111,114,108,100,80,111,115,68,114,73,100,32,61,32,76,79,65,68,70,52,40,71,69,84, + 95,82,65,87,95,66,85,70,70,69,82,40,80,111,115,105,116,105,111,110,115,41,44,32,82,65,87,95,66,85, + 70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,52,41,41,59,10,9, + 99,111,110,115,116,32,118,101,99,51,9,9,119,111,114,108,100,80,111,115,32,61,32,119,111,114,108,100,80,111, + 115,68,114,73,100,46,120,121,122,59,10,9,99,111,110,115,116,32,117,105,110,116,9,9,100,114,73,100,32,61, + 32,97,115,117,105,110,116,40,119,111,114,108,100,80,111,115,68,114,73,100,46,119,41,59,10,35,101,110,100,105, + 102,10,10,10,9,99,111,110,115,116,32,118,101,99,52,9,9,99,117,114,114,101,110,116,68,114,32,61,32,71, + 69,84,95,67,79,78,83,84,65,78,84,40,66,105,108,108,98,111,97,114,100,73,110,102,111,44,32,68,114,97, + 119,82,101,113,117,101,115,116,41,91,100,114,73,100,93,59,10,9,99,111,110,115,116,32,117,105,110,116,9,9, + 102,108,97,103,115,32,61,32,97,115,117,105,110,116,40,99,117,114,114,101,110,116,68,114,46,120,41,59,10,9, + 99,111,110,115,116,32,117,105,110,116,9,9,98,105,108,108,98,111,97,114,100,101,114,84,121,112,101,32,61,32, + 102,108,97,103,115,32,38,32,66,66,95,70,108,97,103,95,66,105,108,108,98,111,97,114,100,77,97,115,107,59, + 10,9,99,111,110,115,116,32,98,111,111,108,9,9,102,108,105,112,85,32,61,32,40,102,108,97,103,115,32,38, + 32,66,66,95,70,108,97,103,95,70,108,105,112,85,41,32,33,61,32,48,85,59,10,9,99,111,110,115,116,32, + 98,111,111,108,9,9,102,108,105,112,86,32,61,32,40,102,108,97,103,115,32,38,32,66,66,95,70,108,97,103, + 95,70,108,105,112,86,41,32,33,61,32,48,85,59,10,10,9,99,111,110,115,116,32,118,101,99,50,9,9,114, + 97,100,105,117,115,32,61,32,103,101,116,95,114,97,100,105,117,115,40,112,97,114,116,105,99,108,101,73,68,32, + 86,83,95,80,65,82,65,77,83,41,59,10,9,118,101,99,51,9,9,9,116,97,110,103,101,110,116,48,32,61, + 32,118,101,99,51,40,48,44,32,48,44,32,48,41,59,32,47,47,32,98,105,108,108,98,111,97,114,100,32,115, + 105,100,101,32,118,101,99,116,111,114,10,9,118,101,99,51,9,9,9,116,97,110,103,101,110,116,49,32,61,32, + 118,101,99,51,40,48,44,32,48,44,32,48,41,59,32,47,47,32,98,105,108,108,98,111,97,114,100,32,102,119, + 100,47,115,116,114,101,116,99,104,32,118,101,99,116,111,114,10,9,118,101,99,51,9,9,9,112,108,97,110,101, + 78,111,114,109,97,108,32,61,32,118,101,99,51,40,48,44,32,48,44,32,48,41,59,32,47,47,32,98,105,108, + 108,98,111,97,114,100,32,110,111,114,109,97,108,32,118,101,99,116,111,114,10,10,35,105,102,9,9,33,100,101, + 102,105,110,101,100,40,67,79,78,83,84,95,83,99,101,110,101,73,110,102,111,95,66,105,108,108,98,111,97,114, + 100,105,110,103,86,105,101,119,41,10,35,9,101,114,114,111,114,32,34,77,105,115,115,105,110,103,32,66,105,108, + 108,98,111,97,114,100,105,110,103,86,105,101,119,32,109,97,116,114,105,120,32,105,110,32,83,99,101,110,101,73, + 110,102,111,34,10,35,101,110,100,105,102,10,35,105,102,9,9,33,100,101,102,105,110,101,100,40,67,79,78,83, + 84,95,83,99,101,110,101,73,110,102,111,95,83,105,100,101,86,101,99,116,111,114,41,10,35,9,101,114,114,111, + 114,32,34,77,105,115,115,105,110,103,32,86,105,101,119,32,115,105,100,101,32,118,101,99,116,111,114,32,105,110, + 32,83,99,101,110,101,73,110,102,111,34,10,35,101,110,100,105,102,10,35,105,102,9,9,33,100,101,102,105,110, + 101,100,40,67,79,78,83,84,95,83,99,101,110,101,73,110,102,111,95,68,101,112,116,104,86,101,99,116,111,114, + 41,10,35,9,101,114,114,111,114,32,34,77,105,115,115,105,110,103,32,86,105,101,119,32,100,101,112,116,104,32, + 118,101,99,116,111,114,32,105,110,32,83,99,101,110,101,73,110,102,111,34,10,35,101,110,100,105,102,10,10,9, + 99,111,110,115,116,32,118,101,99,50,9,9,99,111,114,110,101,114,67,111,111,114,100,115,32,61,32,118,73,110, + 112,117,116,46,84,101,120,67,111,111,114,100,115,59,10,9,118,101,99,50,9,9,9,116,101,120,67,111,111,114, + 100,115,32,61,32,99,111,114,110,101,114,67,111,111,114,100,115,59,10,9,115,119,105,116,99,104,32,40,98,105, + 108,108,98,111,97,114,100,101,114,84,121,112,101,41,10,9,123,10,35,105,102,32,66,66,95,83,99,114,101,101, + 110,65,108,105,103,110,101,100,10,9,99,97,115,101,32,66,66,95,83,99,114,101,101,110,65,108,105,103,110,101, + 100,58,10,9,123,10,9,9,116,97,110,103,101,110,116,48,32,61,32,71,69,84,95,77,65,84,82,73,88,95, + 88,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44, + 32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,9,9,116,97,110, + 103,101,110,116,49,32,61,32,71,69,84,95,77,65,84,82,73,88,95,89,95,65,88,73,83,40,71,69,84,95, + 67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,66,105,108,108,98,111,97,114,100,105, + 110,103,86,105,101,119,41,41,46,120,121,122,59,10,9,9,112,108,97,110,101,78,111,114,109,97,108,32,61,32, + 71,69,84,95,77,65,84,82,73,88,95,90,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84, + 40,83,99,101,110,101,73,110,102,111,44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41, + 46,120,121,122,59,10,10,9,9,82,111,116,97,116,101,84,97,110,103,101,110,116,115,40,112,97,114,116,105,99, + 108,101,73,68,44,32,116,97,110,103,101,110,116,48,44,32,116,97,110,103,101,110,116,49,32,86,83,95,80,65, + 82,65,77,83,41,59,10,10,9,9,47,47,32,65,112,112,108,121,32,114,97,100,105,117,115,32,97,102,116,101, + 114,32,114,111,116,97,116,105,111,110,44,32,111,116,104,101,114,119,105,115,101,32,102,108,111,97,116,50,32,115, + 105,122,101,115,32,97,114,101,32,105,110,99,111,114,114,101,99,116,10,9,9,116,97,110,103,101,110,116,48,32, + 42,61,32,114,97,100,105,117,115,46,120,59,10,9,9,116,97,110,103,101,110,116,49,32,42,61,32,114,97,100, + 105,117,115,46,121,59,10,9,9,98,114,101,97,107,59,10,9,125,10,35,101,110,100,105,102,10,35,105,102,32, + 66,66,95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,10,9,99,97,115,101,32,66,66,95,86,105,101, + 119,112,111,115,65,108,105,103,110,101,100,58,10,9,123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,118, + 105,101,119,80,111,115,32,61,32,71,69,84,95,77,65,84,82,73,88,95,87,95,65,88,73,83,40,71,69,84, + 95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,66,105,108,108,98,111,97,114,100, + 105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,118,105, + 101,119,85,112,65,120,105,115,32,61,32,71,69,84,95,77,65,84,82,73,88,95,89,95,65,88,73,83,40,71, + 69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,66,105,108,108,98,111,97, + 114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9, + 99,97,109,84,111,80,97,114,116,105,99,108,101,32,61,32,110,111,114,109,97,108,105,122,101,40,119,111,114,108, + 100,80,111,115,32,45,32,118,105,101,119,80,111,115,41,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9, + 117,112,86,101,99,116,111,114,73,110,116,101,114,109,32,61,32,118,105,101,119,85,112,65,120,105,115,32,45,32, + 49,46,101,45,53,102,32,42,32,99,97,109,84,111,80,97,114,116,105,99,108,101,46,120,122,121,59,10,10,9, + 9,116,97,110,103,101,110,116,48,32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114,111,115,115,40, + 99,97,109,84,111,80,97,114,116,105,99,108,101,44,32,117,112,86,101,99,116,111,114,73,110,116,101,114,109,41, + 41,59,10,9,9,116,97,110,103,101,110,116,49,32,61,32,109,121,67,114,111,115,115,40,116,97,110,103,101,110, + 116,48,44,32,99,97,109,84,111,80,97,114,116,105,99,108,101,41,59,10,9,9,112,108,97,110,101,78,111,114, + 109,97,108,32,61,32,45,99,97,109,84,111,80,97,114,116,105,99,108,101,59,10,9,9,82,111,116,97,116,101, + 84,97,110,103,101,110,116,115,40,112,97,114,116,105,99,108,101,73,68,44,32,116,97,110,103,101,110,116,48,44, + 32,116,97,110,103,101,110,116,49,32,86,83,95,80,65,82,65,77,83,41,59,10,9,9,10,9,9,47,47,32, + 65,112,112,108,121,32,114,97,100,105,117,115,32,97,102,116,101,114,32,114,111,116,97,116,105,111,110,44,32,111, + 116,104,101,114,119,105,115,101,32,102,108,111,97,116,50,32,115,105,122,101,115,32,97,114,101,32,105,110,99,111, + 114,114,101,99,116,10,9,9,116,97,110,103,101,110,116,48,32,42,61,32,114,97,100,105,117,115,46,120,59,10, + 9,9,116,97,110,103,101,110,116,49,32,42,61,32,114,97,100,105,117,115,46,121,59,10,9,9,98,114,101,97, + 107,59,10,9,125,10,35,101,110,100,105,102,10,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101, + 100,10,9,99,97,115,101,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,58,10,9,123,10,9,9,99, + 111,110,115,116,32,118,101,99,51,9,118,105,101,119,80,111,115,32,61,32,71,69,84,95,77,65,84,82,73,88, + 95,87,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111, + 44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,9,9,99,111, + 110,115,116,32,118,101,99,51,9,99,97,109,84,111,80,97,114,116,105,99,108,101,32,61,32,110,111,114,109,97, + 108,105,122,101,40,119,111,114,108,100,80,111,115,32,45,32,118,105,101,119,80,111,115,41,59,10,10,35,9,105, + 102,32,66,66,95,71,80,85,95,83,73,77,10,9,9,99,111,110,115,116,32,118,101,99,51,9,97,120,105,115, + 95,102,119,100,32,61,32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71, + 80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70, + 69,82,40,65,120,105,115,48,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95, + 73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82, + 95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,35,9,101,108,115, + 101,10,9,9,99,111,110,115,116,32,118,101,99,51,9,97,120,105,115,95,102,119,100,32,61,32,76,79,65,68, + 70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,120,105,115,48,115,41,44,32,82,65,87, + 95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41, + 59,10,35,9,101,110,100,105,102,32,47,47,32,66,66,95,71,80,85,95,83,73,77,10,10,9,9,116,97,110, + 103,101,110,116,48,32,61,32,67,111,109,112,117,116,101,84,97,110,103,101,110,116,49,40,99,97,109,84,111,80, + 97,114,116,105,99,108,101,44,32,97,120,105,115,95,102,119,100,32,86,83,95,80,65,82,65,77,83,41,32,42, + 32,114,97,100,105,117,115,46,120,59,10,9,9,116,97,110,103,101,110,116,49,32,61,32,97,120,105,115,95,102, + 119,100,32,42,32,48,46,53,102,59,10,9,9,112,108,97,110,101,78,111,114,109,97,108,32,61,32,45,99,97, + 109,84,111,80,97,114,116,105,99,108,101,59,10,9,9,98,114,101,97,107,59,10,9,125,10,35,101,110,100,105, + 102,10,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,83,112,104,101,114,111,105,100,10,9, + 99,97,115,101,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,83,112,104,101,114,111,105,100,58,10,9, + 123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,118,105,101,119,80,111,115,32,61,32,71,69,84,95,77, + 65,84,82,73,88,95,87,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110, + 101,73,110,102,111,44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59, + 10,9,9,99,111,110,115,116,32,118,101,99,51,9,99,97,109,84,111,80,97,114,116,105,99,108,101,32,61,32, + 110,111,114,109,97,108,105,122,101,40,119,111,114,108,100,80,111,115,32,45,32,118,105,101,119,80,111,115,41,59, + 10,10,35,9,105,102,32,66,66,95,71,80,85,95,83,73,77,10,9,9,99,111,110,115,116,32,118,101,99,51, + 9,97,120,105,115,95,102,119,100,32,61,32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70, + 70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84,95,82,65,87, + 95,66,85,70,70,69,82,40,65,120,105,115,48,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85, + 70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,41,41,32,43,32,82,65,87,95,66, + 85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10, + 35,9,101,108,115,101,10,9,9,99,111,110,115,116,32,118,101,99,51,9,97,120,105,115,95,102,119,100,32,61, + 32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,120,105,115,48,115,41, + 44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32, + 42,32,51,41,41,59,10,35,9,101,110,100,105,102,32,47,47,32,66,66,95,71,80,85,95,83,73,77,10,10, + 9,9,116,97,110,103,101,110,116,48,32,61,32,67,111,109,112,117,116,101,84,97,110,103,101,110,116,49,40,99, + 97,109,84,111,80,97,114,116,105,99,108,101,44,32,97,120,105,115,95,102,119,100,32,86,83,95,80,65,82,65, + 77,83,41,32,42,32,114,97,100,105,117,115,46,120,59,10,9,9,116,97,110,103,101,110,116,49,32,61,32,97, + 120,105,115,95,102,119,100,32,42,32,48,46,53,102,32,43,32,109,121,67,114,111,115,115,40,116,97,110,103,101, + 110,116,48,44,32,99,97,109,84,111,80,97,114,116,105,99,108,101,41,59,10,9,9,47,47,32,87,97,114,110, + 105,110,103,58,32,116,97,110,103,101,110,116,48,32,97,110,100,32,116,97,110,103,101,110,116,49,32,97,114,101, + 32,110,111,116,32,111,114,116,104,111,103,111,110,97,108,46,10,9,9,112,108,97,110,101,78,111,114,109,97,108, + 32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114,111,115,115,40,116,97,110,103,101,110,116,48,44, + 32,116,97,110,103,101,110,116,49,41,41,59,10,9,9,98,114,101,97,107,59,10,9,125,10,35,101,110,100,105, + 102,10,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,10,9,99, + 97,115,101,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,58,10,9,123,10, + 9,9,99,111,110,115,116,32,118,101,99,51,9,118,105,101,119,80,111,115,32,61,32,71,69,84,95,77,65,84, + 82,73,88,95,87,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73, + 110,102,111,44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,9, + 9,99,111,110,115,116,32,118,101,99,51,9,99,97,109,84,111,80,97,114,116,105,99,108,101,32,61,32,110,111, + 114,109,97,108,105,122,101,40,119,111,114,108,100,80,111,115,32,45,32,118,105,101,119,80,111,115,41,59,10,10, + 35,9,105,102,32,66,66,95,71,80,85,95,83,73,77,10,9,9,99,111,110,115,116,32,118,101,99,51,9,97, + 120,105,115,95,102,119,100,32,61,32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69, + 82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84,95,82,65,87,95,66, + 85,70,70,69,82,40,65,120,105,115,48,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85,70,70, + 69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,41,41,32,43,32,82,65,87,95,66,85,70, + 70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,35,9, + 101,108,115,101,10,9,9,99,111,110,115,116,32,118,101,99,51,9,97,120,105,115,95,102,119,100,32,61,32,76, + 79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,120,105,115,48,115,41,44,32, + 82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32, + 51,41,41,59,10,35,9,101,110,100,105,102,32,47,47,32,66,66,95,71,80,85,95,83,73,77,10,10,9,9, + 116,97,110,103,101,110,116,48,32,61,32,67,111,109,112,117,116,101,84,97,110,103,101,110,116,49,40,99,97,109, + 84,111,80,97,114,116,105,99,108,101,44,32,97,120,105,115,95,102,119,100,32,86,83,95,80,65,82,65,77,83, + 41,32,42,32,115,113,114,116,40,50,46,102,41,32,42,32,114,97,100,105,117,115,46,120,59,10,10,9,9,116, + 97,110,103,101,110,116,49,32,61,32,97,120,105,115,95,102,119,100,32,42,32,48,46,53,102,59,10,9,9,112, + 108,97,110,101,78,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114,111,115,115, + 40,116,97,110,103,101,110,116,48,44,32,116,97,110,103,101,110,116,49,41,41,59,10,10,35,105,102,32,70,76, + 73,80,95,66,73,76,76,66,79,65,82,68,73,78,71,95,65,88,73,83,10,9,9,116,97,110,103,101,110,116, + 48,32,42,61,32,45,49,46,48,102,59,10,35,101,110,100,105,102,10,10,9,9,99,111,110,115,116,32,102,108, + 111,97,116,9,117,112,65,120,105,115,83,116,114,101,116,99,104,32,61,32,97,98,115,40,116,101,120,67,111,111, + 114,100,115,46,121,41,32,45,32,49,46,48,102,59,10,9,9,116,97,110,103,101,110,116,49,32,45,61,32,109, + 121,67,114,111,115,115,40,116,97,110,103,101,110,116,48,44,32,99,97,109,84,111,80,97,114,116,105,99,108,101, + 41,32,42,32,117,112,65,120,105,115,83,116,114,101,116,99,104,59,10,9,9,116,101,120,67,111,111,114,100,115, + 46,121,32,61,32,99,108,97,109,112,40,116,101,120,67,111,111,114,100,115,46,121,44,32,45,49,46,48,102,44, + 32,49,46,48,102,41,59,10,10,9,9,98,114,101,97,107,59,10,9,125,10,35,101,110,100,105,102,10,35,105, + 102,32,66,66,95,80,108,97,110,101,65,108,105,103,110,101,100,10,9,99,97,115,101,32,66,66,95,80,108,97, + 110,101,65,108,105,103,110,101,100,58,10,9,123,10,35,9,105,102,32,66,66,95,71,80,85,95,83,73,77,10, + 9,9,99,111,110,115,116,32,118,101,99,51,9,97,120,105,115,95,102,119,100,32,61,32,76,79,65,68,70,51, + 40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76, + 79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,120,105,115,48,115,79,102,102,115, + 101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101, + 73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99, + 108,101,73,68,32,42,32,51,41,41,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,97,120,105,115,95, + 110,114,109,32,61,32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80, + 85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69, + 82,40,65,120,105,115,49,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73, + 78,68,69,88,40,115,116,111,114,97,103,101,73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95, + 73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,35,9,101,108,115,101, + 10,9,9,99,111,110,115,116,32,118,101,99,51,9,97,120,105,115,95,102,119,100,32,61,32,76,79,65,68,70, + 51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,120,105,115,48,115,41,44,32,82,65,87,95, + 66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59, + 10,9,9,99,111,110,115,116,32,118,101,99,51,9,97,120,105,115,95,110,114,109,32,61,32,76,79,65,68,70, + 51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,120,105,115,49,115,41,44,32,82,65,87,95, + 66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59, + 10,35,9,101,110,100,105,102,32,47,47,32,66,66,95,71,80,85,95,83,73,77,10,10,9,9,116,97,110,103, + 101,110,116,48,32,61,32,67,111,109,112,117,116,101,84,97,110,103,101,110,116,49,40,97,120,105,115,95,110,114, + 109,44,32,97,120,105,115,95,102,119,100,32,86,83,95,80,65,82,65,77,83,41,59,10,9,9,116,97,110,103, + 101,110,116,49,32,61,32,109,121,67,114,111,115,115,40,116,97,110,103,101,110,116,48,44,32,97,120,105,115,95, + 110,114,109,41,59,10,9,9,112,108,97,110,101,78,111,114,109,97,108,32,61,32,97,120,105,115,95,110,114,109, + 59,10,10,9,9,47,47,32,83,112,101,99,105,102,105,99,32,116,111,32,112,108,97,110,97,114,32,97,108,105, + 103,110,101,100,32,113,117,97,100,115,44,32,102,108,105,112,32,88,10,9,9,82,111,116,97,116,101,84,97,110, + 103,101,110,116,115,40,112,97,114,116,105,99,108,101,73,68,44,32,116,97,110,103,101,110,116,48,44,32,116,97, + 110,103,101,110,116,49,32,86,83,95,80,65,82,65,77,83,41,59,10,9,9,10,9,9,47,47,32,65,112,112, + 108,121,32,114,97,100,105,117,115,32,97,102,116,101,114,32,114,111,116,97,116,105,111,110,44,32,111,116,104,101, + 114,119,105,115,101,32,102,108,111,97,116,50,32,115,105,122,101,115,32,97,114,101,32,105,110,99,111,114,114,101, + 99,116,10,9,9,116,97,110,103,101,110,116,48,32,42,61,32,114,97,100,105,117,115,46,120,59,10,9,9,116, + 97,110,103,101,110,116,49,32,42,61,32,114,97,100,105,117,115,46,121,59,10,9,9,116,97,110,103,101,110,116, + 48,32,61,32,45,116,97,110,103,101,110,116,48,59,10,10,9,9,98,114,101,97,107,59,10,9,125,10,35,101, + 110,100,105,102,10,9,100,101,102,97,117,108,116,58,10,9,9,98,114,101,97,107,59,10,9,125,10,10,35,105, + 102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,10,9,47,47,32,70,108, + 105,112,32,110,111,116,32,110,101,101,100,101,100,10,35,101,108,105,102,32,70,76,73,80,95,66,73,76,76,66, + 79,65,82,68,73,78,71,95,65,88,73,83,10,9,116,97,110,103,101,110,116,49,32,42,61,32,45,49,46,48, + 102,59,32,47,47,32,87,101,32,110,101,101,100,32,116,111,32,102,108,105,112,32,116,104,101,32,121,32,97,120, + 105,115,32,116,111,32,103,101,116,32,116,104,101,32,115,97,109,101,32,114,101,115,117,108,116,32,97,115,32,116, + 104,101,32,67,80,85,32,98,105,108,108,98,111,97,114,100,101,114,115,10,35,101,110,100,105,102,10,10,9,99, + 111,110,115,116,32,118,101,99,51,9,98,98,67,111,114,110,101,114,32,61,32,116,97,110,103,101,110,116,48,32, + 42,32,116,101,120,67,111,111,114,100,115,46,120,32,43,32,116,97,110,103,101,110,116,49,32,42,32,116,101,120, + 67,111,111,114,100,115,46,121,59,10,9,99,111,110,115,116,32,118,101,99,51,9,118,101,114,116,101,120,87,111, + 114,108,100,80,111,115,105,116,105,111,110,32,61,32,119,111,114,108,100,80,111,115,32,43,32,98,98,67,111,114, + 110,101,114,59,10,10,35,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108, + 101,10,9,47,42,9,87,101,32,119,97,110,116,32,116,111,32,114,101,109,97,112,32,116,104,101,32,105,110,112, + 117,116,32,116,101,120,99,111,111,114,100,115,32,116,104,97,116,32,105,110,100,105,99,97,116,101,115,32,116,104, + 101,32,101,120,112,97,110,100,32,100,105,114,101,99,116,105,111,110,44,32,105,110,116,111,32,116,104,101,32,116, + 101,120,99,111,111,114,100,115,58,10,9,42,10,9,42,9,9,9,50,9,9,32,32,51,10,9,42,9,9,32, + 32,32,49,44,49,9,9,32,49,44,45,49,9,9,9,9,9,32,32,32,49,44,49,9,9,32,49,44,49,10, + 9,42,9,9,32,32,32,44,46,45,45,45,45,45,45,45,45,45,43,9,9,9,9,9,9,32,32,32,44,43, + 45,45,45,45,45,45,45,45,45,43,10,9,42,9,32,9,32,44,39,32,124,32,32,32,32,32,32,32,46,32, + 124,32,96,46,9,9,9,9,9,32,44,39,32,124,32,32,32,32,32,32,32,46,32,124,32,96,46,10,9,42, + 9,48,44,50,9,43,32,32,32,124,32,32,32,32,46,32,32,32,32,124,32,32,32,43,32,48,44,45,50,9, + 45,62,9,48,44,49,9,43,32,32,32,124,32,32,32,32,46,32,32,32,32,124,32,32,32,43,32,49,44,48, + 10,9,42,9,32,52,9,32,39,46,32,124,32,46,32,32,32,32,32,32,32,124,32,46,39,32,32,32,53,9, + 9,9,9,32,39,46,32,124,32,46,32,32,32,32,32,32,32,124,32,46,39,10,9,42,9,9,32,32,32,43, + 46,45,45,45,45,45,45,45,45,45,43,39,9,9,9,9,9,32,32,32,39,43,45,45,45,45,45,45,45,45, + 45,43,39,10,9,42,9,9,32,45,49,44,49,9,9,45,49,44,45,49,9,9,9,9,9,32,32,48,44,48, + 9,9,32,48,44,48,10,9,42,9,9,32,32,32,49,9,9,32,32,48,10,9,42,10,9,42,9,9,73,110, + 100,105,99,101,115,58,32,49,32,51,32,48,44,32,50,32,51,32,49,44,32,51,32,53,32,48,44,32,49,32, + 52,32,50,10,9,42,47,10,9,99,111,110,115,116,32,102,108,111,97,116,9,9,120,77,97,120,32,61,32,109, + 97,120,40,99,111,114,110,101,114,67,111,111,114,100,115,46,120,44,32,48,46,48,102,41,59,10,9,116,101,120, + 67,111,111,114,100,115,32,61,32,118,101,99,50,40,120,77,97,120,32,43,32,109,97,120,40,99,111,114,110,101, + 114,67,111,111,114,100,115,46,121,32,45,32,49,46,48,102,44,32,48,46,48,102,41,44,32,120,77,97,120,32, + 43,32,109,97,120,40,45,99,111,114,110,101,114,67,111,111,114,100,115,46,121,32,45,32,49,46,48,102,44,32, + 48,46,48,102,41,41,59,10,35,101,108,115,101,10,9,47,42,9,87,101,32,119,97,110,116,32,116,111,32,114, + 101,109,97,112,32,116,104,101,32,105,110,112,117,116,32,116,101,120,99,111,111,114,100,115,32,116,104,97,116,32, + 105,110,100,105,99,97,116,101,115,32,116,104,101,32,101,120,112,97,110,100,32,100,105,114,101,99,116,105,111,110, + 44,32,105,110,116,111,32,116,104,101,32,116,101,120,99,111,111,114,100,115,58,10,9,42,10,9,42,9,9,49, + 9,9,32,32,50,10,9,42,9,32,32,45,49,44,49,9,9,32,49,44,49,9,32,32,32,48,44,49,9,9, + 32,49,44,49,10,9,42,9,9,43,45,45,45,45,45,45,45,45,45,43,9,9,9,43,45,45,45,45,45,45, + 45,45,45,43,10,9,42,9,9,124,96,46,95,32,32,32,32,32,32,124,9,9,9,124,96,46,95,32,32,32, + 32,32,32,124,10,9,42,9,9,124,32,32,32,96,46,95,32,32,32,124,9,9,45,62,9,124,32,32,32,96, + 46,95,32,32,32,124,10,9,42,9,9,124,32,32,32,32,32,32,96,46,32,124,9,9,9,124,32,32,32,32, + 32,32,96,46,32,124,10,9,42,9,9,43,45,45,45,45,45,45,45,45,96,43,9,9,9,43,45,45,45,45, + 45,45,45,45,96,43,10,9,42,9,32,45,49,44,45,49,9,9,32,49,44,45,49,9,32,32,32,48,44,48, + 9,9,32,48,44,49,10,9,42,9,32,32,32,48,9,9,32,32,51,10,9,42,10,9,42,9,73,110,100,105, + 99,101,115,58,32,49,32,51,32,48,44,32,50,32,51,32,49,10,9,42,47,10,9,116,101,120,67,111,111,114, + 100,115,32,61,32,116,101,120,67,111,111,114,100,115,32,42,32,48,46,53,102,32,43,32,48,46,53,102,59,32, + 47,47,32,82,101,109,97,112,32,99,111,114,110,101,114,115,32,102,114,111,109,32,45,49,44,49,32,116,111,32, + 48,44,49,10,35,101,110,100,105,102,10,10,9,105,102,32,40,102,108,105,112,85,41,10,9,9,116,101,120,67, + 111,111,114,100,115,46,120,32,61,32,49,46,48,102,32,45,32,116,101,120,67,111,111,114,100,115,46,120,59,10, + 9,105,102,32,40,102,108,105,112,86,41,10,9,9,116,101,120,67,111,111,114,100,115,46,121,32,61,32,49,46, + 48,102,32,45,32,116,101,120,67,111,111,114,100,115,46,121,59,10,10,35,105,102,9,100,101,102,105,110,101,100, + 40,86,79,85,84,80,85,84,95,102,114,97,103,85,86,48,41,10,35,9,105,102,32,66,66,95,70,101,97,116, + 117,114,101,95,65,116,108,97,115,10,9,99,111,110,115,116,32,117,105,110,116,9,109,97,120,65,116,108,97,115, + 73,68,32,61,32,76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,116,108,97, + 115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,48,41,41,32,45,32,49,85,59, + 10,9,10,35,9,9,105,102,32,66,66,95,71,80,85,95,83,73,77,10,9,99,111,110,115,116,32,102,108,111, + 97,116,9,116,101,120,116,117,114,101,73,68,32,61,32,76,79,65,68,70,40,71,69,84,95,82,65,87,95,66, + 85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84,95,82, + 65,87,95,66,85,70,70,69,82,40,65,116,108,97,115,95,84,101,120,116,117,114,101,73,68,115,79,102,102,115, + 101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101, + 73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99, + 108,101,73,68,41,41,59,10,35,9,9,101,108,115,101,10,9,99,111,110,115,116,32,102,108,111,97,116,9,116, + 101,120,116,117,114,101,73,68,32,61,32,76,79,65,68,70,40,71,69,84,95,82,65,87,95,66,85,70,70,69, + 82,40,65,116,108,97,115,95,84,101,120,116,117,114,101,73,68,115,41,44,32,82,65,87,95,66,85,70,70,69, + 82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,41,41,59,10,35,9,9,101,110,100,105,102, + 32,47,47,32,66,66,95,71,80,85,95,83,73,77,10,10,9,99,111,110,115,116,32,117,105,110,116,9,97,116, + 108,97,115,73,68,48,32,61,32,109,105,110,40,117,105,110,116,40,116,101,120,116,117,114,101,73,68,41,44,32, + 109,97,120,65,116,108,97,115,73,68,41,59,10,9,99,111,110,115,116,32,118,101,99,52,9,114,101,99,116,48, + 32,61,32,76,79,65,68,70,52,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,116,108,97,115, + 41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,97,116,108,97,115,73,68,48,32,42, + 32,52,32,43,32,49,41,41,59,10,10,9,118,79,117,116,112,117,116,46,102,114,97,103,85,86,48,32,61,32, + 116,101,120,67,111,111,114,100,115,32,42,32,114,101,99,116,48,46,120,121,32,43,32,114,101,99,116,48,46,122, + 119,59,10,10,35,9,9,105,102,32,100,101,102,105,110,101,100,32,40,86,79,85,84,80,85,84,95,102,114,97, + 103,85,86,49,41,10,9,99,111,110,115,116,32,117,105,110,116,9,97,116,108,97,115,73,68,49,32,61,32,109, + 105,110,40,97,116,108,97,115,73,68,48,32,43,32,49,85,44,32,109,97,120,65,116,108,97,115,73,68,41,59, + 10,9,99,111,110,115,116,32,118,101,99,52,9,114,101,99,116,49,32,61,32,76,79,65,68,70,52,40,71,69, + 84,95,82,65,87,95,66,85,70,70,69,82,40,65,116,108,97,115,41,44,32,82,65,87,95,66,85,70,70,69, + 82,95,73,78,68,69,88,40,97,116,108,97,115,73,68,49,32,42,32,52,32,43,32,49,41,41,59,10,10,9, + 118,79,117,116,112,117,116,46,102,114,97,103,85,86,49,32,61,32,116,101,120,67,111,111,114,100,115,32,42,32, + 114,101,99,116,49,46,120,121,32,43,32,114,101,99,116,49,46,122,119,59,10,10,9,47,47,32,84,111,32,98, + 101,32,114,101,109,111,118,101,100,32,105,110,32,102,117,116,117,114,101,32,80,111,112,99,111,114,110,70,88,32, + 118,101,114,115,105,111,110,115,46,32,87,101,32,97,108,114,101,97,100,121,32,111,117,116,112,117,116,32,118,79, + 117,116,112,117,116,46,102,114,97,103,65,116,108,97,115,95,84,101,120,116,117,114,101,73,68,32,103,101,110,101, + 114,97,116,101,100,10,9,47,47,32,102,114,111,109,32,97,100,100,105,116,105,111,110,97,108,32,105,110,112,117, + 116,115,46,32,84,104,105,115,32,108,105,110,101,32,103,101,110,101,114,97,116,101,115,32,97,32,100,114,105,118, + 101,114,32,98,117,103,32,111,110,32,110,118,105,100,105,97,32,99,97,114,100,115,32,105,102,32,116,104,101,32, + 34,43,32,48,46,48,48,48,48,49,102,34,32,105,115,110,39,116,32,97,100,100,101,100,46,10,9,118,79,117, + 116,112,117,116,46,102,114,97,103,65,116,108,97,115,73,68,32,61,32,116,101,120,116,117,114,101,73,68,32,43, + 32,48,46,48,48,48,48,49,102,59,10,10,35,9,9,101,110,100,105,102,10,35,9,101,108,115,101,10,9,9, + 118,79,117,116,112,117,116,46,102,114,97,103,85,86,48,32,61,32,116,101,120,67,111,111,114,100,115,59,10,35, + 9,101,110,100,105,102,10,35,101,110,100,105,102,10,10,35,105,102,9,100,101,102,105,110,101,100,40,86,79,85, + 84,80,85,84,95,102,114,97,103,78,111,114,109,97,108,41,32,124,124,32,100,101,102,105,110,101,100,40,86,79, + 85,84,80,85,84,95,102,114,97,103,84,97,110,103,101,110,116,41,10,9,99,111,110,115,116,32,102,108,111,97, + 116,9,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,32,61,32,99,117,114,114,101,110, + 116,68,114,46,121,59,10,9,105,102,32,40,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111, + 114,32,62,32,48,46,48,102,41,10,9,123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,116,97,110,103, + 101,110,116,48,78,111,114,109,32,61,32,110,111,114,109,97,108,105,122,101,40,116,97,110,103,101,110,116,48,41, + 59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,116,97,110,103,101,110,116,49,78,111,114,109,32,61,32, + 110,111,114,109,97,108,105,122,101,40,116,97,110,103,101,110,116,49,41,59,10,9,9,99,111,110,115,116,32,102, + 108,111,97,116,9,110,111,114,109,97,108,87,101,105,103,104,116,32,61,32,40,49,46,48,102,32,45,32,110,111, + 114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,41,59,10,10,35,9,105,102,9,100,101,102,105, + 110,101,100,32,40,86,79,85,84,80,85,84,95,102,114,97,103,78,111,114,109,97,108,41,10,35,9,9,105,102, + 32,66,66,95,65,120,105,115,65,108,105,103,110,101,100,67,97,112,115,117,108,101,10,9,9,99,111,110,115,116, + 32,102,108,111,97,116,9,117,112,65,120,105,115,83,116,114,101,116,99,104,32,61,32,97,98,115,40,99,111,114, + 110,101,114,67,111,111,114,100,115,46,121,41,32,45,32,49,46,48,102,59,10,9,9,99,111,110,115,116,32,118, + 101,99,51,9,98,101,110,116,78,111,114,109,97,108,32,61,32,40,116,97,110,103,101,110,116,48,78,111,114,109, + 32,42,32,99,111,114,110,101,114,67,111,111,114,100,115,46,120,32,42,32,40,49,46,48,102,32,45,32,117,112, + 65,120,105,115,83,116,114,101,116,99,104,41,32,43,32,116,97,110,103,101,110,116,49,78,111,114,109,32,42,32, + 115,105,103,110,40,99,111,114,110,101,114,67,111,111,114,100,115,46,121,41,32,42,32,117,112,65,120,105,115,83, + 116,114,101,116,99,104,41,32,42,32,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,59, + 10,35,9,9,101,108,115,101,10,9,9,99,111,110,115,116,32,118,101,99,51,9,98,101,110,116,78,111,114,109, + 97,108,32,61,32,40,116,97,110,103,101,110,116,48,78,111,114,109,32,42,32,99,111,114,110,101,114,67,111,111, + 114,100,115,46,120,32,43,32,116,97,110,103,101,110,116,49,78,111,114,109,32,42,32,99,111,114,110,101,114,67, + 111,111,114,100,115,46,121,41,32,42,32,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114, + 59,10,35,9,9,101,110,100,105,102,10,10,9,9,118,79,117,116,112,117,116,46,102,114,97,103,78,111,114,109, + 97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,112,108,97,110,101,78,111,114,109,97,108,32,42,32,110, + 111,114,109,97,108,87,101,105,103,104,116,32,43,32,98,101,110,116,78,111,114,109,97,108,41,59,10,35,9,101, + 110,100,105,102,10,10,35,9,105,102,9,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97, + 103,84,97,110,103,101,110,116,41,10,35,9,9,105,102,32,66,66,95,65,120,105,115,65,108,105,103,110,101,100, + 67,97,112,115,117,108,101,10,9,9,99,111,110,115,116,32,102,108,111,97,116,9,110,111,114,109,97,108,83,105, + 103,110,32,61,32,115,105,103,110,40,99,111,114,110,101,114,67,111,111,114,100,115,46,121,41,32,45,32,99,111, + 114,110,101,114,67,111,111,114,100,115,46,121,32,45,32,99,111,114,110,101,114,67,111,111,114,100,115,46,120,59, + 10,9,9,99,111,110,115,116,32,118,101,99,51,9,112,108,97,110,101,78,111,114,109,97,108,70,111,114,84,97, + 110,103,101,110,116,32,61,32,112,108,97,110,101,78,111,114,109,97,108,32,42,32,110,111,114,109,97,108,83,105, + 103,110,32,42,32,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,59,10,9,9,99,111, + 110,115,116,32,118,101,99,51,9,98,101,110,116,84,97,110,103,101,110,116,32,61,32,112,108,97,110,101,78,111, + 114,109,97,108,70,111,114,84,97,110,103,101,110,116,32,43,32,40,116,97,110,103,101,110,116,48,78,111,114,109, + 32,42,32,117,112,65,120,105,115,83,116,114,101,116,99,104,32,43,32,116,97,110,103,101,110,116,49,78,111,114, + 109,32,42,32,40,49,46,48,102,32,45,32,117,112,65,120,105,115,83,116,114,101,116,99,104,41,41,32,42,32, + 110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,59,10,9,9,99,111,110,115,116,32,118, + 101,99,51,9,112,108,97,110,101,84,97,110,103,101,110,116,87,101,105,103,104,116,101,100,32,61,32,110,111,114, + 109,97,108,105,122,101,40,116,97,110,103,101,110,116,48,78,111,114,109,32,43,32,116,97,110,103,101,110,116,49, + 78,111,114,109,41,32,42,32,110,111,114,109,97,108,87,101,105,103,104,116,59,10,9,9,99,111,110,115,116,32, + 102,108,111,97,116,9,116,97,110,103,101,110,116,68,105,114,32,61,32,102,108,105,112,85,32,63,32,45,49,46, + 48,102,32,58,32,49,46,48,102,59,10,9,9,99,111,110,115,116,32,102,108,111,97,116,9,98,105,116,97,110, + 103,101,110,116,68,105,114,32,61,32,102,108,105,112,85,32,33,61,32,102,108,105,112,86,32,63,32,45,49,46, + 48,102,32,58,32,49,46,48,102,59,10,9,9,118,79,117,116,112,117,116,46,102,114,97,103,84,97,110,103,101, + 110,116,32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40,112,108,97,110,101,84,97,110,103,101, + 110,116,87,101,105,103,104,116,101,100,32,43,32,98,101,110,116,84,97,110,103,101,110,116,41,32,42,32,116,97, + 110,103,101,110,116,68,105,114,44,32,98,105,116,97,110,103,101,110,116,68,105,114,41,59,10,35,9,9,101,108, + 115,101,10,9,9,99,111,110,115,116,32,118,101,99,50,9,116,97,110,103,101,110,116,84,101,120,67,111,111,114, + 100,115,32,61,32,118,101,99,50,40,45,99,111,114,110,101,114,67,111,111,114,100,115,46,120,44,32,99,111,114, + 110,101,114,67,111,111,114,100,115,46,121,32,42,32,115,105,103,110,40,45,99,111,114,110,101,114,67,111,111,114, + 100,115,46,120,41,41,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,112,108,97,110,101,78,111,114,109, + 97,108,70,111,114,84,97,110,103,101,110,116,32,61,32,112,108,97,110,101,78,111,114,109,97,108,32,42,32,116, + 97,110,103,101,110,116,84,101,120,67,111,111,114,100,115,46,120,32,42,32,110,111,114,109,97,108,66,101,110,100, + 105,110,103,70,97,99,116,111,114,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,98,101,110,116,84,97, + 110,103,101,110,116,32,61,32,112,108,97,110,101,78,111,114,109,97,108,70,111,114,84,97,110,103,101,110,116,32, + 43,32,40,116,97,110,103,101,110,116,48,78,111,114,109,32,43,32,116,97,110,103,101,110,116,49,78,111,114,109, + 32,42,32,116,97,110,103,101,110,116,84,101,120,67,111,111,114,100,115,46,121,41,32,42,32,110,111,114,109,97, + 108,66,101,110,100,105,110,103,70,97,99,116,111,114,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,112, + 108,97,110,101,84,97,110,103,101,110,116,87,101,105,103,104,116,101,100,32,61,32,116,97,110,103,101,110,116,48, + 78,111,114,109,32,42,32,110,111,114,109,97,108,87,101,105,103,104,116,59,10,9,9,99,111,110,115,116,32,102, + 108,111,97,116,32,116,97,110,103,101,110,116,68,105,114,32,61,32,102,108,105,112,85,32,63,32,45,49,46,48, + 102,32,58,32,49,46,48,102,59,10,9,9,99,111,110,115,116,32,102,108,111,97,116,9,98,105,116,97,110,103, + 101,110,116,68,105,114,32,61,32,102,108,105,112,85,32,33,61,32,102,108,105,112,86,32,63,32,49,46,48,102, + 32,58,32,45,49,46,48,102,59,10,9,9,118,79,117,116,112,117,116,46,102,114,97,103,84,97,110,103,101,110, + 116,32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40,112,108,97,110,101,84,97,110,103,101,110, + 116,87,101,105,103,104,116,101,100,32,43,32,98,101,110,116,84,97,110,103,101,110,116,41,32,42,32,116,97,110, + 103,101,110,116,68,105,114,44,32,98,105,116,97,110,103,101,110,116,68,105,114,41,59,10,35,9,9,101,110,100, + 105,102,10,35,9,101,110,100,105,102,10,9,125,10,9,101,108,115,101,10,9,123,10,35,9,105,102,9,100,101, + 102,105,110,101,100,32,40,86,79,85,84,80,85,84,95,102,114,97,103,78,111,114,109,97,108,41,10,9,9,118, + 79,117,116,112,117,116,46,102,114,97,103,78,111,114,109,97,108,32,61,32,112,108,97,110,101,78,111,114,109,97, + 108,59,10,35,9,101,110,100,105,102,10,35,9,105,102,9,100,101,102,105,110,101,100,40,86,79,85,84,80,85, + 84,95,102,114,97,103,84,97,110,103,101,110,116,41,10,35,9,9,105,102,32,66,66,95,65,120,105,115,65,108, + 105,103,110,101,100,67,97,112,115,117,108,101,10,9,9,99,111,110,115,116,32,118,101,99,51,9,116,97,110,103, + 101,110,116,48,78,111,114,109,32,61,32,110,111,114,109,97,108,105,122,101,40,116,97,110,103,101,110,116,48,41, + 59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,116,97,110,103,101,110,116,49,78,111,114,109,32,61,32, + 110,111,114,109,97,108,105,122,101,40,116,97,110,103,101,110,116,49,41,59,10,9,9,118,79,117,116,112,117,116, + 46,102,114,97,103,84,97,110,103,101,110,116,32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40, + 116,97,110,103,101,110,116,48,78,111,114,109,32,43,32,116,97,110,103,101,110,116,49,78,111,114,109,41,32,42, + 32,40,102,108,105,112,85,32,63,32,45,49,46,48,102,32,58,32,49,46,48,102,41,44,32,102,108,105,112,85, + 32,33,61,32,102,108,105,112,86,32,63,32,45,49,46,48,102,32,58,32,49,46,48,102,41,59,10,35,9,9, + 101,108,115,101,10,9,9,118,79,117,116,112,117,116,46,102,114,97,103,84,97,110,103,101,110,116,32,61,32,118, + 101,99,52,40,110,111,114,109,97,108,105,122,101,40,116,97,110,103,101,110,116,48,41,32,42,32,40,102,108,105, + 112,85,32,63,32,45,49,46,48,102,32,58,32,49,46,48,102,41,44,32,102,108,105,112,85,32,33,61,32,102, + 108,105,112,86,32,63,32,49,46,48,102,32,58,32,45,49,46,48,102,41,59,10,35,101,110,100,105,102,10,35, + 9,101,110,100,105,102,10,9,125,10,35,101,110,100,105,102,10,10,9,118,79,117,116,112,117,116,46,86,101,114, + 116,101,120,80,111,115,105,116,105,111,110,32,61,32,112,114,111,106,95,112,111,115,105,116,105,111,110,40,118,101, + 114,116,101,120,87,111,114,108,100,80,111,115,105,116,105,111,110,32,86,83,95,80,65,82,65,77,83,41,59,10, + 35,105,102,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,87,111,114,108,100,80, + 111,115,105,116,105,111,110,41,10,9,118,79,117,116,112,117,116,46,102,114,97,103,87,111,114,108,100,80,111,115, + 105,116,105,111,110,32,61,32,118,101,114,116,101,120,87,111,114,108,100,80,111,115,105,116,105,111,110,59,10,35, + 101,110,100,105,102,10,125, +}; diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/GPUSimInterface_GBuffer_ProjectToNormal.d3d.h b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/GPUSimInterface_GBuffer_ProjectToNormal.d3d.h new file mode 100644 index 00000000..ebcae135 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/GPUSimInterface_GBuffer_ProjectToNormal.d3d.h @@ -0,0 +1,58 @@ +#pragma once + +extern const char g_GPUSimInterface_GBuffer_ProjectToNormal_d3d_data[1521]; + +const char g_GPUSimInterface_GBuffer_ProjectToNormal_d3d_data[1521] = +{ + 47,47,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,10,47,47,10,47,47,9,9,95,112,107,115, + 105,95,71,66,117,102,102,101,114,95,80,114,111,106,101,99,116,84,111,78,111,114,109,97,108,10,47,47,10,47, + 47,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,10,10,47,47,32,80,75,45,83,97,109,112,108, + 101,76,105,98,32,114,101,110,100,101,114,105,110,103,32,110,111,114,109,97,108,32,117,110,112,97,99,107,32,102, + 117,110,99,116,105,111,110,10,102,108,111,97,116,51,9,85,110,112,97,99,107,78,111,114,109,97,108,83,112,104, + 101,114,101,109,97,112,40,102,108,111,97,116,50,32,110,111,114,109,97,108,41,10,123,10,9,102,108,111,97,116, + 50,9,102,101,110,99,32,61,32,110,111,114,109,97,108,32,42,32,52,46,48,102,32,45,32,50,46,48,102,59, + 10,9,102,108,111,97,116,9,102,32,61,32,100,111,116,40,102,101,110,99,44,32,102,101,110,99,41,59,10,9, + 102,108,111,97,116,9,103,32,61,32,115,113,114,116,40,49,46,48,102,32,45,32,102,32,47,32,52,46,48,102, + 41,59,10,9,102,108,111,97,116,51,9,111,117,116,78,111,114,109,97,108,59,10,10,9,111,117,116,78,111,114, + 109,97,108,46,120,121,32,61,32,102,101,110,99,32,42,32,103,59,10,9,111,117,116,78,111,114,109,97,108,46, + 122,32,61,32,49,46,48,102,32,45,32,102,32,47,32,50,46,48,102,59,10,9,114,101,116,117,114,110,32,109, + 117,108,40,85,110,112,97,99,107,78,111,114,109,97,108,86,105,101,119,44,32,102,108,111,97,116,52,40,111,117, + 116,78,111,114,109,97,108,44,32,48,46,48,102,41,41,46,120,121,122,59,10,125,10,10,47,47,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,10,10,47,47,32,79,117,116,112,117,116,115,32,116,104,101,32,71, + 66,117,102,102,101,114,32,110,111,114,109,97,108,32,118,97,108,117,101,32,97,116,32,112,114,111,106,101,99,116, + 101,100,32,119,111,114,108,100,32,112,111,115,105,116,105,111,110,10,102,108,111,97,116,51,9,69,120,116,95,95, + 112,107,115,105,95,71,66,117,102,102,101,114,95,80,114,111,106,101,99,116,84,111,78,111,114,109,97,108,95,102, + 51,50,120,51,95,67,88,40,102,108,111,97,116,51,32,112,111,115,105,116,105,111,110,44,32,105,110,111,117,116, + 32,105,110,116,52,32,115,99,101,110,101,67,116,120,41,10,123,10,9,102,108,111,97,116,52,9,99,108,105,112, + 80,111,115,105,116,105,111,110,32,61,32,109,117,108,40,86,105,101,119,80,114,111,106,44,32,102,108,111,97,116, + 52,40,112,111,115,105,116,105,111,110,44,32,49,46,48,102,41,41,59,10,9,102,108,111,97,116,50,9,115,99, + 114,101,101,110,80,111,115,105,116,105,111,110,32,61,32,99,108,105,112,80,111,115,105,116,105,111,110,46,120,121, + 32,47,32,99,108,105,112,80,111,115,105,116,105,111,110,46,119,59,10,9,102,108,111,97,116,50,9,115,99,114, + 101,101,110,85,86,32,61,32,115,99,114,101,101,110,80,111,115,105,116,105,111,110,32,42,32,48,46,53,102,32, + 43,32,48,46,53,102,59,10,10,9,47,47,32,82,101,116,117,114,110,32,122,101,114,111,32,110,111,114,109,97, + 108,32,105,102,32,105,110,112,117,116,32,112,111,115,105,116,105,111,110,32,105,115,32,111,117,116,115,105,100,101, + 32,111,102,32,118,105,101,119,58,10,9,47,47,32,98,114,97,110,99,104,105,110,103,32,98,101,108,111,119,32, + 99,111,117,108,100,32,97,108,115,111,32,98,101,32,114,101,109,111,118,101,100,32,98,121,32,99,104,97,110,103, + 105,110,103,32,83,99,101,110,101,84,101,120,116,117,114,101,115,83,97,109,112,108,101,114,39,115,32,97,100,100, + 114,101,115,115,105,110,103,32,109,111,100,101,32,116,111,32,84,69,88,84,85,82,69,95,65,68,68,82,69,83, + 83,95,77,79,68,69,95,66,79,82,68,69,82,32,97,110,100,32,104,97,118,105,110,103,32,97,32,122,101,114, + 111,32,98,111,114,100,101,114,32,99,111,108,111,114,10,9,102,108,111,97,116,51,9,119,111,114,108,100,78,111, + 114,109,97,108,32,61,32,102,108,111,97,116,51,40,48,46,48,102,44,32,48,46,48,102,44,32,48,46,48,102, + 41,59,10,9,105,102,32,40,97,108,108,40,97,98,115,40,115,99,114,101,101,110,80,111,115,105,116,105,111,110, + 46,120,121,41,32,60,61,32,102,108,111,97,116,50,40,49,44,32,49,41,41,41,10,9,123,10,9,9,102,108, + 111,97,116,52,9,112,97,99,107,101,100,78,111,114,109,97,108,82,111,117,103,104,77,101,116,97,108,32,61,32, + 83,99,101,110,101,78,111,114,109,97,108,46,83,97,109,112,108,101,76,101,118,101,108,40,83,99,101,110,101,84, + 101,120,116,117,114,101,115,83,97,109,112,108,101,114,44,32,115,99,114,101,101,110,85,86,44,32,48,41,59,10, + 9,9,119,111,114,108,100,78,111,114,109,97,108,32,61,32,85,110,112,97,99,107,78,111,114,109,97,108,83,112, + 104,101,114,101,109,97,112,40,112,97,99,107,101,100,78,111,114,109,97,108,82,111,117,103,104,77,101,116,97,108, + 46,114,103,41,59,10,9,125,10,9,114,101,116,117,114,110,32,119,111,114,108,100,78,111,114,109,97,108,59,10, + 125,10,10,47,47,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +}; diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/GPUSimInterface_GBuffer_ProjectToPosition.d3d.h b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/GPUSimInterface_GBuffer_ProjectToPosition.d3d.h new file mode 100644 index 00000000..fcf10e16 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/GPUSimInterface_GBuffer_ProjectToPosition.d3d.h @@ -0,0 +1,48 @@ +#pragma once + +extern const char g_GPUSimInterface_GBuffer_ProjectToPosition_d3d_data[1223]; + +const char g_GPUSimInterface_GBuffer_ProjectToPosition_d3d_data[1223] = +{ + 47,47,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,10,47,47,10,47,47,9,9,95,112,107,115, + 105,95,71,66,117,102,102,101,114,95,80,114,111,106,101,99,116,84,111,80,111,115,105,116,105,111,110,10,47,47, + 10,47,47,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,10,10,102,108,111,97,116,51,32,32,32, + 32,68,101,112,116,104,84,111,87,111,114,108,100,80,111,115,40,102,108,111,97,116,32,100,101,112,116,104,44,32, + 102,108,111,97,116,50,32,115,99,114,101,101,110,85,86,115,41,10,123,10,9,102,108,111,97,116,50,9,99,108, + 105,112,83,112,97,99,101,32,61,32,115,99,114,101,101,110,85,86,115,32,42,32,50,32,45,32,49,59,10,9, + 102,108,111,97,116,52,9,112,114,111,106,80,111,115,32,61,32,102,108,111,97,116,52,40,99,108,105,112,83,112, + 97,99,101,44,32,100,101,112,116,104,44,32,49,41,59,10,10,9,112,114,111,106,80,111,115,32,61,32,109,117, + 108,40,73,110,118,86,105,101,119,80,114,111,106,44,32,112,114,111,106,80,111,115,41,59,10,9,114,101,116,117, + 114,110,32,112,114,111,106,80,111,115,46,120,121,122,32,47,32,112,114,111,106,80,111,115,46,119,59,10,125,10, + 10,47,47,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,10,10,47,47,32,79,117,116,112,117,116, + 115,32,116,104,101,32,83,99,101,110,101,68,101,112,116,104,32,109,97,112,32,118,97,108,117,101,32,97,116,32, + 112,114,111,106,101,99,116,101,100,32,119,111,114,108,100,32,112,111,115,105,116,105,111,110,10,102,108,111,97,116, + 51,9,69,120,116,95,95,112,107,115,105,95,71,66,117,102,102,101,114,95,80,114,111,106,101,99,116,84,111,80, + 111,115,105,116,105,111,110,95,102,51,50,120,51,95,67,88,40,102,108,111,97,116,51,32,112,111,115,105,116,105, + 111,110,44,32,105,110,111,117,116,32,105,110,116,52,32,115,99,101,110,101,67,116,120,41,10,123,10,9,102,108, + 111,97,116,52,9,99,108,105,112,80,111,115,105,116,105,111,110,32,61,32,109,117,108,40,86,105,101,119,80,114, + 111,106,44,32,102,108,111,97,116,52,40,112,111,115,105,116,105,111,110,44,32,49,46,48,102,41,41,59,10,9, + 102,108,111,97,116,50,9,115,99,114,101,101,110,80,111,115,105,116,105,111,110,32,61,32,99,108,105,112,80,111, + 115,105,116,105,111,110,46,120,121,32,47,32,99,108,105,112,80,111,115,105,116,105,111,110,46,119,59,10,9,102, + 108,111,97,116,50,9,115,99,114,101,101,110,85,86,32,61,32,115,99,114,101,101,110,80,111,115,105,116,105,111, + 110,32,42,32,48,46,53,102,32,43,32,48,46,53,102,59,10,10,9,47,47,32,82,101,116,117,114,110,32,102, + 111,114,119,97,114,100,101,100,32,105,110,112,117,116,32,112,111,115,105,116,105,111,110,32,105,102,32,105,110,112, + 117,116,32,112,111,115,105,116,105,111,110,32,105,115,32,111,117,116,115,105,100,101,32,111,102,32,118,105,101,119, + 10,9,102,108,111,97,116,51,9,119,111,114,108,100,80,111,115,32,61,32,112,111,115,105,116,105,111,110,59,10, + 9,105,102,32,40,97,108,108,40,97,98,115,40,115,99,114,101,101,110,80,111,115,105,116,105,111,110,46,120,121, + 41,32,60,61,32,102,108,111,97,116,50,40,49,44,32,49,41,41,41,10,9,123,10,9,9,102,108,111,97,116, + 9,115,97,109,112,108,101,100,68,101,112,116,104,32,61,32,83,99,101,110,101,68,101,112,116,104,46,83,97,109, + 112,108,101,76,101,118,101,108,40,83,99,101,110,101,84,101,120,116,117,114,101,115,83,97,109,112,108,101,114,44, + 32,115,99,114,101,101,110,85,86,44,32,48,41,46,114,59,10,9,9,119,111,114,108,100,80,111,115,32,61,32, + 68,101,112,116,104,84,111,87,111,114,108,100,80,111,115,40,115,97,109,112,108,101,100,68,101,112,116,104,44,32, + 115,99,114,101,101,110,85,86,41,59,10,9,125,10,9,114,101,116,117,114,110,32,119,111,114,108,100,80,111,115, + 59,10,125,10,10,47,47,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +}; diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Ribbon.vert.h b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Ribbon.vert.h new file mode 100644 index 00000000..9de92dce --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Ribbon.vert.h @@ -0,0 +1,424 @@ +#pragma once + +extern const char g_Ribbon_vert_data[12506]; + +const char g_Ribbon_vert_data[12506] = +{ + 35,105,102,9,33,100,101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,9,35,101,114,114, + 111,114,32,34,86,101,114,116,101,120,32,114,105,98,98,111,110,32,98,105,108,108,98,111,97,114,100,105,110,103, + 32,111,110,108,121,32,105,109,112,108,101,109,101,110,116,101,100,32,102,111,114,32,71,80,85,32,115,116,111,114, + 97,103,101,34,10,35,101,110,100,105,102,10,10,35,105,102,32,66,66,95,70,101,97,116,117,114,101,67,48,10, + 35,9,100,101,102,105,110,101,32,82,66,95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,9,9,9,49, + 85,10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,80,111,115,105, + 116,105,111,110,115,79,102,102,115,101,116,115,41,10,35,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103, + 32,80,111,115,105,116,105,111,110,115,79,102,102,115,101,116,115,32,83,82,86,10,35,9,101,110,100,105,102,10, + 35,101,108,115,101,10,35,9,101,114,114,111,114,32,99,111,110,102,105,103,32,101,114,114,111,114,10,35,101,110, + 100,105,102,10,10,35,105,102,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,85, + 86,49,41,10,35,9,105,102,32,33,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103, + 65,116,108,97,115,73,68,41,10,35,9,9,101,114,114,111,114,32,34,99,111,110,102,105,103,32,101,114,114,111, + 114,34,10,35,9,101,110,100,105,102,10,35,101,108,115,101,10,35,9,105,102,32,100,101,102,105,110,101,100,40, + 86,79,85,84,80,85,84,95,102,114,97,103,65,116,108,97,115,73,68,41,10,35,9,9,101,114,114,111,114,32, + 34,99,111,110,102,105,103,32,101,114,114,111,114,34,10,35,9,101,110,100,105,102,10,35,101,110,100,105,102,10, + 35,105,102,32,66,66,95,70,101,97,116,117,114,101,95,65,116,108,97,115,10,35,9,105,102,32,33,100,101,102, + 105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,65,116,108,97,115,95,84,101,120,116,117,114,101,73,68, + 115,79,102,102,115,101,116,115,41,10,35,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,84,101,120, + 116,117,114,101,73,68,115,79,102,102,115,101,116,115,32,83,82,86,10,35,9,101,110,100,105,102,10,35,101,110, + 100,105,102,10,10,35,105,102,32,66,66,95,70,101,97,116,117,114,101,67,49,10,35,9,100,101,102,105,110,101, + 32,78,79,82,77,65,76,73,90,69,82,95,69,80,83,73,76,79,78,9,9,9,9,49,46,48,101,45,56,102, + 10,35,9,100,101,102,105,110,101,32,82,66,95,78,111,114,109,97,108,65,120,105,115,65,108,105,103,110,101,100, + 9,9,9,9,50,85,10,35,9,100,101,102,105,110,101,32,82,66,95,83,105,100,101,65,120,105,115,65,108,105, + 103,110,101,100,9,9,9,9,51,85,10,35,9,100,101,102,105,110,101,32,82,66,95,83,105,100,101,65,120,105, + 115,65,108,105,103,110,101,100,84,117,98,101,9,9,9,52,85,10,35,9,100,101,102,105,110,101,32,82,66,95, + 83,105,100,101,65,120,105,115,65,108,105,103,110,101,100,77,117,108,116,105,80,108,97,110,101,9,9,53,85,10, + 35,9,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,65,120,105,115,48,115, + 79,102,102,115,101,116,115,41,10,35,9,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,65,120,105,115, + 48,115,79,102,102,115,101,116,115,32,83,82,86,10,35,9,101,110,100,105,102,10,35,101,110,100,105,102,10,10, + 35,100,101,102,105,110,101,9,70,76,73,80,95,66,73,76,76,66,79,65,82,68,73,78,71,95,65,88,73,83, + 9,9,49,10,10,35,105,102,9,33,100,101,102,105,110,101,100,40,67,79,78,83,84,95,66,105,108,108,98,111, + 97,114,100,73,110,102,111,95,68,114,97,119,82,101,113,117,101,115,116,41,10,35,101,114,114,111,114,32,34,77, + 105,115,115,105,110,103,32,99,111,110,115,116,97,110,116,32,119,105,116,104,32,105,110,102,111,115,32,102,111,114, + 32,98,105,108,108,98,111,97,114,100,34,10,35,101,110,100,105,102,10,10,35,105,102,32,100,101,102,105,110,101, + 100,40,67,79,78,83,84,95,66,105,108,108,98,111,97,114,100,73,110,102,111,95,68,114,97,119,82,101,113,117, + 101,115,116,41,10,35,100,101,102,105,110,101,9,66,66,95,70,108,97,103,95,66,105,108,108,98,111,97,114,100, + 77,97,115,107,9,55,85,9,47,47,32,51,32,102,105,114,115,116,115,32,98,105,116,115,10,35,100,101,102,105, + 110,101,9,66,66,95,70,108,97,103,95,86,70,108,105,112,85,9,9,9,56,85,9,47,47,32,52,116,104,32, + 98,105,116,10,35,100,101,102,105,110,101,9,66,66,95,70,108,97,103,95,86,70,108,105,112,86,9,9,9,49, + 54,85,9,47,47,32,53,116,104,32,98,105,116,10,35,100,101,102,105,110,101,9,66,66,95,70,108,97,103,95, + 86,82,111,116,97,116,101,84,101,120,116,117,114,101,9,51,50,85,9,47,47,32,53,116,104,32,98,105,116,10, + 35,101,110,100,105,102,10,10,35,105,102,9,9,33,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99, + 101,110,101,73,110,102,111,95,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,10,35,9,101,114, + 114,111,114,32,34,77,105,115,115,105,110,103,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,32, + 109,97,116,114,105,120,32,105,110,32,83,99,101,110,101,73,110,102,111,34,10,35,101,110,100,105,102,10,35,105, + 102,9,9,33,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99,101,110,101,73,110,102,111,95,83,105, + 100,101,86,101,99,116,111,114,41,10,35,9,101,114,114,111,114,32,34,77,105,115,115,105,110,103,32,86,105,101, + 119,32,115,105,100,101,32,118,101,99,116,111,114,32,105,110,32,83,99,101,110,101,73,110,102,111,34,10,35,101, + 110,100,105,102,10,35,105,102,9,9,33,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99,101,110,101, + 73,110,102,111,95,68,101,112,116,104,86,101,99,116,111,114,41,10,35,9,101,114,114,111,114,32,34,77,105,115, + 115,105,110,103,32,86,105,101,119,32,100,101,112,116,104,32,118,101,99,116,111,114,32,105,110,32,83,99,101,110, + 101,73,110,102,111,34,10,35,101,110,100,105,102,10,10,47,47,9,68,114,97,119,82,101,113,117,101,115,116,58, + 10,47,47,32,120,58,32,70,108,97,103,115,10,47,47,32,121,58,32,78,111,114,109,97,108,115,66,101,110,100, + 105,110,103,70,97,99,116,111,114,10,10,47,47,32,82,105,103,104,116,72,97,110,100,101,100,47,76,101,102,116, + 72,97,110,100,101,100,58,10,35,100,101,102,105,110,101,9,109,121,67,114,111,115,115,40,97,44,32,98,41,32, + 32,99,114,111,115,115,40,97,44,32,98,41,32,42,32,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99, + 101,110,101,73,110,102,111,44,32,72,97,110,100,101,100,110,101,115,115,41,10,10,118,101,99,52,9,112,114,111, + 106,95,112,111,115,105,116,105,111,110,40,73,78,40,118,101,99,51,41,32,112,111,115,105,116,105,111,110,32,86, + 83,95,65,82,71,83,41,10,123,10,35,105,102,9,100,101,102,105,110,101,100,40,67,79,78,83,84,95,83,99, + 101,110,101,73,110,102,111,95,86,105,101,119,80,114,111,106,41,10,9,114,101,116,117,114,110,32,109,117,108,40, + 71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,86,105,101,119,80,114, + 111,106,41,44,32,118,101,99,52,40,112,111,115,105,116,105,111,110,44,32,49,46,48,102,41,41,59,10,35,101, + 108,115,101,10,9,114,101,116,117,114,110,32,118,101,99,52,40,112,111,115,105,116,105,111,110,44,32,49,46,48, + 102,41,59,10,35,101,110,100,105,102,10,125,10,10,117,105,110,116,9,86,101,114,116,101,120,66,105,108,108,98, + 111,97,114,100,40,73,78,40,83,86,101,114,116,101,120,73,110,112,117,116,41,32,118,73,110,112,117,116,44,32, + 73,78,79,85,84,40,83,86,101,114,116,101,120,79,117,116,112,117,116,41,32,118,79,117,116,112,117,116,44,32, + 117,105,110,116,32,105,110,80,97,114,116,105,99,108,101,73,68,32,86,83,95,65,82,71,83,41,10,123,10,9, + 99,111,110,115,116,32,117,105,110,116,9,115,116,111,114,97,103,101,73,100,32,61,32,71,69,84,95,67,79,78, + 83,84,65,78,84,40,71,80,85,66,105,108,108,98,111,97,114,100,80,117,115,104,67,111,110,115,116,97,110,116, + 115,44,32,83,116,114,101,97,109,79,102,102,115,101,116,115,73,110,100,101,120,41,59,10,9,99,111,110,115,116, + 32,117,105,110,116,9,112,97,114,116,105,99,108,101,67,111,117,110,116,32,61,32,76,79,65,68,85,40,71,69, + 84,95,82,65,87,95,66,85,70,70,69,82,40,73,110,100,105,114,101,99,116,68,114,97,119,41,44,32,82,65, + 87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,32,42,32,53,32,43, + 32,49,41,41,59,10,9,99,111,110,115,116,32,117,105,110,116,9,109,97,120,73,68,32,61,32,112,97,114,116, + 105,99,108,101,67,111,117,110,116,32,45,32,49,59,10,10,9,47,47,32,86,101,114,116,101,120,32,116,101,120, + 99,111,111,114,100,115,32,97,114,101,32,105,110,32,114,97,110,103,101,32,91,45,49,32,43,49,93,32,97,110, + 100,32,117,115,101,100,32,116,111,32,98,117,105,108,100,32,118,101,114,116,101,120,32,112,111,115,105,116,105,111, + 110,10,9,99,111,110,115,116,32,98,111,111,108,9,105,115,76,101,102,116,83,105,100,101,32,61,32,32,118,73, + 110,112,117,116,46,84,101,120,67,111,111,114,100,115,46,120,32,60,32,48,46,48,102,59,10,10,9,47,47,32, + 67,111,109,112,117,116,101,32,105,110,100,105,114,101,99,116,101,100,32,112,97,114,116,105,99,108,101,32,73,68, + 115,10,9,99,111,110,115,116,32,117,105,110,116,9,105,110,80,97,114,116,105,99,108,101,73,68,79,102,102,115, + 101,116,116,101,100,32,61,32,105,110,80,97,114,116,105,99,108,101,73,68,32,43,32,40,105,115,76,101,102,116, + 83,105,100,101,32,63,32,48,32,58,32,49,41,59,32,47,47,32,79,102,102,115,101,116,32,112,97,114,116,105, + 99,108,101,32,73,68,32,102,111,114,32,116,104,101,32,114,105,103,104,116,32,115,105,100,101,32,118,101,114,116, + 105,99,101,115,10,9,99,111,110,115,116,32,117,105,110,116,9,112,97,114,116,105,99,108,101,73,68,32,61,32, + 76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,82,105,98,98,111,110,73,110,100, + 105,114,101,99,116,105,111,110,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,105,110, + 80,97,114,116,105,99,108,101,73,68,79,102,102,115,101,116,116,101,100,41,41,59,10,9,117,105,110,116,9,9, + 112,97,114,116,105,99,108,101,73,68,80,114,101,118,32,61,32,76,79,65,68,85,40,71,69,84,95,82,65,87, + 95,66,85,70,70,69,82,40,82,105,98,98,111,110,73,110,100,105,114,101,99,116,105,111,110,41,44,32,82,65, + 87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,117,105,110,116,40,109,97,120,40,105,110,116,40,105,110, + 80,97,114,116,105,99,108,101,73,68,79,102,102,115,101,116,116,101,100,41,32,45,32,49,44,32,48,41,41,41, + 41,59,10,9,117,105,110,116,9,9,112,97,114,116,105,99,108,101,73,68,78,101,120,116,32,61,32,76,79,65, + 68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,82,105,98,98,111,110,73,110,100,105,114,101, + 99,116,105,111,110,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,109,105,110,40,105, + 110,80,97,114,116,105,99,108,101,73,68,79,102,102,115,101,116,116,101,100,32,43,32,49,44,32,109,97,120,73, + 68,41,41,41,59,10,10,9,47,47,32,80,97,114,101,110,116,73,68,115,10,9,99,111,110,115,116,32,117,105, + 110,116,9,112,97,114,101,110,116,73,68,79,102,102,115,101,116,32,61,32,76,79,65,68,85,40,71,69,84,95, + 82,65,87,95,66,85,70,70,69,82,40,80,97,114,101,110,116,73,68,115,79,102,102,115,101,116,115,41,44,32, + 82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,41,41,59,10, + 9,99,111,110,115,116,32,117,105,110,116,9,112,97,114,101,110,116,73,68,32,61,32,76,79,65,68,85,50,40, + 71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,112,97, + 114,101,110,116,73,68,79,102,102,115,101,116,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69, + 88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,50,41,41,46,120,59,10,9,99,111,110,115,116,32,117, + 105,110,116,9,112,97,114,101,110,116,73,68,80,114,101,118,32,61,32,76,79,65,68,85,50,40,71,69,84,95, + 82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,112,97,114,101,110,116, + 73,68,79,102,102,115,101,116,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97, + 114,116,105,99,108,101,73,68,80,114,101,118,32,42,32,50,41,41,46,120,59,10,9,99,111,110,115,116,32,117, + 105,110,116,9,112,97,114,101,110,116,73,68,78,101,120,116,32,61,32,76,79,65,68,85,50,40,71,69,84,95, + 82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,112,97,114,101,110,116, + 73,68,79,102,102,115,101,116,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97, + 114,116,105,99,108,101,73,68,78,101,120,116,32,42,32,50,41,41,46,120,59,10,9,47,47,32,73,102,32,112, + 114,101,118,32,111,114,32,110,101,120,116,32,112,97,114,116,105,99,108,101,115,32,97,114,101,32,102,114,111,109, + 32,97,110,111,116,104,101,114,32,114,105,98,98,111,110,44,32,117,115,101,32,109,105,100,100,108,101,32,112,97, + 114,116,105,99,108,101,73,68,46,10,9,105,102,32,40,112,97,114,101,110,116,73,68,80,114,101,118,32,33,61, + 32,112,97,114,101,110,116,73,68,41,10,9,9,112,97,114,116,105,99,108,101,73,68,80,114,101,118,32,61,32, + 112,97,114,116,105,99,108,101,73,68,59,10,9,105,102,32,40,112,97,114,101,110,116,73,68,78,101,120,116,32, + 33,61,32,112,97,114,101,110,116,73,68,41,10,9,9,112,97,114,116,105,99,108,101,73,68,78,101,120,116,32, + 61,32,112,97,114,116,105,99,108,101,73,68,59,10,10,9,47,47,32,80,111,115,105,116,105,111,110,115,10,9, + 99,111,110,115,116,32,117,105,110,116,9,112,111,115,79,102,102,115,101,116,32,61,32,76,79,65,68,85,40,71, + 69,84,95,82,65,87,95,66,85,70,70,69,82,40,80,111,115,105,116,105,111,110,115,79,102,102,115,101,116,115, + 41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,41, + 41,59,10,9,99,111,110,115,116,32,118,101,99,51,9,112,111,115,32,61,32,76,79,65,68,70,51,40,71,69, + 84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,112,111,115,79, + 102,102,115,101,116,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105, + 99,108,101,73,68,32,42,32,51,41,41,59,10,9,99,111,110,115,116,32,118,101,99,51,9,112,111,115,80,114, + 101,118,32,61,32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85, + 83,105,109,68,97,116,97,41,44,32,112,111,115,79,102,102,115,101,116,32,43,32,82,65,87,95,66,85,70,70, + 69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,80,114,101,118,32,42,32,51,41,41,59, + 10,9,99,111,110,115,116,32,118,101,99,51,9,112,111,115,78,101,120,116,32,61,32,76,79,65,68,70,51,40, + 71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,112,111, + 115,79,102,102,115,101,116,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114, + 116,105,99,108,101,73,68,78,101,120,116,32,42,32,51,41,41,59,10,9,99,111,110,115,116,32,118,101,99,51, + 9,99,101,110,116,101,114,32,61,32,48,46,53,102,32,42,32,40,112,111,115,32,43,32,40,105,115,76,101,102, + 116,83,105,100,101,32,63,32,112,111,115,78,101,120,116,32,58,32,112,111,115,80,114,101,118,41,41,59,10,10, + 9,47,47,32,68,111,32,110,111,116,32,114,101,110,100,101,114,32,105,102,46,46,46,10,9,99,111,110,115,116, + 32,98,111,111,108,9,105,115,76,97,115,116,32,61,9,40,105,115,76,101,102,116,83,105,100,101,32,38,38,32, + 40,112,97,114,101,110,116,73,68,32,33,61,32,112,97,114,101,110,116,73,68,78,101,120,116,41,41,32,124,124, + 10,9,9,9,9,9,9,9,40,33,105,115,76,101,102,116,83,105,100,101,32,38,38,32,40,112,97,114,101,110, + 116,73,68,32,33,61,32,112,97,114,101,110,116,73,68,80,114,101,118,41,41,32,124,124,10,9,9,9,9,9, + 9,9,40,105,110,80,97,114,116,105,99,108,101,73,68,32,61,61,32,109,97,120,73,68,41,59,10,9,99,111, + 110,115,116,32,102,108,111,97,116,9,100,111,82,101,110,100,101,114,32,61,32,105,115,76,97,115,116,32,63,32, + 48,46,48,102,32,58,32,49,46,48,102,59,10,10,9,47,47,32,83,105,122,101,10,9,99,111,110,115,116,32, + 117,105,110,116,9,115,105,122,101,115,79,102,102,115,101,116,32,61,32,76,79,65,68,85,40,71,69,84,95,82, + 65,87,95,66,85,70,70,69,82,40,83,105,122,101,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66, + 85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,41,41,59,10,9,99,111,110,115, + 116,32,102,108,111,97,116,9,115,105,122,101,32,61,32,76,79,65,68,70,40,71,69,84,95,82,65,87,95,66, + 85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,115,105,122,101,115,79,102,102,115,101,116, + 32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68, + 41,41,59,10,10,9,99,111,110,115,116,32,117,105,110,116,9,100,114,73,100,32,61,32,48,59,32,47,47,32, + 78,111,32,98,97,116,99,104,105,110,103,32,121,101,116,32,102,111,114,32,71,80,85,32,112,97,114,116,105,99, + 108,101,115,10,9,99,111,110,115,116,32,118,101,99,52,9,99,117,114,114,101,110,116,68,114,32,61,32,71,69, + 84,95,67,79,78,83,84,65,78,84,40,66,105,108,108,98,111,97,114,100,73,110,102,111,44,32,68,114,97,119, + 82,101,113,117,101,115,116,41,91,100,114,73,100,93,59,10,9,99,111,110,115,116,32,117,105,110,116,9,102,108, + 97,103,115,32,61,32,97,115,117,105,110,116,40,99,117,114,114,101,110,116,68,114,46,120,41,59,10,9,99,111, + 110,115,116,32,117,105,110,116,9,98,105,108,108,98,111,97,114,100,101,114,84,121,112,101,32,61,32,102,108,97, + 103,115,32,38,32,66,66,95,70,108,97,103,95,66,105,108,108,98,111,97,114,100,77,97,115,107,59,10,9,99, + 111,110,115,116,32,118,101,99,51,9,118,105,101,119,80,111,115,32,61,32,71,69,84,95,77,65,84,82,73,88, + 95,87,95,65,88,73,83,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111, + 44,32,66,105,108,108,98,111,97,114,100,105,110,103,86,105,101,119,41,41,46,120,121,122,59,10,9,99,111,110, + 115,116,32,102,108,111,97,116,9,113,117,97,100,67,111,117,110,116,32,61,32,99,117,114,114,101,110,116,68,114, + 46,122,59,10,10,9,47,47,32,66,105,108,108,98,111,97,114,100,105,110,103,32,119,105,108,108,32,119,114,105, + 116,101,32,116,104,111,115,101,58,32,10,9,118,101,99,51,9,9,116,97,110,103,101,110,116,48,32,61,32,118, + 101,99,51,40,48,44,32,48,44,32,48,41,59,32,47,47,32,82,105,98,98,111,110,32,115,105,100,101,32,97, + 120,105,115,44,32,117,110,110,111,114,109,97,108,105,122,101,100,10,9,118,101,99,51,9,9,116,97,110,103,101, + 110,116,49,32,61,32,118,101,99,51,40,48,44,32,48,44,32,48,41,59,32,47,47,32,82,105,98,98,111,110, + 32,108,111,110,103,105,116,117,100,105,110,97,108,32,97,120,105,115,44,32,117,110,110,111,114,109,97,108,105,122, + 101,100,10,9,118,101,99,51,9,9,110,111,114,109,97,108,32,61,32,118,101,99,51,40,48,44,32,48,44,32, + 48,41,59,32,47,47,32,86,101,114,116,101,120,32,110,111,114,109,97,108,32,118,101,99,116,111,114,10,10,9, + 102,108,111,97,116,9,9,113,117,97,100,73,100,32,61,32,49,46,48,102,59,10,10,35,105,102,32,82,66,95, + 83,105,100,101,65,120,105,115,65,108,105,103,110,101,100,77,117,108,116,105,80,108,97,110,101,32,38,38,32,82, + 66,95,83,105,100,101,65,120,105,115,65,108,105,103,110,101,100,84,117,98,101,10,10,9,47,47,32,84,104,101, + 32,116,101,120,99,111,111,114,100,115,32,117,32,118,97,108,117,101,32,97,114,101,32,109,117,108,116,105,112,108, + 105,101,100,32,98,121,32,116,104,101,32,99,117,114,114,101,110,116,32,112,108,97,110,101,73,100,46,10,9,105, + 102,32,40,98,105,108,108,98,111,97,114,100,101,114,84,121,112,101,32,61,61,32,82,66,95,83,105,100,101,65, + 120,105,115,65,108,105,103,110,101,100,77,117,108,116,105,80,108,97,110,101,32,124,124,32,98,105,108,108,98,111, + 97,114,100,101,114,84,121,112,101,32,61,61,32,82,66,95,83,105,100,101,65,120,105,115,65,108,105,103,110,101, + 100,84,117,98,101,41,10,9,123,10,9,9,113,117,97,100,73,100,32,61,32,97,98,115,40,118,73,110,112,117, + 116,46,84,101,120,67,111,111,114,100,115,46,120,41,59,10,10,9,125,10,35,101,110,100,105,102,10,10,9,9, + 10,9,115,119,105,116,99,104,32,40,98,105,108,108,98,111,97,114,100,101,114,84,121,112,101,41,10,9,123,10, + 35,105,102,32,82,66,95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,10,9,99,97,115,101,32,82,66, + 95,86,105,101,119,112,111,115,65,108,105,103,110,101,100,58,10,9,123,10,9,9,99,111,110,115,116,32,118,101, + 99,51,9,112,114,101,118,84,111,78,101,120,116,32,61,32,112,111,115,78,101,120,116,32,45,32,112,111,115,80, + 114,101,118,59,10,9,9,110,111,114,109,97,108,32,61,32,112,111,115,32,45,32,118,105,101,119,80,111,115,59, + 10,9,9,116,97,110,103,101,110,116,49,32,61,32,105,115,76,101,102,116,83,105,100,101,32,63,32,40,112,111, + 115,78,101,120,116,32,45,32,112,111,115,41,32,58,32,40,112,111,115,32,45,32,112,111,115,80,114,101,118,41, + 59,9,10,9,9,116,97,110,103,101,110,116,48,32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114, + 111,115,115,40,110,111,114,109,97,108,44,32,112,114,101,118,84,111,78,101,120,116,41,41,59,9,10,9,9,110, + 111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114,111,115,115,40,116,97,110,103, + 101,110,116,48,44,32,112,114,101,118,84,111,78,101,120,116,41,41,59,10,9,9,116,97,110,103,101,110,116,48, + 32,42,61,32,115,105,122,101,32,42,32,100,111,82,101,110,100,101,114,59,10,10,9,9,98,114,101,97,107,59, + 10,9,125,10,35,101,110,100,105,102,10,35,105,102,32,82,66,95,78,111,114,109,97,108,65,120,105,115,65,108, + 105,103,110,101,100,10,9,99,97,115,101,32,82,66,95,78,111,114,109,97,108,65,120,105,115,65,108,105,103,110, + 101,100,58,10,9,123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,112,114,101,118,84,111,78,101,120,116, + 32,61,32,112,111,115,78,101,120,116,32,45,32,112,111,115,80,114,101,118,59,10,9,9,110,111,114,109,97,108, + 32,61,32,45,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83, + 105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40, + 65,120,105,115,48,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68, + 69,88,40,115,116,111,114,97,103,101,73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78, + 68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,9,9,116,97,110,103,101,110, + 116,49,32,61,32,105,115,76,101,102,116,83,105,100,101,32,63,32,40,112,111,115,78,101,120,116,32,45,32,112, + 111,115,41,32,58,32,40,112,111,115,32,45,32,112,111,115,80,114,101,118,41,59,9,10,9,9,116,97,110,103, + 101,110,116,48,32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114,111,115,115,40,110,111,114,109,97, + 108,44,32,112,114,101,118,84,111,78,101,120,116,41,41,59,10,9,9,110,111,114,109,97,108,32,61,32,110,111, + 114,109,97,108,105,122,101,40,109,121,67,114,111,115,115,40,116,97,110,103,101,110,116,48,44,32,112,114,101,118, + 84,111,78,101,120,116,41,41,59,10,9,9,116,97,110,103,101,110,116,48,32,42,61,32,115,105,122,101,32,42, + 32,100,111,82,101,110,100,101,114,59,10,10,9,9,98,114,101,97,107,59,10,9,125,10,35,101,110,100,105,102, + 10,35,105,102,32,82,66,95,83,105,100,101,65,120,105,115,65,108,105,103,110,101,100,9,10,9,99,97,115,101, + 32,82,66,95,83,105,100,101,65,120,105,115,65,108,105,103,110,101,100,58,10,9,123,10,9,9,99,111,110,115, + 116,32,118,101,99,51,9,112,114,101,118,84,111,78,101,120,116,32,61,32,112,111,115,78,101,120,116,32,45,32, + 112,111,115,80,114,101,118,59,10,9,9,116,97,110,103,101,110,116,49,32,61,32,105,115,76,101,102,116,83,105, + 100,101,32,63,32,40,112,111,115,78,101,120,116,32,45,32,112,111,115,41,32,58,32,40,112,111,115,32,45,32, + 112,111,115,80,114,101,118,41,59,9,10,9,9,116,97,110,103,101,110,116,48,32,61,32,45,110,111,114,109,97, + 108,105,122,101,40,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85, + 83,105,109,68,97,116,97,41,44,32,76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82, + 40,65,120,105,115,48,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78, + 68,69,88,40,115,116,111,114,97,103,101,73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73, + 78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,41,59,9,9,10,9,9,110,111, + 114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,109,121,67,114,111,115,115,40,116,97,110,103,101, + 110,116,48,44,32,112,114,101,118,84,111,78,101,120,116,41,41,59,10,9,9,116,97,110,103,101,110,116,48,32, + 42,61,32,115,105,122,101,32,42,32,100,111,82,101,110,100,101,114,59,10,10,9,9,98,114,101,97,107,59,10, + 9,125,10,35,101,110,100,105,102,10,35,105,102,32,82,66,95,83,105,100,101,65,120,105,115,65,108,105,103,110, + 101,100,84,117,98,101,10,9,99,97,115,101,32,82,66,95,83,105,100,101,65,120,105,115,65,108,105,103,110,101, + 100,84,117,98,101,58,10,9,123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,112,114,101,118,84,111,78, + 101,120,116,32,61,32,112,111,115,78,101,120,116,32,45,32,112,111,115,80,114,101,118,59,10,9,9,116,97,110, + 103,101,110,116,49,32,61,32,105,115,76,101,102,116,83,105,100,101,32,63,32,40,112,111,115,78,101,120,116,32, + 45,32,112,111,115,41,32,58,32,40,112,111,115,32,45,32,112,111,115,80,114,101,118,41,59,9,10,9,9,116, + 97,110,103,101,110,116,48,32,61,32,45,110,111,114,109,97,108,105,122,101,40,76,79,65,68,70,51,40,71,69, + 84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68, + 85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,120,105,115,48,115,79,102,102,115,101,116,115, + 41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,41, + 41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73, + 68,32,42,32,51,41,41,41,59,9,9,10,9,9,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105, + 122,101,40,109,121,67,114,111,115,115,40,116,97,110,103,101,110,116,48,44,32,112,114,101,118,84,111,78,101,120, + 116,41,41,59,10,9,9,116,97,110,103,101,110,116,48,32,42,61,32,115,105,122,101,32,42,32,100,111,82,101, + 110,100,101,114,59,10,10,9,9,47,47,32,81,117,97,116,101,114,110,105,111,110,32,114,111,116,97,116,105,111, + 110,32,111,102,32,116,104,101,32,110,111,114,109,97,108,32,118,101,99,116,111,114,32,97,114,111,117,110,100,32, + 116,104,101,32,112,114,101,118,84,111,78,101,120,116,32,97,120,105,115,32,119,105,116,104,32,97,110,32,97,110, + 103,108,101,32,111,102,32,113,117,97,100,73,100,32,47,32,113,117,97,100,67,111,117,110,116,32,42,32,50,46, + 48,102,32,42,32,80,73,32,114,97,100,105,97,110,116,32,40,101,118,101,110,32,114,111,116,97,116,105,111,110, + 32,111,102,32,101,97,99,104,32,115,101,103,109,101,110,116,32,97,114,111,117,110,100,32,51,54,48,32,100,101, + 103,114,101,101,115,41,46,10,9,9,99,111,110,115,116,32,102,108,111,97,116,9,97,110,103,108,101,32,61,32, + 51,46,49,52,49,53,57,50,54,53,51,53,56,102,32,42,32,40,113,117,97,100,73,100,32,45,32,49,41,32, + 47,32,113,117,97,100,67,111,117,110,116,59,10,9,9,99,111,110,115,116,32,102,108,111,97,116,9,115,105,110, + 116,104,101,116,97,32,61,32,115,105,110,40,97,110,103,108,101,41,59,10,9,9,99,111,110,115,116,32,102,108, + 111,97,116,9,114,32,61,32,99,111,115,40,97,110,103,108,101,41,59,10,9,9,99,111,110,115,116,32,118,101, + 99,51,9,117,32,61,32,110,111,114,109,97,108,105,122,101,40,112,114,101,118,84,111,78,101,120,116,41,32,42, + 32,115,105,110,116,104,101,116,97,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,117,118,32,61,32,109, + 121,67,114,111,115,115,40,117,44,32,110,111,114,109,97,108,41,59,10,9,9,99,111,110,115,116,32,118,101,99, + 51,9,117,117,118,32,61,32,109,121,67,114,111,115,115,40,117,44,32,117,118,41,59,10,9,9,110,111,114,109, + 97,108,32,61,32,117,118,32,42,32,40,114,32,43,32,114,41,32,43,32,40,110,111,114,109,97,108,32,43,32, + 40,117,117,118,32,43,32,117,117,118,41,41,59,10,9,9,98,114,101,97,107,59,10,9,125,10,35,101,110,100, + 105,102,10,35,105,102,32,82,66,95,83,105,100,101,65,120,105,115,65,108,105,103,110,101,100,77,117,108,116,105, + 80,108,97,110,101,10,9,99,97,115,101,32,82,66,95,83,105,100,101,65,120,105,115,65,108,105,103,110,101,100, + 77,117,108,116,105,80,108,97,110,101,58,10,9,123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,112,114, + 101,118,84,111,78,101,120,116,32,61,32,112,111,115,78,101,120,116,32,45,32,112,111,115,80,114,101,118,59,10, + 9,9,116,97,110,103,101,110,116,49,32,61,32,105,115,76,101,102,116,83,105,100,101,32,63,32,40,112,111,115, + 78,101,120,116,32,45,32,112,111,115,41,32,58,32,40,112,111,115,32,45,32,112,111,115,80,114,101,118,41,59, + 9,10,9,9,116,97,110,103,101,110,116,48,32,61,32,45,110,111,114,109,97,108,105,122,101,40,76,79,65,68, + 70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44, + 32,76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,120,105,115,48,115,79,102, + 102,115,101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97, + 103,101,73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116, + 105,99,108,101,73,68,32,42,32,51,41,41,41,59,9,9,10,10,9,9,47,47,32,81,117,97,116,101,114,110, + 105,111,110,32,114,111,116,97,116,105,111,110,32,111,102,32,116,104,101,32,116,97,110,103,101,110,116,48,32,118, + 101,99,116,111,114,32,97,114,111,117,110,100,32,116,104,101,32,112,114,101,118,84,111,78,101,120,116,32,97,120, + 105,115,32,119,105,116,104,32,97,110,32,97,110,103,108,101,32,111,102,32,113,117,97,100,73,100,32,47,32,113, + 117,97,100,67,111,117,110,116,32,42,32,80,73,32,114,97,100,105,97,110,116,32,40,101,118,101,110,32,114,111, + 116,97,116,105,111,110,32,111,102,32,101,97,99,104,32,112,108,97,110,101,32,116,97,110,103,101,110,116,32,100, + 105,114,32,97,114,111,117,110,100,32,49,56,48,32,100,101,103,114,101,101,115,41,46,10,9,9,99,111,110,115, + 116,32,102,108,111,97,116,9,97,110,103,108,101,32,61,32,51,46,49,52,49,53,57,50,54,53,51,53,56,102, + 32,42,32,40,113,117,97,100,73,100,32,45,32,49,41,32,47,32,113,117,97,100,67,111,117,110,116,32,42,32, + 48,46,53,102,59,10,9,9,99,111,110,115,116,32,102,108,111,97,116,9,115,105,110,116,104,101,116,97,32,61, + 32,115,105,110,40,97,110,103,108,101,41,59,10,9,9,99,111,110,115,116,32,102,108,111,97,116,9,114,32,61, + 32,99,111,115,40,97,110,103,108,101,41,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,117,32,61,32, + 110,111,114,109,97,108,105,122,101,40,112,114,101,118,84,111,78,101,120,116,41,32,42,32,115,105,110,116,104,101, + 116,97,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,117,118,32,61,32,109,121,67,114,111,115,115,40, + 117,44,32,116,97,110,103,101,110,116,48,41,59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,117,117,118, + 32,61,32,109,121,67,114,111,115,115,40,117,44,32,117,118,41,59,10,9,9,116,97,110,103,101,110,116,48,32, + 61,32,117,118,32,42,32,40,114,32,43,32,114,41,32,43,32,40,116,97,110,103,101,110,116,48,32,43,32,40, + 117,117,118,32,43,32,117,117,118,41,41,59,10,10,9,9,116,97,110,103,101,110,116,48,32,42,61,32,115,105, + 122,101,32,42,32,100,111,82,101,110,100,101,114,59,10,10,9,9,110,111,114,109,97,108,32,61,32,110,111,114, + 109,97,108,105,122,101,40,109,121,67,114,111,115,115,40,116,97,110,103,101,110,116,48,44,32,112,114,101,118,84, + 111,78,101,120,116,41,41,59,10,10,9,9,98,114,101,97,107,59,10,9,125,10,35,101,110,100,105,102,10,9, + 100,101,102,97,117,108,116,58,10,9,9,98,114,101,97,107,59,10,9,125,10,10,9,47,47,32,87,101,32,117, + 115,101,32,116,97,110,103,101,110,116,115,32,116,111,32,116,114,97,110,115,102,111,114,109,32,91,45,49,32,43, + 49,93,32,99,111,111,114,100,115,32,116,111,32,119,111,114,108,100,32,115,112,97,99,101,32,112,111,115,105,116, + 105,111,110,10,9,99,111,110,115,116,32,118,101,99,50,9,99,111,114,110,101,114,67,111,111,114,100,115,32,61, + 32,118,73,110,112,117,116,46,84,101,120,67,111,111,114,100,115,32,47,32,118,101,99,50,40,113,117,97,100,73, + 100,44,32,49,46,48,102,41,59,10,10,9,118,101,99,51,9,98,98,67,111,114,110,101,114,32,61,32,116,97, + 110,103,101,110,116,49,32,42,32,99,111,114,110,101,114,67,111,111,114,100,115,46,120,32,42,32,48,46,53,102, + 32,43,32,116,97,110,103,101,110,116,48,32,42,32,99,111,114,110,101,114,67,111,111,114,100,115,46,121,59,10, + 10,35,105,102,32,82,66,95,83,105,100,101,65,120,105,115,65,108,105,103,110,101,100,84,117,98,101,10,9,105, + 102,32,40,98,105,108,108,98,111,97,114,100,101,114,84,121,112,101,32,61,61,32,82,66,95,83,105,100,101,65, + 120,105,115,65,108,105,103,110,101,100,84,117,98,101,41,10,9,9,98,98,67,111,114,110,101,114,32,61,32,116, + 97,110,103,101,110,116,49,32,42,32,99,111,114,110,101,114,67,111,111,114,100,115,46,120,32,42,32,48,46,53, + 102,32,43,32,110,111,114,109,97,108,32,42,32,115,105,122,101,32,42,32,100,111,82,101,110,100,101,114,59,10, + 35,101,110,100,105,102,10,10,9,99,111,110,115,116,32,118,101,99,51,9,118,101,114,116,101,120,87,111,114,108, + 100,80,111,115,105,116,105,111,110,32,61,32,99,101,110,116,101,114,32,43,32,98,98,67,111,114,110,101,114,59, + 10,10,9,47,47,32,82,101,109,97,112,32,99,111,114,110,101,114,115,32,102,114,111,109,32,91,45,49,32,43, + 49,93,32,116,111,32,91,48,32,49,93,32,116,101,120,67,111,111,114,100,115,10,9,118,101,99,50,9,9,116, + 101,120,67,111,111,114,100,115,32,61,32,99,111,114,110,101,114,67,111,111,114,100,115,32,42,32,48,46,53,102, + 32,43,32,48,46,53,102,59,32,10,10,35,105,102,32,66,66,95,70,101,97,116,117,114,101,95,67,117,115,116, + 111,109,84,101,120,116,117,114,101,85,10,9,116,101,120,67,111,111,114,100,115,46,120,32,61,32,76,79,65,68, + 70,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32, + 76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,67,117,115,116,111,109,84,101,120, + 116,117,114,101,85,95,84,101,120,116,117,114,101,85,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66, + 85,70,70,69,82,95,73,78,68,69,88,40,115,116,111,114,97,103,101,73,100,41,41,32,43,32,82,65,87,95, + 66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,41,41,59,10,35,101,110, + 100,105,102,10,10,9,47,47,32,70,108,105,112,32,97,110,100,32,114,111,116,97,116,101,32,85,86,115,10,9, + 99,111,110,115,116,32,98,111,111,108,9,114,111,116,97,116,101,85,86,115,32,61,32,40,102,108,97,103,115,32, + 38,32,66,66,95,70,108,97,103,95,86,82,111,116,97,116,101,84,101,120,116,117,114,101,41,32,33,61,32,48, + 85,59,10,9,99,111,110,115,116,32,98,111,111,108,9,102,108,105,112,85,32,61,32,40,40,102,108,97,103,115, + 32,38,32,66,66,95,70,108,97,103,95,86,70,108,105,112,85,41,32,33,61,32,48,85,41,59,10,9,99,111, + 110,115,116,32,98,111,111,108,9,102,108,105,112,86,32,61,32,40,40,102,108,97,103,115,32,38,32,66,66,95, + 70,108,97,103,95,86,70,108,105,112,86,41,32,33,61,32,48,85,41,32,33,61,32,114,111,116,97,116,101,85, + 86,115,59,10,10,9,47,47,32,73,102,32,119,101,32,104,97,118,101,32,99,111,114,114,101,99,116,32,100,101, + 102,111,114,109,97,116,105,111,110,44,32,114,111,116,97,116,105,111,110,32,105,115,32,104,97,110,100,108,101,100, + 32,105,110,32,102,114,97,103,109,101,110,116,32,115,104,97,100,101,114,46,10,35,105,102,32,33,100,101,102,105, + 110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,85,86,70,97,99,116,111,114,115,41,10,9,105,102, + 32,40,114,111,116,97,116,101,85,86,115,41,10,9,9,116,101,120,67,111,111,114,100,115,46,120,121,32,61,32, + 116,101,120,67,111,111,114,100,115,46,121,120,59,10,9,105,102,32,40,102,108,105,112,85,41,10,9,9,116,101, + 120,67,111,111,114,100,115,46,120,32,61,32,49,46,48,102,32,45,32,116,101,120,67,111,111,114,100,115,46,120, + 59,10,9,105,102,32,40,102,108,105,112,86,41,10,9,9,116,101,120,67,111,111,114,100,115,46,121,32,61,32, + 49,46,48,102,32,45,32,116,101,120,67,111,111,114,100,115,46,121,59,10,35,101,110,100,105,102,10,10,9,47, + 47,32,85,86,115,32,111,117,116,112,117,116,32,10,35,105,102,9,100,101,102,105,110,101,100,40,86,79,85,84, + 80,85,84,95,102,114,97,103,85,86,48,41,10,35,9,105,102,32,66,66,95,70,101,97,116,117,114,101,95,65, + 116,108,97,115,10,9,99,111,110,115,116,32,117,105,110,116,9,109,97,120,65,116,108,97,115,73,68,32,61,32, + 76,79,65,68,85,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,116,108,97,115,41,44,32,82, + 65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,48,41,41,32,45,32,49,85,59,10,9,99,111,110, + 115,116,32,102,108,111,97,116,9,116,101,120,116,117,114,101,73,68,32,61,32,76,79,65,68,70,40,71,69,84, + 95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,76,79,65,68,85, + 40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,116,108,97,115,95,84,101,120,116,117,114,101,73, + 68,115,79,102,102,115,101,116,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,115, + 116,111,114,97,103,101,73,100,41,41,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40, + 112,97,114,116,105,99,108,101,73,68,41,41,59,10,9,99,111,110,115,116,32,117,105,110,116,9,97,116,108,97, + 115,73,68,48,32,61,32,109,105,110,40,117,105,110,116,40,116,101,120,116,117,114,101,73,68,41,44,32,109,97, + 120,65,116,108,97,115,73,68,41,59,10,9,99,111,110,115,116,32,118,101,99,52,9,114,101,99,116,48,32,61, + 32,76,79,65,68,70,52,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,65,116,108,97,115,41,44, + 32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,97,116,108,97,115,73,68,48,32,42,32,52, + 32,43,32,49,41,41,59,10,9,118,79,117,116,112,117,116,46,102,114,97,103,85,86,48,32,61,32,116,101,120, + 67,111,111,114,100,115,32,42,32,114,101,99,116,48,46,120,121,32,43,32,114,101,99,116,48,46,122,119,59,10, + 35,9,105,102,32,100,101,102,105,110,101,100,32,40,86,79,85,84,80,85,84,95,102,114,97,103,85,86,49,41, + 10,9,99,111,110,115,116,32,117,105,110,116,9,97,116,108,97,115,73,68,49,32,61,32,109,105,110,40,97,116, + 108,97,115,73,68,48,32,43,32,49,85,44,32,109,97,120,65,116,108,97,115,73,68,41,59,10,9,99,111,110, + 115,116,32,118,101,99,52,9,114,101,99,116,49,32,61,32,76,79,65,68,70,52,40,71,69,84,95,82,65,87, + 95,66,85,70,70,69,82,40,65,116,108,97,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68, + 69,88,40,97,116,108,97,115,73,68,49,32,42,32,52,32,43,32,49,41,41,59,10,9,118,79,117,116,112,117, + 116,46,102,114,97,103,85,86,49,32,61,32,116,101,120,67,111,111,114,100,115,32,42,32,114,101,99,116,49,46, + 120,121,32,43,32,114,101,99,116,49,46,122,119,59,10,9,118,79,117,116,112,117,116,46,102,114,97,103,65,116, + 108,97,115,73,68,32,61,32,116,101,120,116,117,114,101,73,68,59,10,35,9,101,110,100,105,102,10,35,9,101, + 108,115,101,10,9,9,118,79,117,116,112,117,116,46,102,114,97,103,85,86,48,32,61,32,116,101,120,67,111,111, + 114,100,115,59,10,35,9,101,110,100,105,102,32,47,47,32,66,66,95,70,101,97,116,117,114,101,95,65,116,108, + 97,115,10,35,101,110,100,105,102,32,47,47,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102, + 114,97,103,85,86,48,41,10,10,9,47,47,32,67,111,114,114,101,99,116,32,100,101,102,111,114,109,97,116,105, + 111,110,32,111,117,116,112,117,116,10,35,105,102,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95, + 102,114,97,103,85,86,83,99,97,108,101,65,110,100,79,102,102,115,101,116,41,10,35,9,105,102,32,100,101,102, + 105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,85,86,70,97,99,116,111,114,115,41,10,9,99, + 111,110,115,116,32,102,108,111,97,116,9,111,116,104,101,114,83,105,122,101,32,61,32,76,79,65,68,70,40,71, + 69,84,95,82,65,87,95,66,85,70,70,69,82,40,71,80,85,83,105,109,68,97,116,97,41,44,32,115,105,122, + 101,115,79,102,102,115,101,116,32,43,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,105,115, + 76,101,102,116,83,105,100,101,32,63,32,112,97,114,116,105,99,108,101,73,68,78,101,120,116,32,58,32,112,97, + 114,116,105,99,108,101,73,68,80,114,101,118,41,41,59,10,9,102,108,111,97,116,9,114,97,116,105,111,32,61, + 32,115,105,122,101,32,47,32,111,116,104,101,114,83,105,122,101,59,10,10,9,99,111,110,115,116,32,98,111,111, + 108,9,105,115,68,111,119,110,83,105,100,101,32,61,32,32,118,73,110,112,117,116,46,84,101,120,67,111,111,114, + 100,115,46,121,32,60,32,48,46,48,102,59,10,10,9,118,101,99,52,9,111,117,116,85,86,70,97,99,116,111, + 114,115,32,61,32,118,101,99,52,40,49,44,32,49,44,32,49,44,32,49,41,59,10,10,9,105,102,32,40,33, + 105,115,68,111,119,110,83,105,100,101,32,38,38,32,105,115,76,101,102,116,83,105,100,101,41,10,9,9,111,117, + 116,85,86,70,97,99,116,111,114,115,46,119,32,61,32,114,97,116,105,111,59,10,9,105,102,32,40,105,115,68, + 111,119,110,83,105,100,101,32,38,38,32,33,105,115,76,101,102,116,83,105,100,101,41,10,9,9,111,117,116,85, + 86,70,97,99,116,111,114,115,46,121,32,61,32,114,97,116,105,111,59,10,10,9,118,101,99,50,9,102,108,105, + 112,115,99,97,108,101,32,61,32,118,101,99,50,40,102,108,105,112,85,32,63,32,45,49,46,102,32,58,32,49, + 46,102,44,32,102,108,105,112,86,32,63,32,45,49,46,102,32,58,32,49,46,102,41,59,10,9,118,101,99,50, + 9,102,108,105,112,111,102,102,115,101,116,32,61,32,118,101,99,50,32,40,102,108,105,112,85,32,63,32,49,46, + 102,32,58,32,48,46,102,44,32,102,108,105,112,86,32,63,32,49,46,102,32,58,32,48,46,102,41,59,10,10, + 9,118,79,117,116,112,117,116,46,102,114,97,103,85,86,83,99,97,108,101,65,110,100,79,102,102,115,101,116,32, + 61,32,118,101,99,52,40,102,108,105,112,115,99,97,108,101,44,32,102,108,105,112,111,102,102,115,101,116,41,59, + 10,9,118,79,117,116,112,117,116,46,102,114,97,103,85,86,70,97,99,116,111,114,115,32,61,32,111,117,116,85, + 86,70,97,99,116,111,114,115,59,10,35,9,101,110,100,105,102,10,35,101,110,100,105,102,10,10,9,47,47,32, + 78,111,114,109,97,108,32,111,117,116,112,117,116,10,35,105,102,32,100,101,102,105,110,101,100,40,86,79,85,84, + 80,85,84,95,102,114,97,103,78,111,114,109,97,108,41,10,9,99,111,110,115,116,32,102,108,111,97,116,9,110, + 111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,32,61,32,99,117,114,114,101,110,116,68,114, + 46,121,59,10,9,105,102,32,40,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,32,62, + 32,48,46,48,102,41,10,9,123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,116,97,110,103,101,110,116, + 48,78,111,114,109,32,61,32,110,111,114,109,97,108,105,122,101,40,116,97,110,103,101,110,116,48,41,59,10,9, + 9,99,111,110,115,116,32,118,101,99,51,9,116,97,110,103,101,110,116,49,78,111,114,109,32,61,32,110,111,114, + 109,97,108,105,122,101,40,116,97,110,103,101,110,116,49,41,59,10,9,9,99,111,110,115,116,32,102,108,111,97, + 116,9,111,110,101,77,105,110,117,115,78,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,32, + 61,32,40,49,46,48,102,32,45,32,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,41, + 59,10,10,9,9,99,111,110,115,116,32,118,101,99,51,9,98,101,110,116,78,111,114,109,97,108,32,61,32,40, + 116,97,110,103,101,110,116,48,78,111,114,109,32,42,32,99,111,114,110,101,114,67,111,111,114,100,115,46,121,41, + 59,10,9,9,118,79,117,116,112,117,116,46,102,114,97,103,78,111,114,109,97,108,32,61,32,110,111,114,109,97, + 108,105,122,101,40,110,111,114,109,97,108,32,42,32,111,110,101,77,105,110,117,115,78,111,114,109,97,108,66,101, + 110,100,105,110,103,70,97,99,116,111,114,32,43,32,98,101,110,116,78,111,114,109,97,108,32,42,32,110,111,114, + 109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,41,59,10,9,125,10,9,101,108,115,101,10,9,9, + 118,79,117,116,112,117,116,46,102,114,97,103,78,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101, + 40,110,111,114,109,97,108,41,59,10,35,101,110,100,105,102,10,10,9,47,47,32,84,97,110,103,101,110,116,32, + 111,117,116,112,117,116,10,35,105,102,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97, + 103,84,97,110,103,101,110,116,41,10,9,47,47,32,87,105,116,104,32,114,105,98,98,111,110,44,32,98,101,110, + 116,32,110,111,114,109,97,108,115,32,97,114,101,32,112,117,115,104,101,100,32,97,108,111,110,103,32,116,97,110, + 103,101,110,116,48,32,97,120,105,115,32,111,110,108,121,32,40,114,105,98,98,111,110,32,115,105,100,101,32,97, + 105,120,115,41,10,9,47,47,32,84,104,105,115,32,109,101,97,110,115,32,116,104,97,116,32,116,97,110,103,101, + 110,116,49,44,32,119,104,105,99,104,32,105,115,32,114,105,98,98,111,110,32,108,111,110,103,105,116,117,100,105, + 110,97,108,32,97,120,105,115,44,32,105,115,32,110,111,116,32,105,109,112,97,99,116,101,100,46,10,9,47,47, + 32,119,32,61,32,45,49,46,48,102,32,119,105,108,108,32,119,111,114,107,32,119,105,116,104,32,100,101,102,97, + 117,108,116,32,114,105,98,98,111,110,44,32,98,117,116,32,119,111,110,39,116,32,97,100,97,112,116,32,116,111, + 10,9,47,47,32,116,114,97,110,115,102,111,114,109,105,110,103,32,116,104,101,32,85,86,115,32,47,32,99,117, + 115,116,111,109,32,85,46,32,70,105,120,32,116,104,97,116,32,105,110,32,67,80,85,32,98,98,44,32,116,104, + 101,110,32,104,101,114,101,46,32,10,9,118,79,117,116,112,117,116,46,102,114,97,103,84,97,110,103,101,110,116, + 32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40,116,97,110,103,101,110,116,49,41,44,32,45, + 49,46,48,102,41,59,10,35,101,110,100,105,102,10,10,9,118,79,117,116,112,117,116,46,86,101,114,116,101,120, + 80,111,115,105,116,105,111,110,32,61,32,112,114,111,106,95,112,111,115,105,116,105,111,110,40,118,101,114,116,101, + 120,87,111,114,108,100,80,111,115,105,116,105,111,110,32,86,83,95,80,65,82,65,77,83,41,59,10,35,105,102, + 32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,87,111,114,108,100,80,111,115,105, + 116,105,111,110,41,10,9,118,79,117,116,112,117,116,46,102,114,97,103,87,111,114,108,100,80,111,115,105,116,105, + 111,110,32,61,32,118,101,114,116,101,120,87,111,114,108,100,80,111,115,105,116,105,111,110,59,10,35,101,110,100, + 105,102,10,10,9,114,101,116,117,114,110,32,112,97,114,116,105,99,108,101,73,68,59,10,125,10, +}; diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Triangle.vert.h b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Triangle.vert.h new file mode 100644 index 00000000..af62282d --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/generated/Triangle.vert.h @@ -0,0 +1,174 @@ +#pragma once + +extern const char g_Triangle_vert_data[5003]; + +const char g_Triangle_vert_data[5003] = +{ + 35,105,102,32,40,33,100,101,102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,86,101,114,116,101,120, + 80,111,115,105,116,105,111,110,48,41,32,124,124,32,33,100,101,102,105,110,101,100,40,86,82,69,83,79,85,82, + 67,69,95,86,101,114,116,101,120,80,111,115,105,116,105,111,110,49,41,32,124,124,32,33,100,101,102,105,110,101, + 100,40,86,82,69,83,79,85,82,67,69,95,86,101,114,116,101,120,80,111,115,105,116,105,111,110,50,41,41,32, + 38,38,32,33,100,101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10,35,9,9,101,114,114, + 111,114,32,109,105,115,115,105,110,103,32,80,111,115,105,116,105,111,110,115,32,83,82,86,10,35,9,101,110,100, + 105,102,10,10,35,105,102,32,33,100,101,102,105,110,101,100,40,86,82,69,83,79,85,82,67,69,95,73,110,100, + 105,99,101,115,41,32,38,38,32,33,100,101,102,105,110,101,100,40,66,66,95,71,80,85,95,83,73,77,41,10, + 35,9,101,114,114,111,114,32,109,105,115,115,105,110,103,32,73,110,100,105,99,101,115,32,83,82,86,9,47,47, + 32,77,97,110,100,97,116,111,114,121,32,102,111,114,32,110,111,119,10,35,101,110,100,105,102,10,10,118,101,99, + 52,9,112,114,111,106,95,112,111,115,105,116,105,111,110,40,73,78,40,118,101,99,51,41,32,112,111,115,105,116, + 105,111,110,32,86,83,95,65,82,71,83,41,10,123,10,35,105,102,9,9,100,101,102,105,110,101,100,40,67,79, + 78,83,84,95,83,99,101,110,101,73,110,102,111,95,86,105,101,119,80,114,111,106,41,10,9,114,101,116,117,114, + 110,32,109,117,108,40,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32, + 86,105,101,119,80,114,111,106,41,44,32,118,101,99,52,40,112,111,115,105,116,105,111,110,44,32,49,46,48,102, + 41,41,59,10,35,101,108,115,101,10,9,114,101,116,117,114,110,32,118,101,99,52,40,112,111,115,105,116,105,111, + 110,44,32,49,46,48,102,41,59,10,35,101,110,100,105,102,10,125,10,10,118,111,105,100,32,32,32,32,86,101, + 114,116,101,120,66,105,108,108,98,111,97,114,100,40,73,78,40,83,86,101,114,116,101,120,73,110,112,117,116,41, + 32,118,73,110,112,117,116,44,32,73,78,79,85,84,40,83,86,101,114,116,101,120,79,117,116,112,117,116,41,32, + 118,79,117,116,112,117,116,44,32,117,105,110,116,32,112,97,114,116,105,99,108,101,73,68,32,86,83,95,65,82, + 71,83,41,10,123,10,35,105,102,32,66,66,95,71,80,85,95,83,73,77,32,47,47,32,78,111,116,32,105,109, + 112,108,101,109,101,110,116,101,100,10,32,32,32,32,99,111,110,115,116,32,118,101,99,51,32,32,119,111,114,108, + 100,80,111,115,32,61,32,118,101,99,51,40,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,10,9,99, + 111,110,115,116,32,118,101,99,52,32,9,119,111,114,108,100,80,111,115,68,114,73,100,32,61,32,118,101,99,52, + 40,48,46,48,44,32,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,10,35,101,108,115,101,10,9,99, + 111,110,115,116,32,118,101,99,52,9,119,111,114,108,100,80,111,115,68,114,73,100,32,61,32,76,79,65,68,70, + 52,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,86,101,114,116,101,120,80,111,115,105,116,105,111, + 110,48,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101, + 73,68,32,42,32,52,41,41,59,10,9,99,111,110,115,116,32,118,101,99,51,9,112,111,115,48,32,61,32,119, + 111,114,108,100,80,111,115,68,114,73,100,46,120,121,122,59,10,9,99,111,110,115,116,32,118,101,99,51,9,112, + 111,115,49,32,61,32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,86,101, + 114,116,101,120,80,111,115,105,116,105,111,110,49,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68, + 69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,9,99,111,110,115,116,32,118,101, + 99,51,9,112,111,115,50,32,61,32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69, + 82,40,86,101,114,116,101,120,80,111,115,105,116,105,111,110,50,41,44,32,82,65,87,95,66,85,70,70,69,82, + 95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,10,9,118,101,99, + 51,9,119,111,114,108,100,80,111,115,32,61,32,118,101,99,51,40,48,46,48,44,32,48,46,48,44,32,48,46, + 48,41,59,10,9,105,102,32,40,118,73,110,112,117,116,46,86,101,114,116,101,120,73,110,100,101,120,32,61,61, + 32,48,41,10,9,9,119,111,114,108,100,80,111,115,32,61,32,112,111,115,48,59,10,9,101,108,115,101,32,105, + 102,32,40,118,73,110,112,117,116,46,86,101,114,116,101,120,73,110,100,101,120,32,61,61,32,49,41,10,9,9, + 119,111,114,108,100,80,111,115,32,61,32,112,111,115,49,59,10,9,101,108,115,101,32,105,102,32,40,118,73,110, + 112,117,116,46,86,101,114,116,101,120,73,110,100,101,120,32,61,61,32,50,41,10,9,9,119,111,114,108,100,80, + 111,115,32,61,32,112,111,115,50,59,10,35,101,110,100,105,102,32,47,47,32,66,66,95,71,80,85,95,83,73, + 77,10,10,32,32,32,32,118,79,117,116,112,117,116,46,86,101,114,116,101,120,80,111,115,105,116,105,111,110,32, + 61,32,112,114,111,106,95,112,111,115,105,116,105,111,110,40,119,111,114,108,100,80,111,115,32,86,83,95,80,65, + 82,65,77,83,41,59,10,10,35,105,102,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114, + 97,103,84,97,110,103,101,110,116,41,32,124,124,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95, + 102,114,97,103,85,86,48,41,10,35,105,102,32,100,101,102,105,110,101,100,40,72,65,83,95,84,114,105,97,110, + 103,108,101,67,117,115,116,111,109,85,86,115,41,10,9,99,111,110,115,116,32,118,101,99,50,9,117,118,48,32, + 61,32,76,79,65,68,70,50,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,84,114,105,97,110,103, + 108,101,67,117,115,116,111,109,85,86,115,95,85,86,49,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95, + 73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,50,41,41,59,10,9,99,111,110,115,116, + 32,118,101,99,50,9,117,118,49,32,61,32,76,79,65,68,70,50,40,71,69,84,95,82,65,87,95,66,85,70, + 70,69,82,40,84,114,105,97,110,103,108,101,67,117,115,116,111,109,85,86,115,95,85,86,50,115,41,44,32,82, + 65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,50, + 41,41,59,10,9,99,111,110,115,116,32,118,101,99,50,9,117,118,50,32,61,32,76,79,65,68,70,50,40,71, + 69,84,95,82,65,87,95,66,85,70,70,69,82,40,84,114,105,97,110,103,108,101,67,117,115,116,111,109,85,86, + 115,95,85,86,51,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116, + 105,99,108,101,73,68,32,42,32,50,41,41,59,10,35,101,108,115,101,10,9,99,111,110,115,116,32,118,101,99, + 50,9,117,118,48,32,61,32,118,101,99,50,40,48,46,48,44,32,48,46,48,41,59,10,9,99,111,110,115,116, + 32,118,101,99,50,32,9,117,118,49,32,61,32,118,101,99,50,40,49,46,48,44,32,48,46,48,41,59,10,9, + 99,111,110,115,116,32,118,101,99,50,32,9,117,118,50,32,61,32,118,101,99,50,40,48,46,48,44,32,49,46, + 48,41,59,10,35,101,110,100,105,102,32,47,47,32,100,101,102,105,110,101,100,40,72,65,83,95,84,114,105,97, + 110,103,108,101,67,117,115,116,111,109,85,86,115,41,10,35,101,110,100,105,102,32,47,47,32,100,101,102,105,110, + 101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,84,97,110,103,101,110,116,41,32,124,124,32,100,101,102, + 105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,85,86,48,41,10,10,35,105,102,32,100,101,102, + 105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,85,86,48,41,10,35,105,102,32,66,66,95,71, + 80,85,95,83,73,77,32,47,47,32,78,111,116,32,105,109,112,108,101,109,101,110,116,101,100,10,9,99,111,110, + 115,116,32,118,101,99,50,9,117,118,32,61,32,118,101,99,50,40,48,46,48,44,32,48,46,48,41,59,10,35, + 101,108,115,101,10,35,105,102,32,100,101,102,105,110,101,100,40,72,65,83,95,84,114,105,97,110,103,108,101,67, + 117,115,116,111,109,85,86,115,41,10,9,118,101,99,50,9,117,118,32,61,32,118,101,99,50,40,48,46,48,44, + 32,48,46,48,41,59,10,9,105,102,32,40,118,73,110,112,117,116,46,86,101,114,116,101,120,73,110,100,101,120, + 32,61,61,32,48,41,10,9,9,117,118,32,61,32,117,118,48,59,10,9,101,108,115,101,32,105,102,32,40,118, + 73,110,112,117,116,46,86,101,114,116,101,120,73,110,100,101,120,32,61,61,32,49,41,10,9,9,117,118,32,61, + 32,117,118,49,59,10,9,101,108,115,101,32,105,102,32,40,118,73,110,112,117,116,46,86,101,114,116,101,120,73, + 110,100,101,120,32,61,61,32,50,41,10,9,9,117,118,32,61,32,117,118,50,59,10,35,101,108,115,101,10,9, + 47,42,10,9,86,101,114,116,101,120,73,110,100,101,120,32,48,32,45,62,32,120,32,61,32,48,44,32,121,32, + 61,32,48,10,9,86,101,114,116,101,120,73,110,100,101,120,32,49,32,45,62,32,120,32,61,32,49,44,32,121, + 32,61,32,48,10,9,86,101,114,116,101,120,73,110,100,101,120,32,50,32,45,62,32,120,32,61,32,48,44,32, + 121,32,61,32,49,10,9,42,47,10,9,99,111,110,115,116,32,118,101,99,50,9,117,118,32,61,32,118,101,99, + 50,40,118,73,110,112,117,116,46,86,101,114,116,101,120,73,110,100,101,120,32,38,32,49,44,32,40,118,73,110, + 112,117,116,46,86,101,114,116,101,120,73,110,100,101,120,32,38,32,50,41,32,62,62,32,49,41,59,10,35,101, + 110,100,105,102,32,47,47,32,100,101,102,105,110,101,100,40,72,65,83,95,84,114,105,97,110,103,108,101,67,117, + 115,116,111,109,85,86,115,41,10,9,118,79,117,116,112,117,116,46,102,114,97,103,85,86,48,32,61,32,117,118, + 59,10,35,101,110,100,105,102,32,47,47,32,66,66,95,71,80,85,95,83,73,77,10,35,101,110,100,105,102,32, + 47,47,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,85,86,48,41,10,10,35, + 105,102,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,78,111,114,109,97,108,41, + 32,124,124,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,84,97,110,103,101,110, + 116,41,10,35,105,102,32,66,66,95,71,80,85,95,83,73,77,32,47,47,32,78,111,116,32,105,109,112,108,101, + 109,101,110,116,101,100,10,9,99,111,110,115,116,32,118,101,99,51,9,110,111,114,109,97,108,32,61,32,118,101, + 99,51,40,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,10,35,101,108,115,101,10,9,118,101,99,51, + 9,110,111,114,109,97,108,32,61,32,118,101,99,51,40,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59, + 10,10,9,99,111,110,115,116,32,118,101,99,51,9,101,100,103,101,48,32,61,32,112,111,115,49,32,45,32,112, + 111,115,48,59,10,9,99,111,110,115,116,32,118,101,99,51,9,101,100,103,101,49,32,61,32,112,111,115,50,32, + 45,32,112,111,115,48,59,10,10,35,105,102,32,100,101,102,105,110,101,100,40,72,65,83,95,84,114,105,97,110, + 103,108,101,67,117,115,116,111,109,78,111,114,109,97,108,115,41,10,9,105,102,32,40,118,73,110,112,117,116,46, + 86,101,114,116,101,120,73,110,100,101,120,32,61,61,32,48,41,10,9,9,110,111,114,109,97,108,32,61,32,76, + 79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,84,114,105,97,110,103,108,101,67, + 117,115,116,111,109,78,111,114,109,97,108,115,95,78,111,114,109,97,108,49,115,41,44,32,82,65,87,95,66,85, + 70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,9, + 101,108,115,101,32,105,102,32,40,118,73,110,112,117,116,46,86,101,114,116,101,120,73,110,100,101,120,32,61,61, + 32,49,41,10,9,9,110,111,114,109,97,108,32,61,32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95, + 66,85,70,70,69,82,40,84,114,105,97,110,103,108,101,67,117,115,116,111,109,78,111,114,109,97,108,115,95,78, + 111,114,109,97,108,50,115,41,44,32,82,65,87,95,66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114, + 116,105,99,108,101,73,68,32,42,32,51,41,41,59,10,9,101,108,115,101,32,105,102,32,40,118,73,110,112,117, + 116,46,86,101,114,116,101,120,73,110,100,101,120,32,61,61,32,50,41,10,9,9,110,111,114,109,97,108,32,61, + 32,76,79,65,68,70,51,40,71,69,84,95,82,65,87,95,66,85,70,70,69,82,40,84,114,105,97,110,103,108, + 101,67,117,115,116,111,109,78,111,114,109,97,108,115,95,78,111,114,109,97,108,51,115,41,44,32,82,65,87,95, + 66,85,70,70,69,82,95,73,78,68,69,88,40,112,97,114,116,105,99,108,101,73,68,32,42,32,51,41,41,59, + 10,35,101,108,115,101,10,9,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114,111, + 115,115,40,101,100,103,101,48,44,32,101,100,103,101,49,41,41,59,10,35,101,110,100,105,102,32,47,47,32,100, + 101,102,105,110,101,100,40,72,65,83,95,84,114,105,97,110,103,108,101,67,117,115,116,111,109,78,111,114,109,97, + 108,115,41,10,10,35,105,102,32,100,101,102,105,110,101,100,40,72,65,83,95,78,111,114,109,97,108,66,101,110, + 100,41,32,38,38,32,33,100,101,102,105,110,101,100,40,72,65,83,95,84,114,105,97,110,103,108,101,67,117,115, + 116,111,109,78,111,114,109,97,108,115,41,10,9,99,111,110,115,116,32,117,105,110,116,9,100,114,73,100,32,61, + 32,97,115,117,105,110,116,40,119,111,114,108,100,80,111,115,68,114,73,100,46,119,41,59,10,9,99,111,110,115, + 116,32,102,108,111,97,116,32,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,32,61,32, + 71,69,84,95,67,79,78,83,84,65,78,84,40,84,114,105,97,110,103,108,101,73,110,102,111,44,32,68,114,97, + 119,82,101,113,117,101,115,116,41,91,100,114,73,100,32,47,32,52,93,91,100,114,73,100,32,37,32,52,93,59, + 10,9,105,102,32,40,110,111,114,109,97,108,66,101,110,100,105,110,103,70,97,99,116,111,114,32,33,61,32,48, + 46,48,102,41,10,9,123,10,9,9,99,111,110,115,116,32,118,101,99,51,9,98,97,114,121,99,101,110,116,101, + 114,32,61,32,40,112,111,115,48,32,43,32,112,111,115,49,32,43,32,112,111,115,50,41,32,47,32,51,46,48, + 59,10,9,9,99,111,110,115,116,32,118,101,99,51,9,109,97,120,66,101,110,116,78,111,114,109,97,108,32,61, + 32,110,111,114,109,97,108,105,122,101,40,119,111,114,108,100,80,111,115,32,45,32,98,97,114,121,99,101,110,116, + 101,114,41,59,10,9,9,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,109,105,120,40, + 110,111,114,109,97,108,44,32,109,97,120,66,101,110,116,78,111,114,109,97,108,44,32,110,111,114,109,97,108,66, + 101,110,100,105,110,103,70,97,99,116,111,114,41,41,59,10,9,125,10,35,101,110,100,105,102,32,47,47,32,100, + 101,102,105,110,101,100,40,72,65,83,95,78,111,114,109,97,108,66,101,110,100,41,32,38,38,32,33,100,101,102, + 105,110,101,100,40,72,65,83,95,84,114,105,97,110,103,108,101,67,117,115,116,111,109,78,111,114,109,97,108,115, + 41,10,35,101,110,100,105,102,32,47,47,32,66,66,95,71,80,85,95,83,73,77,10,10,35,105,102,32,100,101, + 102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,78,111,114,109,97,108,41,10,32,32,32,32, + 118,79,117,116,112,117,116,46,102,114,97,103,78,111,114,109,97,108,32,61,32,110,111,114,109,97,108,59,10,35, + 101,110,100,105,102,32,47,47,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,78, + 111,114,109,97,108,41,10,10,35,105,102,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114, + 97,103,84,97,110,103,101,110,116,41,10,9,118,101,99,50,9,101,100,103,101,48,85,86,32,61,32,117,118,49, + 32,45,32,117,118,48,59,10,9,118,101,99,50,32,9,101,100,103,101,49,85,86,32,61,32,117,118,50,32,45, + 32,117,118,48,59,10,9,102,108,111,97,116,9,100,101,116,32,61,32,101,100,103,101,48,85,86,46,120,32,42, + 32,101,100,103,101,49,85,86,46,121,32,45,32,101,100,103,101,48,85,86,46,121,32,42,32,101,100,103,101,49, + 85,86,46,120,59,10,9,105,102,32,40,97,98,115,40,100,101,116,41,32,60,61,32,49,101,45,54,41,10,9, + 123,10,9,9,101,100,103,101,48,85,86,32,61,32,118,101,99,50,40,49,46,48,44,32,48,46,48,41,59,10, + 9,9,101,100,103,101,49,85,86,32,61,32,118,101,99,50,40,48,46,48,44,32,49,46,48,41,59,10,9,9, + 100,101,116,32,61,32,101,100,103,101,48,85,86,46,120,32,42,32,101,100,103,101,49,85,86,46,121,32,45,32, + 101,100,103,101,48,85,86,46,121,32,42,32,101,100,103,101,49,85,86,46,120,59,10,9,125,10,9,99,111,110, + 115,116,32,102,108,111,97,116,9,114,32,61,32,49,46,48,32,47,32,100,101,116,59,10,9,99,111,110,115,116, + 32,118,101,99,51,9,116,97,110,103,101,110,116,32,61,32,40,101,100,103,101,48,32,42,32,101,100,103,101,49, + 85,86,46,121,32,45,32,101,100,103,101,49,32,42,32,101,100,103,101,48,85,86,46,121,41,32,42,32,114,59, + 10,9,99,111,110,115,116,32,118,101,99,51,9,98,105,116,97,110,103,101,110,116,32,61,32,40,101,100,103,101, + 49,32,42,32,101,100,103,101,48,85,86,46,120,32,45,32,101,100,103,101,48,32,42,32,101,100,103,101,49,85, + 86,46,120,41,32,42,32,114,59,10,9,99,111,110,115,116,32,102,108,111,97,116,9,99,114,111,115,115,83,105, + 103,110,32,61,32,71,69,84,95,67,79,78,83,84,65,78,84,40,83,99,101,110,101,73,110,102,111,44,32,72, + 97,110,100,101,100,110,101,115,115,41,59,10,9,99,111,110,115,116,32,118,101,99,51,9,111,117,116,66,105,116, + 97,110,103,101,110,116,32,61,32,99,114,111,115,115,40,110,111,114,109,97,108,44,32,116,97,110,103,101,110,116, + 41,32,42,32,99,114,111,115,115,83,105,103,110,59,10,9,99,111,110,115,116,32,102,108,111,97,116,9,116,97, + 110,103,101,110,116,87,32,61,32,40,100,111,116,40,98,105,116,97,110,103,101,110,116,44,32,111,117,116,66,105, + 116,97,110,103,101,110,116,41,32,62,32,48,41,32,63,32,49,46,48,32,58,32,45,49,46,48,59,10,10,9, + 47,47,32,99,111,109,112,117,116,101,32,118,101,114,116,101,120,32,116,97,110,103,101,110,116,32,98,97,115,101, + 100,32,111,110,32,116,114,105,97,110,103,108,101,32,117,118,115,32,38,32,112,111,115,105,116,105,111,110,115,10, + 32,32,32,32,118,79,117,116,112,117,116,46,102,114,97,103,84,97,110,103,101,110,116,32,61,32,118,101,99,52, + 40,110,111,114,109,97,108,105,122,101,40,99,114,111,115,115,40,111,117,116,66,105,116,97,110,103,101,110,116,44, + 32,110,111,114,109,97,108,41,41,32,42,32,99,114,111,115,115,83,105,103,110,44,32,116,97,110,103,101,110,116, + 87,41,59,10,35,101,110,100,105,102,32,47,47,32,100,101,102,105,110,101,100,40,86,79,85,84,80,85,84,95, + 102,114,97,103,84,97,110,103,101,110,116,41,10,35,101,110,100,105,102,32,47,47,32,100,101,102,105,110,101,100, + 40,86,79,85,84,80,85,84,95,102,114,97,103,78,111,114,109,97,108,41,32,124,124,32,100,101,102,105,110,101, + 100,40,86,79,85,84,80,85,84,95,102,114,97,103,84,97,110,103,101,110,116,41,10,10,35,105,102,32,100,101, + 102,105,110,101,100,40,86,79,85,84,80,85,84,95,102,114,97,103,87,111,114,108,100,80,111,115,105,116,105,111, + 110,41,10,32,32,32,32,118,79,117,116,112,117,116,46,102,114,97,103,87,111,114,108,100,80,111,115,105,116,105, + 111,110,32,61,32,119,111,114,108,100,80,111,115,59,10,35,101,110,100,105,102,10,125, +}; diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Billboard.geom b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Billboard.geom new file mode 100644 index 00000000..fe409f78 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Billboard.geom @@ -0,0 +1,548 @@ +#if BB_FeatureC0 +# define BB_ScreenAligned 1U +# define BB_ViewposAligned 2U +# if !defined(GINPUT_geomSize) +# error missing input +# endif +#else +# error config error +#endif + +#if BB_FeatureC1 +# define NORMALIZER_EPSILON 1.0e-8f +# define BB_AxisAligned 3U +# define BB_AxisAlignedSpheroid 4U +# if !defined(GINPUT_geomAxis0) +# error missing input +# endif +#endif + +#if BB_FeatureC1_Capsule +# define BB_AxisAlignedCapsule 5U +#endif + +#if BB_FeatureC2 +# define BB_PlaneAligned 6U +# if !defined(GINPUT_geomAxis1) +# error missing input +# endif +#endif + +#define FLIP_BILLBOARDING_AXIS 1 + +#if !defined(CONST_BillboardInfo_DrawRequest) +#error "Missing constant with infos for billboard" +#endif + +#if defined(CONST_BillboardInfo_DrawRequest) +# define BB_Flag_BillboardMask 7U // 3 firsts bits +# define BB_Flag_FlipV 8U // 4th bit +# define BB_Flag_SoftAnimBlend 16U // 5th bit +# define BB_Flag_FlipU 32U // 6th bit +#endif + +// DrawRequest: +// x: Flags +// y: NormalsBendingFactor + +// RightHanded/LeftHanded: +#define myCross(a, b) cross(a, b) * GET_CONSTANT(SceneInfo, Handedness) + +void swap(inout vec2 a, inout vec2 b) +{ + vec2 s = a; + a = b; + b = s; +} + +void swap(inout vec4 a, inout vec4 b) +{ + vec4 s = a; + a = b; + b = s; +} + +vec2 get_radius(in SPrimitives gInput) +{ +#if defined(HAS_SizeFloat2) + return gInput.geomSize; +#else + return vec2(gInput.geomSize, gInput.geomSize); +#endif +} + +#if defined(BB_ScreenAligned) || defined(BB_ViewposAligned) || defined(BB_PlaneAligned) +void rotate_axis(in SPrimitives gInput, inout vec3 xAxis, inout vec3 yAxis) +{ +#if defined(GINPUT_geomRotation) + float c = cos(gInput.geomRotation); + float s = sin(gInput.geomRotation); + vec3 xa = xAxis; + xAxis = yAxis * s + xAxis * c; + yAxis = yAxis * c - xa * s; +#endif +} +#endif + +#if BB_ScreenAligned +void bb_ScreenAlignedQuad(in SPrimitives gInput, out vec3 xAxis, out vec3 yAxis, out vec3 nAxis) +{ +#if !defined(CONST_SceneInfo_BillboardingView) +#error "Missing View matrix in SceneInfo" +#endif + xAxis = GET_MATRIX_X_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + yAxis = GET_MATRIX_Y_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + rotate_axis(gInput, xAxis, yAxis); + vec2 radius = get_radius(gInput); + xAxis *= radius.x; + yAxis *= radius.y; + nAxis = GET_MATRIX_Z_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; +} +#endif + +#if BB_ViewposAligned +void bb_ViewposAlignedQuad(in SPrimitives gInput, out vec3 xAxis, out vec3 yAxis, out vec3 nAxis) +{ +#if !defined(CONST_SceneInfo_BillboardingView) +#error "Missing View matrix in SceneInfo" +#endif + vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + vec3 viewUpAxis = GET_MATRIX_Y_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + vec3 camToParticle = normalize(gInput.VertexPosition.xyz - viewPos); + vec3 upVectorInterm = viewUpAxis - 1.e-5f * camToParticle.xzy; + + xAxis = normalize(myCross(camToParticle, upVectorInterm)); + yAxis = myCross(xAxis, camToParticle); + rotate_axis(gInput, xAxis, yAxis); + + vec2 radius = get_radius(gInput); + xAxis *= radius.x; + yAxis *= radius.y; + nAxis = -camToParticle; +} +#endif + +#if BB_AxisAligned +void bb_VelocityAxisAligned(in SPrimitives gInput, out vec3 xAxis, out vec3 yAxis, out vec3 nAxis) +{ +#if !defined(CONST_SceneInfo_BillboardingView) +#error "Missing View matrix in SceneInfo" +#endif + vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + + vec3 camToParticle = normalize(gInput.VertexPosition.xyz - viewPos); + vec2 radius = get_radius(gInput); + vec3 side = GET_CONSTANT(SceneInfo, SideVector).xyz; + vec3 depth = GET_CONSTANT(SceneInfo, DepthVector).xyz; + + xAxis = myCross(camToParticle, gInput.geomAxis0); + if (dot(xAxis, xAxis) > NORMALIZER_EPSILON) + xAxis = normalize(xAxis); + else + { + vec3 v = -side * dot(camToParticle, depth) + depth * (dot(camToParticle, side) + 0.01f); + xAxis = normalize(myCross(camToParticle, v)); + // This is consistent with CPU but we still flip the axis + // to cancel GPU bb flip, due to FLIP_BILLBOARDING_AXIS. + xAxis = -xAxis; + } + xAxis *= radius.x; + + yAxis = gInput.geomAxis0 * 0.5f; + nAxis = -camToParticle; +} +#endif + +#if BB_AxisAlignedSpheroid +void bb_VelocitySpheroidalAlign(in SPrimitives gInput, out vec3 xAxis, out vec3 yAxis, out vec3 nAxis) +{ +#if !defined(CONST_SceneInfo_BillboardingView) +#error "Missing View matrix in SceneInfo" +#endif + vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + + vec3 camToParticle = normalize(gInput.VertexPosition.xyz - viewPos); + vec2 radius = get_radius(gInput); + vec3 side = GET_CONSTANT(SceneInfo, SideVector).xyz; + vec3 depth = GET_CONSTANT(SceneInfo, DepthVector).xyz; + + vec3 sideVec = myCross(camToParticle, gInput.geomAxis0); + if (dot(sideVec, sideVec) > NORMALIZER_EPSILON) + sideVec = normalize(sideVec); + else + { + vec3 v = -side * dot(camToParticle, depth) + depth * (dot(camToParticle, side) + 0.01f); + sideVec = normalize(myCross(camToParticle, v)); + // This computation is consistent with CPU BUT we flip the axis + // to cancel GPU bb flip, due to FLIP_BILLBOARDING_AXIS. + sideVec = -sideVec; + } + sideVec *= radius.x; + + xAxis = sideVec; + yAxis = gInput.geomAxis0 * 0.5f + myCross(sideVec, camToParticle); + // Warning: xAxis and yAxis are not orthogonal. + nAxis = normalize(myCross(xAxis, yAxis)); +} +#endif + +#if BB_PlaneAligned +void bb_PlanarAlignedQuad(in SPrimitives gInput, out vec3 xAxis, out vec3 yAxis, out vec3 nAxis) +{ + vec3 center = gInput.VertexPosition.xyz; + vec3 axis_fwd = gInput.geomAxis0; + vec3 axis_nrm = gInput.geomAxis1; + vec3 side = GET_CONSTANT(SceneInfo, SideVector).xyz; + vec3 depth = GET_CONSTANT(SceneInfo, DepthVector).xyz; + + xAxis = myCross(axis_nrm, axis_fwd); + if (dot(xAxis, xAxis) > NORMALIZER_EPSILON) + xAxis = normalize(xAxis); + else + { + vec3 v = -side * dot(axis_nrm, depth) + depth * (dot(axis_nrm, side) + 0.01f); + // cross(), not myCross(): in billboards_planar_quad.cpp, fallback axis ignores the handedness + xAxis = normalize(cross(axis_nrm, v)); + // This computation is consistent with CPU BUT we flip the axis + // to cancel GPU bb flip, due to FLIP_BILLBOARDING_AXIS. + xAxis = -xAxis; + } + yAxis = myCross(xAxis, axis_nrm); + rotate_axis(gInput, xAxis, yAxis); + + vec2 radius = get_radius(gInput); + xAxis *= radius.x; + yAxis *= radius.y; + nAxis = axis_nrm; + + // Specific to planar aligned quads, flip X + xAxis = -xAxis; +} +#endif + +#if BB_AxisAlignedCapsule +void bb_VelocityCapsuleAlign(in SPrimitives gInput, out vec3 xAxis, out vec3 yAxis, out vec3 upVec, out vec3 nAxis) +{ +#if !defined(CONST_SceneInfo_BillboardingView) +#error "Missing View matrix in SceneInfo" +#endif + vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + + vec3 camToParticle = normalize(gInput.VertexPosition.xyz - viewPos); + vec2 radius = get_radius(gInput); + vec3 side = GET_CONSTANT(SceneInfo, SideVector).xyz; + vec3 depth = GET_CONSTANT(SceneInfo, DepthVector).xyz; + + vec3 sideVec = myCross(camToParticle, gInput.geomAxis0); + if (dot(sideVec, sideVec) > NORMALIZER_EPSILON) + sideVec = normalize(sideVec); + else + { + vec3 v = -side * dot(camToParticle, depth) + depth * (dot(camToParticle, side) + 0.01f); + sideVec = normalize(myCross(camToParticle, v)); + // This computation is consistent with CPU BUT we flip the axis + // to cancel GPU bb flip, due to FLIP_BILLBOARDING_AXIS. + sideVec = -sideVec; + } + sideVec *= sqrt(2.f) * radius.x; + + upVec = myCross(sideVec, camToParticle); + xAxis = sideVec; +#if FLIP_BILLBOARDING_AXIS + xAxis *= -1.0f; +#endif + yAxis = gInput.geomAxis0 * 0.5f; + nAxis = normalize(myCross(sideVec, yAxis)); +} +#endif + +void billboard_quad(in SPrimitives gInput, uint bb, out vec3 xAxis, out vec3 yAxis, out vec3 nAxis) +{ +#if 0 + bb_ScreenAlignedQuad(gInput, xAxis, yAxis, nAxis); +#else + switch (bb) + { +#if BB_ScreenAligned + case BB_ScreenAligned: + bb_ScreenAlignedQuad(gInput, xAxis, yAxis, nAxis); + break; +#endif +#if BB_ViewposAligned + case BB_ViewposAligned: + bb_ViewposAlignedQuad(gInput, xAxis, yAxis, nAxis); + break; +#endif +#if BB_AxisAligned + case BB_AxisAligned: + bb_VelocityAxisAligned(gInput, xAxis, yAxis, nAxis); + break; +#endif +#if BB_AxisAlignedSpheroid + case BB_AxisAlignedSpheroid: + bb_VelocitySpheroidalAlign(gInput, xAxis, yAxis, nAxis); + break; +#endif +#if BB_PlaneAligned + case BB_PlaneAligned: + bb_PlanarAlignedQuad(gInput, xAxis, yAxis, nAxis); + break; +#endif + default: + bb_ScreenAlignedQuad(gInput, xAxis, yAxis, nAxis); + break; + } +#endif +#if FLIP_BILLBOARDING_AXIS + yAxis *= -1.0f; // We need to flip the y axis to get the same result as the CPU billboarders +#endif +} + +vec4 proj_position(vec3 position) +{ +#if defined(CONST_SceneInfo_ViewProj) + return mul(GET_CONSTANT(SceneInfo, ViewProj), vec4(position, 1.0f)); +#else + return vec4(position, 1.0f); +#endif +} + +#if defined(GOUTPUT_fragUV0) && defined(GOUTPUT_fragUV1) +void bb_billboardUV(in SPrimitives gInput, inout vec4 c00, inout vec4 c01, inout vec4 c10, inout vec4 c11, inout float atlasId, inout vec4 rectA, inout vec4 rectB) +#else +void bb_billboardUV(in SPrimitives gInput, inout vec2 c00, inout vec2 c01, inout vec2 c10, inout vec2 c11, inout vec4 rectA) +#endif +{ + uint drId = asuint(gInput.VertexPosition.w); + uint flags = asuint(GET_CONSTANT(BillboardInfo, DrawRequest)[drId].x); +#if BB_Feature_Atlas + float idf = gInput.geomAtlas_TextureID; + uint maxAtlasIdx = LOADU(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(0)) - 1U; + uint idA = min(uint(floor(idf)), maxAtlasIdx); + rectA = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(idA * 4 + 1)); +# if defined(GOUTPUT_fragUV1) + uint idB = min(idA + 1U, maxAtlasIdx); + rectB = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(idB * 4 + 1)); + vec4 maddm = vec4(rectA.xy, rectB.xy); + vec4 madda = vec4(rectA.zw, rectB.zw); + float blendWeight = (flags & BB_Flag_SoftAnimBlend) != 0U ? 1.0f : 0.0f; + atlasId = fract(idf) * blendWeight; +# else + vec2 maddm = rectA.xy; + vec2 madda = rectA.zw; +# endif + c00 = c00 * maddm + madda; + c01 = c01 * maddm + madda; + c10 = c10 * maddm + madda; + c11 = c11 * maddm + madda; +#endif + + if ((flags & BB_Flag_FlipV) != 0U) + { + swap(c00, c01); + swap(c10, c11); + } + if ((flags & BB_Flag_FlipU) != 0U) + { + swap(c00, c10); + swap(c01, c11); + } +} + +void bb_billboardNormal( + float nFactor, + out vec3 n0, out vec3 n1, out vec3 n2, out vec3 n3, + #if BB_AxisAlignedCapsule + out vec3 n4, out vec3 n5, + #endif + in vec3 xAxis, in vec3 yAxis, in vec3 nAxis) +{ + float nw = (1.0f - nFactor); // weight + vec3 xAxisNorm = normalize(xAxis); + vec3 yAxisNorm = normalize(yAxis); + vec3 n = nAxis * nw; // normal weighted + + #if BB_AxisAlignedCapsule + float rlen = rsqrt(nw * nw + nFactor * nFactor); + xAxisNorm *= nFactor * rlen; + yAxisNorm *= nFactor * rlen; + n *= rlen; + n0 = n + xAxisNorm; + n1 = n - xAxisNorm; + n2 = n + xAxisNorm; + n3 = n - xAxisNorm; + n4 = n - yAxisNorm; + n5 = n + yAxisNorm; + #else + vec3 xpy = (xAxisNorm + yAxisNorm) * nFactor; + vec3 xmy = (xAxisNorm - yAxisNorm) * nFactor; + n0 = normalize(n + xpy); + n1 = normalize(n + xmy); + n2 = normalize(n - xmy); + n3 = normalize(n - xpy); + #endif +} + +void bb_billboardTangent( + float nFactor, + out vec4 t0, out vec4 t1, out vec4 t2, out vec4 t3, + #if BB_AxisAlignedCapsule + out vec4 t4, out vec4 t5, + #endif + in vec3 xAxis, in vec3 yAxis, in vec3 nAxis, in bool flipU, in bool flipV) +{ + float nw = (1.0f - nFactor); // weight + vec3 xAxisNorm = normalize(xAxis); + vec3 yAxisNorm = normalize(yAxis); + vec3 n = nAxis; // normal + + #if BB_AxisAlignedCapsule + vec3 t = normalize(xAxisNorm + yAxisNorm) * nw; + float rlen = rsqrt(nw * nw + 2.0f * nFactor * nFactor); + t *= rlen; + n *= nFactor * rlen; + xAxisNorm *= nFactor * rlen; + yAxisNorm *= nFactor * rlen; + float tangentW = flipU != flipV ? -1.0f : 1.0f; + float tangentDir = flipU ? -1.0f : 1.0f; + t0 = vec4(t - n + yAxisNorm * tangentDir, tangentW); + t2 = t0; + t1 = vec4(t + n + yAxisNorm * tangentDir, tangentW); + t3 = t1; + t4 = vec4(t + n + xAxisNorm * tangentDir, tangentW); + t5 = vec4(t - n + xAxisNorm * tangentDir, tangentW); + #else + vec3 t = xAxisNorm * nw; + n *= nFactor; + xAxisNorm *= nFactor; + yAxisNorm *= nFactor; + float tangentW = flipU != flipV ? 1.0f : -1.0f; + float tangentDir = flipU ? -1.0f : 1.0f; + t0 = vec4(normalize(t - n + xAxisNorm - yAxisNorm) * tangentDir, tangentW); + t1 = vec4(normalize(t - n + xAxisNorm + yAxisNorm) * tangentDir, tangentW); + t2 = vec4(normalize(t + n + xAxisNorm + yAxisNorm) * tangentDir, tangentW); + t3 = vec4(normalize(t + n + xAxisNorm - yAxisNorm) * tangentDir, tangentW); + #endif +} + +void GeometryBillboard(in SGeometryInput gInput, SGeometryOutput gOutput GS_ARGS) +{ + uint drId = asuint(gInput.Primitives[0].VertexPosition.w); + uint flags = asuint(GET_CONSTANT(BillboardInfo, DrawRequest)[drId].x); + + bool flipU = (flags & BB_Flag_FlipU) != 0U; + bool flipV = (flags & BB_Flag_FlipV) != 0U; + float tangentW = 1.0f; + // UV +#if defined(GOUTPUT_fragUV0) && defined(GOUTPUT_fragUV1) +# define setUV0(_uv, _value) _uv = _value.xy; +# define setUV1(_uv, _value) _uv = _value.zw; + vec4 c00 = vec4(0, 0, 0, 0); + vec4 c01 = vec4(0, 1, 0, 1); + vec4 c10 = vec4(1, 0, 1, 0); + vec4 c11 = vec4(1, 1, 1, 1); + vec4 rect0 = vec4(0, 0, 0, 0); + vec4 rect1 = vec4(0, 0, 0, 0);; + bb_billboardUV(gInput.Primitives[0], c00, c01, c10, c11, gOutput.fragAtlasID, rect0, rect1); +#elif defined(GOUTPUT_fragUV0) +# define setUV0(_uv, _value) _uv = _value; +# define setUV1(_uv, _value) + vec2 c00 = vec2(0, 0); + vec2 c01 = vec2(0, 1); + vec2 c10 = vec2(1, 0); + vec2 c11 = vec2(1, 1); + vec4 rect0 = vec4(0, 0, 0, 0); + bb_billboardUV(gInput.Primitives[0], c00, c01, c10, c11, rect0); +#else +# define setUV0(_uv, _value) +# define setUV1(_uv, _value) +#endif + + // Axis y/x to create the quad + normal + vec3 center = gInput.Primitives[0].VertexPosition.xyz; + vec3 xAxis = vec3(0, 0, 0); + vec3 yAxis = vec3(0, 0, 0); + vec3 nAxis = vec3(0, 0, 0); + +#if BB_AxisAlignedCapsule + vec3 upVec = vec3(0, 0, 0); + bb_VelocityCapsuleAlign(gInput.Primitives[0], xAxis, yAxis, upVec, nAxis); +#else + billboard_quad(gInput.Primitives[0], flags & BB_Flag_BillboardMask, xAxis, yAxis, nAxis); +#endif + + vec3 xpy = xAxis + yAxis; + vec3 xmy = xAxis - yAxis; + + // fragViewProjPosition +#if defined(GOUTPUT_fragViewProjPosition) + #define setViewProjPosition(_position, _value) _position = _value; +#else + #define setViewProjPosition(_position, _value) +#endif + + // fragWorldPosition +#if defined(GOUTPUT_fragWorldPosition) + #define setWorldPosition(_position, _value) _position = _value; +#else + #define setWorldPosition(_position, _value) +#endif + +#if defined(GOUTPUT_fragNormal) || defined(GOUTPUT_fragTangent) + float nFactor = GET_CONSTANT(BillboardInfo, DrawRequest)[drId].y; +#endif + + // Normals +#if defined(GOUTPUT_fragNormal) +#define setNormal(_normal, _value) _normal = _value; + vec3 n0, n1, n2, n3; + #if BB_AxisAlignedCapsule + vec3 n4, n5; + bb_billboardNormal(nFactor, n0, n1, n2, n3, n4, n5, xAxis, yAxis, nAxis); + #else + bb_billboardNormal(nFactor, n0, n1, n2, n3, xAxis, yAxis, nAxis); + #endif +#else +#define setNormal(_normal, _value) +#endif + + // Tangent +#if defined(GOUTPUT_fragTangent) +#define setTangent(_tangent, _value) _tangent = _value; + vec4 t0, t1, t2, t3; + #if BB_AxisAlignedCapsule + vec4 t4, t5; + bb_billboardTangent(nFactor, t0, t1, t2, t3, t4, t5, xAxis, yAxis, nAxis, flipU, flipV); + #else + bb_billboardTangent(nFactor, t0, t1, t2, t3, xAxis, yAxis, nAxis, flipU, flipV); + #endif +#else +#define setTangent(_tangent, _value) +#endif + + // Emit 4 / 6 vertex + +#define emittr(pos, uv, normal, tangent) \ + gOutput.VertexPosition = proj_position(pos); \ + setViewProjPosition(gOutput.fragViewProjPosition, gOutput.VertexPosition); \ + setWorldPosition(gOutput.fragWorldPosition, pos); \ + setUV0(gOutput.fragUV0, uv); \ + setUV1(gOutput.fragUV1, uv); \ + setNormal(gOutput.fragNormal, normal); \ + setTangent(gOutput.fragTangent, tangent); \ + AppendVertex(gOutput GS_PARAMS); + +#if BB_AxisAlignedCapsule + emittr(center + yAxis + upVec, c10, n5, t5); + emittr(center + xpy, c11, n0, t0); // +x+y + emittr(center - xmy, c00, n1, t1); // -x+y + emittr(center + xmy, c11, n2, t2); // +x-y + emittr(center - xpy, c00, n3, t3); // -x-y + emittr(center - yAxis - upVec, c01, n4, t4); +#else + emittr(center + xpy, c11, n0, t0); // +x+y + emittr(center + xmy, c10, n1, t1); // +x-y + emittr(center - xmy, c01, n2, t2); // -x+y + emittr(center - xpy, c00, n3, t3); // -x-y +#endif +} diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Billboard.vert b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Billboard.vert new file mode 100644 index 00000000..e4c24a0c --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Billboard.vert @@ -0,0 +1,477 @@ +#if BB_FeatureC0 +# define BB_ScreenAligned 1U +# define BB_ViewposAligned 2U +# if !defined(VRESOURCE_PositionsOffsets) && defined(BB_GPU_SIM) +# error missing PositionsOffsets SRV +# endif +# if !defined(VRESOURCE_Positions) && !defined(BB_GPU_SIM) +# error missing Positions SRV +# endif +# if !defined(VRESOURCE_Indices) && !defined(BB_GPU_SIM) +# error missing Indices SRV // Mandatory for now +# endif +# if !defined(VRESOURCE_SizesOffsets) && !defined(VRESOURCE_Size2sOffsets) && defined(BB_GPU_SIM) +# error missing SizesOffsets or Size2sOffsets SRV +# endif +# if !defined(VRESOURCE_Sizes) && !defined(VRESOURCE_Size2s) && !defined(BB_GPU_SIM) +# error missing Sizes SRV +# endif +#else +# error config error +#endif + +#if defined(VOUTPUT_fragUV1) +# if !defined(VOUTPUT_fragAtlasID) +# error "config error" +# endif +#else +# if defined(VOUTPUT_fragAtlasID) +# error "config error" +# endif +#endif +#if BB_Feature_Atlas +# if !defined(VRESOURCE_Atlas_TextureIDsOffsets) && defined(BB_GPU_SIM) +# error missing TextureIDsOffsets SRV +# endif +# if !defined(VRESOURCE_Atlas_TextureIDs) && !defined(BB_GPU_SIM) +# error "config error" +# endif +#endif + +#if BB_FeatureC1 +# define NORMALIZER_EPSILON 1.0e-8f +# define BB_AxisAligned 3U +# define BB_AxisAlignedSpheroid 4U +# if !defined(VRESOURCE_Axis0sOffsets) && defined(BB_GPU_SIM) +# error missing Axis0sOffsets SRV +# endif +# if !defined(VRESOURCE_Axis0s) && !defined(BB_GPU_SIM) +# error missing Axis0s SRV +# endif +#endif + +#if BB_FeatureC1_Capsule +# define BB_AxisAlignedCapsule 5U +#endif + +#if BB_FeatureC2 +# define BB_PlaneAligned 6U +# if !defined(VRESOURCE_Axis1sOffsets) && defined(BB_GPU_SIM) +# error missing Axis1sOffsets SRV +# endif +# if !defined(VRESOURCE_Axis1s) && !defined(BB_GPU_SIM) +# error missing Axis1s SRV +# endif +#endif + +#define FLIP_BILLBOARDING_AXIS 1 + +#if !defined(CONST_BillboardInfo_DrawRequest) +#error "Missing constant with infos for billboard" +#endif + +#if defined(CONST_BillboardInfo_DrawRequest) +# define BB_Flag_BillboardMask 7U // 3 firsts bits +# define BB_Flag_FlipV 8U // 4th bit +# define BB_Flag_SoftAnimBlend 16U // 5th bit +# define BB_Flag_FlipU 32U // 6th bit +#endif + +// DrawRequest: +// x: Flags +// y: NormalsBendingFactor + +// RightHanded/LeftHanded: +#define myCross(a, b) cross(a, b) * GET_CONSTANT(SceneInfo, Handedness) + +vec2 get_radius(uint particleID VS_ARGS) +{ + float enabled = 1.0f; + +#if BB_GPU_SIM +# if defined(VRESOURCE_EnabledsOffsets) + const uint e = LOADU(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(EnabledsOffsets), RAW_BUFFER_INDEX(GET_CONSTANT(GPUBillboardPushConstants, StreamOffsetsIndex))) + RAW_BUFFER_INDEX(particleID)); + enabled = e != 0 ? 1.0f : 0.0f; +# endif + +# if defined(HAS_SizeFloat2) + return LOADF2(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Size2sOffsets), RAW_BUFFER_INDEX(GET_CONSTANT(GPUBillboardPushConstants, StreamOffsetsIndex))) + RAW_BUFFER_INDEX(particleID * 2)) * enabled; +# else + float _radius = LOADF(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(SizesOffsets), RAW_BUFFER_INDEX(GET_CONSTANT(GPUBillboardPushConstants, StreamOffsetsIndex))) + RAW_BUFFER_INDEX(particleID)); + return vec2(_radius, _radius) * enabled; +# endif +#else +# if defined(HAS_SizeFloat2) + return LOADF2(GET_RAW_BUFFER(Size2s), RAW_BUFFER_INDEX(particleID * 2)) * enabled; +# else + float _radius = LOADF(GET_RAW_BUFFER(Sizes), RAW_BUFFER_INDEX(particleID)); + return vec2(_radius, _radius) * enabled; +# endif +#endif // BB_GPU_SIM +} + +#if defined(BB_ScreenAligned) || defined(BB_ViewposAligned) || defined(BB_PlaneAligned) +void RotateTangents(uint particleID, INOUT(vec3) tangent0, INOUT(vec3) tangent1 VS_ARGS) +{ +#if defined(VRESOURCE_Rotations) || defined(VRESOURCE_RotationsOffsets) +# if BB_GPU_SIM +# if !defined(VRESOURCE_RotationsOffsets) +# error missing RotationsOffsets SRV +# endif // !defined(VRESOURCE_Rotations) + const float rotation = LOADF(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(RotationsOffsets), RAW_BUFFER_INDEX(GET_CONSTANT(GPUBillboardPushConstants, StreamOffsetsIndex))) + RAW_BUFFER_INDEX(particleID)); +# else +# if !defined(VRESOURCE_Rotations) +# error missing Rotations SRV +# endif // !defined(VRESOURCE_Rotations) + const float rotation = LOADF(GET_RAW_BUFFER(Rotations), RAW_BUFFER_INDEX(particleID)); +# endif // BB_GPU_SIM + + const float rotCos = cos(rotation); + const float rotSin = sin(rotation); + const vec3 _tangent0 = tangent0; + + tangent0 = tangent1 * rotSin + tangent0 * rotCos; + tangent1 = tangent1 * rotCos - _tangent0 * rotSin; +#endif // defined(VRESOURCE_Rotations) || defined(VRESOURCE_RotationsOffsets) +} +#endif + +vec4 proj_position(IN(vec3) position VS_ARGS) +{ +#if defined(CONST_SceneInfo_ViewProj) + return mul(GET_CONSTANT(SceneInfo, ViewProj), vec4(position, 1.0f)); +#else + return vec4(position, 1.0f); +#endif +} + +#if BB_FeatureC1 +vec3 ComputeTangent1(IN(vec3) nrm, IN(vec3) tangent0 VS_ARGS) +{ + vec3 side = GET_CONSTANT(SceneInfo, SideVector).xyz; + vec3 depth = GET_CONSTANT(SceneInfo, DepthVector).xyz; + + vec3 tangent1 = myCross(nrm, tangent0); + if (dot(tangent1, tangent1) > NORMALIZER_EPSILON) + tangent1 = normalize(tangent1); + else + { + const vec3 v = -side * dot(nrm, depth) + depth * (dot(nrm, side) + 0.01f); + // cross(), not myCross(): in billboards_planar_quad.cpp, fallback axis ignores the handedness + tangent1 = normalize(cross(nrm, v)); + // This computation is consistent with CPU BUT we flip the axis + // to cancel GPU bb flip, due to FLIP_BILLBOARDING_AXIS. + tangent1 = -tangent1; + } + return tangent1; +} +#endif + +void VertexBillboard(IN(SVertexInput) vInput, INOUT(SVertexOutput) vOutput, uint particleID VS_ARGS) +{ +#if BB_GPU_SIM + const uint storageId = GET_CONSTANT(GPUBillboardPushConstants, StreamOffsetsIndex); + const vec3 worldPos = LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(PositionsOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3)); + const uint drId = 0; // No batching yet for GPU particles +#else + const vec4 worldPosDrId = LOADF4(GET_RAW_BUFFER(Positions), RAW_BUFFER_INDEX(particleID * 4)); + const vec3 worldPos = worldPosDrId.xyz; + const uint drId = asuint(worldPosDrId.w); +#endif + + + const vec4 currentDr = GET_CONSTANT(BillboardInfo, DrawRequest)[drId]; + const uint flags = asuint(currentDr.x); + const uint billboarderType = flags & BB_Flag_BillboardMask; + const bool flipU = (flags & BB_Flag_FlipU) != 0U; + const bool flipV = (flags & BB_Flag_FlipV) != 0U; + + const vec2 radius = get_radius(particleID VS_PARAMS); + vec3 tangent0 = vec3(0, 0, 0); // billboard side vector + vec3 tangent1 = vec3(0, 0, 0); // billboard fwd/stretch vector + vec3 planeNormal = vec3(0, 0, 0); // billboard normal vector + +#if !defined(CONST_SceneInfo_BillboardingView) +# error "Missing BillboardingView matrix in SceneInfo" +#endif +#if !defined(CONST_SceneInfo_SideVector) +# error "Missing View side vector in SceneInfo" +#endif +#if !defined(CONST_SceneInfo_DepthVector) +# error "Missing View depth vector in SceneInfo" +#endif + + const vec2 cornerCoords = vInput.TexCoords; + vec2 texCoords = cornerCoords; + switch (billboarderType) + { +#if BB_ScreenAligned + case BB_ScreenAligned: + { + tangent0 = GET_MATRIX_X_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + tangent1 = GET_MATRIX_Y_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + planeNormal = GET_MATRIX_Z_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + + RotateTangents(particleID, tangent0, tangent1 VS_PARAMS); + + // Apply radius after rotation, otherwise float2 sizes are incorrect + tangent0 *= radius.x; + tangent1 *= radius.y; + break; + } +#endif +#if BB_ViewposAligned + case BB_ViewposAligned: + { + const vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + const vec3 viewUpAxis = GET_MATRIX_Y_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + const vec3 camToParticle = normalize(worldPos - viewPos); + const vec3 upVectorInterm = viewUpAxis - 1.e-5f * camToParticle.xzy; + + tangent0 = normalize(myCross(camToParticle, upVectorInterm)); + tangent1 = myCross(tangent0, camToParticle); + planeNormal = -camToParticle; + RotateTangents(particleID, tangent0, tangent1 VS_PARAMS); + + // Apply radius after rotation, otherwise float2 sizes are incorrect + tangent0 *= radius.x; + tangent1 *= radius.y; + break; + } +#endif +#if BB_AxisAligned + case BB_AxisAligned: + { + const vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + const vec3 camToParticle = normalize(worldPos - viewPos); + +# if BB_GPU_SIM + const vec3 axis_fwd = LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis0sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3)); +# else + const vec3 axis_fwd = LOADF3(GET_RAW_BUFFER(Axis0s), RAW_BUFFER_INDEX(particleID * 3)); +# endif // BB_GPU_SIM + + tangent0 = ComputeTangent1(camToParticle, axis_fwd VS_PARAMS) * radius.x; + tangent1 = axis_fwd * 0.5f; + planeNormal = -camToParticle; + break; + } +#endif +#if BB_AxisAlignedSpheroid + case BB_AxisAlignedSpheroid: + { + const vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + const vec3 camToParticle = normalize(worldPos - viewPos); + +# if BB_GPU_SIM + const vec3 axis_fwd = LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis0sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3)); +# else + const vec3 axis_fwd = LOADF3(GET_RAW_BUFFER(Axis0s), RAW_BUFFER_INDEX(particleID * 3)); +# endif // BB_GPU_SIM + + tangent0 = ComputeTangent1(camToParticle, axis_fwd VS_PARAMS) * radius.x; + tangent1 = axis_fwd * 0.5f + myCross(tangent0, camToParticle); + // Warning: tangent0 and tangent1 are not orthogonal. + planeNormal = normalize(myCross(tangent0, tangent1)); + break; + } +#endif +#if BB_AxisAlignedCapsule + case BB_AxisAlignedCapsule: + { + const vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + const vec3 camToParticle = normalize(worldPos - viewPos); + +# if BB_GPU_SIM + const vec3 axis_fwd = LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis0sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3)); +# else + const vec3 axis_fwd = LOADF3(GET_RAW_BUFFER(Axis0s), RAW_BUFFER_INDEX(particleID * 3)); +# endif // BB_GPU_SIM + + tangent0 = ComputeTangent1(camToParticle, axis_fwd VS_PARAMS) * sqrt(2.f) * radius.x; + + tangent1 = axis_fwd * 0.5f; + planeNormal = normalize(myCross(tangent0, tangent1)); + +#if FLIP_BILLBOARDING_AXIS + tangent0 *= -1.0f; +#endif + + const float upAxisStretch = abs(texCoords.y) - 1.0f; + tangent1 -= myCross(tangent0, camToParticle) * upAxisStretch; + texCoords.y = clamp(texCoords.y, -1.0f, 1.0f); + + break; + } +#endif +#if BB_PlaneAligned + case BB_PlaneAligned: + { +# if BB_GPU_SIM + const vec3 axis_fwd = LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis0sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3)); + const vec3 axis_nrm = LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis1sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3)); +# else + const vec3 axis_fwd = LOADF3(GET_RAW_BUFFER(Axis0s), RAW_BUFFER_INDEX(particleID * 3)); + const vec3 axis_nrm = LOADF3(GET_RAW_BUFFER(Axis1s), RAW_BUFFER_INDEX(particleID * 3)); +# endif // BB_GPU_SIM + + tangent0 = ComputeTangent1(axis_nrm, axis_fwd VS_PARAMS); + tangent1 = myCross(tangent0, axis_nrm); + planeNormal = axis_nrm; + + // Specific to planar aligned quads, flip X + RotateTangents(particleID, tangent0, tangent1 VS_PARAMS); + + // Apply radius after rotation, otherwise float2 sizes are incorrect + tangent0 *= radius.x; + tangent1 *= radius.y; + tangent0 = -tangent0; + + break; + } +#endif + default: + break; + } + +#if BB_AxisAlignedCapsule + // Flip not needed +#elif FLIP_BILLBOARDING_AXIS + tangent1 *= -1.0f; // We need to flip the y axis to get the same result as the CPU billboarders +#endif + + const vec3 bbCorner = tangent0 * texCoords.x + tangent1 * texCoords.y; + const vec3 vertexWorldPosition = worldPos + bbCorner; + +#if BB_AxisAlignedCapsule + /* We want to remap the input texcoords that indicates the expand direction, into the texcoords: + * + * 2 3 + * 1,1 1,-1 1,1 1,1 + * ,.---------+ ,+---------+ + * ,' | . | `. ,' | . | `. + * 0,2 + | . | + 0,-2 -> 0,1 + | . | + 1,0 + * 4 '. | . | .' 5 '. | . | .' + * +.---------+' '+---------+' + * -1,1 -1,-1 0,0 0,0 + * 1 0 + * + * Indices: 1 3 0, 2 3 1, 3 5 0, 1 4 2 + */ + const float xMax = max(cornerCoords.x, 0.0f); + texCoords = vec2(xMax + max(cornerCoords.y - 1.0f, 0.0f), xMax + max(-cornerCoords.y - 1.0f, 0.0f)); +#else + /* We want to remap the input texcoords that indicates the expand direction, into the texcoords: + * + * 1 2 + * -1,1 1,1 0,1 1,1 + * +---------+ +---------+ + * |`._ | |`._ | + * | `._ | -> | `._ | + * | `. | | `. | + * +--------`+ +--------`+ + * -1,-1 1,-1 0,0 0,1 + * 0 3 + * + * Indices: 1 3 0, 2 3 1 + */ + texCoords = texCoords * 0.5f + 0.5f; // Remap corners from -1,1 to 0,1 +#endif + + if (flipU) + texCoords.x = 1.0f - texCoords.x; + if (flipV) + texCoords.y = 1.0f - texCoords.y; + +#if defined(VOUTPUT_fragUV0) +# if BB_Feature_Atlas + const uint maxAtlasID = LOADU(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(0)) - 1U; + +# if BB_GPU_SIM + const float textureID = LOADF(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Atlas_TextureIDsOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID)); +# else + const float textureID = LOADF(GET_RAW_BUFFER(Atlas_TextureIDs), RAW_BUFFER_INDEX(particleID)); +# endif // BB_GPU_SIM + + const uint atlasID0 = min(uint(textureID), maxAtlasID); + const vec4 rect0 = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(atlasID0 * 4 + 1)); + + vOutput.fragUV0 = texCoords * rect0.xy + rect0.zw; + +# if defined (VOUTPUT_fragUV1) + const uint atlasID1 = min(atlasID0 + 1U, maxAtlasID); + const vec4 rect1 = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(atlasID1 * 4 + 1)); + + vOutput.fragUV1 = texCoords * rect1.xy + rect1.zw; + + // To be removed in future PopcornFX versions. We already output vOutput.fragAtlas_TextureID generated + // from additional inputs. This line generates a driver bug on nvidia cards if the "+ 0.00001f" isn't added. + vOutput.fragAtlasID = textureID + 0.00001f; + +# endif +# else + vOutput.fragUV0 = texCoords; +# endif +#endif + +#if defined(VOUTPUT_fragNormal) || defined(VOUTPUT_fragTangent) + const float normalBendingFactor = currentDr.y; + if (normalBendingFactor > 0.0f) + { + const vec3 tangent0Norm = normalize(tangent0); + const vec3 tangent1Norm = normalize(tangent1); + const float normalWeight = (1.0f - normalBendingFactor); + +# if defined (VOUTPUT_fragNormal) +# if BB_AxisAlignedCapsule + const float upAxisStretch = abs(cornerCoords.y) - 1.0f; + const vec3 bentNormal = (tangent0Norm * cornerCoords.x * (1.0f - upAxisStretch) + tangent1Norm * sign(cornerCoords.y) * upAxisStretch) * normalBendingFactor; +# else + const vec3 bentNormal = (tangent0Norm * cornerCoords.x + tangent1Norm * cornerCoords.y) * normalBendingFactor; +# endif + + vOutput.fragNormal = normalize(planeNormal * normalWeight + bentNormal); +# endif + +# if defined(VOUTPUT_fragTangent) +# if BB_AxisAlignedCapsule + const float normalSign = sign(cornerCoords.y) - cornerCoords.y - cornerCoords.x; + const vec3 planeNormalForTangent = planeNormal * normalSign * normalBendingFactor; + const vec3 bentTangent = planeNormalForTangent + (tangent0Norm * upAxisStretch + tangent1Norm * (1.0f - upAxisStretch)) * normalBendingFactor; + const vec3 planeTangentWeighted = normalize(tangent0Norm + tangent1Norm) * normalWeight; + const float tangentDir = flipU ? -1.0f : 1.0f; + const float bitangentDir = flipU != flipV ? -1.0f : 1.0f; + vOutput.fragTangent = vec4(normalize(planeTangentWeighted + bentTangent) * tangentDir, bitangentDir); +# else + const vec2 tangentTexCoords = vec2(-cornerCoords.x, cornerCoords.y * sign(-cornerCoords.x)); + const vec3 planeNormalForTangent = planeNormal * tangentTexCoords.x * normalBendingFactor; + const vec3 bentTangent = planeNormalForTangent + (tangent0Norm + tangent1Norm * tangentTexCoords.y) * normalBendingFactor; + const vec3 planeTangentWeighted = tangent0Norm * normalWeight; + const float tangentDir = flipU ? -1.0f : 1.0f; + const float bitangentDir = flipU != flipV ? 1.0f : -1.0f; + vOutput.fragTangent = vec4(normalize(planeTangentWeighted + bentTangent) * tangentDir, bitangentDir); +# endif +# endif + } + else + { +# if defined (VOUTPUT_fragNormal) + vOutput.fragNormal = planeNormal; +# endif +# if defined(VOUTPUT_fragTangent) +# if BB_AxisAlignedCapsule + const vec3 tangent0Norm = normalize(tangent0); + const vec3 tangent1Norm = normalize(tangent1); + vOutput.fragTangent = vec4(normalize(tangent0Norm + tangent1Norm) * (flipU ? -1.0f : 1.0f), flipU != flipV ? -1.0f : 1.0f); +# else + vOutput.fragTangent = vec4(normalize(tangent0) * (flipU ? -1.0f : 1.0f), flipU != flipV ? 1.0f : -1.0f); +#endif +# endif + } +#endif + + vOutput.VertexPosition = proj_position(vertexWorldPosition VS_PARAMS); +#if defined(VOUTPUT_fragWorldPosition) + vOutput.fragWorldPosition = vertexWorldPosition; +#endif +} \ No newline at end of file diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/GPUSimInterfaces/GPUSimInterface_GBuffer_ProjectToNormal.d3d b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/GPUSimInterfaces/GPUSimInterface_GBuffer_ProjectToNormal.d3d new file mode 100644 index 00000000..a1aafaa9 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/GPUSimInterfaces/GPUSimInterface_GBuffer_ProjectToNormal.d3d @@ -0,0 +1,40 @@ +//---------------------------------------------------------------------------- +// +// _pksi_GBuffer_ProjectToNormal +// +//---------------------------------------------------------------------------- + +// PK-SampleLib rendering normal unpack function +float3 UnpackNormalSpheremap(float2 normal) +{ + float2 fenc = normal * 4.0f - 2.0f; + float f = dot(fenc, fenc); + float g = sqrt(1.0f - f / 4.0f); + float3 outNormal; + + outNormal.xy = fenc * g; + outNormal.z = 1.0f - f / 2.0f; + return mul(UnpackNormalView, float4(outNormal, 0.0f)).xyz; +} + +//---------------------------------------------------------------------------- + +// Outputs the GBuffer normal value at projected world position +float3 Ext__pksi_GBuffer_ProjectToNormal_f32x3_CX(float3 position, inout int4 sceneCtx) +{ + float4 clipPosition = mul(ViewProj, float4(position, 1.0f)); + float2 screenPosition = clipPosition.xy / clipPosition.w; + float2 screenUV = screenPosition * 0.5f + 0.5f; + + // Return zero normal if input position is outside of view: + // branching below could also be removed by changing SceneTexturesSampler's addressing mode to TEXTURE_ADDRESS_MODE_BORDER and having a zero border color + float3 worldNormal = float3(0.0f, 0.0f, 0.0f); + if (all(abs(screenPosition.xy) <= float2(1, 1))) + { + float4 packedNormalRoughMetal = SceneNormal.SampleLevel(SceneTexturesSampler, screenUV, 0); + worldNormal = UnpackNormalSpheremap(packedNormalRoughMetal.rg); + } + return worldNormal; +} + +//---------------------------------------------------------------------------- \ No newline at end of file diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/GPUSimInterfaces/GPUSimInterface_GBuffer_ProjectToPosition.d3d b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/GPUSimInterfaces/GPUSimInterface_GBuffer_ProjectToPosition.d3d new file mode 100644 index 00000000..7f41a611 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/GPUSimInterfaces/GPUSimInterface_GBuffer_ProjectToPosition.d3d @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------------- +// +// _pksi_GBuffer_ProjectToPosition +// +//---------------------------------------------------------------------------- + +float3 DepthToWorldPos(float depth, float2 screenUVs) +{ + float2 clipSpace = screenUVs * 2 - 1; + float4 projPos = float4(clipSpace, depth, 1); + + projPos = mul(InvViewProj, projPos); + return projPos.xyz / projPos.w; +} + +//---------------------------------------------------------------------------- + +// Outputs the SceneDepth map value at projected world position +float3 Ext__pksi_GBuffer_ProjectToPosition_f32x3_CX(float3 position, inout int4 sceneCtx) +{ + float4 clipPosition = mul(ViewProj, float4(position, 1.0f)); + float2 screenPosition = clipPosition.xy / clipPosition.w; + float2 screenUV = screenPosition * 0.5f + 0.5f; + + // Return forwarded input position if input position is outside of view + float3 worldPos = position; + if (all(abs(screenPosition.xy) <= float2(1, 1))) + { + float sampledDepth = SceneDepth.SampleLevel(SceneTexturesSampler, screenUV, 0).r; + worldPos = DepthToWorldPos(sampledDepth, screenUV); + } + return worldPos; +} + +//---------------------------------------------------------------------------- \ No newline at end of file diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Ribbon.vert b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Ribbon.vert new file mode 100644 index 00000000..f49f9963 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Ribbon.vert @@ -0,0 +1,341 @@ +#if !defined(BB_GPU_SIM) + #error "Vertex ribbon billboarding only implemented for GPU storage" +#endif + +#if BB_FeatureC0 +# define RB_ViewposAligned 1U +# if !defined(VRESOURCE_PositionsOffsets) +# error missing PositionsOffsets SRV +# endif +#else +# error config error +#endif + +#if defined(VOUTPUT_fragUV1) +# if !defined(VOUTPUT_fragAtlasID) +# error "config error" +# endif +#else +# if defined(VOUTPUT_fragAtlasID) +# error "config error" +# endif +#endif +#if BB_Feature_Atlas +# if !defined(VRESOURCE_Atlas_TextureIDsOffsets) +# error missing TextureIDsOffsets SRV +# endif +#endif + +#if BB_FeatureC1 +# define NORMALIZER_EPSILON 1.0e-8f +# define RB_NormalAxisAligned 2U +# define RB_SideAxisAligned 3U +# define RB_SideAxisAlignedTube 4U +# define RB_SideAxisAlignedMultiPlane 5U +# if !defined(VRESOURCE_Axis0sOffsets) +# error missing Axis0sOffsets SRV +# endif +#endif + +#define FLIP_BILLBOARDING_AXIS 1 + +#if !defined(CONST_BillboardInfo_DrawRequest) +#error "Missing constant with infos for billboard" +#endif + +#if defined(CONST_BillboardInfo_DrawRequest) +#define BB_Flag_BillboardMask 7U // 3 firsts bits +#define BB_Flag_VFlipU 8U // 4th bit +#define BB_Flag_VFlipV 16U // 5th bit +#define BB_Flag_VRotateTexture 32U // 5th bit +#endif + +#if !defined(CONST_SceneInfo_BillboardingView) +# error "Missing BillboardingView matrix in SceneInfo" +#endif +#if !defined(CONST_SceneInfo_SideVector) +# error "Missing View side vector in SceneInfo" +#endif +#if !defined(CONST_SceneInfo_DepthVector) +# error "Missing View depth vector in SceneInfo" +#endif + +// DrawRequest: +// x: Flags +// y: NormalsBendingFactor + +// RightHanded/LeftHanded: +#define myCross(a, b) cross(a, b) * GET_CONSTANT(SceneInfo, Handedness) + +vec4 proj_position(IN(vec3) position VS_ARGS) +{ +#if defined(CONST_SceneInfo_ViewProj) + return mul(GET_CONSTANT(SceneInfo, ViewProj), vec4(position, 1.0f)); +#else + return vec4(position, 1.0f); +#endif +} + +uint VertexBillboard(IN(SVertexInput) vInput, INOUT(SVertexOutput) vOutput, uint inParticleID VS_ARGS) +{ + const uint storageId = GET_CONSTANT(GPUBillboardPushConstants, StreamOffsetsIndex); + const uint particleCount = LOADU(GET_RAW_BUFFER(IndirectDraw), RAW_BUFFER_INDEX(storageId * 5 + 1)); + const uint maxID = particleCount - 1; + + // Vertex texcoords are in range [-1 +1] and used to build vertex position + const bool isLeftSide = vInput.TexCoords.x < 0.0f; + + // Compute indirected particle IDs + const uint inParticleIDOffsetted = inParticleID + (isLeftSide ? 0 : 1); // Offset particle ID for the right side vertices + const uint particleID = LOADU(GET_RAW_BUFFER(RibbonIndirection), RAW_BUFFER_INDEX(inParticleIDOffsetted)); + uint particleIDPrev = LOADU(GET_RAW_BUFFER(RibbonIndirection), RAW_BUFFER_INDEX(uint(max(int(inParticleIDOffsetted) - 1, 0)))); + uint particleIDNext = LOADU(GET_RAW_BUFFER(RibbonIndirection), RAW_BUFFER_INDEX(min(inParticleIDOffsetted + 1, maxID))); + + // ParentIDs + const uint parentIDOffset = LOADU(GET_RAW_BUFFER(ParentIDsOffsets), RAW_BUFFER_INDEX(storageId)); + const uint parentID = LOADU2(GET_RAW_BUFFER(GPUSimData), parentIDOffset + RAW_BUFFER_INDEX(particleID * 2)).x; + const uint parentIDPrev = LOADU2(GET_RAW_BUFFER(GPUSimData), parentIDOffset + RAW_BUFFER_INDEX(particleIDPrev * 2)).x; + const uint parentIDNext = LOADU2(GET_RAW_BUFFER(GPUSimData), parentIDOffset + RAW_BUFFER_INDEX(particleIDNext * 2)).x; + // If prev or next particles are from another ribbon, use middle particleID. + if (parentIDPrev != parentID) + particleIDPrev = particleID; + if (parentIDNext != parentID) + particleIDNext = particleID; + + // Positions + const uint posOffset = LOADU(GET_RAW_BUFFER(PositionsOffsets), RAW_BUFFER_INDEX(storageId)); + const vec3 pos = LOADF3(GET_RAW_BUFFER(GPUSimData), posOffset + RAW_BUFFER_INDEX(particleID * 3)); + const vec3 posPrev = LOADF3(GET_RAW_BUFFER(GPUSimData), posOffset + RAW_BUFFER_INDEX(particleIDPrev * 3)); + const vec3 posNext = LOADF3(GET_RAW_BUFFER(GPUSimData), posOffset + RAW_BUFFER_INDEX(particleIDNext * 3)); + const vec3 center = 0.5f * (pos + (isLeftSide ? posNext : posPrev)); + + // Do not render if... + const bool isLast = (isLeftSide && (parentID != parentIDNext)) || + (!isLeftSide && (parentID != parentIDPrev)) || + (inParticleID == maxID); + const float doRender = isLast ? 0.0f : 1.0f; + + // Size + const uint sizesOffset = LOADU(GET_RAW_BUFFER(SizesOffsets), RAW_BUFFER_INDEX(storageId)); + const float size = LOADF(GET_RAW_BUFFER(GPUSimData), sizesOffset + RAW_BUFFER_INDEX(particleID)); + + const uint drId = 0; // No batching yet for GPU particles + const vec4 currentDr = GET_CONSTANT(BillboardInfo, DrawRequest)[drId]; + const uint flags = asuint(currentDr.x); + const uint billboarderType = flags & BB_Flag_BillboardMask; + const vec3 viewPos = GET_MATRIX_W_AXIS(GET_CONSTANT(SceneInfo, BillboardingView)).xyz; + const float quadCount = currentDr.z; + + // Billboarding will write those: + vec3 tangent0 = vec3(0, 0, 0); // Ribbon side axis, unnormalized + vec3 tangent1 = vec3(0, 0, 0); // Ribbon longitudinal axis, unnormalized + vec3 normal = vec3(0, 0, 0); // Vertex normal vector + + float quadId = 1.0f; + +#if RB_SideAxisAlignedMultiPlane && RB_SideAxisAlignedTube + + // The texcoords u value are multiplied by the current planeId. + if (billboarderType == RB_SideAxisAlignedMultiPlane || billboarderType == RB_SideAxisAlignedTube) + { + quadId = abs(vInput.TexCoords.x); + + } +#endif + + + switch (billboarderType) + { +#if RB_ViewposAligned + case RB_ViewposAligned: + { + const vec3 prevToNext = posNext - posPrev; + normal = pos - viewPos; + tangent1 = isLeftSide ? (posNext - pos) : (pos - posPrev); + tangent0 = normalize(myCross(normal, prevToNext)); + normal = normalize(myCross(tangent0, prevToNext)); + tangent0 *= size * doRender; + + break; + } +#endif +#if RB_NormalAxisAligned + case RB_NormalAxisAligned: + { + const vec3 prevToNext = posNext - posPrev; + normal = -LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis0sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3)); + tangent1 = isLeftSide ? (posNext - pos) : (pos - posPrev); + tangent0 = normalize(myCross(normal, prevToNext)); + normal = normalize(myCross(tangent0, prevToNext)); + tangent0 *= size * doRender; + + break; + } +#endif +#if RB_SideAxisAligned + case RB_SideAxisAligned: + { + const vec3 prevToNext = posNext - posPrev; + tangent1 = isLeftSide ? (posNext - pos) : (pos - posPrev); + tangent0 = -normalize(LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis0sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3))); + normal = normalize(myCross(tangent0, prevToNext)); + tangent0 *= size * doRender; + + break; + } +#endif +#if RB_SideAxisAlignedTube + case RB_SideAxisAlignedTube: + { + const vec3 prevToNext = posNext - posPrev; + tangent1 = isLeftSide ? (posNext - pos) : (pos - posPrev); + tangent0 = -normalize(LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis0sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3))); + normal = normalize(myCross(tangent0, prevToNext)); + tangent0 *= size * doRender; + + // Quaternion rotation of the normal vector around the prevToNext axis with an angle of quadId / quadCount * 2.0f * PI radiant (even rotation of each segment around 360 degrees). + const float angle = 3.14159265358f * (quadId - 1) / quadCount; + const float sintheta = sin(angle); + const float r = cos(angle); + const vec3 u = normalize(prevToNext) * sintheta; + const vec3 uv = myCross(u, normal); + const vec3 uuv = myCross(u, uv); + normal = uv * (r + r) + (normal + (uuv + uuv)); + break; + } +#endif +#if RB_SideAxisAlignedMultiPlane + case RB_SideAxisAlignedMultiPlane: + { + const vec3 prevToNext = posNext - posPrev; + tangent1 = isLeftSide ? (posNext - pos) : (pos - posPrev); + tangent0 = -normalize(LOADF3(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Axis0sOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * 3))); + + // Quaternion rotation of the tangent0 vector around the prevToNext axis with an angle of quadId / quadCount * PI radiant (even rotation of each plane tangent dir around 180 degrees). + const float angle = 3.14159265358f * (quadId - 1) / quadCount * 0.5f; + const float sintheta = sin(angle); + const float r = cos(angle); + const vec3 u = normalize(prevToNext) * sintheta; + const vec3 uv = myCross(u, tangent0); + const vec3 uuv = myCross(u, uv); + tangent0 = uv * (r + r) + (tangent0 + (uuv + uuv)); + + tangent0 *= size * doRender; + + normal = normalize(myCross(tangent0, prevToNext)); + + break; + } +#endif + default: + break; + } + + // We use tangents to transform [-1 +1] coords to world space position + const vec2 cornerCoords = vInput.TexCoords / vec2(quadId, 1.0f); + + vec3 bbCorner = tangent1 * cornerCoords.x * 0.5f + tangent0 * cornerCoords.y; + +#if RB_SideAxisAlignedTube + if (billboarderType == RB_SideAxisAlignedTube) + bbCorner = tangent1 * cornerCoords.x * 0.5f + normal * size * doRender; +#endif + + const vec3 vertexWorldPosition = center + bbCorner; + + // Remap corners from [-1 +1] to [0 1] texCoords + vec2 texCoords = cornerCoords * 0.5f + 0.5f; + +#if BB_Feature_CustomTextureU + texCoords.x = LOADF(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(CustomTextureU_TextureUsOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID)); +#endif + + // Flip and rotate UVs + const bool rotateUVs = (flags & BB_Flag_VRotateTexture) != 0U; + const bool flipU = ((flags & BB_Flag_VFlipU) != 0U); + const bool flipV = ((flags & BB_Flag_VFlipV) != 0U) != rotateUVs; + + // If we have correct deformation, rotation is handled in fragment shader. +#if !defined(VOUTPUT_fragUVFactors) + if (rotateUVs) + texCoords.xy = texCoords.yx; + if (flipU) + texCoords.x = 1.0f - texCoords.x; + if (flipV) + texCoords.y = 1.0f - texCoords.y; +#endif + + // UVs output +#if defined(VOUTPUT_fragUV0) +# if BB_Feature_Atlas + const uint maxAtlasID = LOADU(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(0)) - 1U; + const float textureID = LOADF(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Atlas_TextureIDsOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID)); + const uint atlasID0 = min(uint(textureID), maxAtlasID); + const vec4 rect0 = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(atlasID0 * 4 + 1)); + vOutput.fragUV0 = texCoords * rect0.xy + rect0.zw; +# if defined (VOUTPUT_fragUV1) + const uint atlasID1 = min(atlasID0 + 1U, maxAtlasID); + const vec4 rect1 = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(atlasID1 * 4 + 1)); + vOutput.fragUV1 = texCoords * rect1.xy + rect1.zw; + vOutput.fragAtlasID = textureID; +# endif +# else + vOutput.fragUV0 = texCoords; +# endif // BB_Feature_Atlas +#endif // defined(VOUTPUT_fragUV0) + + // Correct deformation output +#if defined(VOUTPUT_fragUVScaleAndOffset) +# if defined(VOUTPUT_fragUVFactors) + const float otherSize = LOADF(GET_RAW_BUFFER(GPUSimData), sizesOffset + RAW_BUFFER_INDEX(isLeftSide ? particleIDNext : particleIDPrev)); + float ratio = size / otherSize; + + const bool isDownSide = vInput.TexCoords.y < 0.0f; + + vec4 outUVFactors = vec4(1, 1, 1, 1); + + if (!isDownSide && isLeftSide) + outUVFactors.w = ratio; + if (isDownSide && !isLeftSide) + outUVFactors.y = ratio; + + vec2 flipscale = vec2(flipU ? -1.f : 1.f, flipV ? -1.f : 1.f); + vec2 flipoffset = vec2 (flipU ? 1.f : 0.f, flipV ? 1.f : 0.f); + + vOutput.fragUVScaleAndOffset = vec4(flipscale, flipoffset); + vOutput.fragUVFactors = outUVFactors; +# endif +#endif + + // Normal output +#if defined(VOUTPUT_fragNormal) + const float normalBendingFactor = currentDr.y; + if (normalBendingFactor > 0.0f) + { + const vec3 tangent0Norm = normalize(tangent0); + const vec3 tangent1Norm = normalize(tangent1); + const float oneMinusNormalBendingFactor = (1.0f - normalBendingFactor); + + const vec3 bentNormal = (tangent0Norm * cornerCoords.y); + vOutput.fragNormal = normalize(normal * oneMinusNormalBendingFactor + bentNormal * normalBendingFactor); + } + else + vOutput.fragNormal = normalize(normal); +#endif + + // Tangent output +#if defined(VOUTPUT_fragTangent) + // With ribbon, bent normals are pushed along tangent0 axis only (ribbon side aixs) + // This means that tangent1, which is ribbon longitudinal axis, is not impacted. + // w = -1.0f will work with default ribbon, but won't adapt to + // transforming the UVs / custom U. Fix that in CPU bb, then here. + vOutput.fragTangent = vec4(normalize(tangent1), -1.0f); +#endif + + vOutput.VertexPosition = proj_position(vertexWorldPosition VS_PARAMS); +#if defined(VOUTPUT_fragWorldPosition) + vOutput.fragWorldPosition = vertexWorldPosition; +#endif + + return particleID; +} diff --git a/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Triangle.vert b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Triangle.vert new file mode 100644 index 00000000..b9dfed6e --- /dev/null +++ b/Samples/PK-SampleLib/Assets/ShaderIncludes/sources/Triangle.vert @@ -0,0 +1,137 @@ +#if (!defined(VRESOURCE_VertexPosition0) || !defined(VRESOURCE_VertexPosition1) || !defined(VRESOURCE_VertexPosition2)) && !defined(BB_GPU_SIM) +# error missing Positions SRV +# endif + +#if !defined(VRESOURCE_Indices) && !defined(BB_GPU_SIM) +# error missing Indices SRV // Mandatory for now +#endif + +vec4 proj_position(IN(vec3) position VS_ARGS) +{ +#if defined(CONST_SceneInfo_ViewProj) + return mul(GET_CONSTANT(SceneInfo, ViewProj), vec4(position, 1.0f)); +#else + return vec4(position, 1.0f); +#endif +} + +void VertexBillboard(IN(SVertexInput) vInput, INOUT(SVertexOutput) vOutput, uint particleID VS_ARGS) +{ +#if BB_GPU_SIM // Not implemented + const vec3 worldPos = vec3(0.0, 0.0, 0.0); + const vec4 worldPosDrId = vec4(0.0, 0.0, 0.0, 0.0); +#else + const vec4 worldPosDrId = LOADF4(GET_RAW_BUFFER(VertexPosition0), RAW_BUFFER_INDEX(particleID * 4)); + const vec3 pos0 = worldPosDrId.xyz; + const vec3 pos1 = LOADF3(GET_RAW_BUFFER(VertexPosition1), RAW_BUFFER_INDEX(particleID * 3)); + const vec3 pos2 = LOADF3(GET_RAW_BUFFER(VertexPosition2), RAW_BUFFER_INDEX(particleID * 3)); + + vec3 worldPos = vec3(0.0, 0.0, 0.0); + if (vInput.VertexIndex == 0) + worldPos = pos0; + else if (vInput.VertexIndex == 1) + worldPos = pos1; + else if (vInput.VertexIndex == 2) + worldPos = pos2; +#endif // BB_GPU_SIM + + vOutput.VertexPosition = proj_position(worldPos VS_PARAMS); + +#if defined(VOUTPUT_fragTangent) || defined(VOUTPUT_fragUV0) +#if defined(HAS_TriangleCustomUVs) + const vec2 uv0 = LOADF2(GET_RAW_BUFFER(TriangleCustomUVs_UV1s), RAW_BUFFER_INDEX(particleID * 2)); + const vec2 uv1 = LOADF2(GET_RAW_BUFFER(TriangleCustomUVs_UV2s), RAW_BUFFER_INDEX(particleID * 2)); + const vec2 uv2 = LOADF2(GET_RAW_BUFFER(TriangleCustomUVs_UV3s), RAW_BUFFER_INDEX(particleID * 2)); +#else + const vec2 uv0 = vec2(0.0, 0.0); + const vec2 uv1 = vec2(1.0, 0.0); + const vec2 uv2 = vec2(0.0, 1.0); +#endif // defined(HAS_TriangleCustomUVs) +#endif // defined(VOUTPUT_fragTangent) || defined(VOUTPUT_fragUV0) + +#if defined(VOUTPUT_fragUV0) +#if BB_GPU_SIM // Not implemented + const vec2 uv = vec2(0.0, 0.0); +#else +#if defined(HAS_TriangleCustomUVs) + vec2 uv = vec2(0.0, 0.0); + if (vInput.VertexIndex == 0) + uv = uv0; + else if (vInput.VertexIndex == 1) + uv = uv1; + else if (vInput.VertexIndex == 2) + uv = uv2; +#else + /* + VertexIndex 0 -> x = 0, y = 0 + VertexIndex 1 -> x = 1, y = 0 + VertexIndex 2 -> x = 0, y = 1 + */ + const vec2 uv = vec2(vInput.VertexIndex & 1, (vInput.VertexIndex & 2) >> 1); +#endif // defined(HAS_TriangleCustomUVs) + vOutput.fragUV0 = uv; +#endif // BB_GPU_SIM +#endif // defined(VOUTPUT_fragUV0) + +#if defined(VOUTPUT_fragNormal) || defined(VOUTPUT_fragTangent) +#if BB_GPU_SIM // Not implemented + const vec3 normal = vec3(0.0, 0.0, 0.0); +#else + vec3 normal = vec3(0.0, 0.0, 0.0); + + const vec3 edge0 = pos1 - pos0; + const vec3 edge1 = pos2 - pos0; + +#if defined(HAS_TriangleCustomNormals) + if (vInput.VertexIndex == 0) + normal = LOADF3(GET_RAW_BUFFER(TriangleCustomNormals_Normal1s), RAW_BUFFER_INDEX(particleID * 3)); + else if (vInput.VertexIndex == 1) + normal = LOADF3(GET_RAW_BUFFER(TriangleCustomNormals_Normal2s), RAW_BUFFER_INDEX(particleID * 3)); + else if (vInput.VertexIndex == 2) + normal = LOADF3(GET_RAW_BUFFER(TriangleCustomNormals_Normal3s), RAW_BUFFER_INDEX(particleID * 3)); +#else + normal = normalize(cross(edge0, edge1)); +#endif // defined(HAS_TriangleCustomNormals) + +#if defined(HAS_NormalBend) && !defined(HAS_TriangleCustomNormals) + const uint drId = asuint(worldPosDrId.w); + const float normalBendingFactor = GET_CONSTANT(TriangleInfo, DrawRequest)[drId / 4][drId % 4]; + if (normalBendingFactor != 0.0f) + { + const vec3 barycenter = (pos0 + pos1 + pos2) / 3.0; + const vec3 maxBentNormal = normalize(worldPos - barycenter); + normal = normalize(mix(normal, maxBentNormal, normalBendingFactor)); + } +#endif // defined(HAS_NormalBend) && !defined(HAS_TriangleCustomNormals) +#endif // BB_GPU_SIM + +#if defined(VOUTPUT_fragNormal) + vOutput.fragNormal = normal; +#endif // defined(VOUTPUT_fragNormal) + +#if defined(VOUTPUT_fragTangent) + vec2 edge0UV = uv1 - uv0; + vec2 edge1UV = uv2 - uv0; + float det = edge0UV.x * edge1UV.y - edge0UV.y * edge1UV.x; + if (abs(det) <= 1e-6) + { + edge0UV = vec2(1.0, 0.0); + edge1UV = vec2(0.0, 1.0); + det = edge0UV.x * edge1UV.y - edge0UV.y * edge1UV.x; + } + const float r = 1.0 / det; + const vec3 tangent = (edge0 * edge1UV.y - edge1 * edge0UV.y) * r; + const vec3 bitangent = (edge1 * edge0UV.x - edge0 * edge1UV.x) * r; + const float crossSign = GET_CONSTANT(SceneInfo, Handedness); + const vec3 outBitangent = cross(normal, tangent) * crossSign; + const float tangentW = (dot(bitangent, outBitangent) > 0) ? 1.0 : -1.0; + + // compute vertex tangent based on triangle uvs & positions + vOutput.fragTangent = vec4(normalize(cross(outBitangent, normal)) * crossSign, tangentW); +#endif // defined(VOUTPUT_fragTangent) +#endif // defined(VOUTPUT_fragNormal) || defined(VOUTPUT_fragTangent) + +#if defined(VOUTPUT_fragWorldPosition) + vOutput.fragWorldPosition = worldPos; +#endif +} \ No newline at end of file diff --git a/Samples/PK-SampleLib/Assets/Shaders/Gizmo.frag b/Samples/PK-SampleLib/Assets/Shaders/Gizmo.frag new file mode 100644 index 00000000..2ce182a3 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Shaders/Gizmo.frag @@ -0,0 +1,5 @@ + +void FragmentMain(IN(SFragmentInput) fInput, OUT(SFragmentOutput) fOutput FS_ARGS) +{ + fOutput.outColor = vec4(fInput.fragColor, 1); +} diff --git a/Samples/PK-SampleLib/Assets/Shaders/Gizmo.vert b/Samples/PK-SampleLib/Assets/Shaders/Gizmo.vert new file mode 100644 index 00000000..64a497ad --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Shaders/Gizmo.vert @@ -0,0 +1,14 @@ + +void VertexMain(IN(SVertexInput) vInput, OUT(SVertexOutput) vOutput VS_ARGS) +{ + vec4 grabbedColor = GET_CONSTANT(GizmoConstant, GrabbedColor); + vec4 hoveredColor = GET_CONSTANT(GizmoConstant, HoveredColor); + + vOutput.VertexPosition = mul(GET_CONSTANT(GizmoConstant, ModelViewProj), vec4(vInput.Position, 1.)); + if (hoveredColor.a == 1.) + vOutput.fragColor = hoveredColor.rgb; + else if (grabbedColor.a == 1.) + vOutput.fragColor = grabbedColor.rgb; + else + vOutput.fragColor = vInput.Color; +} diff --git a/Samples/PK-SampleLib/Assets/Shaders/ImGui.frag b/Samples/PK-SampleLib/Assets/Shaders/ImGui.frag new file mode 100644 index 00000000..709ed56f --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Shaders/ImGui.frag @@ -0,0 +1,5 @@ + +void FragmentMain(IN(SFragmentInput) fInput, OUT(SFragmentOutput) fOutput FS_ARGS) +{ + fOutput.outColor = fInput.fragColor * SAMPLE(Texture, fInput.fragTexCoord).r; +} diff --git a/Samples/PK-SampleLib/Assets/Shaders/ImGui.vert b/Samples/PK-SampleLib/Assets/Shaders/ImGui.vert new file mode 100644 index 00000000..48f70e4f --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Shaders/ImGui.vert @@ -0,0 +1,7 @@ + +void VertexMain(IN(SVertexInput) vInput, OUT(SVertexOutput) vOutput VS_ARGS) +{ + vOutput.fragColor = vInput.Color; + vOutput.fragTexCoord = vInput.TexCoord; + vOutput.VertexPosition = vec4(vInput.Position * GET_CONSTANT(ImGui, Scale) + GET_CONSTANT(ImGui, Translate), 0, 1); +} diff --git a/Samples/PK-SampleLib/Assets/Shaders/Profiler.frag b/Samples/PK-SampleLib/Assets/Shaders/Profiler.frag new file mode 100644 index 00000000..40a056b0 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Shaders/Profiler.frag @@ -0,0 +1,5 @@ + +void FragmentMain(IN(SFragmentInput) fInput, OUT(SFragmentOutput) fOutput FS_ARGS) +{ + fOutput.outColor = fInput.fragColor; +} diff --git a/Samples/PK-SampleLib/Assets/Shaders/Profiler.vert b/Samples/PK-SampleLib/Assets/Shaders/Profiler.vert new file mode 100644 index 00000000..62c7491e --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Shaders/Profiler.vert @@ -0,0 +1,6 @@ + +void VertexMain(IN(SVertexInput) vInput, OUT(SVertexOutput) vOutput VS_ARGS) +{ + vOutput.fragColor = vInput.Color; + vOutput.VertexPosition = mul(GET_CONSTANT(ProfilerConstant, Transform), vec4(vInput.Position.xy, 0.0, 1.0)); +} diff --git a/Samples/PK-SampleLib/Assets/Shaders/ProfilerDrawNode.frag b/Samples/PK-SampleLib/Assets/Shaders/ProfilerDrawNode.frag new file mode 100644 index 00000000..c22c0643 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Shaders/ProfilerDrawNode.frag @@ -0,0 +1,39 @@ +//#define PROFILER_OLD_STYLE + +void FragmentMain(IN(SFragmentInput) fInput, OUT(SFragmentOutput) fOutput FS_ARGS) +{ +#if defined(HAS_DASHED_LINES) +# if defined(PROFILER_OLD_STYLE) + if (fInput.fragNodePixelCoord.x < 0.0f || fInput.fragNodePixelCoord.x > fInput.fragNodePixelCoord.z) + { + float lineWidth = 1.0f; + float invCoordX = fInput.fragNodeExtendedPixelCoord.z - fInput.fragNodeExtendedPixelCoord.x; + bool isLine = abs(invCoordX - fInput.fragNodeExtendedPixelCoord.y) < lineWidth; + fOutput.outColor = isLine ? vec4(fInput.fragColor0.xyz, 1.0f / 3.0f) : vec4(0.0f, 0.0f, 0.0f, 0.0f); + } + else +# endif + { + // Draw dashed lines: + // Dash: + float dashSize = ceil(fInput.fragNodePixelCoord.w * 0.2f); + int dashFrequency = 3; + float coord = fInput.fragNodePixelCoord.x + fInput.fragNodePixelCoord.y; + + // Do a fake AA by supersampling before and after: + vec4 colDashCur = (int((coord + 0.0f) / dashSize) % dashFrequency == 0) ? fInput.fragColor0 : fInput.fragColor1; + vec4 colDashPos = (int((coord + 0.5f) / dashSize) % dashFrequency == 0) ? fInput.fragColor0 : fInput.fragColor1; + vec4 colDashNeg = (int((coord - 0.5f) / dashSize) % dashFrequency == 0) ? fInput.fragColor0 : fInput.fragColor1; + fOutput.outColor = (colDashCur + colDashPos + colDashNeg) * (1.0f / 3.0f); +# if defined(PROFILER_OLD_STYLE) + // Border: + vec2 borderSize = vec2(0.0f, 2.0f); + if (ANY_BOOL(VEC_LESS_THAN(fInput.fragNodePixelCoord.xy, borderSize)) || + ANY_BOOL(VEC_LESS_THAN((fInput.fragNodePixelCoord.zw - fInput.fragNodePixelCoord.xy), borderSize))) + fOutput.outColor = fInput.fragColor2; +# endif + } +#else + fOutput.outColor = fInput.fragColor0; +#endif +} diff --git a/Samples/PK-SampleLib/Assets/Shaders/ProfilerDrawNode.vert b/Samples/PK-SampleLib/Assets/Shaders/ProfilerDrawNode.vert new file mode 100644 index 00000000..2b0ac2e5 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Shaders/ProfilerDrawNode.vert @@ -0,0 +1,56 @@ +//#define PROFILER_OLD_STYLE + +void VertexMain(IN(SVertexInput) vInput, OUT(SVertexOutput) vOutput VS_ARGS) +{ + vec2 curVtxUV; + + switch (vInput.VertexIndex) + { + default: + case 0: + curVtxUV = vec2(0, 0); + break; + case 1: + curVtxUV = vec2(1, 0); + break; + case 2: + curVtxUV = vec2(1, 1); + break; + case 3: + curVtxUV = vec2(0, 1); + break; + } + + vec2 minPos = vInput.Position.xy; + vec2 maxPos = vInput.Position.zw; + + // color +#if defined(HAS_DASHED_LINES) && defined(PROFILER_OLD_STYLE) + float currentNodeWidth = maxPos.x - minPos.x; + float extendNodeSize = 5.0f - currentNodeWidth; + if (extendNodeSize > 0.0f) + { + maxPos.x += extendNodeSize; + minPos.x -= extendNodeSize; + } +#endif + + // build vertex position: + vec2 vtxPosition = (vec2(1.0f, 1.0f) - curVtxUV) * minPos + curVtxUV * maxPos; + vOutput.VertexPosition = mul(GET_CONSTANT(ProfilerConstant, Transform), vec4(vtxPosition, 0.0f, 1.0f)); + +#if defined(HAS_DASHED_LINES) + vOutput.fragColor0 = vInput.Color0; + vOutput.fragColor1 = vInput.Color1; + vOutput.fragColor2 = vInput.Color2; + + vOutput.fragNodePixelCoord.xy = vtxPosition - vInput.Position.xy; + vOutput.fragNodePixelCoord.zw = vInput.Position.zw - vInput.Position.xy; + + vOutput.fragNodeExtendedPixelCoord.xy = vtxPosition - minPos; + vOutput.fragNodeExtendedPixelCoord.zw = maxPos - minPos; +#else + vOutput.fragColor0 = curVtxUV.y == 0.0f ? vInput.Color0 : vInput.Color1; +#endif + +} diff --git a/Samples/PK-SampleLib/Assets/Textures/DitheringPatterns.png b/Samples/PK-SampleLib/Assets/Textures/DitheringPatterns.png new file mode 100644 index 00000000..38bc3d9e --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Textures/DitheringPatterns.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1f780b828e1d8e9885262f5864f5834c841dab99aac236007e65048dd930ee7 +size 169 diff --git a/Samples/PK-SampleLib/Assets/Textures/default.dds b/Samples/PK-SampleLib/Assets/Textures/default.dds new file mode 100644 index 00000000..e68293b9 --- /dev/null +++ b/Samples/PK-SampleLib/Assets/Textures/default.dds @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eeddc8a31f1c0c91724241ef291f667942316ef589b3a9aa7638ccd33d473303 +size 22000 diff --git a/Samples/PK-SampleLib/BRDFLUT.cpp b/Samples/PK-SampleLib/BRDFLUT.cpp new file mode 100644 index 00000000..d1be7a49 --- /dev/null +++ b/Samples/PK-SampleLib/BRDFLUT.cpp @@ -0,0 +1,210 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "BRDFLUT.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +PK_ALIGN(0x10) const PopcornFX::f16 BRDFLUTArray[] = +{ + 0.5928792953, 0.0197160058, 0.5857781172, 0.0186424851, 0.5784918070, 0.0175879523, 0.5710341334, 0.0165821873, 0.5634498000, 0.0156332999, 0.5558079481, 0.0147334747, 0.5481278300, 0.0138749490, 0.5405995250, 0.0130726667, 0.5337178111, 0.0123035237, 0.5275365710, 0.0115812030, 0.5212166309, 0.0108914664, 0.5148030519, 0.0102377571, 0.5084724426, 0.0096249217, 0.5023453832, 0.0090476535, 0.4965533018, 0.0085039893, 0.4908497036, 0.0079848059, 0.4851862788, 0.0074922619, 0.4796939194, 0.0070290812, 0.4745422304, 0.0065860045, 0.4693622589, 0.0061620031, 0.4641675651, 0.0057544452, 0.4589919150, 0.0053738072, + 0.4540398121, 0.0050179097, 0.4490005970, 0.0046884972, 0.4442968369, 0.0043827523, 0.4398451149, 0.0040968107, 0.4355189800, 0.0038264915, 0.4313957095, 0.0035674111, 0.4272800684, 0.0033150068, 0.4229676425, 0.0030695463, 0.4184719622, 0.0028379445, 0.4140142798, 0.0026260319, 0.4098556042, 0.0024322607, 0.4059606791, 0.0022483275, 0.4021876156, 0.0020762973, 0.3984971941, 0.0019159976, 0.3948787749, 0.0017679565, 0.3913232386, 0.0016277467, 0.3877742290, 0.0014948611, 0.3842629492, 0.0013712380, 0.3808415830, 0.0012515578, 0.3773273528, 0.0011423699, 0.3738927245, 0.0010451928, 0.3707726002, 0.0009525953, + 0.3677315414, 0.0008643608, 0.3646012247, 0.0007804013, 0.3614533246, 0.0007024501, 0.3582736552, 0.0006311476, 0.3552420735, 0.0005654168, 0.3522365987, 0.0005047423, 0.3493055403, 0.0004508914, 0.3466095626, 0.0004003556, 0.3439306319, 0.0003510175, 0.3411004245, 0.0003073665, 0.3383085132, 0.0002662078, 0.3355643153, 0.0002310198, 0.3330217898, 0.0001985141, 0.3305359185, 0.0001683505, 0.3279927373, 0.0001401394, 0.3253412247, 0.0001151556, 0.3228756785, 0.0000936760, 0.3205035925, 0.0000741684, 0.3181360066, 0.0000565645, 0.3158090115, 0.0000411256, 0.6014475226, 0.0208085589, 0.5942923427, 0.0196898058, + 0.5869737267, 0.0185893010, 0.5795043707, 0.0175374430, 0.5719256401, 0.0165443253, 0.5642768145, 0.0155987190, 0.5566198230, 0.0146994730, 0.5490393043, 0.0138543397, 0.5419200659, 0.0130526163, 0.5358410478, 0.0122871529, 0.5296750665, 0.0115635619, 0.5233610868, 0.0108737182, 0.5171182752, 0.0102249291, 0.5109600425, 0.0096175540, 0.5051636696, 0.0090389531, 0.4996532500, 0.0084926151, 0.4940812588, 0.0079735769, 0.4887030423, 0.0074788537, 0.4834633470, 0.0070086014, 0.4785485268, 0.0065577123, 0.4735291302, 0.0061325347, 0.4685393274, 0.0057336665, 0.4636216164, 0.0053578629, 0.4588604867, 0.0050102035, + 0.4540166557, 0.0046822564, 0.4496358335, 0.0043767449, 0.4453676045, 0.0040839044, 0.4413131475, 0.0038021272, 0.4373855293, 0.0035281549, 0.4334383309, 0.0032692861, 0.4293289781, 0.0030292377, 0.4250656962, 0.0028095811, 0.4208480120, 0.0026016883, 0.4169168472, 0.0024056463, 0.4132609367, 0.0022255925, 0.4097253680, 0.0020575861, 0.4062625468, 0.0018971234, 0.4028309882, 0.0017443576, 0.3994657397, 0.0016011168, 0.3961008787, 0.0014635378, 0.3927783966, 0.0013394071, 0.3896271288, 0.0012258060, 0.3863417208, 0.0011181273, 0.3830064237, 0.0010156132, 0.3800049424, 0.0009185754, 0.3771324754, 0.0008289643, + 0.3742413521, 0.0007483030, 0.3713362813, 0.0006720709, 0.3683776557, 0.0006017808, 0.3655362427, 0.0005388645, 0.3627285361, 0.0004801930, 0.3599117398, 0.0004233624, 0.3573568761, 0.0003722302, 0.3548936844, 0.0003250731, 0.3523243964, 0.0002836616, 0.3498111367, 0.0002456736, 0.3471645415, 0.0002096689, 0.3447063565, 0.0001764788, 0.3422856927, 0.0001469555, 0.3401328921, 0.0001222431, 0.3377437294, 0.0000991284, 0.3353759944, 0.0000775837, 0.3331399858, 0.0000589831, 0.3308923542, 0.0000427634, 0.6098433137, 0.0219714195, 0.6026170850, 0.0208044164, 0.5952546597, 0.0196551308, 0.5877653956, 0.0185544416, + 0.5801842213, 0.0175132994, 0.5725200176, 0.0165192261, 0.5649089813, 0.0155792311, 0.5572822094, 0.0146900769, 0.5500488877, 0.0138506684, 0.5438963771, 0.0130435228, 0.5378739238, 0.0122814402, 0.5317246914, 0.0115569374, 0.5255489349, 0.0108719571, 0.5194805861, 0.0102272406, 0.5136919618, 0.0096139554, 0.5082226396, 0.0090338783, 0.5028399825, 0.0084861657, 0.4975062609, 0.0079594189, 0.4923238456, 0.0074553965, 0.4874714017, 0.0069817505, 0.4827114046, 0.0065406850, 0.4779226482, 0.0061202552, 0.4731382728, 0.0057257665, 0.4685056806, 0.0053529297, 0.4639297128, 0.0050047650, 0.4593693912, 0.0046720905, + 0.4552188516, 0.0043537156, 0.4511176050, 0.0040446385, 0.4473220110, 0.0037528505, 0.4436406791, 0.0034831562, 0.4399527311, 0.0032381269, 0.4360884130, 0.0030034129, 0.4320608675, 0.0027837527, 0.4281131625, 0.0025808155, 0.4244609475, 0.0023899321, 0.4210368693, 0.0022051416, 0.4176717699, 0.0020288548, 0.4144271314, 0.0018650432, 0.4111856520, 0.0017075163, 0.4080383182, 0.0015658516, 0.4049442708, 0.0014345679, 0.4018395543, 0.0013095770, 0.3988796771, 0.0011917480, 0.3957861662, 0.0010807479, 0.3926317990, 0.0009785574, 0.3898462951, 0.0008847725, 0.3871761560, 0.0007954001, 0.3844894469, 0.0007148195, + 0.3818468153, 0.0006424109, 0.3791685998, 0.0005744467, 0.3764535785, 0.0005075874, 0.3737720549, 0.0004480393, 0.3711742759, 0.0003940520, 0.3688367903, 0.0003455121, 0.3666160107, 0.0003007461, 0.3642066717, 0.0002584338, 0.3618311286, 0.0002199388, 0.3593447804, 0.0001852176, 0.3572267294, 0.0001559912, 0.3550502658, 0.0001282396, 0.3529471159, 0.0001027207, 0.3507107794, 0.0000807459, 0.3485639393, 0.0000613372, 0.3465326130, 0.0000441772, 0.6180451512, 0.0232096836, 0.6107332110, 0.0219911523, 0.6033141613, 0.0207902119, 0.5957947373, 0.0196376983, 0.5882027149, 0.0185444616, 0.5805313587, 0.0175001975, + 0.5729563236, 0.0165164042, 0.5653614402, 0.0155806327, 0.5580887198, 0.0146988975, 0.5516617894, 0.0138496850, 0.5457806587, 0.0130466493, 0.5398058295, 0.0122859394, 0.5337483883, 0.0115662264, 0.5277915001, 0.0108777359, 0.5219641328, 0.0102279065, 0.5165061355, 0.0096134683, 0.5113361478, 0.0090298289, 0.5060998201, 0.0084703844, 0.5010536909, 0.0079367701, 0.4961336851, 0.0074413503, 0.4916513264, 0.0069728107, 0.4870608747, 0.0065293568, 0.4825303257, 0.0061152801, 0.4779745936, 0.0057206377, 0.4736397564, 0.0053443867, 0.4692371786, 0.0049822773, 0.4649467468, 0.0046321703, 0.4610179663, 0.0043032579, + 0.4571691751, 0.0039977566, 0.4536758065, 0.0037187652, 0.4502845407, 0.0034566894, 0.4468474388, 0.0032107891, 0.4432704449, 0.0029831857, 0.4395169020, 0.0027647929, 0.4357993603, 0.0025538886, 0.4323571622, 0.0023531583, 0.4291913211, 0.0021675404, 0.4260437191, 0.0019883686, 0.4230205715, 0.0018262044, 0.4200585783, 0.0016740659, 0.4171256125, 0.0015288396, 0.4142171443, 0.0013940244, 0.4113452435, 0.0012677348, 0.4086238146, 0.0011497989, 0.4057776332, 0.0010417233, 0.4028320313, 0.0009386057, 0.4002251029, 0.0008463886, 0.3978651762, 0.0007637604, 0.3954588473, 0.0006839596, 0.3929835558, 0.0006071680, + 0.3904982507, 0.0005382582, 0.3881096244, 0.0004757180, 0.3856660426, 0.0004188296, 0.3832698166, 0.0003665170, 0.3810754716, 0.0003167994, 0.3789916933, 0.0002716367, 0.3767994642, 0.0002311842, 0.3747234643, 0.0001962849, 0.3724816740, 0.0001634990, 0.3704312146, 0.0001332870, 0.3684123755, 0.0001071286, 0.3664931357, 0.0000839576, 0.3645898700, 0.0000636353, 0.3626712561, 0.0000456094, 0.6260332465, 0.0245289132, 0.6186174154, 0.0232552774, 0.6111286283, 0.0219993480, 0.6035680175, 0.0207913220, 0.5959574580, 0.0196419079, 0.5882971287, 0.0185462534, 0.5807289481, 0.0175164454, 0.5731663704, 0.0165326279, + 0.5658372045, 0.0156001570, 0.5591238737, 0.0147105604, 0.5533688664, 0.0138616385, 0.5475836992, 0.0130647570, 0.5416894555, 0.0123037305, 0.5358209610, 0.0115750274, 0.5300696492, 0.0108850151, 0.5246579051, 0.0102328705, 0.5195556283, 0.0096094618, 0.5145391822, 0.0090159886, 0.5096003413, 0.0084612574, 0.5048223138, 0.0079353442, 0.5002779961, 0.0074353996, 0.4960283339, 0.0069700354, 0.4916805029, 0.0065258471, 0.4873752594, 0.0061040022, 0.4830923080, 0.0056980066, 0.4789781272, 0.0053041689, 0.4747686088, 0.0049300594, 0.4707965851, 0.0045825359, 0.4671566486, 0.0042666993, 0.4636271000, 0.0039706635, + 0.4604138136, 0.0036928598, 0.4573387206, 0.0034366539, 0.4541791975, 0.0031890299, 0.4508461654, 0.0029494667, 0.4473423958, 0.0027229514, 0.4438887835, 0.0025109649, 0.4406730533, 0.0023073282, 0.4377565682, 0.0021212106, 0.4348886609, 0.0019462644, 0.4320588708, 0.0017802521, 0.4293490052, 0.0016277869, 0.4266791940, 0.0014828609, 0.4240244925, 0.0013466785, 0.4213738441, 0.0012218922, 0.4188980162, 0.0011043326, 0.4163476229, 0.0009996038, 0.4136945307, 0.0009028606, 0.4112945199, 0.0008103348, 0.4090894759, 0.0007220636, 0.4069103599, 0.0006427831, 0.4047837257, 0.0005716523, 0.4026315212, 0.0005054633, + 0.4005083442, 0.0004437471, 0.3982341290, 0.0003855213, 0.3959522545, 0.0003330581, 0.3939907551, 0.0002858063, 0.3922520578, 0.0002449497, 0.3903518617, 0.0002063387, 0.3884589076, 0.0001710128, 0.3863961697, 0.0001395895, 0.3845612407, 0.0001118541, 0.3828678429, 0.0000876472, 0.3811038435, 0.0000657775, 0.3794387281, 0.0000470578, 0.6337887049, 0.0259350277, 0.6262497306, 0.0246024095, 0.6186744571, 0.0232877191, 0.6110615730, 0.0220199730, 0.6034229994, 0.0208103303, 0.5957684517, 0.0196615458, 0.5882008672, 0.0185810197, 0.5806686282, 0.0175462496, 0.5732767582, 0.0165627990, 0.5662995577, 0.0156265888, + 0.5606338978, 0.0147331478, 0.5550162196, 0.0138912844, 0.5493229032, 0.0130871031, 0.5435970426, 0.0123198759, 0.5379880667, 0.0115870610, 0.5325348377, 0.0108919088, 0.5274393559, 0.0102310684, 0.5226997137, 0.0096071893, 0.5179123878, 0.0090236785, 0.5132787824, 0.0084629888, 0.5087850690, 0.0079398006, 0.5046707392, 0.0074376203, 0.5006353259, 0.0069642365, 0.4965491593, 0.0065079802, 0.4924613535, 0.0060657565, 0.4884644747, 0.0056471704, 0.4845891893, 0.0052541159, 0.4806758761, 0.0048958906, 0.4770665765, 0.0045585823, 0.4736994803, 0.0042432551, 0.4705010056, 0.0039514708, 0.4675855935, 0.0036685644, + 0.4647426605, 0.0033971991, 0.4618395269, 0.0031400118, 0.4587885737, 0.0028988125, 0.4555633366, 0.0026687863, 0.4523970187, 0.0024555882, 0.4494268596, 0.0022549948, 0.4467624724, 0.0020682025, 0.4441895783, 0.0018958455, 0.4416279495, 0.0017297697, 0.4391418695, 0.0015738496, 0.4367247522, 0.0014300729, 0.4343794882, 0.0012971991, 0.4320481718, 0.0011765420, 0.4299066067, 0.0010654969, 0.4276395440, 0.0009586431, 0.4251636267, 0.0008569030, 0.4229743481, 0.0007662423, 0.4210757613, 0.0006828399, 0.4191450477, 0.0006054717, 0.4172642231, 0.0005335429, 0.4153474867, 0.0004662834, 0.4134882390, 0.0004056908, + 0.4115439951, 0.0003508840, 0.4095762670, 0.0003027435, 0.4078431726, 0.0002573192, 0.4062568545, 0.0002157840, 0.4045867026, 0.0001786590, 0.4030548930, 0.0001465127, 0.4014486969, 0.0001177638, 0.3997290730, 0.0000909474, 0.3982101381, 0.0000682843, 0.3966949284, 0.0000484710, 0.6412889361, 0.0274344925, 0.6336047649, 0.0260386262, 0.6259283423, 0.0246616863, 0.6182509065, 0.0233289879, 0.6105739474, 0.0220557041, 0.6029266119, 0.0208532419, 0.5953447819, 0.0197149999, 0.5878691673, 0.0186283328, 0.5804657936, 0.0175881460, 0.5735227466, 0.0166001711, 0.5675318241, 0.0156618804, 0.5620800853, 0.0147713227, + 0.5566058755, 0.0139219211, 0.5510495305, 0.0131103080, 0.5455708504, 0.0123366797, 0.5402089953, 0.0115945898, 0.5352008939, 0.0108951870, 0.5305294394, 0.0102439411, 0.5260002613, 0.0096202074, 0.5215045810, 0.0090321023, 0.5171948671, 0.0084729567, 0.5130386353, 0.0079423832, 0.5092911124, 0.0074300137, 0.5054778457, 0.0069356360, 0.5016621947, 0.0064653372, 0.4978403449, 0.0060205865, 0.4942005873, 0.0056151585, 0.4906338453, 0.0052342326, 0.4870312810, 0.0048756190, 0.4837821424, 0.0045404835, 0.4806638062, 0.0042180666, 0.4777222872, 0.0039095855, 0.4750945270, 0.0036171209, 0.4725372195, 0.0033411721, + 0.4699116349, 0.0030801517, 0.4671558142, 0.0028364637, 0.4642688930, 0.0026124204, 0.4614246786, 0.0024017966, 0.4587467909, 0.0022039716, 0.4563271701, 0.0020140808, 0.4540189207, 0.0018368145, 0.4517582059, 0.0016727301, 0.4495831728, 0.0015237684, 0.4475207329, 0.0013860143, 0.4455044866, 0.0012566731, 0.4435032606, 0.0011334263, 0.4415462613, 0.0010155954, 0.4396156073, 0.0009114625, 0.4374648631, 0.0008129358, 0.4354658425, 0.0007230331, 0.4337901175, 0.0006395846, 0.4320282340, 0.0005610056, 0.4304122329, 0.0004910720, 0.4288488626, 0.0004278765, 0.4274032414, 0.0003717582, 0.4257895350, 0.0003182572, + 0.4239913225, 0.0002689811, 0.4224108160, 0.0002249403, 0.4211238027, 0.0001874622, 0.4198695719, 0.0001529493, 0.4184142351, 0.0001212781, 0.4170735478, 0.0000940824, 0.4157230556, 0.0000703223, 0.4145072699, 0.0000497564, 0.6485129595, 0.0290342402, 0.6406610608, 0.0275704339, 0.6328650713, 0.0261272676, 0.6251092553, 0.0247257110, 0.6173861027, 0.0233837422, 0.6097412705, 0.0221240893, 0.6021345854, 0.0209216401, 0.5947344303, 0.0197815672, 0.5873834491, 0.0186836421, 0.5803866386, 0.0176414102, 0.5740402341, 0.0166525990, 0.5687622428, 0.0157092642, 0.5634953380, 0.0148091316, 0.5581729412, 0.0139481202, + 0.5528554916, 0.0131312944, 0.5476791859, 0.0123495311, 0.5426492095, 0.0116114430, 0.5380210280, 0.0109175444, 0.5337682366, 0.0102557773, 0.5294963121, 0.0096325669, 0.5253665447, 0.0090382062, 0.5213573575, 0.0084697120, 0.5175892115, 0.0079211136, 0.5141428113, 0.0073959827, 0.5106111169, 0.0068986733, 0.5071470737, 0.0064384360, 0.5036550760, 0.0060048690, 0.5003591776, 0.0055963993, 0.4971190691, 0.0052167689, 0.4938315749, 0.0048511424, 0.4908647537, 0.0044974638, 0.4879975319, 0.0041628629, 0.4853341281, 0.0038493844, 0.4830094874, 0.0035553141, 0.4807854891, 0.0032814518, 0.4785477817, 0.0030283078, + 0.4761603475, 0.0027882981, 0.4736267626, 0.0025616940, 0.4710780084, 0.0023444369, 0.4686523378, 0.0021427562, 0.4665120244, 0.0019560715, 0.4645563364, 0.0017879017, 0.4626807570, 0.0016292469, 0.4608429074, 0.0014805029, 0.4590057731, 0.0013361996, 0.4572821856, 0.0012021828, 0.4556154013, 0.0010821056, 0.4539965689, 0.0009675458, 0.4524021745, 0.0008637737, 0.4505824745, 0.0007657698, 0.4487651885, 0.0006741956, 0.4473106265, 0.0005925716, 0.4458655715, 0.0005190845, 0.4445378184, 0.0004531133, 0.4432235658, 0.0003894905, 0.4419570565, 0.0003318838, 0.4406753778, 0.0002811603, 0.4393383265, 0.0002371065, + 0.4380684495, 0.0001955419, 0.4368220270, 0.0001577556, 0.4358155429, 0.0001255111, 0.4347457886, 0.0000976689, 0.4337539375, 0.0000726357, 0.4327136576, 0.0000509118, 0.6554371119, 0.0307418164, 0.6473928690, 0.0292049367, 0.6394596100, 0.0276912823, 0.6316106915, 0.0262165144, 0.6238422990, 0.0248052459, 0.6161818504, 0.0234783161, 0.6085779071, 0.0222100578, 0.6012173295, 0.0210095793, 0.5939213634, 0.0198523570, 0.5868591070, 0.0187518857, 0.5802626014, 0.0177082494, 0.5750253797, 0.0167055130, 0.5699610114, 0.0157520883, 0.5648997426, 0.0148454653, 0.5597779155, 0.0139767397, 0.5547776222, 0.0131563889, + 0.5499228239, 0.0123801604, 0.5453417301, 0.0116319545, 0.5411269069, 0.0109342262, 0.5372024179, 0.0102666756, 0.5332230926, 0.0096342796, 0.5294496417, 0.0090233535, 0.5257577896, 0.0084397467, 0.5224415660, 0.0078870282, 0.5193192959, 0.0073685055, 0.5161446929, 0.0068847057, 0.5130563974, 0.0064260247, 0.5099284649, 0.0059948349, 0.5069754124, 0.0055782492, 0.5040255189, 0.0051765316, 0.5010342002, 0.0047975429, 0.4983965158, 0.0044407640, 0.4958437085, 0.0041062045, 0.4934816658, 0.0037924210, 0.4915072620, 0.0035027382, 0.4896015525, 0.0032297296, 0.4877087474, 0.0029711511, 0.4856579006, 0.0027235299, + 0.4834789634, 0.0024957943, 0.4813472927, 0.0022859371, 0.4793166220, 0.0020928085, 0.4775233269, 0.0019094625, 0.4758422673, 0.0017371870, 0.4741799533, 0.0015689012, 0.4725811779, 0.0014157722, 0.4711136520, 0.0012766127, 0.4697138369, 0.0011454357, 0.4683538377, 0.0010245771, 0.4670029581, 0.0009100951, 0.4657440782, 0.0008058462, 0.4642979801, 0.0007116642, 0.4628223181, 0.0006272572, 0.4617455602, 0.0005490768, 0.4605894983, 0.0004745614, 0.4594040513, 0.0004081035, 0.4584613740, 0.0003496934, 0.4577019513, 0.0002972848, 0.4567567706, 0.0002479064, 0.4555923343, 0.0002032856, 0.4546421468, 0.0001647335, + 0.4538329542, 0.0001313711, 0.4530894160, 0.0001007995, 0.4522245824, 0.0000745542, 0.4515615106, 0.0000522835, 0.6620380282, 0.0325652882, 0.6537756920, 0.0309497099, 0.6456835866, 0.0293605868, 0.6377309561, 0.0278101936, 0.6299053431, 0.0263252594, 0.6222216487, 0.0249219295, 0.6146399975, 0.0235844254, 0.6072921157, 0.0223175343, 0.6000623107, 0.0210991595, 0.5930049419, 0.0199406501, 0.5864906311, 0.0188333225, 0.5808597803, 0.0177697726, 0.5759971142, 0.0167570077, 0.5711886287, 0.0158008318, 0.5663517118, 0.0148810511, 0.5615270138, 0.0140148448, 0.5568857193, 0.0131911151, 0.5523555279, 0.0124037908, + 0.5482621789, 0.0116543286, 0.5445064306, 0.0109486813, 0.5408756137, 0.0102668060, 0.5372030735, 0.0096125109, 0.5338031054, 0.0089933034, 0.5304748416, 0.0084107062, 0.5276550651, 0.0078697773, 0.5249072313, 0.0073566544, 0.5221092701, 0.0068736533, 0.5193948150, 0.0064074788, 0.5165912509, 0.0059544472, 0.5140057802, 0.0055253641, 0.5113820434, 0.0051208418, 0.5087302327, 0.0047402177, 0.5064670444, 0.0043861824, 0.5043136477, 0.0040574418, 0.5022759438, 0.0037453359, 0.5006213784, 0.0034481399, 0.4990346730, 0.0031668870, 0.4975233972, 0.0029088291, 0.4959183037, 0.0026711498, 0.4941753447, 0.0024464347, + 0.4924193323, 0.0022359474, 0.4906555712, 0.0020348032, 0.4891267717, 0.0018415243, 0.4877250791, 0.0016656824, 0.4863994718, 0.0015034789, 0.4851318896, 0.0013525476, 0.4839079380, 0.0012114955, 0.4828162193, 0.0010806189, 0.4817366004, 0.0009595823, 0.4807904065, 0.0008534279, 0.4800337851, 0.0007549134, 0.4790651500, 0.0006645407, 0.4778138399, 0.0005772124, 0.4770039618, 0.0005003471, 0.4763255715, 0.0004318334, 0.4755700231, 0.0003690553, 0.4747172594, 0.0003096919, 0.4741417170, 0.0002574007, 0.4735941291, 0.0002122790, 0.4729689658, 0.0001726632, 0.4723579288, 0.0001362432, 0.4717232287, 0.0001043304, + 0.4712703526, 0.0000771234, 0.4707048833, 0.0000532159, 0.6682917476, 0.0345133878, 0.6597825289, 0.0328128859, 0.6515117288, 0.0311427470, 0.6434386969, 0.0295108929, 0.6355468631, 0.0279471837, 0.6278313398, 0.0264634807, 0.6202743649, 0.0250507873, 0.6129282117, 0.0237100795, 0.6058166623, 0.0224312432, 0.5988485813, 0.0212089326, 0.5922818184, 0.0200320464, 0.5862117410, 0.0189043451, 0.5815781355, 0.0178332310, 0.5769995451, 0.0168117359, 0.5724800229, 0.0158502832, 0.5679266453, 0.0149318967, 0.5634767413, 0.0140541522, 0.5592136383, 0.0132274078, 0.5551723242, 0.0124314055, 0.5514175296, 0.0116650248, + 0.5481128693, 0.0109367007, 0.5448174477, 0.0102473563, 0.5415745378, 0.0095904600, 0.5385458469, 0.0089808814, 0.5356556177, 0.0084054442, 0.5333070159, 0.0078663761, 0.5309461951, 0.0073443963, 0.5284867883, 0.0068355622, 0.5261344910, 0.0063540763, 0.5237193108, 0.0059005897, 0.5215536356, 0.0054711569, 0.5193307996, 0.0050686751, 0.5170787573, 0.0046931123, 0.5151740909, 0.0043371907, 0.5133625269, 0.0040001497, 0.5116437674, 0.0036823449, 0.5103690028, 0.0033893099, 0.5092293620, 0.0031167541, 0.5081066489, 0.0028560751, 0.5069167018, 0.0026128395, 0.5055274963, 0.0023786670, 0.5040615201, 0.0021570569, + 0.5026400089, 0.0019568170, 0.5014370084, 0.0017693196, 0.5004366636, 0.0015960743, 0.4994098544, 0.0014333163, 0.4984827936, 0.0012816647, 0.4975292087, 0.0011445465, 0.4969336092, 0.0010230636, 0.4963563383, 0.0009074600, 0.4956703186, 0.0007996417, 0.4951874316, 0.0006979253, 0.4946067333, 0.0006092435, 0.4937662780, 0.0005273137, 0.4931357503, 0.0004523628, 0.4926880300, 0.0003825460, 0.4921966791, 0.0003222241, 0.4918066263, 0.0002689277, 0.4916466177, 0.0002216248, 0.4913509488, 0.0001780205, 0.4910252392, 0.0001400714, 0.4906392097, 0.0001067972, 0.4904921949, 0.0000784483, 0.4904029667, 0.0000543794, + 0.6741734743, 0.0365955606, 0.6653865576, 0.0348033346, 0.6569140553, 0.0330457538, 0.6487056017, 0.0313271061, 0.6407358646, 0.0296784882, 0.6329831481, 0.0281079132, 0.6254588366, 0.0266218185, 0.6180989146, 0.0251955595, 0.6111097336, 0.0238502119, 0.6042331457, 0.0225574486, 0.5976136327, 0.0213129558, 0.5915935040, 0.0201203171, 0.5866871476, 0.0189833399, 0.5823619962, 0.0179024953, 0.5781258345, 0.0168858953, 0.5739198923, 0.0159145351, 0.5696852207, 0.0149847455, 0.5656456351, 0.0140969446, 0.5617750883, 0.0132505978, 0.5582388043, 0.0124386698, 0.5549590588, 0.0116641689, 0.5520450473, 0.0109263593, + 0.5491530895, 0.0102456221, 0.5463967919, 0.0096012689, 0.5437852740, 0.0089912619, 0.5413275957, 0.0084003489, 0.5393514633, 0.0078295879, 0.5373504162, 0.0072856718, 0.5352891684, 0.0067762798, 0.5333600044, 0.0062939227, 0.5313643813, 0.0058410028, 0.5296736360, 0.0054197144, 0.5278956294, 0.0050201281, 0.5260314941, 0.0046342085, 0.5245208144, 0.0042720106, 0.5230346322, 0.0039346241, 0.5217374563, 0.0036212795, 0.5207245946, 0.0033214733, 0.5199339390, 0.0030407275, 0.5191783309, 0.0027740572, 0.5183367133, 0.0025207356, 0.5174421072, 0.0022930838, 0.5164428949, 0.0020789900, 0.5154072642, 0.0018775427, + 0.5145315528, 0.0016911018, 0.5138944387, 0.0015181798, 0.5132343769, 0.0013622893, 0.5128456950, 0.0012198631, 0.5122664571, 0.0010835789, 0.5117987394, 0.0009567483, 0.5115171671, 0.0008392606, 0.5112818480, 0.0007358482, 0.5111513138, 0.0006395964, 0.5109639764, 0.0005520206, 0.5104585290, 0.0004707735, 0.5101304650, 0.0004000438, 0.5100883245, 0.0003372441, 0.5100048780, 0.0002805752, 0.5098557472, 0.0002285029, 0.5099000931, 0.0001832373, 0.5099875331, 0.0001442127, 0.5101649761, 0.0001103685, 0.5102130771, 0.0000804653, 0.5102313161, 0.0000548989, 0.6796571612, 0.0388219580, 0.6705607772, 0.0369304158, + 0.6618609428, 0.0350785032, 0.6535009742, 0.0332670659, 0.6454446316, 0.0315287560, 0.6376487613, 0.0298637301, 0.6301530004, 0.0282979999, 0.6228448153, 0.0267899539, 0.6159164310, 0.0253660027, 0.6091599464, 0.0239948276, 0.6026425958, 0.0226794649, 0.5966686010, 0.0214213002, 0.5912854075, 0.0202186592, 0.5872420669, 0.0190781932, 0.5832873583, 0.0179962125, 0.5794227719, 0.0169649366, 0.5755664706, 0.0159774497, 0.5717473030, 0.0150300944, 0.5681359172, 0.0141299935, 0.5646770000, 0.0132707926, 0.5616430640, 0.0124424165, 0.5589097142, 0.0116719138, 0.5564250946, 0.0109449942, 0.5539479256, 0.0102580367, + 0.5516474247, 0.0095973639, 0.5494115353, 0.0089540528, 0.5473746657, 0.0083417296, 0.5458076596, 0.0077658882, 0.5442628860, 0.0072246371, 0.5426543355, 0.0067177415, 0.5411869287, 0.0062421211, 0.5396471024, 0.0057901596, 0.5383719206, 0.0053533749, 0.5370154977, 0.0049425587, 0.5356156230, 0.0045608240, 0.5345470905, 0.0042016339, 0.5333829522, 0.0038567176, 0.5323939919, 0.0035327394, 0.5316264033, 0.0032258881, 0.5311598778, 0.0029378249, 0.5308709145, 0.0026773463, 0.5304908752, 0.0024321657, 0.5300191641, 0.0022024205, 0.5294576883, 0.0019903225, 0.5289472938, 0.0017943379, 0.5285111070, 0.0016148299, + 0.5282640457, 0.0014449897, 0.5279928446, 0.0012858876, 0.5277644396, 0.0011389772, 0.5275855064, 0.0010039628, 0.5273784995, 0.0008836129, 0.5273829699, 0.0007703779, 0.5275862217, 0.0006684479, 0.5277974606, 0.0005748822, 0.5280659795, 0.0004924855, 0.5281804204, 0.0004197704, 0.5282505751, 0.0003521543, 0.5284798741, 0.0002905269, 0.5286680460, 0.0002363670, 0.5289669037, 0.0001900086, 0.5294625759, 0.0001494621, 0.5297181010, 0.0001127110, 0.5301510096, 0.0000818849, 0.5306910872, 0.0000560087, 0.6847168207, 0.0412035882, 0.6752743125, 0.0392044373, 0.6663239598, 0.0372503810, 0.6577965021, 0.0353415646, + 0.6496402621, 0.0335041396, 0.6418164968, 0.0317486487, 0.6343286633, 0.0300865173, 0.6270906925, 0.0284912810, 0.6202069521, 0.0269836485, 0.6136302352, 0.0255356003, 0.6072543263, 0.0241468176, 0.6012552977, 0.0228221603, 0.5957987905, 0.0215513483, 0.5916239023, 0.0203457642, 0.5879607201, 0.0191868115, 0.5844132304, 0.0180876069, 0.5809527040, 0.0170394517, 0.5774947405, 0.0160355084, 0.5741366744, 0.0150723727, 0.5709704161, 0.0141496388, 0.5680615306, 0.0132845836, 0.5654884577, 0.0124673517, 0.5633082390, 0.0116916923, 0.5612376332, 0.0109454365, 0.5591549277, 0.0102232331, 0.5572597980, 0.0095337825, + 0.5554736257, 0.0088871308, 0.5539423227, 0.0082835136, 0.5528472662, 0.0077130306, 0.5518051386, 0.0071786237, 0.5506800413, 0.0066655991, 0.5496283174, 0.0061718654, 0.5485063791, 0.0057040867, 0.5476697087, 0.0052706921, 0.5468038321, 0.0048592533, 0.5457960963, 0.0044655497, 0.5450786352, 0.0040971464, 0.5443314910, 0.0037429412, 0.5436845422, 0.0034193315, 0.5432776213, 0.0031214729, 0.5431558490, 0.0028406230, 0.5433155298, 0.0025812199, 0.5434003472, 0.0023373666, 0.5434294939, 0.0021104591, 0.5433802605, 0.0019041890, 0.5432525873, 0.0017051485, 0.5431674123, 0.0015247162, 0.5432094932, 0.0013538277, + 0.5434713364, 0.0011994264, 0.5436018109, 0.0010576824, 0.5438712239, 0.0009276972, 0.5439873934, 0.0008082003, 0.5442991853, 0.0007000748, 0.5448691249, 0.0006038879, 0.5455570221, 0.0005171180, 0.5462044477, 0.0004360627, 0.5465903282, 0.0003636707, 0.5470235348, 0.0003008358, 0.5478280783, 0.0002461577, 0.5484983921, 0.0001969247, 0.5489701033, 0.0001522294, 0.5497234464, 0.0001151194, 0.5503802299, 0.0000832587, 0.5510643721, 0.0000561289, 0.6893240213, 0.0437521823, 0.6794993877, 0.0416362174, 0.6702712774, 0.0395715348, 0.6615586877, 0.0375586040, 0.6532940865, 0.0356149338, 0.6454367638, 0.0337619446, + 0.6379550695, 0.0319944955, 0.6308079362, 0.0303126574, 0.6239523888, 0.0287088417, 0.6175685525, 0.0271823946, 0.6113405228, 0.0257137604, 0.6054363251, 0.0243207868, 0.6001759171, 0.0229885690, 0.5954685211, 0.0217061806, 0.5921548009, 0.0204758383, 0.5889389515, 0.0193010084, 0.5858433247, 0.0181858130, 0.5828182697, 0.0171178412, 0.5797877908, 0.0160876643, 0.5769258738, 0.0151102599, 0.5742704272, 0.0141936513, 0.5719383359, 0.0133206388, 0.5698212981, 0.0124836983, 0.5681272149, 0.0116680600, 0.5664817095, 0.0108912745, 0.5648460984, 0.0101643531, 0.5634772182, 0.0094879968, 0.5622051954, 0.0088458955, + 0.5611672997, 0.0082421042, 0.5605154634, 0.0076591829, 0.5599130988, 0.0070987805, 0.5592186451, 0.0065681273, 0.5586344004, 0.0060755294, 0.5579863191, 0.0056042280, 0.5575068593, 0.0051593874, 0.5571224689, 0.0047416613, 0.5565932393, 0.0043429905, 0.5562991500, 0.0039834380, 0.5561691523, 0.0036438468, 0.5559702516, 0.0033245159, 0.5559611320, 0.0030239474, 0.5561371446, 0.0027429606, 0.5566235781, 0.0024810915, 0.5571904778, 0.0022400720, 0.5576127768, 0.0020127920, 0.5580388308, 0.0018036928, 0.5583423376, 0.0016044277, 0.5586587787, 0.0014278465, 0.5591002703, 0.0012630766, 0.5598247051, 0.0011137369, + 0.5603641272, 0.0009731953, 0.5610011816, 0.0008465610, 0.5615708232, 0.0007333539, 0.5622070432, 0.0006306780, 0.5628819466, 0.0005346143, 0.5637751222, 0.0004506132, 0.5649862885, 0.0003771835, 0.5659355521, 0.0003120705, 0.5667162538, 0.0002526488, 0.5676234365, 0.0001993894, 0.5686322451, 0.0001553380, 0.5696795583, 0.0001174712, 0.5708093643, 0.0000844511, 0.5719581246, 0.0000568485, 0.6934506893, 0.0464805812, 0.6832033396, 0.0442376137, 0.6736713052, 0.0420527533, 0.6647559404, 0.0399274640, 0.6563763022, 0.0378747545, 0.6484786868, 0.0359142795, 0.6410018206, 0.0340309292, 0.6339532733, 0.0322594196, + 0.6272034645, 0.0305538550, 0.6209469438, 0.0289392155, 0.6149716377, 0.0273960736, 0.6092708707, 0.0259242579, 0.6040118933, 0.0245171003, 0.5993004441, 0.0231581330, 0.5958040357, 0.0218539648, 0.5929592252, 0.0206033029, 0.5902296305, 0.0194092002, 0.5876193047, 0.0182710532, 0.5850713253, 0.0171795711, 0.5825458765, 0.0161494296, 0.5802361965, 0.0151707251, 0.5780924559, 0.0142349489, 0.5763073564, 0.0133239916, 0.5746489763, 0.0124545163, 0.5735287070, 0.0116402628, 0.5724340081, 0.0108748144, 0.5712955594, 0.0101466766, 0.5704212785, 0.0094621759, 0.5696596503, 0.0088027446, 0.5690229535, 0.0081660990, + 0.5687951446, 0.0075653391, 0.5686849356, 0.0070055528, 0.5685114861, 0.0064692530, 0.5683794618, 0.0059689768, 0.5682623982, 0.0054973294, 0.5681734085, 0.0050480221, 0.5683599710, 0.0046378663, 0.5684837699, 0.0042540524, 0.5685454011, 0.0038872960, 0.5689237118, 0.0035419511, 0.5691713691, 0.0032173102, 0.5695586801, 0.0029175321, 0.5701262355, 0.0026359325, 0.5708835125, 0.0023745678, 0.5718262792, 0.0021275366, 0.5726659298, 0.0018984841, 0.5734885931, 0.0016954371, 0.5742862225, 0.0015054049, 0.5750390887, 0.0013278733, 0.5758213997, 0.0011637075, 0.5767915249, 0.0010178406, 0.5779007673, 0.0008865834, + 0.5789593458, 0.0007667936, 0.5799294114, 0.0006541575, 0.5809006691, 0.0005572070, 0.5820773840, 0.0004698650, 0.5832611918, 0.0003910926, 0.5846334100, 0.0003194462, 0.5856962204, 0.0002566123, 0.5870062709, 0.0002050794, 0.5885832906, 0.0001595933, 0.5898836851, 0.0001190211, 0.5912480354, 0.0000849659, 0.5926127434, 0.0000565561, 0.6970671415, 0.0494023338, 0.6863564253, 0.0470210053, 0.6764909625, 0.0447059646, 0.6673547626, 0.0424601100, 0.6588520408, 0.0402896889, 0.6509117484, 0.0382123739, 0.6434564590, 0.0362189598, 0.6364971995, 0.0343383886, 0.6299016476, 0.0325316899, 0.6237381697, 0.0308151655, + 0.6180372238, 0.0291923080, 0.6125442386, 0.0276299324, 0.6074157357, 0.0261469111, 0.6029617786, 0.0247098710, 0.5988830924, 0.0233214553, 0.5964446068, 0.0219911225, 0.5941160321, 0.0207179543, 0.5918953419, 0.0194912311, 0.5898210406, 0.0183432065, 0.5878316760, 0.0172568411, 0.5858699083, 0.0162119232, 0.5840860009, 0.0152029684, 0.5824407339, 0.0142293489, 0.5812920332, 0.0133240893, 0.5802286267, 0.0124670817, 0.5797021985, 0.0116501171, 0.5791661739, 0.0108718518, 0.5785405040, 0.0101176966, 0.5780392885, 0.0093908785, 0.5777368546, 0.0087131662, 0.5775595903, 0.0080745099, 0.5778368711, 0.0074699842, + 0.5782361031, 0.0069061033, 0.5786340237, 0.0063710297, 0.5789972544, 0.0058657420, 0.5794903040, 0.0054004896, 0.5799283981, 0.0049553630, 0.5805246234, 0.0045317793, 0.5811035037, 0.0041356673, 0.5815922618, 0.0037622957, 0.5824133158, 0.0034199094, 0.5832083225, 0.0030953616, 0.5839034319, 0.0027921922, 0.5848466158, 0.0025055334, 0.5859711766, 0.0022498658, 0.5873622894, 0.0020123508, 0.5887139440, 0.0017881941, 0.5899114013, 0.0015800133, 0.5909957886, 0.0013911955, 0.5923432112, 0.0012266123, 0.5936049819, 0.0010714915, 0.5949172974, 0.0009296161, 0.5964722037, 0.0007988937, 0.5979804993, 0.0006851401, + 0.5994589329, 0.0005817469, 0.6007208824, 0.0004868820, 0.6020959616, 0.0004023260, 0.6035663486, 0.0003291772, 0.6055677533, 0.0002678341, 0.6071894765, 0.0002117701, 0.6085858345, 0.0001620641, 0.6103474498, 0.0001208138, 0.6120437384, 0.0000862669, 0.6138473153, 0.0000572077, 0.7001442909, 0.0525321774, 0.6889251471, 0.0499997735, 0.6786965728, 0.0475441404, 0.6693232059, 0.0451683700, 0.6606884599, 0.0428719632, 0.6527037621, 0.0406705886, 0.6452918649, 0.0385619402, 0.6384127736, 0.0365601815, 0.6319944859, 0.0346480198, 0.6259441972, 0.0328241289, 0.6205067635, 0.0311071090, 0.6153475642, 0.0294644292, + 0.6104821563, 0.0278760977, 0.6060523391, 0.0263506882, 0.6022614241, 0.0248902906, 0.5993843675, 0.0234834887, 0.5974961519, 0.0221178774, 0.5957245827, 0.0208233669, 0.5941023827, 0.0196047258, 0.5926256180, 0.0184504762, 0.5912092924, 0.0173344556, 0.5898161530, 0.0162523426, 0.5886321068, 0.0152401747, 0.5876194239, 0.0142776547, 0.5870865583, 0.0133584412, 0.5866090059, 0.0124831153, 0.5866058469, 0.0116341310, 0.5865706205, 0.0108120451, 0.5865015984, 0.0100429207, 0.5865411162, 0.0093205543, 0.5867575407, 0.0086377179, 0.5870491266, 0.0079984330, 0.5878449678, 0.0073874099, 0.5888068676, 0.0068131150, + 0.5897422433, 0.0062782569, 0.5906212926, 0.0057643307, 0.5915957093, 0.0052815229, 0.5924666524, 0.0048238654, 0.5935047865, 0.0043949527, 0.5945940614, 0.0039979550, 0.5955525637, 0.0036237012, 0.5966551304, 0.0032739998, 0.5978810787, 0.0029468383, 0.5991374850, 0.0026534300, 0.6004627347, 0.0023744933, 0.6019448042, 0.0021134671, 0.6035515070, 0.0018746166, 0.6053861976, 0.0016623540, 0.6072149277, 0.0014676281, 0.6089053154, 0.0012876501, 0.6104359031, 0.0011178190, 0.6120332479, 0.0009691892, 0.6138402820, 0.0008337921, 0.6157492399, 0.0007111899, 0.6175633073, 0.0005993035, 0.6194127202, 0.0005012794, + 0.6211850047, 0.0004160877, 0.6231079102, 0.0003419033, 0.6248779297, 0.0002741038, 0.6269036531, 0.0002139888, 0.6288846135, 0.0001646858, 0.6307188869, 0.0001223480, 0.6328452826, 0.0000866794, 0.6346889138, 0.0000566830, 0.7026492953, 0.0558859445, 0.6908757091, 0.0531881973, 0.6802540421, 0.0505803227, 0.6706257463, 0.0480629764, 0.6618542075, 0.0456350707, 0.6538264751, 0.0432997383, 0.6464632750, 0.0410731472, 0.6396785378, 0.0389409289, 0.6334456205, 0.0369109437, 0.6276372075, 0.0349832289, 0.6223669648, 0.0331610665, 0.6175690293, 0.0314239115, 0.6129967570, 0.0297323149, 0.6088091135, 0.0281196926, + 0.6052578688, 0.0265716612, 0.6020469069, 0.0250758268, 0.6003527641, 0.0236350633, 0.5991099477, 0.0222776998, 0.5979812741, 0.0209823791, 0.5969745517, 0.0197329149, 0.5960467458, 0.0185206812, 0.5952596664, 0.0173932016, 0.5945287943, 0.0163167957, 0.5939683318, 0.0152843138, 0.5935484767, 0.0142964572, 0.5935647488, 0.0133358464, 0.5935848951, 0.0124073979, 0.5941224694, 0.0115512246, 0.5947639346, 0.0107447915, 0.5953372717, 0.0099723451, 0.5959766507, 0.0092511242, 0.5967250466, 0.0085513704, 0.5975517035, 0.0079042092, 0.5987755060, 0.0072897580, 0.6002562642, 0.0067009507, 0.6016942263, 0.0061429045, + 0.6030341983, 0.0056152600, 0.6044559479, 0.0051274779, 0.6059051752, 0.0046708854, 0.6074132919, 0.0042424286, 0.6089137197, 0.0038364963, 0.6104565263, 0.0034667822, 0.6119530797, 0.0031231050, 0.6136049628, 0.0027960644, 0.6151816249, 0.0024958455, 0.6167798638, 0.0022240849, 0.6187589169, 0.0019786942, 0.6208356619, 0.0017493013, 0.6230515838, 0.0015367251, 0.6251518130, 0.0013395448, 0.6272560358, 0.0011667366, 0.6292704344, 0.0010075739, 0.6312175989, 0.0008623797, 0.6332287788, 0.0007313487, 0.6353375316, 0.0006172028, 0.6377686262, 0.0005172302, 0.6401243806, 0.0004282934, 0.6421490312, 0.0003467427, + 0.6441644430, 0.0002759436, 0.6462899446, 0.0002166939, 0.6487188339, 0.0001659412, 0.6510323882, 0.0001224992, 0.6532891989, 0.0000862399, 0.6557361484, 0.0000565369, 0.7045518160, 0.0594805330, 0.6921738386, 0.0566015840, 0.6811287999, 0.0538281724, 0.6712287068, 0.0511579402, 0.6623144150, 0.0485899672, 0.6542500854, 0.0461132824, 0.6469417214, 0.0437590852, 0.6402766705, 0.0414921418, 0.6342425942, 0.0393490270, 0.6287117600, 0.0373104252, 0.6236000657, 0.0353627168, 0.6191707850, 0.0335056558, 0.6150246859, 0.0317147821, 0.6111763120, 0.0300043989, 0.6076875925, 0.0283631608, 0.6049923897, 0.0267703533, + 0.6026681662, 0.0252728630, 0.6019819975, 0.0238448810, 0.6014033556, 0.0224534068, 0.6008896232, 0.0210957043, 0.6005139947, 0.0198215097, 0.6002592444, 0.0186092332, 0.6000979543, 0.0174478833, 0.5999778509, 0.0163368024, 0.6000121236, 0.0152589558, 0.6001331210, 0.0142254466, 0.6007903814, 0.0132646281, 0.6014996767, 0.0123531055, 0.6025819778, 0.0114874803, 0.6038841009, 0.0106755383, 0.6050696969, 0.0098802177, 0.6062694788, 0.0091489516, 0.6076443791, 0.0084398184, 0.6088981032, 0.0077626402, 0.6103966236, 0.0071206330, 0.6122912169, 0.0065177265, 0.6143148541, 0.0059655122, 0.6162657142, 0.0054462398, + 0.6181043386, 0.0049527115, 0.6200824976, 0.0044896998, 0.6220748425, 0.0040660589, 0.6241310835, 0.0036638973, 0.6261107922, 0.0032901689, 0.6280855536, 0.0029505705, 0.6302433610, 0.0026367607, 0.6324847937, 0.0023509187, 0.6344674230, 0.0020799928, 0.6365365386, 0.0018302159, 0.6388932467, 0.0016042463, 0.6413676143, 0.0013986619, 0.6439183354, 0.0012115533, 0.6463235021, 0.0010411482, 0.6485711932, 0.0008885672, 0.6510179043, 0.0007558624, 0.6534518003, 0.0006380256, 0.6559099555, 0.0005298369, 0.6584776044, 0.0004344478, 0.6610497236, 0.0003516302, 0.6636332870, 0.0002812821, 0.6661571264, 0.0002206538, + 0.6686874628, 0.0001677176, 0.6713083982, 0.0001232049, 0.6736995578, 0.0000858215, 0.6762138009, 0.0000553654, 0.7058184743, 0.0633341670, 0.6927843690, 0.0602560341, 0.6812848449, 0.0573021732, 0.6710970998, 0.0544664115, 0.6620355844, 0.0517475121, 0.6539435387, 0.0491302386, 0.6466981769, 0.0466322787, 0.6401938796, 0.0442357287, 0.6343605518, 0.0419662781, 0.6291233301, 0.0398056209, 0.6243584156, 0.0377307795, 0.6201445460, 0.0357348062, 0.6164575219, 0.0338421613, 0.6130434275, 0.0320239887, 0.6099609733, 0.0302644670, 0.6074176431, 0.0286072642, 0.6054749489, 0.0270312689, 0.6042866707, 0.0254972707, + 0.6042677164, 0.0239999387, 0.6043847203, 0.0225785058, 0.6046015024, 0.0212165657, 0.6048799157, 0.0199031122, 0.6052711606, 0.0186492186, 0.6057218909, 0.0174395982, 0.6061939001, 0.0162831470, 0.6069101691, 0.0152069516, 0.6077075601, 0.0141791245, 0.6090247035, 0.0132164527, 0.6103976369, 0.0122842975, 0.6119890809, 0.0113863470, 0.6137931943, 0.0105485013, 0.6156008244, 0.0097389771, 0.6172998548, 0.0089653768, 0.6191431284, 0.0082390439, 0.6210198402, 0.0075608231, 0.6229521632, 0.0069351997, 0.6252230406, 0.0063324813, 0.6277741194, 0.0057649380, 0.6302537918, 0.0052376781, 0.6326577067, 0.0047489065, + 0.6349891424, 0.0042879283, 0.6374388933, 0.0038643188, 0.6400502920, 0.0034717564, 0.6426821351, 0.0031158871, 0.6451569796, 0.0027770412, 0.6476351023, 0.0024643240, 0.6502036452, 0.0021710347, 0.6527490020, 0.0019110707, 0.6551116109, 0.0016721353, 0.6575800180, 0.0014515817, 0.6603479981, 0.0012536625, 0.6633187532, 0.0010780013, 0.6662929654, 0.0009227313, 0.6690896153, 0.0007827758, 0.6716201305, 0.0006523074, 0.6741061211, 0.0005398450, 0.6768460274, 0.0004421565, 0.6798374653, 0.0003592809, 0.6829334497, 0.0002865007, 0.6856709719, 0.0002218680, 0.6883285642, 0.0001676299, 0.6911405325, 0.0001224452, + 0.6941902637, 0.0000855834, 0.6969999671, 0.0000552583, 0.7064153552, 0.0674660131, 0.6926710606, 0.0641693249, 0.6806857586, 0.0610178411, 0.6701959968, 0.0580035932, 0.6609865427, 0.0551233664, 0.6528758407, 0.0523610376, 0.6457104087, 0.0497059859, 0.6393821836, 0.0471756272, 0.6337700486, 0.0447658971, 0.6288656592, 0.0424847603, 0.6244697571, 0.0402630866, 0.6205192208, 0.0381299332, 0.6172874570, 0.0361297764, 0.6143937707, 0.0341875441, 0.6117630601, 0.0323331729, 0.6095452309, 0.0305841472, 0.6079673767, 0.0288934074, 0.6067267060, 0.0272381268, 0.6066154242, 0.0256577805, 0.6073546410, 0.0241461135, + 0.6082092524, 0.0226924904, 0.6091424227, 0.0212912895, 0.6101061702, 0.0199290290, 0.6111555696, 0.0186325945, 0.6122883558, 0.0174134932, 0.6134956479, 0.0162553042, 0.6148884892, 0.0151694100, 0.6162717342, 0.0141071528, 0.6180853248, 0.0130966511, 0.6200949550, 0.0121397572, 0.6221899986, 0.0112173501, 0.6244940758, 0.0103430618, 0.6268188953, 0.0095184082, 0.6292037368, 0.0087593235, 0.6315883994, 0.0080366330, 0.6340671182, 0.0073475926, 0.6364527345, 0.0067034881, 0.6390873790, 0.0061065797, 0.6420505643, 0.0055437824, 0.6450781226, 0.0050169313, 0.6481018662, 0.0045336853, 0.6509817243, 0.0040810029, + 0.6538922191, 0.0036628826, 0.6567531228, 0.0032669550, 0.6597394347, 0.0029006698, 0.6626350880, 0.0025698817, 0.6655275226, 0.0022707207, 0.6685240865, 0.0019902908, 0.6715757251, 0.0017367078, 0.6744068861, 0.0015056470, 0.6773455143, 0.0013054562, 0.6803444028, 0.0011206979, 0.6835638881, 0.0009520518, 0.6866924763, 0.0007991858, 0.6898087263, 0.0006679911, 0.6929277778, 0.0005553614, 0.6959647536, 0.0004551249, 0.6989031434, 0.0003661066, 0.7017738819, 0.0002873958, 0.7049996853, 0.0002225087, 0.7081081867, 0.0001683690, 0.7111302018, 0.0001228882, 0.7140595317, 0.0000846878, 0.7170689702, 0.0000536976, + 0.7063078284, 0.0718969479, 0.6917980313, 0.0683593377, 0.6792955995, 0.0649919063, 0.6684913039, 0.0617856868, 0.6591351032, 0.0587342456, 0.6510169506, 0.0558151789, 0.6439544559, 0.0529973619, 0.6378162503, 0.0503194854, 0.6324965358, 0.0477766320, 0.6279008985, 0.0453412086, 0.6239243150, 0.0429860391, 0.6204475760, 0.0407337807, 0.6174914837, 0.0385725535, 0.6151685119, 0.0365216210, 0.6131705642, 0.0345786735, 0.6114180088, 0.0326992460, 0.6100127697, 0.0308719818, 0.6093675494, 0.0291139986, 0.6089299321, 0.0274402481, 0.6098570228, 0.0258232858, 0.6113499403, 0.0242653340, 0.6129207015, 0.0227506775, + 0.6145738363, 0.0213028435, 0.6163100600, 0.0199317373, 0.6181104779, 0.0186318997, 0.6200048327, 0.0173960086, 0.6218528152, 0.0161893442, 0.6237972379, 0.0150501626, 0.6258099675, 0.0139570544, 0.6280426979, 0.0129119540, 0.6306383014, 0.0119236177, 0.6332356930, 0.0109941792, 0.6362683773, 0.0101373810, 0.6392030716, 0.0093114851, 0.6421626210, 0.0085325129, 0.6450453401, 0.0077997930, 0.6481131911, 0.0071175611, 0.6511050463, 0.0064676623, 0.6541747451, 0.0058700899, 0.6573138833, 0.0053045726, 0.6609334946, 0.0047898483, 0.6643891931, 0.0042986176, 0.6677147746, 0.0038427978, 0.6709273458, 0.0034210817, + 0.6742804646, 0.0030416534, 0.6776492000, 0.0026867844, 0.6810010672, 0.0023624958, 0.6841650009, 0.0020651147, 0.6874860525, 0.0018045019, 0.6909487247, 0.0015650721, 0.6942663789, 0.0013465140, 0.6973070502, 0.0011455220, 0.7005107403, 0.0009719134, 0.7039350867, 0.0008202509, 0.7075829506, 0.0006861306, 0.7110959888, 0.0005647612, 0.7142977715, 0.0004584683, 0.7173655033, 0.0003645177, 0.7205645442, 0.0002882665, 0.7238382697, 0.0002233202, 0.7272602320, 0.0001676411, 0.7305409908, 0.0001209966, 0.7337548137, 0.0000830008, 0.7369498014, 0.0000526591, 0.7054612637, 0.0766489506, 0.6901281476, 0.0728452951, + 0.6770779490, 0.0692427233, 0.6659493446, 0.0658321083, 0.6564494967, 0.0625935942, 0.6483376026, 0.0595024899, 0.6414030194, 0.0565222315, 0.6354902983, 0.0536924228, 0.6304790378, 0.0509956405, 0.6262176633, 0.0483817980, 0.6226965785, 0.0459017828, 0.6197366118, 0.0435209833, 0.6172283292, 0.0412091985, 0.6153622270, 0.0390414707, 0.6140064001, 0.0369727947, 0.6128994823, 0.0349514298, 0.6120321751, 0.0329960175, 0.6115554571, 0.0311444681, 0.6118426919, 0.0293503590, 0.6122133136, 0.0276212525, 0.6140611172, 0.0259353761, 0.6163216829, 0.0243272204, 0.6186909080, 0.0227928609, 0.6211940646, 0.0213489607, + 0.6237422824, 0.0199576672, 0.6262471676, 0.0185920186, 0.6287911534, 0.0173066258, 0.6313548684, 0.0160725806, 0.6338288188, 0.0148815634, 0.6365029812, 0.0137664983, 0.6392353773, 0.0127289444, 0.6425811648, 0.0117488177, 0.6457910538, 0.0108026369, 0.6492461562, 0.0099093625, 0.6527842283, 0.0090735611, 0.6562260985, 0.0082819890, 0.6596915722, 0.0075449655, 0.6631203294, 0.0068519618, 0.6666635275, 0.0062032267, 0.6700922847, 0.0056004473, 0.6736560464, 0.0050298627, 0.6772424579, 0.0045014983, 0.6811576486, 0.0040231347, 0.6850161552, 0.0035806072, 0.6886588335, 0.0031672826, 0.6921517253, 0.0027882333, + 0.6958611012, 0.0024512527, 0.6997209191, 0.0021464645, 0.7033208609, 0.0018636418, 0.7067574859, 0.0016067737, 0.7103120685, 0.0013755935, 0.7141909599, 0.0011779193, 0.7178157568, 0.0009979554, 0.7213057876, 0.0008373721, 0.7246195674, 0.0006909600, 0.7281235456, 0.0005642909, 0.7316837907, 0.0004558357, 0.7354922295, 0.0003674747, 0.7390241623, 0.0002886655, 0.7424623370, 0.0002220330, 0.7458465099, 0.0001654151, 0.7494255304, 0.0001191885, 0.7530137300, 0.0000817810, 0.7563720942, 0.0000512484, 0.7038409710, 0.0817454457, 0.6876227856, 0.0776472688, 0.6739978194, 0.0737888888, 0.6625381112, 0.0701567009, + 0.6529031396, 0.0667184368, 0.6448125243, 0.0634374395, 0.6380339861, 0.0602975078, 0.6323872209, 0.0573111363, 0.6277042627, 0.0544339120, 0.6238645315, 0.0516620651, 0.6207780242, 0.0490257666, 0.6183649898, 0.0464963801, 0.6164870858, 0.0440828577, 0.6150437593, 0.0417537317, 0.6142552495, 0.0395144336, 0.6138557792, 0.0373569317, 0.6137184501, 0.0352965295, 0.6137945652, 0.0332972147, 0.6142840385, 0.0313847959, 0.6154209375, 0.0295201559, 0.6166317463, 0.0277317278, 0.6193848848, 0.0260350052, 0.6225596666, 0.0244365130, 0.6257855892, 0.0228758678, 0.6290026307, 0.0213436820, 0.6322981119, 0.0198996719, + 0.6355544329, 0.0184976440, 0.6387749314, 0.0171541292, 0.6420262456, 0.0159000438, 0.6453490853, 0.0147298444, 0.6486098170, 0.0136016915, 0.6519734859, 0.0125279687, 0.6556540728, 0.0115142958, 0.6595315337, 0.0105572157, 0.6633992791, 0.0096493261, 0.6675260067, 0.0088002589, 0.6714898944, 0.0079918057, 0.6754209995, 0.0072519239, 0.6791996360, 0.0065448037, 0.6830672622, 0.0058881729, 0.6869513988, 0.0052844468, 0.6908116341, 0.0047277240, 0.6947240233, 0.0042058812, 0.6986470222, 0.0037278756, 0.7027719021, 0.0032944970, 0.7070144415, 0.0029093069, 0.7110052109, 0.0025468636, 0.7148633599, 0.0022172299, + 0.7188155651, 0.0019161378, 0.7229196429, 0.0016565789, 0.7267937064, 0.0014184159, 0.7305004597, 0.0012051623, 0.7342277765, 0.0010107696, 0.7380563617, 0.0008413208, 0.7416790724, 0.0006937980, 0.7454779148, 0.0005709913, 0.7494900227, 0.0004648782, 0.7533830404, 0.0003699281, 0.7570841312, 0.0002876050, 0.7607678771, 0.0002201156, 0.7641995549, 0.0001627403, 0.7677807212, 0.0001166164, 0.7712831497, 0.0000786131, 0.7750309110, 0.0000492805, 0.7014091015, 0.0872110948, 0.6842458844, 0.0827872083, 0.6700180173, 0.0786492601, 0.6582249999, 0.0747788325, 0.6484666467, 0.0711229369, 0.6404190660, 0.0676349401, + 0.6338298917, 0.0643326566, 0.6284824610, 0.0611758009, 0.6241819263, 0.0581164435, 0.6207901239, 0.0551773459, 0.6181940436, 0.0523681492, 0.6163479686, 0.0497005470, 0.6151184440, 0.0471457243, 0.6143681407, 0.0446732603, 0.6140306592, 0.0422581248, 0.6143141985, 0.0399584435, 0.6149299145, 0.0377438217, 0.6157900095, 0.0356235579, 0.6168079972, 0.0335535482, 0.6182475090, 0.0315759778, 0.6203452945, 0.0296983235, 0.6225197315, 0.0279105436, 0.6260643601, 0.0261562858, 0.6299439669, 0.0244422071, 0.6339303255, 0.0228202362, 0.6378958225, 0.0212379247, 0.6419279575, 0.0197475664, 0.6460229754, 0.0183449239, + 0.6501350999, 0.0170176532, 0.6541674137, 0.0157359280, 0.6580916047, 0.0145077715, 0.6619151235, 0.0133399414, 0.6657543778, 0.0122358473, 0.6696705222, 0.0111995377, 0.6740016341, 0.0102163618, 0.6783406734, 0.0093042264, 0.6828742623, 0.0084461113, 0.6873936057, 0.0076377825, 0.6917839050, 0.0068836808, 0.6960873008, 0.0061921361, 0.7002286315, 0.0055459379, 0.7045738697, 0.0049484973, 0.7088426352, 0.0044039143, 0.7132536769, 0.0039101630, 0.7175426483, 0.0034474987, 0.7218735814, 0.0030253730, 0.7262132764, 0.0026383998, 0.7304853201, 0.0022952580, 0.7346614599, 0.0019846342, 0.7386901975, 0.0017031289, + 0.7429028153, 0.0014476309, 0.7468904257, 0.0012194995, 0.7508179545, 0.0010251955, 0.7548318505, 0.0008561065, 0.7590258718, 0.0007119650, 0.7630441189, 0.0005791912, 0.7670202851, 0.0004667814, 0.7706265450, 0.0003662292, 0.7748550773, 0.0002869123, 0.7786145806, 0.0002170701, 0.7825197577, 0.0001615687, 0.7861834168, 0.0001147282, 0.7899155021, 0.0000780879, 0.7934539318, 0.0000480547, 0.6981306672, 0.0930722952, 0.6799601316, 0.0882869288, 0.6651064157, 0.0838462636, 0.6529810429, 0.0797169581, 0.6431171298, 0.0758271366, 0.6351421475, 0.0721258521, 0.6287759542, 0.0686434209, 0.6237659454, 0.0653051212, + 0.6198947430, 0.0620618388, 0.6170110106, 0.0589613244, 0.6149836183, 0.0559876226, 0.6137044430, 0.0531426407, 0.6131397486, 0.0504249223, 0.6131123304, 0.0477892235, 0.6135176420, 0.0452331267, 0.6143676043, 0.0427731983, 0.6157609224, 0.0404169634, 0.6174177527, 0.0381247997, 0.6192690134, 0.0359129533, 0.6212844253, 0.0338152088, 0.6237330437, 0.0318170562, 0.6267384887, 0.0298542399, 0.6297156811, 0.0279488973, 0.6338521242, 0.0261200983, 0.6385207772, 0.0243537333, 0.6433292627, 0.0227024723, 0.6481952667, 0.0211298205, 0.6530988812, 0.0196320321, 0.6578869224, 0.0181633681, 0.6626335382, 0.0167672522, + 0.6672977805, 0.0154381273, 0.6718881130, 0.0141825192, 0.6763442159, 0.0129904076, 0.6806463003, 0.0118634766, 0.6850396991, 0.0108286580, 0.6895851493, 0.0098340670, 0.6942732334, 0.0089012971, 0.6991004944, 0.0080505237, 0.7041904926, 0.0072549297, 0.7091197968, 0.0065094018, 0.7139809728, 0.0058285715, 0.7186771035, 0.0051998831, 0.7231712341, 0.0046173078, 0.7278121114, 0.0040787645, 0.7323166132, 0.0035872238, 0.7369933128, 0.0031399692, 0.7415563464, 0.0027391214, 0.7460732460, 0.0023690434, 0.7505382895, 0.0020370120, 0.7548219562, 0.0017369286, 0.7590532303, 0.0014790281, 0.7633534074, 0.0012502790, + 0.7679348588, 0.0010527795, 0.7722228765, 0.0008751510, 0.7761568427, 0.0007163594, 0.7800285816, 0.0005782105, 0.7839114070, 0.0004619412, 0.7877647281, 0.0003643610, 0.7916223407, 0.0002814463, 0.7958164215, 0.0002147233, 0.7997194529, 0.0001567300, 0.8037630916, 0.0001121957, 0.8074651957, 0.0000748776, 0.8111510277, 0.0000460360, 0.6939688325, 0.0993564501, 0.6747276187, 0.0941691250, 0.6592289805, 0.0893974602, 0.6467775106, 0.0849855915, 0.6368310452, 0.0808457062, 0.6289679408, 0.0769337192, 0.6228628159, 0.0732445493, 0.6182293296, 0.0696978197, 0.6148368716, 0.0662780777, 0.6125189066, 0.0630109385, + 0.6111196876, 0.0598772392, 0.6105164289, 0.0568629466, 0.6105957627, 0.0539548621, 0.6113348007, 0.0511491001, 0.6125568748, 0.0484427251, 0.6141930223, 0.0458380803, 0.6162230968, 0.0432952046, 0.6187143326, 0.0408348665, 0.6214737892, 0.0385038927, 0.6244594455, 0.0362663977, 0.6274775863, 0.0340646133, 0.6306636930, 0.0319310352, 0.6345475912, 0.0298815649, 0.6384348273, 0.0279283319, 0.6431404352, 0.0260720141, 0.6487448215, 0.0243111569, 0.6543290019, 0.0225973036, 0.6598595977, 0.0209363792, 0.6653335690, 0.0193428583, 0.6707827449, 0.0178353935, 0.6761708260, 0.0164049398, 0.6814639568, 0.0150467362, + 0.6867352128, 0.0137847792, 0.6918776631, 0.0125865843, 0.6967994571, 0.0114447679, 0.7016164064, 0.0103903571, 0.7063686848, 0.0094080791, 0.7114722729, 0.0084859757, 0.7165555954, 0.0076291128, 0.7217441201, 0.0068349941, 0.7271233201, 0.0061065829, 0.7323367000, 0.0054278490, 0.7373649478, 0.0048025069, 0.7421392202, 0.0042252052, 0.7468811274, 0.0037121447, 0.7515491247, 0.0032352924, 0.7562473416, 0.0028090819, 0.7610422969, 0.0024224203, 0.7657005191, 0.0020810850, 0.7704946399, 0.0017795668, 0.7751927972, 0.0015134589, 0.7797980309, 0.0012765020, 0.7839027047, 0.0010583047, 0.7880948782, 0.0008712718, + 0.7924093008, 0.0007090696, 0.7966591120, 0.0005753370, 0.8007373810, 0.0004580960, 0.8047008514, 0.0003595140, 0.8086624146, 0.0002789607, 0.8124454618, 0.0002085831, 0.8162528276, 0.0001531014, 0.8202566504, 0.0001067982, 0.8240458369, 0.0000711330, 0.8279327154, 0.0000438745, 0.6888876557, 0.1060925499, 0.6685126424, 0.1004591584, 0.6523543596, 0.0953251794, 0.6395906210, 0.0906082541, 0.6295928359, 0.0861939639, 0.6218846440, 0.0820654258, 0.6160895228, 0.0781605989, 0.6118785143, 0.0743878335, 0.6090244651, 0.0707941726, 0.6073318720, 0.0673648342, 0.6066282392, 0.0640641600, 0.6067650318, 0.0608806759, + 0.6075969934, 0.0577685460, 0.6090642810, 0.0547773167, 0.6111755967, 0.0519291237, 0.6136969924, 0.0491395965, 0.6165316105, 0.0464066043, 0.6197702289, 0.0438145027, 0.6234824061, 0.0413219482, 0.6273115277, 0.0388623923, 0.6312193274, 0.0364664830, 0.6352514029, 0.0341794752, 0.6393470168, 0.0319954492, 0.6441445947, 0.0299166273, 0.6490358114, 0.0279353913, 0.6542173624, 0.0259694755, 0.6602132320, 0.0240822397, 0.6663832664, 0.0222784206, 0.6725377440, 0.0205666125, 0.6786609888, 0.0189432781, 0.6847595572, 0.0174104497, 0.6908780932, 0.0159845110, 0.6967436075, 0.0145943863, 0.7025830150, 0.0133084031, + 0.7083310485, 0.0121076265, 0.7138906717, 0.0109737003, 0.7192299366, 0.0099072456, 0.7243537903, 0.0089148385, 0.7294540405, 0.0080010723, 0.7347966433, 0.0071472926, 0.7399670482, 0.0063597667, 0.7452815175, 0.0056274058, 0.7507658601, 0.0049713692, 0.7560445666, 0.0043675844, 0.7611588240, 0.0038187695, 0.7660641670, 0.0033189463, 0.7708322406, 0.0028720610, 0.7757387161, 0.0024793372, 0.7805391550, 0.0021251137, 0.7854827642, 0.0018103468, 0.7899774313, 0.0015187903, 0.7946447134, 0.0012690556, 0.7990991473, 0.0010511398, 0.8035400510, 0.0008654242, 0.8076759577, 0.0007036753, 0.8120867014, 0.0005666046, + 0.8164811730, 0.0004523153, 0.8207231164, 0.0003541602, 0.8247153759, 0.0002695376, 0.8287075758, 0.0002026096, 0.8324847817, 0.0001469273, 0.8362858295, 0.0001032155, 0.8403324485, 0.0000688871, 0.8440600038, 0.0000415980, 0.6828498840, 0.1133107096, 0.6612799764, 0.1071796864, 0.6444531679, 0.1016513780, 0.6314000487, 0.0966041908, 0.6213892102, 0.0918990672, 0.6138884425, 0.0875403583, 0.6084533930, 0.0833940655, 0.6047307849, 0.0794104487, 0.6024785638, 0.0756417513, 0.6014752984, 0.0720422193, 0.6015268564, 0.0685731918, 0.6024562716, 0.0651868731, 0.6041424274, 0.0619075485, 0.6064887047, 0.0587494597, + 0.6093679667, 0.0556591898, 0.6127662659, 0.0526482947, 0.6166124940, 0.0497914068, 0.6207857728, 0.0470298007, 0.6251444221, 0.0442896560, 0.6299331784, 0.0416389965, 0.6348870993, 0.0390987769, 0.6399270296, 0.0366538726, 0.6450002789, 0.0343063250, 0.6500691175, 0.0320447460, 0.6553655863, 0.0298144277, 0.6609314680, 0.0276764240, 0.6664909124, 0.0256393924, 0.6729557514, 0.0237140544, 0.6798025966, 0.0218746141, 0.6866818666, 0.0201553460, 0.6933912039, 0.0184896067, 0.7000440359, 0.0169231929, 0.7066715956, 0.0154630756, 0.7131274343, 0.0140752327, 0.7193716764, 0.0127571141, 0.7254905105, 0.0115316892, + 0.7314933538, 0.0103985835, 0.7373275757, 0.0093460530, 0.7428536415, 0.0083551854, 0.7480565310, 0.0074310265, 0.7532916069, 0.0065978244, 0.7587950826, 0.0058365543, 0.7639998794, 0.0051327967, 0.7694051266, 0.0044915108, 0.7748084664, 0.0039113215, 0.7801592350, 0.0034005849, 0.7852807045, 0.0029360221, 0.7902337909, 0.0025214746, 0.7947887778, 0.0021391683, 0.7994536757, 0.0018066252, 0.8041291833, 0.0015152452, 0.8088214397, 0.0012632222, 0.8134342432, 0.0010456251, 0.8182677031, 0.0008597917, 0.8228850365, 0.0006999408, 0.8272863626, 0.0005627283, 0.8313704133, 0.0004407642, 0.8358444571, 0.0003448156, + 0.8400186300, 0.0002636059, 0.8440759778, 0.0001957688, 0.8480694890, 0.0001417663, 0.8520466089, 0.0000998456, 0.8557070494, 0.0000653162, 0.8594460487, 0.0000393721, 0.6758192182, 0.1210423931, 0.6529963613, 0.1143555567, 0.6354991794, 0.1083979383, 0.6221876144, 0.1029943228, 0.6122195125, 0.0980030000, 0.6049796343, 0.0933783427, 0.5999644399, 0.0889669433, 0.5968102813, 0.0848008022, 0.5952337980, 0.0808570385, 0.5949779153, 0.0770617723, 0.5958423018, 0.0734003335, 0.5976262093, 0.0698117241, 0.6002379656, 0.0663700029, 0.6035097241, 0.0629967749, 0.6072897315, 0.0596544780, 0.6115985513, 0.0564789698, + 0.6163970232, 0.0534267463, 0.6215183139, 0.0504089631, 0.6268771291, 0.0474770889, 0.6324344873, 0.0446488485, 0.6383423209, 0.0419208743, 0.6444431543, 0.0393069461, 0.6505136490, 0.0367399529, 0.6564513445, 0.0342182852, 0.6622678638, 0.0317934901, 0.6680426002, 0.0295061544, 0.6744089127, 0.0273193773, 0.6806752086, 0.0252482910, 0.6875143647, 0.0232900660, 0.6946911812, 0.0213956386, 0.7021021247, 0.0196243934, 0.7093586922, 0.0179355685, 0.7164401412, 0.0163291115, 0.7234285474, 0.0148325767, 0.7302662730, 0.0134292906, 0.7369993925, 0.0121289929, 0.7434256673, 0.0108917197, 0.7495988607, 0.0097364802, + 0.7557314038, 0.0086953668, 0.7616212964, 0.0077311378, 0.7672232985, 0.0068389904, 0.7725292444, 0.0060217241, 0.7777373195, 0.0052749324, 0.7832161188, 0.0046213116, 0.7885051370, 0.0040197014, 0.7939132452, 0.0034798372, 0.7992432714, 0.0029828155, 0.8043750525, 0.0025427039, 0.8093755841, 0.0021587496, 0.8141458035, 0.0018205313, 0.8187665343, 0.0015282626, 0.8234326839, 0.0012727517, 0.8281951547, 0.0010497235, 0.8328425884, 0.0008582817, 0.8371044993, 0.0006879673, 0.8415888548, 0.0005473010, 0.8459250331, 0.0004308266, 0.8498783708, 0.0003320338, 0.8540194631, 0.0002517816, 0.8582675457, 0.0001879465, + 0.8623184562, 0.0001349738, 0.8660300970, 0.0000925880, 0.8698731661, 0.0000608820, 0.8738012314, 0.0000369617, 0.6677614450, 0.1293196082, 0.6436279416, 0.1220128685, 0.6254699230, 0.1155876517, 0.6119416356, 0.1097987145, 0.6020770073, 0.1045047641, 0.5951704979, 0.0996073484, 0.5906531811, 0.0949450657, 0.5881454349, 0.0905852318, 0.5873156190, 0.0864432305, 0.5878787637, 0.0824461579, 0.5896025300, 0.0785463750, 0.5923332572, 0.0747921020, 0.5958994031, 0.0711287707, 0.6001066566, 0.0674822628, 0.6049591899, 0.0640100241, 0.6103461981, 0.0606588796, 0.6160657406, 0.0573141910, 0.6220799088, 0.0540471487, + 0.6284632683, 0.0509085692, 0.6350711584, 0.0478755943, 0.6418420672, 0.0449487716, 0.6486355662, 0.0420376658, 0.6555940509, 0.0392113887, 0.6625563502, 0.0365106761, 0.6694840193, 0.0339367911, 0.6762903929, 0.0314709283, 0.6830129623, 0.0291501451, 0.6896812916, 0.0268785711, 0.6965631247, 0.0247369260, 0.7033789754, 0.0226993226, 0.7108353972, 0.0207599178, 0.7184530497, 0.0189289693, 0.7260659933, 0.0172083918, 0.7335909009, 0.0156107042, 0.7407956719, 0.0140810460, 0.7478237748, 0.0126580028, 0.7548012733, 0.0113604274, 0.7616128325, 0.0101615908, 0.7681254745, 0.0090384465, 0.7744467258, 0.0080098202, + 0.7805551887, 0.0070680557, 0.7866377234, 0.0062357541, 0.7923221588, 0.0054590842, 0.7977088094, 0.0047557624, 0.8028844595, 0.0041093780, 0.8080161214, 0.0035313445, 0.8130636811, 0.0030265173, 0.8183357716, 0.0025794702, 0.8236014247, 0.0021889573, 0.8288500905, 0.0018455180, 0.8337972164, 0.0015397600, 0.8384887576, 0.0012748719, 0.8427137733, 0.0010393077, 0.8469634652, 0.0008393746, 0.8514379263, 0.0006738015, 0.8556805849, 0.0005330780, 0.8596257567, 0.0004150026, 0.8638082147, 0.0003197787, 0.8679069281, 0.0002442147, 0.8716041446, 0.0001782737, 0.8754371405, 0.0001263610, 0.8796350360, 0.0000887013, + 0.8835351467, 0.0000579645, 0.8870736957, 0.0000341576, 0.6586403251, 0.1381750405, 0.6331454515, 0.1301755458, 0.6143456101, 0.1232383400, 0.6006554365, 0.1170342788, 0.5909700990, 0.1114367843, 0.5844708085, 0.1062311530, 0.5805497169, 0.1013514027, 0.5787807107, 0.0968055800, 0.5787664056, 0.0924278125, 0.5802193284, 0.0882001966, 0.5828971863, 0.0840954557, 0.5866237879, 0.0801223963, 0.5911596417, 0.0761657581, 0.5964599252, 0.0723678172, 0.6024310589, 0.0687200353, 0.6088311076, 0.0650623441, 0.6156111956, 0.0614756159, 0.6227433681, 0.0580050386, 0.6301351190, 0.0546343699, 0.6376860142, 0.0513382517, + 0.6453074813, 0.0480583273, 0.6529694200, 0.0448897183, 0.6606750488, 0.0418661162, 0.6685479283, 0.0389747247, 0.6765481830, 0.0362318419, 0.6844228506, 0.0335878171, 0.6920517087, 0.0310211945, 0.6994686723, 0.0285786930, 0.7065599561, 0.0262414236, 0.7137948871, 0.0240160190, 0.7208840847, 0.0219248608, 0.7283034325, 0.0199731123, 0.7358478308, 0.0181025881, 0.7435417175, 0.0163553376, 0.7512377501, 0.0147408759, 0.7588426471, 0.0132545009, 0.7661476135, 0.0118548172, 0.7732231021, 0.0105604371, 0.7800908089, 0.0093705636, 0.7869380116, 0.0083086016, 0.7934220433, 0.0073141106, 0.7996959686, 0.0064115743, + 0.8055897355, 0.0055772616, 0.8112328053, 0.0048277960, 0.8168691993, 0.0041797389, 0.8221383095, 0.0035920751, 0.8273866773, 0.0030764840, 0.8326022625, 0.0026156171, 0.8373726606, 0.0022005697, 0.8422442079, 0.0018388964, 0.8470140100, 0.0015186826, 0.8516064286, 0.0012444439, 0.8563005328, 0.0010169671, 0.8606983423, 0.0008209582, 0.8648630381, 0.0006568210, 0.8690846562, 0.0005193860, 0.8736476898, 0.0004085208, 0.8778179884, 0.0003124166, 0.8815495372, 0.0002317006, 0.8855257630, 0.0001717748, 0.8891335130, 0.0001242416, 0.8926637769, 0.0000846181, 0.8964288235, 0.0000546124, 0.9002606869, 0.0000328531, + 0.6484217048, 0.1476421803, 0.6215204000, 0.1388680488, 0.6021102667, 0.1313701123, 0.5883291960, 0.1247357279, 0.5789096951, 0.1188126728, 0.5729131103, 0.1133003086, 0.5696932077, 0.1082202569, 0.5687406063, 0.1034326479, 0.5696430206, 0.0988395140, 0.5720607042, 0.0943559408, 0.5757893920, 0.0900584683, 0.5805322528, 0.0857762098, 0.5861919522, 0.0816406533, 0.5926665664, 0.0776770934, 0.5996833444, 0.0736856610, 0.6071846485, 0.0697676465, 0.6151096821, 0.0659554005, 0.6233602762, 0.0622373186, 0.6318054795, 0.0585728176, 0.6402807832, 0.0549123064, 0.6488484740, 0.0513758957, 0.6575216055, 0.0480036214, + 0.6663361192, 0.0447939821, 0.6751179695, 0.0416911170, 0.6837037802, 0.0386542194, 0.6923775077, 0.0357690752, 0.7009230256, 0.0329941772, 0.7091914415, 0.0303257257, 0.7172253728, 0.0278015379, 0.7249917984, 0.0254215207, 0.7323573232, 0.0231585633, 0.7398635149, 0.0210181475, 0.7470853329, 0.0190354884, 0.7546979189, 0.0171921179, 0.7622717619, 0.0154434815, 0.7698717713, 0.0138217611, 0.7774110436, 0.0123278573, 0.7849078178, 0.0109840501, 0.7920129299, 0.0097196670, 0.7989217043, 0.0085684545, 0.8054538965, 0.0074970289, 0.8118903041, 0.0065443981, 0.8182852268, 0.0057038646, 0.8244334459, 0.0049434565, + 0.8303286433, 0.0042605437, 0.8359420896, 0.0036470618, 0.8411669731, 0.0030945665, 0.8460994959, 0.0026102064, 0.8507212400, 0.0021806161, 0.8554175496, 0.0018083908, 0.8600088954, 0.0014970448, 0.8645736575, 0.0012289373, 0.8691956401, 0.0009992153, 0.8737528920, 0.0008056076, 0.8781651855, 0.0006450281, 0.8823547959, 0.0005060320, 0.8860368729, 0.0003875067, 0.8900179863, 0.0002955223, 0.8943567872, 0.0002241383, 0.8983172774, 0.0001645034, 0.9019544721, 0.0001158289, 0.9053246975, 0.0000784904, 0.9085403085, 0.0000508749, 0.9116362333, 0.0000289758, 0.6370708346, 0.1577536762, 0.6087276936, 0.1481114924, + 0.5887561440, 0.1400054544, 0.5749724507, 0.1329399943, 0.5659171343, 0.1266569346, 0.5605376363, 0.1208664030, 0.5581297278, 0.1155804098, 0.5580947995, 0.1105379909, 0.5599908233, 0.1056696624, 0.5635071397, 0.1010063887, 0.5683156252, 0.0963976756, 0.5742253065, 0.0919097438, 0.5811136365, 0.0876034945, 0.5886970758, 0.0832760856, 0.5968739986, 0.0790102407, 0.6055521965, 0.0748307109, 0.6146286130, 0.0707414746, 0.6239494681, 0.0666844770, 0.6333658695, 0.0626388714, 0.6429500580, 0.0587389618, 0.6527671814, 0.0550528355, 0.6625899673, 0.0514502376, 0.6723920107, 0.0479633436, 0.6819965243, 0.0445361026, + 0.6914630532, 0.0412422009, 0.7007431388, 0.0380609408, 0.7098252773, 0.0350269638, 0.7188336849, 0.0321573280, 0.7277352214, 0.0294442773, 0.7362571955, 0.0268447585, 0.7445613146, 0.0244282130, 0.7524884343, 0.0221545678, 0.7598406076, 0.0199884139, 0.7672806382, 0.0179747343, 0.7743799090, 0.0161175933, 0.7819487453, 0.0144295432, 0.7892320156, 0.0128337592, 0.7964863181, 0.0113674905, 0.8035838008, 0.0100009609, 0.8107714057, 0.0088051474, 0.8177472353, 0.0077190516, 0.8244263530, 0.0067284042, 0.8308418989, 0.0058334288, 0.8368959427, 0.0050188228, 0.8426370621, 0.0042877961, 0.8481502533, 0.0036433772, + 0.8533363342, 0.0030694131, 0.8584534526, 0.0025788054, 0.8634834290, 0.0021596379, 0.8682715893, 0.0017963455, 0.8726594448, 0.0014773458, 0.8772593737, 0.0012060098, 0.8816751242, 0.0009792038, 0.8858352304, 0.0007812508, 0.8898628950, 0.0006113466, 0.8938873410, 0.0004772446, 0.8980472684, 0.0003720635, 0.9017390013, 0.0002817906, 0.9051134586, 0.0002074456, 0.9088296890, 0.0001492884, 0.9125488997, 0.0001044376, 0.9160901904, 0.0000718703, 0.9193519354, 0.0000450122, 0.9227033257, 0.0000274058, 0.6245567203, 0.1685421467, 0.5947448611, 0.1579275280, 0.5742776394, 0.1491626948, 0.5605978966, 0.1416522264, + 0.5520209670, 0.1349894106, 0.5473945737, 0.1289687604, 0.5458998680, 0.1234119460, 0.5469049215, 0.1181391403, 0.5499224663, 0.1130373552, 0.5546025634, 0.1081005782, 0.5606195331, 0.1032381058, 0.5678231716, 0.0985795185, 0.5759164095, 0.0939246044, 0.5847315788, 0.0892994106, 0.5941562653, 0.0847522989, 0.6040551066, 0.0802750289, 0.6142432690, 0.0757981539, 0.6246083379, 0.0713488609, 0.6352649331, 0.0670980662, 0.6461557746, 0.0630255565, 0.6570345163, 0.0590081997, 0.6678162813, 0.0550482236, 0.6785147786, 0.0512144156, 0.6889995337, 0.0474724174, 0.6993075609, 0.0438779816, 0.7094373703, 0.0404525660, + 0.7193681002, 0.0372002721, 0.7289186716, 0.0340610221, 0.7382212281, 0.0311118905, 0.7472530603, 0.0283246581, 0.7560661435, 0.0256706104, 0.7645935416, 0.0232056770, 0.7728222013, 0.0209183209, 0.7807143927, 0.0188083593, 0.7880008817, 0.0168146491, 0.7951685786, 0.0149736209, 0.8019317389, 0.0132631361, 0.8091866970, 0.0117473807, 0.8162435889, 0.0103443665, 0.8228746653, 0.0090604033, 0.8296276927, 0.0078947069, 0.8361088634, 0.0068299212, 0.8423364162, 0.0058775521, 0.8483573794, 0.0050347750, 0.8541637659, 0.0042889770, 0.8597880602, 0.0036362833, 0.8652891517, 0.0030708748, 0.8705929518, 0.0025769579, + 0.8756098747, 0.0021425560, 0.8803856373, 0.0017668706, 0.8850156665, 0.0014504638, 0.8892760873, 0.0011742343, 0.8930501342, 0.0009353652, 0.8970662355, 0.0007430618, 0.9010866284, 0.0005879031, 0.9048055410, 0.0004555187, 0.9084878564, 0.0003444714, 0.9119375348, 0.0002555414, 0.9153557420, 0.0001886108, 0.9185380340, 0.0001348541, 0.9219128489, 0.0000972072, 0.9257523417, 0.0000651089, 0.9294882417, 0.0000426928, 0.9326978922, 0.0000247022, 0.6108458638, 0.1800379604, 0.5795549154, 0.1683356464, 0.5586774945, 0.1588602662, 0.5452268124, 0.1508899629, 0.5372672677, 0.1438618302, 0.5335337520, 0.1376200318, + 0.5330876112, 0.1318020821, 0.5352407098, 0.1262467951, 0.5395132303, 0.1209448501, 0.5454592109, 0.1157134324, 0.5528484583, 0.1106880382, 0.5613870621, 0.1057306007, 0.5707821250, 0.1007291302, 0.5809196830, 0.0957999304, 0.5916290879, 0.0909179151, 0.6026980281, 0.0860047936, 0.6140938997, 0.0811836421, 0.6258534193, 0.0765678957, 0.6377626061, 0.0720216483, 0.6497104764, 0.0675474629, 0.6615031958, 0.0630834550, 0.6732200980, 0.0587578826, 0.6847547889, 0.0545488186, 0.6961104274, 0.0504991449, 0.7073208094, 0.0466463380, 0.7182223797, 0.0429252908, 0.7288185954, 0.0393732190, 0.7390776873, 0.0359910727, + 0.7489147186, 0.0327622779, 0.7585467696, 0.0297681075, 0.7678069472, 0.0269497167, 0.7767377496, 0.0243304539, 0.7851370573, 0.0218494553, 0.7933489084, 0.0195506923, 0.8011675477, 0.0174159165, 0.8087887168, 0.0155005436, 0.8157951236, 0.0137124183, 0.8223913312, 0.0120754149, 0.8288503885, 0.0105822664, 0.8351755738, 0.0092122294, 0.8415421247, 0.0079808338, 0.8476448655, 0.0068878978, 0.8534646034, 0.0059095821, 0.8594475389, 0.0050552110, 0.8652596474, 0.0043052393, 0.8709774613, 0.0036429728, 0.8763741255, 0.0030550009, 0.8815864325, 0.0025468091, 0.8866757751, 0.0021128017, 0.8913260102, 0.0017260161, + 0.8956692815, 0.0013936753, 0.9000749588, 0.0011275071, 0.9042117596, 0.0009007201, 0.9080866575, 0.0007113045, 0.9115476012, 0.0005505478, 0.9151548743, 0.0004242802, 0.9188334942, 0.0003246170, 0.9223274589, 0.0002440642, 0.9261258841, 0.0001827469, 0.9295431376, 0.0001313246, 0.9326043725, 0.0000916770, 0.9351204038, 0.0000607240, 0.9379389882, 0.0000372573, 0.9411149025, 0.0000214885, 0.5959086418, 0.1922696531, 0.5631437302, 0.1793507338, 0.5419694781, 0.1691198349, 0.5288916230, 0.1606747955, 0.5217127204, 0.1533277333, 0.5190151930, 0.1468267739, 0.5197650790, 0.1407662034, 0.5232271552, 0.1350008696, + 0.5288528800, 0.1294129938, 0.5362416506, 0.1239927337, 0.5451020598, 0.1187393442, 0.5550093651, 0.1133669391, 0.5658299327, 0.1080585569, 0.5773526430, 0.1027764678, 0.5893638134, 0.0974619836, 0.6017964482, 0.0922311991, 0.6146512628, 0.0871972367, 0.6276034117, 0.0821364224, 0.6406010389, 0.0771295950, 0.6535039544, 0.0721672103, 0.6662597656, 0.0672932640, 0.6788505912, 0.0625622272, 0.6913170218, 0.0580332428, 0.7035567164, 0.0536708608, 0.7153920531, 0.0494262204, 0.7269072533, 0.0453724377, 0.7381201982, 0.0415297672, 0.7490422726, 0.0379097052, 0.7595446110, 0.0344708823, 0.7697305083, 0.0312604532, + 0.7794297934, 0.0282173082, 0.7886794209, 0.0253668763, 0.7975140214, 0.0227184445, 0.8060748577, 0.0203015152, 0.8141458035, 0.0180529933, 0.8217056990, 0.0159738772, 0.8288530707, 0.0140563985, 0.8355922699, 0.0123059861, 0.8419690132, 0.0107397335, 0.8477998972, 0.0093228137, 0.8534508944, 0.0080567328, 0.8592602015, 0.0069521703, 0.8654468656, 0.0059725149, 0.8711425662, 0.0050830352, 0.8764303327, 0.0042943363, 0.8816981316, 0.0036179358, 0.8868284225, 0.0030158437, 0.8915373087, 0.0024823963, 0.8961872458, 0.0020371517, 0.9009140134, 0.0016716602, 0.9054160118, 0.0013528957, 0.9097098708, 0.0010839504, + 0.9137645960, 0.0008566829, 0.9177870154, 0.0006746736, 0.9215939641, 0.0005249091, 0.9251771569, 0.0004027410, 0.9287185669, 0.0003098287, 0.9319500923, 0.0002303668, 0.9351661205, 0.0001673487, 0.9381834865, 0.0001181739, 0.9414716959, 0.0000823420, 0.9445438981, 0.0000553937, 0.9470009804, 0.0000350744, 0.9498007298, 0.0000206887, 0.5797171593, 0.2052614540, 0.5455055833, 0.1909817904, 0.5241721869, 0.1799641848, 0.5116382837, 0.1710329950, 0.5054208636, 0.1634156853, 0.5039247870, 0.1566515267, 0.5060204864, 0.1503383070, 0.5109516978, 0.1443916261, 0.5180951357, 0.1385780573, 0.5270901918, 0.1330127120, + 0.5374139547, 0.1272858530, 0.5488693714, 0.1216164902, 0.5612197518, 0.1159760952, 0.5741932392, 0.1102698967, 0.5876512527, 0.1045813486, 0.6016041040, 0.0990805775, 0.6156952381, 0.0935192406, 0.6297643185, 0.0879087672, 0.6438151598, 0.0823938102, 0.6576924324, 0.0769441053, 0.6714670658, 0.0716860816, 0.6850754619, 0.0666115880, 0.6982322335, 0.0616031364, 0.7111320496, 0.0568254665, 0.7237070203, 0.0522610582, 0.7359036207, 0.0479048193, 0.7476590872, 0.0437485948, 0.7591013312, 0.0398570411, 0.7699803710, 0.0361335538, 0.7804137468, 0.0326400548, 0.7904704809, 0.0293938704, 0.8001382947, 0.0263845287, + 0.8092810512, 0.0235689469, 0.8179214597, 0.0209553819, 0.8260548711, 0.0185387339, 0.8337320685, 0.0163252968, 0.8411021829, 0.0143343303, 0.8480036855, 0.0125204623, 0.8547940254, 0.0109277675, 0.8612002730, 0.0094955377, 0.8671666980, 0.0081941085, 0.8726304173, 0.0070167584, 0.8777281046, 0.0059893229, 0.8826484084, 0.0050858501, 0.8877215981, 0.0042706323, 0.8925904036, 0.0035555270, 0.8974546194, 0.0029613108, 0.9019660354, 0.0024451292, 0.9063171148, 0.0020032979, 0.9107703567, 0.0016254456, 0.9149904251, 0.0013055773, 0.9190453887, 0.0010399759, 0.9229350686, 0.0008202113, 0.9267264605, 0.0006428575, + 0.9304298162, 0.0005005135, 0.9339654446, 0.0003805999, 0.9372743964, 0.0002830791, 0.9405379891, 0.0002093394, 0.9434874654, 0.0001519289, 0.9462872148, 0.0001073783, 0.9491649270, 0.0000743747, 0.9522976279, 0.0000511702, 0.9554097652, 0.0000328724, 0.9575527906, 0.0000184557, 0.5622437000, 0.2190332264, 0.5266392827, 0.2032328695, 0.5053191781, 0.1914080232, 0.4935216904, 0.1819844395, 0.4884674549, 0.1741477400, 0.4883558452, 0.1671418101, 0.4919989109, 0.1606823206, 0.4985356927, 0.1544855833, 0.5073984265, 0.1485670805, 0.5180094838, 0.1425637156, 0.5300270319, 0.1365722269, 0.5431600809, 0.1305844039, + 0.5570817590, 0.1244841516, 0.5716041327, 0.1183554828, 0.5866841078, 0.1123591959, 0.6019712687, 0.1062736288, 0.6172422171, 0.1000789627, 0.6324502826, 0.0939136371, 0.6475619078, 0.0878706351, 0.6625995040, 0.0820364207, 0.6772645116, 0.0762594864, 0.6916409135, 0.0706810206, 0.7056488395, 0.0652928576, 0.7192472816, 0.0601130649, 0.7323864698, 0.0551457889, 0.7451636791, 0.0504605062, 0.7573145032, 0.0459452979, 0.7690673470, 0.0417179093, 0.7803422213, 0.0377466902, 0.7911487818, 0.0340343416, 0.8013623953, 0.0305401552, 0.8110608459, 0.0272916071, 0.8202005625, 0.0242708512, 0.8289250135, 0.0215100069, + 0.8372190595, 0.0189864691, 0.8453876972, 0.0167421605, 0.8531615138, 0.0146999285, 0.8605912924, 0.0128545351, 0.8674105406, 0.0111536486, 0.8738120794, 0.0096265217, 0.8798934221, 0.0082744714, 0.8854263425, 0.0070527066, 0.8903855085, 0.0059555476, 0.8951941729, 0.0050245244, 0.8996891379, 0.0042239721, 0.9037432671, 0.0035202201, 0.9078031182, 0.0029150594, 0.9122129083, 0.0023838298, 0.9164864421, 0.0019403277, 0.9205836058, 0.0015694883, 0.9243978262, 0.0012565217, 0.9281074405, 0.0010027402, 0.9319385886, 0.0007895419, 0.9355769157, 0.0006127249, 0.9389276505, 0.0004665288, 0.9420853257, 0.0003495231, + 0.9451861978, 0.0002605699, 0.9480547905, 0.0001894063, 0.9509161115, 0.0001371917, 0.9535733461, 0.0000966881, 0.9562777281, 0.0000678825, 0.9587379098, 0.0000437739, 0.9610370398, 0.0000262458, 0.9637341499, 0.0000150583, 0.5434657335, 0.2335977256, 0.5065548420, 0.2160972208, 0.4854526222, 0.2034554332, 0.4746229351, 0.1936136484, 0.4709392190, 0.1855370402, 0.4724186361, 0.1783560067, 0.4777953923, 0.1717654765, 0.4861360788, 0.1654139161, 0.4968256056, 0.1592415869, 0.5092602968, 0.1529517621, 0.5231018662, 0.1466495991, 0.5379547477, 0.1401888281, 0.5535650849, 0.1336452067, 0.5698241591, 0.1271636486, + 0.5863460302, 0.1205144227, 0.6028875113, 0.1137025207, 0.6193831563, 0.1068898290, 0.6358916759, 0.1002676561, 0.6521991491, 0.0937370062, 0.6681124568, 0.0872638524, 0.6837019920, 0.0809919313, 0.6988940835, 0.0749232918, 0.7136125565, 0.0690652803, 0.7278933525, 0.0634779260, 0.7415792346, 0.0580952168, 0.7547236681, 0.0529830493, 0.7673145533, 0.0481497459, 0.7793666720, 0.0436041430, 0.7907521725, 0.0393025465, 0.8015665412, 0.0352850184, 0.8117474318, 0.0315311067, 0.8215976954, 0.0281175729, 0.8312374353, 0.0250383653, 0.8403152823, 0.0221862793, 0.8489799500, 0.0195896272, 0.8570616841, 0.0171939265, + 0.8645409942, 0.0149923600, 0.8717176318, 0.0130294450, 0.8784348369, 0.0112584401, 0.8845844865, 0.0096509205, 0.8905736804, 0.0082545066, 0.8962969780, 0.0070310058, 0.9016932845, 0.0059536239, 0.9067012072, 0.0050037499, 0.9112172127, 0.0041622440, 0.9155108929, 0.0034470430, 0.9195593596, 0.0028406961, 0.9230956435, 0.0023147911, 0.9263226390, 0.0018837948, 0.9296023250, 0.0015197941, 0.9332701564, 0.0012079785, 0.9366855025, 0.0009437054, 0.9399228096, 0.0007302486, 0.9429039955, 0.0005570165, 0.9458526969, 0.0004260920, 0.9489488602, 0.0003192546, 0.9519447088, 0.0002355200, 0.9548781514, 0.0001723313, + 0.9578611851, 0.0001260441, 0.9604732394, 0.0000869797, 0.9627132416, 0.0000562217, 0.9648488164, 0.0000362039, 0.9668019414, 0.0000234672, 0.9691731334, 0.0000135197, 0.5233637691, 0.2489591986, 0.4852719605, 0.2295718640, 0.4646313787, 0.2161020935, 0.4550284445, 0.2059359848, 0.4529525340, 0.1976747364, 0.4562615454, 0.1904363036, 0.4635502994, 0.1836722046, 0.4739254415, 0.1772915274, 0.4865632951, 0.1707618982, 0.5010004044, 0.1642206013, 0.5167352557, 0.1574565172, 0.5334333777, 0.1505353451, 0.5509277582, 0.1436160952, 0.5687232614, 0.1363684088, 0.5866386890, 0.1289492548, 0.6045688987, 0.1215093359, + 0.6225514412, 0.1142458543, 0.6402186751, 0.1069453731, 0.6575539708, 0.0997612625, 0.6744713187, 0.0927286372, 0.6909247637, 0.0858955532, 0.7068797350, 0.0793016478, 0.7222190499, 0.0729196966, 0.7369337082, 0.0667991415, 0.7510269880, 0.0609744526, 0.7644986510, 0.0554569364, 0.7772722840, 0.0502252169, 0.7893706560, 0.0452988148, 0.8009854555, 0.0407429636, 0.8121819496, 0.0365620926, 0.8229335546, 0.0327146910, 0.8330566883, 0.0291403327, 0.8426419497, 0.0258503780, 0.8514666557, 0.0227795728, 0.8597617745, 0.0199831892, 0.8676517010, 0.0174663346, 0.8749504685, 0.0151674971, 0.8818394542, 0.0131123550, + 0.8884447813, 0.0112980418, 0.8947719336, 0.0096970238, 0.9005928636, 0.0082581649, 0.9059286118, 0.0069745095, 0.9110864997, 0.0058698631, 0.9160439968, 0.0049167154, 0.9206486344, 0.0040839287, 0.9250323176, 0.0033737295, 0.9292458296, 0.0027731908, 0.9330171347, 0.0022490949, 0.9363692999, 0.0017990399, 0.9394083023, 0.0014245410, 0.9420943260, 0.0011158341, 0.9445721507, 0.0008779399, 0.9471164346, 0.0006760552, 0.9500063658, 0.0005150196, 0.9526982903, 0.0003857187, 0.9554570913, 0.0002918244, 0.9580802917, 0.0002147162, 0.9602963924, 0.0001517994, 0.9625725150, 0.0001031898, 0.9652353525, 0.0000726265, + 0.9677672386, 0.0000492076, 0.9706230760, 0.0000354582, 0.9729149938, 0.0000216764, 0.9747125506, 0.0000123626, 0.5019233823, 0.2651089728, 0.4628259540, 0.2436427623, 0.4429315627, 0.2293593436, 0.4348466098, 0.2189857960, 0.4346370697, 0.2106152326, 0.4400051534, 0.2033586800, 0.4494771659, 0.1966562271, 0.4619868696, 0.1899761260, 0.4768203795, 0.1832828820, 0.4933570623, 0.1763391197, 0.5111095905, 0.1690977663, 0.5298622847, 0.1617939323, 0.5490139723, 0.1539943814, 0.5683898330, 0.1459675580, 0.5879691839, 0.1380053014, 0.6074716449, 0.1299927682, 0.6266320348, 0.1218895987, 0.6454093456, 0.1138598919, + 0.6637589335, 0.1059961244, 0.6815804839, 0.0983205512, 0.6988076568, 0.0908643380, 0.7153124213, 0.0836197436, 0.7311235666, 0.0766704082, 0.7462612391, 0.0700530633, 0.7607283592, 0.0637803972, 0.7744629979, 0.0578398667, 0.7876508832, 0.0523208119, 0.8002962470, 0.0472032577, 0.8121510744, 0.0423780903, 0.8234848380, 0.0379412211, 0.8340004086, 0.0337762386, 0.8437253833, 0.0298986863, 0.8530639410, 0.0264056399, 0.8616979122, 0.0231841914, 0.8697400093, 0.0202527475, 0.8774085045, 0.0176353995, 0.8848076463, 0.0153182046, 0.8915531039, 0.0132041564, 0.8977680206, 0.0113040190, 0.9038909674, 0.0096640429, + 0.9095773697, 0.0082059242, 0.9148245454, 0.0069145677, 0.9198153615, 0.0057977326, 0.9246400595, 0.0048413118, 0.9289700985, 0.0039947317, 0.9329058528, 0.0032597198, 0.9365848899, 0.0026369945, 0.9401578307, 0.0021211405, 0.9436657429, 0.0017005672, 0.9468202591, 0.0013422015, 0.9497662187, 0.0010485380, 0.9524880052, 0.0008093040, 0.9552434683, 0.0006276196, 0.9576430321, 0.0004788518, 0.9594796896, 0.0003557740, 0.9617527723, 0.0002612605, 0.9639750123, 0.0001885683, 0.9665424824, 0.0001378688, 0.9688871503, 0.0000984010, 0.9711858630, 0.0000711238, 0.9728165865, 0.0000469714, 0.9749408960, 0.0000295557, + 0.9771493077, 0.0000177676, 0.9796831608, 0.0000112353, 0.4791373014, 0.2820260823, 0.4392674863, 0.2582855523, 0.4204544723, 0.2432682663, 0.4141988754, 0.2327729017, 0.4161587656, 0.2245137990, 0.4238315523, 0.2172837257, 0.4357045591, 0.2106281519, 0.4505941868, 0.2038170546, 0.4677630067, 0.1968356967, 0.4864933789, 0.1893653721, 0.5065144897, 0.1817908138, 0.5271205902, 0.1735617965, 0.5480687022, 0.1649811268, 0.5693172812, 0.1564123482, 0.5904054642, 0.1475724727, 0.6111897826, 0.1386358887, 0.6315941811, 0.1297571361, 0.6514729261, 0.1209632978, 0.6708009243, 0.1123780310, 0.6893418431, 0.1039230153, + 0.7071303725, 0.0957353115, 0.7243509293, 0.0879723281, 0.7406756878, 0.0804702193, 0.7561984658, 0.0733323470, 0.7710476518, 0.0666382462, 0.7852416635, 0.0603810847, 0.7985897660, 0.0544733703, 0.8112179041, 0.0489644036, 0.8228712082, 0.0437560156, 0.8339027166, 0.0389771871, 0.8442412019, 0.0345747285, 0.8537783027, 0.0305007584, 0.8628606796, 0.0268329959, 0.8715618849, 0.0235482734, 0.8795039654, 0.0205258336, 0.8869863153, 0.0178151373, 0.8941171765, 0.0154099297, 0.9006752372, 0.0132426387, 0.9067307711, 0.0113072125, 0.9125410318, 0.0096231410, 0.9180036187, 0.0081431605, 0.9229463339, 0.0068258569, + 0.9275224209, 0.0056752879, 0.9318962693, 0.0046937582, 0.9359655380, 0.0038506708, 0.9399398565, 0.0031474151, 0.9435183406, 0.0025391006, 0.9469062090, 0.0020318190, 0.9501745105, 0.0016151803, 0.9534013271, 0.0012789621, 0.9564205408, 0.0010002918, 0.9591935873, 0.0007698621, 0.9618227482, 0.0005853349, 0.9642052650, 0.0004366789, 0.9665166736, 0.0003251397, 0.9686203003, 0.0002390651, 0.9704040289, 0.0001743287, 0.9721766710, 0.0001256434, 0.9740287066, 0.0000869680, 0.9759066105, 0.0000607421, 0.9779693484, 0.0000407256, 0.9798642993, 0.0000266814, 0.9814394712, 0.0000163344, 0.9827718139, 0.0000077274, + 0.4550087452, 0.2996678054, 0.4146704674, 0.2734881639, 0.3973276019, 0.2578884661, 0.3932490945, 0.2474271953, 0.3976759017, 0.2393748909, 0.4079812169, 0.2325052917, 0.4224342704, 0.2257400900, 0.4399264157, 0.2188469619, 0.4595054090, 0.2113310844, 0.4807704389, 0.2036698610, 0.5028568506, 0.1951093525, 0.5254737735, 0.1860788763, 0.5484491587, 0.1768738031, 0.5712670684, 0.1672222316, 0.5938058496, 0.1574147791, 0.6159741879, 0.1476301849, 0.6375626922, 0.1378789097, 0.6584205031, 0.1281996816, 0.6785065532, 0.1187270358, 0.6979253888, 0.1096312478, 0.7163508534, 0.1007501185, 0.7339098454, 0.0922519341, + 0.7506992221, 0.0842216611, 0.7666441202, 0.0766172484, 0.7817800045, 0.0694695115, 0.7959169745, 0.0626852736, 0.8090754151, 0.0562939942, 0.8215162158, 0.0503992215, 0.8330128789, 0.0448882394, 0.8438712955, 0.0398582071, 0.8542256355, 0.0353075229, 0.8638116121, 0.0311157312, 0.8727955222, 0.0273113381, 0.8812727928, 0.0238817520, 0.8890740871, 0.0207647029, 0.8962669373, 0.0179529581, 0.9031941295, 0.0154878953, 0.9095600843, 0.0132743223, 0.9153257012, 0.0112882378, 0.9206958413, 0.0095423982, 0.9256688952, 0.0080143427, 0.9303355813, 0.0066911476, 0.9347745180, 0.0055574076, 0.9387677312, 0.0045662578, + 0.9425720572, 0.0037292130, 0.9463666677, 0.0030389156, 0.9500126243, 0.0024606735, 0.9533733726, 0.0019694192, 0.9564483762, 0.0015552511, 0.9592347741, 0.0012096402, 0.9617866874, 0.0009263702, 0.9643266201, 0.0007067516, 0.9669620991, 0.0005392343, 0.9693573117, 0.0004031571, 0.9717171788, 0.0003007864, 0.9737797976, 0.0002171404, 0.9757620692, 0.0001554656, 0.9776006341, 0.0001095169, 0.9790745974, 0.0000739453, 0.9801864624, 0.0000501494, 0.9819086790, 0.0000335461, 0.9831682444, 0.0000201468, 0.9843743443, 0.0000107903, 0.9860820770, 0.0000067574, 0.4295528829, 0.3179740608, 0.3891335428, 0.2892118394, + 0.3737014830, 0.2732397318, 0.3721817136, 0.2630480230, 0.3794078827, 0.2554164529, 0.3925849199, 0.2488110662, 0.4099167287, 0.2422077656, 0.4301170409, 0.2349490374, 0.4525031745, 0.2273909599, 0.4760582745, 0.2186622173, 0.5004007816, 0.2093086541, 0.5252017379, 0.1995334029, 0.5498922467, 0.1891100109, 0.5743714571, 0.1784687489, 0.5983711481, 0.1676451117, 0.6218081713, 0.1568516195, 0.6444049478, 0.1460485458, 0.6662778854, 0.1355422884, 0.6871027350, 0.1251765341, 0.7069930434, 0.1151762232, 0.7260304689, 0.1056574658, 0.7440614104, 0.0965385735, 0.7611909509, 0.0879217684, 0.7771300077, 0.0796566084, + 0.7920836210, 0.0718935430, 0.8060777783, 0.0646306649, 0.8192279339, 0.0579014383, 0.8317824602, 0.0517702848, 0.8434532881, 0.0460799187, 0.8543491364, 0.0408545509, 0.8644762039, 0.0360642560, 0.8738109469, 0.0316775106, 0.8824453354, 0.0276933778, 0.8907030821, 0.0241581406, 0.8982226253, 0.0209398828, 0.9051609635, 0.0180517547, 0.9114596248, 0.0154571161, 0.9173189998, 0.0131688211, 0.9228582382, 0.0111727715, 0.9279469848, 0.0094141522, 0.9326192141, 0.0078757731, 0.9372974634, 0.0065832222, 0.9416669607, 0.0054646144, 0.9457525015, 0.0045033949, 0.9493892193, 0.0036666207, 0.9528068900, 0.0029590370, + 0.9559228420, 0.0023606576, 0.9588055015, 0.0018630327, 0.9617281556, 0.0014687661, 0.9643964171, 0.0011407570, 0.9668939114, 0.0008754380, 0.9692835808, 0.0006647510, 0.9714336991, 0.0004937083, 0.9736284018, 0.0003663847, 0.9756047726, 0.0002647599, 0.9774077535, 0.0001862283, 0.9790746570, 0.0001273805, 0.9809178710, 0.0000904471, 0.9824937582, 0.0000603874, 0.9838786721, 0.0000383410, 0.9850273728, 0.0000230572, 0.9860813022, 0.0000166070, 0.9879530072, 0.0000121263, 0.9892121553, 0.0000067960, 0.4028021097, 0.3368509114, 0.3627848029, 0.3053886294, 0.3497577608, 0.2893529236, 0.3512147367, 0.2797809541, + 0.3616237342, 0.2729508579, 0.3779467344, 0.2666350901, 0.3983339369, 0.2599770427, 0.4216189086, 0.2528210282, 0.4465919435, 0.2442157865, 0.4726910293, 0.2347482294, 0.4993819594, 0.2244857252, 0.5260679722, 0.2133491486, 0.5526401997, 0.2019024044, 0.5787329674, 0.1901276261, 0.6040819287, 0.1781200767, 0.6286510229, 0.1661915332, 0.6521947980, 0.1543094963, 0.6747093797, 0.1426882148, 0.6962905526, 0.1315254569, 0.7167686820, 0.1207451746, 0.7362041473, 0.1104556993, 0.7542919517, 0.1005047262, 0.7714173794, 0.0911854580, 0.7873381376, 0.0823495835, 0.8025152683, 0.0742304176, 0.8167346120, 0.0666686520, + 0.8299572468, 0.0596293695, 0.8422506452, 0.0531171151, 0.8535941839, 0.0471003242, 0.8641380668, 0.0416034870, 0.8741063476, 0.0366522111, 0.8832648396, 0.0321263522, 0.8916063309, 0.0279983599, 0.8992027044, 0.0242624208, 0.9063257575, 0.0209493209, 0.9129618406, 0.0180088878, 0.9190510511, 0.0153905489, 0.9249319434, 0.0131227970, 0.9305362701, 0.0111451345, 0.9357043505, 0.0094045047, 0.9403314590, 0.0078645647, 0.9444916248, 0.0065177735, 0.9482677579, 0.0053535565, 0.9517099261, 0.0043567959, 0.9551137090, 0.0035359152, 0.9582691789, 0.0028424552, 0.9610973597, 0.0022546079, 0.9638658762, 0.0017791868, + 0.9663540125, 0.0013820793, 0.9687975645, 0.0010667067, 0.9710245132, 0.0008093365, 0.9730492234, 0.0006023836, 0.9749188423, 0.0004396302, 0.9767073393, 0.0003160191, 0.9785848856, 0.0002284868, 0.9803804159, 0.0001613963, 0.9820633531, 0.0001112230, 0.9835931659, 0.0000741449, 0.9852041006, 0.0000512352, 0.9867466092, 0.0000347601, 0.9883210063, 0.0000245634, 0.9897513986, 0.0000162361, 0.9907686114, 0.0000092153, 0.9915582538, 0.0000051382, 0.3748117685, 0.3561698198, 0.3357924521, 0.3219901025, 0.3257218599, 0.3063445091, 0.3305975497, 0.2977919281, 0.3445270061, 0.2918660045, 0.3643317521, 0.2861338556, + 0.3880990446, 0.2797036171, 0.4143409133, 0.2716515958, 0.4421614707, 0.2623547614, 0.4708186090, 0.2518313527, 0.4996829927, 0.2402103096, 0.5284371972, 0.2279102653, 0.5567405224, 0.2151295841, 0.5842107534, 0.2019096613, 0.6107813716, 0.1886208653, 0.6362388134, 0.1753526330, 0.6606855392, 0.1624439508, 0.6839985251, 0.1498956531, 0.7061311007, 0.1377735138, 0.7267579436, 0.1259466857, 0.7462121844, 0.1147421002, 0.7645477057, 0.1042007431, 0.7819052935, 0.0943806544, 0.7980518937, 0.0851243064, 0.8131128550, 0.0764910802, 0.8270100355, 0.0684246197, 0.8399627805, 0.0610000491, 0.8521573544, 0.0542403050, + 0.8633836508, 0.0480081439, 0.8735846281, 0.0422608890, 0.8829435110, 0.0370322354, 0.8916826248, 0.0323416404, 0.8999119997, 0.0281599946, 0.9076870084, 0.0244429372, 0.9149597287, 0.0211351495, 0.9215239286, 0.0181548763, 0.9275005460, 0.0154990321, 0.9328750372, 0.0131358495, 0.9377401471, 0.0110546676, 0.9421601295, 0.0092362193, 0.9463954568, 0.0076885414, 0.9503310323, 0.0063569699, 0.9538419247, 0.0052028093, 0.9571720362, 0.0042329002, 0.9601951241, 0.0034080513, 0.9631183743, 0.0027279449, 0.9657254815, 0.0021535817, 0.9681500793, 0.0016801860, 0.9704716206, 0.0012970264, 0.9725710154, 0.0009854112, + 0.9747071266, 0.0007475654, 0.9766274095, 0.0005553961, 0.9783676267, 0.0004035490, 0.9799764752, 0.0002867682, 0.9814773798, 0.0001989686, 0.9831411242, 0.0001415492, 0.9846317172, 0.0000968996, 0.9861598611, 0.0000675147, 0.9876542687, 0.0000466278, 0.9889514446, 0.0000299501, 0.9901375175, 0.0000180913, 0.9915391803, 0.0000123173, 0.9928011298, 0.0000074759, 0.9937182069, 0.0000037962, 0.3456684947, 0.3757620156, 0.3083725572, 0.3390566707, 0.3018657863, 0.3244251311, 0.3106606603, 0.3175562024, 0.3284695446, 0.3126911223, 0.3520196378, 0.3074820340, 0.3792413771, 0.3006980121, 0.4086720943, 0.2920255661, + 0.4393321574, 0.2815938592, 0.4705008566, 0.2697565854, 0.5015938282, 0.2567320764, 0.5321742892, 0.2428057194, 0.5620033741, 0.2284325212, 0.5906870961, 0.2136269361, 0.6183449626, 0.1989969462, 0.6448828578, 0.1846539229, 0.6700015068, 0.1704972237, 0.6935457587, 0.1566078067, 0.7157613635, 0.1433284581, 0.7368538380, 0.1308427304, 0.7566435337, 0.1190056950, 0.7751367092, 0.1078329384, 0.7922546864, 0.0972791612, 0.8081983328, 0.0874539912, 0.8232399225, 0.0784466937, 0.8370624781, 0.0700415298, 0.8496754169, 0.0622300506, 0.8613464832, 0.0550911389, 0.8724425435, 0.0486893430, 0.8826978207, 0.0428603925, + 0.8922936916, 0.0376153737, 0.9009933472, 0.0328291245, 0.9089843035, 0.0285220500, 0.9161811471, 0.0246292315, 0.9226957560, 0.0211448427, 0.9286082387, 0.0180480368, 0.9341721535, 0.0153497830, 0.9393146634, 0.0129859680, 0.9439063072, 0.0108996732, 0.9481874704, 0.0091009280, 0.9522742033, 0.0075627640, 0.9560440779, 0.0062409104, 0.9593756199, 0.0050960314, 0.9623704553, 0.0041195611, 0.9650843143, 0.0032958232, 0.9675561786, 0.0026078469, 0.9700166583, 0.0020553076, 0.9722188711, 0.0015958622, 0.9742058516, 0.0012198947, 0.9760274291, 0.0009176950, 0.9777065516, 0.0006785332, 0.9794814587, 0.0005023942, + 0.9810927510, 0.0003635740, 0.9825709462, 0.0002571074, 0.9842093587, 0.0001854830, 0.9855946302, 0.0001275596, 0.9868596196, 0.0000847821, 0.9882060289, 0.0000574052, 0.9895711541, 0.0000391236, 0.9907512069, 0.0000249086, 0.9918331504, 0.0000149646, 0.9928418398, 0.0000083437, 0.9941357374, 0.0000060063, 0.9953106046, 0.0000033756, 0.3154986501, 0.3954105973, 0.2808017731, 0.3567188978, 0.2785034776, 0.3438176215, 0.2916857302, 0.3390407860, 0.3137451112, 0.3354999721, 0.3413384855, 0.3308845758, 0.3721061051, 0.3234398365, 0.4047520757, 0.3136959970, 0.4382525682, 0.3019153476, 0.4718726873, 0.2884637117, + 0.5049238205, 0.2735021710, 0.5371436477, 0.2577345073, 0.5683011413, 0.2415857315, 0.5983524919, 0.2254892439, 0.6269034743, 0.2093114555, 0.6537669301, 0.1932244003, 0.6792406440, 0.1777566671, 0.7033753395, 0.1630205363, 0.7260121703, 0.1489144713, 0.7471247911, 0.1354716718, 0.7667750120, 0.1227693334, 0.7853109241, 0.1110117137, 0.8024312854, 0.0999501273, 0.8181807399, 0.0896040946, 0.8328956366, 0.0801133215, 0.8466996551, 0.0714526325, 0.8594253659, 0.0634815097, 0.8712440133, 0.0562148653, 0.8820182681, 0.0495473556, 0.8918344378, 0.0434655696, 0.9007375240, 0.0379406400, 0.9088292718, 0.0329577401, + 0.9163574576, 0.0285330694, 0.9234028459, 0.0246184412, 0.9297581315, 0.0211131498, 0.9356062412, 0.0180232059, 0.9410061836, 0.0153114684, 0.9458549619, 0.0129168602, 0.9501929283, 0.0108155031, 0.9541004896, 0.0089887297, 0.9576318264, 0.0074125780, 0.9608467817, 0.0060652415, 0.9639586210, 0.0049414295, 0.9666893482, 0.0039784387, 0.9691457152, 0.0031680798, 0.9713740945, 0.0024939454, 0.9734299183, 0.0019412246, 0.9755316973, 0.0015063882, 0.9773474932, 0.0011460246, 0.9791294932, 0.0008652591, 0.9808304310, 0.0006453276, 0.9823196530, 0.0004694195, 0.9838122725, 0.0003386223, 0.9852957726, 0.0002421311, + 0.9865874052, 0.0001673909, 0.9877691865, 0.0001123749, 0.9888717532, 0.0000731959, 0.9899103045, 0.0000461352, 0.9909015894, 0.0000281241, 0.9922511578, 0.0000209097, 0.9932992458, 0.0000132393, 0.9942442775, 0.0000076729, 0.9951249957, 0.0000039331, 0.9959416389, 0.0000015847, 0.2844808996, 0.4148354232, 0.2534020245, 0.3749975562, 0.2560422122, 0.3651687205, 0.2741261721, 0.3630917966, 0.3008496761, 0.3612207174, 0.3324877024, 0.3561323881, 0.3669803143, 0.3479699194, 0.4028387666, 0.3368095756, 0.4390402436, 0.3231219947, 0.4748067260, 0.3074170649, 0.5096689463, 0.2903659344, 0.5435130596, 0.2728431821, + 0.5759224892, 0.2548686266, 0.6065188050, 0.2365553975, 0.6356405020, 0.2187534273, 0.6632637382, 0.2015873194, 0.6891878247, 0.1849671602, 0.7133308053, 0.1689413637, 0.7360932827, 0.1539194137, 0.7573674321, 0.1397564262, 0.7769946456, 0.1263388097, 0.7953487039, 0.1139103919, 0.8124769926, 0.1024122387, 0.8283820748, 0.0917836949, 0.8430153728, 0.0819351226, 0.8564770818, 0.0728693828, 0.8687201738, 0.0645106211, 0.8799197674, 0.0568813644, 0.8903785944, 0.0500236526, 0.9000220299, 0.0438369811, 0.9086884856, 0.0382078066, 0.9166768789, 0.0331784710, 0.9240693450, 0.0287049338, 0.9306672812, 0.0246812496, + 0.9366070032, 0.0211000238, 0.9419633746, 0.0179341417, 0.9468008280, 0.0151514737, 0.9513071179, 0.0127446158, 0.9553819299, 0.0106479190, 0.9590119123, 0.0088251429, 0.9622727633, 0.0072559286, 0.9652080536, 0.0059154197, 0.9680716395, 0.0048036892, 0.9705865979, 0.0038556366, 0.9728754759, 0.0030643025, 0.9751217961, 0.0024221579, 0.9770485163, 0.0018832583, 0.9790571928, 0.0014601832, 0.9807529449, 0.0011091938, 0.9822676778, 0.0008276076, 0.9836468101, 0.0006061418, 0.9849173427, 0.0004350694, 0.9860931039, 0.0003053835, 0.9872428775, 0.0002107970, 0.9885838628, 0.0001487482, 0.9896829128, 0.0000998193, + 0.9906787872, 0.0000647034, 0.9916098714, 0.0000405671, 0.9924880266, 0.0000245580, 0.9933229685, 0.0000142940, 0.9941215515, 0.0000079253, 0.9948847294, 0.0000040941, 0.9956132174, 0.0000018614, 0.9969779849, 0.0000026437, 0.2528620362, 0.4337247908, 0.2265686542, 0.3941317797, 0.2348817885, 0.3887815177, 0.2583470345, 0.3898866773, 0.2899202704, 0.3890300393, 0.3258871138, 0.3837856352, 0.3640395701, 0.3741640151, 0.4029197693, 0.3607942760, 0.4415558577, 0.3446069956, 0.4793441892, 0.3265319765, 0.5159847140, 0.3074446321, 0.5507585406, 0.2871858776, 0.5839761496, 0.2670975924, 0.6155295968, 0.2473731488, + 0.6452108622, 0.2280282676, 0.6730033755, 0.2092813253, 0.6993299127, 0.1916447580, 0.7236865759, 0.1746376753, 0.7464795113, 0.1586877108, 0.7677648664, 0.1437699199, 0.7876050472, 0.1298738569, 0.8058913350, 0.1168677360, 0.8227162361, 0.1047690287, 0.8382609487, 0.0936163589, 0.8525453806, 0.0833556503, 0.8657656312, 0.0740019903, 0.8777870536, 0.0654134825, 0.8888970017, 0.0576484054, 0.8991112113, 0.0506243445, 0.9083071947, 0.0442334637, 0.9166301489, 0.0384715870, 0.9241698980, 0.0333049521, 0.9310054779, 0.0286962558, 0.9373812675, 0.0246476512, 0.9430443048, 0.0210351702, 0.9481297135, 0.0178464670, + 0.9527028203, 0.0150493681, 0.9570074081, 0.0126433270, 0.9608253241, 0.0105403773, 0.9642859697, 0.0087284744, 0.9675266743, 0.0071889483, 0.9705888629, 0.0058881450, 0.9732066393, 0.0047658877, 0.9755194783, 0.0038165008, 0.9775881171, 0.0030229534, 0.9794495702, 0.0023665614, 0.9811309576, 0.0018293308, 0.9827144146, 0.0013985835, 0.9843696356, 0.0010652953, 0.9857506156, 0.0007930931, 0.9869874716, 0.0005789346, 0.9881151915, 0.0004140279, 0.9891560078, 0.0002895758, 0.9901239276, 0.0001976415, 0.9910304546, 0.0001313179, 0.9918836355, 0.0000847277, 0.9926918149, 0.0000529708, 0.9934598804, 0.0000320472, + 0.9941923618, 0.0000187729, 0.9948933125, 0.0000106880, 0.9958515167, 0.0000095014, 0.9968150258, 0.0000077151, 0.9975556731, 0.0000044905, 0.9982447624, 0.0000020471, 0.2209779471, 0.4517399073, 0.2007814497, 0.4146941006, 0.2155106813, 0.4154644608, 0.2448253781, 0.4201773703, 0.2814225852, 0.4198411107, 0.3216159642, 0.4132845104, 0.3632089496, 0.4012444019, 0.4048297703, 0.3850408494, 0.4457082152, 0.3661398888, 0.4850612283, 0.3449828327, 0.5227450728, 0.3229788542, 0.5586956739, 0.3008663952, 0.5926115513, 0.2787354290, 0.6246055961, 0.2571889162, 0.6547551155, 0.2364679128, 0.6828001142, 0.2164311111, + 0.7091723084, 0.1975898445, 0.7338026762, 0.1798310280, 0.7566022277, 0.1630482823, 0.7777719498, 0.1473672986, 0.7971864343, 0.1326553971, 0.8152548075, 0.1191259921, 0.8318507075, 0.1065941975, 0.8471662998, 0.0950958505, 0.8613021374, 0.0845808163, 0.8741220832, 0.0749050751, 0.8857962489, 0.0660792738, 0.8964250088, 0.0580680184, 0.9062191844, 0.0508725010, 0.9151172042, 0.0443821140, 0.9231364727, 0.0385382958, 0.9303806424, 0.0333090015, 0.9370938540, 0.0286970008, 0.9431052804, 0.0245863236, 0.9485911727, 0.0209695660, 0.9537892342, 0.0178338718, 0.9582976699, 0.0150454566, 0.9622859955, 0.0126029057, + 0.9658398032, 0.0104820812, 0.9690132141, 0.0086533567, 0.9718485475, 0.0070870901, 0.9745807648, 0.0057781716, 0.9770013690, 0.0046653496, 0.9791109562, 0.0037245220, 0.9809836149, 0.0029401670, 0.9826586246, 0.0022932987, 0.9841646552, 0.0017655272, 0.9855226874, 0.0013398362, 0.9867540002, 0.0010007562, 0.9878731966, 0.0007343925, 0.9888986349, 0.0005283685, 0.9898418188, 0.0003717779, 0.9907132983, 0.0002550963, 0.9915246964, 0.0001701030, 0.9922835231, 0.0001097910, 0.9929989576, 0.0000682753, 0.9938796163, 0.0000461641, 0.9948120713, 0.0000327317, 0.9955267310, 0.0000205795, 0.9961782098, 0.0000123750, + 0.9967944026, 0.0000071451, 0.9973840714, 0.0000038937, 0.9979541302, 0.0000019051, 0.9985118508, 0.0000007296, 0.1892767549, 0.4685880542, 0.1765985340, 0.4375454783, 0.1984555721, 0.4460583925, 0.2338981032, 0.4538721740, 0.2755780816, 0.4532123506, 0.3198340833, 0.4442977905, 0.3645429909, 0.4288890362, 0.4086864889, 0.4095131457, 0.4511176944, 0.3866304755, 0.4919299185, 0.3627788723, 0.5306304097, 0.3381305337, 0.5673761964, 0.3138229251, 0.6018335819, 0.2897152305, 0.6342487335, 0.2665282786, 0.6646714211, 0.2444016635, 0.6930916905, 0.2233534157, 0.7194137573, 0.2033051401, 0.7437788844, 0.1844147891, + 0.7664428949, 0.1668379754, 0.7873279452, 0.1504179388, 0.8068056703, 0.1353303790, 0.8245747685, 0.1212626547, 0.8408507109, 0.1082842126, 0.8557525873, 0.0963713378, 0.8695535660, 0.0855625495, 0.8820832968, 0.0756644979, 0.8934751153, 0.0666591451, 0.9039675593, 0.0585574582, 0.9134880900, 0.0512332246, 0.9223433137, 0.0447162911, 0.9303614497, 0.0388555080, 0.9374850988, 0.0335772783, 0.9438719153, 0.0288702678, 0.9496071935, 0.0246960446, 0.9547500014, 0.0210122447, 0.9596135616, 0.0178265609, 0.9638332129, 0.0150086302, 0.9675732851, 0.0125503698, 0.9708994627, 0.0104215145, 0.9738604426, 0.0085897213, + 0.9764957428, 0.0070237601, 0.9788402319, 0.0056941812, 0.9809261560, 0.0045735748, 0.9827839136, 0.0036365446, 0.9844390750, 0.0028597591, 0.9859154820, 0.0022218651, 0.9872375727, 0.0017034312, 0.9884235859, 0.0012868869, 0.9894913435, 0.0009564455, 0.9904562831, 0.0006980139, 0.9913345575, 0.0004991118, 0.9924328327, 0.0003634312, 0.9933406711, 0.0002557298, 0.9940991402, 0.0001735518, 0.9947867393, 0.0001142881, 0.9954252243, 0.0000730082, 0.9960258603, 0.0000452167, 0.9965932965, 0.0000271762, 0.9971351027, 0.0000159145, 0.9976544976, 0.0000091591, 0.9981546998, 0.0000052483, 0.9986385703, 0.0000030349, + 0.9991080761, 0.0000017850, 0.9995688200, 0.0000010741, 0.1583418995, 0.4839507341, 0.1546721309, 0.4641346335, 0.1843098849, 0.4817442298, 0.2260160148, 0.4914937615, 0.2725480199, 0.4886892736, 0.3204086125, 0.4758239388, 0.3677670956, 0.4560553432, 0.4136511981, 0.4321652353, 0.4576137066, 0.4060702026, 0.4994890094, 0.3792467415, 0.5389128327, 0.3519591391, 0.5761472583, 0.3253937066, 0.6111502051, 0.2997170091, 0.6437746286, 0.2748950124, 0.6740717292, 0.2511502504, 0.7023214102, 0.2288112640, 0.7286114097, 0.2078929096, 0.7529135346, 0.1882632822, 0.7752798796, 0.1699076742, 0.7958758473, 0.1528705508, + 0.8149934411, 0.1372416615, 0.8324648142, 0.1227730364, 0.8484911323, 0.1094950810, 0.8633015752, 0.0974139124, 0.8770170212, 0.0864656717, 0.8894765973, 0.0764526874, 0.9007127881, 0.0673133731, 0.9108887911, 0.0590368025, 0.9201166034, 0.0515799485, 0.9286790490, 0.0449495874, 0.9362737536, 0.0389629789, 0.9430879354, 0.0336151905, 0.9492039680, 0.0288620424, 0.9546859264, 0.0246559996, 0.9595885277, 0.0209504869, 0.9639668465, 0.0177009739, 0.9678700566, 0.0148650650, 0.9713417888, 0.0124028046, 0.9744239450, 0.0102766585, 0.9771574736, 0.0084514581, 0.9795777798, 0.0068944646, 0.9817188978, 0.0055752872, + 0.9836119413, 0.0044658175, 0.9852842093, 0.0035401778, 0.9867640138, 0.0027746602, 0.9884127378, 0.0021777693, 0.9896796942, 0.0016722787, 0.9907695055, 0.0012629348, 0.9917318821, 0.0009376520, 0.9925915003, 0.0006832578, 0.9933667183, 0.0004876085, 0.9940688610, 0.0003399050, 0.9947105646, 0.0002307155, 0.9953026772, 0.0001519172, 0.9958517551, 0.0000966144, 0.9963653088, 0.0000590450, 0.9968495965, 0.0000344840, 0.9973086715, 0.0000191416, 0.9977470636, 0.0000100614, 0.9981681108, 0.0000050165, 0.9985734820, 0.0000024043, 0.9989649057, 0.0000011415, 0.9993474483, 0.0000005571, 0.9997205138, 0.0000002864, + 0.1289193928, 0.4980921149, 0.1357132345, 0.4963872433, 0.1735292971, 0.5229296088, 0.2213153839, 0.5321257710, 0.2721911371, 0.5249820352, 0.3229746222, 0.5063371062, 0.3724419773, 0.4817118645, 0.4198370278, 0.4536152184, 0.4648190737, 0.4238514304, 0.5074251294, 0.3940341175, 0.5475689769, 0.3646536469, 0.5849445462, 0.3356804252, 0.6199213266, 0.3080135286, 0.6526116133, 0.2818238735, 0.6828910708, 0.2569105327, 0.7109127045, 0.2334457487, 0.7369729877, 0.2116390765, 0.7609928846, 0.1912639290, 0.7832308412, 0.1724327803, 0.8038197756, 0.1550883204, 0.8228952885, 0.1391694844, 0.8402244449, 0.1243967786, + 0.8560564518, 0.1108339280, 0.8706966639, 0.0985301957, 0.8839732409, 0.0872640088, 0.8960197568, 0.0770081133, 0.9069515467, 0.0677149966, 0.9168552160, 0.0593237616, 0.9258102179, 0.0517723747, 0.9338893890, 0.0449998789, 0.9411635995, 0.0389472060, 0.9476972222, 0.0335575677, 0.9535514712, 0.0287767015, 0.9587855339, 0.0245528743, 0.9634524584, 0.0208370462, 0.9676053524, 0.0175827928, 0.9712911248, 0.0147464573, 0.9745559692, 0.0122870058, 0.9777485728, 0.0102164438, 0.9803858995, 0.0084037455, 0.9826765656, 0.0068523679, 0.9846827388, 0.0055373516, 0.9864397645, 0.0044317031, 0.9879828691, 0.0035097920, + 0.9893349409, 0.0027479336, 0.9905229211, 0.0021244502, 0.9915668964, 0.0016196525, 0.9924881458, 0.0012157764, 0.9933032990, 0.0008968979, 0.9940266609, 0.0006488465, 0.9946739078, 0.0004591096, 0.9952556491, 0.0003167330, 0.9957834482, 0.0002122251, 0.9962663054, 0.0001374533, 0.9967105389, 0.0000855423, 0.9971251488, 0.0000507702, 0.9975129962, 0.0000284636, 0.9978808761, 0.0000148928, 0.9982309937, 0.0000071651, 0.9985668659, 0.0000031185, 0.9988901615, 0.0000012144, 0.9992024899, 0.0000004298, 0.9995064139, 0.0000001494, 0.9998037815, 0.0000000569, 0.1018995270, 0.5119493604, 0.1204551458, 0.5367293358, + 0.1665122062, 0.5698357821, 0.2197789699, 0.5745861530, 0.2740872502, 0.5599123240, 0.3271969557, 0.5350105762, 0.3782592714, 0.5052009821, 0.4268113077, 0.4730774164, 0.4725955129, 0.4399955869, 0.5155088902, 0.4070076644, 0.5557756424, 0.3751251400, 0.5932846069, 0.3443393111, 0.6281780601, 0.3150286674, 0.6606920958, 0.2874677777, 0.6908697486, 0.2615966797, 0.7190285921, 0.2376135141, 0.7450395823, 0.2151887268, 0.7689363360, 0.1942503750, 0.7911050916, 0.1749960780, 0.8114024997, 0.1571397483, 0.8300028443, 0.1406891346, 0.8470346332, 0.1255936325, 0.8626038432, 0.1117840633, 0.8768094778, 0.0991872028, + 0.8897451162, 0.0877293199, 0.9014986157, 0.0773373321, 0.9121558070, 0.0679397732, 0.9217980504, 0.0594672449, 0.9304996729, 0.0518526137, 0.9383364320, 0.0450314283, 0.9454008937, 0.0389503017, 0.9519870877, 0.0336098261, 0.9576946497, 0.0288146138, 0.9627627134, 0.0245741960, 0.9672629833, 0.0208443459, 0.9712521434, 0.0175791942, 0.9747782946, 0.0147348493, 0.9778897166, 0.0122698788, 0.9806256890, 0.0101454062, 0.9830258489, 0.0083252024, 0.9851278067, 0.0067755873, 0.9869635701, 0.0054654046, 0.9885633588, 0.0043659192, 0.9899569750, 0.0034507462, 0.9911683798, 0.0026957558, 0.9922232628, 0.0020790112, + 0.9931397438, 0.0015806408, 0.9939391017, 0.0011827587, 0.9946362376, 0.0008693638, 0.9952496290, 0.0006262420, 0.9957901239, 0.0004408594, 0.9962700605, 0.0003022657, 0.9967004061, 0.0002009856, 0.9970889688, 0.0001289166, 0.9974448681, 0.0000792225, 0.9977719188, 0.0000462272, 0.9980770946, 0.0000253078, 0.9983648062, 0.0000127872, 0.9986380935, 0.0000058264, 0.9988996983, 0.0000023154, 0.9991502762, 0.0000007654, 0.9993939996, 0.0000001988, 0.9996289611, 0.0000000407, 0.9998611808, 0.0000000086, 0.0782765299, 0.5282348394, 0.1095081642, 0.5869820118, 0.1632252485, 0.6200850606, 0.2209172994, 0.6157459617, + 0.2779698074, 0.5930348635, 0.3327883184, 0.5614302158, 0.3849449456, 0.5263388157, 0.4339958429, 0.4896054864, 0.4801399112, 0.4533179104, 0.5231977105, 0.4177325964, 0.5634176135, 0.3836754858, 0.6010584831, 0.3516000807, 0.6361391544, 0.3213518858, 0.6686044931, 0.2927654386, 0.6987650394, 0.2661050856, 0.7265763283, 0.2411532998, 0.7522439957, 0.2179761827, 0.7759016156, 0.1965218335, 0.7976667285, 0.1767200977, 0.8176565170, 0.1584929377, 0.8359829187, 0.1417597830, 0.8527503014, 0.1264377832, 0.8680626154, 0.1124440953, 0.8820177913, 0.0996974558, 0.8949809074, 0.0882465765, 0.9065597057, 0.0777636170, + 0.9170292616, 0.0682826117, 0.9264815450, 0.0597388148, 0.9349991679, 0.0520648099, 0.9426528811, 0.0451945588, 0.9495154619, 0.0390649214, 0.9556520581, 0.0336154699, 0.9611221552, 0.0287890118, 0.9659871459, 0.0245312639, 0.9702976942, 0.0207910258, 0.9741075039, 0.0175201427, 0.9774652123, 0.0146733820, 0.9804133773, 0.0122084040, 0.9829942584, 0.0100857206, 0.9852464199, 0.0082685761, 0.9872061014, 0.0067228987, 0.9889048934, 0.0054172114, 0.9903761148, 0.0043225130, 0.9916462898, 0.0034122171, 0.9927399755, 0.0026620482, 0.9936794043, 0.0020499271, 0.9944882989, 0.0015559087, 0.9951827526, 0.0011620381, + 0.9957814813, 0.0008522768, 0.9962989092, 0.0006123880, 0.9967475533, 0.0004298321, 0.9971392155, 0.0002936650, 0.9974869490, 0.0001944293, 0.9977941513, 0.0001240467, 0.9980723858, 0.0000757120, 0.9983255267, 0.0000437839, 0.9985591173, 0.0000236770, 0.9987766743, 0.0000117530, 0.9989843965, 0.0000052108, 0.9991798401, 0.0000019775, 0.9993678331, 0.0000005986, 0.9995517731, 0.0000001274, 0.9997277260, 0.0000000153, 0.9999014139, 0.0000000011, 0.0590669699, 0.5532451272, 0.1032478139, 0.6479286551, 0.1633103788, 0.6707991362, 0.2242575884, 0.6542262435, 0.2831965387, 0.6225534678, 0.3390330672, 0.5840382576, + 0.3916533291, 0.5436261296, 0.4410098791, 0.5032821298, 0.4874027669, 0.4645398557, 0.5306439400, 0.4270665646, 0.5710228086, 0.3915928900, 0.6084818840, 0.3579137623, 0.6432543993, 0.3262948990, 0.6754877567, 0.2967471778, 0.7053204179, 0.2692324519, 0.7328854203, 0.2436887771, 0.7583135962, 0.2200396657, 0.7818989754, 0.1983480304, 0.8035200834, 0.1782780439, 0.8233228326, 0.1597938091, 0.8414558172, 0.1428399980, 0.8580315709, 0.1273317784, 0.8731528521, 0.1131814495, 0.8869208694, 0.1003031731, 0.8994277716, 0.0886128321, 0.9107643366, 0.0780295357, 0.9210147262, 0.0684749931, 0.9302631021, 0.0598742105, + 0.9385827780, 0.0521554574, 0.9460487962, 0.0452502444, 0.9527298808, 0.0390935428, 0.9586920142, 0.0336235426, 0.9639946818, 0.0287817512, 0.9686973691, 0.0245129578, 0.9728549719, 0.0207651332, 0.9765167236, 0.0174894203, 0.9797319174, 0.0146399997, 0.9825440645, 0.0121740540, 0.9849946499, 0.0100517105, 0.9871228933, 0.0082358541, 0.9889633656, 0.0066921511, 0.9905485511, 0.0053888904, 0.9919103384, 0.0042968914, 0.9930758476, 0.0033894223, 0.9940674901, 0.0026420846, 0.9949119687, 0.0020327235, 0.9956290722, 0.0015413092, 0.9962357283, 0.0011498536, 0.9967508912, 0.0008422803, 0.9971863031, 0.0006043364, + 0.9975593090, 0.0004234765, 0.9978778362, 0.0002887592, 0.9981526732, 0.0001907366, 0.9983917475, 0.0001213459, 0.9986037016, 0.0000738019, 0.9987929463, 0.0000424858, 0.9989654422, 0.0000228366, 0.9991253018, 0.0000112406, 0.9992741346, 0.0000049216, 0.9994161725, 0.0000018302, 0.9995507598, 0.0000005335, 0.9996813536, 0.0000001042, 0.9998078942, 0.0000000094, 0.9999323487, 0.0000000001, 0.0451909751, 0.5985370874, 0.1013495177, 0.7145842314, 0.1659482718, 0.7179204822, 0.2290091068, 0.6877719760, 0.2888344228, 0.6463825107, 0.3452666104, 0.6023204327, 0.3983171582, 0.5582891703, 0.4479141533, 0.5151305199, + 0.4941670895, 0.4736239612, 0.5372728705, 0.4342634678, 0.5773839951, 0.3971895874, 0.6146532893, 0.3624362946, 0.6494202614, 0.3302361965, 0.6815004945, 0.3000313938, 0.7111659646, 0.2719697356, 0.7385569811, 0.2459734678, 0.7638086081, 0.2219478935, 0.7870476842, 0.1997952610, 0.8083968759, 0.1794156581, 0.8279752731, 0.1607091278, 0.8458944559, 0.1435769200, 0.8622629046, 0.1279227883, 0.8771849871, 0.1136526689, 0.8907576203, 0.1006761342, 0.9030768871, 0.0889050812, 0.9142317772, 0.0782558396, 0.9243069887, 0.0686475858, 0.9333848357, 0.0600032806, 0.9415428042, 0.0522494838, 0.9488526583, 0.0453163497, + 0.9553831220, 0.0391375944, 0.9612002373, 0.0336503498, 0.9663649797, 0.0287952982, 0.9709355831, 0.0245165396, 0.9749652147, 0.0207613949, 0.9785053134, 0.0174805280, 0.9816039801, 0.0146276662, 0.9843030572, 0.0121596623, 0.9866470098, 0.0100363037, 0.9886722565, 0.0082202507, 0.9904144406, 0.0066769519, 0.9919059873, 0.0053745154, 0.9931772947, 0.0042836345, 0.9942558408, 0.0033774516, 0.9951661825, 0.0026314913, 0.9959316254, 0.0020235181, 0.9965734482, 0.0015334599, 0.9971072674, 0.0011432805, 0.9975523949, 0.0008368811, 0.9979220033, 0.0005999905, 0.9982304573, 0.0004200539, 0.9984870553, 0.0002861279, + 0.9987026453, 0.0001887682, 0.9988853931, 0.0001199185, 0.9990422726, 0.0000728037, 0.9991796017, 0.0000418174, 0.9993013144, 0.0000224121, 0.9994118214, 0.0000109884, 0.9995136857, 0.0000047843, 0.9996083975, 0.0000017639, 0.9996994138, 0.0000005065, 0.9997883439, 0.0000000958, 0.9998719692, 0.0000000078, 0.9999548793, 0.0000000000, 0.0372625180, 0.6778535843, 0.1027785167, 0.7785822153, 0.1700955927, 0.7578215003, 0.2341963351, 0.7146322727, 0.2946294844, 0.6662421823, 0.3512426019, 0.6170032024, 0.4042043090, 0.5691525340, 0.4537843764, 0.5237619281, 0.4999713302, 0.4805711210, 0.5429733992, 0.4399113357, + 0.5829598904, 0.4018208981, 0.6200894117, 0.3662597239, 0.6545162797, 0.3331520557, 0.6863907576, 0.3024038374, 0.7158555388, 0.2739107907, 0.7430489063, 0.2475642413, 0.7681056857, 0.2232528329, 0.7911539674, 0.2008650005, 0.8123166561, 0.1802914590, 0.8317128420, 0.1614247262, 0.8494561911, 0.1441598982, 0.8656545877, 0.1283959597, 0.8804112077, 0.1140352488, 0.8938254714, 0.1009835452, 0.9059899449, 0.0891507640, 0.9169971347, 0.0784505308, 0.9269319177, 0.0688004643, 0.9358730316, 0.0601220280, 0.9438998103, 0.0523405187, 0.9510842562, 0.0453849472, 0.9574940205, 0.0391880795, 0.9631950855, 0.0336865112, + 0.9682492614, 0.0288202167, 0.9727140069, 0.0245326031, 0.9766418934, 0.0207707696, 0.9800852537, 0.0174848344, 0.9830899239, 0.0146282641, 0.9857009649, 0.0121576572, 0.9879595041, 0.0100325430, 0.9899039268, 0.0082154088, 0.9915681481, 0.0066715502, 0.9929856658, 0.0053689466, 0.9941850901, 0.0042781783, 0.9951951504, 0.0033723090, 0.9960410595, 0.0026267888, 0.9967432022, 0.0020193341, 0.9973240495, 0.0015298234, 0.9978014827, 0.0011401910, 0.9981914759, 0.0008343162, 0.9985074997, 0.0005979092, 0.9987652898, 0.0004184064, 0.9989722967, 0.0002848578, 0.9991421103, 0.0001878171, 0.9992794394, 0.0001192297, + 0.9993925691, 0.0000723237, 0.9994878769, 0.0000414980, 0.9995684028, 0.0000222112, 0.9996404648, 0.0000108708, 0.9997045398, 0.0000047215, 0.9997627139, 0.0000017344, 0.9998183846, 0.0000004951, 0.9998719692, 0.0000000926, 0.9999231696, 0.0000000073, 0.9999731779, 0.0000000000, 0.0350048132, 0.7899355292, 0.1060029864, 0.8310775161, 0.1745608449, 0.7882444859, 0.2390404344, 0.7343922853, 0.2996019721, 0.6803277135, 0.3562325835, 0.6275871992, 0.4091520905, 0.5773664713, 0.4585365355, 0.5299669504, 0.5045615435, 0.4854624569, 0.5473993421, 0.4438269734, 0.5872172713, 0.4049846232, 0.6241763234, 0.3688320816, + 0.6584322453, 0.3352533877, 0.6901379824, 0.3041264713, 0.7194358110, 0.2753266394, 0.7464683652, 0.2487293482, 0.7713673115, 0.2242123932, 0.7942625880, 0.2016553283, 0.8152791858, 0.1809419990, 0.8345330358, 0.1619594693, 0.8521379232, 0.1445987523, 0.8682035804, 0.1287552267, 0.8828340769, 0.1143282875, 0.8961259723, 0.1012218222, 0.9081732631, 0.0893436298, 0.9190684557, 0.0786060616, 0.9288952351, 0.0689250678, 0.9377334714, 0.0602211058, 0.9456612468, 0.0524187312, 0.9527510405, 0.0454460531, 0.9590705037, 0.0392354168, 0.9646863341, 0.0337226503, 0.9696564078, 0.0288473498, 0.9740410447, 0.0245526470, + 0.9778947830, 0.0207851417, 0.9812647700, 0.0174948145, 0.9842008352, 0.0146348858, 0.9867462516, 0.0121617056, 0.9889399409, 0.0100347064, 0.9908235073, 0.0082162116, 0.9924312234, 0.0066714007, 0.9937928319, 0.0053681680, 0.9949384928, 0.0042770291, 0.9958981872, 0.0033709689, 0.9966949821, 0.0026253953, 0.9973514080, 0.0020179797, 0.9978872538, 0.0015285702, 0.9983206987, 0.0011390765, 0.9986695051, 0.0008333580, 0.9989473224, 0.0005971104, 0.9991651773, 0.0004177612, 0.9993370771, 0.0002843523, 0.9994708300, 0.0001874339, 0.9995743632, 0.0001189499, 0.9996548891, 0.0000721278, 0.9997174740, 0.0000413673, + 0.9997695088, 0.0000221291, 0.9998111725, 0.0000108229, 0.9998470545, 0.0000046962, 0.9998780489, 0.0000017227, 0.9999079108, 0.0000004907, 0.9999349117, 0.0000000914, 0.9999608994, 0.0000000071, 0.9999872446, 0.0000000000, 0.0363268107, 0.8949306011, 0.1094180718, 0.8678462505, 0.1782684773, 0.8082422018, 0.2428297698, 0.7476644516, 0.3032771647, 0.6894404888, 0.3598039150, 0.6343314052, 0.4126003087, 0.5825159550, 0.4618534744, 0.5339841247, 0.5077446103, 0.4886457026, 0.5504494309, 0.4463792145, 0.5901330709, 0.4070483148, 0.6269620657, 0.3705119491, 0.6610920429, 0.3366281986, 0.6926733851, 0.3052553833, + 0.7218531370, 0.2762562335, 0.7487694025, 0.2494965494, 0.7735593319, 0.2248454690, 0.7963497639, 0.2021788508, 0.8172621131, 0.1813742220, 0.8364176750, 0.1623162031, 0.8539297581, 0.1448932290, 0.8699073792, 0.1289978772, 0.8844483495, 0.1145276278, 0.8976559043, 0.1013851613, 0.9096300602, 0.0894773528, 0.9204478264, 0.0787147805, 0.9302026629, 0.0690133348, 0.9389696121, 0.0602924936, 0.9468309283, 0.0524760932, 0.9538570642, 0.0454919077, 0.9601182342, 0.0392717198, 0.9656765461, 0.0337513052, 0.9705906510, 0.0288696662, 0.9749226570, 0.0245699026, 0.9787282944, 0.0207983982, 0.9820485115, 0.0175047908, + 0.9849371910, 0.0146423187, 0.9874379635, 0.0121671055, 0.9895948768, 0.0100385798, 0.9914370775, 0.0082188761, 0.9930007458, 0.0066731907, 0.9943267703, 0.0053692823, 0.9954383373, 0.0042776591, 0.9963677526, 0.0033712797, 0.9971289635, 0.0026254763, 0.9977539182, 0.0020179211, 0.9982628226, 0.0015284289, 0.9986650348, 0.0011388960, 0.9989860058, 0.0008331715, 0.9992401004, 0.0005969327, 0.9994335771, 0.0004176045, 0.9995784163, 0.0002842209, 0.9996902943, 0.0001873294, 0.9997700453, 0.0001188712, 0.9998291731, 0.0000720710, 0.9998727441, 0.0000413287, 0.9999002814, 0.0000221045, 0.9999260306, 0.0000108084, + 0.9999423623, 0.0000046885, 0.9999536872, 0.0000017192, 0.9999645948, 0.0000004894, 0.9999776483, 0.0000000910, 0.9999885559, 0.0000000071, 0.9999956489, 0.0000000000, 0.0381621197, 0.9541036487, 0.1115348265, 0.8859133124, 0.1803667992, 0.8181236386, 0.2448589057, 0.7540844083, 0.3052337468, 0.6939628720, 0.3616724610, 0.6376712918, 0.4143942595, 0.5850625634, 0.4635618925, 0.5359755754, 0.5093746781, 0.4902262092, 0.5520020127, 0.4476386011, 0.5916138291, 0.4080720246, 0.6283748746, 0.3713401556, 0.6624349356, 0.3373101950, 0.6939625740, 0.3058160543, 0.7230777740, 0.2767166793, 0.7499359846, 0.2498778254, + 0.7746582627, 0.2251592726, 0.7974044085, 0.2024386972, 0.8182517886, 0.1815908253, 0.8373577595, 0.1624954343, 0.8548389673, 0.1450411528, 0.8707695007, 0.1291200221, 0.8852538466, 0.1146296859, 0.8984326720, 0.1014691442, 0.9103514552, 0.0895461515, 0.9211406708, 0.0787707642, 0.9308499098, 0.0690586641, 0.9395790696, 0.0603295453, 0.9474039078, 0.0525058284, 0.9544072747, 0.0455166958, 0.9606352448, 0.0392914377, 0.9661738276, 0.0337673053, 0.9710652232, 0.0288816821, 0.9753563404, 0.0245799031, 0.9791374803, 0.0208059587, 0.9824336171, 0.0175107289, 0.9853020310, 0.0146467788, 0.9877912998, 0.0121707404, + 0.9899252057, 0.0100412406, 0.9917475581, 0.0082207881, 0.9932865500, 0.0066746534, 0.9945834279, 0.0053702979, 0.9956811666, 0.0042784028, 0.9965934753, 0.0033717463, 0.9973594546, 0.0026257983, 0.9979694486, 0.0020181276, 0.9984585643, 0.0015285450, 0.9988400936, 0.0011389712, 0.9991455078, 0.0008332125, 0.9993883371, 0.0005969436, 0.9995711446, 0.0004176005, 0.9996958375, 0.0002842142, 0.9998048544, 0.0001873225, 0.9998745918, 0.0001188614, 0.9999259114, 0.0000720631, 0.9999422431, 0.0000413235, 0.9999839664, 0.0000221006, 0.9999877810, 0.0000108062, 0.9999963045, 0.0000046872, 0.9999985695, 0.0000017185, + 0.9999988079, 0.0000004892, 0.9999995232, 0.0000000910, 0.9999998212, 0.0000000071, 0.9999999404, 0.0000000000, +}; +PK_STATIC_ASSERT(sizeof(BRDFLUTArray) == BRDFLUTArraySize); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/BRDFLUT.h b/Samples/PK-SampleLib/BRDFLUT.h new file mode 100644 index 00000000..b383fc30 --- /dev/null +++ b/Samples/PK-SampleLib/BRDFLUT.h @@ -0,0 +1,23 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" +#include "pk_maths/include/pk_maths_fp16.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +enum { BRDFLUTArraySize = 64 * 64 * 2 * 2/*16*/ }; +extern const PopcornFX::f16 BRDFLUTArray[]; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/BlueNoise.cpp b/Samples/PK-SampleLib/BlueNoise.cpp new file mode 100644 index 00000000..babcc500 --- /dev/null +++ b/Samples/PK-SampleLib/BlueNoise.cpp @@ -0,0 +1,153 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "BlueNoise.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +// 32 * 32, 8 bit per channel, RGBA blue noise +// sRGB space +PK_ALIGN(0x10) const PopcornFX::u32 kBlueNoiseMap[] = +{ + 0x75c178d0, 0x1d3fa33f, 0xdd1dc5aa, 0x14c8de2c, 0xeed74109, 0x7844f49b, 0x3c8a1c21, 0x8bf8daa9, + 0xad5739e5, 0xc4dac934, 0x86f4466a, 0xb7ae94eb, 0x02c06841, 0x9e4a3760, 0x74697ff2, 0x1529e2be, + 0xe3156ae7, 0x29ddc703, 0x43313e86, 0xda0824a3, 0x576fd019, 0x37586b2f, 0x61fd0be4, 0x2a7e7f3b, + 0xd4725300, 0x08521bdb, 0xc0a45eee, 0x7a40dd67, 0x56950927, 0x6af4c9c8, 0xb139897d, 0xef0d1de0, + 0xa5e9d81f, 0x65b0f866, 0xb09217c5, 0x81685af0, 0x320c8b5d, 0xb9a874b7, 0x9a70b93c, 0xe61b9d83, + 0x5eb78200, 0x1036ed50, 0x79452326, 0x2924b5a2, 0xd0e4db07, 0x4a9957b1, 0xed7d284c, 0xcbeb9117, + 0x91a14d91, 0xb645a85d, 0x7080b8b2, 0xf5b35ff8, 0x101ee269, 0xe18c1a96, 0xbc3efbd0, 0x85d1beae, + 0xf009d94c, 0x932892c4, 0x46e3ac84, 0x34c73840, 0x9e067f93, 0xe2692da5, 0x4a4eb010, 0x3b8a45b4, + 0x0c5e03fb, 0xf97c3b76, 0x902c9a50, 0x48f1698a, 0xd538ab18, 0x6abe0ad9, 0x28e7ce71, 0x192957ec, + 0xcda02cb0, 0x4383a8cb, 0xf1737278, 0x97ce0cc0, 0x630dc6d9, 0xac579e86, 0x1fbbfb72, 0x3a05739f, + 0x5cd21ed4, 0x0463d938, 0x9c970f25, 0x31c631dd, 0xace98743, 0x91494f81, 0x42ab3f13, 0x6bbd9c73, + 0x52eb3161, 0xad5f009f, 0x11b3f00d, 0xf5759fba, 0xba306a18, 0x28d7fee9, 0x86b85b47, 0xcd23948d, + 0xbece6f2a, 0x520083a1, 0x254a260f, 0xc7ded2cd, 0x0080e845, 0xff513596, 0x5097482d, 0xde5ef955, + 0x6fc60515, 0xa21061fb, 0x35efe58f, 0xda623438, 0x0e314a57, 0x6d8715e3, 0xbecaaf30, 0x843cce0b, + 0xf37542fe, 0xd6f2f151, 0x65117b74, 0x7f55a0bb, 0x20daea07, 0xce2bcb5a, 0x0167aec6, 0xea1662eb, + 0x23847023, 0xc991c5e2, 0x7e47467a, 0x5bfcd3f8, 0xd5162254, 0x09810d70, 0x98edc0d9, 0x5f9ae15c, + 0x7c72ccd2, 0x35f9b2bb, 0xe49ff337, 0x9dac4fe7, 0x5d17137d, 0xabd2c1f7, 0x92059567, 0x80fd6ec3, + 0x0749d79d, 0xbddebc43, 0x58b28f61, 0x8c937a12, 0xfda7eff4, 0x31fb8520, 0xe01c5eb9, 0xa14f0368, + 0x46b498aa, 0x182466c8, 0xc436c21a, 0xeba6569a, 0x4e7b05f0, 0xb90077a7, 0x74f6252b, 0xa2a1118d, + 0x353ae6b3, 0xdd218345, 0x68c25432, 0x1a9eb7ce, 0xa7567521, 0x72abeaaf, 0xf2414f3a, 0x1c1a3302, + 0xea3319ed, 0xb4544492, 0x87c5606e, 0x1164a3b1, 0x73267625, 0x3a8d86a5, 0xc36c1f05, 0x2d3cb0e0, + 0xf47a3b22, 0xaf201484, 0x1b5351d3, 0x4702d2ac, 0xc741a69a, 0x7dd92c48, 0x0866becd, 0x54a3eb8e, + 0x28e5373f, 0x768a8a7d, 0xa8f929e0, 0x396dfe89, 0x5abb4635, 0xfe95bbd4, 0x8acc8d52, 0x175af5fb, + 0xb4d6d009, 0x95ef2b6b, 0x406b1897, 0xe7038e5d, 0x8dd33c89, 0x368c9cc3, 0x4665a99e, 0xd2e1897f, + 0x06b2e741, 0x6c86bd1d, 0x420d0953, 0xdb3fdf0a, 0xf1f5305e, 0x1fbcf7d2, 0xd2b05e4b, 0x4ad8e375, + 0x61a27db9, 0xe1899a31, 0x77c1fce8, 0x256f206f, 0xb3e84003, 0x5f7b6d7f, 0x942bde5b, 0xf79452ed, + 0xbb0e1c12, 0x8c5bb32a, 0xe3c4d662, 0x0a411549, 0x991e9710, 0x2b4dde6e, 0xd92f5c7b, 0x4873383d, + 0x600ea3c1, 0xf7afb3dd, 0x2a7e66a8, 0xbc2aef04, 0x5138daef, 0xc6f5112d, 0xab0e27df, 0x63bf6565, + 0x2e2878a9, 0xa4d897f5, 0xcb9424c6, 0x55e28fe2, 0xb078b687, 0x7b57c9be, 0x0b2e013b, 0xa0154d92, + 0x87ee2af2, 0x3b35c30e, 0x97d1674f, 0xd52706c7, 0xebb5b729, 0x131492b5, 0xa6c80f36, 0x3e44ccd7, + 0xcdd480a0, 0x637fa4c0, 0x150672f4, 0xd1dc3dab, 0x82ed6ae6, 0x6782abb8, 0xc4b41c1f, 0x08e07aa1, + 0x79404e15, 0xcf509582, 0x1296094b, 0x83e6c1d6, 0x02cb591b, 0xfd4b8077, 0x22a2cf4e, 0x937af711, + 0x7ffe5386, 0xf8463d27, 0x156bd875, 0x271d6c34, 0x8ea45597, 0x67eb3afd, 0xe648a21a, 0xb898d0ae, + 0x17088959, 0xf865e76b, 0x05f8a9a5, 0x695c5889, 0x4f9b79fc, 0x354ef2e2, 0xddf19d74, 0x70716308, + 0x21ba4852, 0x4d31f76d, 0xb1ad0a8c, 0xf664e702, 0x43a0c35c, 0x1e132ec9, 0xa68dd294, 0xe8fe03e9, + 0x53a5e458, 0x9dc741f7, 0xaf1afd37, 0x6a5d31b7, 0xd8b27162, 0x776f4594, 0x591fb9f9, 0xdf5a02bc, + 0xb804af59, 0x4da8c7a1, 0x98cefbd8, 0xbf370e4a, 0x3e068113, 0xfcc81d65, 0x3381f02b, 0x52c17380, + 0x727310cc, 0xc3ad45de, 0xaa3e3316, 0xcc8dd940, 0x8f0bc861, 0x8282261d, 0xbaa73b92, 0x0120e4ad, + 0xf0fc2cf9, 0x7e52ba24, 0x33935b34, 0xa0278fd6, 0x71cc4d41, 0xdd3b8083, 0xb85ef92d, 0x3b06b466, + 0x87276ccf, 0x2468c826, 0xeef38471, 0x4186ac9e, 0x33091ecb, 0xa0dfe13e, 0xc2919f0a, 0x0dc533d0, + 0x377f1bea, 0x72f05d69, 0xd7519e01, 0x62b747b6, 0x118ae8ec, 0xc962ada2, 0x962561d5, 0xdcda9744, + 0x2650ba06, 0x5be51b95, 0x441cf533, 0x2dbd82c2, 0x1cd64c9e, 0xfce3164b, 0x5937aed1, 0x9d608c3c, + 0xd90a00c6, 0x93de797c, 0xc278db98, 0x574822b4, 0x06f5a218, 0x8f6f10ff, 0x2dbe5f4e, 0xfbd48b06, + 0x107d24af, 0xc134548f, 0x5eba130f, 0xe243d5f2, 0x909e9122, 0x1830f27e, 0x48eb64af, 0xea3d8731, + 0xad19ee1b, 0x1e987a40, 0xe52a2b91, 0x84728e7d, 0xa7ddc0c4, 0x49fbdc55, 0x02132773, 0xaf9250f4, + 0x8031d5b3, 0xefa06be6, 0xa179937a, 0xe649a1ab, 0x762d63f1, 0xac6bbe0d, 0x0fc9fe82, 0x40906e66, + 0x67a0d014, 0x27c3aadf, 0x11173749, 0xe4b6f4ed, 0xcce2ca72, 0x4a1f43a3, 0x7d9aeebf, 0x66539bdf, + 0x98e9dd7a, 0x4c923846, 0x7414a4bd, 0x0bd85d5a, 0xb5772ce5, 0xd1500d4a, 0x86b84c6d, 0x6668cb99, + 0x9cd50753, 0x035ca6c9, 0x58e6d3e2, 0x2d101223, 0xeb9e3638, 0x773a760d, 0x6858078f, 0xd4b5fd1e, + 0x1bef3c4f, 0x8c0fb266, 0x09cb0325, 0x63ff2e57, 0xd3afe8db, 0x4b000c2f, 0xbd5657bd, 0xcae940ea, + 0x8a3f9a59, 0xed8451a6, 0x3d67140a, 0xa9336963, 0x60a6b6ce, 0xf0887624, 0x18103139, 0xae440b96, + 0xd8a9baef, 0xcac87131, 0x2f59ebda, 0xa6fbc0a7, 0xfa237906, 0x55cfb18b, 0x270bdbd7, 0xf3ac70fd, + 0x8a35be09, 0x458742a5, 0xcebfe570, 0xb2476bf6, 0x91af5a5f, 0x217da5ad, 0xf4d28add, 0x3f43c4be, + 0xba6a7d3c, 0x50875a88, 0xc554e1c9, 0x3822cd01, 0x9596746f, 0x2276888c, 0xf3b6d79b, 0x3015201f, + 0x5428ec77, 0x7af7c1b6, 0xb7d0852c, 0x6e049390, 0x23595652, 0x9bec1b81, 0xbe77aa10, 0x3fdacf6c, + 0x002c4b55, 0xf1018714, 0x8d710484, 0x1f854367, 0x6ca5f73a, 0x7d6199c2, 0x3c8c3b28, 0xc9f824b7, + 0xde25ff88, 0x7575942f, 0xff0151b4, 0x0ef4b34a, 0x3866f4cf, 0xbf18cf83, 0x5dc2172e, 0x989a2f9d, + 0x2f05eaff, 0xfddba714, 0x7ba722ea, 0x136348b7, 0xe3413843, 0x84f3b5fb, 0x6f85a651, 0xa2db7d37, + 0x184c30da, 0xde7408f8, 0x03aee03e, 0xff9528c2, 0x884ad4e3, 0x34c5e9f3, 0xdb227faa, 0x6f6362d5, + 0x54f6fbb9, 0x81b1961f, 0x3a3721ca, 0xe5e6c898, 0xc54067f6, 0x05121519, 0xb1c68a60, 0x144b5879, + 0x30e47cd5, 0x64a9305b, 0xbbcd0b0e, 0x52918199, 0x8132221b, 0xe0ec3fee, 0xcb269704, 0x07764d54, + 0xa4f7646f, 0x6d2d11a8, 0xdabd8d93, 0xb5e79c2a, 0xa81afad5, 0x5dd01817, 0x0a3266b1, 0xd4a3f3ce, + 0xb2bf4b05, 0x97616188, 0x4411af6a, 0xcfd8fa1b, 0x51fd479c, 0x0b390200, 0xe8a1c345, 0x91bc3d5f, + 0x1d8b29f8, 0xb94ee0a2, 0x62985976, 0x9919a84c, 0x49b632de, 0xd9eee3ac, 0x5e7ab845, 0xa19cd1ef, + 0xee69633c, 0x963f1ac3, 0x241fdcf9, 0xa3549e8c, 0x6dd7bc42, 0x1386e464, 0x4b4d6f79, 0x86aef9c5, + 0xe65db7d3, 0x223bd847, 0x427ec35e, 0x550c6d79, 0x2c9c52a3, 0xf96dca68, 0x475a0b80, 0x360b8e5c, + 0xeaecc5a1, 0x613c9b47, 0x2b8072ca, 0xa52a397b, 0xc08da0b3, 0x796e6b34, 0x5c078d73, 0xa27ea58d, + 0xce131429, 0xf9dfb63e, 0x0cc37ce3, 0xa96bd604, 0x2bd44c2f, 0xf42c7372, 0x83570695, 0x4f0aa212, + 0xc7c2b2a0, 0x0cfcf16a, 0x415fc722, 0xd4ba4adc, 0xf7a35fbb, 0xad0a01ab, 0x2be3abe4, 0x76c98535, + 0xb3162921, 0x6190420a, 0x92d405e1, 0x01b1eb39, 0xce4884f5, 0x99c42a0c, 0xc38fe5c2, 0x76213c30, + 0x8db2d8f0, 0x1e972311, 0x83e10ee6, 0x6b1b8327, 0xf1babd54, 0x16541ed2, 0xb4d0dcc1, 0x26f251e9, + 0x3343ec0b, 0x4c5e68b4, 0x78250c63, 0xc2818c90, 0x1248f6bd, 0x728f1d56, 0xb8b0e9cc, 0x1ddc44e7, + 0xaa848803, 0x7c936c80, 0xe5133a52, 0x8a7b9175, 0x1b38792b, 0x596e3412, 0xed97d49c, 0xd142138e, + 0x10f059f6, 0xf5707bae, 0xbf51a1bc, 0x7cfa3587, 0xe8295d4d, 0x69dfb922, 0x1478a7dc, 0xb7f47890, + 0x53525570, 0xf669b3ae, 0xc8c9e796, 0x0e45ce62, 0x38a25bfa, 0xd6e5f685, 0x45183318, 0xedad779a, + 0x662fc850, 0xe1cb9b7f, 0x89ff2dfc, 0xd5aa3ed1, 0x4004bf1c, 0x92f59886, 0xdf375426, 0x381c29b0, + 0xd04c0933, 0x6e2fa7d7, 0x4ecf12a6, 0x32e1e6ea, 0xc2f2253d, 0x9d21f6d1, 0x3c63c04c, 0x8eb8935f, + 0x4902e17f, 0x31a6f06b, 0xa31fae19, 0x1c86d1cb, 0x3d641c9b, 0x880796e7, 0x283d47b5, 0xdad1043f, + 0x0430ff51, 0xa9028a1e, 0xdcfa2fda, 0x4b784939, 0x9b5f1208, 0x8e3594a7, 0x8089ac69, 0xaa6a06d9, + 0x0a954530, 0x9976fec6, 0x1a11d30f, 0x569caaa4, 0xfe656238, 0x68c082f3, 0x0672cb65, 0x59a2da4d, + 0x26f1bbfe, 0xfbb3f9c0, 0x0003560c, 0xb546ce87, 0x65aaa35b, 0x7ac44efa, 0x08856900, 0xc62f39b8, + 0x6bdf2029, 0xdece4b43, 0x583865ec, 0xd3c01257, 0xaee8f82e, 0x4dabde64, 0xf2996f78, 0x9fbcc102, + 0x408919fd, 0x6ea8a0c7, 0x3027687e, 0xb9b47dbc, 0x5f0def49, 0xfcefb6eb, 0x20d66323, 0xc84b853d, + 0x71b921ac, 0xbcea5870, 0x373c715b, 0xae531647, 0x23e6007a, 0x9f22f1dc, 0xe9d536b9, 0x855c7791, + 0xbfe54342, 0x9b6c9862, 0x8f9d2e1c, 0xdb7780b2, 0xf558b594, 0x250f086f, 0xaafe88c4, 0xe94ccae6, + 0x15769ea2, 0x9a5bbbd6, 0x739b7507, 0xfe129092, 0x0f7c3fab, 0x64568113, 0xc81b26d2, 0x7e6e628a, + 0x5a49d4a0, 0x94ea3a5d, 0x1958df29, 0xe591c66e, 0x74c3268f, 0x039b3fc9, 0x5328d958, 0x3e00c2e0, + 0xe35be688, 0x5d1e90f1, 0xefd3b71e, 0x7b8bdfe5, 0xc8b34997, 0x3244af08, 0xb37f1f15, 0x47166773, + 0x603e152c, 0x3ac7d69c, 0x172461f1, 0x578c1d36, 0x433470ce, 0xcfd9e025, 0x859f1917, 0x50195b8a, + 0xbab1f337, 0x248b0c79, 0x39f62ec5, 0x8c47cd6d, 0xbbd554f5, 0x2f2dc448, 0xe2fdabbf, 0x20ddf336, + 0xb41050eb, 0xfa7f9316, 0x88d307ad, 0xc11da6f3, 0x293d550f, 0xae71719d, 0xd3810e77, 0x9ef92f05, + 0x2ca5a4bb, 0x8bc03994, 0x017d192b, 0xd2077bb2, 0x4f2d9dc8, 0x70cdc653, 0x0d9692a7, 0xd809e2d4, + 0x7a8886e3, 0xf062aec7, 0xb0ddea7b, 0x71f7c654, 0x0fbb41de, 0x9568fc46, 0x2fc9adad, 0x603e7c63, + 0xf8e7444f, 0x7f0adbfe, 0xca25b11c, 0x096ceb32, 0x56b90182, 0x978f9adb, 0x75603424, 0x07c70f69, + 0x399eb84d, 0xd0337384, 0x0f67eccf, 0x45e41a42, 0x7e4f8d33, 0xeccbfab6, 0x6bb09cf9, 0x16457e4d, + 0xf6dbf416, 0x483650d1, 0xa66dcd61, 0x14f3ed40, 0x96605c6c, 0xf6a72ded, 0x8dfcfd24, 0x1bbc5385, + 0xe1323749, 0x2eaa0405, 0xcb184c6c, 0x9f4f8f10, 0xec089fa4, 0xb6933282, 0xe229d4f2, 0x037c960c, + 0xa1612599, 0x46c16db0, 0xdcdb875c, 0xa79f5fba, 0xe93a1fa4, 0x41037709, 0xd7ade293, 0xa32186b2, + 0xee4244df, 0x69f0230b, 0x56b66097, 0x9ca4b05a, 0xcc0bd6d8, 0x36f34a1d, 0x9017ca67, 0xb6665ea8, + 0x8190043a, 0xc40c6a80, 0x659d27fd, 0xdfde8b01, 0x3c4b3e8c, 0x5b1b6f35, 0xc1730ebc, 0xa853a45e, + 0x6aedcda9, 0x04d2f6b6, 0x82997a90, 0x494228e9, 0x2182102d, 0x68e264bf, 0x3d555074, 0x78ab06da, + 0xd3f1c7cc, 0x1c333627, 0x6650a1e1, 0x2a824944, 0x6ecdfcf0, 0x12eed155, 0xc0526778, 0x8288a5fa, + 0x4d74f03d, 0x2508ccc3, 0xab8fbf6d, 0xe02a81e8, 0x1d5d3a7c, 0x62892b8b, 0x4b301328, 0x07e8b9cb, + 0xdb51a9e5, 0x2024dd56, 0x75b5bfa4, 0x2ec40ad8, 0xb13bb176, 0xeb8ed59e, 0x27e27ef6, 0x4426bd19, + 0xc77b5d39, 0x920c6cfc, 0xf46db820, 0x5cf2e3d0, 0xd6b5c241, 0x8920ee58, 0xc6d0741c, 0xac04b53a, + 0x5498f88e, 0x9070df03, 0xf30f1487, 0xb2a8bd72, 0x8818ad15, 0xfb673cca, 0x5cd9572c, 0x31be1660, + 0xb7f8951d, 0x8e4d30a3, 0x73cf532e, 0xf9e10101, 0x0d79e5ba, 0xbcb96d48, 0xf29fedef, 0xa7c28999, + 0x5a754071, 0x3ffe760e, 0xfc5c9623, 0xbe83f2c1, 0x7d111e48, 0x06cce311, 0x876646cd, 0x55b1257e, + 0xa39217db, 0x3dc3994e, 0x19593e60, 0xbb2e5685, 0x34a4889c, 0x0c74a9f7, 0xfdfb1a68, 0x164783b5, + 0x2c87594b, 0xc3b78eec, 0x3be06965, 0x05fa0a98, 0x4e467e3b, 0x9e792be8, 0xd02ec49f, 0x171208bd, + 0xe7a6dd7e, 0x00357bd3, 0xc56afc50, 0x3e1a9fff, 0x854291aa, 0x9ad9ad16, 0x77034f5e, 0x323921bf, + 0xccd1ff33, 0x8f153291, 0x9f9958b5, 0x512c4af1, 0x1af0652e, 0x9aa1a057, 0xd9019068, 0xfa46ef95, + 0x0e1edc28, 0xb23aaa77, 0x7be808c7, 0xe7cc2102, 0xa80fd7af, 0x50603513, 0x713947e1, 0x9bbfcf7c, + 0xec1d23a6, 0x5b2b4030, 0x7c5de9c1, 0xe49098d3, 0xbd23dab0, 0x26b4f506, 0x789b8c8a, 0x47e3b446, + 0x96616e0e, 0xd69420e4, 0x5ec6418e, 0x2eac6574, 0x51fa183b, 0xd855c5dc, 0x236e7c85, 0xe485d707, + 0x12aaa1e1, 0x6ce4114f, 0x0b43d164, 0xe7798281, 0xd1d7c4de, 0x624f02ac, 0x70bb35e8, 0x22f9740d, + 0x4cd584ba, 0xcfac49a6, 0x6d83cbee, 0x294afd36, 0x938e60d7, 0xe0dc9b93, 0x419d002a, 0x846af1c5, + 0xb5eaa2f3, 0x0dd3c217, 0xd23d2f5a, 0x94c55221, 0x19ec7251, 0x64561fdd, 0xaf84606b, 0xef404bf7, + 0x3701e858, 0x6ceaacb1, 0xa023d520, 0xb383bc63, 0xec0e2dcc, 0x6796e09f, 0x44ed5c26, 0xb0200544, + 0x834c68fa, 0xf262b2ca, 0xb607e614, 0x2aaf2a3e, 0x456ca88d, 0xab34fa20, 0x36885ac4, 0xe95fb444, + 0x5a2b2889, 0x8b70ed56, 0xf705921a, 0x04b96e6a, 0x64267e46, 0xc9eebf75, 0x2414e453, 0xd7ae660c, + 0x694d7842, 0x347cb19d, 0xa4a51776, 0x6f09d2fc, 0x3f71a783, 0xdcd64235, 0xc51ccca8, 0x0aca9d1a, + 0x80b834c8, 0xff74849a, 0x214e5532, 0x133b0dee, 0xcdbef20b, 0x0564487b, 0x952e36b8, 0xc6b7996c, + 0x4ecac9a9, 0x398e439b, 0x5ff78c78, 0x89bd16d4, 0xca227004, 0x94e73da0, 0x7f14d371, 0xbd9c10f5, + 0x2ce0bc08, 0x9c555298, 0x42ff32e4, 0xc09a0d81, 0x575bb0be, 0xa57a2aff, 0x09324ecf, 0xf8ca9064, + 0x4c020f8b, 0x1e945cd6, 0xe865ffb8, 0x53178611, 0xfa8b0295, 0x3034eecd, 0x8bffbb28, 0x58a9187c, + 0xa95a073f, 0x4f8ef86e, 0xc1f695d8, 0x89cf754a, 0x79a3a5c0, 0xa5e08b56, 0xfb12b4f4, 0x1a9dec8b, + 0x7336271e, 0xa4dc7559, 0xdf19f531, 0x1f80bab3, 0xfe594efe, 0x02cd994e, 0x16a9e95f, 0xd7776432, +}; +PK_STATIC_ASSERT(sizeof(kBlueNoiseMap) == BlueNoiseMapSize); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/BlueNoise.h b/Samples/PK-SampleLib/BlueNoise.h new file mode 100644 index 00000000..add00c62 --- /dev/null +++ b/Samples/PK-SampleLib/BlueNoise.h @@ -0,0 +1,22 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +enum { BlueNoiseMapSize = 32 * 32 * 4 }; +extern const PopcornFX::u32 kBlueNoiseMap[]; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/Camera.cpp b/Samples/PK-SampleLib/Camera.cpp new file mode 100644 index 00000000..33f29987 --- /dev/null +++ b/Samples/PK-SampleLib/Camera.cpp @@ -0,0 +1,297 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "Camera.h" + +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CFloat3 SCamera::Ray(const CFloat2 &mousePosPixel) const +{ + CFloat4 pos(((2.f * mousePosPixel / m_WinSize) - 1.f) * CFloat2(1.f, -1.f), -1.f, 1.f); + const CFloat4x4 &invView = m_ViewInv; + const CFloat4x4 invProj = m_ProjInv; + pos = invProj.TransformVector(pos); + pos = invView.RotateVector(pos); + return pos.xyz().Normalized(); +} + +//---------------------------------------------------------------------------- +// +// +// +//---------------------------------------------------------------------------- + +CCameraBase::CCameraBase() +: m_NeedUpdate(true) +, m_LookAt(0.f) +{ +} + +//---------------------------------------------------------------------------- + +void CCameraBase::SetProj(float fovyDegrees, const CFloat2 &winDimPixel, float zNear, float zFar, RHI::EGraphicalApi api /* = GApi_Vulkan */, float openGLYFlipSign/* = -1*/) +{ + m_Cam.m_ProjFovy = fovyDegrees; + m_Cam.m_ProjNear = zNear; + m_Cam.m_ProjFar = zFar; + m_Cam.m_WinSize = winDimPixel; + + const float aspect = winDimPixel.x() / winDimPixel.y(); + const float fY = 1.f / tanf(Units::DegreesToRadians(fovyDegrees * 0.5f)); + const float fX = fY / aspect; + + const float kRcpRange = 1.0f / (zNear - zFar); + const float kA = (zFar + zNear) * kRcpRange; + const float kB = (zFar * zNear) * kRcpRange; + + if (api == RHI::GApi_OpenGL || api == RHI::GApi_OES) + { + // OpenGL: + const float _fY = fY * openGLYFlipSign; + m_Cam.m_Proj = CFloat4x4( fX, 0, 0, 0, + 0, _fY, 0, 0, + 0, 0, kA, -1, + 0, 0, 2 * kB, 0); + } + else if (api == RHI::GApi_Orbis || api == RHI::GApi_UNKNOWN2) + { + // Orbis: + m_Cam.m_Proj = CFloat4x4( fX, 0, 0, 0, + 0, fY, 0, 0, + 0, 0, kA, -1, + 0, 0, 2 * kB, 0); + } + else if (api == RHI::GApi_Vulkan || api == RHI::GApi_D3D11 || api == RHI::GApi_D3D12 || api == RHI::GApi_Metal) + { + // Vulkan: + m_Cam.m_Proj = CFloat4x4( fX, 0, 0, 0, + 0, -fY, 0, 0, + 0, 0, 0.5f * kA - 0.5f, -1, + 0, 0, kB, 0); + } + else + { + PK_ASSERT_NOT_REACHED_MESSAGE("No projection matrix for this API"); + } + + // Patch the projection matrix only + CFloat4x4 current2RHYUp = CFloat4x4::IDENTITY; + CCoordinateFrame::BuildTransitionFrame(CCoordinateFrame::GlobalFrame(), Frame_RightHand_Y_Up, current2RHYUp); + + m_Cam.m_Proj = current2RHYUp * m_Cam.m_Proj; + + m_NeedUpdate = true; +} + +//---------------------------------------------------------------------------- + +void CCameraBase::SetProj(const CFloat2 &winDimPixel, float zNear, float zFar, RHI::EGraphicalApi api /* = GApi_Vulkan */, float openGLYFlipSign/* = -1*/) +{ + m_Cam.m_ProjNear = zNear; + m_Cam.m_ProjFar = zFar; + m_Cam.m_WinSize = winDimPixel; + + const float aspect = winDimPixel.x() / winDimPixel.y(); + const float fY = 1.f; + const float fX = fY / aspect; + + const float kRcpRange = 1.0f / (zNear - zFar); + const float kA = 2.f * kRcpRange; + const float kB = (zFar + zNear) * kRcpRange; + + if (api == RHI::GApi_OpenGL || api == RHI::GApi_OES) + { + // OpenGL: + const float _fY = fY * openGLYFlipSign; + m_Cam.m_Proj = CFloat4x4( fX, 0, 0, 0, + 0, _fY, 0, 0, + 0, 0, kA, 0, + 0, 0, kB, 1); + } + else if (api == RHI::GApi_Orbis || api == RHI::GApi_UNKNOWN2) + { + // Orbis: + m_Cam.m_Proj = CFloat4x4( fX, 0, 0, 0, + 0, fY, 0, 0, + 0, 0, kA, 0, + 0, 0, kB, 1); + } + else if (api == RHI::GApi_Vulkan || api == RHI::GApi_D3D11 || api == RHI::GApi_D3D12 || api == RHI::GApi_Metal) + { + // Vulkan: + m_Cam.m_Proj = CFloat4x4( fX, 0, 0, 0, + 0, -fY, 0, 0, + 0, 0, kRcpRange, 0, + 0, 0, zNear * kRcpRange, 1); + } + else + { + PK_ASSERT_NOT_REACHED_MESSAGE("No projection matrix for this API"); + } + + // Patch the projection matrix only + CFloat4x4 current2RHYUp = CFloat4x4::IDENTITY; + CCoordinateFrame::BuildTransitionFrame(CCoordinateFrame::GlobalFrame(), Frame_RightHand_Y_Up, current2RHYUp); + + m_Cam.m_Proj = current2RHYUp * m_Cam.m_Proj; + + m_NeedUpdate = true; +} + +//---------------------------------------------------------------------------- + +float CCameraBase::BoundingZOffset(float radius, bool useLargestFov) const +{ + float aspect = m_Cam.m_WinSize.y() / m_Cam.m_WinSize.x(); + if (aspect == 0.0f || !TNumericTraits::IsFinite(aspect)) + aspect = 1.0f; + +#if 0 + // NOTE: v1.x, how do we want to handle non-square screen pixels in v2 ? + if (!m_IgnoreScreenPixelAspect) + { + if (m_ScreenPixelAspect != 0.0f) + aspect *= m_ScreenPixelAspect;//Caps::Monitors().ScreenPhysicalPixelAspect(); + else + PK_ASSERT_NOT_REACHED_MESSAGE("You must set the screenPixelAspect in CBaseCamera before that call"); + } +#endif + + const float fovY = m_Cam.m_ProjFovy; + const float fovX = fovY / aspect; + const float fov = useLargestFov ? PKMax(fovX, fovY) : PKMin(fovX, fovY); + PK_ASSERT(fov != 0); + + // here, get the distance from the sphere's center that makes 'fov' bind the sphere: + const float f = tanf(TNumericConstants::PiHalf() - fov * TNumericConstants::PiHalf() / 180.0f); + return radius * sqrtf(f * f + 1.0f); +} + +//---------------------------------------------------------------------------- +// +// +// +//---------------------------------------------------------------------------- + +CCameraRotate::CCameraRotate() +: m_Distance(0) +, m_Angles(0) +{ +} + +//---------------------------------------------------------------------------- + +void CCameraRotate::Update() +{ + CFloat4x4 outMatrix; + CFloat4x4 pitch; + CFloat4x4 yaw; + CFloat4x4 roll; + + const CInt3 &axesRemapper = CCoordinateFrame::AxesRemapper(CCoordinateFrame::GlobalFrame()); + const CUint3 axesIndexer = PKAbs(axesRemapper) - 1; + const CFloat3 signs = CFloat3((axesRemapper >> 31) | 1) * CCoordinateFrame::CrossSign(); + + MatrixTools::BuildRotationMatrixAxis(axesIndexer.x(), m_Angles.x() * signs.x(), pitch); + MatrixTools::BuildRotationMatrixAxis(axesIndexer.y(), m_Angles.y() * signs.y(), yaw); + MatrixTools::BuildRotationMatrixAxis(axesIndexer.z(), m_Angles.z() * signs.z(), roll); + + outMatrix = (yaw * pitch) * roll; + + // FIXME(Julien): This is just plain wrong, and countless unneeded matrix inversions. + // We should build the WORLD matrix. And use it to compute the VIEW matrix. + // The view matrix converts from world to view, the world matrix converts from view to world, + // and is more straightforward to compute. Fix this + + CFloat4x4 worldMatrix = outMatrix.Inverse(); + worldMatrix.StrippedTranslations() = m_LookAt - CCoordinateFrame::MatrixAxis(worldMatrix, Axis_Forward) * m_Distance; + + m_Cam.m_View = worldMatrix.Inverse(); + + m_Cam.Update(); + + m_Cam.m_Position = m_Cam.m_ViewInv.StrippedTranslations(); + + m_NeedUpdate = false; +} + +//---------------------------------------------------------------------------- +// +// CCameraFps +// +//---------------------------------------------------------------------------- + +CCameraFps::CCameraFps() +: m_Angles(0) +{ +} + +//---------------------------------------------------------------------------- + +void CCameraFps::Update() +{ + m_NeedUpdate = false; + + CFloat4x4 outMatrix; + CFloat4x4 pitch; + CFloat4x4 yaw; + CFloat4x4 roll; + + const CInt3 &axesRemapper = CCoordinateFrame::AxesRemapper(CCoordinateFrame::GlobalFrame()); + const CUint3 axesIndexer = PKAbs(axesRemapper) - 1; + const CFloat3 signs = CFloat3((axesRemapper >> 31) | 1) * CCoordinateFrame::CrossSign(); + + MatrixTools::BuildRotationMatrixAxis(axesIndexer.x(), m_Angles.x() * signs.x(), pitch); + MatrixTools::BuildRotationMatrixAxis(axesIndexer.y(), m_Angles.y() * signs.y(), yaw); + MatrixTools::BuildRotationMatrixAxis(axesIndexer.z(), m_Angles.z() * signs.z(), roll); + + outMatrix = (yaw * pitch) * roll; + + // FIXME(Julien): This is just plain wrong, and countless unneeded matrix inversions. + // We should build the WORLD matrix. And use it to compute the VIEW matrix. + // The view matrix converts from world to view, the world matrix converts from view to world, + // and is more straightforward to compute. Fix this + + CFloat4x4 matTr = CFloat4x4::IDENTITY; + matTr.StrippedTranslations() = -m_Cam.m_Position; + + outMatrix = matTr * outMatrix; + + m_Cam.m_View = outMatrix; + + m_Cam.Update(); +} + +//---------------------------------------------------------------------------- + +void CCameraFps::ViewOffsetPositionRUF(const CFloat3 &offsetRUF) +{ + if (offsetRUF == CFloat3(0)) + return; + + const CFloat3 worldOffset = offsetRUF.x() * CCoordinateFrame::MatrixAxis(m_Cam.m_ViewInv, Axis_Right) + + offsetRUF.y() * CCoordinateFrame::MatrixAxis(m_Cam.m_ViewInv, Axis_Up) + + offsetRUF.z() * CCoordinateFrame::MatrixAxis(m_Cam.m_ViewInv, Axis_Forward); + + m_Cam.m_Position += worldOffset; + m_NeedUpdate = true; +} + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/Camera.h b/Samples/PK-SampleLib/Camera.h new file mode 100644 index 00000000..1194f201 --- /dev/null +++ b/Samples/PK-SampleLib/Camera.h @@ -0,0 +1,162 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" + +#include +#include +#include +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SCamera +{ + CFloat4x4 m_View; + CFloat4x4 m_Proj; // Embeds the User to RHYup matrix + CFloat3 m_Position; + CFloat4x4 m_ViewInv; + CFloat4x4 m_ProjInv; + CFrustum m_ViewFrustum; + CFloat2 m_WinSize; + float m_ProjFovy; + float m_ProjNear; + float m_ProjFar; + + CFloat3 Ray(const CFloat2 &mousePosPixel) const; + const CFloat3 &Position() const { return m_Position; } + const CFloat4x4 &Proj() const { return m_Proj; } + const CFrustum &ViewFrustum() const { return m_ViewFrustum; } + const CFloat4x4 &View() const { return m_View; } + const CFloat2 WindowSize() const { return m_WinSize; } + const CFloat2 ZLimits() const { return CFloat2(m_ProjNear, m_ProjFar); } + + void Update() + { + m_ViewInv = m_View.Inverse(); + m_ProjInv = m_Proj.Inverse(); + + const CFloat4x4 viewProj = m_View * m_Proj; + m_ViewFrustum.SetupFromMatrix(viewProj, CAABB::NORMALIZED_M1P1); + } + + SCamera() + : m_View(CFloat4x4::IDENTITY) + , m_Proj(CFloat4x4::IDENTITY) + , m_Position(0) + , m_ViewInv(CFloat4x4::IDENTITY) + , m_ProjInv(CFloat4x4::IDENTITY) + , m_WinSize(0) + , m_ProjFovy(0) + , m_ProjNear(0) + , m_ProjFar(0) + { + } +}; + +//---------------------------------------------------------------------------- + +class CCameraBase +{ +public: + CCameraBase(); + + const SCamera &Camera() const { return m_Cam; } + + void SetLookAt(const CFloat3 &lookAt) { m_LookAt = lookAt; m_NeedUpdate = true; } + void SetPosition(const CFloat3 &position) { m_Cam.m_Position = position; m_NeedUpdate = true; } + + void OffsetPosition(const CFloat3 &offset) { m_Cam.m_Position += offset; m_NeedUpdate = true; } + + // TODO: Change this, don't pass vertical FOV, this is a shortcut that causes bad behavior in almost every real-life use case when used in UI. + // openGLYFlipSign: set to '1' to revert the hardcoded OpenGL projection matrix Y axis flip. PopcornFX Editor relies on a flipped proj matrix in OpenGL. + void SetProj(float fovyDegrees, const CFloat2 &winDimPixel, float zNear, float zFar, RHI::EGraphicalApi api = RHI::GApi_Vulkan, float openGLYFlipSign = -1); // perspective-projection + void SetProj(const CFloat2 &winDimPixel, float zNear, float zFar, RHI::EGraphicalApi api = RHI::GApi_Vulkan, float openGLYFlipSign = -1); // othogonal-projection + + bool NeedUpdate() const { return m_NeedUpdate; } + const CFloat3 &Position() const { return m_Cam.m_Position; } + const CFloat3 &LookAt() const { return m_LookAt; } + const CFloat4x4 &View() const { return m_Cam.View(); } + const CFrustum &ViewFrustum() const { return m_Cam.ViewFrustum(); } + const CFloat4x4 &Proj() const { return m_Cam.Proj(); } + CFloat2 ZLimits() const { return m_Cam.ZLimits(); } + float BoundingZOffset(float radius, bool useLargestFov) const; + + CFloat2 WindowSize() const { return m_Cam.WindowSize(); } + +protected: + SCamera m_Cam; + bool m_NeedUpdate; + CFloat3 m_LookAt; +}; + +//---------------------------------------------------------------------------- + +class CCameraRotate : public CCameraBase +{ +public: + CCameraRotate(); + + void Update(); + void UpdateIFN() { if (m_NeedUpdate) Update(); } + + // 2D angles are in { yaw, pitch } order (screenspace mouse-order) + void SetAngles(const CFloat2 &angles) { SetAngles(angles.yx0()); } + void OffsetAngles(const CFloat2 &offset) { OffsetAngles(offset.yx0()); } + + // 3D angles are in { pitch, yaw, roll } order + void SetAngles(const CFloat3 &angles) { m_Angles = angles; m_NeedUpdate = true; } + void OffsetAngles(const CFloat3 &offset) { m_Angles += offset; m_NeedUpdate = true; } + + void SetDistance(float distance) { m_Distance = distance; m_NeedUpdate = true; } + void OffsetDistance(float offset) { m_Distance += offset; m_NeedUpdate = true; } + + const CFloat3 &Angles() const { return m_Angles; } + float Distance() const { return m_Distance; } + +protected: + float m_Distance; + CFloat3 m_Angles; +}; + +//---------------------------------------------------------------------------- + +class CCameraFps : public CCameraBase +{ +public: + CCameraFps(); + + void Update(); + void UpdateIFN() { if (m_NeedUpdate) Update(); } + + // 2D angles are in { yaw, pitch } order (screenspace mouse-order) + void SetAngles(const CFloat2 &angles) { SetAngles(angles.yx0()); } + void OffsetAngles(const CFloat2 &offset) { OffsetAngles(offset.yx0()); } + + // 3D angles are in { pitch, yaw, roll } order + void SetAngles(const CFloat3 &angles) { m_Angles = angles; m_NeedUpdate = true; } + void OffsetAngles(const CFloat3 &offset) { m_Angles += offset; m_NeedUpdate = true; } + + void ViewOffsetPositionRUF(const CFloat3 &offsetRUF); // Offset is expected to be in Right, Up, Forward format + + // pitch, yaw, roll euler angles + const CFloat3 &Angles() const { return m_Angles; } + +protected: + CFloat3 m_Angles; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/DebugHelper.cpp b/Samples/PK-SampleLib/DebugHelper.cpp new file mode 100644 index 00000000..103846df --- /dev/null +++ b/Samples/PK-SampleLib/DebugHelper.cpp @@ -0,0 +1,111 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "DebugHelper.h" +#include "ShaderDefinitions/EditorShaderDefinitions.h" +#include "ShaderLoader.h" + +// Debug draw shaders: +#define DEBUG_DRAW_VERTEX_SHADER_PATH "./Shaders/DebugDraw.vert" +#define DEBUG_DRAW_FRAGMENT_SHADER_PATH "./Shaders/DebugDrawColor.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +bool SDebugDraw::CreateRenderStates( const RHI::PApiManager &apiManager, + CShaderLoader &shaderLoader, + TMemoryView frameBufferLayout, + RHI::PRenderPass renderPass, + CGuid mergeSubPassIdx) +{ + // m_LinesRenderState + { + m_LinesRenderState = apiManager->CreateRenderState(RHI::SRHIResourceInfos("Lines Render State")); + if (m_LinesRenderState == null) + return false; + RHI::SRenderState &renderState = m_LinesRenderState->m_RenderState; + + renderState.m_PipelineState.m_DynamicViewport = true; + renderState.m_PipelineState.m_DynamicScissor = true; + renderState.m_PipelineState.m_DepthTest = RHI::LessOrEqual; + renderState.m_PipelineState.m_DepthWrite = false; + renderState.m_PipelineState.m_Blending = false; + renderState.m_PipelineState.m_DrawMode = RHI::DrawModeLine; + + if (!renderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat3); + + if (!renderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat4); + + PKSample::FillEditorDebugDrawShaderBindings(renderState.m_ShaderBindings, true, false); + PKSample::CShaderLoader::SShadersPaths paths; + paths.m_Vertex = DEBUG_DRAW_VERTEX_SHADER_PATH; + paths.m_Fragment = DEBUG_DRAW_FRAGMENT_SHADER_PATH; + if (!shaderLoader.LoadShader(m_LinesRenderState->m_RenderState, paths, apiManager)) + return false; + if (!apiManager->BakeRenderState(m_LinesRenderState, frameBufferLayout, renderPass, mergeSubPassIdx)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +void SDebugDraw::Draw( const RHI::PApiManager &apiManager, + const RHI::PCommandBuffer &cmdBuff, + const RHI::PConstantSet &sceneInfoConstantSet, + const SDebugLines &lines) +{ + if (!lines.Empty()) + { + const u32 bufferBytePositionsCount = lines.m_Points.CoveredBytes(); + const u32 bufferByteColorCount = lines.m_Colors.CoveredBytes(); + + if (m_LinesPointsColorBuffer.m_LinesPointsBuffer == null || m_LinesPointsColorBuffer.m_LinesPointsBuffer->GetByteSize() < bufferBytePositionsCount) + m_LinesPointsColorBuffer.m_LinesPointsBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Lines Points Vertex Buffer"), RHI::VertexBuffer, bufferBytePositionsCount); + + if (m_LinesPointsColorBuffer.m_LinesColorBuffer == null || m_LinesPointsColorBuffer.m_LinesColorBuffer->GetByteSize() < bufferByteColorCount) + m_LinesPointsColorBuffer.m_LinesColorBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Lines Colors Vertex Buffer"), RHI::VertexBuffer, bufferByteColorCount); + + if (m_LinesPointsColorBuffer.m_LinesPointsBuffer != null && m_LinesPointsColorBuffer.m_LinesColorBuffer != null) + { + void *ptr = apiManager->MapCpuView(m_LinesPointsColorBuffer.m_LinesPointsBuffer); + if (ptr != null) + { + Mem::Copy(ptr, lines.m_Points.RawDataPointer(), bufferBytePositionsCount); + apiManager->UnmapCpuView(m_LinesPointsColorBuffer.m_LinesPointsBuffer); + } + ptr = apiManager->MapCpuView(m_LinesPointsColorBuffer.m_LinesColorBuffer); + if (ptr != null) + { + Mem::Copy(ptr, lines.m_Colors.RawDataPointer(), bufferByteColorCount); + apiManager->UnmapCpuView(m_LinesPointsColorBuffer.m_LinesColorBuffer); + } + + cmdBuff->BindRenderState(m_LinesRenderState); + + cmdBuff->BindConstantSets(TMemoryView(sceneInfoConstantSet)); + + cmdBuff->BindVertexBuffers(TMemoryView(&m_LinesPointsColorBuffer.m_LinesPointsBuffer, 2)); + + PK_ASSERT(lines.m_Points.Count() == lines.m_Colors.Count()); + + cmdBuff->Draw(0, lines.m_Points.Count()); + } + } +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/DebugHelper.h b/Samples/PK-SampleLib/DebugHelper.h new file mode 100644 index 00000000..2db8f5f3 --- /dev/null +++ b/Samples/PK-SampleLib/DebugHelper.h @@ -0,0 +1,60 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CShaderLoader; + +//---------------------------------------------------------------------------- + +struct SDebugLines +{ + TArray m_Points; + TArray m_Colors; + + bool Empty() const { return m_Points.Empty() && m_Colors.Empty(); } + void Clear() { m_Points.Clear(); m_Colors.Clear(); } +}; + +//---------------------------------------------------------------------------- + +struct SDebugDraw +{ + bool CreateRenderStates( const RHI::PApiManager &apiManager, + CShaderLoader &shaderLoader, + TMemoryView frameBufferLayout, + RHI::PRenderPass renderPass, + CGuid subPassIdx); + + void Draw( const RHI::PApiManager &apiManager, + const RHI::PCommandBuffer &cmdBuff, + const RHI::PConstantSet &sceneInfoConstantSet, + const SDebugLines &lines); + + struct SLinePointsColorBuffer + { + RHI::PGpuBuffer m_LinesPointsBuffer; + RHI::PGpuBuffer m_LinesColorBuffer; + }; + + SLinePointsColorBuffer m_LinesPointsColorBuffer; + RHI::PRenderState m_LinesRenderState; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/Gizmo.cpp b/Samples/PK-SampleLib/Gizmo.cpp new file mode 100644 index 00000000..76e83d73 --- /dev/null +++ b/Samples/PK-SampleLib/Gizmo.cpp @@ -0,0 +1,1772 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "Gizmo.h" +#include "SampleUtils.h" +#include "Camera.h" +#include "ShaderLoader.h" +#include "ShaderDefinitions/SampleLibShaderDefinitions.h" + +#include + +#include + +#include +#include + +#include + +#include +#include +#include + +#include + +#if GIZMODRAWER_USE_IMGUI == 1 +#include +#endif + +#define GIZMO_VERTEX_SHADER_PATH "./Shaders/Gizmo.vert" +#define GIZMO_FRAGMENT_SHADER_PATH "./Shaders/Gizmo.frag" + +#define GIZMO_AXIS_FLIP 0 // 1 : The Gizmo axis are always looking-front to the camera. + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CGizmo::CGizmo(const SGizmoGeometryDesc &geomDesc) +: m_Type(GizmoNone) +, m_SelfScale(0.13f) +, m_GeomDesc(geomDesc) +, m_Clicked(false) +, m_FrameLocal(false) +, m_AllowedModesMask(GizmoNone | GizmoShowAxis | GizmoShowAxisWithoutNames) +, m_ParentTransform(CFloat4x4::IDENTITY) +, m_ParentPureRotation(CFloat4x4::IDENTITY) +, m_Transform(CFloat4x4::IDENTITY) +, m_DeltaTransform(CFloat4x4::IDENTITY) +, m_TransformChanged(false) +, m_GrabbedAxis(0) +, m_HoveredAxis(0) +{ +} + +//---------------------------------------------------------------------------- + +void CGizmo::SetParentTransform(const CFloat4x4 &transform) +{ + if (!IsGrabbed()) // if the user is manipulating the Gizmo, then we ignore concurrent update. + { + m_ParentTransform = transform; + + const CFloat3 scalingFactors = m_ParentTransform.ScalingFactors(); + m_ParentPureRotation.XAxis() = m_ParentTransform.XAxis() / scalingFactors.x(); + m_ParentPureRotation.YAxis() = m_ParentTransform.YAxis() / scalingFactors.y(); + m_ParentPureRotation.ZAxis() = m_ParentTransform.ZAxis() / scalingFactors.z(); + + _TransformFromOutput(); + } +} + +//---------------------------------------------------------------------------- + +void CGizmo::ClearOutputToUpdate() +{ + if (!IsGrabbed()) + { + m_AllowedModesMask = GizmoNone; + m_TargetObjects.Clear(); + m_TransformChanged = false; + } +} + +//---------------------------------------------------------------------------- + +bool CGizmo::PushBackObject(CFloat4x4 *transform, u32 allowedModesMask /*= GizmoTranslating | GizmoRotating | GizmoScaling*/) +{ + if (IsGrabbed()) + return false; // when grabbed, you can't add objects (even if this object is already bound). + + { + m_AllowedModesMask |= allowedModesMask; + + const CGuid objectId = m_TargetObjects.PushBack(STargetObject(transform, allowedModesMask)); + _TransformFromOutput(); + return objectId.Valid(); + } +} + +//---------------------------------------------------------------------------- + +#ifdef PK_HAS_GIZMO_STD_FUNCTIONS + +bool CGizmo::PushBackObject(const CFloat4x4 &transform, const fnObjectUpdate &updateFromTransform, u32 allowedModesMask /*= GizmoTranslating | GizmoRotating | GizmoScaling*/) +{ + if (IsGrabbed()) + return false; // when grabbed, you can't add objects (even if this object is already bound). + + { + m_AllowedModesMask |= allowedModesMask; + + const CGuid objectId = m_TargetObjects.PushBack(STargetObject(transform, updateFromTransform, allowedModesMask)); + _TransformFromOutput(); + return objectId.Valid(); + } +} + +//---------------------------------------------------------------------------- + +bool CGizmo::PushBackObject(CBaseObject *object_position, u32 fieldID_position, CBaseObject *object_eulerOrientation, u32 fieldID_eulerOrientation) +{ + if (IsGrabbed()) + return false; // when grabbed, you can't add objects (even if this object is already bound). + + CFloat4x4 transform = CFloat4x4::IDENTITY; + u32 allowedModes = 0; + bool isPositionF4 = false; + bool isRotationF4 = false; + + if (object_position != null) + { + isPositionF4 = object_position->GetFieldDefinition(fieldID_position).Type() == HBO::SGenericType(HBO::GenericType_Float4, false); + PK_ASSERT(isPositionF4 || object_position->GetFieldDefinition(fieldID_position).Type() == HBO::SGenericType(HBO::GenericType_Float3, false)); + + const CFloat3 posXYZ = (isPositionF4) ? object_position->GetField(fieldID_position).xyz() : object_position->GetField(fieldID_position); + const CFloat3 posSUF = CCoordinateFrame::TransposeFrame(ECoordinateFrame::Frame_RightHand_Y_Up, CCoordinateFrame::GlobalFrame(), posXYZ); + transform.StrippedTranslations() = posSUF; + allowedModes |= GizmoTranslating; + } + + if (object_eulerOrientation != null) + { + isRotationF4 = object_eulerOrientation->GetFieldDefinition(fieldID_eulerOrientation).Type() == HBO::SGenericType(HBO::GenericType_Float4, false); + PK_ASSERT(isRotationF4 || object_eulerOrientation->GetFieldDefinition(fieldID_eulerOrientation).Type() == HBO::SGenericType(HBO::GenericType_Float3, false)); + + const CFloat3 rotXYZ = (isRotationF4) ? object_eulerOrientation->GetField(fieldID_eulerOrientation).xyz() : object_eulerOrientation->GetField(fieldID_eulerOrientation); + const CQuaternion orientationXYZ = Transforms::Quaternion::FromEuler(Units::DegreesToRadians(rotXYZ)); + const CQuaternion orientationSUF = CCoordinateFrame::TransposeFrame(ECoordinateFrame::Frame_RightHand_Y_Up, CCoordinateFrame::GlobalFrame(), orientationXYZ); + transform = Transforms::Matrix::FromQuaternion(orientationSUF, transform.WAxis()); + allowedModes |= GizmoRotating; + } + + fnObjectUpdate updateFn = [object_position, fieldID_position, object_eulerOrientation, fieldID_eulerOrientation, isPositionF4, isRotationF4](u32 currentMode, const CFloat4x4 &xform) + { + if (object_position != null && currentMode == GizmoTranslating) + { + const CFloat3 posXYZ = CCoordinateFrame::TransposeFrame(CCoordinateFrame::GlobalFrame(), ECoordinateFrame::Frame_RightHand_Y_Up, xform.StrippedTranslations()); + if (isPositionF4) + object_position->SetField(fieldID_position, posXYZ.xyz0()); + else + object_position->SetField(fieldID_position, posXYZ); + } + + if (object_eulerOrientation != null && currentMode == GizmoRotating) + { + const CQuaternion orientationSUF = Transforms::Quaternion::FromMatrix(xform); + const CQuaternion orientationXYZ = CCoordinateFrame::TransposeFrame(CCoordinateFrame::GlobalFrame(), ECoordinateFrame::Frame_RightHand_Y_Up, orientationSUF); + const CFloat3 eulerAnglesXYZ = Units::RadiansToDegrees(Transforms::Euler::FromQuaternion(orientationXYZ)); + if (isRotationF4) + object_eulerOrientation->SetField(fieldID_eulerOrientation, eulerAnglesXYZ.xyz0()); + else + object_eulerOrientation->SetField(fieldID_eulerOrientation, eulerAnglesXYZ); + } + }; + + return PushBackObject(transform, updateFn, allowedModes); +} + +#endif // PK_HAS_GIZMO_STD_FUNCTIONS + +//---------------------------------------------------------------------------- + +void CGizmo::ApplyGizmoTransform() +{ + m_TransformChanged = false; // Clear dirty flag (fix #6002) + + if (m_Type == GizmoTranslating) + { + const CFloat3 outTranslationWorld = m_DeltaTransform.StrippedTranslations(); + const CFloat3 outTranslationLocal = m_ParentTransform.Crop<3, 3>().Inverse().RotateVector(outTranslationWorld); // TODO better + + for (auto &object : m_TargetObjects) + { + if ((object.m_AllowedGizmoModes & GizmoTranslating) != 0) + { + object.m_Transform.StrippedTranslations() = object.m_TransformPrev.StrippedTranslations() + outTranslationLocal; + } + } + } + else if (m_Type == GizmoScaling) + { + const CFloat4x4 &scaleMatrix = m_DeltaTransform; + + if (m_FrameLocal) + { + for (auto &object : m_TargetObjects) + { + if ((object.m_AllowedGizmoModes & GizmoScaling) != 0) + { + object.m_Transform = scaleMatrix * object.m_TransformPrev; + } + } + } + else + { + // this case will make the local-transform matrix non-orthogonal anymore, but we must avoid this !! + // So the resulting transform will not match exactly with the gizmo transform. + + for (auto &object : m_TargetObjects) + { + if ((object.m_AllowedGizmoModes & GizmoScaling) != 0) + { + const CFloat4x4 newTransform = object.m_TransformPrev * m_ParentPureRotation * scaleMatrix * m_ParentPureRotation.Transposed(); + const CFloat3 scaleFactorOld = object.m_TransformPrev.AbsScalingFactors(); + CFloat3 scaleFactorNew = newTransform.AbsScalingFactors(); + + if (object.m_TransformPrev.XAxis().Dot(newTransform.XAxis()) < 0.f) + scaleFactorNew.x() *= -1.f; + if (object.m_TransformPrev.YAxis().Dot(newTransform.YAxis()) < 0.f) + scaleFactorNew.y() *= -1.f; + if (object.m_TransformPrev.ZAxis().Dot(newTransform.ZAxis()) < 0.f) + scaleFactorNew.z() *= -1.f; + + CFloat4x4 localScaleMatrix; + localScaleMatrix.XAxis() = CFloat4::XAXIS * (scaleFactorNew.x() / scaleFactorOld.x()); + localScaleMatrix.YAxis() = CFloat4::YAXIS * (scaleFactorNew.y() / scaleFactorOld.y()); + localScaleMatrix.ZAxis() = CFloat4::ZAXIS * (scaleFactorNew.z() / scaleFactorOld.z()); + localScaleMatrix.WAxis() = CFloat4::WAXIS; + + const CFloat3 center = object.m_Transform.StrippedTranslations(); + object.m_Transform = localScaleMatrix * object.m_TransformPrev; + object.m_Transform.StrippedTranslations() = center; + } + } + } + } + else if (m_Type == GizmoRotating) + { + const CFloat4x4 &rotateMatrix = m_DeltaTransform; // Already in local-space. + + for (auto &object : m_TargetObjects) + { + if ((object.m_AllowedGizmoModes & GizmoRotating) != 0) + { + object.m_Transform = object.m_TransformPrev * rotateMatrix; + object.m_Transform.StrippedTranslations() = object.m_TransformPrev.StrippedTranslations(); + } + } + } + else + { + PK_ASSERT_NOT_REACHED(); + } + + // Feed back to the bound objects: update their out-transform (or call the update-function). + for (auto &object : m_TargetObjects) + { + if ((object.m_AllowedGizmoModes & m_Type) != 0) + { + if (object.m_Object_Transform != null) + *object.m_Object_Transform = object.m_Transform; + +#ifdef PK_HAS_GIZMO_STD_FUNCTIONS + if (object.m_UpdateFnct) + object.m_UpdateFnct(m_Type, object.m_Transform); +#endif + } + } + +} + +//---------------------------------------------------------------------------- + +void CGizmo::UpdateCameraInfo(const CCameraBase &camera) +{ + const CFloat4x4 viewProj = camera.View() * camera.Proj(); + + m_ContextSize = camera.WindowSize(); + m_ViewTransposed = camera.View().Transposed(); + m_ViewProj = viewProj; + m_CameraPosition = camera.Position(); + m_InvViewProj = viewProj.Inverse(); + + if (!IsGrabbed()) + _TransformReset(); +} + +//---------------------------------------------------------------------------- + +void CGizmo::SetMouseClicked(const CInt2 &mousePosition, bool clicked) +{ + if (clicked) + { + // check if something has been selected + _CheckSelection(m_GrabbedAxis, mousePosition, &m_MouseWorldPositionPrev); + m_Clicked = m_GrabbedAxis != CUint4::ZERO; + m_HoveredAxis = CUint4::ZERO; + if (m_Clicked) // set the "prev"-transforms + { + m_TransformPrev = m_Transform; + for (auto &object : m_TargetObjects) + object.m_TransformPrev = object.m_Transform; + } + } + else + { + m_GrabbedAxis = CUint4::ZERO; + m_Clicked = false; + _TransformReset(); + } +} + +//---------------------------------------------------------------------------- + +void CGizmo::SetMouseMoved(const CInt2 &mousePosition) +{ + const bool isGrabbed = m_GrabbedAxis != CUint4::ZERO; + + if (m_Clicked && isGrabbed) + { + // mouse-drag + _ApplyMouseMove(mousePosition); + } + + if (!m_Clicked && !isGrabbed) + { + // check mouse hover + _CheckSelection(m_HoveredAxis, mousePosition); + } +} + +//---------------------------------------------------------------------------- + +CFloat2 CGizmo::ProjectPointOnScreen(const CFloat3 &point, const CFloat4x4 &mvp, const CUint2 &screenSize) +{ + CFloat4 projected = mvp.TransformVector(CFloat4(point, 1)); + + projected /= projected.w(); + projected.xy() = projected.xy() * 0.5f + 0.5f; + projected.xy() *= screenSize; + return projected.xy(); +} + +//---------------------------------------------------------------------------- + +CFloat3 CGizmo::UnprojectPointToWorld(const CFloat3 &pixelCoords, const CFloat4x4 &inverseMVP, const CUint2 &screenSize) +{ + CFloat4 unproj = CFloat4(pixelCoords.xy() / CFloat2(screenSize), pixelCoords.z(), 1); + + unproj.xy() = unproj.xy() * 2.0f - 1.0f; + unproj = inverseMVP.TransformVector(unproj); + unproj /= unproj.w(); + return unproj.xyz(); +} + +//---------------------------------------------------------------------------- + +float CGizmo::_GetViewScale() const +{ + const CFloat3 viewFoward = m_ViewTransposed.Axis(CCoordinateFrame::AxisIndexer(Axis_Forward)).xyz(); + const CFloat3 camToPos = m_Transform.StrippedTranslations() - m_CameraPosition; + return PKAbs(m_SelfScale * viewFoward.Dot(camToPos)); +} + +//---------------------------------------------------------------------------- + +float CGizmo::_GetViewScalePre() const +{ + const CFloat3 viewFoward = m_ViewTransposed.Axis(CCoordinateFrame::AxisIndexer(Axis_Forward)).xyz(); + const CFloat3 camToPos = m_TransformPrev.StrippedTranslations() - m_CameraPosition; + return PKAbs(m_SelfScale * viewFoward.Dot(camToPos)); +} + +//---------------------------------------------------------------------------- + +void CGizmo::_TransformReset() +{ + if (m_FrameLocal) + { + const float sX = m_Transform.StrippedXAxis().Length(); + const float invSX = sX < 1.e-12f ? 1.e12f : 1.f / sX; + m_Transform.XAxis() *= invSX; + + const float sY = m_Transform.StrippedYAxis().Length(); + const float invSY = sY < 1.e-12f ? 1.e12f : 1.f / sY; + m_Transform.YAxis() *= invSY; + + const float sZ = m_Transform.StrippedZAxis().Length(); + const float invSZ = sZ < 1.e-12f ? 1.e12f : 1.f / sZ; + m_Transform.ZAxis() *= invSZ; + } + else + { + m_Transform.XAxis() = CFloat4::XAXIS; + m_Transform.YAxis() = CFloat4::YAXIS; + m_Transform.ZAxis() = CFloat4::ZAXIS; + } + +#if GIZMO_AXIS_FLIP != 0 + // also compute the sign to have the Gizmo facing the camera ... + + const CFloat3 camToPos = m_ParentTransform.TransformVector(m_Transform.StrippedTranslations()) - m_CameraPosition; + + if (camToPos.Dot(m_Transform.StrippedXAxis()) > 0.f) + m_Transform.XAxis() = -m_Transform.XAxis(); + + if (camToPos.Dot(m_Transform.StrippedYAxis()) > 0.f) + m_Transform.YAxis() = -m_Transform.YAxis(); + + if (camToPos.Dot(m_Transform.StrippedZAxis()) > 0.f) + m_Transform.ZAxis() = -m_Transform.ZAxis(); +#endif + + // Build View-space transform for rotation handles (eq. half-torus drawing) + if (m_Type == GizmoRotating) + { + _TransformComputeRotating(); + } + + m_DeltaTransform = CFloat4x4::IDENTITY; +} + +//---------------------------------------------------------------------------- + +void CGizmo::_TransformFromOutput() +{ + if (IsGrabbed()) + { + // if grabbed, cancel the move + m_Transform = m_TransformPrev; + } + else + { + // merge value from all objects' transform + CFloat4x4 transformObjects = CFloat4x4::IDENTITY; + + { + u32 canRotateCount = 0; + for (const auto &object : m_TargetObjects) + { + transformObjects = object.m_Transform; + if ((object.m_AllowedGizmoModes & GizmoRotating) != 0) + ++canRotateCount; + } + transformObjects.WAxis() = CFloat4::WAXIS; + if (canRotateCount > 1) + transformObjects = CFloat4x4::IDENTITY; + } + + { + u32 canTranslateCount = 0; + CFloat3 posMid = CFloat3::ZERO; + for (const auto &object : m_TargetObjects) + { + posMid += object.m_Transform.StrippedWAxis(); + if ((m_AllowedModesMask & GizmoTranslating) != 0) + ++canTranslateCount; + } + if (canTranslateCount != 0) + transformObjects.StrippedWAxis() = posMid / canTranslateCount; + } + + m_Transform = m_ParentTransform * transformObjects; + } + + _TransformReset(); +} + +//---------------------------------------------------------------------------- + +void CGizmo::_TransformComputeRotating() +{ + PK_ASSERT(m_Transform.Orthonormal()); + + m_TransformRotating[0] = m_TransformRotating[1] = m_TransformRotating[2] = m_Transform; + + PK_ASSERT(m_Type == GizmoRotating); + const CFloat3 viewDepth = (m_CameraPosition - m_Transform.StrippedTranslations()).Normalized(); + + // m_TransformRotating[0] => axisX -> transformX, axisY -> viewDepth + const CFloat3 new0_Y = viewDepth - viewDepth.Dot(m_TransformRotating[0].StrippedXAxis()) * m_TransformRotating[0].StrippedXAxis(); + if (!new0_Y.IsZero()) + { + m_TransformRotating[0].StrippedYAxis() = new0_Y.Normalized(); + m_TransformRotating[0].StrippedZAxis() = m_TransformRotating[0].StrippedXAxis().Cross(m_TransformRotating[0].StrippedYAxis()); + } + + // m_TransformRotating[1] => axisY -> transformY, axisZ -> viewDepth + const CFloat3 new1_Z = viewDepth - viewDepth.Dot(m_TransformRotating[1].StrippedYAxis()) * m_TransformRotating[1].StrippedYAxis(); + if (!new1_Z.IsZero()) + { + m_TransformRotating[1].StrippedZAxis() = new1_Z.Normalized(); + m_TransformRotating[1].StrippedXAxis() = m_TransformRotating[1].StrippedYAxis().Cross(m_TransformRotating[1].StrippedZAxis()); + } + + // m_TransformRotating[2] => axisZ -> transformZ, axisX -> viewDepth + const CFloat3 new2_X = viewDepth - viewDepth.Dot(m_TransformRotating[2].StrippedZAxis()) * m_TransformRotating[2].StrippedZAxis(); + if (!new2_X.IsZero()) + { + m_TransformRotating[2].StrippedXAxis() = new2_X.Normalized(); + m_TransformRotating[2].StrippedYAxis() = m_TransformRotating[2].StrippedZAxis().Cross(m_TransformRotating[2].StrippedXAxis()); + } + + // m_TransformRotating[3] => axisZ -> viewDepth + const CUint3 axesIndexer = CCoordinateFrame::AxesIndexer(); + const CFloat3 trY = viewDepth.Cross(m_ViewTransposed.Axis(axesIndexer.x()).xyz()); + if (!trY.IsZero()) + { + m_TransformRotating[3].XAxis() = trY.Cross(viewDepth).Normalized().xyz0(); + m_TransformRotating[3].YAxis() = trY.Normalized().xyz0(); + m_TransformRotating[3].ZAxis() = viewDepth.xyz0(); + } + else + { + m_TransformRotating[3].XAxis() = m_ViewTransposed.Axis(axesIndexer.x()).xyz0(); + m_TransformRotating[3].YAxis() = m_ViewTransposed.Axis(axesIndexer.y()).xyz0(); + m_TransformRotating[3].ZAxis() = m_ViewTransposed.Axis(axesIndexer.z()).xyz0(); + } + m_TransformRotating[3].Translations() = m_Transform.Translations(); +} + +//---------------------------------------------------------------------------- + +void CGizmo::_ApplyMouseMove(const CInt2 &mouseScreenPosition) +{ + if ((m_Type & m_AllowedModesMask) == 0) + return; + + const CFloat4x4 frame = m_Transform; + + PK_ASSERT(m_Clicked && m_GrabbedAxis != CUint4::ZERO); + + CFloat3 viewDepth; + if (m_Type == GizmoRotating) + { + viewDepth = (m_CameraPosition - m_Transform.StrippedTranslations()).Normalized(); + } + else + { + viewDepth = m_ViewTransposed.Axis(CCoordinateFrame::AxisIndexer(Axis_Backward)).xyz(); + if (CCoordinateFrame::AxisRemapper(Axis_Backward) < 0) + viewDepth = -viewDepth; + } + + // Construct the "mouseWorldPos" depending on projection + CFloat3 mouseWorldPos = CFloat3::ZERO; + + { + const CFloat3 mouseWorldPosFar = UnprojectPointToWorld(CFloat3(mouseScreenPosition, 1.f), m_InvViewProj, m_ContextSize); + const CFloat3 mouseDirection = mouseWorldPosFar - m_CameraPosition; + + const CFloat3 cameraToPos = frame.StrippedTranslations() - m_CameraPosition; + + const bool projAxisX = m_Type != GizmoRotating ? m_GrabbedAxis.Axis(0) != 0 : m_GrabbedAxis.Axis(0) == 0; + const bool projAxisY = m_Type != GizmoRotating ? m_GrabbedAxis.Axis(1) != 0 : m_GrabbedAxis.Axis(1) == 0; + const bool projAxisZ = m_Type != GizmoRotating ? m_GrabbedAxis.Axis(2) != 0 : m_GrabbedAxis.Axis(2) == 0; + const bool projSphere = m_Type == GizmoRotating && m_GrabbedAxis.xyz() == CUint3::ONE; + const bool projScreenP = (m_Type != GizmoRotating && m_GrabbedAxis.xyz() == CUint3::ONE) || m_GrabbedAxis.w() != 0; + + if (projSphere) + { + // project on sphere + const float radius = _GetViewScale() * (m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight); + + const CFloat3 ray = mouseDirection.Normalized(); + const float tRayCenter = cameraToPos.Dot(ray); + const float tOffsetSquared = tRayCenter * tRayCenter - cameraToPos.LengthSquared() + radius * radius; + + if (tOffsetSquared < 0.f) // the ray does not hit the sphere + { + const CFloat3 PosToSphere = radius * ((tRayCenter * ray - cameraToPos).Normalized()); + mouseWorldPos = frame.StrippedTranslations() + PosToSphere; + } + else // the ray hits the sphere + { + const float tOffset = PKSqrt(tOffsetSquared); + const float tRayClosestPoint = tRayCenter - tOffset; + mouseWorldPos = m_CameraPosition + tRayClosestPoint * ray; + } + } + else if (projScreenP) + { + // project on screen-plane with direction = mouseDirection + const CFloat3 planeNormal = viewDepth; + mouseWorldPos = m_CameraPosition + mouseDirection * (planeNormal.Dot(cameraToPos) / planeNormal.Dot(mouseDirection)); + } + else if (projAxisX & projAxisY) + { + // project on XY-plane with direction = mouseDirection + const CFloat3 planeNormal = frame.Axis(2).xyz(); + mouseWorldPos = m_CameraPosition + mouseDirection * (planeNormal.Dot(cameraToPos) / planeNormal.Dot(mouseDirection)); + } + else if (projAxisX & projAxisZ) + { + // project on XZ-plane with direction = mouseDirection + const CFloat3 planeNormal = frame.Axis(1).xyz(); + mouseWorldPos = m_CameraPosition + mouseDirection * (planeNormal.Dot(cameraToPos) / planeNormal.Dot(mouseDirection)); + } + else if (projAxisY & projAxisZ) + { + // project on YZ-plane with direction = mouseDirection + const CFloat3 planeNormal = frame.Axis(0).xyz(); + mouseWorldPos = m_CameraPosition + mouseDirection * (planeNormal.Dot(cameraToPos) / planeNormal.Dot(mouseDirection)); + } + else if (projAxisX | projAxisY | projAxisZ) + { + const u32 axisIdx = projAxisZ ? 2 : (projAxisY ? 1 : 0); + const CFloat3 axis = frame.Axis(axisIdx).xyz(); +#if 1 // pre-2D-Projection (not perfect but better than nothing) + CFloat3 newMouseDirection = mouseDirection; + const CFloat2 gizmoScreenPosition = ProjectPointOnScreen(m_TransformPrev.StrippedTranslations(), m_ViewProj, m_ContextSize); + const CFloat2 gizmoScreenPositionDx = ProjectPointOnScreen(m_TransformPrev.StrippedTranslations() + axis * _GetViewScale(), m_ViewProj, m_ContextSize); + CFloat2 axis2D = gizmoScreenPositionDx - gizmoScreenPosition; + if (!axis2D.IsZero()) + { + axis2D.Normalize(); + const CFloat2 mouseScreenProjected = gizmoScreenPosition + axis2D.Dot(mouseScreenPosition - gizmoScreenPosition) * axis2D; + // mouseScreenProjected : we can do even better, with a 2D-projection using the on-screen-viewSide direction along the (gizmoScreenPosition, axis2D). + // get a new 3D-ray + const CFloat3 mouseWorldProjected = UnprojectPointToWorld(mouseScreenProjected.xy1(), m_InvViewProj, m_ContextSize); + newMouseDirection = mouseWorldProjected - m_CameraPosition; + } +#else + const CFloat3 newMouseDirection = mouseDirection; +#endif + // project on X-axis with direction = mouseDirection + const CFloat3 cross = axis.Cross(newMouseDirection); + // -> project on (rayDir,cross)-plane with direction = mouseDirection + const CFloat3 planeNormal1 = cross.Cross(axis); + const CFloat3 posToProj = newMouseDirection * (planeNormal1.Dot(cameraToPos) / planeNormal1.Dot(newMouseDirection)) - cameraToPos; + // -> distance along the axis + const float tAxis = posToProj.Dot(axis) / axis.LengthSquared(); + mouseWorldPos = frame.StrippedTranslations() + tAxis * axis; + } + else + { + PK_ASSERT_NOT_REACHED(); + } + } + + // Now, apply the new transform on the Gizmo + + if (m_Type == GizmoTranslating) + { + if (viewDepth.Dot(mouseWorldPos - m_CameraPosition) > 0.f) + { + // cancel translating + _TransformFromOutput(); + m_TransformChanged = true; + return; + } + + const CFloat3 outTranslationWorld = mouseWorldPos - m_MouseWorldPositionPrev; + m_DeltaTransform.StrippedTranslations() = outTranslationWorld; + m_Transform.StrippedTranslations() = m_TransformPrev.StrippedTranslations() + outTranslationWorld; + + m_TransformChanged = true; + } + else if (m_Type == GizmoScaling) + { + if (viewDepth.Dot(mouseWorldPos - m_CameraPosition) > 0.f) + { + // cancel scaling + _TransformFromOutput(); + m_TransformChanged = true; + return; + } + + const CFloat3 position = frame.StrippedTranslations(); + + if (m_GrabbedAxis.xyz() == CUint3::ONE) // specific case : global scaling + { + const float projParam = (mouseWorldPos - position).Dot(m_ViewTransposed.Axis(CCoordinateFrame::AxisIndexer(Axis_Left)).xyz()); + const float scaleFactor = projParam + 1.f; + + m_Transform.XAxis() = scaleFactor * m_TransformPrev.XAxis(); + m_Transform.YAxis() = scaleFactor * m_TransformPrev.YAxis(); + m_Transform.ZAxis() = scaleFactor * m_TransformPrev.ZAxis(); + + m_DeltaTransform.XAxis() = scaleFactor * CFloat4::XAXIS; + m_DeltaTransform.YAxis() = scaleFactor * CFloat4::YAXIS; + m_DeltaTransform.ZAxis() = scaleFactor * CFloat4::ZAXIS; + + m_TransformChanged = true; + } + else + { + const CFloat3 vectorPrev = m_MouseWorldPositionPrev - position; + const float scaleNewOld = vectorPrev.Dot(mouseWorldPos - position); + const float scaleSquaredPrev = vectorPrev.LengthSquared(); + const float scaleFactor = scaleSquaredPrev < 1.e-6f ? 0.f : scaleNewOld / scaleSquaredPrev; // = scaleNew * scaleOld / (scaleOld * scaleOld) = scaleNew / scaleOld + + { + CFloat4x4 scaleMatrix = CFloat4x4::IDENTITY; + if (m_GrabbedAxis.Axis(0) != 0) + scaleMatrix.Axis(0) *= scaleFactor; + if (m_GrabbedAxis.Axis(1) != 0) + scaleMatrix.Axis(1) *= scaleFactor; + if (m_GrabbedAxis.Axis(2) != 0) + scaleMatrix.Axis(2) *= scaleFactor; + + m_Transform = scaleMatrix * m_TransformPrev; + + m_DeltaTransform = scaleMatrix; + + m_TransformChanged = true; + } + } + } + else if (m_Type == GizmoRotating) + { + const CFloat3 position = frame.StrippedTranslations(); + + const CFloat3 vectOld = (m_MouseWorldPositionPrev - position).Normalized(); + const CFloat3 vectNew = (mouseWorldPos - position).Normalized(); + + CFloat4x4 rotateMatrix = CFloat4x4::IDENTITY; + + if (m_GrabbedAxis.xyz() == CUint3::ONE) // specific case : global rotation + { + const CFloat3 rotationVector = vectOld.Cross(vectNew); + const float sinTheta = rotationVector.Length(); + + if (sinTheta > 1.e-6f) + { + const CFloat3 rv = rotationVector.Normalized(); + const float cosTheta = vectOld.Dot(vectNew); + const float OneMcosTheta = 1.f - cosTheta; + + rotateMatrix.StrippedXAxis() = CFloat3(cosTheta + OneMcosTheta * rv.x() * rv.x(), sinTheta * rv.z() + OneMcosTheta * rv.x() * rv.y(), -sinTheta * rv.y() + OneMcosTheta * rv.x() * rv.z()); + rotateMatrix.StrippedYAxis() = CFloat3(-sinTheta * rv.z() + OneMcosTheta * rv.y() * rv.x(), cosTheta + OneMcosTheta * rv.y() * rv.y(), sinTheta * rv.x() + OneMcosTheta * rv.y() * rv.z()); + rotateMatrix.StrippedZAxis() = CFloat3(sinTheta * rv.y() + OneMcosTheta * rv.z() * rv.x(), -sinTheta * rv.x() + OneMcosTheta * rv.z() * rv.y(), cosTheta + OneMcosTheta * rv.z() * rv.z()); + } + } + else + { + CFloat3 rv; + if (m_GrabbedAxis.Axis(0) != 0) + rv = m_TransformPrev.StrippedXAxis(); + else if (m_GrabbedAxis.Axis(1) != 0) + rv = m_TransformPrev.StrippedYAxis(); + else if (m_GrabbedAxis.Axis(2) != 0) + rv = m_TransformPrev.StrippedZAxis(); + else // (m_GrabbedAxis.Axis(3) != 0) + rv = viewDepth; + + PK_ASSERT(rv.IsNormalized()); + +#if 0 // Rotate by projection + const float sinTheta = vectOld.Cross(vectNew).Dot(rv); + const float cosTheta = vectOld.Dot(vectNew); +#else // Rotate by screen-space move + const CFloat3 moveTangent3D = rv.Cross(vectOld); + CFloat2 moveDirection2D = m_ViewProj.RotateVector(moveTangent3D).xy(); + if (moveDirection2D.IsZero()) + moveDirection2D = CFloat2(1.f, -1.f); + moveDirection2D.Normalize(); + const CInt2 mouseScreenPositionPrev = ProjectPointOnScreen(m_MouseWorldPositionPrev, m_ViewProj, m_ContextSize); + const CFloat2 deltaXY = mouseScreenPosition - mouseScreenPositionPrev; + const float theta = moveDirection2D.Dot(deltaXY) * 0.006f; // rotation-angle by pixels + const float sinTheta = sin(theta); + const float cosTheta = cos(theta); +#endif + + if (PKAbs(sinTheta) > 1.e-6f) + { + const float OneMcosTheta = 1.f - cosTheta; + + rotateMatrix.StrippedXAxis() = CFloat3(cosTheta + OneMcosTheta * rv.x() * rv.x(), sinTheta * rv.z() + OneMcosTheta * rv.x() * rv.y(), -sinTheta * rv.y() + OneMcosTheta * rv.x() * rv.z()); + rotateMatrix.StrippedYAxis() = CFloat3(-sinTheta * rv.z() + OneMcosTheta * rv.y() * rv.x(), cosTheta + OneMcosTheta * rv.y() * rv.y(), sinTheta * rv.x() + OneMcosTheta * rv.y() * rv.z()); + rotateMatrix.StrippedZAxis() = CFloat3(sinTheta * rv.y() + OneMcosTheta * rv.z() * rv.x(), -sinTheta * rv.x() + OneMcosTheta * rv.z() * rv.y(), cosTheta + OneMcosTheta * rv.z() * rv.z()); + } + } + + PK_ASSERT(m_TransformPrev.Orthonormal()); + + m_DeltaTransform = rotateMatrix; // Warning: m_DeltaTransform will be in local-space in this case. + + rotateMatrix = m_ParentPureRotation * rotateMatrix * m_ParentPureRotation.Transposed(); + + m_Transform = m_TransformPrev * rotateMatrix; + m_Transform.StrippedTranslations() = m_TransformPrev.StrippedTranslations(); + + _TransformComputeRotating(); + + m_TransformChanged = true; + } + else + { + PK_ASSERT_NOT_REACHED(); + } +} + +//---------------------------------------------------------------------------- + +void CGizmo::_CheckSelection(CUint4 &outSelection, const CInt2 &mouseScreenPosition, CFloat3 *outPosition) +{ + outSelection = CUint4::ZERO; + + if ((m_Type & m_AllowedModesMask) == 0) + return; + + const CFloat3 mouseWorldPosFar = UnprojectPointToWorld(CFloat3(mouseScreenPosition, 1.f), m_InvViewProj, m_ContextSize); + const CFloat3 mouseDirection = (mouseWorldPosFar - m_CameraPosition).Normalized(); + const CRay mouseToWorld = CRay(m_CameraPosition, mouseDirection); + + if (m_Type == GizmoRotating) + { + _CheckSelectionSphere(mouseToWorld, outSelection, outPosition); + } + else + { + _CheckSelectionQuads(mouseToWorld, outSelection, outPosition); + + if (outSelection == CUint4::ZERO) + _CheckSelectionRoot(mouseToWorld, outSelection, outPosition); + if (outSelection == CUint4::ZERO) + _CheckSelectionAxis(mouseToWorld, outSelection, outPosition); + } +} + +//---------------------------------------------------------------------------- + +void CGizmo::_CheckSelectionQuads(const CRay &ray, CUint4 &outSelectionAxis, CFloat3 *outPosition) +{ + const CFloat4x4 frame = m_Transform; + + const CFloat3 position = frame.StrippedTranslations(); + const float scale = _GetViewScale(); + + const float squareSizeIn = scale * m_GeomDesc.m_SquareDist; + const float squareSizeOu = scale * m_GeomDesc.m_SquareSize; + + float distMin = TNumericTraits::kMax; + s32 hintMin = -1; + + { + Colliders::STraceResult result; + const CFloat3 vecU = frame.Axis(0).xyz(); + const CFloat3 vecV = frame.Axis(1).xyz(); + const CFloat3 pos0 = position + squareSizeIn * (vecU + vecV); + const Colliders::STriangleTraceAccelerator triangle1(pos0, pos0 + squareSizeOu * vecU, pos0 + squareSizeOu * (vecU + vecV)); + const Colliders::STriangleTraceAccelerator triangle2(pos0 + squareSizeOu * (vecU + vecV), pos0 + squareSizeOu * vecV, pos0); + if (Colliders::RayTraceTriangle(ray, triangle1, result) || + Colliders::RayTraceTriangle(ray, triangle2, result)) + { + distMin = result.m_BasicReport.t; + hintMin = 0; + } + } + + { + Colliders::STraceResult result; + const CFloat3 vecU = frame.Axis(0).xyz(); + const CFloat3 vecV = frame.Axis(2).xyz(); + const CFloat3 pos0 = position + squareSizeIn * (vecU + vecV); + const Colliders::STriangleTraceAccelerator triangle1(pos0, pos0 + squareSizeOu * vecU, pos0 + squareSizeOu * (vecU + vecV)); + const Colliders::STriangleTraceAccelerator triangle2(pos0 + squareSizeOu * (vecU + vecV), pos0 + squareSizeOu * vecV, pos0); + if (Colliders::RayTraceTriangle(ray, triangle1, result) || + Colliders::RayTraceTriangle(ray, triangle2, result)) + { + if (result.m_BasicReport.t < distMin) + { + distMin = result.m_BasicReport.t; + hintMin = 1; + } + } + } + + { + Colliders::STraceResult result; + const CFloat3 vecU = frame.Axis(1).xyz(); + const CFloat3 vecV = frame.Axis(2).xyz(); + const CFloat3 pos0 = position + squareSizeIn * (vecU + vecV); + const Colliders::STriangleTraceAccelerator triangle1(pos0, pos0 + squareSizeOu * vecU, pos0 + squareSizeOu * (vecU + vecV)); + const Colliders::STriangleTraceAccelerator triangle2(pos0 + squareSizeOu * (vecU + vecV), pos0 + squareSizeOu * vecV, pos0); + if (Colliders::RayTraceTriangle(ray, triangle1, result) || + Colliders::RayTraceTriangle(ray, triangle2, result)) + { + if (result.m_BasicReport.t < distMin) + { + distMin = result.m_BasicReport.t; + hintMin = 2; + } + } + } + + outSelectionAxis = (hintMin == 0) * CUint4(1, 1, 0, 0) + + (hintMin == 1) * CUint4(1, 0, 1, 0) + + (hintMin == 2) * CUint4(0, 1, 1, 0); + + if (outPosition != null && hintMin >= 0) + *outPosition = ray.Origin() + distMin * ray.Direction(); +} + +//---------------------------------------------------------------------------- + +void CGizmo::_CheckSelectionRoot(const CRay &ray, CUint4 &outSelectionAxis, CFloat3 *outPosition) +{ + const CFloat4x4 frame = m_Transform; + + const CFloat3 position = frame.StrippedTranslations(); + const CFloat3 CamToPos = position - ray.Origin(); + + const float sphereSize = _GetViewScale() * m_GeomDesc.m_RootSize; + + const CFloat3 tang = CamToPos.Cross(ray.Direction()); + const float distSquared = tang.LengthSquared() / ray.Direction().LengthSquared(); + + //Note: we assume that ray.Origin() == m_CameraPosition + + if (distSquared <= sphereSize * sphereSize) + { + outSelectionAxis = CUint4(1, 1, 1, 0); + + if (outPosition != null) + { + // project on screen-plane with direction = ray.Direction() + PK_ASSERT(m_Type != GizmoRotating); + const CFloat3 planeNormal = m_ViewTransposed.Axis(CCoordinateFrame::AxisIndexer(Axis_Forward)).xyz(); + *outPosition = m_CameraPosition + ray.Direction() * (planeNormal.Dot(CamToPos) / planeNormal.Dot(ray.Direction())); + } + } +} + +//---------------------------------------------------------------------------- + +void CGizmo::_CheckSelectionAxis(const CRay &ray, CUint4 &outSelectionAxis, CFloat3 *outPosition) +{ + const CFloat4x4 frame = m_Transform; + + const CFloat3 position = frame.StrippedTranslations(); + const float scale = _GetViewScale(); + const CFloat3 CamToPos = position - ray.Origin(); + + const float axisSize = scale * (m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight); + const float axisWidth = scale * m_GeomDesc.m_AxisWidth; + + float distMin = TNumericTraits::kMax; + s32 hintMin = -1; + CFloat3 pointOnAxis = CFloat3::ZERO; + + // Note: we assume that ray.Origin() == m_CameraPosition + + // Check axis X-Y-Z + for (u32 iAxis = 0; iAxis < 3; ++iAxis) + { + const CFloat3 axis = frame.Axis(iAxis).xyz(); + const CFloat3 cross = axis.Cross(ray.Direction()); + // -> project on (rayDir,cross)-plane with direction = ray.Direction() + const CFloat3 planeNormal1 = cross.Cross(axis); + const CFloat3 posToProj = ray.Direction() * (planeNormal1.Dot(CamToPos) / planeNormal1.Dot(ray.Direction())) - CamToPos; + // -> distance along the axis + const float tAxis = posToProj.Dot(axis) / axis.LengthSquared(); + if (tAxis >= 0.f && tAxis <= axisSize) + { + const CFloat3 crossDir = ray.Direction().Cross(axis); + const float denom = crossDir.Length(); + if (denom > 1.e-6f) + { + const float dist = PKAbs(CamToPos.Dot(crossDir)) / denom; + if (dist < distMin && dist < axisWidth * 7.f) + { + distMin = dist; + hintMin = s32(iAxis); + pointOnAxis = position + tAxis * axis; + } + } + } + } + + outSelectionAxis = (hintMin == 0) * CUint4(1, 0, 0, 0) + + (hintMin == 1) * CUint4(0, 1, 0, 0) + + (hintMin == 2) * CUint4(0, 0, 1, 0); + + if (outPosition != null && hintMin >= 0) + *outPosition = pointOnAxis; +} + +//---------------------------------------------------------------------------- + +void CGizmo::_CheckSelectionSphere(const CRay &ray, CUint4 &outSelectionAxis, CFloat3 *outPosition) +{ + const CFloat4x4 frame = m_Transform; + + const CFloat3 position = frame.StrippedTranslations(); + const CFloat3 CamToPos = position - ray.Origin(); + + const float kMargin = 0.04f; + + const float radius = _GetViewScale() * (m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight); + const float radius2Sup = PKSquared(radius); + const float radius2Inf = radius2Sup * PKSquared(1 - kMargin); + + const float radiusExt = _GetViewScale() * (m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight * 2.f); + const float radiusExt2Sup = PKSquared(radiusExt); + const float radiusExt2Inf = radiusExt2Sup * PKSquared(1 - kMargin); + + // in fact, it should check the intersection with a torus, but this implies to get the roots of a quartic-equation ... + + PK_ASSERT(m_Type == GizmoRotating); + const CFloat3 viewDepth = (m_CameraPosition - m_Transform.StrippedTranslations()).Normalized(); + + // Project on the sphere + + PK_ASSERT(ray.Direction().IsNormalized(1.e-4f)); + const float tRayCenter = CamToPos.Dot(ray.Direction()); + const float tOffsetSquared = tRayCenter * tRayCenter - CamToPos.LengthSquared() + radius * radius; + const bool hitSphere = tOffsetSquared >= 0; + + const float tOffset = hitSphere ? PKSqrt(tOffsetSquared) : 0.f; + const float tRayClosestPoint = tRayCenter - tOffset; + + const CFloat3 CamToSphere = tRayClosestPoint * ray.Direction(); + + CFloat3 pointOnSpin = ray.Origin() + CamToSphere; + + if (hitSphere && tRayClosestPoint > 0.f) // not behind the camera + { + outSelectionAxis = CUint4(1, 1, 1, 0); // full rotation + } + + // Check if it is close of an axis, for rotation on specific axis (x, y, z or screen-space) + + const CFloat3 PosToSphere = CamToSphere - CamToPos; // we assume that ray.Origin() == m_CameraPosition + + float distMin = TNumericTraits::kMax; + + // Check ring X-Y-Z + for (u32 iAxis = 0; iAxis < 3; ++iAxis) + { + const CFloat3 planeNormal = frame.Axis(iAxis).xyz(); + const float tAxisPlane = planeNormal.Dot(CamToPos) / planeNormal.Dot(ray.Direction()); + if (tAxisPlane > 0.f) + { + // Try to project directly on the plane + const CFloat3 posToProj = ray.Direction() * tAxisPlane - CamToPos; // we assume that ray.Origin() == m_CameraPosition + const float dist2 = posToProj.LengthSquared(); + if (posToProj.Dot(viewDepth) > 0.f && dist2 >= radius2Inf && dist2 <= radius2Sup && (dist2 - radius2Inf) < distMin) + { + distMin = dist2 - radius2Inf; + outSelectionAxis = CUint4::ZERO; + outSelectionAxis.Axis(iAxis) = 1; + pointOnSpin = ray.Origin() + ray.Direction() * tAxisPlane; + } + // Try to project on the shpere, then on the plane + else if (hitSphere) + { + const float tRayAbs = PKAbs(planeNormal.Dot(PosToSphere)); + if (tRayAbs < 0.05f * radius && tRayAbs < distMin) + { + distMin = tRayAbs; + outSelectionAxis = CUint4::ZERO; + outSelectionAxis.Axis(iAxis) = 1; + pointOnSpin = ray.Origin() + ray.Direction() * tAxisPlane; + } + } + } + } + + // Check ring Screen-Space + { + const CFloat3 planeNormal = viewDepth; + const float tAxisPlane = planeNormal.Dot(CamToPos) / planeNormal.Dot(ray.Direction()); + const CFloat3 posToProj = ray.Direction() * tAxisPlane - CamToPos; // we assume that ray.Origin() == m_CameraPosition + const float dist2 = posToProj.LengthSquared(); + if (tAxisPlane > 0.f && dist2 >= radiusExt2Inf && dist2 <= radiusExt2Sup && (dist2 - radiusExt2Inf) < distMin) + { + distMin = dist2 - radius2Inf; + outSelectionAxis = CUint4::WAXIS; + pointOnSpin = ray.Origin() + ray.Direction() * tAxisPlane; + } + } + + if (outPosition != null) + *outPosition = pointOnSpin; +} + +//---------------------------------------------------------------------------- + +struct SGizmoConstant +{ + CFloat4x4 m_ModelViewProj; + CFloat4 m_HoveredColor; + CFloat4 m_GrabbedColor; +}; + +//---------------------------------------------------------------------------- + +struct SGizmoVertex +{ + CFloat3 m_Position; + CFloat3 m_Color; +}; + +//---------------------------------------------------------------------------- + +bool CGizmoDrawer::CreateRenderStates( const RHI::PApiManager &apiManager, + CShaderLoader &loader, + const TMemoryView &frameBufferLayout, + const RHI::PRenderPass &bakedRenderPass, + u32 subPassIdx) +{ + m_Solid = apiManager->CreateRenderState(RHI::SRHIResourceInfos("Gizmo Solid Render State")); + m_Additive = apiManager->CreateRenderState(RHI::SRHIResourceInfos("Gizmo Additive Render State")); + + if (m_Solid == null || m_Additive == null) + return false; + + m_Solid->m_RenderState.m_PipelineState.m_DynamicViewport = true; + m_Solid->m_RenderState.m_PipelineState.m_DynamicScissor = true; + m_Solid->m_RenderState.m_PipelineState.m_DrawMode = RHI::DrawModeTriangle; + + if (!m_Solid->m_RenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + m_Solid->m_RenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(SGizmoVertex); + + FillGizmoShaderBindings(m_Solid->m_RenderState.m_ShaderBindings); + FillGizmoShaderBindings(m_Additive->m_RenderState.m_ShaderBindings); + + m_Solid->m_RenderState.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + m_Solid->m_RenderState.m_ShaderBindings.m_InputAttributes[0].m_StartOffset = 0; + + m_Solid->m_RenderState.m_ShaderBindings.m_InputAttributes[1].m_BufferIdx = 0; + m_Solid->m_RenderState.m_ShaderBindings.m_InputAttributes[1].m_StartOffset = sizeof(CFloat3); + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Fragment = GIZMO_FRAGMENT_SHADER_PATH; + shadersPaths.m_Vertex = GIZMO_VERTEX_SHADER_PATH; + + if (loader.LoadShader(m_Solid->m_RenderState, shadersPaths, apiManager) == false) + return false; + + m_Additive->m_RenderState = m_Solid->m_RenderState; + m_Additive->m_RenderState.m_PipelineState.m_Blending = true; + m_Additive->m_RenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + m_Additive->m_RenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + + if (!apiManager->BakeRenderState(m_Solid, frameBufferLayout, bakedRenderPass, subPassIdx) || + !apiManager->BakeRenderState(m_Additive, frameBufferLayout, bakedRenderPass, subPassIdx)) + return false; + + return true; +} + +//---------------------------------------------------------------------------- + +static CFloat4 _srgb_to_linear(const CFloat4 &c) +{ + return CFloat4( powf(c.x(), 2.2f), + powf(c.y(), 2.2f), + powf(c.z(), 2.2f), + c.w()); +} + +//---------------------------------------------------------------------------- + +static const CFloat4 kGizmoAxisColors[4] = +{ +#if 1 // Trying to mostly preserve luminance + _srgb_to_linear(CFloat4(0.97f, 0.15f, 0.1f, 1.0f)), + _srgb_to_linear(CFloat4(0.50f, 0.85f, 0.0f, 1.0f)), + _srgb_to_linear(CFloat4(0.20f, 0.56f, 1.0f, 1.0f)), +#else + CFloat4(1.0f, 0.2f, 0.2f, 1.0f), + CFloat4(0.2f, 1.0f, 0.1f, 1.0f), + CFloat4(0.1f, 0.2f, 1.0f, 1.0f), +#endif + CFloat4(0.8f, 0.8f, 0.8f, 1.0f), +}; + +//---------------------------------------------------------------------------- + +bool CGizmoDrawer::CreateVertexBuffer(const RHI::PApiManager &apiManager) +{ + // 1. Generates the geometry + CMeshTriangleBatch batch; + + batch.m_IStream.SetPrimitiveType(CMeshIStream::Triangles); + batch.m_VStream.Reformat(VertexDeclaration::Position3f16_Color4f16); + + // -> Root + + m_DrawRoot.offset = batch.m_IStream.IndexCount(); + PrimitiveDiscretizers::BuildSphere(batch, CFloat4x4::IDENTITY, m_GeomDesc.m_RootSize, CFloat4(0.25f), 18); + m_DrawRoot.count = batch.m_IStream.IndexCount() - m_DrawRoot.offset; + + // -> Sphere + + m_DrawSphere.offset = batch.m_IStream.IndexCount(); + PrimitiveDiscretizers::BuildSphere(batch, CFloat4x4::IDENTITY, m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight, CFloat4(0.05f), 48); + m_DrawSphere.count = batch.m_IStream.IndexCount() - m_DrawSphere.offset; + + // -> Square handle + + const u32 up = CCoordinateFrame::AxisIndexer(Axis_Up); + const CUint3 axisIndexer = CCoordinateFrame::AxesIndexer(); + + CFloat4x4 xMatrix = CFloat4x4::IDENTITY; + xMatrix.Axis(axisIndexer.x()) = CFloat4::ZAXIS; + xMatrix.Axis(axisIndexer.y()) = CFloat4::XAXIS; + xMatrix.Axis(axisIndexer.z()) = CFloat4::YAXIS; + + CFloat4x4 yMatrix = CFloat4x4::IDENTITY; + yMatrix.Axis(axisIndexer.x()) = CFloat4::XAXIS; + yMatrix.Axis(axisIndexer.y()) = CFloat4::YAXIS; + yMatrix.Axis(axisIndexer.z()) = CFloat4::ZAXIS; + + CFloat4x4 zMatrix = CFloat4x4::IDENTITY; + zMatrix.Axis(axisIndexer.x()) = CFloat4::YAXIS; + zMatrix.Axis(axisIndexer.y()) = CFloat4::ZAXIS; + zMatrix.Axis(axisIndexer.z()) = CFloat4::XAXIS; + + const CFloat4 kLightGray = CFloat4(0.2f, 0.2f, 0.2f, 1.0f); + + { + const float squareSizeIn = m_GeomDesc.m_SquareDist; + const float squareSizeOu = squareSizeIn + m_GeomDesc.m_SquareSize; + + const CFloat3 squarePt00 = CFloat3(squareSizeIn, 0.f, squareSizeIn); + const CFloat3 squarePt01 = CFloat3(squareSizeIn, 0.f, squareSizeOu); + const CFloat3 squarePt10 = CFloat3(squareSizeOu, 0.f, squareSizeIn); + const CFloat3 squarePt11 = CFloat3(squareSizeOu, 0.f, squareSizeOu); + + m_DrawSquareX.offset = batch.m_IStream.IndexCount(); + + PrimitiveDiscretizers::BuildTriangle(batch, xMatrix, squarePt00, squarePt01, squarePt11, kLightGray); + PrimitiveDiscretizers::BuildTriangle(batch, xMatrix, squarePt11, squarePt10, squarePt00, kLightGray); + + m_DrawSquareX.count = batch.m_IStream.IndexCount() - m_DrawSquareX.offset; + + PrimitiveDiscretizers::BuildTriangle(batch, yMatrix, squarePt00, squarePt01, squarePt11, kLightGray); + PrimitiveDiscretizers::BuildTriangle(batch, yMatrix, squarePt11, squarePt10, squarePt00, kLightGray); + + PrimitiveDiscretizers::BuildTriangle(batch, zMatrix, squarePt00, squarePt01, squarePt11, kLightGray); + PrimitiveDiscretizers::BuildTriangle(batch, zMatrix, squarePt11, squarePt10, squarePt00, kLightGray); + + PK_ASSERT(m_DrawSquareX.offset + m_DrawSquareX.count * 3 == batch.m_IStream.IndexCount()); + } + + // -> Axis for translation + { + m_DrawAxisTX.offset = batch.m_IStream.IndexCount(); + { + CFloat4x4 transf = xMatrix; + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength / 2.0f; + PrimitiveDiscretizers::BuildCylinder(batch, transf, m_GeomDesc.m_AxisWidth, 0, m_GeomDesc.m_AxisLength, kGizmoAxisColors[0], true, 6); + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength; + PrimitiveDiscretizers::BuildCone(batch, transf, m_GeomDesc.m_ArrowWidth, m_GeomDesc.m_ArrowHeight, kGizmoAxisColors[0], true, 8); + } + m_DrawAxisTX.count = batch.m_IStream.IndexCount() - m_DrawAxisTX.offset; + + { + CFloat4x4 transf = yMatrix; + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength / 2.0f; + PrimitiveDiscretizers::BuildCylinder(batch, transf, m_GeomDesc.m_AxisWidth, 0, m_GeomDesc.m_AxisLength, kGizmoAxisColors[1], true, 6); + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength; + PrimitiveDiscretizers::BuildCone(batch, transf, m_GeomDesc.m_ArrowWidth, m_GeomDesc.m_ArrowHeight, kGizmoAxisColors[1], true, 8); + } + + { + CFloat4x4 transf = zMatrix; + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength / 2.0f; + PrimitiveDiscretizers::BuildCylinder(batch, transf, m_GeomDesc.m_AxisWidth, 0, m_GeomDesc.m_AxisLength, kGizmoAxisColors[2], true, 6); + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength; + PrimitiveDiscretizers::BuildCone(batch, transf, m_GeomDesc.m_ArrowWidth, m_GeomDesc.m_ArrowHeight, kGizmoAxisColors[2], true, 8); + } + + PK_ASSERT(m_DrawAxisTX.offset + m_DrawAxisTX.count * 3 == batch.m_IStream.IndexCount()); + } + + // -> Axis for Scale + { + const CAABB box = CAABB(CFloat3(-m_GeomDesc.m_ArrowWidth), CFloat3(m_GeomDesc.m_ArrowWidth)); + + m_DrawAxisSX.offset = batch.m_IStream.IndexCount(); + { + CFloat4x4 transf = xMatrix; + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength / 2.0f; + PrimitiveDiscretizers::BuildCylinder(batch, transf, m_GeomDesc.m_AxisWidth, 0, m_GeomDesc.m_AxisLength, kGizmoAxisColors[0], true, 6); + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength; + PrimitiveDiscretizers::BuildBox(batch, transf, box, kGizmoAxisColors[0]); + } + m_DrawAxisSX.count = batch.m_IStream.IndexCount() - m_DrawAxisSX.offset; + + { + CFloat4x4 transf = yMatrix; + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength / 2.0f; + PrimitiveDiscretizers::BuildCylinder(batch, transf, m_GeomDesc.m_AxisWidth, 0, m_GeomDesc.m_AxisLength, kGizmoAxisColors[1], true, 6); + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength; + PrimitiveDiscretizers::BuildBox(batch, transf, box, kGizmoAxisColors[1]); + } + + { + CFloat4x4 transf = zMatrix; + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength / 2.0f; + PrimitiveDiscretizers::BuildCylinder(batch, transf, m_GeomDesc.m_AxisWidth, 0, m_GeomDesc.m_AxisLength, kGizmoAxisColors[2], true, 6); + transf.StrippedTranslations() = transf.Axis(up).xyz() * m_GeomDesc.m_AxisLength; + PrimitiveDiscretizers::BuildBox(batch, transf, box, kGizmoAxisColors[2]); + } + + PK_ASSERT(m_DrawAxisSX.offset + m_DrawAxisSX.count * 3 == batch.m_IStream.IndexCount()); + } + + // -> Rotation handle + { + m_DrawRotationX.offset = batch.m_IStream.IndexCount(); + PrimitiveDiscretizers::BuildHalfTorus(batch, xMatrix, m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight, m_GeomDesc.m_AxisWidth, kGizmoAxisColors[0], 48, 8); + m_DrawRotationX.count = batch.m_IStream.IndexCount() - m_DrawRotationX.offset; + + PrimitiveDiscretizers::BuildHalfTorus(batch, yMatrix, m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight, m_GeomDesc.m_AxisWidth, kGizmoAxisColors[1], 48, 8); + PrimitiveDiscretizers::BuildHalfTorus(batch, zMatrix, m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight, m_GeomDesc.m_AxisWidth, kGizmoAxisColors[2], 48, 8); + + PK_ASSERT(m_DrawRotationX.offset + m_DrawRotationX.count * 3 == batch.m_IStream.IndexCount()); + + m_DrawRotationSP.offset = batch.m_IStream.IndexCount(); + PrimitiveDiscretizers::BuildDisk(batch, zMatrix, m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight * 2.f, m_GeomDesc.m_AxisLength + m_GeomDesc.m_ArrowHeight, kLightGray, 48); + m_DrawRotationSP.count = batch.m_IStream.IndexCount() - m_DrawRotationSP.offset; + } + + // 2. Upload buffers to RHI + + // 2.1 Vertex buffer + + m_GizmoVtx = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Gizmo Vertex Buffer"), RHI::VertexBuffer, batch.m_VStream.VertexCount() * sizeof(SGizmoVertex)); + if (m_GizmoVtx == null) + return false; + + SGizmoVertex *vtxData = static_cast(apiManager->MapCpuView(m_GizmoVtx)); + if (vtxData == null) + return false; + + TStridedMemoryView positions = batch.m_VStream.Positions(); + TStridedMemoryView colors = batch.m_VStream.Colors(); + + for (u32 i = 0; i < batch.m_VStream.VertexCount(); ++i) + { + vtxData[i].m_Position = positions[i]; + vtxData[i].m_Color = colors[i].xyz(); + } + + apiManager->UnmapCpuView(m_GizmoVtx); + + // 2.2 Transfer the index buffer + + m_GizmoIdx = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Gizmo Index Buffer"), RHI::IndexBuffer, batch.m_IStream.IndexCount() * sizeof(u32)); + if (m_GizmoIdx == null) + return false; + + u32 *idxData = static_cast(apiManager->MapCpuView(m_GizmoIdx)); + if (idxData == null) + return false; + + Mem::Copy(idxData, batch.m_IStream.Stream(), batch.m_IStream.StreamSize()); + + apiManager->UnmapCpuView(m_GizmoIdx); + + return true; +} + +//---------------------------------------------------------------------------- + +#if GIZMODRAWER_USE_IMGUI == 1 +static void _DrawText(const char *imGUIkey, const CInt2 &screenPosition, const CFloat4 &color, const char *format, ...) // colored text, vertical-centered +{ + const ImVec4 kColor = ImVec4(color.x(), color.y(), color.z(), color.w()); + const float kFontSize = ImGui::GetFontSize(); + + const ImVec2 kDispPos = ImVec2(screenPosition.x(), screenPosition.y() - kFontSize/2); + const ImVec2 kDispSiz = ImVec2(kFontSize * 2, kFontSize * 2); + ImGui::SetNextWindowPos(kDispPos, ImGuiSetCond_Always); + ImGui::SetNextWindowSize(kDispSiz, ImGuiSetCond_Always); + ImGui::SetNextWindowBgAlpha(0.f); + const u32 kWindowFlags = ImGuiWindowFlags_NoTitleBar | + ImGuiWindowFlags_NoResize | + ImGuiWindowFlags_NoMove | + ImGuiWindowFlags_NoSavedSettings | + ImGuiWindowFlags_NoInputs | + ImGuiWindowFlags_NoScrollbar | + ImGuiWindowFlags_NoScrollWithMouse | + ImGuiWindowFlags_AlwaysAutoResize | + ImGuiWindowFlags_NoFocusOnAppearing | + ImGuiWindowFlags_NoBringToFrontOnFocus | + ImGuiWindowFlags_NoNav; + + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0.f); + + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.f); + ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.f); + + ImGui::Begin(imGUIkey, null, kWindowFlags); + + va_list arglist; + va_start(arglist, format); + ImGui::TextColoredV(kColor, format, arglist); + va_end(arglist); + + ImGui::End(); + + ImGui::PopStyleVar(6); +} +#endif + +//---------------------------------------------------------------------------- + +bool CGizmoDrawer::DrawGizmo(const RHI::PCommandBuffer &cmdBuff, const CGizmo &gizmo) const +{ + if (gizmo.m_Type == GizmoNone) + return true; // don't draw if the Gizmo mode is not set + + CFloat4x4 MVP = gizmo.m_Transform * gizmo.m_ViewProj; + const float scale = gizmo._GetViewScale(); + MVP.Axis(0) *= scale; + MVP.Axis(1) *= scale; + MVP.Axis(2) *= scale; + + SGizmoConstant gizmoConstant; + + const bool gizmoGrabbedAxisFull = gizmo.m_GrabbedAxis.xyz() == CUint3::ONE; + const bool gizmoHoveredAxisFull = gizmo.m_HoveredAxis.xyz() == CUint3::ONE; + + if (!PK_VERIFY(m_Additive != null && m_Solid != null && m_GizmoVtx != null && m_GizmoIdx != null)) + return false; + + const bool preRenderAdditive = gizmo.m_Type == GizmoRotating || (gizmo.m_Type != GizmoRotating && gizmo.IsGrabbed()); + if (preRenderAdditive) + cmdBuff->BindRenderState(m_Additive); + else + cmdBuff->BindRenderState(m_Solid); + + cmdBuff->BindVertexBuffers(TMemoryView(m_GizmoVtx)); + cmdBuff->BindIndexBuffer(m_GizmoIdx, 0, RHI::IndexBuffer32Bit); + + const CFloat4 kRotate_ShadeFlats = CFloat4(0.01f, 0.01f, 0.01f, 1); + const CFloat4 kRotate_ShadeHover = CFloat4(0.02f, 0.02f, 0.02f, 1); + const CFloat4 kDisabled_ShadeFlats = CFloat4(0.1f, 0.1f, 0.1f, 1); + const CFloat4 kHandle_ShadeFlats = CFloat4(0.1f, 0.1f, 0.1f, 1); + const CFloat4 kGrabbed_ShadeOld = CFloat4(0.07f, 0.07f, 0.07f, 1); + + if (gizmo.m_Type == GizmoRotating) + { + gizmoConstant.m_ModelViewProj = MVP; + + gizmoConstant.m_GrabbedColor = (gizmo.m_AllowedModesMask & GizmoRotating) != 0 ? CFloat4(0.1f, 0.02f, 0.1f, gizmoGrabbedAxisFull ? 1.f : 0.f) : kRotate_ShadeFlats; + gizmoConstant.m_HoveredColor = gizmo.m_GrabbedAxis.w() == 0 ? CFloat4(0.1f, 0.1f, 0.02f, gizmoHoveredAxisFull ? 1.f : 0.f) : kRotate_ShadeHover; + cmdBuff->PushConstant(&gizmoConstant, 0); + // Draw Sphere + cmdBuff->DrawIndexed(m_DrawSphere.offset, 0, m_DrawSphere.count); + } + if (gizmo.m_Type != GizmoRotating && gizmo.IsGrabbed()) + { + CFloat4x4 MVPpre = gizmo.m_TransformPrev * gizmo.m_ViewProj; + const float scalePre = gizmo._GetViewScalePre(); + MVPpre.Axis(0) *= scalePre; + MVPpre.Axis(1) *= scalePre; + MVPpre.Axis(2) *= scalePre; + gizmoConstant.m_ModelViewProj = MVPpre; + // Origin - Axis + const SDrawIndexedRange &drawAxis = gizmo.m_Type == GizmoScaling ? m_DrawAxisSX : m_DrawAxisTX; + gizmoConstant.m_GrabbedColor = kGrabbed_ShadeOld; + gizmoConstant.m_HoveredColor.w() = 0; + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(drawAxis.offset, 0, drawAxis.count * 3); + } + + const bool inactive = (gizmo.m_AllowedModesMask & gizmo.m_Type) == 0; + + if (gizmo.m_Type != GizmoRotating) + { + cmdBuff->BindRenderState(m_Solid); + + // Draw Axis + const SDrawIndexedRange &drawAxis = gizmo.m_Type == GizmoScaling ? m_DrawAxisSX : m_DrawAxisTX; + + gizmoConstant.m_ModelViewProj = MVP; + gizmoConstant.m_GrabbedColor = (!inactive) ? CFloat4(1, 0, 1, 0) : kDisabled_ShadeFlats; + gizmoConstant.m_HoveredColor = (!inactive) ? CFloat4(1, 1, 0, 0) : kDisabled_ShadeFlats; + const CUint4 grabbedAxis = (!inactive) ? gizmo.m_GrabbedAxis : CUint4(0); + const CUint4 hoveredAxis = (!inactive) ? gizmo.m_HoveredAxis : CUint4(1); + + gizmoConstant.m_GrabbedColor.w() = grabbedAxis.x(); + gizmoConstant.m_HoveredColor.w() = hoveredAxis.x(); + if (gizmo.m_Type == GizmoScaling && gizmo.m_Clicked) + { + CFloat4x4 transformScale = gizmo.m_Transform; + transformScale.Axis(0) *= scale; + transformScale.Axis(1) = scale * gizmo.m_TransformPrev.Axis(1); + transformScale.Axis(2) = scale * gizmo.m_TransformPrev.Axis(2); + gizmoConstant.m_ModelViewProj = transformScale * gizmo.m_ViewProj; + } + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(drawAxis.offset, 0, drawAxis.count); + + gizmoConstant.m_GrabbedColor.w() = grabbedAxis.y(); + gizmoConstant.m_HoveredColor.w() = hoveredAxis.y(); + if (gizmo.m_Type == GizmoScaling && gizmo.m_Clicked) + { + CFloat4x4 transformScale = gizmo.m_Transform; + transformScale.Axis(0) = scale * gizmo.m_TransformPrev.Axis(0); + transformScale.Axis(1) *= scale; + transformScale.Axis(2) = scale * gizmo.m_TransformPrev.Axis(2); + gizmoConstant.m_ModelViewProj = transformScale * gizmo.m_ViewProj; + } + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(drawAxis.offset + drawAxis.count, 0, drawAxis.count); + + gizmoConstant.m_GrabbedColor.w() = grabbedAxis.z(); + gizmoConstant.m_HoveredColor.w() = hoveredAxis.z(); + if (gizmo.m_Type == GizmoScaling && gizmo.m_Clicked) + { + CFloat4x4 transformScale = gizmo.m_Transform; + transformScale.Axis(0) = scale * gizmo.m_TransformPrev.Axis(0); + transformScale.Axis(1) = scale * gizmo.m_TransformPrev.Axis(1); + transformScale.Axis(2) *= scale; + gizmoConstant.m_ModelViewProj = transformScale * gizmo.m_ViewProj; + } + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(drawAxis.offset + drawAxis.count * 2, 0, drawAxis.count); + + gizmoConstant.m_ModelViewProj = MVP; + + if (gizmo.m_Type != GizmoShowAxis && gizmo.m_Type != GizmoShowAxisWithoutNames) + { + cmdBuff->BindRenderState(m_Additive); + + // Draw Root + gizmoConstant.m_GrabbedColor = CFloat4(0.1f, 0.02f, 0.1f, gizmoGrabbedAxisFull ? 1.f : 0.f); + gizmoConstant.m_HoveredColor = CFloat4(0.1f, 0.1f, 0.02f, gizmoHoveredAxisFull ? 1.f : 0.f); + if (gizmo.m_Type != GizmoScaling || gizmo.m_GrabbedAxis == CUint4::ZERO || gizmoGrabbedAxisFull) + { + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawRoot.offset, 0, m_DrawRoot.count); + } + + // Draw Square handles + const float desatFactor = inactive ? 1.0f : 0.5f; + const CFloat4 pickSquareColor_X = PKLerp(kGizmoAxisColors[0] * CFloat4(0.5f).xyz1(), kHandle_ShadeFlats, desatFactor); + const CFloat4 pickSquareColor_Y = PKLerp(kGizmoAxisColors[1] * CFloat4(0.5f).xyz1(), kHandle_ShadeFlats, desatFactor); + const CFloat4 pickSquareColor_Z = PKLerp(kGizmoAxisColors[2] * CFloat4(0.5f).xyz1(), kHandle_ShadeFlats, desatFactor); + + gizmoConstant.m_GrabbedColor = gizmo.m_GrabbedAxis.yz() == CUint2::ONE ? CFloat4(0.50f, 0.02f, 0.50f, 1.f) : pickSquareColor_X; + gizmoConstant.m_HoveredColor = gizmo.m_HoveredAxis.yz() == CUint2::ONE ? CFloat4(0.50f, 0.50f, 0.02f, 1.f) : CFloat4::ZERO; + if (gizmo.m_GrabbedAxis == CUint4::ZERO || gizmo.m_GrabbedAxis == CUint4(0, 1, 1, 0)) + { + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawSquareX.offset, 0, m_DrawSquareX.count); + } + + gizmoConstant.m_GrabbedColor = gizmo.m_GrabbedAxis.xz() == CUint2::ONE ? CFloat4(0.50f, 0.02f, 0.50f, 1.f) : pickSquareColor_Y; + gizmoConstant.m_HoveredColor = gizmo.m_HoveredAxis.xz() == CUint2::ONE ? CFloat4(0.50f, 0.50f, 0.02f, 1.f) : CFloat4::ZERO; + if (gizmo.m_GrabbedAxis == CUint4::ZERO || gizmo.m_GrabbedAxis == CUint4(1, 0, 1, 0)) + { + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawSquareX.offset + m_DrawSquareX.count, 0, m_DrawSquareX.count); + } + + gizmoConstant.m_GrabbedColor = gizmo.m_GrabbedAxis.xy() == CUint2::ONE ? CFloat4(0.50f, 0.02f, 0.50f, 1.f) : pickSquareColor_Z; + gizmoConstant.m_HoveredColor = gizmo.m_HoveredAxis.xy() == CUint2::ONE ? CFloat4(0.50f, 0.50f, 0.02f, 1.f) : CFloat4::ZERO; + if (gizmo.m_GrabbedAxis == CUint4::ZERO || gizmo.m_GrabbedAxis == CUint4(1, 1, 0, 0)) + { + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawSquareX.offset + m_DrawSquareX.count * 2, 0, m_DrawSquareX.count); + } + } + } + else // (gizmo.m_Type == GizmoRotating) + { + // Draw Rotation handles + cmdBuff->BindRenderState(m_Solid); + + gizmoConstant.m_GrabbedColor = CFloat4(1, 0, 1, 0); + gizmoConstant.m_HoveredColor = CFloat4(1, 1, 0, 0); + + CFloat4x4 MVProtating; + + if (gizmo.m_GrabbedAxis.w() == 0 && !inactive) + { + MVProtating = gizmo.m_TransformRotating[0] * gizmo.m_ViewProj; + MVProtating.Axis(0) *= scale; + MVProtating.Axis(1) *= scale; + MVProtating.Axis(2) *= scale; + gizmoConstant.m_ModelViewProj = MVProtating; + + gizmoConstant.m_GrabbedColor.w() = gizmoGrabbedAxisFull ? 0 : gizmo.m_GrabbedAxis.x(); + gizmoConstant.m_HoveredColor.w() = gizmoHoveredAxisFull ? 0 : gizmo.m_HoveredAxis.x(); + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawRotationX.offset, 0, m_DrawRotationX.count); + + MVProtating = gizmo.m_TransformRotating[1] * gizmo.m_ViewProj; + MVProtating.Axis(0) *= scale; + MVProtating.Axis(1) *= scale; + MVProtating.Axis(2) *= scale; + gizmoConstant.m_ModelViewProj = MVProtating; + + gizmoConstant.m_GrabbedColor.w() = gizmoGrabbedAxisFull ? 0 : gizmo.m_GrabbedAxis.y(); + gizmoConstant.m_HoveredColor.w() = gizmoHoveredAxisFull ? 0 : gizmo.m_HoveredAxis.y(); + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawRotationX.offset + m_DrawRotationX.count, 0, m_DrawRotationX.count); + + MVProtating = gizmo.m_TransformRotating[2] * gizmo.m_ViewProj; + MVProtating.Axis(0) *= scale; + MVProtating.Axis(1) *= scale; + MVProtating.Axis(2) *= scale; + gizmoConstant.m_ModelViewProj = MVProtating; + + gizmoConstant.m_GrabbedColor.w() = gizmoGrabbedAxisFull ? 0 : gizmo.m_GrabbedAxis.z(); + gizmoConstant.m_HoveredColor.w() = gizmoHoveredAxisFull ? 0 : gizmo.m_HoveredAxis.z(); + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawRotationX.offset + m_DrawRotationX.count * 2, 0, m_DrawRotationX.count); + } + + if ((!gizmo.m_Clicked || gizmo.m_GrabbedAxis.w() != 0) && !inactive) + { + MVProtating = gizmo.m_TransformRotating[3] * gizmo.m_ViewProj; + MVProtating.Axis(0) *= scale; + MVProtating.Axis(1) *= scale; + MVProtating.Axis(2) *= scale; + gizmoConstant.m_ModelViewProj = MVProtating; + gizmoConstant.m_GrabbedColor.w() = gizmo.m_GrabbedAxis.w(); + gizmoConstant.m_HoveredColor.w() = gizmo.m_HoveredAxis.w(); + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawRotationSP.offset, 0, m_DrawRotationSP.count); + } + + cmdBuff->BindRenderState(m_Additive); + + // Draw Axis + gizmoConstant.m_GrabbedColor = kHandle_ShadeFlats; + gizmoConstant.m_HoveredColor.w() = 0; + gizmoConstant.m_ModelViewProj = MVP; + cmdBuff->PushConstant(&gizmoConstant, 0); + cmdBuff->DrawIndexed(m_DrawAxisTX.offset, 0, m_DrawAxisTX.count * 3); + } + +#if GIZMODRAWER_USE_IMGUI == 1 + if (gizmo.m_Type == GizmoShowAxis) + { + const CInt3 axisMapper = CCoordinateFrame::TransposeRemapper(Frame_RightHand_Y_Up, CCoordinateFrame::GlobalFrame()); + + const char kAxisNamesXYZ[3] = { 'X', 'Y', 'Z' }; + const char kAxisNamesSUF[6] = { 'R', 'U', 'B', 'L', 'D', 'F' }; + + const float fontSize = ImGui::GetFontSize(); + + for (u32 iAxis = 0; iAxis < 3; ++iAxis) + { + const CFloat4 center = gizmo.m_Transform.WAxis() + scale * (gizmo.m_GeomDesc.m_AxisLength + gizmo.m_GeomDesc.m_ArrowHeight) * gizmo.m_Transform.Axis(iAxis); + + const CFloat4 camToGizmo_ClipSpace = gizmo.m_ViewProj.TransformVector(gizmo.m_Transform.WAxis()); + const CFloat4 camToLetter_ClipSpace = gizmo.m_ViewProj.TransformVector(center); + const CFloat2 gizmoToLetter_ScreenSpace = 0.5f * (camToLetter_ClipSpace.xy() / camToLetter_ClipSpace.w() - camToGizmo_ClipSpace.xy() / camToGizmo_ClipSpace.w()) * gizmo.m_ContextSize; + + const float lengthSquared_GC = gizmoToLetter_ScreenSpace.LengthSquared(); + + if (lengthSquared_GC < 0.25f * fontSize * fontSize) + continue; + + const CFloat4 axisTip_ClipSpace = gizmo.m_ViewProj.TransformVector(center); + const CInt2 axisTip_ScreenSpace = (0.5f + 0.5f * axisTip_ClipSpace.xy() / axisTip_ClipSpace.w()) * gizmo.m_ContextSize; + + CInt2 letter1_ScreenSpace = axisTip_ScreenSpace; + + // FIXME: Here, we should instead try to collide the letter bounding rect with the viewport corners, + // and use that to decide where to push the letters, instead of the hardcoded logic. + // The code below is a hardcoded behavior for bottom-left placement, now that it can be configured, + // it breaks down for any other location. + + if (gizmoToLetter_ScreenSpace.x() + PKAbs(gizmoToLetter_ScreenSpace.y()) < 0.f) + { + const CInt2 fontOffsetY = CInt2(0, s32(fontSize)); + if (gizmoToLetter_ScreenSpace.y() < 0) + letter1_ScreenSpace = axisTip_ScreenSpace - fontOffsetY; + else + letter1_ScreenSpace = axisTip_ScreenSpace + fontOffsetY; + letter1_ScreenSpace.x() -= 0.3f * fontSize; + } + else if (gizmoToLetter_ScreenSpace.y() > 0.f) + { + letter1_ScreenSpace = axisTip_ScreenSpace + CInt2(s32(0.8f * fontSize), 0); + } + else + { + letter1_ScreenSpace = axisTip_ScreenSpace + 0.8f * fontSize * gizmoToLetter_ScreenSpace.Normalized(); + } + + const CInt2 letter2_ScreenSpace = letter1_ScreenSpace + CInt2(s32(fontSize * 0.7f), 0); + + // Use address of gizmo and axis name to generate a unique name that will be used by ImGui::Begin + // Note: ImGui uses names as IDs too + // That way we avoid a bug where ImGui only shows one group of axis names if multiple gizmo use GizmoShowAxis type + const CString nameKeyXYZ = CString::Format("%p-%c", &gizmo, kAxisNamesXYZ[iAxis]); + _DrawText(nameKeyXYZ.Data(), letter1_ScreenSpace, kGizmoAxisColors[iAxis], "%c", kAxisNamesXYZ[iAxis]); + + const s32 axisMap = axisMapper.Axis(iAxis); + const u32 axisIdx = PKAbs(axisMap) - 1; + const u32 axisNameIdx = axisIdx + (axisMap > 0 ? 0 : 3); + + const CString nameKeySUF = CString::Format("%p-%c", &gizmo, kAxisNamesSUF[axisNameIdx]); + _DrawText(nameKeySUF.Data(), letter2_ScreenSpace, kGizmoAxisColors[3], "%c", kAxisNamesSUF[axisNameIdx]); + } + } +#else + PK_ASSERT_NOT_IMPLEMENTED(); + + if (gizmo.m_Type == GizmoShowAxis) + return false; + +#if 0 + // Extract of code (billboarding): + + const CFloat4 axisSide = scale * 0.5f * gizmo.m_GeomDesc.m_LetterSize * gizmo.m_ViewTransposed.Axis(axisIndexer.x()).xyz0(); + const CFloat4 axisUp = scale * 0.5f * gizmo.m_GeomDesc.m_LetterSize * gizmo.m_ViewTransposed.Axis(axisIndexer.y()).xyz0(); + const CFloat4 xpy = axisSide + axisUp; + const CFloat4 xmy = axisSide - axisUp; + + for (u32 iAxis = 0; iAxis < 3; ++iAxis) + { + // ... + + const CFloat4 center_ClipSpace = gizmo.m_ViewProj.TransformVector(center); + const CFloat2 center_ScreenSpace = center_ClipSpace.xy() / center_ClipSpace.w(); + const CFloat2 centerPixelSnap_ScreenSpace = PKFloor(gizmo.m_ContextSize * center_ScreenSpace) / gizmo.m_ContextSize; + const CFloat4 centerPixelSnap_ClipSpace = CFloat4(centerPixelSnap_ScreenSpace * center_ClipSpace.w(), center_ClipSpace.zw()); + const CFloat4 centerPixelSnap = gizmo.m_InvViewProj.TransformVector(centerPixelSnap_ClipSpace).xyz1(); + + Positions[letterCount * 6 + 0] = centerPixelSnap - xpy; + Positions[letterCount * 6 + 1] = centerPixelSnap + xmy; + Positions[letterCount * 6 + 2] = centerPixelSnap + xpy; + Positions[letterCount * 6 + 3] = centerPixelSnap + xpy; + Positions[letterCount * 6 + 4] = centerPixelSnap - xmy; + Positions[letterCount * 6 + 5] = centerPixelSnap - xpy; + + const u32 iAxisP1 = iAxis + 1; + UVs[letterCount * 6 + 0].xy() = CFloat2(iAxis, 1.f) / 3.f; + UVs[letterCount * 6 + 1].xy() = CFloat2(iAxisP1, 1.f) / 3.f; + UVs[letterCount * 6 + 2].xy() = CFloat2(iAxisP1, 0.f) / 3.f; + UVs[letterCount * 6 + 3].xy() = CFloat2(iAxisP1, 0.f) / 3.f; + UVs[letterCount * 6 + 4].xy() = CFloat2(iAxis, 0.f) / 3.f; + UVs[letterCount * 6 + 5].xy() = CFloat2(iAxis, 1.f) / 3.f; + + // ... + } +#endif + +#endif // GIZMODRAWER_USE_IMGUI == 1 + + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/Gizmo.h b/Samples/PK-SampleLib/Gizmo.h new file mode 100644 index 00000000..94cb0bd9 --- /dev/null +++ b/Samples/PK-SampleLib/Gizmo.h @@ -0,0 +1,235 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" + +#include +#include + +#include + +#if defined(PK_DESKTOP) && !defined(PK_RETAIL) +#define PK_HAS_GIZMO_STD_FUNCTIONS +#include +#include +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CCameraBase; +class CShaderLoader; + +//---------------------------------------------------------------------------- + +enum EGizmoType +{ + GizmoNone = 0x00, + GizmoTranslating = 0x01, + GizmoRotating = 0x02, + GizmoScaling = 0x04, + GizmoShowAxis = 0x10, + GizmoShowAxisWithoutNames = 0x20, +}; + +//---------------------------------------------------------------------------- + +struct SGizmoGeometryDesc +{ + float m_RootSize; + float m_AxisLength; + float m_AxisWidth; + float m_SquareDist; + float m_SquareSize; + float m_ArrowHeight; + float m_ArrowWidth; + + SGizmoGeometryDesc() + : m_RootSize(0.10f) + , m_AxisLength(0.75f) + , m_AxisWidth(0.02f) + , m_SquareDist(0.05f) + , m_SquareSize(0.25f) + , m_ArrowHeight(0.25f) + , m_ArrowWidth(0.08f) + { + } + + bool operator == (const SGizmoGeometryDesc &other) const + { + return PKAbs(m_RootSize - other.m_RootSize) < (1.e-3f * m_RootSize) && + PKAbs(m_AxisLength - other.m_AxisLength) < (1.e-3f * m_AxisLength) && + PKAbs(m_AxisWidth - other.m_AxisWidth) < (1.e-3f * m_AxisWidth) && + PKAbs(m_SquareDist - other.m_SquareDist) < (1.e-3f * m_SquareDist) && + PKAbs(m_SquareSize - other.m_SquareSize) < (1.e-3f * m_SquareSize) && + PKAbs(m_ArrowHeight - other.m_ArrowHeight) < (1.e-3f * m_ArrowHeight) && + PKAbs(m_ArrowWidth - other.m_ArrowWidth) < (1.e-3f * m_ArrowWidth); + } +}; + +//---------------------------------------------------------------------------- + +class CGizmo +{ +public: + CGizmo(const SGizmoGeometryDesc &geomDesc = SGizmoGeometryDesc()); + ~CGizmo() {} + + void SetMode(EGizmoType mode) { if (!IsGrabbed()) m_Type = mode; } + EGizmoType Mode() const { return m_Type; } + void SetLocalFrame(bool enabled) { if (m_FrameLocal != enabled) { m_FrameLocal = enabled; _TransformFromOutput(); }; } + void SetParentTransform(const CFloat4x4 &transform); // Set the "world-space" (ie. global-space) + void Disable() { if (!IsGrabbed()) m_Type = GizmoNone; } + void ClearOutputToUpdate(); // Reset gizmo reference to its outputs + bool PushBackObject(CFloat4x4 *transform, u32 allowedModesMask = GizmoTranslating | GizmoRotating | GizmoScaling); // Bind the "transform" with the gizmo. +#ifdef PK_HAS_GIZMO_STD_FUNCTIONS + typedef std::function fnObjectUpdate; + bool PushBackObject(const CFloat4x4 &transform, const fnObjectUpdate &updateFromTransform, u32 allowedModesMask = GizmoTranslating | GizmoRotating | GizmoScaling); // Bind a transform and a update-function with the gizmo. + bool PushBackObject(CBaseObject *object_position, u32 fieldID_position, CBaseObject *object_eulerOrientation, u32 fieldID_eulerOrientation); // Helper with HBO Objects +#endif + bool IsGrabbed() const { return m_Clicked; } + bool TransformChanged() const { return m_TransformChanged; } + void ApplyGizmoTransform(); // On this call, for all bound objects, their transform is written to the new values (or the update-function is called with the new values). + + // Events + void UpdateCameraInfo(const CCameraBase &camera); + void SetMouseClicked(const CInt2 &mousePosition, bool clicked); + void SetMouseMoved(const CInt2 &mousePosition); + + float &GizmoSelfScale() { return m_SelfScale; } + +private: + // MATH UTILS + static CFloat2 ProjectPointOnScreen(const CFloat3 &point, const CFloat4x4 &mvp, const CUint2 &screenSize); + static CFloat3 UnprojectPointToWorld(const CFloat3 &pixelCoords, const CFloat4x4 &inverseMVP, const CUint2 &screenSize); + + float _GetViewScale() const; // scale of the Gizmo, so it will always have the same size on the screen. + float _GetViewScalePre() const; + void _TransformReset(); + void _TransformFromOutput(); // compute the m_Transform and other intern transforms from the outputs values + void _TransformComputeRotating(); + void _ApplyMouseMove(const CInt2 &mouseScreenPosition); + + + // State + EGizmoType m_Type; + CFloat3 m_MouseWorldPositionPrev; + float m_SelfScale; + SGizmoGeometryDesc m_GeomDesc; + bool m_Clicked; + bool m_FrameLocal; // false to keep the gizmo in the global frame, true to have the gizmo follow the local frame + // in fact, other frames could be definied (euler-frame, global-after-parent, ...) + u32 m_AllowedModesMask; + + // Transforms + CFloat4x4 m_ParentTransform; // transform that defines the "world-space" + CFloat4x4 m_ParentPureRotation; // the rotationnal-part of m_ParentTransform + CFloat4x4 m_TransformPrev; // save of "m_Transform" while the Gizmo is grabbed (in world-space) + CFloat4x4 m_Transform; // current-transform of the Gizmo (in world-space) + CFloat4x4 m_DeltaTransform; // Transform that converts "m_TransformPrev" to "m_Transform" (in world-space) + CFloat4x4 m_TransformRotating[4]; // specific transforms for the rotation handles (x,y,z axis + screen-space) + + // Output + struct STargetObject + { + CFloat4x4 m_TransformPrev = CFloat4x4::IDENTITY; // save of "m_Transform" while the Gizmo is grabbed + CFloat4x4 m_Transform = CFloat4x4::IDENTITY; // current-transform of the object (in the "local-space") + CFloat4x4 *m_Object_Transform = null; +#ifdef PK_HAS_GIZMO_STD_FUNCTIONS + fnObjectUpdate m_UpdateFnct; +#endif + u32 m_AllowedGizmoModes = 0; + + STargetObject() {} + STargetObject(CFloat4x4 *tr, u32 allowedGizmoModes) : m_Transform(*tr), m_Object_Transform(tr), m_AllowedGizmoModes(allowedGizmoModes) {} +#ifdef PK_HAS_GIZMO_STD_FUNCTIONS + STargetObject(const CFloat4x4 &tr, const fnObjectUpdate &fn, u32 allowedGizmoModes) : m_Transform(tr), m_UpdateFnct(fn), m_AllowedGizmoModes(allowedGizmoModes) {} +#endif + }; + TStaticCountedArray m_TargetObjects; // Used a "Static-Counted-Array" to prevent crash with MSVC build, when the array is being relocated on growth. + + bool m_TransformChanged; // true when transform values have been modified + + // Events + CUint4 m_GrabbedAxis; // x,y,z and screen-space + CUint4 m_HoveredAxis; // x,y,z and screen-space + + void _CheckSelection(CUint4 &outSelection, const CInt2 &mouseScreenPosition, CFloat3 *outPosition = null); + void _CheckSelectionRoot(const CRay &ray, CUint4 &outSelectionAxis, CFloat3 *outPosition = null); + void _CheckSelectionQuads(const CRay &ray, CUint4 &outSelectionAxis, CFloat3 *outPosition = null); + void _CheckSelectionAxis(const CRay &ray, CUint4 &outSelectionAxis, CFloat3 *outPosition = null); + void _CheckSelectionSphere(const CRay &ray, CUint4 &outSelectionAxis, CFloat3 *outPosition = null); + + // Save viewport and camera info + CFloat2 m_ContextSize; + CFloat3 m_CameraPosition; + CFloat4x4 m_ViewTransposed; + CFloat4x4 m_ViewProj; + CFloat4x4 m_InvViewProj; + + friend class CGizmoDrawer; +}; + +//---------------------------------------------------------------------------- + +#define GIZMODRAWER_USE_IMGUI 1 + +class CGizmoDrawer +{ +public: + CGizmoDrawer(const SGizmoGeometryDesc &geomDesc = SGizmoGeometryDesc()) + : m_Solid(null) + , m_Additive(null) + , m_GizmoVtx(null) + , m_GizmoIdx(null) + , m_GeomDesc(geomDesc) + { + } + + ~CGizmoDrawer() + { + } + + bool CreateRenderStates(const RHI::PApiManager &apiManager, + CShaderLoader &loader, + const TMemoryView &frameBufferLayout, + const RHI::PRenderPass &bakedRenderPass, + u32 subPassIdx); + + bool CreateVertexBuffer( const RHI::PApiManager &apiManager); + + bool DrawGizmo(const RHI::PCommandBuffer &cmdBuff, const CGizmo &gizmo) const; + +private: + RHI::PRenderState m_Solid; + RHI::PRenderState m_Additive; + RHI::PGpuBuffer m_GizmoVtx; + RHI::PGpuBuffer m_GizmoIdx; + + SGizmoGeometryDesc m_GeomDesc; + + struct SDrawIndexedRange + { + u32 offset; + u32 count; + }; + SDrawIndexedRange m_DrawRoot; + SDrawIndexedRange m_DrawSphere; + SDrawIndexedRange m_DrawAxisTX; // DrawAxeT{X,Y,Z} such as DrawAxeTY = {axeX.offset + axeX.count, axeX.count} and DrawAxeTZ = {axeX.offset + 2 * axeX.count, axeX.count} + SDrawIndexedRange m_DrawAxisSX; // DrawAxeS{X,Y,Z} + SDrawIndexedRange m_DrawSquareX; // m_DrawSquare{X,Y,Z} + SDrawIndexedRange m_DrawRotationX; // m_DrawRotation{X,Y,Z} + SDrawIndexedRange m_DrawRotationSP; // screen-space handle +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ImguiRhiImplem.cpp b/Samples/PK-SampleLib/ImguiRhiImplem.cpp new file mode 100644 index 00000000..f8eeaa18 --- /dev/null +++ b/Samples/PK-SampleLib/ImguiRhiImplem.cpp @@ -0,0 +1,674 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ImguiRhiImplem.h" +#include "SampleUtils.h" +#include "ShaderLoader.h" + +#include "ShaderDefinitions/UnitTestsShaderDefinitions.h" +#include "ShaderDefinitions/SampleLibShaderDefinitions.h" + +#include +#include +#include + +#define VERTEX_SHADER_PATH "./Shaders/ImGui.vert" +#define FRAGMENT_SHADER_PATH "./Shaders/ImGui.frag" + +#define IMGUI_QUEUED_FRAMES 3 + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +ImGuiPkRHI *ImGuiPkRHI::m_Instance = null; + +//---------------------------------------------------------------------------- + +ImGuiPkRHI::ImGuiPkRHI() +{ + m_Time = 0.0f; + m_MouseWheel = 0.0f; + m_DefaultContext = ImGui::CreateContext(); +} + +//---------------------------------------------------------------------------- + +ImGuiPkRHI::~ImGuiPkRHI() +{ + m_RenderInfo.Clear(); +} + +//---------------------------------------------------------------------------- + +bool ImGuiPkRHI::Init(const SImguiInit &initData) +{ + PK_SCOPEDPROFILE(); + + ImGui::SetAllocatorFunctions(&ImGuiPkRHI::Malloc, &ImGuiPkRHI::Free, null); + + if (PK_VERIFY(m_Instance == null)) + m_Instance = PK_NEW(ImGuiPkRHI); + if (m_Instance == null) + return false; + + ImGuiIO &io = ImGui::GetIO(); + + Mem::Copy(io.KeyMap, initData.m_KeyMap, ImGuiKey_COUNT * sizeof(int)); + io.RenderDrawListsFn = null; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer. + + if (PK_VERIFY(io.Fonts != null) && !initData.m_FontDescs.Empty()) + { + for (const auto &font : initData.m_FontDescs) + { + if (font.m_FontPath == null) + io.Fonts->AddFontDefault(); + else + io.Fonts->AddFontFromFileTTF(font.m_FontPath, font.m_FontSize); + } + } + + m_Instance->m_IsMultiThreaded = initData.m_IsMultiThreaded; + { + // Initializes imgui font + unsigned char *pixels = null; + int width = 0; + int height = 0; + + io.Fonts->GetTexDataAsAlpha8(&pixels, &width, &height); + } + m_Instance->m_InitData = initData; + + return true; +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::Quit() +{ + PK_SCOPEDPROFILE(); + ImGui::SetCurrentContext(m_Instance->m_DefaultContext); + ImGui::DestroyContext(); + PK_ASSERT(m_Instance != null); + PK_DELETE(m_Instance); + m_Instance = null; +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::QuitIFN() +{ + if (m_Instance != null) + { + Quit(); + } +} + +//---------------------------------------------------------------------------- + +bool ImGuiPkRHI::CreateRenderInfo( const RHI::PApiManager &apiManager, + CShaderLoader &loader, + const TMemoryView &frameBufferLayout, + const RHI::PRenderPass &renderPass, + u32 subPassIdx) +{ + PK_SCOPEDPROFILE(); + PK_ASSERT(m_Instance != null); + m_Instance->m_RenderInfo.m_ApiManager = apiManager; + m_Instance->m_RenderInfo.m_AlphaBlend = m_Instance->m_RenderInfo.m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("ImGui AlphaBlend Render State")); + if (m_Instance->m_RenderInfo.m_AlphaBlend == null) + return false; + + RHI::SRenderState &renderState = m_Instance->m_RenderInfo.m_AlphaBlend->m_RenderState; + + renderState.m_PipelineState.m_DynamicViewport = true; + renderState.m_PipelineState.m_DynamicScissor = true; + + renderState.m_PipelineState.m_Blending = true; + renderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendSrcAlpha; + renderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOneMinusSrcAlpha; + renderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + + if (!renderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderState.m_InputVertexBuffers.Last().m_Stride = sizeof(ImDrawVert); + + if (m_Instance->m_RenderInfo.m_ShaderConstSetLayout.m_Constants.Empty()) + { + CreateSimpleSamplerConstSetLayouts(m_Instance->m_RenderInfo.m_ShaderConstSetLayout, false); + } + + FillImGuiShaderBindings(renderState.m_ShaderBindings, m_Instance->m_RenderInfo.m_ShaderConstSetLayout); + + renderState.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + renderState.m_ShaderBindings.m_InputAttributes[0].m_StartOffset = PK_MEMBER_OFFSET(ImDrawVert, pos); + + renderState.m_ShaderBindings.m_InputAttributes[1].m_BufferIdx = 0; + renderState.m_ShaderBindings.m_InputAttributes[1].m_StartOffset = PK_MEMBER_OFFSET(ImDrawVert, uv); + + renderState.m_ShaderBindings.m_InputAttributes[2].m_ShaderLocationBinding = 2; + renderState.m_ShaderBindings.m_InputAttributes[2].m_StartOffset = PK_MEMBER_OFFSET(ImDrawVert, col); + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Fragment = FRAGMENT_SHADER_PATH; + shadersPaths.m_Vertex = VERTEX_SHADER_PATH; + if (loader.LoadShader(renderState, shadersPaths, m_Instance->m_RenderInfo.m_ApiManager) == false) + return false; + + if (m_Instance->m_RenderInfo.m_ApiManager->BakeRenderState(m_Instance->m_RenderInfo.m_AlphaBlend, frameBufferLayout, renderPass, subPassIdx) == false) + return false; + + if (m_Instance->m_RenderInfo.m_FontTexture == null) + return CreateFontTexture(); + return true; +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::ReleaseRenderInfo() +{ + PK_SCOPEDPROFILE(); + PK_ASSERT(m_Instance != null); + m_Instance->m_RenderInfo.Clear(); +} + +//---------------------------------------------------------------------------- + +bool ImGuiPkRHI::CreateViewport() +{ + PK_SCOPEDPROFILE(); + PK_ASSERT(m_Instance != null); + return m_Instance->m_ViewportFrameInfo.PushBack().Valid(); +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::ReleaseViewport() +{ + PK_SCOPEDPROFILE(); + if (PK_VERIFY(m_Instance != null)) + { + PK_ASSERT(m_Instance->m_ViewportFrameInfo.Count() > 0); + m_Instance->m_ViewportFrameInfo.PopBackAndDiscard(); + } +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::NewFrame(CUint2 contextSize, float dt, float devicePixelRatio /*= 1.0f*/, float fontScale /*= 1.0f*/) +{ + PK_SCOPEDPROFILE(); + PK_ASSERT(m_Instance != null); + m_Instance->NextViewport(); + // Set the render size + ImGuiIO &io = ImGui::GetIO(); + + io.DisplaySize = ImVec2((float)contextSize.x(), (float)contextSize.y()); + io.DisplayFramebufferScale = ImVec2(devicePixelRatio, devicePixelRatio); + io.FontGlobalScale = fontScale; + + // Setup time step + io.DeltaTime = dt > 0.0 ? dt : (float)(1.0f / 60.0f); + + // Start the frame + ImGui::NewFrame(); +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::EndFrame() +{ + PK_SCOPEDPROFILE(); + PK_ASSERT(m_Instance != null); + m_Instance->m_ViewportIndex.Clear(); +} + +//---------------------------------------------------------------------------- + +ImDrawData *ImGuiPkRHI::GenerateRenderData() +{ + PK_SCOPEDPROFILE(); + PK_ASSERT(m_Instance != null); + ImGui::Render(); + return ImGui::GetDrawData(); +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::DrawRenderData(ImDrawData *draw_data, const RHI::PCommandBuffer &cmdBuff) +{ + PK_NAMEDSCOPEDPROFILE("ImGui pass"); + ImGuiPkRHI *instance = ImGuiPkRHI::GetInstance(); + + // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates) + ImGuiIO &io = ImGui::GetIO(); + + const int fb_width = (int)(io.DisplaySize.x * io.DisplayFramebufferScale.x); + const int fb_height = (int)(io.DisplaySize.y * io.DisplayFramebufferScale.y); + if (fb_width == 0 || fb_height == 0) + return; + draw_data->ScaleClipRects(io.DisplayFramebufferScale); + + ImGuiPkRHI::SFrameRenderInfo &frameRenderInfo = instance->GetFrameRenderInfo(); + + // Create the vertex and index buffer IFN + if (frameRenderInfo.m_VertexCount < static_cast(draw_data->TotalVtxCount)) + { + frameRenderInfo.m_VertexCount = draw_data->TotalVtxCount; + frameRenderInfo.m_VertexBuffer = instance->GetApiManager()->CreateGpuBuffer(RHI::SRHIResourceInfos("ImGui Vertex Buffer"), RHI::VertexBuffer, draw_data->TotalVtxCount * sizeof(ImDrawVert)); + } + if (frameRenderInfo.m_IndexCount < static_cast(draw_data->TotalIdxCount)) + { + frameRenderInfo.m_IndexCount = draw_data->TotalIdxCount; + frameRenderInfo.m_IndexBuffer = instance->GetApiManager()->CreateGpuBuffer(RHI::SRHIResourceInfos("ImGui Index Buffer"), RHI::IndexBuffer, draw_data->TotalIdxCount * sizeof(ImDrawIdx)); + } + + if (frameRenderInfo.m_VertexCount == 0 || frameRenderInfo.m_IndexCount == 0 || + !PK_VERIFY(frameRenderInfo.m_VertexBuffer != null && frameRenderInfo.m_IndexBuffer != null)) + return ; + + // Fill the buffers + ImDrawVert *vertexData = static_cast(instance->GetApiManager()->MapCpuView(frameRenderInfo.m_VertexBuffer)); + ImDrawIdx *indexData = static_cast(instance->GetApiManager()->MapCpuView(frameRenderInfo.m_IndexBuffer)); + + if (vertexData == null || indexData == null) + return; + + for (int n = 0; n < draw_data->CmdListsCount; n++) + { + const ImDrawList* cmd_list = draw_data->CmdLists[n]; + + Mem::Copy(vertexData, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert)); + Mem::Copy(indexData, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx)); + vertexData += cmd_list->VtxBuffer.Size; + indexData += cmd_list->IdxBuffer.Size; + } + + instance->GetApiManager()->UnmapCpuView(frameRenderInfo.m_VertexBuffer); + instance->GetApiManager()->UnmapCpuView(frameRenderInfo.m_IndexBuffer); + + // We push the constants used for rendering + float scaleTranslate[4]; + scaleTranslate[0] = 2.0f / io.DisplaySize.x; + scaleTranslate[1] = 2.0f / io.DisplaySize.y; + scaleTranslate[2] = -1.0f; + scaleTranslate[3] = -1.0f; + + cmdBuff->BindRenderState(instance->GetRenderState()); + + cmdBuff->PushConstant(scaleTranslate, 0); + + // Setup the correct viewport + cmdBuff->SetViewport(CInt2(0, 0), CUint2(fb_width, fb_height), CFloat2(0, 1)); + + cmdBuff->BindVertexBuffers(TMemoryView(frameRenderInfo.m_VertexBuffer)); + cmdBuff->BindIndexBuffer(frameRenderInfo.m_IndexBuffer, 0, RHI::IndexBuffer16Bit); + cmdBuff->BindConstantSets(TMemoryView(instance->GetConstantSet())); + + // Start to render the draw list + u32 vtx_offset = 0; + u32 idx_offset = 0; + for (int n = 0; n < draw_data->CmdListsCount; n++) + { + const ImDrawList *cmd_list = draw_data->CmdLists[n]; + + for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) + { + const ImDrawCmd *pcmd = &cmd_list->CmdBuffer[cmd_i]; + if (pcmd->UserCallback) + { + pcmd->UserCallback(cmd_list, pcmd); + } + else + { + CFloat2 clipRectOrigin = CFloat2(pcmd->ClipRect.x, pcmd->ClipRect.y); + CFloat2 clipRectSize = CFloat2(pcmd->ClipRect.z, pcmd->ClipRect.w) - clipRectOrigin; + + cmdBuff->SetScissor(CInt2((s32)(clipRectOrigin.x()), (s32)(clipRectOrigin.y())), + CUint2((u32)(clipRectSize.x()), (u32)(clipRectSize.y()))); + cmdBuff->DrawIndexed(idx_offset, vtx_offset, pcmd->ElemCount); + } + idx_offset += pcmd->ElemCount; + } + vtx_offset += cmd_list->VtxBuffer.Size; + } +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::MouseMoved(const CInt2 &mousePosition) +{ + PK_ASSERT(m_Instance != null); + ImGuiIO& io = ImGui::GetIO(); + io.MousePos = ImVec2(mousePosition.x(), mousePosition.y()); +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::MouseWheel(float mouseWheel) +{ + PK_ASSERT(m_Instance != null); + if (mouseWheel > 0) + m_Instance->m_MouseWheel = 1; + if (mouseWheel < 0) + m_Instance->m_MouseWheel = -1; +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::MouseButtonEvents(bool pressed, int keyMouseButtons) +{ + PK_ASSERT(m_Instance != null); + ImGuiIO &io = ImGui::GetIO(); + + io.MouseDown[0] = (keyMouseButtons & MouseButton_Left) ? pressed : io.MouseDown[0]; + io.MouseDown[1] = (keyMouseButtons & MouseButton_Middle) ? pressed : io.MouseDown[1]; + io.MouseDown[2] = (keyMouseButtons & MouseButton_Right) ? pressed : io.MouseDown[2]; +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::KeyEvents(bool pressed, int key, int keyModifiers) +{ + PK_ASSERT(m_Instance != null); + ImGuiIO &io = ImGui::GetIO(); + io.KeysDown[key] = pressed; + io.KeyShift = (keyModifiers & Modifier_Shift) ? pressed : io.KeyShift; + io.KeyCtrl = (keyModifiers & Modifier_Ctrl) ? pressed : io.KeyCtrl; + io.KeyAlt = (keyModifiers & Modifier_Alt) ? pressed : io.KeyAlt; + io.KeySuper = (keyModifiers & Modifier_Super) ? pressed : io.KeySuper; +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::TextInput(const char *c) +{ + PK_ASSERT(m_Instance != null); + ImGuiIO &io = ImGui::GetIO(); + io.AddInputCharactersUTF8(c); +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::WindowLostFocus() +{ + PK_ASSERT(m_Instance != null); + ImGuiIO &io = ImGui::GetIO(); + io.MouseDown[0] = false; + io.MouseDown[1] = false; + io.MouseDown[2] = false; +} + +//---------------------------------------------------------------------------- + +bool ImGuiPkRHI::Hovered() +{ + return ImGui::IsMouseHoveringAnyWindow() || ImGui::IsAnyItemHovered(); +} + +//---------------------------------------------------------------------------- + +#ifdef PK_WINDOWS +void ImGuiPkRHI::ChangeWindowHandle(HWND window) +{ + PK_ASSERT(m_Instance != null); + ImGuiIO &io = ImGui::GetIO(); + io.ImeWindowHandle = window; +} +#endif + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::UpdateInputs() +{ + PK_ASSERT(m_Instance != null); + ImGuiIO &io = ImGui::GetIO(); + io.MouseWheel = m_Instance->m_MouseWheel; + m_Instance->m_MouseWheel = 0.0f; +} + +//---------------------------------------------------------------------------- + +ImGuiPkRHI *ImGuiPkRHI::GetInstance() +{ + PK_ASSERT(m_Instance != null); + return m_Instance; +} + +//---------------------------------------------------------------------------- + +const RHI::PApiManager &ImGuiPkRHI::GetApiManager() const +{ + return m_RenderInfo.m_ApiManager; +} + +//---------------------------------------------------------------------------- + +ImGuiPkRHI::SRenderInfo &ImGuiPkRHI::GetRenderInfo() +{ + return m_RenderInfo; +} + +//---------------------------------------------------------------------------- + +ImGuiPkRHI::SFrameRenderInfo &ImGuiPkRHI::GetFrameRenderInfo() +{ + PK_ASSERT(m_ViewportIndex < m_ViewportFrameInfo.Count()); + return m_ViewportFrameInfo[m_ViewportIndex]; +} + +//---------------------------------------------------------------------------- + +const RHI::PConstantSet &ImGuiPkRHI::GetConstantSet() const +{ + return m_RenderInfo.m_ShaderConstSet; +} + +//---------------------------------------------------------------------------- + +const RHI::PRenderState &ImGuiPkRHI::GetRenderState() const +{ + return m_RenderInfo.m_AlphaBlend; +} + +//---------------------------------------------------------------------------- +// +// Copy ImGui data (copy constructor and copy operator are not implemented in ImGui) +// +//---------------------------------------------------------------------------- + +static bool copyDrawCommand(ImDrawCmd &dst, const ImDrawCmd &src) +{ + dst.ElemCount = src.ElemCount; + dst.ClipRect = src.ClipRect; + dst.TextureId = src.TextureId; + dst.UserCallback = src.UserCallback; + dst.UserCallbackData = src.UserCallbackData; + return true; +} + +//---------------------------------------------------------------------------- + +static bool copyDrawIdx(ImDrawIdx &dst, const ImDrawIdx &src) +{ + dst = src; + return true; +} + +//---------------------------------------------------------------------------- + +static bool copyDrawVert(ImDrawVert &dst, const ImDrawVert &src) +{ + dst = src; + return true; +} + +//---------------------------------------------------------------------------- + +ImDrawData *ImGuiPkRHI::CopyDrawData(const ImDrawData *data) +{ + PK_SCOPEDPROFILE(); + if (data->CmdListsCount == 0) + return null; + + ImDrawData *copiedData = PK_NEW(ImDrawData); + if (copiedData == null) + return null; + + copiedData->Valid = data->Valid; + copiedData->TotalVtxCount = data->TotalVtxCount; + copiedData->TotalIdxCount = data->TotalIdxCount; + copiedData->CmdListsCount = data->CmdListsCount; + + copiedData->CmdLists = PK_NEW(ImDrawList*[data->CmdListsCount]); + if (copiedData->CmdLists == null) + { + DeleteDrawData(copiedData); + return null; + } + + for (s32 i = 0; i < data->CmdListsCount; ++i) + { + copiedData->CmdLists[i] = PK_NEW(ImDrawList(ImGui::GetDrawListSharedData())); + if (copiedData->CmdLists[i] == null) + { + DeleteDrawData(copiedData); + return null; + } + + if (!CopyImguiVector(copiedData->CmdLists[i]->CmdBuffer, data->CmdLists[i]->CmdBuffer)) + { + DeleteDrawData(copiedData); + return null; + } + if (!CopyImguiVector(copiedData->CmdLists[i]->IdxBuffer, data->CmdLists[i]->IdxBuffer)) + { + DeleteDrawData(copiedData); + return null; + } + if (!CopyImguiVector(copiedData->CmdLists[i]->VtxBuffer, data->CmdLists[i]->VtxBuffer)) + { + DeleteDrawData(copiedData); + return null; + } + } + return copiedData; +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::DeleteDrawData(ImDrawData *data) +{ + PK_SCOPEDPROFILE(); + for (s32 i = 0; i < data->CmdListsCount; ++i) + { + PK_DELETE(data->CmdLists[i]); + } + PK_DELETE(data->CmdLists); + PK_DELETE(data); +} + +//---------------------------------------------------------------------------- + +bool ImGuiPkRHI::CreateFontTexture() +{ + // Build texture atlas + unsigned char *pixels = null; + int width = 0; + int height = 0; + int bpp = 0; + + ImGuiIO &io = ImGui::GetIO(); + io.Fonts->GetTexDataAsAlpha8(&pixels, &width, &height, &bpp); + + CImage fontImage; + + fontImage.m_Format = CImage::Format_Lum8; + if (!fontImage.m_Frames.PushBack().Valid() || + !fontImage.m_Frames.Last().m_Mipmaps.PushBack(CImageMap(CUint3(width, height, 1), pixels, width * height * bpp)).Valid()) + return false; + + m_Instance->m_RenderInfo.m_FontTexture = RHI::PixelFormatFallbacks::CreateTextureAndFallbackIFN(m_Instance->m_RenderInfo.m_ApiManager, fontImage, true, "IMGUI STATIC FONT IMAGE"); + m_Instance->m_RenderInfo.m_FontSampler = m_Instance->m_RenderInfo.m_ApiManager->CreateConstantSampler(RHI::SRHIResourceInfos("ImGui Font Sampler"), RHI::SampleLinear, RHI::SampleLinear, RHI::SampleClampToEdge, RHI::SampleClampToEdge, RHI::SampleClampToEdge, m_Instance->m_RenderInfo.m_FontTexture->GetMipmapCount()); + + m_Instance->m_RenderInfo.m_ShaderConstSet = m_Instance->m_RenderInfo.m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("ImGui Constant Set"), m_Instance->m_RenderInfo.m_ShaderConstSetLayout); + m_Instance->m_RenderInfo.m_ShaderConstSet->SetConstants(m_Instance->m_RenderInfo.m_FontSampler, m_Instance->m_RenderInfo.m_FontTexture, 0); + m_Instance->m_RenderInfo.m_ShaderConstSet->UpdateConstantValues(); + + // Store our identifier + io.Fonts->TexID = (void *)m_Instance->m_RenderInfo.m_FontTexture.Get(); + return true; +} + +//---------------------------------------------------------------------------- + +void *ImGuiPkRHI::Malloc(size_t size, void *) +{ + return PK_MALLOC(checked_numcast(size)); +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::Free(void *ptr, void *) +{ + PK_FREE(ptr); +} + +void ImGuiPkRHI::NextViewport() +{ + if (m_ViewportIndex.Valid()) + m_ViewportIndex++; + else + m_ViewportIndex = 0; + PK_ASSERT_MESSAGE(m_ViewportIndex < m_ViewportFrameInfo.Count(), "ImGuiPkRHI::ViewportIndex invalid. Missing call to ImGuiPkRHI::EndFrame or ImGuiPkRHI::CreateViewport"); + ImGui::SetCurrentContext(GetFrameRenderInfo().m_ImGuiContext); +} + +//---------------------------------------------------------------------------- + +ImGuiPkRHI::SFrameRenderInfo::SFrameRenderInfo() + : m_ImGuiContext(null) +{ + Clear(); + ImFontAtlas *atlas = ImGui::GetIO().Fonts; + m_ImGuiContext = ImGui::CreateContext(atlas); + ImGuiIO &io = ImGui::GetIO(); + Mem::Copy(io.KeyMap, m_Instance->m_InitData.m_KeyMap, ImGuiKey_COUNT * sizeof(int)); + io.RenderDrawListsFn = null; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer. +} + +//---------------------------------------------------------------------------- + +ImGuiPkRHI::SFrameRenderInfo::~SFrameRenderInfo() +{ + Clear(); +} + +//---------------------------------------------------------------------------- + +void ImGuiPkRHI::SFrameRenderInfo::Clear() +{ + m_VertexBuffer = null; + m_VertexCount = 0; + m_IndexBuffer = null; + m_IndexCount = 0; + if (m_ImGuiContext != null) + { + ImGui::SetCurrentContext(m_ImGuiContext); + ImGui::GetIO().Fonts = null; // avoid to destroy shared Font + ImGui::SetCurrentContext(m_Instance->m_DefaultContext); + ImGui::DestroyContext(m_ImGuiContext); + } + m_ImGuiContext = null; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ImguiRhiImplem.h b/Samples/PK-SampleLib/ImguiRhiImplem.h new file mode 100644 index 00000000..4fdb5f82 --- /dev/null +++ b/Samples/PK-SampleLib/ImguiRhiImplem.h @@ -0,0 +1,193 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "ApiContextConfig.h" + +#include + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +PK_FORWARD_DECLARE(ShaderLoader); + +//---------------------------------------------------------------------------- + +class ImGuiPkRHI +{ +public: + struct SRenderInfo + { + RHI::PApiManager m_ApiManager; + RHI::PRenderState m_AlphaBlend; + RHI::PTexture m_FontTexture; + RHI::PConstantSampler m_FontSampler; + RHI::SConstantSetLayout m_ShaderConstSetLayout; + RHI::PConstantSet m_ShaderConstSet; + + SRenderInfo() + { + Clear(); + } + + ~SRenderInfo() { } + + void Clear() + { + m_ApiManager = null; + m_AlphaBlend = null; + m_FontTexture = null; + m_FontSampler = null; + m_ShaderConstSetLayout.Reset(); + m_ShaderConstSet = null; + } + }; + + struct SFrameRenderInfo + { + RHI::PGpuBuffer m_VertexBuffer; + u32 m_VertexCount; + RHI::PGpuBuffer m_IndexBuffer; + u32 m_IndexCount; + ImGuiContext *m_ImGuiContext; + + SFrameRenderInfo(); + ~SFrameRenderInfo(); + + void Clear(); + }; + + ImGuiPkRHI(); + ~ImGuiPkRHI(); + + // From render thread + struct SImguiInit + { + bool m_IsMultiThreaded; // Set this to true if DrawRenderData is called on a separate thread + int m_KeyMap[ImGuiKey_COUNT]; + + struct SFontDesc + { + const char *m_FontPath; + float m_FontSize; // only used if m_FontPath != null + + SFontDesc() : m_FontPath(null), m_FontSize(0) {} + SFontDesc(const char *path, float size) : m_FontPath(path), m_FontSize(size) {} + }; + TMemoryView m_FontDescs; + + SImguiInit() + : m_IsMultiThreaded(false) + { + Mem::Clear(m_KeyMap); + } + }; + + // This should be called on the same thread + static bool Init(const SImguiInit &initData); + static void Quit(); + static void QuitIFN(); + static bool CreateRenderInfo( const RHI::PApiManager &apiManager, + CShaderLoader &loader, + const TMemoryView &frameBufferLayout, + const RHI::PRenderPass &renderPass, + u32 subPassIdx); + static void ReleaseRenderInfo(); + static bool CreateViewport(); + static void ReleaseViewport(); + static void NewFrame(CUint2 contextSize, float dt, float devicePixelRatio = 1.0f, float fontScale = 1.0f); + static ImDrawData *GenerateRenderData(); + static void DrawRenderData(ImDrawData *data, const RHI::PCommandBuffer &commandBuffer); + static void EndFrame(); + + // From main thread + enum KeyModifiers + { + Modifier_Shift = (1 << 0), + Modifier_Ctrl = (1 << 1), + Modifier_Alt = (1 << 2), + Modifier_Super = (1 << 3), + }; + + enum KeyMouseButtons + { + MouseButton_Left = (1 << 0), + MouseButton_Middle = (1 << 1), + MouseButton_Right = (1 << 2), + }; + + // This can be called on other threads + static void MouseMoved(const CInt2 &mousePosition); + static void MouseWheel(float mouseWheel); + static void MouseButtonEvents(bool pressed, int keyMouseButtons); + static void KeyEvents(bool pressed, int key, int keyModifiers); + static void TextInput(const char *c); + static void WindowLostFocus(); + static bool Hovered(); + +#ifdef PK_WINDOWS + static void ChangeWindowHandle(HWND window); +#endif + + static void UpdateInputs(); + + static ImGuiPkRHI *GetInstance(); + + const RHI::PApiManager &GetApiManager() const; + SRenderInfo &GetRenderInfo(); + SFrameRenderInfo &GetFrameRenderInfo(); + const RHI::PConstantSet &GetConstantSet() const; + const RHI::PRenderState &GetRenderState() const; + + static ImDrawData *CopyDrawData(const ImDrawData *data); + static void DeleteDrawData(ImDrawData *data); + + void NextViewport(); +private: + static bool CreateFontTexture(); + + // Memory management Fn + static void *Malloc(size_t size, void *); + static void Free(void *ptr, void *); + + + template + static bool CopyImguiVector(ImVector<_Type> &vectorDst, + const ImVector<_Type> &vectorSrc) + { + vectorDst.resize(vectorSrc.size()); + for (s32 i = 0; i < vectorSrc.size(); ++i) + { + if (!_CopyTypeFunc(vectorDst[i], vectorSrc[i])) + return false; + } + return true; + } + + static ImGuiPkRHI *m_Instance; + + bool m_IsMultiThreaded; + + double m_Time; + float m_MouseWheel; + + SRenderInfo m_RenderInfo; + TArray m_ViewportFrameInfo; + CGuid m_ViewportIndex; + ImGuiContext *m_DefaultContext; + SImguiInit m_InitData; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/PKPix.cpp b/Samples/PK-SampleLib/PKPix.cpp new file mode 100644 index 00000000..305c57c1 --- /dev/null +++ b/Samples/PK-SampleLib/PKPix.cpp @@ -0,0 +1,75 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "PKPix.h" + +#if (KR_PROFILER_ENABLED != 0) +#if defined(PK_BUILD_WITH_D3D12_SUPPORT) && (PK_BUILD_WITH_D3D12_SUPPORT != 0) + +#include + +#if !defined(PK_RETAIL) +# if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1910) // >= vs2015, < vs2017 +# pragma warning(disable: 4577) // Silence vs2015 noexcept warning +# endif +# define PROFILE +# include +# undef PROFILE +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +bool PKPixBeginEvent(void *arg, const Profiler::SNodeDescriptor *nodeDescriptor, const Profiler::SGPUProfileEventContext *ctx) +{ +#if defined(USE_PIX) + (void)arg; + if (ctx->m_CommandList != null) + { + PIXBeginEvent(ctx->m_CommandList, nodeDescriptor->m_ColorBGRA8, nodeDescriptor->m_Name); + return true; + } + else if (ctx->m_CommandQueue != null) + { + PIXBeginEvent(ctx->m_CommandQueue, nodeDescriptor->m_ColorBGRA8, nodeDescriptor->m_Name); + return true; + } +#else + (void)arg; (void)nodeDescriptor; (void)ctx; +#endif + return false; +} + +//---------------------------------------------------------------------------- + +void PKPixEndEvent(void *arg, const Profiler::SNodeDescriptor *nodeDescriptor, const Profiler::SGPUProfileEventContext *ctx) +{ +#if defined(USE_PIX) + (void)arg; + (void)nodeDescriptor; + if (ctx->m_CommandList != null) + { + PIXEndEvent(ctx->m_CommandList); + } + else if (ctx->m_CommandQueue != null) + { + PIXEndEvent(ctx->m_CommandQueue); + } +#else + (void)arg; (void)nodeDescriptor; (void)ctx; +#endif +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif //(PK_BUILD_WITH_D3D12_SUPPORT != 0) +#endif //(KR_PROFILER_ENABLED != 0) diff --git a/Samples/PK-SampleLib/PKPix.h b/Samples/PK-SampleLib/PKPix.h new file mode 100644 index 00000000..79e9388c --- /dev/null +++ b/Samples/PK-SampleLib/PKPix.h @@ -0,0 +1,30 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" +#include + +#if (KR_PROFILER_ENABLED != 0) +#if defined(PK_BUILD_WITH_D3D12_SUPPORT) && (PK_BUILD_WITH_D3D12_SUPPORT != 0) + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +bool PKPixBeginEvent(void *arg, const Profiler::SNodeDescriptor *nodeDescriptor, const Profiler::SGPUProfileEventContext *ctx); + +void PKPixEndEvent(void *arg, const Profiler::SNodeDescriptor *nodeDescriptor, const Profiler::SGPUProfileEventContext *ctx); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif //(PK_BUILD_WITH_D3D12_SUPPORT != 0) +#endif //(KR_PROFILER_ENABLED != 0) diff --git a/Samples/PK-SampleLib/PKSample.h b/Samples/PK-SampleLib/PKSample.h new file mode 100644 index 00000000..45553417 --- /dev/null +++ b/Samples/PK-SampleLib/PKSample.h @@ -0,0 +1,41 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#include + +// Note (Alex) : fix me, render helper import badly d3d11.h everywhere because of missing abstraction for specific storage +// -> see rh_gpu_batch.inl and ps_stream_to_render.h +#if defined(PK_PARTICLES_UPDATER_USE_D3D11) && (PK_PARTICLES_UPDATER_USE_D3D11 != 0) +# include +#endif + +#define __PK_SAMPLE_API_BEGIN namespace PKSample { +#define __PK_SAMPLE_API_END } + +#if defined(PK_DESKTOP_TOOLS) +# define PK_SAMPLE_LIB_HAS_SHADER_GENERATOR 1 +#else +# define PK_SAMPLE_LIB_HAS_SHADER_GENERATOR 0 +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +using namespace PK_NAMESPACE; + +// Todo(Hugo/Alex/Thomas): Definitely a bad place for this. +const char kDefaultShadersFolder[] = "Shaders"; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/PKSampleInit.cpp b/Samples/PK-SampleLib/PKSampleInit.cpp new file mode 100644 index 00000000..47b98e7b --- /dev/null +++ b/Samples/PK-SampleLib/PKSampleInit.cpp @@ -0,0 +1,101 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include +#include + +#include "PK-SampleLib/PKSampleInit.h" +#include "PK-SampleLib/ImguiRhiImplem.h" +#include "PK-SampleLib/RenderIntegrationRHI/RendererCache.h" +#include "pk_render_helpers/include/render_features/rh_features_basic.h" + +PK_LOG_MODULE_DECLARE(); + +//---------------------------------------------------------------------------- + +#ifndef PK_API_LIB +#if defined(PK_WINAPI) + +BOOL APIENTRY DllMain(HINSTANCE hLibModule, DWORD callOrigin, LPVOID reserved) +{ + PopcornFX::CPKSample::RegisterLibraryEntryPoint(hLibModule); + ::DisableThreadLibraryCalls(hLibModule); + return TRUE; +} + +#else + +int _init(void) +{ + return (0); +} + +int _fini(void) +{ + return (0); +} + +#endif +#endif + +__PK_API_BEGIN +//---------------------------------------------------------------------------- + +bool CPKSampleBase::m_Active = false; + +//---------------------------------------------------------------------------- + +bool CPKSampleBase::InternalStartup(const Config &) +{ + PK_LOG_MODULE_INIT_START; + + PKSample::CRHIMaterialShaders::RegisterHandler(); + PKSample::CRHIRenderingFeature::RegisterHandler(); + PKSample::CRHIRenderingSettings::RegisterHandler(); + + PKSample::SConstantAtlasKey::SetupConstantSetLayout(); + PKSample::SConstantNoiseTextureKey::SetupConstantSetLayout(); + PKSample::SConstantDrawRequests::SetupConstantSetLayouts(); + + PKSample::STextureKey::SetupDefaultResource(); + PKSample::SGeometryKey::SetupDefaultResource(); + + PK_LOG_MODULE_INIT_END; + m_Active = true; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPKSampleBase::InternalShutdown() +{ + m_Active = false; + PK_LOG_MODULE_RELEASE_START; + + PKSample::CRendererCacheInstance_UpdateThread::RenderThread_DestroyAllResources(); + + PKSample::SConstantAtlasKey::ClearConstantSetLayoutIFN(); + PKSample::SConstantNoiseTextureKey::ClearConstantSetLayoutIFN(); + PKSample::SConstantDrawRequests::ClearConstantSetLayoutsIFN(); + + PKSample::ImGuiPkRHI::QuitIFN(); + + PKSample::CRHIRenderingSettings::UnregisterHandler(); + PKSample::CRHIRenderingFeature::UnregisterHandler(); + PKSample::CRHIMaterialShaders::UnregisterHandler(); + + PK_LOG_MODULE_RELEASE_END; + return true; +} + +//---------------------------------------------------------------------------- +__PK_API_END diff --git a/Samples/PK-SampleLib/PKSampleInit.h b/Samples/PK-SampleLib/PKSampleInit.h new file mode 100644 index 00000000..9f3fa117 --- /dev/null +++ b/Samples/PK-SampleLib/PKSampleInit.h @@ -0,0 +1,47 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include + +__PK_API_BEGIN +//---------------------------------------------------------------------------- + +class PK_EXPORT CPKSampleBase +{ +public: + struct Config + { + bool m_ShouldBuildShaders; + Config() : m_ShouldBuildShaders(false) {} + }; + +protected: + static bool InternalStartup(const Config &config); + static bool InternalShutdown(); + + static bool m_Active; + +public: + static const char *LibraryName() { return "PK-Sample"; } + static bool Active() { return m_Active; } +}; + +//---------------------------------------------------------------------------- + +typedef TPKLibrary CPKSample; + +// FIXME: Uncomment this for dlls, but TPKLibrary will need to be instanciated inside a cpp +//template class PK_EXPORT TPKLibrary; + +//---------------------------------------------------------------------------- +__PK_API_END diff --git a/Samples/PK-SampleLib/PipelineCacheHelper.cpp b/Samples/PK-SampleLib/PipelineCacheHelper.cpp new file mode 100644 index 00000000..4741c673 --- /dev/null +++ b/Samples/PK-SampleLib/PipelineCacheHelper.cpp @@ -0,0 +1,87 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + + +#include "precompiled.h" + +#include "PipelineCacheHelper.h" +#include "SampleUtils.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CPipelineCacheHelper::CPipelineCacheHelper() +{ +} + +//---------------------------------------------------------------------------- + +CPipelineCacheHelper::~CPipelineCacheHelper() +{ +} + +//---------------------------------------------------------------------------- + +void CPipelineCacheHelper::LoadPipelineCache(const RHI::PApiManager &apiManager, const CString &filePath) +{ + if (apiManager->ApiDesc().m_SupportPipelineCache) + { + CString apiFilePath = filePath + GetShaderExtensionStringFromApi(apiManager->ApiName()); + PFileStream fileView = File::DefaultFileSystem()->OpenStream(apiFilePath, IFileSystem::Access_Read); + + if (fileView == null) + { + CLog::Log(PK_INFO, "Could not load pipeline cache"); + return; + } + + u32 cacheSize = 0; + void *cacheData = fileView->Bufferize(cacheSize); + if (!apiManager->SetProgramCache(cacheData, cacheSize)) + { + CLog::Log(PK_WARN, "The cache data loaded is not valid"); + } + else + { + CLog::Log(PK_INFO, "Pipeline cache successfully loaded"); + } + PK_FREE(cacheData); + } +} + +//---------------------------------------------------------------------------- + +bool CPipelineCacheHelper::SavePipelineCache(const RHI::PApiManager &apiManager, const CString &filePath) +{ + if (apiManager->ApiDesc().m_SupportPipelineCache) + { + CString apiFilePath = filePath + GetShaderExtensionStringFromApi(apiManager->ApiName()); + PFileStream fileView = File::DefaultFileSystem()->OpenStream(apiFilePath, IFileSystem::Access_WriteCreate); + + void *cacheData = null; + u32 cacheSize = 0; + if (!apiManager->RetrieveProgramCache(cacheData, cacheSize)) + { + CLog::Log(PK_ERROR, "Could not retrieve the pipeline cache"); + return false; + } + if (fileView == null || !fileView->Write(cacheData, cacheSize)) + { + PK_FREE(cacheData); + CLog::Log(PK_ERROR, "Could not save the pipeline cache"); + return false; + } + PK_FREE(cacheData); + } + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/PipelineCacheHelper.h b/Samples/PK-SampleLib/PipelineCacheHelper.h new file mode 100644 index 00000000..0a34c1c5 --- /dev/null +++ b/Samples/PK-SampleLib/PipelineCacheHelper.h @@ -0,0 +1,30 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CPipelineCacheHelper +{ +public: + CPipelineCacheHelper(); + ~CPipelineCacheHelper(); + + void LoadPipelineCache(const RHI::PApiManager &apiManager, const CString &filePath); + bool SavePipelineCache(const RHI::PApiManager &apiManager, const CString &filePath); +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/PopcornStartup/PopcornStartup.cpp b/Samples/PK-SampleLib/PopcornStartup/PopcornStartup.cpp new file mode 100644 index 00000000..565315d5 --- /dev/null +++ b/Samples/PK-SampleLib/PopcornStartup/PopcornStartup.cpp @@ -0,0 +1,290 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PopcornStartup.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#if KR_PROFILER_ENABLED != 0 +# if defined(PK_BUILD_WITH_D3D12_SUPPORT) && (PK_BUILD_WITH_D3D12_SUPPORT != 0) +# include +# elif defined(PK_BUILD_WITH_UNKNOWN2_SUPPORT) && (PK_BUILD_WITH_UNKNOWN2_SUPPORT != 0) +# include +# endif +#endif // KR_PROFILER_ENABLED != 0 + +//---------------------------------------------------------------------------- + +PK_LOG_MODULE_DEFINE(); + +#if (defined(PK_ANDROID) || defined(PK_WINAPI) || defined(PK_LINUX) || defined(PK_MACOSX) || defined(PK_IOS)) +# define USE_PLUGIN_CODEC_PKM 1 +#else +# define USE_PLUGIN_CODEC_PKM 0 +#endif + +#if (defined(PK_IOS) || defined(PK_WINAPI) || defined(PK_LINUX) || defined(PK_MACOSX) || defined(PK_IOS)) +# define USE_PLUGIN_CODEC_PVR 1 +#else +# define USE_PLUGIN_CODEC_PVR 0 +#endif + +#if !defined(PK_COMPILER_BUILD_COMPILER_D3D) || \ + !defined(PK_COMPILER_BUILD_COMPILER_UNKNOWN2) +# error Configuration error: Should be defined in ps_config.h +#endif + +#if !defined(USE_COMPILER_BACKEND_D3D) +# if (PK_COMPILER_BUILD_COMPILER_D3D != 0) +# define USE_COMPILER_BACKEND_D3D +# endif +#endif +#if !defined(USE_COMPILER_BACKEND_UNKNOWN2) +# if (PK_COMPILER_BUILD_COMPILER_UNKNOWN2 != 0) +# define USE_COMPILER_BACKEND_UNKNOWN2 +# endif +#endif + +//---------------------------------------------------------------------------- + +PK_PLUGIN_DECLARE(CCompilerBackendCPU_VM); +#if (PK_COMPILER_BUILD_COMPILER_ISPC != 0) + PK_PLUGIN_DECLARE(CCompilerBackendCPU_ISPC); +#endif +#if defined(USE_COMPILER_BACKEND_D3D) + PK_PLUGIN_DECLARE(CCompilerBackendGPU_D3D); +#endif +#if defined(USE_COMPILER_BACKEND_UNKNOWN2) + PK_PLUGIN_DECLARE(CCompilerBackendGPU_PSSLC); +#endif +PK_PLUGIN_DECLARE(CImageDDSCodec); +PK_PLUGIN_DECLARE(CImagePNGCodec); +PK_PLUGIN_DECLARE(CImageTGACodec); +PK_PLUGIN_DECLARE(CImageJPEGCodec); +PK_PLUGIN_DECLARE(CImageHDRCodec); +#if USE_PLUGIN_CODEC_PKM + PK_PLUGIN_DECLARE(CImagePKMCodec); +#endif +#if USE_PLUGIN_CODEC_PVR + PK_PLUGIN_DECLARE(CImagePVRCodec); +#endif + +//---------------------------------------------------------------------------- + +namespace +{ + struct SPlugin + { + PK_NAMESPACE::IPluginModule *(*m_Startup)(); + PK_NAMESPACE::IPluginModule *(*m_Get)(); + void (*m_Shutdown)(); + const char *m_Path; + }; + + // List of PopcornFX plugins to load alongside PopcornFX runtime SDK + // If your integration code overrides the SDK's default resource manager, you won't need to register image codecs + // as it'll load your resources directly +#define PLUGIN_DEF(__name, __path) { &PK_NAMESPACE::PK_GLUE(StartupPlugin_, __name), &PK_NAMESPACE::PK_GLUE(GetPlugin_, __name), &PK_NAMESPACE::PK_GLUE(ShutdownPlugin_, __name), __path } + const SPlugin g_Plugins[] = + { + PLUGIN_DEF(CCompilerBackendCPU_VM, "Plugins/compiler_backend_cpu_vm"), +#if defined(USE_COMPILER_BACKEND_D3D) + PLUGIN_DEF(CCompilerBackendGPU_D3D, "Plugins/compiler_backend_gpu_d3d"), +#endif +#if defined(USE_COMPILER_BACKEND_UNKNOWN2) + PLUGIN_DEF(CCompilerBackendGPU_PSSLC, "Plugins/compiler_backend_gpu_psslc"), +#endif + PLUGIN_DEF(CImageDDSCodec, "Plugins/codec_dds"), + PLUGIN_DEF(CImagePNGCodec, "Plugins/codec_png"), + PLUGIN_DEF(CImageTGACodec, "Plugins/codec_tga"), + PLUGIN_DEF(CImageJPEGCodec, "Plugins/codec_jpeg"), + PLUGIN_DEF(CImageHDRCodec, "Plugins/codec_hdr"), +# if USE_PLUGIN_CODEC_PKM + PLUGIN_DEF(CImagePKMCodec, "Plugins/codec_pkm"), +# endif +# if USE_PLUGIN_CODEC_PVR + PLUGIN_DEF(CImagePVRCodec, "Plugins/codec_pvr"), +# endif +//#endif + }; +#undef PLUGIN_DEF +} + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +static void AddStdOutLogListener(void *) +{ +#if (PK_LOG_ENABLED != 0) + CLog::AddGlobalListener(PK_NEW(CLogListenerFile("popcorn.htm", "popcorn-engine logfile"))); +# if (PK_LOG_DEV_LOGGERS_ENABLED != 0) && !defined(PK_RETAIL) + CLog::AddGlobalListener(PK_NEW(CLogListenerDebug())); +# if defined(PK_WINAPI) && defined(PK_COMPILER_MSVC) + CLog::AddGlobalListener(PK_NEW(CLogListenerStdOut())); +# endif +# endif +#endif // (PK_LOG_ENABLED != 0) +} + +//---------------------------------------------------------------------------- + +// This worker thread pool creation is very basic right now, we'll improve that in future beta versions +Threads::PAbstractPool _CreateThreadPool() +{ + // You can either use the default PopcornFX thread pool, so you can specify amount of worker threads and their affinities. + // Or create your own, and submit PopcornFX CPU tasks in your engine workers + PWorkerThreadPool pool = PK_NEW(CWorkerThreadPool); + + if (!PK_VERIFY(pool != null)) + return null; + +#if 0//defined(PK_WINAPI) + // Pin each worker to a physical HW thread. + CWorkerThreadPool::SNumaWorkersConfig config; + const bool success = pool->AddNUMAWorkers(config); +#else + // Let the OS shedule our workers + // leave 1 core for main thread + const u32 processorCount = PKMax(CPU::Caps().ProcessAffinity().NumBitsSet(), 2U) - 1U; + const bool success = pool->AddFullAffinityWorkers(processorCount, CPU::Caps().ProcessAffinity(), CThreadManager::Priority_High); +#endif + + if (!success) + return null; + + pool->StartWorkers(); + return pool; +} + +//---------------------------------------------------------------------------- + +bool PopcornStartup(bool logOnStdOut, File::FnNewFileSystem newFileSys, Scheduler::FnCreateThreadPool newThreadPool) +{ + SDllVersion engineVersion; + + PK_ASSERT(engineVersion.Major == PK_VERSION_MAJOR); + PK_ASSERT(engineVersion.Minor == PK_VERSION_MINOR); +#ifdef PK_DEBUG + PK_ASSERT(engineVersion.Debug == true); +#else + PK_ASSERT(engineVersion.Debug == false); +#endif + CPKKernel::Config configKernel; + + if (logOnStdOut) + configKernel.m_AddDefaultLogListeners = &AddStdOutLogListener; + + if (newThreadPool != null) + configKernel.m_CreateThreadPool = newThreadPool; + else + configKernel.m_CreateThreadPool = &_CreateThreadPool; + + configKernel.m_NewFileSystem = newFileSys; + +#if KR_PROFILER_ENABLED != 0 +# if defined(PK_BUILD_WITH_D3D12_SUPPORT) && (PK_BUILD_WITH_D3D12_SUPPORT != 0) + configKernel.m_ProfilerRecordEventStartGPU = &PKPixBeginEvent; + configKernel.m_ProfilerRecordEventEndGPU = &PKPixEndEvent; +# elif defined(PK_BUILD_WITH_UNKNOWN2_SUPPORT) && (PK_BUILD_WITH_UNKNOWN2_SUPPORT != 0) + configKernel.m_ProfilerRecordEventStartGPU = &PKRazorBeginEvent; + configKernel.m_ProfilerRecordEventEndGPU = &PKRazorEndEvent; +# endif +#endif + + // Startup all PopcornFX critical modules, each module's config can be overridden + if (CPKKernel::Startup(engineVersion, configKernel) && + CPKBaseObject::Startup(engineVersion, CPKBaseObject::Config()) && + CPKEngineUtils::Startup(engineVersion, CPKEngineUtils::Config()) && + CPKCompiler::Startup(engineVersion, CPKCompiler::Config()) && + CPKImaging::Startup(engineVersion, CPKImaging::Config()) && + CPKGeometrics::Startup(engineVersion, CPKGeometrics::Config()) && + CPKParticles::Startup(engineVersion, CPKParticles::Config()) && + ParticleToolbox::Startup() && + CPKRenderHelpers::Startup(engineVersion, CPKRenderHelpers::Config()) && + CPKRHI::Startup(engineVersion, CPKRHI::Config()) && // Only necessary if your engine links/relies on PKRHI + CPKSample::Startup(engineVersion, CPKSample::Config()) && // Only necessary if your engine links/relies on PKSample + PK_VERIFY(Kernel::CheckStaticConfigFlags(Kernel::g_BaseStaticConfig, SKernelConfigFlags()))) + { + for (u32 i = 0; i < PK_ARRAY_COUNT(g_Plugins); ++i) + { + IPluginModule *plugin = (*g_Plugins[i].m_Startup)(); + if (plugin == null || !CPluginManager::PluginRegister(plugin, true, g_Plugins[i].m_Path)) + { + CLog::Log(PK_INFO, "Failed to load plugin %s", g_Plugins[i].m_Path); + return false; + } + } + + // Optional, don't place that if PopcornFX startup is done in your engine's main thread + // As this is probably done by your engine + CThreadManager::SetProcessPriority(CThreadManager::Process_High); + + // Specify your engine's coordinate system & unit-system + CParticleManager::SetGlobalFrame(Frame_RightHand_Y_Up); + CParticleManager::SetDistanceUnit(Units::Meter); + return true; + } + + PopcornShutdown(); // shutdown the modules we were able to load... + return false; +} + +//---------------------------------------------------------------------------- + +bool PopcornShutdown() +{ + for (u32 i = 0; i < PK_ARRAY_COUNT(g_Plugins); ++i) + { + IPluginModule *plugin = (*g_Plugins[i].m_Get)(); + if (plugin != null) + CPluginManager::PluginRelease(plugin); + (*g_Plugins[i].m_Shutdown)(); + } + + CPKSample::Shutdown(); // Only necessary if your engine links/relies on PKSample + CPKRHI::Shutdown(); // Only necessary if your engine links/relies on PKRHI + CPKRenderHelpers::Shutdown(); + ParticleToolbox::Shutdown(); + CPKParticles::Shutdown(); + CPKGeometrics::Shutdown(); + CPKImaging::Shutdown(); + CPKCompiler::Shutdown(); + CPKEngineUtils::Shutdown(); + CPKBaseObject::Shutdown(); + CPKKernel::Shutdown(); + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/PopcornStartup/PopcornStartup.h b/Samples/PK-SampleLib/PopcornStartup/PopcornStartup.h new file mode 100644 index 00000000..f4dd4cbc --- /dev/null +++ b/Samples/PK-SampleLib/PopcornStartup/PopcornStartup.h @@ -0,0 +1,24 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +bool PopcornStartup(bool stdOut, File::FnNewFileSystem newFileSys = null, Scheduler::FnCreateThreadPool newThreadPool = null); +bool PopcornShutdown(); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ProfilerRenderer.cpp b/Samples/PK-SampleLib/ProfilerRenderer.cpp new file mode 100644 index 00000000..ce3f935a --- /dev/null +++ b/Samples/PK-SampleLib/ProfilerRenderer.cpp @@ -0,0 +1,998 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ProfilerRenderer.h" + +#if PKSAMPLE_HAS_PROFILER_RENDERER + +#include "ShaderDefinitions/SampleLibShaderDefinitions.h" + +#include + +#include + +#define VERTEX_SHADER_PATH "./Shaders/Profiler.vert" +#define FRAGMENT_SHADER_PATH "./Shaders/Profiler.frag" + +#define VERTEX_RECT_SHADER_PATH "./Shaders/ProfilerDrawNode.vert" +#define FRAGMENT_RECT_SHADER_PATH "./Shaders/ProfilerDrawNode.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +static float scalar_to_target_l(float scalar, float target, float timestep, float lambda) +{ + const float t = 1.0f - expf(-lambda * timestep); + return scalar + t * (target - scalar); +} + +//---------------------------------------------------------------------------- + +CProfilerRenderer::CProfilerRenderer() +: m_Enabled(false) +, m_Pause(false) +#if defined(PK_DEBUG) || defined(PK_LINUX) || defined(PK_MACOSX) +, m_CallstacksEnabled(true) +#else +, m_CallstacksEnabled(false) +#endif +//, m_TransferWait(null) +//, m_TransferSignal(null) +, m_TargetProfilerScale(40000.0f) +, m_LastProfileFocusPos(0.0f) +, m_ProfilerVerticalOffset(0.0f) +, m_DtHistoryPos(0) +, m_ProfilerReplay(false) +{ + _SetupDefaultDescriptor(m_RenderData.m_DrawDescriptor); + for (u32 i = 0; i < kDtHistorySize; i++) + m_DtHistory[i] = 1.0f / 60.0f; +} + +//---------------------------------------------------------------------------- + +CProfilerRenderer::~CProfilerRenderer() +{ + ReleaseRenderInfo(); + + if (!m_ProfilerReplay) + { + Profiler::CProfiler *profiler = Profiler::MainEngineProfiler(); + if (profiler != null) + { + profiler->GrabCallstacks(false); + profiler->Activate(false); + profiler->Reset(); + } + } +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::ReleaseRenderInfo() +{ + m_RenderInfo.Clear(); +} + +//---------------------------------------------------------------------------- + +bool CProfilerRenderer::_TransferBatchToGpu(const SProfilerRenderData &renderData) +{ + PK_SCOPEDPROFILE(); + if (!PK_VERIFY(m_RenderInfo.m_ApiManager != null)) // Not properly initialized + return false; + + if (!renderData.m_IsValid) // We can re-render the old profiler geometry in this case + return true; + + if (m_ProfilerReplay) + { + PK_NAMEDSCOPEDPROFILE("CProfilerDrawer::UpdateReplay"); + + Profiler::PProfilerReport frameReport; + { + PK_SCOPEDLOCK(m_NewProfilerFramesLock); + PK_ASSERT(m_NewProfilerFrames.Empty() || m_NewProfilerFrames.Count() == 1); + if (!m_NewProfilerFrames.Empty()) + frameReport = m_NewProfilerFrames.Last(); + } + + m_ProfilerDrawer.m_ReportToTrash = null; + m_ProfilerDrawer.m_ProfilerReportHistoryPos = 0; + m_ProfilerDrawer.m_ProfilerThreadUsageHistoryPos = 0; + + m_ProfilerDrawer.Update(renderData.m_DrawDescriptor, frameReport); + } + else + { + PK_NAMEDSCOPEDPROFILE("CProfilerDrawer::Update"); + DynamicProfileReportList framesToPush; + StaticProfileReportList framesToTrash; + { + PK_SCOPEDLOCK(m_NewProfilerFramesLock); + framesToPush = m_NewProfilerFrames; + m_NewProfilerFrames.Clear(); + } + for (u32 i = 0; i < framesToPush.Count(); ++i) + { + m_ProfilerDrawer.Update(renderData.m_DrawDescriptor, framesToPush[i]); + if (m_ProfilerDrawer.m_ReportToTrash != null && !framesToTrash.Full()) + framesToTrash.PushBack(m_ProfilerDrawer.m_ReportToTrash); + } + if (!framesToTrash.Empty()) + { + PK_SCOPEDLOCK(m_OldProfilerFramesLock); + for (u32 i = 0; i < framesToTrash.Count() && !m_OldProfilerFrames.Full(); ++i) + m_OldProfilerFrames.PushBack(framesToTrash[i]); + } + } + + { + PK_NAMEDSCOPEDPROFILE("CProfilerDrawer::DrawGPU"); + m_DrawOutputs.Clear(); + m_ToolTipMsgs.Clear(); + m_ProfilerDrawer.DrawGPU(m_DrawOutputs, renderData.m_DrawDescriptor); + } + + // Allocate the GpuBuffers IFN: + m_RenderInfo.m_ElemCountLinesAlphaBlend = m_DrawOutputs.m_LineBatchSolid.m_LineVtxPos.Count(); + m_RenderInfo.m_ElemCountLinesAdditive = m_DrawOutputs.m_LineBatch.m_LineVtxPos.Count(); + m_RenderInfo.m_ElemCountRectsAlphaBlendDashed = m_DrawOutputs.m_RectBatchSolidDashed.m_RectDescs.Count(); + m_RenderInfo.m_ElemCountRectsAlphaBlend = m_DrawOutputs.m_RectBatchSolid.m_RectDescs.Count(); + m_RenderInfo.m_ElemCountRectsAdditive = m_DrawOutputs.m_RectBatch.m_RectDescs.Count(); + + u32 linesVertexCount = m_RenderInfo.m_ElemCountLinesAlphaBlend + m_RenderInfo.m_ElemCountLinesAdditive; + u32 rectsVertexCount = m_RenderInfo.m_ElemCountRectsAlphaBlendDashed + m_RenderInfo.m_ElemCountRectsAlphaBlend + m_RenderInfo.m_ElemCountRectsAdditive; + u32 dashedVertexCount = m_RenderInfo.m_ElemCountRectsAlphaBlendDashed; + + if (m_RenderInfo.m_RectsIndexBuffer == null) + { + PK_NAMEDSCOPEDPROFILE("Alloc rectangles index buffer"); + m_RenderInfo.m_RectsIndexBuffer = m_RenderInfo.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("ProfilerRenderer Index Buffer"), RHI::IndexBuffer, 6 * sizeof(u16)); + // Basic index buffer for quads: + u16 *mappedIdx = (u16*)m_RenderInfo.m_ApiManager->MapCpuView(m_RenderInfo.m_RectsIndexBuffer); + + mappedIdx[0] = 0; + mappedIdx[1] = 1; + mappedIdx[2] = 2; + mappedIdx[3] = 2; + mappedIdx[4] = 3; + mappedIdx[5] = 0; + + m_RenderInfo.m_ApiManager->UnmapCpuView(m_RenderInfo.m_RectsIndexBuffer); + } + if (m_RenderInfo.m_LinesVertexCapacity < linesVertexCount) + { + PK_NAMEDSCOPEDPROFILE("Alloc lines buffer"); + m_RenderInfo.m_LinesVertexCapacity = (linesVertexCount * 2) + 128; + m_RenderInfo.m_LinesVertexBuffer = m_RenderInfo.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("ProfilerRenderer Lines Vertex Buffer"), RHI::VertexBuffer, m_RenderInfo.m_LinesVertexCapacity * sizeof(CFloat2)); + m_RenderInfo.m_LinesColorBuffer = m_RenderInfo.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("ProfilerRenderer Lines Color Vertex Buffer"), RHI::VertexBuffer, m_RenderInfo.m_LinesVertexCapacity * sizeof(CFloat4)); + if (m_RenderInfo.m_LinesVertexBuffer == null || m_RenderInfo.m_LinesColorBuffer == null) + return false; + } + if (m_RenderInfo.m_RectsVertexCapacity < rectsVertexCount) + { + PK_NAMEDSCOPEDPROFILE("Alloc rectangles buffer"); + m_RenderInfo.m_RectsVertexCapacity = (rectsVertexCount * 2) + 128; + m_RenderInfo.m_RectsVertexBuffer = m_RenderInfo.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("ProfilerRenderer Rects Vertex Buffer"), RHI::VertexBuffer, m_RenderInfo.m_RectsVertexCapacity * sizeof(CFloat4)); + m_RenderInfo.m_RectsColorBuffer0 = m_RenderInfo.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("ProfilerRenderer Rects Color0 Vertex Buffer"), RHI::VertexBuffer, m_RenderInfo.m_RectsVertexCapacity * sizeof(CFloat4)); + m_RenderInfo.m_RectsColorBuffer1 = m_RenderInfo.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("ProfilerRenderer Rects Color1 Vertex Buffer"), RHI::VertexBuffer, m_RenderInfo.m_RectsVertexCapacity * sizeof(CFloat4)); + if (m_RenderInfo.m_RectsVertexBuffer == null || m_RenderInfo.m_RectsColorBuffer0 == null || m_RenderInfo.m_RectsColorBuffer1 == null) + return false; + } + if (m_RenderInfo.m_DashedRectsVertexCapacity < dashedVertexCount) + { + PK_NAMEDSCOPEDPROFILE("Alloc dashed rectangles border color"); + m_RenderInfo.m_DashedRectsVertexCapacity = (dashedVertexCount * 2) + 128; + m_RenderInfo.m_DashedRectsBorderColor = m_RenderInfo.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("ProfilerRenderer Dashed Rects Color Vertex Buffer"), RHI::VertexBuffer, m_RenderInfo.m_DashedRectsVertexCapacity * sizeof(CFloat4)); + if (m_RenderInfo.m_DashedRectsBorderColor == null) + return false; + } + + if (linesVertexCount != 0) + { + // Transfer the vertex data for lines: + CFloat2 *linesVertexData = static_cast(m_RenderInfo.m_ApiManager->MapCpuView(m_RenderInfo.m_LinesVertexBuffer, 0, linesVertexCount * sizeof(CFloat2))); + CFloat4 *linesColorData = static_cast(m_RenderInfo.m_ApiManager->MapCpuView(m_RenderInfo.m_LinesColorBuffer, 0, linesVertexCount * sizeof(CFloat4))); + if (linesVertexData == null || linesColorData == null) + return false; + + Mem::Copy(linesVertexData, m_DrawOutputs.m_LineBatchSolid.m_LineVtxPos.RawDataPointer(), m_RenderInfo.m_ElemCountLinesAlphaBlend * sizeof(CFloat2)); + linesVertexData += m_RenderInfo.m_ElemCountLinesAlphaBlend; + Mem::Copy(linesVertexData, m_DrawOutputs.m_LineBatch.m_LineVtxPos.RawDataPointer(), m_RenderInfo.m_ElemCountLinesAdditive * sizeof(CFloat2)); + + Mem::Copy(linesColorData, m_DrawOutputs.m_LineBatchSolid.m_LineVtxColor.RawDataPointer(), m_RenderInfo.m_ElemCountLinesAlphaBlend * sizeof(CFloat4)); + linesColorData += m_RenderInfo.m_ElemCountLinesAlphaBlend; + Mem::Copy(linesColorData, m_DrawOutputs.m_LineBatch.m_LineVtxColor.RawDataPointer(), m_RenderInfo.m_ElemCountLinesAdditive * sizeof(CFloat4)); + + m_RenderInfo.m_ApiManager->UnmapCpuView(m_RenderInfo.m_LinesVertexBuffer); + m_RenderInfo.m_ApiManager->UnmapCpuView(m_RenderInfo.m_LinesColorBuffer); + } + if (rectsVertexCount != 0) + { + // Transfer the vertex data for rects: + CFloat4 *rectsVertexData = static_cast(m_RenderInfo.m_ApiManager->MapCpuView(m_RenderInfo.m_RectsVertexBuffer, 0, rectsVertexCount * sizeof(CFloat4))); + CFloat4 *rectsColor0Data = static_cast(m_RenderInfo.m_ApiManager->MapCpuView(m_RenderInfo.m_RectsColorBuffer0, 0, rectsVertexCount * sizeof(CFloat4))); + CFloat4 *rectsColor1Data = static_cast(m_RenderInfo.m_ApiManager->MapCpuView(m_RenderInfo.m_RectsColorBuffer1, 0, rectsVertexCount * sizeof(CFloat4))); + + if (rectsVertexData == null || rectsColor0Data == null || rectsColor1Data == null) + return false; + + Mem::Copy(rectsVertexData, m_DrawOutputs.m_RectBatchSolid.m_RectDescs.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAlphaBlend * sizeof(CFloat4)); + rectsVertexData += m_RenderInfo.m_ElemCountRectsAlphaBlend; + Mem::Copy(rectsVertexData, m_DrawOutputs.m_RectBatchSolidDashed.m_RectDescs.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAlphaBlendDashed * sizeof(CFloat4)); + rectsVertexData += m_RenderInfo.m_ElemCountRectsAlphaBlendDashed; + Mem::Copy(rectsVertexData, m_DrawOutputs.m_RectBatch.m_RectDescs.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAdditive * sizeof(CFloat4)); + + Mem::Copy(rectsColor0Data, m_DrawOutputs.m_RectBatchSolid.m_RectColor0.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAlphaBlend * sizeof(CFloat4)); + rectsColor0Data += m_RenderInfo.m_ElemCountRectsAlphaBlend; + Mem::Copy(rectsColor0Data, m_DrawOutputs.m_RectBatchSolidDashed.m_DashColor0.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAlphaBlendDashed * sizeof(CFloat4)); + rectsColor0Data += m_RenderInfo.m_ElemCountRectsAlphaBlendDashed; + Mem::Copy(rectsColor0Data, m_DrawOutputs.m_RectBatch.m_RectColor0.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAdditive * sizeof(CFloat4)); + + Mem::Copy(rectsColor1Data, m_DrawOutputs.m_RectBatchSolid.m_RectColor1.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAlphaBlend * sizeof(CFloat4)); + rectsColor1Data += m_RenderInfo.m_ElemCountRectsAlphaBlend; + Mem::Copy(rectsColor1Data, m_DrawOutputs.m_RectBatchSolidDashed.m_DashColor1.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAlphaBlendDashed * sizeof(CFloat4)); + rectsColor1Data += m_RenderInfo.m_ElemCountRectsAlphaBlendDashed; + Mem::Copy(rectsColor1Data, m_DrawOutputs.m_RectBatch.m_RectColor1.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAdditive * sizeof(CFloat4)); + + m_RenderInfo.m_ApiManager->UnmapCpuView(m_RenderInfo.m_RectsVertexBuffer); + m_RenderInfo.m_ApiManager->UnmapCpuView(m_RenderInfo.m_RectsColorBuffer0); + m_RenderInfo.m_ApiManager->UnmapCpuView(m_RenderInfo.m_RectsColorBuffer1); + + if (dashedVertexCount != 0) + { + CFloat4 *dashedRectsBorderColor = static_cast(m_RenderInfo.m_ApiManager->MapCpuView(m_RenderInfo.m_DashedRectsBorderColor, 0, dashedVertexCount * sizeof(CFloat4))); + + if (dashedRectsBorderColor == null) + return false; + + Mem::Copy(dashedRectsBorderColor, m_DrawOutputs.m_RectBatchSolidDashed.m_BorderColor.RawDataPointer(), m_RenderInfo.m_ElemCountRectsAlphaBlendDashed * sizeof(CFloat4)); + + m_RenderInfo.m_ApiManager->UnmapCpuView(m_RenderInfo.m_DashedRectsBorderColor); + } + } + return true; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::SRenderInfo::Clear() +{ + m_ApiManager = null; + m_RectAlphaBlendDashed = null; + m_RectAlphaBlend = null; + m_RectAdditive = null; + m_LineAlphaBlend = null; + m_LineAdditive = null; + m_LinesVertexBuffer = null; + m_LinesColorBuffer = null; + m_RectsIndexBuffer = null; + m_RectsVertexBuffer = null; + m_RectsColorBuffer0 = null; + m_RectsColorBuffer1 = null; + m_DashedRectsBorderColor = null; + + m_LinesVertexCapacity = 0; + m_RectsVertexCapacity = 0; + m_DashedRectsVertexCapacity = 0; + + m_ElemCountRectsAlphaBlendDashed = 0; + m_ElemCountRectsAlphaBlend = 0; + m_ElemCountRectsAdditive = 0; + m_ElemCountLinesAlphaBlend = 0; + m_ElemCountLinesAdditive = 0; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::Setup(const ParticleToolbox::SProfilerDrawerDescriptorNew &descriptor) +{ + const CRect oldDrawRect = m_RenderData.m_DrawDescriptor.m_DrawRect; + const CInt2 oldCursorPos = m_RenderData.m_DrawDescriptor.m_CursorPos; + const CInt2 oldCursorExtent = m_RenderData.m_DrawDescriptor.m_CursorExtent; + const float oldPixelRatio = m_RenderData.m_DrawDescriptor.m_PixelRatio; + const double oldScale = m_RenderData.m_DrawDescriptor.m_ProfilerScale; + const double oldOffset = m_RenderData.m_DrawDescriptor.m_ProfilerOffset; + const float oldVOffset = m_RenderData.m_DrawDescriptor.m_ProfilerVerticalOffset; + const u32 oldHFrameId = m_RenderData.m_DrawDescriptor.m_ProfilerHistoryFrameToDisplay; + const u32 oldHFrameCount = m_RenderData.m_DrawDescriptor.m_ProfilerHistoryFrameToDisplayCount; + + m_RenderData.m_DrawDescriptor = descriptor; + + m_RenderData.m_DrawDescriptor.m_DrawRect = oldDrawRect; + m_RenderData.m_DrawDescriptor.m_CursorPos = oldCursorPos; + m_RenderData.m_DrawDescriptor.m_CursorExtent = oldCursorExtent; + m_RenderData.m_DrawDescriptor.m_PixelRatio = oldPixelRatio; + m_RenderData.m_DrawDescriptor.m_ProfilerScale = oldScale; + m_RenderData.m_DrawDescriptor.m_ProfilerOffset = oldOffset; + m_RenderData.m_DrawDescriptor.m_ProfilerVerticalOffset = oldVOffset; + m_RenderData.m_DrawDescriptor.m_ProfilerHistoryFrameToDisplay = oldHFrameId; + m_RenderData.m_DrawDescriptor.m_ProfilerHistoryFrameToDisplayCount = oldHFrameCount; + + if (!m_RenderData.m_DrawDescriptor.m_FontDraw) + m_RenderData.m_DrawDescriptor.m_FontDraw = FastDelegate &, const CFloat4 &)>(this, &CProfilerRenderer::_FontDraw); + if (!m_RenderData.m_DrawDescriptor.m_FontLength) + m_RenderData.m_DrawDescriptor.m_FontLength = FastDelegate &)>(this, &CProfilerRenderer::_FontLength); + if (!m_RenderData.m_DrawDescriptor.m_FontInfo) + m_RenderData.m_DrawDescriptor.m_FontInfo = FastDelegate(this, &CProfilerRenderer::_FontInfo); + if (!m_RenderData.m_DrawDescriptor.m_ToolTip_AddString) + m_RenderData.m_DrawDescriptor.m_ToolTip_AddString = FastDelegate(this, &CProfilerRenderer::_ToolTip_AddString); + if (!m_RenderData.m_DrawDescriptor.m_ToolTip_Rect) + m_RenderData.m_DrawDescriptor.m_ToolTip_Rect = FastDelegate(this, &CProfilerRenderer::_ToolTip_Rect); + if (!m_RenderData.m_DrawDescriptor.m_ToolTip_Draw) + m_RenderData.m_DrawDescriptor.m_ToolTip_Draw = FastDelegate(this, &CProfilerRenderer::_ToolTip_Draw); +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::_SetupDefaultDescriptor(ParticleToolbox::SProfilerDrawerDescriptorNew &descriptor) +{ + descriptor.m_PauseProfilerCapture = false; + descriptor.m_ShowTooltipOnlyWhenCapturePaused = true; + descriptor.m_MemoryView = false; + descriptor.m_MemoryViewIntensity = 1.0f; + descriptor.m_MemoryViewMaxMem = 1.2f; // Max mem intensity happens @ 1.2 Mb + descriptor.m_VisibleFraction = 1.5f; + descriptor.m_HightlightFilter = null; + descriptor.m_Profiler_TopDown = false; + descriptor.m_Profiler_HMarginsInPixels = CInt2(4, 4); + descriptor.m_Profiler_StartX = 0.0f; + descriptor.m_Profiler_StartY = 12.0f; + descriptor.m_Profiler_LineHeight = 8.0f; + descriptor.m_Profiler_LineSpacing = 0.0f; + descriptor.m_Profiler_SatteliteThreadLineHeight = 12.0f; + descriptor.m_Profiler_SatteliteThreadLineSpacing = 0.0f; + descriptor.m_Profiler_LineThreadSpacing = 3.0f; + descriptor.m_Profiler_LineBottomColorCoeff = 1.0f;//0.8f; + descriptor.m_Profiler_HitNodeBrightness = 2.0f; + descriptor.m_Profiler_SimilarHitNodesBrightness = 1.5f; + descriptor.m_Profiler_OddLinesBrightness = 0.8f; + descriptor.m_Profiler_HScale = 25000.0f; + descriptor.m_Profiler_CondenseAllSatteliteThreads = false; + descriptor.m_Profiler_HideUnusedCallLevels = true; + descriptor.m_Profiler_HLine_Thread = CFloat4(0.7f, 1.0f, 0.7f, 1.0f); + descriptor.m_Profiler_VLine_Time = CFloat4(0.05f, 0.05f, 0.05f, 1.0f); + descriptor.m_Profiler_VLine_Frame = CFloat4(1, 0, 0, 1.0f); + descriptor.m_Profiler_VLine_FrameFramerate = 60.0f; // 60 fps (~16 ms) + descriptor.m_Profiler_NoMemColor = CFloat4(0.05f, 0.05f, 0.05f, 0.5f); + descriptor.m_Profiler_RejectedBarsColor = CFloat4(0.1f, 0.1f, 0.1f, 1.0f); + descriptor.m_Profiler_FilteredBarsColor = CFloat4(1.0f, 0.1f, 0.1f, 1.0f); + descriptor.m_Profiler_IdleNode_Color0 = CFloat4(0.8f, 0, 0, 0.3f); + descriptor.m_Profiler_IdleNode_Color1 = CFloat4(0.01f, 0.01f, 0.01f, 0.8f); + descriptor.m_Profiler_ScaleFont = ParticleToolbox::Font_Medium; + descriptor.m_Profiler_ThreadInfoFont = ParticleToolbox::Font_Small; +// descriptor.m_Profiler_ShowNodeNames = true; + descriptor.m_Profiler_ShowNodeNames = false; + descriptor.m_Profiler_NodeNameFont = ParticleToolbox::Font_Medium; + descriptor.m_FrameCacheSize = 5; + descriptor.m_FrameCachePersistence = 6.0f; + descriptor.m_HistorySizeInFrames = 64; + descriptor.m_HistoryGraph_Start = CFloat2(180, 5); +// descriptor.m_HistoryGraph_Start = CFloat2(0, 0); + descriptor.m_HistoryGraph_Size = CFloat2(600, 50); + descriptor.m_HistoryGraph_ShowCPU = true; + descriptor.m_HistoryGraph_ShowMem = true; +// descriptor.m_CPUGraph_Show = true; + descriptor.m_CPUGraph_Show = false; + descriptor.m_CPUGraph_Height = 16.0f; + descriptor.m_TaskGroups_Show = false; + descriptor.m_TaskGroups_IntensityBright = 0.4f; + descriptor.m_TaskGroups_IntensityDim = 0.2f; + descriptor.m_PixelRatio = 1.0; + descriptor.m_ProfilerScale = 40000.0; + descriptor.m_ProfilerOffset = 0.0; + descriptor.m_ProfilerVerticalOffset = 0.0f; + descriptor.m_ProfilerHistoryFrameToDisplay = 0; + + descriptor.m_FontDraw = FastDelegate &, const CFloat4 &)>(this, &CProfilerRenderer::_FontDraw); + descriptor.m_FontLength = FastDelegate &)>(this, &CProfilerRenderer::_FontLength); + descriptor.m_FontInfo = FastDelegate(this, &CProfilerRenderer::_FontInfo); + descriptor.m_ToolTip_AddString = FastDelegate(this, &CProfilerRenderer::_ToolTip_AddString); + descriptor.m_ToolTip_Rect = FastDelegate(this, &CProfilerRenderer::_ToolTip_Rect); + descriptor.m_ToolTip_Draw = FastDelegate(this, &CProfilerRenderer::_ToolTip_Draw); +} + +//---------------------------------------------------------------------------- + +bool CProfilerRenderer::EnableWithProfileReport(const Profiler::PProfilerReport &profileReport) +{ + PK_SCOPEDPROFILE(); + m_Enabled = (profileReport != null); + m_Pause = true; + m_ProfilerReplay = true; + + { + PK_SCOPEDLOCK(m_NewProfilerFramesLock); + m_NewProfilerFrames.Clear(); + + if (profileReport != null) + { + if (!PK_VERIFY(m_NewProfilerFrames.PushBack(profileReport).Valid())) + return false; + } + } + + { + PK_SCOPEDLOCK(m_OldProfilerFramesLock); + m_OldProfilerFrames.Clear(); + } + + SetCurrentHistoryFrame(0); + return true; +} + +//---------------------------------------------------------------------------- + +bool CProfilerRenderer::Enable(bool enable) +{ + if (m_ProfilerReplay) + { + m_Enabled = enable; + return m_Enabled; + } + + m_Enabled = enable; + m_Pause = false; + + Profiler::CProfiler *profiler = Profiler::MainEngineProfiler(); + if (profiler != null) + { + profiler->Reset(); + } + + SetCurrentHistoryFrame(0); + + return m_Enabled; +} + +//---------------------------------------------------------------------------- + +Profiler::PProfilerReport CProfilerRenderer::CurrentRecord() const +{ + PK_SCOPEDLOCK(m_NewProfilerFramesLock); + if (!m_NewProfilerFrames.Empty()) + { +// const u32 frameId = PKMin(m_NewProfilerFrames.Count() - 1, m_RenderData.m_DrawDescriptor.m_ProfilerHistoryFrameToDisplay); + return m_NewProfilerFrames.Last(); + } + return null; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::SetCurrentHistoryFrame(s32 frameIndex) +{ + frameIndex = frameIndex < 0 ? frameIndex + m_RenderData.m_DrawDescriptor.m_HistorySizeInFrames : frameIndex; + m_RenderData.m_DrawDescriptor.m_ProfilerHistoryFrameToDisplay = frameIndex % m_RenderData.m_DrawDescriptor.m_HistorySizeInFrames; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::ViewVerticalScroll(float scrollXInPixel) +{ + m_RenderData.m_DrawDescriptor.m_ProfilerVerticalOffset += scrollXInPixel; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::ViewHScroll(float scrollXInPixel) +{ + m_RenderData.m_DrawDescriptor.m_ProfilerOffset += scrollXInPixel / m_RenderData.m_DrawDescriptor.m_ProfilerScale; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::ViewHZoom(float zoomCenterXInPixel, float zoomFactor) +{ + const double oldscale = m_RenderData.m_DrawDescriptor.m_ProfilerScale; + const double newscale = oldscale * powf(2.0f, zoomFactor); // *1.41, /1.41<->*0.707 + const double xoff = (zoomCenterXInPixel / oldscale) - (zoomCenterXInPixel / newscale); + m_RenderData.m_DrawDescriptor.m_ProfilerScale = newscale; + m_RenderData.m_DrawDescriptor.m_ProfilerOffset += xoff; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::ProfilerNextFrameTick() +{ + if (m_ProfilerReplay) + return; + + Profiler::CProfiler *profiler = Profiler::MainEngineProfiler(); + if (profiler == null) + return; + + if (!m_Enabled) + { + profiler->GrabCallstacks(false); + profiler->Activate(false); + profiler->Reset(); + return; + } + + { + PK_NAMEDSCOPEDPROFILE("ProfilerNextFrameTick"); + +#if (KR_PROFILER_ENABLED != 0) + // Optim: lock here once, instead of locking multiple times in function calls below + profiler->m_RecordsLock.Lock(); +#endif + + if (!m_Pause) + { + Profiler::PProfilerReport profilerReport = null; + + { + PK_NAMEDSCOPEDPROFILE("get profiler report to fill"); + { + PK_SCOPEDLOCK(m_OldProfilerFramesLock); + if (!m_OldProfilerFrames.Empty()) + profilerReport = m_OldProfilerFrames.PopBack(); + } + if (profilerReport == null) + { + profilerReport = PK_NEW(Profiler::CProfilerReport); + if (profilerReport == null) + { + CLog::Log(PK_INFO, "Could not allocate profiler report"); + return; + } + } + } + { + PK_NAMEDSCOPEDPROFILE("profiler build report"); + profiler->BuildReport(profilerReport.Get()); + } + { + PK_NAMEDSCOPEDPROFILE("push back profiler report"); + PK_SCOPEDLOCK(m_NewProfilerFramesLock); + m_NewProfilerFrames.PushBack(profilerReport); + } + } + profiler->GrabCallstacks(m_CallstacksEnabled); + profiler->Activate(true); + } + + profiler->Reset(); + +#if (KR_PROFILER_ENABLED != 0) + // Optim: lock here once, instead of locking multiple times in function calls below + profiler->m_RecordsLock.Unlock(); +#endif +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::UpdateDrawGeometry(const CRect &drawRect, const CInt2 &cursorPos, float pixelRatio) +{ + m_RenderData.m_DrawDescriptor.m_PixelRatio = pixelRatio; + m_RenderData.m_DrawDescriptor.m_PauseProfilerCapture = m_Pause; + m_RenderData.m_DrawDescriptor.m_DrawRect = drawRect; + m_RenderData.m_DrawDescriptor.m_CursorPos = cursorPos; + m_RenderData.m_DrawDescriptor.m_CursorExtent = CInt2(10, 20); +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::GenerateProfilerRenderData(double dt, const CRect &drawRect, const CInt2 &cursorPos, float pixelRatio) +{ + UpdateDrawGeometry(drawRect, cursorPos, pixelRatio); + + double scaleSpeed = 2.0; + //const double dt = m_Dt; + + m_DtHistory[m_DtHistoryPos] = dt; + m_DtHistoryPos = (m_DtHistoryPos + 1) % kDtHistorySize; + + float avgDt = 0.0f; + for (u32 i = 0; i < kDtHistorySize; i++) + avgDt += m_DtHistory[i]; + avgDt /= kDtHistorySize; + + bool needsAutozoom = false; + if (needsAutozoom) + { + const CFloat2 viewportSize(m_RenderData.m_DrawDescriptor.m_DrawRect.Extent().x(), m_RenderData.m_DrawDescriptor.m_DrawRect.Extent().y()); // viewport dimensions in pixels + const float filteredDt = avgDt; + const float hScale = viewportSize.x(); + const double idealScale = hScale / PKMax(filteredDt * m_RenderData.m_DrawDescriptor.m_VisibleFraction, 1.0e-3f); // 5.0e+4f; // don't autozoom below the millisecond + const double idealOffset = 2.0 / idealScale; + + m_RenderData.m_DrawDescriptor.m_ProfilerOffset = scalar_to_target_l(m_RenderData.m_DrawDescriptor.m_ProfilerOffset, double(idealOffset), double(dt), 2.0); + + m_TargetProfilerScale = idealScale; + m_ProfilerVerticalOffset = 0.0f; + m_LastProfileFocusPos = m_RenderData.m_DrawDescriptor.m_ProfilerOffset; + + scaleSpeed = 0.8; + + const double newProfilerScale = scalar_to_target_l(m_RenderData.m_DrawDescriptor.m_ProfilerScale, m_TargetProfilerScale, dt, scaleSpeed); + const float newProfilerVOffset = scalar_to_target_l(m_RenderData.m_DrawDescriptor.m_ProfilerVerticalOffset, m_ProfilerVerticalOffset, dt, float(scaleSpeed)); + // set the profiler start draw position so that time 'm_LastProfileFocusPos' is invariant during the zoom: + const double focusPosInPixels = (m_LastProfileFocusPos - m_RenderData.m_DrawDescriptor.m_ProfilerOffset) * m_RenderData.m_DrawDescriptor.m_ProfilerScale; + const double newFocusPosInPixels = PKMax(-0.001, m_LastProfileFocusPos - (focusPosInPixels / newProfilerScale)); // allow -1 ms offset + + m_RenderData.m_DrawDescriptor.m_ProfilerScale = newProfilerScale; + m_RenderData.m_DrawDescriptor.m_ProfilerOffset = newFocusPosInPixels; + m_RenderData.m_DrawDescriptor.m_ProfilerVerticalOffset = newProfilerVOffset; + } +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::LockAndCopyProfilerData(SProfilerRenderData &renderData) +{ + PK_SCOPEDPROFILE(); + if (!m_Enabled) + return; + renderData.m_DrawDescriptor = m_RenderData.m_DrawDescriptor; + renderData.m_IsValid = true; +} + +//---------------------------------------------------------------------------- + +bool CProfilerRenderer::CreateRenderInfoIFN(const RHI::PApiManager &apiManager, CShaderLoader &loader, TMemoryView famebufferLayout, RHI::PRenderPass renderPass, u32 subPass) +{ + if (m_RenderInfo.m_ApiManager != null) + return true; + return CreateRenderInfo(apiManager, loader, famebufferLayout, renderPass, subPass); +} + +//---------------------------------------------------------------------------- + +bool CProfilerRenderer::CreateRenderInfo(const RHI::PApiManager &apiManager, CShaderLoader &loader, TMemoryView famebufferLayout, RHI::PRenderPass renderPass, u32 subPass) +{ + RHI::SRenderState linesRenderStateData; + RHI::SRenderState rectsRenderStateData; + RHI::SRenderState rectsDashedRenderStateData; + + // Common between rects and lines: + m_RenderInfo.m_ApiManager = apiManager; + m_RenderInfo.m_RectAlphaBlendDashed = apiManager->CreateRenderState(RHI::SRHIResourceInfos("ProfilerRenderer Rects AlphaBlendDashed Render State")); + m_RenderInfo.m_RectAlphaBlend = apiManager->CreateRenderState(RHI::SRHIResourceInfos("ProfilerRenderer Rects AlphaBlend Render State")); + m_RenderInfo.m_RectAdditive = apiManager->CreateRenderState(RHI::SRHIResourceInfos("ProfilerRenderer Rects Additive Render State")); + m_RenderInfo.m_LineAlphaBlend = apiManager->CreateRenderState(RHI::SRHIResourceInfos("ProfilerRenderer Lines AlphaBlend Render State")); + m_RenderInfo.m_LineAdditive = apiManager->CreateRenderState(RHI::SRHIResourceInfos("ProfilerRenderer Lines Additive Render State")); + if (m_RenderInfo.m_RectAlphaBlendDashed == null || + m_RenderInfo.m_RectAlphaBlend == null || m_RenderInfo.m_RectAdditive == null || + m_RenderInfo.m_LineAlphaBlend == null || m_RenderInfo.m_LineAdditive == null) + return false; + + linesRenderStateData.m_PipelineState.m_DynamicScissor = true; + linesRenderStateData.m_PipelineState.m_DynamicViewport = true; + linesRenderStateData.m_PipelineState.m_Blending = true; + + // Copy render state data: + rectsRenderStateData = linesRenderStateData; + rectsDashedRenderStateData = linesRenderStateData; + + // ------------------------ + // Add line input buffers: + if (!linesRenderStateData.m_InputVertexBuffers.Resize(2)) + return false; + linesRenderStateData.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat2); + linesRenderStateData.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat4); + + // Create shader bindings: + FillProfilerShaderBindings(linesRenderStateData.m_ShaderBindings); + linesRenderStateData.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + linesRenderStateData.m_ShaderBindings.m_InputAttributes[1].m_BufferIdx = 1; + + // ------------------------ + // Add dashed rect input buffers: + if (!rectsDashedRenderStateData.m_InputVertexBuffers.Resize(4)) + return false; + rectsDashedRenderStateData.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat4); + rectsDashedRenderStateData.m_InputVertexBuffers[0].m_InputRate = RHI::PerInstanceInput; + rectsDashedRenderStateData.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat4); + rectsDashedRenderStateData.m_InputVertexBuffers[1].m_InputRate = RHI::PerInstanceInput; + rectsDashedRenderStateData.m_InputVertexBuffers[2].m_Stride = sizeof(CFloat4); + rectsDashedRenderStateData.m_InputVertexBuffers[2].m_InputRate = RHI::PerInstanceInput; + rectsDashedRenderStateData.m_InputVertexBuffers[3].m_Stride = sizeof(CFloat4); + rectsDashedRenderStateData.m_InputVertexBuffers[3].m_InputRate = RHI::PerInstanceInput; + + // Create shader bindings: + FillProfilerDrawNodeShaderBindings(rectsDashedRenderStateData.m_ShaderBindings, true); + rectsDashedRenderStateData.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + rectsDashedRenderStateData.m_ShaderBindings.m_InputAttributes[1].m_BufferIdx = 1; + rectsDashedRenderStateData.m_ShaderBindings.m_InputAttributes[2].m_BufferIdx = 2; + rectsDashedRenderStateData.m_ShaderBindings.m_InputAttributes[3].m_BufferIdx = 3; + + // ------------------------ + // Add rect input buffers: + if (!rectsRenderStateData.m_InputVertexBuffers.Resize(3)) + return false; + rectsRenderStateData.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat4); + rectsRenderStateData.m_InputVertexBuffers[0].m_InputRate = RHI::PerInstanceInput; + rectsRenderStateData.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat4); + rectsRenderStateData.m_InputVertexBuffers[1].m_InputRate = RHI::PerInstanceInput; + rectsRenderStateData.m_InputVertexBuffers[2].m_Stride = sizeof(CFloat4); + rectsRenderStateData.m_InputVertexBuffers[2].m_InputRate = RHI::PerInstanceInput; + + // Create shader bindings: + FillProfilerDrawNodeShaderBindings(rectsRenderStateData.m_ShaderBindings, false); + rectsRenderStateData.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + rectsRenderStateData.m_ShaderBindings.m_InputAttributes[1].m_BufferIdx = 1; + rectsRenderStateData.m_ShaderBindings.m_InputAttributes[2].m_BufferIdx = 2; + + // load basic profiler shader: + CShaderLoader::SShadersPaths linesShadersPaths; + linesShadersPaths.m_Fragment = FRAGMENT_SHADER_PATH; + linesShadersPaths.m_Vertex = VERTEX_SHADER_PATH; + if (!loader.LoadShader(linesRenderStateData, linesShadersPaths, apiManager)) + return false; + + // load profiler shader for rectangles: + CShaderLoader::SShadersPaths rectsShadersPaths; + rectsShadersPaths.m_Fragment = FRAGMENT_RECT_SHADER_PATH; + rectsShadersPaths.m_Vertex = VERTEX_RECT_SHADER_PATH; + if (!loader.LoadShader(rectsRenderStateData, rectsShadersPaths, apiManager)) + return false; + + // load profiler shader for dashed rectangles: + CShaderLoader::SShadersPaths rectsDashedShadersPaths; + rectsDashedShadersPaths.m_Fragment = FRAGMENT_RECT_SHADER_PATH; + rectsDashedShadersPaths.m_Vertex = VERTEX_RECT_SHADER_PATH; + if (!loader.LoadShader(rectsDashedRenderStateData, rectsDashedShadersPaths, apiManager)) + return false; + + m_RenderInfo.m_RectAlphaBlendDashed->m_RenderState = rectsDashedRenderStateData; + m_RenderInfo.m_RectAlphaBlend->m_RenderState = rectsRenderStateData; + m_RenderInfo.m_RectAdditive->m_RenderState = rectsRenderStateData; + + m_RenderInfo.m_LineAlphaBlend->m_RenderState = linesRenderStateData; + m_RenderInfo.m_LineAdditive->m_RenderState = linesRenderStateData; + + m_RenderInfo.m_RectAlphaBlendDashed->m_RenderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + m_RenderInfo.m_RectAlphaBlendDashed->m_RenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendSrcAlpha; + m_RenderInfo.m_RectAlphaBlendDashed->m_RenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOneMinusSrcAlpha; + + m_RenderInfo.m_RectAlphaBlend->m_RenderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + m_RenderInfo.m_RectAlphaBlend->m_RenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendSrcAlpha; + m_RenderInfo.m_RectAlphaBlend->m_RenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOneMinusSrcAlpha; + + m_RenderInfo.m_RectAdditive->m_RenderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + m_RenderInfo.m_RectAdditive->m_RenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + m_RenderInfo.m_RectAdditive->m_RenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + + m_RenderInfo.m_LineAlphaBlend->m_RenderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + m_RenderInfo.m_LineAlphaBlend->m_RenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendSrcAlpha; + m_RenderInfo.m_LineAlphaBlend->m_RenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOneMinusSrcAlpha; + m_RenderInfo.m_LineAlphaBlend->m_RenderState.m_PipelineState.m_DrawMode = RHI::DrawModeLine; + + m_RenderInfo.m_LineAdditive->m_RenderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + m_RenderInfo.m_LineAdditive->m_RenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + m_RenderInfo.m_LineAdditive->m_RenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + m_RenderInfo.m_LineAdditive->m_RenderState.m_PipelineState.m_DrawMode = RHI::DrawModeLine; + + if (!apiManager->BakeRenderState(m_RenderInfo.m_RectAlphaBlendDashed, famebufferLayout, renderPass, subPass) || + !apiManager->BakeRenderState(m_RenderInfo.m_RectAlphaBlend, famebufferLayout, renderPass, subPass) || + !apiManager->BakeRenderState(m_RenderInfo.m_RectAdditive, famebufferLayout, renderPass, subPass) || + !apiManager->BakeRenderState(m_RenderInfo.m_LineAlphaBlend, famebufferLayout, renderPass, subPass) || + !apiManager->BakeRenderState(m_RenderInfo.m_LineAdditive, famebufferLayout, renderPass, subPass)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +const CProfilerRenderer::SProfilerRenderData &CProfilerRenderer::UnsafeGetProfilerData() const +{ + return m_RenderData; +} + +//---------------------------------------------------------------------------- + +bool CProfilerRenderer::Render(const RHI::PCommandBuffer &commandBuff, const CUint2 &contextSize, const SProfilerRenderData &profilerData) +{ + if (!m_Enabled) + return true; + + if (!_TransferBatchToGpu(profilerData)) + { + return false; + } + + const float le = 0.0f; + const float ri = contextSize.x(); + const float bo = 0.0f; + const float to = contextSize.y(); + const float nearVal = -10.0f; + const float farVal = 10.0f; + + CFloat4x4 proj( 2.0f / (ri - le), 0.0f, 0.0f, -(ri + le) / (ri - le), + 0.0f, 2.0f / (to - bo), 0.0f, -(to + bo) / (to - bo), + 0.0f, 0.0f, -2.0f / (farVal - nearVal), -(farVal + nearVal) / (farVal - nearVal), + 0.0f, 0.0f, 0.0f, 1.0f); + proj.Transpose(); + + commandBuff->SetViewport(CInt2(0), contextSize, CFloat2(0, 1)); + commandBuff->SetScissor(CInt2(0), contextSize); + + // Draw the lines first: + u32 curLineVtxOffset = 0; + if (m_RenderInfo.m_ElemCountLinesAlphaBlend != 0) + { + commandBuff->BindRenderState(m_RenderInfo.m_LineAlphaBlend); + commandBuff->PushConstant(&proj, 0); + + RHI::PGpuBuffer buffers[2] = { m_RenderInfo.m_LinesVertexBuffer, m_RenderInfo.m_LinesColorBuffer }; + commandBuff->BindVertexBuffers(TMemoryView(buffers)); + + commandBuff->Draw(curLineVtxOffset, m_RenderInfo.m_ElemCountLinesAlphaBlend); + curLineVtxOffset += m_RenderInfo.m_ElemCountLinesAlphaBlend; + } + if (m_RenderInfo.m_ElemCountLinesAdditive != 0) + { + commandBuff->BindRenderState(m_RenderInfo.m_LineAdditive); + commandBuff->PushConstant(&proj, 0); + + RHI::PGpuBuffer buffers[2] = { m_RenderInfo.m_LinesVertexBuffer, m_RenderInfo.m_LinesColorBuffer }; + commandBuff->BindVertexBuffers(TMemoryView(buffers)); + + commandBuff->Draw(curLineVtxOffset, m_RenderInfo.m_ElemCountLinesAdditive); + curLineVtxOffset += m_RenderInfo.m_ElemCountLinesAdditive; + } + // Then draw the rects: + u32 curRectVtxOffset = 0; + if (m_RenderInfo.m_ElemCountRectsAlphaBlend != 0) + { + commandBuff->BindRenderState(m_RenderInfo.m_RectAlphaBlend); + commandBuff->PushConstant(&proj, 0); + + RHI::PGpuBuffer buffers[3] = { m_RenderInfo.m_RectsVertexBuffer, m_RenderInfo.m_RectsColorBuffer0, m_RenderInfo.m_RectsColorBuffer1 }; + u32 offsets[3] = + { + static_cast(curRectVtxOffset * sizeof(CFloat4)), + static_cast(curRectVtxOffset * sizeof(CFloat4)), + static_cast(curRectVtxOffset * sizeof(CFloat4)) + }; + commandBuff->BindIndexBuffer(m_RenderInfo.m_RectsIndexBuffer, 0, RHI::IndexBuffer16Bit); + commandBuff->BindVertexBuffers(buffers, offsets); + + commandBuff->DrawIndexedInstanced(0, 0, 6, m_RenderInfo.m_ElemCountRectsAlphaBlend); + curRectVtxOffset += m_RenderInfo.m_ElemCountRectsAlphaBlend; + } + if (m_RenderInfo.m_ElemCountRectsAlphaBlendDashed != 0) + { + commandBuff->BindRenderState(m_RenderInfo.m_RectAlphaBlendDashed); + commandBuff->PushConstant(&proj, 0); + + RHI::PGpuBuffer buffers[4] = { m_RenderInfo.m_RectsVertexBuffer, m_RenderInfo.m_RectsColorBuffer0, m_RenderInfo.m_RectsColorBuffer1, m_RenderInfo.m_DashedRectsBorderColor }; + u32 offsets[4] = + { + static_cast(curRectVtxOffset * sizeof(CFloat4)), + static_cast(curRectVtxOffset * sizeof(CFloat4)), + static_cast(curRectVtxOffset * sizeof(CFloat4)), + 0 + }; + commandBuff->BindIndexBuffer(m_RenderInfo.m_RectsIndexBuffer, 0, RHI::IndexBuffer16Bit); + commandBuff->BindVertexBuffers(buffers, offsets); + + commandBuff->DrawIndexedInstanced(0, 0, 6, m_RenderInfo.m_ElemCountRectsAlphaBlendDashed); + curRectVtxOffset += m_RenderInfo.m_ElemCountRectsAlphaBlendDashed; + } + if (m_RenderInfo.m_ElemCountRectsAdditive != 0) + { + commandBuff->BindRenderState(m_RenderInfo.m_RectAdditive); + commandBuff->PushConstant(&proj, 0); + + RHI::PGpuBuffer buffers[3] = { m_RenderInfo.m_RectsVertexBuffer, m_RenderInfo.m_RectsColorBuffer0, m_RenderInfo.m_RectsColorBuffer1 }; + u32 offsets[3] = + { + static_cast(curRectVtxOffset * sizeof(CFloat4)), + static_cast(curRectVtxOffset * sizeof(CFloat4)), + static_cast(curRectVtxOffset * sizeof(CFloat4)) + }; + commandBuff->BindIndexBuffer(m_RenderInfo.m_RectsIndexBuffer, 0, RHI::IndexBuffer16Bit); + commandBuff->BindVertexBuffers(buffers, offsets); + + commandBuff->DrawIndexedInstanced(0, 0, 6, m_RenderInfo.m_ElemCountRectsAdditive); + curRectVtxOffset += m_RenderInfo.m_ElemCountRectsAdditive; + } + return true; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::SetPaused(bool pause) +{ + if (!m_ProfilerReplay) + m_Pause = pause; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::Zoom(float zoom, const CUint2 &windowSize) +{ + const float zoomStep = 0.5f; + ViewHZoom((windowSize.x() * 0.5f), zoom * zoomStep); +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::Offset(float offset) +{ + const float offsetStep = 100.0f; + ViewHScroll(offset * offsetStep); +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::VerticalOffset(float vOffset) +{ + const float offsetStep = 1.0f; + ViewVerticalScroll(vOffset * offsetStep); +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::_FontDraw(ParticleToolbox::EFontType font, const CFloat3 &position, const TMemoryView &textView, const CFloat4 &color) const +{ + (void)font; (void)position; (void)textView; (void)color; +} + +//---------------------------------------------------------------------------- + +float CProfilerRenderer::_FontLength(ParticleToolbox::EFontType font, const TMemoryView &textView) const +{ + (void)font; (void)textView; + return 1.0f; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::_FontInfo(ParticleToolbox::EFontType font, ParticleToolbox::SFontDesc &outDesc) const +{ + (void)font; + outDesc.m_Ascender = 1.0f; + outDesc.m_Descender = 1.0f; + outDesc.m_Height = 1.0f; +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::_ToolTip_AddString(const CString &string) +{ + if (string.Empty()) + m_ToolTipMsgs.PushBack(""); + else + m_ToolTipMsgs.PushBack(string); +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::_ToolTip_Rect(const CInt2 &where, CIRect &outRect) const +{ + (void)where; + outRect = CIRect(CInt2(0, 0), CInt2(20, 40)); +} + +//---------------------------------------------------------------------------- + +void CProfilerRenderer::_ToolTip_Draw(const CInt2 &where, float z) +{ + (void)where; (void)z; +} + +//---------------------------------------------------------------------------- + +CRect CProfilerRenderer::ComputeBounds() const +{ + return m_ProfilerDrawer.ComputeBounds(m_RenderData.m_DrawDescriptor, CurrentRecord().Get()); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // PKSAMPLE_HAS_PROFILER_RENDERER diff --git a/Samples/PK-SampleLib/ProfilerRenderer.h b/Samples/PK-SampleLib/ProfilerRenderer.h new file mode 100644 index 00000000..e56ca3c9 --- /dev/null +++ b/Samples/PK-SampleLib/ProfilerRenderer.h @@ -0,0 +1,219 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" + +#if defined(PK_DESKTOP) || defined(PK_ORBIS) || defined(PK_DURANGO) || defined(PK_UNKNOWN2) + +#include + +#if defined(PK_HAS_PARTICLESTOOLBOX_PROFILER) + +# define PKSAMPLE_HAS_PROFILER_RENDERER 1 + +#include + +#include +#include +#include + +#include "ShaderLoader.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CProfilerRenderer : public CNonCopyable +{ +public: + enum EProfilerRenderState + { + RenderState_Rect_Solid, + RenderState_Rect_Blended, + RenderState_Line_Solid, + RenderState_Line_Blended, + _RenderState_Count + }; + + struct SProfilerRenderData + { + bool m_IsValid; + ParticleToolbox::SProfilerDrawerDescriptorNew m_DrawDescriptor; + + SProfilerRenderData() : m_IsValid(false) { } + }; + + bool EnableWithProfileReport(const Profiler::PProfilerReport &profileReport); + bool Enable(bool enable); + bool Enabled() const { return m_Enabled; } + + void EnableCallstacks(bool enable) { m_CallstacksEnabled = enable; } + bool CallstacksEnabled() const { return m_CallstacksEnabled; } + + void EnableMemoryView(bool enable) { m_RenderData.m_DrawDescriptor.m_MemoryView = enable; } + bool MemoryViewEnabled() const { return m_RenderData.m_DrawDescriptor.m_MemoryView; } + + void CollapseThreads(bool collapsed) { m_RenderData.m_DrawDescriptor.m_Profiler_CondenseAllSatteliteThreads = collapsed; } + bool ThreadsCollapsed() const { return m_RenderData.m_DrawDescriptor.m_Profiler_CondenseAllSatteliteThreads; } + + void SetHiglightFilter(const CString &matchPattern) { m_RenderData.m_DrawDescriptor.m_HightlightFilter = matchPattern; } + void SetMemoryMaxLimit(float maxMemInMb) { m_RenderData.m_DrawDescriptor.m_MemoryViewMaxMem = maxMemInMb; } + + void SetCurrentHistoryFrame(s32 frameIndex); + s32 CurrentHistoryFrame() const { return m_RenderData.m_DrawDescriptor.m_ProfilerHistoryFrameToDisplay; } + + void ViewVerticalScroll(float scrollXInPixel); + void ViewHScroll(float scrollXInPixel); + void ViewHZoom(float zoomCenterXInPixel, float zoomFactor); + + double GetHorizontalScale() const { return m_RenderData.m_DrawDescriptor.m_ProfilerScale; } + void SetHorizontalScale(double scale) { m_RenderData.m_DrawDescriptor.m_ProfilerScale = scale; } + + float GetVerticalOffset() const { return m_RenderData.m_DrawDescriptor.m_ProfilerVerticalOffset; } + void SetVerticalOffset(float offset) { m_RenderData.m_DrawDescriptor.m_ProfilerVerticalOffset = offset; } + double GetHorizontalOffset() const { return m_RenderData.m_DrawDescriptor.m_ProfilerOffset; } + void SetHorizontalOffset(double offset) { m_RenderData.m_DrawDescriptor.m_ProfilerOffset = offset; } + +private: + struct SRenderInfo + { + // To reset + RHI::PApiManager m_ApiManager; + + RHI::PRenderState m_RectAlphaBlendDashed; + RHI::PRenderState m_RectAlphaBlend; + RHI::PRenderState m_RectAdditive; + RHI::PRenderState m_LineAlphaBlend; + RHI::PRenderState m_LineAdditive; + + RHI::PGpuBuffer m_LinesVertexBuffer; + RHI::PGpuBuffer m_LinesColorBuffer; + u32 m_LinesVertexCapacity; + + RHI::PGpuBuffer m_RectsIndexBuffer; + RHI::PGpuBuffer m_RectsVertexBuffer; + RHI::PGpuBuffer m_RectsColorBuffer0; + RHI::PGpuBuffer m_RectsColorBuffer1; + RHI::PGpuBuffer m_DashedRectsBorderColor; + u32 m_RectsVertexCapacity; + u32 m_DashedRectsVertexCapacity; + + u32 m_ElemCountRectsAlphaBlendDashed; + u32 m_ElemCountRectsAlphaBlend; + u32 m_ElemCountRectsAdditive; + u32 m_ElemCountLinesAlphaBlend; + u32 m_ElemCountLinesAdditive; + + SRenderInfo() { Clear(); } + ~SRenderInfo() { } + + void Clear(); + }; + + // Game thread only: + bool m_Enabled; + bool m_Pause; + bool m_CallstacksEnabled; + + double m_TargetProfilerScale; + double m_LastProfileFocusPos; + float m_ProfilerVerticalOffset; + static const u32 kDtHistorySize = 32; + float m_DtHistory[kDtHistorySize]; + u32 m_DtHistoryPos; + + // Actual rendering data created by the update and used by the rendering + SProfilerRenderData m_RenderData; + + // Used for the profiler replay; + bool m_ProfilerReplay; + + // Render thread only: + ParticleToolbox::CProfilerDrawerNew m_ProfilerDrawer; + ParticleToolbox::SProfilerDrawOutput m_DrawOutputs; + TArray m_ToolTipMsgs; + SRenderInfo m_RenderInfo; + + // Accessed by both render and main thread: + typedef TSemiDynamicArray DynamicProfileReportList; + typedef TStaticCountedArray StaticProfileReportList; + + Threads::CCriticalSection m_NewProfilerFramesLock; + DynamicProfileReportList m_NewProfilerFrames; // Dynamic array: we do not want to miss an update + Threads::CCriticalSection m_OldProfilerFramesLock; + StaticProfileReportList m_OldProfilerFrames; // Static array: pool of profile reports + + void _SetupDefaultDescriptor(ParticleToolbox::SProfilerDrawerDescriptorNew &descriptor); + + bool _TransferBatchToGpu(const SProfilerRenderData &renderData); + +public: + CProfilerRenderer(); + ~CProfilerRenderer(); + + // Setup + void Setup(const ParticleToolbox::SProfilerDrawerDescriptorNew &descriptor); + + // Defines the end of last frame the beginning of a new frame to profile + void ProfilerNextFrameTick(); + + // Billboards profiling vertices of last frame + void GenerateProfilerRenderData(double dt, const CRect &drawRect, const CInt2 &cursorPos, float pixelRatio = 1.0f); + void LockAndCopyProfilerData(SProfilerRenderData &renderData); + + void UpdateDrawGeometry(const CRect &drawRect, const CInt2 &cursorPos, float pixelRatio = 1.0f); // Called by 'GenerateProfilerRenderData()' + + // Render thread: + bool CreateRenderInfo( const RHI::PApiManager &apiManager, + CShaderLoader &loader, + TMemoryView famebufferLayout, + RHI::PRenderPass renderPass, u32 subPass); + bool CreateRenderInfoIFN(const RHI::PApiManager &apiManager, + CShaderLoader &loader, + TMemoryView famebufferLayout, + RHI::PRenderPass renderPass, u32 subPass); + + const SProfilerRenderData &UnsafeGetProfilerData() const; + + bool Render( const RHI::PCommandBuffer &commandBuff, + const CUint2 &contextSize, + const SProfilerRenderData &profilerData); + void ReleaseRenderInfo(); + + CRect ComputeBounds() const; + + bool IsPaused() const { return m_Pause; } + void SetPaused(bool pause); + void Zoom(float zoom, const CUint2 &windowSize); + void Offset(float offset); + void VerticalOffset(float vOffset); + + TMemoryView GetTooltips() const { return m_ToolTipMsgs.View(); } + + Profiler::PProfilerReport CurrentRecord() const; + + void _FontDraw(ParticleToolbox::EFontType font, const CFloat3 &position, const TMemoryView &textView, const CFloat4 &color) const; + float _FontLength(ParticleToolbox::EFontType font, const TMemoryView &textView) const; + void _FontInfo(ParticleToolbox::EFontType font, ParticleToolbox::SFontDesc &outDesc) const; + void _ToolTip_AddString(const CString &string); + void _ToolTip_Rect(const CInt2 &where, CIRect &outRect) const; + void _ToolTip_Draw(const CInt2 &where, float z); +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // defined(PK_HAS_PARTICLESTOOLBOX_PROFILER) +#endif // defined(PK_DESKTOP) || defined(PK_ORBIS) || defined(PK_DURANGO) + +#ifndef PKSAMPLE_HAS_PROFILER_RENDERER +# define PKSAMPLE_HAS_PROFILER_RENDERER 0 +#endif diff --git a/Samples/PK-SampleLib/RHIRenderParticleSceneHelpers.cpp b/Samples/PK-SampleLib/RHIRenderParticleSceneHelpers.cpp new file mode 100644 index 00000000..5ab11648 --- /dev/null +++ b/Samples/PK-SampleLib/RHIRenderParticleSceneHelpers.cpp @@ -0,0 +1,3198 @@ +#include "precompiled.h" + +#include "RHIRenderParticleSceneHelpers.h" + +#include "PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.h" +#include "PK-SampleLib/RenderIntegrationRHI/RendererCache.h" +#include "PK-SampleLib/ShaderDefinitions/BasicSceneShaderDefinitions.h" +#include "PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.h" +#include "PK-SampleLib/RenderIntegrationRHI/MaterialToRHI.h" +#include "PK-SampleLib/BRDFLUT.h" + +#include +#include +#include + +#define GBUFFER_VERTEX_SHADER_PATH "./Shaders/SolidMesh.vert" +#define GBUFFER_FRAGMENT_SHADER_PATH "./Shaders/GBuffer.frag" +#define DITHERING_PATTERNS_TEXTURE_PATH "./Textures/DitheringPatterns.png" + + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +void SBackdropsData::CLight::SetAmbient(const CFloat3 &color, float intensity) +{ + m_Type = SLightRenderPass::Ambient; + m_Color = ConvertSRGBToLinear(color); + m_Intensity = intensity; +} + +void SBackdropsData::CLight::SetDirectional(const CFloat3 &direction, const CFloat3 &color, float intensity) +{ + m_Type = SLightRenderPass::Directional; + m_Direction = direction; + m_Color = ConvertSRGBToLinear(color); + m_Intensity = intensity; +} + +void SBackdropsData::CLight::SetSpot(const CFloat3 &position, const CFloat3 &direction, float angle, float coneFalloff, const CFloat3 &color, float intensity) +{ + m_Type = SLightRenderPass::Spot; + m_Position = position; + m_Direction = direction; + m_Angle = angle; + m_ConeFalloff = coneFalloff; + m_Color = ConvertSRGBToLinear(color); + m_Intensity = intensity; +} + +void SBackdropsData::CLight::SetPoint(const CFloat3 &position, const CFloat3 &color, float intensity) +{ + m_Type = SLightRenderPass::Point; + m_Position = position; + m_Color = ConvertSRGBToLinear(color); + m_Intensity = intensity; +} + +//---------------------------------------------------------------------------- + +CRHIParticleSceneRenderHelper::CRHIParticleSceneRenderHelper() +: m_ShaderLoader(null) +, m_ResourceManager(null) +, m_CurrentPackResourceManager(null) +, m_EnableParticleRender(true) +, m_EnableBackdropRender(true) +, m_EnableOverdrawRender(false) +, m_EnableBrushBackground(true) +, m_EnablePostFX(true) +, m_EnableDistortion(true) +, m_EnableBloom(true) +, m_BlurTap(GaussianBlurCombination_5_Tap) +, m_EnableToneMapping(true) +, m_EnableColorRemap(false) +, m_EnableFXAA(true) +, m_CoordinateFrame(CCoordinateFrame::GlobalFrame()) +, m_GridIdxCount(0) +, m_GridSubdivIdxCount(0) +{ +} + +//---------------------------------------------------------------------------- + +CRHIParticleSceneRenderHelper::~CRHIParticleSceneRenderHelper() +{ +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::Init(const RHI::PApiManager &apiManager, + CShaderLoader *shaderLoader, + CResourceManager *resourceManager, + u32 initRP) +{ + m_ApiManager = apiManager; + m_ShaderLoader = shaderLoader; + m_ResourceManager = resourceManager; + m_InitializedRP = initRP; + + if (STextureKey::s_DefaultResourceID.Valid() || + SGeometryKey::s_DefaultResourceID.Valid()) + { + const CString rootPath = resourceManager->FileController()->VirtualToPhysical(CString::EmptyString, IFileSystem::Access_Read); + const SCreateArg args(apiManager, null, resourceManager, rootPath); + + if (STextureKey::s_DefaultResourceID.Valid()) + CTextureManager::RenderThread_ResolveResource(STextureKey::s_DefaultResourceID, args); + if (SGeometryKey::s_DefaultResourceID.Valid()) + CGeometryManager::RenderThread_ResolveResource(SGeometryKey::s_DefaultResourceID, args); + } + + // Create default sampler: + CreateSimpleSamplerConstSetLayouts(m_DefaultSamplerConstLayout, false); + if (m_DefaultSampler == null) + m_DefaultSampler = m_ApiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Default Linear Sampler"), + RHI::SampleLinear, RHI::SampleLinear, + RHI::SampleClampToEdge, RHI::SampleClampToEdge, RHI::SampleClampToEdge, 1); + if (m_DefaultSampler == null) + return false; + if (m_DefaultSamplerNearest == null) + m_DefaultSamplerNearest = m_ApiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Default nearest Sampler"), + RHI::SampleNearest, RHI::SampleNearest, + RHI::SampleClampToEdge, RHI::SampleClampToEdge, RHI::SampleClampToEdge, 1); + if (m_DefaultSamplerNearest == null) + return false; + + u32 white = 0xFFFFFFFF; + u32 black = 0x00000000; + u32 normal = 0xFFFF7F7F; + CImageMap dummyWhite(CUint3::ONE, &white, sizeof(u32)); + CImageMap dummyBlack(CUint3::ONE, &black, sizeof(u32)); + CImageMap dummyNormal(CUint3::ONE, &normal, sizeof(u32)); + + // Init the dummy textures: + m_DummyBlack = m_ApiManager->CreateTexture(RHI::SRHIResourceInfos("Dummy Black Texture"), TMemoryView(dummyBlack), RHI::FormatUnorm8RGBA); + m_DummyWhite = m_ApiManager->CreateTexture(RHI::SRHIResourceInfos("Dummy White Texture"), TMemoryView(dummyWhite), RHI::FormatUnorm8RGBA); + m_DummyNormal = m_ApiManager->CreateTexture(RHI::SRHIResourceInfos("Dummy Normal Texture"), TMemoryView(dummyNormal), RHI::FormatUnorm8RGBA); + + if (!PK_VERIFY(m_DummyBlack != null && m_DummyWhite != null && m_DummyNormal != null)) + return false; + + m_DummyWhiteConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Default White Texture Constant Set"), m_DefaultSamplerConstLayout); + m_DummyBlackConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Default Black Texture Constant Set"), m_DefaultSamplerConstLayout); + + if (!PK_VERIFY(m_DummyWhiteConstantSet != null && m_DummyBlackConstantSet != null)) + return false; + + m_DummyWhiteConstantSet->SetConstants(m_DefaultSampler, m_DummyWhite, 0); + m_DummyWhiteConstantSet->UpdateConstantValues(); + m_DummyBlackConstantSet->SetConstants(m_DefaultSampler, m_DummyBlack, 0); + m_DummyBlackConstantSet->UpdateConstantValues(); + + // Init the environmentMap + if (!PK_VERIFY(m_EnvironmentMap.Init(m_ApiManager, shaderLoader))) + return false; + + // Init the atlas dummy constant-set + PK_ASSERT(SConstantAtlasKey::GetAtlasConstantSetLayout().m_Constants.Count() == 1); + m_DummyAtlas.m_AtlasConstSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Dummy Atlas Constant Set"), SConstantAtlasKey::GetAtlasConstantSetLayout()); + m_DummyAtlas.m_AtlasBuffer = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Dummy Atlas Buffer"), RHI::RawBuffer, sizeof(u32) + sizeof(CFloat4), RHI::UsageStaticDraw); + + if (!PK_VERIFY(m_DummyAtlas.m_AtlasConstSet != null) || !PK_VERIFY(m_DummyAtlas.m_AtlasBuffer != null)) + return false; + + { + void *ptr = m_ApiManager->MapCpuView(m_DummyAtlas.m_AtlasBuffer); + if (PK_VERIFY(ptr != null)) + { + const u32 count = 1; + const CFloat4 rect = CFloat4(1.0f, 1.0f, 0.0f, 0.0f); + Mem::Copy(ptr, &count, sizeof(u32)); + ptr = Mem::AdvanceRawPointer(ptr, sizeof(u32)); + Mem::Copy(ptr, &rect, sizeof(CFloat4)); + } + m_ApiManager->UnmapCpuView(m_DummyAtlas.m_AtlasBuffer); + } + + m_DummyAtlas.m_AtlasConstSet->SetConstants(m_DummyAtlas.m_AtlasBuffer, 0); + m_DummyAtlas.m_AtlasConstSet->UpdateConstantValues(); + + // Init noise texture + RHI::PConstantSampler sampler = m_ApiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Dithering Sampler"), + RHI::SampleNearest, + RHI::SampleNearestMipmapNearest, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + 1); + + STextureKey textureKey; + textureKey.m_Path = DITHERING_PATTERNS_TEXTURE_PATH; + CTextureManager::CResourceId textureId = CTextureManager::UpdateThread_GetResource(textureKey, SPrepareArg(null, null, null)); + if (!textureId.Valid()) + return false; + RHI::PTexture ditheringtexture = CTextureManager::RenderThread_ResolveResource(textureId, SCreateArg(m_ApiManager, null, m_ResourceManager, CString())); + if (ditheringtexture == null) + return false; + + m_NoiseTexture.m_NoiseTexture = ditheringtexture; + m_NoiseTexture.m_NoiseTextureConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Dithering Constant Set"), SConstantNoiseTextureKey::GetNoiseTextureConstantSetLayout()); + m_NoiseTexture.m_NoiseTextureConstantSet->SetConstants(sampler, m_NoiseTexture.m_NoiseTexture, 0); + m_NoiseTexture.m_NoiseTextureConstantSet->UpdateConstantValues(); + + // Init the BRDF LUT + // Load BRDF LUT + const CImageMap mipmaps[] = { CImageMap(CUint3(64, 64, 1), (void*)BRDFLUTArray, BRDFLUTArraySize) }; + PK_STATIC_ASSERT(BRDFLUTArraySize == 64 * 64 * 2 * 2); + + RHI::PTexture BRDFLUT = apiManager->CreateTexture(RHI::SRHIResourceInfos("BRDFLUT Texture"), mipmaps, RHI::FormatFloat16RG); + if (!PK_VERIFY(BRDFLUT != null)) + return false; + + // Create scene info: + { + if (!CreateSceneInfoConstantLayout(m_SceneInfoConstantSetLayout)) + return false; + + const RHI::SConstantBufferDesc &sceneInfoBufferDesc = m_SceneInfoConstantSetLayout.m_Constants.First().m_ConstantBuffer; + + m_SceneInfoConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("SceneInfos Constant Set"), m_SceneInfoConstantSetLayout); + if (!PK_VERIFY(m_SceneInfoConstantSet != null)) + return false; + + const u32 constantBufferSize = sceneInfoBufferDesc.m_ConstantBufferSize; // We could also create the new one based on the default one created + PK_ASSERT(constantBufferSize == sizeof(PKSample::SSceneInfoData)); + m_SceneInfoConstantBuffer = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("SceneInfos Constant Buffer"), RHI::ConstantBuffer, constantBufferSize); + if (!PK_VERIFY(m_SceneInfoConstantBuffer != null)) + return false; + if (!PK_VERIFY(m_SceneInfoConstantSet->SetConstants(m_SceneInfoConstantBuffer, 0))) + return false; + if (!PK_VERIFY(m_SceneInfoConstantSet->UpdateConstantValues())) + return false; + } + + // Just for the full screen quad... + if (!m_GBuffer.Init(m_ApiManager, m_DefaultSampler, m_DefaultSamplerConstLayout, m_SceneInfoConstantSetLayout)) + return false; + + if (!PK_VERIFY(m_Lights.m_DirectionalShadows.Init( m_ApiManager, + m_SceneInfoConstantSetLayout, + m_DefaultSampler, + m_DefaultSamplerConstLayout, + m_GBuffer.m_QuadBuffers.m_VertexBuffers[0]))) + return false; + + if (!PK_VERIFY(m_Lights.Init(m_ApiManager, m_GBuffer.m_LightInfoConstLayout, m_GBuffer.m_ShadowsInfoConstLayout, m_DefaultSampler, m_DummyWhite))) + return false; + + if ((m_InitializedRP & InitRP_Distortion) != 0) + { + // Init render-pass: Distortion + if (!m_Distortion.Init(m_ApiManager, m_GBuffer.m_QuadBuffers.m_VertexBuffers[0], m_DefaultSampler, m_DefaultSamplerConstLayout)) + return false; + } + if ((m_InitializedRP & InitRP_Bloom) != 0) + { + // Init render-pass: Bloom + if (!m_Bloom.Init(apiManager, m_GBuffer.m_QuadBuffers.m_VertexBuffers[0])) + return false; + } + if ((m_InitializedRP & InitRP_ToneMapping) != 0) + { + // Init render-pass: Tonemap + if (!m_ToneMapping.Init(apiManager, m_GBuffer.m_QuadBuffers.m_VertexBuffers[0], m_DefaultSampler, m_DefaultSamplerConstLayout)) + return false; + } + if ((m_InitializedRP & InitRP_ColorRemap) != 0) + { + // Init render-pass: Color Remap + if (!m_ColorRemap.Init(apiManager, m_GBuffer.m_QuadBuffers.m_VertexBuffers[0], m_DefaultSampler, m_DefaultSamplerConstLayout)) + return false; + } + if ((m_InitializedRP & InitRP_FXAA) != 0) + { + // Init render-pass: FXAA + if (!m_FXAA.Init(apiManager, m_GBuffer.m_QuadBuffers.m_VertexBuffers[0], m_DefaultSampler, m_DefaultSamplerConstLayout)) + return false; + } + // Create Gizmo rendering + { + if (!PK_VERIFY(m_GizmoDrawer.CreateVertexBuffer(m_ApiManager))) + return false; + } + + // Create the default textures used for lighting: + // BRDF LookUp: + // Create the sampler + RHI::PConstantSampler BRDFLUTSampler = m_ApiManager->CreateConstantSampler( RHI::SRHIResourceInfos("BRDFLUT Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + 1); + // Create the constant set + m_BRDFLUTConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("BRDFLUT Constant Set"), m_GBuffer.m_BRDFLUTLayout); + if (!PK_VERIFY(m_BRDFLUTConstantSet != null)) + return false; + m_BRDFLUTConstantSet->SetConstants(BRDFLUTSampler, BRDFLUT, 0); + m_BRDFLUTConstantSet->UpdateConstantValues(); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::Resize(TMemoryView finalRts) +{ + if (!PK_VERIFY(!finalRts.Empty())) + return false; + + m_ViewportSize = finalRts.First()->GetSize(); + + // We assert that all the render targets are the same size, just in case... + PK_ONLY_IF_ASSERTS( + for (u32 i = 1; i < finalRts.Count(); ++i) + { + PK_ASSERT(finalRts[i]->GetSize() == m_ViewportSize); + } + ); + + TArray beforeBloomLoadOp; + TArray finalLoadOp; + + // Clear the old FBOs: + m_BeforeBloomClearValues.Clear(); + m_BeforeBloomFrameBuffer = null; + m_BeforeBloomRenderPass = null; + m_FinalClearValues.Clear(); + m_FinalFrameBuffers.Clear(); + m_FinalRenderPass = null; + + m_BeforeDebugOutputRtIdx.Clear(); + m_BasicRenderingRTIdx.Clear(); + m_BasicRenderingSubPassIdx.Clear(); + + // ------------------------------------------ + // We create the new frame buffer / FBO info here: + // ------------------------------------------ + RHI::PRenderPass currentRenderPass; + TMemoryView currentFrameBuffers; + TArray *currentClearValues; + TArray *currentLoadOp; + + const bool hasBeforeBloomRenderPass = (m_InitializedRP & InitRP_Bloom) != 0; + const bool hasAfterBloomRenderPass = !hasBeforeBloomRenderPass || !_IsLastRenderPass(InitRP_Bloom); + + if (hasAfterBloomRenderPass) + { + // Create the final frame buffers: + if (!m_FinalFrameBuffers.Resize(finalRts.Count())) + return false; + for (u32 i = 0; i < finalRts.Count(); ++i) + { + // Create frame buffer and add it + m_FinalFrameBuffers[i] = m_ApiManager->CreateFrameBuffer(RHI::SRHIResourceInfos("Final Frame Buffer")); + if (!PK_VERIFY(m_FinalFrameBuffers[i] != null)) + return false; + if (!m_FinalFrameBuffers[i]->AddRenderTarget(finalRts[i])) + return false; + } + if (!PK_VERIFY(finalLoadOp.PushBack(RHI::LoadDontCare).Valid())) + return false; + // And the final render pass: + m_FinalRenderPass = m_ApiManager->CreateRenderPass(RHI::SRHIResourceInfos("Final Render Pass")); + if (m_FinalRenderPass == null) + return false; + } + else + { + // Here we just keep the ref on the final render targets to give them as the bloom output + if (!m_FinalRenderTargets.Resize(finalRts.Count())) + return false; + for (u32 i = 0; i < finalRts.Count(); ++i) + { + // Copy render target + m_FinalRenderTargets[i] = finalRts[i]; + } + } + + // We check if we need 2 frame buffers: + if (hasBeforeBloomRenderPass) + { + // IFN we create the before bloom frame buffer: + m_BeforeBloomFrameBuffer = m_ApiManager->CreateFrameBuffer(RHI::SRHIResourceInfos("Before Bloom Frame Buffer")); + if (!PK_VERIFY(m_BeforeBloomFrameBuffer != null)) + return false; + m_BeforeBloomRenderPass = m_ApiManager->CreateRenderPass(RHI::SRHIResourceInfos("Before Bloom Render Pass")); + if (!PK_VERIFY(m_BeforeBloomRenderPass != null)) + return false; + currentFrameBuffers = TMemoryView(m_BeforeBloomFrameBuffer); + currentRenderPass = m_BeforeBloomRenderPass; + currentClearValues = &m_BeforeBloomClearValues; + currentLoadOp = &beforeBloomLoadOp; + } + else + { + currentFrameBuffers = m_FinalFrameBuffers; + currentRenderPass = m_FinalRenderPass; + currentClearValues = &m_FinalClearValues; + currentLoadOp = &finalLoadOp; + } + + // In and out render targets + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + // ------------------------------------------ + // + // GBUFFER + // + // ------------------------------------------ + + // ------------------------------------------ + // Create and add the render targets: + // ------------------------------------------ + for (u32 i = 0; i < m_GBufferRTs.Count(); ++i) + { + m_GBufferRTsIdx[i] = currentFrameBuffers.First()->GetRenderTargets().Count(); + if (!PK_VERIFY(m_GBufferRTs[i].CreateRenderTarget( RHI::SRHIResourceInfos("GBuffer Render Target"), + m_ApiManager, + m_DefaultSampler, + SPassDescription::s_GBufferDefaultFormats[i], + m_ViewportSize, + m_DefaultSamplerConstLayout))) + { + return false; + } + for (u32 j = 0; j < currentFrameBuffers.Count(); ++j) + { + if (!PK_VERIFY(currentFrameBuffers[j]->AddRenderTarget(m_GBufferRTs[i].m_RenderTarget))) + return false; + } + } + + // ------------------------------------------ + // Add the clear operations: + // ------------------------------------------ + // GBuffer 0: Diffuse HDR + if (!PK_VERIFY(currentClearValues->PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + if (!PK_VERIFY(currentLoadOp->PushBack(RHI::LoadClear).Valid())) + return false; + // GBuffer 1: Depth + if (!PK_VERIFY(currentClearValues->PushBack(RHI::SFrameBufferClearValue(1.f, 1.f, 1.f, 1.f)).Valid())) + return false; + if (!PK_VERIFY(currentLoadOp->PushBack(RHI::LoadClear).Valid())) + return false; + // GBuffer 2: Emissive HDR + if (!PK_VERIFY(currentClearValues->PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + if (!PK_VERIFY(currentLoadOp->PushBack(RHI::LoadClear).Valid())) + return false; + + CGBuffer::SInOutRenderTargets inOut; + + _FillGBufferInOut(inOut); + if (!PK_VERIFY(m_GBuffer.UpdateFrameBuffer( currentFrameBuffers, + *currentLoadOp, + *currentClearValues, + false, + &inOut))) + return false; + + // ------------------------------------------ + // Create render passes: + // ------------------------------------------ + if (!PK_VERIFY(m_GBuffer.AddSubPasses(currentRenderPass, &inOut))) + return false; + } + else if (m_InitializedRP != 0) + { + // ------------------------------------------ + // + // BASIC TRANSPARENT RENDERING + // + // ------------------------------------------ + // No GBuffer, just a simple HDR buffer for the transparent particles: + RHI::EPixelFormat basicRTPxlFormat = RHI::EPixelFormat::FormatFloat16RGBA; + + // ------------------------------------------ + // Create and add the render targets: + // ------------------------------------------ + if (!PK_VERIFY(m_BasicRenderingRT.CreateRenderTarget( RHI::SRHIResourceInfos("BasicRendering Render Target"), + m_ApiManager, + m_DefaultSampler, + basicRTPxlFormat, + m_ViewportSize, + m_DefaultSamplerConstLayout))) + return false; + for (u32 i = 0; i < currentFrameBuffers.Count(); ++i) + { + m_BasicRenderingRTIdx = currentFrameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(currentFrameBuffers[i]->AddRenderTarget(m_BasicRenderingRT.m_RenderTarget))) + return false; + } + + // ------------------------------------------ + // Add the clear operations: + // ------------------------------------------ + if (!PK_VERIFY(currentClearValues->PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + if (!PK_VERIFY(currentLoadOp->PushBack(RHI::LoadClear).Valid())) + return false; + + // ------------------------------------------ + // Create render passes: + // ------------------------------------------ + RHI::SSubPassDefinition subPass; + + m_BasicRenderingSubPassIdx = currentRenderPass->GetSubPassDefinitions().Count(); + if (!PK_VERIFY(subPass.m_OutputRenderTargets.PushBack(m_BasicRenderingRTIdx).Valid())) + return false; + if (!PK_VERIFY(currentRenderPass->AddRenderSubPass(subPass))) + return false; + } + else // If m_InitializedRP == 0, then we can just render the particles directly in the swap chain render target + { + // ------------------------------------------ + // Create render passes: + // ------------------------------------------ + RHI::SSubPassDefinition subPass; + + m_BasicRenderingSubPassIdx = currentRenderPass->GetSubPassDefinitions().Count(); + if (!PK_VERIFY(subPass.m_OutputRenderTargets.PushBack(0).Valid())) // We just render in the swap-chain render target + return false; + if (!PK_VERIFY(currentRenderPass->AddRenderSubPass(subPass))) + return false; + } + + // ------------------------------------------ + // + // DISTORTION + // + // ------------------------------------------ + if ((m_InitializedRP & InitRP_Distortion) != 0) + { + CPostFxDistortion::SInOutRenderTargets inOut; + + _FillDistortionInOut(inOut); + if (!PK_VERIFY(m_Distortion.UpdateFrameBuffer( currentFrameBuffers, + *currentLoadOp, + *currentClearValues, + &inOut))) + return false; + + if (!PK_VERIFY(m_Distortion.AddSubPasses(currentRenderPass, &inOut))) + return false; + } + + // Change current frame buffer and current render pass if bloom is enabled: + if (hasAfterBloomRenderPass) + { + currentFrameBuffers = m_FinalFrameBuffers; + currentRenderPass = m_FinalRenderPass; + currentClearValues = &m_FinalClearValues; + currentLoadOp = &finalLoadOp; + } + + // ------------------------------------------ + // + // TONE-MAPPING + // + // ------------------------------------------ + if ((m_InitializedRP & InitRP_ToneMapping) != 0) + { + CPostFxToneMapping::SInOutRenderTargets inOut; + + _FillTonemappingInOut(inOut); + if (!PK_VERIFY(m_ToneMapping.UpdateFrameBuffer(currentFrameBuffers, *currentLoadOp, *currentClearValues, &inOut))) + return false; + + if (!PK_VERIFY(m_ToneMapping.AddSubPasses(currentRenderPass, &inOut))) + return false; + } + + // ------------------------------------------ + // + // COLOR-REMAP + // + // ------------------------------------------ + + if ((m_InitializedRP & InitRP_ColorRemap) != 0) + { + CPostFxColorRemap::SInOutRenderTargets inOut; + + _FillColorRemapInOut(inOut); + m_ColorRemap.SetRemapTexture(m_DummyWhite, true); // Placeholder + if (!PK_VERIFY(m_ColorRemap.UpdateFrameBuffer(currentFrameBuffers, *currentLoadOp, &inOut))) + return false; + + if (!PK_VERIFY(m_ColorRemap.AddSubPasses(currentRenderPass, &inOut))) + return false; + } + + + // ------------------------------------------ + // + // FXAA + // + // ------------------------------------------ + if ((m_InitializedRP & InitRP_FXAA) != 0) + { + CPostFxFXAA::SInOutRenderTargets inOut; + + _FillFXAAInOut(inOut); + if (!PK_VERIFY(m_FXAA.UpdateFrameBuffer(currentFrameBuffers, + *currentLoadOp, + *currentClearValues, + &inOut))) + return false; + + if (!PK_VERIFY(m_FXAA.AddSubPasses(currentRenderPass, &inOut))) + return false; + } + + // ------------------------------------------ + // + // DEBUG + // + // ------------------------------------------ + if ((m_InitializedRP & InitRP_Debug) != 0) + { + m_ParticleDebugSubpassIdx = currentRenderPass->GetSubPassDefinitions().Count(); + + // First sub pass: depth test + output in prev render pass output render target + // --------------------------- + _FillDebugInOut(m_BeforeDebugOutputRt, m_BeforeDebugOutputRtIdx); + + RHI::SSubPassDefinition debugSubPass; + + if (!m_BeforeDebugOutputRtIdx.Valid()) + { + // Then we need to add this render target to the current frame buffer to write in it + m_BeforeDebugOutputRtIdx = currentFrameBuffers.First()->GetRenderTargets().Count(); + for (u32 i = 0; i < currentFrameBuffers.Count(); ++i) + { + if (!PK_VERIFY(currentFrameBuffers[i]->AddRenderTarget(m_BeforeDebugOutputRt.m_RenderTarget))) + return false; + } + if (!PK_VERIFY(currentLoadOp->PushBack(RHI::LoadKeepValue).Valid())) + return false; + + } + if (!PK_VERIFY(debugSubPass.m_OutputRenderTargets.PushBack(m_BeforeDebugOutputRtIdx).Valid())) + return false; + + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + if (hasBeforeBloomRenderPass) + { + // Then we need to add the GBuffer depth render target to the current frame buffer to depth-test + debugSubPass.m_DepthStencilRenderTarget = currentFrameBuffers.First()->GetRenderTargets().Count(); + for (u32 i = 0; i < currentFrameBuffers.Count(); ++i) + { + if (!PK_VERIFY(currentFrameBuffers[i]->AddRenderTarget(m_GBuffer.m_Depth.m_RenderTarget))) + return false; + } + if (!PK_VERIFY(currentLoadOp->PushBack(RHI::LoadKeepValue).Valid())) + return false; + } + else + { + debugSubPass.m_DepthStencilRenderTarget = m_GBuffer.m_DepthBufferIndex; + } + } + + if (!PK_VERIFY(currentRenderPass->AddRenderSubPass(debugSubPass))) + return false; + + // Second sub pass: depth test + output in swapchain render target + samples the prev pass output render target + // --------------------------- + RHI::SSubPassDefinition finalSubPass; + + if (!PK_VERIFY(finalSubPass.m_OutputRenderTargets.PushBack(0).Valid())) + return false; + finalSubPass.m_DepthStencilRenderTarget = debugSubPass.m_DepthStencilRenderTarget; + if (!PK_VERIFY(finalSubPass.m_InputRenderTargets.PushBack(m_BeforeDebugOutputRtIdx).Valid())) + return false; + + if (!PK_VERIFY(currentRenderPass->AddRenderSubPass(finalSubPass))) + return false; + } + + // ------------------------------------------ + // + // BAKE THE FRAME BUFFERS AND THE RENDER PASSES + // + // ------------------------------------------ + if (hasBeforeBloomRenderPass) + { + // Bake the render pass: + if (!PK_VERIFY(m_BeforeBloomRenderPass->BakeRenderPass(m_BeforeBloomFrameBuffer->GetLayout(), beforeBloomLoadOp))) + return false; + // Bake the before bloom frame buffer: + if (!PK_VERIFY(m_BeforeBloomFrameBuffer->BakeFrameBuffer(m_BeforeBloomRenderPass))) + return false; + } + + // If the bloom is the last render pass, then we do not need the final frame buffers and final render pass + // as it directly writes in the swap chain render targets + if (hasAfterBloomRenderPass) + { + // Bake the render pass: + if (!PK_VERIFY(m_FinalRenderPass->BakeRenderPass(m_FinalFrameBuffers.First()->GetLayout(), finalLoadOp))) + return false; + + for (u32 i = 0; i < m_FinalFrameBuffers.Count(); ++i) + { + // Bake the before bloom frame buffer: + if (!PK_VERIFY(m_FinalFrameBuffers[i]->BakeFrameBuffer(m_FinalRenderPass))) + return false; + } + } + + // ------------------------------------------ + // + // CREATE THE RENDER STATES + // + // ------------------------------------------ + // Before bloom: + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + const RHI::PFrameBuffer &frameBuffer = hasBeforeBloomRenderPass ? m_BeforeBloomFrameBuffer : m_FinalFrameBuffers.First(); + const RHI::PRenderPass &renderPass = hasBeforeBloomRenderPass ? m_BeforeBloomRenderPass : m_FinalRenderPass; + if (!PK_VERIFY(m_GBuffer.CreateRenderStates(frameBuffer->GetLayout(), *m_ShaderLoader, renderPass))) + return false; + // The opaque backdrops are rendered in the GBuffer opaque render pass: + if (!PK_VERIFY(_CreateOpaqueBackdropRenderStates(frameBuffer->GetLayout(), renderPass, m_GBuffer.m_GBufferSubPassIdx))) + return false; + // The transparent backdrops are rendered in the GBuffer merging render pass: + if (!PK_VERIFY(_CreateTransparentBackdropRenderStates(frameBuffer->GetLayout(), renderPass, m_GBuffer.m_MergingSubPassIdx))) + return false; + } + else + { + const RHI::PFrameBuffer &frameBuffer = hasBeforeBloomRenderPass ? m_BeforeBloomFrameBuffer : m_FinalFrameBuffers.First(); + const RHI::PRenderPass &renderPass = hasBeforeBloomRenderPass ? m_BeforeBloomRenderPass : m_FinalRenderPass; + // The transparent backdrops are rendered in the basic render pass: + if (!PK_VERIFY(_CreateTransparentBackdropRenderStates(frameBuffer->GetLayout(), renderPass, m_BasicRenderingSubPassIdx))) + return false; + } + if ((m_InitializedRP & InitRP_Distortion) != 0) + { + const RHI::PFrameBuffer &frameBuffer = hasBeforeBloomRenderPass ? m_BeforeBloomFrameBuffer : m_FinalFrameBuffers.First(); + const RHI::PRenderPass &renderPass = hasBeforeBloomRenderPass ? m_BeforeBloomRenderPass : m_FinalRenderPass; + if (!PK_VERIFY(m_Distortion.CreateRenderStates(frameBuffer->GetLayout(), *m_ShaderLoader, renderPass))) + return false; + } + // After bloom: + if ((m_InitializedRP & InitRP_ToneMapping) != 0) + { + if (!PK_VERIFY(m_ToneMapping.CreateRenderStates(m_FinalFrameBuffers.First()->GetLayout(), *m_ShaderLoader, m_FinalRenderPass))) + return false; + } + if ((m_InitializedRP & InitRP_ColorRemap) != 0) + { + if (!PK_VERIFY(m_ColorRemap.CreateRenderStates(m_FinalFrameBuffers.First()->GetLayout(), *m_ShaderLoader, m_FinalRenderPass))) + return false; + } + if ((m_InitializedRP & InitRP_FXAA) != 0) + { + if (!PK_VERIFY(m_FXAA.CreateRenderStates(m_FinalFrameBuffers.First()->GetLayout(), *m_ShaderLoader, m_FinalRenderPass))) + return false; + } + if ((m_InitializedRP & InitRP_Debug) != 0) + { + // Final subpass is the subpass just after the particle debug subpass: + if (!PK_VERIFY(_CreateFinalRenderStates(m_FinalFrameBuffers.First()->GetLayout(), m_FinalRenderPass, m_ParticleDebugSubpassIdx, m_BeforeDebugOutputRt))) + return false; + } + + // Add the render passes to the graphic resource manager: + if (!_AddRenderPassesToGraphicResourceManagerIFN()) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::SetupPostFX_Distortion(const SParticleSceneOptions::SDistortion &config, bool /*firstInit*/) +{ + if ((m_InitializedRP & InitRP_Distortion) != 0) + { + m_EnableDistortion = config.m_Enable; + m_Distortion.SetChromaticAberrationIntensity(config.m_DistortionIntensity); + m_Distortion.SetAberrationMultipliers(config.m_ChromaticAberrationMultipliers); + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::SetupPostFX_Bloom(const SParticleSceneOptions::SBloom &config, bool firstInit, bool swapChainChanged) +{ + if ((m_InitializedRP & InitRP_Bloom) != 0) + { + EGaussianBlurCombination blurTap = static_cast(config.m_BlurTap); + + m_EnableBloom = config.m_Enable; + m_Bloom.SetSubtractValue(config.m_BrightPassValue); + m_Bloom.SetIntensity(config.m_Intensity); + m_Bloom.SetAttenuation(config.m_Attenuation); + + if (!swapChainChanged && !firstInit) + return true; // quick exit + + bool success = true; + + CPostFxBloom::SInOutRenderTargets inOut; + + _FillBloomInOut(inOut); + success &= m_Bloom.UpdateFrameBuffer(m_DefaultSampler, config.m_RenderPassCount, &inOut); + if (firstInit) + { + success &= m_Bloom.CreateRenderPass(); + success &= m_Bloom.CreateRenderStates(*m_ShaderLoader, blurTap); + } + else if (m_BlurTap != blurTap) + { + success &= m_Bloom.CreateRenderStates(*m_ShaderLoader, blurTap); + m_BlurTap = blurTap; + } + success &= m_Bloom.CreateFrameBuffers(); + if (!success) + { + CLog::Log(PK_ERROR, "Could not re-create the bloom"); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::SetupPostFX_ToneMapping( const SParticleSceneOptions::SToneMapping &config, + const SParticleSceneOptions::SVignetting &configVignetting, + bool dithering, + bool /*firstInit*/, + bool precomputeLuma /* = true*/) +{ + if ((m_InitializedRP & InitRP_ToneMapping) != 0) + { + m_EnableToneMapping = config.m_Enable; + m_ToneMapping.SetExposure(config.m_Exposure); + m_ToneMapping.SetSaturation(config.m_Saturation); + + m_ToneMapping.SetVignettingColor(configVignetting.m_Color); + m_ToneMapping.SetVignettingColorIntensity(configVignetting.m_ColorIntensity); + m_ToneMapping.SetVignettingDesaturationIntensity(configVignetting.m_DesaturationIntensity); + m_ToneMapping.SetVignettingRoundness(configVignetting.m_Roundness); + m_ToneMapping.SetVignettingSmoothness(configVignetting.m_Smoothness); + + m_ToneMapping.SetDithering(dithering); + + m_ToneMapping.SetPrecomputeLuma(precomputeLuma); + + // Gamma correction is needed only if the render targets are in linear-space. + bool isSRGB = true; + PK_ASSERT(!m_FinalFrameBuffers.Empty()); + PK_ASSERT(!m_FinalFrameBuffers[0]->GetRenderTargets().Empty()); + RHI::PTexture texture = m_FinalFrameBuffers[0]->GetRenderTargets()[0]->GetTexture(); + if (texture != null) + isSRGB = (u32(texture->GetFormat()) & RHI::FlagSrgb) != 0; + m_ToneMapping.SetGamma(isSRGB ? 1.f : 2.2f); + m_ToneMapping.SetScreenSize(m_FinalFrameBuffers[0]->GetRenderTargets()[0]->GetSize().x(), m_FinalFrameBuffers[0]->GetRenderTargets()[0]->GetSize().y()); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::SetupPostFX_ColorRemap( const SParticleSceneOptions::SColorRemap &config, + bool firstInit) +{ + (void)firstInit; + + RHI::PTexture colorRemapTexture = m_DummyWhite; + CUint3 dimensions = {256, 16, 1}; + if ((m_InitializedRP & InitRP_ColorRemap) != 0) + { + m_EnableColorRemap = config.m_Enable; + if (!config.m_RemapTexturePath.Empty()) + { + PK_ASSERT(m_CurrentPackResourceManager != null); + CString resourcePath = config.m_RemapTexturePath; + TResourcePtr inputImage = m_CurrentPackResourceManager->Load(resourcePath); + + + if (inputImage != null && !inputImage->Empty() && !inputImage->m_Frames.Empty() && !inputImage->m_Frames[0].m_Mipmaps.Empty()) + { + // CImage from ressource + CImageMap &resourceMipmap = inputImage->m_Frames[0].m_Mipmaps[0]; + CImageMap dstMipmap = resourceMipmap; + + const bool canSkip = (inputImage->m_Format == CImage::Format_BGRA8_sRGB && config.m_ForceSRGBToLinear) || + (inputImage->m_Format == CImage::Format_BGRA8 && !config.m_ForceSRGBToLinear); + if (!canSkip) + { + dstMipmap.m_Dimensions = resourceMipmap.m_Dimensions; + dstMipmap.m_RawBuffer = CRefCountedMemoryBuffer::Alloc(dstMipmap.PixelBufferSize(inputImage->m_Format)); + Mem::Copy(dstMipmap.m_RawBuffer.Get(), resourceMipmap.m_RawBuffer.Get(), dstMipmap.PixelBufferSize(inputImage->m_Format)); + + // Convert to BGRA8 + CImageSurface surface(dstMipmap, inputImage->m_Format); + + if (!surface.Convert(CImage::Format_BGRA8)) + { + CLog::Log(PK_ERROR, "Color remap post-effect: Could not linearize LUT image \"%s\"", resourcePath.Data()); + return false; + } + if (config.m_ForceSRGBToLinear) + { + surface.m_Format = inputImage->GammaCorrected() ? CImage::Format_BGRA8 : CImage::Format_BGRA8_sRGB; + if (!surface.Convert(inputImage->GammaCorrected() ? CImage::Format_BGRA8_sRGB : CImage::Format_BGRA8)) + { + CLog::Log(PK_ERROR, "Color remap post-effect: Could not linearize LUT image \"%s\"", resourcePath.Data()); + return false; + } + } + dstMipmap.m_RawBuffer = surface.m_RawBuffer; + } + if (dstMipmap.m_RawBuffer != null) + { + RHI::PTexture resourceTexture = m_ApiManager->CreateTexture(RHI::SRHIResourceInfos(resourcePath), TMemoryView(dstMipmap), RHI::FormatUnorm8BGRA); + dimensions = dstMipmap.m_Dimensions; + if (resourceTexture != null) + colorRemapTexture = resourceTexture; + else + CLog::Log(PK_ERROR, "Color remap post-effect: Failed loading LUT image \"%s\"", resourcePath.Data()); + } + } + } + m_ColorRemap.SetRemapTexture(colorRemapTexture, colorRemapTexture == m_DummyWhite, dimensions); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::SetupPostFX_FXAA(const SParticleSceneOptions::SFXAA &config, bool /*firstInit*/, bool lumaInAlpha /* = true*/) +{ + if ((m_InitializedRP & InitRP_FXAA) != 0) + { + const bool oldLumaInAlpha = m_FXAA.LumaInAlpha(); + m_EnableFXAA = config.m_Enable; + // If lumaInAlpha is true, make sure the tonemap pass computes it. + // If tonemap pass is not initialized, luma is computed in the FXAA pass anyway + m_FXAA.SetLumaInAlpha(lumaInAlpha && (m_InitializedRP & InitRP_ToneMapping) != 0); + + if (oldLumaInAlpha != m_FXAA.LumaInAlpha()) + { + if (!PK_VERIFY(m_FXAA.CreateRenderStates(m_FinalFrameBuffers.First()->GetLayout(), *m_ShaderLoader, m_FinalRenderPass))) + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::SetupShadows() +{ + m_Lights.m_DirectionalShadows.SetCascadeShadowsSettings(0, + m_ShadowOptions.m_CascadeShadowSceneRangeRatios.x(), + m_ShadowOptions.m_CascadeShadowMinDistances.x()); + m_Lights.m_DirectionalShadows.SetCascadeShadowsSettings(1, + m_ShadowOptions.m_CascadeShadowSceneRangeRatios.y(), + m_ShadowOptions.m_CascadeShadowMinDistances.y()); + m_Lights.m_DirectionalShadows.SetCascadeShadowsSettings(2, + m_ShadowOptions.m_CascadeShadowSceneRangeRatios.z(), + m_ShadowOptions.m_CascadeShadowMinDistances.z()); + m_Lights.m_DirectionalShadows.SetCascadeShadowsSettings(3, + m_ShadowOptions.m_CascadeShadowSceneRangeRatios.w(), + m_ShadowOptions.m_CascadeShadowMinDistances.w()); + m_Lights.m_DirectionalShadows.SetShadowsInfo( m_ShadowOptions.m_ShadowBias, + m_ShadowOptions.m_ShadowVarianceExponent, + m_ShadowOptions.m_EnableShadows, + m_ShadowOptions.m_EnableVarianceShadows, + m_ShadowOptions.m_EnableDebugShadows, + m_ShadowOptions.m_CascadeShadowResolution); + + bool success = true; + + success &= m_Lights.m_DirectionalShadows.UpdateShadowsSettings(); + success &= m_Lights.UpdateShadowMaps(m_DefaultSampler); + return success; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::SetSceneInfo(const SSceneInfoData &sceneInfoData, ECoordinateFrame coordinateFrame) +{ + if (m_CoordinateFrame != coordinateFrame) + { + m_CoordinateFrame = coordinateFrame; + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + const bool hasDifferentRenderPasses = (m_InitializedRP & InitRP_Bloom) != 0; + const RHI::PFrameBuffer &frameBuffer = hasDifferentRenderPasses ? m_BeforeBloomFrameBuffer : m_FinalFrameBuffers.First(); + const RHI::PRenderPass &renderPass = hasDifferentRenderPasses ? m_BeforeBloomRenderPass : m_FinalRenderPass; + + _CreateOpaqueBackdropRenderStates(frameBuffer->GetLayout(), renderPass, m_GBuffer.m_GBufferSubPassIdx); + } + } + + m_SceneInfoData = sceneInfoData; + + if (!PK_VERIFY(m_SceneInfoConstantBuffer != null)) + return false; + + // Fill the GPU buffer: + SSceneInfoData *sceneInfo = static_cast(m_ApiManager->MapCpuView(m_SceneInfoConstantBuffer)); + if (!PK_VERIFY(sceneInfo != null)) + return false; + + *sceneInfo = sceneInfoData; + if (!PK_VERIFY(m_ApiManager->UnmapCpuView(m_SceneInfoConstantBuffer))) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::SetBackdropInfo(const SBackdropsData &backdropData, ECoordinateFrame coordinateFrame) +{ + // FIXME(Julien): This is a very bad way of handling this. + // Setting it each frame and comparing with the last state to see if something has changed... + + bool success = true; + + // Environment map + if (backdropData.m_EnvironmentMapPath != m_BackdropsData.m_EnvironmentMapPath) + { + // We should try to reload envmap even if EnvironmentMapAffectsAmbient is false, + // envmap might be used for background + if (!backdropData.m_EnvironmentMapPath.Empty()) + success &= m_EnvironmentMap.Load(backdropData.m_EnvironmentMapPath.Data(), m_CurrentPackResourceManager); + else + m_EnvironmentMap.Reset(); + } + + if (backdropData.m_EnvironmentMapRotation != m_BackdropsData.m_EnvironmentMapRotation) + m_EnvironmentMap.SetRotation(backdropData.m_EnvironmentMapRotation); + + + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + m_MeshBackdrop.m_Roughness = backdropData.m_MeshRoughness; + m_MeshBackdrop.m_Metalness = backdropData.m_MeshMetalness; + m_MeshBackdropFilteredSubmeshes = backdropData.m_MeshFilteredSubmeshes; + + // Some code paths provide null paths (i.e. editor-only debug textures, no path is specified but the data changes) + const bool diffuseChanged = (m_MeshBackdrop.m_DiffuseMap.m_Path != backdropData.m_MeshDiffusePath) || + (m_MeshBackdrop.m_DiffuseMap.m_Path.Empty() && (m_MeshBackdrop.m_DiffuseMap.m_ImageData != backdropData.m_MeshDiffuseData)); + const bool normalChanged = (m_MeshBackdrop.m_NormalMap.m_Path != backdropData.m_MeshNormalPath) || + (m_MeshBackdrop.m_NormalMap.m_Path.Empty() && (m_MeshBackdrop.m_NormalMap.m_ImageData != backdropData.m_MeshNormalData)); + const bool roughMetalChanged = (m_MeshBackdrop.m_RoughMetalMap.m_Path != backdropData.m_MeshRoughMetalPath) || + (m_MeshBackdrop.m_RoughMetalMap.m_Path.Empty() && (m_MeshBackdrop.m_RoughMetalMap.m_ImageData != backdropData.m_MeshRoughMetalData)); + + if (m_MeshBackdrop.m_MeshPath != backdropData.m_MeshPath || + m_MeshBackdrop.m_MeshLOD != backdropData.m_MeshLOD || + diffuseChanged || + normalChanged || + roughMetalChanged || + backdropData.m_MeshVertexColorsSet != m_BackdropsData.m_MeshVertexColorsSet || + backdropData.m_MeshVertexColorsMode != m_BackdropsData.m_MeshVertexColorsMode || + m_MeshBackdrop.IsDirty()) + { + Mem::Reinit(m_MeshBackdrop); + + m_MeshBackdrop.m_MeshPath = backdropData.m_MeshPath; + m_MeshBackdrop.m_MeshLOD = backdropData.m_MeshLOD; + m_MeshBackdrop.m_DiffuseMap.m_Path = backdropData.m_MeshDiffusePath; + m_MeshBackdrop.m_NormalMap.m_Path = backdropData.m_MeshNormalPath; + m_MeshBackdrop.m_RoughMetalMap.m_Path = backdropData.m_MeshRoughMetalPath; + m_MeshBackdrop.m_DiffuseMap.m_ImageData = backdropData.m_MeshDiffuseData; + m_MeshBackdrop.m_NormalMap.m_ImageData = backdropData.m_MeshNormalData; + m_MeshBackdrop.m_RoughMetalMap.m_ImageData = backdropData.m_MeshRoughMetalData; + + const RHI::SConstantSetLayout constLayouts[] = + { + m_MeshConstSetLayout, + m_MeshConstSetLayout, + m_MeshConstSetLayout, + m_MeshConstSetLayout + }; + + if (!m_MeshBackdrop.m_MeshPath.Empty()) + success &= m_MeshBackdrop.Load( m_ApiManager, + constLayouts, + m_CurrentPackResourceManager, + backdropData.m_MeshVertexColorsSet, + backdropData.m_MeshVertexColorsMode == 2, + m_DummyWhite, + m_DummyNormal, + m_DefaultSampler); + } + + if (backdropData.m_FollowInstances) + { + m_MeshBackdrop.m_Transforms = backdropData.m_FXInstancesTransforms; + } + else + { + if (!PK_VERIFY(m_MeshBackdrop.m_Transforms.Resize(1))) + return false; + m_MeshBackdrop.m_Transforms.First() = backdropData.m_MeshBackdropTransforms; + } + + // If there is skinned mesh data, transfer to VBuffers + if (!m_MeshBackdrop.RefreshSkinnedDatas(m_ApiManager, backdropData.m_FXInstancesSkinnedDatas)) + return false; + + // And we update the lights + PK_VERIFY(_UpdateBackdropLights(backdropData)); + } + + if (m_GridVertices == null || m_GridIndices == null || + !m_BackdropsData.IsGridSameGeometry(backdropData) || + m_BackdropsData.m_BackdropGridVersion != backdropData.m_BackdropGridVersion) + { + // Create the grid geometry: + success &= _CreateGridGeometry(backdropData.m_GridSize, backdropData.m_GridSubdivisions, backdropData.m_GridSubSubdivisions, backdropData.m_GridTransforms, coordinateFrame); + } + + m_BackdropsData = backdropData; + + return success; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::SetCurrentPackResourceManager(CResourceManager *resourceManager) +{ + m_CurrentPackResourceManager = resourceManager; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::SetBackGroundColor(const CFloat3 &top, const CFloat3 &bottom) +{ + m_BackdropsData.m_BackgroundColorTop = top; + m_BackdropsData.m_BackgroundColorBottom = bottom; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::SetBackGroundTexture(const RHI::PTexture &background) +{ + m_BackgroundTexture = background; + if (m_BackgroundTexture != null && m_BackgroundTextureConstantSet != null) + { + m_BackgroundTextureConstantSet->SetConstants(m_DefaultSampler, m_BackgroundTexture, 0); + m_BackgroundTextureConstantSet->UpdateConstantValues(); + } +} + +//---------------------------------------------------------------------------- + +CGBuffer &CRHIParticleSceneRenderHelper::GetDeferredSetup() +{ + return m_GBuffer; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::RenderScene( ERenderTargetDebug renderTargetDebug, + const SRHIDrawOutputs &drawOutputs, + u32 finalRtIdx) +{ + PK_SCOPEDPROFILE(); + + RHI::PCommandBuffer preOpaqueCmdBuff = m_ApiManager->CreateCommandBuffer(RHI::SRHIResourceInfos("PK-RHI Pre Opaque command buffer")); + RHI::PCommandBuffer postOpaqueCmdBuff = m_ApiManager->CreateCommandBuffer(RHI::SRHIResourceInfos("PK-RHI Post Opaque command buffer")); + + preOpaqueCmdBuff->Start(); + + if (!PK_VERIFY(m_EnvironmentMap.GenerateCubemap(preOpaqueCmdBuff))) + return false; + + if ((m_InitializedRP & InitRP_Debug) != 0) + { + PK_NAMEDSCOPEDPROFILE_GPU(preOpaqueCmdBuff->ProfileEventContext(), "ImGUI"); + if (!GenerateGUI(drawOutputs)) + return false; + } + + if (m_BackdropsData.m_ShowMesh && !m_MeshBackdrop.m_MeshBatches.Empty()) + _UpdateMeshBackdropInfos(); + + const bool hasBloom = (m_InitializedRP & InitRP_Bloom) != 0; + const RHI::PFrameBuffer &frameBuffer = hasBloom ? m_BeforeBloomFrameBuffer : m_FinalFrameBuffers[finalRtIdx]; + const RHI::PRenderPass &renderPass = hasBloom ? m_BeforeBloomRenderPass : m_FinalRenderPass; + const TMemoryView &clearValues = hasBloom ? m_BeforeBloomClearValues : m_FinalClearValues; + + // Render pass shadows: + if (!m_Lights.m_DirectionalLights.Empty() && m_Lights.m_DirectionalShadows.GetShadowEnabled()) + { + const SLightRenderPass::SPerLightData &curLight = m_Lights.m_DirectionalLights.First(); + const CFloat3 lightDir = curLight.m_LightParam0.xyz(); + bool hasShadows = false; + + m_Lights.m_DirectionalShadows.UpdateSceneInfo(m_SceneInfoData); + m_Lights.m_DirectionalShadows.InitFrameUpdateSceneInfo(lightDir, m_CoordinateFrame, *m_ShaderLoader, m_MeshBackdrop, m_BackdropsData.m_CastShadows); + _UpdateShadowsBBox(m_Lights.m_DirectionalShadows, drawOutputs.m_DrawCalls); + m_Lights.m_DirectionalShadows.FinalizeFrameUpdateSceneInfo(); + m_Lights.UpdateShadowsInfo(m_ApiManager); + for (u32 j = 0; j < m_Lights.m_DirectionalShadows.CascadeShadowCount(); ++j) + { + if (m_Lights.m_DirectionalShadows.IsSliceValidForDraw(j)) + { + m_Lights.m_DirectionalShadows.BeginDrawShadowRenderPass(preOpaqueCmdBuff, j, m_BackdropsData.m_CastShadows ? &m_MeshBackdrop : null); + _RenderParticles(false, ParticlePass_OpaqueShadow, drawOutputs.m_DrawCalls, preOpaqueCmdBuff, m_Lights.m_DirectionalShadows.GetSceneInfoConstSet(j)); + m_Lights.m_DirectionalShadows.EndDrawShadowRenderPass(preOpaqueCmdBuff, j); + hasShadows = true; + } + } + if (hasShadows) + preOpaqueCmdBuff->SyncPreviousRenderPass(RHI::OutputColorPipelineStage, RHI::TopOfPipePipelineStage); + } + else + { + // Used to diable shadows in lighting render pass: + m_Lights.UpdateShadowsInfo(m_ApiManager); + } + + // -- START RENDER PASS: Deferred ------------------- + { + PK_NAMEDSCOPEDPROFILE("START RENDER PASS: Deferred"); + preOpaqueCmdBuff->BeginRenderPass(renderPass, frameBuffer, clearValues); + preOpaqueCmdBuff->SetViewport(CInt2(0, 0), frameBuffer->GetSize(), CFloat2(0, 1)); + preOpaqueCmdBuff->SetScissor(CInt2(0), frameBuffer->GetSize()); + } + + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + // Sub-pass: GBuffer + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 0: GBuffer"); + PK_NAMEDSCOPEDPROFILE_GPU(preOpaqueCmdBuff->ProfileEventContext(), "Sub-pass 0: GBuffer"); + if (m_BackdropsData.m_ShowMesh && m_EnableBackdropRender) + _RenderMeshBackdrop(preOpaqueCmdBuff); + } + + preOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(preOpaqueCmdBuff); + + postOpaqueCmdBuff->Start(); + if (!m_PostRenderOpaque.empty()) + m_PostRenderOpaque(postOpaqueCmdBuff); + + // -- START RENDER PASS: Deferred ------------------- + { + PK_NAMEDSCOPEDPROFILE("START RENDER PASS: Deferred"); + postOpaqueCmdBuff->BeginRenderPass(renderPass, frameBuffer, TMemoryView()); // don't clear + postOpaqueCmdBuff->SetViewport(CInt2(0, 0), frameBuffer->GetSize(), CFloat2(0, 1)); + postOpaqueCmdBuff->SetScissor(CInt2(0), frameBuffer->GetSize()); + } + + // Sub-pass: Opaque particles + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 1: Opaque particles"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Opaque particles"); + + if (m_EnableParticleRender) + _RenderParticles(false, ParticlePass_Opaque, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + } + // Sub-pass: Decal + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 2: Decals"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Decal particles"); + postOpaqueCmdBuff->NextRenderSubPass(); + if (m_EnableParticleRender) + _RenderParticles(false, ParticlePass_Decal, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + } + // Sub-pass: backdrop directional light + light particles: + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 3: backdrop directional light + light particles"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "backdrop directional light + light particles"); + postOpaqueCmdBuff->NextRenderSubPass(); + + _RenderBackdropLights(postOpaqueCmdBuff, m_Lights, m_GBuffer.m_LightsRenderState); + + if (m_EnableParticleRender) + { + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Light particles"); + _RenderParticles(false, ParticlePass_Lighting, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + } + } + + // Sub-pass: Merging + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 4: Merging"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Merging"); + postOpaqueCmdBuff->NextRenderSubPass(); + + _RenderBackground(postOpaqueCmdBuff, m_EnableOverdrawRender || !m_EnableBrushBackground); + + { + PK_NAMEDSCOPEDPROFILE("Merge"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Merge"); + postOpaqueCmdBuff->BindRenderState(m_GBuffer.m_MergingRenderState); + postOpaqueCmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_GBuffer.m_MergingSamplersSet)); + postOpaqueCmdBuff->PushConstant(&m_DeferredMergingMinAlpha, 0); + postOpaqueCmdBuff->Draw(0, 6); + } + + // -> Render the grid IFN: + if (m_BackdropsData.m_ShowGrid && !m_EnableOverdrawRender) + { + _RenderGridBackdrop(postOpaqueCmdBuff); + } + // -> Render Particles + if (m_EnableParticleRender) + { + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Transparent particles"); + _RenderParticles(false, ParticlePass_Transparent, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + } + + _RenderEditorMisc(postOpaqueCmdBuff); + } + } + else + { + _RenderBackground(postOpaqueCmdBuff, m_EnableOverdrawRender || !m_EnableBrushBackground); + // Sub-pass: Basic rendering + // -> Render Particles + if (m_EnableParticleRender) + { + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Transparent particles"); + _RenderParticles(false, ParticlePass_Transparent, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + } + + _RenderEditorMisc(postOpaqueCmdBuff); + } + + if (_EndRenderPass(InitRP_GBuffer, postOpaqueCmdBuff)) + { + postOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(postOpaqueCmdBuff); + return true; + } + + // Sub-pass: Distortion-Map + if ((m_InitializedRP & InitRP_Distortion) != 0) + { + // Sub-pass 4-5-6: Distortion/Blur-PostFX + // Input: m_DeferredSetup.m_Merge + // Output: m_DeferredSetup.m_DistortionPostFX.m_OutputRenderTarget + + PK_NAMEDSCOPEDPROFILE("Sub-pass: Distortion-Map"); + postOpaqueCmdBuff->NextRenderSubPass(); + if (PostFXEnabled_Distortion() && m_EnableParticleRender && !m_EnableOverdrawRender) + { + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Distortion particles"); + _RenderParticles(false, ParticlePass_Distortion, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + } + + { + PK_NAMEDSCOPEDPROFILE("Sub-passes: Distortion-PostFX"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Sub-passes: Distortion-PostFX"); + postOpaqueCmdBuff->NextRenderSubPass(); + if (PostFXEnabled_Distortion() && m_EnableParticleRender && !m_EnableOverdrawRender) + m_Distortion.Draw(postOpaqueCmdBuff); + else + m_Distortion.Draw_JustCopy(postOpaqueCmdBuff); + } + + { + PK_NAMEDSCOPEDPROFILE("Sub-passes: Transparent post distortion"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Sub-passes: Transparent post distortion"); + postOpaqueCmdBuff->NextRenderSubPass(); + if (m_EnableParticleRender && !m_EnableOverdrawRender) + { + ESampleLibGraphicResources_RenderPass renderPasses[] = + { + ParticlePass_Tint, + ParticlePass_TransparentPostDisto + }; + + _RenderParticles(false, renderPasses, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + } + } + + if (_EndRenderPass(InitRP_Distortion, postOpaqueCmdBuff)) + { + postOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(postOpaqueCmdBuff); + return true; + } + } + + // -- START RENDER PASS: Bloom Post-FX ------------------------- + // Input: m_DeferredSetup.m_DistortionPostFX.m_OutputRenderTarget + // Output: m_DeferredSetup.m_DistortionPostFX.m_OutputRenderTarget + if ((m_InitializedRP & InitRP_Bloom) != 0) + { + PK_NAMEDSCOPEDPROFILE("START RENDER PASS: Bloom Post-FX"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Bloom Post-FX"); + postOpaqueCmdBuff->EndRenderPass(); + postOpaqueCmdBuff->SyncPreviousRenderPass(RHI::FragmentPipelineStage, RHI::FragmentPipelineStage); + if (PostFXEnabled_Bloom() && !m_EnableOverdrawRender) + { + m_Bloom.Draw(postOpaqueCmdBuff, finalRtIdx); + postOpaqueCmdBuff->SyncPreviousRenderPass(RHI::FragmentPipelineStage, RHI::FragmentPipelineStage); + } + if (_IsLastRenderPass(InitRP_Bloom)) + { + postOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(postOpaqueCmdBuff); + return true; + } + } + + // -- START RENDER PASS: Final Image ------------------------- + if (hasBloom) + { + PK_NAMEDSCOPEDPROFILE("START RENDER PASS: Final Image"); + postOpaqueCmdBuff->BeginRenderPass(m_FinalRenderPass, m_FinalFrameBuffers[finalRtIdx], m_FinalClearValues); + postOpaqueCmdBuff->SetViewport(CInt2(0, 0), m_FinalFrameBuffers.First()->GetSize(), CFloat2(0, 1)); + postOpaqueCmdBuff->SetScissor(CInt2(0), m_FinalFrameBuffers.First()->GetSize()); + } + else + { + postOpaqueCmdBuff->NextRenderSubPass(); + } + + if ((m_InitializedRP & InitRP_ToneMapping) != 0) + { + // Sub-pass 0: Tone-Mapping + // Input: m_DeferredSetup.m_DistortionPostFX.m_OutputRenderTarget + // Output: m_ToneMapping.m_OutputRenderTarget + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 0: Tone-Mapping"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Tone-Mapping"); + + if (PostFXEnabled_ToneMapping() && !m_EnableOverdrawRender) + m_ToneMapping.Draw(postOpaqueCmdBuff); + else + m_ToneMapping.Draw_JustCopy(postOpaqueCmdBuff); + } + + if (_EndRenderPass(InitRP_ToneMapping, postOpaqueCmdBuff)) + { + postOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(postOpaqueCmdBuff); + return true; + } + + postOpaqueCmdBuff->NextRenderSubPass(); + } + if ((m_InitializedRP & InitRP_ColorRemap) != 0) + { + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 1: Color Remap"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Color Remap"); + + if (PostFXEnabled_ColorRemap() && m_ColorRemap.m_HasTexture && !m_EnableOverdrawRender) + m_ColorRemap.Draw(postOpaqueCmdBuff); + else + m_ColorRemap.Draw_JustCopy(postOpaqueCmdBuff); + } + if (_EndRenderPass(InitRP_ColorRemap, postOpaqueCmdBuff)) + { + postOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(postOpaqueCmdBuff); + return true; + } + postOpaqueCmdBuff->NextRenderSubPass(); + } + + // Sub-pass: FXAA + if ((m_InitializedRP & InitRP_FXAA) != 0) + { + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 2: FXAA"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "FXAA"); + if (PostFXEnabled_FXAA() && !m_EnableOverdrawRender) + m_FXAA.Draw(postOpaqueCmdBuff); + else + m_FXAA.Draw_JustCopy(postOpaqueCmdBuff); + } + if (_EndRenderPass(InitRP_FXAA, postOpaqueCmdBuff)) + { + postOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(postOpaqueCmdBuff); + return true; + } + postOpaqueCmdBuff->NextRenderSubPass(); + } + + if ((m_InitializedRP & InitRP_Debug) != 0) + { + // Sub-pass 1: Debug-Particles + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 1: Debug-Particles"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Debug-Particles"); + + if (m_BackdropsData.m_ShowMesh) + _RenderMeshBackdropDebug(postOpaqueCmdBuff); + + _RenderParticles(true, ParticlePass_Debug, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + } + + if (!DrawOnDebugBuffer(postOpaqueCmdBuff)) + return false; + + // Sub-pass 2: Final Copy (and swap-chain as output) + { + PK_NAMEDSCOPEDPROFILE("Sub-pass 2: Final Copy (and swap-chain as output)"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Final Copy"); + postOpaqueCmdBuff->NextRenderSubPass(); + { + if (m_EnableOverdrawRender) + { + postOpaqueCmdBuff->BindRenderState(m_OverdrawHeatmapRenderState); + postOpaqueCmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_OverdrawConstantSet)); + postOpaqueCmdBuff->Draw(0, 6); + } + else if (renderTargetDebug == RenderTargetDebug_ShadowCascades) + { + const CUint2 cascadeViewportSize = frameBuffer->GetSize() / 2; + for (u32 i = 0; i < 4; ++i) + { + const CInt2 viewportOffset = CInt2(cascadeViewportSize.x() * (i % 2), cascadeViewportSize.y() * (i / 2)); + TStaticCountedArray constantSets; + constantSets.PushBack(m_Lights.m_DirectionalShadows.GetDepthConstSet(i)); + postOpaqueCmdBuff->SetViewport(viewportOffset, cascadeViewportSize, CFloat2(0, 1)); + postOpaqueCmdBuff->BindRenderState(m_CopyColorRenderState); + postOpaqueCmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + postOpaqueCmdBuff->BindConstantSets(constantSets); + postOpaqueCmdBuff->Draw(0, 6); + } + } + else + { + RHI::PRenderState renderState = m_CopyColorRenderState; + TStaticCountedArray constantSets; + + if (renderTargetDebug == RenderTargetDebug_NoDebug) + { + // Display final render target: + constantSets.PushBack(m_BeforeDebugOutputRt.m_SamplerConstantSet); + } + else if (renderTargetDebug == RenderTargetDebug_Distortion) + { + // Display distortion render target: + if ((m_InitializedRP & InitRP_Distortion) == 0) + constantSets.PushBack(m_BeforeDebugOutputRt.m_SamplerConstantSet); + else + constantSets.PushBack(m_Distortion.m_DistoRenderTarget.m_SamplerConstantSet); + } + else + { + // Display one of the GBuffer render targets: + if ((m_InitializedRP & InitRP_GBuffer) == 0) + constantSets.PushBack(m_BeforeDebugOutputRt.m_SamplerConstantSet); + else + { + switch (renderTargetDebug) + { + case RenderTargetDebug_Diffuse: + constantSets.PushBack(GBufferRT(SPassDescription::GBufferRT_Diffuse).m_SamplerConstantSet); + break; + case RenderTargetDebug_Depth: + constantSets.PushBack(GBufferRT(SPassDescription::GBufferRT_Depth).m_SamplerConstantSet); + renderState = m_CopyDepthRenderState; + break; + case RenderTargetDebug_Normal: + constantSets.PushBack(m_GBuffer.m_NormalRoughMetal.m_SamplerConstantSet); + renderState = m_CopyNormalRenderState; + break; + case RenderTargetDebug_NormalUnpacked: + constantSets.PushBack(m_GBuffer.m_NormalRoughMetal.m_SamplerConstantSet); + constantSets.PushBack(m_SceneInfoConstantSet); + renderState = m_CopyNormalUnpackedRenderState; + break; + case RenderTargetDebug_Roughness: + constantSets.PushBack(m_GBuffer.m_NormalRoughMetal.m_SamplerConstantSet); + renderState = m_CopySpecularRenderState; + break; + case RenderTargetDebug_Metalness: + constantSets.PushBack(m_GBuffer.m_NormalRoughMetal.m_SamplerConstantSet); + renderState = m_CopyAlphaRenderState; + break; + case RenderTargetDebug_LightAccum: + constantSets.PushBack(m_GBuffer.m_LightAccu.m_SamplerConstantSet); + break; + case RenderTargetDebug_PostMerge: + constantSets.PushBack(m_GBuffer.m_Merge.m_SamplerConstantSet); + break; + default: + constantSets.PushBack(m_BeforeDebugOutputRt.m_SamplerConstantSet); + break; + } + } + } + + postOpaqueCmdBuff->BindRenderState(renderState); + postOpaqueCmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + if (renderTargetDebug == RenderTargetDebug_Depth) + postOpaqueCmdBuff->PushConstant(&m_SceneInfoData.m_ZBufferLimits, 0); + postOpaqueCmdBuff->BindConstantSets(constantSets); + postOpaqueCmdBuff->Draw(0, 6); + } + } + } + + // Draw Selection + { + PK_NAMEDSCOPEDPROFILE("Draw Selection"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Selection"); + _RenderParticles(true, ParticlePass_Compositing, drawOutputs.m_DrawCalls, postOpaqueCmdBuff); + // We should render the selected light particles here. Render the light spheres wire-frames... + } + + if (!DrawOnFinalBuffer(postOpaqueCmdBuff)) + return false; + + if (_EndRenderPass(InitRP_Debug, postOpaqueCmdBuff)) + { + postOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(postOpaqueCmdBuff); + return true; + } + } + PK_ASSERT_NOT_REACHED_MESSAGE("The last render pass in the InitRP bitmask should be InitRP_Debug"); + return false; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_RenderMeshBackdropDebug(const RHI::PCommandBuffer &cmdBuff) +{ + (void)cmdBuff; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_CullParticleDraw( bool debug, + PKSample::ESampleLibGraphicResources_RenderPass renderPass, + const PKSample::SRHIDrawCall &drawCall, + bool validRenderState) +{ + (void)debug; (void)renderPass; (void)drawCall; (void)validRenderState; + return false; +} + +//---------------------------------------------------------------------------- + +RHI::PRenderState CRHIParticleSceneRenderHelper::_GetDebugRenderState(PKSample::ESampleLibGraphicResources_RenderPass renderPass, + const PKSample::SRHIDrawCall &drawCall, + PKSample::EShaderOptions shaderOptions, + PKSample::ESampleLibGraphicResources_RenderPass *cacheRenderPass) +{ + (void)renderPass; (void)drawCall; (void)shaderOptions; (void)cacheRenderPass; + return null; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_CreateFinalDebugRenderStates( TMemoryView frameBufferLayout, + RHI::PRenderPass renderPass, + CGuid mergeSubPassIdx, + CGuid finalSubPassIdx) +{ + (void)frameBufferLayout; (void)renderPass; (void)mergeSubPassIdx; (void)finalSubPassIdx; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_BindDebugVertexBuffer(const PKSample::SRHIDrawCall &drawCall, const RHI::PCommandBuffer &cmdBuff) +{ + (void)drawCall; (void)cmdBuff; + return false; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_BindDebugConstantSets(const RHI::PRenderState &renderState, const PKSample::SRHIDrawCall &drawCall, TStaticCountedArray &constantSets) +{ + (void)drawCall; (void)constantSets; (void)renderState; + return true; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_RenderParticles(bool debugMode, + CRenderPassArray renderPasses, + const TArray &drawCalls, + const RHI::PCommandBuffer &cmdBuff, + const RHI::PConstantSet &sceneInfo) +{ + PK_SCOPEDPROFILE(); + RHI::PRenderState renderState = null; + const CRHIBillboardingBatchPolicy *lastBatch = null; + + for (const SRHIDrawCall &dc : drawCalls) + { + // Here we either get the render state from the renderer cache or we choose between the debug render states: + EShaderOptions shaderOptions = static_cast(dc.m_ShaderOptions); + ESampleLibGraphicResources_RenderPass cacheRenderPass = __MaxParticlePass; + u32 neededConstants = 0; + PCRendererCacheInstance cacheInstance = null; + RHI::PRenderState newRenderState = null; + const bool isGeomShaderBB = !!(shaderOptions & Option_GeomBillboarding); + const bool isVertexShaderBB = (shaderOptions & Option_VertexBillboarding) || + (shaderOptions & Option_TriangleVertexBillboarding) || + (shaderOptions & Option_RibbonVertexBillboarding); + const bool gpuStorage = (shaderOptions & PKSample::Option_GPUStorage) != 0; + const bool GPUMesh = (shaderOptions & PKSample::Option_GPUMesh) != 0; + + if (debugMode && gpuStorage) + { + if ((shaderOptions & Option_RibbonVertexBillboarding) != 0 || + (shaderOptions & Option_TriangleVertexBillboarding) != 0) + continue; // Triangle/Ribbon GPU particles debug draw not currently supported in VertexBB + } + + for (ESampleLibGraphicResources_RenderPass renderPass : renderPasses) + { + //------------------------------------------------------ + // Retrieve renderer cache instance: + //------------------------------------------------------ + { + CRendererCacheInstance_UpdateThread *srcRendererCache = dc.m_RendererCacheInstance.Get(); + if (srcRendererCache != null) + { + if (renderPass == ParticlePass_OpaqueShadow && !srcRendererCache->CastShadows()) + continue; + cacheInstance = srcRendererCache->RenderThread_GetCacheInstance(); + if (cacheInstance != null) + { + const PRendererCache layout = cacheInstance->m_Cache; + if (layout != null) + newRenderState = layout->GetRenderState(shaderOptions, renderPass, &neededConstants); + } + } + else + CLog::Log(PK_ERROR, "The renderer does not have a cache instance: some graphical resource creation must have failed"); + } + + //------------------------------------------------------ + // Cull particle draw + //------------------------------------------------------ + if (_CullParticleDraw(debugMode, renderPass, dc, newRenderState != null)) + { + continue; + } + + if (debugMode) + { + newRenderState = _GetDebugRenderState(renderPass, dc, shaderOptions, &cacheRenderPass); + if (cacheRenderPass != renderPass) + continue; + } + + if (newRenderState == null) + { + continue; + } + + //------------------------------------------------------ + // Bind render state and constants: + //------------------------------------------------------ + if (renderState != newRenderState) + { + renderState = newRenderState; + cmdBuff->BindRenderState(newRenderState); + } + + // First we add the scene info constant set and then the renderer cache constant sets: + TStaticCountedArray constantSets; + if (!debugMode) + { + PK_ASSERT(cacheInstance != null); + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + if (neededConstants & MaterialToRHI::NeedSampleDepth) + constantSets.PushBack(GBufferRT(SPassDescription::GBufferRT_Depth).m_SamplerConstantSet); + if (neededConstants & MaterialToRHI::NeedSampleNormalRoughMetal) + constantSets.PushBack(m_GBuffer.m_NormalRoughMetal.m_SamplerConstantSet); + if (neededConstants & MaterialToRHI::NeedSampleDiffuse) + constantSets.PushBack(GBufferRT(SPassDescription::GBufferRT_Diffuse).m_SamplerConstantSet); + } + else + { + if (neededConstants & MaterialToRHI::NeedSampleDepth) + constantSets.PushBack(m_DummyWhiteConstantSet); + if (neededConstants & MaterialToRHI::NeedSampleNormalRoughMetal) + constantSets.PushBack(m_DummyBlackConstantSet); + if (neededConstants & MaterialToRHI::NeedSampleDiffuse) + constantSets.PushBack(m_DummyBlackConstantSet); + } + if (neededConstants & MaterialToRHI::NeedLightingInfo) + { + constantSets.PushBack(m_Lights.m_LightsInfoConstantSet); + if (renderPass == ParticlePass_OpaqueShadow) + constantSets.PushBack(m_Lights.m_DummyShadowsInfoConstantSet); + else + constantSets.PushBack(m_Lights.m_ShadowsInfoConstantSet); + constantSets.PushBack(m_BRDFLUTConstantSet); + const bool envMapAffectsAmbient = (!m_EnvironmentMap.IsValid() || m_BackdropsData.m_EnvironmentMapPath.Empty()) ? false : m_BackdropsData.m_EnvironmentMapAffectsAmbient; + constantSets.PushBack(envMapAffectsAmbient ? m_EnvironmentMap.GetIBLCubemapConstantSet() : m_EnvironmentMap.GetWhiteEnvMapConstantSet()); + } + if (neededConstants & MaterialToRHI::NeedAtlasInfo) + { + // If the atlas dimension is 1 * 1, it's null in the cache (see LoadRendererAtlas() in + // RHIGraphicResources) but the atlas feature is not disabled in the shader, so we load + // a valid 1 * 1 atlas definition. + if (cacheInstance->m_Atlas != null) + constantSets.PushBack(cacheInstance->m_Atlas->m_AtlasConstSet); + else + constantSets.PushBack(m_DummyAtlas.m_AtlasConstSet); + } + + if (neededConstants & MaterialToRHI::NeedDitheringPattern) + constantSets.PushBack(m_NoiseTexture.m_NoiseTextureConstantSet); + + constantSets.PushBack(sceneInfo == null ? m_SceneInfoConstantSet : sceneInfo); + + if (cacheInstance->m_ConstSet != null) + constantSets.PushBack(cacheInstance->m_ConstSet); + } + else + { + constantSets.PushBack(sceneInfo == null ? m_SceneInfoConstantSet : sceneInfo); + } + + if (isGeomShaderBB || isVertexShaderBB) + { + if (!gpuStorage) + { + PK_ASSERT(dc.m_UBSemanticsPtr[SRHIDrawCall::UBSemantic_GPUBillboard] != null); + + // TODO: Fix this, we should avoid creating the constant set per draw call.. + // But if disabled, artefacts on d3d12 + PK_NAMEDSCOPEDPROFILE("Create constant set for draw requests"); + RHI::PConstantSet drawRequestsConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Draw Requests Constant Set"), SConstantDrawRequests::GetConstantSetLayout(dc.m_RendererType)); + if (!PK_VERIFY(drawRequestsConstantSet != null)) + return; + + drawRequestsConstantSet->SetConstants(dc.m_UBSemanticsPtr[SRHIDrawCall::UBSemantic_GPUBillboard], 0); + drawRequestsConstantSet->UpdateConstantValues(); + constantSets.PushBack(drawRequestsConstantSet); + } + if (isVertexShaderBB) + { + if (debugMode) + { + if (!_BindDebugConstantSets(renderState, dc, constantSets)) + return; + } + else + { + if (gpuStorage) + { + if (!PK_VERIFY(constantSets.PushBack(dc.m_GPUStorageOffsetsConstantSet).Valid())) + return; + } + // Full constant set (Positions, Sizes, .. All additional inputs) + if (!PK_VERIFY(constantSets.PushBack(dc.m_GPUStorageSimDataConstantSet).Valid())) + return; + } + } + } + else if (GPUMesh) + { + if (debugMode) + { + if (!_BindDebugConstantSets(renderState, dc, constantSets)) + return; + } + else + { + if (!PK_VERIFY(constantSets.PushBack(dc.m_GPUStorageOffsetsConstantSet).Valid())) + return; + // Full constant set (Positions, Sizes, .. All additional inputs) + if (!PK_VERIFY(constantSets.PushBack(dc.m_GPUStorageSimDataConstantSet).Valid())) + return; + } + } + + for (u32 i = 0; i < dc.m_PushConstants.Count(); ++i) + cmdBuff->PushConstant(&dc.m_PushConstants[i], i); + + cmdBuff->BindConstantSets(constantSets.View()); + + //------------------------------------------------------ + // Render + //------------------------------------------------------ + if (dc.m_Batch != lastBatch || !dc.m_VertexOffsets.Empty()) + { + if (dc.m_IndexBuffer != null) + cmdBuff->BindIndexBuffer(dc.m_IndexBuffer, 0, dc.m_IndexSize); + + if (!debugMode) + { + // Takes all the generated vertex inputs: + cmdBuff->BindVertexBuffers(dc.m_VertexBuffers, dc.m_VertexOffsets); + } + else + { + _BindDebugVertexBuffer(dc, cmdBuff); + } + //lastBatch = dc->m_Batch; // Fixme + } + + // Draw: + if (dc.m_Type == SRHIDrawCall::DrawCall_Regular) + { + if (dc.m_IndexBuffer != null) + cmdBuff->DrawIndexed(dc.m_IndexOffset, dc.m_VertexOffset, dc.m_IndexCount); + else + cmdBuff->Draw(dc.m_VertexOffset, dc.m_VertexCount); + } + else if (dc.m_Type == SRHIDrawCall::DrawCall_IndexedInstanced) + { + cmdBuff->DrawIndexedInstanced(dc.m_IndexOffset, 0, dc.m_IndexCount, dc.m_InstanceCount); + } + else if (dc.m_Type == SRHIDrawCall::DrawCall_InstancedIndirect) + { + cmdBuff->DrawInstancedIndirect(dc.m_IndirectBuffer, dc.m_IndirectBufferOffset); + } + else if (dc.m_Type == SRHIDrawCall::DrawCall_IndexedInstancedIndirect) + { + cmdBuff->DrawIndexedInstancedIndirect(dc.m_IndirectBuffer, dc.m_IndirectBufferOffset); + } + else + { + PK_ASSERT_NOT_REACHED(); + } + } + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_RenderGridBackdrop(const RHI::PCommandBuffer &cmdBuff) +{ + PK_SCOPEDPROFILE(); + PK_NAMEDSCOPEDPROFILE_GPU(cmdBuff->ProfileEventContext(), "Grid"); + const CFloat4 bigGridColor = ConvertSRGBToLinear(m_BackdropsData.m_GridColor); + const CFloat4 smallGridColor = ConvertSRGBToLinear(m_BackdropsData.m_GridSubColor); + + cmdBuff->BindRenderState(m_GridRenderState); + cmdBuff->BindConstantSets(TMemoryView(m_SceneInfoConstantSet)); + + cmdBuff->BindVertexBuffers(TMemoryView(m_GridVertices)); + cmdBuff->BindIndexBuffer(m_GridIndices, 0, RHI::IndexBuffer16Bit); + + cmdBuff->PushConstant(&smallGridColor, 0); + cmdBuff->DrawIndexed(m_GridIdxCount, 0, m_GridSubdivIdxCount); + + cmdBuff->PushConstant(&bigGridColor, 0); + cmdBuff->DrawIndexed(0, 0, m_GridIdxCount); +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_RenderEditorMisc(const RHI::PCommandBuffer &cmdBuff) +{ + PK_SCOPEDPROFILE(); + PK_NAMEDSCOPEDPROFILE_GPU(cmdBuff->ProfileEventContext(), "Debug draw lines"); + _DrawDebugLines(cmdBuff, m_MiscLinesOpaque_Position, m_MiscLinesOpaque_Color, m_LinesPointsColorBufferOpaque, m_LinesRenderStateOpaque); + _DrawDebugLines(cmdBuff, m_MiscLinesAdditive_Position, m_MiscLinesAdditive_Color, m_LinesPointsColorBufferAdditive, m_LinesRenderStateAdditive); +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::BindMiscLinesOpaque(const TMemoryView &positions, const TMemoryView &colors) +{ + m_MiscLinesOpaque_Position = positions; + m_MiscLinesOpaque_Color = colors; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::BindMiscLinesAdditive(const TMemoryView &positions, const TMemoryView &colors) +{ + m_MiscLinesAdditive_Position = positions; + m_MiscLinesAdditive_Color = colors; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::ClearMiscGeom() +{ + m_MiscLinesOpaque_Position.Clear(); + m_MiscLinesOpaque_Color.Clear(); + m_MiscLinesAdditive_Position.Clear(); + m_MiscLinesAdditive_Color.Clear(); +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_UpdateMeshBackdropInfos() +{ + PK_ASSERT(m_MeshBackdrop.m_MeshInfo != null); + SMeshFragmentConstant *meshFragmentConstant = static_cast(m_ApiManager->MapCpuView(m_MeshBackdrop.m_MeshInfo)); + + if (meshFragmentConstant == null) + return; + + meshFragmentConstant->m_Roughness = m_MeshBackdrop.m_Roughness; + meshFragmentConstant->m_Metalness = m_MeshBackdrop.m_Metalness; + + if (!m_ApiManager->UnmapCpuView(m_MeshBackdrop.m_MeshInfo)) + return; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_UpdateBackdropLights(const SBackdropsData &backdrop) +{ + const float kDeg2Rad = TNumericConstants::Pi() / 180.0f; + CFloat3 ambientColor = CFloat3::ZERO; + u32 dirLightIdx = 0; + u32 spotLightIdx = 0; + u32 pointLightIdx = 0; + + const bool sameShadows = (m_ShadowOptions == backdrop.m_ShadowOptions); + if (!sameShadows) + { + m_ShadowOptions = backdrop.m_ShadowOptions; + SetupShadows(); + } + + for (u32 i = 0; i < backdrop.m_Lights.Count(); ++i) + { + const CFloat3 lightColor = backdrop.m_Lights[i].Color() * backdrop.m_Lights[i].Intensity(); + + if (backdrop.m_Lights[i].Type() == SLightRenderPass::Ambient) + { + ambientColor += lightColor; + } + else if (backdrop.m_Lights[i].Type() == SLightRenderPass::Directional) + { + if (dirLightIdx >= m_Lights.m_DirectionalLights.Count()) + { + if (!PK_VERIFY(m_Lights.m_DirectionalLights.PushBack().Valid())) + return false; + } + m_Lights.m_DirectionalLights[dirLightIdx] = SLightRenderPass::SPerLightData(backdrop.m_Lights[i].Direction(), lightColor); + ++dirLightIdx; + } + else if (backdrop.m_Lights[i].Type() == SLightRenderPass::Spot) + { + if (spotLightIdx >= m_Lights.m_SpotLights.Count()) + { + if (!PK_VERIFY(m_Lights.m_SpotLights.PushBack().Valid())) + return false; + } + m_Lights.m_SpotLights[spotLightIdx] = SLightRenderPass::SPerLightData( backdrop.m_Lights[i].Position(), + backdrop.m_Lights[i].Direction(), + lightColor, + cosf(backdrop.m_Lights[i].Angle() * kDeg2Rad), + backdrop.m_Lights[i].ConeFalloff()); + ++spotLightIdx; + } + else if (backdrop.m_Lights[i].Type() == SLightRenderPass::Point) + { + if (pointLightIdx >= m_Lights.m_PointLights.Count()) + { + if (!PK_VERIFY(m_Lights.m_PointLights.PushBack().Valid())) + return false; + } + m_Lights.m_PointLights[pointLightIdx] = SLightRenderPass::SPerLightData(backdrop.m_Lights[i].Position(), lightColor); + ++pointLightIdx; + } + } + + bool success = true; + + if (dirLightIdx < m_Lights.m_DirectionalLights.Count()) + success &= m_Lights.m_DirectionalLights.Resize(dirLightIdx); + if (spotLightIdx < m_Lights.m_SpotLights.Count()) + success &= m_Lights.m_SpotLights.Resize(spotLightIdx); + if (pointLightIdx < m_Lights.m_PointLights.Count()) + success &= m_Lights.m_PointLights.Resize(pointLightIdx); + + if (!PK_VERIFY(success)) + return false; + + // We update the ambient lighting (add all the ambient backdrop lights): + const bool envMapAffectsAmbient = (!m_EnvironmentMap.IsValid() || backdrop.m_EnvironmentMapPath.Empty()) ? false : backdrop.m_EnvironmentMapAffectsAmbient; + ambientColor = envMapAffectsAmbient ? backdrop.m_EnvironmentMapColor * backdrop.m_EnvironmentMapIntensity : ambientColor; + + m_Lights.m_LightsInfoData.m_AmbientColor = ambientColor; + + if (!PK_VERIFY(m_Lights.Update(m_ApiManager))) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_RenderBackdropLights( const RHI::PCommandBuffer &cmdBuff, + const SLightRenderPass &lightInfo, + const RHI::PRenderState &renderState) +{ + PK_NAMEDSCOPEDPROFILE("Draw light backdrop"); + PK_NAMEDSCOPEDPROFILE_GPU(cmdBuff->ProfileEventContext(), "Directional light"); + + cmdBuff->BindRenderState(renderState); + cmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + + const bool envMapAffectsAmbient = (!m_EnvironmentMap.IsValid() || m_BackdropsData.m_EnvironmentMapPath.Empty()) ? false : m_BackdropsData.m_EnvironmentMapAffectsAmbient; + + const RHI::PConstantSet lightConstSets[] = + { + m_SceneInfoConstantSet, + lightInfo.m_LightsInfoConstantSet, + lightInfo.m_ShadowsInfoConstantSet, + m_BRDFLUTConstantSet, + envMapAffectsAmbient ? m_EnvironmentMap.GetIBLCubemapConstantSet() : m_EnvironmentMap.GetWhiteEnvMapConstantSet(), + m_GBuffer.m_LightingSamplersSet, + }; + + cmdBuff->BindConstantSets(lightConstSets); + cmdBuff->Draw(0, 6); +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_RenderMeshBackdrop(const RHI::PCommandBuffer &cmdBuff) +{ + PK_NAMEDSCOPEDPROFILE_GPU(cmdBuff->ProfileEventContext(), "Mesh backdrop"); + if (m_MeshBackdrop.m_MeshBatches.Empty()) + return; + + const bool useVertexColors = m_MeshBackdrop.m_HasVertexColors && m_BackdropsData.m_MeshVertexColorsMode != 0u; + + if (useVertexColors) + cmdBuff->BindRenderState(m_MeshRenderStateVertexColor); + else + cmdBuff->BindRenderState(m_MeshRenderState); + + const RHI::PConstantSet constSets[] = + { + m_SceneInfoConstantSet, + m_MeshBackdrop.m_ConstantSet + }; + + cmdBuff->BindConstantSets(constSets); + + SMeshVertexConstant meshVertexConstant; + const u32 instanceCount = m_MeshBackdrop.m_Transforms.Count(); + for (u32 iInstance = 0; iInstance < instanceCount; ++iInstance) + { + // Model matrix + const CFloat4x4 meshTransforms = m_MeshBackdrop.m_Transforms[iInstance]; + meshVertexConstant.m_ModelMatrix = meshTransforms; + // Normal matrix (same as model but without scale and translate) + const CFloat4x4 modelNoTranslate = CFloat4x4(meshTransforms.XAxis(), meshTransforms.YAxis(), meshTransforms.ZAxis(), CFloat4::WAXIS); + meshVertexConstant.m_NormalMatrix = modelNoTranslate.Inverse().Transposed(); + + cmdBuff->PushConstant(&meshVertexConstant, 0); + for (u32 j = 0, stop = (m_MeshBackdropFilteredSubmeshes.Empty() ? m_MeshBackdrop.m_MeshBatches.Count() : m_MeshBackdropFilteredSubmeshes.Count()); j < stop; ++j) + { + const u32 smidx = m_MeshBackdropFilteredSubmeshes.Empty() ? j : m_MeshBackdropFilteredSubmeshes[j]; + if (smidx >= m_MeshBackdrop.m_MeshBatches.Count()) // This can happen the frame the backdrop LOD changes in the mesh viewer + continue; + + const PKSample::SMesh::SMeshBatch &curBatch = m_MeshBackdrop.m_MeshBatches[smidx]; + RHI::PGpuBuffer vBuffer = null; + + // curBatch can be either static or skinned batch, most of the time it won't be animated + if (!PK_VERIFY(curBatch.m_Instances.Empty() || iInstance < curBatch.m_Instances.Count())) + continue; + // If this instance has valid skinned data, render with those vb, otherwise render the bindpose + if (curBatch.m_Instances.Empty() || !curBatch.m_Instances[iInstance].m_HasValidSkinnedData) + vBuffer = curBatch.m_BindPoseVertexBuffers; + else + vBuffer = curBatch.m_Instances[iInstance].m_SkinnedVertexBuffers; + + if (!PK_VERIFY(vBuffer != null && curBatch.m_BindPoseVertexBuffers != null)) + continue; + + const RHI::PGpuBuffer vertexBuffersWithColors[] = { vBuffer, vBuffer, vBuffer, curBatch.m_BindPoseVertexBuffers, curBatch.m_BindPoseVertexBuffers }; + const u32 offsetsWithColors[] = { curBatch.m_PositionsOffset, curBatch.m_NormalsOffset, curBatch.m_TangentsOffset, curBatch.m_TexCoordsOffset, curBatch.m_ColorsOffset }; + + const RHI::PGpuBuffer vertexBuffers[] = { vBuffer, vBuffer, vBuffer, curBatch.m_BindPoseVertexBuffers}; + const u32 offsets[] = { curBatch.m_PositionsOffset, curBatch.m_NormalsOffset, curBatch.m_TangentsOffset, curBatch.m_TexCoordsOffset}; + + if (useVertexColors) + cmdBuff->BindVertexBuffers(vertexBuffersWithColors, offsetsWithColors); + else + cmdBuff->BindVertexBuffers(vertexBuffers, offsets); + + cmdBuff->BindIndexBuffer(curBatch.m_IndexBuffer, 0, curBatch.m_IndexSize); + + cmdBuff->DrawIndexed(0, 0, curBatch.m_IndexCount); + } + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_RenderBackground(const RHI::PCommandBuffer &cmdBuff, bool clearOnly /*= false */) +{ + PK_NAMEDSCOPEDPROFILE("Draw background"); + PK_NAMEDSCOPEDPROFILE_GPU(cmdBuff->ProfileEventContext(), "Background"); + if (m_BackgroundTexture != null && !clearOnly) + { + cmdBuff->BindRenderState(m_CopyBackgroundColorRenderState); + cmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + cmdBuff->BindConstantSets(TMemoryView(m_BackgroundTextureConstantSet)); + cmdBuff->Draw(0, 6); + } + else + { + cmdBuff->BindRenderState(m_BrushBackgroundRenderState); + cmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + + // Update brush info data: + SBrushInfo *infos = (SBrushInfo*)m_ApiManager->MapCpuView(m_BrushInfoData); + if (!PK_VERIFY(infos != null)) + return; + + infos->m_TopColor = clearOnly ? CFloat4(0.f, 0.f, 0.f, m_DeferredMergingMinAlpha) : CFloat4(ConvertSRGBToLinear(m_BackdropsData.m_BackgroundColorTop), m_DeferredMergingMinAlpha); + infos->m_BottomColor = clearOnly ? CFloat4(0.f, 0.f, 0.f, m_DeferredMergingMinAlpha) : CFloat4(ConvertSRGBToLinear(m_BackdropsData.m_BackgroundColorBottom), m_DeferredMergingMinAlpha); + infos->m_CameraPosition = m_SceneInfoData.m_InvView.WAxis(); + CCoordinateFrame::BuildTransitionFrame(CCoordinateFrame::GlobalFrame(), Frame_RightHand_Y_Up, infos->m_UserToRHY); + infos->m_InvViewProj = m_SceneInfoData.m_InvViewProj; + infos->m_EnvironmentMapColor = CFloat4(ConvertSRGBToLinear(m_BackdropsData.m_EnvironmentMapColor) * m_BackdropsData.m_EnvironmentMapIntensity, 0); + infos->m_EnvironmentMapMipLvl = m_BackdropsData.m_EnvironmentMapBlur * m_EnvironmentMap.GetBackgroundMipmapCount(); + const bool envMapVisible = (!m_EnvironmentMap.IsValid() || m_BackdropsData.m_EnvironmentMapPath.Empty()) ? false : m_BackdropsData.m_BackgroundUsesEnvironmentMap; + infos->m_EnvironmentMapVisible = clearOnly ? 0 : static_cast(envMapVisible); + + m_ApiManager->UnmapCpuView(m_BrushInfoData); + // ------------ + + const RHI::PConstantSet brushConstantSets[] = { m_BrushInfoConstSet, envMapVisible ? m_EnvironmentMap.GetBackgroundCubemapConstantSet() : m_EnvironmentMap.GetIBLCubemapConstantSet() }; + cmdBuff->BindConstantSets(brushConstantSets, 0); + cmdBuff->Draw(0, 6); + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_UpdateShadowsBBox(CDirectionalShadows &shadow, const TArray &drawCalls) +{ + PK_SCOPEDPROFILE(); + for (u32 dcIdx = 0; dcIdx < drawCalls.Count(); ++dcIdx) + { + u32 neededConstants = 0; + PCRendererCacheInstance cacheInstance = null; + RHI::PRenderState newRenderState = null; + EShaderOptions shaderOptions = static_cast(drawCalls[dcIdx].m_ShaderOptions); + bool castShadows = false; + + //------------------------------------------------------ + // Retrieve renderer cache instance: + //------------------------------------------------------ + { + CRendererCacheInstance_UpdateThread *srcRendererCache = drawCalls[dcIdx].m_RendererCacheInstance.Get(); + if (srcRendererCache != null) + { + castShadows = srcRendererCache->CastShadows(); + cacheInstance = srcRendererCache->RenderThread_GetCacheInstance(); + if (cacheInstance != null) + { + const PRendererCache layout = cacheInstance->m_Cache; + if (layout != null) + newRenderState = layout->GetRenderState(shaderOptions, ParticlePass_Opaque, &neededConstants); + } + } + else + CLog::Log(PK_ERROR, "The renderer does not have a cache instance: some graphical resource creation must have failed"); + } + if (newRenderState != null) + shadow.AddBBox(drawCalls[dcIdx].m_BBox, CFloat4x4::IDENTITY, castShadows); + } +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_CreateFinalRenderStates( const TMemoryView frameBufferLayout, + const RHI::PRenderPass &renderPass, + u32 subPassIdx, + const SSamplableRenderTarget &prevPassOut) +{ + if (!_CreateFinalDebugRenderStates(frameBufferLayout, renderPass, subPassIdx, subPassIdx + 1)) + return false; + + // Final basic copy + if (!_CreateCopyRenderState(m_CopyColorRenderState, CopyCombination_Basic, frameBufferLayout, renderPass, subPassIdx + 1)) + return false; + if (!_CreateCopyRenderState(m_CopyDepthRenderState, CopyCombination_Depth, frameBufferLayout, renderPass, subPassIdx + 1)) + return false; + if (!_CreateCopyRenderState(m_CopyNormalRenderState, CopyCombination_Normal, frameBufferLayout, renderPass, subPassIdx + 1)) + return false; + if (!_CreateCopyRenderState(m_CopyNormalUnpackedRenderState, CopyCombination_UnpackedNormal, frameBufferLayout, renderPass, subPassIdx + 1)) + return false; + if (!_CreateCopyRenderState(m_CopySpecularRenderState, CopyCombination_Specular, frameBufferLayout, renderPass, subPassIdx + 1)) + return false; + if (!_CreateCopyRenderState(m_CopyAlphaRenderState, CopyCombination_Alpha, frameBufferLayout, renderPass, subPassIdx + 1)) + return false; + if (!_CreateCopyRenderState(m_CopyMulAddRenderState, CopyCombination_MulAdd, frameBufferLayout, m_FinalRenderPass, 2)) + return false; + + // Heat-map + { + m_OverdrawHeatmapRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Overdraw Render State")); + if (m_OverdrawHeatmapRenderState == null) + return false; + + RHI::SRenderState &renderState = m_OverdrawHeatmapRenderState->m_RenderState; + renderState.m_PipelineState.m_DynamicScissor = true; + renderState.m_PipelineState.m_DynamicViewport = true; + + if (!renderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + RHI::SConstantSetLayout setLayout(RHI::FragmentShaderMask); + setLayout.AddConstantsLayout(RHI::SConstantSamplerDesc("IntensityMap", RHI::SamplerTypeSingle)); + setLayout.AddConstantsLayout(RHI::SConstantSamplerDesc("OverdrawLUT", RHI::SamplerTypeSingle)); + + FillCopyShaderBindings(CopyCombination_Basic, renderState.m_ShaderBindings, setLayout); + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = FULL_SCREEN_QUAD_VERTEX_SHADER_PATH; + shadersPaths.m_Fragment = OVERDRAW_HEATMAP_FRAGMENT_SHADER_PATH; + + if (m_ShaderLoader->LoadShader(renderState, shadersPaths, m_ApiManager) == false) + return false; + if (!m_ApiManager->BakeRenderState(m_OverdrawHeatmapRenderState, frameBufferLayout, renderPass, subPassIdx + 1)) + return false; + + m_OverdrawConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Overdraw Constant Set") ,setLayout); + if (m_OverdrawConstantSet == null) + return false; + + STextureKey textureKey; + textureKey.m_Path = OVERDRAW_HEATMAP_LUT_TEXTURE_PATH; + CTextureManager::CResourceId textureId = CTextureManager::UpdateThread_GetResource(textureKey, SPrepareArg(null, null, null)); + if (!textureId.Valid()) + return false; + RHI::PTexture heatmapTexture = CTextureManager::RenderThread_ResolveResource(textureId, SCreateArg(m_ApiManager, null, m_ResourceManager, CString())); + if (heatmapTexture == null) + return false; + m_OverdrawConstantSet->SetConstants(m_DefaultSampler, prevPassOut.m_RenderTarget->GetTexture(), 0); + m_OverdrawConstantSet->SetConstants(m_DefaultSampler, heatmapTexture, 1); + m_OverdrawConstantSet->UpdateConstantValues(); + } + + // Gizmo + if (!m_GizmoDrawer.CreateRenderStates(m_ApiManager, *m_ShaderLoader, frameBufferLayout, renderPass, subPassIdx + 1)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_CreateTransparentBackdropRenderStates(TMemoryView frameBufferLayout, const RHI::PRenderPass &renderPass, u32 subPassIdx) +{ + // Background texture copy: + // ---------------------------------------------------------- + { + if (m_ApiManager->ApiName() == RHI::GApi_OpenGL || m_ApiManager->ApiName() == RHI::GApi_OES) + { + if (!_CreateCopyRenderState(m_CopyBackgroundColorRenderState, CopyCombination_FlippedBasic, frameBufferLayout, renderPass, subPassIdx)) + return false; + } + else + { + if (!_CreateCopyRenderState(m_CopyBackgroundColorRenderState, CopyCombination_Basic, frameBufferLayout, renderPass, subPassIdx)) + return false; + } + + m_BackgroundTextureConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Background Texture Constant Set"), m_DefaultSamplerConstLayout); + + if (m_BackgroundTextureConstantSet == null) + return false; + + if (m_BackgroundTexture != null) + { + m_BackgroundTextureConstantSet->SetConstants(m_DefaultSampler, m_BackgroundTexture, 0); + m_BackgroundTextureConstantSet->UpdateConstantValues(); + } + } + + // Brush background render state + // ---------------------------------------------------------- + { + m_BrushBackgroundRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Brush Background Render State")); + if (m_BrushBackgroundRenderState == null) + return false; + + RHI::SRenderState &renderState = m_BrushBackgroundRenderState->m_RenderState; + renderState.m_PipelineState.m_DynamicScissor = true; + renderState.m_PipelineState.m_DynamicViewport = true; + renderState.m_PipelineState.m_DepthWrite = false; + renderState.m_PipelineState.m_DepthTest = RHI::Equal; + + if (!renderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + RHI::SConstantSetLayout brushInfoConstSetLayout; + + CreateBrushBackdropInfoConstantSetLayout(brushInfoConstSetLayout); + FillBrushBackdropShaderBindings(renderState.m_ShaderBindings, brushInfoConstSetLayout, m_GBuffer.m_EnvironmentMapLayout); + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = FULL_SCREEN_QUAD_VERTEX_SHADER_PATH; + shadersPaths.m_Fragment = BRUSH_BACKDROP_FRAGMENT_SHADER_PATH; + + if (!m_ShaderLoader->LoadShader(renderState, shadersPaths, m_ApiManager) || + !m_ApiManager->BakeRenderState(m_BrushBackgroundRenderState, frameBufferLayout, renderPass, subPassIdx)) + return false; + + // We also create the brush backrop info buffer: + m_BrushInfoConstSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Brush Info Constant Set"), brushInfoConstSetLayout); + m_BrushInfoData = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Brush Info Buffer"), RHI::ConstantBuffer, sizeof(SBrushInfo)); + m_BrushInfoConstSet->SetConstants(m_BrushInfoData, 0); + m_BrushInfoConstSet->UpdateConstantValues(); + } + + // Grid: + // ---------------------------------------------------------- + { + m_GridRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Grid Render State")); + + if (m_GridRenderState == null) + return false; + + m_GridRenderState->m_RenderState.m_PipelineState.m_DynamicScissor = true; + m_GridRenderState->m_RenderState.m_PipelineState.m_DynamicViewport = true; + m_GridRenderState->m_RenderState.m_PipelineState.m_Blending = false; + m_GridRenderState->m_RenderState.m_PipelineState.m_DepthWrite = true; + m_GridRenderState->m_RenderState.m_PipelineState.m_DepthTest = RHI::LessOrEqual; + m_GridRenderState->m_RenderState.m_PipelineState.m_RasterizerMode = RHI::RasterizeSolid; + m_GridRenderState->m_RenderState.m_PipelineState.m_DrawMode = RHI::DrawModeLine; + + FillEditorDebugDrawShaderBindings(m_GridRenderState->m_RenderState.m_ShaderBindings, false, false); + + if (!m_GridRenderState->m_RenderState.m_InputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))).Valid()) + return false; + + CShaderLoader::SShadersPaths paths; + paths.m_Vertex = DEBUG_DRAW_VERTEX_SHADER_PATH; + paths.m_Fragment = DEBUG_DRAW_FRAGMENT_SHADER_PATH; + + if (!m_ShaderLoader->LoadShader(m_GridRenderState->m_RenderState, paths, m_ApiManager) || + !m_ApiManager->BakeRenderState(m_GridRenderState, frameBufferLayout, renderPass, subPassIdx)) + return false; + } + + // Misc: + // m_LinesRenderStateAdditive + { + m_LinesRenderStateAdditive = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("DebugDrawLinesAdditive Render State")); + if (m_LinesRenderStateAdditive == null) + return false; + RHI::SRenderState &renderState = m_LinesRenderStateAdditive->m_RenderState; + + renderState.m_PipelineState.m_DynamicViewport = true; + renderState.m_PipelineState.m_DynamicScissor = true; + renderState.m_PipelineState.m_DepthTest = RHI::NoTest; + renderState.m_PipelineState.m_DepthWrite = false; + renderState.m_PipelineState.m_Blending = true; + renderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + renderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + renderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + renderState.m_PipelineState.m_DrawMode = RHI::DrawModeLine; + + PK_ASSERT(renderState.m_InputVertexBuffers.Empty()); + if (!PK_VERIFY(renderState.m_InputVertexBuffers.Resize(2))) + return false; + renderState.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat3); + renderState.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat4); + + PKSample::FillEditorDebugDrawShaderBindings(renderState.m_ShaderBindings, true, false); + PKSample::CShaderLoader::SShadersPaths paths; + paths.m_Vertex = DEBUG_DRAW_VERTEX_SHADER_PATH; + paths.m_Fragment = DEBUG_DRAW_FRAGMENT_SHADER_PATH; + if (!m_ShaderLoader->LoadShader(m_LinesRenderStateAdditive->m_RenderState, paths, m_ApiManager) || + !m_ApiManager->BakeRenderState(m_LinesRenderStateAdditive, frameBufferLayout, renderPass, subPassIdx)) + return false; + } + + // m_LinesRenderStateOpaque + { + m_LinesRenderStateOpaque = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("DebugDrawLinesOpaque Render State")); + if (m_LinesRenderStateOpaque == null) + return false; + RHI::SRenderState &renderState = m_LinesRenderStateOpaque->m_RenderState; + + renderState.m_PipelineState.m_DynamicViewport = true; + renderState.m_PipelineState.m_DynamicScissor = true; + renderState.m_PipelineState.m_DepthTest = RHI::LessOrEqual; + renderState.m_PipelineState.m_DepthWrite = true; + renderState.m_PipelineState.m_Blending = false; + renderState.m_PipelineState.m_DrawMode = RHI::DrawModeLine; + + PK_ASSERT(renderState.m_InputVertexBuffers.Empty()); + if (!PK_VERIFY(renderState.m_InputVertexBuffers.Resize(2))) + return false; + renderState.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat3); + renderState.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat4); + + PKSample::FillEditorDebugDrawShaderBindings(renderState.m_ShaderBindings, true, false); + PKSample::CShaderLoader::SShadersPaths paths; + paths.m_Vertex = DEBUG_DRAW_VERTEX_SHADER_PATH; + paths.m_Fragment = DEBUG_DRAW_FRAGMENT_SHADER_PATH; + if (!m_ShaderLoader->LoadShader(m_LinesRenderStateOpaque->m_RenderState, paths, m_ApiManager) || + !m_ApiManager->BakeRenderState(m_LinesRenderStateOpaque, frameBufferLayout, renderPass, subPassIdx)) + return false; + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_CreateOpaqueBackdropRenderStates(TMemoryView frameBufferLayout, const RHI::PRenderPass &renderPass, u32 subPassIdx) +{ + // Mesh: + // ---------------------------------------------------------- + // We need the constant set layout to create the render state: + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = GBUFFER_VERTEX_SHADER_PATH; + shadersPaths.m_Fragment = GBUFFER_FRAGMENT_SHADER_PATH; + + // This constant set doesn't change wether vertex colors are used or not + CreateGBufferConstSetLayouts(GBufferCombination_Diffuse_RoughMetal_Normal, m_MeshConstSetLayout); + + m_MeshRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Mesh Backdrop Render State")); + m_MeshRenderStateVertexColor = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Mesh Backdrop Vertex Color Render State")); + + if (m_MeshRenderState == null || m_MeshRenderStateVertexColor == null) + return false; + + // Pipeline state + { + const ECoordinateFrame drawFrame = m_CoordinateFrame; + const ECoordinateFrame meshFrame = m_MeshBackdrop.m_MeshBatchCoordinateFrame; + const bool drawRightHanded = CCoordinateFrame::IsRightHanded(drawFrame); + const bool flippedHandedness = CCoordinateFrame::IsRightHanded(meshFrame) != drawRightHanded; + + m_MeshRenderState->m_RenderState.m_PipelineState.m_DynamicScissor = true; + m_MeshRenderState->m_RenderState.m_PipelineState.m_DynamicViewport = true; + m_MeshRenderState->m_RenderState.m_PipelineState.m_DepthWrite = true; + m_MeshRenderState->m_RenderState.m_PipelineState.m_DepthTest = RHI::Less; + m_MeshRenderState->m_RenderState.m_PipelineState.m_CullMode = RHI::CullBackFaces; + m_MeshRenderState->m_RenderState.m_PipelineState.m_PolyOrder = (drawRightHanded ^ flippedHandedness) ? RHI::FrontFaceCounterClockWise : RHI::FrontFaceClockWise; + + if (!m_MeshRenderState->m_RenderState.m_InputVertexBuffers.Resize(4)) + return false; + + m_MeshRenderState->m_RenderState.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat3); + m_MeshRenderState->m_RenderState.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat3); + m_MeshRenderState->m_RenderState.m_InputVertexBuffers[2].m_Stride = sizeof(CFloat4); + m_MeshRenderState->m_RenderState.m_InputVertexBuffers[3].m_Stride = sizeof(CFloat2); + + FillGBufferShaderBindings(m_MeshRenderState->m_RenderState.m_ShaderBindings, m_SceneInfoConstantSetLayout, m_MeshConstSetLayout, false, true); + + m_MeshRenderState->m_RenderState.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + m_MeshRenderState->m_RenderState.m_ShaderBindings.m_InputAttributes[1].m_BufferIdx = 1; + m_MeshRenderState->m_RenderState.m_ShaderBindings.m_InputAttributes[2].m_BufferIdx = 2; + m_MeshRenderState->m_RenderState.m_ShaderBindings.m_InputAttributes[3].m_BufferIdx = 3; + + if (!m_ShaderLoader->LoadShader(m_MeshRenderState->m_RenderState, shadersPaths, m_ApiManager)) + return false; + if (!m_ApiManager->BakeRenderState(m_MeshRenderState, frameBufferLayout, renderPass, subPassIdx)) + return false; + } + + // Pipeline state vertex color + { + m_MeshRenderStateVertexColor->m_RenderState = m_MeshRenderState->m_RenderState; + + if (!m_MeshRenderStateVertexColor->m_RenderState.m_InputVertexBuffers.Resize(5)) + return false; + + m_MeshRenderStateVertexColor->m_RenderState.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat3); + m_MeshRenderStateVertexColor->m_RenderState.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat3); + m_MeshRenderStateVertexColor->m_RenderState.m_InputVertexBuffers[2].m_Stride = sizeof(CFloat4); + m_MeshRenderStateVertexColor->m_RenderState.m_InputVertexBuffers[3].m_Stride = sizeof(CFloat2); + m_MeshRenderStateVertexColor->m_RenderState.m_InputVertexBuffers[4].m_Stride = sizeof(CFloat4); + + FillGBufferShaderBindings(m_MeshRenderStateVertexColor->m_RenderState.m_ShaderBindings, m_SceneInfoConstantSetLayout, m_MeshConstSetLayout, true, true); + + m_MeshRenderStateVertexColor->m_RenderState.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + m_MeshRenderStateVertexColor->m_RenderState.m_ShaderBindings.m_InputAttributes[1].m_BufferIdx = 1; + m_MeshRenderStateVertexColor->m_RenderState.m_ShaderBindings.m_InputAttributes[2].m_BufferIdx = 2; + m_MeshRenderStateVertexColor->m_RenderState.m_ShaderBindings.m_InputAttributes[3].m_BufferIdx = 3; + m_MeshRenderStateVertexColor->m_RenderState.m_ShaderBindings.m_InputAttributes[4].m_BufferIdx = 4; + + if (!m_ShaderLoader->LoadShader(m_MeshRenderStateVertexColor->m_RenderState, shadersPaths, m_ApiManager)) + return false; + if (!m_ApiManager->BakeRenderState(m_MeshRenderStateVertexColor, frameBufferLayout, renderPass, subPassIdx)) + return false; + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_CreateCopyRenderState( RHI::PRenderState &renderState, + ECopyCombination combination, + const TMemoryView &frameBufferLayout, + const RHI::PRenderPass &renderPass, + u32 subPassIdx) +{ + renderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Copy Render State")); + if (renderState == null) + return false; + RHI::SRenderState &debugCopyRenderState = renderState->m_RenderState; + debugCopyRenderState.m_PipelineState.m_DynamicScissor = true; + debugCopyRenderState.m_PipelineState.m_DynamicViewport = true; + + if (!debugCopyRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + debugCopyRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillCopyShaderBindings(combination, debugCopyRenderState.m_ShaderBindings, m_DefaultSamplerConstLayout); + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = FULL_SCREEN_QUAD_VERTEX_SHADER_PATH; + shadersPaths.m_Fragment = COPY_FRAGMENT_SHADER_PATH; + + if (m_ShaderLoader->LoadShader(debugCopyRenderState, shadersPaths, m_ApiManager) == false) + return false; + if (!m_ApiManager->BakeRenderState(renderState, frameBufferLayout, renderPass, subPassIdx)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_CreateGridGeometry(float size, u32 subdiv, u32 secondSubdiv, const CFloat4x4 &transforms, ECoordinateFrame coordinateFrame) +{ + bool success = true; + + const u32 gridVtxCount = 4 + 4 * subdiv; + const u32 gridSubdivVtxCount = 4 * subdiv * secondSubdiv; + m_GridVertices = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Grid Vertex Buffer"), RHI::VertexBuffer, (gridVtxCount + gridSubdivVtxCount) * sizeof(CFloat3)); + + m_GridIdxCount = 8 + 4 * subdiv; + m_GridSubdivIdxCount = 4 * subdiv * secondSubdiv; + + // FIXME(Julien): Will break down as soon as 'subdiv + subdiv * secondSubdiv' >= 16383 + m_GridIndices = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Grid Index Buffer"), RHI::IndexBuffer, (m_GridIdxCount + m_GridSubdivIdxCount) * sizeof(u16)); + + if (m_GridVertices == null || m_GridIndices == null) + return false; + + // We map the buffers: + CFloat3 *vertices = reinterpret_cast(m_ApiManager->MapCpuView(m_GridVertices)); + u16 *indices = reinterpret_cast(m_ApiManager->MapCpuView(m_GridIndices)); + + if (vertices == null || indices == null) + return false; + + const float halfSize = size / 2.0f; + + // We start by creating the frame of the grid: + const CFloat3 &halfSizeForward = CCoordinateFrame::Axis(Axis_Forward, coordinateFrame) * halfSize; + const CFloat3 &halfSizeSide = CCoordinateFrame::Axis(Axis_Right, coordinateFrame) * halfSize; + + vertices[0] = transforms.TransformVector(-halfSizeSide - halfSizeForward); + vertices[1] = transforms.TransformVector(-halfSizeSide + halfSizeForward); + vertices[2] = transforms.TransformVector( halfSizeSide + halfSizeForward); + vertices[3] = transforms.TransformVector( halfSizeSide - halfSizeForward); + + // Quad: + indices[0] = 0; + indices[1] = 1; + indices[2] = 1; + indices[3] = 2; + indices[4] = 2; + indices[5] = 3; + indices[6] = 3; + indices[7] = 0; + + u32 currentVertexIdx = 4; + u32 currentIndexIdx = 8; + + // We divide each side by the subdiv count: + for (u32 i = 0; i < subdiv; ++i) + { + float currentLerpRatio = (1.0f / static_cast(subdiv)) * (i + 1); + + // Then we lerp between the 4 sides: + // Horizontal side = 0 - 3 and 1 - 2 + vertices[currentVertexIdx + 0] = vertices[0].Lerp(vertices[3], currentLerpRatio); + vertices[currentVertexIdx + 1] = vertices[1].Lerp(vertices[2], currentLerpRatio); + // Link those 2 points: + indices[currentIndexIdx + 0] = currentVertexIdx + 0; + indices[currentIndexIdx + 1] = currentVertexIdx + 1; + // Vertical side = 1 - 0 and 2 - 3 + vertices[currentVertexIdx + 2] = vertices[1].Lerp(vertices[0], currentLerpRatio); + vertices[currentVertexIdx + 3] = vertices[2].Lerp(vertices[3], currentLerpRatio); + // Link those 2 points: + indices[currentIndexIdx + 2] = currentVertexIdx + 2; + indices[currentIndexIdx + 3] = currentVertexIdx + 3; + // Increment + currentVertexIdx += 4; + currentIndexIdx += 4; + } + + // Second subdivision: + CFloat3 previousSubdiv[4] = + { + vertices[0], + vertices[1], + vertices[1], + vertices[2], + }; + + for (u32 i = 0; i < subdiv; ++i) + { + CFloat3 currentSubdiv[4]; + float currentLerpRatio = (1.0f / static_cast(subdiv)) * (i + 1); + + // Then we lerp between the 4 sides: + // Horizontal side = 0 - 3 and 1 - 2 + currentSubdiv[0] = vertices[0].Lerp(vertices[3], currentLerpRatio); + currentSubdiv[1] = vertices[1].Lerp(vertices[2], currentLerpRatio); + // Vertical side = 1 - 0 and 2 - 3 + currentSubdiv[2] = vertices[1].Lerp(vertices[0], currentLerpRatio); + currentSubdiv[3] = vertices[2].Lerp(vertices[3], currentLerpRatio); + + // Create the second subdivision: + for (u32 j = 0; j < secondSubdiv; ++j) + { + float secondaryLerpRatio = (1.0f / static_cast(secondSubdiv)) * (j + 1); + vertices[currentVertexIdx + 0] = previousSubdiv[0].Lerp(currentSubdiv[0], secondaryLerpRatio); + vertices[currentVertexIdx + 1] = previousSubdiv[1].Lerp(currentSubdiv[1], secondaryLerpRatio); + indices[currentIndexIdx + 0] = currentVertexIdx + 0; + indices[currentIndexIdx + 1] = currentVertexIdx + 1; + vertices[currentVertexIdx + 2] = previousSubdiv[2].Lerp(currentSubdiv[2], secondaryLerpRatio); + vertices[currentVertexIdx + 3] = previousSubdiv[3].Lerp(currentSubdiv[3], secondaryLerpRatio); + indices[currentIndexIdx + 2] = currentVertexIdx + 2; + indices[currentIndexIdx + 3] = currentVertexIdx + 3; + // Increment + currentVertexIdx += 4; + currentIndexIdx += 4; + } + for (u32 j = 0; j < 4; ++j) + { + previousSubdiv[j] = currentSubdiv[j]; + } + } + + PK_ASSERT(m_GridIdxCount + m_GridSubdivIdxCount == currentIndexIdx); + PK_ASSERT(gridVtxCount + gridSubdivVtxCount == currentVertexIdx); + + success &= m_ApiManager->UnmapCpuView(m_GridVertices); + success &= m_ApiManager->UnmapCpuView(m_GridIndices); + return success; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_DrawDebugLines(const RHI::PCommandBuffer &cmdBuff, const TMemoryView &positions, const TMemoryView &colors, SLinePointsColorBuffer &buffer, RHI::PRenderState &renderState) +{ + if (!PK_VERIFY(positions.Count() == colors.Count()) || + positions.Empty()) + return; + + const u32 bufferBytePositionsCount = positions.CoveredBytes(); + const u32 bufferByteColorCount = colors.CoveredBytes(); + + if (buffer.m_LinesPointsBuffer == null || buffer.m_LinesPointsBuffer->GetByteSize() < bufferBytePositionsCount) + buffer.m_LinesPointsBuffer = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Lines Points Vertex Buffer"), RHI::VertexBuffer, bufferBytePositionsCount); + + if (buffer.m_LinesColorBuffer == null || buffer.m_LinesColorBuffer->GetByteSize() < bufferByteColorCount) + buffer.m_LinesColorBuffer = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Lines Colors Vertex Buffer"), RHI::VertexBuffer, bufferByteColorCount); + + if (buffer.m_LinesPointsBuffer != null && buffer.m_LinesColorBuffer != null) + { + { + void *mappedPtr = m_ApiManager->MapCpuView(buffer.m_LinesPointsBuffer); + if (PK_VERIFY(mappedPtr != null)) + { + Mem::Copy(mappedPtr, positions.Data(), bufferBytePositionsCount); + m_ApiManager->UnmapCpuView(buffer.m_LinesPointsBuffer); + } + } + { + void *mappedPtr = m_ApiManager->MapCpuView(buffer.m_LinesColorBuffer); + if (PK_VERIFY(mappedPtr != null)) + { + Mem::Copy(mappedPtr, colors.Data(), bufferByteColorCount); + m_ApiManager->UnmapCpuView(buffer.m_LinesColorBuffer); + } + } + + cmdBuff->BindRenderState(renderState); + cmdBuff->BindConstantSets(TMemoryView(m_SceneInfoConstantSet)); + cmdBuff->BindVertexBuffers(TMemoryView(&buffer.m_LinesPointsBuffer, 2)); + + cmdBuff->Draw(0, positions.Count()); + } +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_AddRenderPassesToGraphicResourceManagerIFN() +{ + if (SPassDescription::s_PassDescriptions.Empty()) + { + const bool hasDifferentRenderPasses = (m_InitializedRP & InitRP_Bloom) != 0; + const RHI::PFrameBuffer &beforeBloomFrameBuffer = hasDifferentRenderPasses ? m_BeforeBloomFrameBuffer : m_FinalFrameBuffers.First(); + const RHI::PRenderPass &beforeBloomRenderPass = hasDifferentRenderPasses ? m_BeforeBloomRenderPass : m_FinalRenderPass; + + SPassDescription::s_PassDescriptions.Resize(__MaxParticlePass); + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + // Default Opaque + SPassDescription::s_PassDescriptions[ParticlePass_Opaque].m_FrameBufferLayout = beforeBloomFrameBuffer->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Opaque].m_RenderPass = beforeBloomRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Opaque].m_SubPassIdx = m_GBuffer.m_GBufferSubPassIdx; + // Default Opaque Shadow + SPassDescription::s_PassDescriptions[ParticlePass_OpaqueShadow].m_FrameBufferLayout = m_Lights.m_DirectionalShadows.GetFrameBufferLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_OpaqueShadow].m_RenderPass = m_Lights.m_DirectionalShadows.GetRenderPass(); + SPassDescription::s_PassDescriptions[ParticlePass_OpaqueShadow].m_SubPassIdx = m_Lights.m_DirectionalShadows.GetShadowSubpassIdx(); + // Default Decals + SPassDescription::s_PassDescriptions[ParticlePass_Decal].m_FrameBufferLayout = beforeBloomFrameBuffer->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Decal].m_RenderPass = m_BeforeBloomRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Decal].m_SubPassIdx = m_GBuffer.m_DecalSubPassIdx; + // Pass Lighting + SPassDescription::s_PassDescriptions[ParticlePass_Lighting].m_FrameBufferLayout = beforeBloomFrameBuffer->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Lighting].m_RenderPass = beforeBloomRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Lighting].m_SubPassIdx = m_GBuffer.m_LightingSubPassIdx; + // Pass Additive + SPassDescription::s_PassDescriptions[ParticlePass_Transparent].m_FrameBufferLayout = beforeBloomFrameBuffer->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Transparent].m_RenderPass = beforeBloomRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Transparent].m_SubPassIdx = m_GBuffer.m_MergingSubPassIdx; + } + else + { + // Default Opaque + SPassDescription::s_PassDescriptions[ParticlePass_Opaque].m_FrameBufferLayout.Clear(); + SPassDescription::s_PassDescriptions[ParticlePass_Opaque].m_RenderPass = null; + SPassDescription::s_PassDescriptions[ParticlePass_Opaque].m_SubPassIdx.Clear(); + // Default Decals + SPassDescription::s_PassDescriptions[ParticlePass_Decal].m_FrameBufferLayout.Clear(); + SPassDescription::s_PassDescriptions[ParticlePass_Decal].m_RenderPass = null; + SPassDescription::s_PassDescriptions[ParticlePass_Decal].m_SubPassIdx.Clear(); + // Pass Lighting + SPassDescription::s_PassDescriptions[ParticlePass_Lighting].m_FrameBufferLayout.Clear(); + SPassDescription::s_PassDescriptions[ParticlePass_Lighting].m_RenderPass = null; + SPassDescription::s_PassDescriptions[ParticlePass_Lighting].m_SubPassIdx.Clear(); + // Pass Additive + SPassDescription::s_PassDescriptions[ParticlePass_Transparent].m_FrameBufferLayout = beforeBloomFrameBuffer->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Transparent].m_RenderPass = beforeBloomRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Transparent].m_SubPassIdx = m_BasicRenderingSubPassIdx; + } + + if ((m_InitializedRP & InitRP_Distortion) != 0) + { + // Pass Distortion + SPassDescription::s_PassDescriptions[ParticlePass_Distortion].m_FrameBufferLayout = beforeBloomFrameBuffer->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Distortion].m_RenderPass = beforeBloomRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Distortion].m_SubPassIdx = m_Distortion.m_DistoSubPassIdx; + + // After distortion: + SPassDescription::s_PassDescriptions[ParticlePass_TransparentPostDisto].m_FrameBufferLayout = beforeBloomFrameBuffer->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_TransparentPostDisto].m_RenderPass = beforeBloomRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_TransparentPostDisto].m_SubPassIdx = m_Distortion.m_PostDistortionSubPassIdx; + + // Tinting: + SPassDescription::s_PassDescriptions[ParticlePass_Tint].m_FrameBufferLayout = beforeBloomFrameBuffer->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Tint].m_RenderPass = beforeBloomRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Tint].m_SubPassIdx = m_Distortion.m_PostDistortionSubPassIdx; + } + else + { + // Pass Distortion + SPassDescription::s_PassDescriptions[ParticlePass_Distortion].m_FrameBufferLayout.Clear(); + SPassDescription::s_PassDescriptions[ParticlePass_Distortion].m_RenderPass = null; + SPassDescription::s_PassDescriptions[ParticlePass_Distortion].m_SubPassIdx.Clear(); + + SPassDescription::s_PassDescriptions[ParticlePass_TransparentPostDisto].m_FrameBufferLayout.Clear(); + SPassDescription::s_PassDescriptions[ParticlePass_TransparentPostDisto].m_RenderPass = null; + SPassDescription::s_PassDescriptions[ParticlePass_TransparentPostDisto].m_SubPassIdx.Clear(); + + SPassDescription::s_PassDescriptions[ParticlePass_Tint].m_FrameBufferLayout.Clear(); + SPassDescription::s_PassDescriptions[ParticlePass_Tint].m_RenderPass = null; + SPassDescription::s_PassDescriptions[ParticlePass_Tint].m_SubPassIdx.Clear(); + } + + if ((m_InitializedRP & InitRP_Debug) != 0) + { + // Pass Debug + SPassDescription::s_PassDescriptions[ParticlePass_Debug].m_FrameBufferLayout = m_FinalFrameBuffers.First()->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Debug].m_RenderPass = m_FinalRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Debug].m_SubPassIdx = m_ParticleDebugSubpassIdx; + // Pass Compositing / UI + SPassDescription::s_PassDescriptions[ParticlePass_Compositing].m_FrameBufferLayout = m_FinalFrameBuffers.First()->GetLayout(); + SPassDescription::s_PassDescriptions[ParticlePass_Compositing].m_RenderPass = m_FinalRenderPass; + SPassDescription::s_PassDescriptions[ParticlePass_Compositing].m_SubPassIdx = m_ParticleDebugSubpassIdx + 1; + } + else + { + // Pass Debug + SPassDescription::s_PassDescriptions[ParticlePass_Debug].m_FrameBufferLayout.Clear(); + SPassDescription::s_PassDescriptions[ParticlePass_Debug].m_RenderPass = null; + SPassDescription::s_PassDescriptions[ParticlePass_Debug].m_SubPassIdx.Clear(); + // Pass Compositing / UI + SPassDescription::s_PassDescriptions[ParticlePass_Compositing].m_FrameBufferLayout.Clear(); + SPassDescription::s_PassDescriptions[ParticlePass_Compositing].m_RenderPass = null; + SPassDescription::s_PassDescriptions[ParticlePass_Compositing].m_SubPassIdx.Clear(); + } + } + + return true; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_FillGBufferInOut(CGBuffer::SInOutRenderTargets &inOut) +{ + inOut.m_SamplableDiffuseRtIdx = GBufferRTIdx(SPassDescription::GBufferRT_Diffuse); + inOut.m_SamplableDiffuseRt = &GBufferRT(SPassDescription::GBufferRT_Diffuse); + inOut.m_SamplableDepthRtIdx = GBufferRTIdx(SPassDescription::GBufferRT_Depth); + inOut.m_SamplableDepthRt = &GBufferRT(SPassDescription::GBufferRT_Depth); + inOut.m_OpaqueRTsIdx = m_GBufferRTsIdx; + inOut.m_OpaqueRTs = m_GBufferRTs; + if (_IsLastRenderPass(InitRP_GBuffer)) + { + // We can directly merge in the swap chain render targets + inOut.m_OutputRtIdx = 0; + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_FillDistortionInOut(CPostFxDistortion::SInOutRenderTargets &inOut) +{ + if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + inOut.m_ToDistordRtIdx = m_GBuffer.m_MergeBufferIndex; + inOut.m_ToDistordRt = &m_GBuffer.m_Merge; + inOut.m_DepthRtIdx = m_GBuffer.m_DepthBufferIndex; + inOut.m_ParticleInputs = m_GBufferRTsIdx; + } + else + { + inOut.m_ToDistordRtIdx = m_BasicRenderingRTIdx; + inOut.m_ToDistordRt = &m_BasicRenderingRT; + // No depth buffre because no opaque geom + no particle inputs because no GBuffers to sample + } + if (_IsLastRenderPass(InitRP_Distortion)) + { + // We can directly output the distorded buffer in the swap chain render target + inOut.m_OutputRtIdx = 0; + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_FillBloomInOut(CPostFxBloom::SInOutRenderTargets &inOut) +{ + if ((m_InitializedRP & InitRP_Distortion) != 0) + { + inOut.m_InputRenderTarget = &m_Distortion.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + inOut.m_InputRenderTarget = &m_GBuffer.m_Merge; + } + else + { + inOut.m_InputRenderTarget = &m_BasicRenderingRT; + } + if (_IsLastRenderPass(InitRP_Bloom)) + { + inOut.m_OutputRenderTargets = m_FinalRenderTargets; + } + else + { + inOut.m_OutputRenderTargets = TMemoryView(inOut.m_InputRenderTarget->m_RenderTarget); + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_FillTonemappingInOut(CPostFxToneMapping::SInOutRenderTargets &inOut) +{ + const bool isDifferentRenderPass = (m_InitializedRP & InitRP_Bloom) != 0; + + if ((m_InitializedRP & InitRP_Distortion) != 0) + { + if (!isDifferentRenderPass) + inOut.m_ToTonemapRtIdx = m_Distortion.m_OutputBufferIdx; + inOut.m_ToTonemapRt = &m_Distortion.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + if (!isDifferentRenderPass) + inOut.m_ToTonemapRtIdx = m_GBuffer.m_MergeBufferIndex; + inOut.m_ToTonemapRt = &m_GBuffer.m_Merge; + } + else + { + if (!isDifferentRenderPass) + inOut.m_ToTonemapRtIdx = m_BasicRenderingRTIdx; + inOut.m_ToTonemapRt = &m_BasicRenderingRT; + } + if (_IsLastRenderPass(InitRP_ToneMapping)) + { + // We can directly output the tonemapped buffer in the swap chain render target + inOut.m_OutputRtIdx = 0; + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_FillColorRemapInOut(CPostFxColorRemap::SInOutRenderTargets &inOut) +{ + if ((m_InitializedRP & InitRP_ToneMapping) != 0) + { + inOut.m_InputRenderTargetIdx = m_ToneMapping.m_OutputRenderTargetIdx; + inOut.m_InputRenderTarget = &m_ToneMapping.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_Distortion) != 0) + { + inOut.m_InputRenderTargetIdx = m_Distortion.m_DistoBufferIdx; + inOut.m_InputRenderTarget = &m_Distortion.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + inOut.m_InputRenderTargetIdx = m_GBuffer.m_MergeBufferIndex;; + inOut.m_InputRenderTarget = &m_GBuffer.m_Merge; + } + else + { + inOut.m_InputRenderTargetIdx = m_BasicRenderingRTIdx; + inOut.m_InputRenderTarget = &m_BasicRenderingRT; + } + + if (_IsLastRenderPass(InitRP_ColorRemap)) + { + // We can directly output the color remapped buffer in the swap chain render target + inOut.m_OutputRenderTargetIdx = 0; + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_FillDebugInOut(SSamplableRenderTarget &prevPassOut, CGuid &prevPassOutIdx) +{ + const bool isDifferentRenderPass = (m_InitializedRP & InitRP_Bloom) != 0; + + if ((m_InitializedRP & InitRP_FXAA) != 0) + { + prevPassOutIdx = m_FXAA.m_OutputRenderTargetIdx; + prevPassOut = m_FXAA.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_ColorRemap) != 0) + { + prevPassOutIdx = m_ColorRemap.m_OutputRenderTargetIdx; + prevPassOut = m_ColorRemap.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_ToneMapping) != 0) + { + prevPassOutIdx = m_ToneMapping.m_OutputRenderTargetIdx; + prevPassOut = m_ToneMapping.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_Distortion) != 0) + { + if (!isDifferentRenderPass) + prevPassOutIdx = m_Distortion.m_OutputBufferIdx; + prevPassOut = m_Distortion.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + if (!isDifferentRenderPass) + prevPassOutIdx = m_GBuffer.m_MergeBufferIndex; + prevPassOut = m_GBuffer.m_Merge; + } + else + { + if (!isDifferentRenderPass) + prevPassOutIdx = m_BasicRenderingRTIdx; + prevPassOut = m_BasicRenderingRT; + } +} + +//---------------------------------------------------------------------------- + +void CRHIParticleSceneRenderHelper::_FillFXAAInOut(CPostFxFXAA::SInOutRenderTargets &inOut) +{ + const bool isDifferentRenderPass = (m_InitializedRP & InitRP_FXAA) != 0; + + if ((m_InitializedRP & InitRP_ColorRemap) != 0) + { + inOut.m_InputRtIdx = m_ColorRemap.m_OutputRenderTargetIdx; + inOut.m_InputRt = &m_ColorRemap.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_ToneMapping) != 0) + { + inOut.m_InputRtIdx = m_ToneMapping.m_OutputRenderTargetIdx; + inOut.m_InputRt = &m_ToneMapping.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_Distortion) != 0) + { + if (!isDifferentRenderPass) + inOut.m_InputRtIdx = m_Distortion.m_OutputBufferIdx; + inOut.m_InputRt = &m_Distortion.m_OutputRenderTarget; + } + else if ((m_InitializedRP & InitRP_GBuffer) != 0) + { + if (!isDifferentRenderPass) + inOut.m_InputRtIdx = m_GBuffer.m_MergeBufferIndex; + inOut.m_InputRt = &m_GBuffer.m_Merge; + } + else + { + if (!isDifferentRenderPass) + inOut.m_InputRtIdx = m_BasicRenderingRTIdx; + inOut.m_InputRt = &m_BasicRenderingRT; + } + if (_IsLastRenderPass(InitRP_FXAA)) + { + inOut.m_OutputRtIdx = 0; + } +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_IsLastRenderPass(EInitRenderPasses renderPass) const +{ + const u32 bitIdx = IntegerTools::Log2(static_cast(renderPass)); + const u32 nextRenderPasses = (~0U) << (bitIdx + 1); + return (m_InitializedRP & nextRenderPasses) == 0; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleSceneRenderHelper::_EndRenderPass(EInitRenderPasses renderPass, const RHI::PCommandBuffer &cmdBuff) const +{ + if (_IsLastRenderPass(renderPass)) + { + cmdBuff->EndRenderPass(); + return true; + } + return false; +} + +//---------------------------------------------------------------------------- + +RHI::PRenderTarget CRHIParticleSceneRenderHelper::_GetRenderTarget(ERenderTargetDebug target) +{ + RHI::PRenderTarget rt = null; + switch (target) + { + case RenderTargetDebug_Diffuse: + rt = GBufferRT(SPassDescription::GBufferRT_Diffuse).m_RenderTarget; + break; + case RenderTargetDebug_Depth: + rt = GBufferRT(SPassDescription::GBufferRT_Depth).m_RenderTarget; + break; + case RenderTargetDebug_Normal: + rt = m_GBuffer.m_NormalRoughMetal.m_RenderTarget; + break; + case RenderTargetDebug_NormalUnpacked: + rt = m_GBuffer.m_NormalRoughMetal.m_RenderTarget; + break; + case RenderTargetDebug_Roughness: + rt = m_GBuffer.m_NormalRoughMetal.m_RenderTarget; + break; + case RenderTargetDebug_Metalness: + rt = m_GBuffer.m_NormalRoughMetal.m_RenderTarget; + break; + case RenderTargetDebug_LightAccum: + rt = m_GBuffer.m_LightAccu.m_RenderTarget; + break; + case RenderTargetDebug_PostMerge: + rt = m_GBuffer.m_Merge.m_RenderTarget; + break; + case RenderTargetDebug_Distortion: + rt = m_Distortion.m_DistoRenderTarget.m_RenderTarget; + break; + default: + rt = m_BeforeDebugOutputRt.m_RenderTarget; + break; + } + + if (!PK_VERIFY(m_ApiManager != null)) + return null; + + return rt; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RHIRenderParticleSceneHelpers.h b/Samples/PK-SampleLib/RHIRenderParticleSceneHelpers.h new file mode 100644 index 00000000..e581cae7 --- /dev/null +++ b/Samples/PK-SampleLib/RHIRenderParticleSceneHelpers.h @@ -0,0 +1,664 @@ +#pragma once + +#include "PKSample.h" + +#include +#include + +// Render passes: +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// Debug draw shaders: +#define DEBUG_DRAW_VERTEX_SHADER_PATH "./Shaders/DebugDraw.vert" +#define DEBUG_DRAW_FRAGMENT_SHADER_PATH "./Shaders/DebugDrawColor.frag" +// Debug draw shaders: +#define DEBUG_DRAW_VALUE_VERTEX_SHADER_PATH "./Shaders/DebugDrawValue.vert" +#define DEBUG_DRAW_VALUE_FRAGMENT_SHADER_PATH "./Shaders/DebugDrawValue.frag" +#define DEBUG_DRAW_LINE_VERTEX_SHADER_PATH "./Shaders/DebugDrawLine.vert" +#define DEBUG_DRAW_LINE_FRAGMENT_SHADER_PATH "./Shaders/DebugDrawLine.frag" +// Draw for the post-fx: +#define FULL_SCREEN_QUAD_VERTEX_SHADER_PATH "./Shaders/FullScreenQuad.vert" +#define COPY_FRAGMENT_SHADER_PATH "./Shaders/Copy.frag" +// Additional resources for the overdraw rendering: +#define OVERDRAW_HEATMAP_FRAGMENT_SHADER_PATH "./Shaders/Heatmap.frag" +#define OVERDRAW_HEATMAP_LUT_TEXTURE_PATH "./Textures/Overdraw.dds" + +#define BRUSH_BACKDROP_FRAGMENT_SHADER_PATH "./Shaders/BrushBackdrop.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SSceneInfoData; + +//---------------------------------------------------------------------------- + +struct SGizmoFlags +{ + bool m_Enabled; + EGizmoType m_Mode; + bool m_LocalSpace; + bool m_Snap; + u8 m_SnapPrecision; + + SGizmoFlags() + : m_Enabled(true) + , m_Mode(GizmoNone) + , m_LocalSpace(false) + , m_Snap(false) + , m_SnapPrecision(3) + { + } +}; + +//---------------------------------------------------------------------------- + +struct SParticleSceneOptions +{ + struct SDistortion + { + bool m_Enable; + float m_DistortionIntensity; + CFloat4 m_ChromaticAberrationMultipliers; + + bool operator == (const SDistortion &oth) const + { + return m_Enable == oth.m_Enable && m_DistortionIntensity == oth.m_DistortionIntensity && m_ChromaticAberrationMultipliers == oth.m_ChromaticAberrationMultipliers; + } + + SDistortion() : m_Enable(true), m_DistortionIntensity(1.0f), m_ChromaticAberrationMultipliers(0.01f, 0.0125f, 0.015f, 0.0175f) {} + + } m_Distortion; + + struct SBloom + { + bool m_Enable; + float m_BrightPassValue; + float m_Intensity; + float m_Attenuation; + EGaussianBlurCombination m_BlurTap; + u32 m_RenderPassCount; + + SBloom() + : m_Enable(true) + , m_BrightPassValue(1.0f) + , m_Intensity(1.0f) + , m_Attenuation(1.0f) + , m_BlurTap(GaussianBlurCombination_9_Tap) + , m_RenderPassCount(6) + { + } + + bool operator == (const SBloom &oth) const + { + return m_Enable == oth.m_Enable && + m_BrightPassValue == oth.m_BrightPassValue && + m_Intensity == oth.m_Intensity && + m_Attenuation == oth.m_Attenuation && + m_BlurTap == oth.m_BlurTap && + m_RenderPassCount == oth.m_RenderPassCount; + } + } m_Bloom; + + struct SToneMapping + { + bool m_Enable; + float m_Exposure; + float m_Saturation; + + SToneMapping() : m_Enable(true), m_Exposure(-0.336472f), m_Saturation(1.f) {} // ln(x / 1.4f) + + bool operator == (const SToneMapping &oth) const + { + return m_Enable == oth.m_Enable && + m_Exposure == oth.m_Exposure && + m_Saturation == oth.m_Saturation; + } + } m_ToneMapping; + + struct SVignetting + { + CFloat3 m_Color; + float m_ColorIntensity; + float m_DesaturationIntensity; + float m_Roundness; + float m_Smoothness; + + SVignetting() : m_Color(0.f), m_ColorIntensity(0.1f), m_DesaturationIntensity(0.1f), m_Roundness(1.f), m_Smoothness(1.f) {} + + bool operator == (const SVignetting &oth) const + { + return m_Color == oth.m_Color && + m_ColorIntensity == oth.m_ColorIntensity && + m_DesaturationIntensity == oth.m_DesaturationIntensity && + m_Roundness == oth.m_Roundness && + m_Smoothness == oth.m_Smoothness; + } + } m_Vignetting; + + struct SColorRemap + { + bool m_Enable = true; + bool m_ForceSRGBToLinear = false; + CString m_RemapTexturePath; + + bool operator == (const SColorRemap &oth) const + { + return m_Enable == oth.m_Enable && + m_ForceSRGBToLinear == oth.m_ForceSRGBToLinear && + m_RemapTexturePath == oth.m_RemapTexturePath; + } + } m_ColorRemap; + + struct SFXAA + { + bool m_Enable; + bool m_LumaInAlpha; + + SFXAA() : m_Enable(false), m_LumaInAlpha(true) {} + + bool operator == (const SFXAA &oth) const + { + return m_Enable == oth.m_Enable && + m_LumaInAlpha == oth.m_LumaInAlpha; + } + } m_FXAA; + + bool m_Dithering = false; + + bool operator == (const SParticleSceneOptions &oth) const + { + return m_Distortion == oth.m_Distortion && + m_Bloom == oth.m_Bloom && + m_ToneMapping == oth.m_ToneMapping && + m_Vignetting == oth.m_Vignetting && + m_FXAA == oth.m_FXAA && + m_Dithering == oth.m_Dithering; + } +}; + +//---------------------------------------------------------------------------- + +struct SShadowOptions +{ + bool m_EnableShadows = true; + bool m_EnableDebugShadows = false; + float m_ShadowBias = 0.005f; + bool m_EnableVarianceShadows = true; + float m_ShadowVarianceExponent = 10.0f; + CUint2 m_CascadeShadowResolution = CUint2(1024); + CFloat4 m_CascadeShadowSceneRangeRatios = CFloat4(0.15f, 0.2f, 0.25f, 0.4f); + CFloat4 m_CascadeShadowMinDistances = CFloat4(5, 10, 20, 40); + + bool operator == (const SShadowOptions &oth) const + { + return m_EnableShadows == oth.m_EnableShadows && + m_EnableDebugShadows == oth.m_EnableDebugShadows && + m_ShadowBias == oth.m_ShadowBias && + m_EnableVarianceShadows == oth.m_EnableVarianceShadows && + m_ShadowVarianceExponent == oth.m_ShadowVarianceExponent && + m_CascadeShadowResolution == oth.m_CascadeShadowResolution && + m_CascadeShadowSceneRangeRatios == oth.m_CascadeShadowSceneRangeRatios && + m_CascadeShadowMinDistances == oth.m_CascadeShadowMinDistances; + } +}; + +//---------------------------------------------------------------------------- + +struct SBackdropsData +{ + class CLight + { + public: + CLight() { } + + void SetAmbient(const CFloat3 &color, float intensity = 1.0f); + void SetDirectional(const CFloat3 &direction, const CFloat3 &color, float intensity = 1.0f); + void SetSpot(const CFloat3 &position, const CFloat3 &direction, float angle, float coneFalloff, const CFloat3 &color, float intensity = 1.0f); + void SetPoint(const CFloat3 &position, const CFloat3 &color, float intensity = 1.0f); + + SLightRenderPass::ELightType Type() const { return m_Type; } + const CFloat3 &Position() const { return m_Position; } + const CFloat3 &Direction() const { return m_Direction; } + float Angle() const { return m_Angle; } + float ConeFalloff() const { return m_ConeFalloff; } + const CFloat3 &Color() const { return m_Color; } + float Intensity() const { return m_Intensity; } + + private: + SLightRenderPass::ELightType m_Type = SLightRenderPass::Ambient; + + CFloat3 m_Position = CFloat3::ZERO; // Not used for directional and ambient + CFloat3 m_Direction = CFloat3::ZERO; // Not used for point and ambient + float m_Angle = 0.0f; // Only for spotlights + float m_ConeFalloff = 0.0f; // Only for spotlights + + CFloat3 m_Color = CFloat3::ZERO; + float m_Intensity = 0.0f; + }; + + bool m_ShowGrid = false; + u32 m_BackdropGridVersion = 0; // This is incremented each time the backdrops actually change. Avoids having to make inefficient and ineffective compares + float m_GridSize = 1; + u32 m_GridSubdivisions = 1; + u32 m_GridSubSubdivisions = 1; + CFloat4 m_GridColor = CFloat4(0.9f, 0.9f, 0.9f, 1.0f); + CFloat4 m_GridSubColor = CFloat4(0.2f, 0.2f, 0.2f, 1.0f); + CFloat4x4 m_GridTransforms = CFloat4x4::IDENTITY; + + bool m_ShowMesh = false; + bool m_FollowInstances = false; + bool m_CastShadows = false; + CString m_MeshPath; + CGuid m_MeshLOD = 0; + CString m_MeshDiffusePath; + PCImage m_MeshDiffuseData; // can be null, in which case will be loaded using 'm_MeshDiffusePath' + CString m_MeshNormalPath; + PCImage m_MeshNormalData; + CString m_MeshRoughMetalPath; + PCImage m_MeshRoughMetalData; + float m_MeshRoughness = 1.0f; + float m_MeshMetalness = 0.0f; + u32 m_MeshVertexColorsMode = 0; // 0: no vertex color, 1: color, 2: alpha + u32 m_MeshVertexColorsSet = 0; + CFloat4x4 m_MeshBackdropTransforms = CFloat4x4::IDENTITY; + TSemiDynamicArray m_MeshFilteredSubmeshes; + + TArray m_FXInstancesTransforms; + TArray m_FXInstancesSkinnedDatas; + + TArray m_Lights; + + CString m_EnvironmentMapPath; + float m_EnvironmentMapIntensity = 1.0f; + CFloat3 m_EnvironmentMapColor = CFloat3::ONE; + float m_EnvironmentMapRotation = 0.0f; + + CFloat3 m_BackgroundColorTop = CFloat3::ZERO; + CFloat3 m_BackgroundColorBottom = CFloat3::ZERO; + bool m_BackgroundUsesEnvironmentMap = false; + bool m_EnvironmentMapAffectsAmbient = false; + float m_EnvironmentMapBlur = 0.0f; + + // Temp scaffolding: Shadow config, this should ideally be per-light, for now only have a single one + SShadowOptions m_ShadowOptions; + + SBackdropsData() { } + + bool IsGridSameGeometry(const SBackdropsData &oth) const + { + return m_GridSize == oth.m_GridSize && + m_GridSubdivisions == oth.m_GridSubdivisions && + m_GridSubSubdivisions == oth.m_GridSubSubdivisions && + m_GridTransforms == oth.m_GridTransforms; + } +}; + +//---------------------------------------------------------------------------- + +class CRHIParticleSceneRenderHelper +{ +public: + enum EInitRenderPasses + { + InitRP_GBuffer = (1U << 0U), // Do not render opaque geometry + InitRP_Distortion = (1U << 1U), // Do not render the distortion + InitRP_Bloom = (1U << 2U), // Do not render the bloom + InitRP_ToneMapping = (1U << 3U), // Do not render the tone-mapping + InitRP_ColorRemap = (1U << 4U), // Do not render the color remap + InitRP_FXAA = (1U << 5U), // Do not render the FXAA + InitRP_Debug = (1U << 6U), // Do not render the debug render passes + __InitRP_Count = 7U, + InitRP_All = ~((~0U) << __InitRP_Count), + InitRP_AllExceptBloom = InitRP_All ^ InitRP_Bloom, + InitRP_None = 0, + }; + + enum ERenderTargetDebug + { + RenderTargetDebug_NoDebug = 0, + RenderTargetDebug_Diffuse, + RenderTargetDebug_Depth, + RenderTargetDebug_Normal, + RenderTargetDebug_NormalUnpacked, + RenderTargetDebug_Roughness, + RenderTargetDebug_Metalness, + RenderTargetDebug_LightAccum, + RenderTargetDebug_Distortion, + RenderTargetDebug_PostMerge, + RenderTargetDebug_ShadowCascades, + __MaxRenderTargets, + }; + + CRHIParticleSceneRenderHelper(); + virtual ~CRHIParticleSceneRenderHelper(); + + // Init and update: + bool Init( const RHI::PApiManager &apiManager, + CShaderLoader *shaderLoader, + CResourceManager *resourceManager, + u32 initRP = InitRP_All); + bool Resize(TMemoryView finalRts); + + bool SetupPostFX_Distortion(const SParticleSceneOptions::SDistortion &config, bool firstInit); + bool SetupPostFX_Bloom(const SParticleSceneOptions::SBloom &config, bool firstInit, bool swapChainChanged); + bool SetupPostFX_ToneMapping(const SParticleSceneOptions::SToneMapping &config, const SParticleSceneOptions::SVignetting &configVignetting, bool dithering, bool firstInit, bool precomputeLuma = true); + bool SetupPostFX_ColorRemap(const SParticleSceneOptions::SColorRemap &config, bool firstInit); + bool SetupPostFX_FXAA(const SParticleSceneOptions::SFXAA &config, bool firstInit, bool lumaInAlpha = true); + bool SetupShadows(); + + void EnablePostFX(bool enabled) { m_EnablePostFX = enabled; } + bool PostFXEnabled() const { return m_EnablePostFX; } + bool PostFXEnabled_Distortion() const { return m_EnablePostFX && m_EnableDistortion; } + bool PostFXEnabled_Bloom() const { return m_EnablePostFX && m_EnableBloom; } + bool PostFXEnabled_ToneMapping() const { return m_EnablePostFX && m_EnableToneMapping; } + bool PostFXEnabled_ColorRemap() const { return m_EnablePostFX && m_EnableColorRemap; } + bool PostFXEnabled_FXAA() const { return m_EnablePostFX && m_EnableFXAA; } + + void EnableBrushBackground(bool enabled) { m_EnableBrushBackground = enabled; } + + void SetDeferredMergingMinAlpha(float minAlpha) { m_DeferredMergingMinAlpha = minAlpha; } + + bool SetSceneInfo(const SSceneInfoData &sceneInfoData, ECoordinateFrame coordinateFrame); + bool SetBackdropInfo(const SBackdropsData &backdropData, ECoordinateFrame coordinateFrame); + const SBackdropsData &GetBackdropsInfo() const { return m_BackdropsData; } + const RHI::PConstantSet &GetSceneInfoConstantSet() const { return m_SceneInfoConstantSet; } + + void SetCurrentPackResourceManager(CResourceManager *resourceManager); + + void SetBackGroundColor(const CFloat3 &top, const CFloat3 &bottom); + void SetBackGroundTexture(const RHI::PTexture &background); + CGBuffer &GetDeferredSetup(); + + RHI::PFrameBuffer GetFinalFrameBuffers(u32 index) { return m_FinalFrameBuffers[index]; } + + PKSample::CEnvironmentMap &GetEnvironmentMap() { return m_EnvironmentMap; } + PKSample::SBackdropsData &GetBackDropsData() { return m_BackdropsData; } + + // Render: + bool RenderScene(ERenderTargetDebug renderTargetDebug, + const SRHIDrawOutputs &drawOutputs, + u32 finalRtIdx); + + virtual bool DrawOnDebugBuffer(const RHI::PCommandBuffer &cmdBuff) { (void)cmdBuff; return true; } + virtual bool DrawOnFinalBuffer(const RHI::PCommandBuffer &cmdBuff) { (void)cmdBuff; return true; } + virtual bool GenerateGUI(const SRHIDrawOutputs &drawOutputs) { (void)drawOutputs; return true; } + + void BindMiscLinesOpaque(const TMemoryView &positions, const TMemoryView &colors); + void BindMiscLinesAdditive(const TMemoryView &positions, const TMemoryView &colors); +// void BindMiscTrisOpaque(const TMemoryView &positions, const TMemoryView &colors, const TMemoryView &indices); +// void BindMiscTrisAdditive(const TMemoryView &positions, const TMemoryView &colors, const TMemoryView &indices); + + const SSamplableRenderTarget &GBufferRT(SPassDescription::EGBufferRT renderTargetType) const { PK_ASSERT(renderTargetType < SPassDescription::__GBufferRTCount); return m_GBufferRTs[static_cast(renderTargetType)]; } + const CGuid GBufferRTIdx(SPassDescription::EGBufferRT renderTargetType) const { PK_ASSERT(renderTargetType < SPassDescription::__GBufferRTCount); return m_GBufferRTsIdx[static_cast(renderTargetType)]; } + const RHI::PGpuBuffer &SceneInfoBuffer() const { return m_SceneInfoConstantBuffer; } + + void ClearMiscGeom(); + +protected: + //Debug Draw Functions + virtual void _RenderMeshBackdropDebug(const RHI::PCommandBuffer &cmdBuff); + virtual bool _CullParticleDraw(bool debug, PKSample::ESampleLibGraphicResources_RenderPass renderPass, const PKSample::SRHIDrawCall &drawCall, bool validRenderState); + virtual RHI::PRenderState _GetDebugRenderState( PKSample::ESampleLibGraphicResources_RenderPass renderPass, + const PKSample::SRHIDrawCall &drawCall, + PKSample::EShaderOptions shaderOptions, + PKSample::ESampleLibGraphicResources_RenderPass *cacheRenderPass); + virtual bool _CreateFinalDebugRenderStates( TMemoryView frameBufferLayout, + RHI::PRenderPass renderPass, + CGuid mergeSubPassIdx, CGuid finalSubPassIdx); + virtual bool _BindDebugVertexBuffer(const PKSample::SRHIDrawCall &drawCall, const RHI::PCommandBuffer &cmdBuff); + virtual bool _BindDebugConstantSets(const RHI::PRenderState &renderState, const PKSample::SRHIDrawCall &drawCall, TStaticCountedArray &constantSets); + + // Render the draw-calls: + void _RenderParticles( bool debugMode, + CRenderPassArray renderPass, + const TArray &drawCalls, + const RHI::PCommandBuffer &cmdBuff, + const RHI::PConstantSet &sceneInfo = null); + void _RenderGridBackdrop(const RHI::PCommandBuffer &cmdBuff); + void _RenderMeshBackdrop(const RHI::PCommandBuffer &cmdBuff); + void _RenderEditorMisc(const RHI::PCommandBuffer &cmdBuff); + void _RenderBackground(const RHI::PCommandBuffer &cmdBuff, bool clearOnly = false); + + // Update Shadow BBox: + void _UpdateShadowsBBox(CDirectionalShadows &shadow, const TArray &drawCalls); + + RHI::PRenderTarget _GetRenderTarget(ERenderTargetDebug target); + + RHI::PApiManager m_ApiManager; + CShaderLoader *m_ShaderLoader; + + // Resource manager for Editor resources only + CResourceManager *m_ResourceManager; + CResourceManager *m_CurrentPackResourceManager; + + // Scene info constant set: + RHI::PGpuBuffer m_SceneInfoConstantBuffer; + RHI::SConstantSetLayout m_SceneInfoConstantSetLayout; + RHI::PConstantSet m_SceneInfoConstantSet; + + bool m_EnableParticleRender; + bool m_EnableBackdropRender; + bool m_EnableOverdrawRender; + bool m_EnableBrushBackground; + bool m_EnablePostFX; + + float m_DeferredMergingMinAlpha = 1.0f; + + // Default single sampler constant set layout to sample render targets: + RHI::SConstantSetLayout m_DefaultSamplerConstLayout; + RHI::PConstantSampler m_DefaultSampler; + RHI::PConstantSampler m_DefaultSamplerNearest; + + // Render passes: + TStaticArray m_GBufferRTs; + TStaticArray m_GBufferRTsIdx; + + TArray m_BeforeBloomClearValues; + RHI::PFrameBuffer m_BeforeBloomFrameBuffer; + RHI::PRenderPass m_BeforeBloomRenderPass; + // Opaque GBuffer: + CGBuffer m_GBuffer; + // Distortion: + bool m_EnableDistortion; // distortion is inside the m_DeferredSetup + CPostFxDistortion m_Distortion; + // Bloom: + bool m_EnableBloom; + CPostFxBloom m_Bloom; + EGaussianBlurCombination m_BlurTap; + // Tone mapping: + bool m_EnableToneMapping; + CPostFxToneMapping m_ToneMapping; + // Color remap: + bool m_EnableColorRemap; + CPostFxColorRemap m_ColorRemap; + // FXAA: + bool m_EnableFXAA; + CPostFxFXAA m_FXAA; + + struct SBrushInfo + { + CFloat4 m_TopColor; + CFloat4 m_BottomColor; + CFloat4 m_CameraPosition; + CFloat4x4 m_UserToRHY; + CFloat4x4 m_InvViewProj; + CFloat4 m_EnvironmentMapColor; + float m_EnvironmentMapMipLvl; + u32 m_EnvironmentMapVisible; + float m_EnvironmentMapRotation; + }; + + RHI::PRenderState m_BrushBackgroundRenderState; // Bush background (in the GBuffer) + RHI::PGpuBuffer m_BrushInfoData; + RHI::PConstantSet m_BrushInfoConstSet; + // -> Pass 2: Bloom (multi-pass) + + enum EFinalFrameBuffer + { + kMaxSwapChainSize = 3, + }; + + // -> Pass 3: Final and blit in screen + TArray m_FinalClearValues; + RHI::PRenderPass m_FinalRenderPass; + TStaticCountedArray m_FinalFrameBuffers; + TStaticCountedArray m_FinalRenderTargets; + +protected: + RHI::PRenderState m_OverdrawHeatmapRenderState; // Overdraw + RHI::PConstantSet m_OverdrawConstantSet; // Overdraw + RHI::PRenderState m_CopyColorRenderState; // copy + + RHI::PRenderState m_CopyBackgroundColorRenderState; // Can be used instead of brush + + RHI::PRenderState m_CopyDepthRenderState; // Debug copy + RHI::PRenderState m_CopyNormalRenderState; // Debug copy + RHI::PRenderState m_CopyNormalUnpackedRenderState; // Debug copy + RHI::PRenderState m_CopySpecularRenderState; // Debug copy + RHI::PRenderState m_CopyAlphaRenderState; // Debug copy + RHI::PRenderState m_CopyMulAddRenderState; // Debug copy + + SSamplableRenderTarget m_BeforeDebugOutputRt; + CGuid m_BeforeDebugOutputRtIdx; + + CGuid m_ParticleDebugSubpassIdx; + + CUint2 m_ViewportSize; + + SSceneInfoData m_SceneInfoData; // Current scene info + ECoordinateFrame m_CoordinateFrame; + + // Backdrop data: + SBackdropsData m_BackdropsData; + + SSamplableRenderTarget m_BasicRenderingRT; // Render target used when there is no GBuffer enabled + CGuid m_BasicRenderingRTIdx; // Will be zero + CGuid m_BasicRenderingSubPassIdx; + + RHI::PTexture m_BackgroundTexture; + RHI::PConstantSet m_BackgroundTextureConstantSet; + + PKSample::CEnvironmentMap m_EnvironmentMap; + + RHI::PConstantSet m_BRDFLUTConstantSet; + + RHI::PTexture m_DummyWhite; + RHI::PConstantSet m_DummyWhiteConstantSet; + RHI::PTexture m_DummyBlack; + RHI::PConstantSet m_DummyBlackConstantSet; + RHI::PTexture m_DummyNormal; + + CConstantAtlas m_DummyAtlas; + + CConstantNoiseTexture m_NoiseTexture; + + // Grid: + RHI::PGpuBuffer m_GridVertices; + RHI::PGpuBuffer m_GridIndices; + u32 m_GridIdxCount; + u32 m_GridSubdivIdxCount; + + RHI::PRenderState m_GridRenderState; + + // Mesh: + SMesh m_MeshBackdrop; + RHI::PGpuBuffer m_MeshTransformBuffer; + TArray m_MeshBackdropFilteredSubmeshes; + + RHI::SConstantSetLayout m_MeshConstSetLayout; + RHI::PRenderState m_MeshRenderState; + RHI::PRenderState m_MeshRenderStateVertexColor; + + // Misc: + struct SLinePointsColorBuffer + { + RHI::PGpuBuffer m_LinesPointsBuffer; + RHI::PGpuBuffer m_LinesColorBuffer; + }; + RHI::PRenderState m_LinesRenderStateAdditive; + RHI::PRenderState m_LinesRenderStateOpaque; + SLinePointsColorBuffer m_LinesPointsColorBufferAdditive; + SLinePointsColorBuffer m_LinesPointsColorBufferOpaque; + + TMemoryView m_MiscLinesOpaque_Position; + TMemoryView m_MiscLinesOpaque_Color; + TMemoryView m_MiscLinesAdditive_Position; + TMemoryView m_MiscLinesAdditive_Color; + + void _DrawDebugLines(const RHI::PCommandBuffer &cmdBuff, const TMemoryView &positions, const TMemoryView &colors, SLinePointsColorBuffer &buffer, RHI::PRenderState &renderState); + + // Lights: + SLightRenderPass m_Lights; + SShadowOptions m_ShadowOptions; + + // Gizmo rendering: + CGizmoDrawer m_GizmoDrawer; + + // Render passes initialized: + u32 m_InitializedRP; + +private: + // Update buffer for mesh backdrop infos + void _UpdateMeshBackdropInfos(); + + // Update the lights constant sets: + bool _UpdateBackdropLights(const SBackdropsData &backdrop); + // Draw the lights (full screen quad): + void _RenderBackdropLights(const RHI::PCommandBuffer &cmdBuff, const SLightRenderPass &lightInfo, const RHI::PRenderState &renderState); + + // Create the graphic resources: + bool _CreateFinalRenderStates( const TMemoryView frameBufferLayout, + const RHI::PRenderPass &renderPass, + u32 subPassIdx, + const SSamplableRenderTarget &prevPassOut); + bool _CreateOpaqueBackdropRenderStates( TMemoryView frameBufferLayout, + const RHI::PRenderPass &renderPass, + u32 subPassIdx); + bool _CreateTransparentBackdropRenderStates( TMemoryView frameBufferLayout, + const RHI::PRenderPass &renderPass, + u32 subPassIdx); + + bool _CreateCopyRenderState( RHI::PRenderState &renderState, + ECopyCombination combination, + const TMemoryView &frameBufferLayout, + const RHI::PRenderPass &renderPass, + u32 subPassIdx); + bool _CreateGridGeometry(float size, u32 subdiv, u32 secondSubdiv, const CFloat4x4 &transforms, ECoordinateFrame coordinateFrame); + //Add render pass to the graphic resource manager: + bool _AddRenderPassesToGraphicResourceManagerIFN(); + + void _FillGBufferInOut(CGBuffer::SInOutRenderTargets &inOut); + void _FillDistortionInOut(CPostFxDistortion::SInOutRenderTargets &inOut); + void _FillBloomInOut(CPostFxBloom::SInOutRenderTargets &inOut); + void _FillTonemappingInOut(CPostFxToneMapping::SInOutRenderTargets &inOut); + void _FillColorRemapInOut(CPostFxColorRemap::SInOutRenderTargets &inOut); + void _FillDebugInOut(SSamplableRenderTarget &prevPassOut, CGuid &prevPassOutIdx); + void _FillFXAAInOut(CPostFxFXAA::SInOutRenderTargets &inOut); + + bool _IsLastRenderPass(EInitRenderPasses renderPass) const; + bool _EndRenderPass(EInitRenderPasses renderPass, const RHI::PCommandBuffer &cmdBuff) const; + +private: + typedef FastDelegate CbPostRenderOpaque; + + CbPostRenderOpaque m_PostRenderOpaque; + +public: + CbPostRenderOpaque &GetPostOpaque() { return m_PostRenderOpaque; } +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.cpp new file mode 100644 index 00000000..50c398c9 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.cpp @@ -0,0 +1,191 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "FeatureRenderingSettings.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +HBO_CLASS_DEFINITION_BEGIN(CRHIRenderingSettings) + .HBO_FIELD_DEFINITION(RenderingFeatures) +HBO_CLASS_DEFINITION_END + +//---------------------------------------------------------------------------- + +CRHIRenderingSettings::CRHIRenderingSettings() +: HBO_CONSTRUCT(CRHIRenderingSettings) +{ +} + +//---------------------------------------------------------------------------- + +CRHIRenderingSettings::~CRHIRenderingSettings() +{ +} + +//---------------------------------------------------------------------------- + +const char *CRHIRenderingSettings::DisplayName() const +{ + return "Rendering Features"; +} + +//---------------------------------------------------------------------------- + +CRHIRenderingFeature *CRHIRenderingSettings::FindFeature(const CString &name) +{ + for (u32 i = 0; i < RenderingFeatures().Count(); ++i) + { + if (RenderingFeatures()[i] != null && RenderingFeatures()[i]->FeatureName() == name) + return RenderingFeatures()[i]; + } + return null; +} + +//---------------------------------------------------------------------------- + +PCRHIRenderingFeature CRHIRenderingSettings::FindFeature(const CString &name) const +{ + for (u32 i = 0; i < RenderingFeatures().Count(); ++i) + { + if (RenderingFeatures()[i] != null && RenderingFeatures()[i]->FeatureName() == name) + return RenderingFeatures()[i].Get(); + } + return null; +} + +//---------------------------------------------------------------------------- +// +// CRHIRenderingFeature +// +//---------------------------------------------------------------------------- + +HBO_CLASS_DEFINITION_BEGIN(CRHIRenderingFeature) +.Category("Internal") + .HBO_FIELD_DEFINITION(FeatureName) + [ + HBO::Properties::Description("Name of the renderer feature target") + ] +.Category("General") + .HBO_FIELD_DEFINITION(UseUV) + [ + HBO::Properties::Description("UVs are needed for this feature"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(UseNormal) + [ + HBO::Properties::Description("Normals are needed for this feature"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(UseTangent) + [ + HBO::Properties::Description("Tangents are needed for this feature"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(UseMeshUV1) + [ + HBO::Properties::Description("Secondary UVs are needed for this feature (only for mesh renderer)"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(UseMeshVertexColor0) + [ + HBO::Properties::Description("Primary colors are needed for this feature (only for mesh renderer)"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(UseMeshVertexColor1) + [ + HBO::Properties::Description("Secondary colors are needed for this feature (only for mesh renderer)"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(UseMeshVertexBonesIndicesAndWeights) + [ + HBO::Properties::Description("Bones indices and weights are accessible in the vertex shader (only for mesh renderer)"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(SampleDepth) + [ + HBO::Properties::Description("Need depth texture for shading"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(SampleNormalRoughMetal) + [ + HBO::Properties::Description("Need the packed normal / roughness / metalness texture for shading"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(SampleDiffuse) + [ + HBO::Properties::Description("Need normal texture for shading"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(UseSceneLightingInfo) + [ + HBO::Properties::Description("Need scene lights info"), + HBO::Properties::DefaultValue(false) + ] + .HBO_FIELD_DEFINITION(PropertiesAsShaderConstants) + [ + HBO::Properties::Description("Properties needed in shader") + ] + .HBO_FIELD_DEFINITION(TexturesUsedAsLookUp) + [ + HBO::Properties::Description("Textures that do not need the sRGB gamma correction when sampled.") + ] +HBO_CLASS_DEFINITION_END + +//---------------------------------------------------------------------------- + +CRHIRenderingFeature::CRHIRenderingFeature() +: HBO_CONSTRUCT(CRHIRenderingFeature) +{ +} + +//---------------------------------------------------------------------------- + +CRHIRenderingFeature::~CRHIRenderingFeature() +{ +} + +//---------------------------------------------------------------------------- +// +// CRHIMaterialShaders +// +//---------------------------------------------------------------------------- + +HBO_CLASS_DEFINITION_BEGIN(CRHIMaterialShaders) + // NOTE: If you rename these paths, or add other paths, make sure to update 'CCoreUpgrader::_UpgradeCoreFileBufferInPlace()' + .HBO_FIELD_DEFINITION(VertexShader) + [ + HBO::Properties::Caracs(HBO::Caracs_Path), + HBO::Properties::Description("Vertex shader path") + ] + .HBO_FIELD_DEFINITION(FragmentShader) + [ + HBO::Properties::Caracs(HBO::Caracs_Path), + HBO::Properties::Description("Fragment shader path") + ] +HBO_CLASS_DEFINITION_END + +//---------------------------------------------------------------------------- + +CRHIMaterialShaders::CRHIMaterialShaders() +: HBO_CONSTRUCT(CRHIMaterialShaders) +{ +} + +//---------------------------------------------------------------------------- + +CRHIMaterialShaders::~CRHIMaterialShaders() +{ +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.h b/Samples/PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.h new file mode 100644 index 00000000..4130e0b2 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.h @@ -0,0 +1,129 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +PK_FORWARD_DECLARE(RHIRenderingSettings); +PK_FORWARD_DECLARE(RHIRenderingFeature); +PK_FORWARD_DECLARE(RHIMaterialShaders); + +//---------------------------------------------------------------------------- +// Keep this object definition in-sync with 'AssetBaker_EditorMaterialProxy.h' + +class HBO_CLASS(CRHIRenderingSettings), public CBaseSettings +{ + HBO_FIELD(TArray, RenderingFeatures); + +public: + CRHIRenderingSettings(); + ~CRHIRenderingSettings(); + + virtual const char *DisplayName() const override; + + CRHIRenderingFeature *FindFeature(const CString &name); + PCRHIRenderingFeature FindFeature(const CString &name) const; + +public: + HBO_CLASS_DECLARATION(); +}; + +//---------------------------------------------------------------------------- +// Keep this object definition in-sync with 'AssetBaker_EditorMaterialProxy.h' + +class HBO_CLASS(CRHIRenderingFeature), public CBaseObject +{ + HBO_FIELD(CString, FeatureName); + HBO_FIELD(bool, UseUV); + HBO_FIELD(bool, UseNormal); + HBO_FIELD(bool, UseTangent); + HBO_FIELD(bool, UseMeshUV1); + HBO_FIELD(bool, UseMeshVertexColor0); + HBO_FIELD(bool, UseMeshVertexColor1); + HBO_FIELD(bool, UseMeshVertexBonesIndicesAndWeights); + HBO_FIELD(bool, SampleDepth); + HBO_FIELD(bool, SampleNormalRoughMetal); + HBO_FIELD(bool, SampleDiffuse); + HBO_FIELD(bool, UseSceneLightingInfo); + + HBO_FIELD(TArray, PropertiesAsShaderConstants); + HBO_FIELD(TArray, TexturesUsedAsLookUp); + +public: + CRHIRenderingFeature(); + ~CRHIRenderingFeature(); + +public: + HBO_CLASS_DECLARATION(); +}; + +//---------------------------------------------------------------------------- + +struct SRenderingFeature +{ + CStringId m_FeatureName; + PCRHIRenderingFeature m_Settings; + + SRenderingFeature(const CStringId &name, PCRHIRenderingFeature settings) + : m_FeatureName(name) + , m_Settings(settings) + { + } +}; + +//---------------------------------------------------------------------------- +// This is a helper to gather all rendering features and depending on the shader combination used +// we can enable or disable some features: + +struct SToggledRenderingFeature : public SRenderingFeature +{ + bool m_Mandatory; + bool m_Enabled; + + SToggledRenderingFeature(const SRenderingFeature &feature, bool mandatory, bool enabled) + : SRenderingFeature(feature.m_FeatureName, feature.m_Settings) + , m_Mandatory(mandatory) + , m_Enabled(enabled) + { + } + + SToggledRenderingFeature(const CStringId &name, PCRHIRenderingFeature settings, bool mandatory, bool enabled) + : SRenderingFeature(name, settings) + , m_Mandatory(mandatory) + , m_Enabled(enabled) + { + } +}; + +//---------------------------------------------------------------------------- +// Keep this object definition in-sync with 'AssetBaker_EditorMaterialProxy.h' + +class HBO_CLASS(CRHIMaterialShaders), public CBaseObject +{ + HBO_FIELD(CString, VertexShader); + HBO_FIELD(CString, FragmentShader); + +public: + CRHIMaterialShaders(); + ~CRHIMaterialShaders(); + +public: + HBO_CLASS_DECLARATION(); +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/FrameCollector.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/FrameCollector.cpp new file mode 100644 index 00000000..5582838c --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/FrameCollector.cpp @@ -0,0 +1,108 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "FrameCollector.h" + +__PK_SAMPLE_API_BEGIN + +//---------------------------------------------------------------------------- + +CFrameCollector::CFrameCollector() +{ +} + +//---------------------------------------------------------------------------- + +CFrameCollector::~CFrameCollector() +{ +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::EarlyCull(const CAABB &bbox, const PCRendererDataBillboard &renderer) const +{ + return _Cull(bbox, renderer.Get()); +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::EarlyCull(const CAABB &bbox, const PCRendererDataRibbon &renderer) const +{ + return _Cull(bbox, renderer.Get()); +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::EarlyCull(const CAABB &bbox, const PCRendererDataMesh &renderer) const +{ + return _Cull(bbox, renderer.Get()); +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::EarlyCull(const CAABB &bbox, const PCRendererDataTriangle &renderer) const +{ + return _Cull(bbox, renderer.Get()); +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::EarlyCull(const CAABB &bbox, const PCRendererDataDecal &renderer) const +{ + return _Cull(bbox, renderer.Get()); +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::EarlyCull(const CAABB &bbox, const PCRendererDataLight &renderer) const +{ + return _Cull(bbox, renderer.Get()); +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::EarlyCull(const CAABB &bbox, const PCRendererDataSound &renderer) const +{ + return _Cull(bbox, renderer.Get()); +} + +//---------------------------------------------------------------------------- + +bool CFrameCollector::_Cull(const CAABB &bbox, const CRendererDataBase *renderer) const +{ + const CRendererCacheInstance_UpdateThread *rdrCache = static_cast(renderer->m_RendererCache.Get()); + + // We do not cull the draw-call when shadow casting is active: + // We want the shadow to be rendered even when the draw-call is not visible + if (rdrCache->CastShadows()) + return false; + + // Can happen if bounds are not active + if (!bbox.IsFinite() || + !bbox.Valid()) + return false; + + if (m_CullingFrustums.Empty()) + return false; + + const u32 viewCount = m_CullingFrustums.Count(); + for (u32 iView = 0; iView < viewCount; ++iView) + { + if (m_CullingFrustums[iView].Touches(bbox)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/FrameCollector.h b/Samples/PK-SampleLib/RenderIntegrationRHI/FrameCollector.h new file mode 100644 index 00000000..8df8dadd --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/FrameCollector.h @@ -0,0 +1,50 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHITypePolicy.h" + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- +// +// Frame collector +// +//---------------------------------------------------------------------------- + +// CFrameCollector is specialized with our policy to work with RHI. +// Create your own policy to use it in your custom engine. +class CFrameCollector : public TFrameCollector +{ +public: + CFrameCollector(); + virtual ~CFrameCollector(); + + // Views to cull against (setup from update thread) + TMemoryView m_CullingFrustums; + +private: + virtual bool EarlyCull(const CAABB &bbox, const PCRendererDataBillboard &renderer) const override; + virtual bool EarlyCull(const CAABB &bbox, const PCRendererDataRibbon &renderer) const override; + virtual bool EarlyCull(const CAABB &bbox, const PCRendererDataMesh &renderer) const override; + virtual bool EarlyCull(const CAABB &bbox, const PCRendererDataTriangle &renderer) const override; + virtual bool EarlyCull(const CAABB &bbox, const PCRendererDataDecal &renderer) const override; + virtual bool EarlyCull(const CAABB &bbox, const PCRendererDataLight &renderer) const override; + virtual bool EarlyCull(const CAABB &bbox, const PCRendererDataSound &renderer) const override; + + bool _Cull(const CAABB &bbox, const CRendererDataBase *renderer) const; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/MaterialToRHI.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/MaterialToRHI.cpp new file mode 100644 index 00000000..01871d2c --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/MaterialToRHI.cpp @@ -0,0 +1,2319 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PKSample.h" + +#include "MaterialToRHI.h" + +#include "ShaderDefinitions/EditorShaderDefinitions.h" +#include "ShaderDefinitions/SampleLibShaderDefinitions.h" +#include "ShaderGenerator/ShaderGenerator.h" +#include "ApiContextConfig.h" +#include "pk_rhi/include/EnumHelper.h" + +// Node (Alex) : this is temporary until we find a better way to handle built-in elements +#include "pk_particles/include/ps_nodegraph_frontend_renderers.h" +#include "pk_render_helpers/include/render_features/rh_features_basic.h" +#include "pk_render_helpers/include/draw_requests/rh_billboard.h" +#include "pk_render_helpers/include/draw_requests/rh_ribbon.h" + + +#include // for _SanitizeShaderVisibleName implementation + +#include "SampleUtils.h" +#include "PK-MCPP/pk_preprocessor.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +namespace MaterialToRHI +{ + + static bool _IsTriangleGeomGenerationFeatureProperty(const CString &fieldName) + { + return fieldName == "TriangleCustomNormals_Normal1" || + fieldName == "TriangleCustomNormals_Normal2" || + fieldName == "TriangleCustomNormals_Normal3" || + fieldName == "TriangleCustomUVs_UV1" || + fieldName == "TriangleCustomUVs_UV2" || + fieldName == "TriangleCustomUVs_UV3"; + } + + static bool _IsMeshLODProperty(const CString &fieldName) + { + return fieldName == "MeshLOD_LOD"; + } + + //---------------------------------------------------------------------------- + +#if (PK_MAT2RHI_CAN_COMPILE != 0) + static u64 _GetShaderTimestamp(const CString &shaderPath, const CRHIShadersCompilationFileSystem &fs) + { + if (shaderPath.Empty()) + return 0; + + u64 timestamp = fs.FileLastModifiedTime(shaderPath); + // Will need to gather timestamps on shader dependencies + PFileStream shader = fs.GetFileSystem()->OpenStream(shaderPath, IFileSystem::Access_Read, CFilePath::IsAbsolute(shaderPath)); + + if (shader == null) + return 0; + + const CString shaderContent = shader->BufferizeToString(); + TArray dependencies; + + if (!CPreprocessor::FindShaderDependencies(shaderContent, CFilePath::StripFilename(shaderPath), dependencies, fs.GetFileSystem())) + return timestamp; + + for (const CString &path : dependencies) + timestamp = PKMax(fs.FileLastModifiedTime(path), timestamp); + return timestamp; + } + + static bool _IsGeometryGenerationFeature(const CString &featureName) + { +#define X_RENDERER_CLASSES(__name) if (featureName == PK_STRINGIFY(Geometry ## __name)) return true; + PK_EXEC_X_RENDERER_CLASSES() +#undef X_RENDERER_CLASSES + return false; + } + + //---------------------------------------------------------------------------- + + static bool _IsMeshAtlasFeature(const CString &featureName) + { + return featureName == "MeshAtlas" || featureName == "MeshLOD"; + } + + //---------------------------------------------------------------------------- + + SCompileArg::SCompileArg(const SCompileArg &oth) + { + m_SourceTimestamps = oth.m_SourceTimestamps; + m_ShaderFolder = oth.m_ShaderFolder; + m_Fields = oth.m_Fields; + m_Properties = oth.m_Properties; + m_FeaturesSettings = oth.m_FeaturesSettings; + m_MaterialSettings = oth.m_MaterialSettings; + m_RendererType = oth.m_RendererType; + m_RenderPasses = oth.m_RenderPasses; + m_OptionsOverride = oth.m_OptionsOverride; + m_Material = oth.m_Material; + } + + SCompileArg::SCompileArg(const ERendererClass rendererType, const CString &shaderFolder) + : m_ShaderFolder(shaderFolder) + , m_RendererType(rendererType) + , m_Material(null) + { + } + + bool SCompileArg::InitFromRendererFeatures(const PCParticleRendererMaterial &material) + { + PK_ASSERT(!m_ShaderFolder.Empty()); + PK_ASSERT(material != null); + + m_Material = material; + + if (!PK_VERIFY(PopulateSettings(material, m_RendererType, null, &m_FeaturesSettings, &m_MaterialSettings))) + return false; + + // Only remap fragment shader path, not generated +#if 0 // #5527: Materials: All .pkma files should have a valid .frag/.vert shader path + if (m_MaterialSettings.m_FragmentShaderPath.Empty()) + m_MaterialSettings.m_FragmentShaderPath = m_ShaderFolder / m_MaterialSettings.m_MaterialName + ".frag"; +#endif + PK_ASSERT(!m_MaterialSettings.m_FragmentShaderPath.Empty()); + return true; + } + + //---------------------------------------------------------------------------- + + bool SCompileArg::InitFromRendererData( const PCRendererDataBase &renderer, + HBO::CContext *context) + { + PK_ASSERT(!m_ShaderFolder.Empty()); + PK_ASSERT(context != null); + PK_ASSERT(renderer != null && renderer->m_RendererType == m_RendererType); // will crash above anyway + + m_Fields = renderer->m_Declaration.m_AdditionalFields; + m_Properties = renderer->m_Declaration.m_Properties; + + // Here, retrieve shaders from .pkma + const CString &materialPath = renderer->m_Declaration.m_MaterialPath; + bool fileWasLoaded = false; + PBaseObjectFile materialFile = context->LoadFile(materialPath, false, &fileWasLoaded); + if (materialFile != null) + { + PParticleRendererMaterial material = materialFile->FindFirstOf(); + if (PK_VERIFY(material != null) && + PK_VERIFY(material->Initialize())) + { + if (!PK_VERIFY(PopulateSettings(material, renderer->m_RendererType, renderer, &m_FeaturesSettings, &m_MaterialSettings))) + return false; + } + + if (!fileWasLoaded) + materialFile->Unload(); + materialFile = null; + } + // Only remap fragment shader path, not generated +#if 0 // #5527: Materials: All .pkma files should have a valid .frag/.vert shader path + if (m_MaterialSettings.m_FragmentShaderPath.Empty()) + m_MaterialSettings.m_FragmentShaderPath = m_ShaderFolder / m_MaterialSettings.m_MaterialName + ".frag"; +#endif + PK_ASSERT(!m_MaterialSettings.m_FragmentShaderPath.Empty()); + + bool success = true; + + { + success &= m_OptionsOverride.PushBack(Option_VertexPassThrough).Valid(); + + if (renderer->m_RendererType == ERendererClass::Renderer_Billboard) + { + // Geom billboarding shader options + const PCRendererDataBillboard rendererBillboard = static_cast(renderer.Get()); + + const SRendererFeaturePropertyValue *billboardingMode = rendererBillboard->m_Declaration.FindProperty(BasicRendererProperties::SID_BillboardingMode()); + EBillboardMode modeBB = (billboardingMode != null) ? Drawers::SBillboard_BillboardingRequest::BillboardProperty_BillboardMode_ToInternal(billboardingMode->ValueI().x()) : BillboardMode_ScreenAligned; + u32 shaderOptions_Geom = Option_VertexPassThrough | Option_GeomBillboarding; + u32 shaderOptions_Vertex = Option_VertexPassThrough | Option_VertexBillboarding; + switch (modeBB) + { + case BillboardMode_ScreenAligned: + case BillboardMode_ViewposAligned: + break; + case BillboardMode_AxisAligned: + case BillboardMode_AxisAlignedSpheroid: + shaderOptions_Geom |= Option_Axis_C1; + shaderOptions_Vertex |= Option_Axis_C1; + break; + case BillboardMode_AxisAlignedCapsule: + shaderOptions_Geom |= Option_Axis_C1 | Option_Capsule; + shaderOptions_Vertex |= Option_Axis_C1 | Option_Capsule; + break; + case BillboardMode_PlaneAligned: + shaderOptions_Geom |= Option_Axis_C2; + shaderOptions_Vertex |= Option_Axis_C2; + break; + default: + PK_ASSERT_NOT_REACHED(); + break; + } + + const SRendererFeaturePropertyValue *size2Enable = rendererBillboard->m_Declaration.FindProperty(BasicRendererProperties::SID_EnableSize2D()); + const bool size2Enabled = size2Enable != null ? size2Enable->ValueB() : false; + if (size2Enabled) // must match with SBillboard_BillboardingRequest::m_SizeFloat2 + { + shaderOptions_Geom |= Option_BillboardSizeFloat2; + shaderOptions_Vertex |= Option_BillboardSizeFloat2; + } + + // TODO: would be better to know if atlas would needed or not + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Geom)).Valid(); + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Geom | Option_GPUStorage)).Valid(); + + // Vertex billboarding shader options + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Vertex)).Valid(); + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Vertex | Option_GPUStorage)).Valid(); + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Vertex | Option_GPUSort)).Valid(); + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Vertex | Option_GPUStorage | Option_GPUSort)).Valid(); + + } + else if (renderer->m_RendererType == ERendererClass::Renderer_Triangle) + { + const u32 shaderOptions_Vertex = Option_VertexPassThrough | Option_TriangleVertexBillboarding; + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Vertex)).Valid(); + } + else if (renderer->m_RendererType == ERendererClass::Renderer_Mesh) + { + const u32 shaderOptions_Vertex = Option_VertexPassThrough | Option_GPUMesh; + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Vertex)).Valid(); + } + else if (renderer->m_RendererType == ERendererClass::Renderer_Ribbon) + { + // Geom billboarding shader options + const PCRendererDataRibbon rendererRibbon = static_cast(renderer.Get()); + + const SRendererFeaturePropertyValue *billboardingMode = rendererRibbon->m_Declaration.FindProperty(BasicRendererProperties::SID_BillboardingMode()); + ERibbonMode modeBB = (billboardingMode != null) ? Drawers::SRibbon_BillboardingRequest::RibbonProperty_BillboardMode_ToInternal(billboardingMode->ValueI().x()) : RibbonMode_ViewposAligned; + + u32 shaderOptions_Vertex = Option_VertexPassThrough | Option_RibbonVertexBillboarding; + + switch (modeBB) + { + case RibbonMode_ViewposAligned: + break; + case RibbonMode_NormalAxisAligned: + case RibbonMode_SideAxisAligned: + case RibbonMode_SideAxisAlignedTube: // Might be interesting to add shader options for tubes & multi-planes but it would break batching. + case RibbonMode_SideAxisAlignedMultiPlane: + shaderOptions_Vertex |= Option_Axis_C1; + break; + default: + PK_ASSERT_NOT_REACHED(); + break; + } + + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Vertex | Option_GPUStorage)).Valid(); + success &= m_OptionsOverride.PushBack(static_cast(shaderOptions_Vertex | Option_GPUStorage | Option_GPUSort)).Valid(); + } + } + _FindParticleRenderPasses(); + return success; + } + + bool SCompileArg::ComputeSourceShadersTimestamps(const CString &materialPath, const CRHIShadersCompilationFileSystem &fs) + { + const u64 materialTimestamp = fs.FileLastModifiedTime(materialPath); + const u64 vertexShaderTimestamp = _GetShaderTimestamp(m_MaterialSettings.m_VertexShaderPath, fs); + const u64 fragmentShaderTimestamp = _GetShaderTimestamp(m_MaterialSettings.m_FragmentShaderPath, fs); + + m_SourceTimestamps.m_Fragment = PKMax(materialTimestamp, fragmentShaderTimestamp); + if (!m_MaterialSettings.m_VertexShaderPath.Empty()) + m_SourceTimestamps.m_Vertex = PKMax(materialTimestamp, vertexShaderTimestamp); + else + m_SourceTimestamps.m_Vertex = materialTimestamp; // Generated + return true; + } + + //---------------------------------------------------------------------------- + + bool SCompileArg::SetShaderCombination(u32 combination) + { + if (!PK_VERIFY(m_Material != null)) + return false; + // We enable the right options: + u32 optionIdx = 0; + for (u32 i = 0; i < m_FeaturesSettings.Count(); ++i) + { + if (!m_FeaturesSettings[i].m_Mandatory) + { + m_FeaturesSettings[i].m_Enabled = (combination & (1 << optionIdx)) != 0; + ++optionIdx; + } + } + // Then we gather fields and properties: + for (u32 i = 0; i < m_FeaturesSettings.Count(); ++i) + { + if (!m_FeaturesSettings[i].m_Enabled) + continue; + const CStringId featureNameId = m_FeaturesSettings[i].m_FeatureName; + const CString featureName = featureNameId.ToString(); + PCParticleRendererFeature feature = m_Material->GetFeature(featureName); + if (!PK_VERIFY(feature != null)) + continue; + + // Skip all geometry generation features: These do not produce direct shader inputs as vertex streams. + // We hardcode geom generation in the shader generation pipe. + if (_IsGeometryGenerationFeature(featureName)) + continue; + + // Temp: proper fix need to be done inside shader tool + if (_IsMeshAtlasFeature(featureName)) + continue; + + for (u32 pidx = 0; pidx < feature->Properties().Count(); ++pidx) + { + const CParticleNodeTemplateExport *exportNode = feature->Properties()[pidx]; + if (!PK_VERIFY(exportNode != null)) + continue; + + // This code matches the logic in 'CParticleNodeRendererBase::_FillMaterialDataInRendererFrontend' + const Nodegraph::EDataType exportedType = exportNode->ExportedType(); + const Nodegraph::SDataTypeTraits &typeTraits = Nodegraph::SDataTypeTraits::Traits(exportedType); + if (exportedType != Nodegraph::DataType_Bool1 && + exportedType != Nodegraph::DataType_Int1 && + exportedType != Nodegraph::DataType_Int2 && + exportedType != Nodegraph::DataType_Int3 && + exportedType != Nodegraph::DataType_Int4 && + exportedType != Nodegraph::DataType_Float1 && + exportedType != Nodegraph::DataType_Float2 && + exportedType != Nodegraph::DataType_Float3 && + exportedType != Nodegraph::DataType_Float4 && + exportedType != Nodegraph::DataType_Orientation && + exportedType != Nodegraph::DataType_DataImage && + exportedType != Nodegraph::DataType_DataImageAtlas && + exportedType != Nodegraph::DataType_DataGeometry && + exportedType != Nodegraph::DataType_DataAudio) + { + CLog::Log(PK_ERROR, "MaterialToRHI: rendering feature property '%s' of feature '%s' has an unsupported type '%s'.", exportNode->ExportedName().Data(), featureName.Data(), typeTraits.Name()); + return false; + } + + // Gore Hack ! See next comment. + const CStringView kSortKey = "Transparent.SortKey"; + if (featureNameId == BasicRendererProperties::SID_Transparent() && + exportNode->ExportedName() == kSortKey) + continue; + + // Note (Alex): FIXME, We can't base everything on link and property, or skip by feature. + // We need a clear distinction between Billboarding fields and Rendering fields (as additional shader input). + if (exportNode->InputType() == InputType_Link_And_Property && + typeTraits.IsNative()) // it's a data field + { + const CStringId pinName = CStringId(exportNode->ExportedName()); + + // FIXME: Check for multiple identical fields? + if (!PK_VERIFY(m_Fields.PushBack().Valid())) + return false; + m_Fields.Last().SetValueFrom(pinName, Nodegraph::SDataTypeTraits::Traits(exportNode->ExportedType()).BaseType()); + continue; + } + + // FIXME: Check for multiple identical fields? + if (!PK_VERIFY(m_Properties.PushBack().Valid())) + return false; + m_Properties.Last().SetupFrom(exportNode); + } + } + // Finally we deduce the render passes from the enabled features: + _FindParticleRenderPasses(); + return true; + } + + //---------------------------------------------------------------------------- + + bool SCompileArg::_HasProperty(CStringId materialProperty) const + { + for (u32 i = 0; i < m_FeaturesSettings.Count(); ++i) + { + if (m_FeaturesSettings[i].m_FeatureName == materialProperty) + return m_FeaturesSettings[i].m_Enabled; + } + return false; + } + + //---------------------------------------------------------------------------- + + void SCompileArg::_FindParticleRenderPasses() + { + FindParticleRenderPasses(m_RenderPasses, m_RendererType, FastDelegate(this, &SCompileArg::_HasProperty)); + } +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) + + //---------------------------------------------------------------------------- + + void FindParticleRenderPasses(CRenderPassArray &renderPasses, ERendererClass renderer, const FastDelegate &hasProperty) + { + if (renderer == Renderer_Light) + { + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_Lighting); + } + else if (renderer == Renderer_Decal) + { + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_Decal); + } + else + { + const u32 renderPassCount = renderPasses.Count(); + const bool hasDiffuseColor = hasProperty(BasicRendererProperties::SID_Diffuse()); + const bool hasEmissiveColor = hasProperty(BasicRendererProperties::SID_Emissive()); + const bool hasOpaque = hasProperty(BasicRendererProperties::SID_Opaque()); + const bool hasLit = hasProperty(BasicRendererProperties::SID_Lit()); + const bool hasTint = hasProperty(BasicRendererProperties::SID_Tint()); + const bool hasDistortion = hasProperty(BasicRendererProperties::SID_Distortion()); + const bool needTransparentLighting = hasLit && (hasTint || hasDistortion); + const bool hasTransparentColors = !hasOpaque && (hasDiffuseColor || hasEmissiveColor); + const bool hasTransparent = hasTransparentColors || needTransparentLighting || (!hasOpaque && !hasTint && !hasDistortion); + + if (hasTransparent) + { + if (hasTint || hasDistortion) + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_TransparentPostDisto); + else + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_Transparent); + } + if (hasOpaque) + { + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_Opaque); + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_OpaqueShadow); + } + if (hasTint) + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_Tint); + if (hasDistortion) + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_Distortion); + if (renderPassCount == renderPasses.Count()) + { + // By default, materials are rendered in the transparent render pass: + renderPasses.PushBack(ESampleLibGraphicResources_RenderPass::ParticlePass_Transparent); + } + } + } + + //---------------------------------------------------------------------------- + + bool PopulateSettings( const PCParticleRendererMaterial &material, + const ERendererClass rendererType, + const PCRendererDataBase renderer /*= null*/, + TArray *featuresSettings /*= null*/, + SMaterialSettings *materialSettings /*= null*/) + { + (void)rendererType; + PK_ASSERT(material != null); + if (featuresSettings != null) + { + PCRHIRenderingSettings renderingSettings; + PCBaseObjectFile renderingInterfaceFile; + + for (u32 i = 0; i < material->RendererFeatures().Count(); ++i) + { + const CParticleRendererFeatureDesc *featureDesc = material->RendererFeatures()[i]; + if (!PK_VERIFY(featureDesc != null)) + continue; + const CString &featureName = featureDesc->RendererFeatureName(); + bool setFeatureMandatory = featureDesc->Mandatory(); + bool addFeatureToList = setFeatureMandatory; + bool setFeatureEnabled = addFeatureToList; + + if (!addFeatureToList) + { + if (renderer != null) + { + // In the case where we have an actual renderer, we can add only the features that are actually enabled to the featuresSettings: + PK_ASSERT(renderer->m_RendererType == rendererType); + const CStringId propertyKey = CStringId(featureName); + const SRendererFeaturePropertyValue *property = renderer->m_Declaration.FindProperty(propertyKey); + // This happens when a feature in the pkma is not present in the baked pkfx. The renderer pins should be repopulated when baking... + if (!PK_VERIFY(property != null)) + continue; + PK_ASSERT(property->m_Type == PropertyType_Feature); + setFeatureEnabled = addFeatureToList = property->ValueB(); + } + else + { + addFeatureToList = true; + setFeatureEnabled = false; + } + } + + if (addFeatureToList) + { + PCRHIRenderingFeature renderingFeature = null; + if (featureDesc->RendererInterfaceFile() != null) + { + // Avoids searching everytime the settings from HBO list of the same file + if (featureDesc->RendererInterfaceFile() != renderingInterfaceFile) + { + renderingInterfaceFile = featureDesc->RendererInterfaceFile(); + renderingSettings = renderingInterfaceFile->FindFirstOf(); + } + renderingFeature = renderingSettings != null ? renderingSettings->FindFeature(featureName) : null; + } + if (!PK_VERIFY(featuresSettings->PushBack(SToggledRenderingFeature(CStringId(featureName), renderingFeature, setFeatureMandatory, setFeatureEnabled)).Valid())) + return false; + } + } + } + if (materialSettings != null && material->File() != null) + { + materialSettings->m_MaterialName = CFilePath::StripExtension(CFilePath::ExtractFilename(CStringView(material->File()->Path()))).ToString(); + PCRHIMaterialShaders materialDesc = material->File()->FindFirstOf(); + if (materialDesc != null) + { + materialSettings->m_VertexShaderPath = materialDesc->VertexShader(); + materialSettings->m_FragmentShaderPath = materialDesc->FragmentShader(); + } + } + return true; + } + + //---------------------------------------------------------------------------- + +#if defined(PK_LINUX) && ((defined(PK_COMPILER_GCC) && PK_COMPILER_VERSION >= 7000) || defined(PK_COMPILER_CLANG)) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + + static void _PropertyTypeConversion(ERendererFeaturePropertyType inType, RHI::EVarType &outType, u32 &outSize) + { + outType = RHI::TypeUndefined; + outSize = 0; + + switch (inType) + { +#define X_CASE_TYPE(_type, _rhi_type) \ + case PK_NAMESPACE::PropertyType_ ## _type: \ + outType = RHI::Type ## _rhi_type; \ + outSize = sizeof(C ## _type); \ + break; + + case PK_NAMESPACE::PropertyType_Bool1: + X_CASE_TYPE(Int1, Int); + X_CASE_TYPE(Int2, Int2); + X_CASE_TYPE(Int3, Int3); + X_CASE_TYPE(Int4, Int4); + X_CASE_TYPE(Float1, Float); + X_CASE_TYPE(Float2, Float2); + X_CASE_TYPE(Float3, Float3); + X_CASE_TYPE(Float4, Float4); + + default: + PK_ASSERT_NOT_REACHED(); + +#undef X_CASE_TYPE + } + + PK_ASSERT(outType != RHI::TypeUndefined); + } + +#if defined(PK_LINUX) && ((defined(PK_COMPILER_GCC) && PK_COMPILER_VERSION >= 7000) || defined(PK_COMPILER_CLANG)) +# pragma GCC diagnostic pop +#endif + + //---------------------------------------------------------------------------- + + // Replace '.' and other unrecognized tokens by '_' + static CString _SanitizeShaderVisibleName(const CString &baseName) + { + if (!PK_VERIFY(!baseName.Empty())) + return null; + + // First, quickly scan through the string to see if we'll need to change it. + // If we don't, there's no need to copy the string (calling 'RawDataForWriting()' will detach the string and make a copy) + { + const char *readPtr = baseName.Data(); + PK_ASSERT(readPtr != null && *readPtr != '\0'); // '.Empty()' test at the beginning of the function + bool ok = !!KR_BUFFER_IS_IDST(*readPtr); + ++readPtr; + while (*readPtr != '\0') + { + if (!KR_BUFFER_IS_IDSTNUM(*readPtr)) + { + ok = false; + break; + } + ++readPtr; + } + if (ok) // nothing to change here ! + return baseName; + } + CString name = baseName; + + { + char *writePtr = name.RawDataForWriting(); // Detach + PK_ASSERT(writePtr != null && *writePtr != '\0'); // '.Empty()' test at the beginning of the function + + const char kReplace = '_'; + bool prevIsOriginal = true; // condense the '_' to keep the string readable. + + if (!KR_BUFFER_IS_IDST(*writePtr)) + { + *writePtr = kReplace; + prevIsOriginal = false; + } + writePtr++; + + const char *readPtr = writePtr; + while (*readPtr != '\0') + { + if (!KR_BUFFER_IS_IDSTNUM(*readPtr)) + { + *writePtr = kReplace; + if (prevIsOriginal) + writePtr++; + prevIsOriginal = false; + } + else + { + prevIsOriginal = true; + *writePtr = *readPtr; + writePtr++; + } + readPtr++; + } + *writePtr = '\0'; + } + + name.RebuildAfterRawModification(); // not needed, we didn't change the length + return name; + } + + //---------------------------------------------------------------------------- + // + // Front-end material to shader bindings, used in the integration to create the render state - Helpers: + // + //---------------------------------------------------------------------------- + + // Helpers to create the inputs for the fields and the constants: + static bool _SetFields( const SGenericArgs &args, + RHI::SShaderBindings &outShaderBindings, + RHI::SConstantSetLayout *simDataConstantSet, // can be null + RHI::SConstantSetLayout *streamOffsetsConstantSet, // can be null + TArray &outVertexInputBuffer, + RHI::SShaderDescription *outShaderDesc, + RHI::EVertexInputRate inputRate, // outShaderDesc can be null + EShaderOptions options) + { + const bool gpuStorage = (options & Option_GPUStorage) || + (options & Option_GPUMesh); + const bool vertexBB = (options & Option_VertexBillboarding) || + (options & Option_TriangleVertexBillboarding) || + (options & Option_RibbonVertexBillboarding); + const bool GPUMesh = options & Option_GPUMesh; + PK_ASSERT(!vertexBB || simDataConstantSet != null); + PK_ASSERT(!vertexBB || !gpuStorage || streamOffsetsConstantSet != null); + + bool success = true; + u32 attributeLocationBinding = 0; + for (const RHI::SVertexAttributeDesc &inputAttribute : outShaderBindings.m_InputAttributes) + attributeLocationBinding += RHI::VarType::GetRowNumber(inputAttribute.m_Type); + + for (u32 fidx = 0; fidx < args.m_FieldDefinitions.Count(); ++fidx) + { + const SRendererFeatureFieldDefinition &fieldDef = args.m_FieldDefinitions[fidx]; + PK_ASSERT(fieldDef.m_Type != BaseType_Evolved); + + // Here, fieldDef.m_Name is in the 'General.Position' / 'Diffuse.Color' form + // Replace '.' with '_' + const CString fieldnameSanitized = _SanitizeShaderVisibleName(fieldDef.m_Name.ToString()); + + // If already here, don't add it again (added by hardcoded '_SetGeneratedInputs' function) + PK_ONLY_IF_ASSERTS({ + for (u32 iidx = 0; iidx < outShaderBindings.m_InputAttributes.Count(); iidx++) + PK_ASSERT(outShaderBindings.m_InputAttributes[iidx].m_Name != fieldnameSanitized); + }); + + if (fieldDef.m_Type == BaseType_Bool || fieldDef.m_Type == BaseType_Bool2 || fieldDef.m_Type == BaseType_Bool3 || fieldDef.m_Type == BaseType_Bool4) + continue; // ignore boolean fields ... + + // TEMP: triangle custom normals / UVs only needed in vertex shader for vertexBB + if (_IsTriangleGeomGenerationFeatureProperty(fieldnameSanitized) && !vertexBB) + continue; + + // MeshLOD.LOD doesn't need to be visible in the VS shader (it's not a renderer builtin so it ends up here). + if (_IsMeshLODProperty(fieldnameSanitized)) + continue; + + const RHI::EVarType varType = RHI::VarType::RuntimeBaseTypeToVarType(fieldDef.m_Type); + if (!vertexBB) + { + if (GPUMesh) + { + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc(CString::Format("%ssOffsets", fieldnameSanitized.Data()))); + } + else + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc(fieldnameSanitized, attributeLocationBinding, varType, outShaderBindings.m_InputAttributes.Last().m_BufferIdx + 1)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(inputRate, RHI::VarType::GetTypeSize(varType))).Valid(); + } + } + else + { + if (gpuStorage) + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc(CString::Format("%ssOffsets", fieldnameSanitized.Data()))); + else + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc(CString::Format("%ss", fieldnameSanitized.Data()))); + } + + if (!_IsTriangleGeomGenerationFeatureProperty(fieldnameSanitized)) + { + if (outShaderDesc != null) + { + const RHI::EInterpolation interpolationMode = (args.m_RendererType == Renderer_Ribbon) ? RHI::InterpolationSmooth : RHI::InterpolationFlat; + CString fragmentName = "frag" + fieldnameSanitized; + if (outShaderDesc->m_Pipeline == RHI::VsGsPs) + { + success &= outShaderDesc->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput(fragmentName, varType, interpolationMode, outShaderDesc->m_VertexOutput.Count())).Valid(); + fragmentName = "geom" + fieldnameSanitized; + } + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput(fragmentName, varType, interpolationMode, attributeLocationBinding)).Valid(); + } + } + + attributeLocationBinding += RHI::VarType::GetRowNumber(varType); + } + return success; + } + + //---------------------------------------------------------------------------- + + const SRendererFeaturePropertyValue *_FindProperty(const CStringId &name, const TMemoryView &view) + { + for (u32 i = 0; i < view.Count(); ++i) + { + if (view[i].m_Name == name) + return &view[i]; + } + return null; + } + + //---------------------------------------------------------------------------- + + bool CreateConstantSetLayout(const SGenericArgs &args, + const CString &constantBuffName, + RHI::SConstantSetLayout &outConstSetLayout, + TArray *outTextureArray, + TArray *outConstantArray, + CDigestMD5 *contentHash) + { + bool success = true; + CBufferDigesterMD5 digester; + // Then we can add the constant inputs: we will have one constant set and one constant buffer per feature + RHI::SConstantBufferDesc constBufferDesc(constantBuffName); + + for (const SToggledRenderingFeature &feature : args.m_FeaturesSettings) + { + if (!feature.m_Enabled || feature.m_Settings == null) + continue; + for (const CString &propName : feature.m_Settings->PropertiesAsShaderConstants()) + { + // Warning: This is inconsistent with renderer pins, which are CategoryName.PinName + const CString featureName = feature.m_FeatureName.ToString(); + const CString propertyName = CString::Format("%s.%s", featureName.Data(), propName.Data()); + const CString shaderVisibleName = CString::Format("%s_%s", featureName.Data(), propName.Data()); // Some properties have common names (ie. Blending) + const SRendererFeaturePropertyValue *value = _FindProperty(CStringId(propertyName), args.m_Properties); + if (value != null) + { + if (value->m_Type == PropertyType_TexturePath) + { + outConstSetLayout.AddConstantsLayout(RHI::SConstantSamplerDesc(shaderVisibleName, RHI::SamplerTypeSingle)); + if (outTextureArray != null) + { + STextureProperty texProp; + texProp.m_Property = value; + texProp.m_LoadAsSRGB = feature.m_Settings->TexturesUsedAsLookUp().Find(propName) == null; + outTextureArray->PushBack(texProp); + } + } + else + { + RHI::EVarType varType = RHI::TypeUndefined; + u32 varSize = 0; + + _PropertyTypeConversion(value->m_Type, varType, varSize); + constBufferDesc.AddConstant(RHI::SConstantVarDesc(varType, shaderVisibleName)); + if (outConstantArray != null) + outConstantArray->PushBack(*value); + if (contentHash != null) + digester.Append(&value->m_ValueI[0], varSize); + } + } + } + } + + if (!constBufferDesc.m_Constants.Empty()) + success &= outConstSetLayout.AddConstantsLayout(constBufferDesc); + if (contentHash != null) + digester.Finalize(*contentHash); + + return success; + } + + //---------------------------------------------------------------------------- + // + // Create the constant set layout for the geom/vertex billboard pass: + // + //---------------------------------------------------------------------------- + + bool _SetGPUBillboardConstants(RHI::SShaderBindings &outShaderBindings, ERendererClass rendererType, bool vertexBB, bool gpuStorage) + { + if (gpuStorage) + { + RHI::SPushConstantBuffer desc; + desc.m_ShaderStagesMask = static_cast(RHI::VertexShaderMask | RHI::GeometryShaderMask); + if (!SConstantDrawRequests::GetConstantBufferDesc(desc, 1, rendererType) || + !outShaderBindings.m_PushConstants.PushBack(desc).Valid()) + return false; + } + else + { + if (!outShaderBindings.m_ConstantSets.PushBack(SConstantDrawRequests::GetConstantSetLayout(rendererType)).Valid()) + return false; + } + if (vertexBB) + { + RHI::SPushConstantBuffer desc; + + if (!SConstantVertexBillboarding::GetPushConstantBufferDesc(desc, gpuStorage) || + !outShaderBindings.m_PushConstants.PushBack(desc).Valid()) + return false; + } + return true; + } + + //---------------------------------------------------------------------------- + // + // Create the shader inputs for the generated geometry: + // + //---------------------------------------------------------------------------- + + bool _CommonBillboardRibbonGeneratedInputs( bool uv, + bool atlas, + bool normal, + bool tangent, + u32 &shaderLocationBinding, + u32 &vBufferLocationBinding, + RHI::SShaderBindings &outShaderBindings, + TArray &outVertexInputBuffer, + RHI::SShaderDescription *outShaderDesc) + { + bool success = true; + if (normal) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Normal", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragNormal", RHI::TypeFloat3, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))); + } + if (tangent) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Tangent", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragTangent", RHI::TypeFloat4, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))); + } + if (uv) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("UV0", shaderLocationBinding, RHI::TypeFloat2, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV0", RHI::TypeFloat2, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat2))); + } + if (atlas) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("UV1", shaderLocationBinding, RHI::TypeFloat2, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV1", RHI::TypeFloat2, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat2))); + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("AtlasID", shaderLocationBinding, RHI::TypeFloat, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragAtlasID", RHI::TypeFloat, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(float))); + } + + return success; + } + + //---------------------------------------------------------------------------- + + static bool _SetGeneratedInputs(SGenericArgs &args, + RHI::SShaderBindings &outShaderBindings, + u32 &outNeededConstants, + RHI::SConstantSetLayout *simDataConstantSet, // can be null + RHI::SConstantSetLayout *streamOffsetsConstantSet, // can be null + TArray &outVertexInputBuffer, + RHI::SShaderDescription *outShaderDesc, + EShaderOptions options) // outShaderDesc can be null + { + u32 shaderLocationBinding = 0; + u32 vBufferLocationBinding = 0; + bool success = true; + const bool geomBB = options & Option_GeomBillboarding; + const bool vertexBB = (options & Option_VertexBillboarding) || + (options & Option_TriangleVertexBillboarding) || + (options & Option_RibbonVertexBillboarding); + const bool gpuStorage = (options & Option_GPUStorage) || + (options & Option_GPUMesh); + const bool gpuSortCamera = options & Option_GPUSort; + const bool gpuSortRibbon = (args.m_RendererType == Renderer_Ribbon) && vertexBB && gpuStorage; + + PK_ASSERT(!vertexBB || simDataConstantSet != null); + PK_ASSERT(!vertexBB || !gpuStorage || streamOffsetsConstantSet != null); + + // TODO: Clean/split this function.. + + // Get needed features + bool uv = false; + bool normal = false; + bool tangent = false; + bool uv1 = false; + bool atlas = false; + bool opaque = false; + bool vertexColor0 = false; + bool vertexColor1 = false; + bool vertexBonesInfo = false; + bool correctDeformation = false; + bool sampleDepth = false; + bool sampleNormalRoughMetal = false; + bool sampleDiffuse = false; + bool useLightingInfo = false; +// bool transformUVs = false; + bool customTextureU = false; + + const CStringId strIdFeature_CorrectDeformation = BasicRendererProperties::SID_CorrectDeformation(); + const CStringId strIdFeature_Atlas = BasicRendererProperties::SID_Atlas(); +// const CStringId strIdFeature_TransformUVs = BasicRendererProperties::SID_TransformUVs(); + const CStringId strIdFeature_CustomTextureU = BasicRendererProperties::SID_CustomTextureU(); + const CStringId strIdFeature_Opaque = BasicRendererProperties::SID_Opaque(); + + for (const SToggledRenderingFeature &settings : args.m_FeaturesSettings) + { + if (!settings.m_Enabled) + continue; + + const PCRHIRenderingFeature &featureSettings = settings.m_Settings; + + if (featureSettings == null) + continue; + + correctDeformation |= settings.m_FeatureName == strIdFeature_CorrectDeformation; + atlas |= settings.m_FeatureName == strIdFeature_Atlas; + opaque |= settings.m_FeatureName == strIdFeature_Opaque; +// transformUVs |= settings.m_FeatureName == strIdFeature_TransformUVs; + customTextureU |= settings.m_FeatureName == strIdFeature_CustomTextureU; + + uv |= !!featureSettings->UseUV(); + normal |= !!featureSettings->UseNormal(); + tangent |= !!featureSettings->UseTangent(); + uv1 |= !!featureSettings->UseMeshUV1(); + vertexColor0 |= !!featureSettings->UseMeshVertexColor0(); + vertexColor1 |= !!featureSettings->UseMeshVertexColor1(); + vertexBonesInfo |= !!featureSettings->UseMeshVertexBonesIndicesAndWeights(); + sampleDepth |= !!featureSettings->SampleDepth(); + sampleNormalRoughMetal |= !!featureSettings->SampleNormalRoughMetal(); + sampleDiffuse |= !!featureSettings->SampleDiffuse(); + useLightingInfo |= !!featureSettings->UseSceneLightingInfo(); + } + + // Create the shader vertex inputs and outputs + if (vertexBB) + { + if (gpuStorage) + { + PK_ASSERT(args.m_RendererType == Renderer_Billboard || args.m_RendererType == Renderer_Ribbon); + + // GPU sim: only a single raw buffer, offsets per stream, and define "BB_GPU_SIM" + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData")); + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_GPU_SIM")).Valid(); + // Mandatory stream offsets + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("EnabledsOffsets")); + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("PositionsOffsets")); + // Ribbon mandatory stream offsets + if (gpuSortRibbon) + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("ParentIDsOffsets")); + + // Sort indirection buffers + if (gpuSortCamera) + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Indirection")); + if (gpuSortRibbon) + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("RibbonIndirection")); + + // For ribbon we need the effective particle count contained in the indirect draw buffer. + if (gpuSortRibbon) + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("IndirectDraw")); + } + else + { + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Indices")); // Right now, always add the indices raw buffer. Later, shader permutation + if (args.m_RendererType == Renderer_Billboard) + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Positions")); + else if (args.m_RendererType == Renderer_Triangle) + { + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("VertexPosition0")); + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("VertexPosition1")); + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("VertexPosition2")); + } + } + if (args.m_RendererType != Renderer_Triangle) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("TexCoords", shaderLocationBinding, RHI::TypeFloat2, vBufferLocationBinding)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat2))).Valid(); + } + } + else + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Position", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)).Valid(); + + if (!geomBB && outShaderDesc != null) + { + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragWorldPosition", RHI::TypeFloat3, RHI::InterpolationSmooth)).Valid(); + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragViewProjPosition", RHI::TypeFloat4, RHI::InterpolationSmooth)).Valid(); + } + + if (!vertexBB) + { + if (geomBB && !gpuStorage) + { + ++shaderLocationBinding; + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("DrawRequestID", shaderLocationBinding, RHI::TypeFloat, vBufferLocationBinding, sizeof(CFloat3))).Valid(); + } + const bool vertexPositionFloat3 = (args.m_RendererType == Renderer_Mesh || args.m_RendererType == Renderer_Light || args.m_RendererType == Renderer_Decal || gpuStorage); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, vertexPositionFloat3 ? sizeof(CFloat3) : sizeof(CFloat4))).Valid(); + } + ++shaderLocationBinding; + ++vBufferLocationBinding; + + if (outShaderDesc != null) + { + PK_FOREACH(feature, args.m_FeaturesSettings) + { + if (feature->m_Enabled) + outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::AllShaderMask, CString::Format("HAS_%s", feature->m_FeatureName.ToStringData()))); + } + } + + if (args.m_RendererType == Renderer_Billboard) + { + u32 vOutLocationBinding = shaderLocationBinding; + if (geomBB || vertexBB) // Lv0, all geom billboards have those inputs + { + const RHI::EShaderStage shaderStage = geomBB ? RHI::GeometryShaderStage : RHI::VertexShaderStage; + const bool hasAtlas = atlas;// && (options & Option_BillboardAtlas); + + // Size (float) / SizeFloat2 (float2) -> geomSize (float2) -> POSITION + RHI::EVarType sizeType = RHI::TypeFloat; + u32 sizeStride = sizeof(float); + + if (options & Option_BillboardSizeFloat2) + { + sizeType = RHI::TypeFloat2; + sizeStride = sizeof(CFloat2); + outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(shaderStage, "HAS_SizeFloat2")); + } + if (geomBB) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Size", shaderLocationBinding, sizeType, vBufferLocationBinding)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeStride)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + if (outShaderDesc != null) + { + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("geomSize", sizeType, RHI::InterpolationSmooth, vOutLocationBinding)).Valid(); + ++vOutLocationBinding; + } + } + else + { + if (gpuStorage) + { + if (sizeType == RHI::TypeFloat2) + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Size2sOffsets")); + else + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("SizesOffsets")); + } + else + { + if (sizeType == RHI::TypeFloat2) + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Size2s")); + else + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Sizes")); + } + } + // Rotation -> geomRotation -> POSITION + // Warning: EShaderOptions operators & | are overloaded ! + const bool isC0 = !(options & Option_Axis_C1) && !(options & Option_Axis_C2); + const bool isC2 = options & Option_Axis_C2; + if (isC0 || isC2) + { + if (geomBB) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Rotation", shaderLocationBinding, RHI::TypeFloat, vBufferLocationBinding)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(float))).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + if (outShaderDesc != null) + { + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("geomRotation", RHI::TypeFloat, RHI::InterpolationSmooth, vOutLocationBinding)).Valid(); + ++vOutLocationBinding; + } + } + else + { + if (gpuStorage) + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("RotationsOffsets")); + else + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Rotations")); + } + } + if (uv && hasAtlas) + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(shaderStage, "BB_Feature_Atlas")).Valid(); + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(shaderStage, "BB_FeatureC0")).Valid(); + if (outShaderDesc != null) + { + if (geomBB) + { + outShaderDesc->m_GeometryOutput.m_PrimitiveType = RHI::DrawModeTriangleStrip; + outShaderDesc->m_GeometryOutput.m_MaxVertices = 6; // because of velocity capsule align + success &= outShaderDesc->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput("fragWorldPosition", RHI::TypeFloat3, RHI::InterpolationSmooth)).Valid(); + success &= outShaderDesc->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput("fragViewProjPosition", RHI::TypeFloat4, RHI::InterpolationSmooth)).Valid(); + if (normal) + success &= outShaderDesc->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput("fragNormal", RHI::TypeFloat3, RHI::InterpolationSmooth)).Valid(); + if (tangent) + success &= outShaderDesc->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput("fragTangent", RHI::TypeFloat4, RHI::InterpolationSmooth)).Valid(); + if (uv) + success &= outShaderDesc->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput("fragUV0", RHI::TypeFloat2, RHI::InterpolationSmooth)).Valid(); + if (atlas) + { + success &= outShaderDesc->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput("fragUV1", RHI::TypeFloat2, RHI::InterpolationSmooth)).Valid(); + success &= outShaderDesc->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput("fragAtlasID", RHI::TypeFloat, RHI::InterpolationSmooth)).Valid(); + } + } + else + { + if (normal) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragNormal", RHI::TypeFloat3, RHI::InterpolationSmooth)).Valid(); + if (tangent) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragTangent", RHI::TypeFloat4, RHI::InterpolationSmooth)).Valid(); + if (uv) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV0", RHI::TypeFloat2, RHI::InterpolationSmooth)).Valid(); + if (atlas) + { + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV1", RHI::TypeFloat2, RHI::InterpolationSmooth)).Valid(); + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragAtlasID", RHI::TypeFloat, RHI::InterpolationSmooth)).Valid(); + } + } + } + + if ((options & Option_Axis_C1) != 0) + { + // Axis0 -> geomAxis0 -> POSITION + if (geomBB) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Axis0", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + if (outShaderDesc != null) + { + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("geomAxis0", RHI::TypeFloat3, RHI::InterpolationSmooth, vOutLocationBinding)).Valid(); + ++vOutLocationBinding; + } + } + else + { + if (gpuStorage) + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Axis0sOffsets")); + else + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Axis0s")); + } + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(shaderStage, "BB_FeatureC1")).Valid(); + } + if ((options & Option_Axis_C1) && (options & Option_Capsule)) + outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(shaderStage, "BB_FeatureC1_Capsule")); + if ((options & Option_Axis_C2) != 0) + { + // Axis1 -> geomAxis1 -> POSITION + if (geomBB) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Axis1", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + if (outShaderDesc != null) + { + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("geomAxis1", RHI::TypeFloat3, RHI::InterpolationSmooth, vOutLocationBinding)).Valid(); + ++vOutLocationBinding; + } + } + else + { + if (gpuStorage) + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Axis1sOffsets")); + else + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Axis1s")); + } + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(shaderStage, "BB_FeatureC2")).Valid(); + } + + PK_ASSERT(!gpuStorage || geomBB || vertexBB); // when gpuStorage is true, geomBB/vertexBB should be true. + if (gpuStorage && geomBB) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Enabled", shaderLocationBinding, RHI::TypeUint, vBufferLocationBinding)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(u32))).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + } + } + else // No geom billboard + { + success &= _CommonBillboardRibbonGeneratedInputs(uv, atlas, normal, tangent, shaderLocationBinding, vBufferLocationBinding, outShaderBindings, outVertexInputBuffer, outShaderDesc); + } + } + else if (args.m_RendererType == Renderer_Ribbon) + { + if (vertexBB) + { + const bool isC1 = options & Option_Axis_C1; + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_FeatureC0")).Valid(); + + if (gpuStorage) + { + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("SizesOffsets")); + if (isC1) + { + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Axis0sOffsets")); + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_FeatureC1")).Valid(); + } + if (outShaderDesc != null) + { + if (normal) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragNormal", RHI::TypeFloat3, RHI::InterpolationSmooth)).Valid(); + if (tangent) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragTangent", RHI::TypeFloat4, RHI::InterpolationSmooth)).Valid(); + if (uv) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV0", RHI::TypeFloat2, RHI::InterpolationSmooth)).Valid(); + if (atlas) + { + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV1", RHI::TypeFloat2, RHI::InterpolationSmooth)).Valid(); + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragAtlasID", RHI::TypeFloat, RHI::InterpolationSmooth)).Valid(); + } + if (correctDeformation) + { + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUVScaleAndOffset", RHI::TypeFloat4, RHI::InterpolationSmooth)).Valid(); + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUVFactors", RHI::TypeFloat4, RHI::InterpolationSmooth)).Valid(); + } + } + if (uv && atlas) + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_Feature_Atlas")).Valid(); + if (customTextureU) + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_Feature_CustomTextureU")).Valid(); + } + else + { + // Vertex ribbon billboarding not implemented for CPU simulation + } + } + else + { + success &= _CommonBillboardRibbonGeneratedInputs(uv, atlas, normal, tangent, shaderLocationBinding, vBufferLocationBinding, outShaderBindings, outVertexInputBuffer, outShaderDesc); + if (correctDeformation) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("UVScaleAndOffset", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUVScaleAndOffset", RHI::TypeFloat4, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))).Valid(); + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("UVFactors", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUVFactors", RHI::TypeFloat4, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))).Valid(); + } + } + } + else if (args.m_RendererType == Renderer_Mesh) + { + if (normal) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Normal", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragNormal", RHI::TypeFloat3, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))).Valid(); + } + if (tangent) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Tangent", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragTangent", RHI::TypeFloat4, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))).Valid(); + } + if (vertexColor0) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Color0", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragColor0", RHI::TypeFloat4, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))).Valid(); + } + if (uv) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("UV0", shaderLocationBinding, RHI::TypeFloat2, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV0", RHI::TypeFloat2, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat2))).Valid(); + if (atlas) + { + if (!uv1) + { + // Note: disable secondary uv set for meshes until this is properly implemented (#12340). + // We could pack have fragUV0 be a float4 when atlas is enabled + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("UV1", shaderLocationBinding, RHI::TypeFloat2, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV1", RHI::TypeFloat2, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat2))); + } + + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_Feature_Atlas")).Valid(); + } + } + if (vertexColor1) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Color1", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragColor1", RHI::TypeFloat4, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))).Valid(); + } + if (uv1) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("UV1", shaderLocationBinding, RHI::TypeFloat2, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV1", RHI::TypeFloat2, RHI::InterpolationSmooth, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat2))).Valid(); + + // To remove once #12340 is fixed. + success &= outShaderBindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "MESH_USE_UV1")).Valid(); + } + if (vertexBonesInfo) + { + // Indices: + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("BoneIds", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))).Valid(); + // Weights: + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("BoneWeights", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))).Valid(); + } + if (gpuStorage) + { + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData")); + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("MeshTransforms")); + success &= simDataConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("Indirection")); + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("MeshTransformsOffsets")); + success &= streamOffsetsConstantSet->AddConstantsLayout(RHI::SRawBufferDesc("IndirectionOffsets")); + } + else + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("MeshTransform", shaderLocationBinding, RHI::TypeFloat4x4, vBufferLocationBinding)).Valid(); + shaderLocationBinding += RHI::VarType::GetRowNumber(outShaderBindings.m_InputAttributes.Last().m_Type); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(CFloat4x4))).Valid(); + } + } + else if (args.m_RendererType == Renderer_Triangle) + { + if (vertexBB) + { + if (outShaderDesc != null) + { + if (normal) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragNormal", RHI::TypeFloat3, RHI::InterpolationSmooth)).Valid(); + if (tangent) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragTangent", RHI::TypeFloat4, RHI::InterpolationSmooth)).Valid(); + if (uv) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragUV0", RHI::TypeFloat2, RHI::InterpolationSmooth)).Valid(); + } + } + else + { + success &= _CommonBillboardRibbonGeneratedInputs(uv, atlas, normal, tangent, shaderLocationBinding, vBufferLocationBinding, outShaderBindings, outVertexInputBuffer, outShaderDesc); + } + } + else if (args.m_RendererType == Renderer_Decal) + { + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("DecalTransform", shaderLocationBinding, RHI::TypeFloat4x4, vBufferLocationBinding)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(CFloat4x4))).Valid(); + shaderLocationBinding += RHI::VarType::GetRowNumber(outShaderBindings.m_InputAttributes.Last().m_Type); + ++vBufferLocationBinding; + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("InverseDecalTransform", shaderLocationBinding, RHI::TypeFloat4x4, vBufferLocationBinding)).Valid(); + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(CFloat4x4))).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragInverseDecalTransform", RHI::TypeFloat4x4, RHI::InterpolationFlat, shaderLocationBinding)).Valid(); + shaderLocationBinding += RHI::VarType::GetRowNumber(outShaderBindings.m_InputAttributes.Last().m_Type); + ++vBufferLocationBinding; + } + else if (args.m_RendererType == Renderer_Light) + { + // We add the position for the bounding sphere vertices + success &= outShaderBindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("LightPosition", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)).Valid(); + if (outShaderDesc != null) + success &= outShaderDesc->m_VertexOutput.PushBack(RHI::SVertexOutput("fragLightPosition", RHI::TypeFloat3, RHI::InterpolationFlat, shaderLocationBinding)).Valid(); + ++shaderLocationBinding; + ++vBufferLocationBinding; + success &= outVertexInputBuffer.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(CFloat3))).Valid(); + } + else + { + PK_ASSERT_NOT_REACHED_MESSAGE("The material type is unknown"); + return false; + } + + if (sampleDepth) + { + RHI::SConstantSetLayout constSetLayout(RHI::FragmentShaderMask); + constSetLayout.AddConstantsLayout(RHI::SConstantSamplerDesc("DepthSampler", RHI::SamplerTypeSingle)); + if (!outShaderBindings.m_ConstantSets.PushBack(constSetLayout).Valid()) + return false; + outNeededConstants |= NeedSampleDepth; + } + if (sampleNormalRoughMetal) + { + RHI::SConstantSetLayout constSetLayout(RHI::FragmentShaderMask); + constSetLayout.AddConstantsLayout(RHI::SConstantSamplerDesc("NormalRoughMetalSampler", RHI::SamplerTypeSingle)); + if (!outShaderBindings.m_ConstantSets.PushBack(constSetLayout).Valid()) + return false; + outNeededConstants |= NeedSampleNormalRoughMetal; + } + if (sampleDiffuse) + { + RHI::SConstantSetLayout constSetLayout(RHI::FragmentShaderMask); + constSetLayout.AddConstantsLayout(RHI::SConstantSamplerDesc("DiffuseSampler", RHI::SamplerTypeSingle)); + if (!outShaderBindings.m_ConstantSets.PushBack(constSetLayout).Valid()) + return false; + outNeededConstants |= NeedSampleDiffuse; + } + if (useLightingInfo) + { + RHI::SConstantSetLayout lightingInfo; + RHI::SConstantSetLayout shadowsInfo; + RHI::SConstantSetLayout brdfLut; + RHI::SConstantSetLayout envMap; + CreateLightingSceneInfoConstantLayout(lightingInfo, shadowsInfo, brdfLut, envMap); + if (!outShaderBindings.m_ConstantSets.PushBack(lightingInfo).Valid() || + !outShaderBindings.m_ConstantSets.PushBack(shadowsInfo).Valid() || + !outShaderBindings.m_ConstantSets.PushBack(brdfLut).Valid() || + !outShaderBindings.m_ConstantSets.PushBack(envMap).Valid()) + return false; + outNeededConstants |= NeedLightingInfo; + } + if (atlas) + { + if (!outShaderBindings.m_ConstantSets.PushBack(SConstantAtlasKey::GetAtlasConstantSetLayout()).Valid()) + return false; + outNeededConstants |= NeedAtlasInfo; + } + if (opaque) + { + if (!outShaderBindings.m_ConstantSets.PushBack(SConstantNoiseTextureKey::GetNoiseTextureConstantSetLayout()).Valid()) + return false; + outNeededConstants |= NeedDitheringPattern; + } + return success; + } + + //---------------------------------------------------------------------------- + // + // Create the shader inputs for the material interface: + // + //---------------------------------------------------------------------------- + +#if (PK_MAT2RHI_CAN_COMPILE != 0) + // At runtime using pass description + static bool _SetOutputs(const SPassDescription &pass, + TArray &shaderDescOutputs) + { + bool success = true; + // Gather sub pass def + TMemoryView subpasses = pass.m_RenderPass->GetSubPassDefinitions(); + if (!PK_VERIFY(pass.m_SubPassIdx < subpasses.Count())) + return false; + TMemoryView outputs = subpasses[pass.m_SubPassIdx].m_OutputRenderTargets.View(); + for (u32 i = 0; i < outputs.Count(); ++i) + { + // Get Format & extract components flags + const RHI::EPixelFormat format = pass.m_FrameBufferLayout[outputs[i]].m_Format; + const RHI::EPixelFlags flags = static_cast(format & (RHI::FlagRGBA | RHI::FlagDS)); + success &= shaderDescOutputs.PushBack(RHI::SFragmentOutput(CString::Format("Output%u", i), flags)).Valid(); + } + return success; + } + + //---------------------------------------------------------------------------- + + // At offline using static definition + static bool _SetOutputs(const TMemoryView &outputs, + TArray &shaderDescOutputs) + { + bool success = true; + for (u32 i = 0; i < outputs.Count(); ++i) + { + // Get Format & extract components flags + const RHI::EPixelFlags flags = static_cast(outputs[i] & (RHI::FlagRGBA | RHI::FlagDS)); + success &= shaderDescOutputs.PushBack(RHI::SFragmentOutput(CString::Format("Output%u", i), flags)).Valid(); + } + return success; + } + + //---------------------------------------------------------------------------- + + bool SetOutputs( ESampleLibGraphicResources_RenderPass renderPass, + TArray &shaderDescOutputs) + { + if (SPassDescription::s_PassDescriptions.Empty()) + return _SetOutputs(SPassDescription::s_PassOutputsFormats[renderPass], shaderDescOutputs); + else + return _SetOutputs(SPassDescription::s_PassDescriptions[renderPass], shaderDescOutputs); + } +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) + + //---------------------------------------------------------------------------- + // + // Create the shader inputs for the material: + // + //---------------------------------------------------------------------------- + + static bool _SetMaterialInputsAndOutputs( const SGenericArgs &args, + RHI::SShaderBindings &outShaderBindings, + RHI::SConstantSetLayout *simDataConstantSet, // can be null + RHI::SConstantSetLayout *streamOffsetsConstantSet, // can be null + TArray &outVertexInputBuffer, + RHI::SShaderDescription *outShaderDesc, // outShaderDesc can be null + EShaderOptions options) + { + bool rendererPropertiesPerInstance = args.m_RendererType == Renderer_Mesh || args.m_RendererType == Renderer_Light || args.m_RendererType == Renderer_Decal; + + if (!_SetFields(args, outShaderBindings, simDataConstantSet, streamOffsetsConstantSet, outVertexInputBuffer, outShaderDesc, rendererPropertiesPerInstance ? RHI::PerInstanceInput : RHI::PerVertexInput, options)) + return false; + // Add constant set for scene infos + { + RHI::SConstantSetLayout sceneInfoLayout; + + if (!CreateSceneInfoConstantLayout(sceneInfoLayout)) + return false; + if (!outShaderBindings.m_ConstantSets.PushBack(sceneInfoLayout).Valid()) + return false; + } + // Material constant set + { + RHI::SConstantSetLayout constSetLayout; + + if (!CreateConstantSetLayout(args, "Material", constSetLayout)) + return false; + if (!constSetLayout.m_Constants.Empty() && !outShaderBindings.m_ConstantSets.PushBack(constSetLayout).Valid()) + return false; + } + // Should add constant set for billboarding + const bool vertexBB = (options & Option_VertexBillboarding) || + (options & Option_TriangleVertexBillboarding) || + (options & Option_RibbonVertexBillboarding); + if ((options & Option_GeomBillboarding) || + vertexBB || + (options & Option_GPUMesh)) + { + const bool gpuStorage = (options & Option_GPUStorage) != 0 || + (options & Option_GPUMesh) != 0; + if (!_SetGPUBillboardConstants(outShaderBindings, args.m_RendererType, vertexBB, gpuStorage)) + return false; + } + + return true; + } + + //---------------------------------------------------------------------------- + // + // Front-end material to shader bindings, used in the integration to create the render state: + // + //---------------------------------------------------------------------------- + + bool MaterialFrontendToShaderBindings( const SPrepareArg &args, + RHI::SShaderBindings &outShaderBindings, + TArray &outVertexInputBuffer, + u32 &outNeededConstants, + CDigestMD5 &outHash, + EShaderOptions options) + { + SGenericArgs genArgs(args); + + //---------------------------------------------------------------------------- + // To avoid hashing the whole shader inputs, we combine all renderer features and hash: + // - The renderer features + // - The shader options + // - The renderer type + // - The render pass + TSemiDynamicArray toHash; + CBufferDigesterMD5 digester; + + if (!PK_VERIFY(toHash.PushBack(options).Valid())) + return false; + if (!PK_VERIFY(toHash.PushBack(genArgs.m_RendererType).Valid())) + return false; + for (const SToggledRenderingFeature &settings : genArgs.m_FeaturesSettings) + { + if (!PK_VERIFY(toHash.PushBack(settings.m_FeatureName.Id()).Valid())) + return false; + } + digester.Append(toHash.RawDataPointer(), toHash.SizeInBytes()); + digester.Finalize(outHash); + //---------------------------------------------------------------------------- + + const bool gpuStorage = (options & Option_GPUStorage) != 0; + const bool vertexBB = (options & Option_VertexBillboarding) || + (options & Option_TriangleVertexBillboarding) || + (options & Option_RibbonVertexBillboarding); + const bool GPUMesh = (options & Option_GPUMesh) != 0; + const bool needSimDataConstantSet = vertexBB || GPUMesh; + const bool needStreamOffsetsConstantSet = (vertexBB && gpuStorage) || GPUMesh; + + RHI::SConstantSetLayout _simDataConstantSet(RHI::VertexShaderMask); + RHI::SConstantSetLayout _streamOffsetsConstantSet(RHI::VertexShaderMask); + RHI::SConstantSetLayout *simDataConstantSet = needSimDataConstantSet ? &_simDataConstantSet : null; + RHI::SConstantSetLayout *streamOffsetsConstantSet = needStreamOffsetsConstantSet ? &_streamOffsetsConstantSet : null; + + if (!_SetGeneratedInputs(genArgs, outShaderBindings, outNeededConstants, simDataConstantSet, streamOffsetsConstantSet, outVertexInputBuffer, null, options) || + !_SetMaterialInputsAndOutputs(genArgs, outShaderBindings, simDataConstantSet, streamOffsetsConstantSet, outVertexInputBuffer, null, options)) + return false; + + // As we generate a single fragment shader no matter the billboarding mode (CPU/Vertex/Geom) + // We add the vertex billboarding constant set layout last, making sure texture shader registers are not offset: + // register indices are shared between textures and buffers. + if (streamOffsetsConstantSet != null) + { + if (!PK_VERIFY(outShaderBindings.m_ConstantSets.PushBack(_streamOffsetsConstantSet).Valid())) + return false; + } + if (simDataConstantSet != null) + { + if (!PK_VERIFY(outShaderBindings.m_ConstantSets.PushBack(_simDataConstantSet).Valid())) + return false; + } + + return true; + } + + bool MaterialFrontendToShaderBindings( RHI::SShaderBindings &outShaderBindings, + EComputeShaderType computeShaderType) + { + switch (computeShaderType) + { + case ComputeType_ComputeParticleCountPerMesh: + FillComputeParticleCountPerMeshShaderBindings(outShaderBindings, false, false); + break; + case ComputeType_ComputeParticleCountPerMesh_MeshAtlas: + FillComputeParticleCountPerMeshShaderBindings(outShaderBindings, true, false); + break; + case ComputeType_ComputeParticleCountPerMesh_LOD: + FillComputeParticleCountPerMeshShaderBindings(outShaderBindings, false, true); + break; + case ComputeType_ComputeParticleCountPerMesh_LOD_MeshAtlas: + FillComputeParticleCountPerMeshShaderBindings(outShaderBindings, true, true); + break; + case ComputeType_InitIndirectionOffsetsBuffer: + FillInitIndirectionOffsetsBufferShaderBindings(outShaderBindings, false); + break; + case ComputeType_InitIndirectionOffsetsBuffer_LODNoAtlas: + FillInitIndirectionOffsetsBufferShaderBindings(outShaderBindings, true); + break; + case ComputeType_ComputeMeshIndirectionBuffer: + FillComputeMeshIndirectionBufferShaderBindings(outShaderBindings, false, false); + break; + case ComputeType_ComputeMeshIndirectionBuffer_MeshAtlas: + FillComputeMeshIndirectionBufferShaderBindings(outShaderBindings, true, false); + break; + case ComputeType_ComputeMeshIndirectionBuffer_LOD: + FillComputeMeshIndirectionBufferShaderBindings(outShaderBindings, false, true); + break; + case ComputeType_ComputeMeshIndirectionBuffer_LOD_MeshAtlas: + FillComputeMeshIndirectionBufferShaderBindings(outShaderBindings, true, true); + break; + case ComputeType_ComputeMeshMatrices: + FillComputeMeshMatricesShaderBindings(outShaderBindings); + break; + case ComputeType_ComputeSortKeys: + FillComputeSortKeysShaderBindings(outShaderBindings, false, false); + break; + case ComputeType_ComputeSortKeys_CameraDistance: + FillComputeSortKeysShaderBindings(outShaderBindings, true, false); + break; + case ComputeType_ComputeSortKeys_RibbonIndirection: + FillComputeSortKeysShaderBindings(outShaderBindings, false, true); + break; + case ComputeType_ComputeSortKeys_CameraDistance_RibbonIndirection: + FillComputeSortKeysShaderBindings(outShaderBindings, true, true); + break; + case ComputeType_SortUpSweep: + FillSortUpSweepShaderBindings(outShaderBindings, false); + break; + case ComputeType_SortPrefixSum: + FillSortPrefixSumShaderBindings(outShaderBindings); + break; + case ComputeType_SortDownSweep: + FillSortDownSweepShaderBindings(outShaderBindings, false); + break; + case ComputeType_SortUpSweep_KeyStride64: + FillSortUpSweepShaderBindings(outShaderBindings, true); + break; + case ComputeType_SortDownSweep_KeyStride64: + FillSortDownSweepShaderBindings(outShaderBindings, true); + break; + case ComputeType_ComputeRibbonSortKeys: + FillComputeRibbonSortKeysShaderBindings(outShaderBindings); + break; + default: + PK_ASSERT_NOT_REACHED(); + break; + } + + return true; + } + + //---------------------------------------------------------------------------- + // + // front-end material to shader desc, used offline for generating the shaders + // + //---------------------------------------------------------------------------- + +#if (PK_MAT2RHI_CAN_COMPILE != 0) + bool MaterialFrontendToShaderDesc( const SCompileArg &args, + RHI::SShaderDescription &outShaderDesc, + EShaderOptions options, + ESampleLibGraphicResources_RenderPass renderPass) + { + PK_ASSERT(args.m_RendererType != Renderer_Sound); + // Set the shader stages used: + outShaderDesc.m_Pipeline = ParticleShaderGenerator::GetShaderStagePipeline(options); + if (options & Option_GeomBillboarding) + outShaderDesc.m_DrawMode = RHI::DrawModePoint; + + TArray tmp; + + const bool gpuStorage = (options & Option_GPUStorage) != 0; + const bool vertexBB = (options & Option_VertexBillboarding) || + (options & Option_TriangleVertexBillboarding) || + (options & Option_RibbonVertexBillboarding); + const bool GPUMesh = (options & Option_GPUMesh) != 0; + const bool needSimDataConstantSet = vertexBB || GPUMesh; + const bool needStreamOffsetsConstantSet = (vertexBB && gpuStorage) || GPUMesh; + + RHI::SConstantSetLayout _simDataConstantSet(RHI::VertexShaderMask); + RHI::SConstantSetLayout _streamOffsetsConstantSet(RHI::VertexShaderMask); + RHI::SConstantSetLayout *simDataConstantSet = needSimDataConstantSet ? &_simDataConstantSet : null; + RHI::SConstantSetLayout *streamOffsetsConstantSet = needStreamOffsetsConstantSet ? &_streamOffsetsConstantSet : null; + + u32 dummyNeededConstants = 0; + SGenericArgs genArgs(args); + // fill the other data: + if (!_SetGeneratedInputs(genArgs, outShaderDesc.m_Bindings, dummyNeededConstants, simDataConstantSet, streamOffsetsConstantSet, tmp, &outShaderDesc, options) || + !_SetMaterialInputsAndOutputs(genArgs, outShaderDesc.m_Bindings, simDataConstantSet, streamOffsetsConstantSet, tmp, &outShaderDesc, options)) + return false; + + if (renderPass != __MaxParticlePass) + { + if (!SetOutputs(renderPass, outShaderDesc.m_FragmentOutput)) + return false; + + // We add the define for the current compiled render pass: + if (!PK_VERIFY(outShaderDesc.m_Bindings.m_Defines.PushBack().Valid())) + return false; + + const CStringView renderPassName = s_ParticleRenderPassNames[renderPass]; + outShaderDesc.m_Bindings.m_Defines.Last() = RHI::SShaderDefine(RHI::AllShaderMask, renderPassName.ToString()); + } + + if (streamOffsetsConstantSet != null) + { + if (!PK_VERIFY(outShaderDesc.m_Bindings.m_ConstantSets.PushBack(_streamOffsetsConstantSet).Valid())) + return false; + } + if (simDataConstantSet != null) + { + if (!PK_VERIFY(outShaderDesc.m_Bindings.m_ConstantSets.PushBack(_simDataConstantSet).Valid())) + return false; + } + + return true; + } +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) + + //---------------------------------------------------------------------------- + // + // Generate and compile the shaders from a HBO + // + //---------------------------------------------------------------------------- + +#if (PK_MAT2RHI_CAN_COMPILE != 0) + bool CompileParticleShadersFromMaterial( const SCompileArg &args, + const SShaderCompilationSettings &settings, + HBO::CContext *context) + { + PK_ASSERT(args.m_RendererType != Renderer_Sound); + CMaterialCompilation compilation(args, settings, context); + if (compilation.BuildShaderFilesList()) + return compilation.Exec(); + return false; + } +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) + + //---------------------------------------------------------------------------- + + CString GetHashedShaderName(const char *pathPrefix, + const char *path, + const CString &materialName, + const char *specialization, + const TMemoryView &features, + const CStringView &permsSuffix, + ESampleLibGraphicResources_RenderPass renderPass) + { + CBufferDigesterMD5 digester; + CDigestMD5 hashValue; + + if (pathPrefix != null) + digester.Append(pathPrefix, SNativeStringUtils::Length(pathPrefix)); + if (path != null) + digester.Append(path, SNativeStringUtils::Length(path)); + if (specialization != null) + digester.Append(specialization, SNativeStringUtils::Length(specialization)); + + digester.Append(materialName.Data(), materialName.Length()); // ie. Default_Billboard + + for (u32 i = 0; i < features.Count(); ++i) + { + if (features[i].m_Enabled) + { + const CString &featureName = features[i].m_FeatureName.ToString(); + digester.Append(featureName.Data(), featureName.Length()); + digester.Append(0); + } + } + + digester.Append(permsSuffix.Data(), permsSuffix.Length()); // ie. Fwd_VC0.. + digester.Append(renderPass); + + digester.Finalize(hashValue); + return RHI::ShaderHashToString(hashValue); + } + + //---------------------------------------------------------------------------- + + CString RemapShaderPathNoExt( const CString &shaderRoot, + const CString &shaderPath, + const CString &materialName, + RHI::EShaderStage stage, + ERendererClass rendererClass, + EShaderOptions options, + const TMemoryView &features, + ESampleLibGraphicResources_RenderPass renderPass, + CString *outShaderPermutation) + { + const char *pathPrefix = shaderPath.Empty() ? "Generated" : null; + const char *path = !shaderPath.Empty() ? CFilePath::ExtractFilename(shaderPath) : GetShaderExtensionStringFromStage(stage); + const char *specialization = null; + if (rendererClass == ERendererClass::Renderer_Mesh && stage == RHI::VertexShaderStage) + specialization = "Mesh_"; + + char storage[256]; + const CStringView shaderName = ShaderOptionsUtils::GetShaderName(options, stage, storage); + if (!PK_VERIFY(!shaderName.Empty())) + return null; + PK_ASSERT(shaderName.Data()[shaderName.Length()] == '\0'); // Must be null-terminated for the code below to work + + if (outShaderPermutation != null) + { + *outShaderPermutation = CString::Format("%s%s.%s_" + "%s", + pathPrefix != null ? pathPrefix : "", path == null ? "" : path, materialName.Data(), + specialization != null ? specialization : ""); + + for (const SToggledRenderingFeature &feature : features) + { + if (feature.m_Enabled) + { + *outShaderPermutation += feature.m_FeatureName.ToStringView(); + *outShaderPermutation += CStringView("_"); + } + } + *outShaderPermutation += s_ParticleRenderPassNames[renderPass]; + *outShaderPermutation += CStringView("_"); + *outShaderPermutation += shaderName; + } + + return shaderRoot / GetHashedShaderName(pathPrefix, path, materialName, specialization, features, shaderName, renderPass); + } + +#if (PK_MAT2RHI_CAN_COMPILE != 0) + //---------------------------------------------------------------------------- + // + // CMaterialCompilation + // + //---------------------------------------------------------------------------- + + static const EShaderOptions kShaderOptions_Regular[] = + { + Option_VertexPassThrough, + }; + + //---------------------------------------------------------------------------- + + static const EShaderOptions kShaderOptions_GeomBB[] = + { + Option_VertexPassThrough, + + // Basic geoms: + Option_VertexPassThrough | Option_GeomBillboarding, + Option_VertexPassThrough | Option_GeomBillboarding | Option_Axis_C1, + Option_VertexPassThrough | Option_GeomBillboarding | Option_Axis_C1 | Option_Capsule, + Option_VertexPassThrough | Option_GeomBillboarding | Option_Axis_C2, + // Geoms size float2: + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_GeomBillboarding, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_GeomBillboarding | Option_Axis_C1, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_GeomBillboarding | Option_Axis_C1 | Option_Capsule, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_GeomBillboarding | Option_Axis_C2, + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + // Basic geoms: + Option_VertexPassThrough | Option_GeomBillboarding | Option_GPUStorage, + Option_VertexPassThrough | Option_GeomBillboarding | Option_Axis_C1 | Option_GPUStorage, + Option_VertexPassThrough | Option_GeomBillboarding | Option_Axis_C1 | Option_Capsule | Option_GPUStorage, + Option_VertexPassThrough | Option_GeomBillboarding | Option_Axis_C2 | Option_GPUStorage, + // Geoms size float2: + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_GeomBillboarding | Option_GPUStorage, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_GeomBillboarding | Option_Axis_C1 | Option_GPUStorage, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_GeomBillboarding | Option_Axis_C1 | Option_Capsule | Option_GPUStorage, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_GeomBillboarding | Option_Axis_C2 | Option_GPUStorage, +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + }; + + //---------------------------------------------------------------------------- + + static const EShaderOptions kShaderOptions_VertexBB[] = + { + Option_VertexPassThrough, + + // Basic geoms: + Option_VertexPassThrough | Option_VertexBillboarding, + Option_VertexPassThrough | Option_VertexBillboarding | Option_Axis_C1, + Option_VertexPassThrough | Option_VertexBillboarding | Option_Axis_C1 | Option_Capsule, + Option_VertexPassThrough | Option_VertexBillboarding | Option_Axis_C2, + + // Geoms size float2: + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_VertexBillboarding, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C1, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C1 | Option_Capsule, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C2, + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + // Basic geoms: + Option_VertexPassThrough | Option_VertexBillboarding | Option_GPUStorage, + Option_VertexPassThrough | Option_VertexBillboarding | Option_Axis_C1 | Option_GPUStorage, + Option_VertexPassThrough | Option_VertexBillboarding | Option_Axis_C1 | Option_Capsule | Option_GPUStorage, + Option_VertexPassThrough | Option_VertexBillboarding | Option_Axis_C2 | Option_GPUStorage, + // Geoms size float2: + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_GPUStorage, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C1 | Option_GPUStorage, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C1 | Option_Capsule | Option_GPUStorage, + Option_VertexPassThrough | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C2 | Option_GPUStorage, + + // Basic geoms: + Option_VertexPassThrough | Option_GPUSort | Option_VertexBillboarding | Option_GPUStorage, + Option_VertexPassThrough | Option_GPUSort | Option_VertexBillboarding | Option_Axis_C1 | Option_GPUStorage, + Option_VertexPassThrough | Option_GPUSort | Option_VertexBillboarding | Option_Axis_C1 | Option_Capsule | Option_GPUStorage, + Option_VertexPassThrough | Option_GPUSort | Option_VertexBillboarding | Option_Axis_C2 | Option_GPUStorage, + // Geoms size float2: + Option_VertexPassThrough | Option_GPUSort | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_GPUStorage, + Option_VertexPassThrough | Option_GPUSort | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C1 | Option_GPUStorage, + Option_VertexPassThrough | Option_GPUSort | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C1 | Option_Capsule | Option_GPUStorage, + Option_VertexPassThrough | Option_GPUSort | Option_BillboardSizeFloat2 | Option_VertexBillboarding | Option_Axis_C2 | Option_GPUStorage, + +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + }; + + //---------------------------------------------------------------------------- + + static const EShaderOptions kShaderOptions_TriangleVertexBB[] = + { + Option_VertexPassThrough, + + Option_VertexPassThrough | Option_TriangleVertexBillboarding, + }; + + + //---------------------------------------------------------------------------- + + static const EShaderOptions kShaderOptions_GPUmesh[] = + { + Option_VertexPassThrough, + + Option_VertexPassThrough | Option_GPUMesh, + }; + + //---------------------------------------------------------------------------- + + static const EShaderOptions kShaderOptions_RibbonVertexBB[] = + { + Option_VertexPassThrough, + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + Option_VertexPassThrough | Option_GPUStorage, + + // Basic geoms: + Option_VertexPassThrough | Option_GPUStorage | Option_RibbonVertexBillboarding, + Option_VertexPassThrough | Option_GPUStorage | Option_RibbonVertexBillboarding | Option_Axis_C1, + + // GPU camera sort + // Basic geoms: + Option_VertexPassThrough | Option_GPUStorage | Option_RibbonVertexBillboarding | Option_GPUSort, + Option_VertexPassThrough | Option_GPUStorage | Option_RibbonVertexBillboarding | Option_Axis_C1 | Option_GPUSort, + +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + }; + + //---------------------------------------------------------------------------- + + CMaterialCompilation::CMaterialCompilation( const SCompileArg &args, + const SShaderCompilationSettings &settings, + HBO::CContext *context) + : m_Args(args) + , m_Settings(settings) + , m_FSController(context->FileController()) + { + } + + //---------------------------------------------------------------------------- + + CMaterialCompilation::~CMaterialCompilation() + { + } + + //---------------------------------------------------------------------------- + + bool CMaterialCompilation::_AddShaderFileForCompilation( const CString &inputPath, + const CString &outputPath, + const CString &shaderPermutation, + RHI::EShaderStage stage, + ESampleLibGraphicResources_RenderPass renderPass, + EShaderOptions option, + RHI::EGraphicalApi api) + { + if (!PK_VERIFY(m_ShaderFiles.PushBack().Valid())) + return false; + SFileCompilation &compilation = m_ShaderFiles.Last(); + compilation.m_InputPath = inputPath; + compilation.m_OutputPath = outputPath; + compilation.m_ShaderPermutation = shaderPermutation; + compilation.m_Stage = stage; + compilation.m_Option = option; + compilation.m_Api = api; + compilation.m_RenderPass = renderPass; + return true; + } + + //---------------------------------------------------------------------------- + + bool CMaterialCompilation::_FileRequiresCompilation(const CString &compiledFilePath, u64 srcFileTimestamp) + { + SFileTimes fileTimes; + if (!m_FSController->Timestamps(compiledFilePath, fileTimes)) + return true; + return fileTimes.m_LastWriteTime < srcFileTimestamp; + } + + //---------------------------------------------------------------------------- + + bool CMaterialCompilation::_BuildShaderFilesListForOptions(TMemoryView options, ESampleLibGraphicResources_RenderPass renderPass) + { + PK_ASSERT(!m_Settings.m_Targets.Empty()); + + TArray compiledShaders; + const u32 shaderCount = options.Count() * m_Settings.m_Targets.Count(); + if (!PK_VERIFY(compiledShaders.Reserve(shaderCount)) || + !PK_VERIFY(m_ShaderFiles.Reserve(shaderCount))) + return false; + + const CString &materialName = m_Args.m_MaterialSettings.m_MaterialName; + const CString &vertexShaderPath = m_Args.m_MaterialSettings.m_VertexShaderPath; + const CString &fragmentShaderPath = m_Args.m_MaterialSettings.m_FragmentShaderPath; + + const bool forceRebuild = m_Settings.m_ForceRecreate; + for (EShaderOptions option : options) + { + const RHI::EShaderStagePipeline stagesForOption = ParticleShaderGenerator::GetShaderStagePipeline(option); + + // .meta file content (full desc of shader options) + CString vertexPermutation; + CString geomPermutation; + CString fragmentPermutation; + + // Full paths (api independent) + const CString vertexShaderNoExt = RemapShaderPathNoExt(m_Settings.m_OutputFolder, vertexShaderPath, materialName, RHI::VertexShaderStage, m_Args.m_RendererType, option, m_Args.m_FeaturesSettings.View(), renderPass, &vertexPermutation); + const CString geomShaderNoExt = RemapShaderPathNoExt(m_Settings.m_OutputFolder, null, materialName, RHI::GeometryShaderStage, m_Args.m_RendererType, option, m_Args.m_FeaturesSettings.View(), renderPass, &geomPermutation); + const CString fragmentShaderNoExt = RemapShaderPathNoExt(m_Settings.m_OutputFolder, fragmentShaderPath, materialName, RHI::FragmentShaderStage, m_Args.m_RendererType, option, m_Args.m_FeaturesSettings.View(), renderPass, &fragmentPermutation); + + // We remove the already compiled stages: + u32 stagesToCompile = stagesForOption; + const bool containsVertexShader = !forceRebuild && compiledShaders.Contains(vertexShaderNoExt); + const bool containsGeomShader = !forceRebuild && compiledShaders.Contains(geomShaderNoExt); + const bool containsFragmentShader = !forceRebuild && compiledShaders.Contains(fragmentShaderNoExt); + + stagesToCompile &= ~(containsVertexShader ? RHI::VertexShaderMask : 0); + stagesToCompile &= ~(containsGeomShader ? RHI::GeometryShaderMask : 0); + stagesToCompile &= ~(containsFragmentShader ? RHI::FragmentShaderMask : 0); + + if ((stagesToCompile & RHI::VertexShaderMask) != 0) + PK_VERIFY(compiledShaders.PushBack(vertexShaderNoExt).Valid()); + if ((stagesToCompile & RHI::GeometryShaderMask) != 0) + PK_VERIFY(compiledShaders.PushBack(geomShaderNoExt).Valid()); + if ((stagesToCompile & RHI::FragmentShaderMask) != 0) + PK_VERIFY(compiledShaders.PushBack(fragmentShaderNoExt).Valid()); + + for (u32 i = 0; i < m_Settings.m_Targets.Count(); ++i) + { + const RHI::EGraphicalApi api = m_Settings.m_Targets[i].m_Target; + const char *shadersExt = GetShaderExtensionStringFromApi(api); + + if ((stagesForOption & RHI::GeometryShaderMask) != 0) + { + // unsupported geometry shaders on orbis/metal + if (api == RHI::EGraphicalApi::GApi_Orbis || + api == RHI::EGraphicalApi::GApi_UNKNOWN2 || + api == RHI::EGraphicalApi::GApi_Metal) + continue; + } + + if ((stagesToCompile & RHI::VertexShaderMask) != 0) + { + const CString fileDst = vertexShaderNoExt + shadersExt; + if (forceRebuild || _FileRequiresCompilation(fileDst, m_Args.m_SourceTimestamps.m_Vertex)) + { + if (!_AddShaderFileForCompilation(vertexShaderPath, fileDst, vertexPermutation, RHI::VertexShaderStage, renderPass, option, api)) + return false; + } + } + if ((stagesToCompile & RHI::GeometryShaderMask) != 0) + { + const CString fileDst = geomShaderNoExt + shadersExt; + if (forceRebuild || _FileRequiresCompilation(fileDst, m_Args.m_SourceTimestamps.m_Vertex)) + { + if (!_AddShaderFileForCompilation(vertexShaderPath, fileDst, geomPermutation, RHI::GeometryShaderStage, renderPass, option, api)) + return false; + } + } + if ((stagesToCompile & RHI::FragmentShaderMask) != 0) + { + const CString fileDst = fragmentShaderNoExt + shadersExt; + if (forceRebuild || _FileRequiresCompilation(fileDst, m_Args.m_SourceTimestamps.m_Fragment)) + { + if (!_AddShaderFileForCompilation(fragmentShaderPath, fileDst, fragmentPermutation, RHI::FragmentShaderStage, renderPass, option, api)) + return false; + } + } + } + } + return true; + } + + //---------------------------------------------------------------------------- + + bool CMaterialCompilation::BuildShaderFilesList() + { + for (u32 i = 0; i < m_Args.m_RenderPasses.Count(); ++i) + { + ESampleLibGraphicResources_RenderPass renderPass = m_Args.m_RenderPasses[i]; + + // Generate with different options needed + const bool geomBB = m_Settings.m_GenerateGeometryBBShaders; + const bool vertexBB = m_Settings.m_GenerateVertexBBShaders; + + if (m_Settings.m_Targets.Empty()) + continue; + + if (!m_Args.m_OptionsOverride.Empty()) + { + if (!_BuildShaderFilesListForOptions(m_Args.m_OptionsOverride, renderPass)) + return false; + } + else if (m_Args.m_RendererType == Renderer_Billboard && + (vertexBB || geomBB)) + { + bool success = true; + if (geomBB) + success &= _BuildShaderFilesListForOptions(kShaderOptions_GeomBB, renderPass); + if (vertexBB) + success &= _BuildShaderFilesListForOptions(kShaderOptions_VertexBB, renderPass); + if (!success) + return false; + } + else if (m_Args.m_RendererType == Renderer_Triangle && + (vertexBB || geomBB)) + { + bool success = true; + // TODO: Geom billboarding + if (vertexBB) + success &= _BuildShaderFilesListForOptions(kShaderOptions_TriangleVertexBB, renderPass); + if (!success) + return false; + } + else if (m_Args.m_RendererType == Renderer_Mesh) + { + bool success = true; + success &= _BuildShaderFilesListForOptions(kShaderOptions_GPUmesh, renderPass); + if (!success) + return false; + } + else if (m_Args.m_RendererType == Renderer_Ribbon) + { + bool success = true; + success &= _BuildShaderFilesListForOptions(kShaderOptions_RibbonVertexBB, renderPass); + if (!success) + return false; + } + if (!_BuildShaderFilesListForOptions(kShaderOptions_Regular, renderPass)) + return false; + } + return true; + } + + //---------------------------------------------------------------------------- + + bool CMaterialCompilation::Partial(u32 taskNb) const + { +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + if (!PK_VERIFY(taskNb < m_ShaderFiles.Count())) + return false; + + bool result = true; + const SFileCompilation &compilation = m_ShaderFiles[taskNb]; + RHI::SShaderDescription shaderDesc; + + if (!MaterialFrontendToShaderDesc(m_Args, shaderDesc, compilation.m_Option, compilation.m_RenderPass)) + { + CLog::Log(PK_ERROR, "Cannot create the shader description for this material instance"); + return false; + } + CShaderCompilation shaderCompilation( compilation.m_InputPath, + compilation.m_OutputPath, + compilation.m_ShaderPermutation, + compilation.m_Stage, + compilation.m_Option, + shaderDesc, + m_Settings); + result &= shaderCompilation.Exec(compilation.m_Api, m_FSController); + if (!result) + CLog::Log(PK_ERROR, "Compilation failed for shader %s", compilation.m_OutputPath.Data()); + return result; +#else + CLog::Log(PK_ERROR, "Cannot compile shaders at runtime on this platform"); + return result; +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + } + + //---------------------------------------------------------------------------- + + bool CMaterialCompilation::Exec() const + { + bool success = true; + for (u32 i = 0; i < ShaderCount(); ++i) + { + success &= Partial(i); + } + return success; + } +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) + +} // namespace MaterialToRHI + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/MaterialToRHI.h b/Samples/PK-SampleLib/RenderIntegrationRHI/MaterialToRHI.h new file mode 100644 index 00000000..f85db676 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/MaterialToRHI.h @@ -0,0 +1,266 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#include +#include + +#include +#include +#include "PK-SampleLib/ShaderGenerator/ShaderGenerator.h" +#include "PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) && (PK_COMPILER_BUILD_COMPILER != 0) // No shader compilation without graph compiler (Needs access to export nodes) +# define PK_MAT2RHI_CAN_COMPILE 1 +#else +# define PK_MAT2RHI_CAN_COMPILE 0 +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +#if (PK_MAT2RHI_CAN_COMPILE != 0) +// Wrapper around the fs controller (shaders compilation system issues tons of Timestamps OS requests) +// PK-Editor overrides this, default implementation just forwards the requests +// !Only works with virtual paths +class CRHIShadersCompilationFileSystem : public CNonCopyable +{ +public: + CRHIShadersCompilationFileSystem(IFileSystem *fsController) : m_FSController(fsController) { PK_ASSERT(m_FSController != null); } + + virtual u64 FileLastModifiedTime(const CString &path) const + { + SFileTimes timestamps; + if (m_FSController->Timestamps(path, timestamps)) + return timestamps.m_LastWriteTime; + return 0; + } + + // note(Paul): Add getter for preprocessing shaders. + // kind of breaks the whole point of this wrapper... + IFileSystem *GetFileSystem() const { return m_FSController; } + +protected: + IFileSystem *m_FSController; +}; +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) + +//---------------------------------------------------------------------------- + +namespace MaterialToRHI +{ + enum EFeatureDependantBindings + { + NeedSampleDepth = (1 << 0), + NeedSampleNormalRoughMetal = (1 << 1), + NeedSampleDiffuse = (1 << 2), + NeedLightingInfo = (1 << 3), + NeedAtlasInfo = (1 << 4), + NeedDitheringPattern = (1 << 5), + }; + +#if (PK_MAT2RHI_CAN_COMPILE != 0) + struct SCompileArg + { + struct STimestamps + { + STimestamps() : m_Vertex(0), m_Fragment(0) { } + + u64 m_Vertex; + u64 m_Fragment; + }; + + STimestamps m_SourceTimestamps; + CString m_ShaderFolder; // Default shader folder + + TArray m_Fields; + TArray m_Properties; + + TArray m_FeaturesSettings; + SMaterialSettings m_MaterialSettings; + ERendererClass m_RendererType; + + CRenderPassArray m_RenderPasses; + + TArray m_OptionsOverride; + + // Only used when this is initialized from a material: + PCParticleRendererMaterial m_Material; + + SCompileArg(const SCompileArg &oth); + SCompileArg(const ERendererClass rendererType, + const CString &shaderFolder); + + // Init from material: + bool InitFromRendererFeatures(const PCParticleRendererMaterial &material); + bool ComputeSourceShadersTimestamps(const CString &materialPath, const CRHIShadersCompilationFileSystem &fs); + bool SetShaderCombination(u32 combination); + + // Init from renderer: + bool InitFromRendererData( const PCRendererDataBase &renderer, + HBO::CContext *context); + + bool _HasProperty(CStringId materialProperty) const; + void _FindParticleRenderPasses(); + }; +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) + + // Struct to contains generic data used by intermediate functions + // can construct from SCompileArg and SPrepareArg + struct SGenericArgs + { + TMemoryView m_FieldDefinitions; + TMemoryView m_FeaturesSettings; + TMemoryView m_Properties; + ERendererClass m_RendererType; + + SGenericArgs(const SPrepareArg &args) + : m_FieldDefinitions(args.m_Renderer->m_Declaration.m_AdditionalFields) + , m_FeaturesSettings(args.m_FeaturesSettings) + , m_Properties(args.m_Renderer->m_Declaration.m_Properties) + , m_RendererType(args.m_Renderer->m_RendererType) + { + } + +#if (PK_MAT2RHI_CAN_COMPILE != 0) + SGenericArgs(const SCompileArg &args) + : m_FieldDefinitions(args.m_Fields) + , m_FeaturesSettings(args.m_FeaturesSettings) + , m_Properties(args.m_Properties) + , m_RendererType(args.m_RendererType) + { + } +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) + }; + + struct STextureProperty + { + const SRendererFeaturePropertyValue *m_Property; + bool m_LoadAsSRGB; + }; + + // Find particle render passes depending on enabled features: + void FindParticleRenderPasses(CRenderPassArray &renderPasses, ERendererClass renderer, const FastDelegate &hasProperty); + // Generic function to populate array of settings (offline: renderer = null, combination = X...) (runtime: renderer = 0x..., combination = ~0) + bool PopulateSettings( const PCParticleRendererMaterial &material, + const ERendererClass rendererType, + const PCRendererDataBase renderer, + TArray *featuresSettings = null, + SMaterialSettings *materialSettings = null); + + // Generic function to generate constant set layout + bool CreateConstantSetLayout(const SGenericArgs &args, + const CString &constantBuffName, + RHI::SConstantSetLayout &outConstSetLayout, + TArray *outTextureArray = null, + TArray *outconstantArra = null, + CDigestMD5 *contentHash = null); + + // Generate shader bindings from PrepareArg + bool MaterialFrontendToShaderBindings( const SPrepareArg &args, + RHI::SShaderBindings &outShaderBindings, + TArray &outVertexInputBuffer, + u32 &outNeededConstants, + CDigestMD5 &outHash, + EShaderOptions options); + + bool MaterialFrontendToShaderBindings( RHI::SShaderBindings &outShaderBindings, + EComputeShaderType computeShaderType); + + CString GetHashedShaderName(const char *pathPrefix, + const char *path, + const CString &materialName, + const char *specialization, + const TMemoryView &features, + const CStringView &permsSuffix); + + CString RemapShaderPathNoExt( const CString &shaderRoot, + const CString &shaderPath, + const CString &materialName, + RHI::EShaderStage stage, + ERendererClass rendererClass, + EShaderOptions options, + const TMemoryView &features, + ESampleLibGraphicResources_RenderPass renderPass, + CString *outShaderPermutation = null); + +#if (PK_MAT2RHI_CAN_COMPILE != 0) + // Fill the current output for a specific render pass: + bool SetOutputs( ESampleLibGraphicResources_RenderPass renderPass, + TArray &shaderDescOutputs); + + // Generate shader description from CompileArg + bool MaterialFrontendToShaderDesc( const SCompileArg &args, + RHI::SShaderDescription &outShaderDesc, + EShaderOptions options, + ESampleLibGraphicResources_RenderPass renderPass = __MaxParticlePass); + + // Generate shaders from CompileArg + bool CompileParticleShadersFromMaterial( const SCompileArg &args, + const SShaderCompilationSettings &settings, + HBO::CContext *context); + + // Material Compilation + class CMaterialCompilation : public CRefCountedObject + { + private: + const SCompileArg &m_Args; + const SShaderCompilationSettings &m_Settings; + IFileSystem *m_FSController; + + struct SFileCompilation + { + CString m_InputPath; + CString m_OutputPath; + CString m_ShaderPermutation; + RHI::EShaderStage m_Stage; + EShaderOptions m_Option; + ESampleLibGraphicResources_RenderPass m_RenderPass; + RHI::EGraphicalApi m_Api; + CString m_PrecompileError; + }; + TArray m_ShaderFiles; + + bool _AddShaderFileForCompilation( const CString &inputPath, + const CString &outputPath, + const CString &shaderPermutation, + RHI::EShaderStage stage, + ESampleLibGraphicResources_RenderPass renderPass, + EShaderOptions option, + RHI::EGraphicalApi api); + bool _FileRequiresCompilation(const CString &compiledFilePath, u64 srcFileTimestamp); + bool _BuildShaderFilesListForOptions(TMemoryView options, ESampleLibGraphicResources_RenderPass renderPass); + + public: + CMaterialCompilation( const SCompileArg &args, + const SShaderCompilationSettings &settings, + HBO::CContext *context); + ~CMaterialCompilation(); + + bool BuildShaderFilesList(); // Returns true if there are shader files to build + bool Exec() const; + + // Number of shader to compile (api independent) + u32 ShaderCount() const { return m_ShaderFiles.Count(); } + bool Partial(u32 taskNb) const; + const CString &GetShaderName(u32 taskNb) const { return m_ShaderFiles[taskNb].m_OutputPath; } + RHI::EShaderStage GetShaderStage(u32 taskNb) const { return m_ShaderFiles[taskNb].m_Stage; } + RHI::EGraphicalApi GetApiShader(u32 taskNb) const { return m_ShaderFiles[taskNb].m_Api; } + }; + PK_DECLARE_REFPTRCLASS(MaterialCompilation); +#endif // (PK_MAT2RHI_CAN_COMPILE != 0) +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy.cpp new file mode 100644 index 00000000..70fb736d --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy.cpp @@ -0,0 +1,3723 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "RHIBillboardingBatchPolicy.h" + +#include "RHIParticleRenderDataFactory.h" +#include "pk_render_helpers/include/render_features/rh_features_basic.h" + +#include +#include + +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) +# include +# include +# include +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) +# include +# include +# include +#endif +#if (PK_PARTICLES_UPDATER_USE_UNKNOWN2 != 0) +# include +# include +#endif + +#include "PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.h" +#include "RHIRenderIntegrationConfig.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +// Maximum number of draw requests batched in a single billboarding batch policy (1 draw request = 1 particle renderer being drawn) +static u32 kMaxGeomDrawRequestCount = 0x100; +static u32 kMaxGPUDrawRequestCount = 0x100; + +// PK-SampleLib implementation of batches policies: +// We created a master implementation that handles all renderer types so it's easier to read and understand +// You can create a single policy per batch as batches are created by your TParticleRenderDataFactory + +// Batch policies purpose are to allocate, map, unmap and clear vertex buffers and to issue draw calls +// When creating your own, you should take this implementation as reference + +// This implementation is both used by samples and v2 editor + +//---------------------------------------------------------------------------- +// +// Billboarding batch policy: +// +//---------------------------------------------------------------------------- + +CRHIBillboardingBatchPolicy::CRHIBillboardingBatchPolicy() +: m_GPUStorage(false) +, m_RendererType(Renderer_Invalid) +, m_UnusedCounter(0) +{ + _ClearFrame(); +} + +//---------------------------------------------------------------------------- + +CRHIBillboardingBatchPolicy::~CRHIBillboardingBatchPolicy() +{ +} + +//---------------------------------------------------------------------------- +// +// Cull draw requests with some custom metric, here we cull some draw request depending on the rendering pass +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::CanRender(const Drawers::SBillboard_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::CanRender(const Drawers::SRibbon_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::CanRender(const Drawers::SMesh_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::CanRender(const Drawers::SDecal_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::CanRender(const Drawers::STriangle_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::CanRender(const Drawers::SLight_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::CanRender(const Drawers::SSound_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsPostUpdateFencePass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::Tick(SRenderContext &ctx, const TMemoryView &views) +{ + (void)views; (void)ctx; + // Tick function called on draw calls thread, here we remove ourselves if we haven't been used for rendering after 10 (collected) frames: + // 10 PKFX Update()/UpdateFence() without being drawn + if (m_UnusedCounter++ > 10) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::AreBillboardingBatchable(const PCRendererCacheBase &firstCache, const PCRendererCacheBase &secondCache) const +{ + // Return true if firstCache and secondCache can be batched together (same draw call) + // Simplest approach here is to break batching when those two materials are incompatible (varying uniforms, mismatching textures, ..) + return firstCache == secondCache || + *checked_cast(firstCache.Get()) == + *checked_cast(secondCache.Get()); +} + +//---------------------------------------------------------------------------- +// +// Buffers allocations +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::AllocBuffers(SRenderContext &ctx, const SBuffersToAlloc &allocBuffers, const TMemoryView &views, ERendererClass rendererType) +{ + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::AllocBuffers"); + + // Reset the unused counter + m_UnusedCounter = 0; + + // Clear previous frame data + _ClearFrame(allocBuffers.m_ToGenerate.m_PerViewGeneratedInputs.Count()); + + PK_ASSERT(!allocBuffers.m_DrawRequests.Empty()); + PK_ASSERT(allocBuffers.m_DrawRequests.Count() == allocBuffers.m_RendererCaches.Count()); + PK_ASSERT((allocBuffers.m_TotalVertexCount > 0 && allocBuffers.m_TotalIndexCount > 0) || + allocBuffers.m_TotalParticleCount > 0); + PK_ASSERT(allocBuffers.m_DrawRequests.First() != null); + + m_GPUStorage = allocBuffers.m_DrawRequests.First()->StreamToRender_MainMemory() == null; + if (m_RendererType == Renderer_Invalid) + { + m_RendererType = rendererType; + } + else if (!PK_VERIFY(m_RendererType == rendererType)) + { + return false; + } + m_TotalBBox = allocBuffers.m_TotalBBox; + + if (m_RendererType == Renderer_Sound) + { + m_TotalParticleCount = allocBuffers.m_TotalParticleCount; + // For sounds, no vertex buffers allocate/map, we'll just need the main view matrix later (so we can implement doppler) when issuing the "draw calls" + PK_ASSERT(!views.Empty()); + m_MainViewMatrix = views[0].m_InvViewMatrix.Inverse(); + return true; + } + + RHI::PApiManager manager = ctx.ApiManager(); + + // Setup counts + m_TotalParticleCount = allocBuffers.m_TotalParticleCount; + m_TotalVertexCount = allocBuffers.m_TotalVertexCount; + m_TotalIndexCount = allocBuffers.m_TotalIndexCount; + m_IndexSize = (m_TotalVertexCount > 0xFFFF) ? sizeof(u32) : sizeof(u16); + + // Can help avoid GPU buffers resizing + // You'll need a proper GPU buffers pooling system in your engine + m_TotalParticleCount_OverEstimated = Mem::Align(m_TotalParticleCount, 0x100); + m_TotalVertexCount_OverEstimated = Mem::Align(m_TotalVertexCount, 0x1000); + m_TotalIndexCount_OverEstimated = Mem::Align(m_TotalIndexCount, 0x1000); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + const bool canDrawSelectedParticles = !m_GPUStorage && (m_RendererType != Renderer_Sound) && (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()); + const u32 elemCount = m_TotalVertexCount != 0 ? m_TotalVertexCount : m_TotalParticleCount; + const u32 overEstimatedElemCount = m_TotalVertexCount_OverEstimated != 0 ? m_TotalVertexCount_OverEstimated : m_TotalParticleCount_OverEstimated; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Selection Vertex Buffer"), canDrawSelectedParticles, manager, m_IsParticleSelected, RHI::VertexBuffer, overEstimatedElemCount * sizeof(float), elemCount * sizeof(float))) + return false; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + //---------------------------------------------------------------------------- + // View independent inputs: + // SBuffersToAlloc contains what is needed to construct your vertex declaration + + if (m_RendererType != Renderer_Light) + { + if (m_GPUStorage) + { + // GPU simulated particles: their data is already on GPU + if (!_AllocateBuffers_GPU(manager, allocBuffers)) + return false; + } + else + { + // CPU simulated particles: their data from RAM need to be copied to GPU buffers + if (!_AllocateBuffers_Main(manager, allocBuffers)) + return false; + if (!_AllocateBuffers_GeomShaderBillboarding(manager, allocBuffers.m_ToGenerate.m_GeneratedInputs)) + return false; + } + } + else + { + if (!_AllocateBuffers_Lights(manager, allocBuffers.m_ToGenerate)) + return false; + } + + if (!allocBuffers.m_IsNewFrame) + return true; + // Only allocate additional input buffers if we are billboarding a new collected frame (see documentation for more detail) + if (!_AllocateBuffers_AdditionalInputs(manager, allocBuffers.m_ToGenerate)) + return false; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_AllocateBuffers_GPU(const RHI::PApiManager &manager, const SBuffersToAlloc &allocBuffers) +{ + // GPU Storage: the draw request data is contained on GPU memory because the simulation happens on the GPU + // In that case, the draw calls and billboarding process is not the same + + // PK-SampleLib code only supports billboards and meshes for GPU sim right now + PK_ASSERT(m_RendererType == Renderer_Billboard || m_RendererType == Renderer_Mesh); + + // GPU sim: we don't allocate any vertex buffers, the sim buffers will be used directly as input to the vertex/geom shaders: + // we issue an indirect draw, using the storage's particle count, stored in GPU memory + // So we'll just need to map GPU sim buffers for our draw call + m_DrawRequestCount = allocBuffers.m_DrawRequests.Count(); + + if (m_RendererType == Renderer_Billboard) + { + const u32 size = sizeof(RHI::SDrawIndirectArgs) * m_DrawRequestCount; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Billboard DrawRequests Buffer"), true, manager, m_IndirectDraw, RHI::IndirectDrawBuffer, size, size)) + return false; + } + else if (m_RendererType == Renderer_Mesh) + { + m_MeshCount = 0; + const u32 lodCount = allocBuffers.m_RendererCaches.First()->LODCount(); + for (u32 i = 0; i < lodCount; ++i) + m_MeshCount += allocBuffers.m_RendererCaches.First()->m_PerLODMeshCount[i]; + m_HasMeshIDs = allocBuffers.m_HasMeshIDs; + m_HasMeshLODs = allocBuffers.m_HasMeshLODs; + if (!PK_VERIFY(m_PerMeshIndexCount.Resize(m_MeshCount))) + return false; + + CRendererCacheInstance_UpdateThread *refCacheInstance = static_cast(allocBuffers.m_RendererCaches.First().Get()); + PKSample::PCRendererCacheInstance rCacheInstance = refCacheInstance->RenderThread_GetCacheInstance(); + bool hasNoMesh = rCacheInstance == null || rCacheInstance->m_AdditionalGeometry == null; + for (u32 i = 0; i < m_PerMeshIndexCount.Count(); i++) + { + if (hasNoMesh) + { + m_PerMeshIndexCount[i] = 0; + } + else + { + // TODO: Maybe handle indexCounts in allocbuffer ? + const Utils::GpuBufferViews &bufferView = rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews[i]; + + // Get index count + u32 indexCount; + if (bufferView.m_IndexBufferSize == RHI::IndexBuffer16Bit) + indexCount = bufferView.m_IndexBuffer->GetByteSize() / sizeof(u16); + else if (bufferView.m_IndexBufferSize == RHI::IndexBuffer32Bit) + indexCount = bufferView.m_IndexBuffer->GetByteSize() / sizeof(u32); + else + { + PK_ASSERT_NOT_REACHED(); + return false; + } + m_PerMeshIndexCount[i] = indexCount; + } + } + + // Indirect draw buffer + const u32 indirectBufferSizeInBytes = sizeof(RHI::SDrawIndexedIndirectArgs) * m_MeshCount * m_DrawRequestCount; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Indirect Draw Args Buffer"), true, manager, m_IndirectDraw, RHI::RawIndirectDrawBuffer, indirectBufferSizeInBytes, indirectBufferSizeInBytes)) + return false; + + // Indirection buffer + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Indirection Buffer"), true, manager, m_Indirection, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(u32), m_TotalParticleCount_OverEstimated * sizeof(u32))) + return false; + // Indirection offsets buffer: + // * Mesh atlas enabled: one u32 per sub mesh (sub mesh array is "flat" when LODs are enabled, total sub meshes is the total number of sub meshes per LODs) + // * LOD enabled: one u32 per lod level + // * No mesh atlas/LOD: one u32 per draw request + // times 2, the first part of the buffer is used as a scratch buffer for computing the per-particle indirections + const u32 indirectionOffsetsSizeInBytes = 2 * m_DrawRequestCount * sizeof(u32) * (m_HasMeshIDs ? m_MeshCount : (m_HasMeshLODs ? allocBuffers.m_RendererCaches.First()->LODCount() : 1)); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Indirection Offsets Buffer"), true, manager, m_IndirectionOffsets, RHI::RawBuffer, indirectionOffsetsSizeInBytes, indirectionOffsetsSizeInBytes)) + return false; + + // Allocate once, max number of draw requests, indexed by DC from push constant + const u32 offsetsSizeInBytes = kMaxGPUDrawRequestCount * sizeof(u32); // u32 offsets + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Positions Buffer"), true, manager, m_SimStreamOffsets_Positions, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Scales Buffer"), true, manager, m_SimStreamOffsets_Scales, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Orientations Buffer"), true, manager, m_SimStreamOffsets_Orientations, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Enableds Buffer"), true, manager, m_SimStreamOffsets_Enableds, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_MeshIDs Buffer"), m_HasMeshIDs, manager, m_SimStreamOffsets_MeshIDs, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_MeshLODs Buffer"), m_HasMeshLODs, manager, m_SimStreamOffsets_MeshLODs, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Matrices Buffer"), true, manager, m_MatricesOffsets, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes)) + return false; + + const u32 matricesSizeInBytes = m_TotalParticleCount_OverEstimated * sizeof(CFloat4x4); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Matrices Buffer"), true, manager, m_Matrices, RHI::RawBuffer, matricesSizeInBytes, matricesSizeInBytes)) + return false; + + // Constant buffer containing an array of 16 uints for per lod level submesh count (and a second array of the same size + 1, if we have per-particle LODs) + const u32 cbSizeInBytes = (sizeof(u32) * 0x10 + (m_HasMeshLODs ? sizeof(u32) * (0x10 + 1) : 0)) * 4; // We limit the max number of mesh LODs. * 4 as all uint are 16bytes aligned. + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("LODOffsets Constant Buffer"), true, manager, m_LODsConstantBuffer, RHI::ConstantBuffer, cbSizeInBytes, cbSizeInBytes)) + return false; + { + volatile u32 *mappedLODOffsets = static_cast(manager->MapCpuView(m_LODsConstantBuffer.m_Buffer, 0, cbSizeInBytes)); + if (!PK_VERIFY(mappedLODOffsets != null)) + return false; + // Clear everything, just in case. + Mem::Clear_Uncached(mappedLODOffsets, cbSizeInBytes); + + // Write PerMeshLODCount + for (u32 i = 0; i < lodCount; ++i) + *Mem::AdvanceRawPointer(mappedLODOffsets, i * 0x10) = allocBuffers.m_RendererCaches.First()->m_PerLODMeshCount[i]; + mappedLODOffsets = Mem::AdvanceRawPointer(mappedLODOffsets, 0x100); + + // Accumulate PerMeshLODCount into the second constant buffer member + if (m_HasMeshLODs) + { + u32 submeshCount = 0; + for (u32 i = 0; i < lodCount; ++i) + { + *Mem::AdvanceRawPointer(mappedLODOffsets, i * 0x10) = submeshCount; + submeshCount += allocBuffers.m_RendererCaches.First()->m_PerLODMeshCount[i]; + } + // Write at last LOD level + 1 the total number of submeshes, to simplify the shader a bit. + *Mem::AdvanceRawPointer(mappedLODOffsets, lodCount * 0x10) = submeshCount; + } + manager->UnmapCpuView(m_LODsConstantBuffer.m_Buffer); + } + } + + // The offset in the indirect buffer of the current emitted draw call + m_DrawCallCurrentOffset = 0; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_AllocateBuffers_Main(const RHI::PApiManager &manager, const SBuffersToAlloc &allocBuffers) +{ + PK_ASSERT(m_RendererType != Renderer_Sound); + PK_ASSERT(!m_GPUStorage); + + const SGeneratedInputs &toGenerate = allocBuffers.m_ToGenerate; + const u32 viewIndependentInputs = toGenerate.m_GeneratedInputs; + if (m_RendererType == Renderer_Mesh || m_RendererType == Renderer_Decal) + { + // Meshes + m_PerMeshParticleCount = allocBuffers.m_PerMeshParticleCount; // Array of particle counts per sub mesh + m_PerMeshBufferOffset = allocBuffers.m_PerMeshBufferOffset; // Array of particle counts per sub mesh + m_HasMeshIDs = allocBuffers.m_HasMeshIDs; + m_HasMeshLODs = allocBuffers.m_HasMeshLODs; + + // Matrices (view independent), generated from particle's Orientation stream + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Matrices Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_Matrices) != 0, manager, m_Matrices, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4x4), m_TotalVertexCount * sizeof(CFloat4x4))) + return false; + if (m_RendererType == Renderer_Decal) + { + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("InvMatrices Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_Matrices) != 0, manager, m_InvMatrices, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4x4), m_TotalVertexCount * sizeof(CFloat4x4))) + return false; + } + } + else + { + // Billboards, Ribbons (Billboarding done on CPU) + + // View independent indices (ie. Billboard with PlaneAligned Billboarding mode, or Ribbons that are view independent) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Indices Buffer"), (viewIndependentInputs & Drawers::GenInput_Indices) != 0, manager, m_Indices, RHI::IndexBuffer, m_TotalIndexCount_OverEstimated * m_IndexSize, m_TotalIndexCount * m_IndexSize)) + return false; + // View independent positions (ie. Billboard with PlaneAligned Billboarding mode, or Ribbons that are view independent) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Positions Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_Position) != 0, manager, m_Positions, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + // Texcoords are only generated when the "m_HasUV" flag is set on your side (see ps_renderer_base.h SBillboardingFlags) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("UV0s Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_UV0) != 0, manager, m_TexCoords0, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat2), m_TotalVertexCount * sizeof(CFloat2))) + return false; + + // Normal/Tangent are only generated when the "m_HasNormal/m_HasTangent" flag is set on your side (see ps_renderer_base.h SBillboardingFlags) + { + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Normals Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_Normal) != 0, manager, m_Normals, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Tangents Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_Tangent) != 0, manager, m_Tangents, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + } + + if (m_RendererType == Renderer_Billboard || m_RendererType == Renderer_Ribbon) + { + // Specific to billboard/ribbon renderers (necessary for the Linear Atlas Frame Blending mode) - Only enabled if m_SoftAnimationBlending is set on your side (see ps_renderer_base.h SBillboardingFlags) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("UV1s Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_UV1) != 0, manager, m_TexCoords1, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat2), m_TotalVertexCount * sizeof(CFloat2))) + return false; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("AtlasIDs Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_AtlasId) != 0, manager, m_AtlasIDs, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(float), m_TotalVertexCount * sizeof(float))) + return false; + } + if (m_RendererType == Renderer_Ribbon) + { + // Specific to ribbons (necessary for the CorrectDeformation feature) - Only enabled if m_HasRibbonCorrectDeformation is set on your side (see ps_renderer_base.h SBillboardingFlags) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("UVRemaps Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_UVRemap) != 0, manager, m_UVRemap, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("UVFactors Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_UVFactors) != 0, manager, m_UVFactors, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + } + if (!_AllocateBuffers_ViewDependent(manager, toGenerate)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_AllocateBuffers_ViewDependent(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate) +{ + PK_ASSERT(m_RendererType == Renderer_Billboard || m_RendererType == Renderer_Ribbon || m_RendererType == Renderer_Triangle); + PK_ASSERT(!m_GPUStorage); + + // View dependent inputs (typically Indices/Positions/Normals/Tangents): + //---------------------------------------------------------------------------- + + // Specific to billboards and ribbons, as meshes don't have view specific data to billboard (matrices are view independent) + u32 viewBuffersIndex = 0; + const u32 generatedViewCount = toGenerate.m_PerViewGeneratedInputs.Count(); + for (u32 i = 0; i < generatedViewCount; ++i) + { + const u32 viewGeneratedInputs = toGenerate.m_PerViewGeneratedInputs[i].m_GeneratedInputs; + if (viewGeneratedInputs == 0) + continue; // Nothing to generate for this view + + SPerView &viewBuffers = m_PerViewBuffers[viewBuffersIndex++]; + + viewBuffers.m_ViewIdx = i; + // View dependent indices + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("View Sorted Indices Buffer"), (viewGeneratedInputs & Drawers::GenInput_Indices) != 0, manager, viewBuffers.m_Indices, RHI::IndexBuffer, m_TotalIndexCount_OverEstimated * m_IndexSize, m_TotalIndexCount * m_IndexSize)) + return false; + if (m_RendererType == Renderer_Ribbon || m_RendererType == Renderer_Billboard) + { + // View dependent positions + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("View Positions Vertex Buffer"), (viewGeneratedInputs & Drawers::GenInput_Position) != 0, manager, viewBuffers.m_Positions, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + + // Normal/Tangent are only generated when the "m_HasNormal/m_HasTangent" flag is set on your side (see ps_renderer_base.h SBillboardingFlags) + { + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("View Normals Vertex Buffer"), (viewGeneratedInputs & Drawers::GenInput_Normal) != 0, manager, viewBuffers.m_Normals, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("View Tangents Vertex Buffer"), (viewGeneratedInputs & Drawers::GenInput_Tangent) != 0, manager, viewBuffers.m_Tangents, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + } + } + if (m_RendererType == Renderer_Ribbon) + { + // Specific to ribbons (necessary for the CorrectDeformation feature) - Only enabled if m_HasRibbonCorrectDeformation is set on your side (see ps_renderer_base.h SBillboardingFlags) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("View UVFactors Vertex Buffer"), (viewGeneratedInputs & Drawers::GenInput_UVFactors) != 0, manager, viewBuffers.m_UVFactors, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalVertexCount * sizeof(CFloat4))) + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IsAdditionalInputIgnored(const SRendererFeatureFieldDefinition &input) +{ + // 'TriangleCustomUVs' & 'TriangleCustomNormals' are additional inputs, but we do not want them passed to the vertex / fragment shaders. + // Those particle streams are used by CPU billboarding tasks and data is generated in the buffers mapped for 'GenInput_UV' & 'GenInput_Normal' + if (input.m_Type == PopcornFX::EBaseTypeID::BaseType_Float3) + { + if (input.m_Name == BasicRendererProperties::SID_TriangleCustomNormals_Normal1() || + input.m_Name == BasicRendererProperties::SID_TriangleCustomNormals_Normal2() || + input.m_Name == BasicRendererProperties::SID_TriangleCustomNormals_Normal3()) + return true; + } + + if (input.m_Type == PopcornFX::EBaseTypeID::BaseType_Float2) + { + if (input.m_Name == BasicRendererProperties::SID_TriangleCustomUVs_UV1() || + input.m_Name == BasicRendererProperties::SID_TriangleCustomUVs_UV2() || + input.m_Name == BasicRendererProperties::SID_TriangleCustomUVs_UV3()) + return true; + } + + // MeshLOD.LOD: Additional input, but we don't want it passed to the VS/PS shaders (Explicitely ignored as considered to be a builtin pin, see MaterialToRHI.cpp::_IsMeshAtlasFeature) + if (input.m_Type == PopcornFX::EBaseTypeID::BaseType_I32) + { + if (input.m_Name == BasicRendererProperties::SID_MeshLOD_LOD()) + return true; + } + + return false; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_AllocateBuffers_AdditionalInputs(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate) +{ + //---------------------------------------------------------------------------- + // Additional inputs: + // Input streams not required by billboarding (Color, TextureID, AlphaRemapCursor, Additional shader inputs, ..) + + const u32 additionalInputCount = toGenerate.m_AdditionalGeneratedInputs.Count(); + + if (m_GPUStorage) + { + if (m_RendererType == Renderer_Mesh) + { + if (!PK_VERIFY(m_SimStreamOffsets_AdditionalInputs.Reserve(additionalInputCount)) || // GPU buffer holding offsets into the GPU sim storage (1 element per draw request) + !PK_VERIFY(m_MappedSimStreamOffsets_AdditionalInputs.Reserve(additionalInputCount)) || // CPU writable, we know the offsets on the CPU + !PK_VERIFY(m_AdditionalFields.Reserve(additionalInputCount))) // Holds the additional input id for each additional input index (as some are ignored) + return false; + const u32 offsetsSizeInBytes = kMaxGPUDrawRequestCount * sizeof(u32); // u32 offsets + for (u32 i = 0, j = 0; i < additionalInputCount; ++i) + { + if (_IsAdditionalInputIgnored(toGenerate.m_AdditionalGeneratedInputs[i])) + continue; + if (j >= m_AdditionalFields.Count()) + { + if (!PK_VERIFY(m_SimStreamOffsets_AdditionalInputs.PushBack().Valid()) || + !PK_VERIFY(m_MappedSimStreamOffsets_AdditionalInputs.PushBack().Valid()) || + !PK_VERIFY(m_AdditionalFields.PushBack().Valid())) + return false; + } + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Additional Input Offsets Buffer"), true, manager, m_SimStreamOffsets_AdditionalInputs[i], RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes)) + return false; + if (toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Diffuse_Color() || + toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Distortion_Color()) + { + m_HasColorStream = true; + } + m_AdditionalFields[j].m_AdditionalInputIndex = i; // Important, we need that index internally in copy stream tasks + ++j; + } + } + } + else + { + if (!PK_VERIFY(m_AdditionalFields.Reserve(additionalInputCount))) + return false; + + // 2 possible debug color in order: + CGuid diffuseColor; + CGuid distortionColor; + + for (u32 i = 0, j = 0; i < additionalInputCount; ++i) + { + // Create a vertex buffer for each additional field that your engine supports: + // Those vertex buffers will be filled with particle data from the matching streams, per vertex, ie: + // Particle stream with 2 particles, ViewposAligned so 4 vertices per particle :[Color0][Color1][TextureID0][TextureID1] + // Dst Vertex buffers :[Color0][Color0][Color0][Color0][Color1][Color1][Color1][Color1][TextureID0][TextureID0][TextureID0][TextureID0][TextureID1][TextureID1][TextureID1][TextureID1] + // Or it does a single copy per instance (for mesh particles, or when using geometry shader billboarding) + // This policy creates a gpu buffer per additional input, but you could choose to only copy out specific particle fields + + if (_IsAdditionalInputIgnored(toGenerate.m_AdditionalGeneratedInputs[i])) + continue; + + if (j >= m_AdditionalFields.Count()) + { + if (!PK_VERIFY(m_AdditionalFields.PushBack().Valid())) + return false; + } + + SAdditionalInputs &decl = (j >= m_AdditionalFields.Count()) ? m_AdditionalFields.Last() : m_AdditionalFields[j]; + + const u32 typeSize = CBaseTypeTraits::Traits(toGenerate.m_AdditionalGeneratedInputs[i].m_Type).Size; + decl.m_ByteSize = typeSize; + decl.m_AdditionalInputIndex = i; // Important, we need that index internally in copy stream tasks + + // Here is where you can discard specific additional inputs if your engine does not support them + // Ie. If the target engine doesn't support additional inputs, don't allocate vertex buffers for it + if (toGenerate.m_AdditionalGeneratedInputs[i].m_Type == PopcornFX::EBaseTypeID::BaseType_Float4 && + toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Diffuse_Color()) + diffuseColor = i; + else if (toGenerate.m_AdditionalGeneratedInputs[i].m_Type == PopcornFX::EBaseTypeID::BaseType_Float4 && + toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Distortion_Color()) + distortionColor = i; + else if (toGenerate.m_AdditionalGeneratedInputs[i].m_Type == PopcornFX::EBaseTypeID::BaseType_Float && + toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_LightAttenuation_Range()) + decl.m_Semantic = SRHIDrawCall::DebugDrawGPUBuffer_InstanceScales; // Flag that additional field for debug draw (editor only) + + if (!PK_VERIFY(_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("AdditionalInputs Vertex Buffer"), true, manager, decl.m_Buffer, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * typeSize, m_TotalVertexCount * typeSize))) + return false; + + ++j; + } + + if (diffuseColor.Valid()) + m_AdditionalFields[diffuseColor].m_Semantic = SRHIDrawCall::DebugDrawGPUBuffer_Color; // Flag that additional field for debug draw (editor only) + else if (distortionColor.Valid()) + m_AdditionalFields[distortionColor].m_Semantic = SRHIDrawCall::DebugDrawGPUBuffer_Color; // Flag that additional field for debug draw (editor only) + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_AllocateBuffers_GeomShaderBillboarding(const RHI::PApiManager &manager, u32 viewIndependentInputs) +{ + PK_ASSERT(!m_GPUStorage); + + // Specific to billboarding done in a geometry shader, ignore if you don't want to billboard that way + + // For CPU simulation (as GPU sim is just mapping existing GPU buffers to the draw call) + // We issue tasks to fill vbuffers with particle sim data necessary for billboarding + if (viewIndependentInputs & Drawers::GenInput_ParticlePosition) + { + // Particle positions stream + PK_ASSERT(m_TotalVertexCount == m_TotalParticleCount); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Positions Vertex Buffer"), true, manager, m_GeomPositions, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat4), m_TotalParticleCount * sizeof(CFloat4))) + return false; + + // Constant buffer filled by CPU task, will contain simple description of draw request + // We do this so we can batch various draw requests (renderers from various mediums) in a single "draw call" + // This constant buffer will contain flags for each draw request + // Each particle position will contain its associated draw request ID in position's W component (See sample geometry billboard shader for more detail) + PK_STATIC_ASSERT(sizeof(Drawers::SBillboardDrawRequest) == sizeof(CFloat4)); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Billboard DrawRequests Buffer"), true, manager, m_GeomConstants, RHI::ConstantBuffer, kMaxGeomDrawRequestCount * sizeof(Drawers::SBillboardDrawRequest), kMaxGeomDrawRequestCount * sizeof(Drawers::SBillboardDrawRequest))) + return false; + } + + // Can be either one + { + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Sizes Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleSize) != 0, manager, m_GeomSizes, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(float), m_TotalParticleCount * sizeof(float))) + return false; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Size2s Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleSize2) != 0, manager, m_GeomSizes2, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat2), m_TotalParticleCount * sizeof(CFloat2))) + return false; + } + + // Rotation particle stream + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Rotations Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleRotation) != 0, manager, m_GeomRotations, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(float), m_TotalParticleCount * sizeof(float))) + return false; + // First billboarding axis (necessary for AxisAligned billboarding modes) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Axis0s Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleAxis0) != 0, manager, m_GeomAxis0, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat3), m_TotalParticleCount * sizeof(CFloat3))) + return false; + // Second billboarding axis (necessary for PlaneAligned) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Axis1s Vertex Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleAxis1) != 0, manager, m_GeomAxis1, RHI::VertexBuffer, m_TotalVertexCount_OverEstimated * sizeof(CFloat3), m_TotalParticleCount * sizeof(CFloat3))) + return false; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_AllocateBuffers_Lights(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate) +{ + PK_ASSERT(!m_GPUStorage); + + // Here we first allocate the light positions buffer (there will always be some light positions): + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Light Positions Vertex Buffer"), true, manager, m_LightsPositions, RHI::VertexBuffer, m_TotalParticleCount_OverEstimated * sizeof(CFloat3), m_TotalParticleCount * sizeof(CFloat3))) + return false; + + const u32 additionalFieldsCount = toGenerate.m_AdditionalGeneratedInputs.Count(); + + if (!m_AdditionalFields.Resize(additionalFieldsCount)) + return false; + + // Alloc the additional inputs for the lights: + for (u32 i = 0; i < additionalFieldsCount; ++i) + { + const u32 typeSize = CBaseTypeTraits::Traits(toGenerate.m_AdditionalGeneratedInputs[i].m_Type).Size; + m_AdditionalFields[i].m_ByteSize = typeSize; + m_AdditionalFields[i].m_AdditionalInputIndex = i; // Important, we need that index internally in copy stream tasks + + // Here is where you can discard specific additional inputs if your engine does not support them + // Ie. If the target engine doesn't support additional inputs, don't allocate vertex buffers for it + if (toGenerate.m_AdditionalGeneratedInputs[i].m_Type == PopcornFX::EBaseTypeID::BaseType_Float4 && + (toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Diffuse_Color() || + toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Distortion_Color())) + m_AdditionalFields[i].m_Semantic = SRHIDrawCall::DebugDrawGPUBuffer_Color; + else + m_AdditionalFields[i].m_Semantic = SRHIDrawCall::_DebugDrawGPUBuffer_Count; + + if (!PK_VERIFY(_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Light AdditionalInputs Vertex Buffer"), true, manager, m_AdditionalFields[i].m_Buffer, RHI::VertexBuffer, m_TotalParticleCount_OverEstimated * typeSize, m_TotalParticleCount * typeSize))) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +// +// Billboards (CPU billboarding) +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SBillboardBatchJobs *billboardBatch, const SGeneratedInputs &toMap) +{ + PK_ASSERT(!m_GPUStorage); + + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::MapBuffers (billboards)"); + + if (billboardBatch == null) + { + // TODO: FIX This, MapBuffers shouldn't be called with an empty SBillboardBatchJobs for sound draw requests + if (ctx.IsPostUpdateFencePass()) // This is normal, we are processing sounds + return true; + PK_ASSERT_NOT_REACHED(); + return false; + } + + RHI::PApiManager manager = ctx.ApiManager(); + + // Assign mapped vertex/index buffers on CPU tasks that will run async on worker threads + // All buffers used below have been allocated in AllocBuffers either during this BeginCollectingDrawCalls + // They could also have been allocated in a previous BeginCollectingDrawCalls call, see documentation for more detail + // CBillboard_Exec_Indices will generate indices and sort particles based on the renderer sort metric if necessary + // CBillboard_Exec_PositionsNormals will generate particles geometry (quads/capsules) + // CBillboard_Exec_Texcoords will generate particle texcoords (using an atlas if specified) + // CBillboard_Exec_CopyField will do a straight copy of particle data into vertex buffers (once per vertex or once per particle if CBillboard_Exec_CopyField::m_PerVertex is set to false) + + // View independent inputs: + if (toMap.m_GeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_Indices.m_Buffer, 0, m_IndexSize * m_TotalIndexCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalIndexCount, m_IndexSize == sizeof(u32)); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Position) + { + PK_ASSERT(m_Positions.Used()); + void *mappedValue = manager->MapCpuView(m_Positions.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_PNT.m_Positions = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Normal) + { + PK_ASSERT(m_Normals.Used()); + void *mappedValue = manager->MapCpuView(m_Normals.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_PNT.m_Normals = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Tangent) + { + PK_ASSERT(m_Tangents.Used()); + void *mappedValue = manager->MapCpuView(m_Tangents.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_PNT.m_Tangents = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_UV0) + { + PK_ASSERT(m_TexCoords0.Used()); + void *mappedValue = manager->MapCpuView(m_TexCoords0.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat2)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_Texcoords.m_Texcoords = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_UV1) + { + PK_ASSERT(m_TexCoords1.Used()); + void *mappedValue = manager->MapCpuView(m_TexCoords1.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat2)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_Texcoords.m_Texcoords2 = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_AtlasId) + { + PK_ASSERT(m_AtlasIDs.Used()); + void *mappedValue = manager->MapCpuView(m_AtlasIDs.m_Buffer, 0, m_TotalVertexCount * sizeof(float)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_Texcoords.m_AtlasIds = TMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + + // View dependent inputs: + PK_ASSERT(m_PerViewBuffers.Count() == billboardBatch->m_PerView.Count()); + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + { + const u32 viewGeneratedInputs = toMap.m_PerViewGeneratedInputs[i].m_GeneratedInputs; + + PK_ASSERT(m_PerViewBuffers[i].m_ViewIdx == billboardBatch->m_PerView[i].m_ViewIndex); + if (viewGeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_PerViewBuffers[i].m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Indices.m_Buffer, 0, m_TotalIndexCount * m_IndexSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalIndexCount, m_IndexSize == sizeof(u32)); + } + if (viewGeneratedInputs & Drawers::GenInput_Position) + { + PK_ASSERT(m_PerViewBuffers[i].m_Positions.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Positions.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_PNT.m_Positions = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (viewGeneratedInputs & Drawers::GenInput_Normal) + { + PK_ASSERT(m_PerViewBuffers[i].m_Normals.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Normals.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_PNT.m_Normals = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (viewGeneratedInputs & Drawers::GenInput_Tangent) + { + PK_ASSERT(m_PerViewBuffers[i].m_Tangents.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Tangents.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_PNT.m_Tangents = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + } + + // Additional inputs: + if (!toMap.m_AdditionalGeneratedInputs.Empty()) + { + PK_ASSERT(toMap.m_AdditionalGeneratedInputs.Count() >= m_AdditionalFields.Count()); + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalVertexCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalVertexCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + billboardBatch->m_Exec_CopyField.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *billboardBatch) +{ + (void)ctx; (void)drawRequests; (void)billboardBatch; +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_BillboardCustomParticleSelectTask.Clear(); + PK_ASSERT(m_IsParticleSelected.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_IsParticleSelected.m_Buffer, 0, sizeof(float) * m_TotalVertexCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_BillboardCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, sizeof(float)); + m_BillboardCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + billboardBatch->AddExecPage(&m_BillboardCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Billboard_CPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_ASSERT(!m_GPUStorage); + + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::EmitDrawCall Billboard (CPU)"); + + // Common draw call code for CPU billboarding and geom shader billboarding + // Draw calls are not issued inline here, but later in PK-SampleLib's render loop + // _CreateDrawCalls outputs a new pushed draw call that will be processed later (in SRHIDrawOutputs) + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(toEmit, output, SRHIDrawCall::DrawCall_Regular, PKSample::Option_VertexPassThrough); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + + // We had a geometry shader batch, ignore if you don't want to billboard that way: + if (m_GeomPositions.Used()) + { + const Drawers::SBillboard_DrawRequest *dr = static_cast(toEmit.m_DrawRequests.First()); + + outDrawCall.m_ShaderOptions |= _GetGeomBillboardShaderOptions(dr->m_BB); + PK_ASSERT((outDrawCall.m_ShaderOptions & Option_GeomBillboarding) != 0); + + if (!_SetupGeomBillboardVertexBuffers(outDrawCall)) + return false; + } + else + { + bool hasAtlas = false; + CRendererCacheInstance_UpdateThread *refCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (PK_VERIFY(refCacheInstance != null)) + { + PKSample::PCRendererCacheInstance rCacheInstance = refCacheInstance->RenderThread_GetCacheInstance(); + if (PK_VERIFY(rCacheInstance != null)) + hasAtlas = rCacheInstance->m_HasAtlas; + } + if (!_SetupCommonBillboardVertexBuffers(outDrawCall, hasAtlas)) + return false; + } + if (!_SetupBillboardDrawCall(ctx, toEmit, outDrawCall)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_SetupCommonBillboardVertexBuffers(SRHIDrawCall &outDrawCall, bool hasAtlas) +{ + if (!m_PerViewBuffers.Empty() && m_PerViewBuffers[0].m_Positions.Used()) + { + // View dependent buffers (Right now this code only takes in account first view) + // If the first view contains an allocated Positions buffer, it means we have view dependent geometry: + // For billboard, everything that isn't PlanarAxisAligned -> Positions/Normals/Tangents need to be billboarded per view to be correct + // For ribbons, everything that is ViewposAligned -> same + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_PerViewBuffers[0].m_Positions.m_Buffer).Valid())) + return false; + if (m_PerViewBuffers[0].m_Normals.Used() && !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_PerViewBuffers[0].m_Normals.m_Buffer).Valid())) + return false; + if (m_PerViewBuffers[0].m_Tangents.Used() && !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_PerViewBuffers[0].m_Tangents.m_Buffer).Valid())) + return false; + } + else + { + if (m_Positions.Used() && !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_Positions.m_Buffer).Valid())) + return false; + if (m_Normals.Used() && !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_Normals.m_Buffer).Valid())) + return false; + if (m_Tangents.Used() && !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_Tangents.m_Buffer).Valid())) + return false; + } + + if (m_TexCoords0.Used()) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_TexCoords0.m_Buffer).Valid())) + return false; + + // Atlas renderer feature enabled: None/Linear atlas blending share the same vertex declaration, so we just push empty buffers when blending is disabled + PK_ASSERT(m_TexCoords1.Used() == m_AtlasIDs.Used()); + if (hasAtlas || m_TexCoords1.Used()) + { + // If we have invalid m_TexCoords1/m_AtlasIDs, bind a dummy vertex buffer, here m_TexCoords0 + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_TexCoords1.Used() ? m_TexCoords1.m_Buffer : m_TexCoords0.m_Buffer).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_AtlasIDs.Used() ? m_AtlasIDs.m_Buffer : m_TexCoords0.m_Buffer).Valid())) + return false; + } + } + + if (m_UVRemap.Used() && !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_UVRemap.m_Buffer).Valid())) + return false; + + if (!m_PerViewBuffers.Empty() && m_PerViewBuffers[0].m_Positions.Used()) + { + // Same check as above, but UVFactors are pushed in last to match vertex declaration expected by RHI Render states + if (m_PerViewBuffers[0].m_UVFactors.Used() && !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_PerViewBuffers[0].m_UVFactors.m_Buffer).Valid())) + return false; + } + else + { + if (m_UVFactors.Used() && !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_UVFactors.m_Buffer).Valid())) + return false; + } + + // Editor only: for debugging purposes, we'll remove that from samples code later + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = outDrawCall.m_VertexBuffers.First(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_SetupBillboardDrawCall(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawCall &outDrawCall) +{ + (void)ctx; + outDrawCall.m_IndexOffset = toEmit.m_IndexOffset; + outDrawCall.m_VertexCount = toEmit.m_TotalVertexCount; + outDrawCall.m_IndexCount = toEmit.m_TotalIndexCount; + outDrawCall.m_IndexSize = (m_IndexSize == sizeof(u32)) ? RHI::IndexBuffer32Bit : RHI::IndexBuffer16Bit; + + // Indices are mandatory, here we check if we have view independent indices or not: + if (!m_PerViewBuffers.Empty() && m_PerViewBuffers[0].m_Indices.Used()) + outDrawCall.m_IndexBuffer = m_PerViewBuffers[0].m_Indices.m_Buffer; + else + outDrawCall.m_IndexBuffer = m_Indices.m_Buffer; + PK_ASSERT(outDrawCall.m_IndexBuffer != null); + + // Push additional inputs vertex buffers: + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (!m_AdditionalFields[i].m_Buffer.Used()) + continue; + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_AdditionalFields[i].m_Buffer.m_Buffer).Valid())) + return false; + + // Editor only: for debugging purposes, we'll remove that from samples code later + if (m_AdditionalFields[i].m_Semantic == SRHIDrawCall::DebugDrawGPUBuffer_Color) + { + PK_ASSERT(outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] == null); + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = m_AdditionalFields[i].m_Buffer.m_Buffer; + } + } + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if ((ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) && m_IsParticleSelected.Used()) + { + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = m_IsParticleSelected.m_Buffer; + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + return true; +} + +//---------------------------------------------------------------------------- +// +// Billboards (Geometry shader billboarding) +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPUBillboardBatchJobs *billboardGeomBatch, const SGeneratedInputs &toMap) +{ + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::MapBuffers (geom billboard)"); + + RHI::PApiManager manager = ctx.ApiManager(); + + if (billboardGeomBatch == null) + { + // If the billboard batch is null, we have GPU storage: + m_MappedIndirectBuffer = static_cast(manager->MapCpuView(m_IndirectDraw.m_Buffer)); + return PK_VERIFY(m_MappedIndirectBuffer != null); + } + PK_ASSERT(!m_GPUStorage); + + // Assign mapped vertex/index buffers on CPU tasks that will run async on worker threads + // All buffers used below have been allocated in AllocBuffers either during this BeginCollectingDrawCalls + // They could also have been allocated in a previous BeginCollectingDrawCalls call, see documentation for more detail + // CCopyStream_Exec_Indices will generate indices and sort particles based on the renderer sort metric if necessary + // CCopyStream_Exec_Billboard_Std will copy particle sim data necessary for billboarding (Positions/Sizes/Rotations/Axis0s/Axis1s) + // This tasks will also write in Position's W component the associated draw request ID + // CCopyStream_Exec_GPUBillboardDrawRequests will write draw request datas packed + // CCopyStream_Exec_AdditionalField will do a straight copy of specified particle data into the vertex buffers + + if (toMap.m_GeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_Indices.m_Buffer, 0, m_IndexSize * m_TotalParticleCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardGeomBatch->m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalParticleCount, m_IndexSize == sizeof(u32)); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticlePosition) + { + PK_ASSERT(m_GeomPositions.Used()); + void *mappedValue = manager->MapCpuView(m_GeomPositions.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardGeomBatch->m_Exec_CopyBillboardingStreams.m_PositionsDrIds = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + + PK_ASSERT(m_GeomConstants.Used()); + void *mappedConstants = manager->MapCpuView(m_GeomConstants.m_Buffer, 0, kMaxGeomDrawRequestCount * sizeof(Drawers::SBillboardDrawRequest)); + if (!PK_VERIFY(mappedConstants != null)) + return false; + + billboardGeomBatch->m_Exec_GeomBillboardDrawRequests.m_GeomDrawRequests = TMemoryView(static_cast(mappedConstants), kMaxGeomDrawRequestCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleSize) + { + PK_ASSERT(m_GeomSizes.Used()); + void *mappedValue = manager->MapCpuView(m_GeomSizes.m_Buffer, 0, m_TotalParticleCount * sizeof(float)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardGeomBatch->m_Exec_CopyBillboardingStreams.m_Sizes = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + else if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleSize2) + { + PK_ASSERT(m_GeomSizes2.Used()); + void *mappedValue = manager->MapCpuView(m_GeomSizes2.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat2)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardGeomBatch->m_Exec_CopyBillboardingStreams.m_Sizes2 = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleRotation) + { + PK_ASSERT(m_GeomRotations.Used()); + void *mappedValue = manager->MapCpuView(m_GeomRotations.m_Buffer, 0, m_TotalParticleCount * sizeof(float)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardGeomBatch->m_Exec_CopyBillboardingStreams.m_Rotations = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleAxis0) + { + PK_ASSERT(m_GeomAxis0.Used()); + void *mappedValue = manager->MapCpuView(m_GeomAxis0.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat3)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardGeomBatch->m_Exec_CopyBillboardingStreams.m_Axis0 = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleAxis1) + { + PK_ASSERT(m_GeomAxis1.Used()); + void *mappedValue = manager->MapCpuView(m_GeomAxis1.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat3)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardGeomBatch->m_Exec_CopyBillboardingStreams.m_Axis1 = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + + // View dependent inputs: + PK_ASSERT(m_PerViewBuffers.Count() == billboardGeomBatch->m_PerView.Count()); + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + { + const u32 viewGeneratedInputs = toMap.m_PerViewGeneratedInputs[i].m_GeneratedInputs; + + PK_ASSERT(m_PerViewBuffers[i].m_ViewIdx == billboardGeomBatch->m_PerView[i].m_ViewIndex); + if (viewGeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_PerViewBuffers[i].m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Indices.m_Buffer, 0, m_TotalParticleCount * m_IndexSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardGeomBatch->m_PerView[i].m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalParticleCount, m_IndexSize == sizeof(u32)); + } + } + + // Additional inputs: + if (!toMap.m_AdditionalGeneratedInputs.Empty()) + { + PK_ASSERT(toMap.m_AdditionalGeneratedInputs.Count() >= m_AdditionalFields.Count()); + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalParticleCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalParticleCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + billboardGeomBatch->m_Exec_CopyAdditionalFields.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *billboardBatch) +{ + (void)ctx; + // If the billboard batch is null, we have GPU storage: + if (billboardBatch == null) + { + PK_ASSERT(m_MappedIndirectBuffer != null); + PK_ASSERT(m_GPUStorage); + + for (u32 i = 0; i < drawRequests.Count(); ++i) + { + m_MappedIndirectBuffer[i].m_InstanceCount = 1; + m_MappedIndirectBuffer[i].m_InstanceOffset = 0; + m_MappedIndirectBuffer[i].m_VertexOffset = 0; + m_MappedIndirectBuffer[i].m_VertexCount = drawRequests[i]->RenderedParticleCount(); + } + + return true; + } + PK_ASSERT(!m_GPUStorage); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_CopyStreamCustomParticleSelectTask.Clear(); + PK_ASSERT(m_IsParticleSelected.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_IsParticleSelected.m_Buffer, 0, sizeof(float) * m_TotalVertexCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_CopyStreamCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, sizeof(float)); + m_CopyStreamCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + billboardBatch->AddExecAsyncPage(&m_CopyStreamCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Billboard_GPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_ASSERT(m_GPUStorage); + + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::EmitDrawCall Billboard (GPU)"); + + RHI::PApiManager manager = ctx.ApiManager(); + + // GPU particles: we billboard them in a geometry shader and using indirect draws + const u32 drCount = toEmit.m_DrawRequests.Count(); + for (u32 dri = 0; dri < drCount; ++dri) + { + PK_ASSERT(toEmit.m_DrawRequests[dri] != null); + const Drawers::SBillboard_DrawRequest *dr = static_cast(toEmit.m_DrawRequests[dri]); + const Drawers::SBillboard_BillboardingRequest *bbRequest = static_cast(&dr->BaseBillboardingRequest()); + const CParticleStreamToRender *streamToRender = &dr->StreamToRender(); + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(toEmit, output, SRHIDrawCall::DrawCall_InstancedIndirect, PKSample::Option_VertexPassThrough); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + + // Retrieve the particle streams in GPU storage: + static const u32 kBillboardingInputs = 5; // Positions/Sizes/Rotations/Axis0s/Axis1s + const u32 maxBufferCount = bbRequest->m_AdditionalInputs.Count() + kBillboardingInputs; + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.Reserve(maxBufferCount))) + return false; + + // Mandatory streams + u32 enabledOffset = 0; + u32 posOffset = 0; + u32 sizeOffset = 0; + RHI::PGpuBuffer enableds = _RetrieveStorageBuffer(manager, streamToRender, bbRequest->m_EnabledStreamId, enabledOffset); + RHI::PGpuBuffer positions = _RetrieveStorageBuffer(manager, streamToRender, bbRequest->m_PositionStreamId, posOffset); + RHI::PGpuBuffer sizes = _RetrieveStorageBuffer(manager, streamToRender, bbRequest->m_SizeStreamId, sizeOffset); + + if (!PK_VERIFY(positions != null) || + !PK_VERIFY(sizes != null) || + !PK_VERIFY(enableds != null)) + return false; + + // We can't rely on GPU storages being valid or not: now all possible renderer inputs are guaranteed to have valid stream id + const u32 geomInputs = bbRequest->GetGeomGeneratedVertexInputsFlags(); + u32 rotOffset = 0; + u32 axis0Offset = 0; + u32 axis1Offset = 0; + RHI::PGpuBuffer rotations = null; + RHI::PGpuBuffer axis0s = null; + RHI::PGpuBuffer axis1s = null; + + if (geomInputs & Drawers::GenInput_ParticleRotation) + { + rotations = _RetrieveStorageBuffer(manager, streamToRender, bbRequest->m_RotationStreamId, rotOffset); + PK_ASSERT(rotations != null); + } + if (geomInputs & Drawers::GenInput_ParticleAxis0) + { + axis0s = _RetrieveStorageBuffer(manager, streamToRender, bbRequest->m_Axis0StreamId, axis0Offset); + PK_ASSERT(axis0s != null); + } + if (geomInputs & Drawers::GenInput_ParticleAxis1) + { + axis1s = _RetrieveStorageBuffer(manager, streamToRender, bbRequest->m_Axis1StreamId, axis1Offset); + PK_ASSERT(axis1s != null); + } + + RHI::PGpuBuffer bufferIsSelected = null; +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + bufferIsSelected = ctx.Selection().HasGPUParticlesSelected() ? GetIsSelectedBuffer(ctx.Selection(), *dr) : null; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = positions; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Size] = sizes; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Rotation] = rotations; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Axis0] = axis0s; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Axis1] = axis1s; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Enabled] = enableds; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = bufferIsSelected; + + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Position] = posOffset; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Size] = sizeOffset; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Rotation] = rotOffset; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Axis0] = axis0Offset; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Axis1] = axis1Offset; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Enabled] = enabledOffset; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = 0; + + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(positions).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(sizes).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexOffsets.PushBack(posOffset).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexOffsets.PushBack(sizeOffset).Valid())) + return false; + if (rotations != null) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(rotations).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexOffsets.PushBack(rotOffset).Valid())) + return false; + } + if (axis0s != null) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(axis0s).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexOffsets.PushBack(axis0Offset).Valid())) + return false; + } + if (axis1s != null) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(axis1s).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexOffsets.PushBack(axis1Offset).Valid())) + return false; + } + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(enableds).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexOffsets.PushBack(enabledOffset).Valid())) + return false; + + // Additional fields + const u32 additionalInputCount = bbRequest->m_AdditionalInputs.Count(); + for (u32 iInput = 0; iInput < additionalInputCount; ++iInput) + { + u32 offset = 0; + RHI::PGpuBuffer buffer = _RetrieveStorageBuffer(manager, streamToRender, bbRequest->m_AdditionalInputs[iInput].m_StreamId, offset); + if (!PK_VERIFY(buffer != null) || + !PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(buffer).Valid()) || + !PK_VERIFY(outDrawCall.m_VertexOffsets.PushBack(offset).Valid())) + return false; + + // Editor only: for debugging purposes, we'll remove that from samples code later + if (outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] != null) + continue; + if (bbRequest->m_AdditionalInputs[iInput].m_Type == PopcornFX::EBaseTypeID::BaseType_Float4 && + (bbRequest->m_AdditionalInputs[iInput].m_Name == BasicRendererProperties::SID_Diffuse_Color() || + bbRequest->m_AdditionalInputs[iInput].m_Name == BasicRendererProperties::SID_Distortion_Color())) + { + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Color] = offset; + } + } + + PK_TODO("Fill the VB semantics here so that the debug draw modes work with GPU particles..."); + + outDrawCall.m_IndirectBuffer = m_IndirectDraw.m_Buffer; + outDrawCall.m_IndirectBufferOffset = m_DrawCallCurrentOffset; + outDrawCall.m_EstimatedParticleCount = dr->RenderedParticleCount(); + + // Now we need to create the indirect buffer to store the draw informations + // We do not want to read-back the exact particle count from the GPU, so we are creating an + // indirect buffer and send a copy command to copy the exact particle count to this buffer: + RHI::PGpuBuffer particleSimInfo = _RetrieveParticleInfoBuffer(manager, streamToRender); + + if (!PK_VERIFY(particleSimInfo != null)) + return false; + + if (!PK_VERIFY(output.m_CopyCommands.PushBack().Valid())) + return false; + + SRHICopyCommand ©Command = output.m_CopyCommands.Last(); + + // We retrieve the particles info buffer: + copyCommand.m_SrcBuffer = particleSimInfo; + PK_TODO("Retrieve the live count offset from the D3D11_ParticleStream"); + copyCommand.m_SrcOffset = 0; + copyCommand.m_DstBuffer = m_IndirectDraw.m_Buffer; + copyCommand.m_DstOffset = m_DrawCallCurrentOffset + PK_MEMBER_OFFSET(RHI::SDrawIndirectArgs, m_VertexCount); + copyCommand.m_SizeToCopy = sizeof(u32); + + m_DrawCallCurrentOffset += sizeof(RHI::SDrawIndirectArgs); + + outDrawCall.m_ShaderOptions |= Option_GPUStorage; + outDrawCall.m_ShaderOptions |= _GetGeomBillboardShaderOptions(*bbRequest); + + if (!PK_VERIFY(outDrawCall.m_PushConstants.PushBack().Valid())) + return false; + PK_STATIC_ASSERT(sizeof(Drawers::SBillboardDrawRequest) == sizeof(CFloat4)); + Drawers::SBillboardDrawRequest &desc = *reinterpret_cast(&outDrawCall.m_PushConstants.Last()); + desc.Setup(*bbRequest); + } + return true; +} + +//---------------------------------------------------------------------------- + +RHI::PGpuBuffer CRHIBillboardingBatchPolicy::_RetrieveStorageBuffer(const RHI::PApiManager &manager, const CParticleStreamToRender *streams, CGuid streamIdx, u32 &storageOffset) +{ + PK_ASSERT(m_GPUStorage); + PK_ASSERT(streams != null); + + (void)manager; (void)streams; (void)storageOffset; + if (!PK_VERIFY(streamIdx.Valid())) + return null; +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + // We retrieve the vertex buffer from the GPU storages: + if (streams->StorageClass() == CParticleStorageManager_D3D11::DefaultStorageClass()) + { + const CParticleStreamToRender_D3D11 *streamsToRender = static_cast(streams); + const SBuffer_D3D11 &stream = streamsToRender->StreamBuffer(); + if (stream.Empty()) + return null; + storageOffset = streamsToRender->StreamOffset(streamIdx); + return CastD3D11(manager)->D3D11GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), stream.m_Buffer, RHI::RawVertexBuffer); + } +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + // We retrieve the vertex buffer from the GPU storages: + if (streams->StorageClass() == CParticleStorageManager_D3D12::DefaultStorageClass()) + { + const CParticleStreamToRender_D3D12 *streamsToRender = static_cast(streams); + const SBuffer_D3D12 &stream = streamsToRender->StreamBuffer(); + if (stream.Empty()) + return null; + storageOffset = streamsToRender->StreamOffset(streamIdx); + return CastD3D12(manager)->D3D12GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), stream.m_Resource, RHI::RawVertexBuffer, stream.m_State); + } +#endif +#if (PK_PARTICLES_UPDATER_USE_UNKNOWN2 != 0) + // We retrieve the vertex buffer from the GPU storages: + if (streams->StorageClass() == CParticleStorageManager_UNKNOWN2::DefaultStorageClass()) + { + const CParticleStreamToRender_UNKNOWN2* streamsToRender = static_cast(streams); + const SBuffer_UNKNOWN2& stream = streamsToRender->StreamBuffer(); + if (stream.Empty()) + return null; + storageOffset = streamsToRender->StreamOffset(streamIdx); + return CastUNKNOWN2(manager)->UNKNOWN2GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), stream.m_Resource, stream.m_ByteSize, RHI::RawBuffer); + } +#endif + return null; +} + +//---------------------------------------------------------------------------- + +RHI::PGpuBuffer CRHIBillboardingBatchPolicy::_RetrieveParticleInfoBuffer(const RHI::PApiManager &manager, const CParticleStreamToRender *streams) +{ + PK_ASSERT(m_GPUStorage); + + (void)manager; (void)streams; +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + // We retrieve the stream size buffer from the GPU storages: + if (streams->StorageClass() == CParticleStorageManager_D3D11::DefaultStorageClass()) + { + const CParticleStreamToRender_D3D11 *streamsToRender = static_cast(streams); + const SBuffer_D3D11 &stream = streamsToRender->StreamSizeBuf(); + if (stream.Empty()) + return null; + return CastD3D11(manager)->D3D11GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), stream.m_Buffer, RHI::RawVertexBuffer); + } +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + // We retrieve the stream size buffer from the GPU storages: + if (streams->StorageClass() == CParticleStorageManager_D3D12::DefaultStorageClass()) + { + const CParticleStreamToRender_D3D12 *streamsToRender = static_cast(streams); + const SBuffer_D3D12 &stream = streamsToRender->StreamSizeBuf(); + if (stream.Empty()) + return null; + return CastD3D12(manager)->D3D12GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), stream.m_Resource, RHI::RawVertexBuffer, stream.m_State); + } +#endif +#if (PK_PARTICLES_UPDATER_USE_UNKNOWN2 != 0) + // We retrieve the stream size buffer from the GPU storages: + if (streams->StorageClass() == CParticleStorageManager_UNKNOWN2::DefaultStorageClass()) + { + const CParticleStreamToRender_UNKNOWN2 *streamsToRender = static_cast(streams); + const SBuffer_UNKNOWN2 &stream = streamsToRender->StreamSizeBuf(); + if (stream.Empty()) + return null; + return CastUNKNOWN2(manager)->UNKNOWN2GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), stream.m_Resource, stream.m_ByteSize, RHI::RawVertexBuffer); + } +#endif + return null; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_SetupGeomBillboardVertexBuffers(SRHIDrawCall &outDrawCall) +{ + // Vertex buffers below have been filled with particle sim data (via CCopyStream_CPU tasks) + // So the billboarding can be done in a geometry shader + if (m_GeomPositions.Used()) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_GeomPositions.m_Buffer).Valid())) + return false; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = m_GeomPositions.m_Buffer; + PK_ASSERT(m_GeomConstants.Used()); + } + if (m_GeomSizes.Used()) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_GeomSizes.m_Buffer).Valid())) + return false; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Size] = m_GeomSizes.m_Buffer; + } + else if (m_GeomSizes2.Used()) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_GeomSizes2.m_Buffer).Valid())) + return false; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Size] = m_GeomSizes2.m_Buffer; + } + if (m_GeomRotations.Used()) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_GeomRotations.m_Buffer).Valid())) + return false; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Rotation] = m_GeomRotations.m_Buffer; + } + if (m_GeomAxis0.Used()) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_GeomAxis0.m_Buffer).Valid())) + return false; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Axis0] = m_GeomAxis0.m_Buffer; + } + if (m_GeomAxis1.Used()) + { + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_GeomAxis1.m_Buffer).Valid())) + return false; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Axis1] = m_GeomAxis1.m_Buffer; + } + if (m_GeomConstants.Used()) + outDrawCall.m_UBSemanticsPtr[SRHIDrawCall::UBSemantic_GPUBillboard] = m_GeomConstants.m_Buffer; + return true; +} + +//---------------------------------------------------------------------------- + +u32 CRHIBillboardingBatchPolicy::_GetGeomBillboardShaderOptions(const Drawers::SBillboard_BillboardingRequest &bbRequest) +{ + u32 shaderOptions = Option_GeomBillboarding; + + // Here, we set some flags to know which shader we should use to billboard those particles. + // We need that so PK-SampleLib's render loop avoids re-creating the shaders each time the billboarding mode changes: + // The renderer cache contains the geometry shaders for ALL billboarding mode and we choose between those depending on "m_ShaderOptions" + switch (bbRequest.m_Mode) + { + case BillboardMode_ScreenAligned: + case BillboardMode_ViewposAligned: + break; + case BillboardMode_AxisAligned: + case BillboardMode_AxisAlignedSpheroid: + shaderOptions |= Option_Axis_C1; + break; + case BillboardMode_AxisAlignedCapsule: + shaderOptions |= Option_Axis_C1 | Option_Capsule; + break; + case BillboardMode_PlaneAligned: + shaderOptions |= Option_Axis_C2; + break; + default: + PK_ASSERT_NOT_REACHED(); + return 0; + break; + } + if (bbRequest.m_SizeFloat2) + shaderOptions |= Option_BillboardSizeFloat2; + return shaderOptions; +} + +//---------------------------------------------------------------------------- +// +// Ribbons (CPU billboarding) +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SRibbonBatchJobs *billboardBatch, const SGeneratedInputs &toMap) +{ + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::MapBuffers (ribbons)"); + + if (!PK_VERIFY(billboardBatch != null)) + return false; + + RHI::PApiManager manager = ctx.ApiManager(); + + // Assign mapped vertex/index buffers on CPU tasks that will run async on worker threads + // All buffers used below have been allocated in AllocBuffers either during this BeginCollectingDrawCalls + // They could also have been allocated in a previous BeginCollectingDrawCalls call, see documentation for more detail + // CRibbon_Exec_FillSortIndices will generate indices and sort particles based on the renderer sort metric if necessary + // CRibbon_Exec_Positions will generate particle geometry by connecting particles together + // CRibbon_Exec_Texcoords will generate uvs for ribbons + // CRibbon_Exec_UVRemap will generate necessary data for CorrectDeformation renderer feature to correct UVs in the vertex shader + // CRibbon_Exec_CopyField will do a straight copy of particle sim data fields into the vertex buffers (once per vertex or once per particle if CRibbon_Exec_CopyField::m_PerVertex is set to false) + + // View independent inputs: + if (toMap.m_GeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_Indices.m_Buffer, 0 , m_TotalIndexCount * m_IndexSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalIndexCount, m_IndexSize == sizeof(u32)); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Position) + { + PK_ASSERT(m_Positions.Used()); + void *mappedValue = manager->MapCpuView(m_Positions.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_PNT.m_Positions = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Normal) + { + PK_ASSERT(m_Normals.Used()); + void *mappedValue = manager->MapCpuView(m_Normals.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_PNT.m_Normals = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Tangent) + { + PK_ASSERT(m_Tangents.Used()); + void *mappedValue = manager->MapCpuView(m_Tangents.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_PNT.m_Tangents = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_UV0) + { + PK_ASSERT(m_TexCoords0.Used()); + void *mappedValue = manager->MapCpuView(m_TexCoords0.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat2)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_Texcoords.m_Texcoords = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_UV1) + { + PK_ASSERT(m_TexCoords1.Used()); + void *mappedValue = manager->MapCpuView(m_TexCoords1.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat2)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_Texcoords.m_Texcoords2 = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_AtlasId) + { + PK_ASSERT(m_AtlasIDs.Used()); + void *mappedValue = manager->MapCpuView(m_AtlasIDs.m_Buffer, 0, m_TotalVertexCount * sizeof(float)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_Texcoords.m_AtlasIds = TMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_UVRemap) + { + PK_ASSERT(m_UVRemap.Used()); + void *mappedValue = manager->MapCpuView(m_UVRemap.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_UVRemap.m_UVRemap = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount); + + billboardBatch->m_Exec_Texcoords.m_ForUVFactor = true; + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_UVFactors) + { + PK_ASSERT(m_UVFactors.Used()); + void *mappedValue = manager->MapCpuView(m_UVFactors.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_Exec_PNT.m_UVFactors4 = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + + // View dependent inputs: + PK_ASSERT(m_PerViewBuffers.Count() == billboardBatch->m_PerView.Count()); + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + { + const u32 viewGeneratedInputs = toMap.m_PerViewGeneratedInputs[i].m_GeneratedInputs; + + PK_ASSERT(m_PerViewBuffers[i].m_ViewIdx == billboardBatch->m_PerView[i].m_ViewIndex); + if (viewGeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_PerViewBuffers[i].m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Indices.m_Buffer, 0, m_TotalIndexCount * m_IndexSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalIndexCount, m_IndexSize == sizeof(u32)); + } + if (viewGeneratedInputs & Drawers::GenInput_Position) + { + PK_ASSERT(m_PerViewBuffers[i].m_Positions.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Positions.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_PNT.m_Positions = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (viewGeneratedInputs & Drawers::GenInput_Tangent) + { + PK_ASSERT(m_PerViewBuffers[i].m_Tangents.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Tangents.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_PNT.m_Tangents = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (viewGeneratedInputs & Drawers::GenInput_Normal) + { + PK_ASSERT(m_PerViewBuffers[i].m_Normals.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Normals.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_PNT.m_Normals = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (viewGeneratedInputs & Drawers::GenInput_UVFactors) + { + PK_ASSERT(m_PerViewBuffers[i].m_UVFactors.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_UVFactors.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardBatch->m_PerView[i].m_Exec_PNT.m_UVFactors4 = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + } + + // Additional inputs: + if (!toMap.m_AdditionalGeneratedInputs.Empty()) + { + PK_ASSERT(toMap.m_AdditionalGeneratedInputs.Count() >= m_AdditionalFields.Count()); + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalVertexCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalVertexCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + billboardBatch->m_Exec_CopyField.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CRibbon_CPU *billboardBatch) +{ + (void)ctx; (void)drawRequests; (void)billboardBatch; +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_RibbonCustomParticleSelectTask.Clear(); + PK_ASSERT(m_IsParticleSelected.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_IsParticleSelected.m_Buffer, 0, sizeof(float) * m_TotalVertexCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_RibbonCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, sizeof(float)); + m_RibbonCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + billboardBatch->AddExecBatch(&m_RibbonCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *batch) +{ + (void)ctx; (void)drawRequests; (void)batch; + + PK_ASSERT_NOT_REACHED(); + + return false; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Ribbon(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::EmitDrawCall Ribbon (CPU)"); + + PK_ASSERT(!m_GeomPositions.Used()); // Cannot happen, we do not support geom shaders for ribbons yet + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(toEmit, output, SRHIDrawCall::DrawCall_Regular, PKSample::Option_VertexPassThrough); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + bool hasAtlas = false; + CRendererCacheInstance_UpdateThread *refCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (PK_VERIFY(refCacheInstance != null)) + { + PKSample::PCRendererCacheInstance rCacheInstance = refCacheInstance->RenderThread_GetCacheInstance(); + if (PK_VERIFY(rCacheInstance != null)) + hasAtlas = rCacheInstance->m_HasAtlas; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + if (!_SetupCommonBillboardVertexBuffers(outDrawCall, hasAtlas)) + return false; + if (!_SetupBillboardDrawCall(ctx, toEmit, outDrawCall)) + return false; + return true; +} + +//---------------------------------------------------------------------------- +// +// Meshes +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SMeshBatchJobs *meshBatch, const SGeneratedInputs &toMap) +{ + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::MapBuffers (meshes)"); + + RHI::PApiManager manager = ctx.ApiManager(); + + // Assign mapped vertex buffers on CPU tasks that will run async on worker threads + // All buffers used below have been allocated in AllocBuffers either during this BeginCollectingDrawCalls + // They could also have been allocated in a previous BeginCollectingDrawCalls call, see documentation for more detail + // CMesh_Exec_Matrices will generate per particle (instance) transforms + // CMesh_Exec_CopyField will do a straight copy of particle sim data fields into the vertex buffers + // All other buffers (mesh positions/normals/tangents/etc) should be retrieved from the actual mesh rendered + + if (meshBatch == null) // GPU Storage + { + // Indirect draw buffer + m_MappedIndexedIndirectBuffer = static_cast(manager->MapCpuView(m_IndirectDraw.m_Buffer)); + if (!PK_VERIFY(m_MappedIndexedIndirectBuffer != null)) + return false; + + // Sim stream offsets + m_MappedSimStreamOffsets_Positions = static_cast(manager->MapCpuView(m_SimStreamOffsets_Positions.m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_Positions != null)) + return false; + m_MappedSimStreamOffsets_Orientations = static_cast(manager->MapCpuView(m_SimStreamOffsets_Orientations.m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_Orientations != null)) + return false; + m_MappedSimStreamOffsets_Scales = static_cast(manager->MapCpuView(m_SimStreamOffsets_Scales.m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_Scales != null)) + return false; + m_MappedSimStreamOffsets_Enableds = static_cast(manager->MapCpuView(m_SimStreamOffsets_Enableds.m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_Enableds != null)) + return false; + if (m_HasMeshIDs) + { + m_MappedSimStreamOffsets_MeshIDs = static_cast(manager->MapCpuView(m_SimStreamOffsets_MeshIDs.m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_MeshIDs != null)) + return false; + } + if (m_HasMeshLODs) + { + m_MappedSimStreamOffsets_LODs = static_cast(manager->MapCpuView(m_SimStreamOffsets_MeshLODs.m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_LODs != null)) + return false; + } + for (u32 i = 0; i < m_SimStreamOffsets_AdditionalInputs.Count(); ++i) + { + m_MappedSimStreamOffsets_AdditionalInputs[i] = static_cast(manager->MapCpuView(m_SimStreamOffsets_AdditionalInputs[i].m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_AdditionalInputs[i] != null)) + return false; + } + // Matrices offsets + m_MappedMatricesOffsets = static_cast(manager->MapCpuView(m_MatricesOffsets.m_Buffer)); + if (!PK_VERIFY(m_MappedMatricesOffsets != null)) + return false; + + // Indirection offsets + m_MappedIndirectionOffsets = static_cast(manager->MapCpuView(m_IndirectionOffsets.m_Buffer)); + if (!PK_VERIFY(m_MappedIndirectionOffsets != null)) + return false; + + return true; + } + + PK_ASSERT(!m_GPUStorage); + + if (toMap.m_GeneratedInputs & Drawers::GenInput_Matrices) + { + PK_ASSERT(m_Matrices.Used()); + CFloat4x4 *mappedMatrices = static_cast(manager->MapCpuView(m_Matrices.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat4x4))); + if (!PK_VERIFY(mappedMatrices != null)) + return false; + + meshBatch->m_Exec_Matrices.m_Matrices = TMemoryView(mappedMatrices, m_TotalParticleCount); + } + + // Additional inputs: + if (!toMap.m_AdditionalGeneratedInputs.Empty()) + { + PK_ASSERT(toMap.m_AdditionalGeneratedInputs.Count() >= m_AdditionalFields.Count()); + + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalParticleCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + + // We either render each sub mesh id with the same vertex buffer, or we have a single sub mesh id to render + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalParticleCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + meshBatch->m_Exec_CopyField.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + return true; +} + + +//---------------------------------------------------------------------------- +// +// Decals +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SDecalBatchJobs *decalBatch, const SGeneratedInputs &toMap) +{ + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::MapBuffers (decals)"); + + RHI::PApiManager manager = ctx.ApiManager(); + + if (!PK_VERIFY(decalBatch != null)) + return false; + + if (toMap.m_GeneratedInputs & Drawers::GenInput_Matrices) + { + PK_ASSERT(m_Matrices.Used()); + CFloat4x4 *mappedMatrices = static_cast(manager->MapCpuView(m_Matrices.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat4x4))); + if (!PK_VERIFY(mappedMatrices != null)) + return false; + CFloat4x4 *mappedInvMatrices = static_cast(manager->MapCpuView(m_InvMatrices.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat4x4))); + if (!PK_VERIFY(mappedInvMatrices != null)) + return false; + + decalBatch->m_Exec_Matrices.m_Matrices = TMemoryView(mappedMatrices, m_TotalParticleCount); + decalBatch->m_Exec_Matrices.m_InvMatrices = TMemoryView(mappedInvMatrices, m_TotalParticleCount); + } + + // Additional inputs: + if (!toMap.m_AdditionalGeneratedInputs.Empty()) + { + PK_ASSERT(toMap.m_AdditionalGeneratedInputs.Count() >= m_AdditionalFields.Count()); + + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalParticleCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + + // We either render each sub mesh id with the same vertex buffer, or we have a single sub mesh id to render + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalParticleCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + m_CopyAdditionalFieldsTask.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::MapBuffers(SRenderContext &ctx, const TMemoryView &views, STriangleBatchJobs *triangleBatch, const SGeneratedInputs &toMap) +{ + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::MapBuffers (triangles)"); + + RHI::PApiManager manager = ctx.ApiManager(); + + if (!PK_VERIFY(triangleBatch != null)) + return false; + + if (toMap.m_GeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_Indices.m_Buffer, 0, m_TotalIndexCount * m_IndexSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + triangleBatch->m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalIndexCount, m_IndexSize == sizeof(u32)); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Position) + { + PK_ASSERT(m_Positions.Used()); + void *mappedValue = manager->MapCpuView(m_Positions.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + triangleBatch->m_Exec_PNT.m_Positions = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Normal) + { + PK_ASSERT(m_Normals.Used()); + void *mappedValue = manager->MapCpuView(m_Normals.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + triangleBatch->m_Exec_PNT.m_Normals = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_Tangent) + { + PK_ASSERT(m_Tangents.Used()); + void *mappedValue = manager->MapCpuView(m_Tangents.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + triangleBatch->m_Exec_PNT.m_Tangents = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, 0x10); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_UV0) + { + PK_ASSERT(m_TexCoords0.Used()); + void *mappedValue = manager->MapCpuView(m_TexCoords0.m_Buffer, 0, m_TotalVertexCount * sizeof(CFloat2)); + if (!PK_VERIFY(mappedValue != null)) + return false; + triangleBatch->m_Exec_PNT.m_Texcoords = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount); + } + + // View dependent inputs: + PK_ASSERT(m_PerViewBuffers.Count() == triangleBatch->m_PerView.Count()); + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + { + const u32 viewGeneratedInputs = toMap.m_PerViewGeneratedInputs[i].m_GeneratedInputs; + + PK_ASSERT(m_PerViewBuffers[i].m_ViewIdx == triangleBatch->m_PerView[i].m_ViewIndex); + if (viewGeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_PerViewBuffers[i].m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Indices.m_Buffer, 0, m_TotalIndexCount * m_IndexSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + triangleBatch->m_PerView[i].m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalIndexCount, m_IndexSize == sizeof(u32)); + } + } + + // Additional inputs: + if (!toMap.m_AdditionalGeneratedInputs.Empty()) + { + PK_ASSERT(toMap.m_AdditionalGeneratedInputs.Count() >= m_AdditionalFields.Count()); + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalVertexCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalVertexCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + triangleBatch->m_Exec_CopyField.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPUTriangleBatchJobs *GPUTriangleBatch, const SGeneratedInputs &toMap) +{ + (void)ctx; (void)views; (void)GPUTriangleBatch; (void)toMap; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::MapBuffers (GPU Triangle)"); + + PK_ASSERT_NOT_REACHED(); + + return false; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPURibbonBatchJobs *GPURibbonBatch, const SGeneratedInputs &toMap) +{ + (void)ctx; (void)views; (void)GPURibbonBatch; (void)toMap; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::MapBuffers (GPU ribbon)"); + + PK_ASSERT_NOT_REACHED(); + + return false; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CMesh_CPU *meshBatch) +{ + (void)ctx; (void)drawRequests; (void)meshBatch; + + if (meshBatch == null) // GPU strorage + { + PK_ASSERT(m_GPUStorage); + #if (PK_PARTICLES_UPDATER_USE_GPU != 0) + // Init. draw indirect buffer (instance counts we will be set by compute shader) + if (m_MappedIndexedIndirectBuffer != null) + { + for (u32 dri = 0; dri < m_DrawRequestCount; dri++) + { + for (u32 meshi = 0; meshi < m_MeshCount; meshi++) + { + m_MappedIndexedIndirectBuffer[m_MeshCount * dri + meshi].m_IndexCount = m_PerMeshIndexCount[meshi]; + m_MappedIndexedIndirectBuffer[m_MeshCount * dri + meshi].m_InstanceCount = 0; + m_MappedIndexedIndirectBuffer[m_MeshCount * dri + meshi].m_IndexOffset = 0; + m_MappedIndexedIndirectBuffer[m_MeshCount * dri + meshi].m_VertexOffset = 0; + m_MappedIndexedIndirectBuffer[m_MeshCount * dri + meshi].m_InstanceOffset = 0; + } + } + } + + // Setup stream offsets + // Pos/Scale/Orientation/Enabled [ + MeshIds ] [ + MeshLODs ] [ + Additional inputs ] + const u32 streamCount = 4 + (m_HasMeshIDs ? 1 : 0) + (m_HasMeshLODs ? 1 : 0) + m_SimStreamOffsets_AdditionalInputs.Count(); + PK_STACKALIGNEDMEMORYVIEW(u32, streamsOffsets, m_DrawRequestCount * streamCount, 0x10); + for (u32 dri = 0; dri < m_DrawRequestCount; dri++) + { + // Fill in stream offsets for each draw request + const Drawers::SMesh_DrawRequest *dr = static_cast(drawRequests[dri]); + const Drawers::SMesh_BillboardingRequest *bbRequest = static_cast(&dr->BaseBillboardingRequest()); + const CParticleStreamToRender_GPU *streamToRender = dr->StreamToRender_GPU(); + + u32 offset = 0; + streamsOffsets[offset++ * m_DrawRequestCount + dri] = streamToRender->StreamOffset(bbRequest->m_PositionStreamId); + streamsOffsets[offset++ * m_DrawRequestCount + dri] = streamToRender->StreamOffset(bbRequest->m_ScaleStreamId); + streamsOffsets[offset++ * m_DrawRequestCount + dri] = streamToRender->StreamOffset(bbRequest->m_OrientationStreamId); + streamsOffsets[offset++ * m_DrawRequestCount + dri] = streamToRender->StreamOffset(bbRequest->m_EnabledStreamId); + if (m_HasMeshIDs) + streamsOffsets[offset++ * m_DrawRequestCount + dri] = streamToRender->StreamOffset(bbRequest->m_MeshIDStreamId); + if (m_HasMeshLODs) + streamsOffsets[offset++ * m_DrawRequestCount + dri] = streamToRender->StreamOffset(bbRequest->m_MeshLODStreamId); + + // Add all non-virtual stream additional inputs + const u32 additionalInputCount = m_SimStreamOffsets_AdditionalInputs.Count(); + for (u32 iInput = 0; iInput < additionalInputCount; ++iInput) + { + const u32 additionalInputId = m_AdditionalFields[iInput].m_AdditionalInputIndex; + streamsOffsets[offset++ * m_DrawRequestCount + dri] = streamToRender->StreamOffset(bbRequest->m_AdditionalInputs[additionalInputId].m_StreamId); + } + } + // Non temporal writes to gpu mem, aligned and contiguous + u32 streamOffset = 0; + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Positions, &streamsOffsets[streamOffset++ * m_DrawRequestCount], sizeof(u32) * m_DrawRequestCount); + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Scales, &streamsOffsets[streamOffset++ * m_DrawRequestCount], sizeof(u32) * m_DrawRequestCount); + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Orientations, &streamsOffsets[streamOffset++ * m_DrawRequestCount], sizeof(u32) * m_DrawRequestCount); + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Enableds, &streamsOffsets[streamOffset++ * m_DrawRequestCount], sizeof(u32) * m_DrawRequestCount); + if (m_HasMeshIDs) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_MeshIDs, &streamsOffsets[streamOffset++ * m_DrawRequestCount], sizeof(u32) * m_DrawRequestCount); + if (m_HasMeshLODs) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_LODs, &streamsOffsets[streamOffset++ * m_DrawRequestCount], sizeof(u32) * m_DrawRequestCount); + for (u32 iInput = 0; iInput < m_MappedSimStreamOffsets_AdditionalInputs.Count(); ++iInput) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_AdditionalInputs[iInput], &streamsOffsets[streamOffset++ * m_DrawRequestCount], sizeof(u32) * m_DrawRequestCount); + + // Init indirection offsets + const u32 indirectionOffsetsSizeInBytes = 2 * m_DrawRequestCount * sizeof(u32) * (m_HasMeshIDs ? m_MeshCount : (m_HasMeshLODs ? drawRequests[0]->m_BB.LODCount() : 1)); + Mem::Clear_Uncached(m_MappedIndirectionOffsets, indirectionOffsetsSizeInBytes); + + // Setup matrices offset + RHI::PApiManager manager = ctx.ApiManager(); + u32 offset = 0u; + for (u32 i = 0; i < m_DrawRequestCount; i++) + { + m_MappedMatricesOffsets[i] = offset; + + const Drawers::SMesh_DrawRequest *dr = static_cast(drawRequests[i]); + offset += dr->InputParticleCount() * sizeof(CFloat4x4); + } + #endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + return true; + } + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_MeshCustomParticleSelectTask.Clear(); + PK_ASSERT(m_IsParticleSelected.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_IsParticleSelected.m_Buffer, 0, sizeof(float) * m_TotalParticleCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_MeshCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, sizeof(float)); + m_MeshCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + meshBatch->AddExecPage(&m_MeshCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + return true; +} + + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CDecal_CPU *decalBatch) +{ + (void)ctx; (void)decalBatch; + + m_CopyTasks.Prepare(TMemoryView::Reinterpret(drawRequests)); + m_CopyTasks.AddExecAsyncPage(&m_CopyAdditionalFieldsTask); +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_CopyStreamCustomParticleSelectTask.Clear(); + PK_ASSERT(m_IsParticleSelected.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_IsParticleSelected.m_Buffer, 0, sizeof(float) * m_TotalParticleCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_CopyStreamCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, sizeof(float)); + m_CopyStreamCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + m_CopyTasks.AddExecAsyncPage(&m_CopyStreamCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + m_CopyTasks.LaunchTasks(null); + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Mesh_CPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + (void)ctx; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::EmitDrawCall Mesh"); + + // No need to iterate on all draw requests, just take the first as reference as they wouldn't have been batched if not compatible + CRendererCacheInstance_UpdateThread *refCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(refCacheInstance != null)) + return false; + PKSample::PCRendererCacheInstance rCacheInstance = refCacheInstance->RenderThread_GetCacheInstance(); + + if (rCacheInstance == null) + return false; + + // Mesh not resolved, shouldn't assert. + if (rCacheInstance->m_AdditionalGeometry == null) + return true; + + // Will search the attribute description in render state, because renderer features has been checked at renderer cache build in MaterialToRHI.cpp:256 (_SetGeneratedInputs) + const u32 shaderOptions = PKSample::Option_VertexPassThrough; + + TMemoryView vertexBuffDescView; + if (rCacheInstance->m_Cache != null) + { + RHI::PCRenderState renderState = rCacheInstance->m_Cache->GetRenderState(static_cast(shaderOptions)); + if (renderState != null) + { + vertexBuffDescView = renderState->m_RenderState.m_ShaderBindings.m_InputAttributes.View(); + + PK_ONLY_IF_ASSERTS({ + const u32 vertexBufferMaxCount = Utils::__MaxMeshSemantics + 1 + m_AdditionalFields.Count(); + PK_ASSERT(vertexBuffDescView.Count() <= vertexBufferMaxCount); + }); + } + } + + const u32 subMeshCount = rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews.Count(); + if (subMeshCount == 0) + return false; + + PK_ASSERT(!m_HasMeshIDs || m_PerMeshParticleCount.Count() == subMeshCount); + + for (u32 iSubMesh = 0; iSubMesh < subMeshCount; ++iSubMesh) + { + if (m_PerMeshParticleCount[iSubMesh] == 0) + continue; + + const u32 particleOffset = m_PerMeshBufferOffset[iSubMesh]; + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(toEmit, output, SRHIDrawCall::DrawCall_IndexedInstanced, shaderOptions); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + + // Try gathering mesh from renderer cache instance + bool success = true; + + // Push mesh buffers: + const Utils::GpuBufferViews &bufferView = rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews[iSubMesh]; + + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.Reserve(vertexBuffDescView.Count()))) + return false; + + { +#define _PUSH_VERTEX_BUFFER_AND_OFFSET(_condition, _name) \ + if (_condition) \ + { \ + success &= outDrawCall.m_VertexBuffers.PushBack(bufferView.m_VertexBuffers[Utils::PK_GLUE(Mesh, _name)]).Valid(); \ + success &= outDrawCall.m_VertexOffsets.PushBack(0).Valid(); \ + if (bufferView.m_VertexBuffers[Utils::PK_GLUE(Mesh, _name)] == null) \ + { \ + success = false; \ + CLog::Log(PK_ERROR, "Submesh %d doesn't have stream %s in its geometry.", iSubMesh, PK_STRINGIFY(_name)); \ + } \ + } + + for (u32 aidx = 0; aidx < vertexBuffDescView.Count(); ++aidx) + { + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Position", Positions); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Normal", Normals); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Tangent", Tangents); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Color0", Colors); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "UV0", Texcoords); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Color1", Colors1); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "UV1", Texcoords1); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "BoneIds", BoneIds); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "BoneWeights", BoneWeights); + } +#undef _PUSH_VERTEX_BUFFER_AND_OFFSET + if (!success) + { + CLog::Log(PK_ERROR, "Missing mesh data required by the material"); + return false; + } + } + + if (m_PerMeshParticleCount.Empty()) + outDrawCall.m_InstanceCount = toEmit.m_TotalParticleCount; + else + outDrawCall.m_InstanceCount = m_PerMeshParticleCount[iSubMesh]; + + // Matrices: + success &= outDrawCall.m_VertexOffsets.PushBack(particleOffset * u32(sizeof(CFloat4x4))).Valid(); + success &= outDrawCall.m_VertexBuffers.PushBack(m_Matrices.m_Buffer).Valid(); + + // Additional inputs: + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + const u32 bufferOffset = particleOffset * m_AdditionalFields[i].m_ByteSize; + + success &= outDrawCall.m_VertexOffsets.PushBack(bufferOffset).Valid(); + success &= outDrawCall.m_VertexBuffers.PushBack(m_AdditionalFields[i].m_Buffer.m_Buffer).Valid(); + + // Editor only: for debugging purposes, we'll remove that from samples code later + if (m_AdditionalFields[i].m_Semantic == SRHIDrawCall::DebugDrawGPUBuffer_Color) + { + PK_ASSERT(m_AdditionalFields[i].m_ByteSize == sizeof(CFloat4)); + PK_ASSERT(outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] == null); + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = m_AdditionalFields[i].m_Buffer.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Color] = bufferOffset; + } + } + } + + PK_ASSERT(vertexBuffDescView.Count() == outDrawCall.m_VertexBuffers.Count() || + (vertexBuffDescView.Empty() && !outDrawCall.m_Valid)); + + // Fill the semantics for the debug draws: + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = bufferView.m_VertexBuffers[Utils::MeshPositions]; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Position] = 0; + + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_InstanceTransforms] = m_Matrices.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_InstanceTransforms] = particleOffset * u32(sizeof(CFloat4x4)); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if ((ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) && m_IsParticleSelected.Used()) + { + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = m_IsParticleSelected.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = particleOffset * u32(sizeof(float)); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + if (!success) + { + CLog::Log(PK_ERROR, "Could not add all the mesh vertex data"); + return false; + } + + // Set index buffer + outDrawCall.m_IndexBuffer = bufferView.m_IndexBuffer; + if (bufferView.m_IndexBufferSize == RHI::IndexBuffer16Bit) + outDrawCall.m_IndexCount = bufferView.m_IndexBuffer->GetByteSize() / sizeof(u16); + else if (bufferView.m_IndexBufferSize == RHI::IndexBuffer32Bit) + outDrawCall.m_IndexCount = bufferView.m_IndexBuffer->GetByteSize() / sizeof(u32); + else + { + PK_ASSERT_NOT_REACHED(); + return false; + } + outDrawCall.m_IndexSize = bufferView.m_IndexBufferSize; + outDrawCall.m_IndexOffset = 0; + } + return true; +} + +//---------------------------------------------------------------------------- + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) +u32 CRHIBillboardingBatchPolicy::_SubmeshIDToLOD(CRendererCacheInstance_UpdateThread &refCacheInstance, u32 lodCount, u32 iSubMesh) +{ + // From the flat submesh id, determine the lod level + u32 lod = 0; + if (m_HasMeshLODs) + { + u32 totalMeshCount = 0; + for (u32 i = 0; i < lodCount; ++i, ++lod) + { + totalMeshCount += refCacheInstance.m_PerLODMeshCount[0]; + if (iSubMesh < totalMeshCount) + break; + } + } + return lod; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Mesh_GPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_ASSERT(m_GPUStorage); + + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::EmitDrawCall Mesh (GPU)"); + + // Get renderer cache instance + CRendererCacheInstance_UpdateThread *refCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(refCacheInstance != null)) + return false; + PKSample::PCRendererCacheInstance rCacheInstance = refCacheInstance->RenderThread_GetCacheInstance(); + + if (rCacheInstance == null || rCacheInstance->m_Cache == null) + return false; + + // Mesh not resolved, shouldn't assert. + if (rCacheInstance->m_AdditionalGeometry == null) + return true; + + // Will search the attribute description in render state, because renderer features has been checked at renderer cache build in MaterialToRHI.cpp:256 (_SetGeneratedInputs) + const u32 shaderOptions = PKSample::Option_VertexPassThrough | PKSample::Option_GPUMesh; + + TMemoryView vertexBuffDescView; + RHI::PCRenderState renderState = rCacheInstance->m_Cache->GetRenderState(static_cast(shaderOptions)); + if (renderState != null) + { + vertexBuffDescView = renderState->m_RenderState.m_ShaderBindings.m_InputAttributes.View(); + // Vertex attribute should only hold mesh data since particle additionnal fields are bound using raw buffer + PK_ONLY_IF_ASSERTS({ + const u32 vertexBufferMaxCount = Utils::__MaxMeshSemantics + 1; + PK_ASSERT(vertexBuffDescView.Count() <= vertexBufferMaxCount); + }); + } + + const u32 subMeshCount = rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews.Count(); + if (subMeshCount == 0) + return false; + + // We will fill those compute dispatch descriptions arrays and add them to draw call afterwards since order matters. + TArray computeParticleCountPerMesh; + TArray computeMeshMatrices; + TArray computeIndirection; + + RHI::PApiManager manager = ctx.ApiManager(); + + // Get simData and offsets constant sets layouts + const RHI::SConstantSetLayout *simDataConstantSetLayout = null; + const RHI::SConstantSetLayout *offsetsConstantSetLayout = null; + if (!PK_VERIFY(rCacheInstance->m_Cache->GetGPUStorageConstantSets(static_cast(shaderOptions), simDataConstantSetLayout, offsetsConstantSetLayout)) || + !PK_VERIFY(simDataConstantSetLayout != null) || + !PK_VERIFY(offsetsConstantSetLayout != null) || + simDataConstantSetLayout->m_Constants.Empty() || + offsetsConstantSetLayout->m_Constants.Empty()) + return false; + + const u32 lodCount = refCacheInstance->m_PerLODMeshCount.Count(); + // Iterate on draw requests + for (u32 dri = 0; dri < m_DrawRequestCount; ++dri) + { + const Drawers::SMesh_DrawRequest *dr = static_cast(toEmit.m_DrawRequests[dri]); + const Drawers::SMesh_BillboardingRequest *bbRequest = static_cast(&dr->BaseBillboardingRequest()); + const CParticleStreamToRender_GPU *streamToRender = dr->StreamToRender_GPU(); + + // Get particle sim info GPU buffer + RHI::PGpuBuffer particleSimInfo = _RetrieveParticleInfoBuffer(manager, streamToRender); + if (!PK_VERIFY(particleSimInfo != null)) + return false; + + // Get particle stream GPU buffer + u32 offset = 0; + RHI::PGpuBuffer streamBufferGPU = _RetrieveStorageBuffer(manager, streamToRender, bbRequest->m_PositionStreamId, offset); + PK_ASSERT(streamBufferGPU != null); + + // Get particle count estimated for dispatch + const u32 drParticleCountEst = dr->InputParticleCount(); + + // Update simData constant set + m_SimDataConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Sim Data Constant Set"), *simDataConstantSetLayout); + if (!PK_VERIFY(m_SimDataConstantSet != null)) + return false; + PK_ASSERT(m_SimDataConstantSet->GetConstantValues().Count() == 3); // SimBuffer, transforms (from computes), indirection (from computes) + if (!PK_VERIFY(m_SimDataConstantSet->SetConstants(streamBufferGPU, 0)) || + !PK_VERIFY(m_SimDataConstantSet->SetConstants(m_Matrices.m_Buffer, 1)) || + !PK_VERIFY(m_SimDataConstantSet->SetConstants(m_Indirection.m_Buffer, 2))) + return false; + m_SimDataConstantSet->UpdateConstantValues(); + + // Update offsets constant set + m_OffsetsConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Offsets Constant Set"), *offsetsConstantSetLayout); + if (!PK_VERIFY(m_OffsetsConstantSet != null)) + return false; + PK_ASSERT(!m_SimStreamOffsets_AdditionalInputs.Empty()); + PK_ASSERT(m_OffsetsConstantSet->GetConstantValues().Count() == m_SimStreamOffsets_AdditionalInputs.Count() + 2); // transforms offsets, indirection offsets, additional inputs + if (!PK_VERIFY(m_OffsetsConstantSet->SetConstants(m_MatricesOffsets.m_Buffer, 0)) || + !PK_VERIFY(m_OffsetsConstantSet->SetConstants(m_IndirectionOffsets.m_Buffer, 1))) + return false; + for (u32 i = 2; i < m_OffsetsConstantSet->GetConstantValues().Count(); ++i) + { + if (!PK_VERIFY(m_OffsetsConstantSet->SetConstants(m_SimStreamOffsets_AdditionalInputs[i - 2].m_Buffer, i))) + return false; + } + m_OffsetsConstantSet->UpdateConstantValues(); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + RHI::PGpuBuffer bufferIsSelected = ctx.Selection().HasGPUParticlesSelected() ? GetIsSelectedBuffer(ctx.Selection(), *dr) : null; + if (bufferIsSelected != null) + { + RHI::SConstantSetLayout GPUSelectionConstantSetLayout(RHI::VertexShaderMask); + GPUSelectionConstantSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("IsSelected")); + m_GPUSelectionConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("IsSelected Constant Set"), GPUSelectionConstantSetLayout); + m_GPUSelectionConstantSet->SetConstants(bufferIsSelected, 0); + m_GPUSelectionConstantSet->UpdateConstantValues(); + } + else + { + m_GPUSelectionConstantSet = null; + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + // For each mesh, setup draw call description + for (u32 iSubMesh = 0; iSubMesh < subMeshCount; ++iSubMesh) + { + SRHIDrawCall *_outDrawCall = _CreateDrawCall(toEmit, output, SRHIDrawCall::DrawCall_IndexedInstancedIndirect, shaderOptions); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + + // Try gathering mesh from renderer cache instance + bool success = true; + + // Push mesh buffers: + const Utils::GpuBufferViews &bufferView = rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews[iSubMesh]; + + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.Reserve(vertexBuffDescView.Count()))) + return false; + + { +#define _PUSH_VERTEX_BUFFER_AND_OFFSET(_condition, _name) \ + if (_condition) \ + { \ + success &= outDrawCall.m_VertexBuffers.PushBack(bufferView.m_VertexBuffers[Utils::PK_GLUE(Mesh, _name)]).Valid(); \ + success &= outDrawCall.m_VertexOffsets.PushBack(0).Valid(); \ + if (bufferView.m_VertexBuffers[Utils::PK_GLUE(Mesh, _name)] == null) \ + { \ + success = false; \ + CLog::Log(PK_ERROR, "Submesh %d doesn't have stream %s in its geometry.", iSubMesh, PK_STRINGIFY(_name)); \ + } \ + } + + for (u32 aidx = 0; aidx < vertexBuffDescView.Count(); ++aidx) + { + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Position", Positions); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Normal", Normals); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Tangent", Tangents); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Color0", Colors); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "UV0", Texcoords); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "Color1", Colors1); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "UV1", Texcoords1); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "BoneIds", BoneIds); + _PUSH_VERTEX_BUFFER_AND_OFFSET(vertexBuffDescView[aidx].m_Name == "BoneWeights", BoneWeights); + } +#undef _PUSH_VERTEX_BUFFER_AND_OFFSET + } + + if (!success) + { + CLog::Log(PK_ERROR, "Could not add all the mesh vertex data"); + return false; + } + + outDrawCall.m_GPUStorageSimDataConstantSet = m_SimDataConstantSet; + outDrawCall.m_GPUStorageOffsetsConstantSet = m_OffsetsConstantSet; +#if (PK_HAS_PARTICLES_SELECTION != 0) + outDrawCall.m_SelectionConstantSet = m_GPUSelectionConstantSet; +#endif + const u32 currentLOD = _SubmeshIDToLOD(*refCacheInstance, lodCount, iSubMesh); + + // Draw call push constants + if (!PK_VERIFY(outDrawCall.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&outDrawCall.m_PushConstants.Last()); + drPushConstant[0] = dri; // Draw request ID (used to get streams offsets from stream offsets buffers) + drPushConstant[1] = m_HasMeshIDs ? + m_MeshCount * m_DrawRequestCount + m_MeshCount * dri + iSubMesh : + (m_HasMeshLODs ? lodCount * m_DrawRequestCount + lodCount * dri + currentLOD : m_DrawRequestCount + dri); // Used to get the indirection offset from indirection offsets buffer + + // Set index buffer + outDrawCall.m_IndexBuffer = bufferView.m_IndexBuffer; + outDrawCall.m_IndexSize = bufferView.m_IndexBufferSize; + + // Set indirect buffer (will be updated by computeParticleCountPerMesh compute shader) + outDrawCall.m_IndirectBuffer = m_IndirectDraw.m_Buffer; + outDrawCall.m_IndirectBufferOffset = m_DrawCallCurrentOffset; + + // Fill the semantics for the debug draws: + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = bufferView.m_VertexBuffers[Utils::MeshPositions]; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Position] = 0; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_TransformsOffsets] = m_MatricesOffsets.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_IndirectionOffsets] = m_IndirectionOffsets.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_ColorsOffsets] = m_HasColorStream ? m_SimStreamOffsets_AdditionalInputs[0].m_Buffer : null; + + m_DrawCallCurrentOffset += sizeof(RHI::SDrawIndexedIndirectArgs); + } // end of draw call description setup + + // Compute : Count particles per mesh + { + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + RHI::SConstantSetLayout layout; + PKSample::CreateComputeParticleCountPerMeshConstantSetLayout(layout, m_HasMeshIDs, m_HasMeshLODs); + RHI::PConstantSet computeConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Compute Mesh PCount Constant Set"), layout); + u32 constantId = 0; + computeConstantSet->SetConstants(particleSimInfo, constantId++); + computeConstantSet->SetConstants(streamBufferGPU, constantId++); + computeConstantSet->SetConstants(m_SimStreamOffsets_Enableds.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_IndirectDraw.m_Buffer, constantId++); + if (m_HasMeshIDs) + computeConstantSet->SetConstants(m_SimStreamOffsets_MeshIDs.m_Buffer, constantId++); + if (m_HasMeshLODs) + computeConstantSet->SetConstants(m_SimStreamOffsets_MeshLODs.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_LODsConstantBuffer.m_Buffer, constantId++); + computeConstantSet->UpdateConstantValues(); + computeDispatch.m_ConstantSet = computeConstantSet; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = dri; + drPushConstant[1] = m_MeshCount; + if (m_HasMeshLODs) + drPushConstant[2] = lodCount; + + // State + const PKSample::EComputeShaderType type = m_HasMeshIDs ? + (m_HasMeshLODs ? ComputeType_ComputeParticleCountPerMesh_LOD_MeshAtlas : ComputeType_ComputeParticleCountPerMesh_MeshAtlas) : + (m_HasMeshLODs ? ComputeType_ComputeParticleCountPerMesh_LOD : ComputeType_ComputeParticleCountPerMesh); + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + + // Dispatch args + computeDispatch.m_ThreadGroups = CInt3((Mem::Align(drParticleCountEst, PK_RH_GPU_THREADGROUP_SIZE) / PK_RH_GPU_THREADGROUP_SIZE), 1, 1); + + computeParticleCountPerMesh.PushBack(computeDispatch); + } + + // Compute : compute indirection + { + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + RHI::SConstantSetLayout layout; + PKSample::CreateComputeMeshIndirectionBufferConstantSetLayout(layout, m_HasMeshIDs, m_HasMeshLODs); + RHI::PConstantSet computeConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Compute Indirection Constant Set"), layout); + u32 constantId = 0; + computeConstantSet->SetConstants(particleSimInfo, constantId++); + computeConstantSet->SetConstants(streamBufferGPU, constantId++); + computeConstantSet->SetConstants(m_SimStreamOffsets_Enableds.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_Indirection.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_IndirectionOffsets.m_Buffer, constantId++); + if (m_HasMeshIDs) + computeConstantSet->SetConstants(m_SimStreamOffsets_MeshIDs.m_Buffer, constantId++); + if (m_HasMeshLODs) + computeConstantSet->SetConstants(m_SimStreamOffsets_MeshLODs.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_LODsConstantBuffer.m_Buffer, constantId++); + + computeConstantSet->UpdateConstantValues(); + computeDispatch.m_ConstantSet = computeConstantSet; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = dri; + drPushConstant[1] = m_MeshCount; + if (m_HasMeshLODs) + drPushConstant[2] = lodCount; + + // State + const PKSample::EComputeShaderType type = m_HasMeshIDs ? + (m_HasMeshLODs ? ComputeType_ComputeMeshIndirectionBuffer_LOD_MeshAtlas : ComputeType_ComputeMeshIndirectionBuffer_MeshAtlas) : + (m_HasMeshLODs ? ComputeType_ComputeMeshIndirectionBuffer_LOD : ComputeType_ComputeMeshIndirectionBuffer); + + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + + // Dispatch args + computeDispatch.m_ThreadGroups = CInt3((Mem::Align(drParticleCountEst, PK_RH_GPU_THREADGROUP_SIZE) / PK_RH_GPU_THREADGROUP_SIZE), 1, 1); + + computeIndirection.PushBack(computeDispatch); + } + + // Compute : build matrices from stream + { + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + RHI::SConstantSetLayout layout; + PKSample::CreateComputeMeshMatricesConstantSetLayout(layout); + RHI::PConstantSet computeConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Build Matrices Constant Set"), layout); + u32 constantId = 0; + computeConstantSet->SetConstants(particleSimInfo, constantId++); + computeConstantSet->SetConstants(streamBufferGPU, constantId++); + computeConstantSet->SetConstants(m_SimStreamOffsets_Positions.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_SimStreamOffsets_Scales.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_SimStreamOffsets_Orientations.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_MatricesOffsets.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_Matrices.m_Buffer, constantId++); + computeConstantSet->UpdateConstantValues(); + computeDispatch.m_ConstantSet = computeConstantSet; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = dri; // used to index mesh offsets + + // State + const PKSample::EComputeShaderType type = ComputeType_ComputeMeshMatrices; + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + + // Dispatch args + computeDispatch.m_ThreadGroups = CInt3((Mem::Align(drParticleCountEst, PK_RH_GPU_THREADGROUP_SIZE) / PK_RH_GPU_THREADGROUP_SIZE), 1, 1); + + computeMeshMatrices.PushBack(computeDispatch); + } + } // end of iteration over draw requests + + for (PKSample::SRHIComputeDispatchs dispatch : computeParticleCountPerMesh) + output.m_ComputeDispatchs.PushBack(dispatch); + + // Compute : init indirection offsets buffer (one dispatch that handles every DR and DC) + { + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + const bool hasLODNoAtlas = m_HasMeshLODs && !m_HasMeshIDs; // If true, indirection offsets buffer is indexed differently. + + // Constant set + RHI::SConstantSetLayout layout; + PKSample::CreateInitIndirectionOffsetsBufferConstantSetLayout(layout, hasLODNoAtlas); + RHI::PConstantSet computeConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Compute Indirection Offsets Constant Set"), layout); + u32 constantId = 0; + computeConstantSet->SetConstants(m_IndirectDraw.m_Buffer, constantId++); + computeConstantSet->SetConstants(m_IndirectionOffsets.m_Buffer, constantId++); + if (hasLODNoAtlas) + computeConstantSet->SetConstants(m_LODsConstantBuffer.m_Buffer, constantId++); + computeConstantSet->UpdateConstantValues(); + computeDispatch.m_ConstantSet = computeConstantSet; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = m_DrawRequestCount * (m_HasMeshIDs ? m_MeshCount : (m_HasMeshLODs ? lodCount : 1)); // DrawCall (!= drawRequest) count + + // State + PKSample::EComputeShaderType type = hasLODNoAtlas ? + PKSample::EComputeShaderType::ComputeType_InitIndirectionOffsetsBuffer_LODNoAtlas : + PKSample::EComputeShaderType::ComputeType_InitIndirectionOffsetsBuffer; + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + + // Dispatch args + const u32 indirectionOffsetsElementCount = m_DrawRequestCount * (m_HasMeshIDs ? m_MeshCount : (m_HasMeshLODs ? lodCount : 1)); + computeDispatch.m_ThreadGroups = CInt3( (Mem::Align(indirectionOffsetsElementCount, PK_RH_GPU_THREADGROUP_SIZE) / PK_RH_GPU_THREADGROUP_SIZE), + (Mem::Align(indirectionOffsetsElementCount, PK_RH_GPU_THREADGROUP_SIZE) / PK_RH_GPU_THREADGROUP_SIZE), + 1); + + output.m_ComputeDispatchs.PushBack(computeDispatch); + } + + for (PKSample::SRHIComputeDispatchs dispatch : computeIndirection) + output.m_ComputeDispatchs.PushBack(dispatch); + + for (PKSample::SRHIComputeDispatchs dispatch : computeMeshMatrices) + output.m_ComputeDispatchs.PushBack(dispatch); + + return true; +} +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Decal(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + (void)ctx; + + // No need to iterate on all draw requests, just take the first as reference as they wouldn't have been batched if not compatible + CRendererCacheInstance_UpdateThread *refCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(refCacheInstance != null)) + return false; + + PKSample::PCRendererCacheInstance rCacheInstance = refCacheInstance->RenderThread_GetCacheInstance(); + if (!PK_VERIFY(rCacheInstance != null)) + return false; + // Cube mesh used to render the decals not created: + if (!PK_VERIFY(rCacheInstance->m_AdditionalGeometry != null)) + return false; + if (!PK_VERIFY(rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews.Count() == 1)) + return false; + + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(toEmit, output, SRHIDrawCall::DrawCall_IndexedInstanced, PKSample::Option_VertexPassThrough); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + SRHIDrawCall &outDrawCall = *_outDrawCall; + const Utils::GpuBufferViews &bufferView = rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews.First(); + + if (rCacheInstance->m_Cache == null) + return false; + + RHI::PCRenderState renderState = rCacheInstance->m_Cache->GetRenderState(PKSample::Option_VertexPassThrough); + if (!PK_VERIFY(renderState != null)) + return false; + TMemoryView vertexBuffDescView = renderState->m_RenderState.m_ShaderBindings.m_InputAttributes.View(); + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.Reserve(vertexBuffDescView.Count()))) + return false; + + bool success = true; + + // Cube positions: + success &= outDrawCall.m_VertexBuffers.PushBack(bufferView.m_VertexBuffers.First()).Valid(); + // Matrices: + success &= outDrawCall.m_VertexBuffers.PushBack(m_Matrices.m_Buffer).Valid(); + // Inv matrices: + success &= outDrawCall.m_VertexBuffers.PushBack(m_InvMatrices.m_Buffer).Valid(); + + // Additional inputs: + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + success &= outDrawCall.m_VertexBuffers.PushBack(m_AdditionalFields[i].m_Buffer.m_Buffer).Valid(); + + // Editor only: for debugging purposes, we'll remove that from samples code later + if (m_AdditionalFields[i].m_Semantic == SRHIDrawCall::DebugDrawGPUBuffer_Color) + { + PK_ASSERT(m_AdditionalFields[i].m_ByteSize == sizeof(CFloat4)); + PK_ASSERT(outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] == null); + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = m_AdditionalFields[i].m_Buffer.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Color] = 0; + } + } + } + + // Fill the semantics for the debug draws: + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = outDrawCall.m_VertexBuffers.First(); + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Position] = 0; + + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_InstanceTransforms] = m_Matrices.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_InstanceTransforms] = 0; + + // Set index buffer + outDrawCall.m_IndexBuffer = bufferView.m_IndexBuffer; + if (bufferView.m_IndexBufferSize == RHI::IndexBuffer16Bit) + outDrawCall.m_IndexCount = bufferView.m_IndexBuffer->GetByteSize() / sizeof(u16); + else if (bufferView.m_IndexBufferSize == RHI::IndexBuffer32Bit) + outDrawCall.m_IndexCount = bufferView.m_IndexBuffer->GetByteSize() / sizeof(u32); + else + { + PK_ASSERT_NOT_REACHED(); + return false; + } + outDrawCall.m_IndexSize = bufferView.m_IndexBufferSize; + outDrawCall.m_IndexOffset = 0; + + outDrawCall.m_InstanceCount = m_TotalParticleCount; + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if ((ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) && m_IsParticleSelected.Used()) + { + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = m_IsParticleSelected.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = 0; + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + if (!success) + { + CLog::Log(PK_ERROR, "Could not emit the decal draw call"); + return false; + } + return true; +} + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Triangle(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + (void)ctx; + + // No need to iterate on all draw requests, just take the first as reference as they wouldn't have been batched if not compatible + CRendererCacheInstance_UpdateThread *refCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(refCacheInstance != null)) + return false; + + PKSample::PCRendererCacheInstance rCacheInstance = refCacheInstance->RenderThread_GetCacheInstance(); + if (!PK_VERIFY(rCacheInstance != null)) + return false; + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(toEmit, output, SRHIDrawCall::DrawCall_Regular, PKSample::Option_VertexPassThrough); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + SRHIDrawCall &outDrawCall = *_outDrawCall; + + if (!_SetupCommonBillboardVertexBuffers(outDrawCall, false)) + return false; + if (!_SetupBillboardDrawCall(ctx, toEmit, outDrawCall)) + return false; + return true; +} + +//---------------------------------------------------------------------------- +// +// Sounds (CPU) +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *batch) +{ + (void)ctx; (void)drawRequests; (void)batch; + PK_ASSERT(batch == null); + // TODO: transform position/velocity in the camera-space with CustomTasks => rh_sound_cpu.{h,cpp} + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Sound(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + (void)output; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::EmitDrawCall Sound"); + + // Sounds have no tasks to setup, and no vertex buffers. + // Iterate on all draw requests + const u32 drCount = toEmit.m_DrawRequests.Count(); + for (u32 dri = 0; dri < drCount; ++dri) + { + PK_ASSERT(toEmit.m_DrawRequests[dri] != null); + const Drawers::SSound_DrawRequest *dr = static_cast(toEmit.m_DrawRequests[dri]); + const Drawers::SSound_BillboardingRequest &br = dr->m_BB; + CRendererCacheInstance_UpdateThread *rCache = static_cast(toEmit.m_RendererCaches[dri].Get()); + if (!PK_VERIFY(rCache != null)) + { + CLog::Log(PK_ERROR, "Invalid renderer cache instance"); + return false; + } + + PKSample::PCRendererCacheInstance rCacheInstance = rCache->RenderThread_GetCacheInstance(); /* WARNING: bad method name - we are in the update-thread */ + if (rCacheInstance == null) + continue; // side-effect of the RHIGraphicResource that loads the resource progressively + + CSoundResource *curSoundRes = rCacheInstance->m_Sound.Get(); + if (!PK_VERIFY(curSoundRes != null)) + { + CLog::Log(PK_ERROR, "Sound Resource is null"); + continue; + } + + if (curSoundRes->m_SoundData == null) + { + // The sound failed to load, but don't assert and don't spam the log + continue; + } + + const CParticleStreamToRender_MainMemory *streamToRender = dr->StreamToRender_MainMemory(); + PK_ASSERT(streamToRender != null); + + // Map the sound-pool with particles + for (u32 pageIdx = 0; pageIdx < streamToRender->PageCount(); ++pageIdx) + { + const CParticlePageToRender_MainMemory *page = streamToRender->Page(pageIdx); + PK_ASSERT(page != null); + if (page->Culled()) + continue; + + const u32 partCount = page->InputParticleCount(); + const u8 enabledTrue = u8(-1); + + PK_ASSERT(br.m_InvLifeStreamId.Valid()); + PK_ASSERT(br.m_LifeRatioStreamId.Valid()); + PK_ASSERT(br.m_PositionStreamId.Valid()); + TStridedMemoryView bufLRt = page->StreamForReading(br.m_LifeRatioStreamId); + TStridedMemoryView bufLif = page->StreamForReading(br.m_InvLifeStreamId); + TStridedMemoryView bufPos = page->StreamForReading(br.m_PositionStreamId); + + TStridedMemoryView bufVel = (br.m_VelocityStreamId.Valid()) ? page->StreamForReading(br.m_VelocityStreamId) : TStridedMemoryView(&CFloat4::ZERO.xyz(), partCount, 0); + TStridedMemoryView bufVol = (br.m_VolumeStreamId.Valid()) ? page->StreamForReading(br.m_VolumeStreamId) : TStridedMemoryView(&CFloat4::ZERO.x(), partCount, 0); + TStridedMemoryView bufRad = (br.m_RangeStreamId.Valid()) ? page->StreamForReading(br.m_RangeStreamId) : TStridedMemoryView(&CFloat4::ZERO.x(), partCount, 0); + TStridedMemoryView bufEna = (br.m_EnabledStreamId.Valid()) ? page->StreamForReading(br.m_EnabledStreamId) : TStridedMemoryView(&enabledTrue, partCount, 0); + + for (u32 idx = 0; idx < partCount; ++idx) + { + if (!bufEna[idx]) + continue; + + const float ptime = bufLRt[idx] / bufLif[idx]; + if (ptime > curSoundRes->m_Length) + continue; + + const CFloat3 posRel = m_MainViewMatrix.TransformVector(bufPos[idx]); + + const float dist = posRel.Length(); + + float volumePerceived = bufVol[idx]; + if (br.m_AttenuationMode == 0) + { + volumePerceived *= (bufRad[idx] < 1.e-4) ? 0.f : 1.f - dist / bufRad[idx]; + } + else if (br.m_AttenuationMode == 1) + { + volumePerceived *= (bufRad[idx] < 1.e-4) ? 0.f : 1.1f / (dist / bufRad[idx] + 0.1f) - 1.f; + } + if (volumePerceived < 0.001f) + continue; + + const CFloat3 velRel = m_MainViewMatrix.RotateVector(bufVel[idx]); + + // We have a sound ! + // -> find the closest unused sound-element in the pool + { + const s32 sPoolMatchIdx = ctx.SoundPool().FindBestMatchingSoundSlot(curSoundRes, 0.200f * ctx.SimSpeed(), ptime); + if (sPoolMatchIdx != -1) + { + SSoundElement &matchSound = ctx.SoundPool()[sPoolMatchIdx]; + const float deltaTime = matchSound.m_PlayTime - ptime; + const float deltaTimeAbs = PKAbs(deltaTime); + matchSound.m_Used = true; + matchSound.m_Position = posRel; + matchSound.m_Velocity = velRel; + matchSound.m_PerceivedVolume = volumePerceived; + matchSound.m_DopplerLevel = br.m_DopplerFactor; + // Soft-sync method + if (deltaTimeAbs > 0.060f * ctx.SimSpeed()) + { + //matchSound.m_PlaySpeed = (1.f - deltaTime / 5.f); + //CLog::Log(PK_ERROR, "FMOD Soft-sync sound %d by %f s - playspeed = %f", sPoolMatchIdx, deltaTime, matchSound.m_PlaySpeed); + } + continue; // next particle + } + //if (sPoolMatchIdx == -1 && ptime > 0.050f) + // CLog::Log(PK_ERROR, "Sound-Renderer ; fail to get matching sound for particle %d (vol=%f, time=%f, minDt=%f)", idx, volumePerceived, ptime, sPoolMatchDtAbs); + } + + // Not found, then get a free slot in the pool + const CGuid slotId = ctx.SoundPool().GetFreeSoundSlot(curSoundRes); + if (slotId.Valid()) + { + SSoundElement &repSound = ctx.SoundPool()[slotId]; + repSound.m_Used = true; + repSound.m_NeedResync = true; + repSound.m_Position = posRel; + repSound.m_Velocity = velRel; + repSound.m_PlayTime = ptime; + repSound.m_PerceivedVolume = volumePerceived; + repSound.m_DopplerLevel = br.m_DopplerFactor; + repSound.m_PlaySpeed = 1.f; + repSound.m_Resource = curSoundRes; + } + } // end loop on particles + } // end loop on pages + } // end loop on draw-request + return true; +} + +//---------------------------------------------------------------------------- +// +// Lights +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *batch) +{ + (void)batch; + + RHI::PApiManager manager = ctx.ApiManager(); + + // Map the light origins buffer: + CFloat3 *mappedPos = (CFloat3*)manager->MapCpuView(m_LightsPositions.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat3)); + + if (!PK_VERIFY(mappedPos != null)) + return false; + + m_LightDataCopyTask.Clear(); + // We feed the mapped buffer to our custom task (it just copies the positions in the mapped buffer): + m_LightDataCopyTask.m_Positions = TMemoryView(mappedPos, m_TotalParticleCount); + + // Then we map the additional fields: + // Additional inputs: + if (!m_AdditionalFields.Empty()) + { + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalParticleCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalParticleCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + m_CopyAdditionalFieldsTask.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + + m_CopyTasks.Prepare(TMemoryView::Reinterpret(drawRequests)); + m_CopyTasks.AddExecAsyncPage(&m_LightDataCopyTask); + m_CopyTasks.AddExecAsyncPage(&m_CopyAdditionalFieldsTask); +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_CopyStreamCustomParticleSelectTask.Clear(); + PK_ASSERT(m_IsParticleSelected.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_IsParticleSelected.m_Buffer, 0, sizeof(float) * m_TotalParticleCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_CopyStreamCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalParticleCount, sizeof(float)); + m_CopyStreamCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + m_CopyTasks.AddExecAsyncPage(&m_CopyStreamCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + m_CopyTasks.LaunchTasks(null); + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_IssueDrawCall_Light(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + (void)ctx; + + // No need to iterate on all draw requests, just take the first as reference as they wouldn't have been batched if not compatible + CRendererCacheInstance_UpdateThread *refCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(refCacheInstance != null)) + return false; + + PKSample::PCRendererCacheInstance rCacheInstance = refCacheInstance->RenderThread_GetCacheInstance(); + if (!PK_VERIFY(rCacheInstance != null)) + return false; + // Cube mesh used to render the decals not created: + if (!PK_VERIFY(rCacheInstance->m_AdditionalGeometry != null)) + return false; + if (!PK_VERIFY(rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews.Count() == 1)) + return false; + + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(toEmit, output, SRHIDrawCall::DrawCall_IndexedInstanced, PKSample::Option_VertexPassThrough); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + SRHIDrawCall &outDrawCall = *_outDrawCall; + const Utils::GpuBufferViews &bufferView = rCacheInstance->m_AdditionalGeometry->m_PerGeometryViews.First(); + + if (rCacheInstance->m_Cache == null) + return false; + + RHI::PCRenderState renderState = rCacheInstance->m_Cache->GetRenderState(PKSample::Option_VertexPassThrough); + if (!PK_VERIFY(renderState != null)) + return false; + TMemoryView vertexBuffDescView = renderState->m_RenderState.m_ShaderBindings.m_InputAttributes.View(); + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.Reserve(vertexBuffDescView.Count()))) + return false; + + bool success = true; + + // Sphere positions: + success &= outDrawCall.m_VertexBuffers.PushBack(bufferView.m_VertexBuffers.First()).Valid(); + // Light positions: + success &= outDrawCall.m_VertexBuffers.PushBack(m_LightsPositions.m_Buffer).Valid(); + + // Additional inputs: + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + success &= outDrawCall.m_VertexBuffers.PushBack(m_AdditionalFields[i].m_Buffer.m_Buffer).Valid(); + + // Editor only: for debugging purposes, we'll remove that from samples code later + if (m_AdditionalFields[i].m_Semantic == SRHIDrawCall::DebugDrawGPUBuffer_Color) + { + PK_ASSERT(m_AdditionalFields[i].m_ByteSize == sizeof(CFloat4)); + PK_ASSERT(outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] == null); + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = m_AdditionalFields[i].m_Buffer.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Color] = 0; + } + else if (m_AdditionalFields[i].m_Semantic == SRHIDrawCall::DebugDrawGPUBuffer_InstanceScales) + { + PK_ASSERT(m_AdditionalFields[i].m_ByteSize == sizeof(float)); + PK_ASSERT(outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_InstanceScales] == null); + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_InstanceScales] = m_AdditionalFields[i].m_Buffer.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_InstanceScales] = 0; + } + } + } + + // Fill the semantics for the debug draws: + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = outDrawCall.m_VertexBuffers.First(); + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_Position] = 0; + + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_InstancePositions] = m_LightsPositions.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_InstancePositions] = 0; + + // Set index buffer + outDrawCall.m_IndexBuffer = bufferView.m_IndexBuffer; + if (bufferView.m_IndexBufferSize == RHI::IndexBuffer16Bit) + outDrawCall.m_IndexCount = bufferView.m_IndexBuffer->GetByteSize() / sizeof(u16); + else if (bufferView.m_IndexBufferSize == RHI::IndexBuffer32Bit) + outDrawCall.m_IndexCount = bufferView.m_IndexBuffer->GetByteSize() / sizeof(u32); + else + { + PK_ASSERT_NOT_REACHED(); + return false; + } + outDrawCall.m_IndexSize = bufferView.m_IndexBufferSize; + outDrawCall.m_IndexOffset = 0; + + outDrawCall.m_InstanceCount = m_TotalParticleCount; + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if ((ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) && m_IsParticleSelected.Used()) + { + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = m_IsParticleSelected.m_Buffer; + outDrawCall.m_DebugDrawGPUBufferOffsets[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = 0; + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + if (!success) + { + CLog::Log(PK_ERROR, "Could not emit the decal draw call"); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +// +// Triangles +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CTriangle_CPU *batch) +{ + (void)ctx; (void)drawRequests; (void)batch; + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_TriangleCustomParticleSelectTask.Clear(); + PK_ASSERT(m_IsParticleSelected.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_IsParticleSelected.m_Buffer, 0, sizeof(float) * m_TotalVertexCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_TriangleCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalVertexCount, sizeof(float)); + m_TriangleCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + batch->AddExecPage(&m_TriangleCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *batch) +{ + (void)ctx; (void)drawRequests; (void)batch; + + PK_ASSERT_NOT_REACHED(); + + return false; +} + +//---------------------------------------------------------------------------- +// +// +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::WaitForCustomTasks(SRenderContext &ctx) +{ + (void)ctx; + if (m_RendererType == Renderer_Light || m_RendererType == Renderer_Decal) + { + m_CopyTasks.WaitTasks(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::UnmapBuffers(SRenderContext &ctx) +{ + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::UnmapBuffers"); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + m_IsParticleSelected.UnmapIFN(ctx.ApiManager()); +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + // UnmapBuffers is called once all CPU tasks (if any) has finished. + // This gets called prior to issuing draw calls + // Do not clear your vertex buffers here, just unmap + + if (ctx.IsPostUpdateFencePass()) // This is normal, we are processing sounds + return true; + + RHI::PApiManager manager = ctx.ApiManager(); + + m_IndirectDraw.UnmapIFN(manager); + + m_Indices.UnmapIFN(manager); + m_Positions.UnmapIFN(manager); + m_Normals.UnmapIFN(manager); + m_Tangents.UnmapIFN(manager); + m_TexCoords0.UnmapIFN(manager); + m_TexCoords1.UnmapIFN(manager); + m_AtlasIDs.UnmapIFN(manager); + m_Matrices.UnmapIFN(manager); + m_InvMatrices.UnmapIFN(manager); + m_UVRemap.UnmapIFN(manager); + m_UVFactors.UnmapIFN(manager); + m_LightsPositions.UnmapIFN(manager); + + // GPU stream offsets + m_SimStreamOffsets_Positions.UnmapIFN(manager); + m_SimStreamOffsets_Scales.UnmapIFN(manager); + m_SimStreamOffsets_Orientations.UnmapIFN(manager); + m_SimStreamOffsets_Enableds.UnmapIFN(manager); + m_SimStreamOffsets_MeshIDs.UnmapIFN(manager); + m_SimStreamOffsets_MeshLODs.UnmapIFN(manager); + for (u32 i = 0; i < m_SimStreamOffsets_AdditionalInputs.Count(); ++i) + m_SimStreamOffsets_AdditionalInputs[i].UnmapIFN(manager); + m_IndirectionOffsets.UnmapIFN(manager); + m_MatricesOffsets.UnmapIFN(manager); + // m_Indirection is never mapped + + // Geom inputs: + m_GeomPositions.UnmapIFN(manager); + m_GeomConstants.UnmapIFN(manager); + m_GeomSizes.UnmapIFN(manager); + m_GeomSizes2.UnmapIFN(manager); + m_GeomRotations.UnmapIFN(manager); + m_GeomAxis0.UnmapIFN(manager); + m_GeomAxis1.UnmapIFN(manager); + + // Additional inputs: + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + m_AdditionalFields[i].m_Buffer.UnmapIFN(manager); + + // View dependent inputs: + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + { + m_PerViewBuffers[i].m_Indices.UnmapIFN(manager); + m_PerViewBuffers[i].m_Positions.UnmapIFN(manager); + m_PerViewBuffers[i].m_Normals.UnmapIFN(manager); + m_PerViewBuffers[i].m_Tangents.UnmapIFN(manager); + m_PerViewBuffers[i].m_UVFactors.UnmapIFN(manager); + } + return true; +} + +//---------------------------------------------------------------------------- + +void CRHIBillboardingBatchPolicy::ClearBuffers(SRenderContext &ctx) +{ + (void)ctx; + // This only gets called when a new frame has been collected (so before starting billboarding) + // Clear here only resets the m_UsedThisFrame flags, it is not a proper clear as we want to avoid vbuffer resizing/allocations: + // Batches (and their policy) can be reused for various renderers (no matter the layer), + // so we ensure to bind the correct vertex buffers for draw calls. + // It is up to you to find a proper vertex buffer pooling solution for particles and how/when to clear them + + m_IndirectDraw.Clear(); + + m_Indices.Clear(); + m_Positions.Clear(); + m_Normals.Clear(); + m_Tangents.Clear(); + m_TexCoords0.Clear(); + m_TexCoords1.Clear(); + m_AtlasIDs.Clear(); + m_Matrices.Clear(); + m_UVRemap.Clear(); + m_UVFactors.Clear(); + + // GPU Stream offsets + m_SimStreamOffsets_Positions.Clear(); + m_SimStreamOffsets_Scales.Clear(); + m_SimStreamOffsets_Orientations.Clear(); + m_SimStreamOffsets_Enableds.Clear(); + m_SimStreamOffsets_MeshIDs.Clear(); + m_SimStreamOffsets_MeshLODs.Clear(); + for (SGpuBuffer &buffer : m_SimStreamOffsets_AdditionalInputs) + buffer.Clear(); + m_Indirection.Clear(); + m_IndirectionOffsets.Clear(); + m_MatricesOffsets.Clear(); + + // Geom inputs: + m_GeomPositions.Clear(); + m_GeomConstants.Clear(); + m_GeomSizes.Clear(); + m_GeomSizes2.Clear(); + m_GeomRotations.Clear(); + m_GeomAxis0.Clear(); + m_GeomAxis1.Clear(); + + // Additional inputs: + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + m_AdditionalFields[i].m_Buffer.Clear(); + + // View dependent inputs: + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + { + m_PerViewBuffers[i].m_Indices.Clear(); + m_PerViewBuffers[i].m_Positions.Clear(); + m_PerViewBuffers[i].m_Normals.Clear(); + m_PerViewBuffers[i].m_Tangents.Clear(); + m_PerViewBuffers[i].m_UVFactors.Clear(); + } +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::EmitDrawCall(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy::EmitDrawCall"); + + PK_ASSERT(toEmit.m_TotalParticleCount <= m_TotalParticleCount); // <= if slicing is enabled + PK_ASSERT(toEmit.m_TotalIndexCount <= m_TotalIndexCount); + PK_ASSERT(!toEmit.m_DrawRequests.Empty()); + PK_ASSERT(toEmit.m_DrawRequests.First() != null); + + const bool gpuStorage = toEmit.m_DrawRequests.First()->StreamToRender_MainMemory() == null; + PK_ASSERT(gpuStorage == m_GPUStorage); + + const u32 dcCount = output.m_DrawCalls.Count(); + bool success = false; + + switch (toEmit.m_Renderer) + { + case Renderer_Billboard: + PK_ASSERT(toEmit.m_TotalVertexCount > 0 && toEmit.m_TotalIndexCount > 0); + if (gpuStorage) + success = _IssueDrawCall_Billboard_GPU(ctx, toEmit, output); + else + success = _IssueDrawCall_Billboard_CPU(ctx, toEmit, output); + break; + case Renderer_Ribbon: + PK_ASSERT(toEmit.m_TotalVertexCount > 0 && toEmit.m_TotalIndexCount > 0); + success = _IssueDrawCall_Ribbon(ctx, toEmit, output); + break; + case Renderer_Light: + success = _IssueDrawCall_Light(ctx, toEmit, output); + break; + case Renderer_Mesh: +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + if (gpuStorage) + success = _IssueDrawCall_Mesh_GPU(ctx, toEmit, output); + else +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + success = _IssueDrawCall_Mesh_CPU(ctx, toEmit, output); + break; + case Renderer_Triangle: + success = _IssueDrawCall_Triangle(ctx, toEmit, output); + break; + case Renderer_Decal: + success = _IssueDrawCall_Decal(ctx, toEmit, output); + break; + case Renderer_Sound: + success = _IssueDrawCall_Sound(ctx, toEmit, output); + break; + default: + PK_ASSERT_NOT_REACHED(); + break; + } + // Invalidate all draw-calls from this policy if any of them was not created properly: + if (!success) + { + const u32 newDcCount = output.m_DrawCalls.Count(); + + for (u32 i = dcCount; i < newDcCount; ++i) + { + output.m_DrawCalls[i].m_Valid = false; + output.m_DrawCalls[i].m_RendererCacheInstance = null; + } + } + return success; +} + +//---------------------------------------------------------------------------- + +SRHIDrawCall *CRHIBillboardingBatchPolicy::_CreateDrawCall(const SDrawCallDesc &toEmit, SRHIDrawOutputs &output, SRHIDrawCall::EDrawCallType drawCallType, u32 baseShaderOptions) +{ + CRendererCacheInstance_UpdateThread *renderCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(renderCacheInstance != null)) + { + CLog::Log(PK_ERROR, "Invalid renderer cache instance"); + return null; + } + + if (!PK_VERIFY(output.m_DrawCalls.PushBack().Valid())) + return null; + SRHIDrawCall *outDrawCall = &output.m_DrawCalls.Last(); + + outDrawCall->m_Batch = this; + outDrawCall->m_RendererCacheInstance = renderCacheInstance; + outDrawCall->m_Type = drawCallType; + outDrawCall->m_ShaderOptions = baseShaderOptions; + outDrawCall->m_RendererType = m_RendererType; + + // Editor only: for debugging purposes, we'll remove that from samples code later + { + outDrawCall->m_BBox = toEmit.m_BBox; + outDrawCall->m_TotalBBox = m_TotalBBox; + outDrawCall->m_SlicedDC = toEmit.m_TotalIndexCount != m_TotalIndexCount; + } + + outDrawCall->m_Valid = renderCacheInstance != null && + renderCacheInstance->RenderThread_GetCacheInstance() != null && + renderCacheInstance->RenderThread_GetCacheInstance()->m_Cache != null && + renderCacheInstance->RenderThread_GetCacheInstance()->m_Cache->GetRenderState(static_cast(baseShaderOptions)) != null; + + return outDrawCall; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy::_CreateOrResizeGpuBufferIf(const RHI::SRHIResourceInfos &infos, bool condition, const RHI::PApiManager &manager, SGpuBuffer &buffer, RHI::EBufferType type, u32 sizeToAlloc, u32 requiredSize) +{ + PK_ASSERT(sizeToAlloc >= requiredSize); + if (!condition) + return true; + if (buffer.m_Buffer == null || buffer.m_Buffer->GetByteSize() < requiredSize) + { + RHI::PGpuBuffer gpuBuffer = manager->CreateGpuBuffer(infos, type, sizeToAlloc); + buffer.SetGpuBuffer(gpuBuffer); + if (!PK_VERIFY(gpuBuffer != null) || + !PK_VERIFY(buffer.Used())) + return false; + } + else + buffer.Use(); + return true; +} + +//---------------------------------------------------------------------------- + +void CRHIBillboardingBatchPolicy::_ClearFrame(u32 activeViewCount) +{ + // Here we only clear the values that are changing from one frame to another. + // Most of the vertex buffers will stay the same + m_DrawRequestCount = 0; + m_TotalParticleCount = 0; + m_TotalParticleCount_OverEstimated = 0; + m_TotalVertexCount = 0; + m_TotalVertexCount_OverEstimated = 0; + m_TotalIndexCount = 0; + m_TotalIndexCount_OverEstimated = 0; + m_IndexSize = 0; + m_TotalBBox = CAABB::DEGENERATED; + m_PerMeshParticleCount.Clear(); + m_HasMeshIDs = false; + m_HasMeshLODs = false; + m_PerViewBuffers.Resize(activeViewCount); + m_MappedIndirectBuffer = null; + m_MappedIndexedIndirectBuffer = null; + m_DrawCallCurrentOffset = 0; + m_PerMeshIndexCount.Clear(); + m_MappedSimStreamOffsets_Positions = null; + m_MappedSimStreamOffsets_Scales = null; + m_MappedSimStreamOffsets_Orientations = null; + m_MappedSimStreamOffsets_Enableds = null; + m_MappedSimStreamOffsets_MeshIDs = null; + m_MappedSimStreamOffsets_LODs = null; + m_MappedMatricesOffsets = null; + m_HasColorStream = false; + for (u32 i = 0; i < m_MappedSimStreamOffsets_AdditionalInputs.Count(); ++i) + m_MappedSimStreamOffsets_AdditionalInputs[i] = null; + PK_VERIFY(m_SimStreamOffsets_AdditionalInputs.Reserve(0x10)); // Reserved, memory not cleared +} + +//---------------------------------------------------------------------------- + +void CRHIBillboardingBatchPolicy::CCopyStream_Exec_LightsPositions::operator()(const Drawers::SCopyStream_ExecPage &execPage) +{ + const Drawers::SBase_DrawRequest &baseDr = *execPage.m_DrawRequest; + const Drawers::SLight_DrawRequest &dr = static_cast(baseDr); + const Drawers::SLight_BillboardingRequest &br = dr.m_BB; + + const CParticlePageToRender_MainMemory &page = *execPage.m_Page; + const u32 count = page.InputParticleCount(); + const u32 outCount = page.RenderedParticleCount(); + const u32 start = execPage.m_ParticleOffset; + + TMemoryView dstPos = m_Positions.Slice(start, outCount); + TStridedMemoryView srcPos = page.StreamForReading(br.m_PositionStreamId); + TStridedMemoryView srcEnabled = page.StreamForReading(br.m_EnabledStreamId); + + if (outCount == 0) + return; + + if (count == outCount) + { + const CFloat3 *srcPosPtr = srcPos.Data(); + const u32 srcPosStride = srcPos.Stride(); + for (u32 partIdx = 0; partIdx < outCount; ++partIdx) + { + dstPos[partIdx] = *srcPosPtr; + srcPosPtr = Mem::AdvanceRawPointer(srcPosPtr, srcPosStride); + } + } + else + { + PK_ASSERT(!srcEnabled.Empty()); + CFloat3 *dstPosPtr = dstPos.Data(); + CFloat3 *dstPosStop = dstPos.DataEnd(); + const CFloat3 *srcPosPtr = srcPos.Data(); + const u32 srcPosStride = srcPos.Stride(); + const u8 *srcEnabledPtr = srcEnabled.Data(); + const u32 srcEnabledStride = srcEnabled.Stride(); + + while (dstPosPtr < dstPosStop) + { + if (*srcEnabledPtr != 0) + *dstPosPtr++ = *srcPosPtr; + srcPosPtr = Mem::AdvanceRawPointer(srcPosPtr, srcPosStride); + srcEnabledPtr = Mem::AdvanceRawPointer(srcEnabledPtr, srcEnabledStride); + } + } +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy.h new file mode 100644 index 00000000..a2c94597 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy.h @@ -0,0 +1,271 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" + +#include +#include + +#include "PK-SampleLib/RenderIntegrationRHI/RendererCache.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHITypePolicy.h" + +#include "RHICustomTasks.h" + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CRHIParticleRenderDataFactory; + +class CRHIBillboardingBatchPolicy +{ +public: + CRHIBillboardingBatchPolicy(); + ~CRHIBillboardingBatchPolicy(); + + // Return true if this draw request can be rendered (this gets called per batches when the frame collector is in BeginCollectingDrawCalls() and EndCollectingDrawCalls()) + // Return false if you want to discard this draw request and handle it later + // request and renderer cache are the firsts from their batch + static bool CanRender(const Drawers::SBillboard_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + static bool CanRender(const Drawers::SRibbon_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + static bool CanRender(const Drawers::SMesh_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + static bool CanRender(const Drawers::SDecal_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + static bool CanRender(const Drawers::STriangle_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + static bool CanRender(const Drawers::SLight_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + static bool CanRender(const Drawers::SSound_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + + // Whether this billboarding batch policy can be re-used by incompatible renderer caches (see CHM documentation for more detail) + // For example: light renderer billboarding batch policies could return true + static bool IsStateless() { return false; } + + // Return false when this billboarding batch policy should be destroyed (ie. nothing was drawn after 10 ticks) + bool Tick(SRenderContext &ctx, const TMemoryView &views); + + // Called via BeginCollectingDrawCalls() for all render data batches + bool AllocBuffers(SRenderContext &ctx, const SBuffersToAlloc &allocBuffers, const TMemoryView &views, ERendererClass rendererType); + + // Called to map necessary buffers for tasks + // Only map buffers necessary buffers descripted in SGeneratedInputs + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SBillboardBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPUBillboardBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SRibbonBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SMeshBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SDecalBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, STriangleBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPUTriangleBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPURibbonBatchJobs *RibbonBatch, const SGeneratedInputs &toMap); + + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *geomBillboardBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *billboardBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *geomBillboardBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CRibbon_CPU *ribbonBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CMesh_CPU *meshBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CDecal_CPU *decalBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *batch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *batch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CTriangle_CPU *batch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *batch); + + bool WaitForCustomTasks(SRenderContext &ctx); + + bool UnmapBuffers(SRenderContext &ctx); + void ClearBuffers(SRenderContext &ctx); + + bool AreBillboardingBatchable(const PCRendererCacheBase &firstCache, const PCRendererCacheBase &secondCache) const; + + // By default, draw calls are submit back to front based on their bounding boxes (see EDrawCallSortMethod), for each view + // You can setup the frame collector to sort draw calls differently (ie. by sorting sliced draw calls or you can also disable sorting entirely) + bool EmitDrawCall(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + +private: + bool _AllocateBuffers_Main(const RHI::PApiManager &manager, const SBuffersToAlloc &allocBuffers); + bool _AllocateBuffers_ViewDependent(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate); + bool _AllocateBuffers_AdditionalInputs(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate); + bool _AllocateBuffers_GeomShaderBillboarding(const RHI::PApiManager &manager, u32 viewIndependentInputs); + bool _AllocateBuffers_GPU(const RHI::PApiManager &manager, const SBuffersToAlloc &allocBuffers); + bool _AllocateBuffers_Lights(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate); + + u32 _GetGeomBillboardShaderOptions(const Drawers::SBillboard_BillboardingRequest &bbRequest); + bool _CreateOrResizeGpuBufferIf(const RHI::SRHIResourceInfos &infos, bool condition, const RHI::PApiManager &manager, SGpuBuffer &buffer, RHI::EBufferType type, u32 sizeToAlloc, u32 requiredSize); + RHI::PGpuBuffer _RetrieveStorageBuffer(const RHI::PApiManager &manager, const CParticleStreamToRender *streams, CGuid streamIdx, u32 &storageOffset); + RHI::PGpuBuffer _RetrieveParticleInfoBuffer(const RHI::PApiManager &manager, const CParticleStreamToRender *streams); + void _ClearFrame(u32 activeViewCount = 0); // Reset the batch for a new frame + + SRHIDrawCall *_CreateDrawCall(const SDrawCallDesc &toEmit, SRHIDrawOutputs &output, SRHIDrawCall::EDrawCallType drawCallType, u32 baseShaderOptions); + + bool _IssueDrawCall_Billboard_GPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + bool _IssueDrawCall_Billboard_CPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + bool _IssueDrawCall_Ribbon(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + bool _IssueDrawCall_Mesh_CPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + u32 _SubmeshIDToLOD(CRendererCacheInstance_UpdateThread &refCacheInstance, u32 lodCount, u32 iSubMesh); + bool _IssueDrawCall_Mesh_GPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + bool _IssueDrawCall_Decal(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + bool _IssueDrawCall_Triangle(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + bool _IssueDrawCall_Light(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + bool _IssueDrawCall_Sound(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + + bool _SetupGeomBillboardVertexBuffers(SRHIDrawCall &outDrawCall); + bool _SetupCommonBillboardVertexBuffers(SRHIDrawCall &outDrawCall, bool hasAtlas); + bool _SetupBillboardDrawCall(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawCall &outDrawCall); + + bool _IsAdditionalInputIgnored(const SRendererFeatureFieldDefinition &input); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Job to set a boolean as vertex input if the particle is selected: + CBillboard_Exec_WireframeDiscard m_BillboardCustomParticleSelectTask; + CRibbon_Exec_WireframeDiscard m_RibbonCustomParticleSelectTask; + CCopyStream_Exec_WireframeDiscard m_CopyStreamCustomParticleSelectTask; + CMesh_Exec_WireframeDiscard m_MeshCustomParticleSelectTask; + CTriangle_Exec_WireframeDiscard m_TriangleCustomParticleSelectTask; + SGpuBuffer m_IsParticleSelected; + RHI::PConstantSet m_GPUSelectionConstantSet; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + //---------------------------------------------------------------------------- + // RHI buffers data: + //---------------------------------------------------------------------------- + + bool m_GPUStorage; + ERendererClass m_RendererType; + + u32 m_UnusedCounter; + u32 m_DrawRequestCount; + u32 m_TotalParticleCount; + u32 m_TotalParticleCount_OverEstimated; + u32 m_TotalVertexCount; + u32 m_TotalVertexCount_OverEstimated; + u32 m_TotalIndexCount; + u32 m_TotalIndexCount_OverEstimated; + u32 m_IndexSize; + + CAABB m_TotalBBox; + + TMemoryView m_PerMeshParticleCount; + TMemoryView m_PerMeshBufferOffset; + bool m_HasMeshIDs; + bool m_HasMeshLODs; + u32 m_MeshCount; + TArray m_PerMeshIndexCount; + + struct SPerView + { + u32 m_ViewIdx; + + SGpuBuffer m_Indices; + SGpuBuffer m_Positions; + SGpuBuffer m_Normals; + SGpuBuffer m_Tangents; + SGpuBuffer m_UVFactors; + }; + + // View dependent buffers: + TArray m_PerViewBuffers; + + SGpuBuffer m_Indices; + + SGpuBuffer m_Positions; + SGpuBuffer m_Normals; + SGpuBuffer m_Tangents; + + SGpuBuffer m_TexCoords0; + SGpuBuffer m_TexCoords1; + SGpuBuffer m_AtlasIDs; + + SGpuBuffer m_UVFactors; + SGpuBuffer m_UVRemap; + + // Meshes and Decals: + SGpuBuffer m_Matrices; + + // For GPU meshes : + SGpuBuffer m_Indirection; + + SGpuBuffer m_IndirectionOffsets; + volatile u32 *m_MappedIndirectionOffsets; + + SGpuBuffer m_MatricesOffsets; + volatile u32 *m_MappedMatricesOffsets; + + // Constant buffer data used by GPU mesh draw calls, holds mesh LOD infos + SGpuBuffer m_LODsConstantBuffer; + + SGpuBuffer m_SimStreamOffsets_Positions; + SGpuBuffer m_SimStreamOffsets_Scales; + SGpuBuffer m_SimStreamOffsets_Orientations; + SGpuBuffer m_SimStreamOffsets_Enableds; + SGpuBuffer m_SimStreamOffsets_MeshIDs; + SGpuBuffer m_SimStreamOffsets_MeshLODs; + TArray m_SimStreamOffsets_AdditionalInputs; + bool m_HasColorStream; + + volatile u32 *m_MappedSimStreamOffsets_Positions; + volatile u32 *m_MappedSimStreamOffsets_Scales; + volatile u32 *m_MappedSimStreamOffsets_Orientations; + volatile u32 *m_MappedSimStreamOffsets_Enableds; + volatile u32 *m_MappedSimStreamOffsets_MeshIDs; + volatile u32 *m_MappedSimStreamOffsets_LODs; + TArray m_MappedSimStreamOffsets_AdditionalInputs; + + RHI::PConstantSet m_SimDataConstantSet; + RHI::PConstantSet m_OffsetsConstantSet; + + // For decals, we can generate the invert matrice: + SGpuBuffer m_InvMatrices; + + // Geom billboard buffers: + SGpuBuffer m_GeomConstants; + SGpuBuffer m_GeomPositions; + SGpuBuffer m_GeomSizes; + SGpuBuffer m_GeomSizes2; + SGpuBuffer m_GeomRotations; + SGpuBuffer m_GeomAxis0; + SGpuBuffer m_GeomAxis1; + + TArray m_AdditionalFields; + + SGpuBuffer m_LightsPositions; + + // Indirect draw buffer + RHI::SDrawIndirectArgs *m_MappedIndirectBuffer; + SGpuBuffer m_IndirectDraw; // We might need multiple indirect draws for mesh atlases. + volatile RHI::SDrawIndexedIndirectArgs *m_MappedIndexedIndirectBuffer; + u32 m_DrawCallCurrentOffset; + + // We need those temporary arrays to map data: + TArray m_MappedAdditionalFields; + + // Position of the main camera (used for sound to define the position/rotation of the listener) + CFloat4x4 m_MainViewMatrix; + + // Job used to copy additional fields once per particle (used for lights and decals): + Drawers::CCopyStream_Exec_AdditionalField m_CopyAdditionalFieldsTask; + Drawers::CCopyStream_CPU m_CopyTasks; + + // Here we use a custom task to copy the positions of the lights + // We could have just used the CCopyStream_Exec_AdditionalField as all the light fields are just copied: + class CCopyStream_Exec_LightsPositions + { + public: + TMemoryView m_Positions; + + void Clear() { Mem::Reinit(*this); } + void operator()(const Drawers::SCopyStream_ExecPage &execPage); + }; + + CCopyStream_Exec_LightsPositions m_LightDataCopyTask; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy_Vertex.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy_Vertex.cpp new file mode 100644 index 00000000..c9cd6a70 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy_Vertex.cpp @@ -0,0 +1,2528 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "RHIBillboardingBatchPolicy_Vertex.h" + +#include "RHIParticleRenderDataFactory.h" +#include "pk_render_helpers/include/render_features/rh_features_basic.h" + +#include +#include + +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) +//# include +# include +# include +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) +//# include +# include +# include +#endif +#if (PK_PARTICLES_UPDATER_USE_UNKNOWN2 != 0) +//# include +# include +# include +#endif + +#include "PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.h" + +#include "RHIRenderIntegrationConfig.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +// Maximum number of draw requests batched in a single billboarding batch policy (1 draw request = 1 particle renderer being drawn) +static u32 kMaxDrawRequestCount = 0x100; + +// Example implementation of billboard particles being rendered using instanced draw, their vertices are expanded in the vertex shader +// This implementation is both used by samples and v2 editor +// This is an example implementation using RHI as the graphics API abstraction, it's not the only way to provide particle data to render to shaders, feel free to contact us at support if you have specific layouts +// +// Billboarding method is the same for CPU and GPU particles: we pass in a texcoord vertex buffer and a simple index buffer, and instance that several times (number of particles) +// In the vertex shader, vertex positions are expanded based on texcoord values, and by extracting info from particle sim data (particle world's position, size, ..) +// +// CPU simulated particles: +// Particle data resides on main memory, we let PK-RenderHelpers tasks copy that data into GPU memory, by having a single gpu memory buffer per particle stream (position/size/..) +// Data is copied 1-1, except for positions which are setup to store the particle's draw request id in their w member, allowing compatible renderers batching, all other streams are straight copies +// You can create custom tasks to store data as you wish in your gpu buffers (for example in a single gpu buffer) if necessary +// An index buffer is generated if you map one to CPU tasks (sorted/sliced or not depending on the renderer settings and your usage) +// +// GPU simulated particles: +// Particle data resides on gpu memory directly, no copy task occur on CPU, we "retrieve" GPU buffers which basically create a PK-RHI "handle" on the graphics API native object (SRV/Buffer/..) +// A single buffer contains all particles for a given particle layer (might be shared by several draw requests), with particle streams offset in that buffer. +// As PK-RHI doesn't currently support structured buffers (only raw buffers), we create one gpu buffer per stream, containing offsets for that stream in all draw requests, but you can hook that as you wish +// Sorting is implemented for vertex billboarded GPU particles using a base 2 parallel radix sort on 16 bits keys. + +//---------------------------------------------------------------------------- +// +// Billboarding batch policy: +// +//---------------------------------------------------------------------------- + +CRHIBillboardingBatchPolicy_Vertex::CRHIBillboardingBatchPolicy_Vertex() +: m_RendererType(Renderer_Invalid) +, m_Initialized(false) +, m_CapsulesDC(false) +, m_TubesDC(false) +, m_MultiPlanesDC(false) +, m_GpuBufferResizedOrCreated(false) +, m_GPUStorage(false) +#if (PK_HAS_PARTICLES_SELECTION != 0) +, m_SelectionsResizedOrCreated(false) +#endif // (PK_HAS_PARTICLES_SELECTION != 0) +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) +, m_ColorStreamId(CGuid::INVALID) +, m_NeedGPUSort(false) +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) +, m_UnusedCounter(0) +, m_TotalParticleCount(0) +, m_TotalParticleCount_OverEstimated(0) +, m_DrawRequestCount(0) +, m_IndexSize(0) +, m_ShaderOptions(0) +{ + _ClearFrame(); +} + +//---------------------------------------------------------------------------- + +CRHIBillboardingBatchPolicy_Vertex::~CRHIBillboardingBatchPolicy_Vertex() +{ +} + +//---------------------------------------------------------------------------- +// +// Cull draw requests with some custom metric, here we cull some draw request depending on the rendering pass +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::CanRender(const Drawers::SBillboard_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::CanRender(const Drawers::STriangle_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext & ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::CanRender(const Drawers::SRibbon_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext & ctx) +{ + (void)request; (void)rendererCache; + PK_ASSERT(request != null); + PK_ASSERT(rendererCache != null); + return ctx.IsRenderThreadPass(); +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::Tick(SRenderContext &ctx, const TMemoryView &views) +{ + (void)views; (void)ctx; + // Tick function called on draw calls thread, here we remove ourselves if we haven't been used for rendering after 10 (collected) frames: + // 10 PKFX Update()/UpdateFence() without being drawn + if (m_UnusedCounter++ > 10) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::AreBillboardingBatchable(const PCRendererCacheBase &firstCache, const PCRendererCacheBase &secondCache) const +{ + // Return true if firstCache and secondCache can be batched together (same draw call) + // Simplest approach here is to break batching when those two materials are incompatible (varying uniforms, mismatching textures, ..) + return firstCache == secondCache || + *checked_cast(firstCache.Get()) == + *checked_cast(secondCache.Get()); +} + +//---------------------------------------------------------------------------- +// +// Buffers allocations +// +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::AllocBuffers(SRenderContext &ctx, const SBuffersToAlloc &allocBuffers, const TMemoryView &views, ERendererClass rendererType) +{ + (void)rendererType; + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::AllocBuffers"); + + m_UnusedCounter = 0; + + PK_ASSERT(!allocBuffers.m_DrawRequests.Empty()); + PK_ASSERT(allocBuffers.m_DrawRequests.Count() == allocBuffers.m_RendererCaches.Count()); + PK_ASSERT((allocBuffers.m_TotalVertexCount > 0 && allocBuffers.m_TotalIndexCount > 0) || + allocBuffers.m_TotalParticleCount > 0); + PK_ASSERT(allocBuffers.m_DrawRequests.First() != null); + + PK_ASSERT(rendererType != Renderer_Invalid); + if (!m_Initialized) + m_RendererType = rendererType; + else if (!PK_VERIFY(m_RendererType == rendererType)) + return false; + + PK_ASSERT(rendererType == Renderer_Billboard || rendererType == Renderer_Triangle || rendererType == Renderer_Ribbon); + + RHI::PApiManager manager = ctx.ApiManager(); + + // Clear previous frame data + _ClearFrame(allocBuffers.m_ToGenerate.m_PerViewGeneratedInputs.Count()); + + // Setup counts + PK_ASSERT(allocBuffers.m_TotalParticleCount == allocBuffers.m_TotalVertexCount); + PK_ASSERT(allocBuffers.m_TotalParticleCount == allocBuffers.m_TotalIndexCount); + m_TotalParticleCount = allocBuffers.m_TotalParticleCount; + m_TotalIndexCount = allocBuffers.m_TotalIndexCount; + m_IndexSize = (true /*m_TotalParticleCount > 0xFFFF*/) ? sizeof(u32) : sizeof(u16); // Right now, we only handle u32 indices + m_GPUStorage = allocBuffers.m_DrawRequests.First()->StreamToRender_MainMemory() == null; + m_TotalBBox = allocBuffers.m_TotalBBox; + +#if (PK_PARTICLES_UPDATER_USE_GPU == 0) + PK_ASSERT(!m_GPUStorage); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + if (rendererType == Renderer_Billboard) + { + // Determine whether or not we are a capsule aligned draw call + const PopcornFX::Drawers::SBillboard_DrawRequest *compatDr_Billboard = static_cast(allocBuffers.m_DrawRequests.First()); + const PopcornFX::Drawers::SBillboard_BillboardingRequest &compatBr = compatDr_Billboard->m_BB; + + m_CapsulesDC = compatBr.m_Mode == PopcornFX::BillboardMode_AxisAlignedCapsule; // Right now, capsules are not batched with other billboarding modes + } + + if (rendererType == Renderer_Ribbon) + { + // Determine whether or not we are a tube or multi-plane aligned draw call + const PopcornFX::Drawers::SRibbon_DrawRequest *compatDr_Ribbon = static_cast(allocBuffers.m_DrawRequests.First()); + const PopcornFX::Drawers::SRibbon_BillboardingRequest &compatBr = compatDr_Ribbon->m_BB; + + // Right now, tubes & multi-plane ribbons are not batched with other billboarding modes + m_MultiPlanesDC = compatBr.m_Mode == PopcornFX::RibbonMode_SideAxisAlignedMultiPlane; + m_TubesDC = compatBr.m_Mode == PopcornFX::RibbonMode_SideAxisAlignedTube; + m_ParticleQuadCount = compatBr.m_ParticleQuadCount; + } + + if ((rendererType == Renderer_Billboard || rendererType == Renderer_Triangle || rendererType == Renderer_Ribbon) && !m_Initialized) + { + // TODO: The following index and vertex buffer could be shared between all vertex billboarding bb batch policies + + const u16 indexCount = rendererType == Renderer_Ribbon ? m_ParticleQuadCount*6 : 12; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("VertexBB Draw Indices Buffer"), true, manager, m_DrawIndices, RHI::IndexBuffer, indexCount * sizeof(u16), indexCount * sizeof(u16), false)) + return false; + + volatile u16 *indices = static_cast(manager->MapCpuView(m_DrawIndices.m_Buffer, 0, indexCount * sizeof(u16))); + if (!PK_VERIFY(indices != null)) + return false; + + // RHI currently doesn't support DrawInstanced (without indices) + if (rendererType == Renderer_Triangle) + { + indices[0] = 0; + indices[1] = 1; + indices[2] = 2; + } + else if (rendererType == Renderer_Billboard) + { + // TODO: This should match the CPU ribbon vertex order for clarity. + indices[0] = 1; + indices[1] = 3; + indices[2] = 0; + indices[3] = 2; + indices[4] = 3; + indices[5] = 1; + indices[6] = 3; + indices[7] = 5; + indices[8] = 0; + indices[9] = 1; + indices[10] = 4; + indices[11] = 2; + } + else if (rendererType == Renderer_Ribbon) + { + if (m_TubesDC) + { + // Filling tube indices. + const u16 segmentCount = m_ParticleQuadCount; + // This is the index pattern of a tube single quad. + const u16 pattern[6] = { 0, 1, (u16)(segmentCount+1), (u16)(segmentCount+1), 1, (u16)(segmentCount+2) }; + + for (u16 i = 0; i < segmentCount; ++i) + { + indices[0] = pattern[0] + i; + indices[1] = pattern[1] + i; + indices[2] = pattern[2] + i; + indices[3] = pattern[3] + i; + indices[4] = pattern[4] + i; + indices[5] = pattern[5] + i; + indices += 6; + } + } + else if (m_MultiPlanesDC) + { + // Filling multi-plane indices. + const u16 planeCount = m_ParticleQuadCount; + // This is the index pattern of a plane quad. + const u16 pattern[6] = { 1 , (u16)(planeCount*2+1), 0, (u16)(planeCount*2), (u16)(planeCount*2+1), 1 }; + + for (u16 i = 0; i < planeCount * 2; i += 2) + { + indices[0] = pattern[0] + i; + indices[1] = pattern[1] + i; + indices[2] = pattern[2] + i; + indices[3] = pattern[3] + i; + indices[4] = pattern[4] + i; + indices[5] = pattern[5] + i; + indices += 6; + } + } + else + { + indices[0] = 1; + indices[1] = 3; + indices[2] = 0; + indices[3] = 2; + indices[4] = 3; + indices[5] = 1; + } + } + + m_DrawIndices.Unmap(manager); + + u32 uvCount = 4; + if (m_CapsulesDC) + uvCount = 6; + else if (m_TubesDC) // Tube vertex count + uvCount = (m_ParticleQuadCount + 1) * 2; + else if (m_MultiPlanesDC) // Multi-Plane vertex count + uvCount = m_ParticleQuadCount * 4; + + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("VertexBB Texcoords Buffer"), true, manager, m_TexCoords, RHI::VertexBuffer, uvCount * sizeof(CFloat2), uvCount * sizeof(CFloat2), false)) + return false; + + volatile float *texCoords = static_cast(manager->MapCpuView(m_TexCoords.m_Buffer, 0, uvCount * sizeof(CFloat2))); + if (!PK_VERIFY(texCoords != null)) + return false; + + if (rendererType == Renderer_Billboard || rendererType == Renderer_Triangle) + { + texCoords[0] = -1.0f; // Lower left corner + texCoords[1] = -1.0f; + texCoords[2] = -1.0f; // Upper left corner + texCoords[3] = 1.0f; + texCoords[4] = 1.0f; // Upper right corner + texCoords[5] = 1.0f; + texCoords[6] = 1.0f; // Lower right corner + texCoords[7] = -1.0f; + texCoords[8] = 0.0f; // Capsule up + texCoords[9] = 2.0f; + texCoords[10] = 0.0f; // Capsule down + texCoords[11] = -2.0f; + } + else + { + // We store the quad id in the U component of the texcoords. Since it is always 1.0f * quadId or -1.0f * quadId, it will be retrieved with abs(texcoord.x) in the vertex shader. + if (m_MultiPlanesDC) + { + for (u32 planeId = 1; planeId <= m_ParticleQuadCount; ++planeId) + { + texCoords[0] = -1.0f * planeId; // Lower left corner + texCoords[1] = -1.0f; + texCoords[2] = -1.0f * planeId; // Lower right corner + texCoords[3] = 1.0f; + texCoords += 4; + } + + for (u32 planeId = 1; planeId <= m_ParticleQuadCount; ++planeId) + { + texCoords[0] = 1.0f * planeId; // Upper right corner + texCoords[1] = 1.0f; + texCoords[2] = 1.0f * planeId; // Upper left corner + texCoords[3] = -1.0f; + texCoords += 4; + } + } + if (m_TubesDC) + { + float v = -1.0f; + const float vStep = 2.0f / m_ParticleQuadCount; + for (u32 segmentId = 1; segmentId <= m_ParticleQuadCount + 1; ++segmentId) + { + texCoords[0] = -1.0f * segmentId; // Lower corner + texCoords[1] = v; + texCoords += 2; + v += vStep; + } + v = -1.0f; + for (u32 segmentId = 1; segmentId <= m_ParticleQuadCount + 1; ++segmentId) + { + texCoords[0] = 1.0f * segmentId; // Upper corner + texCoords[1] = v; + texCoords += 2; + v += vStep; + } + } + else + { + texCoords[0] = -1.0f; // Lower left corner + texCoords[1] = -1.0f; + texCoords[2] = -1.0f; // Upper left corner + texCoords[3] = 1.0f; + texCoords[4] = 1.0f; // Upper right corner + texCoords[5] = 1.0f; + texCoords[6] = 1.0f; // Lower right corner + texCoords[7] = -1.0f; + } + } + + m_TexCoords.Unmap(manager); + + m_Initialized = true; + } + + // Can help avoid GPU buffers resizing + // You'll need a proper GPU buffers pooling system in your engine + m_TotalParticleCount_OverEstimated = Mem::Align(m_TotalParticleCount, 0x100); + + //---------------------------------------------------------------------------- + // View independent inputs: + // SBuffersToAlloc contains what is needed to construct your vertex declaration + + if (!m_GPUStorage) + { + // !Order matters!: expected constant set layout is layed out like so (see MaterialToRHI.cpp): + // indices + // bb data: + // - positions + // - sizes + // - .. + // additional data (material): + // - colors + // - .. + + if (!_AllocateBuffers_ViewDependent(manager, allocBuffers.m_ToGenerate)) + return false; + } + + // Only allocate and map particle data buffers if we are billboarding a new collected frame (see documentation for more detail) + if (allocBuffers.m_IsNewFrame) + { + m_DrawRequestCount = allocBuffers.m_DrawRequests.Count(); + + if (m_GPUStorage) + { +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + if (!_AllocateBuffers_GPU(manager, allocBuffers)) + return false; + + // The offset in the indirect buffer of the current emitted draw call + m_DrawCallCurrentOffset = 0; +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + } + else + { + if (!_AllocateBuffers_Main(manager, allocBuffers)) + return false; + } + if (!_AllocateBuffers_AdditionalInputs(manager, allocBuffers.m_ToGenerate)) + return false; + } + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + const bool canDrawSelectedParticles = ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected(); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Selection Buffer"), canDrawSelectedParticles, manager, m_Selections, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(float), m_TotalParticleCount * sizeof(float), false)) + return false; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + return true; +} + +//---------------------------------------------------------------------------- + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) +bool CRHIBillboardingBatchPolicy_Vertex::_AllocateBuffers_GPU(const RHI::PApiManager &manager, const SBuffersToAlloc &allocBuffers) +{ + + m_NeedGPUSort = allocBuffers.m_DrawRequests.First()->BaseBillboardingRequest().m_Flags.m_NeedSort; + m_SortByCameraDistance = allocBuffers.m_DrawRequests.First()->BaseBillboardingRequest().m_SortByCameraDistance; + + // GPU particles are rendered using DrawIndexedInstancedIndirect + // As detailed, we create on gpu buffer per stream, that will contain indices into draw request sim data buffers + // For ribbon, this must be a raw indirect buffer to allow compute write (count is set from compute ribbon sort key pass instead of a copy command) + const u32 indirectDrawBufferSizeInBytes = sizeof(RHI::SDrawIndexedIndirectArgs) * m_DrawRequestCount; + const RHI::EBufferType indirectBufferType = (m_RendererType == Renderer_Ribbon) ? RHI::RawIndirectDrawBuffer : RHI::IndirectDrawBuffer; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Indirect Draw Args Buffer"), true, manager, m_IndirectDraw, indirectBufferType, indirectDrawBufferSizeInBytes, indirectDrawBufferSizeInBytes, false)) + return false; + + const u32 viewIndependentInputs = allocBuffers.m_ToGenerate.m_GeneratedInputs; + const u32 drCount = allocBuffers.m_DrawRequests.Count(); + + // Camera sort + if (m_NeedGPUSort) + { + if (m_CameraGPUSorters.Count() != drCount) + { + // For each draw request, we have indirection and sort key buffers + // and a GPU sorter object, handling intermediates work buffers + if (!PK_VERIFY(m_CameraSortIndirection.Resize(drCount)) || + !PK_VERIFY(m_CameraSortKeys.Resize(drCount)) || + !PK_VERIFY(m_CameraGPUSorters.Resize(drCount))) + return false; + } + for (u32 i = 0; i < drCount; i++) + { + if (!PK_VERIFY(allocBuffers.m_DrawRequests[i]->RenderedParticleCount() > 0)) + continue; + const u32 alignedParticleCount = Mem::Align(allocBuffers.m_DrawRequests[i]->RenderedParticleCount()); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Camera Sort Indirection Buffer"), true, manager, m_CameraSortIndirection[i], RHI::RawBuffer, alignedParticleCount * sizeof(u32), alignedParticleCount * sizeof(u32), false) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Camera Sort Keys Buffer"), true, manager, m_CameraSortKeys[i], RHI::RawBuffer, alignedParticleCount * sizeof(u32), alignedParticleCount * sizeof(u32), false)) + return false; + // 16 bits key + const u32 sortKeySizeInBits = 16; + // Init sorter if needed and allocate buffers + if (!PK_VERIFY(m_CameraGPUSorters[i].Init(sortKeySizeInBits, manager)) || + !PK_VERIFY(m_CameraGPUSorters[i].AllocateBuffers(allocBuffers.m_DrawRequests[i]->RenderedParticleCount(), manager))) + return false; + } + } + + // Ribbon sort + if (m_RendererType == Renderer_Ribbon) + { + if (m_RibbonGPUSorters.Count() != drCount) + { + // For each draw request, we have indirection and sort key buffers + // and a GPU sorter object, handling intermediates work buffers + if (!PK_VERIFY(m_RibbonSortIndirection.Resize(drCount)) || + !PK_VERIFY(m_RibbonSortKeys.Resize(drCount)) || + !PK_VERIFY(m_RibbonGPUSorters.Resize(drCount))) + return false; + } + for (u32 i = 0; i < drCount; i++) + { + if (!PK_VERIFY(allocBuffers.m_DrawRequests[i]->RenderedParticleCount() > 0)) + continue; + const u32 alignedParticleCount = Mem::Align(allocBuffers.m_DrawRequests[i]->RenderedParticleCount()); + // Like for CPU ribbon, we have a 44 bits sort key from the self ID (26 bits) and the parentID (18 bits) + const u32 sortKeySizeInBits = 44; + const u32 sortKeyStrideInBytes = 2 * sizeof(u32); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Ribbon Sort Indirection Buffer"), true, manager, m_RibbonSortIndirection[i], RHI::RawBuffer, alignedParticleCount * sizeof(u32), alignedParticleCount * sizeof(u32), false) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Ribbon Sort Keys Buffer"), true, manager, m_RibbonSortKeys[i], RHI::RawBuffer, alignedParticleCount * sortKeyStrideInBytes, alignedParticleCount * sortKeyStrideInBytes, false)) + return false; + // Init sorter if needed and allocate buffers + if (!PK_VERIFY(m_RibbonGPUSorters[i].Init(sortKeySizeInBits, manager)) || + !PK_VERIFY(m_RibbonGPUSorters[i].AllocateBuffers(allocBuffers.m_DrawRequests[i]->RenderedParticleCount(), manager))) + return false; + } + } + + // GPU buffer containing all draw request stream offsets. + // The one flagged as simDataField will be used to fill constant set in _UpdateConstantSetsIFN_GPU(). + // Order must match materialToRHI simStreamOffsets constant sets. + { + // Allocate once, max number of draw requests, indexed by DC from push constant + const u32 offsetsSizeInBytes = kMaxDrawRequestCount * sizeof(u32); // u32 offsets + if (viewIndependentInputs & Drawers::GenInput_ParticlePosition) + { + // Particle positions stream + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Enableds Buffer"), true, manager, m_SimStreamOffsets_Enableds, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Positions Buffer"), true, manager, m_SimStreamOffsets_Positions, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true)) + return false; + } + + // Particle parent IDs and self IDs for ribbon sort. Self ID is not flagged as simstream (not accessed in vertex shader) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_ParentIDs Buffer"), m_RendererType == Renderer_Ribbon, manager, m_SimStreamOffsets_ParentIDs, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_SelfIDs Buffer"), m_RendererType == Renderer_Ribbon, manager, m_SimStreamOffsets_SelfIDs, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, false)) + return false; + + // GPU sort related offset buffers + { + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_CustomSortKeys Buffer"), m_NeedGPUSort && !m_SortByCameraDistance, manager, m_CustomSortKeysOffsets, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, false)) + return false; + } + + // Can be either one + { + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Sizes Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleSize) != 0, manager, m_SimStreamOffsets_Sizes, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true)) + return false; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Size2s Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleSize2) != 0, manager, m_SimStreamOffsets_Size2s, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true)) + return false; + } + + // Rotation particle stream + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Rotations Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleRotation) != 0, manager, m_SimStreamOffsets_Rotations, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true)) + return false; + // First billboarding axis (necessary for billboard AxisAligned, billboard AxisAlignedSpheroid, billboard AxisAlignedCapsule, ribbon NormalAxisAligned and ribbon SideAxisAligned) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Axis0s Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleAxis0) != 0, manager, m_SimStreamOffsets_Axis0s, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true)) + return false; + // Second billboarding axis (necessary for PlaneAligned) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Offsets_Axis1s Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleAxis1) != 0, manager, m_SimStreamOffsets_Axis1s, RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true)) + return false; + } + return true; +} +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::_AllocateBuffers_Main(const RHI::PApiManager &manager, const SBuffersToAlloc &allocBuffers) +{ + PK_ASSERT(!m_GPUStorage); + const u32 viewIndependentInputs = allocBuffers.m_ToGenerate.m_GeneratedInputs; + + // View independent indices (ie. Billboard with PlaneAligned Billboarding mode, or Ribbons that are view independent) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Indices Buffer"), (viewIndependentInputs & Drawers::GenInput_Indices) != 0, manager, m_Indices, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * m_IndexSize, m_TotalParticleCount * m_IndexSize, true)) + return false; + + // For CPU simulation (as GPU sim is just mapping existing GPU buffers to the draw call) + // We issue tasks to fill vbuffers with particle sim data necessary for billboarding + if (viewIndependentInputs & Drawers::GenInput_ParticlePosition) + { + PK_ASSERT(m_RendererType == Renderer_Billboard); + // Particle positions stream + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Positions Buffer"), true, manager, m_Positions, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(CFloat4), m_TotalParticleCount * sizeof(CFloat4), true)) + return false; + + // Constant buffer filled by CPU task, will contain simple description of draw request + // We do this so we can batch various draw requests (renderers from various mediums) in a single draw call + // This constant buffer will contain flags for each draw request + // Each particle position will contain its associated draw request ID in position's W component (See sample vertex shader for more detail) + PK_STATIC_ASSERT(sizeof(Drawers::SBillboardDrawRequest) == sizeof(CFloat4)); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Billboard DrawRequests Buffer"), true, manager, m_DrawRequests, RHI::ConstantBuffer, kMaxDrawRequestCount * sizeof(Drawers::SBillboardDrawRequest), kMaxDrawRequestCount * sizeof(Drawers::SBillboardDrawRequest), false)) + return false; + } + + if (viewIndependentInputs & Drawers::GenInput_ParticlePosition0) + { + PK_ASSERT(m_RendererType == Renderer_Triangle); + PK_ASSERT(viewIndependentInputs & Drawers::GenInput_ParticlePosition1); + PK_ASSERT(viewIndependentInputs & Drawers::GenInput_ParticlePosition2); + + // Vertex positions streams + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Position0s Buffer"), true, manager, m_VertexPositions0, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(CFloat4), m_TotalParticleCount * sizeof(CFloat4), true) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Position1s Buffer"), true, manager, m_VertexPositions1, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(CFloat3), m_TotalParticleCount * sizeof(CFloat3), true) || + !_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Position2s Buffer"), true, manager, m_VertexPositions2, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(CFloat3), m_TotalParticleCount * sizeof(CFloat3), true)) + return false; + + // Constant buffer filled by CPU task, will contain simple description of draw request + // We do this so we can batch various draw requests (renderers from various mediums) in a single draw call + // This constant buffer will contain normals bending factor for each draw request + // Each vertex position 0 will contain its associated draw request ID in position's W component (See sample vertex shader for more detail) + PK_STATIC_ASSERT(sizeof(Drawers::STriangleDrawRequest) == sizeof(float)); + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Triangle DrawRequests Buffer"), true, manager, m_DrawRequests, RHI::ConstantBuffer, kMaxDrawRequestCount * sizeof(Drawers::STriangleDrawRequest), kMaxDrawRequestCount * sizeof(Drawers::STriangleDrawRequest), false)) + return false; + } + else + { + PK_ASSERT((viewIndependentInputs & Drawers::GenInput_ParticlePosition1) == 0); + PK_ASSERT((viewIndependentInputs & Drawers::GenInput_ParticlePosition2) == 0); + } + + if (m_RendererType == Renderer_Billboard) + { + // Can be either one + { + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Sizes Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleSize) != 0, manager, m_Sizes, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(float), m_TotalParticleCount * sizeof(float), true)) + return false; + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Size2s Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleSize2) != 0, manager, m_Sizes2, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(CFloat2), m_TotalParticleCount * sizeof(CFloat2), true)) + return false; + } + + // Rotation particle stream + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Rotations Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleRotation) != 0, manager, m_Rotations, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(float), m_TotalParticleCount * sizeof(float), true)) + return false; + // First billboarding axis (necessary for AxisAligned, AxisAlignedSpheroid, AxisAlignedCapsule) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Axis0s Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleAxis0) != 0, manager, m_Axis0s, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(CFloat3), m_TotalParticleCount * sizeof(CFloat3), true)) + return false; + // Second billboarding axis (necessary for PlaneAligned) + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("Axis1s Buffer"), (viewIndependentInputs & Drawers::GenInput_ParticleAxis1) != 0, manager, m_Axis1s, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * sizeof(CFloat3), m_TotalParticleCount * sizeof(CFloat3), true)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::_AllocateBuffers_ViewDependent(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate) +{ + PK_ASSERT(!m_GPUStorage); + + // View dependent indices (required for sorted particles) + // Indices are either view dependent or view independent for the entire batch + + u32 viewBuffersIndex = 0; + const u32 generatedViewCount = toGenerate.m_PerViewGeneratedInputs.Count(); + for (u32 i = 0; i < generatedViewCount; ++i) + { + const u32 viewGeneratedInputs = toGenerate.m_PerViewGeneratedInputs[i].m_GeneratedInputs; + if (viewGeneratedInputs == 0) + continue; // Nothing to generate for this view + + SPerView &viewBuffers = m_PerViewBuffers[viewBuffersIndex++]; + + viewBuffers.m_ViewIdx = i; + // View dependent indices + if (!_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("View Sorted Indices Buffer"), (viewGeneratedInputs & Drawers::GenInput_Indices) != 0, manager, viewBuffers.m_Indices, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * m_IndexSize, m_TotalParticleCount * m_IndexSize, true)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::_AllocateBuffers_AdditionalInputs(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate) +{ + //---------------------------------------------------------------------------- + // Additional inputs: + // Input streams not required by billboarding (Color, TextureID, AlphaRemapCursor, Additional shader inputs, ..) + + const u32 additionalInputCount = toGenerate.m_AdditionalGeneratedInputs.Count(); + if (m_GPUStorage) + { +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + if (!PK_VERIFY(m_SimStreamOffsets_AdditionalInputs.Resize(additionalInputCount)) || + !PK_VERIFY(m_MappedSimStreamOffsets_AdditionalInputs.Resize(additionalInputCount))) + return false; + + m_ColorStreamId = CGuid::INVALID; // Used for debug drawing + const u32 offsetsSizeInBytes = kMaxDrawRequestCount * sizeof(u32); // u32 offsets + for (u32 i = 0; i < additionalInputCount; ++i) + { + if (!PK_VERIFY(_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("AdditionalInputs Buffer"), true, manager, m_SimStreamOffsets_AdditionalInputs[i], RHI::RawBuffer, offsetsSizeInBytes, offsetsSizeInBytes, true))) + return false; + // Editor only: for debugging purposes, we'll remove that from samples code later + if (toGenerate.m_AdditionalGeneratedInputs[i].m_Type == PopcornFX::EBaseTypeID::BaseType_Float4 && + toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Diffuse_Color()) + m_ColorStreamId = i; + } +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + } + else + { + if (!PK_VERIFY(m_AdditionalFields.Resize(additionalInputCount))) + return false; + + // 2 possible debug color in order: + CGuid diffuseColor; + CGuid distortionColor; + + for (u32 i = 0; i < additionalInputCount; ++i) + { + // Create a gpu buffer for each additional field that your engine supports: + // Those gpu buffers will be filled with particle data from the matching streams, per vertex, ie: + // Particle stream with 2 particles, ViewposAligned so 4 vertices per particle :[Color0][Color1][TextureID0][TextureID1] + // Dst gpu buffers :[Color0][Color1][TextureID0][TextureID1] + // This policy creates a gpu buffer per additional input, but you could choose to only copy out specific particle fields + + const u32 typeSize = CBaseTypeTraits::Traits(toGenerate.m_AdditionalGeneratedInputs[i].m_Type).Size; + m_AdditionalFields[i].m_ByteSize = typeSize; + m_AdditionalFields[i].m_AdditionalInputIndex = i; // Important, we need that index internally in copy stream tasks + + // Here is where you can discard specific additional inputs if your engine does not support them + // Ie. If the target engine doesn't support additional inputs, don't allocate gpu buffers for it + if (toGenerate.m_AdditionalGeneratedInputs[i].m_Type == PopcornFX::EBaseTypeID::BaseType_Float4 && + toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Diffuse_Color()) + diffuseColor = i; + else if (toGenerate.m_AdditionalGeneratedInputs[i].m_Type == PopcornFX::EBaseTypeID::BaseType_Float4 && + toGenerate.m_AdditionalGeneratedInputs[i].m_Name == BasicRendererProperties::SID_Distortion_Color()) + distortionColor = i; + if (!PK_VERIFY(_CreateOrResizeGpuBufferIf(RHI::SRHIResourceInfos("AdditionalInputs Buffer"), true, manager, m_AdditionalFields[i].m_Buffer, RHI::RawBuffer, m_TotalParticleCount_OverEstimated * typeSize, m_TotalParticleCount * typeSize, true))) + return false; + } + + if (diffuseColor.Valid()) + m_AdditionalFields[diffuseColor].m_Semantic = SRHIDrawCall::DebugDrawGPUBuffer_Color; // Flag that additional field for debug draw (editor only) + else if (distortionColor.Valid()) + m_AdditionalFields[distortionColor].m_Semantic = SRHIDrawCall::DebugDrawGPUBuffer_Color; // Flag that additional field for debug draw (editor only) + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPUBillboardBatchJobs *billboardVertexBatch, const SGeneratedInputs &toMap) +{ + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::MapBuffers (vertex billboard)"); + + RHI::PApiManager manager = ctx.ApiManager(); + + if (billboardVertexBatch == null) + { + PK_ASSERT(m_GPUStorage); +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + PK_NAMEDSCOPEDPROFILE("Map GPU streams offsets buffers"); + + // If the billboard batch is null, we have GPU storage: + m_MappedIndirectBuffer = static_cast(manager->MapCpuView(m_IndirectDraw.m_Buffer)); + + // Mandatory streams + m_MappedSimStreamOffsets_Enableds = static_cast(manager->MapCpuView(m_SimStreamOffsets_Enableds.m_Buffer)); + m_MappedSimStreamOffsets_Positions = static_cast(manager->MapCpuView(m_SimStreamOffsets_Positions.m_Buffer)); + m_MappedSimStreamOffsets_Sizes = m_SimStreamOffsets_Sizes.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_Sizes.m_Buffer)) : null; + m_MappedSimStreamOffsets_Size2s = m_SimStreamOffsets_Size2s.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_Size2s.m_Buffer)) : null; + + // Optional streams + m_MappedSimStreamOffsets_Rotations = m_SimStreamOffsets_Rotations.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_Rotations.m_Buffer)) : null; + m_MappedSimStreamOffsets_Axis0s = m_SimStreamOffsets_Axis0s.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_Axis0s.m_Buffer)) : null; + m_MappedSimStreamOffsets_Axis1s = m_SimStreamOffsets_Axis1s.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_Axis1s.m_Buffer)) : null; + + if (!PK_VERIFY(!m_SimStreamOffsets_Rotations.Used() || m_MappedSimStreamOffsets_Rotations != null) || + !PK_VERIFY(!m_SimStreamOffsets_Axis0s.Used() || m_MappedSimStreamOffsets_Axis0s != null) || + !PK_VERIFY(!m_SimStreamOffsets_Axis1s.Used() || m_MappedSimStreamOffsets_Axis1s != null)) + return false; + + // Map all + for (u32 i = 0; i < m_SimStreamOffsets_AdditionalInputs.Count(); ++i) + { + m_MappedSimStreamOffsets_AdditionalInputs[i] = static_cast(manager->MapCpuView(m_SimStreamOffsets_AdditionalInputs[i].m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_AdditionalInputs[i] != null)) + return false; + } + + // Camera sort optional stream offsets + if (m_NeedGPUSort && !m_SortByCameraDistance) + { + m_MappedCustomSortKeysOffsets = static_cast(manager->MapCpuView(m_CustomSortKeysOffsets.m_Buffer)); + if (!PK_VERIFY(m_MappedCustomSortKeysOffsets != null)) + return false; + } + + return PK_VERIFY(m_MappedIndirectBuffer != null) && + PK_VERIFY(m_MappedSimStreamOffsets_Enableds != null) && + PK_VERIFY(m_MappedSimStreamOffsets_Positions != null) && + PK_VERIFY(m_MappedSimStreamOffsets_Sizes != null || m_MappedSimStreamOffsets_Size2s != null); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + } + PK_ASSERT(!m_GPUStorage); + + // Assign mapped gpu buffers on CPU tasks that will run async on worker threads + // All buffers used below have been allocated in AllocBuffers during this BeginCollectingDrawCalls + // They could also have been allocated in a previous BeginCollectingDrawCalls call, see documentation for more detail + // CCopyStream_Exec_Indices will generate indices and sort particles based on the renderer sort metric if necessary + // CCopyStream_Exec_Billboard_Std will copy particle sim data necessary for billboarding (Positions/Sizes/Rotations/Axis0s/Axis1s) + // This tasks will also write in Position's W component the associated draw request ID + // CCopyStream_Exec_GPUBillboardDrawRequests will write draw request datas packed + // CCopyStream_Exec_AdditionalField will do a straight copy of specified particle data into the vertex buffers + + if (toMap.m_GeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_Indices.m_Buffer, 0, m_IndexSize * m_TotalParticleCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardVertexBatch->m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalParticleCount, m_IndexSize == sizeof(u32)); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticlePosition) + { + PK_ASSERT(m_Positions.Used()); + void *mappedValue = manager->MapCpuView(m_Positions.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat4)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardVertexBatch->m_Exec_CopyBillboardingStreams.m_PositionsDrIds = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + + PK_ASSERT(m_DrawRequests.Used()); + void *mappedDrawRequests = manager->MapCpuView(m_DrawRequests.m_Buffer, 0, kMaxDrawRequestCount * sizeof(Drawers::SBillboardDrawRequest)); + if (!PK_VERIFY(mappedDrawRequests != null)) + return false; + + billboardVertexBatch->m_Exec_GeomBillboardDrawRequests.m_GeomDrawRequests = TMemoryView(static_cast(mappedDrawRequests), kMaxDrawRequestCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleSize) + { + PK_ASSERT(m_Sizes.Used()); + void *mappedValue = manager->MapCpuView(m_Sizes.m_Buffer, 0, m_TotalParticleCount * sizeof(float)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardVertexBatch->m_Exec_CopyBillboardingStreams.m_Sizes = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + else if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleSize2) + { + PK_ASSERT(m_Sizes2.Used()); + void *mappedValue = manager->MapCpuView(m_Sizes2.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat2)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardVertexBatch->m_Exec_CopyBillboardingStreams.m_Sizes2 = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleRotation) + { + PK_ASSERT(m_Rotations.Used()); + void *mappedValue = manager->MapCpuView(m_Rotations.m_Buffer, 0, m_TotalParticleCount * sizeof(float)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardVertexBatch->m_Exec_CopyBillboardingStreams.m_Rotations = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleAxis0) + { + PK_ASSERT(m_Axis0s.Used()); + void *mappedValue = manager->MapCpuView(m_Axis0s.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat3)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardVertexBatch->m_Exec_CopyBillboardingStreams.m_Axis0 = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticleAxis1) + { + PK_ASSERT(m_Axis1s.Used()); + void *mappedValue = manager->MapCpuView(m_Axis1s.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat3)); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardVertexBatch->m_Exec_CopyBillboardingStreams.m_Axis1 = TMemoryView(static_cast(mappedValue), m_TotalParticleCount); + } + + // View dependent inputs: + PK_ASSERT(m_PerViewBuffers.Count() == billboardVertexBatch->m_PerView.Count()); + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + { + const u32 viewGeneratedInputs = toMap.m_PerViewGeneratedInputs[i].m_GeneratedInputs; + + PK_ASSERT(m_PerViewBuffers[i].m_ViewIdx == billboardVertexBatch->m_PerView[i].m_ViewIndex); + if (viewGeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_PerViewBuffers[i].m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Indices.m_Buffer, 0, m_TotalParticleCount * m_IndexSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + billboardVertexBatch->m_PerView[i].m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalParticleCount, m_IndexSize == sizeof(u32)); + } + } + + // Additional inputs: + if (!toMap.m_AdditionalGeneratedInputs.Empty()) + { + PK_ASSERT(toMap.m_AdditionalGeneratedInputs.Count() == m_AdditionalFields.Count()); + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalParticleCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalParticleCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + billboardVertexBatch->m_Exec_CopyAdditionalFields.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPUTriangleBatchJobs *triangleVertexBatch, const SGeneratedInputs &toMap) +{ + (void)views; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::MapBuffers (vertex triangle)"); + + PK_ASSERT(!m_GPUStorage); + + RHI::PApiManager manager = ctx.ApiManager(); + + // Assign mapped gpu buffers on CPU tasks that will run async on worker threads + // All buffers used below have been allocated in AllocBuffers during this BeginCollectingDrawCalls + // They could also have been allocated in a previous BeginCollectingDrawCalls call, see documentation for more detail + // CCopyStream_Exec_Indices will generate indices and sort particles based on the renderer sort metric if necessary + // CCopyStream_Exec_Triangle_Std will copy particle sim data necessary for billboarding (Positions) + // This tasks will also write in Position's W component the associated draw request ID + // CCopyStream_Exec_GPUTriangleDrawRequests will write draw request datas packed + // CCopyStream_Exec_AdditionalField will do a straight copy of specified particle data into the vertex buffers + + if (toMap.m_GeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_Indices.m_Buffer, 0, m_IndexSize * m_TotalParticleCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + triangleVertexBatch->m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalParticleCount, m_IndexSize == sizeof(u32)); + } + if (toMap.m_GeneratedInputs & Drawers::GenInput_ParticlePosition0) + { + PK_ASSERT(toMap.m_GeneratedInputs & Drawers::GenInput_ParticlePosition1); + PK_ASSERT(toMap.m_GeneratedInputs & Drawers::GenInput_ParticlePosition2); + PK_ASSERT(m_VertexPositions0.Used()); + PK_ASSERT(m_VertexPositions1.Used()); + PK_ASSERT(m_VertexPositions2.Used()); + void *mappedValue0 = manager->MapCpuView(m_VertexPositions0.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat4)); + void *mappedValue1 = manager->MapCpuView(m_VertexPositions1.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat3)); + void *mappedValue2 = manager->MapCpuView(m_VertexPositions2.m_Buffer, 0, m_TotalParticleCount * sizeof(CFloat3)); + if (!PK_VERIFY(mappedValue0 != null && mappedValue1 != null && mappedValue2 != null)) + return false; + // PositionsDrIds contains the positions of the triangles first vertex in its XYZ components and the draw request ID for each triangle in the W component + // Positions1 and Positions2 only contains the positions of the triangles second and third vertices + triangleVertexBatch->m_Exec_CopyBillboardingStreams.m_PositionsDrIds = TMemoryView(static_cast(mappedValue0), m_TotalParticleCount); + triangleVertexBatch->m_Exec_CopyBillboardingStreams.m_Positions1 = TMemoryView(static_cast(mappedValue1), m_TotalParticleCount); + triangleVertexBatch->m_Exec_CopyBillboardingStreams.m_Positions2 = TMemoryView(static_cast(mappedValue2), m_TotalParticleCount); + + PK_ASSERT(m_DrawRequests.Used()); + void *mappedDrawRequests = manager->MapCpuView(m_DrawRequests.m_Buffer, 0, kMaxDrawRequestCount * sizeof(Drawers::STriangleDrawRequest)); + if (!PK_VERIFY(mappedDrawRequests != null)) + return false; + triangleVertexBatch->m_Exec_GPUTriangleDrawRequests.m_GPUDrawRequests = TMemoryView(static_cast(mappedDrawRequests), kMaxDrawRequestCount); + } + + // View dependent inputs: + PK_ASSERT(m_PerViewBuffers.Count() == triangleVertexBatch->m_PerView.Count()); + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + { + const u32 viewGeneratedInputs = toMap.m_PerViewGeneratedInputs[i].m_GeneratedInputs; + + PK_ASSERT(m_PerViewBuffers[i].m_ViewIdx == triangleVertexBatch->m_PerView[i].m_ViewIndex); + if (viewGeneratedInputs & Drawers::GenInput_Indices) + { + PK_ASSERT(m_PerViewBuffers[i].m_Indices.Used()); + void *mappedValue = manager->MapCpuView(m_PerViewBuffers[i].m_Indices.m_Buffer, 0, m_TotalParticleCount * m_IndexSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + triangleVertexBatch->m_PerView[i].m_Exec_Indices.m_IndexStream.Setup(mappedValue, m_TotalParticleCount, m_IndexSize == sizeof(u32)); + } + } + + // Additional inputs: + if (!toMap.m_AdditionalGeneratedInputs.Empty()) + { + PK_ASSERT(toMap.m_AdditionalGeneratedInputs.Count() == m_AdditionalFields.Count()); + if (!PK_VERIFY(m_MappedAdditionalFields.Resize(m_AdditionalFields.Count()))) + return false; + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (m_AdditionalFields[i].m_Buffer.Used()) + { + void *mappedValue = manager->MapCpuView(m_AdditionalFields[i].m_Buffer.m_Buffer, 0, m_TotalParticleCount * m_AdditionalFields[i].m_ByteSize); + if (!PK_VERIFY(mappedValue != null)) + return false; + + m_MappedAdditionalFields[i].m_AdditionalInputIndex = m_AdditionalFields[i].m_AdditionalInputIndex; + m_MappedAdditionalFields[i].m_Storage.m_Count = m_TotalParticleCount; + m_MappedAdditionalFields[i].m_Storage.m_RawDataPtr = static_cast(mappedValue); + m_MappedAdditionalFields[i].m_Storage.m_Stride = m_AdditionalFields[i].m_ByteSize; + } + } + triangleVertexBatch->m_Exec_CopyAdditionalFields.m_FieldsToCopy = m_MappedAdditionalFields.View(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPURibbonBatchJobs *billboardVertexBatch, const SGeneratedInputs &toMap) +{ + (void)views; + (void)toMap; + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::MapBuffers (ribbon vertex billboard)"); + + RHI::PApiManager manager = ctx.ApiManager(); + + if (billboardVertexBatch == null) + { + PK_ASSERT(m_GPUStorage); +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + PK_NAMEDSCOPEDPROFILE("Map GPU streams offsets buffers"); + + // If the billboard batch is null, we have GPU storage: + m_MappedIndirectBuffer = static_cast(manager->MapCpuView(m_IndirectDraw.m_Buffer)); + + // Mandatory streams + m_MappedSimStreamOffsets_Enableds = static_cast(manager->MapCpuView(m_SimStreamOffsets_Enableds.m_Buffer)); + m_MappedSimStreamOffsets_Positions = static_cast(manager->MapCpuView(m_SimStreamOffsets_Positions.m_Buffer)); + m_MappedSimStreamOffsets_Sizes = m_SimStreamOffsets_Sizes.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_Sizes.m_Buffer)) : null; + + // Optional streams + m_MappedSimStreamOffsets_Rotations = m_SimStreamOffsets_Rotations.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_Rotations.m_Buffer)) : null; + m_MappedSimStreamOffsets_Axis0s = m_SimStreamOffsets_Axis0s.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_Axis0s.m_Buffer)) : null; + m_MappedSimStreamOffsets_ParentIDs = m_SimStreamOffsets_ParentIDs.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_ParentIDs.m_Buffer)) : null; + m_MappedSimStreamOffsets_SelfIDs = m_SimStreamOffsets_SelfIDs.Used() ? static_cast(manager->MapCpuView(m_SimStreamOffsets_SelfIDs.m_Buffer)) : null; + + if (!PK_VERIFY(!m_SimStreamOffsets_Rotations.Used() || m_MappedSimStreamOffsets_Rotations != null) || + !PK_VERIFY(!m_SimStreamOffsets_Axis0s.Used() || m_MappedSimStreamOffsets_Axis0s != null) || + !PK_VERIFY(!m_SimStreamOffsets_ParentIDs.Used() || m_MappedSimStreamOffsets_ParentIDs != null) || + !PK_VERIFY(!m_SimStreamOffsets_SelfIDs.Used() || m_MappedSimStreamOffsets_SelfIDs != null)) + return false; + + // Map all + for (u32 i = 0; i < m_SimStreamOffsets_AdditionalInputs.Count(); ++i) + { + m_MappedSimStreamOffsets_AdditionalInputs[i] = static_cast(manager->MapCpuView(m_SimStreamOffsets_AdditionalInputs[i].m_Buffer)); + if (!PK_VERIFY(m_MappedSimStreamOffsets_AdditionalInputs[i] != null)) + return false; + } + + // Camera sort optional stream offsets + if (m_NeedGPUSort && !m_SortByCameraDistance) + { + m_MappedCustomSortKeysOffsets = static_cast(manager->MapCpuView(m_CustomSortKeysOffsets.m_Buffer)); + if (!PK_VERIFY(m_MappedCustomSortKeysOffsets != null)) + return false; + } + + return PK_VERIFY(m_MappedIndirectBuffer != null) && + PK_VERIFY(m_MappedSimStreamOffsets_Enableds != null) && + PK_VERIFY(m_MappedSimStreamOffsets_Positions != null) && + PK_VERIFY(m_MappedSimStreamOffsets_Sizes != null); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + } + + // Vertex ribbon billboarding not implemented for CPU simulation + PK_ASSERT_NOT_REACHED(); + + return false; +} +//---------------------------------------------------------------------------- + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) +bool CRHIBillboardingBatchPolicy_Vertex::_WriteGPUStreamsOffsets(const TMemoryView &drawRequests) +{ + PK_ASSERT(m_MappedIndirectBuffer != null); + const u32 streamCount = m_GPUBuffers.Count(); // Stream offsets used by the vertex shader. + const u32 drCount = drawRequests.Count(); + u32 GPUSortAdditionnalOffsetsCount = 0; // Additionnal offsets used by sort compute only. + // TODO: replace count of offsets buffer by a proper tracking of + // of those needed by compute but not by vertex shader, like m_GPUBuffers, + // and rename m_GPUBuffers. + + if (m_NeedGPUSort && !m_SortByCameraDistance) + GPUSortAdditionnalOffsetsCount += 1; // Custom sort key offsets + + if (m_RendererType == Renderer_Ribbon) // Ribbon sort: selfIDs stream (parent ID is contained in m_GPUBuffers count) + GPUSortAdditionnalOffsetsCount += 1; + + PK_STACKALIGNEDMEMORYVIEW(u32, streamsOffsets, drCount * (streamCount + GPUSortAdditionnalOffsetsCount), 0x10); + + // Store offsets in a stack view ([PosOffsetDr0][PosOffsetDr1][SizeOffsetDr0][SizeOffsetDr1]..) + for (u32 iDr = 0; iDr < drCount; ++iDr) + { + // Indirect buffer + m_MappedIndirectBuffer[iDr].m_InstanceCount = 0; + m_MappedIndirectBuffer[iDr].m_IndexOffset = 0; + m_MappedIndirectBuffer[iDr].m_VertexOffset = 0; + m_MappedIndirectBuffer[iDr].m_InstanceOffset = 0; + + // Fill in stream offsets for each draw request + const CParticleStreamToRender_GPU *streamToRender = drawRequests[iDr]->StreamToRender_GPU(); + PK_ASSERT(streamToRender != null); + const Drawers::SBase_DrawRequest *dr = drawRequests[iDr]; + const Drawers::SBase_BillboardingRequest baseBr = dr->BaseBillboardingRequest(); + + u32 offset = 0; + + // Mandatory streams + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(baseBr.m_EnabledStreamId); + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(baseBr.m_PositionStreamId); + + // Billboard streams + if (m_RendererType == Renderer_Billboard) + { + const Drawers::SBillboard_DrawRequest *billboardDr = static_cast(dr); + + m_MappedIndirectBuffer[iDr].m_IndexCount = m_CapsulesDC ? 12 : 6; + + // Mandatory + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(billboardDr->m_BB.m_SizeStreamId); + + // Optional + if (m_MappedSimStreamOffsets_Rotations != null) + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(billboardDr->m_BB.m_RotationStreamId); + if (m_MappedSimStreamOffsets_Axis0s != null) + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(billboardDr->m_BB.m_Axis0StreamId); + if (m_MappedSimStreamOffsets_Axis1s != null) + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(billboardDr->m_BB.m_Axis1StreamId); + } + else if (m_RendererType == Renderer_Ribbon) + { + const Drawers::SRibbon_DrawRequest *ribbonDr = static_cast(dr); + + m_MappedIndirectBuffer[iDr].m_IndexCount = m_ParticleQuadCount * 6; + + // Mandatory + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(ribbonDr->m_BB.m_WidthStreamId); + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(ribbonDr->m_BB.m_ParentIDStreamId); + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(ribbonDr->m_BB.m_SelfIDStreamId); + + // Optional + if (m_MappedSimStreamOffsets_Axis0s != null) + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(ribbonDr->m_BB.m_AxisStreamId); + } + else + { + PK_ASSERT_NOT_REACHED_MESSAGE("Writing GPU streams offset from vertex policy, but draw request is neither a billboard or a ribbon one."); + return false; + } + + // Add all non-virtual stream additional inputs + const u32 additionalInputCount = baseBr.m_AdditionalInputs.Count(); + for (u32 iInput = 0; iInput < additionalInputCount; ++iInput) + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(baseBr.m_AdditionalInputs[iInput].m_StreamId); + + if (m_NeedGPUSort && !m_SortByCameraDistance) + streamsOffsets[offset++ * drCount + iDr] = streamToRender->StreamOffset(baseBr.m_SortKeyStreamId); + + PK_ASSERT(offset == streamCount + GPUSortAdditionnalOffsetsCount); + } + + // Non temporal writes to gpu mem, aligned and contiguous + u32 streamOffset = 0; + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Enableds, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Positions, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + + if (m_SimStreamOffsets_Size2s.Used()) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Size2s, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + else if (m_SimStreamOffsets_Sizes.Used()) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Sizes, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + + if (m_MappedSimStreamOffsets_ParentIDs != null) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_ParentIDs, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + if (m_MappedSimStreamOffsets_SelfIDs != null) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_SelfIDs, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + + if (m_MappedSimStreamOffsets_Rotations != null) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Rotations, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + if (m_MappedSimStreamOffsets_Axis0s != null) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Axis0s, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + if (m_MappedSimStreamOffsets_Axis1s != null) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_Axis1s, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + + for (u32 iInput = 0; iInput < m_MappedSimStreamOffsets_AdditionalInputs.Count(); ++iInput) + Mem::Copy_Uncached(m_MappedSimStreamOffsets_AdditionalInputs[iInput], &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + + if (m_MappedCustomSortKeysOffsets != null && !m_SortByCameraDistance) + Mem::Copy_Uncached(m_MappedCustomSortKeysOffsets, &streamsOffsets[streamOffset++ * drCount], sizeof(u32) * drCount); + + return true; +} +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *billboardVertexBatch) +{ + (void)ctx; + // If the billboard batch is null, we have GPU storage: + if (billboardVertexBatch == null) + { + PK_NAMEDSCOPEDPROFILE("Write GPU streams offsets"); + + PK_ASSERT(m_GPUStorage); + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + return PK_VERIFY(_WriteGPUStreamsOffsets(static_cast>(drawRequests))); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + } + PK_ASSERT(!m_GPUStorage); + + (void)drawRequests; + (void)billboardVertexBatch; + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_GeomBillboardCustomParticleSelectTask.Clear(); + PK_ASSERT(m_Selections.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_Selections.m_Buffer, 0, sizeof(float) * m_TotalParticleCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_GeomBillboardCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalParticleCount, sizeof(float)); + m_GeomBillboardCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + billboardVertexBatch->AddExecAsyncPage(&m_GeomBillboardCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *triangleVertexBatch) +{ + (void)ctx; + (void)drawRequests; + (void)triangleVertexBatch; + + PK_ASSERT(!m_GPUStorage); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + if (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) + { + // If we have a CPU storage, we can render the particles that are selected as wire-frame + m_GeomBillboardCustomParticleSelectTask.Clear(); + PK_ASSERT(m_Selections.Used()); + void *mappedValue = ctx.ApiManager()->MapCpuView(m_Selections.m_Buffer, 0, sizeof(float) * m_TotalParticleCount); + if (!PK_VERIFY(mappedValue != null)) + return false; + m_GeomBillboardCustomParticleSelectTask.m_DstSelectedParticles = TStridedMemoryView(static_cast(mappedValue), m_TotalParticleCount, sizeof(float)); + m_GeomBillboardCustomParticleSelectTask.m_SrcParticleSelected = ctx.Selection(); + triangleVertexBatch->AddExecAsyncPage(&m_GeomBillboardCustomParticleSelectTask); + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *ribbonVertexBatch) +{ + (void)ctx; + // If the billboard batch is null, we have GPU storage: + if (ribbonVertexBatch == null) + { + PK_NAMEDSCOPEDPROFILE("Write GPU streams offsets"); + + PK_ASSERT(m_GPUStorage); + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + return PK_VERIFY(_WriteGPUStreamsOffsets(static_cast>(drawRequests))); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + } + (void)drawRequests; + PK_ASSERT_NOT_REACHED_MESSAGE("Ribbon vertex billboarding is only implemented for GPU sim"); + + return true; +} + +//---------------------------------------------------------------------------- + +u32 CRHIBillboardingBatchPolicy_Vertex::_GetVertexBillboardShaderOptions(const Drawers::SBillboard_BillboardingRequest &bbRequest) +{ + u32 shaderOptions = Option_VertexBillboarding; + + // Here, we set some flags to know which shader we should use to billboard those particles. + // We need that so PK-SampleLib's render loop avoids re-creating the shaders each time the billboarding mode changes: + // The renderer cache contains the geometry shaders for ALL billboarding mode and we choose between those depending on "m_ShaderOptions" + switch (bbRequest.m_Mode) + { + case BillboardMode_ScreenAligned: + case BillboardMode_ViewposAligned: + break; + case BillboardMode_AxisAligned: + case BillboardMode_AxisAlignedSpheroid: + shaderOptions |= Option_Axis_C1; + break; + case BillboardMode_AxisAlignedCapsule: + shaderOptions |= Option_Axis_C1 | Option_Capsule; + break; + case BillboardMode_PlaneAligned: + shaderOptions |= Option_Axis_C2; + break; + default: + PK_ASSERT_NOT_REACHED(); + return 0; + break; + } + if (bbRequest.m_SizeFloat2) + shaderOptions |= Option_BillboardSizeFloat2; +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + if (m_NeedGPUSort) + shaderOptions |= Option_GPUSort; +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + return shaderOptions; +} + +//---------------------------------------------------------------------------- + +u32 CRHIBillboardingBatchPolicy_Vertex::_GetVertexRibbonShaderOptions(const Drawers::SRibbon_BillboardingRequest &bbRequest) +{ + u32 shaderOptions = Option_VertexPassThrough | Option_RibbonVertexBillboarding; + + // Here, we set some flags to know which shader we should use to billboard those particles. + // We need that so PK-SampleLib's render loop avoids re-creating the shaders each time the billboarding mode changes: + // The renderer cache contains the geometry shaders for ALL billboarding mode and we choose between those depending on "m_ShaderOptions" + + switch (bbRequest.m_Mode) + { + case RibbonMode_ViewposAligned: + break; + case RibbonMode_NormalAxisAligned: + case RibbonMode_SideAxisAligned: + case RibbonMode_SideAxisAlignedTube: // TODO: implem shader options for tube & multi-planes like capsules. + case RibbonMode_SideAxisAlignedMultiPlane: + shaderOptions |= Option_Axis_C1; + break; + default: + PK_ASSERT_NOT_REACHED(); + return 0; + break; + } +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + if (m_NeedGPUSort) + shaderOptions |= Option_GPUSort; + if (m_GPUStorage) + shaderOptions |= Option_GPUStorage; +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + return shaderOptions; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::UnmapBuffers(SRenderContext &ctx) +{ + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::UnmpBuffers"); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Editor only: for debugging purposes, we'll remove that from samples code later + m_Selections.UnmapIFN(ctx.ApiManager()); +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + // UnmapBuffers is called once all CPU tasks (if any) has finished. + // This gets called prior to issuing draw calls + // Do not clear your vertex buffers here, just unmap + + RHI::PApiManager manager = ctx.ApiManager(); + + m_Indices.UnmapIFN(manager); + m_DrawRequests.UnmapIFN(manager); + m_Positions.UnmapIFN(manager); + m_Sizes.UnmapIFN(manager); + m_Sizes2.UnmapIFN(manager); + m_Rotations.UnmapIFN(manager); + m_Axis0s.UnmapIFN(manager); + m_Axis1s.UnmapIFN(manager); + + m_VertexPositions0.UnmapIFN(manager); + m_VertexPositions1.UnmapIFN(manager); + m_VertexPositions2.UnmapIFN(manager); + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + m_IndirectDraw.UnmapIFN(manager); + m_SimStreamOffsets_Enableds.UnmapIFN(manager); + m_SimStreamOffsets_Positions.UnmapIFN(manager); + m_SimStreamOffsets_Sizes.UnmapIFN(manager); + m_SimStreamOffsets_Size2s.UnmapIFN(manager); + m_SimStreamOffsets_Rotations.UnmapIFN(manager); + m_SimStreamOffsets_Axis0s.UnmapIFN(manager); + m_SimStreamOffsets_Axis1s.UnmapIFN(manager); + m_SimStreamOffsets_ParentIDs.UnmapIFN(manager); + m_SimStreamOffsets_SelfIDs.UnmapIFN(manager); + + for (u32 i = 0; i < m_SimStreamOffsets_AdditionalInputs.Count(); ++i) + m_SimStreamOffsets_AdditionalInputs[i].UnmapIFN(manager); + + m_CustomSortKeysOffsets.UnmapIFN(manager); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + // Additional inputs: + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + m_AdditionalFields[i].m_Buffer.UnmapIFN(manager); + + // View dependent inputs: + for (u32 i = 0; i < m_PerViewBuffers.Count(); ++i) + m_PerViewBuffers[i].m_Indices.UnmapIFN(manager); + return true; +} + +//---------------------------------------------------------------------------- + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) +bool CRHIBillboardingBatchPolicy_Vertex::_UpdateConstantSetsIFN_GPU(const RHI::PApiManager &manager, const SDrawCallDesc &toEmit, const RHI::PGpuBuffer &drStreamBuffer, const RHI::PGpuBuffer &drCameraSortIndirection, const RHI::PGpuBuffer &drRibbonSortIndirection, u32 shaderOptions) +{ + CRendererCacheInstance_UpdateThread *renderCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(renderCacheInstance != null)) + { + CLog::Log(PK_ERROR, "Invalid renderer cache instance"); + return false; + } + + // Two constant sets: + // - One re-created each frame per draw call (sim data SRV) + // - One created once, valid for the entire batch, offset via push constant + + PK_ASSERT(renderCacheInstance != null); + const PCRendererCacheInstance cacheInstance = renderCacheInstance->RenderThread_GetCacheInstance(); + if (cacheInstance == null) + return false; + + const RHI::SConstantSetLayout *simDataConstantSetLayout = null; + const RHI::SConstantSetLayout *offsetsConstantSetLayout = null; + if (!PK_VERIFY(cacheInstance->m_Cache->GetGPUStorageConstantSets(static_cast(shaderOptions), simDataConstantSetLayout, offsetsConstantSetLayout)) || + !PK_VERIFY(simDataConstantSetLayout != null) || + !PK_VERIFY(offsetsConstantSetLayout != null) || + simDataConstantSetLayout->m_Constants.Empty() || + offsetsConstantSetLayout->m_Constants.Empty()) + return false; + + m_VertexBBSimDataConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Sim Data Constant Set"), *simDataConstantSetLayout); + if (!PK_VERIFY(m_VertexBBSimDataConstantSet != null)) + return false; + + PK_ASSERT(drStreamBuffer != null); + // Sim data constant set are: + // raw stream + camera sort indirection buffer if needed + ribbon sort indirection and indirect draw buffers if needed + PK_ASSERT(m_VertexBBSimDataConstantSet->GetConstantValues().Count() == (1u + (m_NeedGPUSort ? 1u : 0u) + ((m_RendererType == Renderer_Ribbon) ? 2u : 0u))); + u32 constantSetLocation = 0; + if (!PK_VERIFY(m_VertexBBSimDataConstantSet->SetConstants(drStreamBuffer, constantSetLocation++))) + return false; + if (m_NeedGPUSort) + { + if (!PK_VERIFY(drCameraSortIndirection != null) || + !PK_VERIFY(m_VertexBBSimDataConstantSet->SetConstants(drCameraSortIndirection, constantSetLocation++))) + return false; + } + if (m_RendererType == Renderer_Ribbon) + { + if (!PK_VERIFY(drRibbonSortIndirection != null) || + !PK_VERIFY(m_VertexBBSimDataConstantSet->SetConstants(drRibbonSortIndirection, constantSetLocation++)) || + !PK_VERIFY(m_VertexBBSimDataConstantSet->SetConstants(m_IndirectDraw.m_Buffer, constantSetLocation++))) + return false; + } + m_VertexBBSimDataConstantSet->UpdateConstantValues(); + + // Lazy, once + if (m_GpuBufferResizedOrCreated) + { + m_VertexBBOffsetsConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Offsets Constant Set"), *offsetsConstantSetLayout); + if (!PK_VERIFY(m_VertexBBOffsetsConstantSet != null)) + return false; + + // Fill offsets constant sets. Also contains SortIndirection offsets buffer if needed. + PK_ASSERT(!m_GPUBuffers.Empty()); + PK_ASSERT(m_VertexBBOffsetsConstantSet->GetConstantValues().Count() == m_GPUBuffers.Count()); + for (u32 i = 0; i < m_VertexBBOffsetsConstantSet->GetConstantValues().Count(); ++i) + { + if (!PK_VERIFY(m_VertexBBOffsetsConstantSet->SetConstants(m_GPUBuffers[i], i))) + return false; + } + m_VertexBBOffsetsConstantSet->UpdateConstantValues(); + + m_ShaderOptions = shaderOptions; + m_GpuBufferResizedOrCreated = false; + } + return true; +} +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::_UpdateConstantSetsIFN_CPU(const RHI::PApiManager &manager, const SDrawCallDesc &toEmit, u32 shaderOptions) +{ + CRendererCacheInstance_UpdateThread *renderCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(renderCacheInstance != null)) + { + CLog::Log(PK_ERROR, "Invalid renderer cache instance"); + return false; + } + if (m_GpuBufferResizedOrCreated || + m_ShaderOptions != shaderOptions) + { + PK_ASSERT(renderCacheInstance != null); + const PCRendererCacheInstance cacheInstance = renderCacheInstance->RenderThread_GetCacheInstance(); + if (cacheInstance == null) + return false; + + const RHI::SConstantSetLayout *simDataConstantSetLayout = null; + const RHI::SConstantSetLayout *offsetsConstantSetLayout = null; + if (!PK_VERIFY(cacheInstance->m_Cache->GetGPUStorageConstantSets(static_cast(shaderOptions), simDataConstantSetLayout, offsetsConstantSetLayout)) || + !PK_VERIFY(simDataConstantSetLayout != null) || + simDataConstantSetLayout->m_Constants.Empty()) + return false; + + m_VertexBBSimDataConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Sim Data Constant Set"), *simDataConstantSetLayout); + if (!PK_VERIFY(m_VertexBBSimDataConstantSet != null)) + return false; + + PK_ASSERT(!m_GPUBuffers.Empty()); + PK_ASSERT(m_VertexBBSimDataConstantSet->GetConstantValues().Count() == m_GPUBuffers.Count()); + for (u32 i = 0; i < m_VertexBBSimDataConstantSet->GetConstantValues().Count(); ++i) + { + if (!PK_VERIFY(m_VertexBBSimDataConstantSet->SetConstants(m_GPUBuffers[i], i))) + return false; + } + m_VertexBBSimDataConstantSet->UpdateConstantValues(); + + m_ShaderOptions = shaderOptions; + m_GpuBufferResizedOrCreated = false; + } +#if (PK_HAS_PARTICLES_SELECTION != 0) + if (m_SelectionsResizedOrCreated) + { + // TODO: This can be global + RHI::SConstantSetLayout selectionSetLayout(RHI::VertexShaderMask); + selectionSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Selections")); + + m_SelectionConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Selection Constant Set"), selectionSetLayout); + if (!PK_VERIFY(m_SelectionConstantSet != null) || + !PK_VERIFY(m_SelectionConstantSet->SetConstants(m_Selections.m_Buffer, 0))) + return false; + m_SelectionConstantSet->UpdateConstantValues(); + m_SelectionsResizedOrCreated = false; + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + return true; +} + +//---------------------------------------------------------------------------- + +SRHIDrawCall *CRHIBillboardingBatchPolicy_Vertex::_CreateDrawCall(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output, SRHIDrawCall::EDrawCallType drawCallType, u32 shaderOptions) +{ + (void)ctx; + CRendererCacheInstance_UpdateThread *renderCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + if (!PK_VERIFY(renderCacheInstance != null)) + { + CLog::Log(PK_ERROR, "Invalid renderer cache instance"); + return null; + } + + if (!PK_VERIFY(output.m_DrawCalls.PushBack().Valid())) + return null; + SRHIDrawCall *outDrawCall = &output.m_DrawCalls.Last(); + + outDrawCall->m_Batch = this; + outDrawCall->m_RendererCacheInstance = renderCacheInstance; + outDrawCall->m_Type = drawCallType; + outDrawCall->m_ShaderOptions = shaderOptions; + outDrawCall->m_RendererType = m_RendererType; + outDrawCall->m_GPUStorageSimDataConstantSet = m_VertexBBSimDataConstantSet; + + // Editor only: for debugging purposes, we'll remove that from samples code later + { + outDrawCall->m_BBox = toEmit.m_BBox; + outDrawCall->m_TotalBBox = m_TotalBBox; + outDrawCall->m_SlicedDC = toEmit.m_TotalIndexCount != m_TotalIndexCount; + } + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + PK_ASSERT(m_VertexBBOffsetsConstantSet == null || m_GPUStorage); + outDrawCall->m_GPUStorageOffsetsConstantSet = m_VertexBBOffsetsConstantSet; +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + +#if (PK_HAS_PARTICLES_SELECTION != 0) + if ((ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected()) && m_SelectionConstantSet != null) + outDrawCall->m_SelectionConstantSet = m_SelectionConstantSet; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + outDrawCall->m_Valid = renderCacheInstance != null && + renderCacheInstance->RenderThread_GetCacheInstance() != null && + renderCacheInstance->RenderThread_GetCacheInstance()->m_Cache != null && + renderCacheInstance->RenderThread_GetCacheInstance()->m_Cache->GetRenderState(static_cast(shaderOptions)) != null; + + PK_ASSERT( (outDrawCall->m_ShaderOptions & Option_VertexBillboarding) || + (outDrawCall->m_ShaderOptions & Option_TriangleVertexBillboarding) || + (outDrawCall->m_ShaderOptions & Option_RibbonVertexBillboarding)); + return outDrawCall; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::_CreateOrResizeGpuBufferIf(const RHI::SRHIResourceInfos &infos, bool condition, const RHI::PApiManager &manager, SGpuBuffer &buffer, RHI::EBufferType type, u32 sizeToAlloc, u32 requiredSize, bool simDataField) +{ + PK_ASSERT(sizeToAlloc >= requiredSize); + if (!condition) + return true; + bool bufferModified = false; + if (buffer.m_Buffer == null || buffer.m_Buffer->GetByteSize() < requiredSize) + { + RHI::PGpuBuffer gpuBuffer = manager->CreateGpuBuffer(infos, type, sizeToAlloc); + buffer.SetGpuBuffer(gpuBuffer); + if (!PK_VERIFY(gpuBuffer != null) || + !PK_VERIFY(buffer.Used())) + return false; + bufferModified = true; + } + else + buffer.Use(); + + // Add the buffer to m_GPUBuffers array (order matters) + if (type == RHI::EBufferType::RawBuffer) + { + if (simDataField) + { + m_GpuBufferResizedOrCreated |= bufferModified; + if (!PK_VERIFY(m_GPUBuffers.PushBack(buffer.m_Buffer).Valid())) + return false; + } +#if (PK_HAS_PARTICLES_SELECTION != 0) + else + m_SelectionsResizedOrCreated = bufferModified; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + } + return true; +} + +//---------------------------------------------------------------------------- + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) +bool CRHIBillboardingBatchPolicy_Vertex::_IssueDrawCall_Billboard_GPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_ASSERT(m_GPUStorage); + PK_ASSERT(m_DrawIndices.Used()); + + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::EmitDrawCall Billboard (GPU)"); + + // Draw calls are not issued inline here, but later in PK-SampleLib's render loop + // _CreateDrawCalls outputs a new pushed draw call that will be processed later (in SRHIDrawOutputs) + RHI::PApiManager manager = ctx.ApiManager(); + + // !Currently, there is no batching for gpu particles! + // So we'll emit one draw call per draw request + const u32 drCount = toEmit.m_DrawRequests.Count(); + + if (m_NeedGPUSort) + { + // Create compute sort key constant set + if (drCount != m_ComputeCameraSortKeysConstantSets.Count()) + { + if (!PK_VERIFY(m_ComputeCameraSortKeysConstantSets.Resize(drCount))) + return false; + RHI::SConstantSetLayout layout; + PKSample::CreateComputeSortKeysConstantSetLayout(layout, m_SortByCameraDistance, false); + for (auto &constantSet : m_ComputeCameraSortKeysConstantSets) + constantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Camera Sort Keys Constant Set"), layout); + } + const u32 computePerDrawRequest = 3 * ((16 + 3) / 4) + 1; // 3 steps 4 bits radix sort, 16 bits key, plus 1 dispatch to generate the sort key + + if (!PK_VERIFY(output.m_ComputeDispatchs.Reserve(drCount * computePerDrawRequest))) + return false; + } + + for (u32 dri = 0; dri < drCount; ++dri) + { + PK_ASSERT(toEmit.m_DrawRequests[dri] != null); + const Drawers::SBillboard_DrawRequest *dr = static_cast(toEmit.m_DrawRequests[dri]); + const Drawers::SBillboard_BillboardingRequest &bbRequest = dr->m_BB; + const CParticleStreamToRender *streamToRender = &dr->StreamToRender(); + + RHI::PGpuBuffer drStreamBuffer; + RHI::PGpuBuffer drStreamSizeBuffer; + +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + if (streamToRender->StorageClass() == CParticleStorageManager_D3D11::DefaultStorageClass()) + { + const CParticleStreamToRender_D3D11 *streamsToRender = static_cast(streamToRender); + const SBuffer_D3D11 &streamBuffer = streamsToRender->StreamBuffer(); + const SBuffer_D3D11 &streamSizeBuffer = streamsToRender->StreamSizeBuf(); + + if (PK_VERIFY(!streamBuffer.Empty()) && PK_VERIFY(!streamSizeBuffer.Empty())) // We have valid sim data and particle count buffers + { + drStreamBuffer = CastD3D11(manager)->D3D11GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), streamBuffer.m_Buffer, RHI::RawBuffer); + drStreamSizeBuffer = CastD3D11(manager)->D3D11GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), streamSizeBuffer.m_Buffer, RHI::RawVertexBuffer); + } + } +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + if (streamToRender->StorageClass() == CParticleStorageManager_D3D12::DefaultStorageClass()) + { + const CParticleStreamToRender_D3D12 *streamsToRender = static_cast(streamToRender); + const SBuffer_D3D12 &streamBuffer = streamsToRender->StreamBuffer(); + const SBuffer_D3D12 &streamSizeBuffer = streamsToRender->StreamSizeBuf(); + + if (PK_VERIFY(!streamBuffer.Empty()) && PK_VERIFY(!streamSizeBuffer.Empty())) // We have valid sim data and particle count buffers + { + drStreamBuffer = CastD3D12(manager)->D3D12GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), streamBuffer.m_Resource, RHI::RawBuffer, streamBuffer.m_State); + drStreamSizeBuffer = CastD3D12(manager)->D3D12GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), streamSizeBuffer.m_Resource, RHI::RawVertexBuffer, streamSizeBuffer.m_State); + } + } +#endif +#if (PK_PARTICLES_UPDATER_USE_UNKNOWN2 != 0) + if (streamToRender->StorageClass() == CParticleStorageManager_UNKNOWN2::DefaultStorageClass()) + { + const CParticleStreamToRender_UNKNOWN2 *streamsToRender = static_cast(streamToRender); + const SBuffer_UNKNOWN2 &streamBuffer = streamsToRender->StreamBuffer(); + const SBuffer_UNKNOWN2 &streamSizeBuffer = streamsToRender->StreamSizeBuf(); + + if (PK_VERIFY(!streamBuffer.Empty()) && PK_VERIFY(!streamSizeBuffer.Empty())) // We have valid sim data and particle count buffers + { + drStreamBuffer = CastUNKNOWN2(manager)->UNKNOWN2GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), streamBuffer.m_Resource, streamBuffer.m_ByteSize, RHI::RawBuffer); + drStreamSizeBuffer = CastUNKNOWN2(manager)->UNKNOWN2GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), streamSizeBuffer.m_Resource, streamBuffer.m_ByteSize, RHI::RawVertexBuffer); + } + } +#endif + if (!PK_VERIFY(drStreamBuffer != null) || + !PK_VERIFY(drStreamSizeBuffer != null)) + return false; + + // Camera GPU sort + if (m_NeedGPUSort) + { + CRendererCacheInstance_UpdateThread *renderCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + PKSample::PCRendererCacheInstance rCacheInstance = renderCacheInstance->RenderThread_GetCacheInstance(); + if (rCacheInstance == null) + return false; + + // Compute: Compute sort keys and init indirection buffer + { + // For radix sort, a thread computes PK_GPU_SORT_NUM_KEY_PER_THREAD keys (see shader definition and RHIGPUSorter.cpp), + // so a group computes (PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE) keys + + const u32 sortGroupCount = (dr->RenderedParticleCount() + PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE - 1) / (PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE); + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + computeDispatch.m_NeedSceneInfoConstantSet = m_SortByCameraDistance; + RHI::PConstantSet computeConstantSet = m_ComputeCameraSortKeysConstantSets[dri]; + computeConstantSet->SetConstants(drStreamSizeBuffer, 0); + computeConstantSet->SetConstants(drStreamBuffer, 1); + computeConstantSet->SetConstants(m_SortByCameraDistance ? m_SimStreamOffsets_Positions.m_Buffer : m_CustomSortKeysOffsets.m_Buffer, 2); + computeConstantSet->SetConstants(m_CameraSortKeys[dri].m_Buffer, 3); + computeConstantSet->SetConstants(m_CameraSortIndirection[dri].m_Buffer, 4); + + computeConstantSet->UpdateConstantValues(); + computeDispatch.m_ConstantSet = computeConstantSet; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = dri; + + // State + const PKSample::EComputeShaderType type = m_SortByCameraDistance ? ComputeType_ComputeSortKeys_CameraDistance : ComputeType_ComputeSortKeys; + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + if (!PK_VERIFY(computeDispatch.m_State != null)) + return false; + + // Dispatch args + // For the sort key computation dispatch, we need exactly twice the sort group count + // so that every thread associated key is initialized. Overflowing keys are initialized + // to 0xFFFF, sorted last (and ultimately not rendered). + computeDispatch.m_ThreadGroups = CInt3(sortGroupCount * PK_GPU_SORT_NUM_KEY_PER_THREAD, 1, 1); + + output.m_ComputeDispatchs.PushBack(computeDispatch); + } + + // Compute: Sort computes + { + m_CameraGPUSorters[dri].SetInOutBuffers(m_CameraSortKeys[dri].m_Buffer, m_CameraSortIndirection[dri].m_Buffer); + m_CameraGPUSorters[dri].AppendDispatchs(rCacheInstance, output.m_ComputeDispatchs); + } + } + + // Emit draw call + { + const u32 shaderOptions = PKSample::Option_VertexPassThrough | PKSample::Option_GPUStorage | _GetVertexBillboardShaderOptions(bbRequest); + const RHI::PGpuBuffer sortIndirectionBuffer = m_NeedGPUSort ? m_CameraSortIndirection[dri].m_Buffer : null; + if (!_UpdateConstantSetsIFN_GPU(ctx.ApiManager(), toEmit, drStreamBuffer, sortIndirectionBuffer, null, shaderOptions)) + return false; + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(ctx, toEmit, output, SRHIDrawCall::DrawCall_IndexedInstancedIndirect, shaderOptions); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + + // A single vertex buffer is used for the instanced draw: the texcoords buffer, contains the direction in which vertices should be expanded + PK_ASSERT(m_TexCoords.Used()); + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_TexCoords.m_Buffer).Valid())) + return false; + + // Editor only: for debugging purposes, we'll remove that from samples code later + { + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Texcoords] = m_TexCoords.m_Buffer; + +#if (PK_HAS_PARTICLES_SELECTION != 0) + RHI::PGpuBuffer bufferIsSelected = ctx.Selection().HasGPUParticlesSelected() ? GetIsSelectedBuffer(ctx.Selection(), *dr) : null; + if (bufferIsSelected != null) + { + // TODO: This can be global + RHI::SConstantSetLayout selectionSetLayout(RHI::VertexShaderMask); + selectionSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Selections")); + + // Constant set re-created each frame, we don't know if the buffer was re-created + m_SelectionConstantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Selection Constant Set"), selectionSetLayout); + if (!PK_VERIFY(m_SelectionConstantSet != null) || + !PK_VERIFY(m_SelectionConstantSet->SetConstants(bufferIsSelected, 0))) + return false; + m_SelectionConstantSet->UpdateConstantValues(); + outDrawCall.m_SelectionConstantSet = m_SelectionConstantSet; + } +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Enabled] = m_SimStreamOffsets_Enableds.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = m_SimStreamOffsets_Positions.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Size] = m_SimStreamOffsets_Sizes.Used() ? m_SimStreamOffsets_Sizes.m_Buffer : m_SimStreamOffsets_Size2s.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Rotation] = m_SimStreamOffsets_Rotations.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Axis0] = m_SimStreamOffsets_Axis0s.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Axis1] = m_SimStreamOffsets_Axis1s.m_Buffer; + + if (m_ColorStreamId.Valid()) + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = m_SimStreamOffsets_AdditionalInputs[m_ColorStreamId].m_Buffer; + } + + outDrawCall.m_IndexOffset = 0; + outDrawCall.m_IndexSize = RHI::IndexBuffer16Bit; + outDrawCall.m_IndexBuffer = m_DrawIndices.m_Buffer; + + outDrawCall.m_IndirectBuffer = m_IndirectDraw.m_Buffer; + outDrawCall.m_IndirectBufferOffset = m_DrawCallCurrentOffset; + outDrawCall.m_EstimatedParticleCount = dr->RenderedParticleCount(); + + // Now we need to create the indirect buffer to store the draw informations + // We do not want to read-back the exact particle count from the GPU, so we are creating an + // indirect buffer and send a copy command to copy the exact particle count to this buffer: + if (!PK_VERIFY(output.m_CopyCommands.PushBack().Valid())) + return false; + + SRHICopyCommand ©Command = output.m_CopyCommands.Last(); + + // We retrieve the particles info buffer: + copyCommand.m_SrcBuffer = drStreamSizeBuffer; + PK_TODO("Retrieve the live count offset from the D3D11_ParticleStream"); + copyCommand.m_SrcOffset = 0; + copyCommand.m_DstBuffer = m_IndirectDraw.m_Buffer; + copyCommand.m_DstOffset = m_DrawCallCurrentOffset + PK_MEMBER_OFFSET(RHI::SDrawIndexedIndirectArgs, m_InstanceCount); + copyCommand.m_SizeToCopy = sizeof(u32); + + m_DrawCallCurrentOffset += sizeof(RHI::SDrawIndexedIndirectArgs); + + if (!PK_VERIFY(outDrawCall.m_PushConstants.PushBack().Valid())) + return false; + PK_STATIC_ASSERT(sizeof(Drawers::SBillboardDrawRequest) == sizeof(CFloat4)); + Drawers::SBillboardDrawRequest &desc = *reinterpret_cast(&outDrawCall.m_PushConstants.Last()); + desc.Setup(bbRequest); + + // GPUBillboardPushConstants + if (!PK_VERIFY(outDrawCall.m_PushConstants.PushBack().Valid())) + return false; + SVertexBillboardingConstants &indices = *reinterpret_cast(&outDrawCall.m_PushConstants.Last()); + indices.m_IndicesOffset = toEmit.m_IndexOffset; + indices.m_StreamOffsetsIndex = dri; + } + } + return true; +} +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::_IssueDrawCall_Billboard_CPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_ASSERT(!m_GPUStorage); + + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::EmitDrawCall Billboard (CPU)"); + + // Draw calls are not issued inline here, but later in PK-SampleLib's render loop + // _CreateDrawCalls outputs a new pushed draw call that will be processed later (in SRHIDrawOutputs) + + // All draw requests are compatible, we can take the first one as reference + const Drawers::SBillboard_DrawRequest *dr = static_cast(toEmit.m_DrawRequests.First()); + const u32 shaderOptions = PKSample::Option_VertexPassThrough | _GetVertexBillboardShaderOptions(dr->m_BB); + + if (!_UpdateConstantSetsIFN_CPU(ctx.ApiManager(), toEmit, shaderOptions)) + { + CLog::Log(PK_ERROR, "Failed to update constant sets for draw call"); + return false; + } + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(ctx, toEmit, output, SRHIDrawCall::DrawCall_IndexedInstanced, shaderOptions); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + + // A single vertex buffer is used for the instanced draw: the texcoords buffer, contains the direction in which vertices should be expanded + PK_ASSERT(m_TexCoords.Used()); + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_TexCoords.m_Buffer).Valid())) + return false; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Texcoords] = m_TexCoords.m_Buffer; + +#if (PK_HAS_PARTICLES_SELECTION != 0) + if (m_Selections.Used() && (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected())) + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = m_Selections.m_Buffer; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + // Editor only: for debugging purposes, we'll remove that from samples code later + { + if (m_DrawRequests.Used()) + outDrawCall.m_UBSemanticsPtr[SRHIDrawCall::UBSemantic_GPUBillboard] = m_DrawRequests.m_Buffer; + } + + // Setup the draw call description + { + outDrawCall.m_IndexOffset = 0; + outDrawCall.m_VertexCount = m_CapsulesDC ? 6 : 4; + outDrawCall.m_IndexCount = m_CapsulesDC ? 12 : 6; + outDrawCall.m_InstanceCount = toEmit.m_TotalParticleCount; + outDrawCall.m_IndexSize = RHI::IndexBuffer16Bit; + outDrawCall.m_IndexBuffer = m_DrawIndices.m_Buffer; + + // GPUBillboardPushConstants + if (!PK_VERIFY(outDrawCall.m_PushConstants.PushBack().Valid())) + return false; + u32 &indexOffset = *reinterpret_cast(&outDrawCall.m_PushConstants.Last()); + indexOffset = toEmit.m_IndexOffset; + + PK_ASSERT(m_DrawIndices.Used()); + + // Editor only: for debugging purposes, we'll remove that from samples code later + { + // TODO: We only support a single view right now + PK_ASSERT(m_Indices.Used() || (!m_PerViewBuffers.Empty() && m_PerViewBuffers[0].m_Indices.Used())); // Currently, we must have one valid indices raw buffer + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Indices] = m_Indices.Used() ? m_Indices.m_Buffer : m_PerViewBuffers[0].m_Indices.m_Buffer; + + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Position] = m_Positions.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Size] = m_Sizes.Used() ? m_Sizes.m_Buffer : m_Sizes2.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Rotation] = m_Rotations.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Axis0] = m_Axis0s.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Axis1] = m_Axis1s.m_Buffer; + + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (!m_AdditionalFields[i].m_Buffer.Used()) + continue; + + // Editor only: for debugging purposes, we'll remove that from samples code later + if (m_AdditionalFields[i].m_Semantic == SRHIDrawCall::DebugDrawGPUBuffer_Color) + { + PK_ASSERT(outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] == null); + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = m_AdditionalFields[i].m_Buffer.m_Buffer; + } + } + } + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::_IssueDrawCall_Triangle_CPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_ASSERT(!m_GPUStorage); + + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::_IssueDrawCall_Triangle_CPU Triangle (CPU)"); + + const u32 shaderOptions = PKSample::Option_VertexPassThrough | PKSample::Option_TriangleVertexBillboarding; + + if (!_UpdateConstantSetsIFN_CPU(ctx.ApiManager(), toEmit, shaderOptions)) + { + CLog::Log(PK_ERROR, "Failed to update constant sets for draw call"); + return false; + } + + // TODO : Use DrawCall_Instanced when RHI supports it + SRHIDrawCall *_outDrawCall = _CreateDrawCall(ctx, toEmit, output, SRHIDrawCall::DrawCall_IndexedInstanced, shaderOptions); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + +#if (PK_HAS_PARTICLES_SELECTION != 0) + if (m_Selections.Used() && (ctx.Selection().HasParticlesSelected() || ctx.Selection().HasRendersSelected())) + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_IsParticleSelected] = m_Selections.m_Buffer; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + if (m_DrawRequests.Used()) + outDrawCall.m_UBSemanticsPtr[SRHIDrawCall::UBSemantic_GPUBillboard] = m_DrawRequests.m_Buffer; + + // Setup the draw call description + { + outDrawCall.m_IndexOffset = 0; + outDrawCall.m_VertexCount = 3; + outDrawCall.m_IndexCount = 3; + outDrawCall.m_InstanceCount = toEmit.m_TotalParticleCount; + + // FIXME: Remove this when the RHI supports DrawCall_Instanced + outDrawCall.m_IndexSize = RHI::IndexBuffer16Bit; + outDrawCall.m_IndexBuffer = m_DrawIndices.m_Buffer; + + // GPUBillboardPushConstants + if (!PK_VERIFY(outDrawCall.m_PushConstants.PushBack().Valid())) + return false; + u32 &indexOffset = *reinterpret_cast(&outDrawCall.m_PushConstants.Last()); + indexOffset = toEmit.m_IndexOffset; + + PK_ASSERT(m_DrawIndices.Used()); + + // Editor only: for debugging purposes, we'll remove that from samples code later + { + // TODO: We only support a single view right now + PK_ASSERT(m_Indices.Used() || (!m_PerViewBuffers.Empty() && m_PerViewBuffers[0].m_Indices.Used())); // Currently, we must have one valid indices raw buffer + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Indices] = m_Indices.Used() ? m_Indices.m_Buffer : m_PerViewBuffers[0].m_Indices.m_Buffer; + + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_VertexPosition0] = m_VertexPositions0.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_VertexPosition1] = m_VertexPositions1.m_Buffer; + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_VertexPosition2] = m_VertexPositions2.m_Buffer; + + for (u32 i = 0; i < m_AdditionalFields.Count(); ++i) + { + if (!m_AdditionalFields[i].m_Buffer.Used()) + continue; + + // Editor only: for debugging purposes, we'll remove that from samples code later + if (m_AdditionalFields[i].m_Semantic == SRHIDrawCall::DebugDrawGPUBuffer_Color) + { + PK_ASSERT(outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] == null); + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = m_AdditionalFields[i].m_Buffer.m_Buffer; + } + } + } + } + return true; +} + +//---------------------------------------------------------------------------- + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) +bool CRHIBillboardingBatchPolicy_Vertex::_IssueDrawCall_Ribbon_GPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_ASSERT(m_GPUStorage); + PK_ASSERT(m_DrawIndices.Used()); + + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::EmitDrawCall Ribbon (GPU)"); + + // Draw calls are not issued inline here, but later in PK-SampleLib's render loop + // _CreateDrawCalls outputs a new pushed draw call that will be processed later (in SRHIDrawOutputs) + RHI::PApiManager manager = ctx.ApiManager(); + + // !Currently, there is no batching for gpu particles! + // So we'll emit one draw call per draw request + const u32 drCount = toEmit.m_DrawRequests.Count(); + + u32 computePerDrawRequest = 0; + + // Create compute sort key constant sets + { + // For camera sort, if needed + if (m_NeedGPUSort) + { + // Create compute sort key constant set + if (drCount != m_ComputeCameraSortKeysConstantSets.Count()) + { + if (!PK_VERIFY(m_ComputeCameraSortKeysConstantSets.Resize(drCount))) + return false; + RHI::SConstantSetLayout layout; + PKSample::CreateComputeSortKeysConstantSetLayout(layout, m_SortByCameraDistance, true); + for (auto &constantSet : m_ComputeCameraSortKeysConstantSets) + constantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Camera Sort Keys Constant Set"), layout); + } + computePerDrawRequest += 3 * 16 / 4 + 1; // 3 steps 4 bits radix sort, 16 bits key, plus 1 dispatch to generate the sort key + } + // For ribbon sort + { + if (drCount != m_ComputeRibbonSortKeysConstantSets.Count()) + { + if (!PK_VERIFY(m_ComputeRibbonSortKeysConstantSets.Resize(drCount))) + return false; + RHI::SConstantSetLayout layout; + PKSample::CreateComputeRibbonSortKeysConstantSetLayout(layout); + for (auto &constantSet : m_ComputeRibbonSortKeysConstantSets) + constantSet = manager->CreateConstantSet(RHI::SRHIResourceInfos("Ribbon Sort Keys Constant Set"), layout); + } + computePerDrawRequest += 3 * 44 / 4 + 1; // 3 steps base 16 radix sort, 44 bits key, plus 1 dispatch to generate the sort key + } + if (!PK_VERIFY(output.m_ComputeDispatchs.Reserve(drCount * computePerDrawRequest))) + return false; + } + + for (u32 dri = 0; dri < drCount; ++dri) + { + PK_ASSERT(toEmit.m_DrawRequests[dri] != null); + const Drawers::SRibbon_DrawRequest *dr = static_cast(toEmit.m_DrawRequests[dri]); + const Drawers::SRibbon_BillboardingRequest &bbRequest = dr->m_BB; + const CParticleStreamToRender *streamToRender = &dr->StreamToRender(); + + RHI::PGpuBuffer drStreamBuffer; + RHI::PGpuBuffer drStreamSizeBuffer; + +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + if (streamToRender->StorageClass() == CParticleStorageManager_D3D11::DefaultStorageClass()) + { + const CParticleStreamToRender_D3D11 *streamsToRender = static_cast(streamToRender); + const SBuffer_D3D11 &streamBuffer = streamsToRender->StreamBuffer(); + const SBuffer_D3D11 &streamSizeBuffer = streamsToRender->StreamSizeBuf(); + + if (PK_VERIFY(!streamBuffer.Empty()) && PK_VERIFY(!streamSizeBuffer.Empty())) // We have valid sim data and particle count buffers + { + drStreamBuffer = CastD3D11(manager)->D3D11GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), streamBuffer.m_Buffer, RHI::RawBuffer); + drStreamSizeBuffer = CastD3D11(manager)->D3D11GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), streamSizeBuffer.m_Buffer, RHI::RawVertexBuffer); + } + } +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + if (streamToRender->StorageClass() == CParticleStorageManager_D3D12::DefaultStorageClass()) + { + const CParticleStreamToRender_D3D12 *streamsToRender = static_cast(streamToRender); + const SBuffer_D3D12 &streamBuffer = streamsToRender->StreamBuffer(); + const SBuffer_D3D12 &streamSizeBuffer = streamsToRender->StreamSizeBuf(); + + if (PK_VERIFY(!streamBuffer.Empty()) && PK_VERIFY(!streamSizeBuffer.Empty())) // We have valid sim data and particle count buffers + { + drStreamBuffer = CastD3D12(manager)->D3D12GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), streamBuffer.m_Resource, RHI::RawBuffer, streamBuffer.m_State); + drStreamSizeBuffer = CastD3D12(manager)->D3D12GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), streamSizeBuffer.m_Resource, RHI::RawVertexBuffer, streamSizeBuffer.m_State); + } + } +#endif +#if (PK_PARTICLES_UPDATER_USE_UNKNOWN2 != 0) + if (streamToRender->StorageClass() == CParticleStorageManager_UNKNOWN2::DefaultStorageClass()) + { + const CParticleStreamToRender_UNKNOWN2 *streamsToRender = static_cast(streamToRender); + const SBuffer_UNKNOWN2 &streamBuffer = streamsToRender->StreamBuffer(); + const SBuffer_UNKNOWN2 &streamSizeBuffer = streamsToRender->StreamSizeBuf(); + + if (PK_VERIFY(!streamBuffer.Empty()) && PK_VERIFY(!streamSizeBuffer.Empty())) // We have valid sim data and particle count buffers + { + drStreamBuffer = CastUNKNOWN2(manager)->UNKNOWN2GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Data Buffer"), streamBuffer.m_Resource, streamBuffer.m_ByteSize, RHI::RawBuffer); + drStreamSizeBuffer = CastUNKNOWN2(manager)->UNKNOWN2GetGpuBufferFromExisting(RHI::SRHIResourceInfos("Stream Infos Buffer"), streamSizeBuffer.m_Resource, streamBuffer.m_ByteSize, RHI::RawVertexBuffer); + } + } +#endif + if (!PK_VERIFY(drStreamBuffer != null) || + !PK_VERIFY(drStreamSizeBuffer != null)) + return false; + + // Ribbon GPU sort + { + CRendererCacheInstance_UpdateThread *renderCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + PKSample::PCRendererCacheInstance rCacheInstance = renderCacheInstance->RenderThread_GetCacheInstance(); + if (rCacheInstance == null) + return false; + + // Compute: Compute sort keys and init indirection buffer + { + // For radix sort, a thread computes 2 keys (see shader definition and RHIGPUSorter.cpp), + // so a group computes (PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE) keys + // It also counts enabled particles and writes the indirectDraw. + + const u32 sortGroupCount = (dr->RenderedParticleCount() + PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE - 1) / (PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE); + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + RHI::PConstantSet computeConstantSet = m_ComputeRibbonSortKeysConstantSets[dri]; + computeConstantSet->SetConstants(drStreamSizeBuffer, 0); + computeConstantSet->SetConstants(drStreamBuffer, 1); + computeConstantSet->SetConstants(m_SimStreamOffsets_SelfIDs.m_Buffer, 2); + computeConstantSet->SetConstants(m_SimStreamOffsets_ParentIDs.m_Buffer, 3); + computeConstantSet->SetConstants(m_SimStreamOffsets_Enableds.m_Buffer, 4); + computeConstantSet->SetConstants(m_RibbonSortKeys[dri].m_Buffer, 5); + computeConstantSet->SetConstants(m_RibbonSortIndirection[dri].m_Buffer, 6); + computeConstantSet->SetConstants(m_IndirectDraw.m_Buffer, 7); + + computeConstantSet->UpdateConstantValues(); + computeDispatch.m_ConstantSet = computeConstantSet; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = dri; + + // State + const PKSample::EComputeShaderType type = ComputeType_ComputeRibbonSortKeys; + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + if (!PK_VERIFY(computeDispatch.m_State != null)) + return false; + + // Dispatch args + // For the sort key computation dispatch, we need exactly PK_GPU_SORT_NUM_KEY_PER_THREAD the sort group count + // so that every thread associated key is initialized. Overflowing keys are initialized + // to 0xFFFF, sorted last (and ultimately not rendered). + computeDispatch.m_ThreadGroups = CInt3(sortGroupCount * PK_GPU_SORT_NUM_KEY_PER_THREAD, 1, 1); + + if (!PK_VERIFY(output.m_ComputeDispatchs.PushBack(computeDispatch).Valid())) + return false; + } + + // Compute: Sort computes + { + m_RibbonGPUSorters[dri].SetInOutBuffers(m_RibbonSortKeys[dri].m_Buffer, m_RibbonSortIndirection[dri].m_Buffer); + m_RibbonGPUSorters[dri].AppendDispatchs(rCacheInstance, output.m_ComputeDispatchs); + } + } + + // Camera GPU sort (must be done after the ribbon GPU sort) + if (m_NeedGPUSort) + { + CRendererCacheInstance_UpdateThread *renderCacheInstance = static_cast(toEmit.m_RendererCaches.First().Get()); + PKSample::PCRendererCacheInstance rCacheInstance = renderCacheInstance->RenderThread_GetCacheInstance(); + if (rCacheInstance == null) + return false; + + // Compute: Compute sort keys and init indirection buffer + { + // For radix sort, a thread computes PK_GPU_SORT_NUM_KEY_PER_THREAD keys (see shader definition and RHIGPUSorter.cpp), + // so a group computes (PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE) keys + const u32 sortGroupCount = (dr->RenderedParticleCount() + PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE - 1) / (PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE); + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + computeDispatch.m_NeedSceneInfoConstantSet = m_SortByCameraDistance; + RHI::PConstantSet computeConstantSet = m_ComputeCameraSortKeysConstantSets[dri]; + computeConstantSet->SetConstants(drStreamSizeBuffer, 0); + computeConstantSet->SetConstants(drStreamBuffer, 1); + computeConstantSet->SetConstants(m_SortByCameraDistance ? m_SimStreamOffsets_Positions.m_Buffer : m_CustomSortKeysOffsets.m_Buffer, 2); + computeConstantSet->SetConstants(m_RibbonSortIndirection[dri].m_Buffer, 3); + computeConstantSet->SetConstants(m_IndirectDraw.m_Buffer, 4); + computeConstantSet->SetConstants(m_CameraSortKeys[dri].m_Buffer, 5); + computeConstantSet->SetConstants(m_CameraSortIndirection[dri].m_Buffer, 6); + + computeConstantSet->UpdateConstantValues(); + computeDispatch.m_ConstantSet = computeConstantSet; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = dri; + + // State + const PKSample::EComputeShaderType type = m_SortByCameraDistance ? ComputeType_ComputeSortKeys_CameraDistance_RibbonIndirection : ComputeType_ComputeSortKeys_RibbonIndirection; + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + if (!PK_VERIFY(computeDispatch.m_State != null)) + return false; + + // Dispatch args + // For the sort key computation dispatch, we need exactly PK_GPU_SORT_NUM_KEY_PER_THREAD the sort group count + // so that every thread associated key is initialized. Overflowing keys are initialized + // to 0xFFFF, sorted last (and ultimately not rendered). + computeDispatch.m_ThreadGroups = CInt3(sortGroupCount * PK_GPU_SORT_NUM_KEY_PER_THREAD, 1, 1); + + output.m_ComputeDispatchs.PushBack(computeDispatch); + } + + // Compute: Sort computes + { + m_CameraGPUSorters[dri].SetInOutBuffers(m_CameraSortKeys[dri].m_Buffer, m_CameraSortIndirection[dri].m_Buffer); + m_CameraGPUSorters[dri].AppendDispatchs(rCacheInstance, output.m_ComputeDispatchs); + } + } + + // Emit draw call + { + const u32 shaderOptions = _GetVertexRibbonShaderOptions(bbRequest); + const RHI::PGpuBuffer ribbonSortIndirection = m_RibbonSortIndirection[dri].m_Buffer; + const RHI::PGpuBuffer cameraSortIndirection = m_NeedGPUSort ? m_CameraSortIndirection[dri].m_Buffer : null; + + if (!_UpdateConstantSetsIFN_GPU(ctx.ApiManager(), toEmit, drStreamBuffer, cameraSortIndirection, ribbonSortIndirection, shaderOptions)) + return false; + + SRHIDrawCall *_outDrawCall = _CreateDrawCall(ctx, toEmit, output, SRHIDrawCall::DrawCall_IndexedInstancedIndirect, shaderOptions); + if (!PK_VERIFY(_outDrawCall != null)) + { + CLog::Log(PK_ERROR, "Failed to create a draw-call"); + return false; + } + + SRHIDrawCall &outDrawCall = *_outDrawCall; + + // A single vertex buffer is used for the instanced draw: the texcoords buffer, contains the direction in which vertices should be expanded + PK_ASSERT(m_TexCoords.Used()); + if (!PK_VERIFY(outDrawCall.m_VertexBuffers.PushBack(m_TexCoords.m_Buffer).Valid())) + return false; + + // Editor only: for debugging purposes, we'll remove that from samples code later + { + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Texcoords] = m_TexCoords.m_Buffer; + // Unused by debug rendering: + outDrawCall.m_DebugDrawGPUBuffers[SRHIDrawCall::DebugDrawGPUBuffer_Color] = m_ColorStreamId.Valid() ? m_TexCoords.m_Buffer : null; + } + + outDrawCall.m_IndexOffset = 0; + outDrawCall.m_IndexSize = RHI::IndexBuffer16Bit; + outDrawCall.m_IndexBuffer = m_DrawIndices.m_Buffer; + + outDrawCall.m_IndirectBuffer = m_IndirectDraw.m_Buffer; + outDrawCall.m_IndirectBufferOffset = m_DrawCallCurrentOffset; + outDrawCall.m_EstimatedParticleCount = dr->RenderedParticleCount(); + + if (!PK_VERIFY(output.m_CopyCommands.PushBack().Valid())) + return false; + + SRHICopyCommand ©Command = output.m_CopyCommands.Last(); + + // We retrieve the particles info buffer: + copyCommand.m_SrcBuffer = drStreamSizeBuffer; + PK_TODO("Retrieve the live count offset from the D3D12_ParticleStream"); + copyCommand.m_SrcOffset = 0; + copyCommand.m_DstBuffer = m_IndirectDraw.m_Buffer; + copyCommand.m_DstOffset = m_DrawCallCurrentOffset + PK_MEMBER_OFFSET(RHI::SDrawIndexedIndirectArgs, m_InstanceCount); + copyCommand.m_SizeToCopy = sizeof(u32); + + m_DrawCallCurrentOffset += sizeof(RHI::SDrawIndexedIndirectArgs); + + // Ribbon GPU billboarding info: constains billboarding mode and normal bending factor. + // No batching with GPU storage, so here this is constant within a drawcall (uses push constant). + if (!PK_VERIFY(outDrawCall.m_PushConstants.PushBack().Valid())) + return false; + PK_STATIC_ASSERT(sizeof(Drawers::SRibbonDrawRequest) == sizeof(CFloat4)); + Drawers::SRibbonDrawRequest &desc = *reinterpret_cast(&outDrawCall.m_PushConstants.Last()); + desc.Setup(bbRequest); + + // GPUBillboardPushConstants + if (!PK_VERIFY(outDrawCall.m_PushConstants.PushBack().Valid())) + return false; + SVertexBillboardingConstants &indices = *reinterpret_cast(&outDrawCall.m_PushConstants.Last()); + indices.m_IndicesOffset = toEmit.m_IndexOffset; + indices.m_StreamOffsetsIndex = dri; + } + } + return true; +} +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + +//---------------------------------------------------------------------------- + +bool CRHIBillboardingBatchPolicy_Vertex::EmitDrawCall(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output) +{ + PK_NAMEDSCOPEDPROFILE("CRHIBillboardingBatchPolicy_Vertex::EmitDrawCall"); + + PK_ASSERT(toEmit.m_TotalParticleCount <= m_TotalParticleCount); // <= if slicing is enabled + PK_ASSERT(toEmit.m_TotalIndexCount <= m_TotalParticleCount); + PK_ASSERT(!toEmit.m_DrawRequests.Empty()); + PK_ASSERT(toEmit.m_DrawRequests.First() != null); + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + const bool gpuStorage = toEmit.m_DrawRequests.First()->StreamToRender_MainMemory() == null; + PK_ASSERT(gpuStorage == m_GPUStorage); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + const u32 dcCount = output.m_DrawCalls.Count(); + bool success = false; + + switch (toEmit.m_Renderer) + { + case Renderer_Billboard: + PK_ASSERT(toEmit.m_TotalVertexCount > 0 && toEmit.m_TotalIndexCount > 0); + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + if (gpuStorage) + success = _IssueDrawCall_Billboard_GPU(ctx, toEmit, output); + else +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + success = _IssueDrawCall_Billboard_CPU(ctx, toEmit, output); + break; + case Renderer_Triangle: + PK_ASSERT(toEmit.m_TotalVertexCount > 0); + success = _IssueDrawCall_Triangle_CPU(ctx, toEmit, output); + break; +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + case Renderer_Ribbon: + PK_ASSERT(gpuStorage); + success = _IssueDrawCall_Ribbon_GPU(ctx, toEmit, output); + break; +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + default: + PK_ASSERT_NOT_REACHED(); + break; + } + + // Invalidate all draw-calls from this policy if any of them was not created properly: + if (!success) + { + const u32 newDcCount = output.m_DrawCalls.Count(); + + for (u32 i = dcCount; i < newDcCount; ++i) + { + output.m_DrawCalls[i].m_Valid = false; + output.m_DrawCalls[i].m_RendererCacheInstance = null; + } + } + return success; +} + +//---------------------------------------------------------------------------- + +void CRHIBillboardingBatchPolicy_Vertex::ClearBuffers(SRenderContext &ctx) +{ + (void)ctx; + // This only gets called when a new frame has been collected (so before starting billboarding) + // Clear here only resets the m_UsedThisFrame flags, it is not a proper clear as we want to avoid vbuffer resizing/allocations: + // Batches (and their policy) can be reused for various renderers (no matter the layer), + // so we ensure to bind the correct gpu buffers for draw calls. + // It is up to you to find a proper gpu buffer pooling solution for particles and how/when to clear them + + m_Indices.Clear(); + m_DrawRequests.Clear(); + m_Positions.Clear(); + m_Sizes.Clear(); + m_Sizes2.Clear(); + m_Rotations.Clear(); + m_Axis0s.Clear(); + m_Axis1s.Clear(); + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + m_IndirectDraw.Clear(); + + m_SimStreamOffsets_Enableds.Clear(); + m_SimStreamOffsets_Positions.Clear(); + m_SimStreamOffsets_Sizes.Clear(); + m_SimStreamOffsets_Size2s.Clear(); + m_SimStreamOffsets_Rotations.Clear(); + m_SimStreamOffsets_Axis0s.Clear(); + m_SimStreamOffsets_Axis1s.Clear(); + m_SimStreamOffsets_ParentIDs.Clear(); + m_SimStreamOffsets_SelfIDs.Clear(); + + for (SGpuBuffer &buffer : m_SimStreamOffsets_AdditionalInputs) + buffer.Clear(); + + m_CustomSortKeysOffsets.Clear(); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + // Additional inputs: + for (SAdditionalInputs &input : m_AdditionalFields) + input.m_Buffer.Clear(); + + // View dependent inputs: + for (SPerView &view : m_PerViewBuffers) + view.m_Indices.Clear(); +} + +//---------------------------------------------------------------------------- + +void CRHIBillboardingBatchPolicy_Vertex::_ClearFrame(u32 activeViewCount) +{ + // Here we only clear the values that are changing from one frame to another. + // Most of the gpu buffers will stay the same + m_CapsulesDC = false; + m_TotalParticleCount = 0; + m_TotalParticleCount_OverEstimated = 0; + m_TotalIndexCount = 0; + m_DrawRequestCount = 0; + m_IndexSize = 0; + m_TotalBBox = CAABB::DEGENERATED; + PK_VERIFY(m_PerViewBuffers.Resize(activeViewCount)); + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + m_MappedIndirectBuffer = null; + m_MappedSimStreamOffsets_Enableds = null; + m_MappedSimStreamOffsets_Positions = null; + m_MappedSimStreamOffsets_Sizes = null; + m_MappedSimStreamOffsets_Size2s = null; + m_MappedSimStreamOffsets_Rotations = null; + m_MappedSimStreamOffsets_Axis0s = null; + m_MappedSimStreamOffsets_Axis1s = null; + for (u32 i = 0; i < m_MappedSimStreamOffsets_AdditionalInputs.Count(); ++i) + m_MappedSimStreamOffsets_AdditionalInputs[i] = null; + m_MappedSimStreamOffsets_ParentIDs = null; + m_MappedSimStreamOffsets_SelfIDs = null; + m_MappedCustomSortKeysOffsets = null; +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + m_GPUBuffers.Clear(); + PK_VERIFY(m_GPUBuffers.Reserve(0x10)); // Reserved, memory not cleared +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy_Vertex.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy_Vertex.h new file mode 100644 index 00000000..4d40fd1c --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy_Vertex.h @@ -0,0 +1,243 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" + +#include +#include + +#include "PK-SampleLib/RenderIntegrationRHI/RendererCache.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHITypePolicy.h" +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) +#include "PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.h" +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + +#include "RHICustomTasks.h" + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CRHIParticleRenderDataFactory; + +class CRHIBillboardingBatchPolicy_Vertex +{ +public: + CRHIBillboardingBatchPolicy_Vertex(); + ~CRHIBillboardingBatchPolicy_Vertex(); + + // Return true if this draw request can be rendered (this gets called per batches when the frame collector is in BeginCollectingDrawCalls() and EndCollectingDrawCalls()) + // Return false if you want to discard this draw request and handle it later + // request and renderer cache are the firsts from their batch + static bool CanRender(const Drawers::SBillboard_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + static bool CanRender(const Drawers::SRibbon_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx); + static bool CanRender(const Drawers::SMesh_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) { (void)request; (void)rendererCache; (void)ctx; PK_ASSERT_NOT_REACHED(); return false; } + static bool CanRender(const Drawers::STriangle_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext & ctx); + static bool CanRender(const Drawers::SLight_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) { (void)request; (void)rendererCache; (void)ctx; PK_ASSERT_NOT_REACHED(); return false; } + static bool CanRender(const Drawers::SSound_DrawRequest *request, const PRendererCacheBase &rendererCache, SRenderContext &ctx) { (void)request; (void)rendererCache; (void)ctx; PK_ASSERT_NOT_REACHED(); return false; } + + // Whether this billboarding batch policy can be re-used by incompatible renderer caches (see CHM documentation for more detail) + // For example: light renderer billboarding batch policies could return true + static bool IsStateless() { return false; } + + // Return false when this billboarding batch policy should be destroyed (ie. nothing was drawn after 10 ticks) + bool Tick(SRenderContext &ctx, const TMemoryView &views); + + // Called via BeginCollectingDrawCalls() for all render data batches + bool AllocBuffers(SRenderContext &ctx, const SBuffersToAlloc &allocBuffers, const TMemoryView &views, ERendererClass rendererType); + + // Called to map necessary buffers for tasks + // Only map buffers necessary buffers descripted in SGeneratedInputs + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SBillboardBatchJobs *billboardBatch, const SGeneratedInputs &toMap) { (void)ctx; (void)views; (void)billboardBatch; (void)toMap; PK_ASSERT_NOT_REACHED(); return false; } + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPUBillboardBatchJobs *billboardVertexBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPURibbonBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SRibbonBatchJobs *billboardBatch, const SGeneratedInputs &toMap) { (void)ctx; (void)views; (void)billboardBatch; (void)toMap; PK_ASSERT_NOT_REACHED(); return false; } + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SMeshBatchJobs *billboardBatch, const SGeneratedInputs &toMap) { (void)ctx; (void)views; (void)billboardBatch; (void)toMap; PK_ASSERT_NOT_REACHED(); return false; } + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, STriangleBatchJobs *billboardBatch, const SGeneratedInputs &toMap) { (void)ctx; (void)views; (void)billboardBatch; (void)toMap; PK_ASSERT_NOT_REACHED(); return false; } + bool MapBuffers(SRenderContext &ctx, const TMemoryView &views, SGPUTriangleBatchJobs *billboardBatch, const SGeneratedInputs &toMap); + + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *billboardVertexBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *billboardBatch) { (void)ctx; (void)drawRequests; (void)billboardBatch; PK_ASSERT_NOT_REACHED(); return false; } + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *ribbonVertexBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CRibbon_CPU *ribbonBatch) { (void)ctx; (void)drawRequests; (void)ribbonBatch; PK_ASSERT_NOT_REACHED(); return false; } + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CMesh_CPU *meshBatch) { (void)ctx; (void)drawRequests; (void)meshBatch; PK_ASSERT_NOT_REACHED(); return false; } + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CTriangle_CPU *triangleBatch) { (void)ctx; (void)drawRequests; (void)triangleBatch; PK_ASSERT_NOT_REACHED(); return false; } + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CCopyStream_CPU *triangleVertexBatch); + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *batch) { (void)ctx; (void)drawRequests; (void)batch; PK_ASSERT_NOT_REACHED(); return false; } + bool LaunchCustomTasks(SRenderContext &ctx, const TMemoryView &drawRequests, Drawers::CBillboard_CPU *batch) { (void)ctx; (void)drawRequests; (void)batch; PK_ASSERT_NOT_REACHED(); return false; } + + bool WaitForCustomTasks(SRenderContext &ctx) { (void)ctx; return true; } + + bool UnmapBuffers(SRenderContext &ctx); + void ClearBuffers(SRenderContext &ctx); + + bool AreBillboardingBatchable(const PCRendererCacheBase &firstCache, const PCRendererCacheBase &secondCache) const; + + // By default, draw calls are submit back to front based on their bounding boxes (see EDrawCallSortMethod), for each view + // You can setup the frame collector to sort draw calls differently (ie. by sorting sliced draw calls or you can also disable sorting entirely) + bool EmitDrawCall(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + +private: + bool _AllocateVertexBBConstantSet(const RHI::PApiManager &manager); + bool _AllocateBuffers_Main(const RHI::PApiManager &manager, const SBuffersToAlloc &allocBuffers); + bool _AllocateBuffers_ViewDependent(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate); + bool _AllocateBuffers_AdditionalInputs(const RHI::PApiManager &manager, const SGeneratedInputs &toGenerate); + + u32 _GetVertexBillboardShaderOptions(const Drawers::SBillboard_BillboardingRequest &bbRequest); + u32 _GetVertexRibbonShaderOptions(const Drawers::SRibbon_BillboardingRequest &bbRequest); + bool _CreateOrResizeGpuBufferIf(const RHI::SRHIResourceInfos &infos, bool condition, const RHI::PApiManager &manager, SGpuBuffer &buffer, RHI::EBufferType type, u32 sizeToAlloc, u32 requiredSize, bool simDataField); + void _ClearFrame(u32 activeViewCount = 0); // Reset the batch for a new frame + + SRHIDrawCall *_CreateDrawCall(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output, SRHIDrawCall::EDrawCallType drawCallType, u32 shaderOptions); + bool _UpdateConstantSetsIFN_CPU(const RHI::PApiManager &manager, const SDrawCallDesc &toEmit, u32 shaderOptions); + bool _IssueDrawCall_Billboard_CPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + bool _AllocateBuffers_GPU(const RHI::PApiManager &manager, const SBuffersToAlloc &allocBuffers); + bool _UpdateConstantSetsIFN_GPU(const RHI::PApiManager &manager, const SDrawCallDesc &toEmit, const RHI::PGpuBuffer &drStreamBuffer, const RHI::PGpuBuffer &drCameraSortIndirection, const RHI::PGpuBuffer &drRibbonSortIndirection, u32 shaderOptions); + bool _IssueDrawCall_Billboard_GPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + bool _IssueDrawCall_Ribbon_GPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + bool _WriteGPUStreamsOffsets(const TMemoryView & drawRequests); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + bool _IssueDrawCall_Triangle_CPU(SRenderContext &ctx, const SDrawCallDesc &toEmit, SRHIDrawOutputs &output); + +#if (PK_HAS_PARTICLES_SELECTION != 0) + // Job to set a boolean as vertex input if the particle is selected: + CCopyStream_Exec_WireframeDiscard m_GeomBillboardCustomParticleSelectTask; + SGpuBuffer m_Selections; + RHI::PConstantSet m_SelectionConstantSet; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + //---------------------------------------------------------------------------- + // RHI buffers data: + //---------------------------------------------------------------------------- + + ERendererClass m_RendererType; + + bool m_Initialized; + bool m_CapsulesDC; + bool m_TubesDC; + bool m_MultiPlanesDC; + bool m_GpuBufferResizedOrCreated; + bool m_GPUStorage; + u32 m_ParticleQuadCount; +#if (PK_HAS_PARTICLES_SELECTION != 0) + bool m_SelectionsResizedOrCreated; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + CGuid m_ColorStreamId; + bool m_NeedGPUSort; + bool m_SortByCameraDistance; + + // Camera sort + TArray m_CameraGPUSorters; + + // Ribbon sort + TArray m_RibbonGPUSorters; + +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + u32 m_UnusedCounter; + u32 m_TotalParticleCount; + u32 m_TotalIndexCount; + u32 m_TotalParticleCount_OverEstimated; + u32 m_DrawRequestCount; + u32 m_IndexSize; + u32 m_ShaderOptions; + + CAABB m_TotalBBox; + + struct SPerView + { + u32 m_ViewIdx; + SGpuBuffer m_Indices; + }; + + // View dependent buffers: + TArray m_PerViewBuffers; + + SGpuBuffer m_DrawIndices; // DrawIndexed indices + SGpuBuffer m_TexCoords; // DrawIndexed texcoords + SGpuBuffer m_DrawRequests; // Draw requests buffer, for draw calls batching + SGpuBuffer m_Indices; // Generated indices for sorted particles + + // Collection of particle data of all active draw requests + SGpuBuffer m_Positions; + SGpuBuffer m_Sizes; + SGpuBuffer m_Sizes2; + SGpuBuffer m_Rotations; + SGpuBuffer m_Axis0s; + SGpuBuffer m_Axis1s; + + // for triangles + SGpuBuffer m_VertexPositions0; + SGpuBuffer m_VertexPositions1; + SGpuBuffer m_VertexPositions2; + + RHI::PConstantSet m_VertexBBSimDataConstantSet; // SRVs: Positions/Sizes/.. for CPU particles, GPUSimData for GPU particles + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + // Indirect draw buffer for GPU simulated particles + volatile RHI::SDrawIndexedIndirectArgs *m_MappedIndirectBuffer; + SGpuBuffer m_IndirectDraw; + u32 m_DrawCallCurrentOffset; + RHI::PConstantSet m_VertexBBOffsetsConstantSet; // (PositionsOffset, SizesOffset, ..) + + // Offsets for accessing each draw request gpu sim data streams + SGpuBuffer m_SimStreamOffsets_Enableds; + SGpuBuffer m_SimStreamOffsets_Positions; + SGpuBuffer m_SimStreamOffsets_Sizes; + SGpuBuffer m_SimStreamOffsets_Size2s; + SGpuBuffer m_SimStreamOffsets_Rotations; + SGpuBuffer m_SimStreamOffsets_Axis0s; + SGpuBuffer m_SimStreamOffsets_Axis1s; + TArray m_SimStreamOffsets_AdditionalInputs; + SGpuBuffer m_SimStreamOffsets_ParentIDs; + SGpuBuffer m_SimStreamOffsets_SelfIDs; + + // Mapped data + volatile u32 *m_MappedSimStreamOffsets_Enableds; + volatile u32 *m_MappedSimStreamOffsets_Positions; + volatile u32 *m_MappedSimStreamOffsets_Sizes; + volatile u32 *m_MappedSimStreamOffsets_Size2s; + volatile u32 *m_MappedSimStreamOffsets_Rotations; + volatile u32 *m_MappedSimStreamOffsets_Axis0s; + volatile u32 *m_MappedSimStreamOffsets_Axis1s; + TArray m_MappedSimStreamOffsets_AdditionalInputs; + volatile u32 *m_MappedSimStreamOffsets_ParentIDs; + volatile u32 *m_MappedSimStreamOffsets_SelfIDs; + volatile u32 *m_MappedCustomSortKeysOffsets; + + TArray m_CameraSortIndirection; + TArray m_CameraSortKeys; + + TArray m_RibbonSortIndirection; + TArray m_RibbonSortKeys; + + SGpuBuffer m_CustomSortKeysOffsets; + + TArray m_ComputeCameraSortKeysConstantSets; + TArray m_ComputeRibbonSortKeysConstantSets; + +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + + TArray m_GPUBuffers; // Used gpu buffers this frame + TArray m_AdditionalFields; + + // We need those temporary arrays to map data: + TArray m_MappedAdditionalFields; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHICustomTasks.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/RHICustomTasks.cpp new file mode 100644 index 00000000..0a89428e --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHICustomTasks.cpp @@ -0,0 +1,717 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "RHICustomTasks.h" + +#if (PK_HAS_PARTICLES_SELECTION != 0) + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +const float DebugColorGrey = 1.0f; +const float DebugColorWhite = 2.0f; +const float DebugColorRed = 3.0f; + +void CBillboard_Exec_WireframeDiscard::operator()(const Drawers::SBillboard_ExecPage &batch) +{ + if (m_DstSelectedParticles.Empty()) + return; + + PK_NAMEDSCOPEDPROFILE("CustomTasks CBillboard_Exec_WireframeDiscard"); + + const u32 vertexPerParticle = batch.m_Billboarder->BillboardVertexCount(); + + const u32 outCount = batch.m_Page->RenderedParticleCount(); + + Mem::Clear(&m_DstSelectedParticles[batch.m_VertexOffset], sizeof(float) * outCount * vertexPerParticle); + + TStridedMemoryView enableds = batch.m_Page->StreamForReading(batch.m_DrawRequest->BaseBillboardingRequest().m_EnabledStreamId); + const bool hasEnabled = batch.m_DrawRequest->InputParticleCount() != batch.m_DrawRequest->RenderedParticleCount(); + + if (batch.m_DrawRequest->RenderedParticleCount() == 0) + return; + + for (const auto &renderSelection : m_SrcParticleSelected.m_AllRendererSelectionsView) + { + if (renderSelection.m_Renderers.Contains(batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeRenderer())) + { + Mem::Fill32(&m_DstSelectedParticles[batch.m_VertexOffset], bit_cast(DebugColorGrey), outCount * vertexPerParticle); + } + } + + CGuid particleId_First; + + TMemoryView &srcSelection = m_SrcParticleSelected.m_AllParticleSelectionsView; + for (u32 i = 0; i < srcSelection.Count(); ++i) + { + if (batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeMedium() == srcSelection[i].m_Medium) + { + PK_ASSERT(!srcSelection[i].m_Ranges.Empty()); + // Remap the particle Id from the simulation (in) to the particle id in the rendering buffers (out) + u32 particleId_in = 0; + u32 particleId_out = 0; + + u32 offset = 0; + + for (u32 j = 0; j < srcSelection[i].m_Ranges.Count(); ++j) + { + if (batch.m_Page->PageIdxInMedium() == srcSelection[i].m_Ranges[j].m_PageId) + { + const u32 range_startId = srcSelection[i].m_Ranges[j].StartID(); + const u32 range_count = srcSelection[i].m_Ranges[j].Count(); + + u32 rangeOut_startId = range_startId; + u32 rangeOut_count = range_count; + if (hasEnabled) + { + PK_ASSERT(particleId_in <= range_startId); // Warning: it only works when "m_Ranges" are in ascending order and not overlapping. Otherwise, find another way !!! + while (particleId_in < range_startId) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_startId = particleId_out; + while (particleId_in < (range_startId + range_count)) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_count = (particleId_out - rangeOut_startId); + } + + if (rangeOut_count == 0) + continue; // TODO: if it goes here with j == 0, then the first particle won't be hightlighted ... + + const bool isFocusedMedium = (i == m_SrcParticleSelected.m_FocusedMedium); + if (isFocusedMedium && srcSelection[i].m_CurrentSelectedId - offset < rangeOut_count) + particleId_First = rangeOut_startId + srcSelection[i].m_CurrentSelectedId - offset; + + PK_ASSERT(rangeOut_startId + rangeOut_count <= outCount); // issue with mismatching between the current frame processed from frame-collector and the editor's selection input. + const u32 writeCount = (rangeOut_startId < outCount) ? PKMin(rangeOut_count, outCount - rangeOut_startId) : 0; + Mem::Fill32(&m_DstSelectedParticles[batch.m_VertexOffset + rangeOut_startId * vertexPerParticle], bit_cast((!m_SrcParticleSelected.m_FocusedMedium.Valid() || isFocusedMedium) ? DebugColorWhite : DebugColorGrey), writeCount * vertexPerParticle); + } + offset += srcSelection[i].m_Ranges[j].Count(); + } + } + } + + if (particleId_First.Valid() && particleId_First < outCount) + { + Mem::Fill32(&m_DstSelectedParticles[batch.m_VertexOffset + particleId_First * vertexPerParticle], bit_cast(DebugColorRed), vertexPerParticle); + } +} + +//---------------------------------------------------------------------------- + +void CCopyStream_Exec_WireframeDiscard::operator()(const Drawers::SCopyStream_ExecPage &batch) +{ + if (m_DstSelectedParticles.Empty()) + return; + + PK_NAMEDSCOPEDPROFILE("CustomTasks CCopyStream_Exec_WireframeDiscard"); + + const u32 outCount = batch.m_Page->RenderedParticleCount(); + + Mem::Clear(&m_DstSelectedParticles[batch.m_ParticleOffset], sizeof(float) * outCount); + + TStridedMemoryView enableds = batch.m_Page->StreamForReading(batch.m_DrawRequest->BaseBillboardingRequest().m_EnabledStreamId); + const bool hasEnabled = batch.m_DrawRequest->InputParticleCount() != batch.m_DrawRequest->RenderedParticleCount(); + + if (batch.m_DrawRequest->RenderedParticleCount() == 0) + return; + + for (const auto &renderSelection : m_SrcParticleSelected.m_AllRendererSelectionsView) + { + if (renderSelection.m_Renderers.Contains(batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeRenderer())) + { + Mem::Fill32(&m_DstSelectedParticles[batch.m_ParticleOffset], bit_cast(DebugColorGrey), outCount); + } + } + + CGuid particleId_First; + + // Build the array of particle ranges for this page: + TMemoryView &srcSelection = m_SrcParticleSelected.m_AllParticleSelectionsView; + for (u32 i = 0; i < srcSelection.Count(); ++i) + { + if (batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeMedium() == srcSelection[i].m_Medium) + { + PK_ASSERT(!srcSelection[i].m_Ranges.Empty()); + // Remap the particle Id from the simulation (in) to the particle id in the rendering buffers (out) + u32 particleId_in = 0; + u32 particleId_out = 0; + + u32 offset = 0; + + for (u32 j = 0; j < srcSelection[i].m_Ranges.Count(); ++j) + { + if (batch.m_Page->PageIdxInMedium() == srcSelection[i].m_Ranges[j].m_PageId) + { + const u32 range_startId = srcSelection[i].m_Ranges[j].StartID(); + const u32 range_count = srcSelection[i].m_Ranges[j].Count(); + + u32 rangeOut_startId = range_startId; + u32 rangeOut_count = range_count; + if (hasEnabled) + { + PK_ASSERT(particleId_in <= range_startId); // Warning: it only works when "m_Ranges" are in ascending order and not overlapping. Otherwise, find another way !!! + while (particleId_in < range_startId) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_startId = particleId_out; + while (particleId_in < (range_startId + range_count)) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_count = (particleId_out - rangeOut_startId); + } + + if (rangeOut_count == 0) + continue; // TODO: if it goes here with j == 0, then the first particle won't be hightlighted ... + + const bool isFocusedMedium = (i == m_SrcParticleSelected.m_FocusedMedium); + if (isFocusedMedium && srcSelection[i].m_CurrentSelectedId - offset < rangeOut_count) + particleId_First = rangeOut_startId + srcSelection[i].m_CurrentSelectedId - offset; + + PK_ASSERT(rangeOut_startId + rangeOut_count <= outCount); // issue with mismatching between the current frame processed from frame-collector and the editor's selection input. + const u32 writeCount = (rangeOut_startId < outCount) ? PKMin(rangeOut_count, outCount - rangeOut_startId) : 0; + Mem::Fill32(&m_DstSelectedParticles[batch.m_ParticleOffset + rangeOut_startId], bit_cast((!m_SrcParticleSelected.m_FocusedMedium.Valid() || isFocusedMedium) ? DebugColorWhite : DebugColorGrey), writeCount); + } + offset += srcSelection[i].m_Ranges[j].Count(); + } + } + } + + if (particleId_First.Valid() && particleId_First < outCount) + { + m_DstSelectedParticles[batch.m_ParticleOffset + particleId_First] = DebugColorRed; + } +} + +//---------------------------------------------------------------------------- + +void CRibbon_Exec_WireframeDiscard::operator()(const Drawers::SRibbon_ExecBatch &ribbonData) +{ + if (m_DstSelectedParticles.Empty()) + return; + + PK_NAMEDSCOPEDPROFILE("CustomTasks CRibbon_Exec_WireframeDiscard"); + + PK_ASSERT(ribbonData.FullVertexOffset() + ribbonData.m_VertexCount <= m_DstSelectedParticles.Count()); + + const u32 outCount = ribbonData.m_DrawRequest->m_DrawRequest->RenderedParticleCount(); + + Mem::Clear(&m_DstSelectedParticles[ribbonData.FullVertexOffset()], sizeof(float) * ribbonData.m_VertexCount); + + if (outCount == 0) + return; + + const Drawers::SRibbon_CPU_DrawRequest *dr = ribbonData.m_DrawRequest; + PK_ASSERT(dr->m_RibbonSorter); + PK_ASSERT(dr->m_Billboarder); + + const u32 vertexOffset = ribbonData.FullVertexOffset(); + const u32 pageCount = dr->m_PageCaches.Count(); + + // Flag selected particles + + for (const auto &renderSelection : m_SrcParticleSelected.m_AllRendererSelectionsView) + { + if (renderSelection.m_Renderers.Contains(dr->m_DrawRequest->BaseBillboardingRequest()._UnsafeRenderer())) + { + Mem::Fill32(&m_DstSelectedParticles[vertexOffset], bit_cast(DebugColorGrey), ribbonData.m_VertexCount); + } + } + + bool particleFirstInitialized = false; + CRibbonBillboarder::SCentersIndex particleFirst; + particleFirst.m_PageIndex = 0; + particleFirst.m_PartIndex = 0; + + struct SRange + { + SMediumParticleSelection::SSelectedRange m_MediumRange; + bool m_IsFocusedMedium; + + SRange(SMediumParticleSelection::SSelectedRange range, bool isFocusedMedium = false) : m_MediumRange(range), m_IsFocusedMedium(isFocusedMedium) {} + + bool operator < (const SRange &oth) const { return m_MediumRange.m_PageId < oth.m_MediumRange.m_PageId || (m_MediumRange.m_PageId == oth.m_MediumRange.m_PageId && m_MediumRange.m_Range < oth.m_MediumRange.m_Range); } + bool operator <= (const SRange &oth) const { return m_MediumRange.m_PageId < oth.m_MediumRange.m_PageId || (m_MediumRange.m_PageId == oth.m_MediumRange.m_PageId && m_MediumRange.m_Range <= oth.m_MediumRange.m_Range); } + bool operator == (const SRange &oth) const { return m_MediumRange.m_PageId == oth.m_MediumRange.m_PageId && m_MediumRange.m_Range == oth.m_MediumRange.m_Range; } + }; + + TSemiDynamicArray currentParticleRanges; + + TMemoryView &srcSelection = m_SrcParticleSelected.m_AllParticleSelectionsView; + for (u32 i = 0; i < srcSelection.Count(); ++i) + { + if (dr->m_DrawRequest->BaseBillboardingRequest()._UnsafeMedium() == srcSelection[i].m_Medium) + { + PK_ASSERT(!srcSelection[i].m_Ranges.Empty()); + + u32 offset = 0; + + for (const SMediumParticleSelection::SSelectedRange &range : srcSelection[i].m_Ranges) + { + const u32 pageId_InMedium = range.PageID(); + CGuid pageId_InTasks; + for (u32 pageIdx = 0; pageIdx < pageCount; ++pageIdx) + { + if (dr->m_PageCaches[pageIdx].m_PageIdxInMedium == pageId_InMedium) + { + pageId_InTasks = pageIdx; + break; + } + } + if (!pageId_InTasks.Valid()) + continue; // page has been culled ... + + const bool isFocusedMedium = (i == m_SrcParticleSelected.m_FocusedMedium); + if (isFocusedMedium && srcSelection[i].m_CurrentSelectedId - offset < range.Count()) + { + particleFirst.m_PageIndex = pageId_InTasks; + particleFirst.m_PartIndex = range.StartID() + srcSelection[i].m_CurrentSelectedId - offset; + particleFirstInitialized = true; + } + + currentParticleRanges.PushBack(SRange(range, isFocusedMedium)); + currentParticleRanges.Last().m_MediumRange.m_PageId = pageId_InTasks; + + offset += range.Count(); + } + } + } + + if (currentParticleRanges.Empty()) + return; // nothing to do !! + + // optim : sort "currentParticleRanges" and extract sub-array foreach 'pageId' - so in the particle loop, the look-up count will be extremely reduced. + + QuickSort(currentParticleRanges.Begin(), currentParticleRanges.End()); + + PK_STACKMEMORYVIEW(u32, rangeOffsetPerPage, pageCount + 1); + Mem::Clear(rangeOffsetPerPage.Data(), rangeOffsetPerPage.CoveredBytes()); + + { + u32 rangeIdx = 0; + const u32 rangeCount = currentParticleRanges.Count(); + for (u32 pageIdx = 0; pageIdx < pageCount; ++pageIdx) + { + rangeOffsetPerPage[pageIdx] = rangeIdx; + while (rangeIdx < rangeCount && currentParticleRanges[rangeIdx].m_MediumRange.m_PageId == pageIdx) + ++rangeIdx; + } + rangeOffsetPerPage[pageCount] = rangeCount; + PK_ASSERT(rangeIdx == rangeCount); + } + + // Loop overall particles + + const u32 vertexPerParticle = dr->m_Billboarder->BillboardVertexCount(); + + const TStridedMemoryView particleReorder = dr->m_RibbonSorter->m_OutSort_Indices.Slice(ribbonData.m_ParticleOffset, ribbonData.m_ParticleCount); + const TStridedMemoryView particleRibbonId = dr->m_RibbonSorter->m_OutSort_RibbonIds.Slice(ribbonData.m_ParticleOffset, ribbonData.m_ParticleCount); + + for (u32 p = 0; p < ribbonData.m_ParticleCount; ++p) + { + const CRibbonBillboarder::SCentersIndex &pIndexPL = particleReorder[p]; + + bool found = false; + bool isFocusedMedium = false; + + for (u32 rangeIdx = rangeOffsetPerPage[pIndexPL.m_PageIndex], rangeStop = rangeOffsetPerPage[pIndexPL.m_PageIndex + 1]; rangeIdx < rangeStop; ++rangeIdx) + { + const SRange &range = currentParticleRanges[rangeIdx]; + const u32 startIdx = range.m_MediumRange.StartID(); + const u32 stopIdx = range.m_MediumRange.StartID() + range.m_MediumRange.Count(); + + if (pIndexPL.m_PartIndex >= startIdx && pIndexPL.m_PartIndex < stopIdx) + { + found = true; + isFocusedMedium = range.m_IsFocusedMedium; + break; + } + } + + if (!found) + continue; + + bool previousFound = false; + bool nextFound = false; + + if (p < ribbonData.m_ParticleCount - 1) + nextFound = (CRibbon_ThreadSort_Policy::kRibbonIdMask & particleRibbonId[p]) == (CRibbon_ThreadSort_Policy::kRibbonIdMask & particleRibbonId[p + 1]); + + if (p > 0) + { + const CRibbonBillboarder::SCentersIndex &pIndexPLNext = particleReorder[p - 1]; + + for (u32 rangeIdx = rangeOffsetPerPage[pIndexPLNext.m_PageIndex], rangeStop = rangeOffsetPerPage[pIndexPLNext.m_PageIndex + 1]; rangeIdx < rangeStop; ++rangeIdx) + { + const SRange &range = currentParticleRanges[rangeIdx]; + const u32 startIdx = range.m_MediumRange.StartID(); + const u32 stopIdx = range.m_MediumRange.StartID() + range.m_MediumRange.Count(); + + if (pIndexPLNext.m_PartIndex >= startIdx && pIndexPLNext.m_PartIndex < stopIdx) + { + previousFound = ((CRibbon_ThreadSort_Policy::kRibbonIdMask & particleRibbonId[p - 1]) == (CRibbon_ThreadSort_Policy::kRibbonIdMask & particleRibbonId[p])); + break; + } + } + } + + const u32 pVertex = vertexOffset + p * vertexPerParticle; + + Mem::Fill32(&m_DstSelectedParticles[pVertex], bit_cast((!m_SrcParticleSelected.m_FocusedMedium.Valid() || isFocusedMedium) ? DebugColorWhite : DebugColorGrey), vertexPerParticle); + + if (particleFirstInitialized && particleFirst.m_PageIndex == pIndexPL.m_PageIndex && particleFirst.m_PartIndex == pIndexPL.m_PartIndex) + { + const bool isFirst = !previousFound; + const bool isLast = !nextFound; + Mem::Fill32(&m_DstSelectedParticles[isFirst ? pVertex : pVertex - vertexPerParticle / 2], bit_cast(DebugColorRed), (isFirst || isLast) ? vertexPerParticle / 2 : vertexPerParticle); + } + } +} + +//---------------------------------------------------------------------------- + +void CMesh_Exec_WireframeDiscard::operator()(const Drawers::SMesh_ExecPage &batch) +{ + if (m_DstSelectedParticles.Empty()) + return; + + PK_NAMEDSCOPEDPROFILE("CustomTasks CMesh_Exec_WireframeDiscard"); + + const u32 outCount = batch.m_Page->RenderedParticleCount(); + + TStridedMemoryView enableds = batch.m_Page->StreamForReading(batch.m_DrawRequest->BaseBillboardingRequest().m_EnabledStreamId); + const bool hasEnabled = batch.m_DrawRequest->InputParticleCount() != batch.m_DrawRequest->RenderedParticleCount(); + + if (batch.m_DrawRequest->RenderedParticleCount() == 0) + return; + + PK_ASSERT(batch.m_Self != null); + TMemoryView particleReorder = batch.m_Self->ParticleReorder(); + + if (particleReorder.Empty()) + { + Mem::Clear(&m_DstSelectedParticles[batch.m_ParticleOffset], sizeof(float) * outCount); + + for (const auto &renderSelection : m_SrcParticleSelected.m_AllRendererSelectionsView) + { + if (renderSelection.m_Renderers.Contains(batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeRenderer())) + { + Mem::Fill32(&m_DstSelectedParticles[batch.m_ParticleOffset], bit_cast(DebugColorGrey), outCount); + } + } + + CGuid particleId_First; + + TMemoryView &srcSelection = m_SrcParticleSelected.m_AllParticleSelectionsView; + for (u32 i = 0; i < srcSelection.Count(); ++i) + { + if (batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeMedium() == srcSelection[i].m_Medium) + { + PK_ASSERT(!srcSelection[i].m_Ranges.Empty()); + // Remap the particle Id from the simulation (in) to the particle id in the rendering buffers (out) + u32 particleId_in = 0; + u32 particleId_out = 0; + + u32 offset = 0; + + for (u32 j = 0; j < srcSelection[i].m_Ranges.Count(); ++j) + { + if (batch.m_Page->PageIdxInMedium() == srcSelection[i].m_Ranges[j].m_PageId) + { + const u32 range_startId = srcSelection[i].m_Ranges[j].StartID(); + const u32 range_count = srcSelection[i].m_Ranges[j].Count(); + + u32 rangeOut_startId = range_startId; + u32 rangeOut_count = range_count; + if (hasEnabled) + { + PK_ASSERT(particleId_in <= range_startId); // Warning: it only works when "m_Ranges" are in ascending order and not overlapping. Otherwise, find another way !!! + while (particleId_in < range_startId) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_startId = particleId_out; + while (particleId_in < (range_startId + range_count)) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_count = (particleId_out - rangeOut_startId); + } + + if (rangeOut_count == 0) + continue; // TODO: if it goes here with j == 0, then the first particle won't be hightlighted ... + + const bool isFocusedMedium = (i == m_SrcParticleSelected.m_FocusedMedium); + if (isFocusedMedium && srcSelection[i].m_CurrentSelectedId - offset < rangeOut_count) + particleId_First = rangeOut_startId + srcSelection[i].m_CurrentSelectedId - offset; + + PK_ASSERT(rangeOut_startId + rangeOut_count <= outCount); // issue with mismatching between the current frame processed from frame-collector and the editor's selection input. + const u32 writeCount = (rangeOut_startId < outCount) ? PKMin(rangeOut_count, outCount - rangeOut_startId) : 0; + Mem::Fill32(&m_DstSelectedParticles[batch.m_ParticleOffset + rangeOut_startId], bit_cast((!m_SrcParticleSelected.m_FocusedMedium.Valid() || isFocusedMedium) ? DebugColorWhite : DebugColorGrey), writeCount); + } + offset += srcSelection[i].m_Ranges[j].Count(); + } + } + } + + if (particleId_First.Valid() && particleId_First < outCount) + { + m_DstSelectedParticles[batch.m_ParticleOffset + particleId_First] = DebugColorRed; + } + } + else + { + struct SRangeAndFocusedMedium + { + SMediumParticleSelection::SRange m_Range; + bool m_IsFocusedMedium; + + SRangeAndFocusedMedium(SMediumParticleSelection::SRange range, bool isFocusedMedium = false) : m_Range(range), m_IsFocusedMedium(isFocusedMedium) {} + }; + + TSemiDynamicArray currentParticleRanges; // 1kb of stack space ?!! I know we should hunt allocs down but isn't there a better way? that's pretty horrible + + for (const auto &renderSelection : m_SrcParticleSelected.m_AllRendererSelectionsView) + { + if (renderSelection.m_Renderers.Contains(batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeRenderer())) + { + currentParticleRanges.PushBack(SMediumParticleSelection::SRange(0, batch.m_Page->InputParticleCount())); + } + } + + CGuid particleId_First; + + TMemoryView &srcSelection = m_SrcParticleSelected.m_AllParticleSelectionsView; + for (u32 i = 0; i < srcSelection.Count(); ++i) + { + if (batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeMedium() == srcSelection[i].m_Medium) + { + PK_ASSERT(!srcSelection[i].m_Ranges.Empty()); + // Remap the particle Id from the simulation (in) to the particle id in the rendering buffers (out) + u32 particleId_in = 0; + u32 particleId_out = 0; + + u32 offset = 0; + + for (u32 j = 0; j < srcSelection[i].m_Ranges.Count(); ++j) + { + if (batch.m_Page->PageIdxInMedium() == srcSelection[i].m_Ranges[j].m_PageId) + { + const u32 range_startId = srcSelection[i].m_Ranges[j].StartID(); + const u32 range_count = srcSelection[i].m_Ranges[j].Count(); + + u32 rangeOut_startId = range_startId; + u32 rangeOut_count = range_count; + if (hasEnabled) + { + PK_ASSERT(particleId_in <= range_startId); // Warning: it only works when "m_Ranges" are in ascending order and not overlapping. Otherwise, find another way !!! + while (particleId_in < range_startId) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_startId = particleId_out; + while (particleId_in < (range_startId + range_count)) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_count = (particleId_out - rangeOut_startId); + } + + if (rangeOut_count == 0) + continue; // TODO: if it goes here with j == 0, then the first particle won't be hightlighted ... + + const bool isFocusedMedium = (i == m_SrcParticleSelected.m_FocusedMedium); + if (isFocusedMedium && srcSelection[i].m_CurrentSelectedId - offset < rangeOut_count) + particleId_First = rangeOut_startId + srcSelection[i].m_CurrentSelectedId - offset; + + PK_ASSERT(rangeOut_startId + rangeOut_count <= outCount); // issue with mismatching between the current frame processed from frame-collector and the editor's selection input. + const u32 writeCount = (rangeOut_startId < outCount) ? PKMin(rangeOut_count, outCount - rangeOut_startId) : 0; + currentParticleRanges.PushBack(SRangeAndFocusedMedium(SMediumParticleSelection::SRange(rangeOut_startId, writeCount), isFocusedMedium)); + } + offset += srcSelection[i].m_Ranges[j].Count(); + } + } + } + + // naive test + u32 currentParticleIdx = batch.m_ParticleOffset; + for (u32 p = 0; p < outCount; ++p) + { + const u32 pIndex = particleReorder[currentParticleIdx++]; + + bool found = false; + bool isFocusedMedium = false; + for (const SRangeAndFocusedMedium &range : currentParticleRanges) + { + const u32 startIdx = range.m_Range.StartID(); + const u32 stopIdx = range.m_Range.StartID() + range.m_Range.Count(); + + if (p >= startIdx && p < stopIdx) + { + found = true; + isFocusedMedium = range.m_IsFocusedMedium; + break; + } + } + m_DstSelectedParticles[pIndex] = found ? ((!m_SrcParticleSelected.m_FocusedMedium.Valid() || isFocusedMedium) ? DebugColorWhite : DebugColorGrey) : 0.0f; + } + + if (particleId_First.Valid() && particleId_First < outCount) + { + m_DstSelectedParticles[particleReorder[batch.m_ParticleOffset + particleId_First]] = DebugColorRed; + } + } +} + +//---------------------------------------------------------------------------- + +void CTriangle_Exec_WireframeDiscard::operator()(const Drawers::STriangle_ExecPage &batch) +{ + if (m_DstSelectedParticles.Empty()) + return; + + PK_NAMEDSCOPEDPROFILE("CustomTasks CCopyStream_Exec_WireframeDiscard"); + + const u32 outCount = batch.m_Page->RenderedParticleCount(); + + Mem::Clear(&m_DstSelectedParticles[batch.m_VertexOffset], sizeof(float) * outCount * 3); + + TStridedMemoryView enableds = batch.m_Page->StreamForReading(batch.m_DrawRequest->BaseBillboardingRequest().m_EnabledStreamId); + const bool hasEnabled = batch.m_DrawRequest->InputParticleCount() != batch.m_DrawRequest->RenderedParticleCount(); + + if (batch.m_DrawRequest->RenderedParticleCount() == 0) + return; + + for (const auto &renderSelection : m_SrcParticleSelected.m_AllRendererSelectionsView) + { + if (renderSelection.m_Renderers.Contains(batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeRenderer())) + { + Mem::Fill32(&m_DstSelectedParticles[batch.m_VertexOffset], bit_cast(DebugColorGrey), outCount * 3); + } + } + + CGuid particleId_First; + + // Build the array of particle ranges for this page: + TMemoryView &srcSelection = m_SrcParticleSelected.m_AllParticleSelectionsView; + for (u32 i = 0; i < srcSelection.Count(); ++i) + { + if (batch.m_DrawRequest->BaseBillboardingRequest()._UnsafeMedium() == srcSelection[i].m_Medium) + { + PK_ASSERT(!srcSelection[i].m_Ranges.Empty()); + // Remap the particle Id from the simulation (in) to the particle id in the rendering buffers (out) + u32 particleId_in = 0; + u32 particleId_out = 0; + + u32 offset = 0; + + for (u32 j = 0; j < srcSelection[i].m_Ranges.Count(); ++j) + { + if (batch.m_Page->PageIdxInMedium() == srcSelection[i].m_Ranges[j].m_PageId) + { + const u32 range_startId = srcSelection[i].m_Ranges[j].StartID(); + const u32 range_count = srcSelection[i].m_Ranges[j].Count(); + + u32 rangeOut_startId = range_startId; + u32 rangeOut_count = range_count; + if (hasEnabled) + { + PK_ASSERT(particleId_in <= range_startId); // Warning: it only works when "m_Ranges" are in ascending order and not overlapping. Otherwise, find another way !!! + while (particleId_in < range_startId) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_startId = particleId_out; + while (particleId_in < (range_startId + range_count)) + { + if (enableds[particleId_in] != 0) + ++particleId_out; + ++particleId_in; + } + rangeOut_count = (particleId_out - rangeOut_startId); + } + + if (rangeOut_count == 0) + continue; // TODO: if it goes here with j == 0, then the first particle won't be hightlighted ... + + const bool isFocusedMedium = (i == m_SrcParticleSelected.m_FocusedMedium); + if (isFocusedMedium && srcSelection[i].m_CurrentSelectedId - offset < rangeOut_count) + particleId_First = rangeOut_startId + srcSelection[i].m_CurrentSelectedId - offset; + + PK_ASSERT(rangeOut_startId + rangeOut_count <= outCount); // issue with mismatching between the current frame processed from frame-collector and the editor's selection input. + const u32 writeCount = (rangeOut_startId < outCount) ? PKMin(rangeOut_count, outCount - rangeOut_startId) : 0; + Mem::Fill32(&m_DstSelectedParticles[batch.m_VertexOffset + rangeOut_startId * 3], bit_cast((!m_SrcParticleSelected.m_FocusedMedium.Valid() || isFocusedMedium) ? DebugColorWhite : DebugColorGrey), writeCount * 3); + } + offset += srcSelection[i].m_Ranges[j].Count(); + } + } + } + + if (particleId_First.Valid() && particleId_First < outCount) + { + Mem::Fill32(&m_DstSelectedParticles[batch.m_VertexOffset + particleId_First * 3], bit_cast(DebugColorRed), 3); + } +} + +//---------------------------------------------------------------------------- + +RHI::PGpuBuffer GetIsSelectedBuffer(const SEffectParticleSelectionView &selectionView, const Drawers::SBillboard_DrawRequest &dr) +{ + for (const auto &s : selectionView.m_AllParticleSelectionsView_GPU) + { + if (s.m_Selection->m_Medium == dr.m_BB._UnsafeMedium()) + return s.m_DstBuffer; + } + return null; +} + +//---------------------------------------------------------------------------- + +RHI::PGpuBuffer GetIsSelectedBuffer(const SEffectParticleSelectionView &selectionView, const Drawers::SMesh_DrawRequest &dr) +{ + for (const auto &s : selectionView.m_AllParticleSelectionsView_GPU) + { + if (s.m_Selection->m_Medium == dr.m_BB._UnsafeMedium()) + return s.m_DstBuffer; + } + return null; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_HAS_PARTICLES_SELECTION != 0) diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHICustomTasks.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RHICustomTasks.h new file mode 100644 index 00000000..cb7b6a36 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHICustomTasks.h @@ -0,0 +1,296 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" + +#include // PK_COMPILER_BUILD_COMPILER + + #if defined(PK_DESKTOP_TOOLS) && !defined(PK_RETAIL) && (PK_COMPILER_BUILD_COMPILER != 0) + # define PK_HAS_PARTICLES_SELECTION 1 + #else + # define PK_HAS_PARTICLES_SELECTION 0 + #endif // !defined(PK_RETAIL) + +#if (PK_HAS_PARTICLES_SELECTION != 0) + +#include +#include +#include +#include +#include + +#include + +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) +#include +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) +#include +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SMediumParticleSelection +{ + struct SRange + { + u32 m_StartIdAndCount; + + SRange(u32 startId, u32 count) + : m_StartIdAndCount((startId << 16) | (count & 0xFFFF)) + { + // Assert for truncation during packing + PK_ASSERT(StartID() == startId); + PK_ASSERT(Count() == count); + } + + PK_FORCEINLINE u32 StartID() const { return m_StartIdAndCount >> 16; } + PK_FORCEINLINE u32 Count() const { return m_StartIdAndCount & 0xFFFF; } + + bool operator < (const SRange &oth) const { return StartID() < oth.StartID(); } + bool operator <= (const SRange &oth) const { return StartID() <= oth.StartID(); } + bool operator == (const SRange &oth) const { return StartID() == oth.StartID(); } + }; + + struct SSelectedRange + { + SRange m_Range; + u32 m_PageId; + + SSelectedRange(u32 startId, u32 count, u32 pageId) + : m_Range(startId, count) + , m_PageId(pageId) + { + // Assert for truncation during packing + PK_ASSERT(StartID() == startId); + PK_ASSERT(Count() == count); + PK_ASSERT(PageID() == pageId); + } + + PK_FORCEINLINE u32 StartID() const { return m_Range.StartID(); } + PK_FORCEINLINE u32 Count() const { return m_Range.Count(); } + PK_FORCEINLINE u32 PageID() const { return m_PageId; } + + bool operator < (const SSelectedRange &oth) const { return m_PageId < oth.m_PageId || (m_PageId == oth.m_PageId && m_Range < oth.m_Range); } + bool operator <= (const SSelectedRange &oth) const { return m_PageId < oth.m_PageId || (m_PageId == oth.m_PageId && m_Range <= oth.m_Range); } + bool operator == (const SSelectedRange &oth) const { return m_PageId == oth.m_PageId && m_Range == oth.m_Range; } + }; + + const CParticleMedium *m_Medium = null; + TArray m_Ranges; + CGuid m_CurrentSelectedId; +}; + +//---------------------------------------------------------------------------- + +struct SMediumParticleSelection_GPU : public CRefCountedObject +{ + const CParticleMedium *m_Medium = null; +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + SBuffer_D3D11 m_BufferD3D11; +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + SBuffer_D3D12 m_BufferD3D12; +#endif + bool m_Processed = false; + + ~SMediumParticleSelection_GPU() + { +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + m_BufferD3D11.Release(); +#endif +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + m_BufferD3D12.Release(); +#endif + } +}; + +typedef TRefPtr PMediumParticleSelection_GPU; + +//---------------------------------------------------------------------------- + +struct SRendererSelection +{ + TArray m_Renderers; + + SRendererSelection() {} +}; + +struct SMediumParticleSelection_GPU_Context +{ + struct SSelectionInfoData // Keep up-to-date with PKSample::CreateEditorSelectorConstantSetLayout + { + CUint4 m_PositionsOffsets; + CUint4 m_RadiusOffsets; + CUint4 m_EnabledOffsets; + CFloat4 m_RayOrigin; + CFloat4 m_RayDirection; + CFloat4x4 m_Planes; + CUint4 m_Mode; // only 'x()' is used. + }; + + enum EMode + { + ModeSelectWithRay = 0, + ModeSelectWithRect = 1, + ModeSelectAll = 2, + ModeParticleAdvanceNext = 8, + ModeParticleAdvancePrev = 9, + ModeParticleReset = 10, + }; + + RHI::PGpuBuffer m_StreamBuffer; + RHI::PGpuBuffer m_StreamInfo; + RHI::PGpuBuffer m_DstBuffer; + TArray m_ConstantData; + + PMediumParticleSelection_GPU m_Selection; +}; + +//---------------------------------------------------------------------------- + +struct SEffectParticleSelection +{ + TArray m_AllParticleSelections; + TArray m_AllParticleSelections_GPU; + TArray m_AllRendererSelections; + CGuid m_FocusedMedium; // address one of the 'm_AllParticleSelections' or 'm_AllParticleSelections_GPU' + + SEffectParticleSelection() {} + + bool Empty() const { return m_AllParticleSelections.Empty() && m_AllParticleSelections_GPU.Empty() && m_AllRendererSelections.Empty(); } + + void ClearParticleSelection() + { + m_AllParticleSelections.Clear(); + m_AllParticleSelections_GPU.Clear(); + m_FocusedMedium = CGuid::INVALID; + } + + void ClearRendererSelection() + { + m_AllRendererSelections.Clear(); + } +}; + +//---------------------------------------------------------------------------- + +struct SEffectParticleSelectionView +{ + TMemoryView m_AllParticleSelectionsView; + TMemoryView m_AllParticleSelectionsView_GPU; + TMemoryView m_AllRendererSelectionsView; + CGuid m_FocusedMedium; + + SEffectParticleSelectionView() {} + + SEffectParticleSelectionView(const SEffectParticleSelection &fromSelection) + : m_AllParticleSelectionsView(fromSelection.m_AllParticleSelections) + , m_AllParticleSelectionsView_GPU(fromSelection.m_AllParticleSelections_GPU) + , m_AllRendererSelectionsView(fromSelection.m_AllRendererSelections) + , m_FocusedMedium(fromSelection.m_FocusedMedium) + { + } + + bool HasParticlesSelected() const { return !m_AllParticleSelectionsView.Empty(); } + bool HasGPUParticlesSelected() const { return !m_AllParticleSelectionsView_GPU.Empty(); } + bool HasRendersSelected() const { return !m_AllRendererSelectionsView.Empty(); } + + void ClearAllViews() + { + m_AllParticleSelectionsView.Clear(); + m_AllParticleSelectionsView_GPU.Clear(); + m_AllRendererSelectionsView.Clear(); + } +}; + +//---------------------------------------------------------------------------- +// CPU billboarding selection: + +class PK_EXPORT CBillboard_Exec_WireframeDiscard +{ +public: + TStridedMemoryView m_DstSelectedParticles; + SEffectParticleSelectionView m_SrcParticleSelected; + + CBillboard_Exec_WireframeDiscard() { } + void Clear() { Mem::Reinit(*this); } + void operator()(const Drawers::SBillboard_ExecPage &batch); +}; + +//---------------------------------------------------------------------------- +// CPU billboarding selection (geometry shader): + +class PK_EXPORT CCopyStream_Exec_WireframeDiscard +{ +public: + TStridedMemoryView m_DstSelectedParticles; + SEffectParticleSelectionView m_SrcParticleSelected; + + void Clear() { Mem::Reinit(*this); } + void operator()(const Drawers::SCopyStream_ExecPage &execPage); +}; + +//---------------------------------------------------------------------------- +// Ribbon billboarding selection: + +class PK_EXPORT CRibbon_Exec_WireframeDiscard +{ +public: + TStridedMemoryView m_DstSelectedParticles; + SEffectParticleSelectionView m_SrcParticleSelected; + + CRibbon_Exec_WireframeDiscard() { } + void Clear() { Mem::Reinit(*this); } + void operator()(const Drawers::SRibbon_ExecBatch &ribbonData); +}; + +//---------------------------------------------------------------------------- +// CPU meshes selection: + +class PK_EXPORT CMesh_Exec_WireframeDiscard +{ +public: + TStridedMemoryView m_DstSelectedParticles; + SEffectParticleSelectionView m_SrcParticleSelected; + + CMesh_Exec_WireframeDiscard() { } + void Clear() { Mem::Reinit(*this); } + void operator()(const Drawers::SMesh_ExecPage &batch); +}; + +//---------------------------------------------------------------------------- +// CPU triangle selection: + +class PK_EXPORT CTriangle_Exec_WireframeDiscard +{ +public: + TStridedMemoryView m_DstSelectedParticles; + SEffectParticleSelectionView m_SrcParticleSelected; + + void Clear() { Mem::Reinit(*this); } + void operator()(const Drawers::STriangle_ExecPage &execPage); +}; + +//---------------------------------------------------------------------------- + +// GPU-sim selection: + +RHI::PGpuBuffer GetIsSelectedBuffer(const SEffectParticleSelectionView &selectionView, const Drawers::SBillboard_DrawRequest &dr); + +RHI::PGpuBuffer GetIsSelectedBuffer(const SEffectParticleSelectionView &selectionView, const Drawers::SMesh_DrawRequest &dr); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_HAS_PARTICLES_SELECTION != 0) diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.cpp new file mode 100644 index 00000000..64d3e48f --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.cpp @@ -0,0 +1,244 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.h" + +#include "RHIRenderIntegrationConfig.h" + +#include "RHIGPUSorter.h" + +__PK_SAMPLE_API_BEGIN + +//---------------------------------------------------------------------------- + +bool CGPUSorter::Init(u32 sortKeySizeInBits, const RHI::PApiManager &apiManager) +{ + if (m_SortKeySizeInBits == sortKeySizeInBits) + return true; + + m_SortKeySizeInBits = sortKeySizeInBits; + m_SortKeyStrideInBytes = Mem::Align(m_SortKeySizeInBits, 32u) / 8u; + m_IndirectionIndexStrideInBytes = Mem::Align(m_IndirectionIndexSizeInBits, 32u) / 8u; + + if (!PK_VERIFY_MESSAGE(m_IndirectionIndexSizeInBits == 32, "Sort only supports 32 bit indirection indices.")) + return false; + if (!PK_VERIFY_MESSAGE(m_SortKeyStrideInBytes == sizeof(u32) || m_SortKeyStrideInBytes == (2 * sizeof(u32)), "Sort keys must be 32 of 64 bit aligned.")) + return false; + + { + RHI::SConstantSetLayout layout; + PKSample::CreateSortUpSweepConstantSetLayout(layout); + for (auto &constantSet : m_UpSweepConstantSets) + constantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("UpSweep Constant Set"), layout); + } + { + RHI::SConstantSetLayout layout; + PKSample::CreateSortPrefixSumConstantSetLayout(layout); + m_PrefixSumConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("Prefix Sum Constant Set"), layout); + } + { + RHI::SConstantSetLayout layout; + PKSample::CreateSortDownSweepConstantSetLayout(layout); + for (auto &constantSet : m_DownSweepConstantSets) + constantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("DownSweep Constant Set"), layout); + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CGPUSorter::AllocateBuffers(u32 elementCount, const RHI::PApiManager &apiManager) +{ + // A radix sort thread handles PK_GPU_SORT_NUM_KEY_PER_THREAD key, so a dispatch computes PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE elements. + m_AlignedElementCount = Mem::Align(elementCount); + m_SortGroupCount = m_AlignedElementCount / (PK_GPU_SORT_NUM_KEY_PER_THREAD * PK_RH_GPU_THREADGROUP_SIZE); + + if (m_AlignedElementCount > m_BuffersMaxElementCount) + { + m_SortIndirection1 = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Sort Indirection1 Buffer"), RHI::RawBuffer, m_AlignedElementCount * m_IndirectionIndexStrideInBytes); + m_SortKeys1 = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Sort Keys1 Buffer"), RHI::RawBuffer, m_AlignedElementCount * m_SortKeyStrideInBytes); + + const u32 alignedSortGroupCount = Mem::Align(m_SortGroupCount); + + m_SortCounts = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Sort Counts Buffer"), RHI::RawBuffer, alignedSortGroupCount * sizeof(CUint4) * 4); + + if (!PK_VERIFY(m_SortIndirection1 != null) || + !PK_VERIFY(m_SortKeys1 != null) || + !PK_VERIFY(m_SortCounts != null)) + return false; + + m_BuffersMaxElementCount = m_AlignedElementCount; + m_ConstantSetsDirty = true; + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CGPUSorter::SetInOutBuffers(const RHI::PGpuBuffer &sortKeys, const RHI::PGpuBuffer &indirection) +{ + if (!PK_VERIFY(sortKeys != null && indirection != null)) + return false; + if (m_SortIndirection0 != indirection) + { + m_SortIndirection0 = indirection; + m_ConstantSetsDirty = true; + } + if (m_SortKeys0 != sortKeys) + { + m_SortKeys0 = sortKeys; + m_ConstantSetsDirty = true; + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CGPUSorter::AppendDispatchs(const PCRendererCacheInstance &rCacheInstance, TArray &outDispatchs) +{ + if (!PK_VERIFY(m_SortIndirection0->GetByteSize() >= (m_AlignedElementCount * m_IndirectionIndexStrideInBytes)) && + !PK_VERIFY(m_SortIndirection1->GetByteSize() >= (m_AlignedElementCount * m_IndirectionIndexStrideInBytes)) && + !PK_VERIFY(m_SortKeys0->GetByteSize() >= (m_AlignedElementCount * m_SortKeyStrideInBytes)) && + !PK_VERIFY(m_SortKeys1->GetByteSize() >= (m_AlignedElementCount * m_SortKeyStrideInBytes))) + return false; + + if (m_ConstantSetsDirty) + { + // Upsweep (2 sets for shuffle) + m_UpSweepConstantSets[0]->SetConstants(m_SortIndirection0, 0); + m_UpSweepConstantSets[0]->SetConstants(m_SortKeys0, 1); + m_UpSweepConstantSets[0]->SetConstants(m_SortCounts, 2); + m_UpSweepConstantSets[0]->UpdateConstantValues(); + m_UpSweepConstantSets[1]->SetConstants(m_SortIndirection1, 0); + m_UpSweepConstantSets[1]->SetConstants(m_SortKeys1, 1); + m_UpSweepConstantSets[1]->SetConstants(m_SortCounts, 2); + m_UpSweepConstantSets[1]->UpdateConstantValues(); + + // Prefix sum + m_PrefixSumConstantSet->SetConstants(m_SortCounts, 0); + m_PrefixSumConstantSet->UpdateConstantValues(); + + // Upsweep (2 sets for shuffle + 1 for the last output) + m_DownSweepConstantSets[0]->SetConstants(m_SortCounts, 0); + m_DownSweepConstantSets[0]->SetConstants(m_SortKeys0, 1); + m_DownSweepConstantSets[0]->SetConstants(m_SortIndirection0, 2); + m_DownSweepConstantSets[0]->SetConstants(m_SortKeys1, 3); + m_DownSweepConstantSets[0]->SetConstants(m_SortIndirection1, 4); + m_DownSweepConstantSets[0]->UpdateConstantValues(); + m_DownSweepConstantSets[1]->SetConstants(m_SortCounts, 0); + m_DownSweepConstantSets[1]->SetConstants(m_SortKeys1, 1); + m_DownSweepConstantSets[1]->SetConstants(m_SortIndirection1, 2); + m_DownSweepConstantSets[1]->SetConstants(m_SortKeys0, 3); + m_DownSweepConstantSets[1]->SetConstants(m_SortIndirection0, 4); + m_DownSweepConstantSets[1]->UpdateConstantValues(); + + m_ConstantSetsDirty = false; + } + + const u32 kBitCount = (m_SortKeySizeInBits + 3) / 4; + + for (u32 bit = 0; bit < kBitCount; bit++) + { + // Compute : Up sweep + { + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + computeDispatch.m_ConstantSet = m_UpSweepConstantSets[bit % 2]; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = bit; + + computeDispatch.m_BufferMemoryBarriers.PushBack(bit % 2 == 0 ? m_SortKeys0 : m_SortKeys1); + + // State + const PKSample::EComputeShaderType type = m_SortKeyStrideInBytes == sizeof(u32) ? ComputeType_SortUpSweep : ComputeType_SortUpSweep_KeyStride64; + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + if (!PK_VERIFY(computeDispatch.m_State != null)) + return false; + + // Dispatch args + computeDispatch.m_ThreadGroups = CInt3(m_SortGroupCount, 1, 1); // groups are in fact half sized, but we launch the usual number of groups + + outDispatchs.PushBack(computeDispatch); + } + + // Compute : Prefix sum on group counts + { + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + computeDispatch.m_ConstantSet = m_PrefixSumConstantSet; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = bit; + drPushConstant[1] = m_SortGroupCount; + + // Adds an explicit barrier: we want to wait for up sweep write + // before reading and writing the prefix sum in SortCounts + computeDispatch.m_BufferMemoryBarriers.PushBack(m_SortCounts); + + // State + const PKSample::EComputeShaderType type = ComputeType_SortPrefixSum; + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + if (!PK_VERIFY(computeDispatch.m_State != null)) + return false; + + // Dispatch args + computeDispatch.m_ThreadGroups = CInt3(1, 1, 1); // 1 group handles prefix sum on counts + + outDispatchs.PushBack(computeDispatch); + } + + // Compute : Down sweep and final SortIndirection computation + { + PKSample::SRHIComputeDispatchs computeDispatch = PKSample::SRHIComputeDispatchs(); + + // Constant set + computeDispatch.m_ConstantSet = m_DownSweepConstantSets[bit % 2]; + + // Push constant + if (!PK_VERIFY(computeDispatch.m_PushConstants.PushBack().Valid())) + return false; + u32 *drPushConstant = reinterpret_cast(&computeDispatch.m_PushConstants.Last()); + drPushConstant[0] = bit; + + computeDispatch.m_BufferMemoryBarriers.PushBack(m_SortCounts); + + // State + const PKSample::EComputeShaderType type = m_SortKeyStrideInBytes == sizeof(u32) ? ComputeType_SortDownSweep : ComputeType_SortDownSweep_KeyStride64; + computeDispatch.m_State = rCacheInstance->m_Cache->GetComputeState(type); + if (!PK_VERIFY(computeDispatch.m_State != null)) + return false; + + // Dispatch args + computeDispatch.m_ThreadGroups = CInt3(m_SortGroupCount, 1, 1); + + outDispatchs.PushBack(computeDispatch); + } + } + + return true; +} + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.h new file mode 100644 index 00000000..3228e8c8 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.h @@ -0,0 +1,71 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PK-SampleLib/PKSample.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHITypePolicy.h" + +#include +#include +#include + +#define PK_GPU_SORT_NUM_KEY_PER_THREAD 24 + +__PK_SAMPLE_API_BEGIN + +//---------------------------------------------------------------------------- + +class CGPUSorter +{ +public: + CGPUSorter() : m_SortKeySizeInBits(0), + m_SortKeyStrideInBytes(0), + m_IndirectionIndexSizeInBits(32), + m_IndirectionIndexStrideInBytes(0), + m_AlignedElementCount(0), + m_SortGroupCount(0), + m_BuffersMaxElementCount(0) {}; + + ~CGPUSorter() {}; + + bool Init(u32 sortKeySizeInBits, const RHI::PApiManager &apiManager); + + bool AllocateBuffers(u32 elementCount, const RHI::PApiManager &apiManager); + + bool SetInOutBuffers(const RHI::PGpuBuffer &sortKeys, const RHI::PGpuBuffer &indirection); + + bool AppendDispatchs(const PCRendererCacheInstance &rCacheInstance, TArray &outDispatchs); + +private: + u32 m_SortKeySizeInBits; + u32 m_SortKeyStrideInBytes; + u32 m_IndirectionIndexSizeInBits = 32u; // This is not exposed yet, but could be to handle more complex indirection (ex: combining particle ID and draw request ID) + u32 m_IndirectionIndexStrideInBytes; + + u32 m_AlignedElementCount; + u32 m_SortGroupCount; + u32 m_BuffersMaxElementCount; // Keeps trace of the greatest element count buffers has been resized to, to avoid resizing buffers when not necessary. + + RHI::PGpuBuffer m_SortIndirection0; + RHI::PGpuBuffer m_SortIndirection1; + RHI::PGpuBuffer m_SortKeys0; + RHI::PGpuBuffer m_SortKeys1; + RHI::PGpuBuffer m_SortCounts; + + TStaticArray m_UpSweepConstantSets; + RHI::PConstantSet m_PrefixSumConstantSet; + TStaticArray m_DownSweepConstantSets; // 2 sets to shuffle input and output between passes + one set for final pass + + bool m_ConstantSetsDirty = true; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.cpp new file mode 100644 index 00000000..ae0d08c7 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.cpp @@ -0,0 +1,2298 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "RenderIntegrationRHI/RHIGraphicResources.h" +#include "RenderIntegrationRHI/MaterialToRHI.h" + +#include "PK-SampleLib/SampleUtils.h" +#include "pk_render_helpers/include/frame_collector/rh_particle_render_data_factory.h" +#include "pk_render_helpers/include/render_features/rh_features_basic.h" +#include "pk_render_helpers/include/render_features/rh_features_vat_static.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#if (PK_BUILD_WITH_FMODEX_SUPPORT != 0) +#include <../SDK/Samples/External/fmodex-4.44.19/inc/fmod.hpp> +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- +// +// SPrepareArg +// +//---------------------------------------------------------------------------- + +SPrepareArg::SPrepareArg(const PCRendererDataBase &renderer, HBO::CContext *context, const RHI::SGPUCaps *gpuCaps) +: m_ResourceManager(null) +, m_Renderer(renderer) +{ + if (gpuCaps != null) + m_GpuCaps = *gpuCaps; + + if (renderer != null) + { + PK_ASSERT(context != null); + m_ResourceManager = context->ResourceManager(); + + const CString &materialPath = renderer->m_Declaration.m_MaterialPath; + + bool fileWasLoaded = false; + PBaseObjectFile materialFile = context->LoadFile(materialPath, false, &fileWasLoaded); + if (materialFile != null) + { + PParticleRendererMaterial material = materialFile->FindFirstOf(); + if (PK_VERIFY(material != null) && + PK_VERIFY(material->Initialize())) + { + // Note(Paul): This should not be in a ctor: cannot properly handle error! + PK_VERIFY(MaterialToRHI::PopulateSettings(material, renderer->m_RendererType, renderer, &m_FeaturesSettings, &m_MaterialSettings)); + + // release refptr here otherwise if kept after file->Unload(), will underflow strong ref if the file has been baked as binary + // (object memory aliases the loaded file buffer memory, so they get force-destroyed when the file is unloaded even if external refs are lying around) + material = null; + } + + if (!fileWasLoaded) + materialFile->Unload(); + materialFile = null; + } + MaterialToRHI::FindParticleRenderPasses(m_RenderPasses, renderer->m_RendererType, FastDelegate(this, &SPrepareArg::_HasProperty)); + } +} + +//---------------------------------------------------------------------------- + +bool SPrepareArg::_HasProperty(CStringId materialProperty) const +{ + const SRendererFeaturePropertyValue *propertyPtr = m_Renderer->m_Declaration.FindProperty(materialProperty); + return propertyPtr != null && (propertyPtr->m_Type != PropertyType_Feature || propertyPtr->ValueB()); +} + +//---------------------------------------------------------------------------- +// +// STextureKey +// +//---------------------------------------------------------------------------- + +bool STextureKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + (void)args; + return true; +} + +//---------------------------------------------------------------------------- + +RHI::PTexture STextureKey::RenderThread_CreateResource(const SCreateArg &args) +{ + if (m_Path.Empty() || args.m_ResourceManagers.Empty()) + return null; + + TResourcePtr image; + for (auto resourceManager : args.m_ResourceManagers) + { + image = resourceManager->Load(m_Path, false, SResourceLoadCtl(false, true)); + if ((image != null) && !image->Empty()) break; + } + + if (image == null || image->Empty()) + { + CLog::Log(PK_ERROR, "Could not load image \"%s\"", m_Path.Data()); + return null; + } + + RHI::PTexture texture = RHI::PixelFormatFallbacks::CreateTextureAndFallbackIFN(args.m_ApiManager, *image, m_LoadAsSRGB, m_Path.Data()); + + if (texture == null) + { + CLog::Log(PK_ERROR, "Could not create RHI texture for image \"%s\"", m_Path.Data()); + return null; + } + return texture; +} + +//---------------------------------------------------------------------------- + +RHI::PTexture STextureKey::RenderThread_ReloadResource(const SCreateArg &args) +{ + return RenderThread_CreateResource(args); +} + +//---------------------------------------------------------------------------- + +bool STextureKey::operator == (const STextureKey &oth) const +{ + return m_Path == oth.m_Path; +} + +//---------------------------------------------------------------------------- + +void STextureKey::SetupDefaultResource() +{ + SPrepareArg args; + STextureKey key; + + key.m_Path = "Textures/default.dds"; + + s_DefaultResourceID = CTextureManager::UpdateThread_GetResource(key, args); +} + +//---------------------------------------------------------------------------- + +CTextureManager::CResourceId STextureKey::s_DefaultResourceID; + +//---------------------------------------------------------------------------- +// +// SConstantSamplerKey +// +//---------------------------------------------------------------------------- + +bool SConstantSamplerKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + (void)args; + return true; +} + +//---------------------------------------------------------------------------- + +RHI::PConstantSampler SConstantSamplerKey::RenderThread_CreateResource(const SCreateArg &args) +{ + RHI::PConstantSampler sampler = args.m_ApiManager->CreateConstantSampler(RHI::SRHIResourceInfos("PK-RHI Sampler"), m_MagFilter, m_MinFilter, m_WrapU, m_WrapV, m_WrapW, m_MipmapCount); + if (sampler == null) + { + CLog::Log(PK_ERROR, "Could not create constant sampler"); + return null; + } + return sampler; +} + +//---------------------------------------------------------------------------- + +bool SConstantSamplerKey::operator == (const SConstantSamplerKey &other) const +{ + return m_MagFilter == other.m_MagFilter && + m_MinFilter == other.m_MinFilter && + m_WrapU == other.m_WrapU && + m_WrapV == other.m_WrapV && + m_WrapW == other.m_WrapW && + m_MipmapCount == other.m_MipmapCount; +} + +//---------------------------------------------------------------------------- +// +// SPassDescription +// +//---------------------------------------------------------------------------- + +const CStringView s_ParticleRenderPassNames[] = +{ + "ParticlePass_Opaque", + "ParticlePass_Decal", + "ParticlePass_Lighting", + "ParticlePass_Transparent", + "ParticlePass_Distortion", + "ParticlePass_Tint", + "ParticlePass_TransparentPostDisto", + "ParticlePass_Debug", + "ParticlePass_Compositing", + "ParticlePass_OpaqueShadow" +}; +PK_STATIC_ASSERT(PK_ARRAY_COUNT(s_ParticleRenderPassNames) == __MaxParticlePass); + +TArray SPassDescription::s_PassDescriptions; + +//---------------------------------------------------------------------------- + +namespace +{ + const RHI::EPixelFormat _OpaqueFormats[] = + { + RHI::EPixelFormat::FormatFloat16RGBA, // GBuffer diffuse HDR + RHI::EPixelFormat::FormatFloat32R, // Depth solid + RHI::EPixelFormat::FormatFloat16RGBA, // Emissive HDR + PKSample::CGBuffer::s_NormalRoughMetalBufferFormat, // GBuffer normal spec + }; + + const RHI::EPixelFormat _OpaqueFormatsNoDepth[] = + { + RHI::EPixelFormat::FormatFloat16RGBA, // GBuffer diffuse HDR + RHI::EPixelFormat::FormatFloat16RGBA, // Emissive HDR + PKSample::CGBuffer::s_NormalRoughMetalBufferFormat, // GBuffer normal spec + }; + + const RHI::EPixelFormat _LightingFormats[] = + { + PKSample::CGBuffer::s_LightAccumBufferFormat, // Light accumulation buffer + }; + + const RHI::EPixelFormat _DistortionFormats[] = + { + PKSample::CPostFxDistortion::s_DistortionBufferFormat, // Distortion map + }; + + const RHI::EPixelFormat _PostMergingFormats[] = + { + PKSample::CGBuffer::s_MergeBufferFormat, // Merging buffer format + }; + + const RHI::EPixelFormat _CompositingFormats[] = + { + RHI::FormatUint8RGBA, // Swapchain format + }; + + const RHI::EPixelFormat _OpaqueShadowFormats[] = { + IDEAL_SHADOW_DEPTH_FORMAT, // Shadow map + }; +} + +//---------------------------------------------------------------------------- + +const TMemoryView SPassDescription::s_PassOutputsFormats[__MaxParticlePass] = +{ + _OpaqueFormats, + _OpaqueFormatsNoDepth, + _LightingFormats, + _PostMergingFormats, // additive in merging buffer + _DistortionFormats, + _PostMergingFormats, + _PostMergingFormats, + _PostMergingFormats, // debug in merging buffer at post bloom + _CompositingFormats, + _OpaqueShadowFormats // variance shadow maps format +}; + +//---------------------------------------------------------------------------- + +// GBuffer only formats +PK_STATIC_ASSERT(SPassDescription::__GBufferRTCount == PK_ARRAY_COUNT(_OpaqueFormats) - 1); +const TMemoryView SPassDescription::s_GBufferDefaultFormats = TMemoryView(&_OpaqueFormats[0], PK_ARRAY_COUNT(_OpaqueFormats) - 1); + +//---------------------------------------------------------------------------- +// +// SRenderStateKey +// +//---------------------------------------------------------------------------- + +PK_NOINLINE bool SRenderStateKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + // Create the shader bindings: + if (!MaterialToRHI::MaterialFrontendToShaderBindings(args, m_ShaderBindings, m_InputVertexBuffers, m_NeededConstants, m_RenderStateHash, m_Options)) + { + CLog::Log(PK_ERROR, "MaterialToRHI::MaterialFrontendToShaderBindings failed"); + return false; + } + // We generate dummy bindings for the shaders: + RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(RHI::GApi_OpenGL, m_ShaderBindings); + for (u32 i = 0; i < RHI::ShaderStage_Count; ++i) + m_ShaderBindings.Hash(static_cast(i)); + // Reset the bindings after the hash: + RHI::ShaderConstantBindingGenerator::ResetBindings(m_ShaderBindings); + + // Create the pipeline state: + m_PipelineState.m_DynamicScissor = true; + m_PipelineState.m_DynamicViewport = true; + + m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + m_PipelineState.m_AlphaBlendingEquation = RHI::BlendAdd; + m_PipelineState.m_Blending = true; + m_PipelineState.m_CullMode = RHI::NoCulling; + + ERendererClass rendererType = args.m_Renderer->m_RendererType; + + if (rendererType == Renderer_Mesh) + { + bool doubleSided = true; // Keep culling off by default + if (args.m_Renderer->m_Declaration.IsFeatureEnabled(BasicRendererProperties::SID_Culling())) + doubleSided = args.m_Renderer->m_Declaration.GetPropertyValue_B(BasicRendererProperties::SID_Culling_DoubleSided(), true); + + // For backward compatibility purposes, if the property is not present on the renderer, act as if the feature is enabled. + m_PipelineState.m_CullMode = doubleSided ? RHI::NoCulling : RHI::CullBackFaces; + } + + if (rendererType == Renderer_Light || rendererType == Renderer_Decal || rendererType == Renderer_Mesh || rendererType == Renderer_Triangle) + m_PipelineState.m_PolyOrder = (CCoordinateFrame::IsRightHanded()) ? RHI::FrontFaceCounterClockWise : RHI::FrontFaceClockWise; + + // Same principle for the lights and the decals, we just want to rasterize the geometry inside the light sphere / decal bbox + if (rendererType == Renderer_Light || rendererType == Renderer_Decal) + { + // We render the backface with a >= depth test (we light everything in front of the backfaces) + m_PipelineState.m_DepthWrite = false; + m_PipelineState.m_DepthClamp = true; // We disable the depth clip space to avoid having the light-spheres culled by the far-plane + + m_PipelineState.m_DepthTest = RHI::GreaterOrEqual; + m_PipelineState.m_CullMode = RHI::CullFrontFaces; + if (rendererType == Renderer_Decal) + { + // Alpha blend for decals: + m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + m_PipelineState.m_ColorBlendingDst = RHI::BlendOneMinusSrcAlpha; + m_PipelineState.m_AlphaBlendingSrc = RHI::BlendOne; + m_PipelineState.m_AlphaBlendingDst = RHI::BlendOneMinusSrcAlpha; + } + else + { + // Additive blend for light accu buffer: + m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + m_PipelineState.m_AlphaBlendingSrc = RHI::BlendZero; + m_PipelineState.m_AlphaBlendingDst = RHI::BlendOne; + } + } + else + { + m_PipelineState.m_DepthTest = RHI::Less; + + ESampleLibGraphicResources_BlendMode blendmode = ParticleBlend_AlphaBlendAdditive; + const SRendererFeaturePropertyValue *transparentType = args.m_Renderer->m_Declaration.FindProperty(BasicRendererProperties::SID_Transparent_Type()); + + if (m_RenderPassIdx == ParticlePass_Distortion) + { + blendmode = ParticleBlend_Additive; + } + else if (m_RenderPassIdx == ParticlePass_TransparentPostDisto) + { + blendmode = ParticleBlend_AlphaBlendAdditive; + } + else if (m_RenderPassIdx == ParticlePass_Tint) + { + blendmode = ParticleBlend_Multiply; + } + else if ( m_RenderPassIdx == ParticlePass_Opaque || + m_RenderPassIdx == ParticlePass_OpaqueShadow) + { + blendmode = ParticleBlend_Opaque; + } + else if (transparentType != null) + { + switch (transparentType->ValueI().x()) + { + default: + case 0: + blendmode = ParticleBlend_Additive; break; + case 1: + blendmode = ParticleBlend_AdditiveNoAlpha; break; + case 2: + blendmode = ParticleBlend_AlphaBlend; break; + case 3: + blendmode = ParticleBlend_AlphaBlendAdditive; break; + } + } + + switch (blendmode) + { + default: + case ParticleBlend_Additive: + case ParticleBlend_Distortion: + m_PipelineState.m_ColorBlendingSrc = RHI::BlendSrcAlpha; + m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + m_PipelineState.m_AlphaBlendingSrc = RHI::BlendOne; + m_PipelineState.m_AlphaBlendingDst = RHI::BlendOne; + break; + case ParticleBlend_AdditiveNoAlpha: + m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + m_PipelineState.m_AlphaBlendingSrc = RHI::BlendZero; + m_PipelineState.m_AlphaBlendingDst = RHI::BlendOne; + break; + case ParticleBlend_AlphaBlend: + m_PipelineState.m_ColorBlendingSrc = RHI::BlendSrcAlpha; + m_PipelineState.m_ColorBlendingDst = RHI::BlendOneMinusSrcAlpha; + m_PipelineState.m_AlphaBlendingSrc = RHI::BlendOne; + m_PipelineState.m_AlphaBlendingDst = RHI::BlendOne; + break; + case ParticleBlend_AlphaBlendAdditive: + m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + m_PipelineState.m_ColorBlendingDst = RHI::BlendOneMinusSrcAlpha; + m_PipelineState.m_AlphaBlendingSrc = RHI::BlendOne; + m_PipelineState.m_AlphaBlendingDst = RHI::BlendOne; + break; + case ParticleBlend_Multiply: + m_PipelineState.m_ColorBlendingSrc = RHI::BlendDstColor; + m_PipelineState.m_ColorBlendingDst = RHI::BlendZero; + m_PipelineState.m_AlphaBlendingSrc = RHI::BlendOne; + m_PipelineState.m_AlphaBlendingDst = RHI::BlendOne; + break; + case ParticleBlend_Opaque: + m_PipelineState.m_DepthWrite = true; + m_PipelineState.m_Blending = false; + break; + } + + if (m_Options & Option_GeomBillboarding) + { + m_PipelineState.m_DrawMode = RHI::DrawModePoint; + } + } + + // Create the shader program: + SShaderProgramKey shaderProgKey; + shaderProgKey.m_Option = m_Options; + shaderProgKey.m_RenderPassIdx = m_RenderPassIdx; + m_ShaderProgram = CShaderProgramManager::UpdateThread_GetResource(shaderProgKey, args); + if (!m_ShaderProgram.m_ID.Valid()) + { + CLog::Log(PK_ERROR, "Could not get shader program"); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +RHI::PRenderState SRenderStateKey::RenderThread_CreateResource(const SCreateArg &args) +{ + RHI::PRenderState renderState = args.m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("PK-RHI Render State")); + if (renderState != null) + { + RHI::SRenderState &desc = renderState->m_RenderState; + desc.m_PipelineState = m_PipelineState; + desc.m_ShaderProgram = CShaderProgramManager::RenderThread_ResolveResource(m_ShaderProgram, args); + +#if defined(PK_DEBUG) + CString vtxShaderPath, fragShaderPath, geomShaderPath; + + const SShaderProgramKey &progKey = CShaderProgramManager::RenderThread_GetKey(m_ShaderProgram); + + const SShaderModuleKey &vtxKey = CShaderModuleManager::RenderThread_GetKey(progKey.m_ShaderModules[RHI::VertexShaderStage]); + vtxShaderPath = vtxKey.m_Path; + + const SShaderModuleKey &fragKey = CShaderModuleManager::RenderThread_GetKey(progKey.m_ShaderModules[RHI::FragmentShaderStage]); + fragShaderPath = fragKey.m_Path; + + if (progKey.m_ShaderModules[RHI::GeometryShaderStage].Valid()) + { + const SShaderModuleKey &geomKey = CShaderModuleManager::RenderThread_GetKey(progKey.m_ShaderModules[RHI::GeometryShaderStage]); + geomShaderPath = geomKey.m_Path; + } +#endif + + if (desc.m_ShaderProgram == null) + { + CLog::Log(PK_ERROR, "Could not create shader program"); + return null; + } + desc.m_InputVertexBuffers = m_InputVertexBuffers; + desc.m_ShaderBindings = m_ShaderBindings; + // Generate the bindings for the Api: + RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(args.m_ApiManager->ApiName(), desc.m_ShaderBindings); + if (!PK_VERIFY(u32(m_RenderPassIdx) < SPassDescription::s_PassDescriptions.Count())) + { + CLog::Log(PK_ERROR, "The render state uses a render pass which is out of bound. It will be ignored."); + return null; + } + SPassDescription &passDesc = SPassDescription::s_PassDescriptions[m_RenderPassIdx]; + + if (passDesc.m_RenderPass == null) + { + CLog::Log(PK_ERROR, "The render state uses a render pass which is not in the SPassDescription::s_PassDescriptions array."); + return null; + } + + if (!args.m_ApiManager->BakeRenderState(renderState, passDesc.m_FrameBufferLayout, passDesc.m_RenderPass, passDesc.m_SubPassIdx)) + { +#if defined(PK_DEBUG) + CLog::Log(PK_ERROR, "Could not bake render state for shaders \"%s\" \"%s\" \"%s\"", vtxShaderPath.Data(), geomShaderPath.Data(), fragShaderPath.Data()); +#endif + return null; + } + } + return renderState; +} + +//---------------------------------------------------------------------------- + +void SRenderStateKey::UpdateThread_ReleaseDependencies() +{ + if (m_ShaderProgram.Valid()) + { + CShaderProgramManager::UpdateThread_ReleaseResource(m_ShaderProgram); + } +} + +//---------------------------------------------------------------------------- + +bool SRenderStateKey::operator == (const SRenderStateKey &oth) const +{ + return m_PipelineState == oth.m_PipelineState && + m_InputVertexBuffers == oth.m_InputVertexBuffers && + m_RenderPassIdx == oth.m_RenderPassIdx && + m_ShaderProgram == oth.m_ShaderProgram && + m_RenderStateHash == oth.m_RenderStateHash; +} + +//---------------------------------------------------------------------------- +// +// SComputeStateKey +// +//---------------------------------------------------------------------------- + +PK_NOINLINE bool SComputeStateKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + // Create the shader bindings: + if (!MaterialToRHI::MaterialFrontendToShaderBindings(m_ShaderBindings, m_Type)) + { + CLog::Log(PK_ERROR, "MaterialToRHI::MaterialFrontendToShaderBindings failed"); + return false; + } + + PK_ASSERT(args.m_ApiName != RHI::EGraphicalApi::GApi_Null); + RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(args.m_ApiName, m_ShaderBindings); + + // Create the shader program: + SShaderProgramKey shaderProgKey = SShaderProgramKey(); + shaderProgKey.m_ComputeShaderType = m_Type; + shaderProgKey.m_ShaderBindings = m_ShaderBindings; + m_ShaderProgram = CShaderProgramManager::UpdateThread_GetResource(shaderProgKey, args); + + if (!m_ShaderProgram.m_ID.Valid()) + { + CLog::Log(PK_ERROR, "Could not get shader program"); + return false; + } + + return true; +} + +//---------------------------------------------------------------------------- + +CStringView _GetComputeShaderPath(EComputeShaderType computeShaderType) +{ + switch (computeShaderType) + { + case ComputeType_ComputeParticleCountPerMesh: + return "ComputeParticleCountPerMesh.comp"; + case ComputeType_ComputeParticleCountPerMesh_MeshAtlas: + return "ComputeParticleCountPerMesh.comp"; + case ComputeType_ComputeParticleCountPerMesh_LOD: + return "ComputeParticleCountPerMesh.comp"; + case ComputeType_ComputeParticleCountPerMesh_LOD_MeshAtlas: + return "ComputeParticleCountPerMesh.comp"; + case ComputeType_InitIndirectionOffsetsBuffer: + return "InitIndirectionOffsetsBuffer.comp"; + case ComputeType_InitIndirectionOffsetsBuffer_LODNoAtlas: + return "InitIndirectionOffsetsBuffer.comp"; + case ComputeType_ComputeMeshIndirectionBuffer: + return "ComputeMeshIndirectionBuffer.comp"; + case ComputeType_ComputeMeshIndirectionBuffer_MeshAtlas: + return "ComputeMeshIndirectionBuffer.comp"; + case ComputeType_ComputeMeshIndirectionBuffer_LOD: + return "ComputeMeshIndirectionBuffer.comp"; + case ComputeType_ComputeMeshIndirectionBuffer_LOD_MeshAtlas: + return "ComputeMeshIndirectionBuffer.comp"; + case ComputeType_ComputeMeshMatrices: + return "ComputeMeshMatrices.comp"; + case ComputeType_ComputeSortKeys: + return "ComputeSortKeys.comp"; + case ComputeType_ComputeSortKeys_CameraDistance: + return "ComputeSortKeys.comp"; + case ComputeType_ComputeSortKeys_RibbonIndirection: + return "ComputeSortKeys.comp"; + case ComputeType_ComputeSortKeys_CameraDistance_RibbonIndirection: + return "ComputeSortKeys.comp"; + case ComputeType_SortUpSweep: + return "SortUpSweep.comp"; + case ComputeType_SortUpSweep_KeyStride64: + return "SortUpSweep.comp"; + case ComputeType_SortPrefixSum: + return "SortPrefixSum.comp"; + case ComputeType_SortDownSweep: + return "SortDownSweep.comp"; + case ComputeType_SortDownSweep_KeyStride64: + return "SortDownSweep.comp"; + case ComputeType_ComputeRibbonSortKeys: + return "ComputeRibbonSortKeys.comp"; + default: + PK_ASSERT_NOT_REACHED(); + } + return CStringView(); +} + +//---------------------------------------------------------------------------- + +RHI::PComputeState SComputeStateKey::RenderThread_CreateResource(const SCreateArg &args) +{ + RHI::PComputeState computeState = args.m_ApiManager->CreateComputeState(RHI::SRHIResourceInfos("PK-RHI Compute State")); + if (computeState != null) + { + RHI::SComputeState &desc = computeState->m_ComputeState; + desc.m_ShaderProgram = CShaderProgramManager::RenderThread_ResolveResource(m_ShaderProgram, args); + +#if defined(PK_DEBUG) + CString compShaderPath; + + const SShaderProgramKey &progKey = CShaderProgramManager::RenderThread_GetKey(m_ShaderProgram); + + const SShaderModuleKey &compKey = CShaderModuleManager::RenderThread_GetKey(progKey.m_ShaderModules[RHI::ComputeShaderStage]); + compShaderPath = compKey.m_Path; +#endif + + if (desc.m_ShaderProgram == null) + { + CLog::Log(PK_ERROR, "Could not create shader program"); + return null; + } + desc.m_ShaderBindings = m_ShaderBindings; + // Generate the bindings for the Api: + RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(args.m_ApiManager->ApiName(), desc.m_ShaderBindings); + + if (!args.m_ApiManager->BakeComputeState(computeState)) + { +#if defined(PK_DEBUG) + CLog::Log(PK_ERROR, "Could not bake compute state for shader \"%s\"", compShaderPath.Data()); +#endif + return null; + } + } + return computeState; +} + +//---------------------------------------------------------------------------- + +void SComputeStateKey::UpdateThread_ReleaseDependencies() +{ + if (m_ShaderProgram.Valid()) + { + CShaderProgramManager::UpdateThread_ReleaseResource(m_ShaderProgram); + } +} + +//---------------------------------------------------------------------------- + +bool SComputeStateKey::operator == (const SComputeStateKey &oth) const +{ + return m_Type == oth.m_Type && + m_ShaderProgram == oth.m_ShaderProgram; +} + +//---------------------------------------------------------------------------- +// +// SShaderModuleKey +// +//---------------------------------------------------------------------------- + +bool SShaderModuleKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + (void)args; + return true; +} + +//---------------------------------------------------------------------------- + +RHI::PShaderModule SShaderModuleKey::RenderThread_CreateResource(const SCreateArg &args) +{ + if (m_Path.Empty()) + return null; + + TArray controllers; + if (args.m_ResourceManagers.Empty()) + { + controllers.PushBack(File::DefaultFileSystem()); + } + else + { + for (u32 i = 0; i < args.m_ResourceManagers.Count(); i++) + { + controllers.PushBack (args.m_ResourceManagers[i]->FileController()); + } + } + + PRefCountedMemoryBuffer byteCode; + RHI::EGraphicalApi graphicalApi = args.m_ApiManager->ApiName(); + const CString ext = GetShaderExtensionStringFromApi(graphicalApi); +#ifndef PK_RETAIL + const CString shaderDebugName = CFilePath::ExtractFilename(m_Path); +#else + const CString shaderDebugName; +#endif // ifndef PK_RETAIL + const CString apiShaderPath = m_Path + ext; + bool precompiledExists = true; + + { + CLog::Log(PK_INFO, "Loading shader %s", apiShaderPath.Data()); + PFileStream fileView; + for (auto controller : controllers) + { + precompiledExists = true; + fileView = controller->OpenStream(apiShaderPath, IFileSystem::Access_Read); + if (fileView == null) + { + precompiledExists = false; + + // Metal: we want to keep the precompiled shader path for static editor shaders and samples but compile from source at runtime in editor. + if (graphicalApi == RHI::GApi_Metal) + { + const CString apiShaderSourcePath = m_Path + GetShaderExtensionStringFromApi(graphicalApi, true); + + CLog::Log(PK_INFO, "Could not find precompiled shader '%s', will try to fallback on source '%s'", apiShaderPath.Data(), apiShaderSourcePath.Data()); + + fileView = controller->OpenStream(apiShaderSourcePath, IFileSystem::Access_Read); + if (fileView == null) + fileView = controller->OpenStream(apiShaderSourcePath, IFileSystem::Access_Read, true); + if (fileView != null) + CLog::Log(PK_INFO, "Successfully loaded source file \"%s\"", apiShaderSourcePath.Data()); + else + { + CLog::Log(PK_ERROR, "Could not load source shader file \"%s\"", apiShaderSourcePath.Data()); + return null; + } + } + } + if (fileView != null) + break; + } + + if (fileView == null) + { + CLog::Log(PK_ERROR, "Could not load shader file \"%s\"", apiShaderPath.Data()); + return null; + } + + byteCode = fileView->BufferizeToRefCountedMemoryBuffer(); + fileView->Close(); + } + if (byteCode == null) + return null; + + RHI::PShaderModule module = args.m_ApiManager->CreateShaderModule(RHI::SRHIResourceInfos(shaderDebugName)); + if (!PK_VERIFY(module != null)) + return null; + + bool result; + if (args.m_ApiManager->ApiDesc().m_SupportPrecompiledShader && precompiledExists) + result = module->LoadFromPrecompiled(byteCode, m_Stage); + else + result = module->CompileFromCode(byteCode->Data(), byteCode->DataSizeInBytes(), m_Stage); + + if (!result) + { + CLog::Log(PK_ERROR, "Could not create shader program from loaded shader file '%s': '%s'", m_Path.Data(), module->GetShaderModuleCreationInfo()); + + if (!args.m_ApiManager->ApiDesc().m_SupportPrecompiledShader) + { + CString shaderCode = CString(byteCode->Data(), byteCode->DataSizeInBytes()); + TArray lines; + + shaderCode.Split('\n', lines); + + CLog::Log(PK_ERROR, "Shader code:"); + for (u32 i = 0; i < lines.Count(); ++i) + { + CLog::Log(PK_ERROR, "[%u]%s", i, lines[i].Data()); + } + } + return null; + } + return module; +} + +//---------------------------------------------------------------------------- + +RHI::PShaderModule SShaderModuleKey::RenderThread_ReloadResource(const SCreateArg &args) +{ + return RenderThread_CreateResource(args); +} + +//---------------------------------------------------------------------------- + +bool SShaderModuleKey::operator == (const SShaderModuleKey &other) const +{ + return m_Path == other.m_Path && m_Stage == other.m_Stage; +} + +//---------------------------------------------------------------------------- + +PK_NOINLINE bool SShaderProgramKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + RHI::EShaderStagePipeline stagepipeline = ParticleShaderGenerator::GetShaderStagePipeline(m_Option); + if (m_ComputeShaderType > 0) + stagepipeline = RHI::EShaderStagePipeline::Cs; + + if (stagepipeline != RHI::EShaderStagePipeline::Cs) + { + const CString &materialName = args.m_MaterialSettings.m_MaterialName; + const CString &vertexShader = args.m_MaterialSettings.m_VertexShaderPath; + const CString &fragmentShader = args.m_MaterialSettings.m_FragmentShaderPath.Empty() ? CString::Format("%s.frag", materialName.Data()) : args.m_MaterialSettings.m_FragmentShaderPath; + + // Vertex module + if (stagepipeline & RHI::VertexShaderMask) + { + SShaderModuleKey vertexModuleKey; + vertexModuleKey.m_Path = MaterialToRHI::RemapShaderPathNoExt(args.m_ShaderFolder, vertexShader, materialName, RHI::VertexShaderStage, args.m_Renderer->m_RendererType, m_Option, args.m_FeaturesSettings.View(), m_RenderPassIdx); + vertexModuleKey.m_Stage = RHI::VertexShaderStage; + m_ShaderModules[vertexModuleKey.m_Stage] = CShaderModuleManager::UpdateThread_GetResource(vertexModuleKey, args); + if (!m_ShaderModules[vertexModuleKey.m_Stage].m_ID.Valid()) + { + CLog::Log(PK_ERROR, "Could not get vertex shader module"); + return false; + } + } + + // Geometry module + if (stagepipeline & RHI::GeometryShaderMask) + { + SShaderModuleKey geometryModuleKey; + geometryModuleKey.m_Path = MaterialToRHI::RemapShaderPathNoExt(args.m_ShaderFolder, vertexShader, materialName, RHI::GeometryShaderStage, args.m_Renderer->m_RendererType, m_Option, args.m_FeaturesSettings.View(), m_RenderPassIdx); + geometryModuleKey.m_Stage = RHI::GeometryShaderStage; + m_ShaderModules[geometryModuleKey.m_Stage] = CShaderModuleManager::UpdateThread_GetResource(geometryModuleKey, args); + if (!m_ShaderModules[geometryModuleKey.m_Stage].m_ID.Valid()) + { + CLog::Log(PK_ERROR, "Could not get geometry shader module"); + return false; + } + } + + // Fragment module + if (stagepipeline & RHI::FragmentShaderMask) + { + SShaderModuleKey fragmentModuleKey; + fragmentModuleKey.m_Path = MaterialToRHI::RemapShaderPathNoExt(args.m_ShaderFolder, fragmentShader, materialName, RHI::FragmentShaderStage, args.m_Renderer->m_RendererType, m_Option, args.m_FeaturesSettings.View(), m_RenderPassIdx); + fragmentModuleKey.m_Stage = RHI::FragmentShaderStage; + m_ShaderModules[fragmentModuleKey.m_Stage] = CShaderModuleManager::UpdateThread_GetResource(fragmentModuleKey, args); + if (!m_ShaderModules[fragmentModuleKey.m_Stage].m_ID.Valid()) + { + CLog::Log(PK_ERROR, "Could not get fragment shader module"); + return false; + } + } + } + else + { + // Compute module + if (stagepipeline & RHI::ComputeShaderMask) + { + // Unlike vert/geom/frag, compute shader is compiled offline by shadertool. + // We build the shader path from compute shader name and hashed binding, as do shadertool. + // Ultimately, compilation will be dynamic and this will be handled by MaterialToRHI::RemapShaderPathNoExt. + const CDigestMD5 &computeHash = m_ShaderBindings.Hash(RHI::ComputeShaderStage); + char _hashStorage[32 + 1]; + const CString filePath = "./Shaders/" + _GetComputeShaderPath(m_ComputeShaderType) + "." + RHI::ShaderHashToStringView(computeHash, _hashStorage); + SShaderModuleKey computeModuleKey; + computeModuleKey.m_Path = filePath; + computeModuleKey.m_Stage = RHI::ComputeShaderStage; + m_ShaderModules[computeModuleKey.m_Stage] = CShaderModuleManager::UpdateThread_GetResource(computeModuleKey, args); + if (!m_ShaderModules[computeModuleKey.m_Stage].m_ID.Valid()) + { + CLog::Log(PK_ERROR, "Could not get compute shader module"); + return false; + } + } + } + return true; +} + +//---------------------------------------------------------------------------- + +RHI::PShaderProgram SShaderProgramKey::RenderThread_CreateResource(const SCreateArg &args) +{ + RHI::PShaderProgram program = args.m_ApiManager->CreateShaderProgram(RHI::SRHIResourceInfos("PK-RHI Shader Program")); + if (program != null) + { + RHI::PShaderModule modules[RHI::ShaderStage_Count]; + + for (u32 i = 0; i < RHI::ShaderStage_Count; ++i) + { + if (m_ShaderModules[i].Valid()) + { + modules[i] = CShaderModuleManager::RenderThread_ResolveResource(m_ShaderModules[i], args); + if (modules[i] == null) + { + CLog::Log(PK_ERROR, "Could not create shader module"); + return null; + } + } + else + { + modules[i] = null; + } + } + bool result = true; + if (m_ComputeShaderType == ComputeType_None) + { + result = program->CreateFromShaderModules(modules[RHI::VertexShaderStage], modules[RHI::GeometryShaderStage], modules[RHI::FragmentShaderStage]); + } + else + { + result = program->CreateFromShaderModule(modules[RHI::ComputeShaderStage]); + } + if (!result) + { + CLog::Log(PK_ERROR, "Could not create shader program from shader modules"); + return null; + } + } + return program; +} + +//---------------------------------------------------------------------------- + +void SShaderProgramKey::UpdateThread_ReleaseDependencies() +{ + for (u32 i = 0; i < RHI::ShaderStage_Count; ++i) + { + if (m_ShaderModules[i].Valid()) + { + CShaderModuleManager::UpdateThread_ReleaseResource(m_ShaderModules[i]); + m_ShaderModules[i].m_ID = CGuid::INVALID; + } + } +} + +//---------------------------------------------------------------------------- + +bool SShaderProgramKey::operator == (const SShaderProgramKey &oth) const +{ + if (m_RenderPassIdx != oth.m_RenderPassIdx) + return false; + for (u32 i = 0; i < RHI::ShaderStage_Count; ++i) + { + if (m_ShaderModules[i] != oth.m_ShaderModules[i]) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +// +// SGeometryKey +// +//---------------------------------------------------------------------------- + +SGeometryKey::SGeometryKey() +: m_GeomType(Geom_Mesh) +{ +} + +//---------------------------------------------------------------------------- + +PGeometryResource SGeometryKey::RenderThread_CreateResource(const SCreateArg &args) +{ + PGeometryResource geom = PK_NEW(CGeometryResource); + + if (geom == null) + { + CLog::Log(PK_ERROR, "Could not allocate geometry resource"); + return null; + } + if (m_GeomType == Geom_Mesh) + { + if (m_Path.Empty() || args.m_ResourceManagers.Empty()) + return null; + + TResourcePtr sourceMesh; + for (auto resourceManager : args.m_ResourceManagers) + { + sourceMesh = resourceManager->Load(m_Path, false, SResourceLoadCtl(false, true)); + if (sourceMesh != null && !sourceMesh->Empty()) + break; + } + + if (sourceMesh == null || sourceMesh->Empty()) + { + CLog::Log(PK_ERROR, "Could not load mesh \"%s\"", m_Path.Data()); + return null; + } + const Utils::MeshSemanticFlags semantics[] = + { + Utils::MeshPositions, + Utils::MeshNormals, + Utils::MeshTangents, + Utils::MeshColors, + Utils::MeshTexcoords, + Utils::MeshColors1, + Utils::MeshTexcoords1, + Utils::MeshBoneIds, + Utils::MeshBoneWeights, + }; + if (!Utils::CreateGpuBuffers(args.m_ApiManager, &(*sourceMesh), semantics, geom->m_PerGeometryViews)) + { + CLog::Log(PK_ERROR, "Could not create the GPU buffers for the geometry resource"); + return null; + } + } + else if (m_GeomType == Geom_Sphere) + { + if (!PK_VERIFY(geom->m_PerGeometryViews.PushBack().Valid())) + return null; + if (!PK_VERIFY(CreateGeomSphere(args.m_ApiManager, 30, geom->m_PerGeometryViews.Last()))) + return null; + } + else if (m_GeomType == Geom_Cube) + { + if (!PK_VERIFY(geom->m_PerGeometryViews.PushBack().Valid())) + return null; + if (!PK_VERIFY(CreateGeomCube(args.m_ApiManager, geom->m_PerGeometryViews.Last()))) + return null; + } + return geom; +} + +//---------------------------------------------------------------------------- + +PGeometryResource SGeometryKey::RenderThread_ReloadResource(const SCreateArg &args) +{ + return RenderThread_CreateResource(args); +} + +//---------------------------------------------------------------------------- + +bool SGeometryKey::operator == (const SGeometryKey &other) const +{ + return m_GeomType == other.m_GeomType && m_Path == other.m_Path; +} + +//---------------------------------------------------------------------------- + +bool SGeometryKey::CreateGeomSphere(const RHI::PApiManager &apiManager, u32 subdivs, Utils::GpuBufferViews &toFill) +{ + float radiusScale = PrimitiveDiscretizers::GetTangentSphereScale(subdivs); +#if 0 + float computedEdgeSize = (vtx1 - vtx2).Length(); + // Find longest edge bruteforce: + float longestEdgeSq = 0.0f; + const u32 *idxBuff = static_cast(batch.m_IStream.RawStream()); + const TStridedMemoryView posBuff = batch.m_VStream.Positions(); + for (u32 i = 0; i < batch.m_IStream.IndexCount(); i += 3) + { + u32 idx0 = idxBuff[i + 0]; + u32 idx1 = idxBuff[i + 1]; + u32 idx2 = idxBuff[i + 2]; + CFloat3 edge1 = posBuff[idx0] - posBuff[idx1]; + CFloat3 edge2 = posBuff[idx1] - posBuff[idx2]; + CFloat3 edge3 = posBuff[idx2] - posBuff[idx0]; + float edge1SqLength = edge1.LengthSquared(); + float edge2SqLength = edge2.LengthSquared(); + float edge3SqLength = edge3.LengthSquared(); + + if (edge1SqLength > longestEdgeSq) + longestEdgeSq = edge1SqLength; + if (edge2SqLength > longestEdgeSq) + longestEdgeSq = edge2SqLength; + if (edge3SqLength > longestEdgeSq) + longestEdgeSq = edge3SqLength; + } + CLog::Log(PK_INFO, "longest distance found = %f", sqrtf(longestEdgeSq)); +#endif + + // Create the light spheres geometry: + CMeshTriangleBatch batch; + + batch.m_IStream.SetPrimitiveType(CMeshIStream::Triangles); + batch.m_VStream.Reformat(VertexDeclaration::Position3f); + PrimitiveDiscretizers::BuildSphere(batch, CFloat4x4::IDENTITY, radiusScale, 0.0f, CFloat3::ONE, 1.0f, CFloat4::ONE, subdivs, Frame_RightHand_Y_Up); + + TStridedMemoryView srcPositions = batch.m_VStream.Positions(); + const u32 idxBuffSize = batch.m_IStream.IndexCount() * sizeof(u32); + const u32 *srcIndices = batch.m_IStream.Stream(); + + RHI::PGpuBuffer vertexBuff = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Sphere Vertex Buffer"), RHI::VertexBuffer, srcPositions.Count() * sizeof(CFloat3), RHI::UsageStaticDraw); + RHI::PGpuBuffer indexBuff = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Sphere Index Buffer"), RHI::IndexBuffer, idxBuffSize, RHI::UsageStaticDraw); + + if (!PK_VERIFY(vertexBuff != null && indexBuff != null)) + return false; + + CFloat3 *mappedPos = static_cast(apiManager->MapCpuView(vertexBuff)); + u32 *mappedIdx = static_cast(apiManager->MapCpuView(indexBuff)); + + if (!PK_VERIFY(mappedPos != null && mappedIdx != null)) + return false; + + for (u32 v = 0; v < srcPositions.Count(); ++v) + { + mappedPos[v] = srcPositions[v]; + } + + Mem::Copy(mappedIdx, srcIndices, idxBuffSize); + + apiManager->UnmapCpuView(vertexBuff); + apiManager->UnmapCpuView(indexBuff); + + if (!PK_VERIFY(toFill.m_VertexBuffers.PushBack(vertexBuff).Valid())) + return false; + toFill.m_IndexBuffer = indexBuff; + toFill.m_IndexBufferSize = RHI::IndexBuffer32Bit; + return true; +} + +//---------------------------------------------------------------------------- + +bool SGeometryKey::CreateGeomCube(const RHI::PApiManager &apiManager, Utils::GpuBufferViews &toFill) +{ + // Create the light spheres geometry: + CMeshTriangleBatch batch; + + batch.m_IStream.SetPrimitiveType(CMeshIStream::Triangles); + batch.m_VStream.Reformat(VertexDeclaration::Position3f); + PrimitiveDiscretizers::BuildBox(batch, CFloat4x4::IDENTITY, CAABB(-CFloat3::ONE, CFloat3::ONE), CFloat4::ONE); + + TStridedMemoryView srcPositions = batch.m_VStream.Positions(); + const u32 idxBuffSize = batch.m_IStream.IndexCount() * sizeof(u32); + const u32 *srcIndices = batch.m_IStream.Stream(); + + RHI::PGpuBuffer vertexBuff = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Cube Vertex Buffer"), RHI::VertexBuffer, srcPositions.Count() * sizeof(CFloat3), RHI::UsageStaticDraw); + RHI::PGpuBuffer indexBuff = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Cube Index Buffer"), RHI::IndexBuffer, idxBuffSize, RHI::UsageStaticDraw); + + if (!PK_VERIFY(vertexBuff != null && indexBuff != null)) + return false; + + CFloat3 *mappedPos = static_cast(apiManager->MapCpuView(vertexBuff)); + u32 *mappedIdx = static_cast(apiManager->MapCpuView(indexBuff)); + + if (!PK_VERIFY(mappedPos != null && mappedIdx != null)) + return false; + + for (u32 v = 0; v < srcPositions.Count(); ++v) + { + mappedPos[v] = srcPositions[v]; + } + + Mem::Copy(mappedIdx, srcIndices, idxBuffSize); + + apiManager->UnmapCpuView(vertexBuff); + apiManager->UnmapCpuView(indexBuff); + + if (!PK_VERIFY(toFill.m_VertexBuffers.PushBack(vertexBuff).Valid())) + return false; + toFill.m_IndexBuffer = indexBuff; + toFill.m_IndexBufferSize = RHI::IndexBuffer32Bit; + return true; +} + +//---------------------------------------------------------------------------- + +void SGeometryKey::SetupDefaultResource() +{ + SPrepareArg args; + SGeometryKey key; + + key.m_GeomType = Geom_Mesh; + key.m_Path = "Meshes/default.pkmm"; + + s_DefaultResourceID = CGeometryManager::UpdateThread_GetResource(key, args); +} + +//---------------------------------------------------------------------------- + +CGeometryManager::CResourceId SGeometryKey::s_DefaultResourceID; + +//---------------------------------------------------------------------------- +// +// SSoundKey +// +//---------------------------------------------------------------------------- + +bool SSoundKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + (void)args; + return true; +} + +//---------------------------------------------------------------------------- + +PSoundResource SSoundKey::RenderThread_CreateResource(const SCreateArg &args) +{ + PSoundResource sndres = PK_NEW(CSoundResource); + if (sndres == null) + { + CLog::Log(PK_ERROR, "Could not allocate sound resource for \"%s\"", m_Path.Data()); + return null; + } + + sndres->m_SoundData = null; + sndres->m_Frequency = 0.f; // cannot get the frequency from here + sndres->m_Length = -1.f; + +#if (PK_BUILD_WITH_FMODEX_SUPPORT != 0) + if (args.m_SoundSystem == null) + { + CLog::Log(PK_ERROR, "Could not create sound resource (null FMOD system) for \"%s\"", m_Path.Data()); + PK_ASSERT_NOT_REACHED_MESSAGE("FMOD System is null (it can be an FMOD failure or an implementation miss)"); + return null; + } + + if (!m_Path.Empty()) // no path: not an issue, just an empty resource + { + // Fix #4138: Audio files with filenames containing special unicode characters do not load & playback properly + // With this version of fmod, we must explicitly pass it unicode strings. + // Apparently from what I gathered from the online docs fmod studio now has removed all that, + // and all file-related functions accept UTF-8 strings. + + const CString soundPath = args.m_RootPath / m_Path; + const CStringUnicode soundPathUTF16 = CStringUnicode::FromUTF8(soundPath.Data()); + FMOD_RESULT res = args.m_SoundSystem->createSound((const char*)soundPathUTF16.Data(), FMOD_LOOP_OFF | FMOD_3D | FMOD_UNICODE, 0, &sndres->m_SoundData); + if (res != FMOD_OK) + { + CLog::Log(PK_ERROR, "FMOD: Failed to load sound \"%s\" (%d)", soundPath.Data(), res); + } + else + { + // get the sound length + u32 soundDurationMs = 0; + res = sndres->m_SoundData->getLength(&soundDurationMs, FMOD_TIMEUNIT_MS); + if (res != FMOD_OK) + CLog::Log(PK_ERROR, "FMOD: Failed to get sound length \"%s\" (%d)", soundPath.Data(), res); + else + sndres->m_Length = soundDurationMs * 0.001f; + } + } +#else + (void)args; +#endif + return sndres; +} + +//---------------------------------------------------------------------------- + +PSoundResource SSoundKey::RenderThread_ReloadResource(const SCreateArg &args) +{ + return RenderThread_CreateResource(args); +} + +//---------------------------------------------------------------------------- + +bool SSoundKey::operator == (const SSoundKey &oth) const +{ + return m_Path == oth.m_Path; +} + +//---------------------------------------------------------------------------- +// +// SConstantAtlasKey +// +//---------------------------------------------------------------------------- + +PConstantAtlas SConstantAtlasKey::RenderThread_CreateResource(const SCreateArg &args) +{ + PConstantAtlas atlas = PK_NEW(CConstantAtlas); + if (atlas == null) + { + CLog::Log(PK_ERROR, "Could not allocate texture atlas data"); + return null; + } + + const u32 atlasCount = m_SourceAtlas->m_RectsFp32.Count(); + + PK_ASSERT(SConstantAtlasKey::GetAtlasConstantSetLayout().m_Constants.Count() == 1); + + RHI::PConstantSet atlasConstSet = args.m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Atlas Constant Set"), GetAtlasConstantSetLayout()); + const u32 atlasBufferByteSize = 1 * sizeof(u32) + atlasCount * sizeof(CFloat4); + RHI::PGpuBuffer atlasBuffer = args.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Atlas Buffer"), RHI::RawBuffer, atlasBufferByteSize, RHI::UsageStaticDraw); + + if (atlasBuffer == null || atlasConstSet == null) + { + CLog::Log(PK_ERROR, "Could not create constant buffer for texture atlas"); + return null; + } + if (!atlasConstSet->SetConstants(atlasBuffer, 0)) + { + CLog::Log(PK_ERROR, "Could not set texture atlas data in constant buffer"); + return null; + } + + { + void *ptr = args.m_ApiManager->MapCpuView(atlasBuffer); + u32 *count = reinterpret_cast(Mem::AdvanceRawPointer(ptr, 0)); + *count = m_SourceAtlas->m_RectsFp32.Count(); + CFloat4 *data = reinterpret_cast(Mem::AdvanceRawPointer(ptr, sizeof(u32))); + PK_ASSERT(m_SourceAtlas->m_RectsFp32.Stride() == sizeof(CFloat4)); + Mem::Copy(data, m_SourceAtlas->m_RectsFp32.RawDataPointer(), m_SourceAtlas->m_RectsFp32.CoveredBytes()); + args.m_ApiManager->UnmapCpuView(atlasBuffer); + } + + atlasConstSet->UpdateConstantValues(); + atlas->m_AtlasConstSet = atlasConstSet; + atlas->m_AtlasBuffer = atlasBuffer; + + return atlas; +} + +//---------------------------------------------------------------------------- + +PConstantAtlas SConstantAtlasKey::RenderThread_ReloadResource(const SCreateArg &args) +{ + return RenderThread_CreateResource(args); +} + +//---------------------------------------------------------------------------- + +bool SConstantAtlasKey::operator == (const SConstantAtlasKey &other) const +{ + if ((m_SourceAtlas == null) != (other.m_SourceAtlas == null)) + return false; + return m_Path == other.m_Path; + //return m_SourceAtlas == other.m_SourceAtlas; +} + +//---------------------------------------------------------------------------- + +static const RHI::SConstantSetLayout *s_AtlasConstantSetLayout = null; + +//---------------------------------------------------------------------------- + +const RHI::SConstantSetLayout &SConstantAtlasKey::GetAtlasConstantSetLayout() +{ + PK_ASSERT(s_AtlasConstantSetLayout != null); + return *s_AtlasConstantSetLayout; +} + +//---------------------------------------------------------------------------- + +void SConstantAtlasKey::SetupConstantSetLayout() +{ + RHI::SConstantSetLayout *layout = PK_NEW(RHI::SConstantSetLayout(static_cast(RHI::VertexShaderMask | RHI::GeometryShaderMask | RHI::FragmentShaderMask))); + if (layout != null && layout->m_Constants.Empty()) + { + RHI::SRawBufferDesc atlas("Atlas"); + if (!layout->AddConstantsLayout(atlas)) + { + PK_DELETE(layout); + return; + } + } + s_AtlasConstantSetLayout = layout; +} + +//---------------------------------------------------------------------------- + +void SConstantAtlasKey::ClearConstantSetLayoutIFN() +{ + RHI::SConstantSetLayout *layout = const_cast(s_AtlasConstantSetLayout); + if (layout != null) + PK_DELETE(layout); +} + +//---------------------------------------------------------------------------- +// Constant noise data +//---------------------------------------------------------------------------- + +static const RHI::SConstantSetLayout *s_NoiseTextureConstantSetLayout = null; + +//---------------------------------------------------------------------------- + +const RHI::SConstantSetLayout &SConstantNoiseTextureKey::GetNoiseTextureConstantSetLayout() +{ + PK_ASSERT(s_NoiseTextureConstantSetLayout != null); + return *s_NoiseTextureConstantSetLayout; +} + +//---------------------------------------------------------------------------- + +void SConstantNoiseTextureKey::SetupConstantSetLayout() +{ + RHI::SConstantSetLayout *layout = PK_NEW(RHI::SConstantSetLayout()); + + if (layout != null && layout->m_Constants.Empty()) + { + layout->m_ShaderStagesMask = RHI::FragmentShaderMask; + if (!layout->AddConstantsLayout(RHI::SConstantSamplerDesc(GetResourceName(), RHI::SamplerTypeSingle))) + { + PK_DELETE(layout); + return; + } + } + s_NoiseTextureConstantSetLayout = layout; +} + +//---------------------------------------------------------------------------- + +void SConstantNoiseTextureKey::ClearConstantSetLayoutIFN() +{ + RHI::SConstantSetLayout *layout = const_cast(s_NoiseTextureConstantSetLayout); + if (layout != null) + PK_DELETE(layout); +} + +//---------------------------------------------------------------------------- +// +// SConstantDrawRequests +// +//---------------------------------------------------------------------------- + +static RHI::SConstantSetLayout *s_DrawRequestsConstantSetLayout_Billboard = null; +static RHI::SConstantSetLayout *s_DrawRequestsConstantSetLayout_Triangle = null; + +//---------------------------------------------------------------------------- + +const RHI::SConstantSetLayout &SConstantDrawRequests::GetConstantSetLayout(ERendererClass rendererType) +{ + if (rendererType == Renderer_Triangle) + { + PK_ASSERT(s_DrawRequestsConstantSetLayout_Triangle != null); + return *s_DrawRequestsConstantSetLayout_Triangle; + } + else + { + PK_ASSERT(s_DrawRequestsConstantSetLayout_Billboard != null); + return *s_DrawRequestsConstantSetLayout_Billboard; + } +} + +//---------------------------------------------------------------------------- + +bool SConstantDrawRequests::GetConstantBufferDesc(RHI::SConstantBufferDesc &outDesc, u32 elementCount, ERendererClass rendererType) +{ + if (rendererType == Renderer_Triangle) + { + outDesc.m_Name = "TriangleInfo"; + + // (see Drawers::STriangleDrawRequest for more details) + // Float: NormalsBendingFactor + return outDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "DrawRequest", elementCount / 4)); + } + else if (rendererType == Renderer_Mesh) + { + outDesc.m_Name = "GPUMeshPushConstants"; + return outDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "DrawRequest")) && + outDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "IndirectionOffsetsIndex")); + } + else + { + outDesc.m_Name = "BillboardInfo"; + + // (see Drawers::SBillboardDrawRequest for more details) + // Float0: Flags + // Float1: NormalsBendingFactor + // Float2: AspectRatio (TO BE REMOVED) + // Float3: AxisScale (TO BE REMOVED) + return outDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "DrawRequest", elementCount)); + } +} + +//---------------------------------------------------------------------------- + +void SConstantDrawRequests::SetupConstantSetLayouts() +{ + if (s_DrawRequestsConstantSetLayout_Billboard == null) + { + RHI::SConstantSetLayout *layout = PK_NEW(RHI::SConstantSetLayout(static_cast(RHI::GeometryShaderMask | RHI::VertexShaderMask))); + if (layout != null && layout->m_Constants.Empty()) + { + RHI::SConstantBufferDesc bufferDesc; + + if (!GetConstantBufferDesc(bufferDesc, 0x100, Renderer_Billboard) || + !layout->AddConstantsLayout(bufferDesc)) + { + PK_DELETE(layout); + return; + } + } + s_DrawRequestsConstantSetLayout_Billboard = layout; + } + if (s_DrawRequestsConstantSetLayout_Triangle == null) + { + RHI::SConstantSetLayout *layout = PK_NEW(RHI::SConstantSetLayout(static_cast(RHI::VertexShaderMask))); + if (layout != null && layout->m_Constants.Empty()) + { + RHI::SConstantBufferDesc bufferDesc; + + if (!GetConstantBufferDesc(bufferDesc, 0x100, Renderer_Triangle) || + !layout->AddConstantsLayout(bufferDesc)) + { + PK_DELETE(layout); + return; + } + } + s_DrawRequestsConstantSetLayout_Triangle = layout; + } +} + +//---------------------------------------------------------------------------- + +void SConstantDrawRequests::ClearConstantSetLayoutsIFN() +{ + PK_SAFE_DELETE(s_DrawRequestsConstantSetLayout_Billboard); + PK_SAFE_DELETE(s_DrawRequestsConstantSetLayout_Triangle); +} + +//---------------------------------------------------------------------------- +// +// SConstantVertexBillboarding +// +//---------------------------------------------------------------------------- + +bool SConstantVertexBillboarding::GetPushConstantBufferDesc(RHI::SPushConstantBuffer &outDesc, bool gpuStorage) +{ + // If gpu sim, push constant will also contain an index into the draw request stream offsets + + outDesc.m_Name = "GPUBillboardPushConstants"; + outDesc.m_ShaderStagesMask = RHI::VertexShaderMask; + + bool success = true; + + success &= outDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "IndicesOffset")); + + if (gpuStorage) + success &= outDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "StreamOffsetsIndex")); + + return success; +} + +//---------------------------------------------------------------------------- +// +// Renderer Cache Manager +// +//---------------------------------------------------------------------------- + +RHI::PRenderState CRendererCache::GetRenderState(EShaderOptions option, ESampleLibGraphicResources_RenderPass renderPass, u32 *neededConstants) +{ + for (u32 i = 0; i < m_RenderStates.Count(); ++i) + { + if (m_RenderStates[i].m_Options == option) + { + if (renderPass == __MaxParticlePass || m_RenderStates[i].m_RenderPassIdx == renderPass) + { + if (neededConstants != null) + *neededConstants = m_RenderStates[i].m_NeededConstants; + if (m_RenderStates[i].m_RenderState == null && !m_RenderStates[i].m_Expected) + { + m_RenderStates[i].m_Expected = true; + CRendererCacheManager::RenderThread_CreateMissingResources(m_LastCreateArgs); + } + return m_RenderStates[i].m_RenderState; + } + } + } + return null; +} + +//---------------------------------------------------------------------------- + +RHI::PComputeState CRendererCache::GetComputeState(EComputeShaderType type) +{ + for (u32 i = 0; i < m_ComputeStates.Count(); ++i) + { + if (m_ComputeStates[i].m_Type == type) + { + if (m_ComputeStates[i].m_ComputeState == null && !m_ComputeStates[i].m_Expected) + { + m_ComputeStates[i].m_Expected = true; + CRendererCacheManager::RenderThread_CreateMissingResources(m_LastCreateArgs); + } + return m_ComputeStates[i].m_ComputeState; + } + } + return null; +} + +//---------------------------------------------------------------------------- + +bool CRendererCache::GetGPUStorageConstantSets(EShaderOptions option, const RHI::SConstantSetLayout *&outSimDataConstantSet, const RHI::SConstantSetLayout *&outOffsetsConstantSet) const +{ + for (u32 i = 0; i < m_RenderStates.Count(); ++i) + { + if (m_RenderStates[i].m_Options == option) + { + outSimDataConstantSet = &m_RenderStates[i].m_GPUStorageSimDataConstantSetLayout; + outOffsetsConstantSet = &m_RenderStates[i].m_GPUStorageOffsetsConstantSetLayout; + return true; + } + } + return false; +} + +//---------------------------------------------------------------------------- + +PK_NOINLINE bool SRendererCacheKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + bool result = true; + +#define MULT_OPTION(_opt, index) \ + do { \ + const u32 opcount = options.Count() - index; \ + PK_VERIFY(options.Resize(index + opcount * 2)); \ + for (u32 i = index, j = 0; j < opcount; ++i, ++j) \ + options[opcount + i] = options[i] | _opt; \ + } while (0) + + // Gen options + TStaticCountedArray options; + // Needed compute shaders + TStaticCountedArray computeShaderTypes; + + if (args.m_Renderer->m_RendererType == ERendererClass::Renderer_Billboard) + { +#if !defined(PK_ORBIS) + if (args.m_GpuCaps.m_SupportsGeometryShaders) + { + PK_VERIFY(options.PushBack(Option_GeomBillboarding).Valid()); + PK_VERIFY(options.PushBack(Option_GeomBillboarding | Option_Axis_C1).Valid()); + PK_VERIFY(options.PushBack(Option_GeomBillboarding | Option_Axis_C1 | Option_Capsule).Valid()); + PK_VERIFY(options.PushBack(Option_GeomBillboarding | Option_Axis_C2).Valid()); +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + MULT_OPTION(Option_GPUStorage, 0); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + MULT_OPTION(Option_BillboardSizeFloat2, 0); + } +#endif + if (args.m_GpuCaps.m_SupportsShaderResourceViews) + { + const u32 optCount = options.Count(); + PK_VERIFY(options.PushBack(Option_VertexBillboarding).Valid()); + PK_VERIFY(options.PushBack(Option_VertexBillboarding | Option_Axis_C1).Valid()); + PK_VERIFY(options.PushBack(Option_VertexBillboarding | Option_Axis_C1 | Option_Capsule).Valid()); + PK_VERIFY(options.PushBack(Option_VertexBillboarding | Option_Axis_C2).Valid()); +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + MULT_OPTION(Option_GPUStorage, optCount); + MULT_OPTION(Option_GPUSort, optCount); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeSortKeys).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeSortKeys_CameraDistance).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_SortUpSweep).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_SortPrefixSum).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_SortDownSweep).Valid()); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + MULT_OPTION(Option_BillboardSizeFloat2, optCount); + } + } + else if (args.m_Renderer->m_RendererType == ERendererClass::Renderer_Triangle) + { + if (args.m_GpuCaps.m_SupportsShaderResourceViews) + { + PK_VERIFY(options.PushBack(Option_TriangleVertexBillboarding).Valid()); + } + } + else if (args.m_Renderer->m_RendererType == ERendererClass::Renderer_Mesh) + { + PK_VERIFY(options.PushBack(Option_GPUMesh).Valid()); +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeParticleCountPerMesh).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeParticleCountPerMesh_MeshAtlas).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeParticleCountPerMesh_LOD).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeParticleCountPerMesh_LOD_MeshAtlas).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_InitIndirectionOffsetsBuffer).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_InitIndirectionOffsetsBuffer_LODNoAtlas).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeMeshIndirectionBuffer).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeMeshIndirectionBuffer_MeshAtlas).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeMeshIndirectionBuffer_LOD).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeMeshIndirectionBuffer_LOD_MeshAtlas).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeMeshMatrices).Valid()); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0 + } + else if (args.m_Renderer->m_RendererType == ERendererClass::Renderer_Ribbon) + { + if (args.m_GpuCaps.m_SupportsShaderResourceViews) + { +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + // RenderStates + const u32 optCount = options.Count(); + PK_VERIFY(options.PushBack(Option_RibbonVertexBillboarding | Option_GPUStorage).Valid()); + PK_VERIFY(options.PushBack(Option_RibbonVertexBillboarding | Option_GPUStorage | Option_Axis_C1).Valid()); + MULT_OPTION(Option_GPUSort, optCount); + + // Compute states + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeSortKeys_RibbonIndirection).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeSortKeys_CameraDistance_RibbonIndirection).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_SortUpSweep).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_SortPrefixSum).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_SortDownSweep).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_SortUpSweep_KeyStride64).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_SortDownSweep_KeyStride64).Valid()); + PK_VERIFY(computeShaderTypes.PushBack(ComputeType_ComputeRibbonSortKeys).Valid()); +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) + } + } + + for (u32 i = 0; i < options.Count(); ++i) + options[i] = options[i] | Option_VertexPassThrough; + + options.PushBack(Option_VertexPassThrough); + +#undef MULT_OPTION + + m_RenderPasses = args.m_RenderPasses; + + for (const auto &option : options) + result &= PushRenderState(args, option); + + if (!result) + CLog::Log(PK_ERROR, "Push render state failed"); + + for (const auto &computeShaderType : computeShaderTypes) + result &= PushComputeState(args, computeShaderType); + + if (!result) + CLog::Log(PK_ERROR, "Push Compute state failed"); + + return result; +} + +//---------------------------------------------------------------------------- + +bool SRendererCacheKey::PushRenderState(const SPrepareArg &args, EShaderOptions options) +{ + for (u32 i = 0; i < m_RenderPasses.Count(); ++i) + { + if (!m_RenderStates.PushBack().Valid()) + return false; + SRendererCacheKey::SRenderStateFeature &renderState = m_RenderStates.Last(); + SRenderStateKey renderStateKey; + renderStateKey.m_Options = options; + renderStateKey.m_RenderPassIdx = m_RenderPasses[i]; + renderState.m_RenderPassIdx = m_RenderPasses[i]; + renderState.m_RenderState = CRenderStateManager::UpdateThread_GetResource(renderStateKey, args); + renderState.m_Options = options; + renderState.m_NeededConstants = renderStateKey.GetNeededConstants(); + if (!m_RenderStates.Last().m_RenderState.Valid()) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool SRendererCacheKey::PushComputeState(const SPrepareArg &args, EComputeShaderType type) +{ + if (!m_ComputeStates.PushBack().Valid()) + return false; + SRendererCacheKey::SComputeStateFeature &computeState = m_ComputeStates.Last(); + SComputeStateKey computeStateKey; + computeStateKey.m_Type = type; + computeState.m_ComputeState = CComputeStateManager::UpdateThread_GetResource(computeStateKey, args); + computeState.m_Type = type; + return m_ComputeStates.Last().m_ComputeState.Valid(); +} + +//---------------------------------------------------------------------------- + +template<> +bool TGraphicResourceManager::RenderThread_CreateMissingResources(const SCreateArg &args) +{ + bool success = true; + + PK_SCOPEDLOCK(m_ResourcesLock); + for (u32 i = 0; i < m_Resources.Count(); ++i) + { + if (!m_Resources[i].m_IsSlotEmpty && (m_Resources[i].m_ResourcePtr == null || m_Resources[i].m_ResourceKey.RenderThread_IsPartiallyBuilt(m_Resources[i].m_ResourcePtr))) + { + m_Resources[i].m_ResourcePtr = m_Resources[i].m_ResourceKey.RenderThread_CreateResource(args, m_Resources[i].m_ResourcePtr); + if (m_Resources[i].m_ResourcePtr == null) + success = false; + } + } + return success; +} + +//---------------------------------------------------------------------------- + +PRendererCache SRendererCacheKey::RenderThread_CreateResource(const SCreateArg &args, PRendererCache rendererCache) +{ + if (rendererCache == null) + rendererCache = PK_NEW(CRendererCache); + + if (rendererCache == null || + !rendererCache->m_RenderStates.Resize(m_RenderStates.Count()) || + !rendererCache->m_ComputeStates.Resize(m_ComputeStates.Count())) + { + CLog::Log(PK_ERROR, "Could not create renderer cache"); + return null; + } + + rendererCache->m_LastCreateArgs = args; + rendererCache->m_RenderPasses = m_RenderPasses; + for (u32 i = 0; i < m_RenderStates.Count(); ++i) + { + CRendererCache::SRenderStateFeature &renderState = rendererCache->m_RenderStates[i]; + if (renderState.m_RenderState != null) + continue; + renderState.m_RenderPassIdx = m_RenderStates[i].m_RenderPassIdx; + renderState.m_Options = m_RenderStates[i].m_Options; + renderState.m_NeededConstants = m_RenderStates[i].m_NeededConstants; + + if (renderState.m_Expected) + { + renderState.m_RenderState = CRenderStateManager::RenderThread_ResolveResource(m_RenderStates[i].m_RenderState, args); + if (renderState.m_RenderState == null) + { + CLog::Log(PK_INFO, "Could not create render state"); + } + } + const bool vertexBB = (renderState.m_Options & Option_VertexBillboarding) || + (renderState.m_Options & Option_TriangleVertexBillboarding) || + (renderState.m_Options & Option_RibbonVertexBillboarding); + const bool gpuStorage = renderState.m_Options & Option_GPUStorage; + const bool GPUMesh = renderState.m_Options & Option_GPUMesh; + if (vertexBB || GPUMesh) + { + // Right now, we know the last added constant set layout is the vertex bb one (see MaterialToRHI.cpp) + const RHI::SShaderBindings &shaderBindings = CRenderStateManager::RenderThread_GetKey(m_RenderStates[i].m_RenderState).GetGeneratedShaderBindings(); + renderState.m_GPUStorageSimDataConstantSetLayout = shaderBindings.m_ConstantSets.Last(); // copy + + // And stream offsets (if any) were added right before + if (gpuStorage || GPUMesh) + renderState.m_GPUStorageOffsetsConstantSetLayout = shaderBindings.m_ConstantSets[shaderBindings.m_ConstantSets.Count() - 2]; // copy + } + } + + for (u32 i = 0; i < m_ComputeStates.Count(); ++i) + { + CRendererCache::SComputeStateFeature &computeState = rendererCache->m_ComputeStates[i]; + if (computeState.m_ComputeState != null) + continue; + computeState.m_Type = m_ComputeStates[i].m_Type; + if (computeState.m_Expected) + { + computeState.m_ComputeState = CComputeStateManager::RenderThread_ResolveResource(m_ComputeStates[i].m_ComputeState, args); + if (computeState.m_ComputeState == null) + { + CLog::Log(PK_INFO, "Could not create compute state"); + } + } + } + + return rendererCache; +} + +//---------------------------------------------------------------------------- + +bool SRendererCacheKey::RenderThread_IsPartiallyBuilt(const PRendererCache &rendererCache) const +{ + if (rendererCache == null) + return false; + for (u32 i = 0; i < m_RenderStates.Count(); ++i) + { + if (rendererCache->m_RenderStates[i].m_RenderState == null && rendererCache->m_RenderStates[i].m_Expected) + return true; + } + for (u32 i = 0; i < m_ComputeStates.Count(); ++i) + { + if (rendererCache->m_ComputeStates[i].m_ComputeState == null && rendererCache->m_ComputeStates[i].m_Expected) + return true; + } + return false; +} + +//---------------------------------------------------------------------------- + +void SRendererCacheKey::UpdateThread_ReleaseDependencies() +{ + for (const SRenderStateFeature &renderStateFeature : m_RenderStates) + { + if (renderStateFeature.m_RenderState.Valid()) + CRenderStateManager::UpdateThread_ReleaseResource(renderStateFeature.m_RenderState); + } + + for (const SComputeStateFeature &computeStateFeature : m_ComputeStates) + { + if (computeStateFeature.m_ComputeState.Valid()) + CComputeStateManager::UpdateThread_ReleaseResource(computeStateFeature.m_ComputeState); + } +} + +//---------------------------------------------------------------------------- + +bool SRendererCacheKey::operator == (const SRendererCacheKey &oth) const +{ + if (m_RenderStates.Count() != oth.m_RenderStates.Count()) + return false; + for (u32 i = 0; i < m_RenderStates.Count(); ++i) + { + if (m_RenderStates[i].m_RenderState != oth.m_RenderStates[i].m_RenderState) + return false; + } + + if (m_ComputeStates.Count() != oth.m_ComputeStates.Count()) + return false; + for (u32 i = 0; i < m_ComputeStates.Count(); ++i) + { + if (m_ComputeStates[i].m_ComputeState != oth.m_ComputeStates[i].m_ComputeState) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +// +// Renderer Cache Instance Manager +// +//---------------------------------------------------------------------------- + +PK_NOINLINE bool SRendererCacheInstanceKey::UpdateThread_Prepare(const SPrepareArg &args) +{ + if (args.m_Renderer->m_RendererType == Renderer_Sound) + { + const SRendererFeaturePropertyValue *soundProperty = args.m_Renderer->m_Declaration.FindProperty(BasicRendererProperties::SID_Sound_SoundData()); + + if (!PK_VERIFY(soundProperty != null)) + return false; + + SSoundKey soundKey; + soundKey.m_Path = soundProperty->m_ValuePath; + + m_Sound = CSoundResourceManager::UpdateThread_GetResource(soundKey, args); + return true; + } + + //------------------------------------------------------------ + // Create the constant set layout: + //------------------------------------------------------------ + TArray textureProperties; + m_constantProperties.Clear(); + if (!MaterialToRHI::CreateConstantSetLayout(MaterialToRHI::SGenericArgs(args), "Material", m_ConstSetLayout, &textureProperties, &m_constantProperties, &m_ContentHash)) + return false; + + //------------------------------------------------------------ + // Create the renderer cache: + //------------------------------------------------------------ + SRendererCacheKey rendererCacheKey; + + m_Cache = CRendererCacheManager::UpdateThread_GetResource(rendererCacheKey, args); + if (!m_Cache.Valid()) + return false; + + //------------------------------------------------------------ + // Create the textures: + //------------------------------------------------------------ + for (u32 i = 0; i < textureProperties.Count(); ++i) + { + STextureKey textureKey; + CTextureManager::CResourceId textureId; + + textureKey.m_Path = textureProperties[i].m_Property->ValuePath(); + textureKey.m_LoadAsSRGB = textureProperties[i].m_LoadAsSRGB; + + textureId = CTextureManager::UpdateThread_GetResource(textureKey, args); + if (!textureId.Valid() || !m_Textures.PushBack(textureId).Valid()) + return false; + } + + //------------------------------------------------------------ + // Create the sampler: + //------------------------------------------------------------ + if (!m_Samplers.Resize(textureProperties.Count())) + return false; + for (u32 i = 0; i < textureProperties.Count(); ++i) + { + SConstantSamplerKey samplerKey; + + samplerKey.m_MagFilter = RHI::SampleLinear; + samplerKey.m_MinFilter = RHI::SampleLinearMipmapLinear; + + RHI::EWrapMode wrapMode = RHI::SampleClampToEdge; + + const SRendererFeaturePropertyValue *textureRepeat = args.m_Renderer->m_Declaration.FindProperty(BasicRendererProperties::SID_TextureRepeat()); + const bool isLUT = textureProperties[i].m_Property != null && + (textureProperties[i].m_Property->m_Name == BasicRendererProperties::SID_AlphaRemap_AlphaMap() || + textureProperties[i].m_Property->m_Name == BasicRendererProperties::SID_DiffuseRamp_RampMap()); + if (textureRepeat != null && textureRepeat->ValueB() && !isLUT) + wrapMode = RHI::SampleRepeat; + +#if 1 // Tmp - this should be configurable at texture asset level, and/or at renderer feature property level + const bool vatMaterial = args.m_Renderer->m_Declaration.FindProperty(VertexAnimationRendererProperties::SID_VertexAnimation_Fluid()) || + args.m_Renderer->m_Declaration.FindProperty(VertexAnimationRendererProperties::SID_VertexAnimation_Soft()) || + args.m_Renderer->m_Declaration.FindProperty(VertexAnimationRendererProperties::SID_VertexAnimation_Rigid()); + + if (vatMaterial) + { + if (textureProperties[i].m_Property->m_Name.ToString().Contains("VertexAnimation")) + { + samplerKey.m_MagFilter = RHI::SampleNearest; + samplerKey.m_MinFilter = RHI::SampleNearest; + wrapMode = RHI::SampleRepeat; + } + } +#endif + + samplerKey.m_WrapU = wrapMode; + samplerKey.m_WrapV = wrapMode; + samplerKey.m_WrapW = wrapMode; + + samplerKey.m_MipmapCount = 16; + m_Samplers[i] = CConstantSamplerManager::UpdateThread_GetResource(samplerKey, args); + if (!m_Samplers[i].Valid()) + return false; + } + + const SRendererDeclaration &decl = args.m_Renderer->m_Declaration; + m_HasAtlas = decl.IsFeatureEnabled(BasicRendererProperties::SID_Atlas()); + if (args.m_Renderer->m_RendererType == Renderer_Billboard || + args.m_Renderer->m_RendererType == Renderer_Ribbon || + args.m_Renderer->m_RendererType == Renderer_Decal || + args.m_Renderer->m_RendererType == Renderer_Mesh) + { + // Create Atlas + if (m_HasAtlas) + { + SConstantAtlasKey atlasKey; + const BasicRendererProperties::EAtlasSource atlasSource = decl.GetPropertyValue_Enum(BasicRendererProperties::SID_Atlas_Source(), BasicRendererProperties::EAtlasSource::External); + if (atlasSource == BasicRendererProperties::EAtlasSource::External) + atlasKey.m_Path = decl.GetPropertyValue_Path(BasicRendererProperties::SID_Atlas_Definition(), CString::EmptyString); + else // Subdivision count + { + const CInt2 &subDivCount = decl.GetPropertyValue_I2(BasicRendererProperties::SID_Atlas_SubDiv(), CInt2::ZERO); + + // Custom name, as we can't rely on comparing CRectangleList strong pointers right now + atlasKey.m_Path = CString::Format("$_ProceduralAtlas_$/%d.%d", subDivCount.x(), subDivCount.y()); + } + + // Warning: This will create a duplicate atlas for Procedural atlases + TResourcePtr atlasResource; + if (LoadRendererAtlas(args.m_Renderer, args.m_ResourceManager, atlasResource)) + { + atlasKey.m_SourceAtlas = &(*atlasResource); // <-- + } + + m_Atlas = CConstantAtlasManager::UpdateThread_GetResource(atlasKey, args); + } + } + if (args.m_Renderer->m_RendererType == Renderer_Mesh) + { + SGeometryKey geometryKey; + const CString &meshPath = decl.GetPropertyValue_Path(BasicRendererProperties::SID_Mesh(), CString::EmptyString); + TResourcePtr meshResource = args.m_ResourceManager->Load(meshPath, false, SResourceLoadCtl(false, true)); + if (meshResource != null && !meshResource->Empty()) + { + geometryKey.m_GeomType = SGeometryKey::Geom_Mesh; + geometryKey.m_Path = meshPath; + } + + m_Geometry = CGeometryManager::UpdateThread_GetResource(geometryKey, args); + } + else if (args.m_Renderer->m_RendererType == Renderer_Light) + { + SGeometryKey geometryKey; + geometryKey.m_GeomType = SGeometryKey::Geom_Sphere; + m_Geometry = CGeometryManager::UpdateThread_GetResource(geometryKey, args); + } + if (args.m_Renderer->m_RendererType == Renderer_Decal) + { + SGeometryKey geometryKey; + geometryKey.m_GeomType = SGeometryKey::Geom_Cube; + m_Geometry = CGeometryManager::UpdateThread_GetResource(geometryKey, args); + } + return true; +} + +//---------------------------------------------------------------------------- + +PRendererCacheInstance SRendererCacheInstanceKey::RenderThread_CreateResource(const SCreateArg &args) +{ + PRendererCacheInstance rendererCacheInstance = PK_NEW(CRendererCacheInstance); + if (rendererCacheInstance == null) + { + CLog::Log(PK_ERROR, "Could not create renderer instance"); + return null; + } + + rendererCacheInstance->m_HasAtlas = m_HasAtlas; + + // Base renderer cache: + if (m_Cache.Valid()) + { + rendererCacheInstance->m_Cache = CRendererCacheManager::RenderThread_ResolveResource(m_Cache, args); + if (rendererCacheInstance->m_Cache == null) + { + CLog::Log(PK_ERROR, "Could not create renderer cache"); + return null; + } + } + + // Constant buffer: + rendererCacheInstance->m_ConstValues = null; + if (!m_ConstSetLayout.m_Constants.Empty()) + { + const RHI::SConstantSetLayout::SConstantDesc &constDesc = m_ConstSetLayout.m_Constants.Last(); + + if (constDesc.m_Type == RHI::TypeConstantBuffer) + { + const RHI::SConstantBufferDesc &bufferDesc = constDesc.m_ConstantBuffer; + + rendererCacheInstance->m_ConstValues = args.m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Material Constant Values Buffer"), RHI::ConstantBuffer, bufferDesc.m_ConstantBufferSize, RHI::UsageStaticDraw); + if (rendererCacheInstance->m_ConstValues == null) + { + CLog::Log(PK_ERROR, "Could not create GPU buffer for material constant values"); + return null; + } + + // Fill the constant buffer + void *buffer = args.m_ApiManager->MapCpuView(rendererCacheInstance->m_ConstValues); + u32 offset = 0; + for (u32 i = 0; i < m_constantProperties.Count(); ++i) + { + const RHI::SConstantVarDesc &varDesc = bufferDesc.m_Constants[i]; + const SRendererFeaturePropertyValue &prop = m_constantProperties[i]; + + u32 datasize = varDesc.RawSizeInBytes(); + + // padding (std140) + if (datasize == 0x08) + { + const u32 offsetAdvance = Mem::Align<0x08>(offset) - offset; + offset += offsetAdvance; + buffer = Mem::AdvanceRawPointer(buffer, offsetAdvance); + } + else if (datasize > 0x08) + { + const u32 offsetAdvance = Mem::Align<0x10>(offset) - offset; + offset += offsetAdvance; + datasize = Mem::Align<0x10>(datasize); + buffer = Mem::AdvanceRawPointer(buffer, offsetAdvance); + } + + if (prop.m_Type == PropertyType_Bool1) + { + const CInt1 valueI( (prop.m_ValueB) ? 1 : 0 ); + Mem::Copy(buffer, &valueI, datasize); + } + else if ( prop.m_Type == PropertyType_Int1 || + prop.m_Type == PropertyType_Int2 || + prop.m_Type == PropertyType_Int3 || + prop.m_Type == PropertyType_Int4 ) + Mem::Copy(buffer, prop.m_ValueI, datasize); + else + Mem::Copy(buffer, prop.m_ValueF, datasize); + + offset += datasize; + buffer = Mem::AdvanceRawPointer(buffer, datasize); + } + args.m_ApiManager->UnmapCpuView(rendererCacheInstance->m_ConstValues); + PK_ASSERT(offset == bufferDesc.m_ConstantBufferSize); + } + } + + // Constant textures: + if (!rendererCacheInstance->m_ConstTextures.Resize(m_Textures.Count())) + { + CLog::Log(PK_ERROR, "Could not allocate texture set for renderer cache"); + return null; + } + for (u32 i = 0; i < m_Textures.Count(); ++i) + { + rendererCacheInstance->m_ConstTextures[i] = CTextureManager::RenderThread_ResolveResource(m_Textures[i], args); + if (rendererCacheInstance->m_ConstTextures[i] == null) + { + CLog::Log(PK_ERROR, "Could not create textures for renderer cache"); + rendererCacheInstance->m_ConstTextures[i] = CTextureManager::RenderThread_ResolveResource(STextureKey::s_DefaultResourceID, args); + if (rendererCacheInstance->m_ConstTextures[i] == null) + return null; + } + } + + // Constant sampler: + if (!rendererCacheInstance->m_ConstSamplers.Resize(m_Samplers.Count())) + { + CLog::Log(PK_ERROR, "Could not allocate samplers for renderer cache"); + return null; + } + for (u32 i = 0; i < m_Samplers.Count(); ++i) + { + rendererCacheInstance->m_ConstSamplers[i] = CConstantSamplerManager::RenderThread_ResolveResource(m_Samplers[i], args); + if (rendererCacheInstance->m_ConstSamplers[i] == null) + { + CLog::Log(PK_ERROR, "Could not create samplers for renderer cache"); + return null; + } + } + + // Constant set: + rendererCacheInstance->m_ConstSet = null; + if (!m_ConstSetLayout.m_Constants.Empty()) + { + u32 textureIdx = 0; + bool success = true; + + rendererCacheInstance->m_ConstSet = args.m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Material Constant Set"), m_ConstSetLayout); + if (rendererCacheInstance->m_ConstSet == null) + { + CLog::Log(PK_ERROR, "Could not create constant set for renderer cache"); + return null; + } + for (u32 i = 0; i < m_ConstSetLayout.m_Constants.Count(); ++i) + { + if (m_ConstSetLayout.m_Constants[i].m_Type == RHI::TypeConstantSampler) + { + PK_ASSERT_MESSAGE(textureIdx == i, "All the textures should be the first constants in the constant set"); + success &= rendererCacheInstance->m_ConstSet->SetConstants( rendererCacheInstance->m_ConstSamplers[textureIdx], + rendererCacheInstance->m_ConstTextures[textureIdx], + i); + ++textureIdx; + } + else if (m_ConstSetLayout.m_Constants[i].m_Type == RHI::TypeConstantBuffer) + { + PK_ASSERT_MESSAGE(i == m_ConstSetLayout.m_Constants.Count() - 1, "The GPU buffer should be the last thing in the constant set"); + success &= rendererCacheInstance->m_ConstSet->SetConstants(rendererCacheInstance->m_ConstValues, i); + } + } + success &= rendererCacheInstance->m_ConstSet->UpdateConstantValues(); + if (!success) + { + CLog::Log(PK_ERROR, "Could not update constant set for renderer cache"); + return null; + } + } + + // Specific geometry + if (m_Geometry.Valid()) + { + rendererCacheInstance->m_AdditionalGeometry = CGeometryManager::RenderThread_ResolveResource(m_Geometry, args); + if (rendererCacheInstance->m_AdditionalGeometry == null || + rendererCacheInstance->m_AdditionalGeometry->m_PerGeometryViews.Count() == 0) + { + CLog::Log(PK_ERROR, "Could not create the mesh for the renderer cache"); + rendererCacheInstance->m_AdditionalGeometry = CGeometryManager::RenderThread_ResolveResource(SGeometryKey::s_DefaultResourceID, args); + rendererCacheInstance->m_Cache = null; // fallback + } + } + + // Atlas + if (m_Atlas.Valid()) + rendererCacheInstance->m_Atlas = CConstantAtlasManager::RenderThread_ResolveResource(m_Atlas, args); + + // Sound + if (m_Sound.Valid()) + rendererCacheInstance->m_Sound = CSoundResourceManager::RenderThread_ResolveResource(m_Sound, args); + + return rendererCacheInstance; +} + +//---------------------------------------------------------------------------- + +void SRendererCacheInstanceKey::UpdateThread_ReleaseDependencies() +{ + if (m_Cache.Valid()) + CRendererCacheManager::UpdateThread_ReleaseResource(m_Cache); + for (u32 i = 0; i < m_Textures.Count(); ++i) + { + if (m_Textures[i].Valid()) + { + CTextureManager::UpdateThread_ReleaseResource(m_Textures[i]); + } + if (m_Samplers[i].Valid()) + CConstantSamplerManager::UpdateThread_ReleaseResource(m_Samplers[i]); + } + if (m_Geometry.Valid()) + CGeometryManager::UpdateThread_ReleaseResource(m_Geometry); +} + +//---------------------------------------------------------------------------- + +bool SRendererCacheInstanceKey::operator == (const SRendererCacheInstanceKey &oth) const +{ + return (m_Atlas == oth.m_Atlas && + m_HasAtlas == oth.m_HasAtlas && + m_Geometry == oth.m_Geometry && + m_Samplers == oth.m_Samplers && + m_Cache == oth.m_Cache && + m_ContentHash == oth.m_ContentHash && + m_Textures == oth.m_Textures && + m_Sound == oth.m_Sound && + m_ConstSetLayout == oth.m_ConstSetLayout); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.h new file mode 100644 index 00000000..3f9b0014 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.h @@ -0,0 +1,777 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" +#include "PK-SampleLib/SampleUtils.h" +#include "PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.h" + +__PK_API_BEGIN +namespace HBO +{ + class CContext; +} + +PK_FORWARD_DECLARE(RectangleList); + +// We use this define for the shadow depth format +// Here we use variance shadow maps, which needs 2 float components +#define IDEAL_SHADOW_DEPTH_FORMAT RHI::FormatFloat32RG + +__PK_API_END + +// Foward declaration of FMOD +namespace FMOD +{ + class System; + class ChannelGroup; + class Sound; + class Channel; +} +typedef unsigned int FMOD_MODE; + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +// SampleLib Graphic Resources enums: +enum ESampleLibGraphicResources_BlendMode +{ + ParticleBlend_Additive = 0, + ParticleBlend_AdditiveNoAlpha, + ParticleBlend_AlphaBlend, + ParticleBlend_AlphaBlendAdditive, + ParticleBlend_Opaque, + ParticleBlend_Distortion, + ParticleBlend_Multiply, + __MaxParticleBlend +}; + +//---------------------------------------------------------------------------- + +enum ESampleLibGraphicResources_RenderPass +{ + ParticlePass_Opaque = 0, // GBuffer pass + ParticlePass_Decal, // Decal render pass + ParticlePass_Lighting, // Light accumulation pass + ParticlePass_Transparent, // Post merging pass + ParticlePass_Distortion, // Distortion Map + ParticlePass_Tint, // Tinting + ParticlePass_TransparentPostDisto, // Transparent particles not affected by distortion + ParticlePass_Debug, // Post bloom, still in HDR Buffer debug pass + ParticlePass_Compositing, // Compositing & UI pass + ParticlePass_OpaqueShadow, // Shadow map + __MaxParticlePass +}; + +enum +{ + kMaxMaxSimultaneousRenderPass = 4, +}; + + +class CRenderPassArray : public TStaticCountedArray +{ +public: + CRenderPassArray() + { + } + + template + CRenderPassArray(ESampleLibGraphicResources_RenderPass(&renderPasses)[_Count]) + : TStaticCountedArray(TMemoryView(renderPasses)) + { } + + CRenderPassArray(ESampleLibGraphicResources_RenderPass renderPass) + : TStaticCountedArray(TMemoryView(renderPass)) + { } +}; + +extern const CStringView s_ParticleRenderPassNames[__MaxParticlePass]; + +//---------------------------------------------------------------------------- + +// Global description of all passes of the app +// Could also be passed as a RenderThread_CreateResource argument +struct SPassDescription +{ + enum EGBufferRT + { + GBufferRT_Diffuse = 0, // GBuffer Diffuse HDR: 0 + GBufferRT_Depth, // GBuffer Depth: 1 + GBufferRT_Emissive, // GBuffer Emissive HDR: 2 + + __GBufferRTCount + }; + + TArray m_FrameBufferLayout; + RHI::PRenderPass m_RenderPass; + CGuid m_SubPassIdx; + + static TArray s_PassDescriptions; + // Bake render state using single pass as reference + // Pass used should be compatible with final passes - see vulkan render pass compatibility + // - https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#renderpass-compatibility + + // Static definition of pass in pixel format, as it was designed + static const TMemoryView s_PassOutputsFormats[__MaxParticlePass]; + static const TMemoryView s_GBufferDefaultFormats; +}; + +//---------------------------------------------------------------------------- + +struct SMaterialSettings +{ + CString m_MaterialName; + CString m_FragmentShaderPath; + CString m_VertexShaderPath; +}; + +//---------------------------------------------------------------------------- + +struct SPrepareArg +{ + CResourceManager *m_ResourceManager; + PCRendererDataBase m_Renderer; + TArray m_FeaturesSettings; + SMaterialSettings m_MaterialSettings; + RHI::SGPUCaps m_GpuCaps; + CRenderPassArray m_RenderPasses; + RHI::EGraphicalApi m_ApiName; + + CString m_ShaderFolder; + + SPrepareArg() + : m_ResourceManager(null) + { + } + + SPrepareArg(const PCRendererDataBase &renderer, HBO::CContext *context, const RHI::SGPUCaps *gpuCaps); + + bool _HasProperty(CStringId materialProperty) const; +}; + +//---------------------------------------------------------------------------- + +struct SCreateArg +{ + RHI::PApiManager m_ApiManager; + FMOD::System *m_SoundSystem; + TArray m_ResourceManagers; + CString m_RootPath; + + SCreateArg(const RHI::PApiManager &apiManager = null) + : m_ApiManager(apiManager) + , m_SoundSystem(null) + { + m_ResourceManagers.Clear(); + } + + SCreateArg(const RHI::PApiManager &apiManager, FMOD::System *soundSystem, CResourceManager *resourceManager, const CString &rootPath) + : m_ApiManager(apiManager) + , m_SoundSystem(soundSystem) + , m_RootPath(rootPath) + { + if (m_ResourceManagers.Resize(1)) + { + m_ResourceManagers[0] = resourceManager; + } + } + + SCreateArg(const RHI::PApiManager &apiManager, FMOD::System *soundSystem, TArray resourceManagers, const CString &rootPath) + : m_ApiManager(apiManager) + , m_SoundSystem(soundSystem) + , m_ResourceManagers(resourceManagers) + , m_RootPath(rootPath) + { + } +}; + +//---------------------------------------------------------------------------- + +struct STextureKey; +struct SConstantSamplerKey; +struct SRenderStateKey; +struct SShaderModuleKey; +struct SShaderProgramKey; +struct SGeometryKey; +struct SSoundKey; +struct SConstantAtlasKey; +struct SRendererCacheKey; +struct SRendererCacheInstanceKey; +struct SComputeStateKey; + +PK_FORWARD_DECLARE(SoundResource); +PK_FORWARD_DECLARE(GeometryResource); +PK_FORWARD_DECLARE(ConstantAtlas); +PK_FORWARD_DECLARE(RendererCache); +PK_FORWARD_DECLARE(RendererCacheInstance); + +#define EXEC_X_GRAPHIC_RESOURCE(__sep) \ + X_GRAPHIC_RESOURCE(Texture) __sep \ + X_GRAPHIC_RESOURCE(ConstantSampler) __sep \ + X_GRAPHIC_RESOURCE(RenderState) __sep \ + X_GRAPHIC_RESOURCE(ComputeState) __sep \ + X_GRAPHIC_RESOURCE(ShaderModule) __sep \ + X_GRAPHIC_RESOURCE(ShaderProgram) __sep \ + X_GRAPHIC_RESOURCE(SoundResource) __sep \ + X_GRAPHIC_RESOURCE(Geometry) __sep \ + X_GRAPHIC_RESOURCE(ConstantAtlas) __sep \ + X_GRAPHIC_RESOURCE(RendererCache) __sep \ + X_GRAPHIC_RESOURCE(RendererCacheInstance) __sep + +// Graphic resources dependencies: +// - Renderer Cache Instance x1 +// - Texture xN +// - Sampler x1 +// - Geometry x1 +// - Constant Atlas x1 +// - Renderer Cache x1 +// - Render State xN (depending on the shader options) +// - Shader Program x1 +// - Shader Module xN + +//---------------------------------------------------------------------------- + +template<> +bool TGraphicResourceManager::RenderThread_CreateMissingResources(const SCreateArg &args); + +// We define all the resources we need to handle: +typedef TGraphicResourceManager CTextureManager; +typedef TGraphicResourceManager CConstantSamplerManager; +typedef TGraphicResourceManager CRenderStateManager; +typedef TGraphicResourceManager CShaderModuleManager; +typedef TGraphicResourceManager CShaderProgramManager; +typedef TGraphicResourceManager CGeometryManager; +typedef TGraphicResourceManager CConstantAtlasManager; +typedef TGraphicResourceManager CRendererCacheManager; +typedef TGraphicResourceManager CRendererCacheInstanceManager; +typedef TGraphicResourceManager CSoundResourceManager; +typedef TGraphicResourceManager CComputeStateManager; + +//---------------------------------------------------------------------------- +// Keys contains data to identify each resource +// if necessary can be compared to retrieve existing resource +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- +// Textures +//---------------------------------------------------------------------------- + +struct STextureKey +{ + bool m_LoadAsSRGB; + CString m_Path; + + STextureKey() : m_LoadAsSRGB(false) {} + + bool UpdateThread_Prepare(const SPrepareArg &args); + RHI::PTexture RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies() {} + RHI::PTexture RenderThread_ReloadResource(const SCreateArg &args); + bool operator == (const STextureKey &other) const; + static const char *GetResourceName() { return "Texture"; } + + static void SetupDefaultResource(); + static CTextureManager::CResourceId s_DefaultResourceID; +}; + +//---------------------------------------------------------------------------- +// Constant sampler +//---------------------------------------------------------------------------- + +struct SConstantSamplerKey +{ + RHI::EFilteringMode m_MagFilter : 4; + RHI::EFilteringMode m_MinFilter : 4; + RHI::EWrapMode m_WrapU : 4; + RHI::EWrapMode m_WrapV : 4; + RHI::EWrapMode m_WrapW : 4; + u32 m_MipmapCount : 8; + + PK_STATIC_ASSERT(RHI::SampleLinear == 0); + PK_STATIC_ASSERT(RHI::SampleRepeat == 0); + SConstantSamplerKey() : m_MagFilter(RHI::SampleLinear), m_MinFilter(RHI::SampleLinear), m_WrapU(RHI::SampleRepeat), m_WrapV(RHI::SampleRepeat), m_WrapW(RHI::SampleRepeat), m_MipmapCount(0) {} + + bool UpdateThread_Prepare(const SPrepareArg &args); + RHI::PConstantSampler RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies() {} + bool operator == (const SConstantSamplerKey &other) const; + static const char *GetResourceName() { return "ConstantSampler"; } +}; + +//---------------------------------------------------------------------------- +// Render state +//---------------------------------------------------------------------------- + +struct SRenderStateKey +{ + EShaderOptions m_Options; + ESampleLibGraphicResources_RenderPass m_RenderPassIdx; + + PK_STATIC_ASSERT(Option_None == 0); + PK_STATIC_ASSERT(ParticlePass_Opaque == 0); + SRenderStateKey() : m_Options(Option_None), m_RenderPassIdx(__MaxParticlePass), m_NeededConstants(0) {} + + bool UpdateThread_Prepare(const SPrepareArg &args); + RHI::PRenderState RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies(); + bool operator == (const SRenderStateKey &other) const; + static const char *GetResourceName() { return "RenderState"; } + + const RHI::SShaderBindings &GetGeneratedShaderBindings() const { return m_ShaderBindings; } + u32 GetNeededConstants() const { return m_NeededConstants; } + +private: + RHI::SShaderBindings m_ShaderBindings; + RHI::SPipelineState m_PipelineState; + TArray m_InputVertexBuffers; + // Dependency: + CShaderProgramManager::CResourceId m_ShaderProgram; + // Needed constants: + u32 m_NeededConstants; + // Hash to compare render states: + CDigestMD5 m_RenderStateHash; +}; + +//---------------------------------------------------------------------------- +// Compute state +//---------------------------------------------------------------------------- + +struct SComputeStateKey +{ + EComputeShaderType m_Type; + + SComputeStateKey() : m_Type(ComputeType_None) {} + + bool UpdateThread_Prepare(const SPrepareArg &args); + RHI::PComputeState RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies(); + bool operator == (const SComputeStateKey &other) const; + static const char *GetResourceName() { return "ComputeState"; } + const RHI::SShaderBindings &GetGeneratedShaderBindings() const { return m_ShaderBindings; } + +private: + RHI::SShaderBindings m_ShaderBindings; + // Dependency: + CShaderProgramManager::CResourceId m_ShaderProgram; +}; + +//---------------------------------------------------------------------------- +// Shader module +//---------------------------------------------------------------------------- + +struct SShaderModuleKey +{ + CString m_Path; + RHI::EShaderStage m_Stage; + + PK_STATIC_ASSERT(RHI::VertexShaderStage == 0); + SShaderModuleKey() : m_Stage(RHI::VertexShaderStage) {} + + bool UpdateThread_Prepare(const SPrepareArg &args); + RHI::PShaderModule RenderThread_CreateResource(const SCreateArg &args); + RHI::PShaderModule RenderThread_ReloadResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies() {} + bool operator == (const SShaderModuleKey &other) const; + static const char *GetResourceName() { return "ShaderModule"; } +}; + +//---------------------------------------------------------------------------- +// Shader program +//---------------------------------------------------------------------------- + +struct SShaderProgramKey +{ + EShaderOptions m_Option; + ESampleLibGraphicResources_RenderPass m_RenderPassIdx; + EComputeShaderType m_ComputeShaderType; + RHI::SShaderBindings m_ShaderBindings; + + PK_STATIC_ASSERT(Option_None == 0); + PK_STATIC_ASSERT(ComputeType_None == 0); + SShaderProgramKey() : m_Option(Option_None), m_RenderPassIdx(__MaxParticlePass), m_ComputeShaderType(ComputeType_None){} + + bool UpdateThread_Prepare(const SPrepareArg &args); + RHI::PShaderProgram RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies(); + bool operator == (const SShaderProgramKey &other) const; + static const char *GetResourceName() { return "ShaderProgram"; } + + CShaderModuleManager::CResourceId m_ShaderModules[RHI::ShaderStage_Count]; +}; + +//---------------------------------------------------------------------------- +// Geometry resource +//---------------------------------------------------------------------------- + +class CGeometryResource : public CRefCountedObject +{ +public: + TArray m_PerGeometryViews; +}; +PK_DECLARE_REFPTRCLASS(GeometryResource); + +//---------------------------------------------------------------------------- + +struct SGeometryKey +{ + enum EGeometryType + { + Geom_Mesh, + Geom_Sphere, + Geom_Cube, + }; + + PCResourceMesh m_SourceMesh; + EGeometryType m_GeomType; + CString m_Path; + + SGeometryKey(); + bool UpdateThread_Prepare(const SPrepareArg &args) { (void)args; return true; } + PGeometryResource RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies() {} + PGeometryResource RenderThread_ReloadResource(const SCreateArg &args); + bool operator == (const SGeometryKey &other) const; + static const char *GetResourceName() { return "Geometry"; } + + bool CreateGeomSphere(const RHI::PApiManager &apiManager, u32 subdivs, Utils::GpuBufferViews &toFill); + bool CreateGeomCube(const RHI::PApiManager &apiManager, Utils::GpuBufferViews &toFill); + + static void SetupDefaultResource(); + static CGeometryManager::CResourceId s_DefaultResourceID; +}; + +//---------------------------------------------------------------------------- +// Sound resource +//---------------------------------------------------------------------------- + +class CSoundResource : public CRefCountedObject +{ +public: + FMOD::Sound *m_SoundData; + float m_Frequency; + float m_Length; + + CSoundResource() + : m_SoundData(null) + , m_Frequency(0.0f) + , m_Length(0.0f) + {} +}; +PK_DECLARE_REFPTRCLASS(SoundResource); + +//---------------------------------------------------------------------------- + +struct SSoundKey +{ + CString m_Path; + + bool UpdateThread_Prepare(const SPrepareArg &args); + PSoundResource RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies() {} + PSoundResource RenderThread_ReloadResource(const SCreateArg &args); + bool operator == (const SSoundKey &other) const; + static const char *GetResourceName() { return "Sound"; } +}; + +//---------------------------------------------------------------------------- +// Constant atlas data +//---------------------------------------------------------------------------- + +class CConstantAtlas : public CRefCountedObject +{ +public: + // Billboard geometry + RHI::PConstantSet m_AtlasConstSet; + RHI::PGpuBuffer m_AtlasBuffer; +}; +PK_DECLARE_REFPTRCLASS(ConstantAtlas); + +//---------------------------------------------------------------------------- + +struct SConstantAtlasKey +{ + PCRectangleList m_SourceAtlas; + CString m_Path; + + bool UpdateThread_Prepare(const SPrepareArg &args) { (void)args; return m_SourceAtlas != null; } + PConstantAtlas RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies() {} + PConstantAtlas RenderThread_ReloadResource(const SCreateArg &args); + bool operator == (const SConstantAtlasKey &other) const; + static const char *GetResourceName() { return "Atlas"; } + + static const RHI::SConstantSetLayout &GetAtlasConstantSetLayout(); + + static void SetupConstantSetLayout(); + static void ClearConstantSetLayoutIFN(); +}; + +//---------------------------------------------------------------------------- +// Constant noise data +//---------------------------------------------------------------------------- + +class CConstantNoiseTexture : public CRefCountedObject +{ +public: + // Billboard geometry + RHI::PTexture m_NoiseTexture; + RHI::PConstantSet m_NoiseTextureConstantSet; +}; + +//---------------------------------------------------------------------------- + +struct SConstantNoiseTextureKey +{ + static const char *GetResourceName() { return "DitheringPatterns"; } + + static const RHI::SConstantSetLayout &GetNoiseTextureConstantSetLayout(); + + static void SetupConstantSetLayout(); + static void ClearConstantSetLayoutIFN(); +}; + +//---------------------------------------------------------------------------- +// Draw requests constant set for GPU billboarding (vertex/geometry) +//---------------------------------------------------------------------------- + +struct SConstantDrawRequests +{ + static const RHI::SConstantSetLayout &GetConstantSetLayout(ERendererClass rendererType); + static bool GetConstantBufferDesc(RHI::SConstantBufferDesc &outDesc, u32 elementCount, ERendererClass rendererType); + + static void SetupConstantSetLayouts(); + static void ClearConstantSetLayoutsIFN(); +}; + +//---------------------------------------------------------------------------- +// Vertex billboarding constants +//---------------------------------------------------------------------------- + +struct SConstantVertexBillboarding +{ + static bool GetPushConstantBufferDesc(RHI::SPushConstantBuffer &outDesc, bool gpuStorage); +}; + +struct SVertexBillboardingConstants +{ + u32 m_IndicesOffset; +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + u32 m_StreamOffsetsIndex; +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) +}; +PK_STATIC_ASSERT(sizeof(SVertexBillboardingConstants) <= sizeof(CUint4)); + +//---------------------------------------------------------------------------- +// Helpers +//---------------------------------------------------------------------------- + +// - Scene info (! Any modification to that struct requires an upgrader for .vert/.frag files !): +struct SSceneInfoData +{ + CFloat4x4 m_ViewProj; + CFloat4x4 m_View; + CFloat4x4 m_Proj; + CFloat4x4 m_InvView; + CFloat4x4 m_InvViewProj; + CFloat4x4 m_UserToLHZ; // Helper matrix to convert from user to LHZup coord system. + CFloat4x4 m_LHZToUser; // Helper matrix to convert from LHZup to user coord system. + CFloat4x4 m_BillboardingView; + CFloat4x4 m_PackNormalView; + CFloat4x4 m_UnpackNormalView; + CFloat4 m_SideVector; + CFloat4 m_DepthVector; + CFloat2 m_ZBufferLimits; + CFloat2 m_ViewportSize; + CFloat1 m_Handedness; + + SSceneInfoData() + : m_ViewProj(CFloat4x4::IDENTITY) + , m_View(CFloat4x4::IDENTITY) + , m_Proj(CFloat4x4::IDENTITY) + , m_InvView(CFloat4x4::IDENTITY) + , m_InvViewProj(CFloat4x4::IDENTITY) + , m_UserToLHZ(CFloat4x4::IDENTITY) + , m_LHZToUser(CFloat4x4::IDENTITY) + , m_BillboardingView(CFloat4x4::IDENTITY) + , m_PackNormalView(CFloat4x4::IDENTITY) + , m_UnpackNormalView(CFloat4x4::IDENTITY) + , m_SideVector(CFloat4::ZERO) + , m_DepthVector(CFloat4::ZERO) + , m_ZBufferLimits(0.1f, 1000.f) + , m_ViewportSize(CFloat2::ONE) + , m_Handedness(1.f) + {} +}; + +//---------------------------------------------------------------------------- +// Renderer Cache (Name collides with the runtime renderer cache, should be something like CRenderStates) +//---------------------------------------------------------------------------- + +class CRendererCache : public CRefCountedObject +{ +public: + struct SRenderStateFeature + { + EShaderOptions m_Options; + u32 m_NeededConstants; + ESampleLibGraphicResources_RenderPass m_RenderPassIdx; + RHI::PRenderState m_RenderState; + + RHI::SConstantSetLayout m_GPUStorageSimDataConstantSetLayout; + RHI::SConstantSetLayout m_GPUStorageOffsetsConstantSetLayout; + + bool m_Expected; + + SRenderStateFeature() + : m_Options(EShaderOptions::Option_None) + , m_RenderPassIdx(ESampleLibGraphicResources_RenderPass::__MaxParticlePass) + , m_Expected(false) + {} + }; + + struct SComputeStateFeature + { + RHI::PComputeState m_ComputeState; + EComputeShaderType m_Type; + + bool m_Expected; + + SComputeStateFeature() + : m_Type(EComputeShaderType::ComputeType_None) + , m_Expected(false) + {} + }; + + TArray m_RenderStates; + CRenderPassArray m_RenderPasses; + TArray m_ComputeStates; + SCreateArg m_LastCreateArgs; + + RHI::PRenderState GetRenderState(EShaderOptions option, ESampleLibGraphicResources_RenderPass renderPass = __MaxParticlePass, u32 *neededConstants = null); + RHI::PComputeState GetComputeState(EComputeShaderType type); + bool GetGPUStorageConstantSets(EShaderOptions option, const RHI::SConstantSetLayout *&outSimDataConstantSet, const RHI::SConstantSetLayout *&outOffsetsConstantSet) const; +}; +PK_DECLARE_REFPTRCLASS(RendererCache); + +//---------------------------------------------------------------------------- + +struct SRendererCacheKey +{ +public: + bool UpdateThread_Prepare(const SPrepareArg &args); + PRendererCache RenderThread_CreateResource(const SCreateArg &args, PRendererCache cache = null); + bool RenderThread_IsPartiallyBuilt(const PRendererCache &cache) const; + void UpdateThread_ReleaseDependencies(); + bool operator == (const SRendererCacheKey &) const; + static const char *GetResourceName() { return "RendererCache"; } + +private: + bool PushRenderState(const SPrepareArg &args, EShaderOptions options); + bool PushComputeState(const SPrepareArg &args, EComputeShaderType options); + + // Dependencies + struct SRenderStateFeature + { + EShaderOptions m_Options; + ESampleLibGraphicResources_RenderPass m_RenderPassIdx; + CRenderStateManager::CResourceId m_RenderState; + u32 m_NeededConstants; + + SRenderStateFeature() + : m_Options(EShaderOptions::Option_None) + , m_RenderPassIdx(ESampleLibGraphicResources_RenderPass::__MaxParticlePass) + , m_NeededConstants(0) + {} + }; + + struct SComputeStateFeature + { + CComputeStateManager::CResourceId m_ComputeState; + EComputeShaderType m_Type; + + SComputeStateFeature() + : m_Type(EComputeShaderType::ComputeType_None) + {} + }; + + TArray m_RenderStates; + CRenderPassArray m_RenderPasses; + TArray m_ComputeStates; +}; + +//---------------------------------------------------------------------------- +// Renderer Cache Instance +//---------------------------------------------------------------------------- + +class CRendererCacheInstance : public CRefCountedObject +{ +public: + RHI::PConstantSet m_ConstSet; + RHI::PGpuBuffer m_ConstValues; + TArray m_ConstTextures; + TArray m_ConstSamplers; + + // Mesh renderer resource + PGeometryResource m_AdditionalGeometry; + PConstantAtlas m_Atlas; + + // Billboards/Ribbons + bool m_HasAtlas; + + // Associated cache + PRendererCache m_Cache; + + // Sound resource + PSoundResource m_Sound; +}; +PK_DECLARE_REFPTRCLASS(RendererCacheInstance); + +//---------------------------------------------------------------------------- + +struct SRendererCacheInstanceKey +{ +public: + bool UpdateThread_Prepare(const SPrepareArg &args); + PRendererCacheInstance RenderThread_CreateResource(const SCreateArg &args); + void UpdateThread_ReleaseDependencies(); + bool operator == (const SRendererCacheInstanceKey &) const; + static const char *GetResourceName() { return "RendererCacheInstance"; } + +private: + bool m_HasAtlas; + + RHI::SConstantSetLayout m_ConstSetLayout; + // Dependencies + CRendererCacheManager::CResourceId m_Cache; + TArray m_Textures; + TArray m_Samplers; + CGeometryManager::CResourceId m_Geometry; + CSoundResourceManager::CResourceId m_Sound; + CConstantAtlasManager::CResourceId m_Atlas; + CDigestMD5 m_ContentHash; + // Tmp data + TArray m_constantProperties; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIParticleRenderDataFactory.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIParticleRenderDataFactory.cpp new file mode 100644 index 00000000..182e7f3c --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIParticleRenderDataFactory.cpp @@ -0,0 +1,314 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "RHIParticleRenderDataFactory.h" + +// Default implementations of the batches: +#include +#include +#include +#include +#include +#include +#include + +#include "RHIBillboardingBatchPolicy.h" +#include "RHIBillboardingBatchPolicy_Vertex.h" + +// Custom RHI policy: +#include "RHIParticleRenderDataFactory.h" + +// Material to RHI +#include "MaterialToRHI.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +bool CRHIParticleRenderDataFactory::UpdateThread_Initialize( RHI::EGraphicalApi apiName, + HBO::CContext *hboContext, + const RHI::SGPUCaps &gpuCaps, + Drawers::EBillboardingLocation billboardingLocation) +{ + PK_SCOPEDLOCK(m_FactoryLock); // Those members are accessed by the render thread + m_ApiName = apiName; + m_HBOContext = hboContext; + m_GPUCaps = gpuCaps; + m_BillboardingLocation = billboardingLocation; + m_IsInitialized = true; + return true; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleRenderDataFactory::UpdateThread_Release() +{ + PK_SCOPEDLOCK(m_FactoryLock); // Those members are accessed by the render thread + m_IsInitialized = false; + m_HBOContext = null; + m_PendingCaches.Clear(); +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleRenderDataFactory::IsInitializedWithAPI(RHI::EGraphicalApi apiName) +{ + return m_IsInitialized && apiName == m_ApiName; +} + +//---------------------------------------------------------------------------- + +void CRHIParticleRenderDataFactory::UpdateThread_SetBillboardingLocation(Drawers::EBillboardingLocation billboardingLocation) +{ + PK_SCOPEDLOCK(m_FactoryLock); + m_BillboardingLocation = billboardingLocation; +} + +//---------------------------------------------------------------------------- + +PRendererCacheBase CRHIParticleRenderDataFactory::UpdateThread_CreateRendererCache(const PRendererDataBase &renderer, const CParticleDescriptor *particleDesc) +{ + (void)particleDesc; + PK_ASSERT(m_IsInitialized); // Check if initialized! + // We create the renderer cache: + PRendererCacheInstance_UpdateThread rendererCache = PK_NEW(CRendererCacheInstance_UpdateThread()); + + if (rendererCache == null) + return null; + if (!rendererCache->UpdateThread_Build(renderer, m_GPUCaps, m_HBOContext, kDefaultShadersFolder, m_ApiName)) + { + CLog::Log(PK_ERROR, "Could not create the renderer cache"); + return null; + } + + PK_SCOPEDLOCK(m_PendingCachesLock); + m_PendingCaches.PushBack(rendererCache); + return rendererCache; +} + +//---------------------------------------------------------------------------- + +bool CRHIParticleRenderDataFactory::RenderThread_BuildPendingCaches(const RHI::PApiManager &apiManager) +{ + // This method is not really useful as all the renderer caches are calling the same static function + // that builds all the renderer caches. + + if (!PK_VERIFY(m_IsInitialized)) // Check if initialized! + return false; + + PK_SCOPEDLOCK(m_FactoryLock); // Any render thread function that need to access the member set by the UpdateThread_Initialize need a lock + PK_SCOPEDLOCK(m_PendingCachesLock); + + const u32 matCount = m_PendingCaches.Count(); + bool success = true; + for (u32 iMat = 0; iMat < matCount; ++iMat) + { + PRendererCacheInstance_UpdateThread rendererCache = m_PendingCaches[iMat]; + PK_ASSERT(rendererCache != null); + + if (!rendererCache->RenderThread_Build(apiManager, m_HBOContext)) + { + CLog::Log(PK_ERROR, "Could not create the graphical resources for an effect created this frame"); + success = false; + } + } + m_PendingCaches.Clear(); + return success; +} + +//---------------------------------------------------------------------------- + +Drawers::EBillboardingLocation CRHIParticleRenderDataFactory::ResolveBillboardingLocationForStorage(bool gpuStorage) +{ + PK_SCOPEDLOCK(m_FactoryLock); + + Drawers::EBillboardingLocation bbLocation = m_BillboardingLocation; + + // Default fallback: CPU -> Geometry shader -> Vertex shader + if (gpuStorage) + { + PK_ASSERT(m_GPUCaps.m_SupportsShaderResourceViews || m_GPUCaps.m_SupportsGeometryShaders); + + if (bbLocation == Drawers::BillboardingLocation_CPU) + bbLocation = Drawers::BillboardingLocation_GeometryShader; + + // Fallback on Geometry shader billboarding + if (bbLocation == Drawers::BillboardingLocation_VertexShader && !m_GPUCaps.m_SupportsShaderResourceViews) + bbLocation = Drawers::BillboardingLocation_GeometryShader; + // Fallback on CPU billboarding + if (bbLocation == Drawers::BillboardingLocation_GeometryShader && !m_GPUCaps.m_SupportsGeometryShaders) + bbLocation = Drawers::BillboardingLocation_VertexShader; + } + else + { + // Fallback on Geometry shader billboarding + if (bbLocation == Drawers::BillboardingLocation_VertexShader && !m_GPUCaps.m_SupportsShaderResourceViews) + bbLocation = Drawers::BillboardingLocation_GeometryShader; + // Fallback on CPU billboarding + if (bbLocation == Drawers::BillboardingLocation_GeometryShader && !m_GPUCaps.m_SupportsGeometryShaders) + bbLocation = Drawers::BillboardingLocation_CPU; + } + return bbLocation; +} + +//---------------------------------------------------------------------------- + +CRHIParticleRenderDataFactory::CBillboardingBatchInterface *CRHIParticleRenderDataFactory::CreateBillboardingBatch(ERendererClass rendererType, const PRendererCacheBase &rendererCache, bool gpuStorage) +{ + (void)rendererCache; + if (!PK_VERIFY(m_IsInitialized)) // Check if initialized! + return null; + + // Default billboarding batch implementations: + typedef TBillboardBatch CBillboardBillboardingBatch; + typedef TBillboardBatch CBillboardBillboardingBatch_Vertex; + typedef TRibbonBatch CRibbonBillboardingBatch; + typedef TRibbonBatch CRibbonBillboardingBatch_Vertex; + typedef TMeshBatch CMeshBillboardingBatch; + typedef TDecalBatch CDecalBillboardingBatch; + typedef TTriangleBatch CTriangleBillboardingBatch; + typedef TTriangleBatch CTriangleBillboardingBatch_Vertex; + typedef TLightBatch CLightBillboardingBatch; + typedef TSoundBatch CSoundBillboardingBatch; + + const Drawers::EBillboardingLocation bbLocation = ResolveBillboardingLocationForStorage(gpuStorage); + + if (gpuStorage) + { + if (bbLocation != Drawers::BillboardingLocation_CPU) + { + switch (rendererType) + { + case Renderer_Billboard: + { + switch (bbLocation) + { + case Drawers::BillboardingLocation_GeometryShader: + { + CBillboardBillboardingBatch *batch = PK_NEW((CBillboardBillboardingBatch)); + if (PK_VERIFY(batch != null)) + batch->SetBillboardingLocation(Drawers::BillboardingLocation_GeometryShader); + return batch; + } + case Drawers::BillboardingLocation_VertexShader: + { + CBillboardBillboardingBatch_Vertex *batch = PK_NEW(CBillboardBillboardingBatch_Vertex); + if (!PK_VERIFY(batch != null)) + return null; + batch->SetBillboardingLocation(Drawers::BillboardingLocation_VertexShader); + return batch; + } + default: + PK_ASSERT_NOT_REACHED(); // Compute shader billboarding not implemented in RHIParticleRenderDataFactory + break; + } + return null; + } + case Renderer_Mesh: + { + CMeshBillboardingBatch *batch = PK_NEW(CMeshBillboardingBatch); + if (!PK_VERIFY(batch != null)) + return null; + return batch; + } + case Renderer_Ribbon: + { + CRibbonBillboardingBatch_Vertex *batch = PK_NEW(CRibbonBillboardingBatch_Vertex); + if (!PK_VERIFY(batch != null)) + return null; + batch->SetBillboardingLocation(Drawers::BillboardingLocation_VertexShader); + return batch; + } + default: + break; + } + } + } + else + { + switch (rendererType) + { + case Renderer_Billboard: + { + switch (bbLocation) + { + case Drawers::BillboardingLocation_CPU: + case Drawers::BillboardingLocation_GeometryShader: + { + CBillboardBillboardingBatch *batch = PK_NEW((CBillboardBillboardingBatch)); + if (!PK_VERIFY(batch != null)) + return null; + batch->SetBillboardingLocation(bbLocation); + return batch; + } + case Drawers::BillboardingLocation_VertexShader: + { + CBillboardBillboardingBatch_Vertex *batch = PK_NEW(CBillboardBillboardingBatch_Vertex); + if (!PK_VERIFY(batch != null)) + return null; + batch->SetBillboardingLocation(bbLocation); + return batch; + } + default: + PK_ASSERT_NOT_REACHED(); // Compute shader billboarding not implemented in RHIParticleRenderDataFactory + break; + } + return null; + } + case Renderer_Ribbon: + { + CRibbonBillboardingBatch *batch = PK_NEW(CRibbonBillboardingBatch); + return batch; + } + case Renderer_Mesh: + return PK_NEW(CMeshBillboardingBatch); + case Renderer_Triangle: + { + switch (bbLocation) + { + case Drawers::BillboardingLocation_CPU: + case Drawers::BillboardingLocation_GeometryShader: // Falls back to BillboardingLocation_CPU + { + CTriangleBillboardingBatch *batch = PK_NEW(CTriangleBillboardingBatch); + if (!PK_VERIFY(batch != null)) + return null; + batch->SetBillboardingLocation(Drawers::BillboardingLocation_CPU); + return batch; + } + case Drawers::BillboardingLocation_VertexShader: + { + CTriangleBillboardingBatch_Vertex *batch = PK_NEW(CTriangleBillboardingBatch_Vertex); + if (!PK_VERIFY(batch != null)) + return null; + batch->SetBillboardingLocation(bbLocation); + return batch; + } + default: + PK_ASSERT_NOT_REACHED(); + break; + } + return null; + } + case Renderer_Decal: + return PK_NEW(CDecalBillboardingBatch); + case Renderer_Light: + return PK_NEW(CLightBillboardingBatch); + case Renderer_Sound: + return PK_NEW(CSoundBillboardingBatch); + default: + PK_ASSERT_NOT_REACHED(); + } + } + return null; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIParticleRenderDataFactory.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIParticleRenderDataFactory.h new file mode 100644 index 00000000..f53f6c66 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIParticleRenderDataFactory.h @@ -0,0 +1,67 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHITypePolicy.h" +#include "PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.h" + +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CRHIParticleRenderDataFactory : public TParticleRenderDataFactory +{ +public: + CRHIParticleRenderDataFactory() : m_IsInitialized(false) { } + virtual ~CRHIParticleRenderDataFactory() { } + +public: + // Create the renderer cache + virtual PRendererCacheBase UpdateThread_CreateRendererCache(const PRendererDataBase &renderer, const CParticleDescriptor *particleDesc) override; + + // Create the billboarding batch for this renderer type + virtual CBillboardingBatchInterface *CreateBillboardingBatch(ERendererClass rendererType, const PRendererCacheBase &rendererCache, bool gpuStorage) override; + + virtual void UpdateThread_CollectedForRendering(const PRendererCacheBase &rendererCache) override { (void)rendererCache; /* Nothing to do */ } + +public: + virtual bool UpdateThread_Initialize(RHI::EGraphicalApi apiName, HBO::CContext *hboContext, const RHI::SGPUCaps &gpuCaps, Drawers::EBillboardingLocation billboardingLocation = Drawers::BillboardingLocation_CPU); + virtual void UpdateThread_Release(); + bool IsInitializedWithAPI(RHI::EGraphicalApi apiName); + + void UpdateThread_SetBillboardingLocation(Drawers::EBillboardingLocation billboardingLocation); + + bool RenderThread_BuildPendingCaches(const RHI::PApiManager &apiManager); + + Drawers::EBillboardingLocation ResolveBillboardingLocationForStorage(bool gpuStorage); + +protected: + bool m_IsInitialized; + + RHI::EGraphicalApi m_ApiName; + HBO::CContext *m_HBOContext; + RHI::SGPUCaps m_GPUCaps; + + Drawers::EBillboardingLocation m_BillboardingLocation; + + Threads::CCriticalSection m_PendingCachesLock; + TArray m_PendingCaches; + + // We add a lock to be able to re-initialize the factory on the game thread while its running: + Threads::CCriticalSection m_FactoryLock; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHIRenderIntegrationConfig.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIRenderIntegrationConfig.h new file mode 100644 index 00000000..35549a30 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHIRenderIntegrationConfig.h @@ -0,0 +1,21 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" + +__PK_SAMPLE_API_BEGIN +__PK_SAMPLE_API_END + +//---------------------------------------------------------------------------- + +#define PK_RH_GPU_THREADGROUP_SIZE 128U +#define PK_RH_GPU_THREADGROUP_SIZE_2D 32U diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RHITypePolicy.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RHITypePolicy.h new file mode 100644 index 00000000..10d42c2b --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RHITypePolicy.h @@ -0,0 +1,331 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include + +#include "PK-SampleLib/PKSample.h" +#include "PK-SampleLib/RenderIntegrationRHI/RendererCache.h" +#include "PK-SampleLib/RenderIntegrationRHI/SoundPoolCache.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHICustomTasks.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CRHIBillboardingBatchPolicy; + +struct SRHIDrawCall +{ + enum EDrawCallType + { + DrawCall_Regular, + DrawCall_IndexedInstanced, + DrawCall_InstancedIndirect, + DrawCall_IndexedInstancedIndirect, + }; + + // Only used for debug draws (Wireframe, ..) + enum EDebugDrawGPUBuffer + { + // Indices fetched in vertex shader + DebugDrawGPUBuffer_Indices, + // Geometry shader billboarding (billboards): + DebugDrawGPUBuffer_Position, + DebugDrawGPUBuffer_Size, + DebugDrawGPUBuffer_Rotation, + DebugDrawGPUBuffer_Axis0, + DebugDrawGPUBuffer_Axis1, + // Vertex shader billboarding (billboards): + DebugDrawGPUBuffer_Texcoords, + // Vertex shader billboarding (triangles): + DebugDrawGPUBuffer_VertexPosition0, + DebugDrawGPUBuffer_VertexPosition1, + DebugDrawGPUBuffer_VertexPosition2, + // Lights: + DebugDrawGPUBuffer_InstancePositions, + DebugDrawGPUBuffer_InstanceScales, + // Meshes: + DebugDrawGPUBuffer_InstanceTransforms, + // Enabled: + DebugDrawGPUBuffer_Enabled, + // Additional field: + DebugDrawGPUBuffer_Color, + // Is selected: + DebugDrawGPUBuffer_IsParticleSelected, + // For GPU storage: + DebugDrawGPUBuffer_ColorsOffsets, + DebugDrawGPUBuffer_TransformsOffsets, // mesh only + DebugDrawGPUBuffer_IndirectionOffsets, // mesh only + + _DebugDrawGPUBuffer_Count + }; + + enum EUniformBufferSemantic + { + UBSemantic_GPUBillboard, + _UBSemantic_Count + }; + + const void *m_Batch; // Batch pointer + + EDrawCallType m_Type; + + PRendererCacheInstance_UpdateThread m_RendererCacheInstance; + + TArray m_VertexBuffers; + TArray m_VertexOffsets; + RHI::PGpuBuffer m_IndexBuffer; + RHI::EIndexBufferSize m_IndexSize; + + RHI::PConstantSet m_GPUStorageSimDataConstantSet; + RHI::PConstantSet m_GPUStorageOffsetsConstantSet; + +#if (PK_HAS_PARTICLES_SELECTION != 0) + RHI::PConstantSet m_SelectionConstantSet; +#endif // (PK_HAS_PARTICLES_SELECTION != 0) + + // Additional buffers info: + TStaticArray m_DebugDrawGPUBuffers; + TStaticArray m_DebugDrawGPUBufferOffsets; + + // Uniform buffers + TStaticArray m_UBSemanticsPtr; + + // For Regular draws: + u32 m_IndexOffset; + u32 m_IndexCount; + + // For Geom shaders: + u32 m_VertexOffset; + u32 m_VertexCount; + + // For instanced draw: + u32 m_InstanceCount; + + // For indirect draw: + u32 m_IndirectBufferOffset; + RHI::PGpuBuffer m_IndirectBuffer; + u32 m_EstimatedParticleCount; + + // Shaders info: + u32 m_ShaderOptions; // As the renderer cache holds multiple shaders, this is to know which one to use for this draw call + + // Only set required bytes depending on shader bindings for this draw call + // Data type doesn't matter + TStaticCountedArray m_PushConstants; // Geometry/Vertex shader billboarding constants + + // Editor viewport debug + bool m_SelectedDrawCall; // Whether the draw call is selected + bool m_SlicedDC; // Whether or not it's a sliced draw call + bool m_Valid; // Whether or not the draw call is valid for rendering. If false, fallbacks on the debug materials + CAABB m_BBox; // Drawcall bbox (Contains the CameraSortOffset, if any) + CAABB m_TotalBBox; // Drawcall's owning batch total bbox (Doesn't contain the CameraSortOffset, this is the batch's total bounding box) + + ERendererClass m_RendererType; + + SRHIDrawCall() + : m_Batch(null) + , m_Type(DrawCall_Regular) + , m_RendererCacheInstance(null) + , m_IndexBuffer(null) + , m_IndexSize(RHI::IndexBuffer16Bit) + , m_GPUStorageSimDataConstantSet(null) + , m_GPUStorageOffsetsConstantSet(null) + , m_IndexOffset(0) + , m_IndexCount(0) + , m_VertexOffset(0) + , m_VertexCount(0) + , m_InstanceCount(0) + , m_IndirectBufferOffset(0) + , m_IndirectBuffer(null) + , m_EstimatedParticleCount(0) + , m_ShaderOptions(0) + , m_SelectedDrawCall(false) + , m_SlicedDC(false) + , m_Valid(true) + , m_BBox(CAABB::DEGENERATED) + , m_TotalBBox(CAABB::DEGENERATED) + , m_RendererType(Renderer_Invalid) + { + for (u32 i = 0; i < _DebugDrawGPUBuffer_Count; ++i) + { + m_DebugDrawGPUBuffers[i] = null; + m_DebugDrawGPUBufferOffsets[i] = 0; + } + + Mem::Clear(m_PushConstants.Begin(), sizeof(CFloat4) * 4); + } +}; + +//---------------------------------------------------------------------------- + +struct SGpuBuffer +{ + RHI::PGpuBuffer m_Buffer; + + SGpuBuffer() : m_Buffer(null), m_UsedThisFrame(false) { } + + void Unmap(const RHI::PApiManager &manager) { if (m_Buffer != null) { PK_ASSERT(m_Buffer->IsMapped()); PK_VERIFY(manager->UnmapCpuView(m_Buffer)); } } + void UnmapIFN(const RHI::PApiManager &manager) { if (m_Buffer != null && m_Buffer->IsMapped()) PK_VERIFY(manager->UnmapCpuView(m_Buffer)); } + void SetGpuBuffer(RHI::PGpuBuffer buffer) { m_Buffer = buffer; m_UsedThisFrame = PK_VERIFY(m_Buffer != null); } + void Use() { m_UsedThisFrame = PK_VERIFY(m_Buffer != null); } + bool Used() const { PK_ASSERT(m_Buffer != null || !m_UsedThisFrame); return m_UsedThisFrame; } + void Clear() { m_UsedThisFrame = false; /* More than some amount of frames unused, we could destroy the vertex buffer */ } + +private: + bool m_UsedThisFrame; +}; + +//---------------------------------------------------------------------------- + +struct SAdditionalInputs +{ + SRHIDrawCall::EDebugDrawGPUBuffer m_Semantic; // Internal - Editor only + + SGpuBuffer m_Buffer; + u32 m_ByteSize; + u32 m_AdditionalInputIndex; + + SAdditionalInputs() + : m_Semantic(SRHIDrawCall::EDebugDrawGPUBuffer::_DebugDrawGPUBuffer_Count) + , m_ByteSize(0) + , m_AdditionalInputIndex(0) + { + + } +}; + +//---------------------------------------------------------------------------- + +struct SRHICopyCommand +{ + u32 m_SrcOffset; + RHI::PGpuBuffer m_SrcBuffer; + + u32 m_DstOffset; + RHI::PGpuBuffer m_DstBuffer; + + u32 m_SizeToCopy; +}; + +//---------------------------------------------------------------------------- + +struct SRHIComputeDispatchs +{ + RHI::PConstantSet m_ConstantSet; + CInt3 m_ThreadGroups; + RHI::PComputeState m_State; + TStaticCountedArray m_PushConstants; + bool m_NeedSceneInfoConstantSet; + TArray m_BufferMemoryBarriers; + + SRHIComputeDispatchs() + : m_ConstantSet(0) + , m_ThreadGroups(0) + , m_State(0) + , m_NeedSceneInfoConstantSet(false) + { + Mem::Clear(m_PushConstants.Begin(), sizeof(CFloat4) * 4); + } +}; + +//---------------------------------------------------------------------------- + +struct SRHIDrawOutputs +{ + TArray m_CopyCommands; + TArray m_DrawCalls; + TArray m_ComputeDispatchs; + + void Clear() + { + m_CopyCommands.Clear(); + m_DrawCalls.Clear(); + m_ComputeDispatchs.Clear(); + } +}; + +//---------------------------------------------------------------------------- + +struct SRenderContext +{ + enum EPass + { + EPass_PostUpdateFence, + EPass_RenderThread + }; + + EPass Pass() const { return m_Pass; } + bool IsPostUpdateFencePass() const { return m_Pass == EPass_PostUpdateFence; } + bool IsRenderThreadPass() const { return m_Pass == EPass_RenderThread; } + RHI::PApiManager ApiManager() const { return m_ApiManager; } + + CSoundPoolCache &SoundPool() { PK_ASSERT(m_SoundPool != null); return *m_SoundPool; } + float SimSpeed() { return m_SimSpeed; } + +#if (PK_HAS_PARTICLES_SELECTION != 0) + const PKSample::SEffectParticleSelectionView &Selection() const { return m_Selection; } + PKSample::SEffectParticleSelectionView m_Selection; +#endif + + SRenderContext(EPass pass, RHI::PApiManager apiManager) + : m_Pass(pass) + , m_ApiManager(apiManager) + , m_SoundPool(null) + , m_SimSpeed(0) + { + } + + SRenderContext(EPass pass, CSoundPoolCache *soundPool, const float simSpeed) + : m_Pass(pass) + , m_ApiManager(null) + , m_SoundPool(soundPool) + , m_SimSpeed(simSpeed) + { + } + +private: + EPass m_Pass; + RHI::PApiManager m_ApiManager; + + CSoundPoolCache *m_SoundPool; + float m_SimSpeed; +}; + +//---------------------------------------------------------------------------- + +struct SAudioContext +{ +}; + +//---------------------------------------------------------------------------- + +struct SViewUserData +{ +}; + +//---------------------------------------------------------------------------- + +class CRHIParticleBatchTypes +{ +public: + typedef SRenderContext CRenderContext; + typedef SRHIDrawOutputs CFrameOutputData; + typedef SViewUserData CViewUserData; + + enum { kMaxQueuedCollectedFrame = 2U }; +}; + +typedef TSceneView SSceneView; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RendererCache.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/RendererCache.cpp new file mode 100644 index 00000000..61544f99 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RendererCache.cpp @@ -0,0 +1,268 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "RendererCache.h" + +#include "PK-SampleLib/ShaderGenerator/ShaderGenerator.h" + +#include +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- +// +// Renderer Cache Instance +// +//---------------------------------------------------------------------------- + +CRendererCacheInstance_UpdateThread::~CRendererCacheInstance_UpdateThread() +{ + if (m_RendererCacheInstanceId.Valid()) + { + CRendererCacheInstanceManager::UpdateThread_ReleaseResource(m_RendererCacheInstanceId); + } + + if (m_MeshResource != null && !m_MeshResource->Empty()) + m_MeshResource->m_OnReloaded -= FastDelegate(this, &CRendererCacheInstance_UpdateThread::_OnMeshReloaded); +} + +//---------------------------------------------------------------------------- + +void CRendererCacheInstance_UpdateThread::UpdateThread_BuildBillboardingFlags(const PRendererDataBase &renderer) +{ + (void)renderer; + // Already resolved in UpdateThread_Build() +} + +//---------------------------------------------------------------------------- + +bool CRendererCacheInstance_UpdateThread::RenderThread_Build(const RHI::PApiManager &apiManager, HBO::CContext *context) +{ + // We create all the missing resources (all the dependencies are directly handled in the RenderThread_CreateResource): + if (context != null && context->ResourceManager() != null) + return CRendererCacheInstanceManager::RenderThread_CreateMissingResources(SCreateArg(apiManager, null, context->ResourceManager(), CString())); + return false; +} + +//---------------------------------------------------------------------------- + +bool CRendererCacheInstance_UpdateThread::UpdateThread_Build(const PCRendererDataBase &rendererData, const RHI::SGPUCaps &gpuCaps, HBO::CContext *context, const CString &shaderFolder, RHI::EGraphicalApi apiName) +{ + PK_SCOPEDPROFILE(); + SPrepareArg args(rendererData, context, &gpuCaps); + args.m_ApiName = apiName; + args.m_ShaderFolder = shaderFolder; + m_Flags.m_HasUV = false; + m_Flags.m_HasNormal = false; + m_Flags.m_HasTangent = false; + m_Flags.m_FlipU = false; + m_Flags.m_FlipV = false; + m_Flags.m_RotateTexture = false; + m_Flags.m_HasAtlasBlending = false; + m_Flags.m_HasRibbonCorrectDeformation = false; + + m_RenderPasses = args.m_RenderPasses; + + if (rendererData->m_Declaration.IsFeatureEnabled(BasicRendererProperties::SID_Lit())) + m_CastShadows = rendererData->m_Declaration.GetPropertyValue_B(BasicRendererProperties::SID_Lit_CastShadows(), false); + if (!m_CastShadows && rendererData->m_Declaration.IsFeatureEnabled(BasicRendererProperties::SID_LegacyLit())) + m_CastShadows = rendererData->m_Declaration.GetPropertyValue_B(BasicRendererProperties::SID_LegacyLit_CastShadows(), false); + if (!m_CastShadows && rendererData->m_Declaration.IsFeatureEnabled(BasicRendererProperties::SID_Opaque())) + m_CastShadows = rendererData->m_Declaration.GetPropertyValue_B(BasicRendererProperties::SID_Opaque_CastShadows(), false); + + // TextureUvs feature: + const SRendererFeaturePropertyValue *textureUVs = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_TextureUVs()); + const SRendererFeaturePropertyValue *textureUVsFlipU = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_TextureUVs_FlipU()); + const SRendererFeaturePropertyValue *textureUVsFlipV = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_TextureUVs_FlipV()); + const SRendererFeaturePropertyValue *textureUVsRotateTexture = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_TextureUVs_RotateTexture()); + const bool hasTextureUVs = textureUVs != null && textureUVs->ValueB(); + + if (hasTextureUVs) + { + PK_ASSERT(rendererData->m_RendererType == Renderer_Ribbon); + m_Flags.m_FlipU = textureUVsFlipU != null ? textureUVsFlipU->ValueB() : false; + m_Flags.m_FlipV = textureUVsFlipV != null ? textureUVsFlipV->ValueB() : false; + m_Flags.m_RotateTexture = textureUVsRotateTexture != null ? textureUVsRotateTexture->ValueB() : false; + } + + // Flip UV feature (flips V): + const SRendererFeaturePropertyValue *flipUV = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_FlipUVs()); + const bool hasFlipUV = flipUV != null && flipUV->ValueB(); + + if (hasFlipUV) + { + PK_ASSERT(rendererData->m_RendererType == Renderer_Billboard); + PK_ASSERT(!m_Flags.m_FlipU); + PK_ASSERT(!m_Flags.m_FlipV); + m_Flags.m_FlipU = false; + m_Flags.m_FlipV = true; + } + + // Basic Transform feature (flips U and V independently): + const SRendererFeaturePropertyValue *basicTransformUVs = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_BasicTransformUVs()); + const SRendererFeaturePropertyValue *basicTransformUVsFlipU = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_BasicTransformUVs_FlipU()); + const SRendererFeaturePropertyValue *basicTransformUVsFlipV = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_BasicTransformUVs_FlipV()); + const SRendererFeaturePropertyValue *basicTransformUVsRotateUV = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_BasicTransformUVs_RotateUV()); + const bool hasBasicTransform = basicTransformUVs != null && basicTransformUVs->ValueB(); + + if (hasBasicTransform) + { + PK_ASSERT(!m_Flags.m_FlipU); + PK_ASSERT(!m_Flags.m_FlipV); + m_Flags.m_FlipU = basicTransformUVsFlipU != null && basicTransformUVsFlipU->ValueB(); + m_Flags.m_FlipV = basicTransformUVsFlipV != null && basicTransformUVsFlipV->ValueB(); + m_Flags.m_RotateTexture = basicTransformUVsRotateUV != null && basicTransformUVsRotateUV->ValueB(); + } + + const SRendererFeaturePropertyValue *atlas = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_Atlas()); + const SRendererFeaturePropertyValue *atlasBlending = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_Atlas_Blending()); + const bool hasAtlas = atlas != null && atlas->ValueB(); + const bool needsSecondUVSet = hasAtlas && (atlasBlending != null && atlasBlending->ValueI().x() >= 1); + if (needsSecondUVSet) + m_Flags.m_HasAtlasBlending = true; + + const CStringId strIdFeature_CorrectDeformation = BasicRendererProperties::SID_CorrectDeformation(); + + for (const SToggledRenderingFeature &renderingFeature : args.m_FeaturesSettings) + { + if (renderingFeature.m_Settings != null) + { + m_Flags.m_HasUV = m_Flags.m_HasUV | renderingFeature.m_Settings->UseUV(); + m_Flags.m_HasNormal = m_Flags.m_HasNormal | renderingFeature.m_Settings->UseNormal(); + m_Flags.m_HasTangent = m_Flags.m_HasTangent | renderingFeature.m_Settings->UseTangent(); + } + if (renderingFeature.m_FeatureName == strIdFeature_CorrectDeformation) + m_Flags.m_HasRibbonCorrectDeformation = true; + } + + const SRendererFeaturePropertyValue *transparentFeature = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_Transparent()); + const SRendererFeaturePropertyValue *transparentType = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_Transparent_Type()); + const SRendererFeaturePropertyValue *disto = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_Distortion()); + const SRendererFeaturePropertyValue *diffuse = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_Diffuse()); + + PK_TODO("Find a way to propagate enum info into RendererDeclaration"); + m_Flags.m_NeedSort |= (transparentType != null && transparentType->ValueI().x() >= 2); + m_Flags.m_NeedSort |= (disto != null && disto->ValueB() && diffuse != null && diffuse->ValueB()); // If we have a diffuse and a distortion, this means alpha-blend + m_Flags.m_NeedSort |= (transparentType == null && transparentFeature != null && diffuse != null && diffuse->ValueB()); // If there is diffuse transparency + m_Flags.m_Slicable = transparentFeature != null; // Right now, only supports non-opaque billboards/ribbons as slicable + + // FIXME: to remove. Load the mesh here to get their bbox. The mesh won't be loaded twice as we keep a refptr from the resource manager. + if (m_MeshResource != null) + m_MeshResource->m_OnReloaded -= FastDelegate(this, &CRendererCacheInstance_UpdateThread::_OnMeshReloaded); + const SRendererFeaturePropertyValue *propMesh = rendererData->m_Declaration.FindProperty(BasicRendererProperties::SID_Mesh()); + CString remappedPath = (propMesh != null) ? propMesh->m_ValuePath : CString(); + m_MeshResource = args.m_ResourceManager->Load(remappedPath, false, SResourceLoadCtl(false, true)); + + // reset info + m_GlobalMeshBounds.Degenerate(); + m_SubMeshBounds.Clear(); + + if (m_MeshResource != null && !m_MeshResource->Empty()) + { + m_MeshResource->m_OnReloaded += FastDelegate(this, &CRendererCacheInstance_UpdateThread::_OnMeshReloaded); + + m_SubMeshBounds.Resize(m_MeshResource->BatchList().Count()); + for (u32 iMesh = 0; iMesh < m_SubMeshBounds.Count(); ++iMesh) + { + m_SubMeshBounds[iMesh] = m_MeshResource->BatchList()[iMesh]->RawMesh()->BBox(); + m_GlobalMeshBounds.Add(m_SubMeshBounds[iMesh]); + } + if (!PK_VERIFY(m_PerLODMeshCount.Resize(m_MeshResource->LODCount()))) + return false; + for (u32 lodIdx = 0; lodIdx < m_PerLODMeshCount.Count(); ++lodIdx) + m_PerLODMeshCount[lodIdx] = m_MeshResource->BatchList(lodIdx).Count(); + } + else + { + // Editor only debugging, allows to draw default mesh: + if (!PK_VERIFY(m_PerLODMeshCount.Resize(1))) + return false; + m_PerLODMeshCount.First() = 1; + } + + SRendererCacheInstanceKey rendererCacheKey; + m_RendererCacheInstanceId = CRendererCacheInstanceManager::UpdateThread_GetResource(rendererCacheKey, args); + return m_RendererCacheInstanceId.Valid(); +} + +//---------------------------------------------------------------------------- + +PCRendererCacheInstance CRendererCacheInstance_UpdateThread::RenderThread_GetCacheInstance() +{ + PCRendererCacheInstance cacheInstance = CRendererCacheInstanceManager::RenderThread_GetResource(m_RendererCacheInstanceId); + + if (cacheInstance != null) + { + m_LastResolveSucceed = true; + } + else if (m_LastResolveSucceed) + { + CLog::Log(PK_WARN, "The renderer cache instance could not be resolved: it might not be created yet or its creation has failed"); + m_LastResolveSucceed = false; + } + return cacheInstance; +} + +//---------------------------------------------------------------------------- + +void CRendererCacheInstance_UpdateThread::RenderThread_FlushAllResources() +{ + // We flush all the unused resources (no dependencies, we need to do it for all the used managers): +#define X_GRAPHIC_RESOURCE(__name) C ## __name ## Manager::RenderThread_FlushUnusedResources() + EXEC_X_GRAPHIC_RESOURCE(;) +#undef X_GRAPHIC_RESOURCE +} + +//---------------------------------------------------------------------------- + +void CRendererCacheInstance_UpdateThread::RenderThread_ClearAllGpuResources() +{ + // We flush all the unused resources (no dependencies, we need to do it for all the used managers): +#define X_GRAPHIC_RESOURCE(__name) C ## __name ## Manager::RenderThread_ClearGpuResources() + EXEC_X_GRAPHIC_RESOURCE(;) +#undef X_GRAPHIC_RESOURCE +} + +//---------------------------------------------------------------------------- + +void CRendererCacheInstance_UpdateThread::RenderThread_DestroyAllResources() +{ + // We flush all the unused resources (no dependencies, we need to do it for all the used managers): +#define X_GRAPHIC_RESOURCE(__name) C ## __name ## Manager::RenderThread_Destroy() + EXEC_X_GRAPHIC_RESOURCE(;) +#undef X_GRAPHIC_RESOURCE +} + +//---------------------------------------------------------------------------- + +void CRendererCacheInstance_UpdateThread::_OnMeshReloaded(CResourceMesh *mesh) +{ + (void)mesh; + m_GlobalMeshBounds.Degenerate(); + m_SubMeshBounds.Clear(); + + m_SubMeshBounds.Resize(m_MeshResource->BatchList().Count()); + for (u32 iMesh = 0; iMesh < m_SubMeshBounds.Count(); ++iMesh) + { + m_SubMeshBounds[iMesh] = m_MeshResource->BatchList()[iMesh]->RawMesh()->BBox(); + m_GlobalMeshBounds.Add(m_SubMeshBounds[iMesh]); + } + if (!PK_VERIFY(m_PerLODMeshCount.Resize(m_MeshResource->LODCount()))) + return; + for (u32 lodIdx = 0; lodIdx < m_PerLODMeshCount.Count(); ++lodIdx) + m_PerLODMeshCount[lodIdx] = m_MeshResource->BatchList(lodIdx).Count(); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/RendererCache.h b/Samples/PK-SampleLib/RenderIntegrationRHI/RendererCache.h new file mode 100644 index 00000000..60d0936b --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/RendererCache.h @@ -0,0 +1,60 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.h" +#include "PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.h" +#include +#include "PK-SampleLib/ShaderLoader.h" + +__PK_SAMPLE_API_BEGIN + +//---------------------------------------------------------------------------- +// +// Renderer Cache Instance +// +//---------------------------------------------------------------------------- + +class CRendererCacheInstance_UpdateThread : public CRendererCacheBase +{ +public: + CRendererCacheInstance_UpdateThread() { } + virtual ~CRendererCacheInstance_UpdateThread(); + + virtual void UpdateThread_BuildBillboardingFlags(const PRendererDataBase &renderer) override; + + bool UpdateThread_Build(const PCRendererDataBase &rendererData, const RHI::SGPUCaps &gpuCaps, HBO::CContext *context, const CString &shaderFolder = CString(), RHI::EGraphicalApi apiName = RHI::GApi_Null); // This is called first + bool RenderThread_Build(const RHI::PApiManager &apiManager, HBO::CContext *context); // Then this is called + + PCRendererCacheInstance RenderThread_GetCacheInstance(); + + static void RenderThread_FlushAllResources(); + static void RenderThread_ClearAllGpuResources(); + static void RenderThread_DestroyAllResources(); + + bool operator == (const CRendererCacheInstance_UpdateThread &oth) const { return m_RendererCacheInstanceId == oth.m_RendererCacheInstanceId; } + + bool CastShadows() const { return m_CastShadows; } + +private: + void _OnMeshReloaded(CResourceMesh *mesh); + + CRenderPassArray m_RenderPasses; + bool m_LastResolveSucceed = true; + bool m_CastShadows = false; + CRendererCacheInstanceManager::CResourceId m_RendererCacheInstanceId; + TResourcePtr m_MeshResource; +}; +PK_DECLARE_REFPTRCLASS(RendererCacheInstance_UpdateThread); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/SoundPoolCache.cpp b/Samples/PK-SampleLib/RenderIntegrationRHI/SoundPoolCache.cpp new file mode 100644 index 00000000..c0f66ea0 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/SoundPoolCache.cpp @@ -0,0 +1,201 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "SoundPoolCache.h" + +#include "../Runtime/pk_kernel/include/kr_sort.h" + +#include "PK-SampleLib/RenderIntegrationRHI/RendererCache.h" + +#if (PK_BUILD_WITH_FMODEX_SUPPORT != 0) +#include <../SDK/Samples/External/fmodex-4.44.19/inc/fmod.hpp> +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- +// +// Sound Pool: +// +//---------------------------------------------------------------------------- + +void CSoundPoolCache::SetSoundSystem(FMOD::System *soundSystem, FMOD::ChannelGroup *FmodChannelGroup) +{ + m_FmodSystem = soundSystem; + m_FmodChannelGroup = FmodChannelGroup; +} + +//---------------------------------------------------------------------------- + +void CSoundPoolCache::PreparePool() +{ +#if (PK_BUILD_WITH_FMODEX_SUPPORT != 0) + // Reset the sound-pool and update the time cursor from the sound system + for (u32 spoolIdx = 0; spoolIdx < m_SoundPool.Count(); ++spoolIdx) + { + if (m_SoundPool[spoolIdx].m_Handle != null) + { + bool isUsable = false; + m_SoundPool[spoolIdx].m_Handle->isPlaying(&isUsable); + if (!isUsable) + { + m_SoundPool[spoolIdx].m_Handle->stop(); + m_SoundPool[spoolIdx].m_Handle = null; + } + } + if (m_SoundPool[spoolIdx].m_Handle != null && m_SoundPool[spoolIdx].m_Used) + { + u32 posMs = 0; + m_SoundPool[spoolIdx].m_Handle->getPosition(&posMs, FMOD_TIMEUNIT_MS); + const float playTime = posMs * 0.001f; + if (m_SoundPool[spoolIdx].m_PlayTime - 0.010f <= playTime && playTime <= m_SoundPool[spoolIdx].m_PlayTime + 0.300f) + m_SoundPool[spoolIdx].m_PlayTime = playTime; + //else + // CLog::Log(PK_WARN, "FMod returned inconsistency time-position of sound slot %d (fmod=%f pk=%f)", spoolIdx, playTime, m_SoundPool[spoolIdx].m_PlayTime); + } + else + { + m_SoundPool[spoolIdx].m_PlayTime = -1.f; + m_SoundPool[spoolIdx].m_PerceivedVolume = 0.f; + } + m_SoundPool[spoolIdx].m_Used = false; + m_SoundPool[spoolIdx].m_NeedResync = false; + } +#endif +} + +//---------------------------------------------------------------------------- + +void CSoundPoolCache::PlayPool(const u32 maxSoundsPlayed, const float simulationSpeed) +{ + (void)simulationSpeed; + m_PoolSize = maxSoundsPlayed; +#if (PK_BUILD_WITH_FMODEX_SUPPORT != 0) + if (!PK_VERIFY(m_FmodSystem != null)) // We shouldn't be here + return; + // Retrench the pool + if (m_SoundPool.Count() > m_PoolSize) + { + QuickSort(m_SoundPool); + for (u32 spoolIdx = m_PoolSize; spoolIdx < m_SoundPool.Count(); ++spoolIdx) + { + if (m_SoundPool[spoolIdx].m_Handle != null) + { + m_SoundPool[spoolIdx].m_Handle->stop(); + m_SoundPool[spoolIdx].m_Handle = null; + } + } + m_SoundPool.Resize(m_PoolSize); + } + + // Update the sound-pool on the sound-system + for (u32 spoolIdx = 0; spoolIdx < m_SoundPool.Count(); ++spoolIdx) + { + if (!m_SoundPool[spoolIdx].m_Used) + { + if (m_SoundPool[spoolIdx].m_Handle != null) + m_SoundPool[spoolIdx].m_Handle->setPaused(true); + continue; + } + + PK_ASSERT(m_SoundPool[spoolIdx].m_Handle != null || m_SoundPool[spoolIdx].m_NeedResync); + + if (m_SoundPool[spoolIdx].m_NeedResync) + { + if (m_SoundPool[spoolIdx].m_Handle == null) + { + FMOD_RESULT res = m_FmodSystem->playSound(FMOD_CHANNEL_FREE, m_SoundPool[spoolIdx].m_Resource->m_SoundData, true, &m_SoundPool[spoolIdx].m_Handle); + if (res != FMOD_OK) + CLog::Log(PK_ERROR, "FMOD cannot play the sound %d (%d)", spoolIdx, res); + else if (m_SoundPool[spoolIdx].m_Resource->m_Frequency == 0.f) + m_SoundPool[spoolIdx].m_Handle->getFrequency(&m_SoundPool[spoolIdx].m_Resource->m_Frequency); + PK_ASSERT(m_FmodChannelGroup != null); + res = m_SoundPool[spoolIdx].m_Handle->setChannelGroup(m_FmodChannelGroup); + if (res != FMOD_OK) + CLog::Log(PK_ERROR, "FMOD failed to assign a channel group for sound %d (%d)", spoolIdx, res); + } + if (m_SoundPool[spoolIdx].m_Handle == null) + continue; + m_SoundPool[spoolIdx].m_Handle->setPosition((u32)(m_SoundPool[spoolIdx].m_PlayTime * 1000), FMOD_TIMEUNIT_MS); // m_PlayTime is in seconds. + } + + const FMOD_VECTOR pos = { m_SoundPool[spoolIdx].m_Position.x(), m_SoundPool[spoolIdx].m_Position.y(), m_SoundPool[spoolIdx].m_Position.z() }; + const FMOD_VECTOR vel = { m_SoundPool[spoolIdx].m_Velocity.x(), m_SoundPool[spoolIdx].m_Velocity.y(), m_SoundPool[spoolIdx].m_Velocity.z() }; + const bool isPaused = (simulationSpeed == 0.f); + + FMOD_RESULT res = FMOD_OK; + + if (!isPaused) + { + res = m_SoundPool[spoolIdx].m_Handle->set3DAttributes(&pos, &vel); + if (res != FMOD_OK) + CLog::Log(PK_ERROR, "FMOD Error set3DAttributes (%d)", res); + res = m_SoundPool[spoolIdx].m_Handle->setVolume(m_SoundPool[spoolIdx].m_PerceivedVolume); + if (res != FMOD_OK) + CLog::Log(PK_ERROR, "FMOD Error setVolume (%d)", res); + res = m_SoundPool[spoolIdx].m_Handle->set3DDopplerLevel(m_SoundPool[spoolIdx].m_DopplerLevel); + if (res != FMOD_OK) + CLog::Log(PK_ERROR, "FMOD Error set3DDopplerLevel (%d)", res); + res = m_SoundPool[spoolIdx].m_Handle->setFrequency(m_SoundPool[spoolIdx].m_PlaySpeed * simulationSpeed * m_SoundPool[spoolIdx].m_Resource->m_Frequency); + if (res != FMOD_OK) + CLog::Log(PK_ERROR, "FMOD Error setFrequency (%d)", res); + } + + res = m_SoundPool[spoolIdx].m_Handle->setPaused(isPaused); + if (res != FMOD_OK) + CLog::Log(PK_ERROR, "FMOD Error setPaused (%d)", res); + + } +#endif +} + +//---------------------------------------------------------------------------- + +s32 CSoundPoolCache::FindBestMatchingSoundSlot(CSoundResource *resource, float maxDt, const float curtime) +{ + s32 sPoolMatchIdx = -1; + for (u32 spoolIdx = 0; spoolIdx < m_SoundPool.Count(); ++spoolIdx) + { + const SSoundElement &element = m_SoundPool[spoolIdx]; + if (element.m_Used || + element.m_Resource != resource || + element.m_Handle == null || + element.m_PlayTime < 0.f) + continue; + + const float deltaTimeAbs = PKAbs(element.m_PlayTime - curtime); + if (deltaTimeAbs < maxDt) + { + sPoolMatchIdx = spoolIdx; + maxDt = deltaTimeAbs; + } + } + return sPoolMatchIdx; +} + +//---------------------------------------------------------------------------- + +CGuid CSoundPoolCache::GetFreeSoundSlot(CSoundResource *resource) +{ + // just find one not used (do not override sounds from other EmitDrawCall requests) + for (u32 spoolIdx = 0; spoolIdx < m_SoundPool.Count(); ++spoolIdx) + { + SSoundElement &element = m_SoundPool[spoolIdx]; + if (element.m_PlayTime < 0 && (element.m_Resource == resource || element.m_Resource == null)) + { + return spoolIdx; + } + } + + return m_SoundPool.PushBack(); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderIntegrationRHI/SoundPoolCache.h b/Samples/PK-SampleLib/RenderIntegrationRHI/SoundPoolCache.h new file mode 100644 index 00000000..53d74936 --- /dev/null +++ b/Samples/PK-SampleLib/RenderIntegrationRHI/SoundPoolCache.h @@ -0,0 +1,87 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" + +// Foward declaration of fmod +namespace FMOD +{ + class System; + class Channel; + class ChannelGroup; + class Sound; +} + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CSoundResource; + +struct SSoundElement +{ + CSoundResource *m_Resource; // audio-data to use + FMOD::Channel *m_Handle; // audio-handle that controls the playback + float m_PlayTime; + float m_PerceivedVolume; + float m_PlaySpeed; + float m_DopplerLevel; + CFloat3 m_Position; // position relative to the listener + CFloat3 m_Velocity; // velocity relative to the listener + bool m_Used; + bool m_NeedResync; + + SSoundElement() + : m_Resource(null) + , m_Handle(null) + , m_PlayTime(0.f) + , m_PerceivedVolume(0.f) + , m_PlaySpeed(1.f) + , m_DopplerLevel(1.f) + , m_Used(false) + , m_NeedResync(false) + {} + + bool operator < (const SSoundElement &other) const { return m_PerceivedVolume > other.m_PerceivedVolume; } + bool operator <= (const SSoundElement &other) const { return m_PerceivedVolume >= other.m_PerceivedVolume; } + bool operator == (const SSoundElement &other) const { return m_PerceivedVolume == other.m_PerceivedVolume; } +}; + +//---------------------------------------------------------------------------- + +class CSoundPoolCache +{ +public: + CSoundPoolCache() : m_FmodSystem(null), m_PoolSize(0) {} + ~CSoundPoolCache() {} + + void SetSoundSystem(FMOD::System *soundSystem, FMOD::ChannelGroup *FmodChannelGroup); + + void PreparePool(); + void CleanPool() { m_SoundPool.Clean(); } + void PlayPool(const u32 maxSoundsPlayed, const float simulationSpeed); + + s32 FindBestMatchingSoundSlot(CSoundResource *resource, float maxDt, const float curtime); + CGuid GetFreeSoundSlot(CSoundResource *resource); + + SSoundElement &operator [] (u32 id) { return m_SoundPool[id]; } + const SSoundElement &operator [] (u32 id) const { return m_SoundPool[id]; } + u32 Count() const { return m_SoundPool.Count(); } + +private: + FMOD::System *m_FmodSystem; + FMOD::ChannelGroup *m_FmodChannelGroup; + TArray m_SoundPool; + u32 m_PoolSize; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/DirectionalShadows.cpp b/Samples/PK-SampleLib/RenderPasses/DirectionalShadows.cpp new file mode 100644 index 00000000..bf46894e --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/DirectionalShadows.cpp @@ -0,0 +1,766 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "DirectionalShadows.h" + +#include +#include + +#include +#include +#include + +#define MESHSHADOW_VERTEX_SHADER_PATH "./Shaders/SolidMeshShadow.vert" +#define MESHSHADOW_FRAGMENT_SHADER_PATH "./Shaders/SolidMeshShadow.frag" + +#define POSTFX_VERTEX_SHADER_PATH "./Shaders/FullScreenQuad.vert" +#define POSTFX_FRAGMENT_SHADER_PATH "./Shaders/GaussianBlur.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +static CFloat4x4 CreateOrtho(float b, float t, float l, float r, float n, float f) +{ + CFloat4x4 ortho = CFloat4x4::IDENTITY; + + ortho.XAxis().x() = 2.0f / (r - l); + ortho.YAxis().y() = 2.0f / (t - b); + ortho.ZAxis().z() = -1.0f / (n - f); + ortho.WAxis() = CFloat4(-((r + l) / (r - l)), -((t + b) / (t - b)), -(n / (n - f)), 1.0f); + ortho.Transpose(); + return ortho; +} + +static float UnlinearizeDepth(float linearDepth, float n, float f) +{ + return (n * f / linearDepth - f) / (n - f); +} + +static float LinearizeDepth(float logDepth, float n, float f) +{ + return n * f / (f + logDepth * (n - f)); +} +//---------------------------------------------------------------------------- + +CDirectionalShadows::CDirectionalShadows() +: m_ApiManager(null) +, m_WorldCameraFrustumBBox(CAABB::DEGENERATED) +, m_BackdropShadowRenderState(null) +, m_BlurHRenderState(null) +, m_BlurVRenderState(null) +, m_RenderPass(null) +, m_SamplerRT(null) +, m_FullScreenQuadBuffer(null) +, m_LightDir(CFloat3::ZERO) +, m_DrawCoordFrame(__MaxCoordinateFrames) +, m_BackdropCoordFrame(__MaxCoordinateFrames) +, m_MeshToDrawFrame(CFloat4x4::IDENTITY) +, m_LightTransform(CFloat4x4::IDENTITY) +, m_CasterLightAlignedBBox(CAABB::DEGENERATED) +, m_ReceiverViewAlignedBBox(CAABB::DEGENERATED) +, m_ReceiverWorldAlignedBBox(CAABB::DEGENERATED) +, m_CasterViewAlignedBBox(CAABB::DEGENERATED) +, m_CasterWorldAlignedBBox(CAABB::DEGENERATED) +, m_ShadowBias(0) +, m_ShadowVariancePower(1.2) +, m_EnableShadows(true) +, m_EnableVariance(true) +, m_DebugShadows(false) +, m_IdealDepthFormat(RHI::EPixelFormat::FormatUnorm16Depth) +{ +} + +//---------------------------------------------------------------------------- + +CDirectionalShadows::~CDirectionalShadows() +{ +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::Init( const RHI::PApiManager &apiManager, + const RHI::SConstantSetLayout &sceneInfoLayout, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout, + const RHI::PGpuBuffer &fullScreenQuadVbo) +{ + m_ApiManager = apiManager; + m_SceneInfoLayout = sceneInfoLayout; + m_SamplerRT = samplerRT; + m_SamplerRTLayout = samplerRTLayout; + m_FullScreenQuadBuffer = fullScreenQuadVbo; + + m_DrawCoordFrame = __MaxCoordinateFrames; + m_BackdropCoordFrame = __MaxCoordinateFrames; + + const RHI::SGPUCaps &caps = m_ApiManager->GetApiContext()->m_GPUCaps; + m_IdealDepthFormat = RHI::PixelFormatFallbacks::FindClosestSupportedDepthStencilFormat(caps, RHI::FormatUnorm16Depth); + + if (caps.IsPixelFormatSupported(IDEAL_SHADOW_DEPTH_FORMAT, RHI::FormatUsage_RenderTarget | RHI::FormatUsage_ShaderSampling)) + m_IdealShadowFormat = IDEAL_SHADOW_DEPTH_FORMAT; + else + m_IdealShadowFormat = RHI::FormatFloat16RG; + + CreateSimpleSamplerConstSetLayouts(m_BlurConstSetLayout, false); + return _CreateRenderPass(); +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::UpdateSceneInfo(const PKSample::SSceneInfoData &sceneInfoData) +{ + m_SceneInfoData = sceneInfoData; + m_WorldCameraFrustumBBox = _GetFrustumBBox(m_SceneInfoData.m_InvViewProj, 0.0f, 1.0f); + return true; +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::_CreateRenderPass() +{ + m_RenderPass = m_ApiManager->CreateRenderPass(RHI::SRHIResourceInfos("Shadow render pass")); + if (m_RenderPass == null) + return false; + + bool result = true; + RHI::SSubPassDefinition solidDepth; + result &= solidDepth.m_OutputRenderTargets.PushBack(0).Valid(); + solidDepth.m_DepthStencilRenderTarget = 2; + result &= m_RenderPass->AddRenderSubPass(solidDepth); + + RHI::SSubPassDefinition renderHBlur; + result &= renderHBlur.m_InputRenderTargets.PushBack(0).Valid(); + result &= renderHBlur.m_OutputRenderTargets.PushBack(1).Valid(); + result &= m_RenderPass->AddRenderSubPass(renderHBlur); + + RHI::SSubPassDefinition renderVBlur; + result &= renderVBlur.m_InputRenderTargets.PushBack(1).Valid(); + result &= renderVBlur.m_OutputRenderTargets.PushBack(0).Valid(); + result &= m_RenderPass->AddRenderSubPass(renderVBlur); + + // Baking + const RHI::ELoadRTOperation loadRt[] = { RHI::LoadClear, RHI::LoadClear, RHI::LoadClear }; + + m_FrameBufferLayout[0].m_Format = m_IdealShadowFormat; + m_FrameBufferLayout[1].m_Format = m_IdealShadowFormat; + m_FrameBufferLayout[2].m_Format = m_IdealDepthFormat; + + result &= m_RenderPass->BakeRenderPass(m_FrameBufferLayout, loadRt); + return result; +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::_CreateMeshBackdropRenderStates(CShaderLoader &loader, ECoordinateFrame drawFrame, ECoordinateFrame meshFrame) +{ + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = MESHSHADOW_VERTEX_SHADER_PATH; + shadersPaths.m_Fragment = MESHSHADOW_FRAGMENT_SHADER_PATH; + + m_BackdropShadowRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Shadow render state")); + + if (m_BackdropShadowRenderState == null) + return false; + + // Pipeline state solid color: + const bool drawRightHanded = CCoordinateFrame::IsRightHanded(drawFrame); + const bool flippedHandedness = CCoordinateFrame::IsRightHanded(meshFrame) != drawRightHanded; + + m_BackdropShadowRenderState->m_RenderState.m_PipelineState.m_DynamicScissor = true; + m_BackdropShadowRenderState->m_RenderState.m_PipelineState.m_DynamicViewport = true; + m_BackdropShadowRenderState->m_RenderState.m_PipelineState.m_DepthWrite = true; + m_BackdropShadowRenderState->m_RenderState.m_PipelineState.m_DepthTest = RHI::Less; + m_BackdropShadowRenderState->m_RenderState.m_PipelineState.m_CullMode = RHI::CullBackFaces; + m_BackdropShadowRenderState->m_RenderState.m_PipelineState.m_PolyOrder = (drawRightHanded ^ flippedHandedness) ? RHI::FrontFaceCounterClockWise : RHI::FrontFaceClockWise; + + if (!m_BackdropShadowRenderState->m_RenderState.m_InputVertexBuffers.Resize(1)) + return false; + + m_BackdropShadowRenderState->m_RenderState.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat3); + + FillGBufferShadowShaderBindings(m_BackdropShadowRenderState->m_RenderState.m_ShaderBindings, m_SceneInfoLayout); + + m_BackdropShadowRenderState->m_RenderState.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + + if (!loader.LoadShader(m_BackdropShadowRenderState->m_RenderState, shadersPaths, m_ApiManager)) + return false; + + PK_ASSERT(m_CascadedShadows.First().m_FrameBuffer != null); + if (!m_ApiManager->BakeRenderState(m_BackdropShadowRenderState, m_CascadedShadows.First().m_FrameBuffer->GetLayout(), m_RenderPass, 0)) + return false; + + m_BlurHRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Shadow Blur Horizontal")); + m_BlurVRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Shadow Blur Vertical")); + + if (m_BlurHRenderState == null || m_BlurVRenderState == null) + return false; + + // Sets the basic viewport / scissor test + m_BlurHRenderState->m_RenderState.m_PipelineState.m_DynamicScissor = true; + m_BlurHRenderState->m_RenderState.m_PipelineState.m_DynamicViewport = true; + + // Describe the vertex input layout + // We have 2 vertex buffers and 2 attributes + if (!m_BlurHRenderState->m_RenderState.m_InputVertexBuffers.Resize(1)) + return false; + + m_BlurHRenderState->m_RenderState.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat2); // Position for full screen quad + + FillGaussianBlurShaderBindings( GaussianBlurCombination_9_Tap, + m_BlurHRenderState->m_RenderState.m_ShaderBindings, + m_SamplerRTLayout); + + CShaderLoader::SShadersPaths shadersPathsBlur; + shadersPathsBlur.m_Vertex = POSTFX_VERTEX_SHADER_PATH; + shadersPathsBlur.m_Fragment = POSTFX_FRAGMENT_SHADER_PATH; + + if (!loader.LoadShader(m_BlurHRenderState->m_RenderState, shadersPathsBlur, m_ApiManager)) + return false; + + m_BlurVRenderState->m_RenderState = m_BlurHRenderState->m_RenderState; + + if (!m_ApiManager->BakeRenderState(m_BlurHRenderState, m_CascadedShadows.First().m_FrameBuffer->GetLayout(), m_RenderPass, 1)) + return false; + if (!m_ApiManager->BakeRenderState(m_BlurVRenderState, m_CascadedShadows.First().m_FrameBuffer->GetLayout(), m_RenderPass, 2)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::_CreateSliceData(SCascadedShadowSlice &slice) +{ + RHI::PRenderTarget rts[] = + { + slice.m_ShadowMap.m_RenderTarget, + slice.m_IntermediateRt.m_RenderTarget, + slice.m_DepthMap.m_RenderTarget + }; + if (!Utils::CreateFrameBuffer(RHI::SRHIResourceInfos("Shadow frame buffer"), m_ApiManager, rts, slice.m_FrameBuffer, m_RenderPass)) + return false; + + slice.m_BlurHConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Constant Set For Shadow Horizontal Blur"), m_BlurConstSetLayout); + slice.m_BlurVConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Constant Set For Shadow Vertical Blur"), m_BlurConstSetLayout); + + if (slice.m_BlurHConstantSet == null || slice.m_BlurVConstantSet == null) + return false; + + bool success = true; + + success &= slice.m_BlurHConstantSet->SetConstants(m_SamplerRT, slice.m_ShadowMap.m_RenderTarget->GetTexture(), 0); + success &= slice.m_BlurHConstantSet->UpdateConstantValues(); + success &= slice.m_BlurVConstantSet->SetConstants(m_SamplerRT, slice.m_IntermediateRt.m_RenderTarget->GetTexture(), 0); + success &= slice.m_BlurVConstantSet->UpdateConstantValues(); + return success; +} + +//---------------------------------------------------------------------------- + +CAABB CDirectionalShadows::_GetFrustumBBox(CFloat4x4 invViewProj, float nearPlane, float farPlane, const CFloat4x4 &postProjTransform) +{ + const CFloat4 kFrustumCorners[8] = + { + CFloat4(-1, -1, nearPlane, 1), + CFloat4(1, -1, nearPlane, 1), + CFloat4(-1, 1, nearPlane, 1), + CFloat4(1, 1, nearPlane, 1), + CFloat4(-1, -1, farPlane, 1), + CFloat4(1, -1, farPlane, 1), + CFloat4(-1, 1, farPlane, 1), + CFloat4(1, 1, farPlane, 1), + }; + + CAABB camBBoxFrustum = CAABB::DEGENERATED; + for (u32 j = 0; j < 8; ++j) + { + const CFloat4 unprojectedCorner = invViewProj.TransformVector(kFrustumCorners[j]); + const CFloat3 cornerPostProj = unprojectedCorner.xyz() / unprojectedCorner.w(); + const CFloat3 cornerTransformed = postProjTransform.TransformVector(cornerPostProj); + camBBoxFrustum.Add(cornerTransformed); + } + return camBBoxFrustum; +} + +//---------------------------------------------------------------------------- + +void CDirectionalShadows::_ExtendCasterBBox(CAABB &caster, const CAABB &receiver, const CFloat3 &lightDirection) const +{ + // Projects the shadow caster BBox on the shadow receiver BBox to get the shadow BBox: + for (u32 i = 0; i < 8; ++i) + { + const CFloat3 viewSpaceCorner = caster.ExtractCorner(i); + const CRay ray = CRay(viewSpaceCorner, lightDirection); + // Collide with the 6 planes of the receiver BBox: + for (u32 j = 0; j < 6; ++j) + { + const u32 currentAxis = j % 3; + CFloat3 normal = CFloat3::ZERO; + normal.Axis(currentAxis) = j < 3 ? -1.0f : 1.0f; + const CPlane plane(normal, j < 3 ? receiver.Min() : receiver.Max()); + TPrimitiveHitReport3D hit; + + if (Colliders::RayTrace(plane, ray, hit) && hit.t > 0.0f) + { + CFloat3 centeredPoint = hit.point; + centeredPoint.Axis(currentAxis) = receiver.Center().Axis(currentAxis); + if (receiver.Contains(centeredPoint)) + caster.Add(hit.point); + } + } + } +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::InitFrameUpdateSceneInfo(const CFloat3 &lightDir, ECoordinateFrame drawFrame, CShaderLoader &loader, const PKSample::SMesh &backdrop, bool castShadows) +{ + if (m_DrawCoordFrame != drawFrame) + m_DrawCoordFrame = drawFrame; + m_LightDir = lightDir.Normalized(); + + // Compute light rotation matrix: + const CFloat3 forward = m_LightDir; + // Safe cross product to find up vector: + CFloat3 up = PKAbs(CCoordinateFrame::AxisSide().Dot(forward)) < 0.995f ? + forward.Cross(CCoordinateFrame::AxisSide()).Normalized() : + forward.Cross(CCoordinateFrame::AxisVertical().Normalized()); + const CFloat3 side = forward.Cross(up).Normalized(); + up = forward.Cross(side); + + // Basic rotation matrix aligned with world axis: + const CFloat4x4 lightRotation = CFloat4x4(side.xyz0(), up.xyz0(), forward.xyz0(), CFloat4(0, 0, 0, 1)); + + PK_ASSERT(lightRotation.Orthonormal()); + m_LightTransform = lightRotation.Inverse(); + m_CasterLightAlignedBBox = CAABB::DEGENERATED; + m_CasterViewAlignedBBox = CAABB::DEGENERATED; + m_ReceiverViewAlignedBBox = CAABB::DEGENERATED; + m_CasterWorldAlignedBBox = CAABB::DEGENERATED; + m_ReceiverWorldAlignedBBox = CAABB::DEGENERATED; + + for (u32 i = 0; i < m_CascadedShadows.Count(); ++i) + { + SCascadedShadowSlice &slice = m_CascadedShadows[i]; + slice.m_IsValid = true; + slice.m_InvView = lightRotation; + slice.m_View = m_LightTransform; + slice.m_ShadowSliceViewAABB = CAABB::DEGENERATED; + } + + if (m_BackdropCoordFrame != backdrop.m_MeshBatchCoordinateFrame) + { + m_BackdropCoordFrame = backdrop.m_MeshBatchCoordinateFrame; + _CreateMeshBackdropRenderStates(loader, m_DrawCoordFrame, m_BackdropCoordFrame); + CCoordinateFrame::BuildTransitionFrame(m_BackdropCoordFrame, m_DrawCoordFrame, m_MeshToDrawFrame); + } + + // Transform each corner of the meshes AABB in light transform space and recompute AABB: + for (u32 instanceIdx = 0; instanceIdx < backdrop.m_Transforms.Count(); ++instanceIdx) + { + const CFloat4x4 meshTransform = backdrop.m_Transforms[instanceIdx]; + + for (u32 meshIdx = 0; meshIdx < backdrop.m_MeshBatches.Count(); ++meshIdx) + { + const CAABB meshBBox = backdrop.m_MeshBatches[meshIdx].m_BBox; + if (meshBBox.Valid()) + { + AddBBox(meshBBox, m_MeshToDrawFrame * meshTransform, castShadows); + } + } + } + return true; +} + +//---------------------------------------------------------------------------- + +void CDirectionalShadows::AddBBox(const CAABB &bbox, const CFloat4x4 &transform, bool castShadows) +{ + const float epsilon = 0.001f; + const CAABB scaledBBox = bbox.ScaledFromCenter(1.0f + epsilon); + + // We compute a view-space BBox and a world BBox to get the min/max depths: + CAABB worldBBox; + worldBBox.SetupFromOBB(scaledBBox, transform); + + CAABB viewBBox; + viewBBox.SetupFromOBB(scaledBBox, transform * m_SceneInfoData.m_View); + + m_ReceiverViewAlignedBBox.Add(viewBBox); + m_ReceiverWorldAlignedBBox.Add(worldBBox); + + if (!castShadows) + return; + + m_CasterViewAlignedBBox.Add(viewBBox); + m_CasterWorldAlignedBBox.Add(worldBBox); + + // We compute a world BBox and a light-space BBox and constraint both depending on the light direction + // Computing both those BBox helps getting the smallest as possible BBox: + CAABB viewSpaceBBox; + viewSpaceBBox.SetupFromOBB(scaledBBox, transform * m_LightTransform); + + // World space culling with the light direction: + CAABB frsutumFittedBBoxWorld = worldBBox; + for (u32 j = 0; j < 3; ++j) + { + if (m_LightDir.Axis(j) <= 0 && worldBBox.Max().Axis(j) > m_WorldCameraFrustumBBox.Min().Axis(j)) + frsutumFittedBBoxWorld.Min().Axis(j) = PKMax(worldBBox.Min().Axis(j), m_WorldCameraFrustumBBox.Min().Axis(j)); + if (m_LightDir.Axis(j) >= 0 && worldBBox.Min().Axis(j) < m_WorldCameraFrustumBBox.Max().Axis(j)) + frsutumFittedBBoxWorld.Max().Axis(j) = PKMin(worldBBox.Max().Axis(j), m_WorldCameraFrustumBBox.Max().Axis(j)); + } + // Then transform this to light-space + CAABB fittedViewSpaceBBox; + fittedViewSpaceBBox.SetupFromOBB(frsutumFittedBBoxWorld, m_LightTransform); + + if (fittedViewSpaceBBox.Valid()) + { + fittedViewSpaceBBox.Min() = PKMax(fittedViewSpaceBBox.Min(), viewSpaceBBox.Min()); + fittedViewSpaceBBox.Max() = PKMin(fittedViewSpaceBBox.Max(), viewSpaceBBox.Max()); + m_CasterLightAlignedBBox.Add(fittedViewSpaceBBox); + } +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::FinalizeFrameUpdateSceneInfo() +{ + // Early out if there is no valid shadow caster BBox: + if (!m_CasterLightAlignedBBox.Valid()) + { + for (u32 i = 0; i < m_CascadedShadows.Count(); ++i) + { + m_CascadedShadows[i].m_IsValid = false; + m_CascadedShadows[i].m_DepthRangeMin = -1; + m_CascadedShadows[i].m_DepthRangeMax = -1; + } + return true; + } + // We start by computing the caster min/max scene depth. + // To do that we start by projecting the caster BBox corners on the receiver BBox depending on the light direction + // We do this twice, once in view space and once in world space: + const CFloat3 viewSpaceLightDirection = m_SceneInfoData.m_View.RotateVector(m_LightDir); + _ExtendCasterBBox(m_CasterViewAlignedBBox, m_ReceiverViewAlignedBBox, viewSpaceLightDirection); + // Now we just have to project the caster BBox min/max with the projection matrix: + // (min and max are inverted because the BBox is in view-space and not inv-view-space) + CFloat4 projCasterMin = m_SceneInfoData.m_Proj.TransformVector(CFloat4(m_CasterViewAlignedBBox.Max(), 1.0f)); + CFloat4 projCasterMax = m_SceneInfoData.m_Proj.TransformVector(CFloat4(m_CasterViewAlignedBBox.Min(), 1.0f)); + projCasterMin.z() = PKMax(projCasterMin.z(), 0.0f); + projCasterMax.z() = PKMax(projCasterMax.z(), 0.0f); + const float viewSpacecastSceneMinDepth = projCasterMin.z() / projCasterMin.w(); + const float viewSpacecastSceneMaxDepth = projCasterMax.z() / projCasterMax.w(); + // We do the same thing in world-space to get the smallest possible BBox: + _ExtendCasterBBox(m_CasterWorldAlignedBBox, m_ReceiverWorldAlignedBBox, m_LightDir); + // Now we project the 8 corners of the caster world-space BBox with the view/projection matrix: + float worldSpacecastSceneMinDepth = 1.0f; + float worldSpacecastSceneMaxDepth = 0.0f; + for (u32 i = 0; i < 8; ++i) + { + const CFloat3 worldSpaceCorner = m_CasterWorldAlignedBBox.ExtractCorner(i); + CFloat4 projCaster = m_SceneInfoData.m_ViewProj.TransformVector(CFloat4(worldSpaceCorner, 1.0f)); + projCaster.z() = PKMax(projCaster.z(), 0); + float cornerDepth = projCaster.z() / projCaster.w(); + worldSpacecastSceneMinDepth = PKMin(cornerDepth, worldSpacecastSceneMinDepth); + worldSpacecastSceneMaxDepth = PKMax(cornerDepth, worldSpacecastSceneMaxDepth); + } + // Get the smallest range of the 2 ranges computed: + const float castSceneMinDepth = PKMax(viewSpacecastSceneMinDepth, worldSpacecastSceneMinDepth); + const float castSceneMaxDepth = PKMin(viewSpacecastSceneMaxDepth, worldSpacecastSceneMaxDepth); + // Now we can compute the distance for each slice depending on the depths computed above: + const CFloat2 &nearFar = m_SceneInfoData.m_ZBufferLimits; + const float linearSceneDepthMin = LinearizeDepth(castSceneMinDepth, nearFar.x(), nearFar.y()); + const float linearSceneDepthMax = LinearizeDepth(castSceneMaxDepth, nearFar.x(), nearFar.y()); + const float linearSceneDepthRange = linearSceneDepthMax - linearSceneDepthMin; + float previousMaxDepth = linearSceneDepthMin; + + for (u32 i = 0; i < m_CascadedShadows.Count(); ++i) + { + SCascadedShadowSlice &slice = m_CascadedShadows[i]; + + const float linearSliceDepthRangeMin = previousMaxDepth; + float linearSliceDepthRangeMax = previousMaxDepth + PKMax(slice.m_MinDistance, linearSceneDepthRange * slice.m_SceneRangeRatio); + linearSliceDepthRangeMax = PKMin(linearSliceDepthRangeMax, linearSceneDepthMax); + + previousMaxDepth = linearSliceDepthRangeMax; + + slice.m_DepthRangeMin = UnlinearizeDepth(linearSliceDepthRangeMin, nearFar.x(), nearFar.y()); + slice.m_DepthRangeMax = UnlinearizeDepth(linearSliceDepthRangeMax, nearFar.x(), nearFar.y()); + + slice.m_IsValid &= slice.m_DepthRangeMin < castSceneMaxDepth && slice.m_DepthRangeMax > castSceneMinDepth; + slice.m_IsValid &= slice.m_DepthRangeMin != slice.m_DepthRangeMax; + + if (!slice.m_IsValid) + { + slice.m_DepthRangeMin = -1.0f; + slice.m_DepthRangeMax = -1.0f; + continue; + } + + slice.m_DepthRangeMin = PKMax(castSceneMinDepth, slice.m_DepthRangeMin); + slice.m_DepthRangeMax = PKMin(castSceneMaxDepth, slice.m_DepthRangeMax); + + // We recompute the matrix with the new depth range: + const CAABB sceneCameraFrustumBBoxLight = _GetFrustumBBox(m_SceneInfoData.m_InvViewProj, slice.m_DepthRangeMin, slice.m_DepthRangeMax, m_LightTransform); + + slice.m_ShadowSliceViewAABB = m_CasterLightAlignedBBox; + + // Clamp left, right, bottom, up and far to the camera frustum: + slice.m_ShadowSliceViewAABB.Min().xy() = PKMax(slice.m_ShadowSliceViewAABB.Min().xy(), sceneCameraFrustumBBoxLight.Min().xy()); + slice.m_ShadowSliceViewAABB.Max().xy() = PKMin(slice.m_ShadowSliceViewAABB.Max().xy(), sceneCameraFrustumBBoxLight.Max().xy()); + slice.m_ShadowSliceViewAABB.Max().z() = PKMin(slice.m_ShadowSliceViewAABB.Max().z(), sceneCameraFrustumBBoxLight.Max().z()); + + slice.m_AspectRatio = CFloat2( PKMin(slice.m_ShadowSliceViewAABB.Extent().x() / slice.m_ShadowSliceViewAABB.Extent().y(), 1.0f), + PKMin(slice.m_ShadowSliceViewAABB.Extent().y() / slice.m_ShadowSliceViewAABB.Extent().x(), 1.0f)); + + // Cam position is the center of the BBox in X and Y and the min value of Z: + CFloat3 camPosition = slice.m_ShadowSliceViewAABB.Center(); + camPosition.z() = slice.m_ShadowSliceViewAABB.Min().z(); + slice.m_ShadowSliceViewAABB -= camPosition; + + // Update scene info with orthogonal view for shadow map: + slice.m_Proj = CreateOrtho( slice.m_ShadowSliceViewAABB.Min().y(), slice.m_ShadowSliceViewAABB.Max().y(), + slice.m_ShadowSliceViewAABB.Min().x(), slice.m_ShadowSliceViewAABB.Max().x(), + slice.m_ShadowSliceViewAABB.Min().z(), slice.m_ShadowSliceViewAABB.Max().z()); + slice.m_InvProj = slice.m_Proj.Inverse(); + // Transform the inv light space cam position into world space: + slice.m_InvView.WAxis() = CFloat4(slice.m_InvView.TransformVector(camPosition), 1); + slice.m_View = slice.m_InvView.Inverse(); + slice.m_WorldToShadow = slice.m_View * slice.m_Proj; + + Utils::SBasicCameraData basicCam; + + basicCam.m_BillboardingView = slice.m_View; + basicCam.m_CameraProj = slice.m_Proj; + basicCam.m_CameraView = slice.m_View; + basicCam.m_CameraZLimit = CFloat2(slice.m_ShadowSliceViewAABB.Min().z(), slice.m_ShadowSliceViewAABB.Max().z()); + + PKSample::SSceneInfoData cascadeSceneInfo = m_SceneInfoData; + + Utils::SetupSceneInfoData(cascadeSceneInfo, basicCam, m_DrawCoordFrame); + + if (!PK_VERIFY(slice.m_SceneInfoBuffer != null)) + return false; + + // Fill the GPU buffer: + SSceneInfoData *sceneInfo = static_cast(m_ApiManager->MapCpuView(slice.m_SceneInfoBuffer)); + if (!PK_VERIFY(sceneInfo != null)) + return false; + *sceneInfo = cascadeSceneInfo; + if (!PK_VERIFY(m_ApiManager->UnmapCpuView(slice.m_SceneInfoBuffer))) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::IsAnySliceValidForDraw() const +{ + for (u32 i = 0; i < m_CascadedShadows.Count(); ++i) + { + if (IsSliceValidForDraw(i)) + return true; + } + return false; +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::BeginDrawShadowRenderPass(const RHI::PCommandBuffer &cmdBuff, u32 cascadeIdx, const PKSample::SMesh *backdrop) +{ + // Begin render pass: + const RHI::SFrameBufferClearValue clearValues[3] = + { + RHI::SFrameBufferClearValue(1.0f, 1.0f, 1.0f, 1.0f), + RHI::SFrameBufferClearValue(1.0f, 1.0f, 1.0f, 1.0f), + RHI::SFrameBufferClearValue(1.0f, 0) + }; + + const SCascadedShadowSlice &slice = m_CascadedShadows[cascadeIdx]; + + if (!PK_VERIFY(slice.m_IsValid)) + return false; + + const CUint2 viewportSize = m_ShadowMapResolution * slice.m_AspectRatio; + + cmdBuff->BeginRenderPass(m_RenderPass, slice.m_FrameBuffer, clearValues); + + cmdBuff->SetViewport(CInt2(0, 0), viewportSize, CFloat2(0, 1)); + cmdBuff->SetScissor(CInt2(0), viewportSize); + + if (backdrop == null) + return true; + + // Draw the meshes: + cmdBuff->BindRenderState(m_BackdropShadowRenderState); + + const RHI::PConstantSet constSets[] = + { + slice.m_SceneInfoConstantSet, + }; + + cmdBuff->BindConstantSets(constSets); + + // Push matrices as constants + CFloat4x4 meshVertexConstant; + + const u32 instanceCount = backdrop->m_Transforms.Count(); + for (u32 iInstance = 0; iInstance < instanceCount; ++iInstance) + { + // Model matrix + const CFloat4x4 meshTransforms = m_MeshToDrawFrame * backdrop->m_Transforms[iInstance]; + meshVertexConstant = meshTransforms; + + cmdBuff->PushConstant(&meshVertexConstant, 0); + for (u32 j = 0; j < backdrop->m_MeshBatches.Count(); ++j) + { + const PKSample::SMesh::SMeshBatch &curBatch = backdrop->m_MeshBatches[j]; + RHI::PGpuBuffer vBuffer = null; + + // curBatch can be either static or skinned batch, most of the time it won't be animated + PK_ASSERT(curBatch.m_Instances.Empty() || iInstance < curBatch.m_Instances.Count()); + // If this instance has valid skinned data, render with those vb, otherwise render the bindpose + if (curBatch.m_Instances.Empty() || !curBatch.m_Instances[iInstance].m_HasValidSkinnedData) + vBuffer = curBatch.m_BindPoseVertexBuffers; + else + vBuffer = curBatch.m_Instances[iInstance].m_SkinnedVertexBuffers; + + if (!PK_VERIFY(vBuffer != null && curBatch.m_BindPoseVertexBuffers != null)) + continue; + + const RHI::PGpuBuffer vertexBuffers[] = { vBuffer }; + const u32 offsets[] = { curBatch.m_PositionsOffset }; + + cmdBuff->BindVertexBuffers(vertexBuffers, offsets); + cmdBuff->BindIndexBuffer(curBatch.m_IndexBuffer, 0, curBatch.m_IndexSize); + + cmdBuff->DrawIndexed(0, 0, curBatch.m_IndexCount); + } + } + return true; +} + +bool CDirectionalShadows::EndDrawShadowRenderPass(const RHI::PCommandBuffer &cmdBuff, u32 cascadeIdx) +{ + if (m_EnableVariance) + { + const SCascadedShadowSlice &slice = m_CascadedShadows[cascadeIdx]; + const CUint2 viewportSize = m_ShadowMapResolution * slice.m_AspectRatio; + const SBlurInfo horizontal(viewportSize, CFloat2(1.0f, 0.0f), CFloat4(0.0f, 0.0f, slice.m_AspectRatio)); + const SBlurInfo vertical(viewportSize, CFloat2(0.0f, 1.0f), CFloat4(0.0f, 0.0f, slice.m_AspectRatio)); + + cmdBuff->SetViewport(CInt2(0, 0), viewportSize, CFloat2(0, 1)); + cmdBuff->SetScissor(CInt2(0), viewportSize); + + cmdBuff->NextRenderSubPass(); + cmdBuff->BindRenderState(m_BlurHRenderState); + + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadBuffer)); + cmdBuff->BindConstantSets(TMemoryView(slice.m_BlurHConstantSet)); + cmdBuff->PushConstant(&horizontal, 0); + cmdBuff->Draw(0, 6); + + cmdBuff->NextRenderSubPass(); + cmdBuff->BindRenderState(m_BlurVRenderState); + + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadBuffer)); + cmdBuff->BindConstantSets(TMemoryView(slice.m_BlurVConstantSet)); + cmdBuff->PushConstant(&vertical, 0); + cmdBuff->Draw(0, 6); + } + else + { + cmdBuff->NextRenderSubPass(); + cmdBuff->NextRenderSubPass(); + } + bool success = true; + success &= cmdBuff->EndRenderPass(); + return success; +} + +//---------------------------------------------------------------------------- + +void CDirectionalShadows::SetShadowsInfo(float bias, float variancePower, bool enableShadows, bool enableVariance, bool debugShadows, const CUint2 &resolution) +{ + m_ShadowBias = bias; + m_ShadowVariancePower = variancePower; + m_EnableShadows = enableShadows; + m_EnableVariance = enableVariance; + m_DebugShadows = debugShadows; + m_ShadowMapResolution = resolution; +} + +//---------------------------------------------------------------------------- + +void CDirectionalShadows::SetCascadeShadowsSettings(u32 cascadeIdx, float sceneRangeRatio, float minDistance) +{ + m_CascadedShadows[cascadeIdx].m_SceneRangeRatio = sceneRangeRatio; + m_CascadedShadows[cascadeIdx].m_MinDistance = minDistance; +} + +//---------------------------------------------------------------------------- + +bool CDirectionalShadows::UpdateShadowsSettings() +{ + // Normalize the range ratios: + float rangeSum = 0.0f; + for (u32 i = 0; i < m_CascadedShadows.Count(); ++i) + rangeSum += m_CascadedShadows[i].m_SceneRangeRatio; + + for (u32 i = 0; i < m_CascadedShadows.Count(); ++i) + { + SCascadedShadowSlice &slice = m_CascadedShadows[i]; + + slice.m_SceneRangeRatio /= rangeSum; + // Create render target: + if (!slice.m_ShadowMap.CreateRenderTarget( RHI::SRHIResourceInfos("Shadow render target RG"), + m_ApiManager, m_SamplerRT, m_IdealShadowFormat, m_ShadowMapResolution, m_SamplerRTLayout)) + return false; + // Create tmp render target: + if (!slice.m_IntermediateRt.CreateRenderTarget( RHI::SRHIResourceInfos("Shadow blur intermediate render target"), + m_ApiManager, m_SamplerRT, m_IdealShadowFormat, m_ShadowMapResolution, m_SamplerRTLayout)) + return false; + // Create depth: + if (!slice.m_DepthMap.CreateRenderTarget( RHI::SRHIResourceInfos("Shadow depth render target"), + m_ApiManager, m_SamplerRT, m_IdealDepthFormat, m_ShadowMapResolution, m_SamplerRTLayout)) + return false; + + // Scene info: + const RHI::SConstantBufferDesc &sceneInfoBufferDesc = m_SceneInfoLayout.m_Constants.First().m_ConstantBuffer; + + slice.m_SceneInfoConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Shadow scene info layout"), m_SceneInfoLayout); + if (!PK_VERIFY(slice.m_SceneInfoConstantSet != null)) + return false; + + const u32 constantBufferSize = sceneInfoBufferDesc.m_ConstantBufferSize; // We could also create the new one based on the default one created + PK_ASSERT(constantBufferSize == sizeof(PKSample::SSceneInfoData)); + slice.m_SceneInfoBuffer = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Shadow scene info buffer"), RHI::ConstantBuffer, constantBufferSize); + if (!PK_VERIFY(slice.m_SceneInfoBuffer != null)) + return false; + if (!PK_VERIFY(slice.m_SceneInfoConstantSet->SetConstants(slice.m_SceneInfoBuffer, 0))) + return false; + if (!PK_VERIFY(slice.m_SceneInfoConstantSet->UpdateConstantValues())) + return false; + if (!_CreateSliceData(slice)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +TMemoryView CDirectionalShadows::GetFrameBufferLayout() const +{ + return TMemoryView(m_FrameBufferLayout); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/DirectionalShadows.h b/Samples/PK-SampleLib/RenderPasses/DirectionalShadows.h new file mode 100644 index 00000000..aa0f2d0e --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/DirectionalShadows.h @@ -0,0 +1,178 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CDirectionalShadows +{ +public: + CDirectionalShadows(); + ~CDirectionalShadows(); + + bool Init( const RHI::PApiManager &apiManager, + const RHI::SConstantSetLayout &sceneInfoLayout, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout, + const RHI::PGpuBuffer &fullScreenQuadVbo); + bool UpdateSceneInfo(const PKSample::SSceneInfoData &sceneInfoData); + bool InitFrameUpdateSceneInfo( const CFloat3 &lightDir, + ECoordinateFrame drawFrame, + CShaderLoader &loader, + const PKSample::SMesh &backdrop, + bool castShadows); + void AddBBox(const CAABB &bbox, const CFloat4x4 &transform, bool castShadows); + bool FinalizeFrameUpdateSceneInfo(); + + bool IsSliceValidForDraw(u32 sliceIdx) const { return m_CascadedShadows[sliceIdx].m_IsValid; } + bool IsAnySliceValidForDraw() const; + bool BeginDrawShadowRenderPass(const RHI::PCommandBuffer &commandBuffer, u32 cascadeIdx, const PKSample::SMesh *backdrop = null); + bool EndDrawShadowRenderPass(const RHI::PCommandBuffer &commandBuffer, u32 cascadeIdx); + + void SetShadowsInfo(float bias, float variancePower, bool enableShadows, bool enableVariance, bool debugShadows, const CUint2 &resolution); + void SetCascadeShadowsSettings(u32 cascadeIdx, float sceneRangeRatio, float minDistance); + bool UpdateShadowsSettings(); + + const RHI::PConstantSet &GetDepthConstSet(u32 sliceIdx) const { return m_CascadedShadows[sliceIdx].m_ShadowMap.m_SamplerConstantSet; } + const RHI::PTexture &GetDepthTexture(u32 sliceIdx) const { return m_CascadedShadows[sliceIdx].m_ShadowMap.m_RenderTarget->GetTexture(); } + const CFloat4x4 &GetWorldToShadow(u32 sliceIdx) const { return m_CascadedShadows[sliceIdx].m_WorldToShadow; } + const RHI::PRenderPass &GetRenderPass() const { return m_RenderPass; } + u32 GetShadowSubpassIdx() const { return 0; } + const RHI::PConstantSet &GetSceneInfoConstSet(u32 sliceIdx) const { return m_CascadedShadows[sliceIdx].m_SceneInfoConstantSet; } + float GetDepthRange(u32 sliceIdx) const { return m_CascadedShadows[sliceIdx].m_DepthRangeMax; } + CFloat2 GetAspectRatio(u32 sliceIdx) const { return m_CascadedShadows[sliceIdx].m_AspectRatio; } + float GetShadowBias() const { return m_ShadowBias; } + float GetShadowVariancePower() const { return m_ShadowVariancePower; } + float GetShadowEnabled() const { return m_EnableShadows; } + float GetShadowVarianceEnabled() const { return m_EnableVariance; } + float GetDebugShadowEnabled() const { return m_DebugShadows; } + u32 CascadeShadowCount() const { return m_CascadedShadows.Count(); } + TMemoryView GetFrameBufferLayout() const; + +private: + struct SCascadedShadowSlice + { + RHI::PConstantSet m_SceneInfoConstantSet; + RHI::PGpuBuffer m_SceneInfoBuffer; + + RHI::PFrameBuffer m_FrameBuffer; + + RHI::PConstantSet m_BlurHConstantSet; + RHI::PConstantSet m_BlurVConstantSet; + + SSamplableRenderTarget m_ShadowMap; + SSamplableRenderTarget m_DepthMap; + SSamplableRenderTarget m_IntermediateRt; + + CFloat4x4 m_View; + CFloat4x4 m_InvView; + CFloat4x4 m_Proj; + CFloat4x4 m_InvProj; + CFloat4x4 m_WorldToShadow; + + CAABB m_ShadowSliceViewAABB; + CFloat2 m_AspectRatio = CFloat2(1); + + float m_SceneRangeRatio; + float m_MinDistance; + + float m_DepthRangeMin; + float m_DepthRangeMax; + // Shadow valid only if there is something to render: + bool m_IsValid; + + SCascadedShadowSlice() + : m_SceneInfoConstantSet(null) + , m_SceneInfoBuffer(null) + , m_FrameBuffer(null) + , m_BlurHConstantSet(null) + , m_BlurVConstantSet(null) + , m_View(CFloat4x4::IDENTITY) + , m_InvView(CFloat4x4::IDENTITY) + , m_Proj(CFloat4x4::IDENTITY) + , m_InvProj(CFloat4x4::IDENTITY) + , m_WorldToShadow(CFloat4x4::IDENTITY) + , m_ShadowSliceViewAABB(CAABB::DEGENERATED) + , m_AspectRatio(1) + , m_SceneRangeRatio(0) + , m_MinDistance(0) + , m_DepthRangeMin(0) + , m_DepthRangeMax(0) + , m_IsValid(false) + { + } + }; + + bool _CreateRenderPass(); + bool _CreateMeshBackdropRenderStates(CShaderLoader &loader, ECoordinateFrame drawFrame, ECoordinateFrame meshFrame); + bool _CreateSliceData(SCascadedShadowSlice &slice); + CAABB _GetFrustumBBox(CFloat4x4 invViewProj, float nearPlane, float farPlane, const CFloat4x4 &postProjTransform = CFloat4x4::IDENTITY); + void _ExtendCasterBBox(CAABB &caster, const CAABB &receiver, const CFloat3 &lightDirection) const; + + RHI::PApiManager m_ApiManager; + + PKSample::SSceneInfoData m_SceneInfoData; + CAABB m_WorldCameraFrustumBBox; + + RHI::PRenderState m_BackdropShadowRenderState; + RHI::SConstantSetLayout m_SceneInfoLayout; + + RHI::SConstantSetLayout m_BlurConstSetLayout; + RHI::PRenderState m_BlurHRenderState; + RHI::PRenderState m_BlurVRenderState; + + RHI::PRenderPass m_RenderPass; + + RHI::PConstantSampler m_SamplerRT; + RHI::SConstantSetLayout m_SamplerRTLayout; + + RHI::PGpuBuffer m_FullScreenQuadBuffer; + + TStaticArray m_CascadedShadows; + + CFloat3 m_LightDir; + + ECoordinateFrame m_DrawCoordFrame; + ECoordinateFrame m_BackdropCoordFrame; + CFloat4x4 m_MeshToDrawFrame; + + CFloat4x4 m_LightTransform; + CAABB m_CasterLightAlignedBBox; + + CAABB m_ReceiverViewAlignedBBox; + CAABB m_ReceiverWorldAlignedBBox; + CAABB m_CasterViewAlignedBBox; + CAABB m_CasterWorldAlignedBBox; + + float m_ShadowBias; + float m_ShadowVariancePower; + bool m_EnableShadows; + bool m_EnableVariance; + bool m_DebugShadows; + CUint2 m_ShadowMapResolution = CUint2(0); + + RHI::EPixelFormat m_IdealDepthFormat; + RHI::EPixelFormat m_IdealShadowFormat; + RHI::SRenderTargetDesc m_FrameBufferLayout[3]; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/DownSampleTexture.cpp b/Samples/PK-SampleLib/RenderPasses/DownSampleTexture.cpp new file mode 100644 index 00000000..f8a67b0f --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/DownSampleTexture.cpp @@ -0,0 +1,258 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "DownSampleTexture.h" + +#include +#include + +#include + +#define QUAD_VERTEX_SHADER "./Shaders/FullScreenQuad.vert" +#define COPY_FRAGMENT_SHADER "./Shaders/Copy.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CDownSampleTexture::CDownSampleTexture() +{ +} + +//---------------------------------------------------------------------------- + +CDownSampleTexture::~CDownSampleTexture() +{ +} + +//---------------------------------------------------------------------------- + +bool CDownSampleTexture::Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo) +{ + m_FullScreenQuadVbo = fullScreenQuadVbo; + m_ApiManager = apiManager; + CreateSimpleSamplerConstSetLayouts(m_ConstSetLayoutDownScale, false); + return true; +} + +//---------------------------------------------------------------------------- + +bool CDownSampleTexture::CreateRenderTargets(const RHI::PConstantSampler &sampler, + u32 maxDownsampleCount, + const CUint2 &textureSize, + RHI::EPixelFormat textureFormat, + const bool forcePowerOfTwoSizes) +{ + CUint2 rtSize = textureSize; //render-target size + CUint2 scSize = textureSize; //screen size + const u32 maxSize = PKMax(rtSize.x(), rtSize.y()); + const u32 pow2 = IntegerTools::Log2(maxSize); + const u32 downscalePassCount = PKMax(PKMin(pow2, maxDownsampleCount), 1U); + + // Create the samplable render targets + if (m_DownscaledTextures.Resize(downscalePassCount) == false) + return false; + PK_VERIFY(m_DownscaledSizes.Resize(downscalePassCount)); + + // Force rtSize to be a power of 2. + if (forcePowerOfTwoSizes) + { + rtSize.x() = IntegerTools::NextOrEqualPowerOfTwo(rtSize.x()); + rtSize.y() = IntegerTools::NextOrEqualPowerOfTwo(rtSize.y()); + // resize screen size (but keep the ratio) + const float factor = (rtSize.y() * textureSize.x() > rtSize.x() * textureSize.y()) ? rtSize.y() * 1.f / textureSize.y() : rtSize.x() * 1.f / textureSize.x(); + scSize.x() = factor * scSize.x(); + scSize.y() = factor * scSize.y(); + } + + // Compute the reduction size + for (u32 i = 0; i < downscalePassCount; ++i) + { + rtSize = PKMax(rtSize / 2U, CUint2(1)); + scSize = PKMax(scSize / 2U, CUint2(1)); + m_DownscaledSizes[i] = scSize; + if (!m_DownscaledTextures[i].CreateRenderTarget(RHI::SRHIResourceInfos("Downscaled Render Target"), + m_ApiManager, + sampler, + textureFormat, + rtSize, + m_ConstSetLayoutDownScale)) + return false; + } + m_FrameBufferLayout = m_DownscaledTextures.First().m_RenderTarget->GetRenderTargetLayout(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CDownSampleTexture::CreateRenderPass() +{ + // Allocations + m_RenderPassDownScale = m_ApiManager->CreateRenderPass(RHI::SRHIResourceInfos("Downscale Render Pass")); + if (m_RenderPassDownScale == null) + return false; + + bool result = true; + // Definition + RHI::SSubPassDefinition blitToLowRes; + + // Bloom Pass + result &= blitToLowRes.m_OutputRenderTargets.PushBack(0).Valid(); + + result &= m_RenderPassDownScale->AddRenderSubPass(blitToLowRes); + + // Baking + const RHI::ELoadRTOperation loadRt[] = { RHI::LoadDontCare }; + + result &= m_RenderPassDownScale->BakeRenderPass(TMemoryView(m_FrameBufferLayout), loadRt); + return result; +} + +//---------------------------------------------------------------------------- + +bool CDownSampleTexture::BakeRenderStates() +{ + bool success = true; + + success &= m_ApiManager->BakeRenderState(m_FirstCopyDownscale, TMemoryView(m_FrameBufferLayout), m_RenderPassDownScale, 0); + success &= m_ApiManager->BakeRenderState(m_CopyDownscale, TMemoryView(m_FrameBufferLayout), m_RenderPassDownScale, 0); + return success; +} + +//---------------------------------------------------------------------------- + +bool CDownSampleTexture::CreateFrameBuffers() +{ + // Create the frame buffers for the blur + if (m_FrameBuffers.Resize(m_DownscaledTextures.Count()) == false) + return false; + for (u32 i = 0; i < m_DownscaledTextures.Count(); ++i) + { + if (!Utils::CreateFrameBuffer( RHI::SRHIResourceInfos("Downscaled Textures Frame Buffer"), + m_ApiManager, + TMemoryView(m_DownscaledTextures[i].m_RenderTarget), + m_FrameBuffers[i], + m_RenderPassDownScale)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CDownSampleTexture::Draw( const RHI::PCommandBuffer &cmdBuff, + const RHI::PConstantSet &hdrFrameSampler, + const SMulAddInfo &firstPass, + const SMulAddInfo &otherPasses) +{ + PK_NAMEDSCOPEDPROFILE("Down sample pass"); + for (u32 i = 0; i < m_DownscaledTextures.Count(); ++i) + { + cmdBuff->BeginRenderPass(m_RenderPassDownScale, m_FrameBuffers[i], TMemoryView()); + + // -------------- Blit render sub pass -------------- + cmdBuff->SetViewport(CInt2(0, 0), m_DownscaledTextures[i].m_Size, CFloat2(0, 1)); + cmdBuff->SetScissor(CInt2(0), m_DownscaledTextures[i].m_Size); + + // -------------- Copy -------------- + if (i == 0) + { + cmdBuff->BindRenderState(m_FirstCopyDownscale); + if (m_FirstCopyCombination == CopyCombination_MulAdd || m_FirstCopyCombination == CopyCombination_ToneMapping) + { + cmdBuff->PushConstant(&firstPass, 0); + } + } + else + { + cmdBuff->BindRenderState(m_CopyDownscale); + if (m_CopyCombination == CopyCombination_MulAdd || m_CopyCombination == CopyCombination_ToneMapping) + { + cmdBuff->PushConstant(&otherPasses, 0); + } + } + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + + if (i == 0) + cmdBuff->BindConstantSets(TMemoryView(hdrFrameSampler)); + else + cmdBuff->BindConstantSets(TMemoryView(m_DownscaledTextures[i - 1].m_SamplerConstantSet)); + + cmdBuff->Draw(0, 6); + + cmdBuff->EndRenderPass(); + cmdBuff->SyncPreviousRenderPass(RHI::OutputColorPipelineStage, RHI::FragmentPipelineStage); + } + return true; +} + +//---------------------------------------------------------------------------- + +TMemoryView CDownSampleTexture::GetSamplableRenderTargets() const +{ + return m_DownscaledTextures; +} + +//---------------------------------------------------------------------------- + +TMemoryView CDownSampleTexture::GetDownscaledSizes() const +{ + return m_DownscaledSizes; +} + +//---------------------------------------------------------------------------- + +bool CDownSampleTexture::CreateRenderStates( CShaderLoader &loader, + ECopyCombination firstCombination, + ECopyCombination otherCombination) +{ + m_FirstCopyCombination = firstCombination; + m_FirstCopyDownscale = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("First Copy Down Render state")); + m_CopyCombination = otherCombination; + m_CopyDownscale = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Copy Down Render state")); + + if (m_FirstCopyDownscale == null || m_CopyDownscale == null) + return false; + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = QUAD_VERTEX_SHADER; + shadersPaths.m_Fragment = COPY_FRAGMENT_SHADER; + + // Render pass bloom + RHI::SRenderState downScaleRenderState; + + downScaleRenderState.m_PipelineState.m_DynamicScissor = true; + downScaleRenderState.m_PipelineState.m_DynamicViewport = true; + if (!downScaleRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + downScaleRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + // First CopyDownScale + FillCopyShaderBindings(m_FirstCopyCombination, downScaleRenderState.m_ShaderBindings, m_ConstSetLayoutDownScale); + + if (loader.LoadShader(downScaleRenderState, shadersPaths, m_ApiManager) == false) + return false; + + m_FirstCopyDownscale->m_RenderState = downScaleRenderState; + + // CopyDownScale + FillCopyShaderBindings(m_CopyCombination, downScaleRenderState.m_ShaderBindings, m_ConstSetLayoutDownScale); + + if (loader.LoadShader(downScaleRenderState, shadersPaths, m_ApiManager) == false) + return false; + + m_CopyDownscale->m_RenderState = downScaleRenderState; + return BakeRenderStates(); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/DownSampleTexture.h b/Samples/PK-SampleLib/RenderPasses/DownSampleTexture.h new file mode 100644 index 00000000..c97193f3 --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/DownSampleTexture.h @@ -0,0 +1,84 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SMulAddInfo +{ + CFloat4 m_MulValue; + CFloat4 m_AddValue; + + SMulAddInfo() : m_MulValue(CFloat4::ZERO), m_AddValue(CFloat4::ZERO) {} + SMulAddInfo(const CFloat4 &mul, const CFloat4 &add) : m_MulValue(mul), m_AddValue(add) {} +}; + +//---------------------------------------------------------------------------- + +class CDownSampleTexture +{ +public: + CDownSampleTexture(); + ~CDownSampleTexture(); + + bool Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo); + + bool CreateRenderTargets(const RHI::PConstantSampler &sampler, + u32 maxDownsampleCount, + const CUint2 &textureSize, + RHI::EPixelFormat textureFormat, + const bool forcePowerOfTwoSizes = false); + + bool CreateRenderPass(); + bool CreateRenderStates( CShaderLoader &loader, + ECopyCombination firstCombination, + ECopyCombination otherCombination); + bool CreateFrameBuffers(); + + bool Draw( const RHI::PCommandBuffer &commandBuffer, + const RHI::PConstantSet &hdrFrameSampler, + const SMulAddInfo &firstPass = SMulAddInfo(), + const SMulAddInfo &otherPasses = SMulAddInfo()); + + TMemoryView GetSamplableRenderTargets() const; + TMemoryView GetDownscaledSizes() const; + +private: + bool BakeRenderStates(); + + RHI::PApiManager m_ApiManager; + + TArray m_DownscaledTextures; + TArray m_FrameBuffers; + TArray m_DownscaledSizes; + + RHI::PGpuBuffer m_FullScreenQuadVbo; + RHI::PRenderPass m_RenderPassDownScale; + RHI::SConstantSetLayout m_ConstSetLayoutDownScale; + + ECopyCombination m_CopyCombination; + RHI::PRenderState m_CopyDownscale; + + ECopyCombination m_FirstCopyCombination; + RHI::PRenderState m_FirstCopyDownscale; + + RHI::SRenderTargetDesc m_FrameBufferLayout; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/GBuffer.cpp b/Samples/PK-SampleLib/RenderPasses/GBuffer.cpp new file mode 100644 index 00000000..487e8f2c --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/GBuffer.cpp @@ -0,0 +1,567 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "GBuffer.h" + +#include +#include +#include +#include +#include + +#include +#include + +//---------------------------------------------------------------------------- + +#define GBUFFER_VERTEX_SHADER_PATH "./Shaders/SolidMesh.vert" +#define GBUFFER_FRAGMENT_SHADER_PATH "./Shaders/GBuffer.frag" +#define FULL_SCREEN_QUAD_VERTEX_SHADER_PATH "./Shaders/FullScreenQuad.vert" +#define DEFERRED_LIGHTS_FRAGMENT_SHADER_PATH "./Shaders/DeferredLights.frag" +#define MERGING_FRAGMENT_SHADER_PATH "./Shaders/DeferredMerging.frag" + +// light particle shaders: +#define LIGHT_INSTANCED_VERTEX_SHADER_PATH "./Shaders/LightInstanced.vert" +#define LIGHT_INSTANCED_FRAGMENT_SHADER_PATH "./Shaders/PointLightInstanced.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +const RHI::EPixelFormat CGBuffer::s_MergeBufferFormat = RHI::FormatFloat16RGBA; +const RHI::EPixelFormat CGBuffer::s_LightAccumBufferFormat = RHI::FormatFloat16RGBA; +const RHI::EPixelFormat CGBuffer::s_DepthBufferFormat = RHI::FormatUnorm24DepthUint8Stencil; +const RHI::EPixelFormat CGBuffer::s_NormalRoughMetalBufferFormat = RHI::FormatFloat16RGBA; + +CGBuffer::CGBuffer() +{ + // Set all RT indices to invalid: + m_MergeBufferIndex = CGuid::INVALID; + m_DepthBufferIndex = CGuid::INVALID; + m_LightAccumBufferIndex = CGuid::INVALID; + m_NormalRoughMetalBufferIndex = CGuid::INVALID; + m_MergeClearValue = RHI::SFrameBufferClearValue(0, 0, 0, 0); +} + +//---------------------------------------------------------------------------- + +CGBuffer::~CGBuffer() +{ +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::Init( const RHI::PApiManager &apiManager, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout, + const RHI::SConstantSetLayout &sceneInfoLayout) +{ + m_ApiManager = apiManager; + m_SamplerRT = samplerRT; + m_SamplerRTLayout = samplerRTLayout; + m_SceneInfoLayout = sceneInfoLayout; + + // ---------------------------- + // Create the vertex buffers: + // ---------------------------- + if (!Utils::CreateGpuBuffers(m_ApiManager, Utils::ScreenQuadHelper, m_QuadBuffers)) + return false; +// if (!CreateLightSphere(30)) +// return false; +// if (!CreateDecalCube()) +// return false; + + // ---------------------------- + // Create the constant set layouts: + // ---------------------------- + // Init the lighting constant layout + CreateLightingSceneInfoConstantLayout(m_LightInfoConstLayout, m_ShadowsInfoConstLayout, m_BRDFLUTLayout, m_EnvironmentMapLayout); + CreateDeferredSamplerLightingConstSetLayout(m_LightingSamplersConstLayout); + + // Init the GBuffer mesh rendering constant sets + for (u32 i = 0; i < static_cast(GBufferCombination_Count); ++i) + { + CreateGBufferConstSetLayouts(static_cast(i), m_GBufferMeshInfoConstLayout[i]); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::UpdateFrameBuffer(const TMemoryView &frameBuffers, + TArray &loadOP, + TArray &clearValues, + bool clearMergingBuffer, + const SInOutRenderTargets *inOut) +{ + // Create all render targets + const RHI::SGPUCaps &caps = m_ApiManager->GetApiContext()->m_GPUCaps; + CUint2 frameBufferSize = frameBuffers.First()->GetSize(); + RHI::EPixelFormat idealDepthFormat = RHI::PixelFormatFallbacks::FindClosestSupportedDepthStencilFormat(caps, s_DepthBufferFormat); + + // Set up framebuffer layouts + // N - Merge + // N+1 - Depth + // N+2 - distortion + // N+3 - post-distortion + // N+4 - light accu + // N+5 - normal rough metal + + // Create the render targets: + // Merge render target + if (inOut->m_OutputRtIdx.Valid()) + { + m_MergeBufferIndex = inOut->m_OutputRtIdx; + } + else + { + if (!PK_VERIFY(m_Merge.CreateRenderTarget(RHI::SRHIResourceInfos("Merge Render Target"), m_ApiManager, m_SamplerRT, s_MergeBufferFormat, frameBufferSize, m_SamplerRTLayout))) + return false; + } + // Depth + if (!PK_VERIFY(m_Depth.CreateRenderTarget(RHI::SRHIResourceInfos("Depth Render Target"), m_ApiManager, m_SamplerRT, idealDepthFormat, frameBufferSize, m_SamplerRTLayout))) + return false; + // Light accu + if (!PK_VERIFY(m_LightAccu.CreateRenderTarget(RHI::SRHIResourceInfos("LightAccu Render Target"), m_ApiManager, m_SamplerRT, s_LightAccumBufferFormat, frameBufferSize, m_SamplerRTLayout))) + return false; + // Normal rough metal + if (!PK_VERIFY(m_NormalRoughMetal.CreateRenderTarget(RHI::SRHIResourceInfos("NormalRoughMetal Render Target"), m_ApiManager, m_SamplerRT, s_NormalRoughMetalBufferFormat, frameBufferSize, m_SamplerRTLayout))) + return false; + + // Add the render targets to the frame buffer: + for (u32 i = 0; i < frameBuffers.Count(); ++i) + { + PK_ASSERT(frameBufferSize == frameBuffers[i]->GetSize()); + + if (!inOut->m_OutputRtIdx.Valid()) + { + // Merge render target + m_MergeBufferIndex = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_Merge.m_RenderTarget))) + return false; + } + // Depth + m_DepthBufferIndex = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_Depth.m_RenderTarget))) + return false; + // Light accu + m_LightAccumBufferIndex = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_LightAccu.m_RenderTarget))) + return false; + // Normal rough metal + m_NormalRoughMetalBufferIndex = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_NormalRoughMetal.m_RenderTarget))) + return false; + } + + // Add the load op and the clear values: + // Merge render target + if (!inOut->m_OutputRtIdx.Valid()) + { + if (clearMergingBuffer) + { + if (!PK_VERIFY(loadOP.PushBack(RHI::LoadClear).Valid() && + clearValues.PushBack(m_MergeClearValue).Valid())) + return false; + } + else + { + if (!PK_VERIFY(loadOP.PushBack(RHI::LoadKeepValue).Valid())) + return false; + } + } + // Depth + if (!PK_VERIFY( loadOP.PushBack(RHI::LoadClear).Valid() && + clearValues.PushBack(RHI::SFrameBufferClearValue(1.f, 0U)).Valid())) + return false; + // Light accu + if (!PK_VERIFY( loadOP.PushBack(RHI::LoadClear).Valid() && + clearValues.PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + // Normal rough metal + if (!PK_VERIFY( loadOP.PushBack(RHI::LoadClear).Valid() && + clearValues.PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + + bool result; + + PK_ASSERT(inOut->m_SamplableDepthRtIdx.Valid() && inOut->m_SamplableDepthRtIdx < frameBuffers.First()->GetRenderTargets().Count()); + PK_ASSERT(inOut->m_SamplableDiffuseRtIdx.Valid() && inOut->m_SamplableDiffuseRtIdx < frameBuffers.First()->GetRenderTargets().Count()); + PK_ASSERT(inOut->m_SamplableDiffuseRt != null && inOut->m_SamplableDepthRt != null); + PK_ASSERT(inOut->m_SamplableDiffuseRt->m_RenderTarget != null && inOut->m_SamplableDepthRt->m_RenderTarget != null); + PK_ASSERT(inOut->m_SamplableDiffuseRt->m_RenderTarget->GetTexture() != null && inOut->m_SamplableDepthRt->m_RenderTarget->GetTexture() != null); + + // ---------------------------- + // Lighting: + // ---------------------------- + // Create constants set IFN + if (m_LightingSamplersSet == null) + { + m_LightingSamplersSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Lighting Constant Set"), m_LightingSamplersConstLayout); + if (m_LightingSamplersSet == null) + return false; + } + + // Bind the new render targets: + result = m_LightingSamplersSet->SetConstants(m_SamplerRT, inOut->m_SamplableDepthRt->m_RenderTarget->GetTexture(), 0); + result &= m_LightingSamplersSet->SetConstants(m_SamplerRT, m_NormalRoughMetal.m_RenderTarget->GetTexture(), 1); + result &= m_LightingSamplersSet->SetConstants(m_SamplerRT, inOut->m_SamplableDiffuseRt->m_RenderTarget->GetTexture(), 2); + result &= m_LightingSamplersSet->UpdateConstantValues(); + + if (result == false) + return false; + + // ---------------------------- + // Merging: + // ---------------------------- + + // Init the Merging constant layout + CreateDeferredMergingConstSetLayouts(m_MergingSamplersConstLayout); + + // Create constants set IFN + if (m_MergingSamplersSet == null) + { + m_MergingSamplersSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Merging Constant Set"), m_MergingSamplersConstLayout); + if (m_MergingSamplersSet == null) + return false; + } + + // Bind the new render targets: + result = m_MergingSamplersSet->SetConstants(m_SamplerRT, m_LightAccu.m_RenderTarget->GetTexture(), 0); + for (u32 i = 0; i < inOut->m_OpaqueRTs.Count(); ++i) + { + PK_ASSERT(inOut->m_OpaqueRTs[i].m_RenderTarget != null); + PK_ASSERT(inOut->m_OpaqueRTs[i].m_RenderTarget->GetTexture() != null); + result &= m_MergingSamplersSet->SetConstants(m_SamplerRT, inOut->m_OpaqueRTs[i].m_RenderTarget->GetTexture(), i + 1); + } + result &= m_MergingSamplersSet->UpdateConstantValues(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::AddSubPasses( const RHI::PRenderPass &renderPass, + const SInOutRenderTargets *inOut) +{ + bool result = true; + + result &= AddGBufferSubPass(renderPass, inOut->m_OpaqueRTsIdx); + result &= AddDecalSubPass(renderPass, inOut->m_OpaqueRTsIdx, inOut->m_SamplableDepthRtIdx); + result &= AddLightingSubPass(renderPass, inOut->m_SamplableDepthRtIdx, inOut->m_SamplableDiffuseRtIdx); + result &= AddMergingSubPass(renderPass, inOut->m_OpaqueRTsIdx); + return result; +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::CreateRenderStates( const TMemoryView &frameBufferLayout, + CShaderLoader &shaderLoader, + const RHI::PRenderPass &renderPass) +{ + bool result = true; + + // ---------------------------- + // Create the render states: + // ---------------------------- + result &= CreateGBufferRenderStates(frameBufferLayout, shaderLoader, renderPass); + result &= CreateLightingRenderStates(frameBufferLayout, shaderLoader, renderPass); + result &= CreateParticleLightingRenderStates(frameBufferLayout, shaderLoader, renderPass); + result &= CreateMergingRenderStates(frameBufferLayout, shaderLoader, renderPass); + return result; +} + +//---------------------------------------------------------------------------- + +void CGBuffer::SetClearMergeBufferColor(const CFloat4 &clearColor) +{ + *((CFloat4*)m_MergeClearValue.m_ColorFloat) = clearColor; +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::CreateGBufferRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &shaderLoader, const RHI::PRenderPass &renderPass) +{ + // We create the render states in this order: + // ----------------------------------------- + // Material_Diffuse + // Material_Diffuse_Normal + // Material_Diffuse_Specular + // Material_Diffuse_Normal_Specular + + for (u32 i = 0; i < static_cast(GBufferCombination_Count); ++i) + { + RHI::PRenderState material = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("GBuffer Render State")); + if (material == null) + return false; + RHI::SRenderState &GBufferRenderState = material->m_RenderState; + // ------------------------------- + // GBUFFER - Bindings + // ------------------------------- + const bool hasVertexColor = false; + const bool hasTangent = i == GBufferCombination_Diffuse_RoughMetal_Normal; + FillGBufferShaderBindings(GBufferRenderState.m_ShaderBindings, m_SceneInfoLayout, m_GBufferMeshInfoConstLayout[i], hasVertexColor, hasTangent); + + GBufferRenderState.m_ShaderBindings.m_InputAttributes[0].m_BufferIdx = 0; + GBufferRenderState.m_ShaderBindings.m_InputAttributes[1].m_BufferIdx = 1; + GBufferRenderState.m_ShaderBindings.m_InputAttributes[2].m_BufferIdx = 2; + if (hasTangent) + { + GBufferRenderState.m_ShaderBindings.m_InputAttributes[3].m_BufferIdx = 3; + if (!GBufferRenderState.m_InputVertexBuffers.Resize(4)) + return false; + GBufferRenderState.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat3); // pos + GBufferRenderState.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat3); // normal + GBufferRenderState.m_InputVertexBuffers[2].m_Stride = sizeof(CFloat4); // tangent + GBufferRenderState.m_InputVertexBuffers[3].m_Stride = sizeof(CFloat2); // texcoords + } + else + { + if (!GBufferRenderState.m_InputVertexBuffers.Resize(3)) + return false; + GBufferRenderState.m_InputVertexBuffers[0].m_Stride = sizeof(CFloat3); // pos + GBufferRenderState.m_InputVertexBuffers[1].m_Stride = sizeof(CFloat3); // normal + GBufferRenderState.m_InputVertexBuffers[2].m_Stride = sizeof(CFloat2); // texcoords + } + + // ------------------------------- + // GBUFFER - Pipeline State + // ------------------------------- + GBufferRenderState.m_PipelineState.m_DynamicScissor = true; + GBufferRenderState.m_PipelineState.m_DynamicViewport = true; + GBufferRenderState.m_PipelineState.m_DepthWrite = true; + GBufferRenderState.m_PipelineState.m_DepthTest = RHI::Less; + GBufferRenderState.m_PipelineState.m_CullMode = RHI::CullBackFaces; + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = GBUFFER_VERTEX_SHADER_PATH; + shadersPaths.m_Fragment = GBUFFER_FRAGMENT_SHADER_PATH; + + if (!shaderLoader.LoadShader(GBufferRenderState, shadersPaths, m_ApiManager)) + return false; + if (!m_ApiManager->BakeRenderState(material, frameBufferLayout, renderPass, m_GBufferSubPassIdx)) + return false; + + m_GBufferMaterials[i] = material; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::CreateLightingRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &shaderLoader, const RHI::PRenderPass &renderPass) +{ + // ------------------------------- + // LIGHTING + // ------------------------------- + m_LightsRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Lighting Render State")); + + if (m_LightsRenderState == null) + return false; + + RHI::SRenderState &lightingRenderState = m_LightsRenderState->m_RenderState; + + lightingRenderState.m_PipelineState.m_DynamicScissor = true; + lightingRenderState.m_PipelineState.m_DynamicViewport = true; + + // Additive blending - one render pass for each light + lightingRenderState.m_PipelineState.m_Blending = true; + lightingRenderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + lightingRenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + lightingRenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + lightingRenderState.m_PipelineState.m_AlphaBlendingDst = RHI::BlendOne; + lightingRenderState.m_PipelineState.m_AlphaBlendingSrc = RHI::BlendOne; + lightingRenderState.m_PipelineState.m_CullMode = RHI::CullBackFaces; + + if (!lightingRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + lightingRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillDeferredLightShaderBindings(lightingRenderState.m_ShaderBindings, + m_SceneInfoLayout, + m_LightInfoConstLayout, + m_ShadowsInfoConstLayout, + m_BRDFLUTLayout, + m_EnvironmentMapLayout, + m_LightingSamplersConstLayout); + + CShaderLoader::SShadersPaths lightsShaderPath; + lightsShaderPath.m_Vertex = FULL_SCREEN_QUAD_VERTEX_SHADER_PATH; + lightsShaderPath.m_Fragment = DEFERRED_LIGHTS_FRAGMENT_SHADER_PATH; + + if (shaderLoader.LoadShader(m_LightsRenderState->m_RenderState, lightsShaderPath, m_ApiManager) == false) + return false; + if (!m_ApiManager->BakeRenderState(m_LightsRenderState, frameBufferLayout, renderPass, m_LightingSubPassIdx)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::CreateParticleLightingRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &shaderLoader, const RHI::PRenderPass &renderPass) +{ + // ------------------------------- + // LIGHTING + // ------------------------------- + m_ParticlePointLightRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Particle Point Light Render State")); + + if (m_ParticlePointLightRenderState == null) + return false; + + RHI::SRenderState &lightingRenderState = m_ParticlePointLightRenderState->m_RenderState; + + lightingRenderState.m_PipelineState.m_DynamicScissor = true; + lightingRenderState.m_PipelineState.m_DynamicViewport = true; + + // Additive blending - one render pass for each light + lightingRenderState.m_PipelineState.m_Blending = true; + lightingRenderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + lightingRenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + lightingRenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + lightingRenderState.m_PipelineState.m_AlphaBlendingDst = RHI::BlendOne; + lightingRenderState.m_PipelineState.m_AlphaBlendingSrc = RHI::BlendOne; + + // full screen quad: + if (!lightingRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + lightingRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat3); + + // light position: + if (!lightingRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + lightingRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat3); + lightingRenderState.m_InputVertexBuffers.Last().m_InputRate = RHI::PerInstanceInput; + // light radius: + if (!lightingRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + lightingRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(float); + lightingRenderState.m_InputVertexBuffers.Last().m_InputRate = RHI::PerInstanceInput; + // light color: + if (!lightingRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + lightingRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat3); + lightingRenderState.m_InputVertexBuffers.Last().m_InputRate = RHI::PerInstanceInput; + + FillParticleLightShaderBindings(lightingRenderState.m_ShaderBindings); + + CShaderLoader::SShadersPaths pointLightShadersPaths; + pointLightShadersPaths.m_Vertex = LIGHT_INSTANCED_VERTEX_SHADER_PATH; + pointLightShadersPaths.m_Fragment = LIGHT_INSTANCED_FRAGMENT_SHADER_PATH; + + if (shaderLoader.LoadShader(m_ParticlePointLightRenderState->m_RenderState, pointLightShadersPaths, m_ApiManager) == false) + return false; + if (!m_ApiManager->BakeRenderState(m_ParticlePointLightRenderState, frameBufferLayout, renderPass, m_LightingSubPassIdx)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::CreateMergingRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &shaderLoader, const RHI::PRenderPass &renderPass) +{ + // ------------------------------- + // MERGING + // ------------------------------- + m_MergingRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Merging Render State")); + if (m_MergingRenderState == null) + return false; + RHI::SRenderState &mergingRenderState = m_MergingRenderState->m_RenderState; + + mergingRenderState.m_PipelineState.m_DynamicScissor = true; + mergingRenderState.m_PipelineState.m_DynamicViewport = true; + + mergingRenderState.m_PipelineState.m_DepthTest = RHI::Greater; + + if (!mergingRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + mergingRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillDeferredMergingShaderBindings(mergingRenderState.m_ShaderBindings, m_MergingSamplersConstLayout); + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = FULL_SCREEN_QUAD_VERTEX_SHADER_PATH; + shadersPaths.m_Fragment = MERGING_FRAGMENT_SHADER_PATH; + + if (shaderLoader.LoadShader(mergingRenderState, shadersPaths, m_ApiManager) == false) + return false; + return m_ApiManager->BakeRenderState(m_MergingRenderState, frameBufferLayout, renderPass, m_MergingSubPassIdx); +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::AddGBufferSubPass(const RHI::PRenderPass &beforePostFX, const TMemoryView &outputRTs) +{ + RHI::SSubPassDefinition subPass; + + subPass.m_DepthStencilRenderTarget = m_DepthBufferIndex; + for (u32 i = 0; i < outputRTs.Count(); ++i) + { + subPass.m_OutputRenderTargets.PushBack(outputRTs[i]); + } + subPass.m_OutputRenderTargets.PushBack(m_NormalRoughMetalBufferIndex); + m_GBufferSubPassIdx = beforePostFX->GetSubPassDefinitions().Count(); + return beforePostFX->AddRenderSubPass(subPass); +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::AddDecalSubPass(const RHI::PRenderPass &beforePostFX, const TMemoryView &outputRTs, CGuid samplableDepthBufferIdx) +{ + RHI::SSubPassDefinition subPass; + + subPass.m_InputRenderTargets.PushBack(samplableDepthBufferIdx); + subPass.m_DepthStencilRenderTarget = m_DepthBufferIndex; + for (u32 i = 0; i < outputRTs.Count(); ++i) + { + if (outputRTs[i] != samplableDepthBufferIdx) + subPass.m_OutputRenderTargets.PushBack(outputRTs[i]); + } + subPass.m_OutputRenderTargets.PushBack(m_NormalRoughMetalBufferIndex); + m_DecalSubPassIdx = beforePostFX->GetSubPassDefinitions().Count(); + return beforePostFX->AddRenderSubPass(subPass); +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::AddLightingSubPass(const RHI::PRenderPass &beforePostFX, CGuid samplableDepthBufferIdx, CGuid samplableDiffuseBufferIdx) +{ + RHI::SSubPassDefinition subPass; + + subPass.m_OutputRenderTargets.PushBack(m_LightAccumBufferIndex); + + subPass.m_InputRenderTargets.PushBack(m_NormalRoughMetalBufferIndex); + subPass.m_InputRenderTargets.PushBack(samplableDepthBufferIdx); + subPass.m_InputRenderTargets.PushBack(samplableDiffuseBufferIdx); + + subPass.m_DepthStencilRenderTarget = m_DepthBufferIndex; + + m_LightingSubPassIdx = beforePostFX->GetSubPassDefinitions().Count(); + return beforePostFX->AddRenderSubPass(subPass); +} + +//---------------------------------------------------------------------------- + +bool CGBuffer::AddMergingSubPass(const RHI::PRenderPass &beforePostFX, const TMemoryView &mergingToSampleRT) +{ + RHI::SSubPassDefinition subPass; + + subPass.m_DepthStencilRenderTarget = m_DepthBufferIndex; + subPass.m_OutputRenderTargets.PushBack(m_MergeBufferIndex); + subPass.m_InputRenderTargets.PushBack(m_LightAccumBufferIndex); + for (u32 i = 0; i < mergingToSampleRT.Count(); ++i) + { + subPass.m_InputRenderTargets.PushBack(mergingToSampleRT[i]); + } + m_MergingSubPassIdx = beforePostFX->GetSubPassDefinitions().Count(); + return beforePostFX->AddRenderSubPass(subPass); +} + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/GBuffer.h b/Samples/PK-SampleLib/RenderPasses/GBuffer.h new file mode 100644 index 00000000..dad2682c --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/GBuffer.h @@ -0,0 +1,161 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +#include + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CGBuffer +{ +public: + struct SInOutRenderTargets + { + // ------------------------------------ + // Render targets needed in the frame buffer before calling the UpdateFrameBuffer method + // ------------------------------------ + // Render targets sampled for the lighting render-pass: + CGuid m_SamplableDepthRtIdx; + const SSamplableRenderTarget *m_SamplableDepthRt; + + CGuid m_SamplableDiffuseRtIdx; + const SSamplableRenderTarget *m_SamplableDiffuseRt; + + CGuid m_SamplableShadowRtIdx; + const SSamplableRenderTarget *m_SamplableShadowRt; + + // All the RT to sample for the merging render-pass (that will also be the output of the opaque render-pass) + TMemoryView m_OpaqueRTsIdx; + TMemoryView m_OpaqueRTs; + + // ------------------------------------ + // Merge output buffer, if m_OutputRtIdx == CGuid::INVALID then the output buffer is created + // otherwise the merge output is done in this frame buffer RT + // ------------------------------------ + CGuid m_OutputRtIdx; + + SInOutRenderTargets() + : m_SamplableDepthRt(null) + , m_SamplableDiffuseRt(null) + { + } + }; + + CGBuffer(); + ~CGBuffer(); + + // samplableDepthBuffIdx is the idx depth buffer that we can sample while having the real depth buffer bound: + // If we could avoid that and have just one depth buffer it would be a lot better + bool Init( const RHI::PApiManager &apiManager, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout, + const RHI::SConstantSetLayout &sceneInfoLayout); + + bool UpdateFrameBuffer( const TMemoryView &frameBuffers, + TArray &loadOP, + TArray &clearValues, + bool clearMergingBuffer, + const SInOutRenderTargets *inOut); + + bool AddSubPasses(const RHI::PRenderPass &renderPass, const SInOutRenderTargets *inOut); + + bool CreateRenderStates( const TMemoryView &frameBufferLayout, + CShaderLoader &shaderLoader, + const RHI::PRenderPass &renderPass); + + void SetClearMergeBufferColor(const CFloat4 &clearColor); + +private: + bool CreateLightSphere(u32 subdivs); + bool CreateDecalCube(); + bool CreateGBufferRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &shaderLoader, const RHI::PRenderPass &renderPass); + bool CreateLightingRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &shaderLoader, const RHI::PRenderPass &renderPass); + bool CreateParticleLightingRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &shaderLoader, const RHI::PRenderPass &renderPass); + bool CreateMergingRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &shaderLoader, const RHI::PRenderPass &renderPass); + + bool AddGBufferSubPass(const RHI::PRenderPass &beforePostFX, const TMemoryView &outputRTs); + bool AddDecalSubPass(const RHI::PRenderPass &beforePostFX, const TMemoryView &outputRTs, CGuid samplableDepthBufferIdx); + bool AddLightingSubPass(const RHI::PRenderPass &beforePostFX, CGuid samplableDepthBufferIdx, CGuid samplableDiffuseBufferIdx); + bool AddMergingSubPass(const RHI::PRenderPass &beforePostFX, const TMemoryView &mergingToSampleRT); + + RHI::PApiManager m_ApiManager; + +public: + static const RHI::EPixelFormat s_MergeBufferFormat; + static const RHI::EPixelFormat s_LightAccumBufferFormat; + static const RHI::EPixelFormat s_DepthBufferFormat; + static const RHI::EPixelFormat s_NormalRoughMetalBufferFormat; + // ----------------------------------------------- + // Render targets indices: + // ----------------------------------------------- + // Always present in the deferred pass: + CGuid m_MergeBufferIndex; + SSamplableRenderTarget m_Merge; + CGuid m_DepthBufferIndex; + SSamplableRenderTarget m_Depth; + CGuid m_LightAccumBufferIndex; + SSamplableRenderTarget m_LightAccu; + CGuid m_NormalRoughMetalBufferIndex; + SSamplableRenderTarget m_NormalRoughMetal; + // ----------------------------------------------- + + // ----------------------------------------------- + // Subpasses idx: + // ----------------------------------------------- + CGuid m_GBufferSubPassIdx; + CGuid m_DecalSubPassIdx; + CGuid m_LightingSubPassIdx; + CGuid m_MergingSubPassIdx; + // ----------------------------------------------- + + u32 m_InitializedRP; + + // Full screen quad buffer + Utils::GpuBufferViews m_QuadBuffers; + + RHI::PConstantSampler m_SamplerRT; + RHI::SConstantSetLayout m_SamplerRTLayout; + + RHI::SConstantSetLayout m_SceneInfoLayout; + + // ----------------------------------------------- + // IF InitRP_GBuffer: + // ----------------------------------------------- + // - In the sub-pass "G-Buffer" : + RHI::SConstantSetLayout m_GBufferMeshInfoConstLayout[GBufferCombination_Count]; // Diffuse - Diffuse, Normal - Diffuse, Spec - Diffuse, Normal, Spec + RHI::PRenderState m_GBufferMaterials[GBufferCombination_Count]; + // - In the sub-pass "Lighting" : + RHI::SConstantSetLayout m_LightingSamplersConstLayout; + RHI::PConstantSet m_LightingSamplersSet; + RHI::SConstantSetLayout m_LightInfoConstLayout; + RHI::SConstantSetLayout m_ShadowsInfoConstLayout; + RHI::PRenderState m_LightsRenderState; + RHI::SConstantSetLayout m_EnvironmentMapLayout; + RHI::SConstantSetLayout m_BRDFLUTLayout; + // - Particle specific shaders (this should replace the previous lighting shaders): + RHI::PRenderState m_ParticlePointLightRenderState; + // - In the sub-pass "Merging" + RHI::SConstantSetLayout m_MergingSamplersConstLayout; + RHI::PConstantSet m_MergingSamplersSet; + RHI::PRenderState m_MergingRenderState; + + RHI::SFrameBufferClearValue m_MergeClearValue; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxBloom.cpp b/Samples/PK-SampleLib/RenderPasses/PostFxBloom.cpp new file mode 100644 index 00000000..b4cceafa --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxBloom.cpp @@ -0,0 +1,383 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PostFxBloom.h" + +#include +#include + +#include + +#define QUAD_VERTEX_SHADER "./Shaders/FullScreenQuad.vert" + +#define BLUR_FRAGMENT_SHADER "./Shaders/GaussianBlur.frag" +#define COPY_FRAGMENT_SHADER "./Shaders/Copy.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CPostFxBloom::CPostFxBloom() +: m_RenderPassBloom(null) +, m_SubtractValue(-1) +, m_Intensity(1) +, m_Attenuation(0.5) +{ +} + +//---------------------------------------------------------------------------- + +CPostFxBloom::~CPostFxBloom() +{ +} + +//---------------------------------------------------------------------------- + +bool CPostFxBloom::Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo) +{ + m_FullScreenQuadVbo = fullScreenQuadVbo; + m_ApiManager = apiManager; + CreateSimpleSamplerConstSetLayouts(m_CopyBlurConstSetLayout, false); + return m_DownSampler.Init(apiManager, fullScreenQuadVbo); +} + +//---------------------------------------------------------------------------- + +bool CPostFxBloom::UpdateFrameBuffer( const RHI::PConstantSampler &sampler, + u32 maxDownSampleBloom, + const SInOutRenderTargets *inOut) +{ + PK_ASSERT(!inOut->m_OutputRenderTargets.Empty()); + CUint2 rtSize = inOut->m_OutputRenderTargets.First()->GetSize(); + + if (!m_DownSampler.CreateRenderTargets(sampler, maxDownSampleBloom, rtSize, RHI::FormatFloat16RGBA, true)) + return false; + m_DownSampledBrightPassRTs = m_DownSampler.GetSamplableRenderTargets(); + const u32 bloomRenderPassCount = m_DownSampledBrightPassRTs.Count(); + + // Create the samplable render targets + if (m_TmpBlurRTs.Resize(bloomRenderPassCount) == false) + return false; + for (u32 i = 0; i < bloomRenderPassCount; ++i) + { + if (m_TmpBlurRTs[i].CreateRenderTarget(RHI::SRHIResourceInfos("Bloom Pass Render Target"), m_ApiManager, sampler, RHI::FormatFloat16RGBA, m_DownSampledBrightPassRTs[i].m_Size, m_CopyBlurConstSetLayout) == false) + return false; + } + + // Fed by user: + m_SwapChainRTs = inOut->m_OutputRenderTargets; + m_InputRenderTarget = *inOut->m_InputRenderTarget; + + // Layout: + m_FrameBufferBloomLayout[0] = m_TmpBlurRTs.First().m_RenderTarget->GetRenderTargetLayout(); + m_FrameBufferBloomLayout[1] = m_DownSampledBrightPassRTs.First().m_RenderTarget->GetRenderTargetLayout(); + m_FrameBufferMergeLayout[0] = m_SwapChainRTs.First()->GetRenderTargetLayout(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxBloom::CreateRenderPass() +{ + // Allocations + m_RenderPassBloom = m_ApiManager->CreateRenderPass(RHI::SRHIResourceInfos("Bloom Render Pass")); + m_RenderPassMerge = m_ApiManager->CreateRenderPass(RHI::SRHIResourceInfos("Merge Render Pass")); + if (m_RenderPassBloom == null || m_RenderPassMerge == null) + return false; + + bool result = true; + + // -------------------------------------------------------------------------------------------- + // Render Targets Definitions: + // -------------------------------------------------------------------------------------------- + // Definition + // Original RT: [RT] + // Downscaled RTs: [RT / 2] [RT / 4] [RT / 8] + // -------------------------------------------------------------------------------------------- + // Bloom RTs: [m_TmpBlurRT / 2] [m_TmpBlurRT / 4] [m_TmpBlurRT / 8] + // -------------------------------------------------------------------------------------------- + + RHI::SSubPassDefinition blitPreviousPass; + RHI::SSubPassDefinition bloomVerticalBlurSubPass; + RHI::SSubPassDefinition bloomHorizontalBlurSubPass; + + result &= blitPreviousPass.m_OutputRenderTargets.PushBack(0).Valid(); + + result &= bloomHorizontalBlurSubPass.m_InputRenderTargets.PushBack(0).Valid(); + result &= bloomHorizontalBlurSubPass.m_OutputRenderTargets.PushBack(1).Valid(); + + result &= bloomVerticalBlurSubPass.m_InputRenderTargets.PushBack(1).Valid(); + result &= bloomVerticalBlurSubPass.m_OutputRenderTargets.PushBack(0).Valid(); + + result &= m_RenderPassBloom->AddRenderSubPass(blitPreviousPass); + result &= m_RenderPassBloom->AddRenderSubPass(bloomHorizontalBlurSubPass); + result &= m_RenderPassBloom->AddRenderSubPass(bloomVerticalBlurSubPass); + + // -------------------------------------------------------------------------------------------- + // Final Merge Render Pass: + // -------------------------------------------------------------------------------------------- + // Frame buffer = [RT] + // -------------------------------------------------------------------------------------------- + // 1 - [RT / 2] -> Copy -> [RT] + // -------------------------------------------------------------------------------------------- + + RHI::SSubPassDefinition finalBlit; + + result &= finalBlit.m_OutputRenderTargets.PushBack(0).Valid(); + result &= m_RenderPassMerge->AddRenderSubPass(finalBlit); + + // Baking + const RHI::ELoadRTOperation loadRt[] = { RHI::LoadDontCare, RHI::LoadDontCare }; + const RHI::ELoadRTOperation keepRt[] = { RHI::LoadKeepValue }; + + result &= m_RenderPassBloom->BakeRenderPass(m_FrameBufferBloomLayout, loadRt); + result &= m_RenderPassMerge->BakeRenderPass(m_FrameBufferMergeLayout, keepRt); + + return result && m_DownSampler.CreateRenderPass(); +} + +//---------------------------------------------------------------------------- + +bool CPostFxBloom::BakeRenderStates() +{ + bool success = true; + + // Bloom: + success &= m_ApiManager->BakeRenderState(m_AdditiveBlitRS, m_FrameBufferBloomLayout, m_RenderPassBloom, 0); + success &= m_ApiManager->BakeRenderState(m_HorizontalBlurRS, m_FrameBufferBloomLayout, m_RenderPassBloom, 1); + success &= m_ApiManager->BakeRenderState(m_VerticalBlurRS, m_FrameBufferBloomLayout, m_RenderPassBloom, 2); + // Final merge: + success &= m_ApiManager->BakeRenderState(m_FinalAdditiveBlitRS, m_FrameBufferMergeLayout, m_RenderPassMerge, 0); + success &= m_ApiManager->BakeRenderState(m_FinalBlitRS, m_FrameBufferMergeLayout, m_RenderPassMerge, 0); + return success; +} + +//---------------------------------------------------------------------------- + +bool CPostFxBloom::CreateFrameBuffers() +{ + // Create the frame buffers for the blur + if (m_FrameBuffersBloom.Resize(m_TmpBlurRTs.Count()) == false) + return false; + for (u32 i = 0; i < m_TmpBlurRTs.Count(); ++i) + { + RHI::PRenderTarget renderTargets[] = + { + m_DownSampledBrightPassRTs[i].m_RenderTarget, + m_TmpBlurRTs[i].m_RenderTarget, + }; + if (!Utils::CreateFrameBuffer(RHI::SRHIResourceInfos("Bloom Frame Buffer"), m_ApiManager, TMemoryView(renderTargets), m_FrameBuffersBloom[i], m_RenderPassBloom)) + return false; + } + + // Create the frame buffers for the merging + if (m_FrameBuffersMerge.Resize(m_SwapChainRTs.Count()) == false) + return false; + for (u32 i = 0; i < m_SwapChainRTs.Count(); ++i) + { + if (!Utils::CreateFrameBuffer(RHI::SRHIResourceInfos("SwapChain Frame Buffer"), m_ApiManager, TMemoryView(m_SwapChainRTs[i]), m_FrameBuffersMerge[i], m_RenderPassMerge)) + return false; + } + return m_DownSampler.CreateFrameBuffers(); +} + +//---------------------------------------------------------------------------- + +void CPostFxBloom::SetSubtractValue(float subtractValue) +{ + m_SubtractValue = CFloat4(-subtractValue); +} + +//---------------------------------------------------------------------------- + +void CPostFxBloom::SetIntensity(float intensity) +{ + m_Intensity = CFloat4(intensity); +} + +//---------------------------------------------------------------------------- + +void CPostFxBloom::SetAttenuation(float attenuation) +{ + m_Attenuation = CFloat4(attenuation); +} + +//---------------------------------------------------------------------------- + +bool CPostFxBloom::Draw(const RHI::PCommandBuffer &cmdBuff, u32 swapChainIdx) +{ + PK_NAMEDSCOPEDPROFILE("Bloom pass"); + SMulAddInfo firstPass(m_Intensity, m_SubtractValue); + SMulAddInfo otherPass(m_Attenuation, CFloat4::ZERO); + + if (!m_DownSampler.Draw(cmdBuff, m_InputRenderTarget.m_SamplerConstantSet, firstPass, otherPass)) + return false; + for (u32 i = 0; i < m_FrameBuffersBloom.Count(); ++i) + { + const u32 currentRT = m_FrameBuffersBloom.Count() - i - 1; + const CFloat2 currentRTSize = m_DownSampledBrightPassRTs[currentRT].m_Size; + const CInt2 currentRTSize_ScreenRatio = m_DownSampler.GetDownscaledSizes()[currentRT]; + + cmdBuff->BeginRenderPass(m_RenderPassBloom, m_FrameBuffersBloom[currentRT], TMemoryView()); + + cmdBuff->SetViewport(CInt2(0, 0), currentRTSize, CFloat2(0, 1)); + cmdBuff->SetScissor(CInt2(0), currentRTSize); + + if (i != 0) + { + // -------------- Additive copy of the prev pass -------------- + PK_NAMEDSCOPEDPROFILE("Additive copy of the prev pass"); + cmdBuff->BindRenderState(m_AdditiveBlitRS); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + + cmdBuff->BindConstantSets(TMemoryView(m_DownSampledBrightPassRTs[currentRT + 1].m_SamplerConstantSet)); + + cmdBuff->Draw(0, 6); + } + + cmdBuff->NextRenderSubPass(); + + SBlurInfo blurInfo(currentRTSize_ScreenRatio, CFloat2(1.0f, 0.0f)); + + { + // -------------- Horizontal blur sub pass -------------- + PK_NAMEDSCOPEDPROFILE("Horizontal blur sub pass"); + cmdBuff->BindRenderState(m_HorizontalBlurRS); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + cmdBuff->BindConstantSets(TMemoryView(m_DownSampledBrightPassRTs[currentRT].m_SamplerConstantSet)); + + cmdBuff->PushConstant(&blurInfo, 0); + + cmdBuff->Draw(0, 6); + + cmdBuff->NextRenderSubPass(); + } + + { + // -------------- Vertical blur sub pass -------------- + PK_NAMEDSCOPEDPROFILE("Vertical blur sub pass"); + cmdBuff->BindRenderState(m_VerticalBlurRS); + cmdBuff->BindConstantSets(TMemoryView(m_TmpBlurRTs[currentRT].m_SamplerConstantSet)); + + blurInfo.m_Direction = CFloat2(0.0f, 1.0f); + cmdBuff->PushConstant(&blurInfo, 0); + + cmdBuff->Draw(0, 6); + + cmdBuff->EndRenderPass(); + cmdBuff->SyncPreviousRenderPass(RHI::OutputColorPipelineStage, RHI::FragmentPipelineStage); + } + } + + // Just in case the index of swap chain overflows + swapChainIdx = swapChainIdx % m_FrameBuffersMerge.Count(); + + // When the input render target is not the same as the output render target, + // we need an additional copy to make the bloom work correctly: + const bool inputAndOutputDiffer = m_SwapChainRTs.Count() > 1 || m_SwapChainRTs.First() != m_InputRenderTarget.m_RenderTarget; + + // -------------- Additive blit to final buffer -------------- + { + PK_NAMEDSCOPEDPROFILE("Additive blit to final buffer"); + cmdBuff->BeginRenderPass(m_RenderPassMerge, m_FrameBuffersMerge[swapChainIdx], TMemoryView()); + + const CUint2 contextSize = m_SwapChainRTs.First()->GetSize(); + + if (inputAndOutputDiffer) + { + cmdBuff->BindRenderState(m_FinalBlitRS); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + cmdBuff->SetViewport(CInt2(0, 0), contextSize, CFloat2(0, 1)); + cmdBuff->SetScissor(CInt2(0), contextSize); + cmdBuff->BindConstantSets(TMemoryView(m_InputRenderTarget.m_SamplerConstantSet)); + cmdBuff->Draw(0, 6); + } + + cmdBuff->BindRenderState(m_FinalAdditiveBlitRS); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + cmdBuff->SetViewport(CInt2(0, 0), contextSize, CFloat2(0, 1)); + cmdBuff->SetScissor(CInt2(0), contextSize); + cmdBuff->BindConstantSets(TMemoryView(m_DownSampledBrightPassRTs[0].m_SamplerConstantSet)); + cmdBuff->Draw(0, 6); + + cmdBuff->EndRenderPass(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxBloom::CreateRenderStates(CShaderLoader &loader, EGaussianBlurCombination blurTap) +{ + m_HorizontalBlurRS = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Bloom HBlur Render State")); + m_VerticalBlurRS = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Bloom VBlur Render State")); + m_AdditiveBlitRS = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Bloom AdditiveBlit Render State")); + m_FinalAdditiveBlitRS = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Bloom FinalAdditiveBlit Render State")); + m_FinalBlitRS = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Bloom FinalBlit Render State")); + + if (m_HorizontalBlurRS == null || m_VerticalBlurRS == null || + m_AdditiveBlitRS == null || m_FinalAdditiveBlitRS == null || m_FinalBlitRS == null) + return false; + + // Render pass bloom + RHI::SRenderState opaqueRenderState; + opaqueRenderState.m_PipelineState.m_DynamicScissor = true; + opaqueRenderState.m_PipelineState.m_DynamicViewport = true; + if (!opaqueRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + opaqueRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + CShaderLoader::SShadersPaths shadersPathsBloom; + shadersPathsBloom.m_Vertex = QUAD_VERTEX_SHADER; + shadersPathsBloom.m_Fragment = BLUR_FRAGMENT_SHADER; + + // Horizontal & VerticalBlur (two passes) + FillGaussianBlurShaderBindings( blurTap, + opaqueRenderState.m_ShaderBindings, + m_CopyBlurConstSetLayout); + + if (loader.LoadShader(opaqueRenderState, shadersPathsBloom, m_ApiManager) == false) + return false; + m_HorizontalBlurRS->m_RenderState = opaqueRenderState; + m_VerticalBlurRS->m_RenderState = opaqueRenderState; + + // Additive blit + RHI::SRenderState additiveRenderState; + additiveRenderState.m_PipelineState.m_DynamicScissor = true; + additiveRenderState.m_PipelineState.m_DynamicViewport = true; + if (!additiveRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + additiveRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + additiveRenderState.m_PipelineState.m_Blending = true; + additiveRenderState.m_PipelineState.m_ColorBlendingEquation = RHI::BlendAdd; + additiveRenderState.m_PipelineState.m_ColorBlendingDst = RHI::BlendOne; + additiveRenderState.m_PipelineState.m_ColorBlendingSrc = RHI::BlendOne; + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = QUAD_VERTEX_SHADER; + shadersPaths.m_Fragment = COPY_FRAGMENT_SHADER; + + FillCopyShaderBindings(CopyCombination_Basic, additiveRenderState.m_ShaderBindings, m_CopyBlurConstSetLayout); + FillCopyShaderBindings(CopyCombination_Basic, opaqueRenderState.m_ShaderBindings, m_CopyBlurConstSetLayout); + if (loader.LoadShader(additiveRenderState, shadersPaths, m_ApiManager) == false) + return false; + if (loader.LoadShader(opaqueRenderState, shadersPaths, m_ApiManager) == false) + return false; + // Those two render states are exactly the same but not used int the same render pass: + m_AdditiveBlitRS->m_RenderState = additiveRenderState; + m_FinalBlitRS->m_RenderState = opaqueRenderState; + m_FinalAdditiveBlitRS->m_RenderState = additiveRenderState; + return BakeRenderStates() && m_DownSampler.CreateRenderStates(loader, CopyCombination_MulAdd, CopyCombination_MulAdd); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxBloom.h b/Samples/PK-SampleLib/RenderPasses/PostFxBloom.h new file mode 100644 index 00000000..11f7eff8 --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxBloom.h @@ -0,0 +1,102 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include +#include + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CPostFxBloom +{ +public: + struct SInOutRenderTargets + { + const SSamplableRenderTarget *m_InputRenderTarget; + TMemoryView m_OutputRenderTargets; + }; + + CPostFxBloom(); + ~CPostFxBloom(); + + bool Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo); + + bool UpdateFrameBuffer( const RHI::PConstantSampler &sampler, + u32 maxDownSampleBloom, + const SInOutRenderTargets *inOut); + + bool CreateRenderPass(); + bool CreateRenderStates(CShaderLoader &loader, EGaussianBlurCombination blurTap); + bool CreateFrameBuffers(); + + void SetSubtractValue(float subtractValue); + void SetIntensity(float intensity); + void SetAttenuation(float attenuation); + + u32 DownsampleCount() const { return m_DownSampledBrightPassRTs.Count(); } + + bool Draw(const RHI::PCommandBuffer &commandBuffer, u32 swapChainIdx); + +private: + bool BakeRenderStates(); + + RHI::PApiManager m_ApiManager; + + struct SBlurRenderTargets + { + SSamplableRenderTarget m_TmpBlurRT; + SSamplableRenderTarget m_FinalBlurRT; + }; + + RHI::SConstantSetLayout m_CopyBlurConstSetLayout; + + RHI::PGpuBuffer m_FullScreenQuadVbo; + + // Render targets: + TArray m_TmpBlurRTs; // Tmp RTs for the blur + TMemoryView m_DownSampledBrightPassRTs; // Down sampled RTs after the bright pass + // Fed by user: + TMemoryView m_SwapChainRTs; // Out RT + SSamplableRenderTarget m_InputRenderTarget; + + CDownSampleTexture m_DownSampler; + + // Frame buffers + TArray m_FrameBuffersBloom; + TArray m_FrameBuffersMerge; + // FrameBuffer Layouts + RHI::SRenderTargetDesc m_FrameBufferBloomLayout[2]; + RHI::SRenderTargetDesc m_FrameBufferMergeLayout[1]; + + RHI::PRenderPass m_RenderPassBloom; + RHI::PRenderPass m_RenderPassMerge; + + // Bloom render pass: + RHI::PRenderState m_AdditiveBlitRS; + RHI::PRenderState m_HorizontalBlurRS; + RHI::PRenderState m_VerticalBlurRS; + // Merge render pass: + RHI::PRenderState m_FinalBlitRS; + RHI::PRenderState m_FinalAdditiveBlitRS; + + CFloat4 m_SubtractValue; + CFloat4 m_Intensity; + CFloat4 m_Attenuation; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxColorRemap.cpp b/Samples/PK-SampleLib/RenderPasses/PostFxColorRemap.cpp new file mode 100644 index 00000000..ebc4f3bd --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxColorRemap.cpp @@ -0,0 +1,231 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PostFxColorRemap.h" + +#include +#include + +#include + +#define QUAD_VERTEX_SHADER "./Shaders/FullScreenQuad.vert" + +#define COLOR_REMAP_FRAGMENT_SHADER "./Shaders/ColorRemap.frag" +#define COPY_FRAGMENT_SHADER "./Shaders/Copy.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CPostFxColorRemap::CPostFxColorRemap() +: m_HasTexture(false) +{ +} + +CPostFxColorRemap::~CPostFxColorRemap() +{ +} + +//---------------------------------------------------------------------------- + +bool CPostFxColorRemap::Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout) +{ + m_FullScreenQuadVbo = fullScreenQuadVbo; + m_ApiManager = apiManager; + m_SamplerRT = samplerRT; + m_SamplerRTLayout = samplerRTLayout; + + m_ColorLUTSetLayout.Reset(); + m_ColorLUTSetLayout.m_ShaderStagesMask = RHI::FragmentShaderMask; + + m_RemapTextureSampler = apiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Color Remap Texture Sampler"), + RHI::EFilteringMode::SampleNearest, // Interpolation done in the shader + RHI::EFilteringMode::SampleNearest, + RHI::EWrapMode::SampleClampToEdge, + RHI::EWrapMode::SampleClampToEdge, + RHI::EWrapMode::SampleClampToEdge, + 1, + false); + + // FullScreen sampler: + RHI::SConstantSamplerDesc fullscreenSamplerLayout("Texture", RHI::SamplerTypeSingle); + m_ColorLUTSetLayout.AddConstantsLayout(fullscreenSamplerLayout); + + // Color LUT sampler : + RHI::SConstantSamplerDesc distortionSamplerLayout("LookUp", RHI::SamplerTypeSingle); + m_ColorLUTSetLayout.AddConstantsLayout(distortionSamplerLayout); + + m_ColorLUTSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("Color Remap Constant Set"), m_ColorLUTSetLayout); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxColorRemap::UpdateFrameBuffer( TMemoryView frameBuffers, + TArray &loadOP, + const SInOutRenderTargets *inOut) +{ + const CUint2 frameBuffersSize = frameBuffers.First()->GetSize(); + + if (!inOut->m_OutputRenderTargetIdx.Valid()) + { + if (!PK_VERIFY(m_OutputRenderTarget.CreateRenderTarget(RHI::SRHIResourceInfos("Color Remap Output Render Target"), m_ApiManager, m_SamplerRT, RHI::FormatFloat16RGBA, frameBuffersSize, m_SamplerRTLayout))) + return false; + + if (!PK_VERIFY(loadOP.PushBack(RHI::LoadDontCare).Valid())) + return false; + + for (u32 i = 0; i < frameBuffers.Count(); ++i) + { + PK_ASSERT(frameBuffersSize == frameBuffers[i]->GetSize()); + + m_OutputRenderTargetIdx = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_OutputRenderTarget.m_RenderTarget))) + return false; + } + } + + m_InputRenderTarget = *inOut->m_InputRenderTarget; + + m_ColorLUTSet->SetConstants(m_SamplerRT, m_InputRenderTarget.m_RenderTarget->GetTexture(), 0); + + if (m_InputRenderTarget.m_RenderTarget != null && m_RemapTexture != null) + m_ColorLUTSet->UpdateConstantValues(); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxColorRemap::AddSubPasses(const RHI::PRenderPass &renderPass, const SInOutRenderTargets *inOut) +{ + bool success = true; + RHI::SSubPassDefinition colorRemapSubPass; + + m_SubPassIdx = renderPass->GetSubPassDefinitions().Count(); + + if (inOut->m_OutputRenderTargetIdx.Valid()) + success &= colorRemapSubPass.m_OutputRenderTargets.PushBack(inOut->m_OutputRenderTargetIdx).Valid(); + else + success &= colorRemapSubPass.m_OutputRenderTargets.PushBack(m_OutputRenderTargetIdx).Valid(); + if (inOut->m_InputRenderTargetIdx.Valid()) + success &= colorRemapSubPass.m_InputRenderTargets.PushBack(inOut->m_InputRenderTargetIdx).Valid(); + + success &= renderPass->AddRenderSubPass(colorRemapSubPass); + return success; +} + +//---------------------------------------------------------------------------- + +bool CPostFxColorRemap::CreateRenderStates( const TMemoryView &frameBufferLayout, + CShaderLoader &loader, + const RHI::PRenderPass &renderPass) +{ + m_RenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Color Remap Render State")); + m_RenderStateSkip = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Color Remap Skip Render State")); + + if (m_RenderState == null || m_RenderStateSkip == null) + return false; + + // Color Remap Render State + RHI::SRenderState remapRenderState; + remapRenderState.m_PipelineState.m_DynamicScissor = true; + remapRenderState.m_PipelineState.m_DynamicViewport = true; + if (!remapRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + + remapRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = QUAD_VERTEX_SHADER; + shadersPaths.m_Fragment = COLOR_REMAP_FRAGMENT_SHADER; + + FillColorRemapShaderBindings(remapRenderState.m_ShaderBindings, m_ColorLUTSetLayout); + + if (loader.LoadShader(remapRenderState, shadersPaths, m_ApiManager) == false) + return false; + + m_RenderState->m_RenderState = remapRenderState; + + // Skip Render State + RHI::SRenderState renderStateSkip; + renderStateSkip.m_PipelineState.m_DynamicScissor = true; + renderStateSkip.m_PipelineState.m_DynamicViewport = true; + if (!renderStateSkip.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderStateSkip.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillCopyShaderBindings(CopyCombination_Basic, renderStateSkip.m_ShaderBindings, m_SamplerRTLayout); + + shadersPaths.m_Fragment = COPY_FRAGMENT_SHADER; + if (loader.LoadShader(renderStateSkip, shadersPaths, m_ApiManager) == false) + return false; + m_RenderStateSkip->m_RenderState = renderStateSkip; + + return m_ApiManager->BakeRenderState(m_RenderState, frameBufferLayout, renderPass, m_SubPassIdx) && + m_ApiManager->BakeRenderState(m_RenderStateSkip, frameBufferLayout, renderPass, m_SubPassIdx); +} + +//---------------------------------------------------------------------------- + +void CPostFxColorRemap::SetRemapTexture(const RHI::PTexture texture, bool isPlaceholder, CUint3 dimensions) +{ + m_HasTexture = !isPlaceholder; + m_ColorLUTSet->SetConstants(m_RemapTextureSampler, texture, 1); + + if(dimensions.x() != dimensions.y() * dimensions.y() && !isPlaceholder) + CLog::Log(PK_WARN, "Color Remap input texture dimensions are expected to be height*height x height"); + + m_ColorLutHeight = dimensions.y(); + + if (m_InputRenderTarget.m_RenderTarget != null && texture != null) + m_ColorLUTSet->UpdateConstantValues(); + + m_RemapTexture = texture; +} + +//---------------------------------------------------------------------------- + +bool CPostFxColorRemap::Draw(const RHI::PCommandBuffer &commandBuffer) +{ + PK_NAMEDSCOPEDPROFILE("Color Remap Pass"); + + commandBuffer->BindRenderState(m_RenderState); + commandBuffer->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + commandBuffer->BindConstantSets(TMemoryView(m_ColorLUTSet)); + + SColorRemapInfo colorRemapInfo(m_ColorLutHeight); + commandBuffer->PushConstant(&m_ColorLutHeight, 0); + commandBuffer->Draw(0, 6); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxColorRemap::Draw_JustCopy(const RHI::PCommandBuffer &cmdBuff) +{ + PK_NAMEDSCOPEDPROFILE("Tone-Mapping Skip pass (just a copy)"); + + cmdBuff->BindRenderState(m_RenderStateSkip); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + cmdBuff->BindConstantSets(TMemoryView(m_InputRenderTarget.m_SamplerConstantSet)); + + cmdBuff->Draw(0, 6); + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxColorRemap.h b/Samples/PK-SampleLib/RenderPasses/PostFxColorRemap.h new file mode 100644 index 00000000..3577ab0d --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxColorRemap.h @@ -0,0 +1,80 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CPostFxColorRemap +{ +public: + struct SInOutRenderTargets + { + const SSamplableRenderTarget *m_InputRenderTarget; + CGuid m_InputRenderTargetIdx; + CGuid m_OutputRenderTargetIdx; + }; + + struct SColorRemapInfo + { + float m_LutHeight; + + SColorRemapInfo(const float &lutHeight) : m_LutHeight(lutHeight) {}; + }; + + CPostFxColorRemap(); + ~CPostFxColorRemap(); + + bool Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout); + + bool UpdateFrameBuffer( TMemoryView currentFrameBuffers, + TArray &loadOP, + const SInOutRenderTargets *inOut); + + bool AddSubPasses(const RHI::PRenderPass &renderPass, const SInOutRenderTargets *inOut); + bool CreateRenderStates(const TMemoryView &frameBufferLayout, CShaderLoader &loader, const RHI::PRenderPass &renderPass); + + void SetRemapTexture(const RHI::PTexture texture, bool isPlaceholder, CUint3 dimensions = {128, 16, 1}); + + bool Draw(const RHI::PCommandBuffer &commandBuffer); + bool Draw_JustCopy(const RHI::PCommandBuffer &commandBuffer); + + SSamplableRenderTarget m_OutputRenderTarget; + CGuid m_OutputRenderTargetIdx; + + bool m_HasTexture; +private: + RHI::PApiManager m_ApiManager; + RHI::PConstantSet m_ColorLUTSet; + RHI::SConstantSetLayout m_ColorLUTSetLayout; + SSamplableRenderTarget m_InputRenderTarget; + RHI::PConstantSampler m_SamplerRT; + RHI::SConstantSetLayout m_SamplerRTLayout; + RHI::PGpuBuffer m_FullScreenQuadVbo; + RHI::PTexture m_RemapTexture; + RHI::PConstantSampler m_RemapTextureSampler; + float m_ColorLutHeight; + CGuid m_SubPassIdx; + RHI::PRenderState m_RenderState; + RHI::PRenderState m_RenderStateSkip; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxDistortion.cpp b/Samples/PK-SampleLib/RenderPasses/PostFxDistortion.cpp new file mode 100644 index 00000000..fdb547fd --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxDistortion.cpp @@ -0,0 +1,348 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PostFxDistortion.h" + +#include +#include + +#include + +#define QUAD_VERTEX_SHADER "./Shaders/FullScreenQuad.vert" + +#define COPY_FRAGMENT_SHADER "./Shaders/Copy.frag" +#define BLUR_FRAGMENT_SHADER "./Shaders/GaussianBlur.frag" +#define DISTORTION_FRAGMENT_SHADER "./Shaders/Distortion.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +const RHI::EPixelFormat CPostFxDistortion::s_DistortionBufferFormat = RHI::FormatFloat16RGBA; + +//---------------------------------------------------------------------------- + +CPostFxDistortion::CPostFxDistortion() +: m_SamplerRT(null) +, m_ConstSetProcessToDistord(null) +, m_ConstSetProcessOutput(null) +, m_RenderStateOffset(null) +, m_RenderStateBlurH(null) +, m_RenderStateBlurV(null) +, m_RenderStateSkip(null) +, m_DistortionIntensity(1.f) +, m_ChromaticAberrationMultipliers(CFloat4(0.01f, 0.0125f, 0.015f, 0.0175f)) +, m_PushMultipliers(m_DistortionIntensity * m_ChromaticAberrationMultipliers) +{ +} + +//---------------------------------------------------------------------------- + +CPostFxDistortion::~CPostFxDistortion() +{ +} + +//---------------------------------------------------------------------------- + +bool CPostFxDistortion::Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout) +{ + m_FullScreenQuadVbo = fullScreenQuadVbo; + m_ApiManager = apiManager; + m_SamplerRT = samplerRT; + m_SamplerRTLayout = samplerRTLayout; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxDistortion::UpdateFrameBuffer( const TMemoryView &frameBuffers, + TArray &loadOP, + TArray &clearValues, + const SInOutRenderTargets *inOut) +{ + CUint2 frameBufferSize = frameBuffers.First()->GetSize(); + + m_ToDistordRt = *inOut->m_ToDistordRt; + // Distortion map RT + if (!PK_VERIFY(m_DistoRenderTarget.CreateRenderTarget(RHI::SRHIResourceInfos("Distortion Render Target"), m_ApiManager, m_SamplerRT, s_DistortionBufferFormat, frameBufferSize, m_SamplerRTLayout))) + return false; + // Output + if (!PK_VERIFY(m_OutputRenderTarget.CreateRenderTarget(RHI::SRHIResourceInfos("Distortion Output Render Target"), m_ApiManager, m_SamplerRT, s_DistortionBufferFormat, frameBufferSize, m_SamplerRTLayout))) + return false; + + for (u32 i = 0; i < frameBuffers.Count(); ++i) + { + PK_ASSERT(frameBufferSize == frameBuffers[i]->GetSize()); + + // Distortion map RT + m_DistoBufferIdx = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_DistoRenderTarget.m_RenderTarget))) + return false; + // Output + m_OutputBufferIdx = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_OutputRenderTarget.m_RenderTarget))) + return false; + } + + // Distortion map RT + if (!PK_VERIFY( loadOP.PushBack(RHI::LoadClear).Valid() && + clearValues.PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + // Output + if (!PK_VERIFY(loadOP.PushBack(RHI::LoadClear).Valid() && + clearValues.PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + + CreateProcessTextureConstSetLayouts(m_ConstSetLayoutProcess); + + m_ConstSetProcessToDistord = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Distort Constant Set"), m_ConstSetLayoutProcess); + m_ConstSetProcessOutput = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Distort Output Constant Set"), m_ConstSetLayoutProcess); + + if (m_ConstSetProcessToDistord == null || m_ConstSetProcessOutput == null) + return false; + + RHI::PTexture sampleRT = m_DistoRenderTarget.m_RenderTarget->GetTexture(); + + m_ConstSetProcessToDistord->SetConstants(m_SamplerRT, m_ToDistordRt.m_RenderTarget->GetTexture(), 0); + m_ConstSetProcessToDistord->SetConstants(m_SamplerRT, sampleRT, 1); + m_ConstSetProcessToDistord->UpdateConstantValues(); + + m_ConstSetProcessOutput->SetConstants(m_SamplerRT, m_OutputRenderTarget.m_RenderTarget->GetTexture(), 0); + m_ConstSetProcessOutput->SetConstants(m_SamplerRT, sampleRT, 1); + m_ConstSetProcessOutput->UpdateConstantValues(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxDistortion::AddSubPasses(const RHI::PRenderPass &renderPass, const SInOutRenderTargets *inOut) +{ + bool success = true; + + m_DistoSubPassIdx = renderPass->GetSubPassDefinitions().Count(); + + // Render the disto texture: + RHI::SSubPassDefinition subPass; + subPass.m_DepthStencilRenderTarget = inOut->m_DepthRtIdx; + for (u32 i = 0; i < inOut->m_ParticleInputs.Count(); ++i) + subPass.m_InputRenderTargets.PushBack(inOut->m_ParticleInputs[i]); + subPass.m_OutputRenderTargets.PushBack(m_DistoBufferIdx); + success &= renderPass->AddRenderSubPass(subPass); + + // Distord the samplableRenderOutputToDistordIdx in the m_OutputRenderTarget + RHI::SSubPassDefinition subPassPost; + subPassPost.m_OutputRenderTargets.PushBack(m_OutputBufferIdx); + subPassPost.m_InputRenderTargets.PushBack(inOut->m_ToDistordRtIdx); + subPassPost.m_InputRenderTargets.PushBack(m_DistoBufferIdx); + success &= renderPass->AddRenderSubPass(subPassPost); + + // HBlur m_OutputRenderTarget -> samplableRenderOutputToDistordIdx + RHI::SSubPassDefinition subPassBlurH; + subPassBlurH.m_OutputRenderTargets.PushBack(inOut->m_ToDistordRtIdx); + subPassBlurH.m_InputRenderTargets.PushBack(m_OutputBufferIdx); + subPassBlurH.m_InputRenderTargets.PushBack(m_DistoBufferIdx); + success &= renderPass->AddRenderSubPass(subPassBlurH); + + // VBlur samplableRenderOutputToDistordIdx -> m_OutputRenderTarget + RHI::SSubPassDefinition subPassBlurV; + if (inOut->m_OutputRtIdx.Valid()) + subPassBlurV.m_OutputRenderTargets.PushBack(inOut->m_OutputRtIdx); + else + subPassBlurV.m_OutputRenderTargets.PushBack(m_OutputBufferIdx); + subPassBlurV.m_InputRenderTargets.PushBack(inOut->m_ToDistordRtIdx); + subPassBlurV.m_InputRenderTargets.PushBack(m_DistoBufferIdx); + success &= renderPass->AddRenderSubPass(subPassBlurV); + + m_PostDistortionSubPassIdx = renderPass->GetSubPassDefinitions().Count(); + + // Render particles post distortion -> m_OutputRenderTarget + RHI::SSubPassDefinition postDistortion; + postDistortion.m_DepthStencilRenderTarget = inOut->m_DepthRtIdx; + for (u32 i = 0; i < inOut->m_ParticleInputs.Count(); ++i) + postDistortion.m_InputRenderTargets.PushBack(inOut->m_ParticleInputs[i]); + if (inOut->m_OutputRtIdx.Valid()) + postDistortion.m_OutputRenderTargets.PushBack(inOut->m_OutputRtIdx); + else + postDistortion.m_OutputRenderTargets.PushBack(m_OutputBufferIdx); + success &= renderPass->AddRenderSubPass(postDistortion); + return success; +} + +//---------------------------------------------------------------------------- + +bool CPostFxDistortion::CreateRenderStates( const TMemoryView &frameBufferLayout, + CShaderLoader &shaderLoader, + const RHI::PRenderPass &renderPass) +{ + m_RenderStateOffset = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Distortion Offset Render State")); + m_RenderStateBlurH = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Distortion BlurH Render State")); + m_RenderStateBlurV = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Distortion BlurV Render State")); + m_RenderStateSkip = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("Distortion Skip Render State")); + + if (m_RenderStateOffset == null || m_RenderStateSkip == null || + m_RenderStateBlurH == null || m_RenderStateBlurV == null) + return false; + + // renderState Offset + + CShaderLoader::SShadersPaths shadersPathsDistortion; + shadersPathsDistortion.m_Vertex = QUAD_VERTEX_SHADER; + shadersPathsDistortion.m_Fragment = DISTORTION_FRAGMENT_SHADER; + + RHI::SRenderState renderState; + renderState.m_PipelineState.m_DynamicScissor = true; + renderState.m_PipelineState.m_DynamicViewport = true; + if (!renderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillDistortionShaderBindings(renderState.m_ShaderBindings, m_ConstSetLayoutProcess); + + if (shaderLoader.LoadShader(renderState, shadersPathsDistortion, m_ApiManager) == false) + return false; + m_RenderStateOffset->m_RenderState = renderState; + + // Skip renderState Blur + + CShaderLoader::SShadersPaths shadersPathsBlur; + shadersPathsBlur.m_Vertex = QUAD_VERTEX_SHADER; + shadersPathsBlur.m_Fragment = BLUR_FRAGMENT_SHADER; + + RHI::SRenderState renderStateBlur; + renderStateBlur.m_PipelineState.m_DynamicScissor = true; + renderStateBlur.m_PipelineState.m_DynamicViewport = true; + if (!renderStateBlur.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderStateBlur.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillGaussianBlurShaderBindings( GaussianBlurCombination_13_Tap, + renderStateBlur.m_ShaderBindings, + m_ConstSetLayoutProcess); + + if (shaderLoader.LoadShader(renderStateBlur, shadersPathsBlur, m_ApiManager) == false) + return false; + m_RenderStateBlurH->m_RenderState = renderStateBlur; + m_RenderStateBlurV->m_RenderState = renderStateBlur; + + // Skip renderState + + CShaderLoader::SShadersPaths shadersPathsCopy; + shadersPathsCopy.m_Vertex = QUAD_VERTEX_SHADER; + shadersPathsCopy.m_Fragment = COPY_FRAGMENT_SHADER; + + RHI::SRenderState renderStateSkip; + renderStateSkip.m_PipelineState.m_DynamicScissor = true; + renderStateSkip.m_PipelineState.m_DynamicViewport = true; + if (!renderStateSkip.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderStateSkip.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillCopyShaderBindings(CopyCombination_Basic, renderStateSkip.m_ShaderBindings, m_SamplerRTLayout); + + if (shaderLoader.LoadShader(renderStateSkip, shadersPathsCopy, m_ApiManager) == false) + return false; + m_RenderStateSkip->m_RenderState = renderStateSkip; + + // Bake + return m_ApiManager->BakeRenderState(m_RenderStateOffset, frameBufferLayout, renderPass, m_DistoSubPassIdx + 1) && + m_ApiManager->BakeRenderState(m_RenderStateBlurH, frameBufferLayout, renderPass, m_DistoSubPassIdx + 2) && + m_ApiManager->BakeRenderState(m_RenderStateBlurV, frameBufferLayout, renderPass, m_DistoSubPassIdx + 3) && + m_ApiManager->BakeRenderState(m_RenderStateSkip, frameBufferLayout, renderPass, m_DistoSubPassIdx + 1); +} + +//---------------------------------------------------------------------------- + +bool CPostFxDistortion::Draw(const RHI::PCommandBuffer &cmdBuff) +{ + bool result = true; + result &= _Draw_UVoffset(cmdBuff, m_ConstSetProcessToDistord); + cmdBuff->NextRenderSubPass(); + result &= _Draw_Blur(cmdBuff, m_ConstSetProcessOutput, true); + cmdBuff->NextRenderSubPass(); + result &= _Draw_Blur(cmdBuff, m_ConstSetProcessToDistord, false); + return result; +} + +//---------------------------------------------------------------------------- + +bool CPostFxDistortion::_Draw_UVoffset(const RHI::PCommandBuffer &cmdBuff, const RHI::PConstantSet &inputSampler) +{ + PK_NAMEDSCOPEDPROFILE("Distortion pass (UV offset)"); + + cmdBuff->BindRenderState(m_RenderStateOffset); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + + cmdBuff->BindConstantSets(TMemoryView(inputSampler)); + + SDistortionInfo distortionInfo(m_PushMultipliers); + + cmdBuff->PushConstant(&distortionInfo, 0); + cmdBuff->Draw(0, 6); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxDistortion::_Draw_Blur(const RHI::PCommandBuffer &cmdBuff, const RHI::PConstantSet &inputSampler, bool isDirHortizontal) +{ + PK_NAMEDSCOPEDPROFILE("Distortion pass (Blur)"); + + cmdBuff->BindRenderState(isDirHortizontal ? m_RenderStateBlurH : m_RenderStateBlurV); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + + const CUint2 contextSize = m_OutputRenderTarget.m_RenderTarget->GetSize(); + const SBlurInfo blurInfo(contextSize, isDirHortizontal ? CFloat2(1.f, 0.f) : CFloat2(0.f, 1.f)); + + cmdBuff->PushConstant(&blurInfo, 0); + + cmdBuff->BindConstantSets(TMemoryView(inputSampler)); + + cmdBuff->Draw(0, 6); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxDistortion::Draw_JustCopy(const RHI::PCommandBuffer &cmdBuff) +{ + PK_NAMEDSCOPEDPROFILE("Distortion Skip pass (just a copy)"); + + cmdBuff->BindRenderState(m_RenderStateSkip); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + + cmdBuff->BindConstantSets(TMemoryView(m_ToDistordRt.m_SamplerConstantSet)); + cmdBuff->Draw(0, 6); + + cmdBuff->NextRenderSubPass(); + cmdBuff->NextRenderSubPass(); + + return true; +} + +void CPostFxDistortion::SetChromaticAberrationIntensity(float intensity) +{ + m_DistortionIntensity = intensity; + m_PushMultipliers = m_DistortionIntensity * m_ChromaticAberrationMultipliers; +} + +void CPostFxDistortion::SetAberrationMultipliers(CFloat4 multipliers) +{ + m_ChromaticAberrationMultipliers = multipliers; + m_PushMultipliers = m_DistortionIntensity * m_ChromaticAberrationMultipliers; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxDistortion.h b/Samples/PK-SampleLib/RenderPasses/PostFxDistortion.h new file mode 100644 index 00000000..48d005a2 --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxDistortion.h @@ -0,0 +1,112 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CPostFxDistortion +{ +public: + struct SInOutRenderTargets + { + // Render target to distord: + CGuid m_ToDistordRtIdx; + const SSamplableRenderTarget *m_ToDistordRt; + + // Depth buffer + CGuid m_DepthRtIdx; + + // Possible particle shader inputs (samplable depth, samplable diffuse...) + TMemoryView m_ParticleInputs; + + // Output render target + CGuid m_OutputRtIdx; + }; + + struct SDistortionInfo + { + CFloat4 m_PushMultipliers; + + SDistortionInfo(const CFloat4 &multipliers) : m_PushMultipliers(multipliers) {}; + }; + + CPostFxDistortion(); + ~CPostFxDistortion(); + + bool Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout); + bool UpdateFrameBuffer( const TMemoryView &frameBuffers, + TArray &loadOP, + TArray &clearValues, + const SInOutRenderTargets *inOut); + bool AddSubPasses(const RHI::PRenderPass &renderPass, const SInOutRenderTargets *inOut); + bool CreateRenderStates( const TMemoryView &frameBufferLayout, + CShaderLoader &shaderLoader, + const RHI::PRenderPass &renderPass); + + bool Draw(const RHI::PCommandBuffer &commandBuffer); + bool Draw_JustCopy(const RHI::PCommandBuffer &commandBuffer); + + void SetChromaticAberrationIntensity(float intensity); + void SetAberrationMultipliers(CFloat4 multipliers); + + CGuid m_DistoBufferIdx; + SSamplableRenderTarget m_DistoRenderTarget; + CGuid m_OutputBufferIdx; + SSamplableRenderTarget m_OutputRenderTarget; + + CGuid m_DistoSubPassIdx; + CGuid m_PostDistortionSubPassIdx; + + static const RHI::EPixelFormat s_DistortionBufferFormat; + +private: + bool _Draw_UVoffset(const RHI::PCommandBuffer &commandBuffer, const RHI::PConstantSet &inputSampler); + bool _Draw_Blur(const RHI::PCommandBuffer &commandBuffer, const RHI::PConstantSet &inputSampler, bool isHorizontal); + + RHI::PConstantSampler m_SamplerRT; + RHI::SConstantSetLayout m_SamplerRTLayout; + + RHI::PConstantSet m_ConstSetProcessToDistord; + RHI::PConstantSet m_ConstSetProcessOutput; + RHI::SConstantSetLayout m_ConstSetLayoutProcess; + + SSamplableRenderTarget m_ToDistordRt; + + RHI::PRenderState m_RenderStateOffset; + RHI::PRenderState m_RenderStateBlurH; + RHI::PRenderState m_RenderStateBlurV; + RHI::PRenderState m_RenderStateSkip; + + float m_DistortionIntensity; + CFloat4 m_ChromaticAberrationMultipliers; + CFloat4 m_PushMultipliers; + + // This class does not own that + RHI::PApiManager m_ApiManager; + RHI::PGpuBuffer m_FullScreenQuadVbo; + RHI::PRenderPass m_RenderPass; + +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxFXAA.cpp b/Samples/PK-SampleLib/RenderPasses/PostFxFXAA.cpp new file mode 100644 index 00000000..a1431f41 --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxFXAA.cpp @@ -0,0 +1,196 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PostFxFXAA.h" + +#include + +#include + +#define QUAD_VERTEX_SHADER "./Shaders/FullScreenQuad.vert" + +#define COPY_FRAGMENT_SHADER "./Shaders/Copy.frag" + +#define FXAA_FRAGMENT_SHADER "./Shaders/FXAA.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CPostFxFXAA::CPostFxFXAA() +: m_SamplerRT(null) +, m_RenderState(null) +, m_RenderStateSkip(null) +{ +} + +//---------------------------------------------------------------------------- + +CPostFxFXAA::~CPostFxFXAA() +{ +} + +//---------------------------------------------------------------------------- + +bool CPostFxFXAA::Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout) +{ + m_FullScreenQuadVbo = fullScreenQuadVbo; + m_ApiManager = apiManager; + m_SamplerRT = samplerRT; + m_SamplerRTLayout = samplerRTLayout; + m_LumaInAlpha = true; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxFXAA::UpdateFrameBuffer( const TMemoryView &frameBuffers, + TArray &loadOP, + TArray &clearValues, + const SInOutRenderTargets *inOut) +{ + (void)clearValues; + m_FrameBufferSize = frameBuffers.First()->GetSize(); + + if (!inOut->m_OutputRtIdx.Valid()) + { + if (!PK_VERIFY(m_OutputRenderTarget.CreateRenderTarget(RHI::SRHIResourceInfos("FXAA Output Render Target"), m_ApiManager, m_SamplerRT, RHI::FormatFloat16RGBA, m_FrameBufferSize, m_SamplerRTLayout))) + return false; + + if (!PK_VERIFY(loadOP.PushBack(RHI::LoadDontCare).Valid())) + return false; + + for (u32 i = 0; i < frameBuffers.Count(); ++i) + { + PK_ASSERT(m_FrameBufferSize == frameBuffers[i]->GetSize()); + + m_OutputRenderTargetIdx = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_OutputRenderTarget.m_RenderTarget))) + return false; + } + } + m_InputRenderTarget = *inOut->m_InputRt; + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxFXAA::AddSubPasses(const RHI::PRenderPass &renderPass, const SInOutRenderTargets *inOut) +{ + bool success = true; + RHI::SSubPassDefinition toneMappingSubPass; + + m_SubPassIdx = renderPass->GetSubPassDefinitions().Count(); + if (inOut->m_OutputRtIdx.Valid()) + success &= toneMappingSubPass.m_OutputRenderTargets.PushBack(inOut->m_OutputRtIdx).Valid(); + else + success &= toneMappingSubPass.m_OutputRenderTargets.PushBack(m_OutputRenderTargetIdx).Valid(); + if (inOut->m_InputRtIdx.Valid()) + success &= toneMappingSubPass.m_InputRenderTargets.PushBack(inOut->m_InputRtIdx).Valid(); + success &= renderPass->AddRenderSubPass(toneMappingSubPass); + return success; +} + +//---------------------------------------------------------------------------- + +bool CPostFxFXAA::CreateRenderStates(const TMemoryView &frameBufferLayout, + CShaderLoader &shaderLoader, + const RHI::PRenderPass &renderPass) +{ + m_RenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("FXAA Render State")); + m_RenderStateSkip = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("FXAA Skip Render State")); + + if (m_RenderState == null) + return false; + if (m_RenderStateSkip == null) + return false; + + CShaderLoader::SShadersPaths shadersPathsCopy; + shadersPathsCopy.m_Vertex = QUAD_VERTEX_SHADER; + shadersPathsCopy.m_Fragment = COPY_FRAGMENT_SHADER; + + CShaderLoader::SShadersPaths shadersPathsFXAA; + shadersPathsFXAA.m_Vertex = QUAD_VERTEX_SHADER; + shadersPathsFXAA.m_Fragment = FXAA_FRAGMENT_SHADER; + + // Main renderState + RHI::SRenderState renderState; + renderState.m_PipelineState.m_DynamicScissor = true; + renderState.m_PipelineState.m_DynamicViewport = true; + if (!renderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillFXAAShaderBindings(renderState.m_ShaderBindings, m_LumaInAlpha); + + if (shaderLoader.LoadShader(renderState, shadersPathsFXAA, m_ApiManager) == false) + return false; + m_RenderState->m_RenderState = renderState; + + // Skip renderState + RHI::SRenderState renderStateSkip; + renderStateSkip.m_PipelineState.m_DynamicScissor = true; + renderStateSkip.m_PipelineState.m_DynamicViewport = true; + if (!renderStateSkip.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderStateSkip.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillCopyShaderBindings(CopyCombination_Basic, renderStateSkip.m_ShaderBindings, m_SamplerRTLayout); + + if (shaderLoader.LoadShader(renderStateSkip, shadersPathsCopy, m_ApiManager) == false) + return false; + m_RenderStateSkip->m_RenderState = renderStateSkip; + + // Bake + return m_ApiManager->BakeRenderState(m_RenderState, frameBufferLayout, renderPass, m_SubPassIdx) && + m_ApiManager->BakeRenderState(m_RenderStateSkip, frameBufferLayout, renderPass, m_SubPassIdx); +} + +//---------------------------------------------------------------------------- + +bool CPostFxFXAA::Draw(const RHI::PCommandBuffer &cmdBuff) +{ + cmdBuff->BindRenderState(m_RenderState); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + cmdBuff->BindConstantSet(m_InputRenderTarget.m_SamplerConstantSet, 0); + cmdBuff->PushConstant(&m_FrameBufferSize, 0); + cmdBuff->Draw(0, 6); + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxFXAA::Draw_JustCopy(const RHI::PCommandBuffer &cmdBuff) +{ + PK_NAMEDSCOPEDPROFILE("Tone-Mapping Skip pass (just a copy)"); + + cmdBuff->BindRenderState(m_RenderStateSkip); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + + cmdBuff->BindConstantSets(TMemoryView(m_InputRenderTarget.m_SamplerConstantSet)); + cmdBuff->Draw(0, 6); + return true; +} + +//---------------------------------------------------------------------------- + +void CPostFxFXAA::SetLumaInAlpha(const bool lumaInAlpha) +{ + m_LumaInAlpha = lumaInAlpha; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxFXAA.h b/Samples/PK-SampleLib/RenderPasses/PostFxFXAA.h new file mode 100644 index 00000000..94c9818d --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxFXAA.h @@ -0,0 +1,84 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN + +//---------------------------------------------------------------------------- + +class CPostFxFXAA +{ +public: + struct SInOutRenderTargets + { + CGuid m_InputRtIdx; + const SSamplableRenderTarget *m_InputRt; + + CGuid m_OutputRtIdx; + }; + + CPostFxFXAA(); + ~CPostFxFXAA(); + + bool Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout); + bool UpdateFrameBuffer( const TMemoryView &frameBuffers, + TArray &loadOP, + TArray &clearValues, + const SInOutRenderTargets *inOut); + bool AddSubPasses( const RHI::PRenderPass &renderPass, + const SInOutRenderTargets *inOut); + bool CreateRenderStates( const TMemoryView &frameBufferLayout, + CShaderLoader &shaderLoader, + const RHI::PRenderPass &renderPass); + + bool Draw(const RHI::PCommandBuffer &commandBuffer); + bool Draw_JustCopy(const RHI::PCommandBuffer &commandBuffer); + + void SetLumaInAlpha(const bool lumaInAlpha); + bool LumaInAlpha() { return m_LumaInAlpha; } + + SSamplableRenderTarget m_OutputRenderTarget; + CGuid m_OutputRenderTargetIdx; + +private: + SSamplableRenderTarget m_InputRenderTarget; + + RHI::PConstantSampler m_SamplerRT; + RHI::SConstantSetLayout m_SamplerRTLayout; + RHI::PConstantSet m_ConstantSet; + + CGuid m_SubPassIdx; + + RHI::PRenderState m_RenderState; + RHI::PRenderState m_RenderStateSkip; + + CUint2 m_FrameBufferSize; + + bool m_LumaInAlpha; + + // This class does not own that + RHI::PApiManager m_ApiManager; + RHI::PGpuBuffer m_FullScreenQuadVbo; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxToneMapping.cpp b/Samples/PK-SampleLib/RenderPasses/PostFxToneMapping.cpp new file mode 100644 index 00000000..3b2cb4e8 --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxToneMapping.cpp @@ -0,0 +1,231 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "PostFxToneMapping.h" + +#include +#include + +#include "BlueNoise.h" + +#include + +#define QUAD_VERTEX_SHADER "./Shaders/FullScreenQuad.vert" + +#define COPY_FRAGMENT_SHADER "./Shaders/Copy.frag" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CPostFxToneMapping::CPostFxToneMapping() +: m_SamplerRT(null) +, m_RenderState(null) +, m_RenderStateSkip(null) +, m_RenderStateSkipPrecomputeLuma(null) +{ + SetExposure(1.0f); // identity exposure is not '1.0' in m_Parameters.m_Params.x, initialize to correct value for exposure of 1 + SetSaturation(1.f); + SetPrecomputeLuma(true); +} + +//---------------------------------------------------------------------------- + +CPostFxToneMapping::~CPostFxToneMapping() +{ +} + +//---------------------------------------------------------------------------- + +bool CPostFxToneMapping::Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout) +{ + m_FullScreenQuadVbo = fullScreenQuadVbo; + m_ApiManager = apiManager; + m_SamplerRT = samplerRT; + m_SamplerRTLayout = samplerRTLayout; + + RHI::SConstantSetLayout blueNoise; + blueNoise.m_ShaderStagesMask = RHI::FragmentShaderMask; + blueNoise.AddConstantsLayout(RHI::SConstantSamplerDesc("BlueNoise", RHI::SamplerTypeSingle)); + + RHI::PConstantSampler sampler = m_ApiManager->CreateConstantSampler( RHI::SRHIResourceInfos("ToneMapping Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleRepeat, + RHI::SampleRepeat, + RHI::SampleRepeat, + 1); + const CImageMap map = CImageMap(CUint3(32, 32, 1), const_cast(reinterpret_cast(&kBlueNoiseMap)), sizeof(u8) * 4 * 32 * 32); + RHI::PTexture texture = apiManager->CreateTexture(RHI::SRHIResourceInfos("ToneMapping Blue Noise Texture"), TMemoryView(map), RHI::EPixelFormat::FormatSrgb8RGBA); + m_BlueNoise = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("ToneMapping Constant Set"), blueNoise); + m_BlueNoise->SetConstants(sampler, texture, 0); + m_BlueNoise->UpdateConstantValues(); + + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxToneMapping::UpdateFrameBuffer( const TMemoryView &frameBuffers, + TArray &loadOP, + TArray &clearValues, + const SInOutRenderTargets *inOut) +{ + (void)clearValues; + const CUint2 frameBufferSize = frameBuffers.First()->GetSize(); + + if (!inOut->m_OutputRtIdx.Valid()) + { + if (!PK_VERIFY(m_OutputRenderTarget.CreateRenderTarget(RHI::SRHIResourceInfos("ToneMapping Output Render Target"), m_ApiManager, m_SamplerRT, RHI::FormatFloat16RGBA, frameBufferSize, m_SamplerRTLayout))) + return false; + + if (!PK_VERIFY(loadOP.PushBack(RHI::LoadDontCare).Valid())) + return false; + + for (u32 i = 0; i < frameBuffers.Count(); ++i) + { + PK_ASSERT(frameBufferSize == frameBuffers[i]->GetSize()); + + m_OutputRenderTargetIdx = frameBuffers[i]->GetRenderTargets().Count(); + if (!PK_VERIFY(frameBuffers[i]->AddRenderTarget(m_OutputRenderTarget.m_RenderTarget))) + return false; + } + } + m_ToTonemapRenderTarget = *inOut->m_ToTonemapRt; + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxToneMapping::AddSubPasses(const RHI::PRenderPass &renderPass, const SInOutRenderTargets *inOut) +{ + bool success = true; + RHI::SSubPassDefinition toneMappingSubPass; + + m_SubPassIdx = renderPass->GetSubPassDefinitions().Count(); + if (inOut->m_OutputRtIdx.Valid()) + success &= toneMappingSubPass.m_OutputRenderTargets.PushBack(inOut->m_OutputRtIdx).Valid(); + else + success &= toneMappingSubPass.m_OutputRenderTargets.PushBack(m_OutputRenderTargetIdx).Valid(); + if (inOut->m_ToTonemapRtIdx.Valid()) + success &= toneMappingSubPass.m_InputRenderTargets.PushBack(inOut->m_ToTonemapRtIdx).Valid(); + success &= renderPass->AddRenderSubPass(toneMappingSubPass); + return success; +} + +//---------------------------------------------------------------------------- + +bool CPostFxToneMapping::CreateRenderStates( const TMemoryView &frameBufferLayout, + CShaderLoader &shaderLoader, + const RHI::PRenderPass &renderPass) +{ + m_RenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("ToneMapping Render State")); + m_RenderStateSkip = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("ToneMapping Skip Render State")); + m_RenderStateSkipPrecomputeLuma = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("ToneMapping Skip PrecomputeLuma Render State")); + + if (m_RenderState == null || m_RenderStateSkip == null || m_RenderStateSkipPrecomputeLuma == null) + return false; + + CShaderLoader::SShadersPaths shadersPathsCopy; + shadersPathsCopy.m_Vertex = QUAD_VERTEX_SHADER; + shadersPathsCopy.m_Fragment = COPY_FRAGMENT_SHADER; + + // Main renderState + + RHI::SRenderState renderState; + renderState.m_PipelineState.m_DynamicScissor = true; + renderState.m_PipelineState.m_DynamicViewport = true; + if (!renderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillCopyShaderBindings(CopyCombination_ToneMapping, renderState.m_ShaderBindings, m_SamplerRTLayout); + + if (shaderLoader.LoadShader(renderState, shadersPathsCopy, m_ApiManager) == false) + return false; + m_RenderState->m_RenderState = renderState; + + // Skip renderState + + RHI::SRenderState renderStateSkip; + renderStateSkip.m_PipelineState.m_DynamicScissor = true; + renderStateSkip.m_PipelineState.m_DynamicViewport = true; + if (!renderStateSkip.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderStateSkip.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillCopyShaderBindings(CopyCombination_Basic, renderStateSkip.m_ShaderBindings, m_SamplerRTLayout); + + if (shaderLoader.LoadShader(renderStateSkip, shadersPathsCopy, m_ApiManager) == false) + return false; + m_RenderStateSkip->m_RenderState = renderStateSkip; + + // Skip renderState precompute luma + + RHI::SRenderState renderStateSkipPrecomputeLuma; + renderStateSkipPrecomputeLuma.m_PipelineState.m_DynamicScissor = true; + renderStateSkipPrecomputeLuma.m_PipelineState.m_DynamicViewport = true; + if (!renderStateSkipPrecomputeLuma.m_InputVertexBuffers.PushBack().Valid()) + return false; + renderStateSkipPrecomputeLuma.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + + FillCopyShaderBindings(CopyCombination_ComputeLuma, renderStateSkipPrecomputeLuma.m_ShaderBindings, m_SamplerRTLayout); + + if (shaderLoader.LoadShader(renderStateSkipPrecomputeLuma, shadersPathsCopy, m_ApiManager) == false) + return false; + m_RenderStateSkipPrecomputeLuma->m_RenderState = renderStateSkipPrecomputeLuma; + + // Bake + return m_ApiManager->BakeRenderState(m_RenderState, frameBufferLayout, renderPass, m_SubPassIdx) && + m_ApiManager->BakeRenderState(m_RenderStateSkipPrecomputeLuma, frameBufferLayout, renderPass, m_SubPassIdx) && + m_ApiManager->BakeRenderState(m_RenderStateSkip, frameBufferLayout, renderPass, m_SubPassIdx); +} + +//---------------------------------------------------------------------------- + +bool CPostFxToneMapping::Draw(const RHI::PCommandBuffer &cmdBuff) +{ + PK_NAMEDSCOPEDPROFILE("Tone-Mapping pass"); + + cmdBuff->BindRenderState(m_RenderState); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + + cmdBuff->PushConstant(&m_Parameters, 0); + + TStaticCountedArray constantSets; + constantSets.PushBack(m_ToTonemapRenderTarget.m_SamplerConstantSet); + constantSets.PushBack(m_BlueNoise); + + cmdBuff->BindConstantSets(constantSets); + cmdBuff->Draw(0, 6); + return true; +} + +//---------------------------------------------------------------------------- + +bool CPostFxToneMapping::Draw_JustCopy(const RHI::PCommandBuffer &cmdBuff) +{ + PK_NAMEDSCOPEDPROFILE("Tone-Mapping Skip pass (just a copy)"); + + RHI::PRenderState renderState = m_PrecomputeLuma ? m_RenderStateSkipPrecomputeLuma : m_RenderStateSkip; + cmdBuff->BindRenderState(renderState); + cmdBuff->BindVertexBuffers(TMemoryView(m_FullScreenQuadVbo)); + + cmdBuff->BindConstantSets(TMemoryView(m_ToTonemapRenderTarget.m_SamplerConstantSet)); + cmdBuff->Draw(0, 6); + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/RenderPasses/PostFxToneMapping.h b/Samples/PK-SampleLib/RenderPasses/PostFxToneMapping.h new file mode 100644 index 00000000..595b4389 --- /dev/null +++ b/Samples/PK-SampleLib/RenderPasses/PostFxToneMapping.h @@ -0,0 +1,112 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SToneMappingInfo +{ + CFloat4 m_Common; // packed parameters: (width, height, aspectRatio, precomputeLuma) + CFloat4 m_ToneMapping; // packed parameters: (exposure, gamma, saturation, dithering) + CFloat4 m_Vignetting; // packed parameters: (color-intensity, desaturation-intensity, roundness, smoothness) + CFloat4 m_VignetteColor; // alpha is ignored + + SToneMappingInfo() : m_Common(CFloat4::ZERO), m_ToneMapping(CFloat4(1, 1, 1, 0)), m_Vignetting(CFloat4::ZERO), m_VignetteColor(CFloat4::ZERO) {} +}; + +//---------------------------------------------------------------------------- + +class CPostFxToneMapping +{ +public: + struct SInOutRenderTargets + { + CGuid m_ToTonemapRtIdx; + const SSamplableRenderTarget *m_ToTonemapRt; + + CGuid m_OutputRtIdx; + }; + + CPostFxToneMapping(); + ~CPostFxToneMapping(); + + bool Init( const RHI::PApiManager &apiManager, + const RHI::PGpuBuffer &fullScreenQuadVbo, + const RHI::PConstantSampler &samplerRT, + const RHI::SConstantSetLayout &samplerRTLayout); + bool UpdateFrameBuffer( const TMemoryView &frameBuffers, + TArray &loadOP, + TArray &clearValues, + const SInOutRenderTargets *inOut); + bool AddSubPasses( const RHI::PRenderPass &renderPass, + const SInOutRenderTargets *inOut); + bool CreateRenderStates( const TMemoryView &frameBufferLayout, + CShaderLoader &shaderLoader, + const RHI::PRenderPass &renderPass); + + void SetExposure(float exposure) { m_Parameters.m_ToneMapping.x() = expf(exposure)*1.4f; } + void SetGamma(float gamma) { m_Parameters.m_ToneMapping.y() = gamma; } + void SetSaturation(float saturation) { m_Parameters.m_ToneMapping.z() = saturation; } + void SetDithering(bool dithering) { m_Parameters.m_ToneMapping.w() = dithering ? 1.f : 0.f; } + void SetPrecomputeLuma(bool precomputeLuma) { m_Parameters.m_Common.w() = precomputeLuma ? 1.f : 0.f; m_PrecomputeLuma = precomputeLuma;} + void SetScreenSize(u32 width, u32 height) + { + PK_ASSERT(width > 0 && height > 0); + m_Parameters.m_Common.x() = (float)width; + m_Parameters.m_Common.y() = (float)height; + m_Parameters.m_Common.z() = (float)height / (float)width; + } + void SetVignettingColor(CFloat3 color) { m_Parameters.m_VignetteColor = color.xyz1(); } + void SetVignettingColorIntensity(float intensity) { m_Parameters.m_Vignetting.x() = intensity; } + void SetVignettingDesaturationIntensity(float intensity) { m_Parameters.m_Vignetting.y() = intensity; } + void SetVignettingRoundness(float roundness) { m_Parameters.m_Vignetting.z() = roundness; } + void SetVignettingSmoothness(float smoothness) { m_Parameters.m_Vignetting.w() = smoothness; } + + bool Draw(const RHI::PCommandBuffer &commandBuffer); + bool Draw_JustCopy(const RHI::PCommandBuffer &commandBuffer); + + SSamplableRenderTarget m_OutputRenderTarget; + CGuid m_OutputRenderTargetIdx; + +private: + SSamplableRenderTarget m_ToTonemapRenderTarget; + + RHI::PConstantSampler m_SamplerRT; + RHI::SConstantSetLayout m_SamplerRTLayout; + + CGuid m_SubPassIdx; + + RHI::PRenderState m_RenderState; + RHI::PRenderState m_RenderStateSkip; + RHI::PRenderState m_RenderStateSkipPrecomputeLuma; + + SToneMappingInfo m_Parameters; + + RHI::PConstantSet m_BlueNoise; + + // This class does not own that + RHI::PApiManager m_ApiManager; + RHI::PGpuBuffer m_FullScreenQuadVbo; + + bool m_PrecomputeLuma; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/AbstractGraphicScene.cpp b/Samples/PK-SampleLib/SampleScene/AbstractGraphicScene.cpp new file mode 100644 index 00000000..84c7987d --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/AbstractGraphicScene.cpp @@ -0,0 +1,501 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + + +#include "precompiled.h" + +#include + +#include "AbstractGraphicScene.h" +#include "WindowContext/AWindowContext.h" +#include "WindowContext/SdlContext/SdlContext.h" +#include "WindowContext/OffscreenContext/OffscreenContext.h" +#include "ApiContext/IApiContext.h" +#include "ApiContext/Metal/MetalContextFactory.h" +#include +#include + +// Just in case the ApiManager does not include the BasicContext +#include + +#include "ImguiRhiImplem.h" + +#if (PK_BUILD_WITH_OGL_SUPPORT != 0) +#include "ApiContext/OpenGL/GLContext.h" +#include +#endif + +#if (PK_BUILD_WITH_VULKAN_SUPPORT != 0) +# include "ApiContext/Vulkan/VulkanContext.h" +# include +#endif + +#if (PK_BUILD_WITH_D3D12_SUPPORT != 0) +# include "ApiContext/D3D/D3D12Context.h" +# include +#endif + +#if (PK_BUILD_WITH_D3D11_SUPPORT != 0) +# include "ApiContext/D3D/D3D11Context.h" +# include +#endif + +#if (PK_BUILD_WITH_ORBIS_SUPPORT != 0) +# include "WindowContext/OrbisContext/OrbisApplicationContext.h" +# include "ApiContext/Orbis/OrbisGraphicContext.h" +# include +#endif + +#if (PK_BUILD_WITH_UNKNOWN2_SUPPORT != 0) +# include "WindowContext/UNKNOWN2Context/UNKNOWN2ApplicationContext.h" +# include "ApiContext/UNKNOWN2/UNKNOWN2GraphicContext.h" +# include +#endif + +#if defined(PK_DURANGO) +# include "WindowContext/DurangoContext/DurangoApplicationContext.h" +# include "ApiContext/Durango/D3D11DurangoGraphicContext.h" +# include "ApiContext/Durango/D3D12DurangoGraphicContext.h" +#endif + +#if defined(PK_SCARLETT) + // TODO: Change this, Scarlett should NOT include Durango files. + // Prevents clean SDK separation when packaging SDKs and excluding platform files + // that are not validated by the vendor for the current licensee +# include "ApiContext/Durango/D3D12DurangoGraphicContext.h" +#endif + +#if defined(PK_GGP) +# include "WindowContext/GgpContext/GgpContext.h" +#endif + +#if defined(PK_GDK) +# include "WindowContext/GdkContext/GdkContext.h" +#endif + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CAbstractGraphicScene::CAbstractGraphicScene() +: m_UserInitCalled(false) +, m_TotalTime(0) +, m_Dt(0) +, m_FrameIdx(0) +, m_UseDirectDraw(false) +, m_RenderOffscreen(false) +#if PKSAMPLE_HAS_PROFILER_RENDERER +, m_ProfilerRenderer(null) +#endif +{ +} + +//---------------------------------------------------------------------------- + +CAbstractGraphicScene::~CAbstractGraphicScene() +{ + m_ApiContext = null; + m_WindowContext = null; +} + +//---------------------------------------------------------------------------- + +bool CAbstractGraphicScene::Init(RHI::EGraphicalApi api, bool forceDirectDraw/* = false*/, const CString &windowTitle /*= CString::EmptyString*/, bool renderOffscreen/* = false*/) +{ +#if (PK_BUILD_WITH_SDL != 0) + if (renderOffscreen) + m_WindowContext = PK_NEW(COffscreenContext); + else + m_WindowContext = PK_NEW(CSdlContext); +#elif defined(PK_DURANGO) && !defined(PK_GDK) + m_WindowContext = PK_NEW(CDurangoApplicationContext); +#elif defined(PK_GDK) + m_WindowContext = PK_NEW(CGdkWindowContext); +#elif defined(PK_GGP) + m_WindowContext = PK_NEW(CGgpContext); +#endif + if (api == RHI::GApi_Null) + { + m_ApiContext = null; + m_ApiManager = PK_NEW(RHI::CNullApiManager); + } +#if (PK_BUILD_WITH_VULKAN_SUPPORT != 0) + else if (api == RHI::GApi_Vulkan) + { + m_ApiContext = PK_NEW(CVulkanContext); + m_ApiManager = PK_NEW(RHI::CVulkanApiManager); + } +#endif +#if (PK_BUILD_WITH_METAL_SUPPORT != 0) + else if (api == RHI::GApi_Metal) + { + // We use a factory for metal because we cannot include the metal headers in cpp files (only in objc .mm files) + m_ApiContext = MetalFactory::CreateContext(); + m_ApiManager = MetalFactory::CreateApiManager(); + } +#endif +#if (PK_BUILD_WITH_OGL_SUPPORT != 0) + else if (api == RHI::GApi_OES) + { + m_ApiContext = PK_NEW(CGLContext(CGLContext::GL_OpenGLES)); + m_ApiManager = PK_NEW(RHI::COpenGLApiManager); + } + else if (api == RHI::GApi_OpenGL) + { + m_ApiContext = PK_NEW(CGLContext(CGLContext::GL_OpenGL)); + m_ApiManager = PK_NEW(RHI::COpenGLApiManager); + } +#endif +#if (PK_BUILD_WITH_ORBIS_SUPPORT != 0) + else if (api == RHI::GApi_Orbis) + { + m_WindowContext = PK_NEW(COrbisApplicationContext); + m_ApiContext = PK_NEW(COrbisGraphicContext); + m_ApiManager = PK_NEW(RHI::COrbisApiManager); + } +#endif +#if (PK_BUILD_WITH_UNKNOWN2_SUPPORT != 0) + else if (api == RHI::GApi_UNKNOWN2) + { + m_WindowContext = PK_NEW(CUNKNOWN2ApplicationContext); + m_ApiContext = PK_NEW(CUNKNOWN2GraphicContext); + m_ApiManager = PK_NEW(RHI::CUNKNOWN2ApiManager); + } +#endif +#if (PK_BUILD_WITH_D3D12_SUPPORT != 0) + else if (api == RHI::GApi_D3D12) + { +# if defined(PK_DURANGO) || defined(PK_SCARLETT) + m_ApiContext = PK_NEW(CD3D12DurangoGraphicContext); +# else + m_ApiContext = PK_NEW(CD3D12Context); +# endif // defined(PK_DURANGO) + m_ApiManager = PK_NEW(RHI::CD3D12ApiManager); + } +#endif // (PK_BUILD_WITH_D3D12_SUPPORT != 0) +#if (PK_BUILD_WITH_D3D11_SUPPORT != 0) + else if (api == RHI::GApi_D3D11) + { +# if defined(PK_DURANGO) + m_ApiContext = PK_NEW(CD3D11DurangoGraphicContext); +# else + m_ApiContext = PK_NEW(CD3D11Context); +# endif + m_ApiManager = PK_NEW(RHI::CD3D11ApiManager); + } +#endif // (PK_BUILD_WITH_D3D11_SUPPORT != 0) + else + { + PK_ASSERT_NOT_REACHED(); + } + // Check allocs + if (m_WindowContext == null || m_ApiManager == null) + return false; + + // Init window context + if (!m_WindowContext->Init(api, windowTitle)) + { + CLog::Log(PK_ERROR, "m_WindowContext->Init failed"); + return false; + } + // Init IMGUI + if (!renderOffscreen && !m_WindowContext->InitImgui(m_ApiManager)) + { + CLog::Log(PK_ERROR, "m_WindowContext->InitImgui failed"); + return false; + } + + m_UseDirectDraw = m_ApiManager->ApiDesc().m_SupportImmediateCommandBuffers && + (forceDirectDraw || !m_ApiManager->ApiDesc().m_SupportDeferredCommandBuffers); + + m_RenderOffscreen = renderOffscreen; + + if (m_ApiContext == null) + { + CLog::Log(PK_ERROR, "m_ApiContext is null"); + return false; + } +#if defined(PK_DEBUG) + if (!m_ApiContext->InitRenderApiContext(true, m_WindowContext)) +#else + if (!m_ApiContext->InitRenderApiContext(false, m_WindowContext)) +#endif + { + CLog::Log(PK_ERROR, "m_ApiContext->InitRenderApiContext failed"); + return false; + } + if (!m_ApiManager->InitApi(m_ApiContext->GetRenderApiContext())) + { + CLog::Log(PK_ERROR, "m_ApiManager->InitApi failed"); + return false; + } + m_SwapChainRenderTargets = m_ApiContext->GetCurrentSwapChain(); + if (m_SwapChainRenderTargets.Empty()) + { + CLog::Log(PK_ERROR, "m_SwapChainRenderTargets is empty"); + return false; + } + +#if PKSAMPLE_HAS_PROFILER_RENDERER + m_ProfilerRenderer = PK_NEW(CProfilerRenderer); + if (m_ProfilerRenderer == null) + return false; + m_WindowContext->RegisterProfiler(m_ProfilerRenderer); +#endif + // We process the events in the case where the window is resized on the first frame: + // we must have at least one end frame after the UserInit() and after the SwapChainSizeChanged() + m_WindowContext->ProcessEvents(); + + m_UserInitCalled = true; + return UserInit(); +} + +//---------------------------------------------------------------------------- + +bool CAbstractGraphicScene::Run() +{ + bool exitSample = false; + + if (!CreateRenderTargets(false) || + !CreateRenderPasses() || + !CreateRenderStates() || + !CreateFrameBuffers(false)) + return false; + + if (!m_UseDirectDraw) + { + for (u32 i = 0; i < m_SwapChainRenderTargets.Count(); ++i) + { + if (!CreateCommandBuffers(false, i)) + return false; + } + } + + if (!LateUserInit()) + return false; + + // Main loop + m_FrameTimer.Start(); + + while (!exitSample) + { +#if PKSAMPLE_HAS_PROFILER_RENDERER + m_ProfilerRenderer->ProfilerNextFrameTick(); + { + PK_NAMEDSCOPEDPROFILE("Profiler Overhead"); + CUint2 drawSize = m_SwapChainRenderTargets.First()->GetSize(); + float pxlRatio = 1.0f; + + if (drawSize != m_WindowContext->GetWindowSize()) + { + drawSize = m_WindowContext->GetWindowSize(); + pxlRatio = m_WindowContext->GetPixelRatio(); + } + m_ProfilerRenderer->GenerateProfilerRenderData( m_Dt, + CIRect(CInt2(0), + CInt2(drawSize)), + m_WindowContext->GetMousePosition(), + pxlRatio); + m_ProfilerRenderer->LockAndCopyProfilerData(m_ProfilerData); + } +#endif + + PK_NAMEDSCOPEDPROFILE_C("MainLoop", CFloat3(0.2f, 0.2f, 0.2f)); + + m_Dt = m_FrameTimer.Restart(); + + m_TotalTime += m_Dt; + ++m_FrameIdx; + + exitSample = !m_WindowContext->ProcessEvents(); + + if (m_WindowContext->HasWindowChanged()) + { + // Recreate the swap chain + m_ApiContext->RecreateSwapChain(m_WindowContext->GetDrawableSize()); + // Notify the api manager that the swap chain was changed + m_ApiManager->SwapChainChanged(0); + m_SwapChainRenderTargets = m_ApiContext->GetCurrentSwapChain(); + if (m_SwapChainRenderTargets.Empty()) + return false; + + if (!CreateRenderTargets(true) || + !CreateFrameBuffers(true)) + return false; + + if (!m_UseDirectDraw) + { + for (u32 i = 0; i < m_SwapChainRenderTargets.Count(); ++i) + { + if (!CreateCommandBuffers(false, i)) + return false; + } + } + } + + if (m_WindowContext->WindowHidden()) + { + continue; + } + + CGuid swapChainIdx; + { + PK_NAMEDSCOPEDPROFILE_C("ApiContext::BeginFrame", CFloat3(0, 0, 0.5f)); + // Only waits for the presentation + swapChainIdx = m_ApiContext->BeginFrame(); + if (!swapChainIdx.Valid()) + { + CLog::Log(PK_ERROR, "m_ApiContext->BeginFrame() failure"); + return false; + } + } + { + PK_NAMEDSCOPEDPROFILE_C("ApiManager::BeginFrame", CFloat3(0.3f, 0.3f, 1)); + m_ApiManager->BeginFrame(swapChainIdx); + } + { + PK_NAMEDSCOPEDPROFILE("DrawHUD"); + if (!m_RenderOffscreen) + DrawHUD(); + } + { + PK_NAMEDSCOPEDPROFILE_C("Update", CFloat3(1, 0, 1)); + if (!Update()) + return false; + } + { + if (m_UseDirectDraw) + { + PK_NAMEDSCOPEDPROFILE_C("CreateImmediateCommandBuffers", CFloat3(0, 1, 0)); + if (!CreateCommandBuffers(true, swapChainIdx)) + return false; + } + else if (!SubmitCommandBuffers(swapChainIdx)) + { + return false; + } + } + { + PK_NAMEDSCOPEDPROFILE_C("PostRender", CFloat3(0.5f, 0, 0.5f)); + if (!PostRender()) + return false; + } + void *renderFinished; + { + PK_NAMEDSCOPEDPROFILE_C("ApiManager::EndFrame()", CFloat3(1, 0.3f, 0.3f)); + renderFinished = m_ApiManager->EndFrame(); + } + { + PK_NAMEDSCOPEDPROFILE_C("ApiContext::EndFrame()", CFloat3(0.5f, 0, 0)); + if (!m_ApiContext->EndFrame(renderFinished)) + { + CLog::Log(PK_ERROR, "m_ApiContext->EndFrame() failure"); + return false; + } + } + + // TODO: Rethink this info display +#if 0//(PK_BUILD_WITH_GPU_PROFILING_SUPPORT != 0) + RHI::PMemoryUsage usedMemory = m_ApiContext->GetRenderApiContext()->m_UsedMemory; + const u64 totalMemory = usedMemory->GetUsedMemory(); + if (fmodf(m_TotalTime, 10.f) <= m_Dt) + { + CLog::Log( PK_INFO, + "GPU Memory used:\n\tBuffers \t%lld\n\tTextures\t%lld\n\tRT\t\t\t%lld\n\tTotal\t\t%lld", + usedMemory->GetUsedBuffers(), usedMemory->GetUsedTextures(), usedMemory->GetUsedRenderTargets(), totalMemory); + } +#endif + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CAbstractGraphicScene::CreateCommandBuffers(bool immediateMode, u32 swapImgIdx) +{ + RHI::PCommandBuffer cmdBuff; + if (immediateMode) + { + cmdBuff = m_ApiManager->GetCurrentImmediateCommandBuffer(); + } + else + { + cmdBuff = m_ApiManager->CreateCommandBuffer(RHI::SRHIResourceInfos("Abstract Graphics Scene Command Buffer")); + if (m_CommandBuffers.Count() != m_SwapChainRenderTargets.Count() && + !m_CommandBuffers.Resize(m_SwapChainRenderTargets.Count())) + return false; + m_CommandBuffers[swapImgIdx] = cmdBuff; + } + + if (cmdBuff != null) + FillCommandBuffer(cmdBuff, swapImgIdx); + + return cmdBuff != null; +} + +//---------------------------------------------------------------------------- + +bool CAbstractGraphicScene::SubmitCommandBuffers(u32 swapImgIdx) +{ + return m_ApiManager->SubmitCommandBufferDirect(m_CommandBuffers[swapImgIdx]); +} + +//---------------------------------------------------------------------------- + +bool CAbstractGraphicScene::Quit() +{ + bool success = true; + + if (m_ApiContext != null) + success &= m_ApiContext->WaitAllRenderFinished(); + + m_GpuBuffers.Clear(); + m_CommandBuffers.Clear(); + if (m_ApiManager != null) + success &= m_ApiManager->DestroyApi(); + + // Only call user quit when all async api operations are finished & when all used resources references are released. + if (m_UserInitCalled) + { + success &= UserQuit(); + m_UserInitCalled = false; + } + + m_GpuBuffers.Clear(); + m_CommandBuffers.Clear(); + if (m_WindowContext != null) + m_WindowContext->Destroy(); + +#if PKSAMPLE_HAS_PROFILER_RENDERER + if (m_ProfilerRenderer != null) + PK_SAFE_DELETE(m_ProfilerRenderer); +#endif + success &= m_ShaderLoader.Release(); + return success; +} + +//---------------------------------------------------------------------------- + +bool CAbstractGraphicScene::UserQuit() +{ + return true; +} + +//---------------------------------------------------------------------------- + +RHI::EGraphicalApi CAbstractGraphicScene::GetGraphicApiName() const +{ + PK_ASSERT(m_ApiContext != null); + PK_ASSERT(m_ApiContext->GetRenderApiContext() != null); + return m_ApiContext->GetRenderApiContext()->m_Api; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/AbstractGraphicScene.h b/Samples/PK-SampleLib/SampleScene/AbstractGraphicScene.h new file mode 100644 index 00000000..08388fde --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/AbstractGraphicScene.h @@ -0,0 +1,94 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" +#include "PK-SampleLib/ShaderLoader.h" +#include "PK-SampleLib/ProfilerRenderer.h" // for PKSAMPLE_HAS_PROFILER_RENDERER. TODO: DO NOT define configuration macros in general headers, forces code to #include all those headers even if it just cares about #ifdefing stuff out. Make configuration headers like in the runtime ! + +#include "pk_rhi/include/interfaces/IFrameBuffer.h" +#include "pk_rhi/include/interfaces/ICommandBuffer.h" +#include "pk_rhi/include/interfaces/IRenderTarget.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +PK_FORWARD_DECLARE(AbstractWindowContext); +PK_FORWARD_DECLARE_INTERFACE(ApiContext); + +//---------------------------------------------------------------------------- + +class CAbstractGraphicScene +{ +public: + CAbstractGraphicScene(); + virtual ~CAbstractGraphicScene(); + + virtual bool Init(RHI::EGraphicalApi api, bool forceDirectDraw = false, const CString &windowTitle = CString::EmptyString, bool renderOffscreen = false); + virtual bool Run(); + virtual bool Quit(); + +protected: + virtual bool UserInit() = 0; + virtual bool LateUserInit() { return true; } + virtual bool UserQuit(); + + virtual bool CreateRenderTargets(bool recreateSwapChain) = 0; + virtual bool CreateRenderPasses() = 0; + virtual bool CreateRenderStates() = 0; + virtual bool CreateFrameBuffers(bool recreateSwapChain) = 0; + + // Create a single buffer, can be override + virtual bool CreateCommandBuffers(bool immediateMode, u32 swapImgIdx); + virtual void FillCommandBuffer(const RHI::PCommandBuffer &cmdBuff, u32 swapImgIdx) = 0; + + // Called for deferred command buffers + virtual bool SubmitCommandBuffers(u32 swapImgIdx); + + virtual void DrawHUD() { }; + virtual bool Update() = 0; + virtual bool PostRender() = 0; + + RHI::EGraphicalApi GetGraphicApiName() const; + + bool m_UserInitCalled; + + // the window context handles the window and the inputs + PAbstractWindowContext m_WindowContext; + // The Api manager is used to draw + RHI::PApiManager m_ApiManager; + // The Api context handles the initialization of the Api + PApiContext m_ApiContext; + + // Bunch of command buffer when using defered command buffers + TArray m_CommandBuffers; + + TMemoryView m_SwapChainRenderTargets; + TArray m_GpuBuffers; + + CShaderLoader m_ShaderLoader; + + CTimer m_FrameTimer; + float m_TotalTime; + float m_Dt; + u32 m_FrameIdx; + + bool m_UseDirectDraw; + bool m_RenderOffscreen; + +#if (PKSAMPLE_HAS_PROFILER_RENDERER == 1) + CProfilerRenderer *m_ProfilerRenderer; + CProfilerRenderer::SProfilerRenderData m_ProfilerData; +#endif +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/DeferredScene.cpp b/Samples/PK-SampleLib/SampleScene/DeferredScene.cpp new file mode 100644 index 00000000..653a2215 --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/DeferredScene.cpp @@ -0,0 +1,1040 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "DeferredScene.h" +#include "SampleUtils.h" +#include "WindowContext/AWindowContext.h" +#include "ShaderDefinitions/SampleLibShaderDefinitions.h" +#include "ShaderDefinitions/UnitTestsShaderDefinitions.h" +#include "RenderIntegrationRHI/RendererCache.h" +#include "BRDFLUT.h" +#include "ImguiRhiImplem.h" +#include "imgui.h" + +#include + +//---------------------------------------------------------------------------- + +#define FULL_SCREEN_QUAD_VERTEX_SHADER_PATH "./Shaders/FullScreenQuad.vert" +#define COPY_FRAGMENT_SHADER_PATH "./Shaders/Copy.frag" +#define DITHERING_PATTERNS_TEXTURE_PATH "./Textures/DitheringPatterns.png" + +#define CAMERA_NEAR_PLANE 1.0e-1f +#define CAMERA_FAR_PLANE 1.0e+3f + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CDeferredScene::CDeferredScene() +: m_CameraGUI_Distance(0) +, m_CameraGUI_Angles(0) +, m_CameraGUI_LookatPosition(0) +, m_CameraFlag_ResetProj(false) +, m_BackgroundColorRGB(CFloat3::ZERO) +, m_IsInit(false) +, m_Controller(null) +, m_PrevMousePosition(0) +, m_UserMaxBloomRenderPass(6) +, m_MaxBloomRenderPass(0) +, m_DisplayFpsAccTime(0) +, m_DisplayFpsAccFrames(0) +, m_DisplayFps(TNumericTraits::PositiveInfinity()) +, m_RtToDraw(RenderTarget_Scene) +, m_ShowAlpha(false) +{ + m_Controller = File::NewFileSystem(); + m_Controller->MountPack("UnitTests"); + m_ShaderLoader.SetDefaultFSController(m_Controller); +} + +//---------------------------------------------------------------------------- + +CDeferredScene::~CDeferredScene() +{ + PKSample::CRendererCacheInstance_UpdateThread::RenderThread_DestroyAllResources(); + PK_DELETE(m_Controller); +} + +//---------------------------------------------------------------------------- + +RHI::PRenderState CDeferredScene::GetGBufferMaterial(EGBufferCombination matCombination) const +{ + if (matCombination < GBufferCombination_Count) + return m_GBuffer.m_GBufferMaterials[matCombination]; + return null; +} + +//---------------------------------------------------------------------------- + +bool CDeferredScene::InitIFN() +{ + if (m_IsInit) + return true; + + // -------------------------------------- + // Create default sampler + // -------------------------------------- + CreateSimpleSamplerConstSetLayouts(m_DefaultSamplerConstLayout, false); + if (m_DefaultSampler == null) + m_DefaultSampler = m_ApiManager->CreateConstantSampler(RHI::SRHIResourceInfos("Default Sampler"), RHI::SampleLinear, RHI::SampleLinear, RHI::SampleClampToEdge, RHI::SampleClampToEdge, RHI::SampleClampToEdge, 1); + if (m_DefaultSampler == null) + return false; + // -------------------------------------- + + // -------------------------------------- + // Create scene info + // -------------------------------------- + { + if (!CreateSceneInfoConstantLayout(m_SceneInfoConstantSetLayout)) + return false; + + const RHI::SConstantBufferDesc &sceneInfoBufferDesc = m_SceneInfoConstantSetLayout.m_Constants.First().m_ConstantBuffer; + + m_SceneInfoConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("SceneInfos Constant Set"), m_SceneInfoConstantSetLayout); + if (!PK_VERIFY(m_SceneInfoConstantSet != null)) + return false; + + const u32 constantBufferSize = sceneInfoBufferDesc.m_ConstantBufferSize; // We could also create the new one based on the default one created + PK_ASSERT(constantBufferSize == sizeof(PKSample::SSceneInfoData)); + m_SceneInfoConstantBuffer = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("SceneInfos Constant Buffer"), RHI::ConstantBuffer, constantBufferSize); + if (!PK_VERIFY(m_SceneInfoConstantBuffer != null)) + return false; + if (!PK_VERIFY(m_SceneInfoConstantSet->SetConstants(m_SceneInfoConstantBuffer, 0))) + return false; + if (!PK_VERIFY(m_SceneInfoConstantSet->UpdateConstantValues())) + return false; + // Update scene info: + Utils::SetupSceneInfoData(m_SceneInfoData, GetCamera().Camera(), CCoordinateFrame::GlobalFrame()); + } + // -------------------------------------- + + // Init render-pass: gbuffer + if (!m_GBuffer.Init(m_ApiManager, m_DefaultSampler, m_DefaultSamplerConstLayout, m_SceneInfoConstantSetLayout)) + return false; + + // Init render-pass: distortion + m_Distortion.SetChromaticAberrationIntensity(m_SceneOptions.m_Distortion.m_DistortionIntensity); + m_Distortion.SetAberrationMultipliers(m_SceneOptions.m_Distortion.m_ChromaticAberrationMultipliers); + if (!m_Distortion.Init(m_ApiManager, m_GBuffer.m_QuadBuffers.m_VertexBuffers[0], m_DefaultSampler, m_DefaultSamplerConstLayout)) + return false; + + // Init render-pass: Bloom + if (!m_Bloom.Init(m_ApiManager, m_GBuffer.m_QuadBuffers.m_VertexBuffers[0])) + return false; + + // Init render-pass: tone-mapping (+ vignetting) + m_ToneMapping.SetExposure(m_SceneOptions.m_ToneMapping.m_Exposure); + m_ToneMapping.SetSaturation(m_SceneOptions.m_ToneMapping.m_Saturation); + if (!m_ToneMapping.Init(m_ApiManager, m_GBuffer.m_QuadBuffers.m_VertexBuffers[0], m_DefaultSampler, m_DefaultSamplerConstLayout)) + return false; + + // Initialize the camera + m_Camera.SetProj(60, CFloat2(m_WindowContext->GetDrawableSize()), CAMERA_NEAR_PLANE, CAMERA_FAR_PLANE); + UpdateCamera(); + + m_PrevMousePosition = m_WindowContext->GetMousePosition(); + + // Load default assets, fixme: use default manager and unload + if (STextureKey::s_DefaultResourceID.Valid() || + SGeometryKey::s_DefaultResourceID.Valid()) + { + const CString rootPath = m_Controller->VirtualToPhysical(CString::EmptyString, IFileSystem::Access_Read); + const SCreateArg args(m_ApiManager, null, Resource::DefaultManager(), rootPath); + + if (STextureKey::s_DefaultResourceID.Valid()) + CTextureManager::RenderThread_ResolveResource(STextureKey::s_DefaultResourceID, args); + if (SGeometryKey::s_DefaultResourceID.Valid()) + CGeometryManager::RenderThread_ResolveResource(SGeometryKey::s_DefaultResourceID, args); + } + + // -------------------------------------- + // Create default textures used for rendering + // -------------------------------------- + // Load a white dummy cube texture + u32 white = 0xFFFFFFFF; + CImageMap dummyWhite(CUint3::ONE, &white, sizeof(u32)); + CImageMap dummyCube[6]; + for (u32 i = 0; i < 6; i++) + dummyCube[i] = dummyWhite; + m_DummyCube = m_ApiManager->CreateTexture(RHI::SRHIResourceInfos("Dummy Cube Texture"), dummyCube, RHI::FormatUnorm8RGBA, RHI::kDefaultComponentSwizzle, RHI::TextureCubemap); + if (!PK_VERIFY(m_DummyCube != null)) + return false; + m_DummyWhite = m_ApiManager->CreateTexture(RHI::SRHIResourceInfos("Dummy White Texture"), TMemoryView(dummyWhite), RHI::FormatUnorm8RGBA, RHI::kDefaultComponentSwizzle, RHI::Texture2D); + if (!PK_VERIFY(m_DummyWhite != null)) + return false; + // Create the sampler + m_DummyCubeSampler = m_ApiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Dummy Cube Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleRepeat, + RHI::SampleRepeat, + RHI::SampleRepeat, + m_DummyCube->GetMipmapCount()); + // Cubemap rotation matrix + RHI::PGpuBuffer cubemapRotation = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("CubemapRotation"), RHI::ConstantBuffer, sizeof(TMatrix)); + TMatrix *data = static_cast*>(m_ApiManager->MapCpuView(cubemapRotation)); + *data = TMatrix(CFloat4(0, 0, 0, 0), CFloat4(0, 0, 0, 0)); + m_ApiManager->UnmapCpuView(cubemapRotation); + + // Create the constant set + m_DummyCubeConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Dummy Cube Constant Set"), GetGBuffer().m_EnvironmentMapLayout); + if (!PK_VERIFY(m_DummyCubeConstantSet != null)) + return false; + m_DummyCubeConstantSet->SetConstants(m_DummyCubeSampler, m_DummyCube, 0); + m_DummyCubeConstantSet->SetConstants(cubemapRotation, 1); + m_DummyCubeConstantSet->UpdateConstantValues(); + + // Load BRDF LUT + const CImageMap mipmaps[] = { CImageMap(CUint3(64, 64, 1), (void*)BRDFLUTArray, BRDFLUTArraySize) }; + PK_STATIC_ASSERT(BRDFLUTArraySize == 64 * 64 * 2 * 2); + RHI::PTexture BRDFLUT = m_ApiManager->CreateTexture(RHI::SRHIResourceInfos("BRDFLUT Texture"), mipmaps, RHI::FormatFloat16RG); + if (!PK_VERIFY(BRDFLUT != null)) + return false; + // Create the sampler + RHI::PConstantSampler BRDFLUTSampler = m_ApiManager->CreateConstantSampler( RHI::SRHIResourceInfos("BRDFLUT Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + 1); + // Create the constant set + m_BRDFLUTConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("BRDFLUT Constant Set"), GetGBuffer().m_BRDFLUTLayout); + if (!PK_VERIFY(m_BRDFLUTConstantSet != null)) + return false; + m_BRDFLUTConstantSet->SetConstants(BRDFLUTSampler, BRDFLUT, 0); + m_BRDFLUTConstantSet->UpdateConstantValues(); + + // Init noise texture + RHI::PConstantSampler sampler = m_ApiManager->CreateConstantSampler(RHI::SRHIResourceInfos("Dithering Sampler"), + RHI::SampleNearest, + RHI::SampleNearest, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + 1); + + STextureKey textureKey; + textureKey.m_Path = DITHERING_PATTERNS_TEXTURE_PATH; + CTextureManager::CResourceId textureId = CTextureManager::UpdateThread_GetResource(textureKey, SPrepareArg(null, null, null)); + if (!textureId.Valid()) + return false; + + const CString rootPath = m_Controller->VirtualToPhysical(CString::EmptyString, IFileSystem::Access_Read); + const SCreateArg args(m_ApiManager, null, Resource::DefaultManager(), rootPath); + RHI::PTexture ditheringtexture = CTextureManager::RenderThread_ResolveResource(textureId, args); + if (ditheringtexture == null) + return false; + + m_NoiseTexture.m_NoiseTexture = ditheringtexture; + m_NoiseTexture.m_NoiseTextureConstantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Dithering Constant Set"), SConstantNoiseTextureKey::GetNoiseTextureConstantSetLayout()); + m_NoiseTexture.m_NoiseTextureConstantSet->SetConstants(sampler, m_NoiseTexture.m_NoiseTexture, 0); + m_NoiseTexture.m_NoiseTextureConstantSet->UpdateConstantValues(); + + // -------------------------------------- + + m_IsInit = true; + return true; +} + +//---------------------------------------------------------------------------- + +bool CDeferredScene::CreateRenderTargets(bool recreateSwapChain) +{ + (void)recreateSwapChain; + return true; +} + +//---------------------------------------------------------------------------- + +bool CDeferredScene::CreateRenderPasses() +{ + return true; +} + +//---------------------------------------------------------------------------- + +bool CDeferredScene::CreateRenderStates() +{ + return true; +} + +//---------------------------------------------------------------------------- + +bool CDeferredScene::CreateFrameBuffers(bool recreateSwapChain) +{ + if (!recreateSwapChain && !InitIFN()) + return false; + + if (!PK_VERIFY(!m_SwapChainRenderTargets.Empty())) + return false; + + UpdateMaxBloomRTs(); + + // Reset the size + m_Camera.SetProj(60, CFloat2(m_WindowContext->GetDrawableSize()), CAMERA_NEAR_PLANE, CAMERA_FAR_PLANE); + UpdateCamera(); + + const CUint2 frameBufferSize = m_SwapChainRenderTargets[0]->GetSize(); + + m_BeforeBloomClearValues.Clear(); + m_FinalClearValues.Clear(); + m_FinalFrameBuffers.Clear(); + m_BeforeBloomFrameBuffer = null; + + // Create the frame buffers and the render passes: + TArray beforeBloomLoadOp; + TArray finalLoadOp; + + m_BeforeBloomFrameBuffer = m_ApiManager->CreateFrameBuffer(RHI::SRHIResourceInfos("BeforeBloom Frame Buffer")); + + if (!PK_VERIFY(m_BeforeBloomFrameBuffer != null)) + return false; + + if (!PK_VERIFY(m_FinalFrameBuffers.Resize(m_SwapChainRenderTargets.Count()))) + return false; + + for (u32 i = 0; i < m_FinalFrameBuffers.Count(); ++i) + { + m_FinalFrameBuffers[i] = m_ApiManager->CreateFrameBuffer(RHI::SRHIResourceInfos("Final Frame Buffer")); + if (!PK_VERIFY(m_FinalFrameBuffers[i] != null)) + return false; + if (!PK_VERIFY(m_FinalFrameBuffers[i]->AddRenderTarget(m_SwapChainRenderTargets[i]))) + return false; + } + if (!PK_VERIFY(finalLoadOp.PushBack(RHI::LoadDontCare).Valid())) + return false; + + if (!recreateSwapChain) + { + m_BeforeBloomRenderPass = m_ApiManager->CreateRenderPass(RHI::SRHIResourceInfos("BeforeBloom Render Pass")); + m_FinalRenderPass = m_ApiManager->CreateRenderPass(RHI::SRHIResourceInfos("Final Render Pass")); + + if (!PK_VERIFY(m_BeforeBloomRenderPass != null && m_FinalRenderPass != null)) + return false; + } + + // ------------------------------------------ + // + // GBUFFER + // + // ------------------------------------------ + for (u32 i = 0; i < m_GBufferRTs.Count(); ++i) + { + m_GBufferRTsIdx[i] = m_BeforeBloomFrameBuffer->GetRenderTargets().Count(); + if (!PK_VERIFY(m_GBufferRTs[i].CreateRenderTarget( RHI::SRHIResourceInfos("GBuffer Render Target"), + m_ApiManager, + m_DefaultSampler, + SPassDescription::s_GBufferDefaultFormats[i], + frameBufferSize, + m_DefaultSamplerConstLayout))) + { + return false; + } + if (!PK_VERIFY(m_BeforeBloomFrameBuffer->AddRenderTarget(m_GBufferRTs[i].m_RenderTarget))) + return false; + } + + // ------------------------------------------ + // Add the clear operations: + // ------------------------------------------ + // GBuffer 0: Diffuse HDR + if (!PK_VERIFY(m_BeforeBloomClearValues.PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + if (!PK_VERIFY(beforeBloomLoadOp.PushBack(RHI::LoadClear).Valid())) + return false; + // GBuffer 1: Depth + if (!PK_VERIFY(m_BeforeBloomClearValues.PushBack(RHI::SFrameBufferClearValue(1.f, 1.f, 1.f, 1.f)).Valid())) + return false; + if (!PK_VERIFY(beforeBloomLoadOp.PushBack(RHI::LoadClear).Valid())) + return false; + // GBuffer 2: Emissive HDR + if (!PK_VERIFY(m_BeforeBloomClearValues.PushBack(RHI::SFrameBufferClearValue(0.f, 0.f, 0.f, 0.f)).Valid())) + return false; + if (!PK_VERIFY(beforeBloomLoadOp.PushBack(RHI::LoadClear).Valid())) + return false; + + CGBuffer::SInOutRenderTargets gbuffInOut; + + gbuffInOut.m_SamplableDiffuseRtIdx = m_GBufferRTsIdx[0]; + gbuffInOut.m_SamplableDiffuseRt = &m_GBufferRTs[0]; + gbuffInOut.m_SamplableDepthRtIdx = m_GBufferRTsIdx[1]; + gbuffInOut.m_SamplableDepthRt = &m_GBufferRTs[1]; + gbuffInOut.m_OpaqueRTsIdx = m_GBufferRTsIdx; + gbuffInOut.m_OpaqueRTs = m_GBufferRTs; + + m_GBuffer.SetClearMergeBufferColor(m_BackgroundColorRGB.xyz1()); + if (!PK_VERIFY(m_GBuffer.UpdateFrameBuffer( TMemoryView(m_BeforeBloomFrameBuffer), + beforeBloomLoadOp, + m_BeforeBloomClearValues, + true, + &gbuffInOut))) + return false; + if (!recreateSwapChain) + { + if (!PK_VERIFY(m_GBuffer.AddSubPasses(m_BeforeBloomRenderPass, &gbuffInOut))) + return false; + } + + // ------------------------------------------ + // + // DISTORTION + // + // ------------------------------------------ + CPostFxDistortion::SInOutRenderTargets distoInOut; + + distoInOut.m_ToDistordRtIdx = m_GBuffer.m_MergeBufferIndex; + distoInOut.m_ToDistordRt = &m_GBuffer.m_Merge; + distoInOut.m_DepthRtIdx = m_GBuffer.m_DepthBufferIndex; + distoInOut.m_ParticleInputs = m_GBufferRTsIdx; + if (!PK_VERIFY(m_Distortion.UpdateFrameBuffer( TMemoryView(m_BeforeBloomFrameBuffer), + beforeBloomLoadOp, + m_BeforeBloomClearValues, + &distoInOut))) + return false; + if (!recreateSwapChain) + { + if (!PK_VERIFY(m_Distortion.AddSubPasses(m_BeforeBloomRenderPass, &distoInOut))) + return false; + } + + // ------------------------------------------ + // + // BLOOM + // + // ------------------------------------------ + CPostFxBloom::SInOutRenderTargets bloomInOut; + + bloomInOut.m_InputRenderTarget = &m_Distortion.m_OutputRenderTarget; + bloomInOut.m_OutputRenderTargets = TMemoryView(bloomInOut.m_InputRenderTarget->m_RenderTarget); + if (!PK_VERIFY(m_Bloom.UpdateFrameBuffer(m_DefaultSampler, m_UserMaxBloomRenderPass, &bloomInOut))) + return false; + if (!recreateSwapChain) + { + if (!PK_VERIFY(m_Bloom.CreateRenderPass())) + return false; + } + if (!PK_VERIFY(m_Bloom.CreateFrameBuffers())) + return false; + + // ------------------------------------------ + // + // TONE-MAPPING + VIGNETTING + // + // ------------------------------------------ + CPostFxToneMapping::SInOutRenderTargets tonemapInOut; + + tonemapInOut.m_ToTonemapRt = &m_Distortion.m_OutputRenderTarget; + if (!PK_VERIFY(m_ToneMapping.UpdateFrameBuffer(m_FinalFrameBuffers, finalLoadOp, m_FinalClearValues, &tonemapInOut))) + return false; + if (!recreateSwapChain) + { + if (!PK_VERIFY(m_ToneMapping.AddSubPasses(m_FinalRenderPass, &tonemapInOut))) + return false; + } + + // ------------------------------------------ + // + // FINAL COPY / DEBUG PASS + // + // ------------------------------------------ + // We add the GBuffer depth in the final frame buffers: + CGuid finalFrameBufferDepthIdx = m_FinalFrameBuffers.First()->GetRenderTargets().Count(); + for (u32 i = 0; i < m_FinalFrameBuffers.Count(); ++i) + { + if (!PK_VERIFY(m_FinalFrameBuffers[i]->AddRenderTarget(m_GBuffer.m_Depth.m_RenderTarget))) + return false; + } + if (!PK_VERIFY(finalLoadOp.PushBack(RHI::LoadKeepValue).Valid())) + return false; + + RHI::SSubPassDefinition finalSubPass; + + if (!PK_VERIFY(finalSubPass.m_InputRenderTargets.PushBack(m_ToneMapping.m_OutputRenderTargetIdx).Valid())) + return false; + if (!PK_VERIFY(finalSubPass.m_OutputRenderTargets.PushBack(0).Valid())) + return false; + finalSubPass.m_DepthStencilRenderTarget = finalFrameBufferDepthIdx; + if (!recreateSwapChain) + { + if (!PK_VERIFY(m_FinalRenderPass->AddRenderSubPass(finalSubPass))) + return false; + } + // Bake the frame buffers and the render passes: + if (!recreateSwapChain) + { + if (!PK_VERIFY(m_BeforeBloomRenderPass->BakeRenderPass(m_BeforeBloomFrameBuffer->GetLayout(), beforeBloomLoadOp))) + return false; + } + if (!PK_VERIFY(m_BeforeBloomFrameBuffer->BakeFrameBuffer(m_BeforeBloomRenderPass))) + return false; + if (!recreateSwapChain) + { + if (!PK_VERIFY(m_FinalRenderPass->BakeRenderPass(m_FinalFrameBuffers.First()->GetLayout(), finalLoadOp))) + return false; + } + for (u32 i = 0; i < m_FinalFrameBuffers.Count(); ++i) + { + if (!PK_VERIFY(m_FinalFrameBuffers[i]->BakeFrameBuffer(m_FinalRenderPass))) + return false; + } + + if (!recreateSwapChain) + { + // Create the render states: + if (!PK_VERIFY(m_GBuffer.CreateRenderStates(m_BeforeBloomFrameBuffer->GetLayout(), m_ShaderLoader, m_BeforeBloomRenderPass))) + return false; + if (!PK_VERIFY(m_Distortion.CreateRenderStates(m_BeforeBloomFrameBuffer->GetLayout(), m_ShaderLoader, m_BeforeBloomRenderPass))) + return false; + if (!PK_VERIFY(m_Bloom.CreateRenderStates(m_ShaderLoader, m_SceneOptions.m_Bloom.m_BlurTap))) + return false; + if (!PK_VERIFY(m_ToneMapping.CreateRenderStates(m_FinalFrameBuffers.First()->GetLayout(), m_ShaderLoader, m_FinalRenderPass))) + return false; + // Now we create the render states: + if (!PK_VERIFY(CreateDebugCopyRenderStates())) + return false; + } + if (!m_RenderOffscreen && !PK_VERIFY(ImGuiPkRHI::CreateRenderInfo(m_ApiManager, m_ShaderLoader, m_FinalFrameBuffers.First()->GetLayout(), m_FinalRenderPass, 1))) + return false; +#if PKSAMPLE_HAS_PROFILER_RENDERER + if (!PK_VERIFY(m_ProfilerRenderer->CreateRenderInfo(m_ApiManager, m_ShaderLoader, m_FinalFrameBuffers.First()->GetLayout(), m_FinalRenderPass, 1))) + return false; +#endif + return true; +} + +//---------------------------------------------------------------------------- + +bool CDeferredScene::CreateDebugCopyRenderStates() +{ + //------------------------------- + // DEBUG COPY PASS + //------------------------------- + m_CopyAlphaRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("CopyAlpha Render State")); + m_CopyColorRenderState = m_ApiManager->CreateRenderState(RHI::SRHIResourceInfos("CopyColor Render State")); + if (m_CopyAlphaRenderState == null || m_CopyColorRenderState == null) + return false; + + RHI::SRenderState &debugCopyColorRenderState = m_CopyColorRenderState->m_RenderState; + RHI::SRenderState &debugCopyAlphaRenderState = m_CopyAlphaRenderState->m_RenderState; + + debugCopyColorRenderState.m_PipelineState.m_DynamicScissor = true; + debugCopyColorRenderState.m_PipelineState.m_DynamicViewport = true; + debugCopyAlphaRenderState.m_PipelineState.m_DynamicScissor = true; + debugCopyAlphaRenderState.m_PipelineState.m_DynamicViewport = true; + + if (!debugCopyColorRenderState.m_InputVertexBuffers.PushBack().Valid() || + !debugCopyAlphaRenderState.m_InputVertexBuffers.PushBack().Valid()) + return false; + debugCopyColorRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + debugCopyAlphaRenderState.m_InputVertexBuffers.Last().m_Stride = sizeof(CFloat2); + FillCopyShaderBindings(CopyCombination_Basic, debugCopyColorRenderState.m_ShaderBindings, m_DefaultSamplerConstLayout); + FillCopyShaderBindings(CopyCombination_Alpha, debugCopyAlphaRenderState.m_ShaderBindings, m_DefaultSamplerConstLayout); + + CShaderLoader::SShadersPaths shadersPaths; + shadersPaths.m_Vertex = FULL_SCREEN_QUAD_VERTEX_SHADER_PATH; + shadersPaths.m_Fragment = COPY_FRAGMENT_SHADER_PATH; + + if (!m_ShaderLoader.LoadShader(debugCopyColorRenderState, shadersPaths, m_ApiManager) || + !m_ShaderLoader.LoadShader(debugCopyAlphaRenderState, shadersPaths, m_ApiManager)) + return false; + return m_ApiManager->BakeRenderState(m_CopyColorRenderState, m_FinalFrameBuffers.First()->GetLayout(), m_FinalRenderPass, 1) && + m_ApiManager->BakeRenderState(m_CopyAlphaRenderState, m_FinalFrameBuffers.First()->GetLayout(), m_FinalRenderPass, 1); +} + +//---------------------------------------------------------------------------- + +void CDeferredScene::FillCommandBuffer(const RHI::PCommandBuffer &cmdBuff, u32 swapImgIdx) +{ + (void)cmdBuff; + CUint2 contextSize = m_SwapChainRenderTargets[0]->GetSize(); + + RHI::PCommandBuffer preOpaqueCmdBuff = m_ApiManager->CreateCommandBuffer(RHI::SRHIResourceInfos("PK-RHI Pre Opaque command buffer")); + RHI::PCommandBuffer postOpaqueCmdBuff = m_ApiManager->CreateCommandBuffer(RHI::SRHIResourceInfos("PK-RHI Post Opaque command buffer")); + + preOpaqueCmdBuff->Start(); + { + // Pre Render: + StartCommandBuffer(preOpaqueCmdBuff); + + // -- RENDER PASS: Deferred ------------------- + + preOpaqueCmdBuff->BeginRenderPass(m_BeforeBloomRenderPass, m_BeforeBloomFrameBuffer, m_BeforeBloomClearValues); + + preOpaqueCmdBuff->SetViewport(CInt2(0), contextSize, CFloat2(0, 1)); + preOpaqueCmdBuff->SetScissor(CInt2(0), contextSize); + + // Sub-pass 0: GBuffer + { + PK_NAMEDSCOPEDPROFILE("Opaque pass"); + PK_NAMEDSCOPEDPROFILE_GPU(preOpaqueCmdBuff->ProfileEventContext(), "Opaque"); + RenderMeshBackdrops(preOpaqueCmdBuff); + } + + preOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(preOpaqueCmdBuff); + + postOpaqueCmdBuff->Start(); + PostOpaque(postOpaqueCmdBuff); + + // -- START RENDER PASS: Deferred ------------------- + { + PK_NAMEDSCOPEDPROFILE("START RENDER PASS: Deferred"); + postOpaqueCmdBuff->BeginRenderPass(m_BeforeBloomRenderPass, m_BeforeBloomFrameBuffer, TMemoryView()); // don't clear + postOpaqueCmdBuff->SetViewport(CInt2(0, 0), m_BeforeBloomFrameBuffer->GetSize(), CFloat2(0, 1)); + postOpaqueCmdBuff->SetScissor(CInt2(0), m_BeforeBloomFrameBuffer->GetSize()); + } + + // Sub-pass 0: Opaque particles + { + PK_NAMEDSCOPEDPROFILE("Opaque particles"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Opaque particles"); + RenderOpaquePass(postOpaqueCmdBuff); + } + + // Sub-pass 1: Decals + { + PK_NAMEDSCOPEDPROFILE("Decals pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Decals"); + postOpaqueCmdBuff->NextRenderSubPass(); + RenderDecals(postOpaqueCmdBuff); + } + + // Sub-pass 2: Light + { + PK_NAMEDSCOPEDPROFILE("Lighting pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Lighting"); + postOpaqueCmdBuff->NextRenderSubPass(); + + postOpaqueCmdBuff->BindRenderState(m_GBuffer.m_LightsRenderState); + postOpaqueCmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + RenderLights(postOpaqueCmdBuff); + } + + // Sub-pass 3: Merging + { + PK_NAMEDSCOPEDPROFILE("GBuffer and light accumulation merging pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "GBuffer and light accumulation merge"); + postOpaqueCmdBuff->NextRenderSubPass(); + postOpaqueCmdBuff->BindRenderState(m_GBuffer.m_MergingRenderState); + postOpaqueCmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_GBuffer.m_MergingSamplersSet)); + postOpaqueCmdBuff->PushConstant(&m_DeferredMergingMinAlpha, 0); + postOpaqueCmdBuff->Draw(0, 6); + } + + { + PK_NAMEDSCOPEDPROFILE("Semi-transparent Forward pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Semi-transparent Forward"); + RenderPostMerge(postOpaqueCmdBuff); + } + + // Sub-pass 4: Distortion-Map + { + PK_NAMEDSCOPEDPROFILE("Distortion-map pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Distortion"); + postOpaqueCmdBuff->NextRenderSubPass(); + RenderDistortionMap(postOpaqueCmdBuff); + } + + // Sub-pass 5-6-7: Distortion-PostFX + { + PK_NAMEDSCOPEDPROFILE("Distortion-postFX pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Distortion-postFX"); + postOpaqueCmdBuff->NextRenderSubPass(); + if (m_SceneOptions.m_Distortion.m_Enable) // TODO, debug modes ... + m_Distortion.Draw(postOpaqueCmdBuff); + else + m_Distortion.Draw_JustCopy(postOpaqueCmdBuff); + } + + { + PK_NAMEDSCOPEDPROFILE("Sub-passes: Transparent no distortion"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Transparent no distortion"); + postOpaqueCmdBuff->NextRenderSubPass(); + RenderPostDistortion(postOpaqueCmdBuff); + } + + postOpaqueCmdBuff->EndRenderPass(); + postOpaqueCmdBuff->SyncPreviousRenderPass(RHI::FragmentPipelineStage, RHI::FragmentPipelineStage); + + // -- RENDER PASS: Bloom Post-FX ------------------------- + // Input: m_DeferredSetup.m_DistortionPostFX.m_OutputRenderTarget + // Output: m_DeferredSetup.m_DistortionPostFX.m_OutputRenderTarget + //m_DownSampler.Draw(postOpaqueCmdBuff, m_DeferredSetup.m_DistortionPostFX.m_SamplerConstantSet); // We do not retrieve the scene illumination yet + if (m_SceneOptions.m_Bloom.m_Enable) + { + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Bloom"); + m_Bloom.Draw(postOpaqueCmdBuff, 0); + postOpaqueCmdBuff->SyncPreviousRenderPass(RHI::FragmentPipelineStage, RHI::FragmentPipelineStage); + } + + // -- RENDER PASS: Final Image ------------------------- + + postOpaqueCmdBuff->BeginRenderPass(m_FinalRenderPass, m_FinalFrameBuffers[swapImgIdx], m_FinalClearValues); + + // Sub-pass 0: Tone-Mapping + // Input: m_DeferredSetup.m_DistortionPostFX.m_OutputRenderTarget + // Output: m_ToneMapping.m_OutputRenderTarget + { + PK_NAMEDSCOPEDPROFILE("Tone-Mapping post-FX pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Tone-Mapping"); + if (m_SceneOptions.m_ToneMapping.m_Enable) // TODO, debug modes ... + m_ToneMapping.Draw(postOpaqueCmdBuff); + else + m_ToneMapping.Draw_JustCopy(postOpaqueCmdBuff); + } + + // Sub-pass 1: Final Copy (and swap-chain as output) + postOpaqueCmdBuff->NextRenderSubPass(); + { + PK_NAMEDSCOPEDPROFILE("Blit final buffer on screen pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Blit final buffer"); + + // ------------ COPY THE CURRENTLY DEBUGGED BUFFER ON SCREEN --------------- + if (m_RtToDraw != RenderTarget_Unknown) + { + if (m_ShowAlpha) + postOpaqueCmdBuff->BindRenderState(m_CopyAlphaRenderState); + else + postOpaqueCmdBuff->BindRenderState(m_CopyColorRenderState); + + if (m_RtToDraw == RenderTarget_Depth) + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_GBuffer.m_Depth.m_SamplerConstantSet)); + else if (m_RtToDraw == RenderTarget_Diffuse) + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_GBufferRTs[0].m_SamplerConstantSet)); + else if (m_RtToDraw == RenderTarget_Specular) + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_GBufferRTs[1].m_SamplerConstantSet)); + else if (m_RtToDraw == RenderTarget_Normal) + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_GBufferRTs[1].m_SamplerConstantSet)); + else if (m_RtToDraw == RenderTarget_LightAccum) + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_GBuffer.m_LightAccu.m_SamplerConstantSet)); + else if (m_RtToDraw == RenderTarget_Scene) + postOpaqueCmdBuff->BindConstantSets(TMemoryView(m_ToneMapping.m_OutputRenderTarget.m_SamplerConstantSet)); + + postOpaqueCmdBuff->BindVertexBuffers(m_GBuffer.m_QuadBuffers.m_VertexBuffers); + postOpaqueCmdBuff->Draw(0, 6); + } + } + + RenderFinalComposition(postOpaqueCmdBuff); + + // ------------ IMGUI --------------- + if (!m_RenderOffscreen) + { + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "ImGUI"); + ImDrawData *drawData = ImGuiPkRHI::GenerateRenderData(); + ImGuiPkRHI::DrawRenderData(drawData, postOpaqueCmdBuff); + ImGuiPkRHI::EndFrame(); + } + + // ------------ PROFILER ------------ + #if PKSAMPLE_HAS_PROFILER_RENDERER + { + PK_NAMEDSCOPEDPROFILE("Profiler pass"); + PK_NAMEDSCOPEDPROFILE_GPU(postOpaqueCmdBuff->ProfileEventContext(), "Profiler"); + m_ProfilerRenderer->Render(postOpaqueCmdBuff, m_WindowContext->GetDrawableSize(), m_ProfilerData); + } + #endif + + postOpaqueCmdBuff->EndRenderPass(); + } + + postOpaqueCmdBuff->Stop(); + m_ApiManager->SubmitCommandBufferDirect(postOpaqueCmdBuff); + return; +} + +//---------------------------------------------------------------------------- + +namespace +{ + static const float kCameraDistanceLimits[2] = { 0.f, 100.f }; + static const float kCameraAzimuthLimits[2] = { -180.f, 180.f }; + static const float kCameraAltitudeLimits[2] = { -90.f, 90.f }; + static const float kCameraRollLimits[2] = { -180.f, 180.f }; + + static float _Diff(const float kd[2]) + { + assert(kd[1] >= kd[0]); // NOTE(Julien): Never call PK_ASSERT() before the popcorn runtime is started + return PKAbs(kd[0] - kd[1]); + } + + static const float kCameraDistanceLimitsDiff = _Diff(kCameraDistanceLimits); + static const float kCameraAzimuthLimitsDiff = _Diff(kCameraAzimuthLimits); + static const float kCameraAltitudeLimitsDiff = _Diff(kCameraAltitudeLimits); + static const float kCameraRollLimitsDiff = _Diff(kCameraRollLimits); +} + +//---------------------------------------------------------------------------- + +void CDeferredScene::UpdateCamera() +{ + // Update camera from controller + if (m_WindowContext != null && m_WindowContext->m_Controller != null) + { + static const float kFactor = 0.001f; + const float rightY = m_WindowContext->m_Controller->GetNormalizedAxis(CAbstractController::AxisRightY) * kFactor; + const float rightX = m_WindowContext->m_Controller->GetNormalizedAxis(CAbstractController::AxisRightX) * kFactor; + const float leftY = m_WindowContext->m_Controller->GetNormalizedAxis(CAbstractController::AxisLeftY) * kFactor; + + m_CameraGUI_Distance += leftY * kCameraDistanceLimitsDiff; + m_CameraGUI_Angles.x() += rightY * kCameraAltitudeLimitsDiff; + m_CameraGUI_Angles.y() += (1.f + rightX) * kCameraAzimuthLimitsDiff; + } + + // Update camera from mouse + if (m_WindowContext != null) + { + static const float kFactor = 0.0015f; + const CInt2 currentMousePosition = m_WindowContext->GetMousePosition(); + const CFloat2 mouseDiff = m_WindowContext->GetPixelRatio() * CFloat2(currentMousePosition - m_PrevMousePosition) * kFactor; + m_PrevMousePosition = currentMousePosition; + + const CBool3 mouseButtonState = m_WindowContext->GetMouseClick(); + if (mouseButtonState != 0) + { + if (!ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) + { + if (mouseButtonState.xz() == CBool2(true, false)) // only left-click: orbit + { + m_CameraGUI_Angles.x() += mouseDiff.y() * kCameraAltitudeLimitsDiff; + m_CameraGUI_Angles.y() += (1.f + mouseDiff.x()) * kCameraAzimuthLimitsDiff; + } + else if (mouseButtonState.xz() == CBool2(true, true)) // left+right click: dolly + { + m_CameraGUI_Distance += mouseDiff.y() * kCameraDistanceLimitsDiff; + } + } + } + } + + m_CameraGUI_Distance = PKClamp(m_CameraGUI_Distance, kCameraDistanceLimits[0], kCameraDistanceLimits[1]); + m_CameraGUI_Angles.x() = PKClamp(m_CameraGUI_Angles.x(), kCameraAltitudeLimits[0], kCameraAltitudeLimits[1]); + m_CameraGUI_Angles.y() = fmodf(m_CameraGUI_Angles.y() - kCameraAzimuthLimits[0], kCameraAzimuthLimitsDiff) + kCameraAzimuthLimits[0]; + + m_Camera.SetAngles(Units::DegreesToRadians(m_CameraGUI_Angles)); + m_Camera.SetDistance(m_CameraGUI_Distance); + m_Camera.SetLookAt(m_CameraGUI_LookatPosition); + + if (m_CameraFlag_ResetProj) + { + m_Camera.SetProj(60, CFloat2(m_WindowContext->GetDrawableSize()), CAMERA_NEAR_PLANE, CAMERA_FAR_PLANE); + m_CameraFlag_ResetProj = false; + } + + m_Camera.Update(); +} + +//---------------------------------------------------------------------------- + +void CDeferredScene::UpdateSceneInfo() +{ + Utils::SetupSceneInfoData(m_SceneInfoData, GetCamera().Camera(), CCoordinateFrame::GlobalFrame()); + PKSample::SSceneInfoData *sceneInfo = static_cast(m_ApiManager->MapCpuView(m_SceneInfoConstantBuffer)); + if (PK_VERIFY(sceneInfo != null)) + { + *sceneInfo = m_SceneInfoData; + PK_VERIFY(m_ApiManager->UnmapCpuView(m_SceneInfoConstantBuffer)); + } +} + +//---------------------------------------------------------------------------- + +void CDeferredScene::DrawHUD() +{ + PK_SCOPEDPROFILE_C(CFloat3(1, 1, 0)); + PK_ASSERT(m_WindowContext != null); + + CUint2 drawSize = m_SwapChainRenderTargets.First()->GetSize(); + float pxlRatio = 1.0f; + + if (drawSize != m_WindowContext->GetWindowSize()) + { + drawSize = m_WindowContext->GetWindowSize(); + pxlRatio = m_WindowContext->GetPixelRatio(); + } + + ImGuiPkRHI::NewFrame(drawSize, m_Dt, pxlRatio); + + // ImGui Additional things + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10, 2)); + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(4, 2)); + ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 6); + ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0); + ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0); + ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 0); + + if (ImGui::Begin("Deferred scene", null, ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize)) + { + ImGui::PushItemWidth(130); + + ImGui::SliderFloat("Camera Distance", &m_CameraGUI_Distance, kCameraDistanceLimits[0], kCameraDistanceLimits[1]); + ImGui::SliderFloat("Camera Azimuth ", &m_CameraGUI_Angles.y(), kCameraAzimuthLimits[0], kCameraAzimuthLimits[1]); + ImGui::SliderFloat("Camera Altitude", &m_CameraGUI_Angles.x(), kCameraAltitudeLimits[0], kCameraAltitudeLimits[1]); + ImGui::SliderFloat("Camera Roll ", &m_CameraGUI_Angles.z(), kCameraRollLimits[0], kCameraRollLimits[1]); + + ImGui::Separator(); + + ImGui::Checkbox("Enable distortion", &m_SceneOptions.m_Distortion.m_Enable); + + ImGui::Separator(); + + ImGui::Checkbox("Enable bloom", &m_SceneOptions.m_Bloom.m_Enable); + + if (ImGui::SliderFloat("Bloom bright-pass", &m_SceneOptions.m_Bloom.m_BrightPassValue, 0, 3)) + { + m_Bloom.SetSubtractValue(m_SceneOptions.m_Bloom.m_BrightPassValue); + } + if (ImGui::SliderFloat("Bloom intensity", &m_SceneOptions.m_Bloom.m_Intensity, 0, 5)) + { + m_Bloom.SetIntensity(m_SceneOptions.m_Bloom.m_Intensity); + } + if (ImGui::SliderFloat("Bloom attenuation", &m_SceneOptions.m_Bloom.m_Attenuation, 0, 1)) + { + m_Bloom.SetAttenuation(m_SceneOptions.m_Bloom.m_Attenuation); + } + UpdateMaxBloomRTs(); + if (ImGui::SliderInt("Bloom max render pass", &m_UserMaxBloomRenderPass, 0, m_MaxBloomRenderPass)) + { + bool success = true; + + CPostFxBloom::SInOutRenderTargets inOut; + + inOut.m_InputRenderTarget = &m_Distortion.m_OutputRenderTarget; + inOut.m_OutputRenderTargets = TMemoryView(m_Distortion.m_OutputRenderTarget.m_RenderTarget); + + success &= m_Bloom.UpdateFrameBuffer(m_DefaultSampler, m_UserMaxBloomRenderPass, &inOut); + success &= m_Bloom.CreateFrameBuffers(); + if (!success) + { + CLog::Log(PK_ERROR, "Could not re-create the bloom"); + } + } + + int bloomTap = static_cast(m_SceneOptions.m_Bloom.m_BlurTap); + + static const char *blurTaps[] = + { + "Gaussian Blur 5 Tap", + "Gaussian Blur 9 Tap", + "Gaussian Blur 13 Tap", + }; + if (ImGui::Combo("Bloom tap number", &bloomTap, blurTaps, GaussianBlurCombination_Count)) + { + bool success = true; + success &= m_Bloom.CreateRenderPass(); + success &= m_Bloom.CreateRenderStates(m_ShaderLoader, static_cast(bloomTap)); + m_SceneOptions.m_Bloom.m_BlurTap = static_cast(bloomTap); + if (!success) + { + CLog::Log(PK_ERROR, "Could not re-create the bloom"); + } + } + + ImGui::Separator(); + + ImGui::Checkbox("Enable tone-mapping", &m_SceneOptions.m_ToneMapping.m_Enable); + + if (ImGui::SliderFloat("Exposure", &m_SceneOptions.m_ToneMapping.m_Exposure, -5, 5)) + { + m_ToneMapping.SetExposure(m_SceneOptions.m_ToneMapping.m_Exposure); + } + if (ImGui::SliderFloat("Saturation", &m_SceneOptions.m_ToneMapping.m_Saturation, 0, 2)) + { + m_ToneMapping.SetSaturation(m_SceneOptions.m_ToneMapping.m_Saturation); + } + if (ImGui::SliderFloat("Vignetting Color Intensity", &m_SceneOptions.m_Vignetting.m_ColorIntensity, 0, 1)) + { + m_ToneMapping.SetVignettingColorIntensity(m_SceneOptions.m_Vignetting.m_ColorIntensity); + } + if (ImGui::SliderFloat("Vignetting Desaturation Intensity", &m_SceneOptions.m_Vignetting.m_DesaturationIntensity, 0, 1)) + { + m_ToneMapping.SetVignettingDesaturationIntensity(m_SceneOptions.m_Vignetting.m_DesaturationIntensity); + } + if (ImGui::SliderFloat("Vignetting Smoothness", &m_SceneOptions.m_Vignetting.m_Smoothness, 0, 1)) + { + m_ToneMapping.SetVignettingSmoothness(m_SceneOptions.m_Vignetting.m_Smoothness); + } + + m_ToneMapping.SetScreenSize(m_Camera.Camera().m_WinSize.x(), m_Camera.Camera().m_WinSize.y()); + ImGui::PopItemWidth(); + } + ImGui::SetWindowCollapsed(true, ImGuiSetCond_Once); + ImGui::SetWindowPos(ImVec2(m_WindowContext->GetWindowSize().x() - ImGui::GetWindowWidth(), 0), ImGuiSetCond_Always); + ImGui::End(); + + UpdateCamera(); + + if (ImGui::Begin("info", null, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar)) + { + ImGui::PushItemWidth(100); + ImGui::LabelText("Frame Time", "%1.3f ms", m_Dt * 1.0e+3f); + + _UpdateDisplayFps(); + ImGui::LabelText("FPS", "%3.1f", _GetDisplayFps()); + + ImGui::SetWindowPos(ImVec2(m_WindowContext->GetWindowSize().x() - ImGui::GetWindowWidth(), m_WindowContext->GetWindowSize().y() - ImGui::GetWindowHeight()), ImGuiSetCond_Always); + ImGui::PopItemWidth(); + } + ImGui::End(); + ImGui::PopStyleVar(6); + +#if PKSAMPLE_HAS_PROFILER_RENDERER + if (m_ProfilerRenderer->Enabled()) + { + if (ImGui::Begin("Profiler node details", null, ImGuiWindowFlags_NoSavedSettings)) + { + ImGui::SetWindowPos(ImVec2(420, 60), ImGuiCond_Once); + ImGui::SetWindowSize(ImVec2(800, 200), ImGuiCond_Once); + for (const auto &msg : m_ProfilerRenderer->GetTooltips()) + ImGui::Text("%s", msg.Data()); + } + ImGui::End(); + } +#endif +} + +//---------------------------------------------------------------------------- + +void CDeferredScene::_UpdateDisplayFps() +{ + m_DisplayFpsAccTime += m_Dt; + m_DisplayFpsAccFrames++; + if (m_DisplayFpsAccTime > 1.0f) + { + m_DisplayFps = m_DisplayFpsAccFrames / m_DisplayFpsAccTime; + m_DisplayFpsAccFrames = 0; + m_DisplayFpsAccTime = 0; + } +} + +//---------------------------------------------------------------------------- + +float CDeferredScene::_GetDisplayFps() const +{ + if (!TNumericTraits::IsFinite(m_DisplayFps)) + return 1.0f / m_Dt; + return m_DisplayFps; +} + +//---------------------------------------------------------------------------- + +void CDeferredScene::UpdateMaxBloomRTs() +{ + const CUint2 ctxSize = m_GBuffer.m_Merge.m_Size; + const u32 maxDimension = PKMax(ctxSize.x(), ctxSize.y()); + m_MaxBloomRenderPass = IntegerTools::Log2(maxDimension); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/DeferredScene.h b/Samples/PK-SampleLib/SampleScene/DeferredScene.h new file mode 100644 index 00000000..7878e8c7 --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/DeferredScene.h @@ -0,0 +1,222 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CDeferredScene : public CAbstractGraphicScene +{ +public: + CDeferredScene(); + virtual ~CDeferredScene(); + + // G Buffer layout / material + + RHI::PRenderState GetGBufferMaterial(EGBufferCombination matCombination) const; + TMemoryView GetGBufferSamplersConstLayouts() const { return m_GBuffer.m_GBufferMeshInfoConstLayout; } + + const SSamplableRenderTarget *GetSamplableDiffuse() const { return &m_GBufferRTs[0]; } + const SSamplableRenderTarget *GetSamplableDepth() const { return &m_GBufferRTs[1]; } + const SSamplableRenderTarget *GetSamplableNormalRoughMetal() const { return &m_GBuffer.m_NormalRoughMetal; } + const SSamplableRenderTarget *GetSamplableToneMapping() const { return &m_ToneMapping.m_OutputRenderTarget; } + + // Light Info Layout + const RHI::SConstantSetLayout &GetLightInfoConstLayout() const { return m_GBuffer.m_LightInfoConstLayout; } + const RHI::SConstantSetLayout &ShadowInfoConstLayout() const { return m_GBuffer.m_ShadowsInfoConstLayout; } + const RHI::PConstantSet GetLightingSamplerSet() const { return m_GBuffer.m_LightingSamplersSet; } + +// CCameraRotate &GetCamera() { return m_Camera; } + const CCameraRotate &GetCamera() const { return m_Camera; } + + TMemoryView GetFrameBufferBeforeBloomLayout() const { return m_BeforeBloomFrameBuffer->GetLayout(); } + TMemoryView GetSwapChainFrameBufferLayout() const { return m_FinalFrameBuffers.First()->GetLayout(); } + + RHI::PRenderPass GetRenderPass_BeforeBloom() const { return m_BeforeBloomRenderPass; } + RHI::PRenderPass GetRenderPass_Final() const { return m_FinalRenderPass; } + + const CGBuffer &GetGBuffer() const { return m_GBuffer; } + + const RHI::PConstantSet &GetSceneInfoConstantSet() const { return m_SceneInfoConstantSet; } + const RHI::PConstantSet &GetBRDFLUTSamplerSet() const { return m_BRDFLUTConstantSet; } + const RHI::PConstantSet &GetDummyEnvMapSamplerSet() const { return m_DummyCubeConstantSet; } + const RHI::PConstantSampler &GetDefaultSampler() const { return m_DefaultSampler; } + + const RHI::PGpuBuffer &GetSceneInfoBuffer() const { return m_SceneInfoConstantBuffer; } + + const RHI::PTexture &GetDummyWhiteTexture() const { return m_DummyWhite; } + + bool InitIFN(); + + enum ERenderTarget + { + RenderTarget_Unknown = -1, + RenderTarget_Depth = 0, + RenderTarget_Diffuse, + RenderTarget_Specular, + RenderTarget_Normal, + RenderTarget_LightAccum, + RenderTarget_Scene, + + __MaxRenderTargets + }; + + // Debug mode: TODO + +private: + virtual bool CreateRenderTargets(bool recreateSwapChain) override; + virtual bool CreateRenderPasses() override; + virtual bool CreateRenderStates() override; + virtual bool CreateFrameBuffers(bool recreateSwapChain) override; + + virtual void FillCommandBuffer(const RHI::PCommandBuffer &cmdBuff, u32 swapImgIdx) override; + + // Default Render states + bool CreateDebugCopyRenderStates(); + +protected: + // Pre Render, right after command list started + virtual void StartCommandBuffer(const RHI::PCommandBuffer &cmdBuff) = 0; + // Render your opaque mesh backdrops, if any + virtual void RenderMeshBackdrops(const RHI::PCommandBuffer &cmdBuff) = 0; + // Submit any command lists before the Post Opaque render pass starts (ie. dispatch compute shaders) + virtual void PostOpaque(const RHI::PCommandBuffer &cmdBuff) = 0; + // Render your opaque pass in G Buffer + virtual void RenderOpaquePass(const RHI::PCommandBuffer &cmdBuff) = 0; + + // Render your custom decals in GBuffer + virtual void RenderDecals(const RHI::PCommandBuffer &cmdBuff) = 0; + // Render your custom lights in Light Accumulation buffer + virtual void RenderLights(const RHI::PCommandBuffer &cmdBuff) = 0; + // Render your custom rendering post merge (transparent pass, ...) + virtual void RenderPostMerge(const RHI::PCommandBuffer &cmdBuff) = 0; + // Render your distortion map + virtual void RenderDistortionMap(const RHI::PCommandBuffer &cmdBuff) = 0; + // Render your distortion map + virtual void RenderPostDistortion(const RHI::PCommandBuffer &cmdBuff) = 0; + // Render your additional composition (eg. UI) + virtual void RenderFinalComposition(const RHI::PCommandBuffer &cmdBuff) = 0; + + virtual void DrawHUD() override; + + // Camera + float m_CameraGUI_Distance; + CFloat3 m_CameraGUI_Angles; + CFloat3 m_CameraGUI_LookatPosition; + bool m_CameraFlag_ResetProj; // (eg. on coordinate frame change) + + float m_DeferredMergingMinAlpha = 1.0f; + + void UpdateCamera(); + void UpdateSceneInfo(); + + // Background + CFloat3 m_BackgroundColorRGB; + + void _UpdateDisplayFps(); + float _GetDisplayFps() const; + +private: + void UpdateMaxBloomRTs(); + + // Default single sampler constant set layout to sample render targets: + RHI::SConstantSetLayout m_DefaultSamplerConstLayout; + RHI::PConstantSampler m_DefaultSampler; + + // Scene info constant set: + PKSample::SSceneInfoData m_SceneInfoData; // current scene info + RHI::SConstantSetLayout m_SceneInfoConstantSetLayout; + RHI::PConstantSet m_SceneInfoConstantSet; + RHI::PGpuBuffer m_SceneInfoConstantBuffer; + + RHI::PConstantSet m_BRDFLUTConstantSet; + + RHI::PTexture m_DummyWhite; + RHI::PTexture m_DummyCube; + RHI::PConstantSet m_DummyCubeConstantSet; + RHI::PConstantSampler m_DummyCubeSampler; + + // Pipeline: Main Render passes + // -> Pass 1: Differed + CGBuffer m_GBuffer; + CPostFxDistortion m_Distortion; + CPostFxBloom m_Bloom; + CPostFxToneMapping m_ToneMapping; + + TStaticArray m_GBufferRTs; + TStaticArray m_GBufferRTsIdx; + + TArray m_BeforeBloomClearValues; + RHI::PRenderPass m_BeforeBloomRenderPass; + RHI::PFrameBuffer m_BeforeBloomFrameBuffer; + + enum EFinalFrameBuffer + { + kMaxSwapChainSize = 3, + }; + + TArray m_FinalClearValues; + RHI::PRenderPass m_FinalRenderPass; + TSemiDynamicArray m_FinalFrameBuffers; + + // Default Render-states + + RHI::PRenderState m_CopyColorRenderState; + RHI::PRenderState m_CopyAlphaRenderState; + + RHI::PRenderState m_OverdrawHeatmapRenderState; // Overdraw + RHI::PConstantSet m_OverdrawConstantSet; // Overdraw + + + TArray m_CommandBuffers; + + bool m_IsInit; + + IFileSystem *m_Controller; + + CCameraRotate m_Camera; + CInt2 m_PrevMousePosition; + + // Bloom, these method are still needed ? + s32 m_UserMaxBloomRenderPass; + s32 m_MaxBloomRenderPass; + + float m_DisplayFpsAccTime; + u32 m_DisplayFpsAccFrames; + float m_DisplayFps; + +protected: + // Use for debug intermediate rendering + ERenderTarget m_RtToDraw; + bool m_ShowAlpha; + + SParticleSceneOptions m_SceneOptions; + + CConstantNoiseTexture m_NoiseTexture; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/Entities/EnvironmentMapEntity.cpp b/Samples/PK-SampleLib/SampleScene/Entities/EnvironmentMapEntity.cpp new file mode 100644 index 00000000..b9e8a347 --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/Entities/EnvironmentMapEntity.cpp @@ -0,0 +1,877 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "EnvironmentMapEntity.h" + +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include + +#define COMPUTE_CUBEMAP_SHADER_PATH "./Shaders/ComputeCubemap.comp" +#define COMPUTE_MIPMAP_SHADER_PATH "./Shaders/ComputeMipMap.comp" +#define FILTER_CUBEMAP_SHADER_PATH "./Shaders/FilterCubemap.comp" +#define BLUR_CUBEMAP_SHADER_PATH "./Shaders/BlurCubemap.comp" +#define RENDER_FACE_SHADER_PATH "./Shaders/RenderCubemapFace.comp" + +#define FACECOUNT 6 +#define MAXFACESIZE 1024 // Mip map count will be computed from this. +// For IBL, we want to specify mip map count since this is hardcoded in shaders +// So it doesn't necessarily goes to the 1*1 level +#define MAXFACESIZEIBL 512 +#define MIPMAPCOUNTIBL 7 +#define IBLSAMPLECOUNT 1024 // For montecarlo sampling of radiance +#define PI 3.14159f + +__PK_SAMPLE_API_BEGIN + + +//---------------------------------------------------------------------------- + +CEnvironmentMap::CEnvironmentMap() +: m_ProgressiveProcessing(false) +, m_InputPath(null) +, m_InputTexture(null) +, m_InputSampler(null) +, m_InputIsLatLong(false) +, m_MustRegisterCompute(false) +, m_LoadIsValid(false) +, m_IsUsable(false) +, m_CubemapConstantSet(null) +, m_IBLCubemapConstantSet(null) +, m_BackgroundCubemapConstantSet(null) +, m_CubemapTexture(null) +, m_IBLCubemapTexture(null) +, m_BackgroundCubemapTexture(null) +, m_CubemapSampler(null) +, m_IBLCubemapSampler(null) +, m_BackgroundCubemapSampler(null) +, m_ComputeLatLongState(null) +, m_ComputeCubeState(null) +, m_ComputeMipMapState(null) +, m_FilterCubemapState(null) +, m_BlurCubemapState(null) +, m_RenderCubemapFaceState(null) +, m_ComputeMipMapSampler(null) +, m_BlurFaceSampler(null) +, m_WhiteEnvMapConstantSet(null) +, m_OutputTextureFormat(RHI::FormatFloat16RGBA) +, m_ProgressiveCounter(0u) +, m_MipmapCount(0u) +, m_MipmapCountIBL(0u) +, m_CubemapRotation(null) +{ +} + +//---------------------------------------------------------------------------- + +CEnvironmentMap::~CEnvironmentMap() +{ +} + +//---------------------------------------------------------------------------- + +u32 _TexelRangeFromAngle(float angle, u32 faceSize) +{ + /* + We want to compute distance (X) (texel range at most deformed region) + for a given angle (radius of the kernel) of (a). + We are also at edge in the third dimension, meaning the angle (c) between + center of edge and corner is smaller than 45 degrees. + The following diagram ignores the half texel offset necessary to work + from texel center. + + +-----X----------D----------------------------+ + | \ \ | | + | \ \ | c = a + b | + | \ \ | 1 = X + D | + | \ \ | | + | \ \ F | + | \ \ | | + | \ a \ b | | + | \ \ | | + | \ \ | | + | \ \| | + | \| | + | | + | | + | | + | | + | | + | | + | | + | | + | | + +---------------------------------------------+ + */ + + // If face size is 1, this won't be use, + // we can blur down to a smaller texture + if (faceSize <= 1 ) + return 0u; + + // Coordinate of the first texel in one dimension, in -1 +1 range (= face seam with half a texel offset) + const float halfTexelNormalized = ((0.5f / static_cast(faceSize)) - 0.5f) * 2.0f; + + const CFloat3 ray = CFloat3(halfTexelNormalized, halfTexelNormalized, 1.0f).Normalized(); + + const CFloat3 F = CFloat3(0.f, halfTexelNormalized, 1.0f); + const float c = acos(ray.Dot(F.Normalized())); + const float b = c - angle; + const float D = tan(b) * F.Length(); + const float X = (1. - D); + + const u32 range = u32(X * faceSize * 0.5); + + /* + { + CLog::Log(PK_INFO, "Size is %i, angle is %f, range is %i ", faceSize, angle, range); + float rangeFloat = X * faceSize * 0.5; + float check = acos(ray.Dot(CFloat3(((0.5 + rangeFloat) - (faceSize*0.5))/(0.5*faceSize), halfTexelNormalized, 1.0f).Normalized())); + CLog::Log(PK_INFO, "Check: angle was %f rad", check); + } + */ + + return range; +} + +//---------------------------------------------------------------------------- + +// For background blurring, heuristic mapping from src mip level to +// kernel blur angle (radians). +float CEnvironmentMap::MipLevelToBlurAngle(u32 srcMipLevel) +{ + // Cursor t in 0 - 1 range. Is = 1 at the before last mipmap, meaning it's processed with the max blur + // into the last mipmap. + const float t = PKMin(1.0f, static_cast(srcMipLevel) / static_cast(m_MipmapCount - 2)); + + // Heuristic: make small cones for first blurs since very visible. + // Do not start with blur of 0., which would mean no blur. + return (PI / 2.0f) * PKLerp(0.01f, 1.0f, pow(t, 1.8f)); +} + +//---------------------------------------------------------------------------- + +bool CEnvironmentMap::Init(const RHI::PApiManager &apiManager, CShaderLoader *shaderLoader) +{ + m_MustRegisterCompute = false; + m_LoadIsValid = false; + m_IsUsable = false; + m_MipmapCount = IntegerTools::Log2(MAXFACESIZE) + 1; + m_MipmapCountIBL = MIPMAPCOUNTIBL; + m_ApiManager = apiManager; + + // Create output texture constant set layout + { + m_CubemapSamplerConstLayout.Reset(); + CreateCubemapSamplerConstantSetLayout(m_CubemapSamplerConstLayout); + } + + // Cubemap rotation (used for both IBL, background, and dummy cubemap constant sets) + { + m_CubemapRotation = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("CubemapRotation"), RHI::ConstantBuffer, sizeof(TMatrix)); + if (!PK_VERIFY(m_CubemapRotation != null)) + return false; + SetRotation(0.0f); + } + + // Create dummy ressources for fallback + { + u32 white = 0xFFFFFFFF; + CImageMap dummyWhite(CUint3::ONE, &white, sizeof(u32)); + CImageMap dummyCube[6]; + + for (u32 i = 0; i < 6; i++) + dummyCube[i] = dummyWhite; + + RHI::PTexture dummyOutputTexture = apiManager->CreateTexture(RHI::SRHIResourceInfos("Dummy Environment Map Texture"), dummyCube, RHI::FormatUnorm8RGBA, RHI::kDefaultComponentSwizzle, RHI::TextureCubemap); + if (!PK_VERIFY(dummyOutputTexture != null)) + return false; + + RHI::PConstantSampler dummyOutputSampler = apiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Dummy Environment Map Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + dummyOutputTexture->GetMipmapCount(), + false); + if (!PK_VERIFY(dummyOutputSampler != null)) + return false; + + m_WhiteEnvMapConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("Dummy Environment Map Constant Set"), m_CubemapSamplerConstLayout); + if (!PK_VERIFY(m_WhiteEnvMapConstantSet != null)) + return false; + + m_WhiteEnvMapConstantSet->SetConstants(dummyOutputSampler, dummyOutputTexture, 0); + m_WhiteEnvMapConstantSet->SetConstants(m_CubemapRotation, 1); + m_WhiteEnvMapConstantSet->UpdateConstantValues(); + } + + // Select cubemap output format + { + if (apiManager->GetApiContext()->m_GPUCaps.IsPixelFormatSupported(RHI::FormatFloat16RGBA, RHI::FormatUsage_ShaderSampling | RHI::FormatUsage_RenderTarget)) + { + m_OutputTextureFormat = RHI::FormatFloat16RGBA; + } + else + { + CLog::Log(PK_WARN, "The pixel format %s is not supported by your GPU.", RHI::PixelFormatHelpers::PixelFormatToString_NoAssert(RHI::FormatFloat16RGBA)); + m_OutputTextureFormat = RHI::FormatUnorm8RGBA; + } + } + + // Create cubemap resources: + // - Intermediate cubemap (mipmapped without specific processing, local to this class) + // - Background cubemap + // - Cubemap for image based lighting + { + // Simple mipmapped cubemap + { + TArray blackCube; + TArray blackTexels; + if (!PK_VERIFY(blackCube.Resize(FACECOUNT * m_MipmapCount)) || + !PK_VERIFY(blackTexels.Resize(MAXFACESIZE * MAXFACESIZE))) + return false; + Mem::Clear(blackTexels.RawDataPointer(), blackTexels.CoveredBytes()); + + if (!PK_VERIFY(m_CubemapRenderTargets.Resize(FACECOUNT * m_MipmapCount))) + return false; + + for (u32 face = 0; face < FACECOUNT; face++) + { + u32 faceSize = MAXFACESIZE; + for (u32 level = 0; level < m_MipmapCount; level++) + { + const u32 id = level + face * m_MipmapCount; + + // add a face to the dummy texture + const CImageMap dummy = CImageMap(CUint3(faceSize, faceSize, 1), blackTexels.RawDataPointer(), faceSize * faceSize * sizeof(float) * 4); + blackCube[id] = dummy; + + m_CubemapRenderTargets[id] = apiManager->CreateRenderTarget(RHI::SRHIResourceInfos("Environment Map Render Target"), m_OutputTextureFormat, CUint2(faceSize, faceSize), true, RHI::SampleCount1, true); + if (!PK_VERIFY(m_CubemapRenderTargets[id] != null)) + return false; + + faceSize /= 2; + } + } + + m_CubemapTexture = apiManager->CreateTexture(RHI::SRHIResourceInfos("Environment Map Texture"), blackCube, m_OutputTextureFormat, RHI::kDefaultComponentSwizzle, RHI::TextureCubemap); + if (!PK_VERIFY(m_CubemapTexture != null)) + return false; + + m_CubemapSampler = apiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Environment Map Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + m_CubemapTexture->GetMipmapCount(), + false); + if (!PK_VERIFY(m_CubemapSampler != null)) + return false; + + m_CubemapConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("Environment Map Constant Set"), m_CubemapSamplerConstLayout); + if (!PK_VERIFY(m_CubemapConstantSet != null)) + return false; + + m_CubemapConstantSet->SetConstants(m_CubemapSampler, m_CubemapTexture, 0); + m_CubemapConstantSet->SetConstants(m_CubemapRotation, 1); + m_CubemapConstantSet->UpdateConstantValues(); + } + + // IBL cubemap (Radiance sum prefiltering) + { + TArray blackCube; + TArray blackTexels; + if (!PK_VERIFY(blackCube.Resize(FACECOUNT * m_MipmapCountIBL)) || + !PK_VERIFY(blackTexels.Resize(MAXFACESIZEIBL * MAXFACESIZEIBL))) + return false; + Mem::Clear(blackTexels.RawDataPointer(), blackTexels.CoveredBytes()); + + if (!PK_VERIFY(m_IBLCubeRenderTargets.Resize(FACECOUNT * m_MipmapCountIBL))) + return false; + + for (u32 face = 0; face < FACECOUNT; face++) + { + u32 faceSize = MAXFACESIZEIBL; + for (u32 level = 0; level < m_MipmapCountIBL; level++) + { + const u32 id = level + face * m_MipmapCountIBL; + + // add a face to the dummy texture + const CImageMap dummy = CImageMap(CUint3(faceSize, faceSize, 1), blackTexels.RawDataPointer(), faceSize * faceSize * sizeof(float) * 4); + blackCube[id] = dummy; + + m_IBLCubeRenderTargets[id] = apiManager->CreateRenderTarget(RHI::SRHIResourceInfos("IBL Render Target"), m_OutputTextureFormat, CUint2(faceSize, faceSize), true, RHI::SampleCount1, true); + if (!PK_VERIFY(m_IBLCubeRenderTargets[id] != null)) + return false; + + faceSize /= 2; + } + } + + m_IBLCubemapTexture = apiManager->CreateTexture(RHI::SRHIResourceInfos("IBL Texture"), blackCube, m_OutputTextureFormat, RHI::kDefaultComponentSwizzle, RHI::TextureCubemap); + if (!PK_VERIFY(m_IBLCubemapTexture != null)) + return false; + + m_IBLCubemapSampler = apiManager->CreateConstantSampler( RHI::SRHIResourceInfos("IBL Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + m_IBLCubemapTexture->GetMipmapCount(), + false); + if (!PK_VERIFY(m_IBLCubemapSampler != null)) + return false; + + m_IBLCubemapConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("IBL Constant Set"), m_CubemapSamplerConstLayout); + if (!PK_VERIFY(m_IBLCubemapConstantSet != null)) + return false; + + m_IBLCubemapConstantSet->SetConstants(m_IBLCubemapSampler, m_IBLCubemapTexture, 0); + m_IBLCubemapConstantSet->SetConstants(m_CubemapRotation, 1); + m_IBLCubemapConstantSet->UpdateConstantValues(); + } + + // Background cubemap (blurred cubemap for display) + { + TArray blackCube; + TArray blackTexels; + if (!PK_VERIFY(blackCube.Resize(FACECOUNT * m_MipmapCount)) || + !PK_VERIFY(blackTexels.Resize(MAXFACESIZE * MAXFACESIZE))) + return false; + Mem::Clear(blackTexels.RawDataPointer(), blackTexels.CoveredBytes()); + + if (!PK_VERIFY(m_BackgroundCubeRenderTargets.Resize(FACECOUNT * m_MipmapCount)) || + !PK_VERIFY(m_FacesForBlurRenderTargets.Resize(FACECOUNT * m_MipmapCount))) + return false; + + for (u32 face = 0; face < FACECOUNT; face++) + { + u32 faceSize = MAXFACESIZE; + for (u32 level = 0; level < m_MipmapCount; level++) + { + const u32 blurRadius = _TexelRangeFromAngle(MipLevelToBlurAngle(level), faceSize); + const u32 id = level + face * m_MipmapCount; + + // add a face to the dummy texture + const CImageMap dummy = CImageMap(CUint3(faceSize, faceSize, 1), blackTexels.RawDataPointer(), faceSize * faceSize * sizeof(float) * 4); + blackCube[id] = dummy; + + m_BackgroundCubeRenderTargets[id] = apiManager->CreateRenderTarget(RHI::SRHIResourceInfos("Blurred Cubemap Render Target"), m_OutputTextureFormat, CUint2(faceSize, faceSize), true, RHI::SampleCount1, true); + m_FacesForBlurRenderTargets[id] = apiManager->CreateRenderTarget(RHI::SRHIResourceInfos("Blurred Face Render Target"), m_OutputTextureFormat, CUint2(faceSize + 2 * (blurRadius), faceSize + 2 * (blurRadius)), true, RHI::SampleCount1, true); + if (!PK_VERIFY(m_BackgroundCubeRenderTargets[id] != null) || + !PK_VERIFY(m_FacesForBlurRenderTargets[id] != null)) + return false; + + faceSize /= 2; + } + } + + m_BackgroundCubemapTexture = apiManager->CreateTexture(RHI::SRHIResourceInfos("Blurred Texture"), blackCube, m_OutputTextureFormat, RHI::kDefaultComponentSwizzle, RHI::TextureCubemap); + if (!PK_VERIFY(m_BackgroundCubemapTexture != null)) + return false; + + m_BackgroundCubemapSampler = apiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Blurred Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + m_BackgroundCubemapTexture->GetMipmapCount(), + false); + if (!PK_VERIFY(m_BackgroundCubemapSampler != null)) + return false; + + m_BackgroundCubemapConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("Blurred Constant Set"), m_CubemapSamplerConstLayout); + if (!PK_VERIFY(m_IBLCubemapConstantSet != null)) + return false; + + m_BackgroundCubemapConstantSet->SetConstants(m_BackgroundCubemapSampler, m_BackgroundCubemapTexture, 0); + m_BackgroundCubemapConstantSet->SetConstants(m_CubemapRotation, 1); + m_BackgroundCubemapConstantSet->UpdateConstantValues(); + } + + // Create sampler for mip map generation + m_ComputeMipMapSampler = apiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Compute Mip Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear , + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + 1, + false); + if (!PK_VERIFY(m_ComputeMipMapSampler != null)) + return false; + + // Create sampler for face blur + m_BlurFaceSampler = apiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Blur Face Sampler"), + RHI::SampleNearest, + RHI::SampleNearestMipmapNearest, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + 1, + false); + if (!PK_VERIFY(m_BlurFaceSampler != null)) + return false; + } + + // Create compute state and constant set layouts + { + // For latlong input texture + m_ComputeLatLongState = apiManager->CreateComputeState(RHI::SRHIResourceInfos("Compute LatLong Compute State")); + if (!PK_VERIFY(m_ComputeLatLongState != null)) + return false; + FillComputeCubemapShaderBindings(m_ComputeLatLongState->m_ComputeState.m_ShaderBindings, true); + if (!PK_VERIFY(shaderLoader->LoadShader(m_ComputeLatLongState->m_ComputeState, COMPUTE_CUBEMAP_SHADER_PATH, apiManager))) + return false; + if (!PK_VERIFY(apiManager->BakeComputeState(m_ComputeLatLongState))) + return false; + CreateComputeCubemapConstantSetLayout(m_ComputeLatLongConstantSetLayout, true); + + // For cube input texture + m_ComputeCubeState = apiManager->CreateComputeState(RHI::SRHIResourceInfos("Cube Compute State")); + if (!PK_VERIFY(m_ComputeCubeState != null)) + return false; + FillComputeCubemapShaderBindings(m_ComputeCubeState->m_ComputeState.m_ShaderBindings, false); + if (!PK_VERIFY(shaderLoader->LoadShader(m_ComputeCubeState->m_ComputeState, COMPUTE_CUBEMAP_SHADER_PATH, apiManager))) + return false; + if (!PK_VERIFY(apiManager->BakeComputeState(m_ComputeCubeState))) + return false; + CreateComputeCubemapConstantSetLayout(m_ComputeCubeConstantSetLayout, false); + + // For mipmap generation + m_ComputeMipMapState = apiManager->CreateComputeState(RHI::SRHIResourceInfos("MipMap Compute State")); + if (!PK_VERIFY(m_ComputeMipMapState != null)) + return false; + FillComputeMipMapShaderBindings(m_ComputeMipMapState->m_ComputeState.m_ShaderBindings); + if (!PK_VERIFY(shaderLoader->LoadShader(m_ComputeMipMapState->m_ComputeState, COMPUTE_MIPMAP_SHADER_PATH, apiManager))) + return false; + if (!PK_VERIFY(apiManager->BakeComputeState(m_ComputeMipMapState))) + return false; + CreateComputeMipMapConstantSetLayout(m_ComputeMipMapConstantSetLayout); + + // For IBL filtering compute shader + m_FilterCubemapState = apiManager->CreateComputeState(RHI::SRHIResourceInfos("Filter Compute State")); + if (!PK_VERIFY(m_FilterCubemapState != null)) + return false; + FillFilterCubemapShaderBindings(m_FilterCubemapState->m_ComputeState.m_ShaderBindings); + if (!PK_VERIFY(shaderLoader->LoadShader(m_FilterCubemapState->m_ComputeState, FILTER_CUBEMAP_SHADER_PATH, apiManager))) + return false; + if (!PK_VERIFY(apiManager->BakeComputeState(m_FilterCubemapState))) + return false; + CreateFilterCubemapConstantSetLayout(m_FilterCubemapConstantSetLayout); + + // For background blurring face pre-rendering compute shader + m_RenderCubemapFaceState = apiManager->CreateComputeState(RHI::SRHIResourceInfos("Render Cubemap Compute State")); + if (!PK_VERIFY(m_RenderCubemapFaceState != null)) + return false; + FillBlurCubemapRenderFaceShaderBindings(m_RenderCubemapFaceState->m_ComputeState.m_ShaderBindings); + if (!PK_VERIFY(shaderLoader->LoadShader(m_RenderCubemapFaceState->m_ComputeState, RENDER_FACE_SHADER_PATH, apiManager))) + return false; + if (!PK_VERIFY(apiManager->BakeComputeState(m_RenderCubemapFaceState))) + return false; + CreateBlurCubemapRenderFaceConstantSetLayout(m_RenderCubemapFaceConstantSetLayout); + + // For background blurring compute shader + m_BlurCubemapState = apiManager->CreateComputeState(RHI::SRHIResourceInfos("Blue Cubemap Compute State")); + if (!PK_VERIFY(m_BlurCubemapState != null)) + return false; + FillBlurCubemapProcessShaderBindings(m_BlurCubemapState->m_ComputeState.m_ShaderBindings); + if (!PK_VERIFY(shaderLoader->LoadShader(m_BlurCubemapState->m_ComputeState, BLUR_CUBEMAP_SHADER_PATH, apiManager))) + return false; + if (!PK_VERIFY(apiManager->BakeComputeState(m_BlurCubemapState))) + return false; + CreateBlurCubemapProcessConstantSetLayout(m_BlurCubemapConstantSetLayout); + } + + return true; +} + +//---------------------------------------------------------------------------- + +bool CEnvironmentMap::Load(const CString &resourcePath, CResourceManager *resourceManager) +{ + if (m_InputPath == resourcePath) + return true; + + m_LoadIsValid = false; + m_IsUsable = false; + m_ProgressiveCounter = 0u; + m_InputPath = resourcePath; + + // Create input texture ressources + TResourcePtr inputImage = resourceManager->Load(resourcePath, false, SResourceLoadCtl(false, true)); + if (inputImage == null || inputImage->Empty()) return false; + m_InputTexture = RHI::PixelFormatFallbacks::CreateTextureAndFallbackIFN(m_ApiManager, *inputImage, inputImage->GammaCorrected() || !inputImage->FloatingPoint(), resourcePath.Data()); + m_InputSampler = m_ApiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Input Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + RHI::SampleClampToEdge, + m_InputTexture->GetMipmapCount(), + false); + if (!PK_VERIFY(m_InputSampler != null)) + return false; + + // Get input type (latlong or cube) + m_InputIsLatLong = (m_InputTexture->GetType() != RHI::ETextureType::TextureCubemap); + + m_MustRegisterCompute = true; + m_LoadIsValid = true; + + return true; +} + +//---------------------------------------------------------------------------- + +// Register cubemap generation (compute dispatch + copy) on the given commandbuffer, if needed +bool CEnvironmentMap::GenerateCubemap(const RHI::PCommandBuffer &cmdBuff) +{ + if (!m_MustRegisterCompute) + return true; + + bool success = true; + + // Start registering commands + if (m_ProgressiveCounter == 0u) + { + // Register compute dispatch + success &= cmdBuff->BeginComputePass(); + + // Sampling source texture (cube or latlong) without specific processing, + // filling 6 max resolution face textures. + for (u32 face = 0; face < FACECOUNT; face++) + { + RHI::PComputeState computeState; + RHI::PConstantSet constantSet; + + if (m_InputIsLatLong) + { + computeState = m_ComputeLatLongState; + constantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("LatLong Constant Set"), m_ComputeLatLongConstantSetLayout); + } + else + { + computeState = m_ComputeCubeState; + constantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Cube Constant Set"), m_ComputeCubeConstantSetLayout); + } + if (!PK_VERIFY(constantSet != null)) + return false; + + RHI::PGpuBuffer faceInfo = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("FaceInfo Constant Buffer"), RHI::ConstantBuffer, sizeof(u32) * 2); + if (!PK_VERIFY(faceInfo != null)) + return false; + u32 *data = static_cast(m_ApiManager->MapCpuView(faceInfo)); + data[0] = face; + data[1] = MAXFACESIZE; + m_ApiManager->UnmapCpuView(faceInfo); + + constantSet->SetConstants(faceInfo, 0); + constantSet->SetConstants(m_InputSampler, m_InputTexture, 1); + constantSet->SetConstants(null, m_CubemapRenderTargets[0 + face * m_MipmapCount]->GetTexture(), 2); + constantSet->UpdateConstantValues(); + + success &= cmdBuff->BindComputeState(computeState); + + success &= cmdBuff->BindConstantSet(constantSet); + success &= cmdBuff->Dispatch( (MAXFACESIZE + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + (MAXFACESIZE + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + 1); + } + + // Compute mip maps (2*2 box blur) without specific processing + u32 faceSize = MAXFACESIZE / 2; + for (u32 level = 1; level < m_MipmapCount; level++) + { + for (u32 face = 0; face < FACECOUNT; face++) + { + RHI::PConstantSet constantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("MipMap Constant Set"), m_ComputeMipMapConstantSetLayout); + if (!PK_VERIFY(constantSet != null)) + return false; + + RHI::PGpuBuffer mipmapData = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("LatLong Constant Set"), RHI::ConstantBuffer, sizeof(CFloat2)); + if (!PK_VERIFY(mipmapData != null)) + return false; + CFloat2 *data = static_cast(m_ApiManager->MapCpuView(mipmapData)); + data[0] = 1.0f / CFloat2(faceSize, faceSize); // Texel size + m_ApiManager->UnmapCpuView(mipmapData); + + RHI::PTexture inputTexture = m_CubemapRenderTargets[(level - 1) + face * m_MipmapCount]->GetTexture(); + RHI::PTexture outputTexture = m_CubemapRenderTargets[level + face * m_MipmapCount]->GetTexture(); + constantSet->SetConstants(mipmapData, 0); + constantSet->SetConstants(m_ComputeMipMapSampler, inputTexture, 1); + constantSet->SetConstants(null, outputTexture, 2); + constantSet->UpdateConstantValues(); + + // Register compute dispatch + success &= cmdBuff->BeginComputePass(); + success &= cmdBuff->BindComputeState(m_ComputeMipMapState); + + success &= cmdBuff->BindConstantSet(constantSet); + success &= cmdBuff->Dispatch( (faceSize + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + (faceSize + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + 1); + } + faceSize /= 2; + } + + success &= cmdBuff->EndComputePass(); + + // Copy faces to cubemap + faceSize = MAXFACESIZE; + for (u32 level = 0; level < m_MipmapCount; level++) + { + for (u32 face = 0; face < FACECOUNT; face++) + { + // Register copy to output texture + success &= cmdBuff->CopyTexture(m_CubemapRenderTargets[level + face * m_MipmapCount]->GetTexture(), m_CubemapTexture, 0, level, 0, face, CUint3::ZERO, CUint3::ZERO, CUint3(faceSize, faceSize, 1)); + } + faceSize /= 2; + } + + // First mip: register copy form our simple mipmapped resource + // to output textures (background cubemap and IBL cubemap) + for (u32 face = 0; face < FACECOUNT; face++) + { + // For background, we have the same mip count as source cubemap + success &= cmdBuff->CopyTexture(m_CubemapRenderTargets[0 + face * m_MipmapCount]->GetTexture(), m_BackgroundCubemapTexture, 0, 0, 0, face, CUint3::ZERO, CUint3::ZERO, CUint3(MAXFACESIZE, MAXFACESIZE, 1)); + // For IBL, dst can have smaller so we don't necessary copy mip 0 + const u32 mipCountDelta = IntegerTools::Log2(MAXFACESIZE) - IntegerTools::Log2(MAXFACESIZEIBL); + success &= cmdBuff->CopyTexture(m_CubemapRenderTargets[mipCountDelta + face * m_MipmapCount]->GetTexture(), m_IBLCubemapTexture, 0, 0, 0, face, CUint3::ZERO, CUint3::ZERO, CUint3(MAXFACESIZEIBL, MAXFACESIZEIBL, 1)); + } + + // Background texture processing: blur + faceSize = MAXFACESIZE / 2; + for (u32 level = 1; level < m_MipmapCount; level++) + { + const float blurAngle = MipLevelToBlurAngle(level - 1); // Takes src level as input + const u32 blurRadius = _TexelRangeFromAngle(blurAngle, faceSize * 2); // Takes src face size as input + + success &= cmdBuff->BeginComputePass(); + + for (u32 face = 0; face < FACECOUNT; face++) + { + { + RHI::PConstantSet constantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Render Cubemap Face Constant Set"), m_RenderCubemapFaceConstantSetLayout); + if (!PK_VERIFY(constantSet != null)) + return false; + RHI::PGpuBuffer faceInfo = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("FaceInfo Constant Buffer"), RHI::ConstantBuffer, sizeof(u32) * 4); + if (!PK_VERIFY(faceInfo != null)) + return false; + u32 *data = static_cast(m_ApiManager->MapCpuView(faceInfo)); + data[0] = face; + data[1] = level; + data[2] = faceSize * 2; + data[3] = blurRadius; + m_ApiManager->UnmapCpuView(faceInfo); + + constantSet->SetConstants(faceInfo, 0); + constantSet->SetConstants(m_BackgroundCubemapSampler, m_BackgroundCubemapTexture, 1); + constantSet->SetConstants(null, m_FacesForBlurRenderTargets[(level - 1) + face * m_MipmapCount]->GetTexture(), 2); + constantSet->UpdateConstantValues(); + + success &= cmdBuff->BindComputeState(m_RenderCubemapFaceState); + success &= cmdBuff->BindConstantSet(constantSet); + u32 size = faceSize * 2 + 2 * blurRadius; + success &= cmdBuff->Dispatch( (size + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + (size + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + 1); + } + + { + RHI::PConstantSet constantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Blur Cubemap Constant Set"), m_BlurCubemapConstantSetLayout); + if (!PK_VERIFY(constantSet != null)) + return false; + RHI::PGpuBuffer faceInfo = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("FaceInfo Constant Buffer"), RHI::ConstantBuffer, sizeof(u32) * 3); + if (!PK_VERIFY(faceInfo != null)) + return false; + void *data = m_ApiManager->MapCpuView(faceInfo); + static_cast(data)[0] = faceSize; + static_cast(data)[1] = blurRadius; + static_cast(data)[2] = blurAngle; + m_ApiManager->UnmapCpuView(faceInfo); + constantSet->SetConstants(faceInfo, 0); + constantSet->SetConstants(m_BlurFaceSampler, m_FacesForBlurRenderTargets[(level - 1) + face * m_MipmapCount]->GetTexture(), 1); + constantSet->SetConstants(null, m_BackgroundCubeRenderTargets[level + face * m_MipmapCount]->GetTexture(), 2); + constantSet->UpdateConstantValues(); + + success &= cmdBuff->BeginComputePass(); + success &= cmdBuff->BindComputeState(m_BlurCubemapState); + success &= cmdBuff->BindConstantSet(constantSet); + success &= cmdBuff->Dispatch( (faceSize + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + (faceSize + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + 1); + } + } + success &= cmdBuff->EndComputePass(); + + for (u32 face = 0; face < FACECOUNT; face++) + success &= cmdBuff->CopyTexture(m_BackgroundCubeRenderTargets[level + face * m_MipmapCount]->GetTexture(), m_BackgroundCubemapTexture, 0, level, 0, face, CUint3::ZERO, CUint3::ZERO, CUint3(faceSize, faceSize, 1)); + + faceSize /= 2; + } + } + + // Processings other levels of the output IBL texture + const u32 totalSampleCount = IBLSAMPLECOUNT; + const u32 progressiveSteps = m_ProgressiveProcessing ? 64u : 1u; + const u32 sampleCount = totalSampleCount / progressiveSteps; + u32 faceSize = MAXFACESIZEIBL / 2; + success &= cmdBuff->BeginComputePass(); + for (u32 level = 1; level < m_MipmapCountIBL; level++) + { + for (u32 face = 0; face < FACECOUNT; face++) + { + RHI::PConstantSet constantSet = m_ApiManager->CreateConstantSet(RHI::SRHIResourceInfos("Filter Cubemap Constant Set"), m_FilterCubemapConstantSetLayout); + if (!PK_VERIFY(constantSet != null)) + return false; + + RHI::PGpuBuffer faceInfo = m_ApiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("FaceInfo Constant Buffer"), RHI::ConstantBuffer, sizeof(u32) * 6); + if (!PK_VERIFY(faceInfo != null)) + return false; + u32 *data = static_cast(m_ApiManager->MapCpuView(faceInfo)); + data[0] = face; + reinterpret_cast(data)[1] = level / (m_MipmapCountIBL - 1.0f); // Roughness + data[2] = faceSize; + data[3] = sampleCount; // Sample count this batch + data[4] = sampleCount * m_ProgressiveCounter; // Already performed sample count + data[5] = totalSampleCount; // Total sample count + m_ApiManager->UnmapCpuView(faceInfo); + + constantSet->SetConstants(faceInfo, 0); + constantSet->SetConstants(m_IBLCubemapSampler, m_CubemapTexture, 1); + constantSet->SetConstants(null, m_IBLCubeRenderTargets[level + face * m_MipmapCountIBL]->GetTexture(), 2); + constantSet->UpdateConstantValues(); + + + success &= cmdBuff->BindComputeState(m_FilterCubemapState); + + success &= cmdBuff->BindConstantSet(constantSet); + success &= cmdBuff->Dispatch( (faceSize + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + (faceSize + (PK_RH_GPU_THREADGROUP_SIZE_2D - 1)) / PK_RH_GPU_THREADGROUP_SIZE_2D, + 1); + + } + faceSize /= 2; + } + success &= cmdBuff->EndComputePass(); + + // Register copy to IBL output cube texture + faceSize = MAXFACESIZEIBL / 2; + for (u32 level = 1; level < m_MipmapCountIBL; level++) + { + for (u32 face = 0; face < FACECOUNT; face++) + { + success &= cmdBuff->CopyTexture(m_IBLCubeRenderTargets[level + face * m_MipmapCountIBL]->GetTexture(), m_IBLCubemapTexture, 0, level, 0, face, CUint3::ZERO, CUint3::ZERO, CUint3(faceSize, faceSize, 1)); + } + faceSize /= 2; + } + + m_ProgressiveCounter += 1u; + + // We have dispatched filtering for each mip level, + // we can start using the texture even if not fully processed. + m_IsUsable = true; + + if (m_ProgressiveCounter >= progressiveSteps) + m_MustRegisterCompute = false; + + return success; +} + +//---------------------------------------------------------------------------- + +RHI::PConstantSet CEnvironmentMap::GetIBLCubemapConstantSet() +{ + return m_LoadIsValid && m_IsUsable ? m_IBLCubemapConstantSet : m_WhiteEnvMapConstantSet; +} + +//---------------------------------------------------------------------------- + +RHI::PConstantSet CEnvironmentMap::GetBackgroundCubemapConstantSet() +{ + return m_LoadIsValid && m_IsUsable ? m_BackgroundCubemapConstantSet : m_WhiteEnvMapConstantSet; +} + +//---------------------------------------------------------------------------- + +bool CEnvironmentMap::IsValid() +{ + return m_LoadIsValid; +} + +//---------------------------------------------------------------------------- + +void CEnvironmentMap::Reset() +{ + m_InputPath = null; + m_InputTexture = null; + m_InputSampler = null; + m_InputIsLatLong = false; + m_MustRegisterCompute = false; + m_LoadIsValid = false; + m_IsUsable = false; +} + +//---------------------------------------------------------------------------- + +RHI::PConstantSet CEnvironmentMap::GetWhiteEnvMapConstantSet() +{ + return m_WhiteEnvMapConstantSet; +} + +//---------------------------------------------------------------------------- + +void CEnvironmentMap::SetProgressiveProcessing(bool progressiveProcessing) +{ + m_ProgressiveProcessing = progressiveProcessing; + m_ProgressiveCounter = 0u; + m_MustRegisterCompute = true; + m_IsUsable = false; +} + +//---------------------------------------------------------------------------- + +void CEnvironmentMap::SetRotation(float angle) +{ + angle = Units::DegreesToRadians(angle); + const float c = cosf(angle); + const float s = sinf(angle); + + if (!PK_VERIFY(m_CubemapRotation != null)) + return; + // std140: array stride must be 16 byte so the mat 2x2 is uploaded as a mat 2x4 + TMatrix *data = static_cast*>(m_ApiManager->MapCpuView(m_CubemapRotation)); + *data = TMatrix(CFloat4(c, -s, 0, 0), CFloat4(s, c, 0, 0)); + m_ApiManager->UnmapCpuView(m_CubemapRotation); +} + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/Entities/EnvironmentMapEntity.h b/Samples/PK-SampleLib/SampleScene/Entities/EnvironmentMapEntity.h new file mode 100644 index 00000000..256ca1e3 --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/Entities/EnvironmentMapEntity.h @@ -0,0 +1,108 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- +class CEnvironmentMap +{ +public: + CEnvironmentMap(); + ~CEnvironmentMap(); + + bool Init(const RHI::PApiManager &apiManager, CShaderLoader *shaderLoader); + bool Load(const CString &resourcePath, CResourceManager *resourceManager); + bool GenerateCubemap(const RHI::PCommandBuffer &cmdBuff); + bool IsValid(); // Input texture is loaded and cubemap generation compute shader has been dispatched. + void Reset(); + void SetRotation(float angle); + + RHI::PConstantSet GetIBLCubemapConstantSet(); + RHI::PConstantSet GetBackgroundCubemapConstantSet(); + RHI::PConstantSet GetWhiteEnvMapConstantSet(); + u32 GetBackgroundMipmapCount() { return m_MipmapCount; } + + void SetProgressiveProcessing(bool progressiveProcessing); + +private: + float MipLevelToBlurAngle(u32 srcMip); + +private: + bool m_ProgressiveProcessing; + CString m_InputPath; + RHI::PTexture m_InputTexture; + RHI::PConstantSampler m_InputSampler; + bool m_InputIsLatLong; + // m_MustRegisterCompute: Has still dispatch to register for generation/filtering + bool m_MustRegisterCompute; + // m_LoadIsValid: given source texture and associated RHI objects exist. + // It doesn't mean the output texture is filled with the final data, but it's allocated + // and will be filled next time we can register some dispatch. + bool m_LoadIsValid; + // m_IsUsable: we have started registering some dispatch, so the output texture has usable data on + // each mip even if not fully processed. Used to return a white cubemap constant set when + // registering dispatch has not occured. + bool m_IsUsable; + RHI::SConstantSetLayout m_CubemapSamplerConstLayout; + + TArray m_CubemapRenderTargets; + TArray m_IBLCubeRenderTargets; + TArray m_BackgroundCubeRenderTargets; + TArray m_FacesForBlurRenderTargets; + + RHI::PConstantSet m_CubemapConstantSet; + RHI::PConstantSet m_IBLCubemapConstantSet; + RHI::PConstantSet m_BackgroundCubemapConstantSet; + + RHI::PTexture m_CubemapTexture; + RHI::PTexture m_IBLCubemapTexture; + RHI::PTexture m_BackgroundCubemapTexture; + + RHI::PConstantSampler m_CubemapSampler; + RHI::PConstantSampler m_IBLCubemapSampler; + RHI::PConstantSampler m_BackgroundCubemapSampler; + + RHI::PComputeState m_ComputeLatLongState; + RHI::PComputeState m_ComputeCubeState; + RHI::PComputeState m_ComputeMipMapState; + RHI::PComputeState m_FilterCubemapState; + RHI::PComputeState m_BlurCubemapState; + RHI::PComputeState m_RenderCubemapFaceState; + + RHI::SConstantSetLayout m_ComputeLatLongConstantSetLayout; + RHI::SConstantSetLayout m_ComputeCubeConstantSetLayout; + RHI::SConstantSetLayout m_ComputeMipMapConstantSetLayout; + RHI::PConstantSampler m_ComputeMipMapSampler; + RHI::SConstantSetLayout m_FilterCubemapConstantSetLayout; + RHI::SConstantSetLayout m_BlurCubemapConstantSetLayout; + RHI::SConstantSetLayout m_RenderCubemapFaceConstantSetLayout; + RHI::PConstantSampler m_BlurFaceSampler; + + RHI::PConstantSet m_WhiteEnvMapConstantSet; + + RHI::EPixelFormat m_OutputTextureFormat; + + RHI::SConstantSetLayout m_ComputeMipMapCubemapConstantSetLayout; + u32 m_ProgressiveCounter; + u32 m_MipmapCount; + u32 m_MipmapCountIBL; + + RHI::PGpuBuffer m_CubemapRotation; + + RHI::PApiManager m_ApiManager; +}; +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/Entities/LightEntity.cpp b/Samples/PK-SampleLib/SampleScene/Entities/LightEntity.cpp new file mode 100644 index 00000000..3d75ffce --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/Entities/LightEntity.cpp @@ -0,0 +1,233 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "LightEntity.h" + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +SLightRenderPass::SLightRenderPass() +: m_LightsInfoConstantSet(null) +, m_LightsInfoBuffer(null) +, m_DirectionalLightsBuffer(null) +, m_SpotLightsBuffer(null) +, m_PointLightsBuffer(null) +, m_ShadowsInfoConstantSet(null) +, m_DummyShadowsInfoConstantSet(null) +, m_ShadowsInfoBuffer(null) +{ +} + +//---------------------------------------------------------------------------- + +bool SLightRenderPass::Init( const RHI::PApiManager &apiManager, + const RHI::SConstantSetLayout &lightInfoLayout, + const RHI::SConstantSetLayout &shadowsInfoLayout, + const RHI::PConstantSampler &samplerShadows, + const RHI::PTexture &defaultShadowTex) +{ + m_LightsInfoConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("LightsInfo Constant Set"), lightInfoLayout); + m_ShadowsInfoConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("ShadowsInfo Constant Set"), shadowsInfoLayout); + m_DummyShadowsInfoConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("ShadowsInfo Constant Set (dummy)"), shadowsInfoLayout); + + if (!PK_VERIFY( m_LightsInfoConstantSet != null && + m_ShadowsInfoConstantSet != null && + m_DummyShadowsInfoConstantSet != null)) + return false; + + if (m_LightsInfoBuffer == null) + { + m_LightsInfoBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("LightsInfos Constant Buffer"), RHI::ConstantBuffer, sizeof(SLightsInfo)); + if (m_LightsInfoBuffer == null) + return false; + } + if (m_ShadowsInfoBuffer == null) + { + m_ShadowsInfoBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("ShadowsInfos Constant Buffer"), RHI::ConstantBuffer, sizeof(SPerShadowData)); + if (m_ShadowsInfoBuffer == null) + return false; + } + + bool success = true; + + success &= m_DummyShadowsInfoConstantSet->SetConstants(m_ShadowsInfoBuffer, 0); + success &= m_DummyShadowsInfoConstantSet->SetConstants(samplerShadows, defaultShadowTex, 1); + success &= m_DummyShadowsInfoConstantSet->SetConstants(samplerShadows, defaultShadowTex, 2); + success &= m_DummyShadowsInfoConstantSet->SetConstants(samplerShadows, defaultShadowTex, 3); + success &= m_DummyShadowsInfoConstantSet->SetConstants(samplerShadows, defaultShadowTex, 4); + success &= m_DummyShadowsInfoConstantSet->UpdateConstantValues(); + + if (!PK_VERIFY(success)) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool SLightRenderPass::Update(const RHI::PApiManager &apiManager) +{ + const u32 directionalLightsDataSize = PKMax(m_DirectionalLights.Count(), 1U) * sizeof(SPerLightData); + const u32 spotLightsDataSize = PKMax(m_SpotLights.Count(), 1U) * sizeof(SPerLightData); + const u32 pointLightsDataSize = PKMax(m_PointLights.Count(), 1U) * sizeof(SPerLightData); + const bool needReinitDirectional = m_DirectionalLightsBuffer == null || directionalLightsDataSize > m_DirectionalLightsBuffer->GetByteSize(); + const bool needReinitSpot = m_SpotLightsBuffer == null || spotLightsDataSize > m_SpotLightsBuffer->GetByteSize(); + const bool needReinitPoint = m_PointLightsBuffer == null || pointLightsDataSize > m_PointLightsBuffer->GetByteSize(); + const bool needInitialize = needReinitDirectional || needReinitSpot || needReinitPoint; + + if (needInitialize) + { + if (needReinitDirectional) + { + m_DirectionalLightsBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Directional Lights Buffer"), RHI::RawBuffer, directionalLightsDataSize); + if (m_DirectionalLightsBuffer == null) + return false; + } + if (needReinitSpot) + { + m_SpotLightsBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Spot Lights Buffer"), RHI::RawBuffer, spotLightsDataSize); + if (m_SpotLightsBuffer == null) + return false; + } + if (needReinitPoint) + { + m_PointLightsBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Point Lights Buffer"), RHI::RawBuffer, pointLightsDataSize); + if (m_PointLightsBuffer == null) + return false; + } + + bool success = true; + + success &= m_LightsInfoConstantSet->SetConstants(m_LightsInfoBuffer, 0); + success &= m_LightsInfoConstantSet->SetConstants(m_DirectionalLightsBuffer, 1); + success &= m_LightsInfoConstantSet->SetConstants(m_SpotLightsBuffer, 2); + success &= m_LightsInfoConstantSet->SetConstants(m_PointLightsBuffer, 3); + success &= m_LightsInfoConstantSet->UpdateConstantValues(); + + if (!PK_VERIFY(success)) + return false; + } + + // Fill light info data: + m_LightsInfoData.m_DirectionalLightsCount = m_DirectionalLights.Count(); + m_LightsInfoData.m_SpotLightsCount = m_SpotLights.Count(); + m_LightsInfoData.m_PointLightsCount = m_PointLights.Count(); + + SLightsInfo *lightConstants = static_cast(apiManager->MapCpuView(m_LightsInfoBuffer)); + + if (lightConstants == null) + return false; + + *lightConstants = m_LightsInfoData; + + if (!apiManager->UnmapCpuView(m_LightsInfoBuffer)) + return false; + + // Fill data for each light: + if (!m_DirectionalLights.Empty()) + { + void *directionalLightsPtr = apiManager->MapCpuView(m_DirectionalLightsBuffer, 0, directionalLightsDataSize); + + if (directionalLightsPtr == null) + return false; + + Mem::Copy(directionalLightsPtr, m_DirectionalLights.RawDataPointer(), m_DirectionalLights.CoveredBytes()); + + if (!apiManager->UnmapCpuView(m_DirectionalLightsBuffer)) + return false; + } + if (!m_SpotLights.Empty()) + { + void *spotLightsPtr = apiManager->MapCpuView(m_SpotLightsBuffer, 0, spotLightsDataSize); + + if (spotLightsPtr == null) + return false; + + Mem::Copy(spotLightsPtr, m_SpotLights.RawDataPointer(), m_SpotLights.CoveredBytes()); + + if (!apiManager->UnmapCpuView(m_SpotLightsBuffer)) + return false; + } + if (!m_PointLights.Empty()) + { + void *pointLightsPtr = apiManager->MapCpuView(m_PointLightsBuffer, 0, pointLightsDataSize); + + if (pointLightsPtr == null) + return false; + + Mem::Copy(pointLightsPtr, m_PointLights.RawDataPointer(), m_PointLights.CoveredBytes()); + + if (!apiManager->UnmapCpuView(m_PointLightsBuffer)) + return false; + } + return true; +} + +//---------------------------------------------------------------------------- + +bool SLightRenderPass::UpdateShadowMaps(const RHI::PConstantSampler &samplerShadows) +{ + bool success = true; + + success &= m_ShadowsInfoConstantSet->SetConstants(m_ShadowsInfoBuffer, 0); + success &= m_ShadowsInfoConstantSet->SetConstants(samplerShadows, m_DirectionalShadows.GetDepthTexture(0), 1); + success &= m_ShadowsInfoConstantSet->SetConstants(samplerShadows, m_DirectionalShadows.GetDepthTexture(1), 2); + success &= m_ShadowsInfoConstantSet->SetConstants(samplerShadows, m_DirectionalShadows.GetDepthTexture(2), 3); + success &= m_ShadowsInfoConstantSet->SetConstants(samplerShadows, m_DirectionalShadows.GetDepthTexture(3), 4); + success &= m_ShadowsInfoConstantSet->UpdateConstantValues(); + return success; +} + +//---------------------------------------------------------------------------- + +bool SLightRenderPass::UpdateShadowsInfo(const RHI::PApiManager &apiManager) +{ + // Fill shadow info data: + m_ShadowData.m_WorldToShadow0 = m_DirectionalShadows.GetWorldToShadow(0); + m_ShadowData.m_WorldToShadow1 = m_DirectionalShadows.GetWorldToShadow(1); + m_ShadowData.m_WorldToShadow2 = m_DirectionalShadows.GetWorldToShadow(2); + m_ShadowData.m_WorldToShadow3 = m_DirectionalShadows.GetWorldToShadow(3); + m_ShadowData.m_ShadowsRanges.x() = m_DirectionalShadows.GetDepthRange(0); + m_ShadowData.m_ShadowsRanges.y() = m_DirectionalShadows.GetDepthRange(1); + m_ShadowData.m_ShadowsRanges.z() = m_DirectionalShadows.GetDepthRange(2); + m_ShadowData.m_ShadowsRanges.w() = m_DirectionalShadows.GetDepthRange(3); + m_ShadowData.m_ShadowsAspectRatio0 = m_DirectionalShadows.GetAspectRatio(0); + m_ShadowData.m_ShadowsAspectRatio1 = m_DirectionalShadows.GetAspectRatio(1); + m_ShadowData.m_ShadowsAspectRatio2 = m_DirectionalShadows.GetAspectRatio(2); + m_ShadowData.m_ShadowsAspectRatio3 = m_DirectionalShadows.GetAspectRatio(3); + m_ShadowData.m_ShadowsConstants.x() = m_DirectionalShadows.GetShadowBias(); + m_ShadowData.m_ShadowsConstants.y() = m_DirectionalShadows.GetShadowVariancePower(); + + m_ShadowData.m_ShadowsFlags = 0; + if (m_DirectionalShadows.GetShadowEnabled()) + m_ShadowData.m_ShadowsFlags |= 1; + if (m_DirectionalShadows.GetShadowVarianceEnabled()) + m_ShadowData.m_ShadowsFlags |= 2; + if (m_DirectionalShadows.GetDebugShadowEnabled()) + m_ShadowData.m_ShadowsFlags |= 4; + + SPerShadowData *shadowConstants = static_cast(apiManager->MapCpuView(m_ShadowsInfoBuffer)); + + if (shadowConstants == null) + return false; + + *shadowConstants = m_ShadowData; + + if (!apiManager->UnmapCpuView(m_ShadowsInfoBuffer)) + return false; + + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/Entities/LightEntity.h b/Samples/PK-SampleLib/SampleScene/Entities/LightEntity.h new file mode 100644 index 00000000..cc01e418 --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/Entities/LightEntity.h @@ -0,0 +1,136 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SLightRenderPass +{ + enum ELightType + { + Ambient, + Directional, + Point, + Spot, + }; + + struct SLightsInfo + { + u32 m_DirectionalLightsCount; + u32 m_SpotLightsCount; + u32 m_PointLightsCount; + u32 __padding0; + CFloat3 m_AmbientColor; + u32 __padding1; + }; + + struct SPerLightData + { + CFloat4 m_LightParam0; + CFloat4 m_LightParam1; + CFloat3 m_Color; + float __padding0; + + SPerLightData() + : m_LightParam0(CFloat4::ZERO) + , m_LightParam1(CFloat4::ZERO) + , m_Color(CFloat3::ONE) + { + } + + // Directional or Point light + SPerLightData(const CFloat3 &posDir, const CFloat3 &color) + : m_LightParam0(posDir, 0.0f) + , m_LightParam1(CFloat4::ZERO) + , m_Color(color) + { + } + + // Spot light + SPerLightData(const CFloat3 &position, const CFloat3 &direction, const CFloat3 &color, float angle, float coneFalloff) + : m_LightParam0(position, angle) + , m_LightParam1(direction.Normalized(), coneFalloff) + , m_Color(color) + { + } + }; + + struct SPerShadowData + { + CFloat4x4 m_WorldToShadow0; + CFloat4x4 m_WorldToShadow1; + CFloat4x4 m_WorldToShadow2; + CFloat4x4 m_WorldToShadow3; + CFloat4 m_ShadowsRanges; + CFloat2 m_ShadowsAspectRatio0; + CFloat2 m_ShadowsAspectRatio1; + CFloat2 m_ShadowsAspectRatio2; + CFloat2 m_ShadowsAspectRatio3; + CFloat4 m_ShadowsConstants; + int m_ShadowsFlags; + + SPerShadowData() + : m_WorldToShadow0(CFloat4x4::IDENTITY) + , m_WorldToShadow1(CFloat4x4::IDENTITY) + , m_WorldToShadow2(CFloat4x4::IDENTITY) + , m_WorldToShadow3(CFloat4x4::IDENTITY) + , m_ShadowsRanges(CFloat4::ZERO) + , m_ShadowsAspectRatio0(CFloat2::ONE) + , m_ShadowsAspectRatio1(CFloat2::ONE) + , m_ShadowsAspectRatio2(CFloat2::ONE) + , m_ShadowsAspectRatio3(CFloat2::ONE) + , m_ShadowsConstants(0.005f, 1.2f, 0, 0) + , m_ShadowsFlags(0) + { + } + }; + + SLightRenderPass(); + ~SLightRenderPass() { } + + bool Init( const RHI::PApiManager &apiManager, + const RHI::SConstantSetLayout &lightInfoLayout, + const RHI::SConstantSetLayout &shadowsInfoLayout, + const RHI::PConstantSampler &samplerShadows, + const RHI::PTexture &defaultShadowTex); + bool Update( const RHI::PApiManager &apiManager); + bool UpdateShadowMaps(const RHI::PConstantSampler &samplerShadows); + bool UpdateShadowsInfo(const RHI::PApiManager &apiManager); + + // Lights data: + SLightsInfo m_LightsInfoData; + TArray m_DirectionalLights; + TArray m_SpotLights; + TArray m_PointLights; + + // GPU info updated by Init and Update: + RHI::PConstantSet m_LightsInfoConstantSet; + RHI::PGpuBuffer m_LightsInfoBuffer; + RHI::PGpuBuffer m_DirectionalLightsBuffer; + RHI::PGpuBuffer m_SpotLightsBuffer; + RHI::PGpuBuffer m_PointLightsBuffer; + + RHI::PConstantSet m_ShadowsInfoConstantSet; + RHI::PConstantSet m_DummyShadowsInfoConstantSet; + RHI::PGpuBuffer m_ShadowsInfoBuffer; + + // Shadows: + CDirectionalShadows m_DirectionalShadows; + SPerShadowData m_ShadowData; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/Entities/MeshEntity.cpp b/Samples/PK-SampleLib/SampleScene/Entities/MeshEntity.cpp new file mode 100644 index 00000000..4277cb6f --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/Entities/MeshEntity.cpp @@ -0,0 +1,453 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "MeshEntity.h" + +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +STextureMap::STextureMap() +: m_Path(null) +, m_Texture(null) +, m_Sampler(null) +{ +} + +//---------------------------------------------------------------------------- + +SMesh::SMesh() +: m_Maps(0) +, m_Material(GBufferCombination_Count) +, m_MeshBatchCoordinateFrame(CCoordinateFrame::GlobalFrame()) +, m_MeshLOD(0) +, m_Roughness(0.5) +, m_Metalness(0) +, m_ResourceDirtyKey(0) +, m_ResourceCleanKey(0) +{ +} + +//---------------------------------------------------------------------------- + +SMesh::~SMesh() +{ + FastDelegate callback = FastDelegate(this, &SMesh::_OnResourceReloaded); + if (m_MeshResource != null && !m_MeshResource->Empty()) + { + if (m_MeshResource->m_OnReloaded.Contains(callback)) + m_MeshResource->m_OnReloaded -= callback; + if (m_MeshResource->m_OnCoordinateFrameChanged.Contains(callback)) + m_MeshResource->m_OnCoordinateFrameChanged -= callback; + } +} + +//---------------------------------------------------------------------------- + +bool SMesh::_AddMeshBatch(const RHI::PApiManager &apiManager, CMeshNew *mesh, u32 colorSet, bool loadAlphaAsColor) +{ + if (!m_MeshBatches.PushBack().Valid()) + return false; + + SMeshBatch &meshBuffers = m_MeshBatches.Last(); + + const CMeshTriangleBatch &triangleBatch = mesh->TriangleBatch(); + + const TStridedMemoryView positions = triangleBatch.m_VStream.Positions(); + const TStridedMemoryView normals = triangleBatch.m_VStream.Normals(); + const TStridedMemoryView tangents = triangleBatch.m_VStream.Tangents(); + const TStridedMemoryView texCoords = triangleBatch.m_VStream.Texcoords(); + const TStridedMemoryView colors = triangleBatch.m_VStream.AbstractStream(CVStreamSemanticDictionnary::ColorStreamToOrdinal(colorSet)); + + m_HasVertexColors = colors.Count() == positions.Count(); + + u32 offset = 0; + const u32 vertexCount = positions.Count(); + const u32 totalVboSize = vertexCount * (positions.ElementSizeInBytes() + normals.ElementSizeInBytes() + texCoords.ElementSizeInBytes() + (m_HasVertexColors ? colors.ElementSizeInBytes() : 0) + tangents.ElementSizeInBytes()); + RHI::PGpuBuffer vertexBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Vertex Buffer"), RHI::VertexBuffer, totalVboSize); + if (vertexBuffer == null) + return false; + + void *mappedVertexBuffer = apiManager->MapCpuView(vertexBuffer); + if (mappedVertexBuffer == null) + return false; + + // Transfer positions + meshBuffers.m_PositionsOffset = offset; + { + CFloat3 *buffData = static_cast(Mem::AdvanceRawPointer(mappedVertexBuffer, offset)); + for (u32 i = 0; i < vertexCount; ++i) + buffData[i] = positions[i]; + } + offset += positions.ElementSizeInBytes() * vertexCount; + + // Transfer normals + meshBuffers.m_NormalsOffset = offset; + PK_ASSERT(positions.Count() == normals.Count() || normals.Empty()); + if (positions.Count() == normals.Count()) + { + CFloat3 *buffData = static_cast(Mem::AdvanceRawPointer(mappedVertexBuffer, offset)); + for (u32 i = 0; i < vertexCount; ++i) + buffData[i] = normals[i]; + } + else // don't fail - fill with default + { + const CFloat3 defaultValue = CCoordinateFrame::Axis(Axis_Up); + CFloat3 *buffData = static_cast(Mem::AdvanceRawPointer(mappedVertexBuffer, offset)); + u32 i = 0; + for (; i < normals.Count(); ++i) + buffData[i] = normals[i]; + for (; i < vertexCount; ++i) + buffData[i] = defaultValue; + } + offset += normals.ElementSizeInBytes() * vertexCount; + + // Transfer tangents + meshBuffers.m_TangentsOffset = offset; + PK_ASSERT(positions.Count() == tangents.Count() || tangents.Empty()); + if (positions.Count() == tangents.Count()) + { + CFloat4 *buffData = static_cast(Mem::AdvanceRawPointer(mappedVertexBuffer, offset)); + PK_ASSERT(!tangents.Virtual() && tangents.Contiguous()); + PK_ASSERT(tangents.CoveredBytes() == vertexCount * sizeof(*buffData)); + Mem::Copy_Uncached(buffData, tangents.Data(), vertexCount * sizeof(*buffData)); + } + else // don't fail - fill with default + { + const CFloat4 defaultValue = CFloat4(CCoordinateFrame::Axis(Axis_Right), 1.0f); + CFloat4 *buffData = static_cast(Mem::AdvanceRawPointer(mappedVertexBuffer, offset)); + if (tangents.Count() > 0) + { + PK_ASSERT(!tangents.Virtual() && tangents.Contiguous()); + Mem::Copy_Uncached(buffData, tangents.Data(), tangents.Count() * sizeof(*buffData)); + } + Mem::Fill128_Uncached(buffData + tangents.Count(), &defaultValue, vertexCount - tangents.Count()); + } + offset += tangents.ElementSizeInBytes() * vertexCount; + + // Transfer UVs + meshBuffers.m_TexCoordsOffset = offset; + PK_ASSERT(positions.Count() == texCoords.Count() || texCoords.Empty()); + if (positions.Count() == texCoords.Count()) + { + CFloat2 *buffData = static_cast(Mem::AdvanceRawPointer(mappedVertexBuffer, offset)); + for (u32 i = 0; i < vertexCount; ++i) + buffData[i] = texCoords[i]; + } + else // don't fail - fill with default + { + const CFloat2 defaultValue = CFloat2::ZERO; + CFloat2 *buffData = static_cast(Mem::AdvanceRawPointer(mappedVertexBuffer, offset)); + u32 i = 0; + for (; i < texCoords.Count(); ++i) + buffData[i] = texCoords[i]; + for (; i < vertexCount; ++i) + buffData[i] = defaultValue; + } + offset += texCoords.ElementSizeInBytes() * vertexCount; + + // Transfer colors + meshBuffers.m_ColorsOffset = offset; + PK_ASSERT(positions.Count() == colors.Count() || colors.Empty()); + if (m_HasVertexColors) + { + CFloat4 *buffData = static_cast(Mem::AdvanceRawPointer(mappedVertexBuffer, offset)); + if (loadAlphaAsColor) + { + for (u32 i = 0; i < vertexCount; ++i) + buffData[i] = colors[i].www1(); + } + else + { + for (u32 i = 0; i < vertexCount; ++i) + buffData[i] = colors[i]; + } + offset += colors.ElementSizeInBytes() * vertexCount; + } + + PK_ASSERT(offset == totalVboSize); + +// buffers.PushBack(vertexBuffer); // NOTE(Julien): Removed, v2.b1 : unused + apiManager->UnmapCpuView(vertexBuffer); + + // Transfer indices + const void *indexData = triangleBatch.m_IStream.RawStream(); + if (!PK_VERIFY(indexData != null)) + return false; + + meshBuffers.m_IndexBuffer = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Index Buffer"), RHI::IndexBuffer, triangleBatch.m_IStream.StreamSize()); + if (meshBuffers.m_IndexBuffer == null) + return false; + + void *buffIndexData = apiManager->MapCpuView(meshBuffers.m_IndexBuffer); + if (!PK_VERIFY(buffIndexData != null)) + return false; + + Mem::Copy(buffIndexData, indexData, triangleBatch.m_IStream.StreamSize()); + + meshBuffers.m_BindPoseVertexBuffers = vertexBuffer; + apiManager->UnmapCpuView(meshBuffers.m_IndexBuffer); + meshBuffers.m_IndexCount = triangleBatch.m_IStream.IndexCount(); + meshBuffers.m_IndexSize = triangleBatch.m_IStream.IndexByteWidth() == 2 ? RHI::IndexBuffer16Bit : RHI::IndexBuffer32Bit; + + meshBuffers.m_BBox = mesh->BBox(); +// buffers.PushBack(meshBuffers.m_IndexBuffer); // NOTE(Julien): Removed, v2.b1 : unused + return true; +} + +//---------------------------------------------------------------------------- + +void SMesh::_OnResourceReloaded(CResourceMesh *resource) +{ + (void)resource; + m_ResourceDirtyKey.Inc(); +} + +//---------------------------------------------------------------------------- + +bool SMesh::Load( const RHI::PApiManager &apiManager, + TMemoryView constLayouts, + CResourceManager *resourceManager, + u32 colorSet /* = 0 */, + bool loadAlphaAsColor /* = false */, + const RHI::PTexture whiteFallbackTx /* = null */, + const RHI::PTexture normalFallbackTx /* = null */, + const RHI::PConstantSampler fallbackSampler /* = null */) +{ + if (!PK_VERIFY(resourceManager != null)) + return false; + + if (m_MeshResource != null) + m_MeshResource->m_OnReloaded -= FastDelegate(this, &SMesh::_OnResourceReloaded); + + const u32 prevDirtyKey = m_ResourceDirtyKey.Load(); + + m_MeshResource = resourceManager->Load(m_MeshPath, false, SResourceLoadCtl(false, true)); + if (m_MeshResource == null || + m_MeshResource->Empty()) + { + CLog::Log(PK_ERROR, "Failed loading mesh resource \"%s\"", m_MeshPath.Data()); + return false; + } + + if (m_MeshResource != null) + { + m_MeshResource->m_OnReloaded += FastDelegate(this, &SMesh::_OnResourceReloaded); + m_MeshResource->m_OnCoordinateFrameChanged += FastDelegate(this, &SMesh::_OnResourceReloaded); + } + + bool hasDiffuse = false; + bool hasRoughMetal = false; + bool hasNormal = false; + + // Choose a constant set layout depending on the mesh: + if (!m_DiffuseMap.m_Path.Empty() || m_DiffuseMap.m_ImageData != null) + { + if (!PK_VERIFY(_LoadMap(apiManager, m_DiffuseMap, resourceManager))) + return false; + hasDiffuse = true; + } + else if (whiteFallbackTx != null && fallbackSampler != null) + { + m_DiffuseMap.m_Sampler = fallbackSampler; + m_DiffuseMap.m_Texture = whiteFallbackTx; + hasDiffuse = true; + } + + if (!m_RoughMetalMap.m_Path.Empty() || m_RoughMetalMap.m_ImageData != null) + { + if (!PK_VERIFY(_LoadMap(apiManager, m_RoughMetalMap, resourceManager, false))) + return false; + hasRoughMetal = true; + } + else if (whiteFallbackTx != null && fallbackSampler != null) + { + m_RoughMetalMap.m_Sampler = fallbackSampler; + m_RoughMetalMap.m_Texture = whiteFallbackTx; + hasRoughMetal = true; + } + + if (!m_NormalMap.m_Path.Empty() || m_NormalMap.m_ImageData != null) + { + if (!PK_VERIFY(_LoadMap(apiManager, m_NormalMap, resourceManager, false))) + return false; + hasNormal = true; + } + else if (normalFallbackTx != null && fallbackSampler != null) + { + m_NormalMap.m_Sampler = fallbackSampler; + m_NormalMap.m_Texture = normalFallbackTx; + hasNormal = true; + } + + if (hasDiffuse && hasRoughMetal && hasNormal) + m_Material = GBufferCombination_Diffuse_RoughMetal_Normal; + if (hasDiffuse && hasRoughMetal) + m_Material = GBufferCombination_Diffuse_RoughMetal; + else if (hasDiffuse) + m_Material = GBufferCombination_Diffuse; + else + m_Material = GBufferCombination_SolidColor; + + const RHI::SConstantSetLayout &layout = constLayouts[m_Material]; + + m_ConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("Mesh Constant Set"), layout); + if (m_ConstantSet == null) + return false; + + m_MeshBatchCoordinateFrame = m_MeshResource->CoordinateSystem(); + m_MeshInfo = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("MeshInfo Constant Buffer"), RHI::ConstantBuffer, sizeof(SMeshFragmentConstant)); + + u32 bindingPoint = 0; + + m_ConstantSet->SetConstants(m_MeshInfo, bindingPoint); + ++bindingPoint; + + if (hasDiffuse) + { + m_ConstantSet->SetConstants(m_DiffuseMap.m_Sampler, m_DiffuseMap.m_Texture, bindingPoint); + ++bindingPoint; + } + + if (hasRoughMetal) + { + m_ConstantSet->SetConstants(m_RoughMetalMap.m_Sampler, m_RoughMetalMap.m_Texture, bindingPoint); + ++bindingPoint; + } + + if (hasNormal) + { + m_ConstantSet->SetConstants(m_NormalMap.m_Sampler, m_NormalMap.m_Texture, bindingPoint); + ++bindingPoint; + } + + m_ConstantSet->UpdateConstantValues(); + + TMemoryView batchList = m_MeshResource->BatchList(m_MeshLOD); + + for (const auto &batch : batchList) + { + if (PK_VERIFY(batch != null) && + !_AddMeshBatch(apiManager, batch->RawMesh(), colorSet, loadAlphaAsColor)) + { + return false; + } + } + + m_ResourceCleanKey = prevDirtyKey; + return true; +} + +//---------------------------------------------------------------------------- + +bool SMesh::_LoadMap(const RHI::PApiManager &apiManager, STextureMap &map, CResourceManager *resourceManager, bool interpretAsSrgb /* = true */) +{ + PCImage image = map.m_ImageData; + if (image == null) + { + map.m_Image = resourceManager->Load(map.m_Path, false, SResourceLoadCtl(false, true)); + if (map.m_Image != null) + image = &(*map.m_Image); + } + + if (image == null || image->Empty()) + { + CLog::Log(PK_ERROR, "Failed loading texture resource \"%s\"", map.m_Path.Data()); + return false; + } + + map.m_Texture = RHI::PixelFormatFallbacks::CreateTextureAndFallbackIFN(apiManager, *image, interpretAsSrgb, map.m_Path.Empty() ? "" : map.m_Path.Data()); + if (map.m_Texture == null) + return false; + + map.m_Sampler = apiManager->CreateConstantSampler( RHI::SRHIResourceInfos("Mesh Texture Sampler"), + RHI::SampleLinear, + RHI::SampleLinearMipmapLinear, + RHI::SampleRepeat, + RHI::SampleRepeat, + RHI::SampleRepeat, + map.m_Texture->GetMipmapCount()); + if (map.m_Sampler == null) + return false; + return true; +} + +//---------------------------------------------------------------------------- + +bool SMesh::RefreshSkinnedDatas(const RHI::PApiManager &apiManager, TMemoryView skinnedDatas) +{ + PK_NAMEDSCOPEDPROFILE("Refresh backdrop skinned datas"); + + if (m_MeshResource == null || m_MeshResource->Empty()) + return true; + + const u32 batchCount = m_MeshBatches.Count(); + for (u32 iBatch = 0; iBatch < batchCount; ++iBatch) + { + SMeshBatch &batch = m_MeshBatches[iBatch]; + + PK_ASSERT(batch.m_BindPoseVertexBuffers != null); + for (u32 iInstance = 0; iInstance < batch.m_Instances.Count(); ++iInstance) + batch.m_Instances[iInstance].m_HasValidSkinnedData = false; + } + if (skinnedDatas.Empty()) + return true; + + PK_ASSERT(skinnedDatas.Count() == m_Transforms.Count()); + const u32 skinnedDataCount = m_Transforms.Count(); + for (u32 iData = 0; iData < skinnedDataCount; ++iData) + { + const SSkinnedMeshData &skinnedData = skinnedDatas[iData]; + if (!skinnedData.m_Valid) + continue; + for (const auto &submesh : skinnedData.m_SubMeshes) + { + if (!PK_VERIFY(m_MeshBatches.Count() > submesh.m_SubMeshID)) + continue; + if (submesh.m_RawData.Empty()) // Nothing to update there + continue; + + SMeshBatch &batch = m_MeshBatches[submesh.m_SubMeshID]; + SMeshBatch::SInstance *instance = null; + if (iData >= batch.m_Instances.Count()) + { + if (!PK_VERIFY(batch.m_Instances.PushBack().Valid())) + return false; + instance = &batch.m_Instances.Last(); + } + else + instance = &batch.m_Instances[iData]; + + instance->m_HasValidSkinnedData = true; + + // Transfer positions/normals + PK_ASSERT(submesh.m_RawData.SizeInBytes() == (batch.m_NormalsOffset / sizeof(CFloat3)) * ( 2 * sizeof(CFloat3) + sizeof(CFloat4))); + if (instance->m_SkinnedVertexBuffers == null) + instance->m_SkinnedVertexBuffers = apiManager->CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Skinned Vertex Buffer"), RHI::VertexBuffer, submesh.m_RawData.SizeInBytes()); + if (!PK_VERIFY(instance->m_SkinnedVertexBuffers != null)) + return false; + + void *mappedData = apiManager->MapCpuView(instance->m_SkinnedVertexBuffers); + if (mappedData == null) + return false; + PK_NAMESPACE::Mem::Copy(mappedData, submesh.m_RawData.RawDataPointer(), submesh.m_RawData.SizeInBytes()); + apiManager->UnmapCpuView(instance->m_SkinnedVertexBuffers); + } + } + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleScene/Entities/MeshEntity.h b/Samples/PK-SampleLib/SampleScene/Entities/MeshEntity.h new file mode 100644 index 00000000..8dd5caed --- /dev/null +++ b/Samples/PK-SampleLib/SampleScene/Entities/MeshEntity.h @@ -0,0 +1,151 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#include +#include +#include +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct STextureMap +{ + CString m_Path; + TResourcePtr m_Image; + PCImage m_ImageData; + RHI::PTexture m_Texture; + RHI::PConstantSampler m_Sampler; + + STextureMap(); +}; + +//---------------------------------------------------------------------------- + +struct SMeshVertexConstant +{ + CFloat4x4 m_ModelMatrix; + CFloat4x4 m_NormalMatrix; +}; + +//---------------------------------------------------------------------------- + +struct SMeshFragmentConstant +{ + float m_Roughness; + float m_Metalness; +}; + +//---------------------------------------------------------------------------- + +// Render ready skinned data +struct SSkinnedMeshData +{ + struct SSkinnedDataSubMesh + { + u32 m_SubMeshID; + TArray m_RawData; + SSkinnedDataSubMesh() : m_SubMeshID(0) {} + }; + + bool m_Valid; + TSemiDynamicArray m_SubMeshes; + + SSkinnedMeshData() : m_Valid(false) { } +}; + +//---------------------------------------------------------------------------- + +struct SMesh +{ + SMesh(); + ~SMesh(); + + bool Load( const RHI::PApiManager &apiManager, + TMemoryView constLayout, + CResourceManager *resourceManager, + u32 colorSet = 0, + bool loadAlphaAsColor = false, + const RHI::PTexture whiteFallbackTex = null, + const RHI::PTexture normalFallbackTx = null, + const RHI::PConstantSampler samplerFallback = null); + + struct SMeshBatch + { + struct SInstance + { + bool m_HasValidSkinnedData; + RHI::PGpuBuffer m_SkinnedVertexBuffers; + + SInstance() : m_HasValidSkinnedData(false), m_SkinnedVertexBuffers(null) { } + }; + + TArray m_Instances; + RHI::PGpuBuffer m_BindPoseVertexBuffers; + RHI::PGpuBuffer m_Texcoords; + + u32 m_PositionsOffset; + u32 m_NormalsOffset; + u32 m_TangentsOffset; + u32 m_TexCoordsOffset; + u32 m_ColorsOffset; + + RHI::PGpuBuffer m_IndexBuffer; + RHI::EIndexBufferSize m_IndexSize; + u32 m_IndexCount; + + CAABB m_BBox; + }; + + TArray m_Transforms; + TResourcePtr m_MeshResource; + + STextureMap m_DiffuseMap; + STextureMap m_NormalMap; + STextureMap m_RoughMetalMap; + u32 m_Maps; + EGBufferCombination m_Material; + + RHI::PConstantSet m_ConstantSet; + + RHI::PGpuBuffer m_MeshInfo; + + ECoordinateFrame m_MeshBatchCoordinateFrame; + TArray m_MeshBatches; + CString m_MeshPath; + CGuid m_MeshLOD; + + float m_Roughness; + float m_Metalness; + bool m_HasVertexColors; + + PImage m_DummyWhiteImage; + PImage m_DummyNormalImage; + PImage m_DummyRoughMetalImage; + + TAtomic m_ResourceDirtyKey; // written by update thread + u32 m_ResourceCleanKey; // written by render thread + + bool RefreshSkinnedDatas(const RHI::PApiManager &apiManager, TMemoryView skinnedDatas); + bool IsDirty() const { return m_ResourceDirtyKey.Load() != m_ResourceCleanKey; } + +private: + static bool _LoadMap(const RHI::PApiManager &apiManager, STextureMap &map, CResourceManager *resourceManager, bool interpretAsSrgb = true); + bool _AddMeshBatch(const RHI::PApiManager &apiManager, CMeshNew *mesh, u32 colorSet, bool loadAlphaAsColor); + void _OnResourceReloaded(CResourceMesh *resource); +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleUtils.cpp b/Samples/PK-SampleLib/SampleUtils.cpp new file mode 100644 index 00000000..b99ee6d6 --- /dev/null +++ b/Samples/PK-SampleLib/SampleUtils.cpp @@ -0,0 +1,577 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "SampleUtils.h" +#include "RenderIntegrationRHI/RHIGraphicResources.h" +#include "Camera.h" + +// RHI +#include + +// Resources +#include +#include +#include +#include +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +const char *GetShaderExtensionStringFromApi(RHI::EGraphicalApi api, bool tmpFile /*= false*/) +{ + switch (api) + { + case RHI::GApi_OpenGL: + case RHI::GApi_OES: + return ".glsl"; + case RHI::GApi_Vulkan: + return tmpFile ? ".vk.glsl" : ".spv"; + case RHI::GApi_D3D12: + case RHI::GApi_D3D11: + return tmpFile ? ".hlsl" : ".cso"; + case RHI::GApi_Metal: + return tmpFile ? ".metal" : ".metallib"; + case RHI::GApi_Orbis: + return tmpFile ? ".pssl" : ".sb"; + case RHI::GApi_UNKNOWN2: + return tmpFile ? ".ags.pssl" : ".ags"; + default: + PK_RELEASE_ASSERT_NOT_REACHED(); + break; + } + return null; +} + +//---------------------------------------------------------------------------- + +const char *GetShaderLogExtensionStringFromAPI(RHI::EGraphicalApi API) +{ + switch (API) + { + case RHI::GApi_OpenGL: + case RHI::GApi_OES: + return ".glsl.err"; + case RHI::GApi_Vulkan: + return ".vk.glsl.err"; + case RHI::GApi_D3D12: + case RHI::GApi_D3D11: + return ".hlsl.err"; + case RHI::GApi_Metal: + return ".metal.err"; + case RHI::GApi_Orbis: + return ".pssl.err"; + case RHI::GApi_UNKNOWN2: + return ".ags.err"; + default: + PK_ASSERT_NOT_REACHED(); + break; + } + return null; +} + +//---------------------------------------------------------------------------- + +const char *GetShaderExtensionStringFromStage(RHI::EShaderStage stage) +{ + switch (stage) + { + case RHI::VertexShaderStage: + return ".vert"; + case RHI::FragmentShaderStage: + return ".frag"; + case RHI::GeometryShaderStage: + return ".geom"; + case RHI::ComputeShaderStage: + return ".comp"; + default: + PK_ASSERT_NOT_REACHED(); + break; + } + return null; +} + +//---------------------------------------------------------------------------- + +bool SSamplableRenderTarget::CreateRenderTarget( const RHI::SRHIResourceInfos &infos, + const RHI::PApiManager &apiManager, + const RHI::PConstantSampler &sampler, + RHI::EPixelFormat format, + const CUint2 &frameBufferSize, + const RHI::SConstantSetLayout &layoutFragment1Sampler) +{ + m_Size = frameBufferSize; + // Create the render targets + m_RenderTarget = apiManager->CreateRenderTarget(infos, format, frameBufferSize, true); + if (m_RenderTarget == null) + return false; + + // Create the constant sets + m_SamplerConstantSet = apiManager->CreateConstantSet(RHI::SRHIResourceInfos("SSamplable Render Target Constant Set"), layoutFragment1Sampler); + if (m_SamplerConstantSet == null) + return false; + m_SamplerConstantSet->SetConstants(sampler, m_RenderTarget->GetTexture(), 0); + m_SamplerConstantSet->UpdateConstantValues(); + return true; +} + +//---------------------------------------------------------------------------- + +namespace // static data +{ + // Screen quad static data + const float kScreenQuadVertex[] = + { + +1, +1, +1, -1, -1, -1, + -1, -1, -1, +1, +1, +1, + }; + + const u16 kScreenQuadIndex[] = + { + 0, 1, 2, 3, 4, 5 + }; + + const u64 kScreenQuadVertexCount = PK_ARRAY_COUNT(kScreenQuadVertex) / 2; + const TMemoryView kScreenQuadVertexViews[] = + { + TMemoryView(kScreenQuadVertex), + }; + + PK_STATIC_ASSERT(kScreenQuadVertexCount*2 == PK_ARRAY_COUNT(kScreenQuadVertex)); +} + +//---------------------------------------------------------------------------- + +namespace Utils +{ + const VertexHelper ScreenQuadHelper(kScreenQuadVertexCount, kScreenQuadVertexViews); + const VertexHelper IndexedScreenQuadHelper(kScreenQuadVertexCount, kScreenQuadVertexViews, kScreenQuadIndex); + + //---------------------------------------------------------------------------- + + template + TStridedMemoryView ViewNotEmpty(TStridedMemoryView view, u32 vCount, _Type defaultValue) + { + static const _Type _defaultValue = defaultValue; + if (view.Empty()) + return TStridedMemoryView(&_defaultValue, vCount, 0); + return view; + } + + //---------------------------------------------------------------------------- + + template + bool CopyDataToGpuBuffer(const RHI::PApiManager &apiManager, RHI::PGpuBuffer &buffer, const TStridedMemoryView<_Type> &view, u64 offset = 0) + { + //PK_ASSERT(view.CoveredBytes() <= buffer->GetByteSize()); // Can be different because of stride + // Api Manager map the buffer and return virtual space + void *data = apiManager->MapCpuView(buffer, offset, view.ElementSizeInBytes() * view.Count()); + if (data == null) + return false; + // Copy Data to virtual space + { + typedef typename TStridedMemoryView<_Type>::ValueTypeNonConst _TypeNonConst; + typedef typename TStridedMemoryView<_Type>::ValueTypeConst _TypeConst; + TStridedMemoryView<_TypeNonConst> bufferView(reinterpret_cast<_TypeNonConst*>(data), view.Count()); + TStridedMemoryView<_TypeConst> srcView(view); + Mem::CopyStreamToStream(bufferView, srcView); + } + // Unmap triggers async transfer to gpu space + return apiManager->UnmapCpuView(buffer); + } + + //---------------------------------------------------------------------------- + + template + bool CopyDataToGpuBuffer(const RHI::PApiManager &apiManager, RHI::PGpuBuffer &buffer, const TMemoryView<_Type> &view, u64 offset = 0) + { + const TStridedMemoryView<_Type> stridedView(view.Data(), view.Count()); + return CopyDataToGpuBuffer(apiManager, buffer, stridedView, offset); + } + + //---------------------------------------------------------------------------- + + template + bool CreateGpuBuffer(const RHI::SRHIResourceInfos &infos, const RHI::PApiManager &apiManager, const TStridedMemoryView<_Type> &view, RHI::PGpuBuffer &buffer, RHI::EBufferType bufferType) + { + buffer = apiManager->CreateGpuBuffer(infos, bufferType, view.ElementSizeInBytes() * view.Count()); + return buffer != null && CopyDataToGpuBuffer(apiManager, buffer, view); + } + + //---------------------------------------------------------------------------- + + template + bool CreateGpuBuffer(const RHI::SRHIResourceInfos &infos, const RHI::PApiManager &apiManager, const TMemoryView<_Type> &view, RHI::PGpuBuffer &buffer, RHI::EBufferType bufferType) + { + const TStridedMemoryView<_Type> stridedView(view.Data(), view.Count()); + return CreateGpuBuffer(infos, apiManager, stridedView, buffer, bufferType); + } + + //---------------------------------------------------------------------------- + + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const VertexHelper &helper, TArray &vertexArray, RHI::PGpuBuffer &indexBuffer, RHI::EIndexBufferSize &indexSize) + { + PK_ASSERT(indexBuffer == null && vertexArray.Empty()); + if (!vertexArray.Reserve(helper.m_VertexData.Count())) + return false; + PK_FOREACH(vinput, helper.m_VertexData) + { + // Api Manager create api specific gpu buffer + vertexArray.PushBack(); + if (!CreateGpuBuffer(RHI::SRHIResourceInfos("Vertex Data Buffer"), apiManager, *vinput, vertexArray.Last(), RHI::VertexBuffer)) + return false; + } + + if (!helper.m_IndexData16.Empty()) + { + indexSize = RHI::IndexBuffer16Bit; + if (!CreateGpuBuffer(RHI::SRHIResourceInfos("Index Buffer"), apiManager, helper.m_IndexData16, indexBuffer, RHI::IndexBuffer)) + return false; + } + + if (!helper.m_IndexData32.Empty()) + { + indexSize = RHI::IndexBuffer32Bit; + if (!CreateGpuBuffer(RHI::SRHIResourceInfos("Index Buffer"), apiManager, helper.m_IndexData32, indexBuffer, RHI::IndexBuffer)) + return false; + } + return true; + } + + //---------------------------------------------------------------------------- + + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const VertexHelper &helper, GpuBufferViews &views) + { + return CreateGpuBuffers(apiManager, helper, views.m_VertexBuffers, views.m_IndexBuffer, views.m_IndexBufferSize); + } + + //---------------------------------------------------------------------------- + + template + void RepackBoneIdxToFloat4(u32 maxBonePerVtx, const TMemoryView &boneIdx, const TMemoryView &outFloat4BoneIdx, const PSkeleton &skeleton) + { + PK_ASSERT(skeleton != null); + PK_ASSERT(maxBonePerVtx <= 0xFF); + const u32 vtxCount = boneIdx.Count() / maxBonePerVtx; + PK_ASSERT(vtxCount * 4 == outFloat4BoneIdx.Count()); + + for (u32 currentVtx = 0; currentVtx < vtxCount; ++currentVtx) + { + u32 currentIdx = currentVtx * maxBonePerVtx; + u32 outIdx = 0; + + while (outIdx < 4 && outIdx < maxBonePerVtx) + { + CGuid remappedIdx = skeleton->RemapBoneIdx(boneIdx[currentIdx + outIdx]); + outFloat4BoneIdx[currentVtx * 4 + outIdx] = static_cast(remappedIdx.Get()); + ++outIdx; + } + while (outIdx < 4) + { + outFloat4BoneIdx[currentVtx * 4 + outIdx] = 0.0f; + ++outIdx; + } + } + } + + void RepackWeightsToFloat4(u32 maxBonePerVtx, const TMemoryView &boneWeights, const TMemoryView &outFloat4BoneWeights) + { + PK_ASSERT(maxBonePerVtx <= 0xFF); + const u32 vtxCount = boneWeights.Count() / maxBonePerVtx; + PK_ASSERT(vtxCount * 4 == outFloat4BoneWeights.Count()); + + for (u32 currentVtx = 0; currentVtx < vtxCount; ++currentVtx) + { + u32 currentIdx = currentVtx * maxBonePerVtx; + u32 outIdx = 0; + + while (outIdx < 4 && outIdx < maxBonePerVtx) + { + outFloat4BoneWeights[currentVtx * 4 + outIdx] = boneWeights[currentIdx + outIdx]; + ++outIdx; + } + while (outIdx < 4) + { + outFloat4BoneWeights[currentVtx * 4 + outIdx] = 0.0f; + ++outIdx; + } + float length = 0.0f; + for (u32 i = 0; i < 4; ++i) + length += outFloat4BoneWeights[currentVtx * 4 + i]; + for (u32 i = 0; i < 4; ++i) + outFloat4BoneWeights[currentVtx * 4 + i] /= length; + } + } + //---------------------------------------------------------------------------- + + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const PCResourceMeshBatch &meshBatch, const PSkeleton &skeleton, const TMemoryView &semantics, GpuBufferViews &views) + { + if (meshBatch == null) + return false; + + CMeshTriangleBatch &trianglesBatch = meshBatch->RawMesh()->TriangleBatch(); + CBaseSkinningStreams *skinningStreams = meshBatch->m_OptimizedStreams; + + // Note (Alex) : this is not perfect and modify the format directly on memory. To be improved. Tangent is computed separately. + SVertexDeclaration vertDecl(trianglesBatch.m_VStream.VertexDeclaration()); + PK_FOREACH(it, semantics) + { + switch (*it) + { + case MeshPositions: + if (!vertDecl.FindAbstractStreamInternalIndex(CVStreamSemanticDictionnary::Ordinal_Position).Valid()) + vertDecl.AddStreamCodeIFN(SVStreamCode(CVStreamSemanticDictionnary::Ordinal_Position, SVStreamCode::Element_Float3)); + break; + case MeshNormals: + if (!vertDecl.FindAbstractStreamInternalIndex(CVStreamSemanticDictionnary::Ordinal_Normal).Valid()) + vertDecl.AddStreamCodeIFN(SVStreamCode(CVStreamSemanticDictionnary::Ordinal_Normal, SVStreamCode::Element_Float3, SVStreamCode::Normalized)); + break; + case MeshTangents: + if (!vertDecl.FindAbstractStreamInternalIndex(CVStreamSemanticDictionnary::Ordinal_Tangent).Valid()) + vertDecl.AddStreamCodeIFN(SVStreamCode(CVStreamSemanticDictionnary::Ordinal_Tangent, SVStreamCode::Element_Float4, SVStreamCode::SIMD_Friendly | SVStreamCode::Normalized)); + break; + case MeshColors: + if (!vertDecl.FindAbstractStreamInternalIndex(CVStreamSemanticDictionnary::Ordinal_Color).Valid()) + vertDecl.AddStreamCodeIFN(SVStreamCode(CVStreamSemanticDictionnary::Ordinal_Color, SVStreamCode::Element_Float4)); + break; + case MeshTexcoords: + if (!vertDecl.FindAbstractStreamInternalIndex(CVStreamSemanticDictionnary::Ordinal_Texcoord).Valid()) + vertDecl.AddStreamCodeIFN(SVStreamCode(CVStreamSemanticDictionnary::Ordinal_Texcoord, SVStreamCode::Element_Float2)); + break; + case MeshColors1: + if (!vertDecl.FindAbstractStreamInternalIndex(CVStreamSemanticDictionnary::ColorStreamToOrdinal(1)).Valid()) + vertDecl.AddStreamCodeIFN(SVStreamCode(CVStreamSemanticDictionnary::ColorStreamToOrdinal(1), SVStreamCode::Element_Float4)); + break; + case MeshTexcoords1: + if (!vertDecl.FindAbstractStreamInternalIndex(CVStreamSemanticDictionnary::UvStreamToOrdinal(1)).Valid()) + vertDecl.AddStreamCodeIFN(SVStreamCode(CVStreamSemanticDictionnary::UvStreamToOrdinal(1), SVStreamCode::Element_Float2)); + break; + case MeshBoneIds: + case MeshBoneWeights: + break; + default: + PK_ASSERT_NOT_IMPLEMENTED(); + break; + }; + } + + if (!PK_VERIFY(!trianglesBatch.m_VStream.Interleaved()) || trianglesBatch.m_VStream.VertexDeclaration() != vertDecl) + { + if (!trianglesBatch.m_VStream.Reformat(vertDecl, false)) + return false; + } + // Notify whatever was hooked onto the old VB that it has changed + meshBatch->RawMesh()->m_OnMeshDataChanged(); + + if (!PK_VERIFY(views.m_VertexBuffers.Reserve(semantics.Count()))) + return false; + bool success = true; + CMeshVStream &vStream = trianglesBatch.m_VStream; + const CMeshIStream &iStream = trianglesBatch.m_IStream; + + if (!vStream.Tangents().Empty()) + success &= MeshTangentBasisUtils::ComputeTangents( vStream.Positions(), + vStream.Normals(), + vStream.Texcoords(), + vStream.Tangents(), + iStream.RawStream(), + iStream.IndexByteWidth(), + iStream.PrimitiveType(), + trianglesBatch.PrimitiveCount(), + 0, false); + + PK_FOREACH(it, semantics) + { + if (!views.m_VertexBuffers.PushBack().Valid()) + return false; + switch (*it) + { + case MeshPositions: + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Positions Vertex Buffer"), apiManager, vStream.Positions(), views.m_VertexBuffers.Last(), RHI::VertexBuffer); + break; + case MeshNormals: + if (vStream.Has()) + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Normals Vertex Buffer"), apiManager, vStream.Normals(), views.m_VertexBuffers.Last(), RHI::VertexBuffer); + break; + case MeshTangents: + if (vStream.Has()) + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Tangents Vertex Buffer"), apiManager, vStream.Tangents(), views.m_VertexBuffers.Last(), RHI::VertexBuffer); + break; + case MeshColors: + if (vStream.Has()) + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Color0s Vertex Buffer"), apiManager, vStream.Colors(), views.m_VertexBuffers.Last(), RHI::VertexBuffer); + break; + case MeshTexcoords: + if (vStream.Has()) + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Texcoord0s Vertex Buffer"), apiManager, vStream.Texcoords(), views.m_VertexBuffers.Last(), RHI::VertexBuffer); + break; + case MeshColors1: + if (vStream.Has(CVStreamSemanticDictionnary::ColorStreamToOrdinal(1))) + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Color1s Vertex Buffer"), apiManager, vStream.AbstractStream(CVStreamSemanticDictionnary::ColorStreamToOrdinal(1)), views.m_VertexBuffers.Last(), RHI::VertexBuffer); + break; + case MeshTexcoords1: + if (vStream.Has(CVStreamSemanticDictionnary::UvStreamToOrdinal(1))) + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Texcoord1s Vertex Buffer"), apiManager, vStream.AbstractStream(CVStreamSemanticDictionnary::UvStreamToOrdinal(1)), views.m_VertexBuffers.Last(), RHI::VertexBuffer); + break; + case MeshBoneIds: + if (skinningStreams != null && skeleton != null) + { + const u32 maxInfluencesPerVertex = skinningStreams->MaxInfluencesPerVertex(); + const u32 vertexCount = skinningStreams->VertexCount(); + const u32 elemCount = vertexCount * maxInfluencesPerVertex; + + TArray indices; + if (!PK_VERIFY(indices.Resize(4 * vertexCount))) + return false; + + if (skinningStreams->IndexSize() == sizeof(u8)) + RepackBoneIdxToFloat4(maxInfluencesPerVertex, TMemoryView(skinningStreams->IndexStream(), elemCount), indices.ViewForWriting(), skeleton); + else if (skinningStreams->IndexSize() == sizeof(u16)) + RepackBoneIdxToFloat4(maxInfluencesPerVertex, TMemoryView(skinningStreams->IndexStream(), elemCount), indices.ViewForWriting(), skeleton); + else + { + PK_ASSERT_NOT_REACHED(); + return false; + } + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh bone indices Vertex Buffer"), apiManager, indices.View(), views.m_VertexBuffers.Last(), RHI::VertexBuffer); + } + break; + case MeshBoneWeights: + if (skinningStreams != null) + { + const u32 maxInfluencesPerVertex = skinningStreams->MaxInfluencesPerVertex(); + const u32 vertexCount = skinningStreams->VertexCount(); +// const u32 elemCount = vertexCount * maxInfluencesPerVertex; + + TArray weights; + if (!PK_VERIFY(weights.Resize(4 * vertexCount))) + return false; + + TMemoryView weightsStream = TMemoryView(skinningStreams->WeightStream(), vertexCount * maxInfluencesPerVertex); + RepackWeightsToFloat4(maxInfluencesPerVertex, weightsStream, weights.ViewForWriting()); + TMemoryView srcWeights = TMemoryView((CFloat4*)weights.RawDataPointer(), vertexCount); + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh bone weights Vertex Buffer"), apiManager, srcWeights, views.m_VertexBuffers.Last(), RHI::VertexBuffer); + } + break; + default: + PK_ASSERT_NOT_REACHED(); + break; + } + } + + if (iStream.IndexByteWidth() == CMeshIStream::U16Indices) + { + const TStridedMemoryView indexView(trianglesBatch.m_IStream.Stream(), trianglesBatch.m_IStream.IndexCount()); + views.m_IndexBufferSize = RHI::IndexBuffer16Bit; + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Index Buffer"), apiManager, indexView, views.m_IndexBuffer, RHI::IndexBuffer); + } + else if (iStream.IndexByteWidth() == CMeshIStream::U32Indices) + { + const TStridedMemoryView indexView(trianglesBatch.m_IStream.Stream(), trianglesBatch.m_IStream.IndexCount()); + views.m_IndexBufferSize = RHI::IndexBuffer32Bit; + success &= CreateGpuBuffer(RHI::SRHIResourceInfos("Mesh Index Buffer"), apiManager, indexView, views.m_IndexBuffer, RHI::IndexBuffer); + } + return success; + } + + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const PCResourceMesh &mesh, const TMemoryView &semantics, TArray &views) + { + return CreateGpuBuffers(apiManager, mesh.Get(), semantics, views); + } + + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const CResourceMesh *mesh, const TMemoryView &semantics, TArray &views) + { + const u32 lodCount = mesh->LODCount(); + u32 totalBatchCount = 0; + + for (u32 lodIdx = 0; lodIdx < lodCount; ++lodIdx) + { + totalBatchCount += mesh->BatchList(lodIdx).Count(); + } + + if (!PK_VERIFY(views.Resize(totalBatchCount))) + return false; + + u32 bufferIdx = 0; + for (u32 lodIdx = 0; lodIdx < lodCount; ++lodIdx) + { + for (u32 meshIdx = 0; meshIdx < mesh->BatchList(lodIdx).Count(); ++meshIdx) + { + const PCResourceMeshBatch meshBatch(&*mesh->BatchList(lodIdx)[meshIdx]); + if (!CreateGpuBuffers(apiManager, meshBatch, mesh->Skeleton(), semantics, views[bufferIdx++])) + return false; + } + } + return true; + } + + //---------------------------------------------------------------------------- + + bool CreateFrameBuffer(const RHI::SRHIResourceInfos &infos, const RHI::PApiManager &apiManager, const TMemoryView &renderTargets, RHI::PFrameBuffer &ptr, const RHI::PRenderPass &renderPassToBake) + { + ptr = apiManager->CreateFrameBuffer(infos); + if (ptr == null) + return false; + PK_FOREACH(rt, renderTargets) + { + if (ptr->AddRenderTarget(*rt) == false) + return false; + } + return ptr->BakeFrameBuffer(renderPassToBake); + } + + void SetupSceneInfoData(SSceneInfoData &data, const SCamera &camera, const ECoordinateFrame &frame) + { + SBasicCameraData camData; + + camData.m_CameraProj = camera.Proj(); + camData.m_CameraView = camera.View(); + camData.m_CameraZLimit = camera.ZLimits(); + camData.m_BillboardingView = camera.View(); + camData.m_ViewportSize = camera.WindowSize(); + SetupSceneInfoData(data, camData, frame); + } + + void SetupSceneInfoData(SSceneInfoData &data, const SBasicCameraData &camera, const ECoordinateFrame &frame) + { + CFloat4x4 view = camera.m_CameraView; + CFloat4x4 invView = view.Inverse(); + CFloat4x4 userToRHY; + + CCoordinateFrame::BuildTransitionFrame(frame, Frame_RightHand_Y_Up, userToRHY); + + CFloat4x4 bbMatrix = (camera.m_BillboardingView * userToRHY).Inverse(); + + data.m_ViewProj = view * camera.m_CameraProj; + data.m_Proj = camera.m_CameraProj; + data.m_View = view; + data.m_InvView = invView; + data.m_InvViewProj = data.m_ViewProj.Inverse(); + data.m_BillboardingView = bbMatrix; + data.m_PackNormalView = view * userToRHY; + data.m_UnpackNormalView = (view * userToRHY).Inverse(); + data.m_ZBufferLimits = CFloat2(camera.m_CameraZLimit); + data.m_ViewportSize = camera.m_ViewportSize; + data.m_Handedness = CFloat1(CCoordinateFrame::CrossSign(frame)); + data.m_SideVector = CCoordinateFrame::AxisSide().xyz0(); + data.m_DepthVector = CCoordinateFrame::AxisDepth().xyz0(); + // Helper matrix to convert from LHZup to user coord system. + CCoordinateFrame::BuildTransitionFrame(CCoordinateFrame::GlobalFrame(), Frame_LeftHand_Z_Up, data.m_UserToLHZ); + CCoordinateFrame::BuildTransitionFrame(Frame_LeftHand_Z_Up, CCoordinateFrame::GlobalFrame(), data.m_LHZToUser); + } +} // namespace Utils + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SampleUtils.h b/Samples/PK-SampleLib/SampleUtils.h new file mode 100644 index 00000000..d7e1e155 --- /dev/null +++ b/Samples/PK-SampleLib/SampleUtils.h @@ -0,0 +1,175 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PKSample.h" +#include +#include +#include +#include + +__PK_API_BEGIN +PK_FORWARD_DECLARE(ResourceMesh); +PK_FORWARD_DECLARE(ResourceMeshBatch); +PK_FORWARD_DECLARE(Skeleton); +__PK_API_END + +__PK_SAMPLE_API_BEGIN + +struct SSceneInfoData; +class CCameraBase; +struct SCamera; + +//---------------------------------------------------------------------------- + +#define INTERMEDIATE_SHADER_EXTENSION ".i" +#define SHADER_ERROR_EXTENSION ".err" +#define META_SHADER_EXTENSION ".meta" + +//---------------------------------------------------------------------------- + +CString GetDefineStringFromApi(RHI::EGraphicalApi api); + +// These return the extension with the dot: ".ext" +const char *GetShaderExtensionStringFromApi(RHI::EGraphicalApi api, bool tmpFile = false); +const char *GetShaderLogExtensionStringFromAPI(RHI::EGraphicalApi API); +const char *GetShaderExtensionStringFromStage(RHI::EShaderStage stage); + +//---------------------------------------------------------------------------- + +template +TVector ConvertSRGBToLinear(const TVector &v) +{ + TVector c; + for (u32 i = 0; i < _D; ++i) + c.Axis(i) = (v.Axis(i) <= 0.04045f) ? (v.Axis(i) / 12.92f) : (powf((v.Axis(i) + 0.055f) / 1.055f, 2.4f)); + return c; +} + +//---------------------------------------------------------------------------- + +template +TVector ConvertLinearToSRGB(const TVector &v) +{ + TVector c; + for (u32 i = 0; i < _D; ++i) + c.Axis(i) = (v.Axis(i) <= 0.0031308f) ? (v.Axis(i) * 12.92f) : (1.055f * powf(v.Axis(i), 1 / 2.4f) - 0.055f); + return c; +} + +//---------------------------------------------------------------------------- + +struct SSamplableRenderTarget +{ + CUint2 m_Size; + RHI::PRenderTarget m_RenderTarget; + RHI::PConstantSet m_SamplerConstantSet; + + bool CreateRenderTarget( const RHI::SRHIResourceInfos &infos, + const RHI::PApiManager &apiManager, + const RHI::PConstantSampler &sampler, + RHI::EPixelFormat format, + const CUint2 &frameBufferSize, + const RHI::SConstantSetLayout &layoutFragment1Sampler); +}; + +//---------------------------------------------------------------------------- + +namespace Utils +{ + struct VertexHelper + { + u64 m_VertexCount; + TMemoryView> m_VertexData; + TMemoryView m_IndexData16; + TMemoryView m_IndexData32; + + VertexHelper(u64 vertexCount, TMemoryView> vertexViews, TMemoryView indexViews) + : m_VertexCount(vertexCount) + , m_VertexData(vertexViews) + , m_IndexData16(indexViews) + {} + + VertexHelper(u64 vertexCount, TMemoryView> vertexViews, TMemoryView indexViews) + : m_VertexCount(vertexCount) + , m_VertexData(vertexViews) + , m_IndexData32(indexViews) + {} + + VertexHelper(u64 vertexCount, TMemoryView> vertexViews) + : m_VertexCount(vertexCount) + , m_VertexData(vertexViews) + {} + + u32 IndexCount() const + { + PK_ASSERT(m_IndexData16.Empty() || m_IndexData32.Empty()); + if (!m_IndexData16.Empty()) return m_IndexData16.Count(); + if (!m_IndexData32.Empty()) return m_IndexData32.Count(); + return 0; + } + }; + + //---------------------------------------------------------------------------- + + struct GpuBufferViews + { + TArray m_VertexBuffers; + RHI::PGpuBuffer m_IndexBuffer; + RHI::EIndexBufferSize m_IndexBufferSize; + }; + + //---------------------------------------------------------------------------- + + extern const VertexHelper ScreenQuadHelper; + extern const VertexHelper IndexedScreenQuadHelper; + + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const VertexHelper &helper, TArray &vertexArray, RHI::PGpuBuffer &indexBuffer, RHI::EIndexBufferSize &indexSize); + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const VertexHelper &helper, GpuBufferViews &views); + + //---------------------------------------------------------------------------- + + enum MeshSemanticFlags + { + MeshPositions, + MeshNormals, + MeshTangents, + MeshColors, // Color 0 + MeshTexcoords, // Texcoords 0 + MeshColors1, + MeshTexcoords1, + MeshBoneIds, + MeshBoneWeights, + __MaxMeshSemantics + }; + + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const PCResourceMesh &mesh, const TMemoryView &semantics, TArray &views); + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const CResourceMesh *mesh, const TMemoryView &semantics, TArray &views); + bool CreateGpuBuffers(const RHI::PApiManager &apiManager, const PCResourceMeshBatch &meshBatch, const PSkeleton &skeleton, const TMemoryView &semantics, GpuBufferViews &views); + + bool CreateFrameBuffer(const RHI::SRHIResourceInfos &infos, const RHI::PApiManager &apiManager, const TMemoryView &renderTargets, RHI::PFrameBuffer &ptr, const RHI::PRenderPass &renderPassToBake); + + // Camera info + struct SBasicCameraData + { + CFloat4x4 m_CameraView; + CFloat4x4 m_CameraProj; + CFloat4x4 m_BillboardingView; + CFloat2 m_CameraZLimit; + CFloat2 m_ViewportSize; + }; + + void SetupSceneInfoData(SSceneInfoData &data, const SCamera &camera, const ECoordinateFrame &frame); + void SetupSceneInfoData(SSceneInfoData &data, const SBasicCameraData &camera, const ECoordinateFrame &frame); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/BasicSceneShaderDefinitions.cpp b/Samples/PK-SampleLib/ShaderDefinitions/BasicSceneShaderDefinitions.cpp new file mode 100644 index 00000000..c5310e59 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/BasicSceneShaderDefinitions.cpp @@ -0,0 +1,377 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ShaderDefinitions.h" +#include "SampleLibShaderDefinitions.h" +#include "BasicSceneShaderDefinitions.h" +#include "UnitTestsShaderDefinitions.h" +#include "RenderIntegrationRHI/RHIGraphicResources.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +void CreateGBufferConstSetLayouts(EGBufferCombination combination, RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::FragmentShaderMask; + + RHI::SConstantBufferDesc meshFragmentConstant("MeshFragmentConstant"); + meshFragmentConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "Roughness")); + meshFragmentConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "Metalness")); + + layout.AddConstantsLayout(meshFragmentConstant); + + // The 3 combinations: + RHI::SConstantSamplerDesc diffuseSamplerLayout("DiffuseTex", RHI::SamplerTypeSingle); + RHI::SConstantSamplerDesc roughMetalSamplerLayout("RoughMetalTex", RHI::SamplerTypeSingle); + RHI::SConstantSamplerDesc normalSamplerLayout("NormalTex", RHI::SamplerTypeSingle); + + if (combination == GBufferCombination_Diffuse) + { + layout.AddConstantsLayout(diffuseSamplerLayout); + } + else if (combination == GBufferCombination_Diffuse_RoughMetal) + { + layout.AddConstantsLayout(diffuseSamplerLayout); + layout.AddConstantsLayout(roughMetalSamplerLayout); + } + else if (combination == GBufferCombination_Diffuse_RoughMetal_Normal) + { + layout.AddConstantsLayout(diffuseSamplerLayout); + layout.AddConstantsLayout(roughMetalSamplerLayout); + layout.AddConstantsLayout(normalSamplerLayout); + } +} + +//---------------------------------------------------------------------------- + +void FillGBufferShaderBindings( RHI::SShaderBindings &bindings, + const RHI::SConstantSetLayout &sceneInfo, + const RHI::SConstantSetLayout &meshInfo, + bool hasVertexColor, + bool hasTangents) +{ + bindings.Reset(); + + // Mesh + RHI::SPushConstantBuffer meshVertexConstant("MeshVertexConstant", RHI::VertexShaderMask); + meshVertexConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "ModelMatrix")); + meshVertexConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "NormalMatrix")); + bindings.m_PushConstants.PushBack(meshVertexConstant); + + // Vertex inputs + u32 location = 0; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = location++; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Normal"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = location++; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + if (hasTangents) + { + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Tangent"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = location++; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "HAS_TANGENTS")); + } + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "TexCoord"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = location++; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + if (hasVertexColor) + { + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = location++; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + // Mandatory define to avoid fragment shader hash collision + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "HAS_VERTEX_COLOR")); + } + + bindings.m_ConstantSets.PushBack(sceneInfo); + bindings.m_ConstantSets.PushBack(meshInfo); +} + +//---------------------------------------------------------------------------- + +void AddGBufferDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragNormal"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat3; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTangent"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragWorldPosition"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outDiffuse"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outDepth"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagR; + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outEmissive"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + // note(Alex): NormalSpec always after + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outNormalSpec"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "SolidMesh.vert"; + shaders.Last().m_FragmentShader = "GBuffer.frag"; + + RHI::SConstantSetLayout sceneInfo; + CreateSceneInfoConstantLayout(sceneInfo); + + RHI::SConstantSetLayout meshInfo[GBufferCombination_Count]; + for (u32 i = 0; i < static_cast(GBufferCombination_Count); ++i) + { + CreateGBufferConstSetLayouts(static_cast(i), meshInfo[i]); + } + + FillGBufferShaderBindings(description.m_Bindings, sceneInfo, meshInfo[GBufferCombination_SolidColor], false); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillGBufferShaderBindings(description.m_Bindings, sceneInfo, meshInfo[GBufferCombination_Diffuse], false); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillGBufferShaderBindings(description.m_Bindings, sceneInfo, meshInfo[GBufferCombination_Diffuse_RoughMetal], false); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillGBufferShaderBindings(description.m_Bindings, sceneInfo, meshInfo[GBufferCombination_Diffuse_RoughMetal_Normal], false, true); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + FillGBufferShaderBindings(description.m_Bindings, sceneInfo, meshInfo[GBufferCombination_SolidColor], true); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillGBufferShaderBindings(description.m_Bindings, sceneInfo, meshInfo[GBufferCombination_Diffuse], true); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillGBufferShaderBindings(description.m_Bindings, sceneInfo, meshInfo[GBufferCombination_Diffuse_RoughMetal_Normal], true, true); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillGBufferShadowShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &sceneInfo) +{ + bindings.Reset(); + + // Mesh + RHI::SPushConstantBuffer meshVertexConstant("MeshVertexConstant", RHI::VertexShaderMask); + meshVertexConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "ModelMatrix")); + bindings.m_PushConstants.PushBack(meshVertexConstant); + + // Vertex inputs + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + bindings.m_ConstantSets.PushBack(sceneInfo); +} + +//---------------------------------------------------------------------------- + +void AddGBufferShadowDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragWorldPosition"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outDepth"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRG; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "SolidMeshShadow.vert"; + shaders.Last().m_FragmentShader = "SolidMeshShadow.frag"; + + RHI::SConstantSetLayout sceneInfo; + CreateSceneInfoConstantLayout(sceneInfo); + + FillGBufferShadowShaderBindings(description.m_Bindings, sceneInfo); + + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void CreateDeferredSamplerLightingConstSetLayout(RHI::SConstantSetLayout &deferredSamplersLayout) +{ + deferredSamplersLayout.Reset(); + deferredSamplersLayout.m_ShaderStagesMask = RHI::FragmentShaderMask; + + RHI::SConstantSamplerDesc depthSampler("DepthSampler", RHI::SamplerTypeSingle); + RHI::SConstantSamplerDesc normalSampler("NormalRoughMetalSampler", RHI::SamplerTypeSingle); + RHI::SConstantSamplerDesc diffuseSampler("DiffuseSampler", RHI::SamplerTypeSingle); + + deferredSamplersLayout.AddConstantsLayout(depthSampler); + deferredSamplersLayout.AddConstantsLayout(normalSampler); + deferredSamplersLayout.AddConstantsLayout(diffuseSampler); +} + +//---------------------------------------------------------------------------- + +void FillDeferredLightShaderBindings(RHI::SShaderBindings &bindings, + RHI::SConstantSetLayout &sceneInfoLayout, + RHI::SConstantSetLayout &lightingLayout, + RHI::SConstantSetLayout &shadowLayout, + RHI::SConstantSetLayout &brdfLUTLayout, + RHI::SConstantSetLayout &environmentMapLayout, + RHI::SConstantSetLayout &deferredSamplersLayout) +{ + bindings.Reset(); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(sceneInfoLayout); + bindings.m_ConstantSets.PushBack(lightingLayout); + bindings.m_ConstantSets.PushBack(shadowLayout); + bindings.m_ConstantSets.PushBack(brdfLUTLayout); + bindings.m_ConstantSets.PushBack(environmentMapLayout); + bindings.m_ConstantSets.PushBack(deferredSamplersLayout); +} + +//---------------------------------------------------------------------------- + +void AddDeferredLightDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout sceneInfoLayout; + RHI::SConstantSetLayout lightingLayout; + RHI::SConstantSetLayout shadowLayout; + RHI::SConstantSetLayout brdfLUTLayout; + RHI::SConstantSetLayout environmentMapLayout; + RHI::SConstantSetLayout samplerLayout; + + CreateSceneInfoConstantLayout(sceneInfoLayout); + CreateLightingSceneInfoConstantLayout(lightingLayout, shadowLayout, brdfLUTLayout, environmentMapLayout); + CreateDeferredSamplerLightingConstSetLayout(samplerLayout); + FillDeferredLightShaderBindings(description.m_Bindings, sceneInfoLayout, lightingLayout, shadowLayout, brdfLUTLayout, environmentMapLayout, samplerLayout); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "DeferredLights.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void CreateDeferredMergingConstSetLayouts(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::FragmentShaderMask; + RHI::SConstantSamplerDesc lightAccuSampler("LightAccuTex", RHI::SamplerTypeSingle); + + layout.AddConstantsLayout(lightAccuSampler); + + for (u32 i = 0, gbufferCount = SPassDescription::s_GBufferDefaultFormats.Count(); i < gbufferCount; ++i) + { + const CString name = CString::Format("GBuffer%uTex", i); + const RHI::SConstantSamplerDesc gbufferSampler(name, RHI::SamplerTypeSingle); + + layout.AddConstantsLayout(gbufferSampler); + } +} + +//---------------------------------------------------------------------------- + +void FillDeferredMergingShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout) +{ + bindings.Reset(); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + RHI::SPushConstantBuffer pushConstants("DeferredMergingPushConstants", RHI::FragmentShaderMask); + pushConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "MinAlpha")); + bindings.m_PushConstants.PushBack(pushConstants); + + bindings.m_ConstantSets.PushBack(layout); +} + +//---------------------------------------------------------------------------- + +void AddDeferredMergingDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout layout; + + CreateDeferredMergingConstSetLayouts(layout); + + FillDeferredMergingShaderBindings(description.m_Bindings, layout); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "DeferredMerging.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/BasicSceneShaderDefinitions.h b/Samples/PK-SampleLib/ShaderDefinitions/BasicSceneShaderDefinitions.h new file mode 100644 index 00000000..61649b9a --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/BasicSceneShaderDefinitions.h @@ -0,0 +1,54 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +__PK_SAMPLE_API_BEGIN + +struct SShaderCombination; + +enum EGBufferCombination +{ + GBufferCombination_SolidColor, + GBufferCombination_Diffuse, + GBufferCombination_Diffuse_RoughMetal, + GBufferCombination_Diffuse_RoughMetal_Normal, + GBufferCombination_Count +}; + +void CreateGBufferConstSetLayouts(EGBufferCombination combination, RHI::SConstantSetLayout &layout); +void FillGBufferShaderBindings( RHI::SShaderBindings &bindings, + const RHI::SConstantSetLayout &sceneInfo, + const RHI::SConstantSetLayout &meshInfo, + bool hasVertexColor = false, + bool hasTangents = false); +void AddGBufferDefinition(TArray &shaders); +void FillGBufferShadowShaderBindings(RHI::SShaderBindings &bindings, + const RHI::SConstantSetLayout &sceneInfo); +void AddGBufferShadowDefinition(TArray &shaders); +void CreateDeferredSamplerLightingConstSetLayout(RHI::SConstantSetLayout &deferredSamplersLayout); +void FillDeferredLightShaderBindings(RHI::SShaderBindings &bindings, + RHI::SConstantSetLayout &sceneInfoLayout, + RHI::SConstantSetLayout &lightingLayout, + RHI::SConstantSetLayout &shadowLayout, + RHI::SConstantSetLayout &brdfLUTLayout, + RHI::SConstantSetLayout &environmentMapLayout, + RHI::SConstantSetLayout &deferredSamplersLayout); +void AddDeferredLightDefinition(TArray &shaders); + +void CreateDeferredMergingConstSetLayouts(RHI::SConstantSetLayout &layout); +void FillDeferredMergingShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout); +void AddDeferredMergingDefinition(TArray &shaders); + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/EditorShaderDefinitions.cpp b/Samples/PK-SampleLib/ShaderDefinitions/EditorShaderDefinitions.cpp new file mode 100644 index 00000000..0a390263 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/EditorShaderDefinitions.cpp @@ -0,0 +1,1159 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "EditorShaderDefinitions.h" +#include "ShaderDefinitions.h" +#include "SampleLibShaderDefinitions.h" +#include "UnitTestsShaderDefinitions.h" +#include "BasicSceneShaderDefinitions.h" + +#include "PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHIRenderIntegrationConfig.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +void FillEditorDebugParticleInputVertexBuffers( TArray &inputVertexBuffers, + ParticleDebugShader shaderMode, + EParticleDebugBillboarderType bbType, + bool gpuStorage) +{ + if (bbType == ParticleDebugBT_Billboard) + { + // Position: + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))); + } + else if (bbType == ParticleDebugBT_Mesh) + { + // Position: + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))); + // Mesh transforms: + if (!gpuStorage) + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(CFloat4x4))); + // Vertex colors + if (shaderMode == ParticleDebugShader_VertexColor) + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))); + } + else if (bbType == ParticleDebugBT_Light) + { + // Position: + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))); + // Light transforms: + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(CFloat3))); + // Light scales: + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(float))); + } + else if (bbType <= ParticleDebugBT_VertexBillboarding_SizeFloat2_C2) + { + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat2))); // Texcoords (expand direction) + } + else if (bbType != ParticleDebugBT_TriangleVertexBillboarding) + { + // Geom billboarding vertex inputs: + if (gpuStorage) + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))); // Position + else + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))); // Position + DrID: + + if (bbType >= ParticleDebugBT_GeomBillboarding_SizeFloat2_C0 && + bbType <= ParticleDebugBT_GeomBillboarding_SizeFloat2_C2) + { + // Size float2 + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat2))); + } + else + { + // Size float + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(float))); + } + + // Rotation: + if (bbType == ParticleDebugBT_GeomBillboarding_C0 || bbType == ParticleDebugBT_GeomBillboarding_C2 || + bbType == ParticleDebugBT_GeomBillboarding_SizeFloat2_C0 || bbType == ParticleDebugBT_GeomBillboarding_SizeFloat2_C2) + { + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(float))); + } + + // If > C1 + if ((bbType >= ParticleDebugBT_GeomBillboarding_C1 && bbType <= ParticleDebugBT_GeomBillboarding_C2) || + (bbType >= ParticleDebugBT_GeomBillboarding_SizeFloat2_C1 && bbType <= ParticleDebugBT_GeomBillboarding_SizeFloat2_C2)) + { + // Axis0: + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))); + + if (bbType == ParticleDebugBT_GeomBillboarding_SizeFloat2_C2 || bbType == ParticleDebugBT_GeomBillboarding_C2) + { + // Axis1: + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat3))); + } + } + if (gpuStorage) + { + // Enabled + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(u32))); + } + } + + // Common vertex inputs: + if (shaderMode == ParticleDebugShader_Color) + { + // Color: + if (((bbType == ParticleDebugBT_Mesh) && !gpuStorage) || bbType == ParticleDebugBT_Light) + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(CFloat4))); + else if (bbType == ParticleDebugBT_Billboard || + bbType >= ParticleDebugBT_GeomBillboarding_C0) + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(CFloat4))); + } + else if (shaderMode == ParticleDebugShader_Selection) + { + // IsSelected + if (bbType == ParticleDebugBT_Mesh || bbType == ParticleDebugBT_Light) + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerInstanceInput, sizeof(float))); + else if (bbType == ParticleDebugBT_Billboard || + bbType >= ParticleDebugBT_GeomBillboarding_C0) + inputVertexBuffers.PushBack(RHI::SVertexInputBufferDesc(RHI::PerVertexInput, sizeof(float))); + } + +} + +//---------------------------------------------------------------------------- + +void FillEditorDebugParticleShaderBindings( RHI::SShaderBindings &bindings, + ParticleDebugShader shaderMode, + EParticleDebugBillboarderType bbType, + bool gpuStorage, + RHI::SShaderDescription *shaderDescription) +{ + const bool vertexBB = bbType >= ParticleDebugBT_VertexBillboarding_C0 && bbType <= ParticleDebugBT_TriangleVertexBillboarding; + const bool geomBB = bbType >= ParticleDebugBT_GeomBillboarding_C0; + + bindings.Reset(); + if (shaderDescription != null) + { + shaderDescription->m_VertexOutput.Clear(); + shaderDescription->m_GeometryOutput.m_GeometryOutput.Clear(); + if (geomBB) + { + shaderDescription->m_DrawMode = RHI::DrawModePoint; + shaderDescription->m_GeometryOutput.m_MaxVertices = 6; + shaderDescription->m_GeometryOutput.m_PrimitiveType = RHI::DrawModeTriangleStrip; + } + else + { + shaderDescription->m_DrawMode = RHI::DrawModeTriangle; + } + } + + // Add the scene info constant set: + RHI::SConstantSetLayout layout; + CreateSceneInfoConstantLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + + u32 shaderLocationBinding = 0; + u32 vBufferLocationBinding = 0; + + RHI::SConstantSetLayout simDataSetLayout(RHI::VertexShaderMask); + RHI::SConstantSetLayout streamOffsetsSetLayout(RHI::VertexShaderMask); // gpu sim + RHI::SConstantSetLayout selectionSetLayout(RHI::VertexShaderMask); + + if (bbType <= ParticleDebugBT_Light) + { + PK_ASSERT(!geomBB && !vertexBB); + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Position", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + + if (bbType == ParticleDebugBT_Mesh) + { + if (gpuStorage) + { + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData")); + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("MeshTransforms")); + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Indirection")); + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("MeshTransformsOffsets")); + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("IndirectionOffsets")); + + RHI::SPushConstantBuffer pushConstant; + pushConstant.m_Name = "GPUMeshPushConstants"; + pushConstant.m_ShaderStagesMask = static_cast(RHI::VertexShaderMask); + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "DrawRequest")); + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "IndirectionOffsetsIndex")); + bindings.m_PushConstants.PushBack(pushConstant).Valid(); + } + else + { + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("MeshTransform", shaderLocationBinding, RHI::TypeFloat4x4, vBufferLocationBinding)).Valid(); + ++vBufferLocationBinding; + shaderLocationBinding += RHI::VarType::GetRowNumber(RHI::TypeFloat4x4); + } + if (shaderMode == ParticleDebugShader_VertexColor) + { + // This would conflict with per instance color if those shaderMode weren't exclusive + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Color", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + } + } + else if (bbType == ParticleDebugBT_Light) + { + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("MeshPosition", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)).Valid(); + ++vBufferLocationBinding; + ++shaderLocationBinding; + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("MeshScale", shaderLocationBinding, RHI::TypeFloat, vBufferLocationBinding)).Valid(); + ++vBufferLocationBinding; + ++shaderLocationBinding; + } + // Color output from vertex shader: + if (shaderDescription != null) + shaderDescription->m_VertexOutput.PushBack(RHI::SVertexOutput("fragColor", RHI::TypeFloat4)); + } + else if (vertexBB) + { + PK_ASSERT(!geomBB); + + const ERendererClass rendererType = (bbType != ParticleDebugBT_TriangleVertexBillboarding) ? Renderer_Billboard : Renderer_Triangle; + + // Vertex billboarding vertex inputs: + if (gpuStorage) + { + // GPU sim: only a single raw buffer, and define "BB_GPU_SIM" + // TODO: Rename BB_GPU_SIM with to as more generic GPU_STORAGE or GPU_SIM define. (make sure to change.vert .geom debug and standard billboarding shaders) + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_GPU_SIM")); + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData")); + + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("EnabledsOffsets")); + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("PositionsOffsets")); + } + else + { + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Indices")); // Right now, always add the indices raw buffer. Later, shader permutation + if (rendererType == Renderer_Billboard) + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Positions")); + else + { + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("VertexPosition0")); + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("VertexPosition1")); + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("VertexPosition2")); + } + } + + if (rendererType == Renderer_Billboard) + { + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("TexCoords", shaderLocationBinding, RHI::TypeFloat2, vBufferLocationBinding)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + } + + if (gpuStorage) + { + RHI::SPushConstantBuffer desc; + desc.m_ShaderStagesMask = RHI::VertexShaderMask; + if (SConstantDrawRequests::GetConstantBufferDesc(desc, 1, Renderer_Billboard)) + bindings.m_PushConstants.PushBack(desc); + } + else + bindings.m_ConstantSets.PushBack(PKSample::SConstantDrawRequests::GetConstantSetLayout(Renderer_Billboard)); + + { + RHI::SPushConstantBuffer desc; + + if (SConstantVertexBillboarding::GetPushConstantBufferDesc(desc, gpuStorage)) + bindings.m_PushConstants.PushBack(desc); + } + + // If the shader is a geom shader, we will output the color from the geom to the fragment: + if (shaderDescription != null) + shaderDescription->m_VertexOutput.PushBack(RHI::SVertexOutput("fragColor", RHI::TypeFloat4)); + + RHI::EVarType sizeType = RHI::TypeFloat; + + if (bbType >= ParticleDebugBT_VertexBillboarding_SizeFloat2_C0 && + bbType <= ParticleDebugBT_VertexBillboarding_SizeFloat2_C2) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "HAS_SizeFloat2")); + sizeType = RHI::TypeFloat2; + } + if (rendererType == Renderer_Billboard) + { + if (gpuStorage) + { + if (sizeType == RHI::TypeFloat2) + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Size2sOffsets")); + else + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("SizesOffsets")); + } + else + { + if (sizeType == RHI::TypeFloat2) + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Size2s")); + else + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Sizes")); + } + + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_FeatureC0")); + } + + if (bbType == ParticleDebugBT_VertexBillboarding_C0 || bbType == ParticleDebugBT_VertexBillboarding_C2 || + bbType == ParticleDebugBT_VertexBillboarding_SizeFloat2_C0 || bbType == ParticleDebugBT_VertexBillboarding_SizeFloat2_C2) + { + if (gpuStorage) + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("RotationsOffsets")); + else + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Rotations")); + } + + // If > C1 + if ((bbType >= ParticleDebugBT_VertexBillboarding_C1 && bbType <= ParticleDebugBT_VertexBillboarding_C2) || + (bbType >= ParticleDebugBT_VertexBillboarding_SizeFloat2_C1 && bbType <= ParticleDebugBT_VertexBillboarding_SizeFloat2_C2)) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_FeatureC1")); + + if (gpuStorage) + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Axis0sOffsets")); + else + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Axis0s")); + + if (bbType == ParticleDebugBT_VertexBillboarding_C1_Capsule || bbType == ParticleDebugBT_VertexBillboarding_SizeFloat2_C1_Capsule) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_FeatureC1_Capsule")); + } + + if (bbType == ParticleDebugBT_VertexBillboarding_SizeFloat2_C2 || bbType == ParticleDebugBT_VertexBillboarding_C2) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "BB_FeatureC2")); + if (gpuStorage) + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Axis1sOffsets")); + else + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Axis1s")); + } + } + } + else + { + PK_ASSERT(geomBB); + + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Position", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)); + ++shaderLocationBinding; + + // Geom billboarding vertex inputs: + if (!gpuStorage) + { + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("DrawRequestID", shaderLocationBinding, RHI::TypeFloat, vBufferLocationBinding, sizeof(CFloat3))); + ++shaderLocationBinding; + } + ++vBufferLocationBinding; + + // Geom billboarding: + if (gpuStorage) + { + RHI::SPushConstantBuffer desc; + desc.m_ShaderStagesMask = RHI::GeometryShaderMask; + if (SConstantDrawRequests::GetConstantBufferDesc(desc, 1, Renderer_Billboard)) + bindings.m_PushConstants.PushBack(desc); + } + else + bindings.m_ConstantSets.PushBack(PKSample::SConstantDrawRequests::GetConstantSetLayout(Renderer_Billboard)); + + // If the shader is a geom shader, we will output the color from the geom to the fragment: + if (shaderDescription != null) + { + shaderDescription->m_VertexOutput.PushBack(RHI::SVertexOutput("geomColor", RHI::TypeFloat4)); + shaderDescription->m_GeometryOutput.m_GeometryOutput.PushBack(RHI::SVertexOutput("fragColor", RHI::TypeFloat4)); + } + + RHI::EVarType sizeType = RHI::TypeFloat; + + if (bbType >= ParticleDebugBT_GeomBillboarding_SizeFloat2_C0 && + bbType <= ParticleDebugBT_GeomBillboarding_SizeFloat2_C2) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::GeometryShaderStage, "HAS_SizeFloat2")); + sizeType = RHI::TypeFloat2; + } + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::GeometryShaderStage, "BB_FeatureC0")); + + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Size", shaderLocationBinding, sizeType, vBufferLocationBinding)); + if (shaderDescription != null) + shaderDescription->m_VertexOutput.PushBack(RHI::SVertexOutput("geomSize", sizeType)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + + if (bbType == ParticleDebugBT_GeomBillboarding_C0 || bbType == ParticleDebugBT_GeomBillboarding_C2 || + bbType == ParticleDebugBT_GeomBillboarding_SizeFloat2_C0 || bbType == ParticleDebugBT_GeomBillboarding_SizeFloat2_C2) + { + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Rotation", shaderLocationBinding, RHI::TypeFloat, vBufferLocationBinding)); + if (shaderDescription != null) + shaderDescription->m_VertexOutput.PushBack(RHI::SVertexOutput("geomRotation", RHI::TypeFloat)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + } + + // If > C1 + if ((bbType >= ParticleDebugBT_GeomBillboarding_C1 && bbType <= ParticleDebugBT_GeomBillboarding_C2) || + (bbType >= ParticleDebugBT_GeomBillboarding_SizeFloat2_C1 && bbType <= ParticleDebugBT_GeomBillboarding_SizeFloat2_C2)) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::GeometryShaderStage, "BB_FeatureC1")); + + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Axis0", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)); + if (shaderDescription != null) + shaderDescription->m_VertexOutput.PushBack(RHI::SVertexOutput("geomAxis0", RHI::TypeFloat3)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + + if (bbType == ParticleDebugBT_GeomBillboarding_C1_Capsule || bbType == ParticleDebugBT_GeomBillboarding_SizeFloat2_C1_Capsule) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::GeometryShaderStage, "BB_FeatureC1_Capsule")); + } + + if (bbType == ParticleDebugBT_GeomBillboarding_SizeFloat2_C2 || bbType == ParticleDebugBT_GeomBillboarding_C2) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::GeometryShaderStage, "BB_FeatureC2")); + + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Axis1", shaderLocationBinding, RHI::TypeFloat3, vBufferLocationBinding)); + if (shaderDescription != null) + shaderDescription->m_VertexOutput.PushBack(RHI::SVertexOutput("geomAxis1", RHI::TypeFloat3)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + } + } + if (gpuStorage) + { + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Enabled", shaderLocationBinding, RHI::TypeUint, vBufferLocationBinding)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + } + } + + // Common vertex inputs: + if (shaderMode == ParticleDebugShader_Color) + { + if (vertexBB) + { + if (gpuStorage) + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("ColorsOffsets")); + else + simDataSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Colors")); + } + else if ((bbType == ParticleDebugBT_Mesh) && gpuStorage) + { + streamOffsetsSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("ColorsOffsets")); + } + else + { + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Color", shaderLocationBinding, RHI::TypeFloat4, vBufferLocationBinding)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + } + } + else if (shaderMode == ParticleDebugShader_Selection) + { + if (vertexBB) + { + selectionSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("Selections")); + } + else + { + if ((bbType == ParticleDebugBT_Mesh) && gpuStorage) + selectionSetLayout.AddConstantsLayout(RHI::SRawBufferDesc("IsSelected")); + else + { + bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("IsSelected", shaderLocationBinding, RHI::TypeFloat, vBufferLocationBinding)); + ++shaderLocationBinding; + ++vBufferLocationBinding; + } + // Just needed in the vertex shader passthrough for geometry shader billboarding: + if (geomBB) + { + if (shaderDescription != null) + { + shaderDescription->m_VertexOutput.PushBack(RHI::SVertexOutput("geomIsSelected", RHI::TypeFloat)); + } + } + } + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::GeometryShaderStage, "BB_Selection")); + } + else if (shaderMode == ParticleDebugShader_Error) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::VertexShaderStage, "DebugShader_Error")); + } + + if (vertexBB || ((bbType == ParticleDebugBT_Mesh) && gpuStorage)) + { + PK_ASSERT(!streamOffsetsSetLayout.m_Constants.Empty() || !gpuStorage); + if (!streamOffsetsSetLayout.m_Constants.Empty()) + bindings.m_ConstantSets.PushBack(streamOffsetsSetLayout); + + PK_ASSERT(!simDataSetLayout.m_Constants.Empty()); + bindings.m_ConstantSets.PushBack(simDataSetLayout); + + if (!selectionSetLayout.m_Constants.Empty()) + bindings.m_ConstantSets.PushBack(selectionSetLayout); + } +} + +//---------------------------------------------------------------------------- + +void AddEditorDebugParticleDefinition(TArray &shaders) +{ + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "DebugParticle.vert"; + shaders.Last().m_FragmentShader = "DebugDrawColor.frag"; + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, ParticleDebugBT_Billboard, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, ParticleDebugBT_Billboard, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, ParticleDebugBT_Billboard, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, ParticleDebugBT_Billboard, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, ParticleDebugBT_Mesh, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, ParticleDebugBT_Mesh, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_VertexColor, ParticleDebugBT_Mesh, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, ParticleDebugBT_Mesh, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, ParticleDebugBT_Mesh, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, ParticleDebugBT_Light, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, ParticleDebugBT_Light, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, ParticleDebugBT_Light, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, ParticleDebugBT_Light, false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + } + + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "DebugMesh_GPU.vert"; + shaders.Last().m_FragmentShader = "DebugDrawColor.frag"; + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, ParticleDebugBT_Mesh, true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, ParticleDebugBT_Mesh, true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_VertexColor, ParticleDebugBT_Mesh, true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, ParticleDebugBT_Mesh, true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, ParticleDebugBT_Mesh, true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + } +} + +//---------------------------------------------------------------------------- + +void AddEditorDebugVertexBBParticleDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Fragment output + PK_VERIFY(description.m_FragmentOutput.PushBack().Valid()); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + PK_VERIFY(shaders.PushBack().Valid()); + shaders.Last().m_VertexShader = "DebugParticleVertexBB.vert"; + shaders.Last().m_FragmentShader = "DebugDrawColor.frag"; + + for (u32 bbType = ParticleDebugBT_VertexBillboarding_C0; bbType <= ParticleDebugBT_VertexBillboarding_SizeFloat2_C2; ++bbType) + { + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, static_cast(bbType), false, &description); + PK_VERIFY(shaders.Last().m_ShaderDescriptions.PushBack(description).Valid()); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, static_cast(bbType), false, &description); + PK_VERIFY(shaders.Last().m_ShaderDescriptions.PushBack(description).Valid()); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, static_cast(bbType), false, &description); + PK_VERIFY(shaders.Last().m_ShaderDescriptions.PushBack(description).Valid()); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, static_cast(bbType), false, &description); + PK_VERIFY(shaders.Last().m_ShaderDescriptions.PushBack(description).Valid()); // PUSH SHADER DESCRIPTION + } + + PK_VERIFY(shaders.PushBack().Valid()); + shaders.Last().m_VertexShader = "DebugParticleVertexTri.vert"; + shaders.Last().m_FragmentShader = "DebugDrawColor.frag"; + + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, EParticleDebugBillboarderType::ParticleDebugBT_TriangleVertexBillboarding, false, &description); + PK_VERIFY(shaders.Last().m_ShaderDescriptions.PushBack(description).Valid()); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, EParticleDebugBillboarderType::ParticleDebugBT_TriangleVertexBillboarding, false, &description); + PK_VERIFY(shaders.Last().m_ShaderDescriptions.PushBack(description).Valid()); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, EParticleDebugBillboarderType::ParticleDebugBT_TriangleVertexBillboarding, false, &description); + PK_VERIFY(shaders.Last().m_ShaderDescriptions.PushBack(description).Valid()); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, EParticleDebugBillboarderType::ParticleDebugBT_TriangleVertexBillboarding, false, &description); + PK_VERIFY(shaders.Last().m_ShaderDescriptions.PushBack(description).Valid()); // PUSH SHADER DESCRIPTION + +#if (PK_PARTICLES_UPDATER_USE_GPU != 0) + // GPU vertex shader changes, there is no DrawRequestId + shaders.PushBack(); + shaders.Last().m_VertexShader = "DebugParticleVertexBB.vert"; + shaders.Last().m_FragmentShader = "DebugDrawColor.frag"; + + for (u32 bbType = ParticleDebugBT_VertexBillboarding_C0; bbType <= ParticleDebugBT_VertexBillboarding_SizeFloat2_C2; ++bbType) + { + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, static_cast(bbType), true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, static_cast(bbType), true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, static_cast(bbType), true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, static_cast(bbType), true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + } +#endif // (PK_PARTICLES_UPDATER_USE_GPU != 0) +} + +//---------------------------------------------------------------------------- + +void AddEditorDebugGeomBBParticleDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsGsPs; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "DebugParticleGeom_CPU.vert"; + shaders.Last().m_GeometryShader = "DebugParticleGeom.geom"; + shaders.Last().m_FragmentShader = "DebugDrawColor.frag"; + + for (u32 bbType = ParticleDebugBT_GeomBillboarding_C0; bbType < _ParticleDebugBT_Count; ++bbType) + { + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, static_cast(bbType), false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, static_cast(bbType), false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, static_cast(bbType), false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, static_cast(bbType), false, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + } + + // GPU vertex shader changes, there is no DrawRequestId + shaders.PushBack(); + shaders.Last().m_VertexShader = "DebugParticleGeom_GPU.vert"; + shaders.Last().m_GeometryShader = "DebugParticleGeom.geom"; + shaders.Last().m_FragmentShader = "DebugDrawColor.frag"; + + for (u32 bbType = ParticleDebugBT_GeomBillboarding_C0; bbType < _ParticleDebugBT_Count; ++bbType) + { + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_White, static_cast(bbType), true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Color, static_cast(bbType), true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Selection, static_cast(bbType), true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + FillEditorDebugParticleShaderBindings(description.m_Bindings, ParticleDebugShader_Error, static_cast(bbType), true, &description); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + } +} + +//---------------------------------------------------------------------------- + +void FillEditorDebugDrawShaderBindings(RHI::SShaderBindings &bindings, bool hasVertexColor, bool isClipSpace) +{ + bindings.Reset(); + + // Vertex inputs + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + if (hasVertexColor) + { + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_BufferIdx = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + } + + if (!isClipSpace) + { + // Scene info: + RHI::SConstantSetLayout layout; + CreateSceneInfoConstantLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + } + + if (!hasVertexColor) + { + // Debug color: + RHI::SPushConstantBuffer debugColor("DebugColor", RHI::VertexShaderMask); + debugColor.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "Color")); + bindings.m_PushConstants.PushBack(debugColor); + } +} + +//---------------------------------------------------------------------------- + +void AddEditorDebugDrawDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + shaders.PushBack(); + + shaders.Last().m_VertexShader = "DebugDraw.vert"; + shaders.Last().m_FragmentShader = "DebugDrawColor.frag"; + + FillEditorDebugDrawShaderBindings(description.m_Bindings, false, false); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugDrawShaderBindings(description.m_Bindings, false, true); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugDrawShaderBindings(description.m_Bindings, true, false); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugDrawShaderBindings(description.m_Bindings, false, false); + description.m_Bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("MeshTransform", 1, RHI::TypeFloat4x4, 1)); + description.m_Bindings.m_InputAttributes.PushBack(RHI::SVertexAttributeDesc("Color", 5, RHI::TypeFloat4, 2)); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillEditorDebugDrawShaderBindings(description.m_Bindings, true, true); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillDebugDrawValueConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + // Data buffer + layout.AddConstantsLayout(RHI::SRawBufferDesc("Data")); +} + +//---------------------------------------------------------------------------- + +void FillEditorDebugDrawValueShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + + // Vertex inputs + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "TexCoords"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + // Scene info + RHI::SConstantSetLayout sceneConstantSetlayout; + CreateSceneInfoConstantLayout(sceneConstantSetlayout); + bindings.m_ConstantSets.PushBack(sceneConstantSetlayout); + + // Data buffers (instanced) + RHI::SConstantSetLayout layout(RHI::VertexShaderMask); + FillDebugDrawValueConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + + // Texture atlas texture (TODO: Glyphs SDF texture for better rendering) + RHI::SConstantSetLayout textureAtlasSetLayout(RHI::FragmentShaderMask); + textureAtlasSetLayout.AddConstantsLayout(RHI::SConstantSamplerDesc("TextAtlas", RHI::SamplerTypeSingle)); + bindings.m_ConstantSets.PushBack(textureAtlasSetLayout); + + // Text atlas + bindings.m_ConstantSets.PushBack(SConstantAtlasKey::GetAtlasConstantSetLayout()); +} + +//---------------------------------------------------------------------------- + +void AddEditorDebugDrawValueDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoords"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + description.m_VertexOutput.Last().m_Interpolation = RHI::InterpolationFlat; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragFlags"; + description.m_VertexOutput.Last().m_Type = RHI::TypeUint; + description.m_VertexOutput.Last().m_Interpolation = RHI::InterpolationFlat; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragDrawDigitCounts"; + description.m_VertexOutput.Last().m_Type = RHI::TypeUint4; + description.m_VertexOutput.Last().m_Interpolation = RHI::InterpolationFlat; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragValue"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + description.m_VertexOutput.Last().m_Interpolation = RHI::InterpolationFlat; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + shaders.PushBack(); + + shaders.Last().m_VertexShader = "DebugDrawValue.vert"; // DEBUG_DRAW_VALUE_VERTEX_SHADER_PATH + shaders.Last().m_FragmentShader = "DebugDrawValue.frag"; // DEBUG_DRAW_VALUE_FRAGMENT_SHADER_PATH + + FillEditorDebugDrawValueShaderBindings(description.m_Bindings); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillEditorDebugDrawLineShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + + // Scene info + RHI::SConstantSetLayout sceneConstantSetlayout; + CreateSceneInfoConstantLayout(sceneConstantSetlayout); + bindings.m_ConstantSets.PushBack(sceneConstantSetlayout); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.Last().m_BufferIdx = 0; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + bindings.m_InputAttributes.Last().m_StartOffset = 4 * sizeof(float); + bindings.m_InputAttributes.Last().m_BufferIdx = 1; +} + +//---------------------------------------------------------------------------- + +void AddEditorDebugDrawLineDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + description.m_VertexOutput.Last().m_Interpolation = RHI::InterpolationSmooth; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; // TODO: What about the alpha? + + shaders.PushBack(); + shaders.Last().m_VertexShader = "DebugDrawLine.vert"; // DEBUG_DRAW_LINE_VERTEX_SHADER_PATH + shaders.Last().m_FragmentShader = "DebugDrawLine.frag"; // DEBUG_DRAW_LINE_FRAGMENT_SHADER_PATH + + FillEditorDebugDrawLineShaderBindings(description.m_Bindings); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void AddEditorHeatmapOverdraw(TArray &shaders) +{ + + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout setLayout(RHI::FragmentShaderMask); + + setLayout.AddConstantsLayout(RHI::SConstantSamplerDesc("IntensityMap", RHI::SamplerTypeSingle)); + setLayout.AddConstantsLayout(RHI::SConstantSamplerDesc("OverdrawLUT", RHI::SamplerTypeSingle)); + + FillCopyShaderBindings(CopyCombination_Basic, description.m_Bindings, setLayout); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "Heatmap.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------- + +void CreateBrushBackdropInfoConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + // Scene info: + RHI::SConstantBufferDesc bufferLayout("Info"); + + bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "Top")); + bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "Bottom")); + bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "Origin")); + bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "UserToRHY")); + bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "InvMat")); + bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "EnvironmentMapColor")); + bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "EnvironmentMapMipLevel")); + bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "EnvironmentMapVisible")); + layout.AddConstantsLayout(bufferLayout); +} + +//---------------------------------------------------------------------- + +void FillBrushBackdropShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &brushInfo, const RHI::SConstantSetLayout &environmentMapLayout) +{ + bindings.Reset(); + + // Vertex inputs + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(brushInfo); + bindings.m_ConstantSets.PushBack(environmentMapLayout); +} + +//---------------------------------------------------------------------- + +void AddBrushBackdropDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + // Create environment map sampler layout + RHI::SConstantSetLayout environmentMapConstSetLayout; + CreateCubemapSamplerConstantSetLayout(environmentMapConstSetLayout); + + RHI::SConstantSetLayout brushInfoConstSetLayout; + CreateBrushBackdropInfoConstantSetLayout(brushInfoConstSetLayout); + + FillBrushBackdropShaderBindings(description.m_Bindings, brushInfoConstSetLayout, environmentMapConstSetLayout); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "BrushBackdrop.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillParticleLightShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + + // Vertex inputs + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.Last().m_BufferIdx = 0; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "LightPosition"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.Last().m_BufferIdx = 1; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "LightRadius"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 2; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat; + bindings.m_InputAttributes.Last().m_BufferIdx = 2; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "LightColor"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 3; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.Last().m_BufferIdx = 3; + + // Samplers layout: + RHI::SConstantSetLayout samplersLayout; + CreateDeferredSamplerLightingConstSetLayout(samplersLayout); + bindings.m_ConstantSets.PushBack(samplersLayout); + + // Scene info: + RHI::SConstantSetLayout sceneInfoLayout; + CreateSceneInfoConstantLayout(sceneInfoLayout); + bindings.m_ConstantSets.PushBack(sceneInfoLayout); +} + +//---------------------------------------------------------------------------- + +void AddParticleLightDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragWorldPosition"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragLightPosition"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat3; + description.m_VertexOutput.Last().m_Interpolation = RHI::InterpolationFlat; + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragLightRadius"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat; + description.m_VertexOutput.Last().m_Interpolation = RHI::InterpolationFlat; + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragLightColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat3; + description.m_VertexOutput.Last().m_Interpolation = RHI::InterpolationFlat; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillParticleLightShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "LightInstanced.vert"; + shaders.Last().m_FragmentShader = "PointLightInstanced.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + + +//---------------------------------------------------------------------------- + +void CreateEditorSelectorConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + + RHI::SConstantBufferDesc constantBufferDesc("SelectionInfo"); + constantBufferDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint4, "PositionsOffset")); + constantBufferDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint4, "RadiusOffset")); + constantBufferDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint4, "EnabledOffset")); + constantBufferDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "RayOrigin")); + constantBufferDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "RayDirection")); + constantBufferDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Planes")); + constantBufferDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Mode")); + + layout.AddConstantsLayout(constantBufferDesc); + layout.AddConstantsLayout(RHI::SRawBufferDesc("Stream", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("StreamInfo", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("Selection", false)); +} + +//---------------------------------------------------------------------------- + +void AddEditorSelectorDefinition(TArray &shaders) +{ + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + RHI::SConstantSetLayout layout; + CreateEditorSelectorConstantSetLayout(layout); + description.m_Bindings.m_ConstantSets.PushBack(layout); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ParticleSelector.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + RHI::SConstantSetLayout layout; + CreateEditorSelectorConstantSetLayout(layout); + description.m_Bindings.m_ConstantSets.PushBack(layout); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ParticleSelectorCycle.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } +} + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/EditorShaderDefinitions.h b/Samples/PK-SampleLib/ShaderDefinitions/EditorShaderDefinitions.h new file mode 100644 index 00000000..9f11141e --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/EditorShaderDefinitions.h @@ -0,0 +1,97 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SShaderCombination; + +//---------------------------------------------------------------------------- + +enum ParticleDebugShader +{ + ParticleDebugShader_White, + ParticleDebugShader_Color, + ParticleDebugShader_VertexColor, // Per vertex color: for meshes + ParticleDebugShader_Selection, + ParticleDebugShader_Error, +}; + +// All the possible geometry billboarding: +enum EParticleDebugBillboarderType +{ + ParticleDebugBT_Billboard, // Billboards/Ribbons (CPU streams) + ParticleDebugBT_Mesh, // Meshes + ParticleDebugBT_Light, // Lights (just like meshes but with just a position instead of a transform mat4) + ParticleDebugBT_VertexBillboarding_C0, // No axis constraint, 4 vertex generated + ParticleDebugBT_VertexBillboarding_C1, // 1 axis constraint, 4 vertex generated + ParticleDebugBT_VertexBillboarding_C1_Capsule, // 1 axis constraint, 6 vertex generated + ParticleDebugBT_VertexBillboarding_C2, // 2 axis constraint, 4 vertex generated + ParticleDebugBT_VertexBillboarding_SizeFloat2_C0, // No axis constraint, 4 vertex generated, size float2 + ParticleDebugBT_VertexBillboarding_SizeFloat2_C1, // 1 axis constraint, 4 vertex generated, size float2 + ParticleDebugBT_VertexBillboarding_SizeFloat2_C1_Capsule, // 1 axis constraint, 6 vertex generated, size float2 + ParticleDebugBT_VertexBillboarding_SizeFloat2_C2, // 2 axis constraint, 4 vertex generated, size float2 + ParticleDebugBT_TriangleVertexBillboarding, // Triangles + ParticleDebugBT_GeomBillboarding_C0, // No axis constraint, 4 vertex generated + ParticleDebugBT_GeomBillboarding_C1, // 1 axis constraint, 4 vertex generated + ParticleDebugBT_GeomBillboarding_C1_Capsule, // 1 axis constraint, 6 vertex generated + ParticleDebugBT_GeomBillboarding_C2, // 2 axis constraint, 4 vertex generated + ParticleDebugBT_GeomBillboarding_SizeFloat2_C0, // No axis constraint, 4 vertex generated, size float2 + ParticleDebugBT_GeomBillboarding_SizeFloat2_C1, // 1 axis constraint, 4 vertex generated, size float2 + ParticleDebugBT_GeomBillboarding_SizeFloat2_C1_Capsule, // 1 axis constraint, 6 vertex generated, size float2 + ParticleDebugBT_GeomBillboarding_SizeFloat2_C2, // 2 axis constraint, 4 vertex generated, size float2 + _ParticleDebugBT_Count +}; + +void FillEditorDebugParticleInputVertexBuffers( TArray &inputVertexBuffers, + ParticleDebugShader shaderMode, + EParticleDebugBillboarderType bbType, + bool gpuStorage); +void FillEditorDebugParticleShaderBindings( RHI::SShaderBindings &bindings, + ParticleDebugShader shaderMode, + EParticleDebugBillboarderType bbType, + bool gpuStorage, + RHI::SShaderDescription *shaderDescription = null); +void AddEditorDebugParticleDefinition(TArray &shaders); +void AddEditorDebugVertexBBParticleDefinition(TArray &shaders); +void AddEditorDebugGeomBBParticleDefinition(TArray &shaders); + +void FillEditorDebugDrawShaderBindings(RHI::SShaderBindings &bindings, bool hasVertexColor, bool isClipSpace); +void AddEditorDebugDrawDefinition(TArray &shaders); + +void FillDebugDrawValueConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillEditorDebugDrawValueShaderBindings(RHI::SShaderBindings &bindings); +void AddEditorDebugDrawValueDefinition(TArray &shaders); + +void FillEditorDebugDrawLineShaderBindings(RHI::SShaderBindings &bindings); +void AddEditorDebugDrawLineDefinition(TArray &shaders); + +void AddEditorHeatmapOverdraw(TArray &shaders); + +void CreateBrushBackdropInfoConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillBrushBackdropShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &brushInfo, const RHI::SConstantSetLayout &environmentMapLayout); +void AddBrushBackdropDefinition(TArray &shaders); + +void FillParticleLightShaderBindings(RHI::SShaderBindings &bindings); +void AddParticleLightDefinition(TArray &shaders); + +void CreateEditorSelectorConstantSetLayout(RHI::SConstantSetLayout &layout); +void AddEditorSelectorDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.cpp b/Samples/PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.cpp new file mode 100644 index 00000000..6fdd8f5b --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.cpp @@ -0,0 +1,1334 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ShaderDefinitions.h" +#include "SampleLibShaderDefinitions.h" +#include "UnitTestsShaderDefinitions.h" + +#include +#include "PK-SampleLib/RenderIntegrationRHI/RHIRenderIntegrationConfig.h" +#include "PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.h" + +__PK_SAMPLE_API_BEGIN + +//---------------------------------------------------------------------------- + +void FillGizmoShaderBindings(RHI::SShaderBindings &bindings) +{ + // Vertex inputs + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + RHI::SPushConstantBuffer gizmoConstants("GizmoConstant", RHI::VertexShaderMask); + gizmoConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "ModelViewProj")); + gizmoConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "HoveredColor")); + gizmoConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "GrabbedColor")); + + bindings.m_PushConstants.PushBack(gizmoConstants); +} + +//---------------------------------------------------------------------------- + +void AddGizmoDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat3; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillGizmoShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "Gizmo.vert"; + shaders.Last().m_FragmentShader = "Gizmo.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillImGuiShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout) +{ + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "TexCoord"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 2; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeRGBA8; + + RHI::SPushConstantBuffer gizmoConstants("ImGui", RHI::VertexShaderMask); + gizmoConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "Scale")); + gizmoConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "Translate")); + + bindings.m_PushConstants.PushBack(gizmoConstants); + + bindings.m_ConstantSets.PushBack(layout); +} + +//---------------------------------------------------------------------------- + +void AddImGuiDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout layout; + + CreateSimpleSamplerConstSetLayouts(layout, false); + + FillImGuiShaderBindings(description.m_Bindings, layout); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "ImGui.vert"; + shaders.Last().m_FragmentShader = "ImGui.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillProfilerShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + + RHI::SPushConstantBuffer profilerConstant("ProfilerConstant", RHI::VertexShaderMask); + profilerConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Transform")); + + bindings.m_PushConstants.PushBack(profilerConstant); +} + +//---------------------------------------------------------------------------- + +void AddProfilerDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillProfilerShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "Profiler.vert"; + shaders.Last().m_FragmentShader = "Profiler.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillProfilerDrawNodeShaderBindings(RHI::SShaderBindings &bindings, bool isDashed) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color0"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color1"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 2; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + + if (isDashed) + { + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color2"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 3; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::AllShaderMask, "HAS_DASHED_LINES")); + } + + RHI::SPushConstantBuffer profilerConstant("ProfilerConstant", RHI::VertexShaderMask); + profilerConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Transform")); + + bindings.m_PushConstants.PushBack(profilerConstant); +} + +//---------------------------------------------------------------------------- + +void AddProfilerDrawNodeDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor0"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillProfilerDrawNodeShaderBindings(description.m_Bindings, false); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "ProfilerDrawNode.vert"; + shaders.Last().m_FragmentShader = "ProfilerDrawNode.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillProfilerDrawNodeShaderBindings(description.m_Bindings, true); + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor1"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor2"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragNodeExtendedPixelCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragNodePixelCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "ProfilerDrawNode.vert"; + shaders.Last().m_FragmentShader = "ProfilerDrawNode.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +bool CreateSceneInfoConstantLayout(RHI::SConstantSetLayout &sceneInfoLayout) +{ + bool success = true; + + sceneInfoLayout.Reset(); + + RHI::SConstantBufferDesc bufferLayout("SceneInfo"); + + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "ViewProj")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "View")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Proj")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "InvView")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "InvViewProj")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "UserToLHZ")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "LHZToUser")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "BillboardingView")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "PackNormalView")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "UnpackNormalView")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "SideVector")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "DepthVector")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "ZBufferLimits")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "ViewportSize")); + success &= bufferLayout.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "Handedness")); + + success &= sceneInfoLayout.AddConstantsLayout(bufferLayout); + + return success; +} + +//---------------------------------------------------------------------------- + +bool CreateLightingSceneInfoConstantLayout( RHI::SConstantSetLayout &lightLayout, + RHI::SConstantSetLayout &shadowLayout, + RHI::SConstantSetLayout &brdfLUTLayout, + RHI::SConstantSetLayout &envMapLayout) +{ + bool success = true; + + lightLayout.Reset(); + lightLayout.m_ShaderStagesMask = RHI::FragmentShaderMask; + RHI::SConstantBufferDesc lightConstant("LightInfo"); + + success &= lightConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeInt, "DirectionalLightsCount")); + success &= lightConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeInt, "SpotLightsCount")); + success &= lightConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeInt, "PointLightsCount")); + success &= lightConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat3, "AmbientColor")); + success &= lightLayout.AddConstantsLayout(lightConstant); + + success &= lightLayout.AddConstantsLayout(RHI::SRawBufferDesc("DirectionalLightsInfo", true)); + success &= lightLayout.AddConstantsLayout(RHI::SRawBufferDesc("SpotLightsInfo", true)); + success &= lightLayout.AddConstantsLayout(RHI::SRawBufferDesc("PointLightsInfo", true)); + + shadowLayout.Reset(); + + RHI::SConstantBufferDesc shadowConstant("ShadowsInfo"); + + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Cascade0_WorldToShadow")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Cascade1_WorldToShadow")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Cascade2_WorldToShadow")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Cascade3_WorldToShadow")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "ShadowsRanges")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "m_ShadowsAspectRatio0")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "m_ShadowsAspectRatio1")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "m_ShadowsAspectRatio2")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "m_ShadowsAspectRatio3")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "ShadowsConstants")); + success &= shadowConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeInt, "ShadowsFlags")); + success &= shadowLayout.AddConstantsLayout(shadowConstant); + + RHI::SConstantSamplerDesc shadowMapSampler0("Cascade0_ShadowMap", RHI::SamplerTypeSingle); + RHI::SConstantSamplerDesc shadowMapSampler1("Cascade1_ShadowMap", RHI::SamplerTypeSingle); + RHI::SConstantSamplerDesc shadowMapSampler2("Cascade2_ShadowMap", RHI::SamplerTypeSingle); + RHI::SConstantSamplerDesc shadowMapSampler3("Cascade3_ShadowMap", RHI::SamplerTypeSingle); + + success &= shadowLayout.AddConstantsLayout(shadowMapSampler0); + success &= shadowLayout.AddConstantsLayout(shadowMapSampler1); + success &= shadowLayout.AddConstantsLayout(shadowMapSampler2); + success &= shadowLayout.AddConstantsLayout(shadowMapSampler3); + + brdfLUTLayout.Reset(); + brdfLUTLayout.m_ShaderStagesMask = RHI::FragmentShaderMask; + RHI::SConstantSamplerDesc BRDFLUTSampler("BRDFLUTSampler", RHI::SamplerTypeSingle); + success &= brdfLUTLayout.AddConstantsLayout(BRDFLUTSampler); + + envMapLayout.Reset(); + CreateCubemapSamplerConstantSetLayout(envMapLayout); + return success; +} + +//---------------------------------------------------------------------------- + +void CreateComputeParticleCountPerMeshConstantSetLayout(RHI::SConstantSetLayout &layout, bool hasMeshIDs, bool hasLODs) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("StreamInfo", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("EnabledsOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutIndirect", false)); + if (hasMeshIDs) + layout.AddConstantsLayout(RHI::SRawBufferDesc("MeshIDsOffsets", true)); + RHI::SConstantBufferDesc LODConstants("LODConstants"); + LODConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "PerLODMeshCount", 0x10)); // We limit the max lod count to 16. + if (hasLODs) + { + layout.AddConstantsLayout(RHI::SRawBufferDesc("LODsOffsets", true)); + LODConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "LODMeshOffsets", 0x10 + 1)); // + 1 as we add a last element to store the total mesh count to simplify logic in the shader. + } + layout.AddConstantsLayout(LODConstants); +} + +//---------------------------------------------------------------------------- + +void FillComputeParticleCountPerMeshShaderBindings(RHI::SShaderBindings &bindings, bool hasMeshIDs, bool hasLODs) +{ + bindings.Reset(); + + RHI::SConstantSetLayout layout; + CreateComputeParticleCountPerMeshConstantSetLayout(layout, hasMeshIDs, hasLODs); + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "DrawRequest")); + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "MeshCount")); + if (hasLODs) + { + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "LODCount")); + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "HAS_LODS")); + } + bindings.m_PushConstants.PushBack(pushConstant); + if (hasMeshIDs) + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "HAS_MESHIDS")); +} + +//---------------------------------------------------------------------------- + +void AddComputeParticleCountPerMeshDefinition(TArray &shaders) +{ + // Mesh atlas, no LOD + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeParticleCountPerMeshShaderBindings(description.m_Bindings, true, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeParticleCountPerMesh.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + // No mesh atlas, no LOD + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeParticleCountPerMeshShaderBindings(description.m_Bindings, false, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeParticleCountPerMesh.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + // Mesh atlas, LOD + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeParticleCountPerMeshShaderBindings(description.m_Bindings, true, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeParticleCountPerMesh.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + // No mesh atlas, LOD + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeParticleCountPerMeshShaderBindings(description.m_Bindings, false, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeParticleCountPerMesh.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } +} + + +//---------------------------------------------------------------------------- + +void CreateComputeMeshMatricesConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("StreamInfo", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("PositionsOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("ScalesOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OrientationsOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("MatricesOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutMatrices", false)); +} + +//---------------------------------------------------------------------------- + +void FillComputeMeshMatricesShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateComputeMeshMatricesConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "DrawRequest")); + bindings.m_PushConstants.PushBack(pushConstant); +} + +//---------------------------------------------------------------------------- + +void AddComputeMeshMatricesDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeMeshMatricesShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeMeshMatrices.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateInitIndirectionOffsetsBufferConstantSetLayout(RHI::SConstantSetLayout &layout, bool lodNoAtlas) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("IndirectBuffer", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutIndirectionOffsets", false)); + + if (lodNoAtlas) + { + RHI::SConstantBufferDesc LODConstants("LODConstants"); + LODConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "PerLODMeshCount", 0x10)); // We limit the max lod count to 16. + LODConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "LODMeshOffsets", 0x10 + 1)); // + 1 as we add a last element to store the total mesh count to simplify logic in the shader. + layout.AddConstantsLayout(LODConstants); + } +} + +//---------------------------------------------------------------------------- + +void FillInitIndirectionOffsetsBufferShaderBindings(RHI::SShaderBindings &bindings, bool lodNoAtlas) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateInitIndirectionOffsetsBufferConstantSetLayout(layout, lodNoAtlas); + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "DrawCallCount")); + bindings.m_PushConstants.PushBack(pushConstant); + if (lodNoAtlas) + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "HAS_LODSNOATLAS")); +} + +//---------------------------------------------------------------------------- + +void AddInitIndirectionOffsetsBufferDefinition(TArray &shaders) +{ + // Mesh atlas enabled (with or without LOD) or mesh atlas disabled (no LOD) + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE_2D, PK_RH_GPU_THREADGROUP_SIZE_2D, 1); + + FillInitIndirectionOffsetsBufferShaderBindings(description.m_Bindings, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "InitIndirectionOffsetsBuffer.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + // Mesh atlas disabled, LOD enabled (indirection offsets buffer is indexed differently) + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE_2D, PK_RH_GPU_THREADGROUP_SIZE_2D, 1); + + FillInitIndirectionOffsetsBufferShaderBindings(description.m_Bindings, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "InitIndirectionOffsetsBuffer.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } +} + +//---------------------------------------------------------------------------- + +void CreateComputeMeshIndirectionBufferConstantSetLayout(RHI::SConstantSetLayout &layout, bool hasMeshIDs, bool hasLODs) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("StreamInfo", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("EnabledOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutIndirection", false)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("IndirectionOffsets", false)); + if (hasMeshIDs) + layout.AddConstantsLayout(RHI::SRawBufferDesc("MeshIDsOffsets", true)); + + RHI::SConstantBufferDesc LODConstants("LODConstants"); + LODConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "PerLODMeshCount", 0x10)); // We limit the max lod count to 16. + if (hasLODs) + { + layout.AddConstantsLayout(RHI::SRawBufferDesc("LODsOffsets", true)); + LODConstants.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "LODMeshOffsets", 0x10 + 1)); // + 1 as we add a last element to store the total mesh count to simplify logic in the shader. + } + layout.AddConstantsLayout(LODConstants); +} + +//---------------------------------------------------------------------------- + +void FillComputeMeshIndirectionBufferShaderBindings(RHI::SShaderBindings &bindings, bool hasMeshIDs, bool hasLODs) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateComputeMeshIndirectionBufferConstantSetLayout(layout, hasMeshIDs, hasLODs); + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "DrawRequest")); + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "MeshCount")); + if (hasLODs) + { + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "LODCount")); + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "HAS_LODS")); + } + bindings.m_PushConstants.PushBack(pushConstant); + + if (hasMeshIDs) + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "HAS_MESHIDS")); +} + +//---------------------------------------------------------------------------- + +void AddComputeMeshIndirectionBufferDefinition(TArray &shaders) +{ + // Mesh atlas, no LOD + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeMeshIndirectionBufferShaderBindings(description.m_Bindings, true, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeMeshIndirectionBuffer.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + // No mesh atlas, no LOD + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeMeshIndirectionBufferShaderBindings(description.m_Bindings, false, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeMeshIndirectionBuffer.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + // Mesh atlas, LOD + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeMeshIndirectionBufferShaderBindings(description.m_Bindings, true, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeMeshIndirectionBuffer.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + // No Mesh atlas, LOD + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeMeshIndirectionBufferShaderBindings(description.m_Bindings, false, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeMeshIndirectionBuffer.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } +} + +//---------------------------------------------------------------------------- + +void CreateComputeSortKeysConstantSetLayout(RHI::SConstantSetLayout &layout, bool sortByCameraDistance, bool hasRibbonIndirection ) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("StreamInfo", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData", true)); + if (sortByCameraDistance) + layout.AddConstantsLayout(RHI::SRawBufferDesc("PositionsOffsets", true)); + else + layout.AddConstantsLayout(RHI::SRawBufferDesc("CustomSortKeysOffsets", true)); + if (hasRibbonIndirection) + { + layout.AddConstantsLayout(RHI::SRawBufferDesc("RibbonIndirection", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("IndirectDraw", true)); + } + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutSortKeys", false)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutIndirection", false)); + +} + +//---------------------------------------------------------------------------- + +void FillComputeSortKeysShaderBindings(RHI::SShaderBindings &bindings, bool sortByCameraDistance, bool hasRibbonIndirection) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + if (sortByCameraDistance) + { + CreateSceneInfoConstantLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "SORT_BY_CAMERA_DISTANCE")); + } + if (hasRibbonIndirection) + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "HAS_RIBBON_INDIRECTION")); + CreateComputeSortKeysConstantSetLayout(layout, sortByCameraDistance, hasRibbonIndirection); + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "DrawRequest")); + bindings.m_PushConstants.PushBack(pushConstant); +} + +//---------------------------------------------------------------------------- + +void AddComputeSortKeysDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeSortKeysShaderBindings(description.m_Bindings, true, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeSortKeys.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + + FillComputeSortKeysShaderBindings(description.m_Bindings, false, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeSortKeys.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + + FillComputeSortKeysShaderBindings(description.m_Bindings, true, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeSortKeys.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + + FillComputeSortKeysShaderBindings(description.m_Bindings, false, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeSortKeys.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateSortUpSweepConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("InIndirection", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("InKeys", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutCounts", false)); +} + +//---------------------------------------------------------------------------- + +void FillSortUpSweepShaderBindings(RHI::SShaderBindings &bindings, bool keyStride64) +{ + bindings.Reset(); + + RHI::SConstantSetLayout layout; + CreateSortUpSweepConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "CurrentBit")); + bindings.m_PushConstants.PushBack(pushConstant); + + RHI::SGroupsharedVariable groupsharedVariable; + groupsharedVariable.m_Name = "localCounts"; + groupsharedVariable.m_ArraySize = PK_RH_GPU_THREADGROUP_SIZE * 4 + ((PK_RH_GPU_THREADGROUP_SIZE * 4) >> 3); + groupsharedVariable.m_Type = RHI::TypeUint4; + bindings.m_GroupsharedVariables.PushBack(groupsharedVariable); + + if (keyStride64) + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "KEYSTRIDE64")); + + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "NUM_KEY_PER_THREAD", CString::Format("%d", PK_GPU_SORT_NUM_KEY_PER_THREAD))); +} + +//---------------------------------------------------------------------------- + +void AddSortUpSweepDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); // Parallel up sweep : Here 1 thread handles 2 keys + + FillSortUpSweepShaderBindings(description.m_Bindings, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "SortUpSweep.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + + FillSortUpSweepShaderBindings(description.m_Bindings, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "SortUpSweep.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateSortPrefixSumConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("InOutCounts", false)); +} + +//---------------------------------------------------------------------------- + +void FillSortPrefixSumShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + + RHI::SConstantSetLayout layout; + CreateSortPrefixSumConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "CurrentBit")); + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "GroupCount")); + bindings.m_PushConstants.PushBack(pushConstant); + + RHI::SGroupsharedVariable groupsharedVariable; + groupsharedVariable.m_Name = "groupCounts"; + groupsharedVariable.m_ArraySize = PK_RH_GPU_THREADGROUP_SIZE * 4 + ((PK_RH_GPU_THREADGROUP_SIZE * 4) >> 3); + groupsharedVariable.m_Type = RHI::TypeUint4; + bindings.m_GroupsharedVariables.PushBack(groupsharedVariable); +} + +//---------------------------------------------------------------------------- + +void AddSortPrefixSumDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillSortPrefixSumShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "SortPrefixSum.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateSortDownSweepConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("InCounts", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("InKeys", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("InIndirection", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutKeys", false)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutIndirection", false)); +} + +//---------------------------------------------------------------------------- + +void FillSortDownSweepShaderBindings(RHI::SShaderBindings &bindings, bool keyStride64) +{ + bindings.Reset(); + + RHI::SConstantSetLayout layout; + CreateSortDownSweepConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + + // Necessary size for the thread group digit bins, used to compute the keys offset. the memory shifts are only necessary to reduce bank conflicts. + // The bank conflicts could be avoided with a better access pattern for the prefix sum phase, but this is an easy fix without a huge memory cost. TODO enhance shared memory access. + const u32 histCountsSize = PK_RH_GPU_THREADGROUP_SIZE * 16 + ((PK_RH_GPU_THREADGROUP_SIZE * 16) >> 4); + // Necessary size to hold all of the thread group keys to reorder them after reading them from global memory and before writing them to global memory. + const u32 keysReorderSize = PK_RH_GPU_THREADGROUP_SIZE * PK_GPU_SORT_NUM_KEY_PER_THREAD * ((keyStride64) ? 2 : 1); + // The total multi-purpose group shared memory size + const u32 tempMemorySize = PKMax(histCountsSize, keysReorderSize); + + RHI::SGroupsharedVariable tempSharedMemoryVariable; + tempSharedMemoryVariable.m_Name = "tempSharedMem"; + tempSharedMemoryVariable.m_ArraySize = tempMemorySize; + tempSharedMemoryVariable.m_Type = RHI::TypeUint; + bindings.m_GroupsharedVariables.PushBack(tempSharedMemoryVariable); + + // shared memory used to hold the thread group offset computed in the prefix sum kernel. Only used for memory access improvements + RHI::SGroupsharedVariable groupOffsetsVariable; + groupOffsetsVariable.m_Name = "groupOffsets"; + groupOffsetsVariable.m_ArraySize = 16; + groupOffsetsVariable.m_Type = RHI::TypeUint; + bindings.m_GroupsharedVariables.PushBack(groupOffsetsVariable); + + // shared memory used to compute the keys relative offset from one digit to another in the thread group. + // This is used to reorder the keys in a ascending order locally to allow coalesced write in global memory for keys and values. + RHI::SGroupsharedVariable localDigitOffsetsVariable; + localDigitOffsetsVariable.m_Name = "localDigitOffsets"; + localDigitOffsetsVariable.m_ArraySize = 16; + localDigitOffsetsVariable.m_Type = RHI::TypeUint; + bindings.m_GroupsharedVariables.PushBack(localDigitOffsetsVariable); + + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "CurrentBit")); + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "GroupCount")); + bindings.m_PushConstants.PushBack(pushConstant); + + if (keyStride64) + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "KEYSTRIDE64")); + + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::ComputeShaderStage, "NUM_KEY_PER_THREAD", CString::Format("%d", PK_GPU_SORT_NUM_KEY_PER_THREAD))); +} + +//---------------------------------------------------------------------------- + +void AddSortDownSweepDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillSortDownSweepShaderBindings(description.m_Bindings, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "SortDownSweep.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + + FillSortDownSweepShaderBindings(description.m_Bindings, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "SortDownSweep.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void FillFXAAShaderBindings(RHI::SShaderBindings &bindings, bool lumaInAlpha) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + RHI::SConstantSetLayout layout; + layout.m_ShaderStagesMask = RHI::FragmentShaderMask; + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("Texture", RHI::SamplerTypeSingle)); + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer pushConstantBuffer("PushConstantBuffer", RHI::FragmentShaderMask); + pushConstantBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeInt2, "Resolution")); + bindings.m_PushConstants.PushBack(pushConstantBuffer); + + if (lumaInAlpha) + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderMask, "LUMAINALPHA")); +} + +//---------------------------------------------------------------------------- + +void AddFXAADefinition(TArray &shaders) +{ + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + description.m_DrawMode = RHI::DrawModeTriangle; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillFXAAShaderBindings(description.m_Bindings, true); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "FXAA.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + + FillFXAAShaderBindings(description.m_Bindings, false); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "FXAA.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } +} + +//---------------------------------------------------------------------------- + +void CreateComputeRibbonSortKeysConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + layout.AddConstantsLayout(RHI::SRawBufferDesc("StreamInfo", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("GPUSimData", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("SelfIDsOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("ParentIDsOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("EnabledsOffsets", true)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutSortKeys", false)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutIndirection", false)); + layout.AddConstantsLayout(RHI::SRawBufferDesc("OutIndirectDraw", false)); +} + +//---------------------------------------------------------------------------- + +void FillComputeRibbonSortKeysShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateComputeRibbonSortKeysConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer pushConstant("Info"); + pushConstant.m_ShaderStagesMask = RHI::ComputeShaderMask; + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "DrawRequest")); + bindings.m_PushConstants.PushBack(pushConstant); +} + +//---------------------------------------------------------------------------- + +void AddComputeRibbonSortKeysDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE, 1, 1); + + FillComputeRibbonSortKeysShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeRibbonSortKeys.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateComputeCubemapConstantSetLayout(RHI::SConstantSetLayout &layout, bool inputTxtIsLatLong) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + + RHI::SConstantBufferDesc buffer("CubemapData"); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Face")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Size")); + + layout.AddConstantsLayout(buffer); + if (!inputTxtIsLatLong) + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("InputTextureCube", RHI::SamplerTypeCube)); + else + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("InputTextureLatlong", RHI::SamplerTypeSingle)); + + layout.AddConstantsLayout(RHI::STextureStorageDesc("OutData", false)); +} + +//---------------------------------------------------------------------------- + +void FillComputeCubemapShaderBindings(RHI::SShaderBindings &bindings, bool inputTxtIsLatLong) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateComputeCubemapConstantSetLayout(layout, inputTxtIsLatLong); + bindings.m_ConstantSets.PushBack(layout); + bindings.m_Defines.PushBack(); + bindings.m_Defines.Last().m_ShaderStages = RHI::ComputeShaderMask; + if (inputTxtIsLatLong) + bindings.m_Defines.Last().m_Define = "INPUTLATLONG"; + else + bindings.m_Defines.Last().m_Define = "INPUTCUBE"; +} + +//---------------------------------------------------------------------------- + +void AddComputeCubemapDefinition(TArray &shaders) +{ + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE_2D, PK_RH_GPU_THREADGROUP_SIZE_2D, 1); + + FillComputeCubemapShaderBindings(description.m_Bindings, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeCubemap.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE_2D, PK_RH_GPU_THREADGROUP_SIZE_2D, 1); + + FillComputeCubemapShaderBindings(description.m_Bindings, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeCubemap.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } +} + +//---------------------------------------------------------------------------- + +void CreateFilterCubemapConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + + RHI::SConstantBufferDesc buffer("CubemapData"); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Face")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "Roughness")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Size")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "SampleCount")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "PerformedSampleCount")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "TotalSampleCount")); + + layout.AddConstantsLayout(buffer); + + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("InputTextureCube", RHI::SamplerTypeCube)); + + layout.AddConstantsLayout(RHI::STextureStorageDesc("OutData", false, RHI::FormatFloat16RGBA)); +} + +//---------------------------------------------------------------------------- + +void FillFilterCubemapShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateFilterCubemapConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); +} + +//---------------------------------------------------------------------------- + +void AddFilterCubemapDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE_2D, PK_RH_GPU_THREADGROUP_SIZE_2D, 1); + + FillFilterCubemapShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "FilterCubemap.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateComputeMipMapConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + + RHI::SConstantBufferDesc buffer("Data"); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "TexelSize")); + + layout.AddConstantsLayout(buffer); + + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("InputTexture", RHI::SamplerTypeSingle)); + + layout.AddConstantsLayout(RHI::STextureStorageDesc("OutputTexture", false)); +} + +//---------------------------------------------------------------------------- + +void FillComputeMipMapShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateComputeMipMapConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); +} + +//---------------------------------------------------------------------------- + +void AddComputeMipMapDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE_2D, PK_RH_GPU_THREADGROUP_SIZE_2D, 1); + + FillComputeMipMapShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "ComputeMipMap.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateBlurCubemapRenderFaceConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + + RHI::SConstantBufferDesc buffer("Data"); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Face")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "MipLevel")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Size")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Padding")); + + layout.AddConstantsLayout(buffer); + + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("InputCubeTexture", RHI::SamplerTypeCube)); + + layout.AddConstantsLayout(RHI::STextureStorageDesc("OutputTexture", false)); +} + +//---------------------------------------------------------------------------- + +void FillBlurCubemapRenderFaceShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateBlurCubemapRenderFaceConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); +} + +//---------------------------------------------------------------------------- + +void AddBlurCubemapRenderFaceDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE_2D, PK_RH_GPU_THREADGROUP_SIZE_2D, 1); + + FillBlurCubemapRenderFaceShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "RenderCubemapFace.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateBlurCubemapProcessConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + + RHI::SConstantBufferDesc buffer("Data"); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Size")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "KernelSize")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "HalfAngle")); + + layout.AddConstantsLayout(buffer); + + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("InputTexture", RHI::SamplerTypeSingle)); + + layout.AddConstantsLayout(RHI::STextureStorageDesc("OutputTexture", false)); +} + +//---------------------------------------------------------------------------- + +void FillBlurCubemapProcessShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateBlurCubemapProcessConstantSetLayout(layout); + bindings.m_ConstantSets.PushBack(layout); +} + +//---------------------------------------------------------------------------- + +void AddBlurCubemapProcessDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(PK_RH_GPU_THREADGROUP_SIZE_2D, PK_RH_GPU_THREADGROUP_SIZE_2D, 1); + + FillBlurCubemapProcessShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "BlurCubemap.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void CreateCubemapSamplerConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.m_ShaderStagesMask = RHI::FragmentShaderMask; + RHI::SConstantSamplerDesc environmentMapSamplerDesc("EnvironmentMapSampler", RHI::SamplerTypeCube); + layout.AddConstantsLayout(environmentMapSamplerDesc); + RHI::SConstantBufferDesc envMapInfo = RHI::SConstantBufferDesc("EnvironmentMapInfo"); + envMapInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2x2, "Rotation")); + layout.AddConstantsLayout(envMapInfo); +} + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.h b/Samples/PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.h new file mode 100644 index 00000000..3afdc670 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.h @@ -0,0 +1,108 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SShaderCombination; + +//---------------------------------------------------------------------------- + +void FillGizmoShaderBindings(RHI::SShaderBindings &bindings); +void AddGizmoDefinition(TArray &shaders); + +void FillImGuiShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &apiManager); +void AddImGuiDefinition(TArray &shaders); + +void FillProfilerShaderBindings(RHI::SShaderBindings &bindings); +void AddProfilerDefinition(TArray &shaders); + +void FillProfilerDrawNodeShaderBindings(RHI::SShaderBindings &bindings, bool isDashed); +void AddProfilerDrawNodeDefinition(TArray &shaders); + +void CreateComputeParticleCountPerMeshConstantSetLayout(RHI::SConstantSetLayout &layout, bool hasMeshIDs, bool hasLODs); +void FillComputeParticleCountPerMeshShaderBindings(RHI::SShaderBindings &bindings, bool hasMeshIDs, bool hasLODs); +void AddComputeParticleCountPerMeshDefinition(TArray &shaders); + +void CreateComputeMeshMatricesConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillComputeMeshMatricesShaderBindings(RHI::SShaderBindings &bindings); +void AddComputeMeshMatricesDefinition(TArray &shaders); + +void CreateInitIndirectionOffsetsBufferConstantSetLayout(RHI::SConstantSetLayout &layout, bool lodNoAtlas); +void FillInitIndirectionOffsetsBufferShaderBindings(RHI::SShaderBindings &bindings, bool lodNoAtlas); +void AddInitIndirectionOffsetsBufferDefinition(TArray &shaders); + +void CreateComputeMeshIndirectionBufferConstantSetLayout(RHI::SConstantSetLayout &layout, bool hasMeshIDs, bool hasLODs); +void FillComputeMeshIndirectionBufferShaderBindings(RHI::SShaderBindings &bindings, bool hasMeshIDs, bool hasLODs); +void AddComputeMeshIndirectionBufferDefinition(TArray &shaders); + +void CreateComputeSortKeysConstantSetLayout(RHI::SConstantSetLayout &layout, bool sortByCameraDistance, bool hasRibbonIndirection); +void FillComputeSortKeysShaderBindings(RHI::SShaderBindings &bindings, bool sortByCameraDistance, bool hasRibbonIndirection); +void AddComputeSortKeysDefinition(TArray &shaders); + +void CreateSortUpSweepConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillSortUpSweepShaderBindings(RHI::SShaderBindings &bindings, bool keyStride); +void AddSortUpSweepDefinition(TArray &shaders); + +void CreateSortPrefixSumConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillSortPrefixSumShaderBindings(RHI::SShaderBindings &bindings); +void AddSortPrefixSumDefinition(TArray &shaders); + +void CreateSortDownSweepConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillSortDownSweepShaderBindings(RHI::SShaderBindings &bindings, bool keyStride); +void AddSortDownSweepDefinition(TArray &shaders); + +void FillFXAAShaderBindings(RHI::SShaderBindings &bindings, bool lumaInAlpha); +void AddFXAADefinition(TArray &shaders); + +void CreateComputeRibbonSortKeysConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillComputeRibbonSortKeysShaderBindings(RHI::SShaderBindings &bindings); +void AddComputeRibbonSortKeysDefinition(TArray &shaders); + +void CreateComputeCubemapConstantSetLayout(RHI::SConstantSetLayout &layout, bool inputTxtIsLatLong); +void FillComputeCubemapShaderBindings(RHI::SShaderBindings &bindings, bool inputTxtIsLatLong); +void AddComputeCubemapDefinition(TArray &shaders); + +void CreateFilterCubemapConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillFilterCubemapShaderBindings(RHI::SShaderBindings &bindings); +void AddFilterCubemapDefinition(TArray &shaders); + +void CreateComputeMipMapConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillComputeMipMapShaderBindings(RHI::SShaderBindings &bindings); +void AddComputeMipMapDefinition(TArray &shaders); + +void CreateBlurCubemapRenderFaceConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillBlurCubemapRenderFaceShaderBindings(RHI::SShaderBindings &bindings); +void AddBlurCubemapRenderFaceDefinition(TArray &shaders); + +void CreateBlurCubemapProcessConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillBlurCubemapProcessShaderBindings(RHI::SShaderBindings &bindings); +void AddBlurCubemapProcessDefinition(TArray &shaders); + +void CreateCubemapSamplerConstantSetLayout(RHI::SConstantSetLayout &layout); + +//---------------------------------------------------------------------------- +// Common utils: +//---------------------------------------------------------------------------- + +bool CreateSceneInfoConstantLayout(RHI::SConstantSetLayout &sceneInfoLayout); +bool CreateLightingSceneInfoConstantLayout( RHI::SConstantSetLayout &lightLayout, + RHI::SConstantSetLayout &shadowLayout, + RHI::SConstantSetLayout &brdfLUTLayout, + RHI::SConstantSetLayout &envMapLayout); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/ShaderDefinitions.cpp b/Samples/PK-SampleLib/ShaderDefinitions/ShaderDefinitions.cpp new file mode 100644 index 00000000..577cf882 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/ShaderDefinitions.cpp @@ -0,0 +1,187 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + + +#include "precompiled.h" +#include "ShaderDefinitions.h" + +#include "UnitTestsShaderDefinitions.h" +#include "SampleLibShaderDefinitions.h" +#include "BasicSceneShaderDefinitions.h" +#include "EditorShaderDefinitions.h" + +#include +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +void CreateShaderDefinitions(TArray &shaders) +{ + // Unit Tests + AddTriangleNoVboDefinition(shaders); + AddPosColVBODefinition(shaders); + AddConstMat4Definition(shaders); + AddUniformTestDefinition(shaders); + AddUnitTestStructLayoutDefinition(shaders); + AddGaussianBlurDefinition(shaders); + AddCopyDefinition(shaders); + AddDistortionDefinition(shaders); + AddColorRemapDefinition(shaders); + AddTextureFormatDefinition(shaders); + AddMipmappingDefinition(shaders); + AddMipmappingModeDefinition(shaders); + AddHDRTextureDefinition(shaders); + AddRTMSAADefinition(shaders); + AddDrawInstancedDefinition(shaders); + AddGeometryDefinition(shaders); + AddGeometry2Definition(shaders); + AddCubemapRenderDefinition(shaders); + AddCubemapComputeDefinition(shaders); + AddComputeUnitTestBufferDefinition(shaders); + AddComputeUnitTestTextureDefinition(shaders); + + // Sample Lib + AddGizmoDefinition(shaders); + AddImGuiDefinition(shaders); + AddProfilerDefinition(shaders); + AddProfilerDrawNodeDefinition(shaders); + AddComputeParticleCountPerMeshDefinition(shaders); + AddComputeMeshMatricesDefinition(shaders); + AddInitIndirectionOffsetsBufferDefinition(shaders); + AddComputeMeshIndirectionBufferDefinition(shaders); + AddComputeSortKeysDefinition(shaders); + AddSortUpSweepDefinition(shaders); + AddSortPrefixSumDefinition(shaders); + AddSortDownSweepDefinition(shaders); + AddFXAADefinition(shaders); + AddComputeRibbonSortKeysDefinition(shaders); + AddComputeCubemapDefinition(shaders); + AddFilterCubemapDefinition(shaders); + AddComputeMipMapDefinition(shaders); + AddBlurCubemapProcessDefinition(shaders); + AddBlurCubemapRenderFaceDefinition(shaders); + + // Basic Scene + AddGBufferDefinition(shaders); + AddGBufferShadowDefinition(shaders); + AddDeferredLightDefinition(shaders); + AddDeferredMergingDefinition(shaders); + + // Pop ed + AddEditorDebugParticleDefinition(shaders); + AddEditorDebugVertexBBParticleDefinition(shaders); + AddEditorDebugGeomBBParticleDefinition(shaders); + AddEditorDebugDrawDefinition(shaders); + AddEditorDebugDrawValueDefinition(shaders); + AddEditorDebugDrawLineDefinition(shaders); + AddEditorHeatmapOverdraw(shaders); + AddBrushBackdropDefinition(shaders); + AddParticleLightDefinition(shaders); + AddEditorSelectorDefinition(shaders); +} + +//---------------------------------------------------------------------------- + +void GenerateDefinesFromDefinition(TArray &defines, const RHI::SShaderDescription &desc, RHI::EShaderStage stage) +{ + for (const RHI::SShaderDefine &define : desc.m_Bindings.m_Defines) + { + if ((define.m_ShaderStages & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + if (define.m_Value.Empty()) + defines.PushBack(define.m_Define); + else + defines.PushBack(CString::Format("%s=%s", define.m_Define.Data(), define.m_Value.Data())); + } + } + for (const RHI::SConstantSetLayout &constSet : desc.m_Bindings.m_ConstantSets) + { + if ((constSet.m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + for (const RHI::SConstantSetLayout::SConstantDesc &constant : constSet.m_Constants) + { + if (constant.m_Type == RHI::TypeConstantBuffer) + { + for (const RHI::SConstantVarDesc &var : constant.m_ConstantBuffer.m_Constants) + { + defines.PushBack(CString("CONST_") + constant.m_ConstantBuffer.m_Name + "_" + var.m_Name); + } + } + else if (constant.m_Type == RHI::TypeRawBuffer) + { + defines.PushBack(CString("VRESOURCE_") + constant.m_RawBuffer.m_Name); + } + else if (constant.m_Type == RHI::TypeConstantSampler) + { + if (constant.m_ConstantSampler.m_Type == RHI::SamplerTypeMulti) + { + defines.PushBack(CString("SAMPLER_MS_") + constant.m_ConstantSampler.m_Name); + } + else + { + defines.PushBack(CString("SAMPLER_") + constant.m_ConstantSampler.m_Name); + } + } + } + } + } + if (stage == RHI::VertexShaderStage) + { + for (const RHI::SVertexAttributeDesc &vertexInput : desc.m_Bindings.m_InputAttributes) + defines.PushBack(CString("VINPUT_") + vertexInput.m_Name); + } + for (const RHI::SPushConstantBuffer &pushConst : desc.m_Bindings.m_PushConstants) + { + if ((pushConst.m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + for (const RHI::SConstantVarDesc &var : pushConst.m_Constants) + { + defines.PushBack(CString("CONST_") + pushConst.m_Name + "_" + var.m_Name); + } + } + } + const bool vertexShaderStage = stage == RHI::VertexShaderStage; + const bool geomShaderStage = stage == RHI::GeometryShaderStage; + const bool fragmentShaderStage = stage == RHI::FragmentShaderStage; + for (const RHI::SVertexOutput &finput : desc.m_VertexOutput) + { + if (vertexShaderStage) + defines.PushBack("VOUTPUT_" + finput.m_Name); + + if (desc.m_Pipeline == RHI::VsPs) + { + if (fragmentShaderStage) + defines.PushBack("FINPUT_" + finput.m_Name); + } + else + { + if (geomShaderStage) + defines.PushBack("GINPUT_" + finput.m_Name); + } + } + for (const RHI::SVertexOutput &finput : desc.m_GeometryOutput.m_GeometryOutput) + { + if (geomShaderStage) + defines.PushBack("GOUTPUT_" + finput.m_Name); + + if (desc.m_Pipeline == RHI::VsGsPs) + { + if (fragmentShaderStage) + defines.PushBack("FINPUT_" + finput.m_Name); + } + } +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/ShaderDefinitions.h b/Samples/PK-SampleLib/ShaderDefinitions/ShaderDefinitions.h new file mode 100644 index 00000000..207422d0 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/ShaderDefinitions.h @@ -0,0 +1,35 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SShaderCombination +{ + CString m_VertexShader; + CString m_GeometryShader; + CString m_FragmentShader; + CString m_ComputeShader; + TArray m_ShaderDescriptions; +}; + +//---------------------------------------------------------------------------- + +void CreateShaderDefinitions(TArray &shaders); +void GenerateDefinesFromDefinition(TArray &defines, const RHI::SShaderDescription &desc, RHI::EShaderStage stage); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/UnitTestsShaderDefinitions.cpp b/Samples/PK-SampleLib/ShaderDefinitions/UnitTestsShaderDefinitions.cpp new file mode 100644 index 00000000..47675d97 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/UnitTestsShaderDefinitions.cpp @@ -0,0 +1,1329 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "UnitTestsShaderDefinitions.h" +#include "SampleLibShaderDefinitions.h" +#include "ShaderDefinitions.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- +// +// Create the constant set layouts: +// +//---------------------------------------------------------------------------- + +void CreateSimpleSamplerConstSetLayouts(RHI::SConstantSetLayout &layout, bool multiSampled) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::FragmentShaderMask; + + // sampler2d Texture: + RHI::SConstantSamplerDesc colorSamplerLayout("Texture", multiSampled ? RHI::SamplerTypeMulti : RHI::SamplerTypeSingle); + layout.AddConstantsLayout(colorSamplerLayout); +} + +//---------------------------------------------------------------------------- + +void CreateMultiSamplersConstSetLayouts(RHI::SConstantSetLayout &layout, u32 textureCount) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::FragmentShaderMask; + + for (u32 i = 0; i < textureCount; ++i) + { + // sampler2d Texturei + CString samplerName = CString::Format("Texture%u", i); + RHI::SConstantSamplerDesc colorSamplerLayout(samplerName, RHI::SamplerTypeSingle); + layout.AddConstantsLayout(colorSamplerLayout); + } +} + +//---------------------------------------------------------------------------- + +void CreatePerViewConstSetLayouts(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::AllShaderMask; + + // buffer ViewData: + RHI::SConstantBufferDesc viewData("ViewData"); + viewData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Model")); + viewData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "View")); + viewData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "Proj")); + viewData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "MatNormal")); + layout.AddConstantsLayout(viewData); +} + +//---------------------------------------------------------------------------- + +void CreatePerFrameConstSetLayouts(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::FragmentShaderMask; + + // buffer LightData: + RHI::SConstantBufferDesc lightData("LightData"); + lightData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "LightCount")); + lightData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "LightDirections", 256)); + lightData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "LightColors", 256)); + layout.AddConstantsLayout(lightData); +} + +//---------------------------------------------------------------------------- + +void CreateProcessTextureConstSetLayouts(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::FragmentShaderMask; + + // sampler2d ToBlur: + RHI::SConstantSamplerDesc toBlurSamplerLayout("Texture", RHI::SamplerTypeSingle); + layout.AddConstantsLayout(toBlurSamplerLayout); + // sampler2d Distortion: + RHI::SConstantSamplerDesc distortionSamplerLayout("LookUp", RHI::SamplerTypeSingle); + layout.AddConstantsLayout(distortionSamplerLayout); +} + +//---------------------------------------------------------------------------- + +void FillPositionInputSingleConstSetShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout) +{ + bindings.Reset(); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(layout); +} + +//---------------------------------------------------------------------------- + +void AddTriangleNoVboDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "TriangleNoVBO.vert"; + shaders.Last().m_FragmentShader = "Basic.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillPosColVBOShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; +} + +//---------------------------------------------------------------------------- + +void AddPosColVBODefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillPosColVBOShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "PosColVBO.vert"; + shaders.Last().m_FragmentShader = "Basic.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillUniformTestShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &perView, const RHI::SConstantSetLayout &perFrame) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Normal"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + bindings.m_ConstantSets.PushBack(perView); + bindings.m_ConstantSets.PushBack(perFrame); +} + +//---------------------------------------------------------------------------- + +void AddUniformTestDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragWorldNormal"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat3; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + description.m_Pipeline = RHI::VsPs; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "ConstMat4.vert"; + shaders.Last().m_FragmentShader = "TestArray.frag"; + + RHI::SConstantSetLayout perView; + RHI::SConstantSetLayout perFrame; + + CreatePerViewConstSetLayouts(perView); + CreatePerFrameConstSetLayouts(perFrame); + + FillUniformTestShaderBindings(description.m_Bindings, perView, perFrame); + + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- + +void FillConstMat4ShaderBindings(RHI::SShaderBindings &bindings, + const RHI::SConstantSetLayout &perView, + const RHI::SConstantSetLayout *perFrame, + const RHI::SConstantSetLayout *simpleSampler) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + + bindings.m_ConstantSets.PushBack(perView); + if (perFrame != null) + bindings.m_ConstantSets.PushBack(*perFrame); + if (simpleSampler != null) + { + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "TexCoord"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 2; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + bindings.m_ConstantSets.PushBack(*simpleSampler); + } +} + +//---------------------------------------------------------------------------- + +void AddConstMat4Definition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + shaders.PushBack(); + shaders.Last().m_VertexShader = "ConstMat4.vert"; + shaders.Last().m_FragmentShader = "Basic.frag"; + + RHI::SConstantSetLayout perView; + RHI::SConstantSetLayout perFrame; + RHI::SConstantSetLayout simpleSampler; + + CreatePerViewConstSetLayouts(perView); + CreatePerFrameConstSetLayouts(perFrame); + CreateSimpleSamplerConstSetLayouts(simpleSampler, false); + + FillConstMat4ShaderBindings(description.m_Bindings, perView); + + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillConstMat4ShaderBindings(description.m_Bindings, perView, &perFrame); + + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillConstMat4ShaderBindings(description.m_Bindings, perView, null, &simpleSampler); + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- +// +// Cubemap +// +//---------------------------------------------------------------------------- + +void FillCubemapRenderShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &perView, const RHI::SConstantSetLayout &simpleSampler) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(perView); + bindings.m_ConstantSets.PushBack(simpleSampler); + +} + +//---------------------------------------------------------------------------- + +void CreateCubemapRenderConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::AllShaderMask; + RHI::SConstantBufferDesc viewData("ViewData"); + viewData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "InvViewProj")); + viewData.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4x4, "SceneInfo")); + layout.AddConstantsLayout(viewData); +} + +//---------------------------------------------------------------------------- + +void AddCubemapRenderDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + // Regular copy + shaders.PushBack(); + shaders.Last().m_VertexShader = "CubemapFullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "Cubemap.frag"; + + RHI::SConstantSetLayout perView; + CreateCubemapRenderConstantSetLayout(perView); + + RHI::SConstantSetLayout simpleSampler; + simpleSampler.Reset(); + simpleSampler.m_ShaderStagesMask = RHI::FragmentShaderMask; + RHI::SConstantSamplerDesc colorSamplerLayout("Texture", RHI::SamplerTypeCube); + simpleSampler.AddConstantsLayout(colorSamplerLayout); + + FillCubemapRenderShaderBindings(description.m_Bindings, perView, simpleSampler); + + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + + +//---------------------------------------------------------------------------- + +void CreateCubemapComputeConstantSetLayout(RHI::SConstantSetLayout &layout, bool inputTxtIsLatLong) +{ + layout.Reset(); + layout.m_ShaderStagesMask = RHI::ComputeShaderMask; + + RHI::SConstantBufferDesc buffer("CubemapData"); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Face")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Level")); + buffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "Size")); + + layout.AddConstantsLayout(buffer); + if (!inputTxtIsLatLong) + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("InputTextureCube", RHI::SamplerTypeCube)); + else + layout.AddConstantsLayout(RHI::SConstantSamplerDesc("InputTextureLatlong", RHI::SamplerTypeSingle)); + + layout.AddConstantsLayout(RHI::STextureStorageDesc("OutData", false)); +} + +//---------------------------------------------------------------------------- + +void FillCubemapComputeShaderBindings(RHI::SShaderBindings &bindings, bool inputTxtIsLatLong) +{ + bindings.Reset(); + RHI::SConstantSetLayout layout; + CreateCubemapComputeConstantSetLayout(layout, inputTxtIsLatLong); + bindings.m_ConstantSets.PushBack(layout); + bindings.m_Defines.PushBack(); + bindings.m_Defines.Last().m_ShaderStages = RHI::ComputeShaderMask; + if (inputTxtIsLatLong) + bindings.m_Defines.Last().m_Define = "INPUTLATLONG"; + else + bindings.m_Defines.Last().m_Define = "INPUTCUBE"; +} + +//---------------------------------------------------------------------------- + +void AddCubemapComputeDefinition(TArray &shaders) +{ + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(32, 32, 1); + + FillCubemapComputeShaderBindings(description.m_Bindings, true); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "UnitTestGenerateCubemap.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } + { + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(32, 32, 1); + + FillCubemapComputeShaderBindings(description.m_Bindings, false); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "UnitTestGenerateCubemap.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + } +} + +//---------------------------------------------------------------------------- + +void CreateUnitTestStructLayoutConstantSetLayout(RHI::SConstantSetLayout &layout) +{ + layout.Reset(); + + RHI::SConstantBufferDesc testAlignmentBuffer("AlignmentBuffer"); + + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat , "value1")); // offset: 0, size: 4 (+padding: 12) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat3, "value3")); // offset: 16, size: 12 (+padding: 0) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat , "padding0")); // offset: 28, size: 4 (+padding: 0) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat , "padding1")); // offset: 32, size: 4 (+padding: 8) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "value2")); // offset: 40, size: 8 (+padding: 0) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "value4")); // offset: 48, size: 16 (+padding: 0) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat , "array1", 3)); // offset: 96, size: 48 (+padding: 0) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "array2", 3)); // offset: 144, size: 48 (+padding: 0) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat3, "array3", 3)); // offset: 192, size: 48 (+padding: 0) + testAlignmentBuffer.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "array4", 3)); // offset: 240, size: 48 (+padding: 0) + + layout.AddConstantsLayout(testAlignmentBuffer); +} + +//---------------------------------------------------------------------------- + +void AddUnitTestStructLayoutDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outValue"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + description.m_Pipeline = RHI::VsPs; + + RHI::SConstantSetLayout layout; + CreateUnitTestStructLayoutConstantSetLayout(layout); + description.m_Bindings.m_ConstantSets.PushBack(layout); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "UnitTestStructLayout.vert"; + shaders.Last().m_FragmentShader = "UnitTestStructLayout.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + + +//---------------------------------------------------------------------------- +// +// Gaussian Blur +// +//---------------------------------------------------------------------------- + +void FillGaussianBlurShaderBindings( EGaussianBlurCombination combination, + RHI::SShaderBindings &bindings, + const RHI::SConstantSetLayout &layoutSampler) +{ + bindings.Reset(); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(layoutSampler); + + // Blur Info + RHI::SPushConstantBuffer blurInfo("BlurInfo", RHI::FragmentShaderMask); + + blurInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "ContextSize")); + blurInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "Direction")); + blurInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "SubUV")); + + bindings.m_PushConstants.PushBack(blurInfo); + + bindings.m_Defines.PushBack(); + bindings.m_Defines.Last().m_ShaderStages = RHI::FragmentShaderMask; + if (combination == GaussianBlurCombination_5_Tap) + bindings.m_Defines.Last().m_Define = "BLUR_5_TAP"; + else if (combination == GaussianBlurCombination_9_Tap) + bindings.m_Defines.Last().m_Define = "BLUR_9_TAP"; + else if (combination == GaussianBlurCombination_13_Tap) + bindings.m_Defines.Last().m_Define = "BLUR_13_TAP"; +} + +//---------------------------------------------------------------------------- + +void AddGaussianBlurDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout layoutSamplerNoDisto; + RHI::SConstantSetLayout layoutSamplerDisto; + + CreateSimpleSamplerConstSetLayouts(layoutSamplerNoDisto, false); + CreateProcessTextureConstSetLayouts(layoutSamplerDisto); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "GaussianBlur.frag"; + + for (u32 combination = 0; combination < GaussianBlurCombination_Count; ++combination) + { + FillGaussianBlurShaderBindings( static_cast(combination), + description.m_Bindings, + layoutSamplerNoDisto); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + FillGaussianBlurShaderBindings(static_cast(combination), + description.m_Bindings, + layoutSamplerDisto); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + } +} + +//---------------------------------------------------------------------------- +// +// Copy Shader +// +//---------------------------------------------------------------------------- + +void FillCopyShaderBindings(ECopyCombination combination, RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout) +{ + bindings.Reset(); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(layout); + + if (combination == CopyCombination_Basic) + { + return; + } + else if (combination == CopyCombination_FlippedBasic) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "COPY_FLIPPED")); + } + else if (combination == CopyCombination_Alpha) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "COPY_ALPHA")); + } + else if (combination == CopyCombination_Normal) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "COPY_NORMAL")); + } + else if (combination == CopyCombination_UnpackedNormal) + { + RHI::SConstantSetLayout sceneInfo; + CreateSceneInfoConstantLayout(sceneInfo); + bindings.m_ConstantSets.PushBack(sceneInfo); + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "COPY_NORMAL_UNPACKED")); + } + else if (combination == CopyCombination_Specular) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "COPY_SPEC")); + } + else if (combination == CopyCombination_MulAdd) + { + RHI::SPushConstantBuffer mulAddInfo("MulAddInfo", RHI::FragmentShaderMask); + + mulAddInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "MulValue")); + mulAddInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "AddValue")); + + bindings.m_PushConstants.PushBack(mulAddInfo); + } + else if (combination == CopyCombination_ToneMapping) + { + RHI::SConstantSetLayout blueNoise; + blueNoise.m_ShaderStagesMask = RHI::FragmentShaderMask; + blueNoise.AddConstantsLayout(RHI::SConstantSamplerDesc("BlueNoise", RHI::SamplerTypeSingle)); + bindings.m_ConstantSets.PushBack(blueNoise); + + RHI::SPushConstantBuffer highPassInfo("ToneMappingInfo", RHI::FragmentShaderMask); + + highPassInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "Common")); + highPassInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "ExpGammaSat")); + highPassInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "Vignetting")); + highPassInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "VignetteColor")); + + bindings.m_PushConstants.PushBack(highPassInfo); + } + else if (combination == CopyCombination_Depth) + { + RHI::SPushConstantBuffer depthInfo("DepthInfo", RHI::FragmentShaderMask); + + depthInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "DepthNear")); + depthInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "DepthFar")); + + bindings.m_PushConstants.PushBack(depthInfo); + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "COPY_DEPTH")); + } + else if (combination == CopyCombination_ComputeLuma) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "COPY_COMPUTE_LUMA")); + } + else + { + PK_ASSERT_NOT_REACHED(); + } +} + +//---------------------------------------------------------------------------- + +void AddCopyDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + // Copy with VBO + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "Copy.frag"; + + RHI::SConstantSetLayout layout; + + CreateSimpleSamplerConstSetLayouts(layout, false); + + // Basic copy + FillCopyShaderBindings(CopyCombination_Basic, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Flipped copy + FillCopyShaderBindings(CopyCombination_FlippedBasic, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Alpha copy + FillCopyShaderBindings(CopyCombination_Alpha, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Copy subtract + FillCopyShaderBindings(CopyCombination_MulAdd, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Bright-pass filter + FillCopyShaderBindings(CopyCombination_ToneMapping, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Depth copy + FillCopyShaderBindings(CopyCombination_Depth, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Normal copy + FillCopyShaderBindings(CopyCombination_Normal, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Unpacked normal copy + FillCopyShaderBindings(CopyCombination_UnpackedNormal, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Specular & Glossiness copy + FillCopyShaderBindings(CopyCombination_Specular, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION + + // Specular & Glossiness copy + FillCopyShaderBindings(CopyCombination_ComputeLuma, description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); // PUSH SHADER DESCRIPTION +} + +//---------------------------------------------------------------------------- +// +// Color Remap Shader +// +//---------------------------------------------------------------------------- + +void FillColorRemapShaderBindings( RHI::SShaderBindings &bindings, + RHI::SConstantSetLayout &layout) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + RHI::SPushConstantBuffer colorRemapInfo("ColorRemapInfo", RHI::FragmentShaderMask); + colorRemapInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "LutHeight")); + bindings.m_PushConstants.PushBack(colorRemapInfo); + bindings.m_ConstantSets.PushBack(layout); +} + +void AddColorRemapDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + // Copy with VBO + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "ColorRemap.frag"; + + RHI::SConstantSetLayout layout; + CreateProcessTextureConstSetLayouts(layout); + + FillColorRemapShaderBindings(description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- +// +// Distortion Shader +// +//---------------------------------------------------------------------------- + +void FillDistortionShaderBindings(RHI::SShaderBindings &bindings, RHI::SConstantSetLayout &layout) +{ + bindings.Reset(); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(layout); + + // DistortionInfo + RHI::SPushConstantBuffer distortionInfo("DistortionInfo", RHI::FragmentShaderMask); + distortionInfo.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat4, "DistortionMultipliers")); + bindings.m_PushConstants.PushBack(distortionInfo); +} + +//---------------------------------------------------------------------------- + +void AddDistortionDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + // Copy with VBO + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "Distortion.frag"; + + RHI::SConstantSetLayout layout; + + CreateProcessTextureConstSetLayouts(layout); + + FillDistortionShaderBindings(description.m_Bindings, layout); + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- +// +// Texture Format +// +//---------------------------------------------------------------------------- + +void FillTextureFormatShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(layout); +} + +//---------------------------------------------------------------------------- + +void AddTextureFormatDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout layout; + + CreateMultiSamplersConstSetLayouts(layout); + + FillTextureFormatShaderBindings(description.m_Bindings, layout); + + // Regular copy + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "GridTexture.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- +// +// Mipmapping +// +//---------------------------------------------------------------------------- + +void FillMipmappingShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &perView, const RHI::SConstantSetLayout &simpleSampler) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "TexCoord"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 2; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(perView); + bindings.m_ConstantSets.PushBack(simpleSampler); + + RHI::SPushConstantBuffer constant("Mipmap", RHI::FragmentShaderMask); + + constant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "Level")); + + bindings.m_PushConstants.PushBack(constant); +} + +//---------------------------------------------------------------------------- + +void AddMipmappingDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragColor"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout perView; + RHI::SConstantSetLayout simpleSampler; + + CreatePerViewConstSetLayouts(perView); + CreateSimpleSamplerConstSetLayouts(simpleSampler, false); + + FillMipmappingShaderBindings(description.m_Bindings, perView, simpleSampler); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "ConstMat4.vert"; + shaders.Last().m_FragmentShader = "SamplingMipmap.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void FillMipmappingModeShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "TexCoord"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(layout); + + RHI::SPushConstantBuffer constant("Mipmap", RHI::FragmentShaderMask); + + constant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "Level")); + + bindings.m_PushConstants.PushBack(constant); +} + +//---------------------------------------------------------------------------- + +void AddMipmappingModeDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout simpleSampler; + + CreateSimpleSamplerConstSetLayouts(simpleSampler, false); + + FillMipmappingModeShaderBindings(description.m_Bindings, simpleSampler); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "SamplingMipmapMode.vert"; + shaders.Last().m_FragmentShader = "SamplingMipmapMode.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- +// +// HDR Texture +// +//---------------------------------------------------------------------------- + +void FillHDRTextureShaderBindings(bool gammaCorrect, RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &simpleSampler) +{ + bindings.Reset(); + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat2; + + bindings.m_ConstantSets.PushBack(simpleSampler); + + if (gammaCorrect) + { + bindings.m_Defines.PushBack(RHI::SShaderDefine(RHI::FragmentShaderStage, "GAMMA_CORRECTION")); + } +} + +//---------------------------------------------------------------------------- + +void AddHDRTextureDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + + description.m_Pipeline = RHI::VsPs; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragTexCoord"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat2; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout simpleSampler; + + CreateSimpleSamplerConstSetLayouts(simpleSampler, false); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "FullScreenQuad.vert"; + shaders.Last().m_FragmentShader = "Tonemapping.frag"; + + FillHDRTextureShaderBindings(false, description.m_Bindings, simpleSampler); + shaders.Last().m_ShaderDescriptions.PushBack(description); + FillHDRTextureShaderBindings(true, description.m_Bindings, simpleSampler); + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- +// +// MSAA +// +//---------------------------------------------------------------------------- + +void FillRTMSAAShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &perView) +{ + bindings.Reset(); + + // Vertex inputs + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Normal"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + + bindings.m_ConstantSets.PushBack(perView); +} + +//---------------------------------------------------------------------------- + +void AddRTMSAADefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "fragWorldNormal"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat3; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + RHI::SConstantSetLayout perView; + + CreatePerViewConstSetLayouts(perView); + + FillRTMSAAShaderBindings(description.m_Bindings, perView); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "ConstMat4.vert"; + shaders.Last().m_FragmentShader = "StaticLighting.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- +// +// Draw Instanced +// +//---------------------------------------------------------------------------- + +void FillDrawInstancedShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "LocalPosition"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "WorldPosition"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "ColorInstance"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 2; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat; + + RHI::SPushConstantBuffer pushConstant("ImageInfo", RHI::VertexShaderMask); + pushConstant.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat2, "Size")); + bindings.m_PushConstants.PushBack(pushConstant); +} + +//---------------------------------------------------------------------------- + +void AddDrawInstancedDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::VsPs; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "ColorInstance"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillDrawInstancedShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "BasicDrawInstanced.vert"; + shaders.Last().m_FragmentShader = "BasicDrawInstanced.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- +// +// Geometry Shaders +// +//---------------------------------------------------------------------------- + +void FillGeometryShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat; +} + +//---------------------------------------------------------------------------- +// +// Geometry Definition +// +//---------------------------------------------------------------------------- + +void AddGeometryDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::EShaderStagePipeline::VsGsPs; + description.m_DrawMode = RHI::DrawModePoint; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "Color"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat; + + // Geometry output + description.m_GeometryOutput.m_PrimitiveType = RHI::DrawModeLine; + description.m_GeometryOutput.m_MaxVertices = 16; + description.m_GeometryOutput.m_GeometryOutput.PushBack(); + description.m_GeometryOutput.m_GeometryOutput.Last().m_Name = "ColorGeom"; + description.m_GeometryOutput.m_GeometryOutput.Last().m_Type = RHI::TypeFloat; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillGeometryShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "BasicGeometry.vert"; + shaders.Last().m_GeometryShader = "BasicGeometry.geom"; + shaders.Last().m_FragmentShader = "BasicGeometry.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- + +void FillGeometry2ShaderBindings(RHI::SShaderBindings &bindings) +{ + bindings.Reset(); + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Position"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 0; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat3; + bindings.m_InputAttributes.PushBack(); + bindings.m_InputAttributes.Last().m_Name = "Color"; + bindings.m_InputAttributes.Last().m_ShaderLocationBinding = 1; + bindings.m_InputAttributes.Last().m_Type = RHI::TypeFloat4; + + RHI::SPushConstantBuffer vertexDesc("NumberOfInstanceConstBuf", RHI::VertexShaderMask); + vertexDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeUint, "NumberOfInstance")); + bindings.m_PushConstants.PushBack(vertexDesc); + + RHI::SPushConstantBuffer geometryDesc("RadiusConstBuf", RHI::GeometryShaderMask); + geometryDesc.AddConstant(RHI::SConstantVarDesc(RHI::TypeFloat, "Radius")); + bindings.m_PushConstants.PushBack(geometryDesc); +} + +//---------------------------------------------------------------------------- +// +// Geometry Definition +// +//---------------------------------------------------------------------------- + +void AddGeometry2Definition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::EShaderStagePipeline::VsGsPs; + description.m_DrawMode = RHI::DrawModePoint; + + // Vertex output + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "Color"; + description.m_VertexOutput.Last().m_Type = RHI::TypeFloat4; + description.m_VertexOutput.Last().m_InputRelated = 1; + description.m_VertexOutput.PushBack(); + description.m_VertexOutput.Last().m_Name = "NumberOfPoints"; + description.m_VertexOutput.Last().m_Type = RHI::TypeUint; + + // Geometry output + description.m_GeometryOutput.m_PrimitiveType = RHI::DrawModeLine; + description.m_GeometryOutput.m_MaxVertices = 64; + description.m_GeometryOutput.m_GeometryOutput.PushBack(); + description.m_GeometryOutput.m_GeometryOutput.Last().m_Name = "ColorGeom"; + description.m_GeometryOutput.m_GeometryOutput.Last().m_Type = RHI::TypeFloat4; + + // Fragment output + description.m_FragmentOutput.PushBack(); + description.m_FragmentOutput.Last().m_Name = "outColor"; + description.m_FragmentOutput.Last().m_Type = RHI::FlagRGBA; + + FillGeometry2ShaderBindings(description.m_Bindings); + + shaders.PushBack(); + shaders.Last().m_VertexShader = "BasicGeometry2.vert"; + shaders.Last().m_GeometryShader = "BasicGeometry2.geom"; + shaders.Last().m_FragmentShader = "BasicGeometry2.frag"; + shaders.Last().m_ShaderDescriptions.PushBack(description); +} + +//---------------------------------------------------------------------------- +// +// Compute Shader Unit Test +// +//---------------------------------------------------------------------------- + +void AddComputeUnitTestBufferDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(32, 32, 1); + + description.m_Bindings.m_ConstantSets.PushBack(); + + RHI::SConstantSetLayout &set = description.m_Bindings.m_ConstantSets.Last(); + set.m_ShaderStagesMask = RHI::ComputeShaderMask; + set.AddConstantsLayout(RHI::SRawBufferDesc("OutData", false)); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "GenerateGeometry.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + +} + +//---------------------------------------------------------------------------- + +void AddComputeUnitTestTextureDefinition(TArray &shaders) +{ + RHI::SShaderDescription description; + description.m_Pipeline = RHI::Cs; + description.m_DrawMode = RHI::DrawModeInvalid; + description.m_DispatchThreadSize = CUint3(32, 32, 1); + + description.m_Bindings.m_ConstantSets.PushBack(); + + RHI::SConstantSetLayout &set = description.m_Bindings.m_ConstantSets.Last(); + set.m_ShaderStagesMask = RHI::ComputeShaderMask; + set.AddConstantsLayout(RHI::STextureStorageDesc("OutData", false)); + + shaders.PushBack(); + shaders.Last().m_ComputeShader = "GenerateTexture.comp"; + shaders.Last().m_ShaderDescriptions.PushBack(description); + +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderDefinitions/UnitTestsShaderDefinitions.h b/Samples/PK-SampleLib/ShaderDefinitions/UnitTestsShaderDefinitions.h new file mode 100644 index 00000000..c9ed2e22 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderDefinitions/UnitTestsShaderDefinitions.h @@ -0,0 +1,210 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SShaderCombination; + +//---------------------------------------------------------------------------- +// Create the constant set layouts: +//---------------------------------------------------------------------------- + +// - SimpleSampler +// - sampler2d Texture +void CreateSimpleSamplerConstSetLayouts(RHI::SConstantSetLayout &layout, bool multiSampled); + +// - MultiSampler +// - sampler2d Texture0 +// - sampler2d Texture1 +// - ... +// - sampler2d TextureN +void CreateMultiSamplersConstSetLayouts(RHI::SConstantSetLayout &layout, u32 textureCount = 3*4); + +// - PerView +// - ViewData +// - float4x4 Model +// - float4x4 View +// - float4x4 Proj +// - float4x4 Normal +void CreatePerViewConstSetLayouts(RHI::SConstantSetLayout &layout); + +// - PerFrame +// - LightData +// - float LightCount +// - float3 LightDirections[256] +// - float3 LightColors[256] +void CreatePerFrameConstSetLayouts(RHI::SConstantSetLayout &layout); + +// - TextureProcess +// - sampler2d ToProcess +// - sampler2d LookUp +void CreateProcessTextureConstSetLayouts(RHI::SConstantSetLayout &layout); + +//---------------------------------------------------------------------------- +// Unit tests shader programs: +//---------------------------------------------------------------------------- + +void AddTriangleNoVboDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillPosColVBOShaderBindings(RHI::SShaderBindings &bindings); +void AddPosColVBODefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillUniformTestShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &perView, const RHI::SConstantSetLayout &perFrame); +void AddUniformTestDefinition(TArray &shaders); + + +void CreateUnitTestStructLayoutConstantSetLayout(RHI::SConstantSetLayout &layout); +void AddUnitTestStructLayoutDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillConstMat4ShaderBindings(RHI::SShaderBindings &bindings, + const RHI::SConstantSetLayout &perView, + const RHI::SConstantSetLayout *perFrame = null, + const RHI::SConstantSetLayout *simpleSampler = null); +void AddConstMat4Definition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void CreateCubemapRenderConstantSetLayout(RHI::SConstantSetLayout &layout); +void FillCubemapRenderShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout, const RHI::SConstantSetLayout &simpleSampler); +void AddCubemapRenderDefinition(TArray &shaders); +void CreateCubemapComputeConstantSetLayout(RHI::SConstantSetLayout &layout, bool inputTxtIsLatLong); +void FillCubemapComputeShaderBindings(RHI::SShaderBindings &bindings, bool inputTxtIsLatLong); +void AddCubemapComputeDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void AddComputeUnitTestBufferDefinition(TArray &shaders); +void AddComputeUnitTestTextureDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +// Blur push constants: +struct SBlurInfo +{ + CFloat2 m_ContextSize; + CFloat2 m_Direction; + CFloat4 m_SubUV; + + SBlurInfo(const CFloat2 &contextSize, const CFloat2 &direction) + : m_ContextSize(contextSize) + , m_Direction(direction) + , m_SubUV(0.0f, 0.0f, 1.0f, 1.0f) + { + } + + SBlurInfo(const CFloat2 &contextSize, const CFloat2 &direction, const CFloat4 &subUV) + : m_ContextSize(contextSize) + , m_Direction(direction) + , m_SubUV(subUV) + { + } +}; + +enum EGaussianBlurCombination +{ + GaussianBlurCombination_5_Tap = 0, + GaussianBlurCombination_9_Tap, + GaussianBlurCombination_13_Tap, + GaussianBlurCombination_Count +}; +void FillGaussianBlurShaderBindings( EGaussianBlurCombination combination, + RHI::SShaderBindings &bindings, + const RHI::SConstantSetLayout &layout); +void AddGaussianBlurDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +// UTBasicDrawMultiPass, UTBasicDrawRTMSAA +// FullScreenQuad.vert +// Copy.frag +enum ECopyCombination +{ + CopyCombination_Basic = 0, + CopyCombination_FlippedBasic, + CopyCombination_Alpha, + CopyCombination_MulAdd, + CopyCombination_ToneMapping, + CopyCombination_Depth, + CopyCombination_Normal, + CopyCombination_UnpackedNormal, + CopyCombination_Specular, + CopyCombination_ComputeLuma, + CopyCombination_Count +}; +void FillCopyShaderBindings(ECopyCombination combination, RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout); +void AddCopyDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillDistortionShaderBindings(RHI::SShaderBindings &bindings, RHI::SConstantSetLayout &layout); +void AddDistortionDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillColorRemapShaderBindings(RHI::SShaderBindings &bindings, RHI::SConstantSetLayout &layout); +void AddColorRemapDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillTextureFormatShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout); +void AddTextureFormatDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillMipmappingShaderBindings( RHI::SShaderBindings &bindings, + const RHI::SConstantSetLayout &perView, + const RHI::SConstantSetLayout &simpleSampler); +void AddMipmappingDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillMipmappingModeShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout); +void AddMipmappingModeDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillHDRTextureShaderBindings(bool gammaCorrect, RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout); +void AddHDRTextureDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillRTMSAAShaderBindings(RHI::SShaderBindings &bindings, const RHI::SConstantSetLayout &layout); +void AddRTMSAADefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillDrawInstancedShaderBindings(RHI::SShaderBindings &bindings); +void AddDrawInstancedDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillGeometryShaderBindings(RHI::SShaderBindings &bindings); +void AddGeometryDefinition(TArray &shaders); + +//---------------------------------------------------------------------------- + +void FillGeometry2ShaderBindings(RHI::SShaderBindings &bindings); +void AddGeometry2Definition(TArray &shaders); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderGenerator/GLSLShaderGenerator.cpp b/Samples/PK-SampleLib/ShaderGenerator/GLSLShaderGenerator.cpp new file mode 100644 index 00000000..4a188be9 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/GLSLShaderGenerator.cpp @@ -0,0 +1,813 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "GLSLShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include "pk_rhi/include/EnumHelper.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +namespace +{ + + const char *_GetGlslPrimitiveLayoutType(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return "points"; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return "lines"; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return "triangles"; + default: + PK_ASSERT_NOT_REACHED(); + return null; + } + } + + //---------------------------------------------------------------------------- + + const char *_GetGlslOutType(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return "points"; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return "line_strip"; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return "triangle_strip"; + default: + PK_ASSERT_NOT_REACHED(); + return null; + } + } + + //---------------------------------------------------------------------------- + + u32 _GetPointNumberInPrimitive(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return 1; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return 2; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return 3; + default: + PK_ASSERT_NOT_REACHED(); + return 0; + } + } +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenDefines(const RHI::SShaderDescription &description) const +{ + (void)description; + const CString defines = "\n" + "#define OPENGL_API\n" + "\n" + "#define GLUE(_a, _b) _a ## _b\n" + "\n" + "#define VEC4_ZERO vec4(0,0,0,0)\n" + "#define VEC4_ONE vec4(1,1,1,1)\n" + "#define VEC3_ZERO vec3(0,0,0)\n" + "#define VEC3_ONE vec3(1,1,1)\n" + "#define VEC2_ZERO vec2(0,0)\n" + "#define VEC2_ONE vec2(1,1)\n" + "\n" + "#define VEC_GREATER_THAN(_vec1, _vec2) greaterThan(_vec1, _vec2)\n" + "#define VEC_GREAT_THAN_EQ(_vec1, _vec2) greaterThanEqual(_vec1, _vec2)\n" + "#define VEC_LESS_THAN(_vec1, _vec2) lessThan(_vec1, _vec2)\n" + "#define VEC_LESS_THAN_EQ(_vec1, _vec2) lessThanEqual(_vec1, _vec2)\n" + "#define VEC_EQ(_vec1, _vec2) equal(_vec1, _vec2)\n" + "#define VEC_NOT_EQ(_vec1, _vec2) notEqual(_vec1, _vec2)\n" + "#define ALL_BOOL(_bvec) all(_bvec)\n" + "#define ANY_BOOL(_bvec) any(_bvec)\n" + "\n" + "#define BUILD_MAT2(_axisX, _axisY) mat2(_axisX, _axisY)\n" + "#define BUILD_MAT3(_axisX, _axisY, _axisZ) mat3(_axisX, _axisY, _axisZ)\n" + "#define BUILD_MAT4(_axisX, _axisY, _axisZ, _axisW) mat4(_axisX, _axisY, _axisZ, _axisW)\n" + "\n" + "#define GET_CONSTANT(_constant, _var) _constant._var\n" + "#define GET_RAW_BUFFER(_buffer) _buffer._buffer\n" + "\n" + "#define TEXTURE_DIMENSIONS(_sampler, _lod, _dimensions) _dimensions = textureSize(_sampler, _lod);\n" + "#define SAMPLE(_sampler, _uv) texture(_sampler, _uv)\n" + "#define SAMPLE_CUBE(_sampler, _uv) SAMPLE(_sampler, _uv)\n" + "#define FETCH(_sampler, _uv) texelFetch(_sampler, (_uv).xy, (_uv).z)\n" // uv is int3 (z = lod) + "#define SAMPLEMS(_sampler, _uv, _sampleID) texelFetch(_sampler, _uv, _sampleID)\n" + "#define SAMPLELOD(_sampler, _uv, _lod) textureLod(_sampler, _uv, _lod)\n" + "#define SAMPLELOD_CUBE(_sampler, _uv, _lod) SAMPLELOD(_sampler, _uv, _lod)\n" + "#define SAMPLEGRAD(_sampler, _uv, _ddx, _ddy) textureGrad(_sampler, _uv, _ddx, _ddy)\n" + "\n" + "#define RAW_BUFFER_INDEX(_index) (_index)\n" + "\n" + "#define LOADU(_name, _index) _name[_index]\n" + "#define LOADU2(_name, _index) uvec2(_name[_index], _name[(_index) + 1])\n" + "#define LOADU3(_name, _index) uvec3(_name[_index], _name[(_index) + 1], _name[(_index) + 2])\n" + "#define LOADU4(_name, _index) uvec4(_name[_index], _name[(_index) + 1], _name[(_index) + 2], _name[(_index) + 3])\n" + "\n" + "#define LOADI(_name, _index) _name[_index]\n" + "#define LOADI2(_name, _index) ivec2(_name[_index], _name[(_index) + 1])\n" + "#define LOADI3(_name, _index) ivec3(_name[_index], _name[(_index) + 1], _name[(_index) + 2])\n" + "#define LOADI4(_name, _index) ivec4(_name[_index], _name[(_index) + 1], _name[(_index) + 2], _name[(_index) + 3])\n" + "\n" + "#define LOADF(_name, _index) asfloat(_name[_index])\n" + "#define LOADF2(_name, _index) vec2(asfloat(_name[_index]), asfloat(_name[(_index) + 1]))\n" + "#define LOADF3(_name, _index) vec3(asfloat(_name[_index]), asfloat(_name[(_index) + 1]), asfloat(_name[(_index) + 2]))\n" + "#define LOADF4(_name, _index) vec4(asfloat(_name[_index]), asfloat(_name[(_index) + 1]), asfloat(_name[(_index) + 2]), asfloat(_name[(_index) + 3]))\n" + "\n" + "#define STOREU(_name, _index, _value) _name[_index] = _value;\n" + "#define STOREU2(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y\n" + "#define STOREU3(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y; _name[(_index) + 2] = (_value).z;\n" + "#define STOREU4(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y; _name[(_index) + 2] = (_value).z; _name[(_index) + 3] = (_value).w;\n" + "\n" + "#define STOREF(_name, _index, _value) _name[_index] = asuint(_value);\n" + "#define STOREF2(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y)\n" + "#define STOREF3(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y); _name[(_index) + 2] = asuint((_value).z);\n" + "#define STOREF4(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y); _name[(_index) + 2] = asuint((_value).z); _name[(_index) + 3] = asuint((_value).w);\n" + "\n" + "#define F32TOF16(_x) packHalf2x16(vec2 (_x, 0))\n" + "\n" + "#define ATOMICADD(_name, _index, _value, _original) _original = atomicAdd(_name[_index], asuint(_value))\n" + "\n" + "#define GROUPMEMORYBARRIERWITHGROUPSYNC() groupMemoryBarrier(); barrier();\n" + "\n" + "#define IMAGE_LOAD(_name, _uv) imageLoad(_name, ivec2(_uv))\n" + "#define IMAGE_STORE(_name, _uv, _value) imageStore(_name, ivec2(_uv), _value)\n" + "\n" + "#define mul(_a,_b) ((_a) * (_b))\n" + "\n" + "#define asuint(x) floatBitsToUint(x)\n" + "#define asfloat(x) uintBitsToFloat(x)\n" + "\n" + "#define ARRAY_BEGIN(_type) _type[] (\n" + "#define ARRAY_END() )\n" + "\n" + "#define SAMPLER2D_DCL_ARG(_sampler) sampler2D _sampler\n" + "#define SAMPLER2DMS_DCL_ARG(_sampler) sampler2DMS _sampler\n" + "\n" + "#define SAMPLER_ARG(_sampler) _sampler\n" + "#define SAMPLERMS_ARG(_sampler) _sampler\n" + "\n" + "#define SATURATE(_value) clamp(_value, 0.0, 1.0)\n" + "#define CAST(_type, _value) _type(_value)\n" + "\n" + "#define CROSS(_a, _b) cross(_a, _b)\n" + "\n" + "#define IN(_type) in _type\n" + "#define OUT(_type) out _type\n" + "#define INOUT(_type) inout _type\n" + "\n" + "#define GS_PARAMS\n" + "#define GS_ARGS\n" + "#define VS_PARAMS\n" + "#define VS_ARGS\n" + "#define FS_PARAMS\n" + "#define FS_ARGS\n" + "#define CS_PARAMS\n" + "#define CS_ARGS\n" + "\n" + "#define rsqrt(x) (1.0 / sqrt(x))\n" + "#define GET_MATRIX_X_AXIS(_mat) (_mat)[0]\n" + "#define GET_MATRIX_Y_AXIS(_mat) (_mat)[1]\n" + "#define GET_MATRIX_Z_AXIS(_mat) (_mat)[2]\n" + "#define GET_MATRIX_W_AXIS(_mat) (_mat)[3]\n" + "\n" + "#define GET_GROUPSHARED(_var) _var\n" + "\n" + "#define UNROLL\n" + "\n"; + + CString precisions; + + if (m_UseMediumPrecision) + { + precisions = "#define FLOAT_PRECISION precision mediump float;\n" + "#define SAMPLER2D_PRECISION precision mediump sampler2D;\n" + "#define SAMPLER2DMS_PRECISION precision mediump sampler2DMS;\n" + "#define SAMPLERCUBE_PRECISION precision mediump samplerCube;\n"; + } + else + { + precisions = "#define FLOAT_PRECISION\n" + "#define SAMPLER2D_PRECISION\n" + "#define SAMPLER2DMS_PRECISION\n" + "#define SAMPLERCUBE_PRECISION\n"; + } + + CString version; + + if (m_IsOpenGLES) + version = "#define VERSION #version 310 es\n"; + else + { + bool useStorageResource = false; + // We check if we are using a storage buffer: + for (u32 i = 0; i < description.m_Bindings.m_ConstantSets.Count() && !useStorageResource; ++i) + { + for (u32 j = 0; j < description.m_Bindings.m_ConstantSets[i].m_Constants.Count() && !useStorageResource; ++j) + { + useStorageResource = (description.m_Bindings.m_ConstantSets[i].m_Constants[j].m_Type == RHI::TypeRawBuffer) || + (description.m_Bindings.m_ConstantSets[i].m_Constants[j].m_Type == RHI::TypeTextureStorage); + } + } + if (useStorageResource) + version = "#define VERSION #version 430\n"; + else + version = "#define VERSION #version 330\n"; + } + CString extensions; + + if (m_IsOpenGLES) + extensions = "#define EXTENSION1\n"; + else + extensions = "#define EXTENSION1 #extension GL_ARB_separate_shader_objects : enable\n"; + + return defines + precisions + version + extensions; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenHeader(RHI::EShaderStage stage) const +{ + (void)stage; + return "VERSION\nEXTENSION1\nFLOAT_PRECISION\nSAMPLER2D_PRECISION\nSAMPLER2DMS_PRECISION\nSAMPLERCUBE_PRECISION\n"; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenVertexInputs(const TMemoryView &vertexInputs) +{ + CString vertexInputsStr; + + // Vertex Inputs + PK_FOREACH(attribute, vertexInputs) + { + vertexInputsStr += CString::Format( "layout(location = %d) in %s _vin_%s;\n", + attribute->m_ShaderLocationBinding, + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data()); + } + + // struct + vertexInputsStr += "\nstruct SVertexInput\n{\n"; + PK_FOREACH(attribute, vertexInputs) + { + vertexInputsStr += CString::Format( " %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data()); + } + vertexInputsStr += " int VertexIndex;\n"; + vertexInputsStr += " uint InstanceId;\n"; + vertexInputsStr += "};\n"; + return vertexInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) +{ + (void)toFragment; + CString vertexOutputsStr; + u32 outputLocation = 0; + + // Vertex Outputs + PK_FOREACH(interpolated, vertexOutputs) + { +#if defined(PK_MACOSX) + CString format; + + if (toFragment) + format = "layout(location = %d) %s out %s _fin_%s;\n"; + else + format = "layout(location = %d) %s out %s _gin_%s;\n"; + + vertexOutputsStr += CString::Format(format.Data(), + outputLocation, + RHI::GlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); +#else + vertexOutputsStr += CString::Format("layout(location = %d) %s out %s _vout_%s;\n", + outputLocation, + RHI::GlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); +#endif + outputLocation += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + // struct + vertexOutputsStr += "\nstruct SVertexOutput\n{\n"; + PK_FOREACH(interpolated, vertexOutputs) + { + vertexOutputsStr += CString::Format(" %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + } + vertexOutputsStr += " vec4 VertexPosition;\n"; + vertexOutputsStr += "};\n"; + return vertexOutputsStr; +} + +//----------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenGeometryInputs(const TMemoryView& geometryInputs, const RHI::EDrawMode drawMode) +{ + PK_ASSERT_MESSAGE(drawMode != RHI::DrawModeInvalid, "Geometry shader input primitive type is not set"); + + + CString geomInputsStr; + geomInputsStr += CString::Format("layout(%s) in;\n", _GetGlslPrimitiveLayoutType(drawMode)); + + const u32 pointNumberInput = _GetPointNumberInPrimitive(drawMode); + u32 inputLocation = 0; + // Geometry Inputs + PK_FOREACH(attribute, geometryInputs) + { + geomInputsStr += CString::Format( "layout(location = %d) %s in %s _gin_%s[%d];\n", + inputLocation, + RHI::GlslShaderTypes::GetInterpolationString(attribute->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data(), + pointNumberInput); + inputLocation += RHI::VarType::GetRowNumber(attribute->m_Type); + } + + geomInputsStr += "\nstruct SPrimitives\n{\n"; + PK_FOREACH(attribute, geometryInputs) { + geomInputsStr += CString::Format( " %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data()); + } + //geomInputsStr += CString::Format(" vec4 VertexPosition[%d];\n", pointNumberInput); + geomInputsStr += "\tvec4 VertexPosition;\n"; + geomInputsStr += "};\n"; + + // struct + geomInputsStr += "\nstruct SGeometryInput\n{\n"; + geomInputsStr += CString::Format("\tSPrimitives Primitives[%d];\n", pointNumberInput); + geomInputsStr += "\tint PrimitiveId;\n"; + geomInputsStr += "};\n"; + return geomInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenGeometryOutputs(const RHI::SGeometryOutput &geometryOutputs) +{ + CString geometryOutputsStr; + u32 outputLocation = 0; + + PK_ASSERT_MESSAGE(geometryOutputs.m_MaxVertices != 0, "Geometry can emmit a maximum of 0 vertices... Set the value to something appropriate"); + + geometryOutputsStr += CString::Format( "layout(%s, max_vertices = %d) out;\n", + _GetGlslOutType(geometryOutputs.m_PrimitiveType), + geometryOutputs.m_MaxVertices); + + // Vertex Outputs + PK_FOREACH(interpolated, geometryOutputs.m_GeometryOutput) + { +#if defined(PK_MACOSX) + geometryOutputsStr += CString::Format("layout(location = %d) %s out %s _fin_%s;\n", + outputLocation, + RHI::GlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); +#else + geometryOutputsStr += CString::Format("layout(location = %d) %s out %s _gout_%s;\n", + outputLocation, + RHI::GlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); +#endif + outputLocation += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + // struct + geometryOutputsStr += "\nstruct SGeometryOutput\n{\n"; + PK_FOREACH(interpolated, geometryOutputs.m_GeometryOutput) + { + geometryOutputsStr += CString::Format(" %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + } + geometryOutputsStr += " vec4 VertexPosition;\n"; + geometryOutputsStr += "};\n"; + return geometryOutputsStr; +} + +//----------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenFragmentInputs(const TMemoryView &fragmentInputs) +{ + CString vertexOutputsStr; + u32 inputLocation = 0; + + // Vertex Outputs + PK_FOREACH(interpolated, fragmentInputs) + { + vertexOutputsStr += CString::Format("layout(location = %d) %s in %s _fin_%s;\n", + inputLocation, + RHI::GlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + inputLocation += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + // struct + vertexOutputsStr += "\nstruct SFragmentInput\n{\n"; + PK_FOREACH(interpolated, fragmentInputs) + { + vertexOutputsStr += CString::Format(" %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + } + vertexOutputsStr += " bool IsFrontFace;\n"; + vertexOutputsStr += "};\n"; + return vertexOutputsStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenFragmentOutputs(const TMemoryView &fragmentOutputs) +{ + CString fragmentOutputsStr; + u32 outputLocation = 0; + bool hasDepthOutput = false; + + PK_FOREACH(outBuffer, fragmentOutputs) + { + bool isDepth = false; + RHI::EVarType outType = RHI::VarType::PixelFormatToType(outBuffer->m_Type, isDepth); + + if (isDepth == false) + { + fragmentOutputsStr += CString::Format("layout(location = %d) out %s _fout_%s;\n", + outputLocation++, + RHI::GlslShaderTypes::GetTypeString(outType).Data(), + outBuffer->m_Name.Data()); + } + else + { + hasDepthOutput = true; + } + } + fragmentOutputsStr += "\nstruct SFragmentOutput\n{\n"; + PK_FOREACH(outBuffer, fragmentOutputs) + { + bool isDepth; + RHI::EVarType outType; + + outType = RHI::VarType::PixelFormatToType(outBuffer->m_Type, isDepth); + if (isDepth == false) + { + fragmentOutputsStr += CString::Format(" %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(outType).Data(), + outBuffer->m_Name.Data()); + } + } + if (hasDepthOutput) + { + fragmentOutputsStr += " float DepthValue;\n"; + } + fragmentOutputsStr += "};\n"; + return fragmentOutputsStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) +{ + CString constantsStr; + + PK_FOREACH(constantSet, constSet) + { + if ((constantSet->m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + PK_FOREACH(constant, constantSet->m_Constants) + { + if (constant->m_Type == RHI::TypeConstantBuffer) + { + constantsStr += CString::Format("layout(/*binding = %d, */std140) uniform U%s\n", constant->m_ConstantBuffer.m_PerBlockBinding.Get(), constant->m_ConstantBuffer.m_Name.Data()); + constantsStr += "{\n"; + PK_FOREACH(var, constant->m_ConstantBuffer.m_Constants) + { + constantsStr += CString::Format(" %s %s", RHI::GlslShaderTypes::GetTypeString(var->m_Type).Data(), var->m_Name.Data()); + if (var->m_ArraySize >= 1) + constantsStr += CString::Format("[%u];\n", var->m_ArraySize); + else + constantsStr += ";\n"; + } + constantsStr += CString::Format("} %s;\n", constant->m_ConstantBuffer.m_Name.Data()); + } + else if (constant->m_Type == RHI::TypeRawBuffer) + { + const char *ro = constant->m_RawBuffer.m_ReadOnly ? "readonly" : ""; + const char *name = constant->m_RawBuffer.m_Name.Data(); + constantsStr += CString::Format("layout(std430/*, binding = %d*/) %s buffer B%s\n" + "{\n" + " uint %s[];\n" + "} %s;\n", constant->m_RawBuffer.m_PerBlockBinding.Get(), ro, name, name, name); + } + else if (constant->m_Type == RHI::TypeTextureStorage) + { + const bool hasFormat = constant->m_TextureStorage.m_Format != RHI::FormatUnknown; + constantsStr += CString::Format("/*layout(binding = %d)*/ %s uniform %s image2D %s;\n", + constant->m_TextureStorage.m_PerBlockBinding.Get(), + hasFormat ? ("layout(" + RHI::GlslShaderTypes::GetGLSLLayoutQualifierString(constant->m_TextureStorage.m_Format) + ")").Data() : "", + constant->m_TextureStorage.m_ReadOnly ? "readonly" : hasFormat ? "" : "writeonly", + constant->m_TextureStorage.m_Name.Data()); + } + else if (constant->m_Type == RHI::TypeConstantSampler) + { + constantsStr += CString::Format("/*layout(binding = %d) */uniform %s %s;\n", + constant->m_ConstantSampler.m_PerBlockBinding.Get(), + constant->m_ConstantSampler.m_Type == RHI::SamplerTypeMulti ? "highp sampler2DMS" : constant->m_ConstantSampler.m_Type == RHI::SamplerTypeCube ? "samplerCube" : "sampler2D", + constant->m_ConstantSampler.m_Name.Data()); + } + } + } + } + return constantsStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) +{ + CString pushConstantsStr; + + PK_FOREACH(pushConstant, pushConstants) + { + if ((pushConstant->m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + pushConstantsStr += CString::Format("layout(/*binding = %d, */std140) uniform U%s\n", + pushConstant->m_PerBlockBinding.Get(), + pushConstant->m_Name.Data()); + pushConstantsStr += "{\n"; + PK_FOREACH(var, pushConstant->m_Constants) + { + pushConstantsStr += CString::Format(" %s %s", + RHI::GlslShaderTypes::GetTypeString(var->m_Type).Data(), + var->m_Name.Data()); + if (var->m_ArraySize >= 1) + pushConstantsStr += CString::Format("[%u];\n", var->m_ArraySize); + else + pushConstantsStr += ";\n"; + } + pushConstantsStr += CString::Format("} %s;\n", pushConstant->m_Name.Data()); + } + } + return pushConstantsStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenGroupsharedVariables(const TMemoryView &groupsharedVariables) +{ + CString groupsharedStr; + + for (auto &variable : groupsharedVariables) + { + groupsharedStr += CString::Format( "shared %s %s[%u];\n", + RHI::GlslShaderTypes::GetTypeString(variable.m_Type).Data(), + variable.m_Name.Data(), + variable.m_ArraySize); + } + + return groupsharedStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenVertexMain( const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) +{ + (void)outputClipspacePosition; + CString mainStr; + + // Shader main + mainStr += "void main()\n{\n"; + mainStr += " SVertexInput vInput;\n"; + mainStr += " SVertexOutput vOutput;\n\n"; + PK_FOREACH(attribute, vertexInputs) + { + mainStr += CString::Format(" vInput.%s = _vin_%s;\n", attribute->m_Name.Data(), attribute->m_Name.Data()); + } + mainStr += " vInput.VertexIndex = gl_VertexID;\n"; + mainStr += " vInput.InstanceId = uint(gl_InstanceID);\n"; + + // Initialize output struct to zero + PK_FOREACH(vertOutput, vertexOutputs) + { + mainStr += CString::Format(" vOutput.%s = %s(0", vertOutput->m_Name.Data(), RHI::GlslShaderTypes::GetTypeString(vertOutput->m_Type).Data()); + for (u32 i = 1; i < RHI::VarType::VarTypeToComponentSize(vertOutput->m_Type); ++i) + mainStr += ", 0"; + mainStr += ");\n"; + } + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(vInput, vOutput);\n"; + } + PK_FOREACH(interpolated, vertexOutputs) + { +#if defined(PK_MACOSX) + CString format; + + if (outputClipspacePosition) + mainStr += CString::Format(" _fin_%s = vOutput.%s;\n", interpolated->m_Name.Data(), interpolated->m_Name.Data()); + else + mainStr += CString::Format(" _gin_%s = vOutput.%s;\n", interpolated->m_Name.Data(), interpolated->m_Name.Data()); +#else + mainStr += CString::Format(" _vout_%s = vOutput.%s;\n", interpolated->m_Name.Data(), interpolated->m_Name.Data()); +#endif + } + mainStr += " gl_Position = vOutput.VertexPosition;\n"; + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenGeometryMain( const TMemoryView & geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) +{ + const u32 pointNumberInput = _GetPointNumberInPrimitive(primitiveType); +// const u32 pointNumberOutput = _GetPointNumberInPrimitive(geometryOutputs.m_PrimitiveType); + + // Shader main + CString mainStr; + mainStr += "void main()\n{\n"; + mainStr += " SGeometryInput gInput;\n"; + mainStr += CString::Format(" SGeometryOutput gOutput;\n\n"); + + PK_FOREACH(attribute, geometryInputs) + { + for (u32 i = 0 ; i < pointNumberInput ; ++i) + mainStr += CString::Format(" gInput.Primitives[%d].%s = _gin_%s[%d];\n", i, attribute->m_Name.Data(), attribute->m_Name.Data(), i); + } + for (u32 i = 0 ; i < pointNumberInput ; ++i) + mainStr += CString::Format(" gInput.Primitives[%d].VertexPosition = gl_in[%d].gl_Position;\n", i, i); + mainStr += " gInput.PrimitiveId = gl_PrimitiveIDIn;\n"; + // Initialize output struct to zero + PK_FOREACH(geomOutput, geometryOutputs.m_GeometryOutput) + { + mainStr += CString::Format(" gOutput.%s = %s(0", geomOutput->m_Name.Data(), RHI::GlslShaderTypes::GetTypeString(geomOutput->m_Type).Data()); + for (u32 i = 1; i < RHI::VarType::VarTypeToComponentSize(geomOutput->m_Type); ++i) + mainStr += ", 0"; + mainStr += ");\n"; + } + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(gInput, gOutput);\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenFragmentMain( const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) +{ + bool hasDepth = false; + CString mainStr; + + // Shader main + mainStr += "void main()\n{\n"; + mainStr += " SFragmentInput fInput;\n"; + mainStr += " SFragmentOutput fOutput;\n\n"; + PK_FOREACH(interpolated, vertexOutputs) + { + mainStr += CString::Format(" fInput.%s = _fin_%s;\n", interpolated->m_Name.Data(), interpolated->m_Name.Data()); + } + mainStr += " fInput.IsFrontFace = gl_FrontFacing;\n"; + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(fInput, fOutput);\n"; + } + PK_FOREACH(outBuffer, fragmentOutputs) + { + if (outBuffer->m_Type == RHI::FlagD) + { + hasDepth = true; + } + else + { + mainStr += CString::Format(" _fout_%s = fOutput.%s;\n", outBuffer->m_Name.Data(), outBuffer->m_Name.Data()); + } + } + if (hasDepth) + { + mainStr += " gl_FragDepth = fOutput.DepthValue;\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenGeometryEmitVertex(const RHI::SGeometryOutput &geometryOutputs, bool outputClipspacePosition) +{ + (void)outputClipspacePosition; +// const u32 pointNumberOutput = _GetPointNumberInPrimitive(geometryOutputs.m_PrimitiveType); + + CString emitVertexStr; + emitVertexStr += "void AppendVertex(in SGeometryOutput outputData)\n{\n"; + + PK_FOREACH(attribute, geometryOutputs.m_GeometryOutput) + { +#if defined(PK_MACOSX) + emitVertexStr += CString::Format(" _fin_%s = outputData.%s;\n", attribute->m_Name.Data(), attribute->m_Name.Data()); +#else + emitVertexStr += CString::Format(" _gout_%s = outputData.%s;\n", attribute->m_Name.Data(), attribute->m_Name.Data()); +#endif + } + emitVertexStr += " gl_Position = outputData.VertexPosition;\n"; + emitVertexStr += " EmitVertex();\n"; + + emitVertexStr += "}"; + return emitVertexStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenGeometryEndPrimitive(const RHI::SGeometryOutput &geometryOutputs) +{ + (void)geometryOutputs; + CString emitEndStr; + emitEndStr += "void FinishPrimitive(in SGeometryOutput outputData)\n{\n"; + emitEndStr += " EndPrimitive();\n"; + emitEndStr += "}\n"; + return emitEndStr; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenComputeInputs() +{ + return "\n" + "\nstruct SComputeInput\n" + "{\n" + " uvec3 GlobalThreadID;" + " uvec3 LocalThreadID;" + " uvec3 GroupID;" + "};\n"; +} + +//---------------------------------------------------------------------------- + +CString CGLSLShaderGenerator::GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) +{ + // Shader main + CString mainStr; + mainStr += CString::Format("layout(local_size_x = %u, local_size_y = %u, local_size_z = %u) in;\n", dispatchSize.x(), dispatchSize.y(), dispatchSize.z()); + mainStr += "void main()\n" + "{\n" + " SComputeInput cInput;\n" + " cInput.GlobalThreadID = gl_GlobalInvocationID;\n" + " cInput.LocalThreadID = gl_LocalInvocationID;\n" + " cInput.GroupID = gl_WorkGroupID;\n"; + for(const CString &func : funcToCall) + { + if (!func.Empty()) + mainStr += " " + func + "(cInput);\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/GLSLShaderGenerator.h b/Samples/PK-SampleLib/ShaderGenerator/GLSLShaderGenerator.h new file mode 100644 index 00000000..489e73b9 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/GLSLShaderGenerator.h @@ -0,0 +1,80 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include "ShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CGLSLShaderGenerator : public CAbstractShaderGenerator +{ +public: + CGLSLShaderGenerator() : m_IsOpenGLES(false), m_UseMediumPrecision(false) {} + virtual ~CGLSLShaderGenerator() {} + + +protected: + bool m_IsOpenGLES; + bool m_UseMediumPrecision; + +private: + virtual CString GenDefines(const RHI::SShaderDescription &description) const override final; + virtual CString GenHeader(RHI::EShaderStage stage) const override; + virtual CString GenVertexInputs(const TMemoryView &vertexInputs) override; + virtual CString GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) override; + virtual CString GenGeometryInputs(const TMemoryView &geometryInputs, const RHI::EDrawMode drawMode) override final; + virtual CString GenGeometryOutputs(const RHI::SGeometryOutput &geometryOutputs) override final; + virtual CString GenFragmentInputs(const TMemoryView &fragmentInputs) override; + virtual CString GenFragmentOutputs(const TMemoryView &fragmentOutputs) override; + virtual CString GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) override; + virtual CString GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) override; + virtual CString GenGroupsharedVariables(const TMemoryView &groupsharedVariables) override; + virtual CString GenVertexMain( const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) override; + virtual CString GenGeometryMain(const TMemoryView &geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) override final; + virtual CString GenFragmentMain(const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) override; + virtual CString GenGeometryEmitVertex(const RHI::SGeometryOutput &geometryOutputs, bool outputClipspacePosition) override final; + virtual CString GenGeometryEndPrimitive(const RHI::SGeometryOutput &geometryOutputs) override final; + virtual CString GenComputeInputs() override final; + virtual CString GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) override final; +}; + +//---------------------------------------------------------------------------- + +class CGLSLESShaderGenerator : public CGLSLShaderGenerator +{ +public: + CGLSLESShaderGenerator(bool isMediumPrecision = true) + { + m_IsOpenGLES = true; + m_UseMediumPrecision = isMediumPrecision; + } + virtual ~CGLSLESShaderGenerator() {} +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/HLSLShaderGenerator.cpp b/Samples/PK-SampleLib/ShaderGenerator/HLSLShaderGenerator.cpp new file mode 100644 index 00000000..fb0347b1 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/HLSLShaderGenerator.cpp @@ -0,0 +1,696 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "HLSLShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +namespace +{ + + const char *_GetHlslPrimitiveLayoutInputType(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return "point"; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return "line"; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return "triangle"; + default: + PK_ASSERT_NOT_REACHED(); + return null; + } + } + + //---------------------------------------------------------------------------- + + const char *_GetHlslPrimitiveLayoutOutputType(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return "PointStream"; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return "LineStream"; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return "TriangleStream"; + default: + PK_ASSERT_NOT_REACHED(); + return null; + } + } + + //---------------------------------------------------------------------------- + + u32 _GetPointNumberInPrimitive(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return 1; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return 2; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return 3; + default: + PK_ASSERT_NOT_REACHED(); + return 0; + } + } +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenDefines(const RHI::SShaderDescription &description) const +{ + CString defines = "\n" + "#define DIRECTX_API \n" + "\n" + "#define GLUE(_a, _b) _a ## _b\n" + "\n" + "#define VEC4_ZERO vec4(0,0,0,0)\n" + "#define VEC4_ONE vec4(1,1,1,1)\n" + "#define VEC3_ZERO vec3(0,0,0)\n" + "#define VEC3_ONE vec3(1,1,1)\n" + "#define VEC2_ZERO vec2(0,0)\n" + "#define VEC2_ONE vec2(1,1)\n" + "\n" + "#define VEC_GREATER_THAN(_vec1, _vec2) ((_vec1) > (_vec2))\n" + "#define VEC_GREAT_THAN_EQ(_vec1, _vec2) ((_vec1) >= (_vec2))\n" + "#define VEC_LESS_THAN(_vec1, _vec2) ((_vec1) < (_vec2))\n" + "#define VEC_LESS_THAN_EQ(_vec1, _vec2) ((_vec1) <= (_vec2))\n" + "#define VEC_EQ(_vec1, _vec2) ((_vec1) == (_vec2))\n" + "#define VEC_NOT_EQ(_vec1, _vec2) ((_vec1) != (_vec2))\n" + "#define ALL_BOOL(_bvec) all(_bvec)\n" + "#define ANY_BOOL(_bvec) any(_bvec)\n" + "\n" + "#define vec2 float2\n" + "#define vec3 float3\n" + "#define vec4 float4\n" + "\n" + "#define mat2 float2x2\n" + "#define mat3 float3x3\n" + "#define mat4 float4x4\n" + "\n" + "#define dvec2 double2\n" + "#define dvec3 double3\n" + "#define dvec4 double4\n" + "\n" + "#define ivec2 int2\n" + "#define ivec3 int3\n" + "#define ivec4 int4\n" + "\n" + "#define uvec2 uint2\n" + "#define uvec3 uint3\n" + "#define uvec4 uint4\n" + "\n" + "#define BUILD_MAT2(_axisX, _axisY) transpose(mat2(_axisX, _axisY))\n" + "#define BUILD_MAT3(_axisX, _axisY, _axisZ) transpose(mat3(_axisX, _axisY, _axisZ))\n" + "#define BUILD_MAT4(_axisX, _axisY, _axisZ, _axisW) transpose(mat4(_axisX, _axisY, _axisZ, _axisW))\n" + "\n" + "#define GET_CONSTANT(_constant, _var) _var\n" + "#define GET_RAW_BUFFER(_buffer) _buffer\n" + "\n" + "#define CROSS(_a, _b) cross(_a, _b)\n" + "\n" + "#define DX_TEXTURE_NAME(_name) GLUE(Tex_,_name)\n" + "#define DX_SAMPLER_NAME(_name) GLUE(Sampler_,_name)\n" + "\n" + "#define TEXTURE_DIMENSIONS(_sampler, _lod, _dimensions) { uint _levelCount; DX_TEXTURE_NAME(_sampler).GetDimensions(_lod, (_dimensions).x, (_dimensions).y, _levelCount); }\n" + "#define SAMPLE(_sampler, _uv) DX_TEXTURE_NAME(_sampler).Sample(DX_SAMPLER_NAME(_sampler), _uv)\n" + "#define SAMPLE_CUBE(_sampler, _uv) SAMPLE(_sampler, _uv)\n" + "#define FETCH(_sampler, _uv) DX_TEXTURE_NAME(_sampler).Load(_uv)\n" // uv is int3 (z = lod) + "#define SAMPLEMS(_samplerMS, _uv, _sampleID) DX_TEXTURE_NAME(_samplerMS).Load(_uv, _sampleID)\n" + "#define SAMPLELOD(_sampler, _uv, _lod) DX_TEXTURE_NAME(_sampler).SampleLevel(DX_SAMPLER_NAME(_sampler), _uv, _lod)\n" + "#define SAMPLELOD_CUBE(_sampler, _uv, _lod) SAMPLELOD(_sampler, _uv, _lod)\n" + "#define SAMPLEGRAD(_sampler, _uv, _ddx, _ddy) DX_TEXTURE_NAME(_sampler).SampleGrad(DX_SAMPLER_NAME(_sampler), _uv, _ddx, _ddy)\n" + "\n" + "#define RAW_BUFFER_INDEX(_index) ((_index) * 4)\n" // u32 aligned + "\n" + "#define LOADU(_name, _index) _name.Load(_index)\n" + "#define LOADU2(_name, _index) _name.Load2(_index)\n" + "#define LOADU3(_name, _index) _name.Load3(_index)\n" + "#define LOADU4(_name, _index) _name.Load4(_index)\n" + "\n" + "#define LOADI(_name, _index) asint(_name.Load(_index))\n" + "#define LOADI2(_name, _index) asint(_name.Load2(_index))\n" + "#define LOADI3(_name, _index) asint(_name.Load3(_index))\n" + "#define LOADI4(_name, _index) asint(_name.Load4(_index))\n" + "\n" + "#define LOADF(_name, _index) asfloat(_name.Load(_index))\n" + "#define LOADF2(_name, _index) asfloat(_name.Load2(_index))\n" + "#define LOADF3(_name, _index) asfloat(_name.Load3(_index))\n" + "#define LOADF4(_name, _index) asfloat(_name.Load4(_index))\n" + "\n" + "#define STOREU(_name, _index, _value) _name.Store(_index, _value)\n" + "#define STOREU2(_name, _index, _value) _name.Store2(_index, _value)\n" + "#define STOREU3(_name, _index, _value) _name.Store3(_index, _value)\n" + "#define STOREU4(_name, _index, _value) _name.Store4(_index, _value)\n" + "\n" + "#define STOREF(_name, _index, _value) _name.Store(_index, asuint(_value))\n" + "#define STOREF2(_name, _index, _value) _name.Store2(_index, asuint(_value))\n" + "#define STOREF3(_name, _index, _value) _name.Store3(_index, asuint(_value))\n" + "#define STOREF4(_name, _index, _value) _name.Store4(_index, asuint(_value))\n" + "\n" + "#define F32TOF16(_x) f32tof16(_x)\n" + "\n" + "#define ATOMICADD(_name, _index, _value, _original) _name.InterlockedAdd(_index, asuint(_value), _original)\n" + "\n" + "#define GROUPMEMORYBARRIERWITHGROUPSYNC() GroupMemoryBarrierWithGroupSync()\n" + "\n" + "#define IMAGE_LOAD(_name, _uv) _name[_uv]\n" + "#define IMAGE_STORE(_name, _uv, _value) _name[_uv] = _value\n" + "\n" + "#define ARRAY_BEGIN(_type) {\n" + "#define ARRAY_END() }\n" + "\n" + "#define SAMPLER2D_DCL_ARG(_sampler) Texture2D DX_TEXTURE_NAME(_sampler), SamplerState DX_SAMPLER_NAME(_sampler)\n" + "#define SAMPLER2DMS_DCL_ARG(_sampler) Texture2DMS DX_TEXTURE_NAME(_sampler)\n" + "\n" + "#define SAMPLER_ARG(_sampler) DX_TEXTURE_NAME(_sampler), DX_SAMPLER_NAME(_sampler)\n" + "#define SAMPLERMS_ARG(_sampler) DX_TEXTURE_NAME(_sampler)\n" + "\n" + "#define SATURATE(_value) saturate(_value)\n" + "#define CAST(_type, _value) ((_type) (_value))\n" + "\n" + "#define mod(_x, _y) fmod(_x, _y)\n" + "#define fract(_x) frac(_x)\n" + "#define mix(_x, _y, _s) lerp(_x, _y, _s)\n" + "#define atan(_x, _y) atan2(_x, _y)\n" + "\n" + "#define IN(_type) in _type\n" + "#define OUT(_type) out _type\n" + "#define INOUT(_type) inout _type\n" + "\n" + "#define GS_PARAMS , _outputStream\n" + "#define VS_PARAMS\n" + "#define VS_ARGS\n" + "#define FS_PARAMS\n" + "#define FS_ARGS\n" + "#define CS_PARAMS\n" + "#define CS_ARGS\n" + "\n" + "#define GET_MATRIX_X_AXIS(_mat) float4((_mat)[0].x, (_mat)[1].x, (_mat)[2].x, (_mat)[3].x)\n" + "#define GET_MATRIX_Y_AXIS(_mat) float4((_mat)[0].y, (_mat)[1].y, (_mat)[2].y, (_mat)[3].y)\n" + "#define GET_MATRIX_Z_AXIS(_mat) float4((_mat)[0].z, (_mat)[1].z, (_mat)[2].z, (_mat)[3].z)\n" + "#define GET_MATRIX_W_AXIS(_mat) float4((_mat)[0].w, (_mat)[1].w, (_mat)[2].w, (_mat)[3].w)\n" + "\n" + "#define dFdx(_arg) ddx(_arg)\n" + "#define dFdy(_arg) ddy(_arg)\n" + "\n" + "#define GET_GROUPSHARED(_var) _var\n" + "\n" + "#define UNROLL [unroll]\n" + "\n"; + + if (description.m_Pipeline == RHI::VsGsPs) + { + switch (description.m_GeometryOutput.m_PrimitiveType) + { + case RHI::DrawModePoint: + defines += "#define GS_ARGS , inout PointStream _outputStream\n"; + break; + case RHI::DrawModeLine: + case RHI::DrawModeLineStrip: + defines += "#define GS_ARGS , inout LineStream _outputStream\n"; + break; + case RHI::DrawModeTriangle: + case RHI::DrawModeTriangleStrip: + defines += "#define GS_ARGS , inout TriangleStream _outputStream\n"; + break; + default: + PK_ASSERT_NOT_REACHED(); + } + } + + return defines; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenHeader(RHI::EShaderStage stage) const +{ + (void)stage; + return ""; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenVertexInputs(const TMemoryView &vertexInputs) +{ + CString vertexInputsStr; + + // struct VtxInput + vertexInputsStr += "\nstruct SVertexInput\n{\n"; + PK_FOREACH(attribute, vertexInputs) + { + vertexInputsStr += CString::Format( " %s %s : TEXCOORD%u;\n", + RHI::HlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data(), + attribute->m_ShaderLocationBinding); + } + vertexInputsStr += " uint VertexIndex : SV_VertexID;\n"; + vertexInputsStr += " uint InstanceId : SV_InstanceID;\n"; + vertexInputsStr += "};\n"; + return vertexInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) +{ + (void)toFragment; + CString vertexOutputsStr; + u32 idx = 0; + + // struct VtxOutput + vertexOutputsStr += "\nstruct SVertexOutput\n{\n"; + PK_FOREACH(interpolated, vertexOutputs) + { + vertexOutputsStr += CString::Format(" %s %s %s : TEXCOORD%u;\n", + RHI::HlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::HlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data(), + idx); + idx += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + vertexOutputsStr += " float4 VertexPosition : SV_POSITION;\n"; + vertexOutputsStr += "};\n"; + return vertexOutputsStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenGeometryInputs(const TMemoryView& geometryInputs, const RHI::EDrawMode drawMode) +{ + PK_ASSERT_MESSAGE(drawMode != RHI::DrawModeInvalid, "Geometry shader input primitive type is not set"); + + const u32 pointNumberInput = _GetPointNumberInPrimitive(drawMode); + u32 inputLocation = 0; + + CString geomInputsStr; + geomInputsStr += "\nstruct SPrimitives\n{\n"; + PK_FOREACH(attribute, geometryInputs) + { + geomInputsStr += CString::Format( " %s %s %s : TEXCOORD%u;\n", + RHI::HlslShaderTypes::GetInterpolationString(attribute->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data(), + inputLocation); + inputLocation += RHI::VarType::GetRowNumber(attribute->m_Type); + } + geomInputsStr += " float4 VertexPosition : SV_POSITION;\n"; + geomInputsStr += "};\n"; + + geomInputsStr += "\nstruct SGeometryInput\n{\n"; + geomInputsStr += CString::Format( " SPrimitives Primitives[%d];\n", pointNumberInput); + geomInputsStr += " int PrimitiveId;\n"; + geomInputsStr += "};\n"; + + return geomInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenGeometryOutputs(const RHI::SGeometryOutput& geometryOutputs) +{ + CString geometryOutputsStr; + u32 outputLocation = 0; + + PK_ASSERT_MESSAGE(geometryOutputs.m_MaxVertices != 0, "Geometry can emmit a maximum of 0 vertices... Set the value to something appropriate"); + + // struct + geometryOutputsStr += "\nstruct SGeometryOutput\n{\n"; + PK_FOREACH(interpolated, geometryOutputs.m_GeometryOutput) + { + geometryOutputsStr += CString::Format( " %s %s %s : TEXCOORD%u;\n", + RHI::HlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data(), + outputLocation); + outputLocation += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + geometryOutputsStr += " float4 VertexPosition : SV_POSITION;\n"; + geometryOutputsStr += "};\n"; + + return geometryOutputsStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenFragmentInputs(const TMemoryView &fragmentInputs) +{ + CString fragInputsStr; + u32 idx = 0; + + // struct VtxInput + fragInputsStr += "\nstruct SFragmentInput\n{\n"; + PK_FOREACH(interpolated, fragmentInputs) + { + fragInputsStr += CString::Format( " %s %s %s : TEXCOORD%u;\n", + RHI::HlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::HlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data(), + idx); + idx += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + fragInputsStr += " bool IsFrontFace : SV_IsFrontFace;\n"; + fragInputsStr += "};\n"; + return fragInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenFragmentOutputs(const TMemoryView &fragmentOutputs) +{ + CString fragOutputsStr; + u32 idx = 0; + bool hasDepthOutput = false; + + // struct VtxInput + fragOutputsStr += "\nstruct SFragmentOutput\n{\n"; + PK_FOREACH(interpolated, fragmentOutputs) + { + bool isDepth; + RHI::EVarType outType; + + outType = RHI::VarType::PixelFormatToType(interpolated->m_Type, isDepth); + if (isDepth == false) + { + fragOutputsStr += CString::Format( " %s %s : SV_Target%u;\n", + RHI::HlslShaderTypes::GetTypeString(outType).Data(), + interpolated->m_Name.Data(), + idx++); + } + hasDepthOutput |= isDepth; + } + if (hasDepthOutput) + fragOutputsStr += " float DepthValue : SV_Depth;\n"; + fragOutputsStr += "};\n"; + return fragOutputsStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) +{ + CString constantsStr; + + PK_FOREACH(cSet, constSet) + { + if ((cSet->m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + PK_FOREACH(constant, cSet->m_Constants) + { + if (constant->m_Type == RHI::TypeConstantBuffer) + { + const RHI::SConstantBufferDesc & cbuffer = constant->m_ConstantBuffer; + //constantsStr = CString::Format("cbuffer %s : register(%s, b%u)\n{\n", + constantsStr += CString::Format("cbuffer %s : register(b%u)\n{\n", + cbuffer.m_Name.Data(), + cbuffer.m_PerBlockBinding.Get()); + PK_FOREACH(field, cbuffer.m_Constants) + { + constantsStr += CString::Format(" %s %s", RHI::HlslShaderTypes::GetTypeString(field->m_Type).Data(), field->m_Name.Data()); + if (field->m_ArraySize >= 1) + constantsStr += CString::Format("[%u]", field->m_ArraySize); + + const u32 cidx = field->m_OffsetInBuffer / 16; + const u32 sidx = (field->m_OffsetInBuffer % 16) / 4; + const char *swizzle[] = { "x", "y", "z", "w" }; + constantsStr += CString::Format(" : packoffset(c%d.%s);\n", cidx, swizzle[sidx]); + } + constantsStr += "};\n"; + } + else if (constant->m_Type == RHI::TypeRawBuffer) + { + const RHI::SRawBufferDesc &buffer = constant->m_RawBuffer; + + if (buffer.m_ReadOnly) + constantsStr += CString::Format("ByteAddressBuffer %s : register(t%u);\n", buffer.m_Name.Data(), buffer.m_PerBlockBinding.Get()); + else + constantsStr += CString::Format("RWByteAddressBuffer %s : register(u%u);\n", buffer.m_Name.Data(), buffer.m_PerBlockBinding.Get()); + } + else if (constant->m_Type == RHI::TypeTextureStorage) + { + // TODO: might need to rework and add format in STextureStorageDesc, avoid float4 conversion and could handle correctly uint/int texture + const RHI::STextureStorageDesc &texStorage = constant->m_TextureStorage; + + if (texStorage.m_ReadOnly) + constantsStr += CString::Format("Texture2D %s : register(t%u);\n", texStorage.m_Name.Data(), texStorage.m_PerBlockBinding.Get()); + else + constantsStr += CString::Format("RWTexture2D %s : register(u%u);\n", texStorage.m_Name.Data(), texStorage.m_PerBlockBinding.Get()); + } + else if (constant->m_Type == RHI::TypeConstantSampler) + { + const RHI::SConstantSamplerDesc &csampler = constant->m_ConstantSampler; + + constantsStr += CString::Format("%s Tex_%s", + csampler.m_Type == RHI::SamplerTypeMulti ? "Texture2DMS" : csampler.m_Type == RHI::SamplerTypeCube ? "TextureCube" : "Texture2D", + csampler.m_Name.Data()); + constantsStr += CString::Format(" : register(%s, t%u);\n", + RHI::HlslShaderTypes::GetShaderStageProfileString(stage).Data(), + csampler.m_PerBlockBinding.Get()); + + if (csampler.m_Type != RHI::SamplerTypeMulti) + { + constantsStr += CString::Format("SamplerState Sampler_%s", csampler.m_Name.Data()); + constantsStr += CString::Format(" : register(%s, s%u);\n", + RHI::HlslShaderTypes::GetShaderStageProfileString(stage).Data(), + csampler.m_PerStageSamplerBinding.Get()); + } + } + } + } + } + + return constantsStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) +{ + CString pushConstantsStr; + + PK_FOREACH(pushConstant, pushConstants) + { + if ((pushConstant->m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + //constantsStr = CString::Format("cbuffer %s : register(%s, b%u)\n{\n", + pushConstantsStr += CString::Format( "cbuffer %s : register(b%u)\n{\n", + pushConstant->m_Name.Data(), + //RHI::HlslShaderTypes::GetShaderStageProfileString(stage).Data(), + pushConstant->m_PerBlockBinding.Get()); + + PK_FOREACH(field, pushConstant->m_Constants) + { + pushConstantsStr += CString::Format(" %s %s", RHI::HlslShaderTypes::GetTypeString(field->m_Type).Data(), field->m_Name.Data()); + if (field->m_ArraySize >= 1) + pushConstantsStr += CString::Format("[%u];\n", field->m_ArraySize); + else + pushConstantsStr += ";\n"; + } + pushConstantsStr += "};\n"; + + } + } + return pushConstantsStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenGroupsharedVariables(const TMemoryView &groupsharedVariables) +{ + CString groupsharedStr; + + for (auto &variable : groupsharedVariables) + { + groupsharedStr += CString::Format( "groupshared %s %s[%u];\n", + RHI::HlslShaderTypes::GetTypeString(variable.m_Type).Data(), + variable.m_Name.Data(), + variable.m_ArraySize); + } + + return groupsharedStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenVertexMain(const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) +{ + (void)vertexInputs; (void)vertexOutputs; + CString mainStr; + + // Shader main + mainStr += "void main(in SVertexInput vInput, out SVertexOutput vOutput)\n" + "{\n"; + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(vInput, vOutput);\n"; + } + if (outputClipspacePosition) + { + mainStr += " vOutput.VertexPosition.y *= -1.0;\n"; // We invert the y in clip space + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenGeometryMain( const TMemoryView &geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) +{ + (void)geometryInputs; + const u32 pointNumberInput = _GetPointNumberInPrimitive(primitiveType); + + // Shader main + CString mainStr; + mainStr += CString::Format("[maxvertexcount(%d)]\n", geometryOutputs.m_MaxVertices); + mainStr += CString::Format( "void main(%s SPrimitives _input[%d], in uint PrimitiveId : SV_PrimitiveID, inout %s _output)\n{\n", + _GetHlslPrimitiveLayoutInputType(primitiveType), + pointNumberInput, + _GetHlslPrimitiveLayoutOutputType(geometryOutputs.m_PrimitiveType)); + mainStr += " SGeometryInput gInput;\n" + " SGeometryOutput gOutput;\n\n" + " gInput.Primitives = _input;\n\n" + " gInput.PrimitiveId = PrimitiveId;\n\n"; + // Initialize output struct to zero + PK_FOREACH(geomOutput, geometryOutputs.m_GeometryOutput) + { + mainStr += CString::Format(" gOutput.%s = %s(0", geomOutput->m_Name.Data(), RHI::GlslShaderTypes::GetTypeString(geomOutput->m_Type).Data()); + for (u32 i = 1; i < RHI::VarType::VarTypeToComponentSize(geomOutput->m_Type); ++i) + mainStr += ", 0"; + mainStr += ");\n"; + } + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(gInput, gOutput, _output);\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenFragmentMain( const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) +{ + (void)vertexOutputs; (void)fragmentOutputs; + CString mainStr; + + // Shader main + mainStr += "void main(in SFragmentInput fInput, out SFragmentOutput fOutput)\n" + "{\n"; + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(fInput, fOutput);\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenGeometryEmitVertex(const RHI::SGeometryOutput& geometryOutputs, bool outputClipspacePosition) +{ +// const u32 pointNumberOutput = _GetPointNumberInPrimitive(geometryOutputs.m_PrimitiveType); + + CString emitVertexStr; + emitVertexStr += CString::Format( "void AppendVertex(in SGeometryOutput outputData, inout %s _outputStream)\n{\n", + _GetHlslPrimitiveLayoutOutputType(geometryOutputs.m_PrimitiveType)); + + emitVertexStr += " SGeometryOutput output;\n"; + + PK_FOREACH(attribute, geometryOutputs.m_GeometryOutput) + { + emitVertexStr += CString::Format(" output.%s = outputData.%s;\n", attribute->m_Name.Data(), attribute->m_Name.Data()); + } + emitVertexStr += " output.VertexPosition = outputData.VertexPosition;\n"; + if (outputClipspacePosition) + { + emitVertexStr += " output.VertexPosition.y *= -1.0;\n"; + } + emitVertexStr += " _outputStream.Append(output);\n" + "}"; + return emitVertexStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenGeometryEndPrimitive(const RHI::SGeometryOutput& geometryOutputs) +{ + CString emitEndStr; + emitEndStr += CString::Format( "void FinishPrimitive(in SGeometryOutput outputData, inout %s _outputStream)\n{\n", + _GetHlslPrimitiveLayoutOutputType(geometryOutputs.m_PrimitiveType)); + emitEndStr += "\t_outputStream.RestartStrip();\n"; + emitEndStr += "}\n"; + return emitEndStr; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenComputeInputs() +{ + return "\nstruct SComputeInput\n" + "{\n" + " uint3 GlobalThreadID : SV_DispatchThreadID;\n" + " uint3 LocalThreadID : SV_GroupThreadID;\n" + " uint3 GroupID : SV_GroupID;\n" + "};\n"; +} + +//---------------------------------------------------------------------------- + +CString CHLSLShaderGenerator::GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) +{ + // Shader main + CString mainStr; + mainStr += CString::Format("[numthreads(%u, %u, %u)]\n", dispatchSize.x(), dispatchSize.y(), dispatchSize.z()); + mainStr += "void main(in SComputeInput cInput)\n" + "{\n"; + for(const CString &func : funcToCall) + { + if (!func.Empty()) + mainStr += " " + func + "(cInput);\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/HLSLShaderGenerator.h b/Samples/PK-SampleLib/ShaderGenerator/HLSLShaderGenerator.h new file mode 100644 index 00000000..0005648d --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/HLSLShaderGenerator.h @@ -0,0 +1,63 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include "ShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CHLSLShaderGenerator : public CAbstractShaderGenerator +{ +public: + CHLSLShaderGenerator() {} + virtual ~CHLSLShaderGenerator() {} + +public: + virtual CString GenDefines(const RHI::SShaderDescription &description) const override final; + virtual CString GenHeader(RHI::EShaderStage stage) const override; + virtual CString GenVertexInputs(const TMemoryView &vertexInputs) override; + virtual CString GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) override; + virtual CString GenGeometryInputs(const TMemoryView &geometryInputs, const RHI::EDrawMode drawMode) override final; + virtual CString GenGeometryOutputs(const RHI::SGeometryOutput &geometryOutputs) override final; + virtual CString GenFragmentInputs(const TMemoryView &fragmentInputs) override; + virtual CString GenFragmentOutputs(const TMemoryView &fragmentOutputs) override; + virtual CString GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) override; + virtual CString GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) override; + virtual CString GenGroupsharedVariables(const TMemoryView &groupsharedVariables) override; + virtual CString GenVertexMain( const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) override; + virtual CString GenGeometryMain(const TMemoryView &geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) override final; + virtual CString GenFragmentMain(const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) override; + virtual CString GenGeometryEmitVertex(const RHI::SGeometryOutput &geometryOutputs, bool outputClipspacePosition) override final; + virtual CString GenGeometryEndPrimitive(const RHI::SGeometryOutput &geometryOutputs) override final; + + virtual CString GenComputeInputs() override final; + virtual CString GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) override final; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/MetalShaderGenerator.cpp b/Samples/PK-SampleLib/ShaderGenerator/MetalShaderGenerator.cpp new file mode 100644 index 00000000..dc8fd1f4 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/MetalShaderGenerator.cpp @@ -0,0 +1,803 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "MetalShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include "pk_rhi/include/EnumHelper.h" +#include "PK-MCPP/pk_preprocessor.h" + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +bool CMetalShaderGenerator::GatherShaderInfo(const CString &shaderContent, const CString &shaderDir, IFileSystem *fs) +{ + // Find all the shader dependencies for parsing: + TArray dependencies; + + if (!PK_VERIFY(CPreprocessor::FindShaderDependencies(shaderContent, shaderDir, dependencies, fs))) + { + CLog::Log(PK_ERROR, "Could not find the shader dependencies"); + return false; + } + if (!_FindAllTextureFunctionParameters(shaderContent)) + return false; + PK_FOREACH(dep, dependencies) + { + const CString fileContent = fs->BufferizeToString(*dep, CFilePath::IsAbsolute(*dep)); + if (!fileContent.Empty()) + { + if (!_FindAllTextureFunctionParameters(fileContent)) + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenDefines(const RHI::SShaderDescription &description) const +{ + (void)description; + return "\n" + "#define METAL_API\n" + "\n" + "#define GLUE(_a, _b) _a ## _b\n" + "\n" + "#define VEC4_ZERO float4(0,0,0,0)\n" + "#define VEC4_ONE float4(1,1,1,1)\n" + "#define VEC3_ZERO float3(0,0,0)\n" + "#define VEC3_ONE float3(1,1,1)\n" + "#define VEC2_ZERO float2(0,0)\n" + "#define VEC2_ONE float2(1,1)\n" + "\n" + "#define VEC_GREATER_THAN(_vec1, _vec2) ((_vec1) > (_vec2))\n" + "#define VEC_GREAT_THAN_EQ(_vec1, _vec2) ((_vec1) >= (_vec2))\n" + "#define VEC_LESS_THAN(_vec1, _vec2) ((_vec1) < (_vec2))\n" + "#define VEC_LESS_THAN_EQ(_vec1, _vec2) ((_vec1) <= (_vec2))\n" + "#define VEC_EQ(_vec1, _vec2) ((_vec1) == (_vec2))\n" + "#define VEC_NOT_EQ(_vec1, _vec2) ((_vec1) != (_vec2))\n" + "#define ALL_BOOL(_bvec) all(_bvec)\n" + "#define ANY_BOOL(_bvec) any(_bvec)\n" + "\n" + "#define vec2 float2\n" + "#define vec3 float3\n" + "#define vec4 float4\n" + "\n" + "#define mat2 float2x2\n" + "#define mat3 float3x3\n" + "#define mat4 float4x4\n" + "\n" + "#define dvec2 double2\n" + "#define dvec3 double3\n" + "#define dvec4 double4\n" + "\n" + "#define ivec2 int2\n" + "#define ivec3 int3\n" + "#define ivec4 int4\n" + "\n" + "#define uvec2 uint2\n" + "#define uvec3 uint3\n" + "#define uvec4 uint4\n" + "\n" + "#define BUILD_MAT2(_axisX, _axisY) float2x2(_axisX, _axisY)\n" + "#define BUILD_MAT3(_axisX, _axisY, _axisZ) float3x3(_axisX, _axisY, _axisZ)\n" + "#define BUILD_MAT4(_axisX, _axisY, _axisZ, _axisW) float4x4(_axisX, _axisY, _axisZ, _axisW)\n" + "\n" + "#define MTL_DEREF_SYM(_name) GLUE(__DEREF_SYM_,_name)\n" // '->' OR '.' depending on if the constant is a push constant or a buffer + "#define MTL_SET_NAME(_name) GLUE(__CONSTANT_SET_,_name)\n" // Constant set name from constant var name + "#define MTL_TEXTURE_NAME(_name) MTL_SET_NAME(_name)GLUE(Tex_,_name)\n" + "#define MTL_SAMPLER_NAME(_name) MTL_SET_NAME(_name)GLUE(Sampler_,_name)\n" + "\n" + "#define GET_CONSTANT(_constant, _var) MTL_SET_NAME(_constant) _constant MTL_DEREF_SYM(_constant) _var\n" + "#define GET_RAW_BUFFER(_buffer) MTL_SET_NAME(_buffer) _buffer\n" + "\n" + "#define TEXTURE_DIMENSIONS(_sampler, _lod, _dimensions) { _dimensions = int2(MTL_TEXTURE_NAME(_sampler).get_width(), MTL_TEXTURE_NAME(_sampler).get_height()); }\n" + "#define SAMPLE(_sampler, _uv) MTL_TEXTURE_NAME(_sampler).sample(MTL_SAMPLER_NAME(_sampler), float2((_uv).x, 1.0f - (_uv).y))\n" + "#define SAMPLE_CUBE(_sampler, _uv) MTL_TEXTURE_NAME(_sampler).sample(MTL_SAMPLER_NAME(_sampler), _uv)\n" + "# define FETCH(_sampler, _uv) MTL_TEXTURE_NAME(_sampler).read(uint2((_uv).x, MTL_TEXTURE_NAME(_sampler).get_height() - (_uv).y), uint((_uv).z))\n" // uv is int3 (z = lod) + "# define SAMPLEMS(_sampler, _uv, _sampleID) MTL_TEXTURE_NAME(_sampler).read(_uv, _sampleID)\n" + "#define SAMPLELOD(_sampler, _uv, _lod) MTL_TEXTURE_NAME(_sampler).sample(MTL_SAMPLER_NAME(_sampler), float2((_uv).x, 1.0f - (_uv).y), level(_lod))\n" + "#define SAMPLELOD_CUBE(_sampler, _uv, _lod) MTL_TEXTURE_NAME(_sampler).sample(MTL_SAMPLER_NAME(_sampler), _uv, level(_lod))\n" + "#define SAMPLEGRAD(_sampler, _uv, _ddx, _ddy) MTL_TEXTURE_NAME(_sampler).sample(MTL_SAMPLER_NAME(_sampler), _uv, gradient2d(_ddx, _ddy), 0.0f)\n" + "\n" + "#define RAW_BUFFER_INDEX(_index) (_index)\n" + "\n" + "#define LOADU(_name, _index) _name[_index]\n" + "#define LOADU2(_name, _index) uvec2(_name[_index], _name[(_index) + 1])\n" + "#define LOADU3(_name, _index) uvec3(_name[_index], _name[(_index) + 1], _name[(_index) + 2])\n" + "#define LOADU4(_name, _index) uvec4(_name[_index], _name[(_index) + 1], _name[(_index) + 2], _name[(_index) + 3])\n" + "\n" + "#define LOADI(_name, _index) asint(_name[_index])\n" + "#define LOADI2(_name, _index) ivec2(asint(_name[_index]), asint(_name[(_index) + 1]))\n" + "#define LOADI3(_name, _index) ivec3(asint(_name[_index]), asint(_name[(_index) + 1]), asint(_name[(_index) + 2]))\n" + "#define LOADI4(_name, _index) ivec4(asint(_name[_index]), asint(_name[(_index) + 1]), asint(_name[(_index) + 2]), asint(_name[(_index) + 3]))\n" + "\n" + "#define LOADF(_name, _index) asfloat(_name[_index])\n" + "#define LOADF2(_name, _index) vec2(asfloat(_name[_index]), asfloat(_name[(_index) + 1]))\n" + "#define LOADF3(_name, _index) vec3(asfloat(_name[_index]), asfloat(_name[(_index) + 1]), asfloat(_name[(_index) + 2]))\n" + "#define LOADF4(_name, _index) vec4(asfloat(_name[_index]), asfloat(_name[(_index) + 1]), asfloat(_name[(_index) + 2]), asfloat(_name[(_index) + 3]))\n" + "\n" + "#define STOREU(_name, _index, _value) _name[_index] = _value;\n" + "#define STOREU2(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y;\n" + "#define STOREU3(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y; _name[(_index) + 2] = (_value).z;\n" + "#define STOREU4(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y; _name[(_index) + 2] = (_value).z; _name[(_index) + 3] = (_value).w;\n" + "\n" + "#define STOREF(_name, _index, _value) _name[_index] = asuint(_value);\n" + "#define STOREF2(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y);\n" + "#define STOREF3(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y); _name[(_index) + 2] = asuint((_value).z);\n" + "#define STOREF4(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y); _name[(_index) + 2] = asuint((_value).z); _name[(_index) + 3] = asuint((_value).w);\n" + "\n" + "#define F32TOF16(_x) ((uint)as_type((half)(_x)))\n" + "\n" + "#define ATOMICADD(_name, _index, _value, _original) _original = atomic_fetch_add_explicit((device _atomic*)&_name[_index], _value, memory_order_relaxed)\n" + "\n" + "#define GROUPMEMORYBARRIERWITHGROUPSYNC() threadgroup_barrier(mem_flags::mem_threadgroup)\n" + "\n" + "#define IMAGE_LOAD(_name, _uv) MTL_TEXTURE_NAME(_name).read(CAST(uint2, _uv))\n" + "#define IMAGE_STORE(_name, _uv, _value) MTL_TEXTURE_NAME(_name).write(_value, CAST(uint2, _uv))\n" + "\n" + "#define asint(x) as_type(x)\n" + "#define asuint(x) as_type(x)\n" + "#define asfloat(x) as_type(x)\n" + "\n" + "#define mul(_a, _b) ((_a) * (_b))\n" + "#define mod(_a, _b) fmod(_a, _b)\n" + "\n" + "#define atan(_a, _b) atan2(_a, _b)" + "\n" + "#define ARRAY_BEGIN(_type) {\n" + "#define ARRAY_END() }\n" + "\n" + "#define SAMPLER2D_DCL_ARG(_sampler) texture2d MTL_TEXTURE_NAME(_sampler), sampler MTL_SAMPLER_NAME(_sampler)\n" + "#define SAMPLER2DMS_DCL_ARG(_sampler) texture2d_ms MTL_TEXTURE_NAME(_sampler)\n" + "\n" + "#define SAMPLER_ARG(_sampler) MTL_TEXTURE_NAME(_sampler), MTL_SAMPLER_NAME(_sampler)\n" + "#define SAMPLERMS_ARG(_sampler) MTL_TEXTURE_NAME(_sampler)\n" + "\n" + "#define SATURATE(_value) saturate(_value)\n" + "#define CAST(_type, _value) static_cast<_type>(_value)\n" + "\n" + "#define CROSS(_a, _b) cross(_a, _b)\n" + "\n" + "#define IN(_type) _type \n" + "#define OUT(_type) thread _type &\n" + "#define INOUT(_type) thread _type &\n" + "\n" + "#define discard discard_fragment()\n" + "\n" + "#define rsqrt(x) (1.0 / sqrt(x))\n" + "#define GET_MATRIX_X_AXIS(_mat) (_mat)[0]\n" + "#define GET_MATRIX_Y_AXIS(_mat) (_mat)[1]\n" + "#define GET_MATRIX_Z_AXIS(_mat) (_mat)[2]\n" + "#define GET_MATRIX_W_AXIS(_mat) (_mat)[3]\n" + "\n" + "#define METAL_INCLUDE #include \n" + "\n" + "#define GET_GROUPSHARED(_var) Groupshared._var\n" + "\n" + "#define dFdx(_arg) dfdx(_arg)\n" + "#define dFdy(_arg) dfdy(_arg)\n" + "\n" + "#define UNROLL\n" + "\n"; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenHeader(RHI::EShaderStage stage) const +{ + (void)stage; + return "METAL_INCLUDE\nusing namespace metal;\n"; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenVertexInputs(const TMemoryView &vertexInputs) +{ + CString vertexInputsStr; + + // real input struct + vertexInputsStr += "\nstruct\t__SVertexInput\n{\n"; + PK_FOREACH(attribute, vertexInputs) + { + if (RHI::VarType::GetRowNumber(attribute->m_Type) == 1) + { + vertexInputsStr += CString::Format("\t%s %s [[attribute(%u)]];\n", + RHI::HlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data(), + attribute->m_ShaderLocationBinding); + } + else + { + for (u32 i = 0; i < RHI::VarType::GetRowNumber(attribute->m_Type); ++i) + { + RHI::EVarType rowType = RHI::VarType::GetRowType(attribute->m_Type); + + vertexInputsStr += CString::Format("\t%s %s_%u [[attribute(%u)]];\n", + RHI::HlslShaderTypes::GetTypeString(rowType).Data(), + attribute->m_Name.Data(), + i, + attribute->m_ShaderLocationBinding + i); + } + } + } + vertexInputsStr += "};\n"; + // struct + vertexInputsStr += "\nstruct\tSVertexInput\n{\n"; + PK_FOREACH(attribute, vertexInputs) + { + vertexInputsStr += CString::Format("\t%s %s;\n", RHI::HlslShaderTypes::GetTypeString(attribute->m_Type).Data(), attribute->m_Name.Data()); + } + vertexInputsStr += "\tuint VertexIndex;\n"; + vertexInputsStr += "\tuint InstanceId;\n"; + vertexInputsStr += "};\n"; + return vertexInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) +{ + (void)toFragment; + CString vertexOutputsStr; + u32 outputLocation = 0; + + // real input struct + vertexOutputsStr += "\nstruct\tSVertexOutput\n{\n"; + PK_FOREACH(interpolated, vertexOutputs) + { + vertexOutputsStr += CString::Format("\t%s %s [[user(attribute%u)]];\n", + RHI::HlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data(), + outputLocation); + ++outputLocation; + } + vertexOutputsStr += "\tfloat4 VertexPosition [[position]];\n"; + vertexOutputsStr += "};\n"; + return vertexOutputsStr; +} + +//----------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenGeometryInputs(const TMemoryView &geometryInputs, const RHI::EDrawMode drawMode) +{ + (void)geometryInputs; (void)drawMode; + PK_RELEASE_ASSERT_NOT_REACHED_MESSAGE("Metal does not handle geometry shaders"); + return ""; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenGeometryOutputs(const RHI::SGeometryOutput &geometryOutputs) +{ + (void)geometryOutputs; + PK_RELEASE_ASSERT_NOT_REACHED_MESSAGE("Metal does not handle geometry shaders"); + return ""; +} + +//----------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenFragmentInputs(const TMemoryView &fragmentInputs) +{ + CString fragInputsStr; + u32 outputLocation = 0; + + // struct + fragInputsStr += "\nstruct\tSFragmentInput\n{\n"; + PK_FOREACH(interpolated, fragmentInputs) + { + fragInputsStr += CString::Format("\t%s %s [[user(attribute%u)]];\n", + RHI::HlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data(), + outputLocation); + ++outputLocation; + } + fragInputsStr += "\tfloat4 VertexPosition [[position]];\n"; + fragInputsStr += "\tbool IsFrontFace[[front_facing]];\n"; + fragInputsStr += "};\n"; + return fragInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenFragmentOutputs(const TMemoryView &fragmentOutputs) +{ + CString fragmentOutputsStr; + u32 outputLocation = 0; + + fragmentOutputsStr += "\nstruct\tSFragmentOutput\n{\n"; + PK_FOREACH(outBuffer, fragmentOutputs) + { + bool isDepth = false; + RHI::EVarType outType = RHI::VarType::PixelFormatToType(outBuffer->m_Type, isDepth); + if (isDepth == false) + { + fragmentOutputsStr += CString::Format("\t%s %s [[color(%u)]];\n", + RHI::HlslShaderTypes::GetTypeString(outType).Data(), + outBuffer->m_Name.Data(), + outputLocation++); + } + else + { + fragmentOutputsStr += CString::Format("\t%s %s [[depth(any)]];\n", + RHI::HlslShaderTypes::GetTypeString(outType).Data(), + outBuffer->m_Name.Data()); + } + } + fragmentOutputsStr += "};\n"; + return fragmentOutputsStr; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) +{ + CString mainArgs; + CString stageArgs; + CString stageParams; + CString constantToSetNames; + + if (stage == RHI::VertexShaderStage) + { + mainArgs = "#define __VS_MAIN_ARGS\t"; + stageArgs = "#define __VS_ARGS\t"; + stageParams = "#define __VS_PARAMS\t"; + } + else if (stage == RHI::FragmentShaderStage) + { + mainArgs = "#define __FS_MAIN_ARGS\t"; + stageArgs = "#define __FS_ARGS\t"; + stageParams = "#define __FS_PARAMS\t"; + } + else if (stage == RHI::ComputeShaderStage) + { + mainArgs = "#define __CS_MAIN_ARGS\t"; + stageArgs = "#define __CS_ARGS\t"; + stageParams = "#define __CS_PARAMS\t"; + } + + CString constantsStr; + + PK_FOREACH(constantSet, constSet) + { + if (constantSet->m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) + { + u32 bindIdx = 0; + CString constSetGeneratedName = CString::Format("ConstantSet%u", constantSet->m_PerSetBinding.Get()); + const char *constSetName = constSetGeneratedName.Data(); + CString constSetContent; + CString constantStructures; + + PK_FOREACH(constant, constantSet->m_Constants) + { + if (constant->m_Type == RHI::TypeConstantBuffer) + { + const char *structName = constant->m_ConstantBuffer.m_Name.Data(); + + constantToSetNames += CString::Format("#define __CONSTANT_SET_%s\t%s.\n", structName, constSetName); + constantToSetNames += CString::Format("#define __DEREF_SYM_%s\t->\n", structName); + + constantStructures += CString::Format("struct\tS%s{\n", structName); + PK_FOREACH(var, constant->m_ConstantBuffer.m_Constants) + { + constantStructures += CString::Format("\t%s %s", RHI::HlslShaderTypes::GetTypeString(var->m_Type).Data(), var->m_Name.Data()); + if (var->m_ArraySize >= 1) + constantStructures += CString::Format("[%u];\n", var->m_ArraySize); + else + constantStructures += ";\n"; + } + constantStructures += CString::Format("};\n\n"); + + constSetContent += CString::Format("\tconstant S%s *%s [[id(%u)]];\n", structName, structName, bindIdx++); + + } + else if (constant->m_Type == RHI::TypeRawBuffer) + { + const char *bufferName = constant->m_RawBuffer.m_Name.Data(); + + constantToSetNames += CString::Format("#define __CONSTANT_SET_%s\t%s.\n", bufferName, constSetName); + const char *addrSpace = constant->m_RawBuffer.m_ReadOnly ? "constant" : "device"; + constSetContent += CString::Format("\t%s uint *%s [[id(%u)]];\n", addrSpace, bufferName, bindIdx++); + } + else if (constant->m_Type == RHI::TypeTextureStorage) + { + const char *texName = constant->m_TextureStorage.m_Name.Data(); + + constantToSetNames += CString::Format("#define __CONSTANT_SET_%s\t%s.\n", texName, constSetName); + const char *access = constant->m_TextureStorage.m_ReadOnly ? "access::read" : "access::read_write"; + constSetContent += CString::Format("\ttexture2d Tex_%s [[id(%u)]];\n", access, texName, bindIdx++); + } + else if (constant->m_Type == RHI::TypeConstantSampler) + { + const char *texName = constant->m_ConstantSampler.m_Name.Data(); + + constantToSetNames += CString::Format("#define __CONSTANT_SET_%s\t%s.\n", texName, constSetName); + + if (constant->m_ConstantSampler.m_Type == RHI::SamplerTypeCube) + { + constSetContent += CString::Format("\ttexturecube Tex_%s [[id(%u)]];\n", texName, bindIdx++); + constSetContent += CString::Format("\tsampler Sampler_%s [[id(%u)]];\n", texName, bindIdx++); + } + else if (constant->m_ConstantSampler.m_Type == RHI::SamplerTypeMulti) + { + constSetContent += CString::Format("\ttexture2d_ms Tex_%s [[id(%u)]];\n", texName, bindIdx++); + constSetContent += CString::Format("\tsampler Sampler_%s [[id(%u)]];\n", texName, bindIdx++); + } + else + { + constSetContent += CString::Format("\ttexture2d Tex_%s [[id(%u)]];\n", texName, bindIdx++); + constSetContent += CString::Format("\tsampler Sampler_%s [[id(%u)]];\n", texName, bindIdx++); + } + } + } + + constantsStr += constantStructures; + constantsStr += CString::Format("struct\tS%s\n{\n", constSetName); + constantsStr += constSetContent; + constantsStr += "};\n"; + + mainArgs += CString::Format(", constant S%s &%s [[buffer(%u)]]", constSetName, constSetName, static_cast(constantSet->m_PerSetBinding)); + stageArgs += CString::Format(", constant S%s &%s", constSetName, constSetName); + stageParams += CString::Format(", %s", constSetName); + } + } + + PK_FOREACH(identifier, m_TextureParameters) + { + constantToSetNames += CString::Format("#define __CONSTANT_SET_%s\n", identifier->Data()); + } + + constantsStr += "\n" + mainArgs; + constantsStr += "\n" + stageArgs; + constantsStr += "\n" + stageParams; + constantsStr += "\n" + constantToSetNames; + + return constantsStr; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) +{ + CString mainArgs; + CString stageArgs; + CString stageParams; + CString constantToSetNames; + + if (stage == RHI::VertexShaderStage) + { + mainArgs = "#define VS_MAIN_ARGS __VS_MAIN_ARGS\t"; + stageArgs = "#define VS_ARGS __VS_ARGS\t"; + stageParams = "#define VS_PARAMS __VS_PARAMS\t"; + } + else if (stage == RHI::FragmentShaderStage) + { + mainArgs = "#define FS_MAIN_ARGS __FS_MAIN_ARGS\t"; + stageArgs = "#define FS_ARGS __FS_ARGS\t"; + stageParams = "#define FS_PARAMS __FS_PARAMS\t"; + } + else if (stage == RHI::ComputeShaderStage) + { + mainArgs = "#define _CS_MAIN_ARGS __CS_MAIN_ARGS\t"; + stageArgs = "#define _CS_ARGS __CS_ARGS\t"; + stageParams = "#define _CS_PARAMS __CS_PARAMS\t"; + } + + CString pushConstantsStr; + + PK_FOREACH(pushConstant, pushConstants) + { + if ((pushConstant->m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + u32 constantIdx = 0; + const char *structName = pushConstant->m_Name.Data(); + + constantToSetNames += CString::Format("#define __CONSTANT_SET_%s\n", structName); + constantToSetNames += CString::Format("#define __DEREF_SYM_%s\t.\n", structName); + + pushConstantsStr += CString::Format("struct\tS%s\n{\n", structName); + PK_FOREACH(var, pushConstant->m_Constants) + { + pushConstantsStr += CString::Format("\t%s %s", RHI::HlslShaderTypes::GetTypeString(var->m_Type).Data(), var->m_Name.Data()); + if (var->m_ArraySize >= 1) + pushConstantsStr += CString::Format(" [[id(%u)]] [%u];\n", constantIdx++, var->m_ArraySize); + else + pushConstantsStr += CString::Format(" [[id(%u)]];\n", constantIdx++); + } + pushConstantsStr += CString::Format("};\n"); + + mainArgs += CString::Format(", constant S%s &%s [[buffer(%u)]]", structName, structName, static_cast(pushConstant->m_PerBlockBinding)); + stageArgs += CString::Format(", constant S%s &%s", structName, structName); + stageParams += CString::Format(", %s", structName); + } + } + + pushConstantsStr += "\n" + mainArgs; + pushConstantsStr += "\n" + stageArgs; + pushConstantsStr += "\n" + stageParams; + pushConstantsStr += "\n" + constantToSetNames; + + return pushConstantsStr; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenGroupsharedVariables(const TMemoryView &groupsharedVariables) +{ + CString groupsharedStr; + CString mainArgs = "#define CS_MAIN_ARGS _CS_MAIN_ARGS\t"; + CString stageArgs = "#define CS_ARGS _CS_ARGS\t"; + CString stageParams = "#define CS_PARAMS _CS_PARAMS\t"; + + if (!groupsharedVariables.Empty()) + { + groupsharedStr += CString::Format("struct\tSGroupshared\n{\n"); + for (auto &variable : groupsharedVariables) + { + groupsharedStr += CString::Format( "\t%s %s[%u];\n", + RHI::HlslShaderTypes::GetTypeString(variable.m_Type).Data(), + variable.m_Name.Data(), + variable.m_ArraySize); + } + groupsharedStr += CString::Format("};\n"); + + mainArgs += ", threadgroup SGroupshared &Groupshared [[threadgroup(0)]]"; + stageArgs += ", threadgroup SGroupshared &Groupshared"; + stageParams += ", Groupshared"; + } + + groupsharedStr += "\n" + mainArgs; + groupsharedStr += "\n" + stageArgs; + groupsharedStr += "\n" + stageParams; + + return groupsharedStr; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenVertexMain( const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) +{ + (void)vertexOutputs; (void)outputClipspacePosition; + CString mainStr; + + // Shader main + mainStr += "vertex SVertexOutput\tvert_main(__SVertexInput _vInput [[stage_in]], uint vertexID [[vertex_id]], uint instanceID [[instance_id]] VS_MAIN_ARGS)\n{\n"; + mainStr += "\tSVertexInput vInput;\n"; + mainStr += "\tSVertexOutput vOutput;\n\n"; + + PK_FOREACH(attribute, vertexInputs) + { + if (RHI::VarType::GetRowNumber(attribute->m_Type) == 1) + { + mainStr += CString::Format("\tvInput.%s = _vInput.%s;\n", attribute->m_Name.Data(), attribute->m_Name.Data()); + } + else + { + for (u32 i = 0; i < RHI::VarType::GetRowNumber(attribute->m_Type); ++i) + { + mainStr += CString::Format("\tvInput.%s[%u] = _vInput.%s_%u;\n", attribute->m_Name.Data(), i, attribute->m_Name.Data(), i); + } + } + } + mainStr += "\tvInput.VertexIndex = vertexID;\n"; + mainStr += "\tvInput.InstanceId = instanceID;\n\n"; + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += "\n " + *func + "(vInput, vOutput VS_PARAMS);\n"; + } + mainStr += "\treturn vOutput;\n"; + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenGeometryMain(const TMemoryView &geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) +{ + (void)geometryInputs; (void)geometryOutputs; (void)funcToCall; (void)primitiveType; + PK_RELEASE_ASSERT_NOT_REACHED_MESSAGE("Metal does not handle geometry shaders"); + return ""; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenFragmentMain(const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) +{ + (void)vertexOutputs; (void)fragmentOutputs; (void)funcToCall; + CString mainStr; + + // Shader main + mainStr += "fragment SFragmentOutput\tfrag_main(SFragmentInput fInput [[stage_in]] FS_MAIN_ARGS)\n{\n"; + mainStr += "\tSFragmentOutput fOutput;\n\n"; + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(fInput, fOutput FS_PARAMS);\n"; + } + mainStr += "\treturn fOutput;\n"; + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenGeometryEmitVertex(const RHI::SGeometryOutput &geometryOutputs, bool outputClipspacePosition) +{ + (void)geometryOutputs; (void)outputClipspacePosition; + PK_RELEASE_ASSERT_NOT_REACHED_MESSAGE("Metal does not handle geometry shaders"); + return ""; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenGeometryEndPrimitive(const RHI::SGeometryOutput &geometryOutputs) +{ + (void)geometryOutputs; + PK_RELEASE_ASSERT_NOT_REACHED_MESSAGE("Metal does not handle geometry shaders"); + return ""; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenComputeInputs() +{ + return "\nstruct SComputeInput\n" + "{\n" + " uint3 GlobalThreadID;\n" + " uint3 LocalThreadID;\n" + " uint3 GroupID;\n" + "};\n"; +} + +//---------------------------------------------------------------------------- + +CString CMetalShaderGenerator::GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) +{ + (void)dispatchSize; + CString mainStr; + + // Shader main + mainStr += "kernel void\tcomp_main(uint3 globalThreadID [[thread_position_in_grid]], uint3 localThreadID [[thread_position_in_threadgroup]], uint3 groupID [[threadgroup_position_in_grid]] CS_MAIN_ARGS)\n" + "{\n" + " SComputeInput cInput;\n" + " cInput.GlobalThreadID = globalThreadID;\n" + " cInput.LocalThreadID = localThreadID;\n" + " cInput.GroupID = groupID;\n"; + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += "\n " + *func + "(cInput CS_PARAMS);\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +bool CMetalShaderGenerator::_FindAllTextureFunctionParameters(const CString &shaderCode) +{ + _FindMacroParametersInShader(shaderCode, "SAMPLER2D_DCL_ARG"); + _FindMacroParametersInShader(shaderCode, "SAMPLER2DMS_DCL_ARG"); + return true; +} + +//---------------------------------------------------------------------------- + +bool CMetalShaderGenerator::_FindMacroParametersInShader(const CString &shaderCode, const CStringView ¯o) +{ + const char *shaderCodePtr = shaderCode.Data(); + const u32 shaderCodeLength = shaderCode.Length(); + u32 shaderCharIdx = 0; + + while (shaderCharIdx < shaderCodeLength) + { + // Skip comment '//': + if (shaderCharIdx + 1 < shaderCodeLength && + shaderCodePtr[shaderCharIdx] == '/' && + shaderCodePtr[shaderCharIdx + 1] == '/') + { + shaderCharIdx += 2; + if (shaderCharIdx < shaderCodeLength) + { + // Jump to EOL: + KR_BUFFER_JUMP2EOL(shaderCodePtr, shaderCharIdx); + } + } + // Skip comment '/* */' + if (shaderCharIdx + 1 < shaderCodeLength && + shaderCodePtr[shaderCharIdx] == '/' && + shaderCodePtr[shaderCharIdx + 1] == '*') + { + shaderCharIdx += 2; + while (shaderCharIdx + 1 < shaderCodeLength) + { + if (shaderCodePtr[shaderCharIdx] == '*' && + shaderCodePtr[shaderCharIdx + 1] == '/') + { + shaderCharIdx += 2; + break; + } + else if (shaderCodePtr[shaderCharIdx] == '\\') + shaderCharIdx += 2; + else + shaderCharIdx += 1; + } + } + // Search for macro: + u32 cmpLength = 0; + while (cmpLength < macro.Length() && shaderCharIdx + cmpLength < shaderCodeLength) + { + if (shaderCodePtr[shaderCharIdx + cmpLength] != macro[cmpLength]) + break; + ++cmpLength; + } + if (cmpLength == macro.Length()) // We found the macro + { + shaderCharIdx += cmpLength; + // Skip the spaces IFN: + while (KR_BUFFER_IS_SPACE(shaderCodePtr[shaderCharIdx])) + ++shaderCharIdx; + // Check the open parenthesis: + if (shaderCodePtr[shaderCharIdx] == '(') + { + ++shaderCharIdx; + // Skip the spaces IFN: + while (KR_BUFFER_IS_SPACE(shaderCodePtr[shaderCharIdx])) + ++shaderCharIdx; + // Get the identifier name: + u32 identifierStart = shaderCharIdx; + if (KR_BUFFER_IS_IDST(shaderCodePtr[shaderCharIdx])) // Needs to start with an non-digit character + { + ++shaderCharIdx; + while (KR_BUFFER_IS_IDSTNUM(shaderCodePtr[shaderCharIdx])) + ++shaderCharIdx; + u32 identifierEnd = shaderCharIdx; + // Skip the spaces IFN: + while (KR_BUFFER_IS_SPACE(shaderCodePtr[shaderCharIdx])) + ++shaderCharIdx; + // Check the closing parenthesis: + if (shaderCodePtr[shaderCharIdx] == ')') + { + ++shaderCharIdx; + CString identifierFound = CString(shaderCodePtr + identifierStart, identifierEnd - identifierStart); + CLog::Log(PK_INFO, "Found identifier '%s'", identifierFound.Data()); + if (!m_TextureParameters.Contains(identifierFound)) + m_TextureParameters.PushBack(identifierFound); + } + } + } + } + else if (cmpLength == 0) + shaderCharIdx += 1; + else + shaderCharIdx += cmpLength; + } + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/MetalShaderGenerator.h b/Samples/PK-SampleLib/ShaderGenerator/MetalShaderGenerator.h new file mode 100644 index 00000000..b6bc8769 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/MetalShaderGenerator.h @@ -0,0 +1,72 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include "ShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CMetalShaderGenerator : public CAbstractShaderGenerator +{ +public: + CMetalShaderGenerator() {} + virtual ~CMetalShaderGenerator() {} + + virtual bool GatherShaderInfo(const CString &shaderContent, const CString &shaderDir, IFileSystem *fs) override; + +private: + virtual CString GenDefines(const RHI::SShaderDescription &description) const override final; + virtual CString GenHeader(RHI::EShaderStage stage) const override; + virtual CString GenVertexInputs(const TMemoryView &vertexInputs) override; + virtual CString GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) override; + virtual CString GenGeometryInputs(const TMemoryView &geometryInputs, const RHI::EDrawMode drawMode) override final; + virtual CString GenGeometryOutputs(const RHI::SGeometryOutput &geometryOutputs) override final; + virtual CString GenFragmentInputs(const TMemoryView &fragmentInputs) override; + virtual CString GenFragmentOutputs(const TMemoryView &fragmentOutputs) override; + virtual CString GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) override; + virtual CString GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) override; + virtual CString GenGroupsharedVariables(const TMemoryView &groupsharedVariables) override; + + virtual CString GenVertexMain( const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) override; + virtual CString GenGeometryMain(const TMemoryView &geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) override final; + virtual CString GenFragmentMain(const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) override; + virtual CString GenGeometryEmitVertex(const RHI::SGeometryOutput &geometryOutputs, bool outputClipspacePosition) override final; + virtual CString GenGeometryEndPrimitive(const RHI::SGeometryOutput &geometryOutputs) override final; + virtual CString GenComputeInputs() override final; + virtual CString GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) override final; + +private: + bool _FindAllTextureFunctionParameters(const CString &shaderCode); + bool _FindMacroParametersInShader(const CString &shaderCode, const CStringView ¯o); + + // Textures passed as parameter to functions: + TArray m_TextureParameters; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.cpp b/Samples/PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.cpp new file mode 100644 index 00000000..9a9ffa11 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.cpp @@ -0,0 +1,568 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ParticleShaderGenerator.h" + +#include "Assets/ShaderIncludes/generated/Billboard.vert.h" +#include "Assets/ShaderIncludes/generated/Billboard.geom.h" +#include "Assets/ShaderIncludes/generated/Triangle.vert.h" +#include "Assets/ShaderIncludes/generated/Ribbon.vert.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +SPerStageShaderName g_OptionsShaderNames[] = +{ + { Option_None, null, null, null }, + { Option_VertexPassThrough, "Fwd", null, null }, + { Option_GeomBillboarding, "Geom", "Geom", "Geom" }, + { Option_VertexBillboarding, "Vertex", null, "Vertex" }, + { Option_Axis_C1, "C1", "C1", "C1" }, + { Option_Axis_C2, "C2", "C2", "C2" }, + { Option_Capsule, "Caps", "Caps", null }, + { Option_BillboardSizeFloat2, "Size2", "Size2", null }, + { Option_TriangleVertexBillboarding, "Tri", null, "VB" }, + { Option_RibbonVertexBillboarding, "Ribbon", null, "VB" }, + { Option_GPUStorage, "GPU", "GPU", "GPU" }, + { Option_GPUMesh, "GPUMesh", null, "GPUMesh" }, + { Option_GPUSort, "GPUSort", null, "GPUSort" }, +}; + +// FIXME: +// We cannot share the same fragment between CPUBB/GeomBB and VertexBB because shader bindings are not taken into account +// for generating shaders. If sampleDepth is enabled, its binding will be offset by all vertex stage bindings (Positions, indices, ..), +// And the depth sampler binding will end up being different than the vertex passthrough option the shader is generated with +// Same issue when Option_VertexBillboarding_GPU is enabled, generated texture registers differ +// ! We can get rid of some of those fragment shader specializations once we have a single GPU buffer as for the GPU sim billboarded in the vertex shader ! + +//---------------------------------------------------------------------------- + +CStringView ShaderOptionsUtils::GetShaderName(EShaderOptions options, RHI::EShaderStage stage, const TMemoryView &outStorage) +{ + u32 writeId = 0; + + for (u32 i = 0; i < PK_ARRAY_COUNT(g_OptionsShaderNames); ++i) + { + if (options & g_OptionsShaderNames[i].m_ShaderOption) + { + if (stage == RHI::VertexShaderStage && g_OptionsShaderNames[i].m_Vertex != null) + { + const u32 len = static_cast(strlen(g_OptionsShaderNames[i].m_Vertex)); + if (!PK_VERIFY(writeId + 1 + len + 1 < outStorage.Count())) + return CStringView(); + if (writeId != 0) + outStorage[writeId++] = '_'; + memcpy(&outStorage[writeId], g_OptionsShaderNames[i].m_Vertex, len); + writeId += len; + } + else if (stage == RHI::GeometryShaderStage && g_OptionsShaderNames[i].m_Geom != null) + { + const u32 len = static_cast(strlen(g_OptionsShaderNames[i].m_Geom)); + if (!PK_VERIFY(writeId + 1 + len + 1 < outStorage.Count())) + return CStringView(); + if (writeId != 0) + outStorage[writeId++] = '_'; + memcpy(&outStorage[writeId], g_OptionsShaderNames[i].m_Geom, len); + writeId += len; + } + else if (stage == RHI::FragmentShaderStage && g_OptionsShaderNames[i].m_Fragment != null) + { + const u32 len = static_cast(strlen(g_OptionsShaderNames[i].m_Fragment)); + if (!PK_VERIFY(writeId + 1 + len + 1 < outStorage.Count())) + return CStringView(); + if (writeId != 0) + outStorage[writeId++] = '_'; + memcpy(&outStorage[writeId], g_OptionsShaderNames[i].m_Fragment, len); + writeId += len; + } + } + } + + if (writeId == 0) + { + const char kDefault[] = "User"; + const u32 len = PK_ARRAY_COUNT(kDefault)-1; + if (!PK_VERIFY(len + 1 < outStorage.Count())) + return CStringView(); + memcpy(&outStorage[0], kDefault, len); + writeId += len; + } + outStorage[writeId] = '\0'; + + return CStringView(outStorage.Data(), writeId); +} + +//---------------------------------------------------------------------------- + +namespace +{ + CString GenVertexBBBody(const RHI::SShaderDescription &description, EShaderOptions options) + { + CString shaderCode; + if (options & Option_VertexBillboarding) + shaderCode = CString(g_Billboard_vert_data, sizeof(g_Billboard_vert_data)); + else if (options & Option_TriangleVertexBillboarding) + shaderCode = CString(g_Triangle_vert_data, sizeof(g_Triangle_vert_data)); + else if (options & Option_RibbonVertexBillboarding) + shaderCode = CString(g_Ribbon_vert_data, sizeof(g_Ribbon_vert_data)); + else + PK_ASSERT_NOT_REACHED(); + shaderCode += "\nvoid " + ParticleShaderGenerator::GetVertexPassThroughFunctionName() + "(IN(SVertexInput) vInput, OUT(SVertexOutput) vOutput VS_ARGS)\n" + "{\n"; + + // Right now, indices are always generated + shaderCode += " const uint indicesOffset = GET_CONSTANT(GPUBillboardPushConstants, IndicesOffset);\n"; + + // We'll generate VertexBillboard callee without #if BB_GPU_SIM as we have that info here + const bool gpuStorage = (options & Option_GPUStorage) != 0; + if (gpuStorage) + { + shaderCode += " const uint storageId = GET_CONSTANT(GPUBillboardPushConstants, StreamOffsetsIndex);\n"; + shaderCode += " uint particleID = vInput.InstanceId;\n"; + if (options & Option_GPUSort) + { + shaderCode += "#if defined(VRESOURCE_Indirection)\n"; + shaderCode += " particleID = LOADU(GET_RAW_BUFFER(Indirection), RAW_BUFFER_INDEX(particleID));\n"; + shaderCode += "#endif\n"; + } + } + else + shaderCode += " const uint particleID = LOADU(GET_RAW_BUFFER(Indices), RAW_BUFFER_INDEX(indicesOffset) + RAW_BUFFER_INDEX(vInput.InstanceId));\n"; + + // Initialize vertex outputs to 0 + for (const RHI::SVertexOutput &vOutput : description.m_VertexOutput) + { + shaderCode += CString::Format(" vOutput.%s = %s(0", vOutput.m_Name.Data(), RHI::GlslShaderTypes::GetTypeString(vOutput.m_Type).Data()); + for (u32 i = 1; i < RHI::VarType::VarTypeToComponentSize(vOutput.m_Type); ++i) + shaderCode += ", 0"; + shaderCode += ");\n"; + } + + // Do billboarding (write position / normal / uv vertex outputs). If ribbon, it also + // returns updated particle ID for the current vertex (a ribbon quad being made of 2 particles) + if (options & Option_RibbonVertexBillboarding) + shaderCode += " particleID = VertexBillboard(vInput, vOutput, particleID VS_PARAMS);\n"; + else + shaderCode += " VertexBillboard(vInput, vOutput, particleID VS_PARAMS);\n"; + + shaderCode += "#if defined(VOUTPUT_fragViewProjPosition)\n" + "vOutput.fragViewProjPosition = vOutput.VertexPosition;\n" + "#endif\n"; + + // Setup others vertex outputs (color and others additionnal per particle parameters) + for (const RHI::SVertexOutput &vOutput : description.m_VertexOutput) + { + if (vOutput.m_InputRelated.Valid()) + { + const u32 dim = RHI::VarType::VarTypeToComponentSize(vOutput.m_Type); + const EBaseTypeID baseType = RHI::VarType::VarTypeToRuntimeBaseType(vOutput.m_Type); + + if (PK_VERIFY(dim >= 1 && dim <= 4)) + { + const CString bindingName = vOutput.m_Name.Replace("frag", ""); // TODO: not happy with that + + CString loadString; + if (CBaseTypeTraits::Traits(baseType).IsFp) + loadString = dim > 1 ? CString::Format("LOADF%d", dim) : "LOADF"; + else + loadString = dim > 1 ? CString::Format("LOADU%d", dim) : "LOADU"; + + if (gpuStorage) + if (vOutput.m_Type == RHI::TypeInt) // Gorefix for #13391. If more implicit cast errors happen, refactor to force explicit cast. + shaderCode += CString::Format(" vOutput.%s = int(%s(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(%ssOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * %d)));\n", vOutput.m_Name.Data(), loadString.Data(), bindingName.Data(), dim); + else + shaderCode += CString::Format(" vOutput.%s = %s(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(%ssOffsets), RAW_BUFFER_INDEX(storageId)) + RAW_BUFFER_INDEX(particleID * %d));\n", vOutput.m_Name.Data(), loadString.Data(), bindingName.Data(), dim); + else + shaderCode += CString::Format(" vOutput.%s = %s(GET_RAW_BUFFER(%ss), RAW_BUFFER_INDEX(particleID * %d));\n", vOutput.m_Name.Data(), loadString.Data(), bindingName.Data(), dim); + } + else + PK_ASSERT_NOT_REACHED(); + } + } + + const CString sizeZero = (options & Option_BillboardSizeFloat2) ? CString("vec2(0.f, 0.f)") : CString("0.f"); + + shaderCode += "}\n"; + + return shaderCode; + } + +//---------------------------------------------------------------------------- + + CString _GenGPUMeshVertexPassthrough(const RHI::SShaderDescription &description, CGuid positionIdx) + { + CString shaderCode = "void " + ParticleShaderGenerator::GetVertexPassThroughFunctionName() + "(IN(SVertexInput) vInput, OUT(SVertexOutput) vOutput VS_ARGS)\n" + "{\n"; + + const auto &inputs = description.m_Bindings.m_InputAttributes; + shaderCode += " const uint storageID = GET_CONSTANT(GPUMeshPushConstants, DrawRequest);\n"; + shaderCode += " const uint indirectionOffsetsID = GET_CONSTANT(GPUMeshPushConstants, IndirectionOffsetsIndex);\n"; + shaderCode += " const uint indirectionOffset = LOADU(GET_RAW_BUFFER(IndirectionOffsets), RAW_BUFFER_INDEX(indirectionOffsetsID));\n"; + shaderCode += " const uint particleID = LOADU(GET_RAW_BUFFER(Indirection), indirectionOffset + RAW_BUFFER_INDEX(vInput.InstanceId));\n"; + shaderCode += " const mat4 modelMatrix = GetMeshMatrix(vInput VS_PARAMS);\n"; + + if (positionIdx.Valid()) + { + for (const RHI::SVertexAttributeDesc &field : inputs) + { + if (field.m_ShaderLocationBinding == positionIdx) + { + CString swizzle; + switch (inputs[positionIdx].m_Type) + { + case RHI::TypeFloat2: + swizzle = ".xy, 0.0"; + break; + case RHI::TypeFloat3: + case RHI::TypeFloat4: + swizzle = ".xyz"; + break; + default: + break; + } + if (swizzle.Empty()) + break; + shaderCode += "\n#if defined(CONST_SceneInfo_ViewProj)\n"; + shaderCode += CString::Format(" vec4 pos = mul(modelMatrix, vec4(vInput.%s%s, 1.0));\n", inputs[positionIdx].m_Name.Data(), swizzle.Data()); + shaderCode += CString::Format(" vOutput.VertexPosition = mul(GET_CONSTANT(SceneInfo, ViewProj), pos);\n"); + shaderCode += "#else\n"; + shaderCode += CString::Format(" vOutput.VertexPosition = vec4(vInput.%s%s, 1.0);\n", inputs[positionIdx].m_Name.Data(), swizzle.Data()); + shaderCode += "#endif\n"; + } + } + } + + for (const RHI::SVertexOutput &vOutput : description.m_VertexOutput) + { + CGuid idx = vOutput.m_InputRelated; + if (idx.Valid()) + { + bool hasVertexInput = false; + for (const RHI::SVertexAttributeDesc &field : inputs) + { + if (field.m_ShaderLocationBinding == idx) + { + shaderCode += CString::Format(" vOutput.%s = vInput.%s;\n", vOutput.m_Name.Data(), field.m_Name.Data()); + hasVertexInput = true; + } + } + if (!hasVertexInput) + { + const u32 dim = RHI::VarType::VarTypeToComponentSize(vOutput.m_Type); + const EBaseTypeID baseType = RHI::VarType::VarTypeToRuntimeBaseType(vOutput.m_Type); + + if (PK_VERIFY(dim >= 1 && dim <= 4)) + { + const CString bindingName = vOutput.m_Name.Replace("frag", ""); // TODO: not happy with that + + CString loadString; + if (CBaseTypeTraits::Traits(baseType).IsFp) + loadString = dim > 1 ? CString::Format("LOADF%d", dim) : "LOADF"; + else + loadString = dim > 1 ? CString::Format("LOADU%d", dim) : "LOADU"; + if (vOutput.m_Type == RHI::TypeInt) // Gorefix for #13391. If more implicit cast errors happen, refactor to force explicit cast. + { + shaderCode += CString::Format( + " vOutput.%s = int(%s(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(%ssOffsets), RAW_BUFFER_INDEX(storageID)) + RAW_BUFFER_INDEX(particleID * %d)));\n", + vOutput.m_Name.Data(), loadString.Data(), bindingName.Data(), dim); + } + else + { + shaderCode += CString::Format( + " vOutput.%s = %s(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(%ssOffsets), RAW_BUFFER_INDEX(storageID)) + RAW_BUFFER_INDEX(particleID * %d));\n", + vOutput.m_Name.Data(), loadString.Data(), bindingName.Data(), dim); + } + + } + else + PK_ASSERT_NOT_REACHED(); + } + } + else + { + shaderCode += CString::Format(" vOutput.%s = %s(0", vOutput.m_Name.Data(), RHI::GlslShaderTypes::GetTypeString(vOutput.m_Type).Data()); + for (u32 i = 1; i < RHI::VarType::VarTypeToComponentSize(vOutput.m_Type); ++i) + shaderCode += ", 0"; + shaderCode += ");\n"; + } + } + + shaderCode += "#if defined(VOUTPUT_fragWorldPosition)\n" + " vOutput.fragWorldPosition = mul(modelMatrix, vec4(vInput.Position, 1.0f)).xyz;\n" + "#endif\n" + "#if defined(VINPUT_Normal)\n" + " vOutput.fragNormal = mul(modelMatrix, vec4(vInput.Normal.xyz, 0)).xyz;\n" + "#endif\n" + "#if defined(VINPUT_Tangent)\n" + " vOutput.fragTangent = vec4(mul(modelMatrix, vec4(vInput.Tangent.xyz, 0)).xyz, vInput.Tangent.w);\n" + "#endif\n" + "#if defined(VOUTPUT_fragViewProjPosition)\n" + " vOutput.fragViewProjPosition = vOutput.VertexPosition;\n" + "#endif\n"; + + // Atlas feature, mesh particles + shaderCode += "#if defined(BB_Feature_Atlas) && defined(VINPUT_UV0)\n" + "# if !defined(VRESOURCE_Atlas_TextureIDsOffsets)\n" + "# error \"config error\"\n" + "# endif\n" + " const uint maxAtlasID = LOADU(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(0)) - 1U;\n" + " const float textureID = LOADF(GET_RAW_BUFFER(GPUSimData), LOADU(GET_RAW_BUFFER(Atlas_TextureIDsOffsets), RAW_BUFFER_INDEX(storageID)) + RAW_BUFFER_INDEX(particleID));\n" + " const uint atlasID0 = min(uint(textureID), maxAtlasID);\n" + " const uint atlasID1 = min(uint(textureID + 1), maxAtlasID);\n" + " const vec4 rect0 = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(atlasID0 * 4 + 1));\n" + " const vec4 rect1 = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(atlasID1 * 4 + 1));\n" + " vOutput.fragUV0 = vInput.UV0 * rect0.xy + rect0.zw;\n" + "# if !defined(MESH_USE_UV1)\n" // #12340 + " vOutput.fragUV1 = vInput.UV0 * rect1.xy + rect1.zw;\n" + "# endif // !defined(MESH_USE_UV1)\n" + "#endif\n"; + + shaderCode += ""; + + shaderCode += "}\n"; + + return shaderCode; + } +} + +//---------------------------------------------------------------------------- + +CString ParticleShaderGenerator::GenGetMeshTransformHelper() +{ + CString getMeshMatrixHelper = "mat4 GetMeshMatrix(IN(SVertexInput) vInput VS_ARGS)\n"; + getMeshMatrixHelper += "{\n"; + getMeshMatrixHelper += "#if defined(VRESOURCE_MeshTransforms)\n"; + getMeshMatrixHelper += " const uint storageID = GET_CONSTANT(GPUMeshPushConstants, DrawRequest);\n"; + getMeshMatrixHelper += " const uint indirectionOffsetsID = GET_CONSTANT(GPUMeshPushConstants, IndirectionOffsetsIndex);\n"; + getMeshMatrixHelper += " const uint indirectionOffset = LOADU(GET_RAW_BUFFER(IndirectionOffsets), RAW_BUFFER_INDEX(indirectionOffsetsID));\n"; + getMeshMatrixHelper += " const uint transformsOffset = LOADU(GET_RAW_BUFFER(MeshTransformsOffsets), RAW_BUFFER_INDEX(storageID));\n"; + getMeshMatrixHelper += " const uint particleID = LOADU(GET_RAW_BUFFER(Indirection), indirectionOffset + RAW_BUFFER_INDEX(vInput.InstanceId));\n"; + getMeshMatrixHelper += " const vec4 m0 = LOADF4(GET_RAW_BUFFER(MeshTransforms), transformsOffset + RAW_BUFFER_INDEX(particleID * 16 + 0 * 4));\n"; + getMeshMatrixHelper += " const vec4 m1 = LOADF4(GET_RAW_BUFFER(MeshTransforms), transformsOffset + RAW_BUFFER_INDEX(particleID * 16 + 1 * 4));\n"; + getMeshMatrixHelper += " const vec4 m2 = LOADF4(GET_RAW_BUFFER(MeshTransforms), transformsOffset + RAW_BUFFER_INDEX(particleID * 16 + 2 * 4));\n"; + getMeshMatrixHelper += " const vec4 m3 = LOADF4(GET_RAW_BUFFER(MeshTransforms), transformsOffset + RAW_BUFFER_INDEX(particleID * 16 + 3 * 4));\n"; + getMeshMatrixHelper += " return BUILD_MAT4(m0, m1, m2, m3);\n"; + getMeshMatrixHelper += "#elif defined(VINPUT_MeshTransform)\n"; + getMeshMatrixHelper += " return vInput.MeshTransform;\n"; + getMeshMatrixHelper += "#else\n"; + getMeshMatrixHelper += " return BUILD_MAT4(vec4(1, 0, 0, 0), vec4(0, 1, 0, 0), vec4(0, 0, 1, 0), vec4(0, 0, 0, 1));\n"; + getMeshMatrixHelper += "#endif\n"; + getMeshMatrixHelper += "}\n\n"; + return getMeshMatrixHelper; +} + +//---------------------------------------------------------------------------- + +// Generate Passthrough for Particle shaders +CString ParticleShaderGenerator::GenVertexPassThrough(const RHI::SShaderDescription &description, CGuid positionIdx, EShaderOptions options) +{ + const bool vertexBB = options & Option_VertexBillboarding || + options & Option_TriangleVertexBillboarding || + options & Option_RibbonVertexBillboarding; + if (vertexBB) + return GenVertexBBBody(description, options); + + if (options & Option_GPUMesh) + return _GenGPUMeshVertexPassthrough(description, positionIdx); + + CString shaderCode = "void " + GetVertexPassThroughFunctionName() + "(IN(SVertexInput) vInput, OUT(SVertexOutput) vOutput VS_ARGS)\n" + "{\n"; + + const auto &inputs = description.m_Bindings.m_InputAttributes; + const bool geomBB = options & Option_GeomBillboarding; + if (positionIdx.Valid()) + { + for (const RHI::SVertexAttributeDesc &field : inputs) + { + if (field.m_ShaderLocationBinding == positionIdx) + { + CString swizzle; + switch (inputs[positionIdx].m_Type) + { + case RHI::TypeFloat2: + swizzle = ".xy, 0.0"; + break; + case RHI::TypeFloat3: + case RHI::TypeFloat4: + swizzle = ".xyz"; + break; + default: + break; + } + if (swizzle.Empty()) + break; + if (!geomBB) + { + shaderCode += "#if defined(CONST_SceneInfo_ViewProj)\n"; + shaderCode += " #if defined(VINPUT_MeshTransform)\n"; + shaderCode += CString::Format(" vec4 pos = mul(vInput.MeshTransform, vec4(vInput.%s%s, 1.0));\n", inputs[positionIdx].m_Name.Data(), swizzle.Data()); + shaderCode += CString::Format(" vOutput.VertexPosition = mul(GET_CONSTANT(SceneInfo, ViewProj), pos);\n"); + shaderCode += " #else\n"; + shaderCode += CString::Format(" vOutput.VertexPosition = mul(GET_CONSTANT(SceneInfo, ViewProj), vec4(vInput.%s%s, 1.0));\n", inputs[positionIdx].m_Name.Data(), swizzle.Data()); + shaderCode += " #endif\n"; + shaderCode += "#else\n"; + shaderCode += CString::Format(" vOutput.VertexPosition = vec4(vInput.%s%s, 1.0);\n", inputs[positionIdx].m_Name.Data(), swizzle.Data()); + shaderCode += "#endif\n"; + } + else + { + // For geometry shaders, DrawRequestID is in Position's W component + if (options & Option_GPUStorage) + shaderCode += CString::Format(" vOutput.VertexPosition = vec4(vInput.%s%s, 0.0);\n", inputs[positionIdx].m_Name.Data(), swizzle.Data()); + else if (geomBB) + { + PK_ASSERT(inputs.Count() > positionIdx + 1); + shaderCode += CString::Format(" vOutput.VertexPosition = vec4(vInput.%s%s, vInput.%s);\n", inputs[positionIdx].m_Name.Data(), swizzle.Data(), inputs[positionIdx + 1].m_Name.Data()); + } + } + } + } + } + + for (const RHI::SVertexOutput &vOutput : description.m_VertexOutput) + { + CGuid idx = vOutput.m_InputRelated; + if (idx.Valid()) + { + for (const RHI::SVertexAttributeDesc &field : inputs) + { + if (field.m_ShaderLocationBinding == idx) + shaderCode += CString::Format(" vOutput.%s = vInput.%s;\n", vOutput.m_Name.Data(), field.m_Name.Data()); + } + } + else + { + shaderCode += CString::Format(" vOutput.%s = %s(0", vOutput.m_Name.Data(), RHI::GlslShaderTypes::GetTypeString(vOutput.m_Type).Data()); + for (u32 i = 1; i < RHI::VarType::VarTypeToComponentSize(vOutput.m_Type); ++i) + shaderCode += ", 0"; + shaderCode += ");\n"; + } + } + + shaderCode += "#if defined(VINPUT_MeshTransform)\n" + " mat4 modelMatrix = vInput.MeshTransform;\n" + "#endif\n" + "#if defined(VOUTPUT_fragWorldPosition)\n" + "# if defined(VINPUT_MeshTransform)\n" + " vOutput.fragWorldPosition = mul(modelMatrix, vec4(vInput.Position, 1.0f)).xyz;\n" + "# else\n" + " vOutput.fragWorldPosition = vInput.Position;\n" + "# endif\n" + "#endif\n" + "#if defined(VINPUT_Normal) && defined(VINPUT_MeshTransform)\n" + " vOutput.fragNormal = mul(modelMatrix, vec4(vInput.Normal.xyz, 0)).xyz;\n" + "#endif\n" + "#if defined(VINPUT_Tangent) && defined(VINPUT_MeshTransform)\n" + " vOutput.fragTangent = vec4(mul(modelMatrix, vec4(vInput.Tangent.xyz, 0)).xyz, vInput.Tangent.w);\n" + "#endif\n" + "#if defined(VOUTPUT_fragViewProjPosition)\n" + " vOutput.fragViewProjPosition = vOutput.VertexPosition;\n" + "#endif\n"; + + // Atlas feature, mesh particles + shaderCode += "#if defined(BB_Feature_Atlas) && defined(VINPUT_UV0)\n" + "# if !defined(VINPUT_Atlas_TextureID)\n" + "# error \"config error\"\n" + "# endif\n" + " const uint maxAtlasID = LOADU(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(0)) - 1U;\n" + " const float textureID = vInput.Atlas_TextureID;\n" + " const uint atlasID0 = min(uint(textureID), maxAtlasID);\n" + " const uint atlasID1 = min(uint(textureID + 1), maxAtlasID);\n" + " const vec4 rect0 = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(atlasID0 * 4 + 1));\n" + " const vec4 rect1 = LOADF4(GET_RAW_BUFFER(Atlas), RAW_BUFFER_INDEX(atlasID1 * 4 + 1));\n" + " vOutput.fragUV0 = vInput.UV0 * rect0.xy + rect0.zw;\n" + "# if !defined(MESH_USE_UV1)\n" // #12340 + " vOutput.fragUV1 = vInput.UV0 * rect1.xy + rect1.zw;\n" + "# endif // !defined(MESH_USE_UV1)\n" + "#endif\n"; + + shaderCode += ""; + + const CString sizeZero = (options & Option_BillboardSizeFloat2) ? CString("vec2(0.f, 0.f)") : CString("0.f"); + + shaderCode += "#if defined(VINPUT_Enabled)\n" + " if (vInput.Enabled == 0u)\n"; + shaderCode += CString::Format(" vOutput.geomSize = %s;\n", sizeZero.Data()); + shaderCode += "#endif\n"; + + shaderCode += "}\n"; + + return shaderCode; +} + +//---------------------------------------------------------------------------- + +CString ParticleShaderGenerator::GetVertexPassThroughFunctionName() +{ + return "VertexGenerated"; +} + +//---------------------------------------------------------------------------- + +CString ParticleShaderGenerator::GenGeomBillboarding(const RHI::SShaderDescription &description) +{ + CString shaderCode = CString(g_Billboard_geom_data, sizeof(g_Billboard_geom_data)) + + "\nvoid " + GetGeomBillboardingFunctionName() + "(IN(SGeometryInput) gInput, SGeometryOutput gOutput GS_ARGS)\n" + "{\n"; + PK_FOREACH(vOuput, description.m_GeometryOutput.m_GeometryOutput) + { + CGuid idx = vOuput->m_InputRelated; + if (idx.Valid()) + { + if (idx < description.m_VertexOutput.Count()) + shaderCode += CString::Format(" gOutput.%s = gInput.Primitives[0].%s;\n", vOuput->m_Name.Data(), description.m_VertexOutput[idx].m_Name.Data()); + } + } + + shaderCode += " GeometryBillboard(gInput, gOutput GS_PARAMS);\n" + "}\n"; + + return shaderCode; +} + +//---------------------------------------------------------------------------- + +CString ParticleShaderGenerator::GetGeomBillboardingFunctionName() +{ + return "GeometryGenerated"; +} + +//---------------------------------------------------------------------------- + +CString ParticleShaderGenerator::GenAdditionalFunction(const RHI::SShaderDescription &description, EShaderOptions options, TArray &funcToCall, RHI::EShaderStage stage) +{ + CString genStr; + bool geomBB = options & Option_GeomBillboarding; + if (options & Option_VertexPassThrough && stage == RHI::VertexShaderStage) + { + genStr += GenVertexPassThrough(description, 0, options); // 0 is hard coded ... Bad + funcToCall.PushFront(GetVertexPassThroughFunctionName()); + } + if (geomBB && stage == RHI::GeometryShaderStage) + { + genStr += GenGeomBillboarding(description); + funcToCall.PushFront(GetGeomBillboardingFunctionName()); + } + return genStr; +} + +//---------------------------------------------------------------------------- + +RHI::EShaderStagePipeline ParticleShaderGenerator::GetShaderStagePipeline(EShaderOptions options) +{ + if (options & Option_GeomBillboarding) + return RHI::VsGsPs; + return RHI::VsPs; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.h b/Samples/PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.h new file mode 100644 index 00000000..49cab443 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.h @@ -0,0 +1,145 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +// TODO: This needs refactoring, we should only need: +// - Option_None +// - Option_VertexPassThrough +// - Option_Billboard_VertexBillboarding +// - Option_Billboard_GeomBillboarding +// - Option_Triangle_VertexBillboarding +// Everything else is deduced from the .pkma and activated features + +/*! +* @brief enum to select options needed in shader pass. +* Helper operators: enum | enum -> enum // enum & enum -> bool +*/ +enum EShaderOptions +{ + Option_None = 0, + Option_VertexPassThrough = 0x1 << 0, + Option_VertexBillboarding = 0x1 << 1, // Vertex billboarding (billboard) + Option_GeomBillboarding = 0x1 << 2, // Geometry billboarding (billboard) + Option_TriangleVertexBillboarding = 0x1 << 3, // Vertex billboarding (triangle) + Option_RibbonVertexBillboarding = 0x1 << 4, // Vertex billboarding (ribbon) + Option_GPUMesh = 0x1 << 5, // Compute shader "billboarding" (mesh) + Option_Axis_C1 = 0x1 << 6, // One billboarding constraint axis + Option_Axis_C2 = 0x1 << 7 | Option_Axis_C1, // Two billboarding constraint axis + Option_Capsule = 0x1 << 8, // Capsule billboard: 6 vertices instead of 4 + Option_BillboardSizeFloat2 = 0x1 << 9, // Size as a float2 instead of float + Option_GPUStorage = 0x1 << 10, // GPU storage (= GPU simulation) + Option_GPUSort = 0x1 << 11, // Uses a compute shader sort (ex: alpha blended GPU simulated particles) + + //Option_CorrectDeformation = 0x1 << 8, +}; + +//---------------------------------------------------------------------------- + +enum EComputeShaderType +{ + ComputeType_None, + ComputeType_ComputeParticleCountPerMesh, + ComputeType_ComputeParticleCountPerMesh_MeshAtlas, + ComputeType_ComputeParticleCountPerMesh_LOD, + ComputeType_ComputeParticleCountPerMesh_LOD_MeshAtlas, + ComputeType_InitIndirectionOffsetsBuffer, + ComputeType_InitIndirectionOffsetsBuffer_LODNoAtlas, + ComputeType_ComputeMeshIndirectionBuffer, + ComputeType_ComputeMeshIndirectionBuffer_MeshAtlas, + ComputeType_ComputeMeshIndirectionBuffer_LOD, + ComputeType_ComputeMeshIndirectionBuffer_LOD_MeshAtlas, + ComputeType_ComputeMeshMatrices, + ComputeType_ComputeSortKeys, + ComputeType_ComputeSortKeys_CameraDistance, + ComputeType_ComputeSortKeys_RibbonIndirection, + ComputeType_ComputeSortKeys_CameraDistance_RibbonIndirection, + ComputeType_SortUpSweep, + ComputeType_SortPrefixSum, + ComputeType_SortDownSweep, + ComputeType_SortUpSweep_KeyStride64, + ComputeType_SortPrefixSum_KeyStride64, + ComputeType_SortDownSweep_KeyStride64, + ComputeType_ComputeRibbonSortKeys, + ComputeType_Count, +}; + +//---------------------------------------------------------------------------- + +struct SPerStageShaderName +{ + EShaderOptions m_ShaderOption; + + const char *m_Vertex; + const char *m_Geom; + const char *m_Fragment; +}; + +//---------------------------------------------------------------------------- + +namespace ShaderOptionsUtils +{ + // returns a CStringView into 'outStorage'. If the capacity of 'outStorage' is too small, returns an empty view + CStringView GetShaderName(EShaderOptions options, RHI::EShaderStage stage, const TMemoryView &outStorage); +} + +//---------------------------------------------------------------------------- + +namespace ParticleShaderGenerator +{ + // Helpers + CString GenGetMeshTransformHelper(); + + // Vertex pass through + CString GenVertexPassThrough(const RHI::SShaderDescription &description, CGuid positionIdx, EShaderOptions options); + CString GetVertexPassThroughFunctionName(); + + // Geometry billboarding + CString GenGeomBillboarding(const RHI::SShaderDescription &description); + CString GetGeomBillboardingFunctionName(); + + // Concat all needed functions + CString GenAdditionalFunction( const RHI::SShaderDescription &description, + EShaderOptions options, + TArray &funcToCall, + RHI::EShaderStage stage); + RHI::EShaderStagePipeline GetShaderStagePipeline(EShaderOptions options); +}; + +//---------------------------------------------------------------------------- + +inline EShaderOptions operator|(EShaderOptions a, EShaderOptions b) +{ + return static_cast(static_cast(a) | static_cast(b)); +} + +//---------------------------------------------------------------------------- + +inline bool operator&(EShaderOptions a, EShaderOptions b) +{ + return (static_cast(a) & static_cast(b)) == b; +} + +//---------------------------------------------------------------------------- + +inline EShaderOptions operator^(EShaderOptions a, EShaderOptions b) +{ + return static_cast(static_cast(a) ^ static_cast(b)); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderGenerator/ShaderGenerator.cpp b/Samples/PK-SampleLib/ShaderGenerator/ShaderGenerator.cpp new file mode 100644 index 00000000..18177208 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/ShaderGenerator.cpp @@ -0,0 +1,532 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "ShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include "ShaderGenerator/HLSLShaderGenerator.h" +#include "ShaderGenerator/GLSLShaderGenerator.h" +#include "ShaderGenerator/VulkanShaderGenerator.h" +#include "ShaderGenerator/MetalShaderGenerator.h" +#include "ShaderDefinitions/ShaderDefinitions.h" +#include "ShaderGenerator/ParticleShaderGenerator.h" + +#include + +#if (PK_BUILD_WITH_PSSL_GENERATOR != 0) +# include "ShaderGenerator/PSSL/PSSLShaderGenerator.h" +#endif // (PK_BUILD_WITH_PSSL_GENERATOR != 0) + +#include +#include +#include + +#include + +#include "SampleUtils.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +CString CAbstractShaderGenerator::GenerateShader(const CString &fileContent, RHI::EShaderStage stage, const RHI::SShaderDescription &description, EShaderOptions options) +{ + PK_ASSERT_MESSAGE(description.m_Pipeline != RHI::InvalidShaderStagePipeline, "Shader pipeline is not set"); + + CString shaderCode = GenDefines(description); + shaderCode += GenHeader(stage); + + TMemoryView fragmentInput; + if (stage == RHI::FragmentShaderStage) + { + switch (description.m_Pipeline) + { + case RHI::VsPs: + fragmentInput = description.m_VertexOutput.View(); + break; + case RHI::EShaderStagePipeline::VsGsPs: + fragmentInput = description.m_GeometryOutput.m_GeometryOutput.View(); + break; + default: + PK_ASSERT_NOT_REACHED_MESSAGE("This function is either non implemented or you shouldn't be there"); + break; + } + } + + shaderCode += "\n"; + if (stage == RHI::VertexShaderStage) + { + shaderCode += GenVertexInputs(description.m_Bindings.m_InputAttributes); + shaderCode += "\n"; + shaderCode += GenVertexOutputs(description.m_VertexOutput, description.m_Pipeline == RHI::VsPs); + shaderCode += "\n"; + } + else if (stage == RHI::GeometryShaderStage) + { + if (description.m_Pipeline == RHI::EShaderStagePipeline::VsGsPs) + shaderCode += GenGeometryInputs(description.m_VertexOutput.View(), description.m_DrawMode); + else + PK_ASSERT_NOT_REACHED_MESSAGE("This function is either not implemented or you shouldn't be there"); + shaderCode += "\n"; + shaderCode += GenGeometryOutputs(description.m_GeometryOutput); + shaderCode += "\n"; + shaderCode += GenGeometryEmitVertex(description.m_GeometryOutput, true); // We emit clip space vertices + shaderCode += "\n"; + shaderCode += GenGeometryEndPrimitive(description.m_GeometryOutput); + shaderCode += "\n"; + } + else if (stage == RHI::FragmentShaderStage) + { + shaderCode += GenFragmentInputs(fragmentInput); + shaderCode += "\n"; + shaderCode += GenFragmentOutputs(description.m_FragmentOutput); + shaderCode += "\n"; + } + else if (stage == RHI::ComputeShaderStage) + { + shaderCode += CString::Format("#define THREADGROUP_SIZE_X %u \n", description.m_DispatchThreadSize.x()); + shaderCode += CString::Format("#define THREADGROUP_SIZE_Y %u \n", description.m_DispatchThreadSize.y()); + shaderCode += CString::Format("#define THREADGROUP_SIZE_Z %u \n", description.m_DispatchThreadSize.z()); + shaderCode += GenComputeInputs(); + shaderCode += "\n"; + } + shaderCode += GenConstantSets(description.m_Bindings.m_ConstantSets, stage); + shaderCode += "\n"; + shaderCode += GenPushConstants(description.m_Bindings.m_PushConstants, stage); + shaderCode += "\n"; + if (stage == RHI::ComputeShaderStage) + { + shaderCode += GenGroupsharedVariables(description.m_Bindings.m_GroupsharedVariables); + shaderCode += "\n"; + } + shaderCode += "\n"; + if (stage == RHI::VertexShaderStage) + { + shaderCode += ParticleShaderGenerator::GenGetMeshTransformHelper(); + shaderCode += "\n"; + } + shaderCode += fileContent; + shaderCode += "\n"; + + TArray funcToCall; + // Should be inserted before calling GenAdditionalFunction() + if (!fileContent.Empty()) + { + if (stage == RHI::VertexShaderStage) + funcToCall.PushBack("VertexMain"); + else if (stage == RHI::GeometryShaderStage) + funcToCall.PushBack("GeometryMain"); + else if (stage == RHI::FragmentShaderStage) + funcToCall.PushBack("FragmentMain"); + else if (stage == RHI::ComputeShaderStage) + funcToCall.PushBack("ComputeMain"); + } + + shaderCode += ParticleShaderGenerator::GenAdditionalFunction(description, options, funcToCall, stage); + shaderCode += "\n"; + + switch(stage) + { + case RHI::VertexShaderStage: + shaderCode += GenVertexMain(description.m_Bindings.m_InputAttributes, description.m_VertexOutput, funcToCall, description.m_Pipeline == RHI::VsPs); + shaderCode += "\n"; + break; + case RHI::GeometryShaderStage: + shaderCode += GenGeometryMain(description.m_VertexOutput, description.m_GeometryOutput, funcToCall, description.m_DrawMode); + shaderCode += "\n"; + break; + case RHI::FragmentShaderStage: + shaderCode += GenFragmentMain(fragmentInput, description.m_FragmentOutput, funcToCall); + shaderCode += "\n"; + break; + case RHI::ComputeShaderStage: + shaderCode += GenComputeMain(description.m_DispatchThreadSize, funcToCall); + shaderCode += "\n"; + break; + default: + PK_ASSERT_NOT_REACHED_MESSAGE("This function is either not implemented or you shouldn't be there"); + } + + return shaderCode; +} + +//---------------------------------------------------------------------------- + +namespace +{ + PKSample::CGLSLShaderGenerator glslGenerator; + PKSample::CGLSLESShaderGenerator glslesGenerator; + PKSample::CVulkanShaderGenerator vulkanGenerator; + PKSample::CHLSLShaderGenerator hlslGenerator; + PKSample::CMetalShaderGenerator metalGenerator; +#if (PK_BUILD_WITH_PSSL_GENERATOR != 0) + PKSample::CPSSLShaderGenerator psslGenerator; +#endif // (PK_BUILD_WITH_PSSL_GENERATOR != 0) + + PKSample::CAbstractShaderGenerator *shaderGenerators[RHI::__GApi_Count] = + { + null, // GApi_Null, + &glslGenerator, // GApi_OpenGL, + &glslesGenerator, // GApi_OES, + &vulkanGenerator, // GApi_Vulkan, +#if (PK_BUILD_WITH_PSSL_GENERATOR != 0) + &psslGenerator, // GApi_Orbis, +#else + null, // (PK_BUILD_WITH_PSSL_GENERATOR == 0) +#endif + &hlslGenerator, // GApi_D3D11, + &hlslGenerator, // GApi_D3D12, + &metalGenerator, // GApi_Metal +#if (PK_BUILD_WITH_PSSL_GENERATOR != 0) + &psslGenerator, // GApi_UNKNOWN2, +#else + null, // (PK_BUILD_WITH_PSSL_GENERATOR == 0) +#endif + }; +} + +//---------------------------------------------------------------------------- + +CShaderCompilation::CShaderCompilation( const CString &inputPath, + const CString &outputPath, + const CString &shaderPermutation, + RHI::EShaderStage shaderStage, + EShaderOptions shaderOptions, + RHI::SShaderDescription &shaderDesc, + const SShaderCompilationSettings &settings) +: m_InputPath(inputPath) +, m_OutputPath(outputPath) +, m_ShaderPermutation(shaderPermutation) +, m_ShaderStage(shaderStage) +, m_ParticleOptions(shaderOptions) +, m_ShaderDescription(shaderDesc) +, m_GenerateMetaShaderFile(false) +, m_CompilationSettings(settings) +{ + if (m_CompilationSettings.m_KeepTmpFile) + m_ShaderMetaFilePath = CFilePath::StripExtension(m_OutputPath) + META_SHADER_EXTENSION; +} + +//---------------------------------------------------------------------------- + +CShaderCompilation::~CShaderCompilation() +{ +} + +//---------------------------------------------------------------------------- + +void CShaderCompilation::Clear() +{ + m_InputPath.Clear(); + m_OutputPath.Clear(); + m_ShaderPermutation.Clear(); +} + +//---------------------------------------------------------------------------- + +bool CShaderCompilation::Exec(RHI::EGraphicalApi api, IFileSystem *controller) +{ + //in this function checking if the path is absolute, as it's legit to compile/load shaders outside of the PopcornFX project (ie. After-Effects plugin relies on this) + const CString lockFileName = m_OutputPath + ".lock"; + if (controller->Exists(lockFileName)) + return true; // Already compiling + + const CString dstFolder = CFilePath::StripFilename(m_OutputPath); + bool result = controller->CreateDirectoryChainIFN(dstFolder, CFilePath::IsAbsolute(dstFolder)); + if (!result) + { + CLog::Log(PK_ERROR, "Couldn't create directory chain '%s' when trying to compile shader '%s'", dstFolder.Data(), m_OutputPath.Data()); + return false; + } + bool lockFileIsAbsolute = CFilePath::IsAbsolute(lockFileName); + PFileStream lockFile = controller->OpenStream(lockFileName, IFileSystem::Access_ReadWriteCreate, lockFileIsAbsolute); + if (lockFile == null) + return true; // Already compiling + lockFile->Flush(); // Should not be needed + + controller->FileDelete(m_OutputPath, CFilePath::IsAbsolute(m_OutputPath)); // Delete destination file to force flush file + + // Additional lock file for meta objects: A same shader hash is shared with all graphics API (so we can't use 'lockFileName') + // If we don't lock like so, an effect compiled for several graphics API fails with errors because async CShaderCompilation are trying to write to the same .meta file. + // Ideally, this should be done earlier, per hash instead of per shader/API, but the shaders compilation submission isn't designed like so + PFileStream metaLockFile = null; + CString metaLockFileName; + bool metaLockFilePathIsAbsolute = CFilePath::IsAbsolute(metaLockFileName); + if (!m_ShaderMetaFilePath.Empty()) + { + metaLockFileName = m_ShaderMetaFilePath + ".lock"; + m_GenerateMetaShaderFile = !controller->Exists(metaLockFileName, metaLockFilePathIsAbsolute); + if (m_GenerateMetaShaderFile) + { + metaLockFile = controller->OpenStream(metaLockFileName, IFileSystem::Access_ReadWriteCreate, metaLockFilePathIsAbsolute); + if (metaLockFile == null) + m_GenerateMetaShaderFile = false; + else + metaLockFile->Flush(); // Should not be needed + } + } + + result &= Partial(api, GenerationStage, controller) && + Partial(api, CompilationStage, controller); + + if (m_GenerateMetaShaderFile) + { + PK_ASSERT(metaLockFile != null); + PK_ASSERT(!metaLockFileName.Empty()); + metaLockFile->Close(); + controller->FileDelete(metaLockFileName, metaLockFilePathIsAbsolute); + } + + lockFile->Close(); + controller->FileDelete(lockFileName, lockFileIsAbsolute); + + return result; +} + +//---------------------------------------------------------------------------- + +bool CShaderCompilation::Partial(RHI::EGraphicalApi api, EStage compilationStage, IFileSystem *controller) +{ + bool success = true; + + if (m_ShaderDescription.m_DrawMode == RHI::DrawModeInvalid && m_ShaderDescription.m_Pipeline == RHI::InvalidShaderStagePipeline) + return true; // empty shader - skip + + const CString preprocessedFilePath = CFilePath::StripExtension(m_OutputPath) + GetShaderExtensionStringFromApi(api, true); + const CString generatedFilePath = preprocessedFilePath + INTERMEDIATE_SHADER_EXTENSION; + + if (compilationStage == EStage::GenerationStage) + { + const CString dstFolder = CFilePath::StripFilename(m_OutputPath); + if (!controller->CreateDirectoryChainIFN(dstFolder, CFilePath::IsAbsolute(dstFolder))) + { + CLog::Log(PK_ERROR, "Couldn't create directory chain '%s' when trying to compile shader '%s'", dstFolder.Data(), m_OutputPath.Data()); + return false; + } + RHI::ShaderConstantBindingGenerator::ResetBindings(m_ShaderDescription.m_Bindings); + RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(api, m_ShaderDescription.m_Bindings); + success &= GenerateShaderFile(api, m_InputPath, preprocessedFilePath, controller); + } + else if (compilationStage == EStage::CompilationStage) + { + const SShaderCompilationTargetSettings *setting = null; + + for (const SShaderCompilationTargetSettings &target : m_CompilationSettings.m_Targets) + { + if (target.m_Target == api) + setting = ⌖ + } + if (setting == null) + return false; + + CString compileCmdLine = setting->m_CompilerCmdLine; + const bool pssl = setting->m_Target == RHI::GApi_Orbis || setting->m_Target == RHI::GApi_UNKNOWN2; + switch (m_ShaderStage) + { + case RHI::VertexShaderStage: + compileCmdLine = compileCmdLine.Replace("##ShortStage##", pssl ? "vs_vs" : "vs"); + compileCmdLine = compileCmdLine.Replace("##ShaderStage##", "vert"); + break; + case RHI::GeometryShaderStage: + compileCmdLine = compileCmdLine.Replace("##ShortStage##", "gs"); + compileCmdLine = compileCmdLine.Replace("##ShaderStage##", "geom"); + break; + case RHI::FragmentShaderStage: + compileCmdLine = compileCmdLine.Replace("##ShortStage##", "ps"); + compileCmdLine = compileCmdLine.Replace("##ShaderStage##", "frag"); + break; + default: break; + } + + if (!compileCmdLine.Empty()) + success &= CompileShaderFile(compileCmdLine, preprocessedFilePath, m_OutputPath, controller); + if (success) + CLog::Log(PK_INFO, "Shader %s successfully compiled", m_OutputPath.Data()); + else + CLog::Log(PK_INFO, "Shader failed compilation: \"%s\"", compileCmdLine.Data()); + + if (success && !m_CompilationSettings.m_KeepTmpFile) + { + controller->FileDelete(generatedFilePath); + if (!compileCmdLine.Empty()) + controller->FileDelete(preprocessedFilePath); + } + } + return success; +} + +//---------------------------------------------------------------------------- + +bool CShaderCompilation::GenerateShaderFile(RHI::EGraphicalApi apiName, const CString &inputPath, const CString &outputPath, IFileSystem *controller) const +{ + //in this function checking if the path is absolute, as it's legit to compile/load shaders outside of the PopcornFX project (ie. After-Effects plugin relies on this) + PKSample::CAbstractShaderGenerator *generator = shaderGenerators[apiName]; + if (generator == null) + return false; + + CString content; + if (!inputPath.Empty()) + { + content = controller->BufferizeToString(inputPath, CFilePath::IsAbsolute(inputPath)); + if (content.Empty()) + { + CLog::Log(PK_ERROR, "Couldn't open '%s' for reading when trying to compile shader '%s'", inputPath.Data(), outputPath.Data()); + return false; + } + } + + if (!generator->GatherShaderInfo(content, CFilePath::StripFilename(inputPath), controller)) + { + CLog::Log(PK_ERROR, "Shader generator could not gather info from shader '%s'", inputPath.Data()); + return false; + } + + const CString newContent = generator->GenerateShader(content, m_ShaderStage, m_ShaderDescription, m_ParticleOptions); + + // Preprocess shader: + CPreprocessor::SPreprocessOutput preprocOut; + TArray shaderDefines; + + PKSample::GenerateDefinesFromDefinition(shaderDefines, m_ShaderDescription, m_ShaderStage); + + const CString curDir = CFilePath::StripFilename(controller->VirtualToPhysical(inputPath, IFileSystem::Access_Read)); + const bool pathNotVirtual = CFilePath::IsAbsolute(outputPath); + const CString generatedFilePath = outputPath + INTERMEDIATE_SHADER_EXTENSION; // Only used when preprocessing fails + const CString errorFilePath = outputPath + SHADER_ERROR_EXTENSION; // Only used when preprocessing fails + const bool preprocSuccess = CPreprocessor::PreprocessString(shaderDefines, newContent, curDir, preprocOut); + + if (!preprocOut.m_Error.Empty()) + CLog::Log(PK_ERROR, "preprocess errors:\n%s", preprocOut.m_Error.Data()); + if (!preprocOut.m_Info.Empty()) + CLog::Log(PK_ERROR, "preprocess info:\n%s", preprocOut.m_Info.Data()); + + if (preprocSuccess) + { + PFileStream fileView = controller->OpenStream(outputPath, IFileSystem::Access_WriteCreate, pathNotVirtual); + if (fileView == null) + { + CLog::Log(PK_ERROR, "Couldn't create/open shader file '%s'", outputPath.Data()); + return false; + } + fileView->Write(preprocOut.m_Output.Data(), preprocOut.m_Output.Length()); + fileView->Close(); + if (controller->Exists(generatedFilePath)) + controller->FileDelete(generatedFilePath, pathNotVirtual); + if (controller->Exists(errorFilePath)) + controller->FileDelete(errorFilePath, pathNotVirtual); + } + else + { + CLog::Log(PK_ERROR, "Shader precompiling failed"); + PFileStream preprocessFailFileStream = controller->OpenStream( generatedFilePath, + IFileSystem::Access_WriteCreate, + pathNotVirtual); + PFileStream errorFileStream = controller->OpenStream( errorFilePath, + IFileSystem::Access_WriteCreate, + pathNotVirtual); + if (preprocessFailFileStream == null) + { + CLog::Log(PK_ERROR, "Couldn't create/open shader intermediate file '%s'", generatedFilePath.Data()); + return false; + } + if (errorFileStream == null) + { + CLog::Log(PK_ERROR, "Couldn't create/open shader error file '%s'", errorFilePath.Data()); + return false; + } + preprocessFailFileStream->Write(newContent.Data(), newContent.Length()); + preprocessFailFileStream->Close(); + errorFileStream->Write(preprocOut.m_Error.Data(), preprocOut.m_Error.Length()); + errorFileStream->Close(); + if (controller->Exists(outputPath)) + controller->FileDelete(outputPath, pathNotVirtual); + return false; + } + + // Write meta file content, only if m_KeepTmpFile is enabled + if (m_GenerateMetaShaderFile) + { + PK_ASSERT(!m_ShaderMetaFilePath.Empty()); + PFileStream metaFileStream = controller->OpenStream(m_ShaderMetaFilePath, IFileSystem::Access_WriteCreate); + if (metaFileStream == null) + { + CLog::Log(PK_ERROR, "Couldn't create/open shader meta file '%s'", m_ShaderMetaFilePath.Data()); + return false; + } + metaFileStream->Write(m_ShaderPermutation.Data(), m_ShaderPermutation.Length()); + metaFileStream->Close(); + } + return true; +} + +//---------------------------------------------------------------------------- + +bool CShaderCompilation::CompileShaderFile( const CString &cmdLine, + const CString &inputPath, + const CString &outputPath, + IFileSystem *controller) const +{ + // Check if the path is absolute, as it's legit to compile/load shaders outside of the PopcornFX project (ie. After-Effects plugin relies on this) + const CString inputPhysicalPath = CFilePath::IsAbsolute(inputPath) ? inputPath : controller->VirtualToPhysical(inputPath, IFileSystem::Access_Read); + const CString outputPhysicalPath = CFilePath::IsAbsolute(outputPath) ? outputPath : controller->VirtualToPhysical(outputPath, IFileSystem::Access_ReadWriteCreate); + const CString outputDirPhysicalPath = CFilePath::StripFilename(outputPhysicalPath); + if (inputPhysicalPath.Empty() || outputPhysicalPath.Empty()) + { + CLog::Log(PK_ERROR, "Could not resolve the physical path for the shader preprocessing"); + return false; + } + + CString program; + TArray processArgs; + + CProcess::ParseCommandLine(cmdLine, program, processArgs); + + // Inject path in commandline arguments + for (CString &argument : processArgs) + { + if (argument.Contains("##InputPath##")) + argument = argument.Replace("##InputPath##", inputPhysicalPath.Data()); + else if (argument.Contains("##OutputPath##")) + argument = argument.Replace("##OutputPath##", outputPhysicalPath.Data()); + else if (argument.Contains("##OutputDir##")) + argument = argument.Replace("##OutputDir##", outputDirPhysicalPath.Data()); +#if defined(PK_WINDOWS) + // Fix #11905: Rendering is broken when creating a project on a remote network drive with a path of the form '//123.45.67.89' + // fxc.exe does not support network paths with forward slashes :| + argument = argument.Replace("/", "\\"); +#endif + } + + // We end by compiling the shader + CProcess compileProcess; + if (compileProcess.Start(program, processArgs)) + compileProcess.WaitForExit(); + + const CProcess::EExitStatus exitStatus = compileProcess.GetExitStatus(); + if (!PK_VERIFY_MESSAGE(exitStatus == CProcess::StatusSuccess, "Failed compiling shader")) + { + PK_ASSERT_MESSAGE(exitStatus != CProcess::StatusStillActive, "Internal error: process.GetExitStatus()"); + PK_ASSERT_MESSAGE(exitStatus != CProcess::StatusNotStarted, "Process failed to start"); + PK_ASSERT_MESSAGE(exitStatus != CProcess::StatusFailed, "Process failed to finish"); + + const CString command = CProcess::CreateCommandLine(program, processArgs); + + CLog::Log(PK_ERROR, "Shader compile command failed: \"%s\"", command.Data()); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/ShaderGenerator.h b/Samples/PK-SampleLib/ShaderGenerator/ShaderGenerator.h new file mode 100644 index 00000000..d1b491d6 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/ShaderGenerator.h @@ -0,0 +1,142 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include +#include +#include + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +struct SShaderCompilationSettings; + +//---------------------------------------------------------------------------- + +class CAbstractShaderGenerator +{ +public: + CAbstractShaderGenerator() {} + virtual ~CAbstractShaderGenerator() {} + + virtual bool GatherShaderInfo(const CString &shaderContent, const CString &shaderDir, IFileSystem *fs) { (void)shaderContent; (void)shaderDir; (void)fs; return true; } + CString GenerateShader( const CString &fileContent, + RHI::EShaderStage stage, + const RHI::SShaderDescription &description, + EShaderOptions options); + +private: + virtual CString GenDefines(const RHI::SShaderDescription &description) const = 0; + virtual CString GenHeader(RHI::EShaderStage stage) const = 0; + virtual CString GenVertexInputs(const TMemoryView &vertexInputs) = 0; + virtual CString GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) = 0; + virtual CString GenGeometryInputs(const TMemoryView &geometryInputs, const RHI::EDrawMode drawMode) = 0; + virtual CString GenGeometryOutputs(const RHI::SGeometryOutput &geometryOutputs) = 0; + virtual CString GenFragmentInputs(const TMemoryView &fragmentInputs) = 0; + virtual CString GenFragmentOutputs(const TMemoryView &fragmentOutputs) = 0; + virtual CString GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) = 0; + virtual CString GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) = 0; + virtual CString GenGroupsharedVariables(const TMemoryView &groupsharedVariables) = 0; + virtual CString GenVertexMain( const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) = 0; + virtual CString GenGeometryMain(const TMemoryView &geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) = 0; + virtual CString GenFragmentMain(const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) = 0; + + virtual CString GenGeometryEmitVertex(const RHI::SGeometryOutput &geometryOutputs, bool outputClipspacePosition) = 0; + virtual CString GenGeometryEndPrimitive(const RHI::SGeometryOutput &geometryOutputs) = 0; + virtual CString GenComputeInputs() = 0; + virtual CString GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) = 0; +}; + +//---------------------------------------------------------------------------- + +struct CShaderCompilation : public CNonCopyable +{ +private: + CString m_InputPath; // Original shader path + CString m_OutputPath; // Final shader path (after compilation) + CString m_ShaderPermutation; // Every options contributing to the final hashed shader name + RHI::EShaderStage m_ShaderStage; + EShaderOptions m_ParticleOptions; + RHI::SShaderDescription &m_ShaderDescription; + + CString m_ShaderMetaFilePath; + bool m_GenerateMetaShaderFile; + + const SShaderCompilationSettings &m_CompilationSettings; + +public: + enum EStage + { + GenerationStage, + CompilationStage, + }; + + bool Partial(RHI::EGraphicalApi api, EStage compilationStage, IFileSystem *controller); + bool Exec(RHI::EGraphicalApi api, IFileSystem *controller); + void Clear(); + + CShaderCompilation( const CString &inputPath, + const CString &outputPath, + const CString &shaderPermutation, + RHI::EShaderStage shaderStage, + EShaderOptions shaderOptions, + RHI::SShaderDescription &shaderDesc, + const SShaderCompilationSettings &compilatons); + ~CShaderCompilation(); + +private: + bool GenerateShaderFile(RHI::EGraphicalApi apiName, const CString &inputPath, const CString &outputPath, IFileSystem *controller) const; + bool CompileShaderFile(const CString &cmdLine, const CString &inputPath, const CString &outputPath, IFileSystem *controller) const; +}; + +//---------------------------------------------------------------------------- + +struct SShaderCompilationTargetSettings +{ + RHI::EGraphicalApi m_Target; + CString m_CompilerCmdLine; +}; + +//---------------------------------------------------------------------------- + +struct SShaderCompilationSettings +{ + TArray m_Targets; + CString m_OutputFolder; + bool m_KeepTmpFile; + bool m_GenerateGeometryBBShaders; + bool m_GenerateVertexBBShaders; + bool m_ForceRecreate; + + SShaderCompilationSettings() + : m_KeepTmpFile(false) + , m_GenerateGeometryBBShaders(false) + , m_GenerateVertexBBShaders(false) + , m_ForceRecreate(false) + {} +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/VulkanShaderGenerator.cpp b/Samples/PK-SampleLib/ShaderGenerator/VulkanShaderGenerator.cpp new file mode 100644 index 00000000..9bd72368 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/VulkanShaderGenerator.cpp @@ -0,0 +1,749 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" +#include "VulkanShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include "pk_rhi/include/EnumHelper.h" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +namespace +{ + + const char *_GetGlslPrimitiveLayoutType(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return "points"; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return "lines"; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return "triangles"; + default: + PK_ASSERT_NOT_REACHED(); + return null; + } + } + + //---------------------------------------------------------------------------- + + const char *_GetGlslOutType(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return "points"; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return "line_strip"; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return "triangle_strip"; + default: + PK_ASSERT_NOT_REACHED(); + return null; + } + } + + //---------------------------------------------------------------------------- + + u32 _GetPointNumberInPrimitive(const RHI::EDrawMode primitiveType) + { + switch (primitiveType) + { + case RHI::EDrawMode::DrawModePoint: + return 1; + case RHI::EDrawMode::DrawModeLine: + case RHI::EDrawMode::DrawModeLineStrip: + return 2; + case RHI::EDrawMode::DrawModeTriangle: + case RHI::EDrawMode::DrawModeTriangleStrip: + return 3; + default: + PK_ASSERT_NOT_REACHED(); + return 0; + } + } +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenDefines(const RHI::SShaderDescription &description) const +{ + (void)description; + return "\n" + "#define VULKAN_API\n" + "\n" + "#define GLUE(_a, _b) _a ## _b\n" + "\n" + "#define VEC4_ZERO vec4(0,0,0,0)\n" + "#define VEC4_ONE vec4(1,1,1,1)\n" + "#define VEC3_ZERO vec3(0,0,0)\n" + "#define VEC3_ONE vec3(1,1,1)\n" + "#define VEC2_ZERO vec2(0,0)\n" + "#define VEC2_ONE vec2(1,1)\n" + "\n" + "#define VEC_GREATER_THAN(_vec1, _vec2) greaterThan(_vec1, _vec2)\n" + "#define VEC_GREAT_THAN_EQ(_vec1, _vec2) greaterThanEqual(_vec1, _vec2)\n" + "#define VEC_LESS_THAN(_vec1, _vec2) lessThan(_vec1, _vec2)\n" + "#define VEC_LESS_THAN_EQ(_vec1, _vec2) lessThanEqual(_vec1, _vec2)\n" + "#define VEC_EQ(_vec1, _vec2) equal(_vec1, _vec2)\n" + "#define VEC_NOT_EQ(_vec1, _vec2) notEqual(_vec1, _vec2)\n" + "#define ALL_BOOL(_bvec) all(_bvec)\n" + "#define ANY_BOOL(_bvec) any(_bvec)\n" + "\n" + "#define BUILD_MAT2(_axisX, _axisY) mat2(_axisX, _axisY)\n" + "#define BUILD_MAT3(_axisX, _axisY, _axisZ) mat3(_axisX, _axisY, _axisZ)\n" + "#define BUILD_MAT4(_axisX, _axisY, _axisZ, _axisW) mat4(_axisX, _axisY, _axisZ, _axisW)\n" + "\n" + "#define GET_CONSTANT(_constant, _var) _constant._var\n" + "#define GET_RAW_BUFFER(_buffer) _buffer._buffer\n" + "\n" + "#define TEXTURE_DIMENSIONS(_sampler, _lod, _dimensions) _dimensions = textureSize(_sampler, _lod);\n" + "#define SAMPLE(_sampler, _uv) texture(_sampler, _uv)\n" + "#define SAMPLE_CUBE(_sampler, _uv) SAMPLE(_sampler, _uv)\n" + "# define FETCH(_sampler, _uv) texelFetch(_sampler, (_uv).xy, (_uv).z)\n" // uv is int3 (z = lod) + "# define SAMPLEMS(_sampler, _uv, _sampleID) texelFetch(_sampler, _uv, _sampleID)\n" + "#define SAMPLELOD(_sampler, _uv, _lod) textureLod(_sampler, _uv, _lod)\n" + "#define SAMPLELOD_CUBE(_sampler, _uv, _lod) SAMPLELOD(_sampler, _uv, _lod)\n" + "#define SAMPLEGRAD(_sampler, _uv, _ddx, _ddy) textureGrad(_sampler, _uv, _ddx, _ddy)\n" + "\n" + "#define RAW_BUFFER_INDEX(_index) (_index)\n" + "\n" + "#define LOADU(_name, _index) _name[_index]\n" + "#define LOADU2(_name, _index) uvec2(_name[_index], _name[(_index) + 1])\n" + "#define LOADU3(_name, _index) uvec3(_name[_index], _name[(_index) + 1], _name[(_index) + 2])\n" + "#define LOADU4(_name, _index) uvec4(_name[_index], _name[(_index) + 1], _name[(_index) + 2], _name[(_index) + 3])\n" + "\n" + "#define LOADI(_name, _index) _name[_index]\n" + "#define LOADI2(_name, _index) ivec2(_name[_index], _name[(_index) + 1])\n" + "#define LOADI3(_name, _index) ivec3(_name[_index], _name[(_index) + 1], _name[(_index) + 2])\n" + "#define LOADI4(_name, _index) ivec4(_name[_index], _name[(_index) + 1], _name[(_index) + 2], _name[(_index) + 3])\n" + "\n" + "#define LOADF(_name, _index) asfloat(_name[_index])\n" + "#define LOADF2(_name, _index) vec2(asfloat(_name[_index]), asfloat(_name[(_index) + 1]))\n" + "#define LOADF3(_name, _index) vec3(asfloat(_name[_index]), asfloat(_name[(_index) + 1]), asfloat(_name[(_index) + 2]))\n" + "#define LOADF4(_name, _index) vec4(asfloat(_name[_index]), asfloat(_name[(_index) + 1]), asfloat(_name[(_index) + 2]), asfloat(_name[(_index) + 3]))\n" + "\n" + "#define STOREU(_name, _index, _value) _name[_index] = _value;\n" + "#define STOREU2(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y\n" + "#define STOREU3(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y; _name[(_index) + 2] = (_value).z;\n" + "#define STOREU4(_name, _index, _value) _name[_index] = (_value).x; _name[(_index) + 1] = (_value).y; _name[(_index) + 2] = (_value).z; _name[(_index) + 3] = (_value).w;\n" + "\n" + "#define STOREF(_name, _index, _value) _name[_index] = asuint(_value);\n" + "#define STOREF2(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y)\n" + "#define STOREF3(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y); _name[(_index) + 2] = asuint((_value).z);\n" + "#define STOREF4(_name, _index, _value) _name[_index] = asuint((_value).x); _name[(_index) + 1] = asuint((_value).y); _name[(_index) + 2] = asuint((_value).z); _name[(_index) + 3] = asuint((_value).w);\n" + "\n" + "#define F32TOF16(_x) packHalf2x16(vec2 (_x, 0))\n" + "\n" + "#define ATOMICADD(_name, _index, _value, _original) _original = atomicAdd(_name[_index], asuint(_value))\n" + "\n" + "#define GROUPMEMORYBARRIERWITHGROUPSYNC() groupMemoryBarrier(); barrier();\n" + "\n" + "#define IMAGE_LOAD(_name, _uv) imageLoad(_name, ivec2(_uv))\n" + "#define IMAGE_STORE(_name, _uv, _value) imageStore(_name, ivec2(_uv), _value)\n" + "\n" + "#define asuint(x) floatBitsToUint(x)\n" + "#define asfloat(x) uintBitsToFloat(x)\n" + "\n" + "#define mul(_a,_b) ((_a) * (_b))\n" + "\n" + "#define ARRAY_BEGIN(_type) _type[] (\n" + "#define ARRAY_END() )\n" + "\n" + "#define SAMPLER2D_DCL_ARG(_sampler) sampler2D _sampler\n" + "#define SAMPLER2DMS_DCL_ARG(_sampler) sampler2DMS _sampler\n" + "\n" + "#define SAMPLER_ARG(_sampler) _sampler\n" + "#define SAMPLERMS_ARG(_sampler) _sampler\n" + "\n" + "#define SATURATE(_value) clamp(_value, 0.0, 1.0)\n" + "#define CAST(_type, _value) _type(_value)\n" + "\n" + "#define CROSS(_a, _b) cross(_a, _b)\n" + "\n" + "#define IN(_type) in _type\n" + "#define OUT(_type) out _type\n" + "#define INOUT(_type) inout _type\n" + "\n" + "#define GS_PARAMS\n" + "#define GS_ARGS\n" + "#define VS_PARAMS\n" + "#define VS_ARGS\n" + "#define FS_PARAMS\n" + "#define FS_ARGS\n" + "#define CS_PARAMS\n" + "#define CS_ARGS\n" + "\n" + "#define VERSION #version 450\n" + "#define EXTENSION #extension GL_ARB_separate_shader_objects : enable\n" + "#define rsqrt(x) (1.0 / sqrt(x))\n" + "#define GET_MATRIX_X_AXIS(_mat) (_mat)[0]\n" + "#define GET_MATRIX_Y_AXIS(_mat) (_mat)[1]\n" + "#define GET_MATRIX_Z_AXIS(_mat) (_mat)[2]\n" + "#define GET_MATRIX_W_AXIS(_mat) (_mat)[3]\n" + "\n" + "#define GET_GROUPSHARED(_var) _var\n" + "\n" + "#define UNROLL\n" + "\n"; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenHeader(RHI::EShaderStage stage) const +{ + (void)stage; + return "VERSION\nEXTENSION\n\n" + "bool any(bool r) { return r; }\n" + "bool all(bool r) { return r; }\n"; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenVertexInputs(const TMemoryView &vertexInputs) +{ + CString vertexInputsStr; + + // Vertex Inputs + PK_FOREACH(attribute, vertexInputs) + { + vertexInputsStr += CString::Format( "layout(location = %d) in %s _vin_%s;\n", + attribute->m_ShaderLocationBinding, + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data()); + } + + // struct + vertexInputsStr += "\nstruct SVertexInput\n{\n"; + PK_FOREACH(attribute, vertexInputs) + { + vertexInputsStr += CString::Format( " %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data()); + } + vertexInputsStr += " int VertexIndex;\n"; + vertexInputsStr += " uint InstanceId;\n"; + vertexInputsStr += "};\n"; + return vertexInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) +{ + (void)toFragment; + CString vertexOutputsStr; + u32 outputLocation = 0; + + // Vertex Outputs + PK_FOREACH(interpolated, vertexOutputs) + { + vertexOutputsStr += CString::Format("layout(location = %d) %s out %s _vtof_%s;\n", + outputLocation, + RHI::GlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + outputLocation += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + // struct + vertexOutputsStr += "\nstruct SVertexOutput\n{\n"; + PK_FOREACH(interpolated, vertexOutputs) + { + vertexOutputsStr += CString::Format(" %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + } + vertexOutputsStr += " vec4 VertexPosition;\n"; + vertexOutputsStr += "};\n"; + return vertexOutputsStr; +} + +//----------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenGeometryInputs(const TMemoryView& geometryInputs, const RHI::EDrawMode drawMode) +{ + PK_ASSERT_MESSAGE(drawMode != RHI::DrawModeInvalid, "Geometry shader input primitive type is not set"); + + CString geomInputsStr; + + geomInputsStr += CString::Format("layout(%s) in;\n", _GetGlslPrimitiveLayoutType(drawMode)); + + const u32 pointNumberInput = _GetPointNumberInPrimitive(drawMode); + + u32 inputLocation = 0; + // Geometry Inputs + PK_FOREACH(attribute, geometryInputs) + { + geomInputsStr += CString::Format( "layout(location = %d) in %s _gin_%s[%d];\n", + inputLocation, + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data(), + pointNumberInput); + inputLocation += RHI::VarType::GetRowNumber(attribute->m_Type); + } + geomInputsStr += "\nstruct SPrimitives\n{\n"; + PK_FOREACH(attribute, geometryInputs) { + geomInputsStr += CString::Format( " %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(attribute->m_Type).Data(), + attribute->m_Name.Data()); + } + //geomInputsStr += CString::Format(" vec4 VertexPosition[%d];\n", pointNumberInput); + geomInputsStr += "\tvec4 VertexPosition;\n"; + geomInputsStr += "};\n"; + + // struct + geomInputsStr += "\nstruct SGeometryInput\n{\n"; + geomInputsStr += CString::Format("\tSPrimitives Primitives[%d];\n", pointNumberInput); + geomInputsStr += "\tint PrimitiveId;\n"; + geomInputsStr += "};\n"; + return geomInputsStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenGeometryOutputs(const RHI::SGeometryOutput &geometryOutputs) +{ + CString geometryOutputsStr; + u32 outputLocation = 0; + + PK_ASSERT_MESSAGE(geometryOutputs.m_MaxVertices != 0, "Geometry can emmit a maximum of 0 vertices... Set the value to something appropriate"); + + geometryOutputsStr += CString::Format( "layout(%s, max_vertices = %d) out;\n", + _GetGlslOutType(geometryOutputs.m_PrimitiveType), + geometryOutputs.m_MaxVertices); + + // Vertex Outputs + PK_FOREACH(interpolated, geometryOutputs.m_GeometryOutput) + { + geometryOutputsStr += CString::Format("layout(location = %d) %s out %s _gout_%s;\n", + outputLocation, + RHI::GlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + outputLocation += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + // struct + geometryOutputsStr += "\nstruct SGeometryOutput\n{\n"; + PK_FOREACH(interpolated, geometryOutputs.m_GeometryOutput) + { + geometryOutputsStr += CString::Format(" %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + } + geometryOutputsStr += " vec4 VertexPosition;\n"; + geometryOutputsStr += "};\n"; + return geometryOutputsStr; +} + +//----------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenFragmentInputs(const TMemoryView &fragmentInputs) +{ + CString vertexOutputsStr; + u32 inputLocation = 0; + + // Vertex Outputs + PK_FOREACH(interpolated, fragmentInputs) + { + vertexOutputsStr += CString::Format("layout(location = %d) %s in %s _vtof_%s;\n", + inputLocation, + RHI::GlslShaderTypes::GetInterpolationString(interpolated->m_Interpolation).Data(), + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + inputLocation += RHI::VarType::GetRowNumber(interpolated->m_Type); + } + // struct + vertexOutputsStr += "\nstruct SFragmentInput\n{\n"; + PK_FOREACH(interpolated, fragmentInputs) + { + vertexOutputsStr += CString::Format(" %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(interpolated->m_Type).Data(), + interpolated->m_Name.Data()); + } + vertexOutputsStr += " bool IsFrontFace;\n"; + vertexOutputsStr += "};\n"; + return vertexOutputsStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenFragmentOutputs(const TMemoryView &fragmentOutputs) +{ + CString fragmentOutputsStr; + u32 outputLocation = 0; + bool hasDepthOutput = false; + + PK_FOREACH(outBuffer, fragmentOutputs) + { + bool isDepth = false; + RHI::EVarType outType = RHI::VarType::PixelFormatToType(outBuffer->m_Type, isDepth); + + if (isDepth == false) + { + fragmentOutputsStr += CString::Format("layout(location = %d) out %s _fout_%s;\n", + outputLocation, + RHI::GlslShaderTypes::GetTypeString(outType).Data(), + outBuffer->m_Name.Data()); + ++outputLocation; + } + else + { + hasDepthOutput = true; + } + } + fragmentOutputsStr += "\nstruct SFragmentOutput\n{\n"; + PK_FOREACH(outBuffer, fragmentOutputs) + { + bool isDepth = false; + RHI::EVarType outType = RHI::VarType::PixelFormatToType(outBuffer->m_Type, isDepth); + if (isDepth == false) + { + fragmentOutputsStr += CString::Format( " %s %s;\n", + RHI::GlslShaderTypes::GetTypeString(outType).Data(), + outBuffer->m_Name.Data()); + } + } + if (hasDepthOutput) + { + fragmentOutputsStr += " float DepthValue;\n"; + } + fragmentOutputsStr += "};\n"; + return fragmentOutputsStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) +{ + CString constantsStr; + + PK_FOREACH(constantSet, constSet) + { + if ((constantSet->m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + u32 bindIdx = 0; + + PK_FOREACH(constant, constantSet->m_Constants) + { + if (constant->m_Type == RHI::TypeConstantBuffer) + { + constantsStr += CString::Format("layout(set = %d, binding = %d) uniform U%s\n", u32(constantSet->m_PerSetBinding), bindIdx, constant->m_ConstantBuffer.m_Name.Data()); + constantsStr += "{\n"; + PK_FOREACH(var, constant->m_ConstantBuffer.m_Constants) + { + constantsStr += CString::Format(" %s %s", RHI::GlslShaderTypes::GetTypeString(var->m_Type).Data(), var->m_Name.Data()); + if (var->m_ArraySize >= 1) + constantsStr += CString::Format("[%u];\n", var->m_ArraySize); + else + constantsStr += ";\n"; + } + constantsStr += CString::Format("} %s;\n", constant->m_ConstantBuffer.m_Name.Data()); + } + else if (constant->m_Type == RHI::TypeRawBuffer) + { + constantsStr += CString::Format("layout(set = %d, binding = %d) %s buffer B%s\n" + "{\n" + " uint %s[];\n" + "} %s;\n", + u32(constantSet->m_PerSetBinding), + bindIdx, + constant->m_RawBuffer.m_ReadOnly ? "readonly" : "", + constant->m_RawBuffer.m_Name.Data(), constant->m_RawBuffer.m_Name.Data(), constant->m_RawBuffer.m_Name.Data()); + } + else if (constant->m_Type == RHI::TypeTextureStorage) + { + const bool hasFormat = constant->m_TextureStorage.m_Format != RHI::FormatUnknown; + constantsStr += CString::Format("layout(set = %d, binding = %d %s) uniform %s image2D %s;\n", + u32(constantSet->m_PerSetBinding), + bindIdx, + hasFormat ? RHI::GlslShaderTypes::GetGLSLLayoutQualifierString(constant->m_TextureStorage.m_Format).Prepend(", ").Data() : "", + constant->m_TextureStorage.m_ReadOnly ? "readonly" : hasFormat ? "" : "writeonly", + constant->m_TextureStorage.m_Name.Data()); + } + else if (constant->m_Type == RHI::TypeConstantSampler) + { + constantsStr += CString::Format("layout(set = %d, binding = %d) uniform %s %s;\n", + u32(constantSet->m_PerSetBinding), + bindIdx, + constant->m_ConstantSampler.m_Type == RHI::SamplerTypeMulti ? "sampler2DMS" : constant->m_ConstantSampler.m_Type == RHI::SamplerTypeCube ? "samplerCube" : "sampler2D", + constant->m_ConstantSampler.m_Name.Data()); + } + ++bindIdx; + } + } + } + + return constantsStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) +{ + CString pushConstantsStr; + CString constantRemaps; + bool stageSetup = true; + u32 blockSizeInBytes = 0; + + for (const RHI::SPushConstantBuffer &pushConstant : pushConstants) + { + if ((pushConstant.m_ShaderStagesMask & RHI::EnumConversion::ShaderStageToMask(stage)) != 0) + { + PK_ASSERT(!pushConstant.m_Constants.Empty()); // Why are we here + if (stageSetup) // A single push_constant is allowed per stage in vulkan. + { + pushConstantsStr += "layout(push_constant) uniform UStagePushConstant\n{\n"; + stageSetup = false; + } + + constantRemaps += CString::Format("#define %s StagePushConstant\n", pushConstant.m_Name.Data()); // Allow GET_CONSTANT(UBlockName, ConstantName) -> UStagePushConstant.ConstantName + + u32 currentOffset = 0; + for (const RHI::SConstantVarDesc &var : pushConstant.m_Constants) + { + pushConstantsStr += CString::Format(" layout(offset = %u) %s %s", + u32(pushConstant.m_ByteOffset + currentOffset), + RHI::GlslShaderTypes::GetTypeString(var.m_Type).Data(), + var.m_Name.Data()); + if (var.m_ArraySize >= 1) + pushConstantsStr += CString::Format("[%u];\n", var.m_ArraySize); + else + pushConstantsStr += ";\n"; + currentOffset += RHI::VarType::GetTypeSize(var.m_Type); + } + blockSizeInBytes += currentOffset; + } + } + if (blockSizeInBytes > 0) + { + if (blockSizeInBytes > 128) + { + PK_ASSERT_NOT_REACHED(); // It's guaranteed the minimum push constant size supported is 128bytes (see doc) + } + pushConstantsStr += "} StagePushConstant;\n"; + pushConstantsStr += constantRemaps; + } + return pushConstantsStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenGroupsharedVariables(const TMemoryView &groupsharedVariables) +{ + CString groupsharedStr; + + for (auto &variable : groupsharedVariables) + { + groupsharedStr += CString::Format( "shared %s %s[%u];\n", + RHI::GlslShaderTypes::GetTypeString(variable.m_Type).Data(), + variable.m_Name.Data(), + variable.m_ArraySize); + } + + return groupsharedStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenVertexMain( const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) +{ + (void)outputClipspacePosition; + CString mainStr; + + // Shader main + mainStr += "void main()\n{\n"; + mainStr += " SVertexInput vInput;\n"; + mainStr += " SVertexOutput vOutput;\n\n"; + PK_FOREACH(attribute, vertexInputs) + { + mainStr += CString::Format(" vInput.%s = _vin_%s;\n", attribute->m_Name.Data(), attribute->m_Name.Data()); + } + mainStr += " vInput.VertexIndex = gl_VertexIndex;\n"; + mainStr += " vInput.InstanceId = uint(gl_InstanceIndex);\n"; + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += "\n " + *func + "(vInput, vOutput);\n"; + } + PK_FOREACH(interpolated, vertexOutputs) + { + mainStr += CString::Format(" _vtof_%s = vOutput.%s;\n", interpolated->m_Name.Data(), interpolated->m_Name.Data()); + } + mainStr += " gl_Position = vOutput.VertexPosition;\n"; + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenGeometryMain(const TMemoryView &geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) +{ + (void)geometryOutputs; + const u32 pointNumberInput = _GetPointNumberInPrimitive(primitiveType); +// const u32 pointNumberOutput = _GetPointNumberInPrimitive(geometryOutputs.m_PrimitiveType); + + // Shader main + CString mainStr; + mainStr += "in gl_PerVertex {\n"; + mainStr += " vec4 gl_Position;\n"; + mainStr += "} gl_in[];\n\n"; + mainStr += "void main()\n{\n"; + mainStr += " SGeometryInput gInput;\n"; + mainStr += CString::Format(" SGeometryOutput gOutput;\n\n"); + + PK_FOREACH(attribute, geometryInputs) + { + for (u32 i = 0 ; i < pointNumberInput ; ++i) + mainStr += CString::Format(" gInput.Primitives[%d].%s = _gin_%s[%d];\n", i, attribute->m_Name.Data(), attribute->m_Name.Data(), i); + } + for (u32 i = 0 ; i < pointNumberInput ; ++i) + mainStr += CString::Format(" gInput.Primitives[%d].VertexPosition = gl_in[%d].gl_Position;\n", i, i); + mainStr += " gInput.PrimitiveId = gl_PrimitiveIDIn;\n"; + + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(gInput, gOutput);\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenFragmentMain(const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) +{ + bool hasDepth = false; + CString mainStr; + + // Shader main + mainStr += "void main()\n{\n"; + mainStr += " SFragmentInput fInput;\n"; + mainStr += " SFragmentOutput fOutput;\n\n"; + PK_FOREACH(interpolated, vertexOutputs) + { + mainStr += CString::Format(" fInput.%s = _vtof_%s;\n", interpolated->m_Name.Data(), interpolated->m_Name.Data()); + } + mainStr += " fInput.IsFrontFace = gl_FrontFacing;\n"; + PK_FOREACH(func, funcToCall) + { + if (!func->Empty()) + mainStr += " " + *func + "(fInput, fOutput);\n"; + } + PK_FOREACH(outBuffer, fragmentOutputs) + { + if (outBuffer->m_Type == RHI::FlagD) + { + hasDepth = true; + } + else + { + mainStr += CString::Format(" _fout_%s = fOutput.%s;\n", outBuffer->m_Name.Data(), outBuffer->m_Name.Data()); + } + } + if (hasDepth) + { + mainStr += " gl_FragDepth = fOutput.DepthValue;\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenGeometryEmitVertex(const RHI::SGeometryOutput &geometryOutputs, bool outputClipspacePosition) +{ + (void)outputClipspacePosition; + CString emitVertexStr; + + //const u32 pointNumberOutput = _GetPointNumberInPrimitive(geometryOutputs.m_PrimitiveType); + + emitVertexStr += "void AppendVertex(in SGeometryOutput outputData)\n{\n"; + + PK_FOREACH(attribute, geometryOutputs.m_GeometryOutput) + { + emitVertexStr += CString::Format(" _gout_%s = outputData.%s;\n", attribute->m_Name.Data(), attribute->m_Name.Data()); + } + emitVertexStr += " gl_Position = outputData.VertexPosition;\n"; + emitVertexStr += " EmitVertex();\n"; + + emitVertexStr += "}"; + return emitVertexStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenGeometryEndPrimitive(const RHI::SGeometryOutput &geometryOutputs) +{ + (void)geometryOutputs; + CString emitEndStr; + emitEndStr += "void FinishPrimitive(in SGeometryOutput outputData)\n{\n"; + emitEndStr += " EndPrimitive();\n"; + emitEndStr += "}\n"; + return emitEndStr; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenComputeInputs() +{ + return "\n" + "\nstruct SComputeInput\n" + "{\n" + " uvec3 GlobalThreadID;\n" + " uvec3 LocalThreadID;\n" + " uvec3 GroupID;\n" + "};\n"; +} + +//---------------------------------------------------------------------------- + +CString CVulkanShaderGenerator::GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) +{ + // Shader main + CString mainStr; + mainStr += CString::Format("layout(local_size_x = %u, local_size_y = %u, local_size_z = %u) in;\n", dispatchSize.x(), dispatchSize.y(), dispatchSize.z()); + mainStr += "void main()\n" + "{\n" + " SComputeInput cInput;\n" + " cInput.GlobalThreadID = gl_GlobalInvocationID;\n" + " cInput.LocalThreadID = gl_LocalInvocationID;\n" + " cInput.GroupID = gl_WorkGroupID;\n"; + for(const CString &func : funcToCall) + { + if (!func.Empty()) + mainStr += " " + func + "(cInput);\n"; + } + mainStr += "}\n"; + return mainStr; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderGenerator/VulkanShaderGenerator.h b/Samples/PK-SampleLib/ShaderGenerator/VulkanShaderGenerator.h new file mode 100644 index 00000000..459fddac --- /dev/null +++ b/Samples/PK-SampleLib/ShaderGenerator/VulkanShaderGenerator.h @@ -0,0 +1,62 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include "ShaderGenerator.h" + +#if (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CVulkanShaderGenerator : public CAbstractShaderGenerator +{ +public: + CVulkanShaderGenerator() {} + virtual ~CVulkanShaderGenerator() {} + +private: + virtual CString GenDefines(const RHI::SShaderDescription &description) const override final; + virtual CString GenHeader(RHI::EShaderStage stage) const override; + virtual CString GenVertexInputs(const TMemoryView &vertexInputs) override; + virtual CString GenVertexOutputs(const TMemoryView &vertexOutputs, bool toFragment) override; + virtual CString GenGeometryInputs(const TMemoryView &geometryInputs, const RHI::EDrawMode drawMode) override final; + virtual CString GenGeometryOutputs(const RHI::SGeometryOutput &geometryOutputs) override final; + virtual CString GenFragmentInputs(const TMemoryView &fragmentInputs) override; + virtual CString GenFragmentOutputs(const TMemoryView &fragmentOutputs) override; + virtual CString GenConstantSets(const TMemoryView &constSet, RHI::EShaderStage stage) override; + virtual CString GenPushConstants(const TMemoryView &pushConstants, RHI::EShaderStage stage) override; + virtual CString GenGroupsharedVariables(const TMemoryView &groupsharedVariables) override; + virtual CString GenVertexMain( const TMemoryView &vertexInputs, + const TMemoryView &vertexOutputs, + const TMemoryView &funcToCall, + bool outputClipspacePosition) override; + virtual CString GenGeometryMain(const TMemoryView &geometryInputs, + const RHI::SGeometryOutput &geometryOutputs, + const TMemoryView &funcToCall, + const RHI::EDrawMode primitiveType) override final; + virtual CString GenFragmentMain(const TMemoryView &vertexOutputs, + const TMemoryView &fragmentOutputs, + const TMemoryView &funcToCall) override; + virtual CString GenGeometryEmitVertex(const RHI::SGeometryOutput &geometryOutputs, bool outputClipspacePosition) override final; + virtual CString GenGeometryEndPrimitive(const RHI::SGeometryOutput &geometryOutputs) override final; + virtual CString GenComputeInputs() override final; + virtual CString GenComputeMain( const CUint3 dispatchSize, + const TMemoryView &funcToCall) override final; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_SAMPLE_LIB_HAS_SHADER_GENERATOR != 0) diff --git a/Samples/PK-SampleLib/ShaderLoader.cpp b/Samples/PK-SampleLib/ShaderLoader.cpp new file mode 100644 index 00000000..55349a87 --- /dev/null +++ b/Samples/PK-SampleLib/ShaderLoader.cpp @@ -0,0 +1,348 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include + +#include "ShaderLoader.h" +#include "SampleUtils.h" +#include "pk_rhi/include/ShaderConstantBindingGenerator.h" +#include "pk_rhi/include/interfaces/SShaderBindings.h" +#include +#include + +#include +#include +#include +#include +#if (PK_BUILD_WITH_PSSL_GENERATOR != 0) +# include +#endif // (PK_BUILD_WITH_PSSL_GENERATOR != 0) + +#define PATH_TO_RESOURCES "../Resources/" + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +bool CShaderLoader::Release() +{ + m_VertexModules.Clear(); + m_GeometryModules.Clear(); + m_FragmentModules.Clear(); + m_ComputeModules.Clear(); + m_Programs.Clear(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CShaderLoader::LoadShader( RHI::SComputeState &pipelineState, + const CString &shaderPath, + const RHI::PApiManager &apiManager, + IFileSystem *controller /*= null*/) +{ + RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(apiManager->ApiName(), pipelineState.m_ShaderBindings); +// if (preprocessDescription != null) +// RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(apiManager->ApiName(), preprocessDescription->m_Bindings); + + const CDigestMD5 &computeHash = pipelineState.m_ShaderBindings.Hash(RHI::ComputeShaderStage); + CGuid loadedProgramId; + + // Check if the program has already been loaded: + for (u32 i = 0; i < m_Programs.Count(); ++i) + { + if (m_Programs[i].HasSamePathThan(shaderPath)) + { + PK_FOREACH(program, m_Programs[i].m_Programs) + { + if (computeHash == program->m_ComputeHash) + { + PK_ONLY_IF_ASSERTS( + // Check hash collisions + if (!program->m_ShaderBindingsForDebug.AreBindingsEqual(pipelineState.m_ShaderBindings, RHI::ComputeShaderStage)) + { + CLog::Log(PK_ERROR, "Hash collision detected for the shader CS: \"%s\"", shaderPath.Data()); + PK_ASSERT_NOT_REACHED_MESSAGE("Hash collision detected"); + return false; + } + ); + pipelineState.m_ShaderProgram = program->m_Program; + return true; + } + } + loadedProgramId = i; + break; + } + } + + RHI::PShaderModule computeModule = FindOrLoadShaderModule(m_ComputeModules, shaderPath, RHI::ComputeShaderStage, apiManager, pipelineState.m_ShaderBindings, computeHash, controller); + + if (computeModule == null) + return false; + + RHI::PShaderProgram program = apiManager->CreateShaderProgram(RHI::SRHIResourceInfos("PK-RHI Shader Program")); + if (program->CreateFromShaderModule(computeModule) == false) + return false; + + if (!loadedProgramId.Valid()) + { + loadedProgramId = m_Programs.PushBack(); + if (!loadedProgramId.Valid()) + return false; + } + + { + SLoadedProgram &loadedProgram = m_Programs[loadedProgramId]; + if (!loadedProgram.m_Programs.PushBack().Valid()) + { + m_Programs.Remove(loadedProgramId); + return false; + } + loadedProgram.m_ComputePath = shaderPath; + loadedProgram.m_Programs.Last().m_ComputeHash = computeHash; + PK_ONLY_IF_ASSERTS( + loadedProgram.m_Programs.Last().m_ShaderBindingsForDebug = pipelineState.m_ShaderBindings; + ); + loadedProgram.m_Programs.Last().m_Program = program; + } + + pipelineState.m_ShaderProgram = program; + return true; + +} + +//---------------------------------------------------------------------------- + +bool CShaderLoader::LoadShader( RHI::SRenderState &renderState, + const SShadersPaths &shadersPaths, + const RHI::PApiManager &apiManager, + IFileSystem *controller /*= null*/) +{ + RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(apiManager->ApiName(), renderState.m_ShaderBindings); +// if (preprocessDescription != null) +// RHI::ShaderConstantBindingGenerator::GenerateBindingsForApi(apiManager->ApiName(), preprocessDescription->m_Bindings); + + const CDigestMD5 &vertexHash = renderState.m_ShaderBindings.Hash(RHI::VertexShaderStage); + const CDigestMD5 &geometryHash = renderState.m_ShaderBindings.Hash(RHI::GeometryShaderStage); + const CDigestMD5 &fragmentHash = renderState.m_ShaderBindings.Hash(RHI::FragmentShaderStage); + CGuid loadedProgramId; + + // Check if the program has already been loaded: + for (u32 i = 0; i < m_Programs.Count(); ++i) + { + if (m_Programs[i].HasSamePathThan(shadersPaths)) + { + PK_FOREACH(program, m_Programs[i].m_Programs) + { + if (vertexHash == program->m_VertexHash && fragmentHash == program->m_FragmentHash && geometryHash == program->m_GeometryHash) + { + PK_ONLY_IF_ASSERTS( + // Check hash collisions + if (!program->m_ShaderBindingsForDebug.AreBindingsEqual(renderState.m_ShaderBindings, RHI::VertexShaderStage) || + !program->m_ShaderBindingsForDebug.AreBindingsEqual(renderState.m_ShaderBindings, RHI::FragmentShaderStage) || + !program->m_ShaderBindingsForDebug.AreBindingsEqual(renderState.m_ShaderBindings, RHI::GeometryShaderStage)) + { + CLog::Log( PK_ERROR, + "Hash collision detected for the shader VS: \"%s\" GS: \"%s\" PS: \"%s\"", + shadersPaths.m_Vertex.Data(), + shadersPaths.m_Geometry.Data(), + shadersPaths.m_Fragment.Data()); + PK_ASSERT_NOT_REACHED_MESSAGE("Hash collision detected"); + return false; + } + ); + renderState.m_ShaderProgram = program->m_Program; + return true; + } + } + loadedProgramId = i; + break; + } + } + + RHI::PShaderModule vertexModule = FindOrLoadShaderModule(m_VertexModules, shadersPaths.m_Vertex, RHI::VertexShaderStage, apiManager, renderState.m_ShaderBindings, vertexHash, controller); + RHI::PShaderModule geometryModule = null; + if (shadersPaths.HasGeometry()) + geometryModule = FindOrLoadShaderModule(m_GeometryModules, shadersPaths.m_Geometry, RHI::GeometryShaderStage, apiManager, renderState.m_ShaderBindings, geometryHash, controller); + RHI::PShaderModule fragmentModule = FindOrLoadShaderModule(m_FragmentModules, shadersPaths.m_Fragment, RHI::FragmentShaderStage, apiManager, renderState.m_ShaderBindings, fragmentHash, controller); + + if (vertexModule == null || fragmentModule == null || (shadersPaths.HasGeometry() && geometryModule == null)) + return false; + + RHI::PShaderProgram program = apiManager->CreateShaderProgram(RHI::SRHIResourceInfos("PK-RHI Shader Program")); + if (program->CreateFromShaderModules(vertexModule, geometryModule, fragmentModule) == false) + return false; + + if (!loadedProgramId.Valid()) + { + loadedProgramId = m_Programs.PushBack(); + if (!loadedProgramId.Valid()) + return false; + } + + { + SLoadedProgram &loadedProgram = m_Programs[loadedProgramId]; + if (!loadedProgram.m_Programs.PushBack().Valid()) + { + m_Programs.Remove(loadedProgramId); + return false; + } + loadedProgram.m_FragmentPath = shadersPaths.m_Fragment; + loadedProgram.m_VertexPath = shadersPaths.m_Vertex; + loadedProgram.m_GeometryPath = shadersPaths.m_Geometry; + loadedProgram.m_Programs.Last().m_VertexHash = vertexHash; + loadedProgram.m_Programs.Last().m_FragmentHash = fragmentHash; + loadedProgram.m_Programs.Last().m_GeometryHash = geometryHash; + PK_ONLY_IF_ASSERTS( + loadedProgram.m_Programs.Last().m_ShaderBindingsForDebug = renderState.m_ShaderBindings; + ); + loadedProgram.m_Programs.Last().m_Program = program; + } + + renderState.m_ShaderProgram = program; + return true; +} + +//---------------------------------------------------------------------------- + +RHI::PShaderModule CShaderLoader::FindOrLoadShaderModule( TArray &moduleLibrary, + const CString &shaderPath, + RHI::EShaderStage stage, + const RHI::PApiManager &apiManager, + const RHI::SShaderBindings &bindings, + const CDigestMD5 &hash, + IFileSystem *controller) +{ + (void)bindings; + for (u32 i = 0; i < moduleLibrary.Count(); ++i) + { + SLoadedModule &loadedModule = moduleLibrary[i]; + if (loadedModule.m_Path == shaderPath) + { + for (u32 j = 0; j < loadedModule.m_Modules.Count(); ++j) + { + SLoadedModule::SModule ¤tModule = loadedModule.m_Modules[j]; + if (hash == currentModule.m_Hash) + { + PK_ONLY_IF_ASSERTS( + // Check hash collisions + if (!currentModule.m_ShaderBindingsForDebug.AreBindingsEqual(bindings, stage)) + { + CLog::Log(PK_ERROR, "Hash collision detected for the shader \"%s\"", shaderPath.Data()); + PK_ASSERT_NOT_REACHED_MESSAGE("Hash collision detected"); + return null; + } + ); + return currentModule.m_Module; + } + } + + RHI::PShaderModule module = LoadShaderModule(shaderPath, hash, apiManager, stage, controller); + if (module == null) + return null; + + if (!loadedModule.m_Modules.PushBack().Valid()) + return null; + loadedModule.m_Modules.Last().m_Module = module; + loadedModule.m_Modules.Last().m_Hash = hash; + PK_ONLY_IF_ASSERTS( + loadedModule.m_Modules.Last().m_ShaderBindingsForDebug = bindings; + ); + return module; + } + } + + RHI::PShaderModule module = LoadShaderModule(shaderPath, hash, apiManager, stage, controller); + if (module == null) + return null; + if (!moduleLibrary.PushBack().Valid()) + return null; + if (!moduleLibrary.Last().m_Modules.PushBack().Valid()) + { + moduleLibrary.PopBackAndDiscard(); + return null; + } + + moduleLibrary.Last().m_Path = shaderPath; + moduleLibrary.Last().m_Modules.Last().m_Hash = hash; + PK_ONLY_IF_ASSERTS( + moduleLibrary.Last().m_Modules.Last().m_ShaderBindingsForDebug = bindings; + ); + moduleLibrary.Last().m_Modules.Last().m_Module = module; + return module; +} + +//---------------------------------------------------------------------------- + +RHI::PShaderModule CShaderLoader::LoadShaderModule(const CString &path, + const CDigestMD5 &hash, + const RHI::PApiManager &apiManager, + RHI::EShaderStage stage, + IFileSystem *controller) +{ + if (controller == null) + controller = m_DefaultController; + if (controller == null) + controller = File::DefaultFileSystem(); + + char _hashStorage[32+1]; + const CStringView finalHash = RHI::ShaderHashToStringView(hash, _hashStorage); + const CString filePathNoExt = path + "." + finalHash; + const CString filePath = filePathNoExt + GetShaderExtensionStringFromApi(apiManager->ApiName()); +#ifndef PK_RETAIL + const CString shaderDebugName = CFilePath::ExtractFilename(filePathNoExt); +#else + const CString shaderDebugName; +#endif // ifndef PK_RETAIL + + // Load the compiled shader + RHI::PShaderModule module = apiManager->CreateShaderModule(RHI::SRHIResourceInfos(shaderDebugName)); + PFileStream fileView = controller->OpenStream(filePath, IFileSystem::Access_Read); + if (fileView == null) + fileView = controller->OpenStream(filePath, IFileSystem::Access_Read, true); + + if (fileView == null) + { + CLog::Log(PK_ERROR, "Could not load the shader file %s", filePath.Data()); + return null; + } + PRefCountedMemoryBuffer byteCode = fileView->BufferizeToRefCountedMemoryBuffer(); + fileView->Close(); + + bool err = false; + if (apiManager->ApiDesc().m_SupportPrecompiledShader) + err = module->LoadFromPrecompiled(byteCode, stage); + else + err = module->CompileFromCode(byteCode->Data(), byteCode->DataSizeInBytes(), stage); + + if (err == false) + { + CLog::Log(PK_ERROR, "Shader '%s' did not compile: '%s'", path.Data(), module->GetShaderModuleCreationInfo()); + if (!apiManager->ApiDesc().m_SupportPrecompiledShader) + { + CString shaderCode = CString(byteCode->Data(), byteCode->DataSizeInBytes()); + TArray lines; + + shaderCode.Split('\n', lines); + + CLog::Log(PK_ERROR, "Shader code:"); + for (u32 i = 0; i < lines.Count(); ++i) + { + CLog::Log(PK_ERROR, "[%u]%s", i, lines[i].Data()); + } + } + return null; + } + return module; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/ShaderLoader.h b/Samples/PK-SampleLib/ShaderLoader.h new file mode 100644 index 00000000..628b45ed --- /dev/null +++ b/Samples/PK-SampleLib/ShaderLoader.h @@ -0,0 +1,118 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" +#include +#include +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CShaderLoader +{ +public: + struct SShadersPaths + { + CString m_Vertex; + CString m_Geometry; + CString m_Fragment; + + bool HasGeometry() const { return !m_Geometry.Empty(); } + }; + + CShaderLoader() : m_DefaultController(null) { } + ~CShaderLoader() { } + + bool Release(); + + bool LoadShader( RHI::SRenderState &renderState, + const SShadersPaths &shadersPaths, + const RHI::PApiManager &apiManager, + IFileSystem *controller = null); // Give preprocess shader description to enable preprocessing + + + bool LoadShader( RHI::SComputeState &pipelineState, + const CString &shaderPath, + const RHI::PApiManager &apiManager, + IFileSystem *controller = null); // Give preprocess shader description to enable preprocessing + + void SetDefaultFSController(IFileSystem *controller) { m_DefaultController = controller; } + +private: + struct SLoadedModule + { + CString m_Path; + + struct SModule + { + CDigestMD5 m_Hash; + RHI::PShaderModule m_Module; +#ifdef PK_DEBUG + RHI::SShaderBindings m_ShaderBindingsForDebug; +#endif + }; + + TArray m_Modules; + }; + + struct SLoadedProgram + { + CString m_VertexPath; + CString m_GeometryPath; + CString m_FragmentPath; + CString m_ComputePath; + + bool HasSamePathThan(const SShadersPaths & shadersPaths) const { return m_VertexPath == shadersPaths.m_Vertex && m_FragmentPath == shadersPaths.m_Fragment && m_GeometryPath == shadersPaths.m_Geometry; } + bool HasSamePathThan(const CString & computeShaderPath) const { return m_ComputePath == computeShaderPath; } + + struct SProgram + { + CDigestMD5 m_VertexHash; + CDigestMD5 m_GeometryHash; + CDigestMD5 m_FragmentHash; + CDigestMD5 m_ComputeHash; + RHI::PShaderProgram m_Program; +#ifdef PK_DEBUG + RHI::SShaderBindings m_ShaderBindingsForDebug; +#endif + }; + + TArray m_Programs; + }; + + RHI::PShaderModule FindOrLoadShaderModule( TArray &moduleLibrary, + const CString &shaderPath, + RHI::EShaderStage stage, + const RHI::PApiManager &apiManager, + const RHI::SShaderBindings &bindings, + const CDigestMD5 &hash, + IFileSystem *controller); + RHI::PShaderModule LoadShaderModule( const CString &path, + const CDigestMD5 &hash, + const RHI::PApiManager &apiManager, + RHI::EShaderStage stage, + IFileSystem *controller); + + TArray m_VertexModules; + TArray m_GeometryModules; + TArray m_FragmentModules; + TArray m_ComputeModules; + + TArray m_Programs; + + IFileSystem *m_DefaultController; +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SimInterfaces/SimInterface_GBufferSampling.cpp b/Samples/PK-SampleLib/SimInterfaces/SimInterface_GBufferSampling.cpp new file mode 100644 index 00000000..947a909c --- /dev/null +++ b/Samples/PK-SampleLib/SimInterfaces/SimInterface_GBufferSampling.cpp @@ -0,0 +1,551 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "SimInterfaces.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// PK-RHI and PK-SampleLib are used for generating shader code & bindings, only PK-Particles +// is required in an engine not using PK-SampleLib for rendering. + +// Only required when baking effects +#if (PK_COMPILER_BUILD_COMPILER_D3D != 0) + // Source shaders code built into a char array. + // Source shaders can be found in source_tree/SDK/Samples/PK-Samples/PK-SampleLib/Assets/ShaderIncludes/sources/GPUSimInterfaces +# include +# include + +# include +#endif // (PK_COMPILER_BUILD_COMPILER_D3D != 0) + +// Required at runtime +#if (PK_PARTICLES_UPDATER_USE_D3D != 0) +# include +# include +# include + +# include +# include +# include +# include +# include +#endif // (PK_COMPILER_BUILD_COMPILER_D3D != 0) + +#include +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +namespace SimInterfaces +{ + +#if (PK_COMPILER_BUILD_COMPILER_D3D != 0) + namespace D3D + { + //---------------------------------------------------------------------------- + // + // Compute shader generation (only required to be available for baking) + // + //---------------------------------------------------------------------------- + + bool _Declare_Texture2D(CStringId name, u32 regslot, CString &out) + { + out += CString::Format("Texture2D %s : register(t%d);\n", name.ToStringData(), regslot); + return true; + } + + bool _Declare_SceneInfos(CStringId name, u32 regslot, CString &out) + { + (void)name; + // Use SampleLib's shader generation wrapper, to make sure shader code remains up to date with editor code. + RHI::SConstantSetLayout sceneInfoLayout; + if (!PK_VERIFY(PKSample::CreateSceneInfoConstantLayout(sceneInfoLayout))) + return false; + PKSample::CHLSLShaderGenerator hlslGenerator; + + // Assume scene info layout only contains one constant buffer + if (!PK_VERIFY(sceneInfoLayout.m_Constants.Count() == 1) || + !PK_VERIFY(sceneInfoLayout.m_Constants[0].m_Type == RHI::TypeConstantBuffer)) + return false; + sceneInfoLayout.m_Constants[0].m_ConstantBuffer.m_PerBlockBinding = regslot; + + out += hlslGenerator.GenConstantSets(TMemoryView(sceneInfoLayout), RHI::ComputeShaderStage); + return true; + } + + bool _Declare_Sampler_HLSL(CStringId name, u32 regslot, CString &out) + { + out += CString::Format( "SamplerState %s : register(s%d);\n", name.ToStringData(), regslot); + return true; + } + + // Data shared by several sim interface EmitBuiltin functions to avoid re-defining the same inputs several times + bool EmitBuiltin_SampleData(CLinkerGPU::SExternalFunctionEmitArgs &args) + { + // Declare common bindings required by shaders (see where EmitBuiltin_SampleData is referenced) + CLinkerGPU::SExternalFunctionEmitArgs::SDeclInput inputSceneInfos(CStringId("SceneInfos"), CLinkerGPU::SExternalFunctionEmitArgs::SDeclInput::ConstantBuffer, _Declare_SceneInfos); + if (!PK_VERIFY(args.m_ExternalShaderInput.PushBack(inputSceneInfos).Valid())) + return false; + + switch (args.m_Shaderlang) + { + case CLinkerGPU::SExternalFunctionEmitArgs::HLSL_5_0: // D3D11 GPU sim + case CLinkerGPU::SExternalFunctionEmitArgs::HLSL_6_0: // D3D12 GPU sim + { + CLinkerGPU::SExternalFunctionEmitArgs::SDeclInput inputSampler(CStringId("SceneTexturesSampler"), CLinkerGPU::SExternalFunctionEmitArgs::SDeclInput::Sampler, _Declare_Sampler_HLSL); + if (!PK_VERIFY(args.m_ExternalShaderInput.PushBack(inputSampler).Valid())) + return false; + } + break; + default: + PK_ASSERT_NOT_REACHED(); + return false; + } + return true; + } + + // Scene intersect with scene depth map + bool EmitBuiltin_ProjectToPosition(CLinkerGPU::SExternalFunctionEmitArgs &args) + { + // Declare the unique binding required by this shader + CLinkerGPU::SExternalFunctionEmitArgs::SDeclInput inputSceneDepth(CStringId("SceneDepth"), CLinkerGPU::SExternalFunctionEmitArgs::SDeclInput::ShaderResource, _Declare_Texture2D); + if (!PK_VERIFY(args.m_ExternalShaderInput.PushBack(inputSceneDepth).Valid())) + return false; + + // Shader content + args.m_DstKernelSource += g_GPUSimInterface_GBuffer_ProjectToPosition_d3d_data; + return true; + } + + // Scene intersect with scene depth map + bool EmitBuiltin_ProjectToNormal(CLinkerGPU::SExternalFunctionEmitArgs &args) + { + // Declare the unique binding required by this shader + CLinkerGPU::SExternalFunctionEmitArgs::SDeclInput inputSceneNormal(CStringId("SceneNormal"), CLinkerGPU::SExternalFunctionEmitArgs::SDeclInput::ShaderResource, _Declare_Texture2D); + if (!PK_VERIFY(args.m_ExternalShaderInput.PushBack(inputSceneNormal).Valid())) + return false; + + // Shader content + args.m_DstKernelSource += g_GPUSimInterface_GBuffer_ProjectToNormal_d3d_data; + return true; + } + + } // namespace D3D +#endif // (PK_COMPILER_BUILD_COMPILER_D3D != 0) + + //---------------------------------------------------------------------------- + // + // Compute shader dispatch bindings (required at runtime, called on async threads during PK simulation) + // + //---------------------------------------------------------------------------- + + bool Bind_ConstantBuffer(const RHI::PGpuBuffer &buffer, const SLinkGPUContext &context) + { + (void)context; + if (!PK_VERIFY(buffer != null)) + return false; + +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + if (context.m_ContextType == ContextD3D11) + { + const SBindingContextD3D11 &d3d11Context = context.ToD3D11(); + RHI::PD3D11GpuBuffer d3d11Buffer = CastD3D11(buffer); + ID3D11Buffer *_d3d11Buffer = d3d11Buffer->D3D11GetBuffer(); + + if (!PK_VERIFY(_d3d11Buffer != null)) + return false; + d3d11Context.m_DeviceContext->CSSetConstantBuffers(context.m_Location, 1, &_d3d11Buffer); + return true; + } +#endif // (PK_PARTICLES_UPDATER_USE_D3D11 != 0) +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + if (context.m_ContextType == ContextD3D12) + { + SBindingContextD3D12 &d3d12Context = const_cast(context.ToD3D12()); + SBindingHeapD3D12 &bindingHeap = d3d12Context.m_Heap; + RHI::PD3D12GpuBuffer d3d12Buffer = CastD3D12(buffer); + ID3D12Resource *_d3d12Buffer = d3d12Buffer->D3D12GetResource(); + + if (!PK_VERIFY(_d3d12Buffer != null)) + return false; + return bindingHeap.BindConstantBufferView(d3d12Context.m_Device, _d3d12Buffer, context.m_Location) && + bindingHeap.KeepResourceReference(_d3d12Buffer); + } +#endif // (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + PK_ASSERT_NOT_REACHED(); + return false; + } + + //---------------------------------------------------------------------------- + + bool Bind_Texture(const RHI::PTexture &texture, const SLinkGPUContext &context) + { + (void)context; + if (!PK_VERIFY(texture != null)) + return false; + +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + if (context.m_ContextType == ContextD3D11) + { + const SBindingContextD3D11 &d3d11Context = context.ToD3D11(); + RHI::PD3D11Texture d3d11Texture = CastD3D11(texture); + ID3D11ShaderResourceView *_d3d11Texture = d3d11Texture->D3D11GetView(); + + if (!PK_VERIFY(_d3d11Texture != null)) + return false; + d3d11Context.m_DeviceContext->CSSetShaderResources(context.m_Location, 1, &_d3d11Texture); + return true; + } +#endif // (PK_PARTICLES_UPDATER_USE_D3D11 != 0) +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + if (context.m_ContextType == ContextD3D12) + { + SBindingContextD3D12 &d3d12Context = const_cast(context.ToD3D12()); + SBindingHeapD3D12 &bindingHeap = d3d12Context.m_Heap; + RHI::PD3D12Texture d3d12Texture = CastD3D12(texture); + ID3D12Resource *_d3d12Texture = d3d12Texture->D3D12GetResource(); + + if (!PK_VERIFY(_d3d12Texture != null) || + !PK_VERIFY(d3d12Context.m_DynamicBarrier != null)) + return false; + + // Note: can be used to transition a resource before/after the associated CS is dispatched +#if 0 + const D3D12_RESOURCE_STATES stateBefore = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + const D3D12_RESOURCE_STATES stateAfter = D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE; + if (!PK_VERIFY(d3d12Context.m_DynamicBarrier->AddBarrier(_d3d12Texture, stateBefore, stateAfter)) || + !PK_VERIFY(d3d12Context.m_DynamicBarrier_PostUpdate->AddBarrier(_d3d12Texture, stateAfter, stateBefore))) + return false; +#endif + + const DXGI_FORMAT dxgiFormat = RHI::D3DConversion::PopcornToD3DPixelFormat(texture->GetFormat()); + return bindingHeap.BindTextureShaderResourceView(d3d12Context.m_Device, _d3d12Texture, context.m_Location, dxgiFormat, D3D12_SRV_DIMENSION_TEXTURE2D, D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING) && + bindingHeap.KeepResourceReference(_d3d12Texture); + } +#endif // (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + PK_ASSERT_NOT_REACHED(); + return false; + } + + //---------------------------------------------------------------------------- + + bool Bind_Sampler(CStringId mangledName, const SLinkGPUContext &context) + { + (void)mangledName; (void)context; + PK_ASSERT(mangledName.ToStringView() == "SceneTexturesSampler"); + +#if (PK_PARTICLES_UPDATER_USE_D3D11 != 0) + if (context.m_ContextType == ContextD3D11) + { + SBindingContextD3D11 &d3d11Context = const_cast(context.ToD3D11()); + ID3D11Device *device = null; + d3d11Context.m_DeviceContext->GetDevice(&device); + if (!PK_VERIFY(device != null)) + return false; + + D3D11_SAMPLER_DESC desc = {}; + desc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; + desc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; + desc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; + desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; + desc.MaxAnisotropy = 1; + desc.ComparisonFunc = D3D11_COMPARISON_NEVER; + + ID3D11SamplerState *samplerState = null; + HRESULT errorCode = device->CreateSamplerState(&desc, &samplerState); + if (!PK_VERIFY(errorCode == S_OK)) + return false; + d3d11Context.m_DeviceContext->CSSetSamplers(context.m_Location, 1, &samplerState); + return true; + } +#endif // (PK_PARTICLES_UPDATER_USE_D3D11 != 0) +#if (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + if (context.m_ContextType == ContextD3D12) + { + SBindingContextD3D12 &d3d12Context = const_cast(context.ToD3D12()); //...... + SBindingHeapD3D12 &bindingHeap = d3d12Context.m_Heap; + + D3D12_SAMPLER_DESC desc = {}; + desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP; + desc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP; + desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP; + desc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT; + desc.MipLODBias = 0; + desc.MaxAnisotropy = 1; + desc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER; + desc.MinLOD = 0; + desc.MaxLOD = 0; + + return bindingHeap.BindSampler(d3d12Context.m_Device, desc, context.m_Location); + } +#endif // (PK_PARTICLES_UPDATER_USE_D3D12 != 0) + PK_ASSERT_NOT_REACHED(); + return false; + } + + //---------------------------------------------------------------------------- + // + // Sim interface definition (required at runtime, when registration of the sim interface occurs) + // + //---------------------------------------------------------------------------- + +#if (PK_PARTICLES_UPDATER_USE_D3D != 0) + static bool _BuildSimInterfaceDef_ProjectToPosition(SSimulationInterfaceDefinition &def) + { + // Build the graphics API / backend independent definition of the sim interface + PK_ASSERT(def.m_Inputs.Empty() && def.m_Outputs.Empty()); + + // Build the sim interface definition + def.m_FnNameBase = "GBuffer_ProjectToPosition"; + def.m_Traits = Compiler::F_StreamedReturnValue | Compiler::F_Pure; + + // Pass in scene, to make sure our function does not get constant folded if input World Position is constant: our output isn't. + def.m_Flags = SSimulationInterfaceDefinition::Flags_Context_Scene; + + // "Space" of the inputs/outputs + const Compiler::STypeMetaData kMetaData_Full = u32(MetaData_XForm_World | MetaData_XForm_Full); + + // Declare all inputs + if (!def.m_Inputs.PushBack(SSimulationInterfaceDefinition::SValueIn("Position", Nodegraph::DataType_Float3, Compiler::Attribute_Stream, kMetaData_Full)).Valid()) + return false; + + // Declare all outputs + if (!def.m_Outputs.PushBack(SSimulationInterfaceDefinition::SValueOut("WorldPosition", Nodegraph::DataType_Float3, Compiler::Attribute_Stream, kMetaData_Full)).Valid()) + return false; + + return true; + } + + //---------------------------------------------------------------------------- + +#if (PK_COMPILER_BUILD_COMPILER != 0) + static bool _CustomRangeBuild_ProjectToNormal( const CCompilerIR *ir, + Compiler::IR::CRangeAnalysis *ranges, + const Compiler::IR::SOptimizerConfig &optimizerConfig, + const Compiler::IR::SOp_Generic &op, + Range::SConstantRange &outputRange) + { + (void)ranges; (void)optimizerConfig; (void)ir; + if (!PK_VERIFY(op.m_Opcode == Compiler::IR::Opcode_FunctionCall) || + !PK_VERIFY(op.m_Inputs.Count() == 2)) // SI_GBuffer_ProjectToNormal(float3 position, int4 sceneCtx) + return false; + + // Assume the sample normal implementation returns normalized normals: lets the optimizer remove calls to 'normalize' for example + outputRange = Range::SConstantRange::kF32_m1p1; // ]-1,+1[ + return true; + } +#endif // (PK_COMPILER_BUILD_COMPILER != 0) + + //---------------------------------------------------------------------------- + + static bool _BuildSimInterfaceDef_ProjectToNormal(SSimulationInterfaceDefinition &def) + { + // Build the graphics API / backend independent definition of the sim interface + PK_ASSERT(def.m_Inputs.Empty() && def.m_Outputs.Empty()); + + // Build the sim interface definition + def.m_FnNameBase = "GBuffer_ProjectToNormal"; + def.m_Traits = Compiler::F_StreamedReturnValue | Compiler::F_Pure; + + // Pass in scene, to make sure our function does not get constant folded if input World Position is constant: our output isn't. + def.m_Flags = SSimulationInterfaceDefinition::Flags_Context_Scene; + +#if (PK_COMPILER_BUILD_COMPILER != 0) + // Step used by the particle compiler / optimizer: defines the range of values of the WorldNormal output. + def.m_OptimizerDefs.m_FnRangeBuildPtr = &_CustomRangeBuild_ProjectToNormal; +#endif + + // "Space" of the inputs/outputs + const Compiler::STypeMetaData kMetaData_Position = u32(MetaData_XForm_World | MetaData_XForm_Full); + const Compiler::STypeMetaData kMetaData_Direction = u32(MetaData_XForm_World | MetaData_XForm_Direction); + + // Declare all inputs + if (!def.m_Inputs.PushBack(SSimulationInterfaceDefinition::SValueIn("Position", Nodegraph::DataType_Float3, Compiler::Attribute_Stream, kMetaData_Position)).Valid()) + return false; + + // Declare all outputs + if (!def.m_Outputs.PushBack(SSimulationInterfaceDefinition::SValueOut("WorldNormal", Nodegraph::DataType_Float3, Compiler::Attribute_Stream, kMetaData_Direction)).Valid()) + return false; + + return true; + } +#endif // (PK_PARTICLES_UPDATER_USE_D3D != 0) + + //---------------------------------------------------------------------------- + // + // Sim interface CPU implementation (required at runtime, when registration of the sim interface occurs) + // + //---------------------------------------------------------------------------- + + void _ProjectToPosition( const TStridedMemoryView &dstWorldPositions, + const TStridedMemoryView &srcPositions, + const CParticleContextScene *sceneCtx) + { + (void)sceneCtx; + // Forward positions + Mem::CopyStreamToStream(dstWorldPositions, srcPositions); + } + + //---------------------------------------------------------------------------- + + void _ProjectToNormal( const TStridedMemoryView &dstWorldNormals, + const TStridedMemoryView &srcPositions, + const CParticleContextScene *sceneCtx) + { + (void)sceneCtx; + // Clear output normals + (void)srcPositions; + Mem::ClearStream(dstWorldNormals); + } + + //---------------------------------------------------------------------------- + // + // Linker binding + // + //---------------------------------------------------------------------------- + + bool BindGBufferSamplingSimInterfaces(const CString &coreLibPath, HBO::CContext *context) + { + (void)context; (void)coreLibPath; +#if (PK_PARTICLES_UPDATER_USE_D3D != 0) + // Build the sim interface definition (backend independent) + SSimulationInterfaceDefinition defProjectToPosition; + SSimulationInterfaceDefinition defProjectToNormal; + if (!PK_VERIFY(_BuildSimInterfaceDef_ProjectToPosition(defProjectToPosition)) || + !PK_VERIFY(_BuildSimInterfaceDef_ProjectToNormal(defProjectToNormal))) + return false; + + const CString simInterfacePath = coreLibPath / "PopcornFXCore/Templates/Utils.pkfx"; + const CStringUnicode simInterfaceNameProjectToPosition = L"GBuffer_ProjectToPosition"; + const CStringUnicode simInterfaceNameProjectToNormal = L"GBuffer_ProjectToNormal"; + +# if (PK_COMPILER_BUILD_COMPILER != 0) + // Make sure the definition is valid, and can be resolved (only available when the source template file is available). + if (!PK_VERIFY(CSimulationInterfaceMapper::CheckBinding(simInterfacePath, simInterfaceNameProjectToPosition, defProjectToPosition, context)) || + !PK_VERIFY(CSimulationInterfaceMapper::CheckBinding(simInterfacePath, simInterfaceNameProjectToNormal, defProjectToNormal, context))) + return false; + + // Bind the definition to the sim interface template path in your project + CSimulationInterfaceMapper *simInterfaceMapper = CSimulationInterfaceMapper::DefaultMapper(); + if (!simInterfaceMapper->Bind(simInterfacePath, simInterfaceNameProjectToPosition, defProjectToPosition) || + !simInterfaceMapper->Bind(simInterfacePath, simInterfaceNameProjectToNormal, defProjectToNormal)) + { + CLog::Log(PK_INFO, "Failed binding GPU sim interfaces"); + } +# endif + + // CPU sim implementation fallback (as soon as we bind a sim interface, all supported backends must be implemented) + PopcornFX::Compiler::SBinding linkBindingProjectToPosition; + PopcornFX::Compiler::SBinding linkBindingProjectToNormal; + PopcornFX::Compiler::Binders::Bind(linkBindingProjectToPosition, &_ProjectToPosition); + PopcornFX::Compiler::Binders::Bind(linkBindingProjectToNormal, &_ProjectToNormal); + + if (!CLinkerCPU::Bind(defProjectToPosition.GetCallNameMangledCPU(0), linkBindingProjectToPosition) || + !CLinkerCPU::Bind(defProjectToNormal.GetCallNameMangledCPU(0), linkBindingProjectToNormal)) + { + CLog::Log(PK_ERROR, "Failed linking CPU sim implementation for GPU sim interfaces"); + return false; + } + + const CStringId backendName_D3D("GPU_D3D"); +# if (PK_COMPILER_BUILD_COMPILER_D3D != 0) + // GPU shader implementation: emit the shader code for that sim interface. Only required when baking + const CStringId SPID_Ext_sampleData("_sample_data"); + // Dependencies shared by ProjectToPosition and ProjectToNormal (mainly, the SceneInfo constant buffer, and the shared texture sampler) + const CStringId deps[] = + { + SPID_Ext_sampleData + }; + const CString mangledCallGPUProjectToPosition = defProjectToPosition.GetCallNameMangledGPU(0); + const CString mangledCallGPUProjectToNormal = defProjectToNormal.GetCallNameMangledGPU(0); + if (!CLinkerGPU::Bind(backendName_D3D, SPID_Ext_sampleData, &D3D::EmitBuiltin_SampleData) || + !CLinkerGPU::Bind(backendName_D3D, CStringId(mangledCallGPUProjectToPosition), &D3D::EmitBuiltin_ProjectToPosition, false, deps) || + !CLinkerGPU::Bind(backendName_D3D, CStringId(mangledCallGPUProjectToNormal), &D3D::EmitBuiltin_ProjectToNormal, false, deps)) + { + CLog::Log(PK_ERROR, "Failed emitting GPU sim interfaces"); + return false; + } +# endif // (PK_COMPILER_BUILD_COMPILER_D3D != 0) + + if (!CLinkerGPU::BindLink(backendName_D3D, CStringId("SceneTexturesSampler"), &Bind_Sampler)) + { + CLog::Log(PK_ERROR, "Failed linking GPU sim interface bindings"); + return false; + } + return true; +#else + CLog::Log(PK_ERROR, "GPU GBufferSampling simulation interfaces can only be bound with D3D GPU simulation"); + return false; +#endif // (PK_PARTICLES_UPDATER_USE_D3D != 0) + } + + //---------------------------------------------------------------------------- + + void UnbindGBufferSamplingSimInterfaces(const CString &coreLibPath) + { + (void)coreLibPath; +#if (PK_PARTICLES_UPDATER_USE_D3D != 0) + const CString simInterfacePath = coreLibPath / "PopcornFXCore/Templates/Utils.pkfx"; + const CStringUnicode simInterfaceNameProjectToPosition = L"GBuffer_ProjectToPosition"; + const CStringUnicode simInterfaceNameProjectToNormal = L"GBuffer_ProjectToNormal"; + + // Build the sim interface definition + SSimulationInterfaceDefinition defProjectToPosition; + SSimulationInterfaceDefinition defProjectToNormal; + if (!PK_VERIFY(_BuildSimInterfaceDef_ProjectToPosition(defProjectToPosition)) || + !PK_VERIFY(_BuildSimInterfaceDef_ProjectToNormal(defProjectToNormal))) + return; + +#if (PK_COMPILER_BUILD_COMPILER != 0) + CSimulationInterfaceMapper *simInterfaceMapper = CSimulationInterfaceMapper::DefaultMapper(); + // If sim interface is not there, abort + if (simInterfaceMapper->Map(simInterfacePath, simInterfaceNameProjectToPosition) == null || + simInterfaceMapper->Map(simInterfacePath, simInterfaceNameProjectToNormal) == null) + return; + + // Unbind the sim interface. + // All subsequent effect compilations will not see it as a sim interface + // and will compile like in the editor: using the default implementation contained + // in the sim interface template node. + simInterfaceMapper->Unbind(simInterfacePath, simInterfaceNameProjectToPosition); + simInterfaceMapper->Unbind(simInterfacePath, simInterfaceNameProjectToNormal); +#endif // (PK_COMPILER_BUILD_COMPILER != 0) + + // Unbind from GPU linker + const CStringId backendName_D3D("GPU_D3D"); + CLinkerGPU::UnbindLink(backendName_D3D, CStringId("SceneDepth")); + CLinkerGPU::UnbindLink(backendName_D3D, CStringId("SceneNormal")); + CLinkerGPU::UnbindLink(backendName_D3D, CStringId("SceneInfos")); + CLinkerGPU::UnbindLink(backendName_D3D, CStringId("SceneTexturesSampler")); + + // Unbind from CPU linker + CLinkerCPU::Unbind(defProjectToPosition.GetCallNameMangledCPU(0)); + CLinkerCPU::Unbind(defProjectToNormal.GetCallNameMangledCPU(0)); +#endif // (PK_PARTICLES_UPDATER_USE_D3D != 0) + } + +} // namespace SimInterfaces + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/SimInterfaces/SimInterfaces.h b/Samples/PK-SampleLib/SimInterfaces/SimInterfaces.h new file mode 100644 index 00000000..8e5d4666 --- /dev/null +++ b/Samples/PK-SampleLib/SimInterfaces/SimInterfaces.h @@ -0,0 +1,39 @@ +#pragma once +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "PK-SampleLib/PKSample.h" + +#include +#include + +__PK_API_BEGIN +namespace HBO { class CContext; } +struct SLinkGPUContext; +__PK_API_END + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +namespace SimInterfaces +{ + bool Bind_ConstantBuffer(const RHI::PGpuBuffer &buffer, const SLinkGPUContext &context); + bool Bind_Texture(const RHI::PTexture &texture, const SLinkGPUContext &context); + bool Bind_Sampler(CStringId mangledName, const SLinkGPUContext &context); + + //---------------------------------------------------------------------------- + + // SI_GBuffer_ProjectToPosition(), SI_GBuffer_ProjectToNormal(), .. + bool BindGBufferSamplingSimInterfaces(const CString &coreLibPath, HBO::CContext *context = null); + void UnbindGBufferSamplingSimInterfaces(const CString &coreLibPath); +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/WindowContext/AWindowContext.cpp b/Samples/PK-SampleLib/WindowContext/AWindowContext.cpp new file mode 100644 index 00000000..b6d77a1d --- /dev/null +++ b/Samples/PK-SampleLib/WindowContext/AWindowContext.cpp @@ -0,0 +1,64 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "AWindowContext.h" + +#include "ProfilerRenderer.h" // PKSAMPLE_HAS_PROFILER_RENDERER + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +bool CAbstractWindowContext::ProcessEvents() +{ + if (m_Controller == null) + return true; + if (m_Controller->IsButtonPressed(CAbstractController::ButtonStart, true)) + return false; // We quit when start is pressed + +#if PKSAMPLE_HAS_PROFILER_RENDERER + if (m_Profiler != null) + { + if (m_Controller->IsButtonPressed(CAbstractController::ButtonGPadUp, true)) + m_Profiler->Enable(!m_Profiler->Enabled()); + if (m_Profiler->Enabled()) + { + if (m_Controller->IsButtonPressed(CAbstractController::ButtonGPadLeft, true)) + m_Profiler->SetPaused(!m_Profiler->IsPaused()); + } + } +#endif + return true; +} + +//---------------------------------------------------------------------------- + +void CAbstractWindowContext::RegisterProfiler(CProfilerRenderer *profiler) +{ + (void)profiler; +#if PKSAMPLE_HAS_PROFILER_RENDERER + m_Profiler = profiler; +#endif +} + +//---------------------------------------------------------------------------- + +const float CAbstractController::kDeadZone = 0.01f; + +//---------------------------------------------------------------------------- + +float CAbstractController::FilterDeadZone(float value) +{ + return PKAbs(value) > kDeadZone ? value : 0.f; +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/WindowContext/AWindowContext.h b/Samples/PK-SampleLib/WindowContext/AWindowContext.h new file mode 100644 index 00000000..5b954143 --- /dev/null +++ b/Samples/PK-SampleLib/WindowContext/AWindowContext.h @@ -0,0 +1,131 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CGizmo; +class CProfilerRenderer; + +enum ContextApi +{ + Context_Sdl, + Context_Offscreen, + Context_Orbis, + Context_Durango, + Context_Glfw, + Context_Gdk, + Context_UNKNOWN2, +}; + +//---------------------------------------------------------------------------- + +class CAbstractController +{ +public: + virtual ~CAbstractController() {} + + enum EControllerButton + { + ButtonStart, + // directional pad (Up/Down-Left/Right) + ButtonDPadUp, + ButtonDPadDown, + ButtonDPadLeft, + ButtonDPadRight, + // Gameplay pad (Y/A-X/B) (Triangle/Cross-Square/Circle) + ButtonGPadUp, + ButtonGPadDown, + ButtonGPadLeft, + ButtonGPadRight, + // Button/Trigger + ButtonL1, + ButtonL2, + ButtonL3, + ButtonR1, + ButtonR2, + ButtonR3, + __MaxButtons + }; + + virtual bool IsButtonPressed(EControllerButton button, bool onEventOnly) = 0; + virtual bool IsButtonReleased(EControllerButton button, bool onEventOnly) = 0; + + enum EControllerAxis + { + AxisLeftX, + AxisLeftY, + AxisRightX, + AxisRightY, + __MaxAxis + }; + + virtual float GetNormalizedAxis(EControllerAxis axis) = 0; + +protected: + static float FilterDeadZone(float value); + static const float kDeadZone; +}; + +//---------------------------------------------------------------------------- + + +class CAbstractWindowContext : public CRefCountedObject +{ +public: + CAbstractWindowContext(ContextApi ctxType) + : m_Controller(null) + , m_Context(ctxType) + , m_Profiler(null) + {} + + ~CAbstractWindowContext() {} + + virtual bool InitImgui(const RHI::PApiManager &manager) = 0; + virtual bool Init(RHI::EGraphicalApi api, const CString &title, bool allowHighDPI = false) = 0; + virtual bool Destroy() = 0; + virtual bool ProcessEvents(); // Process the window events + + virtual CBool3 GetMouseClick() const = 0; + virtual CInt2 GetMousePosition() const = 0; + + virtual void RegisterGizmo(CGizmo *gizmo) = 0; + virtual void RegisterProfiler(CProfilerRenderer *profiler); + + virtual bool HasWindowChanged() = 0; // returns true if the swap chain needs to be re-created + + virtual CUint2 GetWindowSize() const = 0; + // Implem those in case of high DPI: + virtual CUint2 GetDrawableSize() const { return GetWindowSize(); } + virtual float GetPixelRatio() const { return 1.0f; } + + virtual bool WindowHidden() const { return false; } + + ContextApi GetContextApi() const { return m_Context; } + + CAbstractController *m_Controller; + +private: + ContextApi m_Context; + +protected: + CProfilerRenderer *m_Profiler; + + typedef CAbstractWindowContext Super; +}; +PK_DECLARE_REFPTRCLASS(AbstractWindowContext); + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/WindowContext/OffscreenContext/OffscreenContext.cpp b/Samples/PK-SampleLib/WindowContext/OffscreenContext/OffscreenContext.cpp new file mode 100644 index 00000000..ef8a3053 --- /dev/null +++ b/Samples/PK-SampleLib/WindowContext/OffscreenContext/OffscreenContext.cpp @@ -0,0 +1,60 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "OffscreenContext.h" + +#define DEFAULT_WINDOW_WIDTH 800 +#define DEFAULT_WINDOW_HEIGHT 600 + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- +// +// COffscreenContext +// +//---------------------------------------------------------------------------- + +COffscreenContext::COffscreenContext() +: CAbstractWindowContext(Context_Offscreen) +, m_WindowSize(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT) +, m_PixelRatio(1.0f) +{ +} + +//---------------------------------------------------------------------------- + +bool COffscreenContext::InitImgui(const RHI::PApiManager &manager) +{ + (void)manager; + return true; +} + +//---------------------------------------------------------------------------- + +bool COffscreenContext::Init(RHI::EGraphicalApi api, const CString &title, bool allowHighDPI) +{ + (void)title; + (void)allowHighDPI; + m_UsedApi = api; + + return true; +} + +//---------------------------------------------------------------------------- + +bool COffscreenContext::ProcessEvents() +{ + return Super::ProcessEvents(); +} + +//---------------------------------------------------------------------------- + +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/WindowContext/OffscreenContext/OffscreenContext.h b/Samples/PK-SampleLib/WindowContext/OffscreenContext/OffscreenContext.h new file mode 100644 index 00000000..d7d25fab --- /dev/null +++ b/Samples/PK-SampleLib/WindowContext/OffscreenContext/OffscreenContext.h @@ -0,0 +1,55 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#include + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +// This class is mainly for PopcornFX internal purposes. It performs as a +// minimum windows context that is only necessary for offscreen rendering. +class COffscreenContext : public CAbstractWindowContext +{ +public: + COffscreenContext(); + ~COffscreenContext() {}; + + virtual bool InitImgui(const RHI::PApiManager &manager) override; + virtual bool Init(RHI::EGraphicalApi api, const CString &title, bool allowHighDPI = false) override; // Opens the context for the specified graphical Api + virtual bool Destroy() override { return true; }; + virtual bool ProcessEvents() override; + + virtual CBool3 GetMouseClick() const override { return CBool3(false); }; + virtual CInt2 GetMousePosition() const override { return CInt2::ZERO; }; + + virtual void RegisterGizmo(CGizmo *gizmo) override { (void)gizmo; }; + + virtual bool HasWindowChanged() override { return false; }; + + virtual CUint2 GetWindowSize() const override { return m_WindowSize; } + virtual CUint2 GetDrawableSize() const override { return m_WindowSize * m_PixelRatio; } + virtual float GetPixelRatio() const override { return m_PixelRatio; } + + virtual bool WindowHidden() const override { return false; }; + +private: + // Currently used API + RHI::EGraphicalApi m_UsedApi; + + CUint2 m_WindowSize; + float m_PixelRatio; // For high-dpi screens +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END diff --git a/Samples/PK-SampleLib/WindowContext/SdlContext/SdlContext.cpp b/Samples/PK-SampleLib/WindowContext/SdlContext/SdlContext.cpp new file mode 100644 index 00000000..310473ba --- /dev/null +++ b/Samples/PK-SampleLib/WindowContext/SdlContext/SdlContext.cpp @@ -0,0 +1,595 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" + +#include "SdlContext.h" + +#if (PK_BUILD_WITH_SDL != 0) + +#include "Gizmo.h" +#include "ProfilerRenderer.h" +#include "ImguiRhiImplem.h" + +#if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpragma-pack" +#endif // defined(PK_COMPILER_CLANG_CL) +#include +#if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic pop +#endif // defined(PK_COMPILER_CLANG_CL) + +#define DEFAULT_WINDOW_WIDTH 800 +#define DEFAULT_WINDOW_HEIGHT 600 + +#define PK_SDL_JOY_ID_INVALID -1 + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- +// +// CSdlController +// +//---------------------------------------------------------------------------- + +namespace +{ + + const u32 kSdlButtonValue[] = + { + SDL_CONTROLLER_BUTTON_START, + SDL_CONTROLLER_BUTTON_DPAD_UP, + SDL_CONTROLLER_BUTTON_DPAD_DOWN, + SDL_CONTROLLER_BUTTON_DPAD_LEFT, + SDL_CONTROLLER_BUTTON_DPAD_RIGHT, + SDL_CONTROLLER_BUTTON_Y, + SDL_CONTROLLER_BUTTON_A, + SDL_CONTROLLER_BUTTON_X, + SDL_CONTROLLER_BUTTON_B, + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, + SDL_CONTROLLER_BUTTON_MAX, + SDL_CONTROLLER_BUTTON_LEFTSTICK, + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, + SDL_CONTROLLER_BUTTON_MAX, + SDL_CONTROLLER_BUTTON_RIGHTSTICK + }; + PK_STATIC_ASSERT(PK_ARRAY_COUNT(kSdlButtonValue) == CSdlController::__MaxButtons); + + //---------------------------------------------------------------------------- + + CSdlController::EControllerButton GetControllerButtonFromSDLCode(Uint8 sdlCode) + { + CSdlController::EControllerButton button = CSdlController::ButtonStart; + while (button < CSdlController::__MaxButtons) + { + if (kSdlButtonValue[button] == sdlCode) + return button; + button = static_cast(button + 1); + } + return CSdlController::__MaxButtons; + } + + //---------------------------------------------------------------------------- + + const u32 kSdlAxisValue[] = + { + SDL_CONTROLLER_AXIS_LEFTX, + SDL_CONTROLLER_AXIS_LEFTY, + SDL_CONTROLLER_AXIS_RIGHTX, + SDL_CONTROLLER_AXIS_RIGHTY + }; + PK_STATIC_ASSERT(PK_ARRAY_COUNT(kSdlAxisValue) == CSdlController::__MaxAxis); + + //---------------------------------------------------------------------------- + + CSdlController::EControllerAxis GetControllerAxisFromSDLCode(Uint8 sdlCode) + { + CSdlController::EControllerAxis axis = CSdlController::AxisLeftX; + while (axis < CSdlController::__MaxAxis) + { + if (kSdlAxisValue[axis] == sdlCode) + return axis; + axis = static_cast(axis + 1); + } + return CSdlController::__MaxAxis; + } + +} + +//---------------------------------------------------------------------------- + +CSdlController::CSdlController() +: m_JoyID(PK_SDL_JOY_ID_INVALID) +{ + Mem::Clear(m_JoyData); + Mem::Clear(m_AxisData); +} + +//---------------------------------------------------------------------------- + +CSdlController::~CSdlController() +{ +} + +//---------------------------------------------------------------------------- + +void CSdlController::Init() +{ + if (SDL_NumJoysticks() <= 0) + return; + SDL_GameController *controller = SDL_GameControllerOpen(0); + if (controller == null) + return; + SDL_Joystick *joystick = SDL_GameControllerGetJoystick(controller); + if (joystick != null) + m_JoyID = SDL_JoystickInstanceID(joystick); +} + +//---------------------------------------------------------------------------- + +void CSdlController::UpdateUserIFN(SDL_JoystickID id) +{ + if (m_JoyID == PK_SDL_JOY_ID_INVALID) + { + SDL_GameController *controller = SDL_GameControllerFromInstanceID(id); + if (controller == null) + controller = SDL_GameControllerOpen(0); + if (controller == null) + return; + SDL_Joystick *joystick = SDL_GameControllerGetJoystick(controller); + if (joystick != null) + m_JoyID = SDL_JoystickInstanceID(joystick); + } +} + +//---------------------------------------------------------------------------- + +void CSdlController::Destroy() +{ + if (m_JoyID != PK_SDL_JOY_ID_INVALID) + { + SDL_GameController *controller = SDL_GameControllerFromInstanceID(m_JoyID); + if (controller != null) + SDL_GameControllerClose(controller); + } + m_JoyID = PK_SDL_JOY_ID_INVALID; + Mem::Clear(m_JoyData[0]); +} + +//---------------------------------------------------------------------------- + +void CSdlController::PreProcess() +{ + m_JoyData[1] = m_JoyData[0]; + SDL_GameControllerUpdate(); +} + +//---------------------------------------------------------------------------- + +void CSdlController::Process(const SDL_Event &ev) +{ + if (m_JoyID == PK_SDL_JOY_ID_INVALID || ev.cbutton.which != m_JoyID) + return; + + if (ev.type == SDL_CONTROLLERBUTTONUP || ev.type == SDL_CONTROLLERBUTTONDOWN) + { + EControllerButton button = GetControllerButtonFromSDLCode(ev.cbutton.button); + if (ev.cbutton.state == SDL_PRESSED) + m_JoyData[0] |= (1 << button); + else if (ev.cbutton.state == SDL_RELEASED) + m_JoyData[0] &= ~(1 << button); + } + + if (ev.type == SDL_CONTROLLERAXISMOTION) + { + if (ev.caxis.axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || + ev.caxis.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) + { + EControllerButton button = (ev.caxis.axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT ? ButtonL2 : ButtonR2); + if (FilterDeadZone(ev.caxis.value) > 0) + m_JoyData[0] |= (1 << button); + else + m_JoyData[0] &= ~(1 << button); + } + else + { + EControllerAxis axis = GetControllerAxisFromSDLCode(ev.caxis.axis); + if (axis < __MaxAxis) + m_AxisData[axis] = float(ev.caxis.value) / float(TNumericTraits::Max()); + } + + } +} + +//---------------------------------------------------------------------------- + +bool CSdlController::IsButtonPressed(EControllerButton button, bool onEventOnly) +{ + bool pressed = (m_JoyData[0] & (1 << button)) != 0; + if (onEventOnly) + pressed &= (m_JoyData[1] & (1 << button)) == 0; + return pressed; +} + +//---------------------------------------------------------------------------- + +bool CSdlController::IsButtonReleased(EControllerButton button, bool onEventOnly) +{ + bool pressed = (m_JoyData[0] & (1 << button)) == 0; + if (onEventOnly) + pressed &= (m_JoyData[1] & (1 << button)) != 0; + return pressed; +} + +//---------------------------------------------------------------------------- + +float CSdlController::GetNormalizedAxis(EControllerAxis axis) +{ + if (axis >= __MaxAxis) + return 0; + return FilterDeadZone(m_AxisData[axis]); +} + +//---------------------------------------------------------------------------- +// +// CSdlContext +// +//---------------------------------------------------------------------------- + +CSdlContext::CSdlContext() +: CAbstractWindowContext(Context_Sdl) +, m_Gizmo(null) +{ + m_WindowHidden = false; + m_WindowChanged = false; + m_Controller = &m_SdlController; + m_WindowSize = CUint2::ZERO; + m_PixelRatio = 1.0f; +} + +//---------------------------------------------------------------------------- + +CSdlContext::~CSdlContext() +{ +} + +//---------------------------------------------------------------------------- + +bool CSdlContext::InitImgui(const RHI::PApiManager &manager) +{ + (void)manager; + ImGuiPkRHI::SImguiInit init; + + init.m_IsMultiThreaded = false; + init.m_KeyMap[ImGuiKey_Tab] = SDLK_TAB; + init.m_KeyMap[ImGuiKey_LeftArrow] = SDL_SCANCODE_LEFT; + init.m_KeyMap[ImGuiKey_RightArrow] = SDL_SCANCODE_RIGHT; + init.m_KeyMap[ImGuiKey_UpArrow] = SDL_SCANCODE_UP; + init.m_KeyMap[ImGuiKey_DownArrow] = SDL_SCANCODE_DOWN; + init.m_KeyMap[ImGuiKey_PageUp] = SDL_SCANCODE_PAGEUP; + init.m_KeyMap[ImGuiKey_PageDown] = SDL_SCANCODE_PAGEDOWN; + init.m_KeyMap[ImGuiKey_Home] = SDL_SCANCODE_HOME; + init.m_KeyMap[ImGuiKey_End] = SDL_SCANCODE_END; + init.m_KeyMap[ImGuiKey_Delete] = SDLK_DELETE; + init.m_KeyMap[ImGuiKey_Backspace] = SDLK_BACKSPACE; + init.m_KeyMap[ImGuiKey_Enter] = SDLK_RETURN; + init.m_KeyMap[ImGuiKey_Escape] = SDLK_ESCAPE; + init.m_KeyMap[ImGuiKey_A] = SDLK_a; + init.m_KeyMap[ImGuiKey_C] = SDLK_c; + init.m_KeyMap[ImGuiKey_V] = SDLK_v; + init.m_KeyMap[ImGuiKey_X] = SDLK_x; + init.m_KeyMap[ImGuiKey_Y] = SDLK_y; + init.m_KeyMap[ImGuiKey_Z] = SDLK_z; + if (!ImGuiPkRHI::Init(init)) + return false; + ImGuiPkRHI::CreateViewport(); +#ifdef PK_WINDOWS + SDL_SysWMinfo wmInfo; + + SDL_VERSION(&wmInfo.version); + SDL_GetWindowWMInfo(m_Window, &wmInfo); + ImGuiPkRHI::ChangeWindowHandle(wmInfo.info.win.window); +#endif + return true; +} + +//---------------------------------------------------------------------------- + +bool CSdlContext::Init(RHI::EGraphicalApi api, const CString &title, bool allowHighDPI) +{ +#if defined(PK_PRINT_SDL_VERSION) + SDL_version compiled; + SDL_version linked; + + SDL_VERSION(&compiled); + SDL_GetVersion(&linked); + + CLog::Log(PK_INFO, "We compiled against SDL version %d.%d.%d", compiled.major, compiled.minor, compiled.patch); + CLog::Log(PK_INFO, "We are linking against SDL version %d.%d.%d", linked.major, linked.minor, linked.patch); +#endif + + u32 sdlWindowFlags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; + + // For some reason, when using OpenGL we have to enable the SDL_WINDOW_ALLOW_HIGHDPI flag... + if (allowHighDPI || api == RHI::GApi_OpenGL || api == RHI::GApi_OES) + sdlWindowFlags |= SDL_WINDOW_ALLOW_HIGHDPI; + + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) < 0) + { + CLog::Log(PK_ERROR, "SDL_Init failed: %s", SDL_GetError()); + return false; + } + m_UsedApi = api; + if (m_UsedApi == RHI::GApi_OpenGL || m_UsedApi == RHI::GApi_OES) + sdlWindowFlags |= SDL_WINDOW_OPENGL; + m_Window = SDL_CreateWindow(title.Data(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT, + sdlWindowFlags); + if (m_Window == null) + { + CLog::Log(PK_ERROR, "SDL_CreateWindow failure"); + return false; + } + UpdateContextSize(); + m_SdlController.Init(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CSdlContext::HasWindowChanged() +{ + return m_WindowChanged; +} + +//---------------------------------------------------------------------------- + +bool CSdlContext::Destroy() +{ + ImGuiPkRHI::ReleaseViewport(); + PKSample::ImGuiPkRHI::QuitIFN(); + SDL_DestroyWindow(m_Window); + SDL_Quit(); + return true; +} + +//---------------------------------------------------------------------------- + +bool CSdlContext::ProcessEvents() +{ + SDL_Event event; +#if PKSAMPLE_HAS_PROFILER_RENDERER + CUint2 windowSize = GetDrawableSize(); +#endif + + m_WindowChanged = false; + m_SdlController.PreProcess(); + while (SDL_PollEvent(&event)) + { + // Controller event + if (event.type == SDL_CONTROLLERDEVICEADDED || event.type == SDL_CONTROLLERDEVICEREMAPPED) + m_SdlController.UpdateUserIFN(event.cdevice.which); + else if (event.type == SDL_CONTROLLERDEVICEREMOVED && event.cdevice.which == m_SdlController.GetJoystickID()) + m_SdlController.Destroy(); + else if ((event.type & SDL_CONTROLLERAXISMOTION) == SDL_CONTROLLERAXISMOTION) // all controller event + m_SdlController.Process(event); + + // Imgui event + if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) + { + int key = event.key.keysym.sym & ~SDLK_SCANCODE_MASK; + int modifiers = 0; + + modifiers |= ((SDL_GetModState() & KMOD_SHIFT) != 0) ? ImGuiPkRHI::Modifier_Shift : 0; + modifiers |= ((SDL_GetModState() & KMOD_CTRL) != 0) ? ImGuiPkRHI::Modifier_Ctrl : 0; + modifiers |= ((SDL_GetModState() & KMOD_ALT) != 0) ? ImGuiPkRHI::Modifier_Alt : 0; + modifiers |= ((SDL_GetModState() & KMOD_GUI) != 0) ? ImGuiPkRHI::Modifier_Super : 0; + ImGuiPkRHI::KeyEvents(event.type == SDL_KEYDOWN, key, modifiers); + } + else if (event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_MOUSEBUTTONUP) + { + int mouseButtons = 0; + + mouseButtons |= (event.button.button == SDL_BUTTON_LEFT) ? ImGuiPkRHI::MouseButton_Left : 0; + mouseButtons |= (event.button.button == SDL_BUTTON_MIDDLE) ? ImGuiPkRHI::MouseButton_Middle : 0; + mouseButtons |= (event.button.button == SDL_BUTTON_RIGHT) ? ImGuiPkRHI::MouseButton_Right : 0; + ImGuiPkRHI::MouseButtonEvents(event.type == SDL_MOUSEBUTTONDOWN, mouseButtons); + } + else if (event.type == SDL_TEXTINPUT) + { + ImGuiPkRHI::TextInput(event.text.text); + } + else if (event.type == SDL_MOUSEWHEEL) + { + ImGuiPkRHI::MouseWheel(event.wheel.y); + } + else if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) + { + ImGuiPkRHI::WindowLostFocus(); + } + + // Gizmo key events + if (m_Gizmo != null) + { + if (event.type == SDL_KEYUP) + { + if (event.key.keysym.sym == SDLK_q) + m_Gizmo->Disable(); + else if (event.key.keysym.sym == SDLK_w) + m_Gizmo->SetMode(GizmoTranslating); + else if (event.key.keysym.sym == SDLK_e) + m_Gizmo->SetMode(GizmoRotating); + else if (event.key.keysym.sym == SDLK_r) + m_Gizmo->SetMode(GizmoScaling); + } + else if (event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_MOUSEBUTTONUP) + { + if (event.button.button == SDL_BUTTON_LEFT) + { + m_Gizmo->SetMouseClicked(GetMousePosition() * GetPixelRatio(), event.type == SDL_MOUSEBUTTONDOWN); + } + } + } + +#if PKSAMPLE_HAS_PROFILER_RENDERER + // Profiler key events + if (m_Profiler != null) + { + if (event.type == SDL_KEYUP) + { + switch (event.key.keysym.sym) + { + case SDLK_i: // up + if (m_Profiler->Enabled()) + m_Profiler->Zoom(1.0f, windowSize); + break; + case SDLK_k: // down + if (m_Profiler->Enabled()) + m_Profiler->Zoom(-1.0f, windowSize); + break; + case SDLK_l: // right + if (m_Profiler->Enabled()) + m_Profiler->Offset(1.0f); + break; + case SDLK_j: // left + if (m_Profiler->Enabled()) + m_Profiler->Offset(-1.0f); + break; + case SDLK_v: + m_Profiler->Enable(!m_Profiler->Enabled()); + break; + case SDLK_b: + m_Profiler->SetPaused(!m_Profiler->IsPaused()); + break; + case SDLK_u: + if (m_Profiler->Enabled()) + m_Profiler->SetCurrentHistoryFrame(m_Profiler->CurrentHistoryFrame() + 1); + break; + case SDLK_o: + if (m_Profiler->Enabled()) + m_Profiler->SetCurrentHistoryFrame(m_Profiler->CurrentHistoryFrame() - 1); + break; + case SDLK_y: + if (m_Profiler->Enabled()) + m_Profiler->VerticalOffset(-1.0f); + break; + case SDLK_h: + if (m_Profiler->Enabled()) + m_Profiler->VerticalOffset(1.0f); + break; + } + } + } +#endif // PKSAMPLE_HAS_PROFILER_RENDERER + + // Window events + if (event.type == SDL_QUIT) + { + return false; + } + if (event.type == SDL_WINDOWEVENT) + { + if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) + m_WindowChanged = true; + else if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) + m_WindowHidden = true; + else if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) + m_WindowHidden = false; + } + } + + if (m_WindowChanged) + { + UpdateContextSize(); + } + + ImGuiPkRHI::MouseMoved(GetMousePosition()); // IMGUI handles the pixel ratio internally + ImGuiPkRHI::UpdateInputs(); + if (m_Gizmo != null) + { + m_Gizmo->SetMouseMoved(GetMousePosition() * GetPixelRatio()); + } + + return Super::ProcessEvents(); +} + +//---------------------------------------------------------------------------- + +CBool3 CSdlContext::GetMouseClick() const +{ + const u32 mstate = SDL_GetMouseState(null, null); + return CBool3( (mstate & SDL_BUTTON(SDL_BUTTON_LEFT)) != 0, + (mstate & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0, + (mstate & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0); +} + +//---------------------------------------------------------------------------- + +CInt2 CSdlContext::GetMousePosition() const +{ + CInt2 mousePos = CInt2::ZERO; + SDL_GetMouseState(&mousePos.x(), &mousePos.y()); + return mousePos; +} + +//---------------------------------------------------------------------------- + +void CSdlContext::RegisterGizmo(CGizmo *gizmo) +{ + m_Gizmo = gizmo; +} + +//---------------------------------------------------------------------------- + +bool CSdlContext::WindowHidden() const +{ + return m_WindowHidden; +} + +//---------------------------------------------------------------------------- + +SDL_Window *CSdlContext::SdlGetWindow() const +{ + return m_Window; +} + +//---------------------------------------------------------------------------- + +void CSdlContext::UpdateContextSize() +{ + CInt2 size; + SDL_GetWindowSize(m_Window, &size.x(), &size.y()); + PK_ASSERT(size.x() >= 0 && size.y() >= 0); + m_WindowSize = CUint2(size); + SDL_GL_GetDrawableSize(m_Window, &size.x(), &size.y()); + m_PixelRatio = static_cast(size.x()) / static_cast(m_WindowSize.x()); +} + +//---------------------------------------------------------------------------- + +void CSdlContext::CheckSDLError(int line) +{ + (void)line; +#if defined(PK_DEBUG) + const char *error = SDL_GetError(); + if (*error != '\0') + { + printf("SDL Error: %s\n", error); + if (line != -1) + printf(" + line: %i\n", line); + SDL_ClearError(); + } +#endif +} + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif diff --git a/Samples/PK-SampleLib/WindowContext/SdlContext/SdlContext.h b/Samples/PK-SampleLib/WindowContext/SdlContext/SdlContext.h new file mode 100644 index 00000000..d4b4e169 --- /dev/null +++ b/Samples/PK-SampleLib/WindowContext/SdlContext/SdlContext.h @@ -0,0 +1,125 @@ +#pragma once + +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include + +#include + +#if (PK_BUILD_WITH_SDL != 0) + +#if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpragma-pack" +# pragma clang diagnostic ignored "-Wmacro-redefined" // SDL_cpuinfo.h define __SSE__, __SSE2__ +#endif // defined(PK_COMPILER_CLANG_CL) + +#include + +#if defined(PK_COMPILER_CLANG_CL) +# pragma clang diagnostic pop +#endif // defined(PK_COMPILER_CLANG_CL) + +#undef main + +__PK_SAMPLE_API_BEGIN +//---------------------------------------------------------------------------- + +class CProfilerRenderer; + +struct SOpenGLContext +{ + SDL_GLContext m_Context; +}; + +//---------------------------------------------------------------------------- + +class CSdlController : public CAbstractController +{ +public: + CSdlController(); + virtual ~CSdlController(); + + void Init(); + void UpdateUserIFN(SDL_JoystickID id); + void Destroy(); + + void PreProcess(); + void Process(const SDL_Event &event); + + bool IsButtonPressed(EControllerButton button, bool onEventOnly) override; + bool IsButtonReleased(EControllerButton button, bool onEventOnly) override; + + float GetNormalizedAxis(EControllerAxis axis) override; + + SDL_JoystickID GetJoystickID() const { return m_JoyID; } + +private: + u32 m_JoyData[2]; + float m_AxisData[__MaxAxis]; + SDL_JoystickID m_JoyID; +}; + +//---------------------------------------------------------------------------- + +class CSdlContext : public CAbstractWindowContext +{ +public: + CSdlContext(); + ~CSdlContext(); + + virtual bool InitImgui(const RHI::PApiManager &manager) override; + virtual bool Init(RHI::EGraphicalApi api, const CString &title, bool allowHighDPI = false) override; // Opens the context for the specified graphical Api + virtual bool Destroy() override; + virtual bool ProcessEvents() override; + + virtual CBool3 GetMouseClick() const override; + virtual CInt2 GetMousePosition() const override; + + virtual void RegisterGizmo(CGizmo *gizmo) override; + + virtual bool HasWindowChanged() override; // returns true if the swap chain needs to be re-created (window resizing for example) + + virtual CUint2 GetWindowSize() const override { return m_WindowSize; } + virtual CUint2 GetDrawableSize() const override { return m_WindowSize * m_PixelRatio; } + virtual float GetPixelRatio() const override { return m_PixelRatio; } + + virtual bool WindowHidden() const override; + + SDL_Window *SdlGetWindow() const; + + void UpdateContextSize(); + + bool HasHighDPI() const { return m_PixelRatio != 1.0f; } + +private: + void CheckSDLError(int line); + + bool m_WindowHidden; + // Does the context needs a new swap chain? + bool m_WindowChanged; + // Currently used API + RHI::EGraphicalApi m_UsedApi; + // SDL Windows + SDL_Window *m_Window; + + CGizmo *m_Gizmo; + + CSdlController m_SdlController; + + CUint2 m_WindowSize; + float m_PixelRatio; // For high-dpi screens +}; + +//---------------------------------------------------------------------------- +__PK_SAMPLE_API_END + +#endif // (PK_BUILD_WITH_SDL != 0) diff --git a/Samples/PK-SampleLib/bin/mcpp.exe b/Samples/PK-SampleLib/bin/mcpp.exe new file mode 100644 index 00000000..c8491cd3 --- /dev/null +++ b/Samples/PK-SampleLib/bin/mcpp.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:149fcbe03c54b5aa7ef9e925ba0a0d9f99c88cce9a3685aa1cb96849ce25003c +size 150528 diff --git a/Samples/precompiled/precompiled.cpp b/Samples/precompiled/precompiled.cpp new file mode 100644 index 00000000..c284f549 --- /dev/null +++ b/Samples/precompiled/precompiled.cpp @@ -0,0 +1,11 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#include "precompiled.h" diff --git a/Samples/precompiled/precompiled.h b/Samples/precompiled/precompiled.h new file mode 100644 index 00000000..7b22a7bd --- /dev/null +++ b/Samples/precompiled/precompiled.h @@ -0,0 +1,58 @@ +//---------------------------------------------------------------------------- +// This program is the property of Persistant Studios SARL. +// +// You may not redistribute it and/or modify it under any conditions +// without written permission from Persistant Studios SARL, unless +// otherwise stated in the latest Persistant Studios Code License. +// +// See the Persistant Studios Code License for further details. +//---------------------------------------------------------------------------- + +#undef PK_LIBRARY_NAME +#undef PV_MODULE_NAME +#undef PV_MODULE_SYM +#define PK_LIBRARY_NAME "PK-Sample" +#define PV_MODULE_NAME "PKSample" +#define PV_MODULE_SYM PKSample + +#include + +PK_LOG_MODULE_DEFINE(); + +#if defined(PK_LINUX) || defined(PK_ORBIS) || defined(PK_UNKNOWN2) || defined(PK_NX) || defined(PK_MACOSX) || defined(PK_IOS) +# include +#endif // defined(PK_LINUX) || defined(PK_ORBIS) || defined(PK_UNKNOWN2) || defined(PK_NX) || defined(PK_MACOSX) || defined(PK_IOS) + +#if defined(PK_ANDROID) || defined(PK_NX) || defined(PK_IOS) +# include +#endif // defined(PK_ANDROID) || defined(PK_NX) || defined(PK_IOS) + +// Define which api we are going to use by default +#if defined(PK_ORBIS) +# define DEFAULT_API GApi_Orbis +#elif defined(PK_UNKNOWN2) +# define DEFAULT_API GApi_UNKNOWN2 +#elif defined(PK_DURANGO) +# if defined(PK_GDK) +# define DEFAULT_API GApi_D3D12 +# else +# define DEFAULT_API GApi_D3D11 +# endif +#elif defined(PK_SCARLETT) +# define DEFAULT_API GApi_D3D12 +#elif defined(PK_WINDOWS) +//# define DEFAULT_API GApi_Null +//# define DEFAULT_API GApi_Vulkan +//# define DEFAULT_API GApi_OpenGL +//# define DEFAULT_API GApi_D3D12 +# define DEFAULT_API GApi_D3D11 +#elif defined(PK_MACOSX) +//# define DEFAULT_API GApi_Vulkan +//# define DEFAULT_API GApi_OpenGL +# define DEFAULT_API GApi_Metal +#elif defined(PK_GGP) +# define DEFAULT_API GApi_Vulkan +#else +//# define DEFAULT_API GApi_Vulkan +# define DEFAULT_API GApi_OpenGL +#endif diff --git a/download_3rd_party.bat b/download_3rd_party.bat new file mode 100644 index 00000000..4c148443 --- /dev/null +++ b/download_3rd_party.bat @@ -0,0 +1,40 @@ +@echo off + +echo "---------- Download PopcornFX After Effects plugin 3rd party libraries ----------" + +setlocal +set OPEN_SOURCE_AE_REPO_PATH=%~dp0 + +bitsadmin /reset +bitsadmin /create third_party_download +bitsadmin /addfile third_party_download http://downloads.popcornfx.com/Plugins/ExternalLibs/ExternalLibs_AfterEffects_2.19.1-20726_x64_vs2019_macosx.zip "%OPEN_SOURCE_AE_REPO_PATH%ExternalLibs.zip" +bitsadmin /setpriority third_party_download "FOREGROUND" +bitsadmin /resume third_party_download + +:WAIT_FOR_DOWNLOAD_LOOP_START + call bitsadmin /info third_party_download /verbose | find "STATE: TRANSFERRED" + if %ERRORLEVEL% equ 0 goto WAIT_FOR_DOWNLOAD_LOOP_END + call bitsadmin /RawReturn /GetBytesTransferred third_party_download + echo Bytes transferred + timeout 2 > nul + goto WAIT_FOR_DOWNLOAD_LOOP_START +:WAIT_FOR_DOWNLOAD_LOOP_END + +bitsadmin /complete third_party_download + +echo "---------- Download complete ----------" +echo "---------- Cleaning %OPEN_SOURCE_AE_REPO_PATH%ExternalLibs ----------" + +rmdir /s /q "%OPEN_SOURCE_AE_REPO_PATH%ExternalLibs" + +echo "---------- Unzipping %OPEN_SOURCE_AE_REPO_PATH%ExternalLibs.zip ----------" + +powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%OPEN_SOURCE_AE_REPO_PATH%ExternalLibs.zip', '%OPEN_SOURCE_AE_REPO_PATH%'); }" + +echo "---------- Removing %OPEN_SOURCE_AE_REPO_PATH%ExternalLibs.zip ----------" + +del /f "%OPEN_SOURCE_AE_REPO_PATH%ExternalLibs.zip" + +echo "---------- Finished ----------" + +endlocal diff --git a/download_3rd_party.sh b/download_3rd_party.sh new file mode 100644 index 00000000..97bdff3b --- /dev/null +++ b/download_3rd_party.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +SCRIPT_PATH=$(readlink -f "$0") +OPEN_SOURCE_AE_REPO_PATH=$(dirname "$SCRIPT_PATH") + +rm -rf "$OPEN_SOURCE_AE_REPO_PATH/ExternalLibs" +wget "http://downloads.popcornfx.com/Plugins/ExternalLibs/ExternalLibs_AfterEffects_2.19.1-20726_x64_vs2019_macosx.zip" -o "$OPEN_SOURCE_AE_REPO_PATH/ExternalLibs.zip" +unzip "$OPEN_SOURCE_AE_REPO_PATH/ExternalLibs.zip" +rm -f "$OPEN_SOURCE_AE_REPO_PATH/ExternalLibs.zip" diff --git a/projects/AfterEffects_macosx/AE_Effect_Attribute.make b/projects/AfterEffects_macosx/AE_Effect_Attribute.make new file mode 100644 index 00000000..0ceb8127 --- /dev/null +++ b/projects/AfterEffects_macosx/AE_Effect_Attribute.make @@ -0,0 +1,199 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs -I../../AE_Effect_Attribute/Sources -I../../AE_Effect_Attribute/Include -I../../AE_Effect_Attribute/Precompiled -I../../AE_Suites -I"../../External/AE SDK/Resources" -I"../../External/AE SDK/Headers" -I"../../External/AE SDK/Util" -I"../../External/AE SDK/Headers/SP" -I"../../External/AE SDK/Headers/adobesdk" -I"../../External/AE SDK/Headers/SP/artemis" -I"../../External/AE SDK/Headers/SP/photoshop" -I"../../External/AE SDK/Headers/SP/artemis/config" -I"../../External/AE SDK/Headers/SP/photoshop/config" -I"../../External/AE SDK/Headers/adobesdk/config" -I"../../External/AE SDK/Headers/adobesdk/drawbotsuite" +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += -framework quartzcore -framework cocoa -framework metal -liconv -lm -lpthread -ldl +LDDEPS += +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_x64 +TARGET = $(TARGETDIR)/libAE_Effect_Attribute_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/AE_Effect_Attribute +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DUSE_POSIX_API=1 -D__MWERKS__=0 -DA_INTERNAL_TEST_ONE=0 -DWEB_ENV=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -std=c++14 -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_LDFLAGS += $(LDFLAGS) -m64 -dynamiclib -Wl,-install_name,@rpath/libAE_Effect_Attribute_d -Wl,-undefined,error -target x86_64-apple-macos10.14 -framework OpenGL + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_x64 +TARGET = $(TARGETDIR)/libAE_Effect_Attribute_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/AE_Effect_Attribute +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DUSE_POSIX_API=1 -D__MWERKS__=0 -DA_INTERNAL_TEST_ONE=0 -DWEB_ENV=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -O3 -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -O3 -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -std=c++14 -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_LDFLAGS += $(LDFLAGS) -m64 -dynamiclib -Wl,-install_name,@rpath/libAE_Effect_Attribute_r -Wl,-undefined,error -target x86_64-apple-macos10.14 -framework OpenGL + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + +PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -fdeclspec -x objective-c++ + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AEAttribute_Main.o +GENERATED += $(OBJDIR)/AEAttribute_ParamDefine.o +GENERATED += $(OBJDIR)/AEAttribute_PluginInterface.o +GENERATED += $(OBJDIR)/AEAttribute_SequenceData.o +GENERATED += $(OBJDIR)/AEFX_ArbParseHelper.o +GENERATED += $(OBJDIR)/AEFX_SuiteHelper.o +GENERATED += $(OBJDIR)/AEGP_SuiteHandler.o +GENERATED += $(OBJDIR)/AEGP_Utils.o +GENERATED += $(OBJDIR)/MissingSuiteError.o +GENERATED += $(OBJDIR)/Smart_Utils.o +GENERATED += $(OBJDIR)/ae_precompiled.o +OBJECTS += $(OBJDIR)/AEAttribute_Main.o +OBJECTS += $(OBJDIR)/AEAttribute_ParamDefine.o +OBJECTS += $(OBJDIR)/AEAttribute_PluginInterface.o +OBJECTS += $(OBJDIR)/AEAttribute_SequenceData.o +OBJECTS += $(OBJDIR)/AEFX_ArbParseHelper.o +OBJECTS += $(OBJDIR)/AEFX_SuiteHelper.o +OBJECTS += $(OBJDIR)/AEGP_SuiteHandler.o +OBJECTS += $(OBJDIR)/AEGP_Utils.o +OBJECTS += $(OBJDIR)/MissingSuiteError.o +OBJECTS += $(OBJDIR)/Smart_Utils.o +OBJECTS += $(OBJDIR)/ae_precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking AE_Effect_Attribute + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning AE_Effect_Attribute +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/AEFX_ArbParseHelper.o: ../../External/AE\ SDK/Util/AEFX_ArbParseHelper.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEFX_SuiteHelper.o: ../../External/AE\ SDK/Util/AEFX_SuiteHelper.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_SuiteHandler.o: ../../External/AE\ SDK/Util/AEGP_SuiteHandler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_Utils.o: ../../External/AE\ SDK/Util/AEGP_Utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MissingSuiteError.o: ../../External/AE\ SDK/Util/MissingSuiteError.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Smart_Utils.o: ../../External/AE\ SDK/Util/Smart_Utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ae_precompiled.o: ../../AE_Effect_Attribute/Precompiled/ae_precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEAttribute_Main.o: ../../AE_Effect_Attribute/Sources/AEAttribute_Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEAttribute_ParamDefine.o: ../../AE_Effect_Attribute/Sources/AEAttribute_ParamDefine.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEAttribute_PluginInterface.o: ../../AE_Effect_Attribute/Sources/AEAttribute_PluginInterface.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEAttribute_SequenceData.o: ../../AE_Effect_Attribute/Sources/AEAttribute_SequenceData.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/AE_Effect_AttributeSampler.make b/projects/AfterEffects_macosx/AE_Effect_AttributeSampler.make new file mode 100644 index 00000000..615549af --- /dev/null +++ b/projects/AfterEffects_macosx/AE_Effect_AttributeSampler.make @@ -0,0 +1,199 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs -I../../AE_Effect_AttributeSampler/Sources -I../../AE_Effect_AttributeSampler/Include -I../../AE_Effect_AttributeSampler/Precompiled -I../../AE_Suites -I"../../External/AE SDK/Resources" -I"../../External/AE SDK/Headers" -I"../../External/AE SDK/Util" -I"../../External/AE SDK/Headers/SP" -I"../../External/AE SDK/Headers/adobesdk" -I"../../External/AE SDK/Headers/SP/artemis" -I"../../External/AE SDK/Headers/SP/photoshop" -I"../../External/AE SDK/Headers/SP/artemis/config" -I"../../External/AE SDK/Headers/SP/photoshop/config" -I"../../External/AE SDK/Headers/adobesdk/config" -I"../../External/AE SDK/Headers/adobesdk/drawbotsuite" +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += -framework quartzcore -framework cocoa -framework metal -liconv -lm -lpthread -ldl +LDDEPS += +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_x64 +TARGET = $(TARGETDIR)/libAE_Effect_AttributeSampler_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/AE_Effect_AttributeSampler +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DUSE_POSIX_API=1 -D__MWERKS__=0 -DA_INTERNAL_TEST_ONE=0 -DWEB_ENV=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -std=c++14 -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_LDFLAGS += $(LDFLAGS) -m64 -dynamiclib -Wl,-install_name,@rpath/libAE_Effect_AttributeSampler_d -Wl,-undefined,error -target x86_64-apple-macos10.14 -framework OpenGL + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_x64 +TARGET = $(TARGETDIR)/libAE_Effect_AttributeSampler_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/AE_Effect_AttributeSampler +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DUSE_POSIX_API=1 -D__MWERKS__=0 -DA_INTERNAL_TEST_ONE=0 -DWEB_ENV=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -O3 -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -O3 -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -std=c++14 -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_LDFLAGS += $(LDFLAGS) -m64 -dynamiclib -Wl,-install_name,@rpath/libAE_Effect_AttributeSampler_r -Wl,-undefined,error -target x86_64-apple-macos10.14 -framework OpenGL + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + +PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -fdeclspec -x objective-c++ + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AEAttributeSampler_Main.o +GENERATED += $(OBJDIR)/AEAttributeSampler_ParamDefine.o +GENERATED += $(OBJDIR)/AEAttributeSampler_PluginInterface.o +GENERATED += $(OBJDIR)/AEAttributeSampler_SequenceData.o +GENERATED += $(OBJDIR)/AEFX_ArbParseHelper.o +GENERATED += $(OBJDIR)/AEFX_SuiteHelper.o +GENERATED += $(OBJDIR)/AEGP_SuiteHandler.o +GENERATED += $(OBJDIR)/AEGP_Utils.o +GENERATED += $(OBJDIR)/MissingSuiteError.o +GENERATED += $(OBJDIR)/Smart_Utils.o +GENERATED += $(OBJDIR)/ae_precompiled.o +OBJECTS += $(OBJDIR)/AEAttributeSampler_Main.o +OBJECTS += $(OBJDIR)/AEAttributeSampler_ParamDefine.o +OBJECTS += $(OBJDIR)/AEAttributeSampler_PluginInterface.o +OBJECTS += $(OBJDIR)/AEAttributeSampler_SequenceData.o +OBJECTS += $(OBJDIR)/AEFX_ArbParseHelper.o +OBJECTS += $(OBJDIR)/AEFX_SuiteHelper.o +OBJECTS += $(OBJDIR)/AEGP_SuiteHandler.o +OBJECTS += $(OBJDIR)/AEGP_Utils.o +OBJECTS += $(OBJDIR)/MissingSuiteError.o +OBJECTS += $(OBJDIR)/Smart_Utils.o +OBJECTS += $(OBJDIR)/ae_precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking AE_Effect_AttributeSampler + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning AE_Effect_AttributeSampler +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/AEFX_ArbParseHelper.o: ../../External/AE\ SDK/Util/AEFX_ArbParseHelper.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEFX_SuiteHelper.o: ../../External/AE\ SDK/Util/AEFX_SuiteHelper.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_SuiteHandler.o: ../../External/AE\ SDK/Util/AEGP_SuiteHandler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_Utils.o: ../../External/AE\ SDK/Util/AEGP_Utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MissingSuiteError.o: ../../External/AE\ SDK/Util/MissingSuiteError.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Smart_Utils.o: ../../External/AE\ SDK/Util/Smart_Utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ae_precompiled.o: ../../AE_Effect_AttributeSampler/Precompiled/ae_precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEAttributeSampler_Main.o: ../../AE_Effect_AttributeSampler/Sources/AEAttributeSampler_Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEAttributeSampler_ParamDefine.o: ../../AE_Effect_AttributeSampler/Sources/AEAttributeSampler_ParamDefine.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEAttributeSampler_PluginInterface.o: ../../AE_Effect_AttributeSampler/Sources/AEAttributeSampler_PluginInterface.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEAttributeSampler_SequenceData.o: ../../AE_Effect_AttributeSampler/Sources/AEAttributeSampler_SequenceData.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/AE_Effect_Emitter.make b/projects/AfterEffects_macosx/AE_Effect_Emitter.make new file mode 100644 index 00000000..6cc2fe41 --- /dev/null +++ b/projects/AfterEffects_macosx/AE_Effect_Emitter.make @@ -0,0 +1,199 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs -I../../AE_Effect_Emitter/Sources -I../../AE_Effect_Emitter/Include -I../../AE_Effect_Emitter/Precompiled -I../../AE_Suites -I"../../External/AE SDK/Resources" -I"../../External/AE SDK/Headers" -I"../../External/AE SDK/Util" -I"../../External/AE SDK/Headers/SP" -I"../../External/AE SDK/Headers/adobesdk" -I"../../External/AE SDK/Headers/SP/artemis" -I"../../External/AE SDK/Headers/SP/photoshop" -I"../../External/AE SDK/Headers/SP/artemis/config" -I"../../External/AE SDK/Headers/SP/photoshop/config" -I"../../External/AE SDK/Headers/adobesdk/config" -I"../../External/AE SDK/Headers/adobesdk/drawbotsuite" +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += -framework quartzcore -framework cocoa -framework metal -liconv -lm -lpthread -ldl +LDDEPS += +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_x64 +TARGET = $(TARGETDIR)/libAE_Effect_Emitter_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/AE_Effect_Emitter +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DUSE_POSIX_API=1 -D__MWERKS__=0 -DA_INTERNAL_TEST_ONE=0 -DWEB_ENV=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -std=c++14 -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_LDFLAGS += $(LDFLAGS) -m64 -dynamiclib -Wl,-install_name,@rpath/libAE_Effect_Emitter_d -Wl,-undefined,error -target x86_64-apple-macos10.14 -framework OpenGL + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_x64 +TARGET = $(TARGETDIR)/libAE_Effect_Emitter_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/AE_Effect_Emitter +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DUSE_POSIX_API=1 -D__MWERKS__=0 -DA_INTERNAL_TEST_ONE=0 -DWEB_ENV=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -O3 -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -O3 -fPIC -fno-strict-aliasing -msse2 -Wall -Wextra -std=c++14 -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_LDFLAGS += $(LDFLAGS) -m64 -dynamiclib -Wl,-install_name,@rpath/libAE_Effect_Emitter_r -Wl,-undefined,error -target x86_64-apple-macos10.14 -framework OpenGL + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + +PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -fdeclspec -x objective-c++ + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AEEffect_Main.o +GENERATED += $(OBJDIR)/AEEffect_ParamDefine.o +GENERATED += $(OBJDIR)/AEEffect_PluginInterface.o +GENERATED += $(OBJDIR)/AEEffect_SequenceData.o +GENERATED += $(OBJDIR)/AEFX_ArbParseHelper.o +GENERATED += $(OBJDIR)/AEFX_SuiteHelper.o +GENERATED += $(OBJDIR)/AEGP_SuiteHandler.o +GENERATED += $(OBJDIR)/AEGP_Utils.o +GENERATED += $(OBJDIR)/MissingSuiteError.o +GENERATED += $(OBJDIR)/Smart_Utils.o +GENERATED += $(OBJDIR)/ae_precompiled.o +OBJECTS += $(OBJDIR)/AEEffect_Main.o +OBJECTS += $(OBJDIR)/AEEffect_ParamDefine.o +OBJECTS += $(OBJDIR)/AEEffect_PluginInterface.o +OBJECTS += $(OBJDIR)/AEEffect_SequenceData.o +OBJECTS += $(OBJDIR)/AEFX_ArbParseHelper.o +OBJECTS += $(OBJDIR)/AEFX_SuiteHelper.o +OBJECTS += $(OBJDIR)/AEGP_SuiteHandler.o +OBJECTS += $(OBJDIR)/AEGP_Utils.o +OBJECTS += $(OBJDIR)/MissingSuiteError.o +OBJECTS += $(OBJDIR)/Smart_Utils.o +OBJECTS += $(OBJDIR)/ae_precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking AE_Effect_Emitter + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning AE_Effect_Emitter +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/AEFX_ArbParseHelper.o: ../../External/AE\ SDK/Util/AEFX_ArbParseHelper.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEFX_SuiteHelper.o: ../../External/AE\ SDK/Util/AEFX_SuiteHelper.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_SuiteHandler.o: ../../External/AE\ SDK/Util/AEGP_SuiteHandler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_Utils.o: ../../External/AE\ SDK/Util/AEGP_Utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MissingSuiteError.o: ../../External/AE\ SDK/Util/MissingSuiteError.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Smart_Utils.o: ../../External/AE\ SDK/Util/Smart_Utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ae_precompiled.o: ../../AE_Effect_Emitter/Precompiled/ae_precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEEffect_Main.o: ../../AE_Effect_Emitter/Sources/AEEffect_Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEEffect_ParamDefine.o: ../../AE_Effect_Emitter/Sources/AEEffect_ParamDefine.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEEffect_PluginInterface.o: ../../AE_Effect_Emitter/Sources/AEEffect_PluginInterface.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEEffect_SequenceData.o: ../../AE_Effect_Emitter/Sources/AEEffect_SequenceData.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/AE_GeneralPlugin.make b/projects/AfterEffects_macosx/AE_GeneralPlugin.make new file mode 100644 index 00000000..c9dae6b2 --- /dev/null +++ b/projects/AfterEffects_macosx/AE_GeneralPlugin.make @@ -0,0 +1,380 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +INCLUDES += -I../../AE_GeneralPlugin/Sources -I../../AE_GeneralPlugin/Include -I../../AE_GeneralPlugin/Precompiled -I../../AE_Suites -I"../../External/AE SDK/Resources" -I"../../External/AE SDK/Headers" -I"../../External/AE SDK/Util" -I"../../External/AE SDK/Headers/SP" -I"../../External/AE SDK/Headers/adobesdk" -I"../../External/AE SDK/Headers/SP/artemis" -I"../../External/AE SDK/Headers/SP/photoshop" -I"../../External/AE SDK/Headers/SP/artemis/config" -I"../../External/AE SDK/Headers/SP/photoshop/config" -I"../../External/AE SDK/Headers/adobesdk/config" -I"../../External/AE SDK/Headers/adobesdk/drawbotsuite" -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs -I../../Samples -I../../ExternalLibs/GL/include -I"$(QTDIR)/include" -I"$(QTDIR)/include/QtCore" -I"$(QTDIR)/include/QtWidgets" -I"$(QTDIR)/include/QtNetwork" -I"$(QTDIR)/include/QtXml" -I"$(QTDIR)/include/QtGui" +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_x64 +TARGET = $(TARGETDIR)/libAE_GeneralPlugin_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/AE_GeneralPlugin +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DUSE_POSIX_API=1 -D__MWERKS__=0 -DA_INTERNAL_TEST_ONE=0 -DWEB_ENV=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DPK_BUILD_WITH_D3D11_SUPPORT=0 -DPK_BUILD_WITH_D3D12_SUPPORT=0 -DQT_NO_KEYWORDS -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DMACOSX -DQT_CORE_LIB -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_XML_LIB -DQT_GUI_LIB +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fPIC -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fPIC -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=c++14 -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_d.a ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -framework Cocoa -liconv -lm -lpthread -ldl -lPK-RenderHelpers_d -lPK-RHI_d -lPK-Discretizers_d -lPK-MCPP_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_TIFF_d -lPK-Plugin_CodecImage_HDR_d -lPK-Plugin_CodecImage_EXR_d -lPK-Plugin_CodecMesh_FBX_d -lPK-ZLib_d -lfbxsdk_d -lxml2 -lz -lPK-ParticlesToolbox_d -lPK-Runtime_d -lQt5Core -lQt5Widgets -lQt5Network -lQt5Xml -lQt5Gui +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_d.a ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/CodecMesh_FBX/libs/macosx/legacy_clang -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -L"$(QTDIR)/lib" -m64 -dynamiclib -Wl,-install_name,@rpath/libAE_GeneralPlugin_macosx_d -Wl,-undefined,error -target x86_64-apple-macos10.14 -framework OpenGL -Wl,-rpath,$(QTDIR)/lib + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_x64 +TARGET = $(TARGETDIR)/libAE_GeneralPlugin_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/AE_GeneralPlugin +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DUSE_POSIX_API=1 -D__MWERKS__=0 -DA_INTERNAL_TEST_ONE=0 -DWEB_ENV=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DPK_BUILD_WITH_D3D11_SUPPORT=0 -DPK_BUILD_WITH_D3D12_SUPPORT=0 -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DMACOSX -DQT_CORE_LIB -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_XML_LIB -DQT_GUI_LIB +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fPIC -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fPIC -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=c++14 -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_r.a ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -framework Cocoa -liconv -lm -lpthread -ldl -lPK-RenderHelpers_r -lPK-RHI_r -lPK-Discretizers_r -lPK-MCPP_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_TIFF_r -lPK-Plugin_CodecImage_HDR_r -lPK-Plugin_CodecImage_EXR_r -lPK-Plugin_CodecMesh_FBX_r -lPK-ZLib_r -lfbxsdk_r -lxml2 -lz -lPK-ParticlesToolbox_r -lPK-Runtime_r -lQt5Core -lQt5Widgets -lQt5Network -lQt5Xml -lQt5Gui +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_r.a ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/CodecMesh_FBX/libs/macosx/legacy_clang -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -L"$(QTDIR)/lib" -m64 -dynamiclib -Wl,-install_name,@rpath/libAE_GeneralPlugin_macosx_r -Wl,-undefined,error -target x86_64-apple-macos10.14 -framework OpenGL -Wl,-rpath,$(QTDIR)/lib + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + +PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -fdeclspec -x objective-c++ +PERFILE_FLAGS_1 = $(ALL_CXXFLAGS) -Wno-unguarded-availability-new -I$(OBJDIR) + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AEFX_ArbParseHelper.o +GENERATED += $(OBJDIR)/AEFX_SuiteHelper.o +GENERATED += $(OBJDIR)/AEGP_AEPKConversion.o +GENERATED += $(OBJDIR)/AEGP_AssetBaker.o +GENERATED += $(OBJDIR)/AEGP_Attribute.o +GENERATED += $(OBJDIR)/AEGP_BaseContext.o +GENERATED += $(OBJDIR)/AEGP_CopyPixels.o +GENERATED += $(OBJDIR)/AEGP_D3D11Context.o +GENERATED += $(OBJDIR)/AEGP_D3D12Context.o +GENERATED += $(OBJDIR)/AEGP_FileDialog.o +GENERATED += $(OBJDIR)/AEGP_FileDialogMac.o +GENERATED += $(OBJDIR)/AEGP_FileWatcher.o +GENERATED += $(OBJDIR)/AEGP_FrameCollector.o +GENERATED += $(OBJDIR)/AEGP_GraphicalResourcesTreeModel.o +GENERATED += $(OBJDIR)/AEGP_LayerHolder.o +GENERATED += $(OBJDIR)/AEGP_Log.o +GENERATED += $(OBJDIR)/AEGP_Main.o +GENERATED += $(OBJDIR)/AEGP_MetalContext.o +GENERATED += $(OBJDIR)/AEGP_PackExplorer.o +GENERATED += $(OBJDIR)/AEGP_PanelQT.o +GENERATED += $(OBJDIR)/AEGP_ParticleScene.o +GENERATED += $(OBJDIR)/AEGP_PopcornFXPlugins.o +GENERATED += $(OBJDIR)/AEGP_RenderContext.o +GENERATED += $(OBJDIR)/AEGP_Scene.o +GENERATED += $(OBJDIR)/AEGP_SkinnedMesh.o +GENERATED += $(OBJDIR)/AEGP_SkinnedMeshInstance.o +GENERATED += $(OBJDIR)/AEGP_SuiteHandler.o +GENERATED += $(OBJDIR)/AEGP_System.o +GENERATED += $(OBJDIR)/AEGP_UpdateAEState.o +GENERATED += $(OBJDIR)/AEGP_Utils.o +GENERATED += $(OBJDIR)/AEGP_VaultHandler.o +GENERATED += $(OBJDIR)/AEGP_WinFileDialog.o +GENERATED += $(OBJDIR)/AEGP_WinSystem.o +GENERATED += $(OBJDIR)/AEGP_World.o +GENERATED += $(OBJDIR)/MissingSuiteError.o +GENERATED += $(OBJDIR)/Smart_Utils.o +GENERATED += $(OBJDIR)/ae_precompiled.o +OBJECTS += $(OBJDIR)/AEFX_ArbParseHelper.o +OBJECTS += $(OBJDIR)/AEFX_SuiteHelper.o +OBJECTS += $(OBJDIR)/AEGP_AEPKConversion.o +OBJECTS += $(OBJDIR)/AEGP_AssetBaker.o +OBJECTS += $(OBJDIR)/AEGP_Attribute.o +OBJECTS += $(OBJDIR)/AEGP_BaseContext.o +OBJECTS += $(OBJDIR)/AEGP_CopyPixels.o +OBJECTS += $(OBJDIR)/AEGP_D3D11Context.o +OBJECTS += $(OBJDIR)/AEGP_D3D12Context.o +OBJECTS += $(OBJDIR)/AEGP_FileDialog.o +OBJECTS += $(OBJDIR)/AEGP_FileDialogMac.o +OBJECTS += $(OBJDIR)/AEGP_FileWatcher.o +OBJECTS += $(OBJDIR)/AEGP_FrameCollector.o +OBJECTS += $(OBJDIR)/AEGP_GraphicalResourcesTreeModel.o +OBJECTS += $(OBJDIR)/AEGP_LayerHolder.o +OBJECTS += $(OBJDIR)/AEGP_Log.o +OBJECTS += $(OBJDIR)/AEGP_Main.o +OBJECTS += $(OBJDIR)/AEGP_MetalContext.o +OBJECTS += $(OBJDIR)/AEGP_PackExplorer.o +OBJECTS += $(OBJDIR)/AEGP_PanelQT.o +OBJECTS += $(OBJDIR)/AEGP_ParticleScene.o +OBJECTS += $(OBJDIR)/AEGP_PopcornFXPlugins.o +OBJECTS += $(OBJDIR)/AEGP_RenderContext.o +OBJECTS += $(OBJDIR)/AEGP_Scene.o +OBJECTS += $(OBJDIR)/AEGP_SkinnedMesh.o +OBJECTS += $(OBJDIR)/AEGP_SkinnedMeshInstance.o +OBJECTS += $(OBJDIR)/AEGP_SuiteHandler.o +OBJECTS += $(OBJDIR)/AEGP_System.o +OBJECTS += $(OBJDIR)/AEGP_UpdateAEState.o +OBJECTS += $(OBJDIR)/AEGP_Utils.o +OBJECTS += $(OBJDIR)/AEGP_VaultHandler.o +OBJECTS += $(OBJDIR)/AEGP_WinFileDialog.o +OBJECTS += $(OBJDIR)/AEGP_WinSystem.o +OBJECTS += $(OBJDIR)/AEGP_World.o +OBJECTS += $(OBJDIR)/MissingSuiteError.o +OBJECTS += $(OBJDIR)/Smart_Utils.o +OBJECTS += $(OBJDIR)/ae_precompiled.o + +ifeq ($(config),debug_x64) +GENERATED += $(OBJDIR)/moc_AEGP_GraphicalResourcesTreeModel.o +GENERATED += $(OBJDIR)/moc_AEGP_PanelQT.o +OBJECTS += $(OBJDIR)/moc_AEGP_GraphicalResourcesTreeModel.o +OBJECTS += $(OBJDIR)/moc_AEGP_PanelQT.o + +else ifeq ($(config),release_x64) +GENERATED += $(OBJDIR)/moc_AEGP_GraphicalResourcesTreeModel1.o +GENERATED += $(OBJDIR)/moc_AEGP_PanelQT1.o +OBJECTS += $(OBJDIR)/moc_AEGP_GraphicalResourcesTreeModel1.o +OBJECTS += $(OBJDIR)/moc_AEGP_PanelQT1.o + +#else +# $(error "invalid configuration $(config)") +endif + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking AE_GeneralPlugin + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning AE_GeneralPlugin +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/AEFX_ArbParseHelper.o: ../../External/AE\ SDK/Util/AEFX_ArbParseHelper.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEFX_SuiteHelper.o: ../../External/AE\ SDK/Util/AEFX_SuiteHelper.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_SuiteHandler.o: ../../External/AE\ SDK/Util/AEGP_SuiteHandler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_Utils.o: ../../External/AE\ SDK/Util/AEGP_Utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MissingSuiteError.o: ../../External/AE\ SDK/Util/MissingSuiteError.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Smart_Utils.o: ../../External/AE\ SDK/Util/Smart_Utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ae_precompiled.o: ../../AE_GeneralPlugin/Precompiled/ae_precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_AEPKConversion.o: ../../AE_GeneralPlugin/Sources/AEGP_AEPKConversion.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_AssetBaker.o: ../../AE_GeneralPlugin/Sources/AEGP_AssetBaker.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_Attribute.o: ../../AE_GeneralPlugin/Sources/AEGP_Attribute.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_FileDialog.o: ../../AE_GeneralPlugin/Sources/AEGP_FileDialog.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_FileDialogMac.o: ../../AE_GeneralPlugin/Sources/AEGP_FileDialogMac.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_FileWatcher.o: ../../AE_GeneralPlugin/Sources/AEGP_FileWatcher.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_FrameCollector.o: ../../AE_GeneralPlugin/Sources/AEGP_FrameCollector.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_LayerHolder.o: ../../AE_GeneralPlugin/Sources/AEGP_LayerHolder.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_Log.o: ../../AE_GeneralPlugin/Sources/AEGP_Log.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_Main.o: ../../AE_GeneralPlugin/Sources/AEGP_Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_PackExplorer.o: ../../AE_GeneralPlugin/Sources/AEGP_PackExplorer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_ParticleScene.o: ../../AE_GeneralPlugin/Sources/AEGP_ParticleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_PopcornFXPlugins.o: ../../AE_GeneralPlugin/Sources/AEGP_PopcornFXPlugins.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_RenderContext.o: ../../AE_GeneralPlugin/Sources/AEGP_RenderContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_Scene.o: ../../AE_GeneralPlugin/Sources/AEGP_Scene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_SkinnedMesh.o: ../../AE_GeneralPlugin/Sources/AEGP_SkinnedMesh.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_SkinnedMeshInstance.o: ../../AE_GeneralPlugin/Sources/AEGP_SkinnedMeshInstance.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_System.o: ../../AE_GeneralPlugin/Sources/AEGP_System.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_UpdateAEState.o: ../../AE_GeneralPlugin/Sources/AEGP_UpdateAEState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_VaultHandler.o: ../../AE_GeneralPlugin/Sources/AEGP_VaultHandler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_WinFileDialog.o: ../../AE_GeneralPlugin/Sources/AEGP_WinFileDialog.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_WinSystem.o: ../../AE_GeneralPlugin/Sources/AEGP_WinSystem.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_World.o: ../../AE_GeneralPlugin/Sources/AEGP_World.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_GraphicalResourcesTreeModel.o: ../../AE_GeneralPlugin/Sources/Panels/AEGP_GraphicalResourcesTreeModel.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_PanelQT.o: ../../AE_GeneralPlugin/Sources/Panels/AEGP_PanelQT.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_BaseContext.o: ../../AE_GeneralPlugin/Sources/RenderApi/AEGP_BaseContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_CopyPixels.o: ../../AE_GeneralPlugin/Sources/RenderApi/AEGP_CopyPixels.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_D3D11Context.o: ../../AE_GeneralPlugin/Sources/RenderApi/AEGP_D3D11Context.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_D3D12Context.o: ../../AE_GeneralPlugin/Sources/RenderApi/AEGP_D3D12Context.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AEGP_MetalContext.o: ../../AE_GeneralPlugin/Sources/RenderApi/AEGP_MetalContext.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +ifeq ($(config),debug_x64) +Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.cpp: ../../AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h + @echo "Moc AEGP_GraphicalResourcesTreeModel.h" + $(SILENT) QT_SELECT=5 $(QTDIR)/bin/moc "../../AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h" -o "Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.cpp" @"Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.args" +Qt/x64/Debug/moc_AEGP_PanelQT.cpp: ../../AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h + @echo "Moc AEGP_PanelQT.h" + $(SILENT) QT_SELECT=5 $(QTDIR)/bin/moc "../../AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h" -o "Qt/x64/Debug/moc_AEGP_PanelQT.cpp" @"Qt/x64/Debug/moc_AEGP_PanelQT.args" +$(OBJDIR)/moc_AEGP_GraphicalResourcesTreeModel.o: Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/moc_AEGP_PanelQT.o: Qt/x64/Debug/moc_AEGP_PanelQT.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +else ifeq ($(config),release_x64) +Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.cpp: ../../AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h + @echo "Moc AEGP_GraphicalResourcesTreeModel.h" + $(SILENT) QT_SELECT=5 $(QTDIR)/bin/moc "../../AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h" -o "Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.cpp" @"Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.args" +Qt/x64/Release/moc_AEGP_PanelQT.cpp: ../../AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h + @echo "Moc AEGP_PanelQT.h" + $(SILENT) QT_SELECT=5 $(QTDIR)/bin/moc "../../AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h" -o "Qt/x64/Release/moc_AEGP_PanelQT.cpp" @"Qt/x64/Release/moc_AEGP_PanelQT.args" +$(OBJDIR)/moc_AEGP_GraphicalResourcesTreeModel1.o: Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/moc_AEGP_PanelQT1.o: Qt/x64/Release/moc_AEGP_PanelQT.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +#else +# $(error "invalid configuration $(config)") +endif + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-AssetBaker.make b/projects/AfterEffects_macosx/PK-AssetBaker.make new file mode 100644 index 00000000..7a0436b0 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-AssetBaker.make @@ -0,0 +1,192 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/PK-AssetBaker/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/PK-AssetBaker -I../../ExternalLibs/PK-AssetBakerLib -I../../ExternalLibs/pk_upgraderlib/include -I../../SDK/Samples/Common/PKFX -I../../ExternalLibs/Runtime/libs/zlib-1.2.8 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/libs/freetype-2.5.5/lib/macosx_x64 -L../../ExternalLibs/CodecMesh_FBX/libs/macosx/legacy_clang -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -liconv +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/application/BinariesGM_macosx_x64_d +TARGET = $(TARGETDIR)/PK-AssetBaker +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-AssetBaker +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DZ_PREFIX -DZ_PREFIX_CUSTOM=pk_z_ -DPK_USE_RENDER_HELPERS=0 -DUSE_FBXIMPORTER -DUSE_IMAGE_PLUGIN_HDR -DUSE_IMAGE_PLUGIN_TIFF -DUSE_IMAGE_PLUGIN_PKM -DUSE_IMAGE_PLUGIN_PVR -DUSE_COMPILER_BACKEND_D3D -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_d.a ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_d.a -framework Cocoa -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TIFF_d -lPK-Plugin_CodecImage_HDR_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-ZLib_d -lPK-Plugin_CodecMesh_FBX_d -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CodecImage_EXR_d -lfreetype -lfbxsdk_d -lxml2 -lz -lPK-ParticlesToolbox_d -lPK-Runtime_d +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_d.a ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/application/BinariesGM_macosx_x64_r +TARGET = $(TARGETDIR)/PK-AssetBaker +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-AssetBaker +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DZ_PREFIX -DZ_PREFIX_CUSTOM=pk_z_ -DPK_USE_RENDER_HELPERS=0 -DUSE_FBXIMPORTER -DUSE_IMAGE_PLUGIN_HDR -DUSE_IMAGE_PLUGIN_TIFF -DUSE_IMAGE_PLUGIN_PKM -DUSE_IMAGE_PLUGIN_PVR -DUSE_COMPILER_BACKEND_D3D -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_r.a ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_r.a -framework Cocoa -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TIFF_r -lPK-Plugin_CodecImage_HDR_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-ZLib_r -lPK-Plugin_CodecMesh_FBX_r -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CodecImage_EXR_r -lfreetype -lfbxsdk_r -lxml2 -lz -lPK-ParticlesToolbox_r -lPK-Runtime_r +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_r.a ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_r.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AssetBaker.o +GENERATED += $(OBJDIR)/AssetBaker_EditorMaterialProxy.o +GENERATED += $(OBJDIR)/AssetBaker_SimulationInterfaces.o +GENERATED += $(OBJDIR)/AssetBaker_Unzip.o +GENERATED += $(OBJDIR)/AssetBaker_Upgrade.o +GENERATED += $(OBJDIR)/FxPlugins.o +GENERATED += $(OBJDIR)/FxStartup.o +GENERATED += $(OBJDIR)/precompiled.o +GENERATED += $(OBJDIR)/unzip.o +OBJECTS += $(OBJDIR)/AssetBaker.o +OBJECTS += $(OBJDIR)/AssetBaker_EditorMaterialProxy.o +OBJECTS += $(OBJDIR)/AssetBaker_SimulationInterfaces.o +OBJECTS += $(OBJDIR)/AssetBaker_Unzip.o +OBJECTS += $(OBJDIR)/AssetBaker_Upgrade.o +OBJECTS += $(OBJDIR)/FxPlugins.o +OBJECTS += $(OBJDIR)/FxStartup.o +OBJECTS += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/unzip.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-AssetBaker + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-AssetBaker +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/AssetBaker.o: ../../ExternalLibs/PK-AssetBaker/AssetBaker.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_EditorMaterialProxy.o: ../../ExternalLibs/PK-AssetBaker/AssetBaker_EditorMaterialProxy.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_SimulationInterfaces.o: ../../ExternalLibs/PK-AssetBaker/AssetBaker_SimulationInterfaces.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Unzip.o: ../../ExternalLibs/PK-AssetBaker/AssetBaker_Unzip.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Upgrade.o: ../../ExternalLibs/PK-AssetBaker/AssetBaker_Upgrade.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/FxPlugins.o: ../../SDK/Samples/Common/PKFX/FxPlugins.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/FxStartup.o: ../../SDK/Samples/Common/PKFX/FxStartup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../ExternalLibs/PK-AssetBaker/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/unzip.o: ../../ExternalLibs/PK-AssetBaker/unzip.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-AssetBakerLib.make b/projects/AfterEffects_macosx/PK-AssetBakerLib.make new file mode 100644 index 00000000..355f3096 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-AssetBakerLib.make @@ -0,0 +1,221 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/PK-AssetBakerLib/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/PK-AssetBakerLib -I../../ExternalLibs/Runtime/libs/freetype-2.5.5/include +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-AssetBakerLib_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-AssetBakerLib +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-AssetBakerLib_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-AssetBakerLib +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-AssetBakerLib_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-AssetBakerLib +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AssetBaker_Cookery.o +GENERATED += $(OBJDIR)/AssetBaker_Oven.o +GENERATED += $(OBJDIR)/AssetBaker_Oven_Font.o +GENERATED += $(OBJDIR)/AssetBaker_Oven_HBO.o +GENERATED += $(OBJDIR)/AssetBaker_Oven_HBO_AttributeHotfix.o +GENERATED += $(OBJDIR)/AssetBaker_Oven_Mesh.o +GENERATED += $(OBJDIR)/AssetBaker_Oven_StraightCopy.o +GENERATED += $(OBJDIR)/AssetBaker_Oven_Texture.o +GENERATED += $(OBJDIR)/AssetBaker_Oven_VectorField.o +GENERATED += $(OBJDIR)/AssetBaker_Startup.o +GENERATED += $(OBJDIR)/ConvexHull.o +GENERATED += $(OBJDIR)/TextureTrimmer.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/AssetBaker_Cookery.o +OBJECTS += $(OBJDIR)/AssetBaker_Oven.o +OBJECTS += $(OBJDIR)/AssetBaker_Oven_Font.o +OBJECTS += $(OBJDIR)/AssetBaker_Oven_HBO.o +OBJECTS += $(OBJDIR)/AssetBaker_Oven_HBO_AttributeHotfix.o +OBJECTS += $(OBJDIR)/AssetBaker_Oven_Mesh.o +OBJECTS += $(OBJDIR)/AssetBaker_Oven_StraightCopy.o +OBJECTS += $(OBJDIR)/AssetBaker_Oven_Texture.o +OBJECTS += $(OBJDIR)/AssetBaker_Oven_VectorField.o +OBJECTS += $(OBJDIR)/AssetBaker_Startup.o +OBJECTS += $(OBJDIR)/ConvexHull.o +OBJECTS += $(OBJDIR)/TextureTrimmer.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-AssetBakerLib + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-AssetBakerLib +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/AssetBaker_Cookery.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Cookery.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Oven.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Oven.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Oven_Font.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Oven_Font.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Oven_HBO.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Oven_HBO.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Oven_HBO_AttributeHotfix.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Oven_HBO_AttributeHotfix.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Oven_Mesh.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Oven_Mesh.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Oven_StraightCopy.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Oven_StraightCopy.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Oven_Texture.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Oven_Texture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Oven_VectorField.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Oven_VectorField.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AssetBaker_Startup.o: ../../ExternalLibs/PK-AssetBakerLib/AssetBaker_Startup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ConvexHull.o: ../../ExternalLibs/PK-AssetBakerLib/ConvexHull.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/TextureTrimmer.o: ../../ExternalLibs/PK-AssetBakerLib/TextureTrimmer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../ExternalLibs/PK-AssetBakerLib/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Discretizers_SDK1.make b/projects/AfterEffects_macosx/PK-Discretizers_SDK1.make new file mode 100644 index 00000000..f8cbc604 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Discretizers_SDK1.make @@ -0,0 +1,152 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/Runtime/pk_discretizers/dc_precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_discretizers/src -I../../ExternalLibs/Runtime/pk_discretizers +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-Discretizers_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Discretizers_SDK1 +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-Discretizers_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Discretizers_SDK1 +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-Discretizers_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Discretizers_SDK1 +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Discretizers_SDK1 + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Discretizers_SDK1 +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-MCPP.make b/projects/AfterEffects_macosx/PK-MCPP.make new file mode 100644 index 00000000..960eb2fb --- /dev/null +++ b/projects/AfterEffects_macosx/PK-MCPP.make @@ -0,0 +1,203 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples -I../../Samples/PK-MCPP +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-MCPP_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-MCPP +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMCPP_LIB=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-MCPP_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-MCPP +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMCPP_LIB=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-MCPP_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-MCPP +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMCPP_LIB=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/directive.o +GENERATED += $(OBJDIR)/eval.o +GENERATED += $(OBJDIR)/expand.o +GENERATED += $(OBJDIR)/main.o +GENERATED += $(OBJDIR)/mbchar.o +GENERATED += $(OBJDIR)/pk_mcpp_bridge.o +GENERATED += $(OBJDIR)/pk_preprocessor.o +GENERATED += $(OBJDIR)/precompiled.o +GENERATED += $(OBJDIR)/support.o +GENERATED += $(OBJDIR)/system.o +OBJECTS += $(OBJDIR)/directive.o +OBJECTS += $(OBJDIR)/eval.o +OBJECTS += $(OBJDIR)/expand.o +OBJECTS += $(OBJDIR)/main.o +OBJECTS += $(OBJDIR)/mbchar.o +OBJECTS += $(OBJDIR)/pk_mcpp_bridge.o +OBJECTS += $(OBJDIR)/pk_preprocessor.o +OBJECTS += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/support.o +OBJECTS += $(OBJDIR)/system.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-MCPP + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-MCPP +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/directive.o: ../../Samples/PK-MCPP/directive.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/eval.o: ../../Samples/PK-MCPP/eval.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/expand.o: ../../Samples/PK-MCPP/expand.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/main.o: ../../Samples/PK-MCPP/main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/mbchar.o: ../../Samples/PK-MCPP/mbchar.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/pk_mcpp_bridge.o: ../../Samples/PK-MCPP/pk_mcpp_bridge.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/pk_preprocessor.o: ../../Samples/PK-MCPP/pk_preprocessor.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../Samples/PK-MCPP/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/support.o: ../../Samples/PK-MCPP/support.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/system.o: ../../Samples/PK-MCPP/system.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-MCPP_SDK1.make b/projects/AfterEffects_macosx/PK-MCPP_SDK1.make new file mode 100644 index 00000000..e8959285 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-MCPP_SDK1.make @@ -0,0 +1,203 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples -I../../Samples/PK-MCPP +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-MCPP_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-MCPP_SDK1 +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMCPP_LIB=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-MCPP_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-MCPP_SDK1 +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMCPP_LIB=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-MCPP_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-MCPP_SDK1 +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMCPP_LIB=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/directive.o +GENERATED += $(OBJDIR)/eval.o +GENERATED += $(OBJDIR)/expand.o +GENERATED += $(OBJDIR)/main.o +GENERATED += $(OBJDIR)/mbchar.o +GENERATED += $(OBJDIR)/pk_mcpp_bridge.o +GENERATED += $(OBJDIR)/pk_preprocessor.o +GENERATED += $(OBJDIR)/precompiled.o +GENERATED += $(OBJDIR)/support.o +GENERATED += $(OBJDIR)/system.o +OBJECTS += $(OBJDIR)/directive.o +OBJECTS += $(OBJDIR)/eval.o +OBJECTS += $(OBJDIR)/expand.o +OBJECTS += $(OBJDIR)/main.o +OBJECTS += $(OBJDIR)/mbchar.o +OBJECTS += $(OBJDIR)/pk_mcpp_bridge.o +OBJECTS += $(OBJDIR)/pk_preprocessor.o +OBJECTS += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/support.o +OBJECTS += $(OBJDIR)/system.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-MCPP_SDK1 + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-MCPP_SDK1 +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/directive.o: ../../Samples/PK-MCPP/directive.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/eval.o: ../../Samples/PK-MCPP/eval.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/expand.o: ../../Samples/PK-MCPP/expand.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/main.o: ../../Samples/PK-MCPP/main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/mbchar.o: ../../Samples/PK-MCPP/mbchar.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/pk_mcpp_bridge.o: ../../Samples/PK-MCPP/pk_mcpp_bridge.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/pk_preprocessor.o: ../../Samples/PK-MCPP/pk_preprocessor.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../Samples/PK-MCPP/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/support.o: ../../Samples/PK-MCPP/support.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/system.o: ../../Samples/PK-MCPP/system.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-ParticlesToolbox_SDK1.make b/projects/AfterEffects_macosx/PK-ParticlesToolbox_SDK1.make new file mode 100644 index 00000000..b04f027c --- /dev/null +++ b/projects/AfterEffects_macosx/PK-ParticlesToolbox_SDK1.make @@ -0,0 +1,152 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/Runtime/pk_particles_toolbox/pt_precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_particles_toolbox -I../../ExternalLibs/Runtime/pk_particles_toolbox/src/include +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-ParticlesToolbox_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-ParticlesToolbox_SDK1 +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-ParticlesToolbox_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-ParticlesToolbox_SDK1 +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-ParticlesToolbox_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-ParticlesToolbox_SDK1 +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-ParticlesToolbox_SDK1 + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-ParticlesToolbox_SDK1 +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-RHI.make b/projects/AfterEffects_macosx/PK-RHI.make new file mode 100644 index 00000000..6992f8d3 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-RHI.make @@ -0,0 +1,768 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/Runtime/pk_rhi/src/precompiled/rhi_precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_rhi/include -I../../ExternalLibs/Runtime/pk_rhi/src -I../../ExternalLibs/Runtime/pk_rhi/src/precompiled -I../../Samples/Common -I../../ExternalLibs/GL/include +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RHI_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-RHI +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RHI_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-RHI +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RHI_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-RHI +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + +PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -include pk_compiler_warnings.h +PERFILE_FLAGS_1 = $(ALL_CXXFLAGS) -Wno-unguarded-availability-new -include pk_compiler_warnings.h + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AbstractCommandBuffer.o +GENERATED += $(OBJDIR)/AbstractConstantSet.o +GENERATED += $(OBJDIR)/AbstractFrameBuffer.o +GENERATED += $(OBJDIR)/AbstractGpuBuffer.o +GENERATED += $(OBJDIR)/AbstractRenderPass.o +GENERATED += $(OBJDIR)/AbstractRenderTarget.o +GENERATED += $(OBJDIR)/AbstractTexture.o +GENERATED += $(OBJDIR)/D3D11ApiManager.o +GENERATED += $(OBJDIR)/D3D11CommandBuffer.o +GENERATED += $(OBJDIR)/D3D11ComputeState.o +GENERATED += $(OBJDIR)/D3D11ConstantSampler.o +GENERATED += $(OBJDIR)/D3D11ConstantSet.o +GENERATED += $(OBJDIR)/D3D11FrameBuffer.o +GENERATED += $(OBJDIR)/D3D11GpuBuffer.o +GENERATED += $(OBJDIR)/D3D11PopcornEnumConversion.o +GENERATED += $(OBJDIR)/D3D11QueryPool.o +GENERATED += $(OBJDIR)/D3D11RHI.o +GENERATED += $(OBJDIR)/D3D11ReadBackTexture.o +GENERATED += $(OBJDIR)/D3D11RenderPass.o +GENERATED += $(OBJDIR)/D3D11RenderState.o +GENERATED += $(OBJDIR)/D3D11RenderTarget.o +GENERATED += $(OBJDIR)/D3D11ShaderModule.o +GENERATED += $(OBJDIR)/D3D11ShaderProgram.o +GENERATED += $(OBJDIR)/D3D11Texture.o +GENERATED += $(OBJDIR)/D3D12ApiManager.o +GENERATED += $(OBJDIR)/D3D12CommandBuffer.o +GENERATED += $(OBJDIR)/D3D12ComputeState.o +GENERATED += $(OBJDIR)/D3D12ConstantSampler.o +GENERATED += $(OBJDIR)/D3D12ConstantSet.o +GENERATED += $(OBJDIR)/D3D12DescriptorAllocator.o +GENERATED += $(OBJDIR)/D3D12Fence.o +GENERATED += $(OBJDIR)/D3D12FrameBuffer.o +GENERATED += $(OBJDIR)/D3D12GpuBuffer.o +GENERATED += $(OBJDIR)/D3D12PopcornEnumConversion.o +GENERATED += $(OBJDIR)/D3D12QueryPool.o +GENERATED += $(OBJDIR)/D3D12RHI.o +GENERATED += $(OBJDIR)/D3D12ReadBackTexture.o +GENERATED += $(OBJDIR)/D3D12RenderPass.o +GENERATED += $(OBJDIR)/D3D12RenderState.o +GENERATED += $(OBJDIR)/D3D12RenderTarget.o +GENERATED += $(OBJDIR)/D3D12ShaderModule.o +GENERATED += $(OBJDIR)/D3D12ShaderProgram.o +GENERATED += $(OBJDIR)/D3D12Texture.o +GENERATED += $(OBJDIR)/D3DCompileShader.o +GENERATED += $(OBJDIR)/D3DPopcornEnumConversion.o +GENERATED += $(OBJDIR)/EnumHelper.o +GENERATED += $(OBJDIR)/IApiManager.o +GENERATED += $(OBJDIR)/IFrameBuffer.o +GENERATED += $(OBJDIR)/IGpuBuffer.o +GENERATED += $(OBJDIR)/IReadBackTexture.o +GENERATED += $(OBJDIR)/IRenderPass.o +GENERATED += $(OBJDIR)/IRenderTarget.o +GENERATED += $(OBJDIR)/MetalApiManager.o +GENERATED += $(OBJDIR)/MetalCommandBuffer.o +GENERATED += $(OBJDIR)/MetalComputeState.o +GENERATED += $(OBJDIR)/MetalConstantSampler.o +GENERATED += $(OBJDIR)/MetalConstantSet.o +GENERATED += $(OBJDIR)/MetalFrameBuffer.o +GENERATED += $(OBJDIR)/MetalGpuBuffer.o +GENERATED += $(OBJDIR)/MetalPopcornEnumConversion.o +GENERATED += $(OBJDIR)/MetalReadBackTexture.o +GENERATED += $(OBJDIR)/MetalRenderPass.o +GENERATED += $(OBJDIR)/MetalRenderState.o +GENERATED += $(OBJDIR)/MetalRenderTarget.o +GENERATED += $(OBJDIR)/MetalShaderModule.o +GENERATED += $(OBJDIR)/MetalShaderProgram.o +GENERATED += $(OBJDIR)/MetalTexture.o +GENERATED += $(OBJDIR)/NullApiManager.o +GENERATED += $(OBJDIR)/NullCommandBuffer.o +GENERATED += $(OBJDIR)/NullConstantSampler.o +GENERATED += $(OBJDIR)/NullConstantSet.o +GENERATED += $(OBJDIR)/NullFrameBuffer.o +GENERATED += $(OBJDIR)/NullGpuBuffer.o +GENERATED += $(OBJDIR)/NullReadBackTexture.o +GENERATED += $(OBJDIR)/NullRenderPass.o +GENERATED += $(OBJDIR)/NullRenderState.o +GENERATED += $(OBJDIR)/NullRenderTarget.o +GENERATED += $(OBJDIR)/NullShaderModule.o +GENERATED += $(OBJDIR)/NullShaderProgram.o +GENERATED += $(OBJDIR)/NullTexture.o +GENERATED += $(OBJDIR)/OpenGLApiManager.o +GENERATED += $(OBJDIR)/OpenGLCommandBuffer.o +GENERATED += $(OBJDIR)/OpenGLComputeState.o +GENERATED += $(OBJDIR)/OpenGLConstantSampler.o +GENERATED += $(OBJDIR)/OpenGLConstantSet.o +GENERATED += $(OBJDIR)/OpenGLFrameBuffer.o +GENERATED += $(OBJDIR)/OpenGLGpuBuffer.o +GENERATED += $(OBJDIR)/OpenGLPopcornEnumConversion.o +GENERATED += $(OBJDIR)/OpenGLQueryPool.o +GENERATED += $(OBJDIR)/OpenGLRHI.o +GENERATED += $(OBJDIR)/OpenGLReadBackTexture.o +GENERATED += $(OBJDIR)/OpenGLRenderPass.o +GENERATED += $(OBJDIR)/OpenGLRenderState.o +GENERATED += $(OBJDIR)/OpenGLRenderTarget.o +GENERATED += $(OBJDIR)/OpenGLShaderModule.o +GENERATED += $(OBJDIR)/OpenGLShaderProgram.o +GENERATED += $(OBJDIR)/OpenGLTexture.o +GENERATED += $(OBJDIR)/PixelFormatFallbacks.o +GENERATED += $(OBJDIR)/RHIInit.o +GENERATED += $(OBJDIR)/SConstantSetLayout.o +GENERATED += $(OBJDIR)/SShaderBindings.o +GENERATED += $(OBJDIR)/ShaderConstantBindingGenerator.o +GENERATED += $(OBJDIR)/Startup.o +GENERATED += $(OBJDIR)/VulkanApiManager.o +GENERATED += $(OBJDIR)/VulkanCommandBuffer.o +GENERATED += $(OBJDIR)/VulkanComputeState.o +GENERATED += $(OBJDIR)/VulkanConstantSampler.o +GENERATED += $(OBJDIR)/VulkanConstantSet.o +GENERATED += $(OBJDIR)/VulkanFrameBuffer.o +GENERATED += $(OBJDIR)/VulkanGpuBuffer.o +GENERATED += $(OBJDIR)/VulkanPopcornEnumConversion.o +GENERATED += $(OBJDIR)/VulkanQueryPool.o +GENERATED += $(OBJDIR)/VulkanRHI.o +GENERATED += $(OBJDIR)/VulkanReadBackTexture.o +GENERATED += $(OBJDIR)/VulkanRenderPass.o +GENERATED += $(OBJDIR)/VulkanRenderState.o +GENERATED += $(OBJDIR)/VulkanRenderTarget.o +GENERATED += $(OBJDIR)/VulkanShaderModule.o +GENERATED += $(OBJDIR)/VulkanShaderProgram.o +GENERATED += $(OBJDIR)/VulkanTexture.o +GENERATED += $(OBJDIR)/glew.o +GENERATED += $(OBJDIR)/rhi_precompiled.o +OBJECTS += $(OBJDIR)/AbstractCommandBuffer.o +OBJECTS += $(OBJDIR)/AbstractConstantSet.o +OBJECTS += $(OBJDIR)/AbstractFrameBuffer.o +OBJECTS += $(OBJDIR)/AbstractGpuBuffer.o +OBJECTS += $(OBJDIR)/AbstractRenderPass.o +OBJECTS += $(OBJDIR)/AbstractRenderTarget.o +OBJECTS += $(OBJDIR)/AbstractTexture.o +OBJECTS += $(OBJDIR)/D3D11ApiManager.o +OBJECTS += $(OBJDIR)/D3D11CommandBuffer.o +OBJECTS += $(OBJDIR)/D3D11ComputeState.o +OBJECTS += $(OBJDIR)/D3D11ConstantSampler.o +OBJECTS += $(OBJDIR)/D3D11ConstantSet.o +OBJECTS += $(OBJDIR)/D3D11FrameBuffer.o +OBJECTS += $(OBJDIR)/D3D11GpuBuffer.o +OBJECTS += $(OBJDIR)/D3D11PopcornEnumConversion.o +OBJECTS += $(OBJDIR)/D3D11QueryPool.o +OBJECTS += $(OBJDIR)/D3D11RHI.o +OBJECTS += $(OBJDIR)/D3D11ReadBackTexture.o +OBJECTS += $(OBJDIR)/D3D11RenderPass.o +OBJECTS += $(OBJDIR)/D3D11RenderState.o +OBJECTS += $(OBJDIR)/D3D11RenderTarget.o +OBJECTS += $(OBJDIR)/D3D11ShaderModule.o +OBJECTS += $(OBJDIR)/D3D11ShaderProgram.o +OBJECTS += $(OBJDIR)/D3D11Texture.o +OBJECTS += $(OBJDIR)/D3D12ApiManager.o +OBJECTS += $(OBJDIR)/D3D12CommandBuffer.o +OBJECTS += $(OBJDIR)/D3D12ComputeState.o +OBJECTS += $(OBJDIR)/D3D12ConstantSampler.o +OBJECTS += $(OBJDIR)/D3D12ConstantSet.o +OBJECTS += $(OBJDIR)/D3D12DescriptorAllocator.o +OBJECTS += $(OBJDIR)/D3D12Fence.o +OBJECTS += $(OBJDIR)/D3D12FrameBuffer.o +OBJECTS += $(OBJDIR)/D3D12GpuBuffer.o +OBJECTS += $(OBJDIR)/D3D12PopcornEnumConversion.o +OBJECTS += $(OBJDIR)/D3D12QueryPool.o +OBJECTS += $(OBJDIR)/D3D12RHI.o +OBJECTS += $(OBJDIR)/D3D12ReadBackTexture.o +OBJECTS += $(OBJDIR)/D3D12RenderPass.o +OBJECTS += $(OBJDIR)/D3D12RenderState.o +OBJECTS += $(OBJDIR)/D3D12RenderTarget.o +OBJECTS += $(OBJDIR)/D3D12ShaderModule.o +OBJECTS += $(OBJDIR)/D3D12ShaderProgram.o +OBJECTS += $(OBJDIR)/D3D12Texture.o +OBJECTS += $(OBJDIR)/D3DCompileShader.o +OBJECTS += $(OBJDIR)/D3DPopcornEnumConversion.o +OBJECTS += $(OBJDIR)/EnumHelper.o +OBJECTS += $(OBJDIR)/IApiManager.o +OBJECTS += $(OBJDIR)/IFrameBuffer.o +OBJECTS += $(OBJDIR)/IGpuBuffer.o +OBJECTS += $(OBJDIR)/IReadBackTexture.o +OBJECTS += $(OBJDIR)/IRenderPass.o +OBJECTS += $(OBJDIR)/IRenderTarget.o +OBJECTS += $(OBJDIR)/MetalApiManager.o +OBJECTS += $(OBJDIR)/MetalCommandBuffer.o +OBJECTS += $(OBJDIR)/MetalComputeState.o +OBJECTS += $(OBJDIR)/MetalConstantSampler.o +OBJECTS += $(OBJDIR)/MetalConstantSet.o +OBJECTS += $(OBJDIR)/MetalFrameBuffer.o +OBJECTS += $(OBJDIR)/MetalGpuBuffer.o +OBJECTS += $(OBJDIR)/MetalPopcornEnumConversion.o +OBJECTS += $(OBJDIR)/MetalReadBackTexture.o +OBJECTS += $(OBJDIR)/MetalRenderPass.o +OBJECTS += $(OBJDIR)/MetalRenderState.o +OBJECTS += $(OBJDIR)/MetalRenderTarget.o +OBJECTS += $(OBJDIR)/MetalShaderModule.o +OBJECTS += $(OBJDIR)/MetalShaderProgram.o +OBJECTS += $(OBJDIR)/MetalTexture.o +OBJECTS += $(OBJDIR)/NullApiManager.o +OBJECTS += $(OBJDIR)/NullCommandBuffer.o +OBJECTS += $(OBJDIR)/NullConstantSampler.o +OBJECTS += $(OBJDIR)/NullConstantSet.o +OBJECTS += $(OBJDIR)/NullFrameBuffer.o +OBJECTS += $(OBJDIR)/NullGpuBuffer.o +OBJECTS += $(OBJDIR)/NullReadBackTexture.o +OBJECTS += $(OBJDIR)/NullRenderPass.o +OBJECTS += $(OBJDIR)/NullRenderState.o +OBJECTS += $(OBJDIR)/NullRenderTarget.o +OBJECTS += $(OBJDIR)/NullShaderModule.o +OBJECTS += $(OBJDIR)/NullShaderProgram.o +OBJECTS += $(OBJDIR)/NullTexture.o +OBJECTS += $(OBJDIR)/OpenGLApiManager.o +OBJECTS += $(OBJDIR)/OpenGLCommandBuffer.o +OBJECTS += $(OBJDIR)/OpenGLComputeState.o +OBJECTS += $(OBJDIR)/OpenGLConstantSampler.o +OBJECTS += $(OBJDIR)/OpenGLConstantSet.o +OBJECTS += $(OBJDIR)/OpenGLFrameBuffer.o +OBJECTS += $(OBJDIR)/OpenGLGpuBuffer.o +OBJECTS += $(OBJDIR)/OpenGLPopcornEnumConversion.o +OBJECTS += $(OBJDIR)/OpenGLQueryPool.o +OBJECTS += $(OBJDIR)/OpenGLRHI.o +OBJECTS += $(OBJDIR)/OpenGLReadBackTexture.o +OBJECTS += $(OBJDIR)/OpenGLRenderPass.o +OBJECTS += $(OBJDIR)/OpenGLRenderState.o +OBJECTS += $(OBJDIR)/OpenGLRenderTarget.o +OBJECTS += $(OBJDIR)/OpenGLShaderModule.o +OBJECTS += $(OBJDIR)/OpenGLShaderProgram.o +OBJECTS += $(OBJDIR)/OpenGLTexture.o +OBJECTS += $(OBJDIR)/PixelFormatFallbacks.o +OBJECTS += $(OBJDIR)/RHIInit.o +OBJECTS += $(OBJDIR)/SConstantSetLayout.o +OBJECTS += $(OBJDIR)/SShaderBindings.o +OBJECTS += $(OBJDIR)/ShaderConstantBindingGenerator.o +OBJECTS += $(OBJDIR)/Startup.o +OBJECTS += $(OBJDIR)/VulkanApiManager.o +OBJECTS += $(OBJDIR)/VulkanCommandBuffer.o +OBJECTS += $(OBJDIR)/VulkanComputeState.o +OBJECTS += $(OBJDIR)/VulkanConstantSampler.o +OBJECTS += $(OBJDIR)/VulkanConstantSet.o +OBJECTS += $(OBJDIR)/VulkanFrameBuffer.o +OBJECTS += $(OBJDIR)/VulkanGpuBuffer.o +OBJECTS += $(OBJDIR)/VulkanPopcornEnumConversion.o +OBJECTS += $(OBJDIR)/VulkanQueryPool.o +OBJECTS += $(OBJDIR)/VulkanRHI.o +OBJECTS += $(OBJDIR)/VulkanReadBackTexture.o +OBJECTS += $(OBJDIR)/VulkanRenderPass.o +OBJECTS += $(OBJDIR)/VulkanRenderState.o +OBJECTS += $(OBJDIR)/VulkanRenderTarget.o +OBJECTS += $(OBJDIR)/VulkanShaderModule.o +OBJECTS += $(OBJDIR)/VulkanShaderProgram.o +OBJECTS += $(OBJDIR)/VulkanTexture.o +OBJECTS += $(OBJDIR)/glew.o +OBJECTS += $(OBJDIR)/rhi_precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-RHI + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-RHI +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(PERFILE_FLAGS_0) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/glew.o: ../../ExternalLibs/GL/src/glew.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rhi_precompiled.o: ../../ExternalLibs/Runtime/pk_rhi/src/precompiled/rhi_precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11ApiManager.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11ApiManager.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11CommandBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11CommandBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11ComputeState.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11ComputeState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11ConstantSampler.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11ConstantSampler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11ConstantSet.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11ConstantSet.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11FrameBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11FrameBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11GpuBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11GpuBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11PopcornEnumConversion.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11PopcornEnumConversion.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11QueryPool.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11QueryPool.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11RHI.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11RHI.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11ReadBackTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11ReadBackTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11RenderPass.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11RenderPass.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11RenderState.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11RenderState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11RenderTarget.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11RenderTarget.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11ShaderModule.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11ShaderModule.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11ShaderProgram.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11ShaderProgram.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11Texture.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D11/D3D11Texture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12ApiManager.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12ApiManager.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12CommandBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12CommandBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12ComputeState.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12ComputeState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12ConstantSampler.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12ConstantSampler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12ConstantSet.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12ConstantSet.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12DescriptorAllocator.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12DescriptorAllocator.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12Fence.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12Fence.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12FrameBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12FrameBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12GpuBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12GpuBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12PopcornEnumConversion.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12PopcornEnumConversion.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12QueryPool.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12QueryPool.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12RHI.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12RHI.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12ReadBackTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12ReadBackTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12RenderPass.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12RenderPass.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12RenderState.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12RenderState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12RenderTarget.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12RenderTarget.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12ShaderModule.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12ShaderModule.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12ShaderProgram.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12ShaderProgram.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12Texture.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3D12/D3D12Texture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3DCompileShader.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3DCommon/D3DCompileShader.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3DPopcornEnumConversion.o: ../../ExternalLibs/Runtime/pk_rhi/src/D3DCommon/D3DPopcornEnumConversion.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/EnumHelper.o: ../../ExternalLibs/Runtime/pk_rhi/src/EnumHelper.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PixelFormatFallbacks.o: ../../ExternalLibs/Runtime/pk_rhi/src/PixelFormatFallbacks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RHIInit.o: ../../ExternalLibs/Runtime/pk_rhi/src/RHIInit.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ShaderConstantBindingGenerator.o: ../../ExternalLibs/Runtime/pk_rhi/src/ShaderConstantBindingGenerator.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Startup.o: ../../ExternalLibs/Runtime/pk_rhi/src/Startup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/IApiManager.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/IApiManager.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/IFrameBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/IFrameBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/IGpuBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/IGpuBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/IReadBackTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/IReadBackTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/IRenderPass.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/IRenderPass.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/IRenderTarget.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/IRenderTarget.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SConstantSetLayout.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/SConstantSetLayout.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SShaderBindings.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/SShaderBindings.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AbstractCommandBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/abstracts/AbstractCommandBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AbstractConstantSet.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/abstracts/AbstractConstantSet.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AbstractFrameBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/abstracts/AbstractFrameBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AbstractGpuBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/abstracts/AbstractGpuBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AbstractRenderPass.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/abstracts/AbstractRenderPass.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AbstractRenderTarget.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/abstracts/AbstractRenderTarget.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AbstractTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/interfaces/abstracts/AbstractTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalApiManager.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalApiManager.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalCommandBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalCommandBuffer.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalComputeState.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalComputeState.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalConstantSampler.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalConstantSampler.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalConstantSet.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalConstantSet.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalFrameBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalFrameBuffer.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalGpuBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalGpuBuffer.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalPopcornEnumConversion.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalPopcornEnumConversion.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalReadBackTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalReadBackTexture.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalRenderPass.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalRenderPass.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalRenderState.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalRenderState.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalRenderTarget.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalRenderTarget.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalShaderModule.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalShaderModule.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalShaderProgram.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalShaderProgram.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/metal/MetalTexture.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_1) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullApiManager.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullApiManager.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullCommandBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullCommandBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullConstantSampler.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullConstantSampler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullConstantSet.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullConstantSet.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullFrameBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullFrameBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullGpuBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullGpuBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullReadBackTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullReadBackTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullRenderPass.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullRenderPass.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullRenderState.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullRenderState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullRenderTarget.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullRenderTarget.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullShaderModule.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullShaderModule.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullShaderProgram.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullShaderProgram.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NullTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/null/NullTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLApiManager.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLApiManager.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLCommandBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLCommandBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLComputeState.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLComputeState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLConstantSampler.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLConstantSampler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLConstantSet.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLConstantSet.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLFrameBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLFrameBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLGpuBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLGpuBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLPopcornEnumConversion.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLPopcornEnumConversion.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLQueryPool.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLQueryPool.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLRHI.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLRHI.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLReadBackTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLReadBackTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLRenderPass.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLRenderPass.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLRenderState.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLRenderState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLRenderTarget.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLRenderTarget.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLShaderModule.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLShaderModule.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLShaderProgram.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLShaderProgram.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OpenGLTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/opengl/OpenGLTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanApiManager.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanApiManager.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanCommandBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanCommandBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanComputeState.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanComputeState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanConstantSampler.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanConstantSampler.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanConstantSet.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanConstantSet.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanFrameBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanFrameBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanGpuBuffer.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanGpuBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanPopcornEnumConversion.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanPopcornEnumConversion.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanQueryPool.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanQueryPool.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanRHI.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanRHI.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanReadBackTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanReadBackTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanRenderPass.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanRenderPass.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanRenderState.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanRenderState.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanRenderTarget.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanRenderTarget.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanShaderModule.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanShaderModule.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanShaderProgram.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanShaderProgram.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanTexture.o: ../../ExternalLibs/Runtime/pk_rhi/src/vulkan/VulkanTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-RHI_SDK1.make b/projects/AfterEffects_macosx/PK-RHI_SDK1.make new file mode 100644 index 00000000..1630c586 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-RHI_SDK1.make @@ -0,0 +1,162 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/Runtime/pk_rhi/src/precompiled/rhi_precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_rhi/include -I../../ExternalLibs/Runtime/pk_rhi/src -I../../ExternalLibs/Runtime/pk_rhi/src/precompiled -I../../Samples/Common -I../../ExternalLibs/GL/include +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RHI_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-RHI_SDK1 +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RHI_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-RHI_SDK1 +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RHI_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-RHI_SDK1 +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + +PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -include pk_compiler_warnings.h + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/glew.o +OBJECTS += $(OBJDIR)/glew.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-RHI_SDK1 + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-RHI_SDK1 +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/glew.o: ../../ExternalLibs/GL/src/glew.c + @echo "$(notdir $<)" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-RenderHelpers.make b/projects/AfterEffects_macosx/PK-RenderHelpers.make new file mode 100644 index 00000000..8b545c86 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-RenderHelpers.make @@ -0,0 +1,436 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/Runtime/pk_render_helpers/src/precompiled/rh_precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_render_helpers/src -I../../ExternalLibs/Runtime/pk_render_helpers/src/precompiled +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RenderHelpers_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-RenderHelpers +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RenderHelpers_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-RenderHelpers +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RenderHelpers_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-RenderHelpers +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/rh_batch_drawer.o +GENERATED += $(OBJDIR)/rh_batch_jobs_billboard_cpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_billboard_gpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_decal_cpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_decal_gpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_helpers.o +GENERATED += $(OBJDIR)/rh_batch_jobs_light_std.o +GENERATED += $(OBJDIR)/rh_batch_jobs_mesh_cpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_mesh_gpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_ribbon_cpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_ribbon_gpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_sound_std.o +GENERATED += $(OBJDIR)/rh_batch_jobs_triangle_cpu.o +GENERATED += $(OBJDIR)/rh_batch_jobs_triangle_gpu.o +GENERATED += $(OBJDIR)/rh_billboard.o +GENERATED += $(OBJDIR)/rh_billboard_cpu.o +GENERATED += $(OBJDIR)/rh_billboard_cpu_tasks.o +GENERATED += $(OBJDIR)/rh_billboard_ribbon_batch_helper.o +GENERATED += $(OBJDIR)/rh_billboarders_billboards_axial_capsule.o +GENERATED += $(OBJDIR)/rh_billboarders_billboards_axial_quad.o +GENERATED += $(OBJDIR)/rh_billboarders_billboards_axial_spheroidal.o +GENERATED += $(OBJDIR)/rh_billboarders_billboards_planar_quad.o +GENERATED += $(OBJDIR)/rh_billboarders_billboards_screen_quad.o +GENERATED += $(OBJDIR)/rh_billboarders_billboards_standard.o +GENERATED += $(OBJDIR)/rh_billboarders_billboards_view_quad.o +GENERATED += $(OBJDIR)/rh_billboarders_ribbons.o +GENERATED += $(OBJDIR)/rh_billboarders_ribbons_axial.o +GENERATED += $(OBJDIR)/rh_bufferpool.o +GENERATED += $(OBJDIR)/rh_common.o +GENERATED += $(OBJDIR)/rh_copystream_cpu.o +GENERATED += $(OBJDIR)/rh_copystream_cpu_tasks.o +GENERATED += $(OBJDIR)/rh_decal.o +GENERATED += $(OBJDIR)/rh_decal_cpu.o +GENERATED += $(OBJDIR)/rh_decal_cpu_tasks.o +GENERATED += $(OBJDIR)/rh_draw_requests.o +GENERATED += $(OBJDIR)/rh_features_basic.o +GENERATED += $(OBJDIR)/rh_features_vat_skeletal.o +GENERATED += $(OBJDIR)/rh_features_vat_static.o +GENERATED += $(OBJDIR)/rh_frame_collector.o +GENERATED += $(OBJDIR)/rh_init.o +GENERATED += $(OBJDIR)/rh_light.o +GENERATED += $(OBJDIR)/rh_main.o +GENERATED += $(OBJDIR)/rh_mesh.o +GENERATED += $(OBJDIR)/rh_mesh_cpu.o +GENERATED += $(OBJDIR)/rh_mesh_cpu_tasks.o +GENERATED += $(OBJDIR)/rh_particle_render_data_factory.o +GENERATED += $(OBJDIR)/rh_precompiled.o +GENERATED += $(OBJDIR)/rh_render_medium.o +GENERATED += $(OBJDIR)/rh_renderers_walker.o +GENERATED += $(OBJDIR)/rh_ribbon.o +GENERATED += $(OBJDIR)/rh_ribbon_cpu.o +GENERATED += $(OBJDIR)/rh_ribbon_cpu_tasks.o +GENERATED += $(OBJDIR)/rh_sound.o +GENERATED += $(OBJDIR)/rh_triangle.o +GENERATED += $(OBJDIR)/rh_triangle_cpu.o +GENERATED += $(OBJDIR)/rh_triangle_cpu_tasks.o +OBJECTS += $(OBJDIR)/rh_batch_drawer.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_billboard_cpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_billboard_gpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_decal_cpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_decal_gpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_helpers.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_light_std.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_mesh_cpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_mesh_gpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_ribbon_cpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_ribbon_gpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_sound_std.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_triangle_cpu.o +OBJECTS += $(OBJDIR)/rh_batch_jobs_triangle_gpu.o +OBJECTS += $(OBJDIR)/rh_billboard.o +OBJECTS += $(OBJDIR)/rh_billboard_cpu.o +OBJECTS += $(OBJDIR)/rh_billboard_cpu_tasks.o +OBJECTS += $(OBJDIR)/rh_billboard_ribbon_batch_helper.o +OBJECTS += $(OBJDIR)/rh_billboarders_billboards_axial_capsule.o +OBJECTS += $(OBJDIR)/rh_billboarders_billboards_axial_quad.o +OBJECTS += $(OBJDIR)/rh_billboarders_billboards_axial_spheroidal.o +OBJECTS += $(OBJDIR)/rh_billboarders_billboards_planar_quad.o +OBJECTS += $(OBJDIR)/rh_billboarders_billboards_screen_quad.o +OBJECTS += $(OBJDIR)/rh_billboarders_billboards_standard.o +OBJECTS += $(OBJDIR)/rh_billboarders_billboards_view_quad.o +OBJECTS += $(OBJDIR)/rh_billboarders_ribbons.o +OBJECTS += $(OBJDIR)/rh_billboarders_ribbons_axial.o +OBJECTS += $(OBJDIR)/rh_bufferpool.o +OBJECTS += $(OBJDIR)/rh_common.o +OBJECTS += $(OBJDIR)/rh_copystream_cpu.o +OBJECTS += $(OBJDIR)/rh_copystream_cpu_tasks.o +OBJECTS += $(OBJDIR)/rh_decal.o +OBJECTS += $(OBJDIR)/rh_decal_cpu.o +OBJECTS += $(OBJDIR)/rh_decal_cpu_tasks.o +OBJECTS += $(OBJDIR)/rh_draw_requests.o +OBJECTS += $(OBJDIR)/rh_features_basic.o +OBJECTS += $(OBJDIR)/rh_features_vat_skeletal.o +OBJECTS += $(OBJDIR)/rh_features_vat_static.o +OBJECTS += $(OBJDIR)/rh_frame_collector.o +OBJECTS += $(OBJDIR)/rh_init.o +OBJECTS += $(OBJDIR)/rh_light.o +OBJECTS += $(OBJDIR)/rh_main.o +OBJECTS += $(OBJDIR)/rh_mesh.o +OBJECTS += $(OBJDIR)/rh_mesh_cpu.o +OBJECTS += $(OBJDIR)/rh_mesh_cpu_tasks.o +OBJECTS += $(OBJDIR)/rh_particle_render_data_factory.o +OBJECTS += $(OBJDIR)/rh_precompiled.o +OBJECTS += $(OBJDIR)/rh_render_medium.o +OBJECTS += $(OBJDIR)/rh_renderers_walker.o +OBJECTS += $(OBJDIR)/rh_ribbon.o +OBJECTS += $(OBJDIR)/rh_ribbon_cpu.o +OBJECTS += $(OBJDIR)/rh_ribbon_cpu_tasks.o +OBJECTS += $(OBJDIR)/rh_sound.o +OBJECTS += $(OBJDIR)/rh_triangle.o +OBJECTS += $(OBJDIR)/rh_triangle_cpu.o +OBJECTS += $(OBJDIR)/rh_triangle_cpu_tasks.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-RenderHelpers + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-RenderHelpers +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/rh_precompiled.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/precompiled/rh_precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_billboard_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_billboard_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_billboard_gpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_billboard_gpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_decal_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_decal_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_decal_gpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_decal_gpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_helpers.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_helpers.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_light_std.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_light_std.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_mesh_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_mesh_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_mesh_gpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_mesh_gpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_ribbon_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_ribbon_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_ribbon_gpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_ribbon_gpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_sound_std.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_sound_std.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_triangle_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_triangle_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_jobs_triangle_gpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batch_jobs/rh_batch_jobs_triangle_gpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboard_ribbon_batch_helper.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/batches/rh_billboard_ribbon_batch_helper.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_billboards_axial_capsule.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_billboards_axial_capsule.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_billboards_axial_quad.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_billboards_axial_quad.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_billboards_axial_spheroidal.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_billboards_axial_spheroidal.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_billboards_planar_quad.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_billboards_planar_quad.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_billboards_screen_quad.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_billboards_screen_quad.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_billboards_standard.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_billboards_standard.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_billboards_view_quad.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_billboards_view_quad.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_ribbons.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_ribbons.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboarders_ribbons_axial.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/billboarders/rh_billboarders_ribbons_axial.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_bufferpool.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/buffer_pool/rh_bufferpool.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboard.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_billboard.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboard_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_billboard_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_billboard_cpu_tasks.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_billboard_cpu_tasks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_common.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_common.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_copystream_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_copystream_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_copystream_cpu_tasks.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_copystream_cpu_tasks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_decal.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_decal.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_decal_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_decal_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_decal_cpu_tasks.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_decal_cpu_tasks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_draw_requests.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_draw_requests.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_light.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_light.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_mesh.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_mesh.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_mesh_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_mesh_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_mesh_cpu_tasks.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_mesh_cpu_tasks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_ribbon.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_ribbon.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_ribbon_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_ribbon_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_ribbon_cpu_tasks.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_ribbon_cpu_tasks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_sound.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_sound.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_triangle.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_triangle.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_triangle_cpu.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_triangle_cpu.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_triangle_cpu_tasks.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/draw_requests/rh_triangle_cpu_tasks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_batch_drawer.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/frame_collector/rh_batch_drawer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_frame_collector.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/frame_collector/rh_frame_collector.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_particle_render_data_factory.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/frame_collector/rh_particle_render_data_factory.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_render_medium.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/frame_collector/rh_render_medium.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_renderers_walker.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/frame_collector/rh_renderers_walker.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_features_basic.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/render_features/rh_features_basic.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_features_vat_skeletal.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/render_features/rh_features_vat_skeletal.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_features_vat_static.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/render_features/rh_features_vat_static.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_init.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/rh_init.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/rh_main.o: ../../ExternalLibs/Runtime/pk_render_helpers/src/rh_main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-RenderHelpers_SDK1.make b/projects/AfterEffects_macosx/PK-RenderHelpers_SDK1.make new file mode 100644 index 00000000..43be21da --- /dev/null +++ b/projects/AfterEffects_macosx/PK-RenderHelpers_SDK1.make @@ -0,0 +1,152 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/Runtime/pk_render_helpers/src/precompiled/rh_precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_render_helpers/src -I../../ExternalLibs/Runtime/pk_render_helpers/src/precompiled +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RenderHelpers_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-RenderHelpers_SDK1 +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RenderHelpers_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-RenderHelpers_SDK1 +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-RenderHelpers_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-RenderHelpers_SDK1 +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-RenderHelpers_SDK1 + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-RenderHelpers_SDK1 +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Runtime_SDK1.make b/projects/AfterEffects_macosx/PK-Runtime_SDK1.make new file mode 100644 index 00000000..146fc19b --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Runtime_SDK1.make @@ -0,0 +1,151 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-Runtime_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Runtime_SDK1 +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_maths/src -I../../ExternalLibs/Runtime/pk_maths -I../../ExternalLibs/Runtime/pk_toolkit -I../../ExternalLibs/Runtime/pk_toolkit/src/include -I../../ExternalLibs/Runtime/pk_kernel -I../../ExternalLibs/Runtime/pk_imaging -I../../ExternalLibs/Runtime/pk_base_object/src -I../../ExternalLibs/Runtime/pk_base_object/src/precompiled -I../../ExternalLibs/Runtime/pk_compiler/src -I../../ExternalLibs/Runtime/pk_compiler/src/precompiled -I../../ExternalLibs/Runtime/pk_engine_utils/src/precompiled -I../../ExternalLibs/Runtime/pk_geometrics -I../../ExternalLibs/Runtime/pk_particles/src -I../intermediate/AfterEffects/GM/x64/Debug/PK-Runtime_SDK1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-Runtime_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Runtime_SDK1 +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_maths/src -I../../ExternalLibs/Runtime/pk_maths -I../../ExternalLibs/Runtime/pk_toolkit -I../../ExternalLibs/Runtime/pk_toolkit/src/include -I../../ExternalLibs/Runtime/pk_kernel -I../../ExternalLibs/Runtime/pk_imaging -I../../ExternalLibs/Runtime/pk_base_object/src -I../../ExternalLibs/Runtime/pk_base_object/src/precompiled -I../../ExternalLibs/Runtime/pk_compiler/src -I../../ExternalLibs/Runtime/pk_compiler/src/precompiled -I../../ExternalLibs/Runtime/pk_engine_utils/src/precompiled -I../../ExternalLibs/Runtime/pk_geometrics -I../../ExternalLibs/Runtime/pk_particles/src -I../intermediate/AfterEffects/GM/x64/Release/PK-Runtime_SDK1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-Runtime_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Runtime_SDK1 +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/Runtime/pk_maths/src -I../../ExternalLibs/Runtime/pk_maths -I../../ExternalLibs/Runtime/pk_toolkit -I../../ExternalLibs/Runtime/pk_toolkit/src/include -I../../ExternalLibs/Runtime/pk_kernel -I../../ExternalLibs/Runtime/pk_imaging -I../../ExternalLibs/Runtime/pk_base_object/src -I../../ExternalLibs/Runtime/pk_base_object/src/precompiled -I../../ExternalLibs/Runtime/pk_compiler/src -I../../ExternalLibs/Runtime/pk_compiler/src/precompiled -I../../ExternalLibs/Runtime/pk_engine_utils/src/precompiled -I../../ExternalLibs/Runtime/pk_geometrics -I../../ExternalLibs/Runtime/pk_particles/src -I../intermediate/AfterEffects/GM/x64/Retail/PK-Runtime_SDK1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Runtime_SDK1 + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Runtime_SDK1 +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-SampleLib.make b/projects/AfterEffects_macosx/PK-SampleLib.make new file mode 100644 index 00000000..fc2245b2 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-SampleLib.make @@ -0,0 +1,492 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples -I../../Samples/precompiled -I../../Samples/PK-SampleLib -I../../ExternalLibs/GL/include -I/usr/local/include/SDL2 -I../../ExternalLibs/imgui +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-SampleLib_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-SampleLib +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_SDL=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-SampleLib_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-SampleLib +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_SDL=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-SampleLib_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-SampleLib +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_SDL=0 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + +PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -Wno-unguarded-availability-new + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AWindowContext.o +GENERATED += $(OBJDIR)/AbstractGraphicScene.o +GENERATED += $(OBJDIR)/BRDFLUT.o +GENERATED += $(OBJDIR)/BasicSceneShaderDefinitions.o +GENERATED += $(OBJDIR)/BlueNoise.o +GENERATED += $(OBJDIR)/Camera.o +GENERATED += $(OBJDIR)/D3D11Context.o +GENERATED += $(OBJDIR)/D3D12Context.o +GENERATED += $(OBJDIR)/DebugHelper.o +GENERATED += $(OBJDIR)/DeferredScene.o +GENERATED += $(OBJDIR)/DirectionalShadows.o +GENERATED += $(OBJDIR)/DownSampleTexture.o +GENERATED += $(OBJDIR)/EGLContext.o +GENERATED += $(OBJDIR)/EditorShaderDefinitions.o +GENERATED += $(OBJDIR)/EnvironmentMapEntity.o +GENERATED += $(OBJDIR)/FeatureRenderingSettings.o +GENERATED += $(OBJDIR)/FrameCollector.o +GENERATED += $(OBJDIR)/GBuffer.o +GENERATED += $(OBJDIR)/GLContext.o +GENERATED += $(OBJDIR)/GLSLShaderGenerator.o +GENERATED += $(OBJDIR)/GLXContext.o +GENERATED += $(OBJDIR)/Gizmo.o +GENERATED += $(OBJDIR)/HLSLShaderGenerator.o +GENERATED += $(OBJDIR)/ImguiRhiImplem.o +GENERATED += $(OBJDIR)/LightEntity.o +GENERATED += $(OBJDIR)/MaterialToRHI.o +GENERATED += $(OBJDIR)/MeshEntity.o +GENERATED += $(OBJDIR)/MetalContext.o +GENERATED += $(OBJDIR)/MetalContextFactory.o +GENERATED += $(OBJDIR)/MetalShaderGenerator.o +GENERATED += $(OBJDIR)/NSGLContext.o +GENERATED += $(OBJDIR)/OffscreenContext.o +GENERATED += $(OBJDIR)/PKPix.o +GENERATED += $(OBJDIR)/PKSampleInit.o +GENERATED += $(OBJDIR)/ParticleShaderGenerator.o +GENERATED += $(OBJDIR)/PipelineCacheHelper.o +GENERATED += $(OBJDIR)/PopcornStartup.o +GENERATED += $(OBJDIR)/PostFxBloom.o +GENERATED += $(OBJDIR)/PostFxColorRemap.o +GENERATED += $(OBJDIR)/PostFxDistortion.o +GENERATED += $(OBJDIR)/PostFxFXAA.o +GENERATED += $(OBJDIR)/PostFxToneMapping.o +GENERATED += $(OBJDIR)/ProfilerRenderer.o +GENERATED += $(OBJDIR)/RHIBillboardingBatchPolicy.o +GENERATED += $(OBJDIR)/RHIBillboardingBatchPolicy_Vertex.o +GENERATED += $(OBJDIR)/RHICustomTasks.o +GENERATED += $(OBJDIR)/RHIGPUSorter.o +GENERATED += $(OBJDIR)/RHIGraphicResources.o +GENERATED += $(OBJDIR)/RHIParticleRenderDataFactory.o +GENERATED += $(OBJDIR)/RHIRenderParticleSceneHelpers.o +GENERATED += $(OBJDIR)/RendererCache.o +GENERATED += $(OBJDIR)/SampleLibShaderDefinitions.o +GENERATED += $(OBJDIR)/SampleUtils.o +GENERATED += $(OBJDIR)/SdlContext.o +GENERATED += $(OBJDIR)/ShaderDefinitions.o +GENERATED += $(OBJDIR)/ShaderGenerator.o +GENERATED += $(OBJDIR)/ShaderLoader.o +GENERATED += $(OBJDIR)/SimInterface_GBufferSampling.o +GENERATED += $(OBJDIR)/SoundPoolCache.o +GENERATED += $(OBJDIR)/UnitTestsShaderDefinitions.o +GENERATED += $(OBJDIR)/VulkanContext.o +GENERATED += $(OBJDIR)/VulkanShaderGenerator.o +GENERATED += $(OBJDIR)/WGLContext.o +GENERATED += $(OBJDIR)/imgui.o +GENERATED += $(OBJDIR)/imgui_demo.o +GENERATED += $(OBJDIR)/imgui_draw.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/AWindowContext.o +OBJECTS += $(OBJDIR)/AbstractGraphicScene.o +OBJECTS += $(OBJDIR)/BRDFLUT.o +OBJECTS += $(OBJDIR)/BasicSceneShaderDefinitions.o +OBJECTS += $(OBJDIR)/BlueNoise.o +OBJECTS += $(OBJDIR)/Camera.o +OBJECTS += $(OBJDIR)/D3D11Context.o +OBJECTS += $(OBJDIR)/D3D12Context.o +OBJECTS += $(OBJDIR)/DebugHelper.o +OBJECTS += $(OBJDIR)/DeferredScene.o +OBJECTS += $(OBJDIR)/DirectionalShadows.o +OBJECTS += $(OBJDIR)/DownSampleTexture.o +OBJECTS += $(OBJDIR)/EGLContext.o +OBJECTS += $(OBJDIR)/EditorShaderDefinitions.o +OBJECTS += $(OBJDIR)/EnvironmentMapEntity.o +OBJECTS += $(OBJDIR)/FeatureRenderingSettings.o +OBJECTS += $(OBJDIR)/FrameCollector.o +OBJECTS += $(OBJDIR)/GBuffer.o +OBJECTS += $(OBJDIR)/GLContext.o +OBJECTS += $(OBJDIR)/GLSLShaderGenerator.o +OBJECTS += $(OBJDIR)/GLXContext.o +OBJECTS += $(OBJDIR)/Gizmo.o +OBJECTS += $(OBJDIR)/HLSLShaderGenerator.o +OBJECTS += $(OBJDIR)/ImguiRhiImplem.o +OBJECTS += $(OBJDIR)/LightEntity.o +OBJECTS += $(OBJDIR)/MaterialToRHI.o +OBJECTS += $(OBJDIR)/MeshEntity.o +OBJECTS += $(OBJDIR)/MetalContext.o +OBJECTS += $(OBJDIR)/MetalContextFactory.o +OBJECTS += $(OBJDIR)/MetalShaderGenerator.o +OBJECTS += $(OBJDIR)/NSGLContext.o +OBJECTS += $(OBJDIR)/OffscreenContext.o +OBJECTS += $(OBJDIR)/PKPix.o +OBJECTS += $(OBJDIR)/PKSampleInit.o +OBJECTS += $(OBJDIR)/ParticleShaderGenerator.o +OBJECTS += $(OBJDIR)/PipelineCacheHelper.o +OBJECTS += $(OBJDIR)/PopcornStartup.o +OBJECTS += $(OBJDIR)/PostFxBloom.o +OBJECTS += $(OBJDIR)/PostFxColorRemap.o +OBJECTS += $(OBJDIR)/PostFxDistortion.o +OBJECTS += $(OBJDIR)/PostFxFXAA.o +OBJECTS += $(OBJDIR)/PostFxToneMapping.o +OBJECTS += $(OBJDIR)/ProfilerRenderer.o +OBJECTS += $(OBJDIR)/RHIBillboardingBatchPolicy.o +OBJECTS += $(OBJDIR)/RHIBillboardingBatchPolicy_Vertex.o +OBJECTS += $(OBJDIR)/RHICustomTasks.o +OBJECTS += $(OBJDIR)/RHIGPUSorter.o +OBJECTS += $(OBJDIR)/RHIGraphicResources.o +OBJECTS += $(OBJDIR)/RHIParticleRenderDataFactory.o +OBJECTS += $(OBJDIR)/RHIRenderParticleSceneHelpers.o +OBJECTS += $(OBJDIR)/RendererCache.o +OBJECTS += $(OBJDIR)/SampleLibShaderDefinitions.o +OBJECTS += $(OBJDIR)/SampleUtils.o +OBJECTS += $(OBJDIR)/SdlContext.o +OBJECTS += $(OBJDIR)/ShaderDefinitions.o +OBJECTS += $(OBJDIR)/ShaderGenerator.o +OBJECTS += $(OBJDIR)/ShaderLoader.o +OBJECTS += $(OBJDIR)/SimInterface_GBufferSampling.o +OBJECTS += $(OBJDIR)/SoundPoolCache.o +OBJECTS += $(OBJDIR)/UnitTestsShaderDefinitions.o +OBJECTS += $(OBJDIR)/VulkanContext.o +OBJECTS += $(OBJDIR)/VulkanShaderGenerator.o +OBJECTS += $(OBJDIR)/WGLContext.o +OBJECTS += $(OBJDIR)/imgui.o +OBJECTS += $(OBJDIR)/imgui_demo.o +OBJECTS += $(OBJDIR)/imgui_draw.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-SampleLib + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-SampleLib +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/MetalContext.o: ../../Samples/PK-SampleLib/ApiContext/Metal/MetalContext.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalContextFactory.o: ../../Samples/PK-SampleLib/ApiContext/Metal/MetalContextFactory.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/NSGLContext.o: ../../Samples/PK-SampleLib/ApiContext/OpenGL/NSGLContext.mm + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(PERFILE_FLAGS_0) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D11Context.o: ../../Samples/PK-SampleLib/ApiContext/D3D/D3D11Context.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/D3D12Context.o: ../../Samples/PK-SampleLib/ApiContext/D3D/D3D12Context.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/EGLContext.o: ../../Samples/PK-SampleLib/ApiContext/OpenGL/EGLContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GLContext.o: ../../Samples/PK-SampleLib/ApiContext/OpenGL/GLContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GLXContext.o: ../../Samples/PK-SampleLib/ApiContext/OpenGL/GLXContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/WGLContext.o: ../../Samples/PK-SampleLib/ApiContext/OpenGL/WGLContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanContext.o: ../../Samples/PK-SampleLib/ApiContext/Vulkan/VulkanContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/BRDFLUT.o: ../../Samples/PK-SampleLib/BRDFLUT.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/BlueNoise.o: ../../Samples/PK-SampleLib/BlueNoise.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Camera.o: ../../Samples/PK-SampleLib/Camera.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/DebugHelper.o: ../../Samples/PK-SampleLib/DebugHelper.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Gizmo.o: ../../Samples/PK-SampleLib/Gizmo.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ImguiRhiImplem.o: ../../Samples/PK-SampleLib/ImguiRhiImplem.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PKPix.o: ../../Samples/PK-SampleLib/PKPix.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PKSampleInit.o: ../../Samples/PK-SampleLib/PKSampleInit.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PipelineCacheHelper.o: ../../Samples/PK-SampleLib/PipelineCacheHelper.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PopcornStartup.o: ../../Samples/PK-SampleLib/PopcornStartup/PopcornStartup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ProfilerRenderer.o: ../../Samples/PK-SampleLib/ProfilerRenderer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RHIRenderParticleSceneHelpers.o: ../../Samples/PK-SampleLib/RHIRenderParticleSceneHelpers.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/FeatureRenderingSettings.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/FeatureRenderingSettings.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/FrameCollector.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/FrameCollector.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MaterialToRHI.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/MaterialToRHI.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RHIBillboardingBatchPolicy.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RHIBillboardingBatchPolicy_Vertex.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/RHIBillboardingBatchPolicy_Vertex.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RHICustomTasks.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/RHICustomTasks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RHIGPUSorter.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/RHIGPUSorter.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RHIGraphicResources.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/RHIGraphicResources.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RHIParticleRenderDataFactory.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/RHIParticleRenderDataFactory.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/RendererCache.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/RendererCache.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SoundPoolCache.o: ../../Samples/PK-SampleLib/RenderIntegrationRHI/SoundPoolCache.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/DirectionalShadows.o: ../../Samples/PK-SampleLib/RenderPasses/DirectionalShadows.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/DownSampleTexture.o: ../../Samples/PK-SampleLib/RenderPasses/DownSampleTexture.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GBuffer.o: ../../Samples/PK-SampleLib/RenderPasses/GBuffer.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PostFxBloom.o: ../../Samples/PK-SampleLib/RenderPasses/PostFxBloom.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PostFxColorRemap.o: ../../Samples/PK-SampleLib/RenderPasses/PostFxColorRemap.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PostFxDistortion.o: ../../Samples/PK-SampleLib/RenderPasses/PostFxDistortion.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PostFxFXAA.o: ../../Samples/PK-SampleLib/RenderPasses/PostFxFXAA.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PostFxToneMapping.o: ../../Samples/PK-SampleLib/RenderPasses/PostFxToneMapping.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AbstractGraphicScene.o: ../../Samples/PK-SampleLib/SampleScene/AbstractGraphicScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/DeferredScene.o: ../../Samples/PK-SampleLib/SampleScene/DeferredScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/EnvironmentMapEntity.o: ../../Samples/PK-SampleLib/SampleScene/Entities/EnvironmentMapEntity.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/LightEntity.o: ../../Samples/PK-SampleLib/SampleScene/Entities/LightEntity.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MeshEntity.o: ../../Samples/PK-SampleLib/SampleScene/Entities/MeshEntity.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleUtils.o: ../../Samples/PK-SampleLib/SampleUtils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/BasicSceneShaderDefinitions.o: ../../Samples/PK-SampleLib/ShaderDefinitions/BasicSceneShaderDefinitions.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/EditorShaderDefinitions.o: ../../Samples/PK-SampleLib/ShaderDefinitions/EditorShaderDefinitions.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleLibShaderDefinitions.o: ../../Samples/PK-SampleLib/ShaderDefinitions/SampleLibShaderDefinitions.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ShaderDefinitions.o: ../../Samples/PK-SampleLib/ShaderDefinitions/ShaderDefinitions.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/UnitTestsShaderDefinitions.o: ../../Samples/PK-SampleLib/ShaderDefinitions/UnitTestsShaderDefinitions.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GLSLShaderGenerator.o: ../../Samples/PK-SampleLib/ShaderGenerator/GLSLShaderGenerator.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/HLSLShaderGenerator.o: ../../Samples/PK-SampleLib/ShaderGenerator/HLSLShaderGenerator.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/MetalShaderGenerator.o: ../../Samples/PK-SampleLib/ShaderGenerator/MetalShaderGenerator.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ParticleShaderGenerator.o: ../../Samples/PK-SampleLib/ShaderGenerator/ParticleShaderGenerator.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ShaderGenerator.o: ../../Samples/PK-SampleLib/ShaderGenerator/ShaderGenerator.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/VulkanShaderGenerator.o: ../../Samples/PK-SampleLib/ShaderGenerator/VulkanShaderGenerator.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ShaderLoader.o: ../../Samples/PK-SampleLib/ShaderLoader.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SimInterface_GBufferSampling.o: ../../Samples/PK-SampleLib/SimInterfaces/SimInterface_GBufferSampling.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AWindowContext.o: ../../Samples/PK-SampleLib/WindowContext/AWindowContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/OffscreenContext.o: ../../Samples/PK-SampleLib/WindowContext/OffscreenContext/OffscreenContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SdlContext.o: ../../Samples/PK-SampleLib/WindowContext/SdlContext/SdlContext.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/imgui.o: ../../ExternalLibs/imgui/imgui.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/imgui_demo.o: ../../ExternalLibs/imgui/imgui_demo.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/imgui_draw.o: ../../ExternalLibs/imgui/imgui_draw.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_01_BasicRendering.make b/projects/AfterEffects_macosx/PK-Sample_01_BasicRendering.make new file mode 100644 index 00000000..8814e1c1 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_01_BasicRendering.make @@ -0,0 +1,200 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_01_BasicRendering -I../../Samples/precompiled -I../../Samples -I../../SDK/Samples/Common -I../../SDK/Samples/Common/PKFX -I../../ExternalLibs/GL/include +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/GL/lib/macosx -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_01_BasicRendering_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_01_BasicRendering +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_01_BasicRendering -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -framework iokit -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lglfw3 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_01_BasicRendering_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_01_BasicRendering +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_01_BasicRendering -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -framework iokit -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lglfw3 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_01_BasicRendering_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_01_BasicRendering +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_01_BasicRendering -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -framework iokit -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lglfw3 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/BasicBatchDrawer_Billboard.o +GENERATED += $(OBJDIR)/BasicBatchDrawer_Mesh.o +GENERATED += $(OBJDIR)/BasicBatchDrawer_Ribbon.o +GENERATED += $(OBJDIR)/BasicRendererCache.o +GENERATED += $(OBJDIR)/PK-Sample_01_BasicRendering.o +GENERATED += $(OBJDIR)/ParticleSampleGLglfw3.o +GENERATED += $(OBJDIR)/gl_utils.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/BasicBatchDrawer_Billboard.o +OBJECTS += $(OBJDIR)/BasicBatchDrawer_Mesh.o +OBJECTS += $(OBJDIR)/BasicBatchDrawer_Ribbon.o +OBJECTS += $(OBJDIR)/BasicRendererCache.o +OBJECTS += $(OBJDIR)/PK-Sample_01_BasicRendering.o +OBJECTS += $(OBJDIR)/ParticleSampleGLglfw3.o +OBJECTS += $(OBJDIR)/gl_utils.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_01_BasicRendering + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_01_BasicRendering +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/BasicBatchDrawer_Billboard.o: ../../Samples/PK-Sample_01_BasicRendering/BasicBatchDrawer_Billboard.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/BasicBatchDrawer_Mesh.o: ../../Samples/PK-Sample_01_BasicRendering/BasicBatchDrawer_Mesh.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/BasicBatchDrawer_Ribbon.o: ../../Samples/PK-Sample_01_BasicRendering/BasicBatchDrawer_Ribbon.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/BasicRendererCache.o: ../../Samples/PK-Sample_01_BasicRendering/BasicRendererCache.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PK-Sample_01_BasicRendering.o: ../../Samples/PK-Sample_01_BasicRendering/PK-Sample_01_BasicRendering.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ParticleSampleGLglfw3.o: ../../SDK/Samples/ParticleSampleGL/ParticleSampleGLglfw3.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/gl_utils.o: ../../SDK/Samples/Common/Gl/gl_utils.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_01_BasicStartup.make b/projects/AfterEffects_macosx/PK-Sample_01_BasicStartup.make new file mode 100644 index 00000000..74715138 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_01_BasicStartup.make @@ -0,0 +1,175 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../SDK/Samples/ParticleSample/src/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../SDK/Samples/ParticleSample/src -I../../SDK/Samples/ParticleSample/src/include -I../../SDK/Samples/Common/PKFX +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_01_BasicStartup_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_01_BasicStartup +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-ZLib_d -lPK-ParticlesToolbox_d -lPK-Runtime_d + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_01_BasicStartup_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_01_BasicStartup +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-ZLib_r -lPK-ParticlesToolbox_r -lPK-Runtime_r + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_01_BasicStartup_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_01_BasicStartup +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-ZLib_s -lPK-ParticlesToolbox_s -lPK-Runtime_s + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/FxPlatformGeneric.o +GENERATED += $(OBJDIR)/FxStartup.o +GENERATED += $(OBJDIR)/ParticleSample_01_BasicStartup.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/FxPlatformGeneric.o +OBJECTS += $(OBJDIR)/FxStartup.o +OBJECTS += $(OBJDIR)/ParticleSample_01_BasicStartup.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_01_BasicStartup + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_01_BasicStartup +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/FxPlatformGeneric.o: ../../SDK/Samples/Common/PKFX/FxPlatformGeneric.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/FxStartup.o: ../../SDK/Samples/Common/PKFX/FxStartup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ParticleSample_01_BasicStartup.o: ../../SDK/Samples/ParticleSample/src/ParticleSample_01_BasicStartup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../SDK/Samples/ParticleSample/src/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_02_BasicEvolve.make b/projects/AfterEffects_macosx/PK-Sample_02_BasicEvolve.make new file mode 100644 index 00000000..c1188a5f --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_02_BasicEvolve.make @@ -0,0 +1,175 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../SDK/Samples/ParticleSample/src/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../SDK/Samples/ParticleSample/src -I../../SDK/Samples/ParticleSample/src/include -I../../SDK/Samples/Common/PKFX +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_02_BasicEvolve_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_02_BasicEvolve +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-ZLib_d -lPK-ParticlesToolbox_d -lPK-Runtime_d + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_02_BasicEvolve_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_02_BasicEvolve +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-ZLib_r -lPK-ParticlesToolbox_r -lPK-Runtime_r + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_02_BasicEvolve_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_02_BasicEvolve +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-ZLib_s -lPK-ParticlesToolbox_s -lPK-Runtime_s + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/FxPlatformGeneric.o +GENERATED += $(OBJDIR)/FxStartup.o +GENERATED += $(OBJDIR)/ParticleSample_02_BasicEvolve.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/FxPlatformGeneric.o +OBJECTS += $(OBJDIR)/FxStartup.o +OBJECTS += $(OBJDIR)/ParticleSample_02_BasicEvolve.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_02_BasicEvolve + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_02_BasicEvolve +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/FxPlatformGeneric.o: ../../SDK/Samples/Common/PKFX/FxPlatformGeneric.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/FxStartup.o: ../../SDK/Samples/Common/PKFX/FxStartup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ParticleSample_02_BasicEvolve.o: ../../SDK/Samples/ParticleSample/src/ParticleSample_02_BasicEvolve.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../SDK/Samples/ParticleSample/src/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_02_FullIntegration.make b/projects/AfterEffects_macosx/PK-Sample_02_FullIntegration.make new file mode 100644 index 00000000..ea77855a --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_02_FullIntegration.make @@ -0,0 +1,185 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_02_FullIntegration -I../../Samples/precompiled -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_02_FullIntegration_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_02_FullIntegration +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_02_FullIntegration -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_02_FullIntegration_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_02_FullIntegration +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_02_FullIntegration -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_02_FullIntegration_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_02_FullIntegration +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_02_FullIntegration -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/PopcornScene.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/PopcornScene.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_02_FullIntegration + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_02_FullIntegration +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_02_FullIntegration/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PopcornScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/PopcornScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_03_EngineHooks.make b/projects/AfterEffects_macosx/PK-Sample_03_EngineHooks.make new file mode 100644 index 00000000..855b43a4 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_03_EngineHooks.make @@ -0,0 +1,170 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../SDK/Samples/ParticleSample/src/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../SDK/Samples/ParticleSample/src -I../../SDK/Samples/ParticleSample/src/include -I../../SDK/Samples/Common/PKFX +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_03_EngineHooks_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_03_EngineHooks +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMACOSX -DPK_USE_RENDER_HELPERS=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-ZLib_d -lPK-ParticlesToolbox_d -lPK-Runtime_d + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_03_EngineHooks_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_03_EngineHooks +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMACOSX -DPK_USE_RENDER_HELPERS=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-ZLib_r -lPK-ParticlesToolbox_r -lPK-Runtime_r + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_03_EngineHooks_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_03_EngineHooks +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMACOSX -DPK_USE_RENDER_HELPERS=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-ZLib_s -lPK-ParticlesToolbox_s -lPK-Runtime_s + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/FxPlatformGeneric.o +GENERATED += $(OBJDIR)/ParticleSample_03_EngineHooks.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/FxPlatformGeneric.o +OBJECTS += $(OBJDIR)/ParticleSample_03_EngineHooks.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_03_EngineHooks + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_03_EngineHooks +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/FxPlatformGeneric.o: ../../SDK/Samples/Common/PKFX/FxPlatformGeneric.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ParticleSample_03_EngineHooks.o: ../../SDK/Samples/ParticleSample/src/ParticleSample_03_EngineHooks.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../SDK/Samples/ParticleSample/src/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_04_Baking.make b/projects/AfterEffects_macosx/PK-Sample_04_Baking.make new file mode 100644 index 00000000..93a2ae6d --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_04_Baking.make @@ -0,0 +1,177 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../SDK/Samples/ParticleSample/src/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../SDK/Samples/ParticleSample/src -I../../SDK/Samples/ParticleSample/src/include -I../../ExternalLibs/PK-AssetBakerLib -I../../SDK/Samples/Common/PKFX +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/libs/freetype-2.5.5/lib/macosx_x64 -L../../ExternalLibs/CodecMesh_FBX/libs/macosx/legacy_clang -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -liconv +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_04_Baking_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_04_Baking +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DUSE_COMPILER_BACKEND_D3D -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_d.a -framework Cocoa -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TIFF_d -lPK-Plugin_CodecImage_HDR_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-ZLib_d -lPK-Plugin_CodecMesh_FBX_d -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CodecImage_EXR_d -lfreetype -lfbxsdk_d -lxml2 -lz -lPK-ParticlesToolbox_d -lPK-Runtime_d +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_04_Baking_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_04_Baking +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DUSE_COMPILER_BACKEND_D3D -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_r.a -framework Cocoa -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TIFF_r -lPK-Plugin_CodecImage_HDR_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-ZLib_r -lPK-Plugin_CodecMesh_FBX_r -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CodecImage_EXR_r -lfreetype -lfbxsdk_r -lxml2 -lz -lPK-ParticlesToolbox_r -lPK-Runtime_r +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_04_Baking_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_04_Baking +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DUSE_COMPILER_BACKEND_D3D -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_s.a -framework Cocoa -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TIFF_s -lPK-Plugin_CodecImage_HDR_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-ZLib_s -lPK-Plugin_CodecMesh_FBX_s -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CodecImage_EXR_s -lfreetype -lfbxsdk_r -lxml2 -lz -lPK-ParticlesToolbox_s -lPK-Runtime_s +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-AssetBakerLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/FxPlugins.o +GENERATED += $(OBJDIR)/FxStartup.o +GENERATED += $(OBJDIR)/ParticleSample_04_Baking.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/FxPlugins.o +OBJECTS += $(OBJDIR)/FxStartup.o +OBJECTS += $(OBJDIR)/ParticleSample_04_Baking.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_04_Baking + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_04_Baking +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/FxPlugins.o: ../../SDK/Samples/Common/PKFX/FxPlugins.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/FxStartup.o: ../../SDK/Samples/Common/PKFX/FxStartup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ParticleSample_04_Baking.o: ../../SDK/Samples/ParticleSample/src/ParticleSample_04_Baking.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../SDK/Samples/ParticleSample/src/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_04_EffectInterface.make b/projects/AfterEffects_macosx/PK-Sample_04_EffectInterface.make new file mode 100644 index 00000000..5e16a8c0 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_04_EffectInterface.make @@ -0,0 +1,230 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_04_EffectInterface -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_04_EffectInterface_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_04_EffectInterface +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_04_EffectInterface -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_04_EffectInterface_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_04_EffectInterface +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_04_EffectInterface -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_04_EffectInterface_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_04_EffectInterface +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_04_EffectInterface -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AttributeSampler_GeometryCustom.o +GENERATED += $(OBJDIR)/AttributeSampler_GeometryCustomProxy.o +GENERATED += $(OBJDIR)/AttributeSampler_GeometryDefault.o +GENERATED += $(OBJDIR)/AttributeSampler_GeometryMeshCollection.o +GENERATED += $(OBJDIR)/AttributeSampler_GeometryProcedural.o +GENERATED += $(OBJDIR)/AttributeSampler_GeometryProxy.o +GENERATED += $(OBJDIR)/AttributeSampler_GeometryShape.o +GENERATED += $(OBJDIR)/EffectInstance.o +GENERATED += $(OBJDIR)/EffectInterface.o +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/SkinnedMesh.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/AttributeSampler_GeometryCustom.o +OBJECTS += $(OBJDIR)/AttributeSampler_GeometryCustomProxy.o +OBJECTS += $(OBJDIR)/AttributeSampler_GeometryDefault.o +OBJECTS += $(OBJDIR)/AttributeSampler_GeometryMeshCollection.o +OBJECTS += $(OBJDIR)/AttributeSampler_GeometryProcedural.o +OBJECTS += $(OBJDIR)/AttributeSampler_GeometryProxy.o +OBJECTS += $(OBJDIR)/AttributeSampler_GeometryShape.o +OBJECTS += $(OBJDIR)/EffectInstance.o +OBJECTS += $(OBJDIR)/EffectInterface.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/SkinnedMesh.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_04_EffectInterface + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_04_EffectInterface +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AttributeSampler_GeometryCustom.o: ../../Samples/PK-Sample_04_EffectInterface/AttributeSampler_GeometryCustom.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AttributeSampler_GeometryCustomProxy.o: ../../Samples/PK-Sample_04_EffectInterface/AttributeSampler_GeometryCustomProxy.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AttributeSampler_GeometryDefault.o: ../../Samples/PK-Sample_04_EffectInterface/AttributeSampler_GeometryDefault.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AttributeSampler_GeometryMeshCollection.o: ../../Samples/PK-Sample_04_EffectInterface/AttributeSampler_GeometryMeshCollection.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AttributeSampler_GeometryProcedural.o: ../../Samples/PK-Sample_04_EffectInterface/AttributeSampler_GeometryProcedural.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AttributeSampler_GeometryProxy.o: ../../Samples/PK-Sample_04_EffectInterface/AttributeSampler_GeometryProxy.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AttributeSampler_GeometryShape.o: ../../Samples/PK-Sample_04_EffectInterface/AttributeSampler_GeometryShape.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/EffectInstance.o: ../../Samples/PK-Sample_04_EffectInterface/EffectInstance.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/EffectInterface.o: ../../Samples/PK-Sample_04_EffectInterface/EffectInterface.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_04_EffectInterface/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SkinnedMesh.o: ../../Samples/PK-Sample_04_EffectInterface/SkinnedMesh.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_05_Stats.make b/projects/AfterEffects_macosx/PK-Sample_05_Stats.make new file mode 100644 index 00000000..96cbf1d1 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_05_Stats.make @@ -0,0 +1,185 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_05_Stats -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_05_Stats_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_05_Stats +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_05_Stats -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_05_Stats_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_05_Stats +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_05_Stats -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_05_Stats_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_05_Stats +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_05_Stats -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/Stats.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/Stats.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_05_Stats + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_05_Stats +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_05_Stats/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Stats.o: ../../Samples/PK-Sample_05_Stats/Stats.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_05_Upgrader.make b/projects/AfterEffects_macosx/PK-Sample_05_Upgrader.make new file mode 100644 index 00000000..547d5aa4 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_05_Upgrader.make @@ -0,0 +1,172 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../SDK/Samples/ParticleSample/src/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../SDK/Samples/ParticleSample/src -I../../SDK/Samples/ParticleSample/src/include -I../../ExternalLibs/pk_upgraderlib/include -I../../SDK/Samples/Common/PKFX +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_05_Upgrader_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_05_Upgrader +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_d.a -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-ZLib_d -lPK-ParticlesToolbox_d -lPK-Runtime_d +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_05_Upgrader_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_05_Upgrader +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_r.a -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-ZLib_r -lPK-ParticlesToolbox_r -lPK-Runtime_r +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_05_Upgrader_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_05_Upgrader +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_USE_RENDER_HELPERS=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_s.a -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-ZLib_s -lPK-ParticlesToolbox_s -lPK-Runtime_s +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/FxStartup.o +GENERATED += $(OBJDIR)/ParticleSample_05_Upgrader.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/FxStartup.o +OBJECTS += $(OBJDIR)/ParticleSample_05_Upgrader.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_05_Upgrader + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_05_Upgrader +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/FxStartup.o: ../../SDK/Samples/Common/PKFX/FxStartup.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ParticleSample_05_Upgrader.o: ../../SDK/Samples/ParticleSample/src/ParticleSample_05_Upgrader.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../SDK/Samples/ParticleSample/src/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_06_SimInterface.make b/projects/AfterEffects_macosx/PK-Sample_06_SimInterface.make new file mode 100644 index 00000000..8431ac46 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_06_SimInterface.make @@ -0,0 +1,200 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_06_SimInterface -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_06_SimInterface_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_06_SimInterface +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_06_SimInterface -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_06_SimInterface_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_06_SimInterface +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_06_SimInterface -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_06_SimInterface_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_06_SimInterface +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_06_SimInterface -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/SimInterface.o +GENERATED += $(OBJDIR)/SimInterfaceImplem_CPU.o +GENERATED += $(OBJDIR)/SimInterfaceImplem_GPU.o +GENERATED += $(OBJDIR)/SimInterfaceImplem_ISPC.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/SimInterface.o +OBJECTS += $(OBJDIR)/SimInterfaceImplem_CPU.o +OBJECTS += $(OBJDIR)/SimInterfaceImplem_GPU.o +OBJECTS += $(OBJDIR)/SimInterfaceImplem_ISPC.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_06_SimInterface + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_06_SimInterface +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_06_SimInterface/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SimInterface.o: ../../Samples/PK-Sample_06_SimInterface/SimInterface.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SimInterfaceImplem_CPU.o: ../../Samples/PK-Sample_06_SimInterface/SimInterfaceImplem_CPU.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SimInterfaceImplem_GPU.o: ../../Samples/PK-Sample_06_SimInterface/SimInterfaceImplem_GPU.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SimInterfaceImplem_ISPC.o: ../../Samples/PK-Sample_06_SimInterface/SimInterfaceImplem_ISPC.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_06_SimInterfaceGPU.make b/projects/AfterEffects_macosx/PK-Sample_06_SimInterfaceGPU.make new file mode 100644 index 00000000..e93c2efa --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_06_SimInterfaceGPU.make @@ -0,0 +1,190 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_06_SimInterfaceGPU -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_06_SimInterfaceGPU_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_06_SimInterfaceGPU +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_06_SimInterfaceGPU -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_06_SimInterfaceGPU_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_06_SimInterfaceGPU +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_06_SimInterfaceGPU -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_06_SimInterfaceGPU_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_06_SimInterfaceGPU +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_06_SimInterfaceGPU -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/SimInterface.o +GENERATED += $(OBJDIR)/SimInterfaceImplem_GPU.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/SimInterface.o +OBJECTS += $(OBJDIR)/SimInterfaceImplem_GPU.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_06_SimInterfaceGPU + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_06_SimInterfaceGPU +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_06_SimInterfaceGPU/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SimInterface.o: ../../Samples/PK-Sample_06_SimInterfaceGPU/SimInterface.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SimInterfaceImplem_GPU.o: ../../Samples/PK-Sample_06_SimInterfaceGPU/SimInterfaceImplem_GPU.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_07_LOD.make b/projects/AfterEffects_macosx/PK-Sample_07_LOD.make new file mode 100644 index 00000000..b553ad34 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_07_LOD.make @@ -0,0 +1,185 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_07_LOD -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_07_LOD_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_07_LOD +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_07_LOD -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_07_LOD_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_07_LOD +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_07_LOD -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_07_LOD_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_07_LOD +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_07_LOD -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/LOD.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/LOD.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_07_LOD + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_07_LOD +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/LOD.o: ../../Samples/PK-Sample_07_LOD/LOD.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_07_LOD/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_08_CustomCollision.make b/projects/AfterEffects_macosx/PK-Sample_08_CustomCollision.make new file mode 100644 index 00000000..31fe9ad0 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_08_CustomCollision.make @@ -0,0 +1,200 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_08_CustomCollision -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_08_CustomCollision_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_08_CustomCollision +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_08_CustomCollision -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_08_CustomCollision_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_08_CustomCollision +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_08_CustomCollision -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_08_CustomCollision_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_08_CustomCollision +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_08_CustomCollision -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/CustomCollision.o +GENERATED += $(OBJDIR)/CustomCollision_Scene.o +GENERATED += $(OBJDIR)/CustomCollision_SimInterface_Decl.o +GENERATED += $(OBJDIR)/CustomCollision_SimInterface_Impl.o +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/CustomCollision.o +OBJECTS += $(OBJDIR)/CustomCollision_Scene.o +OBJECTS += $(OBJDIR)/CustomCollision_SimInterface_Decl.o +OBJECTS += $(OBJDIR)/CustomCollision_SimInterface_Impl.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_08_CustomCollision + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_08_CustomCollision +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/CustomCollision.o: ../../Samples/PK-Sample_08_CustomCollision/CustomCollision.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/CustomCollision_Scene.o: ../../Samples/PK-Sample_08_CustomCollision/CustomCollision_Scene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/CustomCollision_SimInterface_Decl.o: ../../Samples/PK-Sample_08_CustomCollision/CustomCollision_SimInterface_Decl.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/CustomCollision_SimInterface_Impl.o: ../../Samples/PK-Sample_08_CustomCollision/CustomCollision_SimInterface_Impl.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_08_CustomCollision/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_09_AsyncLoading.make b/projects/AfterEffects_macosx/PK-Sample_09_AsyncLoading.make new file mode 100644 index 00000000..151f81ac --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_09_AsyncLoading.make @@ -0,0 +1,190 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_09_AsyncLoading -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_09_AsyncLoading_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_09_AsyncLoading +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_09_AsyncLoading -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_09_AsyncLoading_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_09_AsyncLoading +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_09_AsyncLoading -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_09_AsyncLoading_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_09_AsyncLoading +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_09_AsyncLoading -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AsyncLoading.o +GENERATED += $(OBJDIR)/AsyncLoading_Thread.o +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/AsyncLoading.o +OBJECTS += $(OBJDIR)/AsyncLoading_Thread.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_09_AsyncLoading + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_09_AsyncLoading +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AsyncLoading.o: ../../Samples/PK-Sample_09_AsyncLoading/AsyncLoading.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AsyncLoading_Thread.o: ../../Samples/PK-Sample_09_AsyncLoading/AsyncLoading_Thread.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_09_AsyncLoading/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_10_AsyncRendering.make b/projects/AfterEffects_macosx/PK-Sample_10_AsyncRendering.make new file mode 100644 index 00000000..75424e4a --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_10_AsyncRendering.make @@ -0,0 +1,190 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_10_AsyncRendering -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_10_AsyncRendering_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_10_AsyncRendering +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_10_AsyncRendering -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_10_AsyncRendering_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_10_AsyncRendering +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_10_AsyncRendering -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_10_AsyncRendering_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_10_AsyncRendering +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_10_AsyncRendering -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/AsyncRendering.o +GENERATED += $(OBJDIR)/AsyncRendering_Thread.o +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/AsyncRendering.o +OBJECTS += $(OBJDIR)/AsyncRendering_Thread.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_10_AsyncRendering + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_10_AsyncRendering +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AsyncRendering.o: ../../Samples/PK-Sample_10_AsyncRendering/AsyncRendering.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/AsyncRendering_Thread.o: ../../Samples/PK-Sample_10_AsyncRendering/AsyncRendering_Thread.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_10_AsyncRendering/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_11_ThreadPool.make b/projects/AfterEffects_macosx/PK-Sample_11_ThreadPool.make new file mode 100644 index 00000000..9c70ea13 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_11_ThreadPool.make @@ -0,0 +1,195 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_11_ThreadPool -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_11_ThreadPool_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_11_ThreadPool +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_11_ThreadPool -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_11_ThreadPool_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_11_ThreadPool +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_11_ThreadPool -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_11_ThreadPool_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_11_ThreadPool +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_11_ThreadPool -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/ThreadPool.o +GENERATED += $(OBJDIR)/ThreadPool_Default.o +GENERATED += $(OBJDIR)/ThreadPool_Mono.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/ThreadPool.o +OBJECTS += $(OBJDIR)/ThreadPool_Default.o +OBJECTS += $(OBJDIR)/ThreadPool_Mono.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_11_ThreadPool + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_11_ThreadPool +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_11_ThreadPool/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ThreadPool.o: ../../Samples/PK-Sample_11_ThreadPool/ThreadPool.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ThreadPool_Default.o: ../../Samples/PK-Sample_11_ThreadPool/ThreadPool_Default.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ThreadPool_Mono.o: ../../Samples/PK-Sample_11_ThreadPool/ThreadPool_Mono.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Sample_12_GBufferSampling.make b/projects/AfterEffects_macosx/PK-Sample_12_GBufferSampling.make new file mode 100644 index 00000000..20f1f617 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Sample_12_GBufferSampling.make @@ -0,0 +1,185 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples/PK-Sample_12_GBufferSampling -I../../Samples/precompiled -I../../Samples/PK-Sample_02_FullIntegration/Scene -I../../Samples -I../../ExternalLibs/GL/include -I../../ExternalLibs/imgui -I/usr/local/include/SDL2 +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL -framework CoreFoundation -framework CoreServices +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_12_GBufferSampling_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Sample_12_GBufferSampling +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_12_GBufferSampling -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-ZLib_d -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_12_GBufferSampling_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Sample_12_GBufferSampling +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_12_GBufferSampling -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-ZLib_r -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-Sample_12_GBufferSampling_macosx_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Sample_12_GBufferSampling +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPKSAMPLE_PROJNAME=PK-Sample_12_GBufferSampling -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_SDL=0 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a -framework quartzcore -framework cocoa -framework metal -lPK-RHI -lPK-RenderHelpers -lPK-MCPP -lPK-Plugin_CompilerBackend_GPU_D3D_s -lPK-Plugin_CompilerBackend_CPU_VM_s -lPK-Plugin_CodecImage_DDS_s -lPK-Plugin_CodecImage_JPG_s -lPK-Plugin_CodecImage_PKM_s -lPK-Plugin_CodecImage_PNG_s -lPK-Plugin_CodecImage_PVR_s -lPK-Plugin_CodecImage_TGA_s -lPK-Plugin_CodecImage_HDR_s -lPK-Discretizers_s -lPK-ParticlesToolbox_s -lPK-Runtime_s -lPK-ZLib_s -lpthread -lm -ldl -lSDL2 +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/GPUContext_D3D.o +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/PK-Sample_12_GBufferSampling.o +GENERATED += $(OBJDIR)/SampleScene.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/GPUContext_D3D.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/PK-Sample_12_GBufferSampling.o +OBJECTS += $(OBJDIR)/SampleScene.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist + @: + +$(dir $(TARGETDIR))PkgInfo: +$(dir $(TARGETDIR))Info.plist: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Sample_12_GBufferSampling + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Sample_12_GBufferSampling +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-Sample_12_GBufferSampling/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/PK-Sample_12_GBufferSampling.o: ../../Samples/PK-Sample_12_GBufferSampling/PK-Sample_12_GBufferSampling.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/GPUContext_D3D.o: ../../Samples/PK-Sample_02_FullIntegration/GPUContext_D3D.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/SampleScene.o: ../../Samples/PK-Sample_02_FullIntegration/Scene/SampleScene.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-ShaderTool.make b/projects/AfterEffects_macosx/PK-ShaderTool.make new file mode 100644 index 00000000..6c53f938 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-ShaderTool.make @@ -0,0 +1,162 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../Samples/precompiled/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../Samples -I../../Samples/precompiled -I../../Samples/PK-ShaderTool -I../../ExternalLibs/GL/include +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -framework AppKit -framework OpenGL +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-ShaderTool_macosx_d +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-ShaderTool +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DMACOSX -DPK_BUILD_WITH_SDL=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a -framework quartzcore -framework cocoa -framework metal -lPK-MCPP -lPK-RHI -lPK-RenderHelpers -lPK-Plugin_CodecImage_DDS_d -lPK-Plugin_CodecImage_JPG_d -lPK-Plugin_CodecImage_PKM_d -lPK-Plugin_CodecImage_PNG_d -lPK-Plugin_CodecImage_PVR_d -lPK-Plugin_CodecImage_TGA_d -lPK-Plugin_CodecImage_HDR_d -lPK-Plugin_CompilerBackend_CPU_VM_d -lPK-Discretizers_d -lPK-ParticlesToolbox_d -lPK-Runtime_d -lPK-Plugin_CompilerBackend_GPU_D3D_d -lPK-ZLib_d +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/builds/x64_Samples +TARGET = $(TARGETDIR)/PK-ShaderTool_macosx_r +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-ShaderTool +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DPK_BUILD_WITH_FMODEX_SUPPORT=0 -DPK_BUILD_WITH_METAL_SUPPORT=1 -DPK_BUILD_WITH_OGL_SUPPORT=1 -DGL_GLEXT_PROTOTYPES -DGLEW_STATIC -DGLEW_NO_GLU -DMACOSX -DPK_BUILD_WITH_SDL=0 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a -framework quartzcore -framework cocoa -framework metal -lPK-MCPP -lPK-RHI -lPK-RenderHelpers -lPK-Plugin_CodecImage_DDS_r -lPK-Plugin_CodecImage_JPG_r -lPK-Plugin_CodecImage_PKM_r -lPK-Plugin_CodecImage_PNG_r -lPK-Plugin_CodecImage_PVR_r -lPK-Plugin_CodecImage_TGA_r -lPK-Plugin_CodecImage_HDR_r -lPK-Plugin_CompilerBackend_CPU_VM_r -lPK-Discretizers_r -lPK-ParticlesToolbox_r -lPK-Runtime_r -lPK-Plugin_CompilerBackend_GPU_D3D_r -lPK-ZLib_r +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-SampleLib_r.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/Main.o +GENERATED += $(OBJDIR)/ShaderTool.o +GENERATED += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/Main.o +OBJECTS += $(OBJDIR)/ShaderTool.o +OBJECTS += $(OBJDIR)/precompiled.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-ShaderTool + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-ShaderTool +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/precompiled.o: ../../Samples/precompiled/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/Main.o: ../../Samples/PK-ShaderTool/Main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/ShaderTool.o: ../../Samples/PK-ShaderTool/ShaderTool.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-Upgrader.make b/projects/AfterEffects_macosx/PK-Upgrader.make new file mode 100644 index 00000000..a5ab8377 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-Upgrader.make @@ -0,0 +1,172 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/pk_upgrader/precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs/pk_upgrader -I../../ExternalLibs +FORCE_INCLUDE += +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +ALL_LDFLAGS += $(LDFLAGS) -L../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 -m64 -target x86_64-apple-macos10.14 -liconv +LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../../release/application/BinariesGM_macosx_x64_d +TARGET = $(TARGETDIR)/PK-Upgrader +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-Upgrader +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_d.a -lPK-ParticlesToolbox_d -lPK-Runtime_d +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_d.a + +else ifeq ($(config),release_x64) +TARGETDIR = ../../../release/application/BinariesGM_macosx_x64_r +TARGET = $(TARGETDIR)/PK-Upgrader +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-Upgrader +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_r.a -lPK-ParticlesToolbox_r -lPK-Runtime_r +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_r.a + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../../release/application/BinariesGM_macosx_x64_r +TARGET = $(TARGETDIR)/PK-Upgrader_s +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-Upgrader +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 -DMACOSX +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +LIBS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_s.a -lPK-ParticlesToolbox_s -lPK-Runtime_s +LDDEPS += ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64/libPK-UpgraderLib_s.a + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/main.o +GENERATED += $(OBJDIR)/precompiled.o +GENERATED += $(OBJDIR)/tests.o +OBJECTS += $(OBJDIR)/main.o +OBJECTS += $(OBJDIR)/precompiled.o +OBJECTS += $(OBJDIR)/tests.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-Upgrader + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-Upgrader +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/main.o: ../../ExternalLibs/pk_upgrader/main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/precompiled.o: ../../ExternalLibs/pk_upgrader/precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/tests.o: ../../ExternalLibs/pk_upgrader/tests.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PK-UpgraderLib.make b/projects/AfterEffects_macosx/PK-UpgraderLib.make new file mode 100644 index 00000000..0f2c76c2 --- /dev/null +++ b/projects/AfterEffects_macosx/PK-UpgraderLib.make @@ -0,0 +1,1461 @@ +# Alternative GNU Make project makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +.PHONY: clean prebuild + +SHELLTYPE := posix +ifeq (.exe,$(findstring .exe,$(ComSpec))) + SHELLTYPE := msdos +endif + +# Configurations +# ############################################# + +ifeq ($(origin CC), default) + CC = clang +endif +ifeq ($(origin CXX), default) + CXX = clang++ +endif +ifeq ($(origin AR), default) + AR = ar +endif +PCH = ../../ExternalLibs/pk_upgraderlib/src/precompiled/upg_precompiled.h +PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH)) +GCH = $(PCH_PLACEHOLDER).gch +INCLUDES += -I../../ExternalLibs/Runtime -I../../ExternalLibs/Runtime/include -I../../ExternalLibs/Runtime/include/license/AfterEffects -I../../ExternalLibs -I../../ExternalLibs/pk_upgraderlib/src -I../../ExternalLibs/pk_upgraderlib/src/precompiled +FORCE_INCLUDE += -include pk_compiler_warnings.h +ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES) +ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +LIBS += +LDDEPS += +ALL_LDFLAGS += $(LDFLAGS) -m64 -target x86_64-apple-macos10.14 +define LINKCMD + $(SILENT) $(RM) -f $@ + $(SILENT) $(AR) -rcs $@ $(OBJECTS) +endef +define PREBUILDCMDS +endef +define PRELINKCMDS +endef +define POSTBUILDCMDS +endef + +ifeq ($(config),debug_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-UpgraderLib_d.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Debug/PK-UpgraderLib +DEFINES += -D_DEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -ggdb -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),release_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-UpgraderLib_r.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Release/PK-UpgraderLib +DEFINES += -DNDEBUG -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fno-omit-frame-pointer -O3 -fno-strict-aliasing -g -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +else ifeq ($(config),retail_x64) +TARGETDIR = ../../ExternalLibs/Runtime/bin/AfterEffects/gmake_macosx_x64 +TARGET = $(TARGETDIR)/libPK-UpgraderLib_s.a +OBJDIR = ../intermediate/AfterEffects/GM/x64/Retail/PK-UpgraderLib +DEFINES += -DNDEBUG -DPK_RETAIL -DPK_COMPILER_BUILD_COMPILER_D3D11=1 -DPK_COMPILER_BUILD_COMPILER_D3D12=1 +ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` +ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -Wundef -fomit-frame-pointer -O3 -fno-strict-aliasing -msse2 -Wall -Wextra -std=gnu++0x -fno-exceptions -fvisibility-inlines-hidden -fno-rtti -fvisibility=hidden -Winvalid-pch -Wno-pragma-pack -fno-math-errno -fno-trapping-math -mfpmath=sse -target x86_64-apple-macos10.14 -iwithsysroot `xcrun --show-sdk-path` + +#else +# $(error "invalid configuration $(config)") +endif + +# Per File Configurations +# ############################################# + + +# File sets +# ############################################# + +GENERATED := +OBJECTS := + +GENERATED += $(OBJDIR)/core_upgrader.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_45754.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_46520.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_47147.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_47887.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_48439.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_48597.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_49290.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_50071.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_50306.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_50392.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_0_51547.o +GENERATED += $(OBJDIR)/core_upgrader_2_0_2_51773.o +GENERATED += $(OBJDIR)/core_upgrader_2_10_0_8984.o +GENERATED += $(OBJDIR)/core_upgrader_2_10_0_9172.o +GENERATED += $(OBJDIR)/core_upgrader_2_10_0_9560.o +GENERATED += $(OBJDIR)/core_upgrader_2_10_0_9625.o +GENERATED += $(OBJDIR)/core_upgrader_2_10_0_9653.o +GENERATED += $(OBJDIR)/core_upgrader_2_11_0_11056.o +GENERATED += $(OBJDIR)/core_upgrader_2_12_0_12548.o +GENERATED += $(OBJDIR)/core_upgrader_2_12_0_12698.o +GENERATED += $(OBJDIR)/core_upgrader_2_13_0_13590.o +GENERATED += $(OBJDIR)/core_upgrader_2_14_0_14494.o +GENERATED += $(OBJDIR)/core_upgrader_2_14_0_14605.o +GENERATED += $(OBJDIR)/core_upgrader_2_15_0_15495.o +GENERATED += $(OBJDIR)/core_upgrader_2_15_0_15714.o +GENERATED += $(OBJDIR)/core_upgrader_2_16_0_16433.o +GENERATED += $(OBJDIR)/core_upgrader_2_16_0_16626.o +GENERATED += $(OBJDIR)/core_upgrader_2_16_0_16685.o +GENERATED += $(OBJDIR)/core_upgrader_2_16_0_16701.o +GENERATED += $(OBJDIR)/core_upgrader_2_17_0_17463.o +GENERATED += $(OBJDIR)/core_upgrader_2_17_0_17579.o +GENERATED += $(OBJDIR)/core_upgrader_2_17_0_17673.o +GENERATED += $(OBJDIR)/core_upgrader_2_18_0_18518.o +GENERATED += $(OBJDIR)/core_upgrader_2_18_0_18710.o +GENERATED += $(OBJDIR)/core_upgrader_2_18_0_18748.o +GENERATED += $(OBJDIR)/core_upgrader_2_18_0_18759.o +GENERATED += $(OBJDIR)/core_upgrader_2_19_0_20350.o +GENERATED += $(OBJDIR)/core_upgrader_2_19_0_20470.o +GENERATED += $(OBJDIR)/core_upgrader_2_19_0_20475.o +GENERATED += $(OBJDIR)/core_upgrader_2_19_0_20538.o +GENERATED += $(OBJDIR)/core_upgrader_2_19_0_20545.o +GENERATED += $(OBJDIR)/core_upgrader_2_19_0_20554.o +GENERATED += $(OBJDIR)/core_upgrader_2_19_0_20558.o +GENERATED += $(OBJDIR)/core_upgrader_2_1_0_53018.o +GENERATED += $(OBJDIR)/core_upgrader_2_1_0_53244.o +GENERATED += $(OBJDIR)/core_upgrader_2_2_0_56591.o +GENERATED += $(OBJDIR)/core_upgrader_2_3_0_59136.o +GENERATED += $(OBJDIR)/core_upgrader_2_3_0_59175.o +GENERATED += $(OBJDIR)/core_upgrader_2_3_0_59344.o +GENERATED += $(OBJDIR)/core_upgrader_2_4_0_61372.o +GENERATED += $(OBJDIR)/core_upgrader_2_4_0_61427.o +GENERATED += $(OBJDIR)/core_upgrader_2_4_0_61613.o +GENERATED += $(OBJDIR)/core_upgrader_2_5_0_63107.o +GENERATED += $(OBJDIR)/core_upgrader_2_6_0_64722.o +GENERATED += $(OBJDIR)/core_upgrader_2_6_0_64941.o +GENERATED += $(OBJDIR)/core_upgrader_2_7_0_835.o +GENERATED += $(OBJDIR)/core_upgrader_2_8_0_3675.o +GENERATED += $(OBJDIR)/core_upgrader_2_8_0_3864.o +GENERATED += $(OBJDIR)/core_upgrader_2_8_0_4071.o +GENERATED += $(OBJDIR)/core_upgrader_2_9_0_6358.o +GENERATED += $(OBJDIR)/core_upgrader_2_9_0_6714.o +GENERATED += $(OBJDIR)/core_upgrades_generated.o +GENERATED += $(OBJDIR)/manifest.o +GENERATED += $(OBJDIR)/manifest1.o +GENERATED += $(OBJDIR)/upg_builder.o +GENERATED += $(OBJDIR)/upg_data_AnimatedMesh.vert.o +GENERATED += $(OBJDIR)/upg_data_Animated_Mesh.pkma.o +GENERATED += $(OBJDIR)/upg_data_Basic.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Basic.pkfx1.o +GENERATED += $(OBJDIR)/upg_data_BillboardMaterial.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Black.dds.o +GENERATED += $(OBJDIR)/upg_data_Black.dds1.o +GENERATED += $(OBJDIR)/upg_data_Blur.h.o +GENERATED += $(OBJDIR)/upg_data_Circle.fbx.o +GENERATED += $(OBJDIR)/upg_data_Circle.pkcf.o +GENERATED += $(OBJDIR)/upg_data_Classic.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Color.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Color_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Core.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Core_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_CurvePresets.pkfx.o +GENERATED += $(OBJDIR)/upg_data_CurvePresets_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Debug.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Debug_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_DecalMaterial.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Decal_Default.vert.o +GENERATED += $(OBJDIR)/upg_data_Default_AlphaMap.dds.o +GENERATED += $(OBJDIR)/upg_data_Default_AlphaMap.dds1.o +GENERATED += $(OBJDIR)/upg_data_Default_Billboard.frag.o +GENERATED += $(OBJDIR)/upg_data_Default_Billboard.frag1.o +GENERATED += $(OBJDIR)/upg_data_Default_Billboard.pkma.o +GENERATED += $(OBJDIR)/upg_data_Default_Billboard.pkma1.o +GENERATED += $(OBJDIR)/upg_data_Default_Decal.frag.o +GENERATED += $(OBJDIR)/upg_data_Default_Decal.pkma.o +GENERATED += $(OBJDIR)/upg_data_Default_Decal.vert.o +GENERATED += $(OBJDIR)/upg_data_Default_Light.frag.o +GENERATED += $(OBJDIR)/upg_data_Default_Light.frag1.o +GENERATED += $(OBJDIR)/upg_data_Default_Light.pkma.o +GENERATED += $(OBJDIR)/upg_data_Default_Light.pkma1.o +GENERATED += $(OBJDIR)/upg_data_Default_Light.vert.o +GENERATED += $(OBJDIR)/upg_data_Default_Light.vert1.o +GENERATED += $(OBJDIR)/upg_data_Default_Mesh.frag.o +GENERATED += $(OBJDIR)/upg_data_Default_Mesh.frag1.o +GENERATED += $(OBJDIR)/upg_data_Default_Mesh.pkma.o +GENERATED += $(OBJDIR)/upg_data_Default_Mesh.pkma1.o +GENERATED += $(OBJDIR)/upg_data_Default_Ribbon.frag.o +GENERATED += $(OBJDIR)/upg_data_Default_Ribbon.frag1.o +GENERATED += $(OBJDIR)/upg_data_Default_Ribbon.pkma.o +GENERATED += $(OBJDIR)/upg_data_Default_Ribbon.pkma1.o +GENERATED += $(OBJDIR)/upg_data_Default_Sound.pkma.o +GENERATED += $(OBJDIR)/upg_data_Default_Sound.pkma1.o +GENERATED += $(OBJDIR)/upg_data_Default_Triangle.frag.o +GENERATED += $(OBJDIR)/upg_data_Default_Triangle.pkma.o +GENERATED += $(OBJDIR)/upg_data_Diffuse.dds.o +GENERATED += $(OBJDIR)/upg_data_Diffuse.dds1.o +GENERATED += $(OBJDIR)/upg_data_Distort.dds.o +GENERATED += $(OBJDIR)/upg_data_Distort.dds1.o +GENERATED += $(OBJDIR)/upg_data_Distortion_Billboard.frag.o +GENERATED += $(OBJDIR)/upg_data_Distortion_Billboard.frag1.o +GENERATED += $(OBJDIR)/upg_data_Distortion_Billboard.pkma.o +GENERATED += $(OBJDIR)/upg_data_Distortion_Billboard.pkma1.o +GENERATED += $(OBJDIR)/upg_data_Distortion_Ribbon.frag.o +GENERATED += $(OBJDIR)/upg_data_Distortion_Ribbon.pkma.o +GENERATED += $(OBJDIR)/upg_data_Dynamics.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Dynamics_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Editor.pkbo.o +GENERATED += $(OBJDIR)/upg_data_Editor.pkri.o +GENERATED += $(OBJDIR)/upg_data_Editor.pkri1.o +GENERATED += $(OBJDIR)/upg_data_Editor_2.9.0.pkri.o +GENERATED += $(OBJDIR)/upg_data_Events.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Events_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_ExBillboard_Diffuse.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExBillboard_Distortion.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExBillboard_Emissive.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExBillboard_Opaque.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExBillboard_Tinted.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExDecal_Diffuse.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExDecal_Emissive.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExLight_Default.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExMesh_Emissive.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExMesh_Opaque.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExMesh_Tinted.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_CD_Diffuse.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_CD_Distortion.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_CD_Emissive.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_CD_Opaque.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_CD_Tinted.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_Diffuse.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_Distortion.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_Emissive.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_Opaque.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExRibbon_Tinted.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExSound_Default.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExTriangle_Diffuse.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExTriangle_Distortion.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExTriangle_Emissive.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExTriangle_Opaque.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_ExTriangle_Tinted.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_Experimental.pkri.o +GENERATED += $(OBJDIR)/upg_data_FX_Simple.pkfx.o +GENERATED += $(OBJDIR)/upg_data_FX_Simple.pkfx1.o +GENERATED += $(OBJDIR)/upg_data_FeatureAtlas.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureDecal.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureDiffuse.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureDistortion.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureDithering.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureEmissive.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureRibbonCorrectDeformation.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureSoftParticles.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureTint.h.o +GENERATED += $(OBJDIR)/upg_data_FeatureTransformUVs.h.o +GENERATED += $(OBJDIR)/upg_data_Legacy.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Legacy_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_LightMaterial.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Light_Default.frag.o +GENERATED += $(OBJDIR)/upg_data_Light_Default.vert.o +GENERATED += $(OBJDIR)/upg_data_MeshAnim.pkri.o +GENERATED += $(OBJDIR)/upg_data_MeshMaterial.pkfx.o +GENERATED += $(OBJDIR)/upg_data_NMap_Flat.dds.o +GENERATED += $(OBJDIR)/upg_data_NMap_Flat.dds1.o +GENERATED += $(OBJDIR)/upg_data_Opaque_Billboard.frag.o +GENERATED += $(OBJDIR)/upg_data_Opaque_Billboard.pkma.o +GENERATED += $(OBJDIR)/upg_data_Opaque_Ribbon.frag.o +GENERATED += $(OBJDIR)/upg_data_Opaque_Ribbon.pkma.o +GENERATED += $(OBJDIR)/upg_data_Opaque_Triangle.frag.o +GENERATED += $(OBJDIR)/upg_data_Opaque_Triangle.pkma.1.o +GENERATED += $(OBJDIR)/upg_data_PKLighting.h.o +GENERATED += $(OBJDIR)/upg_data_PKOutputColor.h.o +GENERATED += $(OBJDIR)/upg_data_PKSurface.h.o +GENERATED += $(OBJDIR)/upg_data_Particle_Master.frag.o +GENERATED += $(OBJDIR)/upg_data_Particle_Master.frag1.o +GENERATED += $(OBJDIR)/upg_data_PingPong.fbx.o +GENERATED += $(OBJDIR)/upg_data_PingPong.pkcf.o +GENERATED += $(OBJDIR)/upg_data_Placement.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Placement_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_RibbonMaterial.pkfx.o +GENERATED += $(OBJDIR)/upg_data_SampleLibSettings.pkbo.o +GENERATED += $(OBJDIR)/upg_data_SampleLibSettings.pkbo1.o +GENERATED += $(OBJDIR)/upg_data_Samplers.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Samplers_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_SkeletalAnimationTexture.pkri.o +GENERATED += $(OBJDIR)/upg_data_SoundMaterial.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Sphere.fbx.o +GENERATED += $(OBJDIR)/upg_data_Trails.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Trails_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Transparent_Mesh.frag.o +GENERATED += $(OBJDIR)/upg_data_Transparent_Mesh.frag1.o +GENERATED += $(OBJDIR)/upg_data_Transparent_Mesh.pkma.o +GENERATED += $(OBJDIR)/upg_data_Transparent_Mesh.pkma1.o +GENERATED += $(OBJDIR)/upg_data_TriangleMaterial.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Utils.h.o +GENERATED += $(OBJDIR)/upg_data_Utils.pkfx.o +GENERATED += $(OBJDIR)/upg_data_Utils_2.9.0.pkfx.o +GENERATED += $(OBJDIR)/upg_data_White.dds.o +GENERATED += $(OBJDIR)/upg_data_White.dds1.o +GENERATED += $(OBJDIR)/upg_helper_axis_system.o +GENERATED += $(OBJDIR)/upg_helper_core_upgrade.o +GENERATED += $(OBJDIR)/upg_helper_file.o +GENERATED += $(OBJDIR)/upg_helper_material.o +GENERATED += $(OBJDIR)/upg_helper_nodegraph.o +GENERATED += $(OBJDIR)/upg_helper_script.o +GENERATED += $(OBJDIR)/upg_helper_string.o +GENERATED += $(OBJDIR)/upg_import_v1.o +GENERATED += $(OBJDIR)/upg_logger.o +GENERATED += $(OBJDIR)/upg_main.o +GENERATED += $(OBJDIR)/upg_precompiled.o +GENERATED += $(OBJDIR)/upg_rawfile.o +GENERATED += $(OBJDIR)/upg_upgrader.o +GENERATED += $(OBJDIR)/upg_upgrades_hardfix.o +GENERATED += $(OBJDIR)/upg_upgrades_v1.13.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v1.14.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_alpha0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_alpha1.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_alpha2.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_alpha3.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_alpha4.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_beta1.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_beta2.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_beta3.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.0.0_beta4.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.1.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.10.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.11.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.12.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.13.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.14.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.15.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.16.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.17.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.18.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.19.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.2.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.3.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.4.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.5.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.6.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.7.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.8.0.o +GENERATED += $(OBJDIR)/upg_upgrades_v2.9.0.o +OBJECTS += $(OBJDIR)/core_upgrader.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_45754.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_46520.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_47147.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_47887.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_48439.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_48597.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_49290.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_50071.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_50306.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_50392.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_0_51547.o +OBJECTS += $(OBJDIR)/core_upgrader_2_0_2_51773.o +OBJECTS += $(OBJDIR)/core_upgrader_2_10_0_8984.o +OBJECTS += $(OBJDIR)/core_upgrader_2_10_0_9172.o +OBJECTS += $(OBJDIR)/core_upgrader_2_10_0_9560.o +OBJECTS += $(OBJDIR)/core_upgrader_2_10_0_9625.o +OBJECTS += $(OBJDIR)/core_upgrader_2_10_0_9653.o +OBJECTS += $(OBJDIR)/core_upgrader_2_11_0_11056.o +OBJECTS += $(OBJDIR)/core_upgrader_2_12_0_12548.o +OBJECTS += $(OBJDIR)/core_upgrader_2_12_0_12698.o +OBJECTS += $(OBJDIR)/core_upgrader_2_13_0_13590.o +OBJECTS += $(OBJDIR)/core_upgrader_2_14_0_14494.o +OBJECTS += $(OBJDIR)/core_upgrader_2_14_0_14605.o +OBJECTS += $(OBJDIR)/core_upgrader_2_15_0_15495.o +OBJECTS += $(OBJDIR)/core_upgrader_2_15_0_15714.o +OBJECTS += $(OBJDIR)/core_upgrader_2_16_0_16433.o +OBJECTS += $(OBJDIR)/core_upgrader_2_16_0_16626.o +OBJECTS += $(OBJDIR)/core_upgrader_2_16_0_16685.o +OBJECTS += $(OBJDIR)/core_upgrader_2_16_0_16701.o +OBJECTS += $(OBJDIR)/core_upgrader_2_17_0_17463.o +OBJECTS += $(OBJDIR)/core_upgrader_2_17_0_17579.o +OBJECTS += $(OBJDIR)/core_upgrader_2_17_0_17673.o +OBJECTS += $(OBJDIR)/core_upgrader_2_18_0_18518.o +OBJECTS += $(OBJDIR)/core_upgrader_2_18_0_18710.o +OBJECTS += $(OBJDIR)/core_upgrader_2_18_0_18748.o +OBJECTS += $(OBJDIR)/core_upgrader_2_18_0_18759.o +OBJECTS += $(OBJDIR)/core_upgrader_2_19_0_20350.o +OBJECTS += $(OBJDIR)/core_upgrader_2_19_0_20470.o +OBJECTS += $(OBJDIR)/core_upgrader_2_19_0_20475.o +OBJECTS += $(OBJDIR)/core_upgrader_2_19_0_20538.o +OBJECTS += $(OBJDIR)/core_upgrader_2_19_0_20545.o +OBJECTS += $(OBJDIR)/core_upgrader_2_19_0_20554.o +OBJECTS += $(OBJDIR)/core_upgrader_2_19_0_20558.o +OBJECTS += $(OBJDIR)/core_upgrader_2_1_0_53018.o +OBJECTS += $(OBJDIR)/core_upgrader_2_1_0_53244.o +OBJECTS += $(OBJDIR)/core_upgrader_2_2_0_56591.o +OBJECTS += $(OBJDIR)/core_upgrader_2_3_0_59136.o +OBJECTS += $(OBJDIR)/core_upgrader_2_3_0_59175.o +OBJECTS += $(OBJDIR)/core_upgrader_2_3_0_59344.o +OBJECTS += $(OBJDIR)/core_upgrader_2_4_0_61372.o +OBJECTS += $(OBJDIR)/core_upgrader_2_4_0_61427.o +OBJECTS += $(OBJDIR)/core_upgrader_2_4_0_61613.o +OBJECTS += $(OBJDIR)/core_upgrader_2_5_0_63107.o +OBJECTS += $(OBJDIR)/core_upgrader_2_6_0_64722.o +OBJECTS += $(OBJDIR)/core_upgrader_2_6_0_64941.o +OBJECTS += $(OBJDIR)/core_upgrader_2_7_0_835.o +OBJECTS += $(OBJDIR)/core_upgrader_2_8_0_3675.o +OBJECTS += $(OBJDIR)/core_upgrader_2_8_0_3864.o +OBJECTS += $(OBJDIR)/core_upgrader_2_8_0_4071.o +OBJECTS += $(OBJDIR)/core_upgrader_2_9_0_6358.o +OBJECTS += $(OBJDIR)/core_upgrader_2_9_0_6714.o +OBJECTS += $(OBJDIR)/core_upgrades_generated.o +OBJECTS += $(OBJDIR)/manifest.o +OBJECTS += $(OBJDIR)/manifest1.o +OBJECTS += $(OBJDIR)/upg_builder.o +OBJECTS += $(OBJDIR)/upg_data_AnimatedMesh.vert.o +OBJECTS += $(OBJDIR)/upg_data_Animated_Mesh.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Basic.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Basic.pkfx1.o +OBJECTS += $(OBJDIR)/upg_data_BillboardMaterial.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Black.dds.o +OBJECTS += $(OBJDIR)/upg_data_Black.dds1.o +OBJECTS += $(OBJDIR)/upg_data_Blur.h.o +OBJECTS += $(OBJDIR)/upg_data_Circle.fbx.o +OBJECTS += $(OBJDIR)/upg_data_Circle.pkcf.o +OBJECTS += $(OBJDIR)/upg_data_Classic.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Color.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Color_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Core.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Core_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_CurvePresets.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_CurvePresets_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Debug.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Debug_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_DecalMaterial.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Decal_Default.vert.o +OBJECTS += $(OBJDIR)/upg_data_Default_AlphaMap.dds.o +OBJECTS += $(OBJDIR)/upg_data_Default_AlphaMap.dds1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Billboard.frag.o +OBJECTS += $(OBJDIR)/upg_data_Default_Billboard.frag1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Billboard.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Default_Billboard.pkma1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Decal.frag.o +OBJECTS += $(OBJDIR)/upg_data_Default_Decal.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Default_Decal.vert.o +OBJECTS += $(OBJDIR)/upg_data_Default_Light.frag.o +OBJECTS += $(OBJDIR)/upg_data_Default_Light.frag1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Light.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Default_Light.pkma1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Light.vert.o +OBJECTS += $(OBJDIR)/upg_data_Default_Light.vert1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Mesh.frag.o +OBJECTS += $(OBJDIR)/upg_data_Default_Mesh.frag1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Mesh.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Default_Mesh.pkma1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Ribbon.frag.o +OBJECTS += $(OBJDIR)/upg_data_Default_Ribbon.frag1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Ribbon.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Default_Ribbon.pkma1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Sound.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Default_Sound.pkma1.o +OBJECTS += $(OBJDIR)/upg_data_Default_Triangle.frag.o +OBJECTS += $(OBJDIR)/upg_data_Default_Triangle.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Diffuse.dds.o +OBJECTS += $(OBJDIR)/upg_data_Diffuse.dds1.o +OBJECTS += $(OBJDIR)/upg_data_Distort.dds.o +OBJECTS += $(OBJDIR)/upg_data_Distort.dds1.o +OBJECTS += $(OBJDIR)/upg_data_Distortion_Billboard.frag.o +OBJECTS += $(OBJDIR)/upg_data_Distortion_Billboard.frag1.o +OBJECTS += $(OBJDIR)/upg_data_Distortion_Billboard.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Distortion_Billboard.pkma1.o +OBJECTS += $(OBJDIR)/upg_data_Distortion_Ribbon.frag.o +OBJECTS += $(OBJDIR)/upg_data_Distortion_Ribbon.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Dynamics.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Dynamics_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Editor.pkbo.o +OBJECTS += $(OBJDIR)/upg_data_Editor.pkri.o +OBJECTS += $(OBJDIR)/upg_data_Editor.pkri1.o +OBJECTS += $(OBJDIR)/upg_data_Editor_2.9.0.pkri.o +OBJECTS += $(OBJDIR)/upg_data_Events.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Events_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_ExBillboard_Diffuse.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExBillboard_Distortion.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExBillboard_Emissive.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExBillboard_Opaque.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExBillboard_Tinted.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExDecal_Diffuse.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExDecal_Emissive.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExLight_Default.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExMesh_Emissive.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExMesh_Opaque.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExMesh_Tinted.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_CD_Diffuse.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_CD_Distortion.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_CD_Emissive.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_CD_Opaque.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_CD_Tinted.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_Diffuse.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_Distortion.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_Emissive.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_Opaque.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExRibbon_Tinted.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExSound_Default.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExTriangle_Diffuse.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExTriangle_Distortion.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExTriangle_Emissive.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExTriangle_Opaque.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_ExTriangle_Tinted.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_Experimental.pkri.o +OBJECTS += $(OBJDIR)/upg_data_FX_Simple.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_FX_Simple.pkfx1.o +OBJECTS += $(OBJDIR)/upg_data_FeatureAtlas.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureDecal.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureDiffuse.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureDistortion.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureDithering.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureEmissive.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureRibbonCorrectDeformation.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureSoftParticles.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureTint.h.o +OBJECTS += $(OBJDIR)/upg_data_FeatureTransformUVs.h.o +OBJECTS += $(OBJDIR)/upg_data_Legacy.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Legacy_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_LightMaterial.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Light_Default.frag.o +OBJECTS += $(OBJDIR)/upg_data_Light_Default.vert.o +OBJECTS += $(OBJDIR)/upg_data_MeshAnim.pkri.o +OBJECTS += $(OBJDIR)/upg_data_MeshMaterial.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_NMap_Flat.dds.o +OBJECTS += $(OBJDIR)/upg_data_NMap_Flat.dds1.o +OBJECTS += $(OBJDIR)/upg_data_Opaque_Billboard.frag.o +OBJECTS += $(OBJDIR)/upg_data_Opaque_Billboard.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Opaque_Ribbon.frag.o +OBJECTS += $(OBJDIR)/upg_data_Opaque_Ribbon.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Opaque_Triangle.frag.o +OBJECTS += $(OBJDIR)/upg_data_Opaque_Triangle.pkma.1.o +OBJECTS += $(OBJDIR)/upg_data_PKLighting.h.o +OBJECTS += $(OBJDIR)/upg_data_PKOutputColor.h.o +OBJECTS += $(OBJDIR)/upg_data_PKSurface.h.o +OBJECTS += $(OBJDIR)/upg_data_Particle_Master.frag.o +OBJECTS += $(OBJDIR)/upg_data_Particle_Master.frag1.o +OBJECTS += $(OBJDIR)/upg_data_PingPong.fbx.o +OBJECTS += $(OBJDIR)/upg_data_PingPong.pkcf.o +OBJECTS += $(OBJDIR)/upg_data_Placement.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Placement_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_RibbonMaterial.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_SampleLibSettings.pkbo.o +OBJECTS += $(OBJDIR)/upg_data_SampleLibSettings.pkbo1.o +OBJECTS += $(OBJDIR)/upg_data_Samplers.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Samplers_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_SkeletalAnimationTexture.pkri.o +OBJECTS += $(OBJDIR)/upg_data_SoundMaterial.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Sphere.fbx.o +OBJECTS += $(OBJDIR)/upg_data_Trails.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Trails_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Transparent_Mesh.frag.o +OBJECTS += $(OBJDIR)/upg_data_Transparent_Mesh.frag1.o +OBJECTS += $(OBJDIR)/upg_data_Transparent_Mesh.pkma.o +OBJECTS += $(OBJDIR)/upg_data_Transparent_Mesh.pkma1.o +OBJECTS += $(OBJDIR)/upg_data_TriangleMaterial.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Utils.h.o +OBJECTS += $(OBJDIR)/upg_data_Utils.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_Utils_2.9.0.pkfx.o +OBJECTS += $(OBJDIR)/upg_data_White.dds.o +OBJECTS += $(OBJDIR)/upg_data_White.dds1.o +OBJECTS += $(OBJDIR)/upg_helper_axis_system.o +OBJECTS += $(OBJDIR)/upg_helper_core_upgrade.o +OBJECTS += $(OBJDIR)/upg_helper_file.o +OBJECTS += $(OBJDIR)/upg_helper_material.o +OBJECTS += $(OBJDIR)/upg_helper_nodegraph.o +OBJECTS += $(OBJDIR)/upg_helper_script.o +OBJECTS += $(OBJDIR)/upg_helper_string.o +OBJECTS += $(OBJDIR)/upg_import_v1.o +OBJECTS += $(OBJDIR)/upg_logger.o +OBJECTS += $(OBJDIR)/upg_main.o +OBJECTS += $(OBJDIR)/upg_precompiled.o +OBJECTS += $(OBJDIR)/upg_rawfile.o +OBJECTS += $(OBJDIR)/upg_upgrader.o +OBJECTS += $(OBJDIR)/upg_upgrades_hardfix.o +OBJECTS += $(OBJDIR)/upg_upgrades_v1.13.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v1.14.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_alpha0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_alpha1.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_alpha2.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_alpha3.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_alpha4.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_beta1.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_beta2.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_beta3.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.0.0_beta4.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.1.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.10.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.11.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.12.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.13.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.14.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.15.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.16.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.17.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.18.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.19.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.2.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.3.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.4.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.5.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.6.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.7.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.8.0.o +OBJECTS += $(OBJDIR)/upg_upgrades_v2.9.0.o + +# Rules +# ############################################# + +all: $(TARGET) + @: + +$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) + $(PRELINKCMDS) + @echo Linking PK-UpgraderLib + $(SILENT) $(LINKCMD) + $(POSTBUILDCMDS) + +$(TARGETDIR): + @echo Creating $(TARGETDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(TARGETDIR) +else + $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) +endif + +$(OBJDIR): + @echo Creating $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) mkdir -p $(OBJDIR) +else + $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) +endif + +clean: + @echo Cleaning PK-UpgraderLib +ifeq (posix,$(SHELLTYPE)) + $(SILENT) rm -f $(TARGET) + $(SILENT) rm -rf $(GENERATED) + $(SILENT) rm -rf $(OBJDIR) +else + $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) + $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) +endif + +prebuild: | $(OBJDIR) + $(PREBUILDCMDS) + +ifneq (,$(PCH)) +$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) +$(GCH): $(PCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" +$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) +ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" +else + $(SILENT) echo $null >> "$@" +endif +else +$(OBJECTS): | prebuild +endif + + +# File Rules +# ############################################# + +$(OBJDIR)/upg_precompiled.o: ../../ExternalLibs/pk_upgraderlib/src/precompiled/upg_precompiled.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/CoreUpgrades/core_upgrader.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrades_generated.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/CoreUpgrades/core_upgrades_generated.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_45754.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.45754/core_upgrader_2_0_0_45754.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_46520.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.46520/core_upgrader_2_0_0_46520.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_47147.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.47147/core_upgrader_2_0_0_47147.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_47887.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.47887/core_upgrader_2_0_0_47887.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_48439.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.48439/core_upgrader_2_0_0_48439.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_48597.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.48597/core_upgrader_2_0_0_48597.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_49290.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.49290/core_upgrader_2_0_0_49290.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_50071.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.50071/core_upgrader_2_0_0_50071.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_50306.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.50306/core_upgrader_2_0_0_50306.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_50392.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.50392/core_upgrader_2_0_0_50392.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_0_51547.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.0.51547/core_upgrader_2_0_0_51547.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_0_2_51773.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.0.2.51773/core_upgrader_2_0_2_51773.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_1_0_53018.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.1.0.53018/core_upgrader_2_1_0_53018.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_1_0_53244.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.1.0.53244/core_upgrader_2_1_0_53244.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_10_0_8984.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.10.0.8984/core_upgrader_2_10_0_8984.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_10_0_9172.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.10.0.9172/core_upgrader_2_10_0_9172.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_10_0_9560.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.10.0.9560/core_upgrader_2_10_0_9560.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_10_0_9625.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.10.0.9625/core_upgrader_2_10_0_9625.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_10_0_9653.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.10.0.9653/core_upgrader_2_10_0_9653.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_11_0_11056.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.11.0.11056/core_upgrader_2_11_0_11056.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_12_0_12548.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.12.0.12548/core_upgrader_2_12_0_12548.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_12_0_12698.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.12.0.12698/core_upgrader_2_12_0_12698.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_13_0_13590.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.13.0.13590/core_upgrader_2_13_0_13590.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_14_0_14494.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.14.0.14494/core_upgrader_2_14_0_14494.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_14_0_14605.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.14.0.14605/core_upgrader_2_14_0_14605.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_15_0_15495.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.15.0.15495/core_upgrader_2_15_0_15495.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_15_0_15714.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.15.0.15714/core_upgrader_2_15_0_15714.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_16_0_16433.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.16.0.16433/core_upgrader_2_16_0_16433.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_16_0_16626.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.16.0.16626/core_upgrader_2_16_0_16626.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_16_0_16685.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.16.0.16685/core_upgrader_2_16_0_16685.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_16_0_16701.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.16.0.16701/core_upgrader_2_16_0_16701.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_17_0_17463.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.17.0.17463/core_upgrader_2_17_0_17463.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_17_0_17579.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.17.0.17579/core_upgrader_2_17_0_17579.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_17_0_17673.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.17.0.17673/core_upgrader_2_17_0_17673.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_18_0_18518.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.18.0.18518/core_upgrader_2_18_0_18518.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_18_0_18710.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.18.0.18710/core_upgrader_2_18_0_18710.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_18_0_18748.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.18.0.18748/core_upgrader_2_18_0_18748.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_18_0_18759.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.18.0.18759/core_upgrader_2_18_0_18759.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_19_0_20350.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.19.0.20350/core_upgrader_2_19_0_20350.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_19_0_20470.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.19.0.20470/core_upgrader_2_19_0_20470.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_19_0_20475.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.19.0.20475/core_upgrader_2_19_0_20475.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_19_0_20538.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.19.0.20538/core_upgrader_2_19_0_20538.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_19_0_20545.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.19.0.20545/core_upgrader_2_19_0_20545.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_19_0_20554.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.19.0.20554/core_upgrader_2_19_0_20554.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_19_0_20558.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.19.0.20558/core_upgrader_2_19_0_20558.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_2_0_56591.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.2.0.56591/core_upgrader_2_2_0_56591.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_3_0_59136.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.3.0.59136/core_upgrader_2_3_0_59136.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_3_0_59175.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.3.0.59175/core_upgrader_2_3_0_59175.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_3_0_59344.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.3.0.59344/core_upgrader_2_3_0_59344.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_4_0_61372.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.4.0.61372/core_upgrader_2_4_0_61372.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_4_0_61427.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.4.0.61427/core_upgrader_2_4_0_61427.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_4_0_61613.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.4.0.61613/core_upgrader_2_4_0_61613.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_5_0_63107.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.5.0.63107/core_upgrader_2_5_0_63107.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_6_0_64722.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.6.0.64722/core_upgrader_2_6_0_64722.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_6_0_64941.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.6.0.64941/core_upgrader_2_6_0_64941.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_7_0_835.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.7.0.835/core_upgrader_2_7_0_835.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_8_0_3675.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.8.0.3675/core_upgrader_2_8_0_3675.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_8_0_3864.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.8.0.3864/core_upgrader_2_8_0_3864.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_8_0_4071.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.8.0.4071/core_upgrader_2_8_0_4071.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_9_0_6358.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.9.0.6358/core_upgrader_2_9_0_6358.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/core_upgrader_2_9_0_6714.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/2.9.0.6714/core_upgrader_2_9_0_6714.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Black.dds.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/DefaultTextures/upg_data_Black.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_AlphaMap.dds.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/DefaultTextures/upg_data_Default_AlphaMap.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Diffuse.dds.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/DefaultTextures/upg_data_Diffuse.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Distort.dds.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/DefaultTextures/upg_data_Distort.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_NMap_Flat.dds.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/DefaultTextures/upg_data_NMap_Flat.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_White.dds.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/DefaultTextures/upg_data_White.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Editor.pkri.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/Interface/upg_data_Editor.pkri.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Billboard.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Default_Billboard.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Light.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Default_Light.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Mesh.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Default_Mesh.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Ribbon.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Default_Ribbon.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Sound.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Default_Sound.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Distortion_Billboard.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Distortion_Billboard.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Opaque_Billboard.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Opaque_Billboard.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Opaque_Ribbon.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Opaque_Ribbon.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_SampleLibSettings.pkbo.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_SampleLibSettings.pkbo.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Transparent_Mesh.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Materials/upg_data_Transparent_Mesh.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Billboard.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Default_Billboard.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Light.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Default_Light.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Light.vert.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Default_Light.vert.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Mesh.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Default_Mesh.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Ribbon.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Default_Ribbon.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Distortion_Billboard.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Distortion_Billboard.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Opaque_Billboard.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Opaque_Billboard.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Opaque_Ribbon.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Opaque_Ribbon.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Transparent_Mesh.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Shaders/upg_data_Transparent_Mesh.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Classic.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Classic.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Color.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Color.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Color_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Color_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Core.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Core.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Core_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Core_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_CurvePresets.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_CurvePresets.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_CurvePresets_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_CurvePresets_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Debug.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Debug.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Debug_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Debug_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Dynamics.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Dynamics.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Dynamics_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Dynamics_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Events.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Events.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Events_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Events_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Legacy.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Legacy.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Legacy_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Legacy_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Placement.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Placement.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Placement_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Placement_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Samplers.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Samplers.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Samplers_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Samplers_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Trails.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Trails.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Trails_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Trails_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Utils.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Utils.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Utils_2.9.0.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/Library/PopcornFXCore/Templates/upg_data_Utils_2.9.0.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/manifest.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXCore/manifest.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Circle.fbx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/AnimationTracks/upg_data_Circle.fbx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Circle.pkcf.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/AnimationTracks/upg_data_Circle.pkcf.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_PingPong.fbx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/AnimationTracks/upg_data_PingPong.fbx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_PingPong.pkcf.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/AnimationTracks/upg_data_PingPong.pkcf.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Basic.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/Effects/upg_data_Basic.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FX_Simple.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/Effects/upg_data_FX_Simple.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Sphere.fbx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/MaterialEditor/Meshes/upg_data_Sphere.fbx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_BillboardMaterial.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/MaterialEditor/upg_data_BillboardMaterial.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_DecalMaterial.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/MaterialEditor/upg_data_DecalMaterial.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_LightMaterial.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/MaterialEditor/upg_data_LightMaterial.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_MeshMaterial.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/MaterialEditor/upg_data_MeshMaterial.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_RibbonMaterial.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/MaterialEditor/upg_data_RibbonMaterial.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_SoundMaterial.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/MaterialEditor/upg_data_SoundMaterial.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_TriangleMaterial.pkfx.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Presets/MaterialEditor/upg_data_TriangleMaterial.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Basic.pkfx1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Templates/upg_data_Basic.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FX_Simple.pkfx1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Editor/Templates/upg_data_FX_Simple.pkfx.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Editor_2.9.0.pkri.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/Interface/upg_data_Editor_2.9.0.pkri.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Experimental.pkri.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/Interface/upg_data_Experimental.pkri.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_MeshAnim.pkri.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/Interface/upg_data_MeshAnim.pkri.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_SkeletalAnimationTexture.pkri.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/Interface/upg_data_SkeletalAnimationTexture.pkri.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Animated_Mesh.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_Animated_Mesh.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Decal.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_Default_Decal.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Triangle.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_Default_Triangle.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Distortion_Ribbon.pkma.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_Distortion_Ribbon.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExBillboard_Diffuse.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExBillboard_Diffuse.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExBillboard_Distortion.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExBillboard_Distortion.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExBillboard_Emissive.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExBillboard_Emissive.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExBillboard_Opaque.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExBillboard_Opaque.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExBillboard_Tinted.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExBillboard_Tinted.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExDecal_Diffuse.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExDecal_Diffuse.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExDecal_Emissive.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExDecal_Emissive.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExLight_Default.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExLight_Default.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExMesh_Emissive.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExMesh_Emissive.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExMesh_Opaque.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExMesh_Opaque.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExMesh_Tinted.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExMesh_Tinted.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_CD_Diffuse.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_CD_Diffuse.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_CD_Distortion.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_CD_Distortion.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_CD_Emissive.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_CD_Emissive.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_CD_Opaque.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_CD_Opaque.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_CD_Tinted.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_CD_Tinted.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_Diffuse.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_Diffuse.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_Distortion.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_Distortion.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_Emissive.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_Emissive.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_Opaque.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_Opaque.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExRibbon_Tinted.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExRibbon_Tinted.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExSound_Default.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExSound_Default.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExTriangle_Diffuse.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExTriangle_Diffuse.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExTriangle_Distortion.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExTriangle_Distortion.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExTriangle_Emissive.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExTriangle_Emissive.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExTriangle_Opaque.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExTriangle_Opaque.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_ExTriangle_Tinted.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_ExTriangle_Tinted.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Opaque_Triangle.pkma.1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Materials/upg_data_Opaque_Triangle.pkma.1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureAtlas.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureAtlas.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureDecal.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureDecal.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureDiffuse.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureDiffuse.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureDistortion.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureDistortion.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureDithering.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureDithering.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureEmissive.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureEmissive.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureRibbonCorrectDeformation.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureRibbonCorrectDeformation.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureSoftParticles.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureSoftParticles.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureTint.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureTint.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_FeatureTransformUVs.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_FeatureTransformUVs.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_PKLighting.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_PKLighting.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_PKOutputColor.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_PKOutputColor.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_PKSurface.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/includes/upg_data_PKSurface.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Decal_Default.vert.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/upg_data_Decal_Default.vert.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Light_Default.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/upg_data_Light_Default.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Light_Default.vert.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/upg_data_Light_Default.vert.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Particle_Master.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/Experimental/upg_data_Particle_Master.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_AnimatedMesh.vert.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/upg_data_AnimatedMesh.vert.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Decal.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/upg_data_Default_Decal.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Decal.vert.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/upg_data_Default_Decal.vert.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Triangle.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/upg_data_Default_Triangle.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Distortion_Ribbon.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/upg_data_Distortion_Ribbon.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Opaque_Triangle.frag.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/upg_data_Opaque_Triangle.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Particle_Master.frag1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Library/PopcornFXCore/Shaders/upg_data_Particle_Master.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Black.dds1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/DefaultTextures/upg_data_Black.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_AlphaMap.dds1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/DefaultTextures/upg_data_Default_AlphaMap.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Diffuse.dds1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/DefaultTextures/upg_data_Diffuse.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Distort.dds1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/DefaultTextures/upg_data_Distort.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_NMap_Flat.dds1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/DefaultTextures/upg_data_NMap_Flat.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_White.dds1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/DefaultTextures/upg_data_White.dds.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Editor.pkbo.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/Interface/upg_data_Editor.pkbo.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Editor.pkri1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/Interface/upg_data_Editor.pkri.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Billboard.pkma1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/upg_data_Default_Billboard.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Light.pkma1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/upg_data_Default_Light.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Mesh.pkma1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/upg_data_Default_Mesh.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Ribbon.pkma1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/upg_data_Default_Ribbon.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Sound.pkma1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/upg_data_Default_Sound.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Distortion_Billboard.pkma1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/upg_data_Distortion_Billboard.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_SampleLibSettings.pkbo1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/upg_data_SampleLibSettings.pkbo.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Transparent_Mesh.pkma1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Materials/upg_data_Transparent_Mesh.pkma.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Blur.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/ShaderInclude/upg_data_Blur.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Utils.h.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/ShaderInclude/upg_data_Utils.h.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Billboard.frag1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/upg_data_Default_Billboard.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Light.frag1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/upg_data_Default_Light.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Light.vert1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/upg_data_Default_Light.vert.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Mesh.frag1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/upg_data_Default_Mesh.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Default_Ribbon.frag1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/upg_data_Default_Ribbon.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Distortion_Billboard.frag1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/upg_data_Distortion_Billboard.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_data_Transparent_Mesh.frag1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/Shaders/upg_data_Transparent_Mesh.frag.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/manifest1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/Data/PopcornFXEditorCore/manifest.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_import_v1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_import_v1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_hardfix.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_hardfix.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v1.13.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v1.13.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v1.14.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v1.14.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_alpha0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_alpha0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_alpha1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_alpha1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_alpha2.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_alpha2.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_alpha3.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_alpha3.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_alpha4.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_alpha4.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_beta1.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_beta1.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_beta2.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_beta2.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_beta3.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_beta3.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.0.0_beta4.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.0.0_beta4.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.1.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.1.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.10.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.10.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.11.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.11.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.12.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.12.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.13.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.13.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.14.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.14.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.15.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.15.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.16.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.16.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.17.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.17.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.18.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.18.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.19.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.19.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.2.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.2.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.3.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.3.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.4.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.4.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.5.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.5.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.6.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.6.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.7.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.7.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.8.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.8.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrades_v2.9.0.o: ../../ExternalLibs/pk_upgraderlib/src/Upgrades/upg_upgrades_v2.9.0.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_builder.o: ../../ExternalLibs/pk_upgraderlib/src/upg_builder.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_helper_axis_system.o: ../../ExternalLibs/pk_upgraderlib/src/upg_helper_axis_system.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_helper_core_upgrade.o: ../../ExternalLibs/pk_upgraderlib/src/upg_helper_core_upgrade.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_helper_file.o: ../../ExternalLibs/pk_upgraderlib/src/upg_helper_file.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_helper_material.o: ../../ExternalLibs/pk_upgraderlib/src/upg_helper_material.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_helper_nodegraph.o: ../../ExternalLibs/pk_upgraderlib/src/upg_helper_nodegraph.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_helper_script.o: ../../ExternalLibs/pk_upgraderlib/src/upg_helper_script.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_helper_string.o: ../../ExternalLibs/pk_upgraderlib/src/upg_helper_string.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_logger.o: ../../ExternalLibs/pk_upgraderlib/src/upg_logger.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_main.o: ../../ExternalLibs/pk_upgraderlib/src/upg_main.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_rawfile.o: ../../ExternalLibs/pk_upgraderlib/src/upg_rawfile.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" +$(OBJDIR)/upg_upgrader.o: ../../ExternalLibs/pk_upgraderlib/src/upg_upgrader.cpp + @echo "$(notdir $<)" + $(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" + +-include $(OBJECTS:%.o=%.d) +ifneq (,$(PCH)) + -include $(PCH_PLACEHOLDER).d +endif diff --git a/projects/AfterEffects_macosx/PopcornFX_AfterEffectsPlugin.make b/projects/AfterEffects_macosx/PopcornFX_AfterEffectsPlugin.make new file mode 100644 index 00000000..128ab226 --- /dev/null +++ b/projects/AfterEffects_macosx/PopcornFX_AfterEffectsPlugin.make @@ -0,0 +1,168 @@ +# Alternative GNU Make workspace makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +ifeq ($(config),debug_x64) + PK_Runtime_SDK1_config = debug_x64 + PK_Discretizers_SDK1_config = debug_x64 + PK_ParticlesToolbox_SDK1_config = debug_x64 + PK_RenderHelpers_SDK1_config = debug_x64 + PK_RHI_SDK1_config = debug_x64 + PK_SampleLib_config = debug_x64 + PK_MCPP_SDK1_config = debug_x64 + PK_AssetBakerLib_config = debug_x64 + AE_Effect_Emitter_config = debug_x64 + AE_Effect_AttributeSampler_config = debug_x64 + AE_Effect_Attribute_config = debug_x64 + AE_GeneralPlugin_config = debug_x64 + +else ifeq ($(config),release_x64) + PK_Runtime_SDK1_config = release_x64 + PK_Discretizers_SDK1_config = release_x64 + PK_ParticlesToolbox_SDK1_config = release_x64 + PK_RenderHelpers_SDK1_config = release_x64 + PK_RHI_SDK1_config = release_x64 + PK_SampleLib_config = release_x64 + PK_MCPP_SDK1_config = release_x64 + PK_AssetBakerLib_config = release_x64 + AE_Effect_Emitter_config = release_x64 + AE_Effect_AttributeSampler_config = release_x64 + AE_Effect_Attribute_config = release_x64 + AE_GeneralPlugin_config = release_x64 + +else + $(error "invalid configuration $(config)") +endif + +PROJECTS := PK-Runtime_SDK1 PK-Discretizers_SDK1 PK-ParticlesToolbox_SDK1 PK-RenderHelpers_SDK1 PK-RHI_SDK1 PK-SampleLib PK-MCPP_SDK1 PK-AssetBakerLib AE_Effect_Emitter AE_Effect_AttributeSampler AE_Effect_Attribute AE_GeneralPlugin + +.PHONY: all clean help $(PROJECTS) AE Integration Runtime Tools Tools/AssetBaker + +all: $(PROJECTS) + +AE: AE_Effect_Attribute AE_Effect_AttributeSampler AE_Effect_Emitter AE_GeneralPlugin + +Integration: PK-RHI_SDK1 PK-RenderHelpers_SDK1 PK-SampleLib + +Runtime: PK-Discretizers_SDK1 PK-ParticlesToolbox_SDK1 PK-Runtime_SDK1 + +Tools: Tools/AssetBaker PK-MCPP_SDK1 + +Tools/AssetBaker: PK-AssetBakerLib + +PK-Runtime_SDK1: +ifneq (,$(PK_Runtime_SDK1_config)) + @echo "==== Building PK-Runtime_SDK1 ($(PK_Runtime_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Runtime_SDK1.make config=$(PK_Runtime_SDK1_config) +endif + +PK-Discretizers_SDK1: +ifneq (,$(PK_Discretizers_SDK1_config)) + @echo "==== Building PK-Discretizers_SDK1 ($(PK_Discretizers_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Discretizers_SDK1.make config=$(PK_Discretizers_SDK1_config) +endif + +PK-ParticlesToolbox_SDK1: +ifneq (,$(PK_ParticlesToolbox_SDK1_config)) + @echo "==== Building PK-ParticlesToolbox_SDK1 ($(PK_ParticlesToolbox_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-ParticlesToolbox_SDK1.make config=$(PK_ParticlesToolbox_SDK1_config) +endif + +PK-RenderHelpers_SDK1: +ifneq (,$(PK_RenderHelpers_SDK1_config)) + @echo "==== Building PK-RenderHelpers_SDK1 ($(PK_RenderHelpers_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-RenderHelpers_SDK1.make config=$(PK_RenderHelpers_SDK1_config) +endif + +PK-RHI_SDK1: +ifneq (,$(PK_RHI_SDK1_config)) + @echo "==== Building PK-RHI_SDK1 ($(PK_RHI_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-RHI_SDK1.make config=$(PK_RHI_SDK1_config) +endif + +PK-SampleLib: +ifneq (,$(PK_SampleLib_config)) + @echo "==== Building PK-SampleLib ($(PK_SampleLib_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-SampleLib.make config=$(PK_SampleLib_config) +endif + +PK-MCPP_SDK1: +ifneq (,$(PK_MCPP_SDK1_config)) + @echo "==== Building PK-MCPP_SDK1 ($(PK_MCPP_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-MCPP_SDK1.make config=$(PK_MCPP_SDK1_config) +endif + +PK-AssetBakerLib: +ifneq (,$(PK_AssetBakerLib_config)) + @echo "==== Building PK-AssetBakerLib ($(PK_AssetBakerLib_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-AssetBakerLib.make config=$(PK_AssetBakerLib_config) +endif + +AE_Effect_Emitter: +ifneq (,$(AE_Effect_Emitter_config)) + @echo "==== Building AE_Effect_Emitter ($(AE_Effect_Emitter_config)) ====" + @${MAKE} --no-print-directory -C . -f AE_Effect_Emitter.make config=$(AE_Effect_Emitter_config) +endif + +AE_Effect_AttributeSampler: AE_Effect_Emitter +ifneq (,$(AE_Effect_AttributeSampler_config)) + @echo "==== Building AE_Effect_AttributeSampler ($(AE_Effect_AttributeSampler_config)) ====" + @${MAKE} --no-print-directory -C . -f AE_Effect_AttributeSampler.make config=$(AE_Effect_AttributeSampler_config) +endif + +AE_Effect_Attribute: AE_Effect_Emitter +ifneq (,$(AE_Effect_Attribute_config)) + @echo "==== Building AE_Effect_Attribute ($(AE_Effect_Attribute_config)) ====" + @${MAKE} --no-print-directory -C . -f AE_Effect_Attribute.make config=$(AE_Effect_Attribute_config) +endif + +AE_GeneralPlugin: PK-AssetBakerLib PK-SampleLib AE_Effect_Emitter AE_Effect_Attribute AE_Effect_AttributeSampler +ifneq (,$(AE_GeneralPlugin_config)) + @echo "==== Building AE_GeneralPlugin ($(AE_GeneralPlugin_config)) ====" + @${MAKE} --no-print-directory -C . -f AE_GeneralPlugin.make config=$(AE_GeneralPlugin_config) +endif + +clean: + @${MAKE} --no-print-directory -C . -f PK-Runtime_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-Discretizers_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-ParticlesToolbox_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-RenderHelpers_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-RHI_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-SampleLib.make clean + @${MAKE} --no-print-directory -C . -f PK-MCPP_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-AssetBakerLib.make clean + @${MAKE} --no-print-directory -C . -f AE_Effect_Emitter.make clean + @${MAKE} --no-print-directory -C . -f AE_Effect_AttributeSampler.make clean + @${MAKE} --no-print-directory -C . -f AE_Effect_Attribute.make clean + @${MAKE} --no-print-directory -C . -f AE_GeneralPlugin.make clean + +help: + @echo "Usage: make [config=name] [target]" + @echo "" + @echo "CONFIGURATIONS:" + @echo " debug_x64" + @echo " release_x64" + @echo "" + @echo "TARGETS:" + @echo " all (default)" + @echo " clean" + @echo " PK-Runtime_SDK1" + @echo " PK-Discretizers_SDK1" + @echo " PK-ParticlesToolbox_SDK1" + @echo " PK-RenderHelpers_SDK1" + @echo " PK-RHI_SDK1" + @echo " PK-SampleLib" + @echo " PK-MCPP_SDK1" + @echo " PK-AssetBakerLib" + @echo " AE_Effect_Emitter" + @echo " AE_Effect_AttributeSampler" + @echo " AE_Effect_Attribute" + @echo " AE_GeneralPlugin" + @echo "" + @echo "For more information, see https://github.com/premake/premake-core/wiki" diff --git a/projects/AfterEffects_macosx/PopcornFX_SDK1.make b/projects/AfterEffects_macosx/PopcornFX_SDK1.make new file mode 100644 index 00000000..78c847a1 --- /dev/null +++ b/projects/AfterEffects_macosx/PopcornFX_SDK1.make @@ -0,0 +1,372 @@ +# Alternative GNU Make workspace makefile autogenerated by Premake + +ifndef config + config=debug_x64 +endif + +ifndef verbose + SILENT = @ +endif + +ifeq ($(config),debug_x64) + PK_Runtime_SDK1_config = debug_x64 + PK_Discretizers_SDK1_config = debug_x64 + PK_ParticlesToolbox_SDK1_config = debug_x64 + PK_AssetBakerLib_config = debug_x64 + PK_AssetBaker_config = debug_x64 + PK_UpgraderLib_config = debug_x64 + PK_Upgrader_config = debug_x64 + PK_Sample_01_BasicStartup_config = debug_x64 + PK_Sample_02_BasicEvolve_config = debug_x64 + PK_Sample_03_EngineHooks_config = debug_x64 + PK_Sample_04_Baking_config = debug_x64 + PK_Sample_05_Upgrader_config = debug_x64 + PK_RenderHelpers_SDK1_config = debug_x64 + PK_RHI_SDK1_config = debug_x64 + PK_SampleLib_config = debug_x64 + PK_ShaderTool_config = debug_x64 + PK_MCPP_SDK1_config = debug_x64 + PK_Sample_01_BasicRendering_config = debug_x64 + PK_Sample_02_FullIntegration_config = debug_x64 + PK_Sample_04_EffectInterface_config = debug_x64 + PK_Sample_05_Stats_config = debug_x64 + PK_Sample_06_SimInterface_config = debug_x64 + PK_Sample_06_SimInterfaceGPU_config = debug_x64 + PK_Sample_07_LOD_config = debug_x64 + PK_Sample_08_CustomCollision_config = debug_x64 + PK_Sample_09_AsyncLoading_config = debug_x64 + PK_Sample_10_AsyncRendering_config = debug_x64 + PK_Sample_11_ThreadPool_config = debug_x64 + PK_Sample_12_GBufferSampling_config = debug_x64 + +else ifeq ($(config),release_x64) + PK_Runtime_SDK1_config = release_x64 + PK_Discretizers_SDK1_config = release_x64 + PK_ParticlesToolbox_SDK1_config = release_x64 + PK_AssetBakerLib_config = release_x64 + PK_AssetBaker_config = release_x64 + PK_UpgraderLib_config = release_x64 + PK_Upgrader_config = release_x64 + PK_Sample_01_BasicStartup_config = release_x64 + PK_Sample_02_BasicEvolve_config = release_x64 + PK_Sample_03_EngineHooks_config = release_x64 + PK_Sample_04_Baking_config = release_x64 + PK_Sample_05_Upgrader_config = release_x64 + PK_RenderHelpers_SDK1_config = release_x64 + PK_RHI_SDK1_config = release_x64 + PK_SampleLib_config = release_x64 + PK_ShaderTool_config = release_x64 + PK_MCPP_SDK1_config = release_x64 + PK_Sample_01_BasicRendering_config = release_x64 + PK_Sample_02_FullIntegration_config = release_x64 + PK_Sample_04_EffectInterface_config = release_x64 + PK_Sample_05_Stats_config = release_x64 + PK_Sample_06_SimInterface_config = release_x64 + PK_Sample_06_SimInterfaceGPU_config = release_x64 + PK_Sample_07_LOD_config = release_x64 + PK_Sample_08_CustomCollision_config = release_x64 + PK_Sample_09_AsyncLoading_config = release_x64 + PK_Sample_10_AsyncRendering_config = release_x64 + PK_Sample_11_ThreadPool_config = release_x64 + PK_Sample_12_GBufferSampling_config = release_x64 + +else ifeq ($(config),retail_x64) + PK_Runtime_SDK1_config = retail_x64 + PK_Discretizers_SDK1_config = retail_x64 + PK_ParticlesToolbox_SDK1_config = retail_x64 + PK_AssetBakerLib_config = retail_x64 + PK_UpgraderLib_config = retail_x64 + PK_Upgrader_config = retail_x64 + PK_Sample_01_BasicStartup_config = retail_x64 + PK_Sample_02_BasicEvolve_config = retail_x64 + PK_Sample_03_EngineHooks_config = retail_x64 + PK_Sample_04_Baking_config = retail_x64 + PK_Sample_05_Upgrader_config = retail_x64 + PK_RenderHelpers_SDK1_config = retail_x64 + PK_RHI_SDK1_config = retail_x64 + PK_SampleLib_config = retail_x64 + PK_MCPP_SDK1_config = retail_x64 + PK_Sample_01_BasicRendering_config = retail_x64 + PK_Sample_02_FullIntegration_config = retail_x64 + PK_Sample_04_EffectInterface_config = retail_x64 + PK_Sample_05_Stats_config = retail_x64 + PK_Sample_06_SimInterface_config = retail_x64 + PK_Sample_06_SimInterfaceGPU_config = retail_x64 + PK_Sample_07_LOD_config = retail_x64 + PK_Sample_08_CustomCollision_config = retail_x64 + PK_Sample_09_AsyncLoading_config = retail_x64 + PK_Sample_10_AsyncRendering_config = retail_x64 + PK_Sample_11_ThreadPool_config = retail_x64 + PK_Sample_12_GBufferSampling_config = retail_x64 + +else + $(error "invalid configuration $(config)") +endif + +PROJECTS := PK-Runtime_SDK1 PK-Discretizers_SDK1 PK-ParticlesToolbox_SDK1 PK-AssetBakerLib PK-AssetBaker PK-UpgraderLib PK-Upgrader PK-Sample_01_BasicStartup PK-Sample_02_BasicEvolve PK-Sample_03_EngineHooks PK-Sample_04_Baking PK-Sample_05_Upgrader PK-RenderHelpers_SDK1 PK-RHI_SDK1 PK-SampleLib PK-ShaderTool PK-MCPP_SDK1 PK-Sample_01_BasicRendering PK-Sample_02_FullIntegration PK-Sample_04_EffectInterface PK-Sample_05_Stats PK-Sample_06_SimInterface PK-Sample_06_SimInterfaceGPU PK-Sample_07_LOD PK-Sample_08_CustomCollision PK-Sample_09_AsyncLoading PK-Sample_10_AsyncRendering PK-Sample_11_ThreadPool PK-Sample_12_GBufferSampling + +.PHONY: all clean help $(PROJECTS) Rendering Runtime Samples Samples/Basic Tools Tools/AssetBaker Tools/Upgrader + +all: $(PROJECTS) + +Rendering: PK-RHI_SDK1 PK-RenderHelpers_SDK1 PK-SampleLib + +Runtime: PK-Discretizers_SDK1 PK-ParticlesToolbox_SDK1 PK-Runtime_SDK1 + +Samples: Samples/Basic PK-Sample_01_BasicRendering PK-Sample_02_FullIntegration PK-Sample_04_EffectInterface PK-Sample_05_Stats PK-Sample_06_SimInterface PK-Sample_06_SimInterfaceGPU PK-Sample_07_LOD PK-Sample_08_CustomCollision PK-Sample_09_AsyncLoading PK-Sample_10_AsyncRendering PK-Sample_11_ThreadPool PK-Sample_12_GBufferSampling + +Samples/Basic: PK-Sample_01_BasicStartup PK-Sample_02_BasicEvolve PK-Sample_03_EngineHooks PK-Sample_04_Baking PK-Sample_05_Upgrader + +Tools: Tools/AssetBaker Tools/Upgrader PK-MCPP_SDK1 PK-ShaderTool + +Tools/AssetBaker: PK-AssetBaker PK-AssetBakerLib + +Tools/Upgrader: PK-Upgrader PK-UpgraderLib + +PK-Runtime_SDK1: +ifneq (,$(PK_Runtime_SDK1_config)) + @echo "==== Building PK-Runtime_SDK1 ($(PK_Runtime_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Runtime_SDK1.make config=$(PK_Runtime_SDK1_config) +endif + +PK-Discretizers_SDK1: +ifneq (,$(PK_Discretizers_SDK1_config)) + @echo "==== Building PK-Discretizers_SDK1 ($(PK_Discretizers_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Discretizers_SDK1.make config=$(PK_Discretizers_SDK1_config) +endif + +PK-ParticlesToolbox_SDK1: +ifneq (,$(PK_ParticlesToolbox_SDK1_config)) + @echo "==== Building PK-ParticlesToolbox_SDK1 ($(PK_ParticlesToolbox_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-ParticlesToolbox_SDK1.make config=$(PK_ParticlesToolbox_SDK1_config) +endif + +PK-AssetBakerLib: +ifneq (,$(PK_AssetBakerLib_config)) + @echo "==== Building PK-AssetBakerLib ($(PK_AssetBakerLib_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-AssetBakerLib.make config=$(PK_AssetBakerLib_config) +endif + +PK-AssetBaker: PK-AssetBakerLib PK-UpgraderLib +ifneq (,$(PK_AssetBaker_config)) + @echo "==== Building PK-AssetBaker ($(PK_AssetBaker_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-AssetBaker.make config=$(PK_AssetBaker_config) +endif + +PK-UpgraderLib: +ifneq (,$(PK_UpgraderLib_config)) + @echo "==== Building PK-UpgraderLib ($(PK_UpgraderLib_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-UpgraderLib.make config=$(PK_UpgraderLib_config) +endif + +PK-Upgrader: PK-UpgraderLib +ifneq (,$(PK_Upgrader_config)) + @echo "==== Building PK-Upgrader ($(PK_Upgrader_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Upgrader.make config=$(PK_Upgrader_config) +endif + +PK-Sample_01_BasicStartup: +ifneq (,$(PK_Sample_01_BasicStartup_config)) + @echo "==== Building PK-Sample_01_BasicStartup ($(PK_Sample_01_BasicStartup_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_01_BasicStartup.make config=$(PK_Sample_01_BasicStartup_config) +endif + +PK-Sample_02_BasicEvolve: +ifneq (,$(PK_Sample_02_BasicEvolve_config)) + @echo "==== Building PK-Sample_02_BasicEvolve ($(PK_Sample_02_BasicEvolve_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_02_BasicEvolve.make config=$(PK_Sample_02_BasicEvolve_config) +endif + +PK-Sample_03_EngineHooks: +ifneq (,$(PK_Sample_03_EngineHooks_config)) + @echo "==== Building PK-Sample_03_EngineHooks ($(PK_Sample_03_EngineHooks_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_03_EngineHooks.make config=$(PK_Sample_03_EngineHooks_config) +endif + +PK-Sample_04_Baking: PK-AssetBakerLib +ifneq (,$(PK_Sample_04_Baking_config)) + @echo "==== Building PK-Sample_04_Baking ($(PK_Sample_04_Baking_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_04_Baking.make config=$(PK_Sample_04_Baking_config) +endif + +PK-Sample_05_Upgrader: PK-UpgraderLib +ifneq (,$(PK_Sample_05_Upgrader_config)) + @echo "==== Building PK-Sample_05_Upgrader ($(PK_Sample_05_Upgrader_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_05_Upgrader.make config=$(PK_Sample_05_Upgrader_config) +endif + +PK-RenderHelpers_SDK1: +ifneq (,$(PK_RenderHelpers_SDK1_config)) + @echo "==== Building PK-RenderHelpers_SDK1 ($(PK_RenderHelpers_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-RenderHelpers_SDK1.make config=$(PK_RenderHelpers_SDK1_config) +endif + +PK-RHI_SDK1: +ifneq (,$(PK_RHI_SDK1_config)) + @echo "==== Building PK-RHI_SDK1 ($(PK_RHI_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-RHI_SDK1.make config=$(PK_RHI_SDK1_config) +endif + +PK-SampleLib: +ifneq (,$(PK_SampleLib_config)) + @echo "==== Building PK-SampleLib ($(PK_SampleLib_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-SampleLib.make config=$(PK_SampleLib_config) +endif + +PK-ShaderTool: PK-SampleLib +ifneq (,$(PK_ShaderTool_config)) + @echo "==== Building PK-ShaderTool ($(PK_ShaderTool_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-ShaderTool.make config=$(PK_ShaderTool_config) +endif + +PK-MCPP_SDK1: +ifneq (,$(PK_MCPP_SDK1_config)) + @echo "==== Building PK-MCPP_SDK1 ($(PK_MCPP_SDK1_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-MCPP_SDK1.make config=$(PK_MCPP_SDK1_config) +endif + +PK-Sample_01_BasicRendering: PK-SampleLib +ifneq (,$(PK_Sample_01_BasicRendering_config)) + @echo "==== Building PK-Sample_01_BasicRendering ($(PK_Sample_01_BasicRendering_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_01_BasicRendering.make config=$(PK_Sample_01_BasicRendering_config) +endif + +PK-Sample_02_FullIntegration: PK-SampleLib +ifneq (,$(PK_Sample_02_FullIntegration_config)) + @echo "==== Building PK-Sample_02_FullIntegration ($(PK_Sample_02_FullIntegration_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_02_FullIntegration.make config=$(PK_Sample_02_FullIntegration_config) +endif + +PK-Sample_04_EffectInterface: PK-SampleLib +ifneq (,$(PK_Sample_04_EffectInterface_config)) + @echo "==== Building PK-Sample_04_EffectInterface ($(PK_Sample_04_EffectInterface_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_04_EffectInterface.make config=$(PK_Sample_04_EffectInterface_config) +endif + +PK-Sample_05_Stats: PK-SampleLib +ifneq (,$(PK_Sample_05_Stats_config)) + @echo "==== Building PK-Sample_05_Stats ($(PK_Sample_05_Stats_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_05_Stats.make config=$(PK_Sample_05_Stats_config) +endif + +PK-Sample_06_SimInterface: PK-SampleLib +ifneq (,$(PK_Sample_06_SimInterface_config)) + @echo "==== Building PK-Sample_06_SimInterface ($(PK_Sample_06_SimInterface_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_06_SimInterface.make config=$(PK_Sample_06_SimInterface_config) +endif + +PK-Sample_06_SimInterfaceGPU: PK-SampleLib +ifneq (,$(PK_Sample_06_SimInterfaceGPU_config)) + @echo "==== Building PK-Sample_06_SimInterfaceGPU ($(PK_Sample_06_SimInterfaceGPU_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_06_SimInterfaceGPU.make config=$(PK_Sample_06_SimInterfaceGPU_config) +endif + +PK-Sample_07_LOD: PK-SampleLib +ifneq (,$(PK_Sample_07_LOD_config)) + @echo "==== Building PK-Sample_07_LOD ($(PK_Sample_07_LOD_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_07_LOD.make config=$(PK_Sample_07_LOD_config) +endif + +PK-Sample_08_CustomCollision: PK-SampleLib +ifneq (,$(PK_Sample_08_CustomCollision_config)) + @echo "==== Building PK-Sample_08_CustomCollision ($(PK_Sample_08_CustomCollision_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_08_CustomCollision.make config=$(PK_Sample_08_CustomCollision_config) +endif + +PK-Sample_09_AsyncLoading: PK-SampleLib +ifneq (,$(PK_Sample_09_AsyncLoading_config)) + @echo "==== Building PK-Sample_09_AsyncLoading ($(PK_Sample_09_AsyncLoading_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_09_AsyncLoading.make config=$(PK_Sample_09_AsyncLoading_config) +endif + +PK-Sample_10_AsyncRendering: PK-SampleLib +ifneq (,$(PK_Sample_10_AsyncRendering_config)) + @echo "==== Building PK-Sample_10_AsyncRendering ($(PK_Sample_10_AsyncRendering_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_10_AsyncRendering.make config=$(PK_Sample_10_AsyncRendering_config) +endif + +PK-Sample_11_ThreadPool: PK-SampleLib +ifneq (,$(PK_Sample_11_ThreadPool_config)) + @echo "==== Building PK-Sample_11_ThreadPool ($(PK_Sample_11_ThreadPool_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_11_ThreadPool.make config=$(PK_Sample_11_ThreadPool_config) +endif + +PK-Sample_12_GBufferSampling: PK-SampleLib +ifneq (,$(PK_Sample_12_GBufferSampling_config)) + @echo "==== Building PK-Sample_12_GBufferSampling ($(PK_Sample_12_GBufferSampling_config)) ====" + @${MAKE} --no-print-directory -C . -f PK-Sample_12_GBufferSampling.make config=$(PK_Sample_12_GBufferSampling_config) +endif + +clean: + @${MAKE} --no-print-directory -C . -f PK-Runtime_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-Discretizers_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-ParticlesToolbox_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-AssetBakerLib.make clean + @${MAKE} --no-print-directory -C . -f PK-AssetBaker.make clean + @${MAKE} --no-print-directory -C . -f PK-UpgraderLib.make clean + @${MAKE} --no-print-directory -C . -f PK-Upgrader.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_01_BasicStartup.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_02_BasicEvolve.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_03_EngineHooks.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_04_Baking.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_05_Upgrader.make clean + @${MAKE} --no-print-directory -C . -f PK-RenderHelpers_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-RHI_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-SampleLib.make clean + @${MAKE} --no-print-directory -C . -f PK-ShaderTool.make clean + @${MAKE} --no-print-directory -C . -f PK-MCPP_SDK1.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_01_BasicRendering.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_02_FullIntegration.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_04_EffectInterface.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_05_Stats.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_06_SimInterface.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_06_SimInterfaceGPU.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_07_LOD.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_08_CustomCollision.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_09_AsyncLoading.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_10_AsyncRendering.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_11_ThreadPool.make clean + @${MAKE} --no-print-directory -C . -f PK-Sample_12_GBufferSampling.make clean + +help: + @echo "Usage: make [config=name] [target]" + @echo "" + @echo "CONFIGURATIONS:" + @echo " debug_x64" + @echo " release_x64" + @echo " retail_x64" + @echo "" + @echo "TARGETS:" + @echo " all (default)" + @echo " clean" + @echo " PK-Runtime_SDK1" + @echo " PK-Discretizers_SDK1" + @echo " PK-ParticlesToolbox_SDK1" + @echo " PK-AssetBakerLib" + @echo " PK-AssetBaker" + @echo " PK-UpgraderLib" + @echo " PK-Upgrader" + @echo " PK-Sample_01_BasicStartup" + @echo " PK-Sample_02_BasicEvolve" + @echo " PK-Sample_03_EngineHooks" + @echo " PK-Sample_04_Baking" + @echo " PK-Sample_05_Upgrader" + @echo " PK-RenderHelpers_SDK1" + @echo " PK-RHI_SDK1" + @echo " PK-SampleLib" + @echo " PK-ShaderTool" + @echo " PK-MCPP_SDK1" + @echo " PK-Sample_01_BasicRendering" + @echo " PK-Sample_02_FullIntegration" + @echo " PK-Sample_04_EffectInterface" + @echo " PK-Sample_05_Stats" + @echo " PK-Sample_06_SimInterface" + @echo " PK-Sample_06_SimInterfaceGPU" + @echo " PK-Sample_07_LOD" + @echo " PK-Sample_08_CustomCollision" + @echo " PK-Sample_09_AsyncLoading" + @echo " PK-Sample_10_AsyncRendering" + @echo " PK-Sample_11_ThreadPool" + @echo " PK-Sample_12_GBufferSampling" + @echo "" + @echo "For more information, see https://github.com/premake/premake-core/wiki" diff --git a/projects/AfterEffects_macosx/Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.args b/projects/AfterEffects_macosx/Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.args new file mode 100644 index 00000000..85dd6eaf --- /dev/null +++ b/projects/AfterEffects_macosx/Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.args @@ -0,0 +1,53 @@ +-D_DEBUG +-DPK_COMPILER_BUILD_COMPILER_D3D11=1 +-DPK_COMPILER_BUILD_COMPILER_D3D12=1 +-DUSE_POSIX_API=1 +-D__MWERKS__=0 +-DA_INTERNAL_TEST_ONE=0 +-DWEB_ENV=0 +-DPK_BUILD_WITH_FMODEX_SUPPORT=0 +-DPK_BUILD_WITH_SDL=0 +-DPK_BUILD_WITH_D3D11_SUPPORT=0 +-DPK_BUILD_WITH_D3D12_SUPPORT=0 +-DQT_NO_KEYWORDS +-DQT_NO_SIGNALS_SLOTS_KEYWORDS +-DPK_BUILD_WITH_METAL_SUPPORT=1 +-DPK_BUILD_WITH_OGL_SUPPORT=1 +-DGL_GLEXT_PROTOTYPES +-DGLEW_STATIC +-DGLEW_NO_GLU +-DMACOSX +-DQT_CORE_LIB +-DQT_WIDGETS_LIB +-DQT_NETWORK_LIB +-DQT_XML_LIB +-DQT_GUI_LIB +-I../../AE_GeneralPlugin/Sources +-I../../AE_GeneralPlugin/Include +-I../../AE_GeneralPlugin/Precompiled +-I../../AE_Suites +-I../../External/AE SDK/Resources +-I../../External/AE SDK/Headers +-I../../External/AE SDK/Util +-I../../External/AE SDK/Headers/SP +-I../../External/AE SDK/Headers/adobesdk +-I../../External/AE SDK/Headers/SP/artemis +-I../../External/AE SDK/Headers/SP/photoshop +-I../../External/AE SDK/Headers/SP/artemis/config +-I../../External/AE SDK/Headers/SP/photoshop/config +-I../../External/AE SDK/Headers/adobesdk/config +-I../../External/AE SDK/Headers/adobesdk/drawbotsuite +-I../../ExternalLibs/Runtime +-I../../ExternalLibs/Runtime/include +-I../../ExternalLibs/Runtime/include/license/AfterEffects +-I../../ExternalLibs +-I../../Samples +-I../../ExternalLibs/GL/include +-I$(QTDIR)/include +-I$(QTDIR)/include/QtCore +-I$(QTDIR)/include/QtWidgets +-I$(QTDIR)/include/QtNetwork +-I$(QTDIR)/include/QtXml +-I$(QTDIR)/include/QtGui +-D__AEGP_PK_BEGIN=namespace AEGPPk { +-D__AEGP_PK_END=} diff --git a/projects/AfterEffects_macosx/Qt/x64/Debug/moc_AEGP_PanelQT.args b/projects/AfterEffects_macosx/Qt/x64/Debug/moc_AEGP_PanelQT.args new file mode 100644 index 00000000..85dd6eaf --- /dev/null +++ b/projects/AfterEffects_macosx/Qt/x64/Debug/moc_AEGP_PanelQT.args @@ -0,0 +1,53 @@ +-D_DEBUG +-DPK_COMPILER_BUILD_COMPILER_D3D11=1 +-DPK_COMPILER_BUILD_COMPILER_D3D12=1 +-DUSE_POSIX_API=1 +-D__MWERKS__=0 +-DA_INTERNAL_TEST_ONE=0 +-DWEB_ENV=0 +-DPK_BUILD_WITH_FMODEX_SUPPORT=0 +-DPK_BUILD_WITH_SDL=0 +-DPK_BUILD_WITH_D3D11_SUPPORT=0 +-DPK_BUILD_WITH_D3D12_SUPPORT=0 +-DQT_NO_KEYWORDS +-DQT_NO_SIGNALS_SLOTS_KEYWORDS +-DPK_BUILD_WITH_METAL_SUPPORT=1 +-DPK_BUILD_WITH_OGL_SUPPORT=1 +-DGL_GLEXT_PROTOTYPES +-DGLEW_STATIC +-DGLEW_NO_GLU +-DMACOSX +-DQT_CORE_LIB +-DQT_WIDGETS_LIB +-DQT_NETWORK_LIB +-DQT_XML_LIB +-DQT_GUI_LIB +-I../../AE_GeneralPlugin/Sources +-I../../AE_GeneralPlugin/Include +-I../../AE_GeneralPlugin/Precompiled +-I../../AE_Suites +-I../../External/AE SDK/Resources +-I../../External/AE SDK/Headers +-I../../External/AE SDK/Util +-I../../External/AE SDK/Headers/SP +-I../../External/AE SDK/Headers/adobesdk +-I../../External/AE SDK/Headers/SP/artemis +-I../../External/AE SDK/Headers/SP/photoshop +-I../../External/AE SDK/Headers/SP/artemis/config +-I../../External/AE SDK/Headers/SP/photoshop/config +-I../../External/AE SDK/Headers/adobesdk/config +-I../../External/AE SDK/Headers/adobesdk/drawbotsuite +-I../../ExternalLibs/Runtime +-I../../ExternalLibs/Runtime/include +-I../../ExternalLibs/Runtime/include/license/AfterEffects +-I../../ExternalLibs +-I../../Samples +-I../../ExternalLibs/GL/include +-I$(QTDIR)/include +-I$(QTDIR)/include/QtCore +-I$(QTDIR)/include/QtWidgets +-I$(QTDIR)/include/QtNetwork +-I$(QTDIR)/include/QtXml +-I$(QTDIR)/include/QtGui +-D__AEGP_PK_BEGIN=namespace AEGPPk { +-D__AEGP_PK_END=} diff --git a/projects/AfterEffects_macosx/Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.args b/projects/AfterEffects_macosx/Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.args new file mode 100644 index 00000000..5688a434 --- /dev/null +++ b/projects/AfterEffects_macosx/Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.args @@ -0,0 +1,54 @@ +-DNDEBUG +-DPK_COMPILER_BUILD_COMPILER_D3D11=1 +-DPK_COMPILER_BUILD_COMPILER_D3D12=1 +-DUSE_POSIX_API=1 +-D__MWERKS__=0 +-DA_INTERNAL_TEST_ONE=0 +-DWEB_ENV=0 +-DPK_BUILD_WITH_FMODEX_SUPPORT=0 +-DPK_BUILD_WITH_SDL=0 +-DPK_BUILD_WITH_D3D11_SUPPORT=0 +-DPK_BUILD_WITH_D3D12_SUPPORT=0 +-DQT_NO_DEBUG +-DQT_NO_KEYWORDS +-DQT_NO_SIGNALS_SLOTS_KEYWORDS +-DPK_BUILD_WITH_METAL_SUPPORT=1 +-DPK_BUILD_WITH_OGL_SUPPORT=1 +-DGL_GLEXT_PROTOTYPES +-DGLEW_STATIC +-DGLEW_NO_GLU +-DMACOSX +-DQT_CORE_LIB +-DQT_WIDGETS_LIB +-DQT_NETWORK_LIB +-DQT_XML_LIB +-DQT_GUI_LIB +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Sources +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Include +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Precompiled +-I../../Integrations/AfterEffects/AE_Suites +-I../../Integrations/AfterEffects/External/AE SDK/Resources +-I../../Integrations/AfterEffects/External/AE SDK/Headers +-I../../Integrations/AfterEffects/External/AE SDK/Util +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/artemis +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/photoshop +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/artemis/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/photoshop/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/drawbotsuite +-I../../Runtime +-I../../Runtime/include +-I../../Runtime/include/license/AfterEffects +-I../../Tools +-I../../SDK/Samples/PK-Samples +-I../../SDK/Samples/External/GL/include +-I$(QTDIR)/include +-I$(QTDIR)/include/QtCore +-I$(QTDIR)/include/QtWidgets +-I$(QTDIR)/include/QtNetwork +-I$(QTDIR)/include/QtXml +-I$(QTDIR)/include/QtGui +-D__AEGP_PK_BEGIN=namespace AEGPPk { +-D__AEGP_PK_END=} diff --git a/projects/AfterEffects_macosx/Qt/x64/Release/moc_AEGP_PanelQT.args b/projects/AfterEffects_macosx/Qt/x64/Release/moc_AEGP_PanelQT.args new file mode 100644 index 00000000..5688a434 --- /dev/null +++ b/projects/AfterEffects_macosx/Qt/x64/Release/moc_AEGP_PanelQT.args @@ -0,0 +1,54 @@ +-DNDEBUG +-DPK_COMPILER_BUILD_COMPILER_D3D11=1 +-DPK_COMPILER_BUILD_COMPILER_D3D12=1 +-DUSE_POSIX_API=1 +-D__MWERKS__=0 +-DA_INTERNAL_TEST_ONE=0 +-DWEB_ENV=0 +-DPK_BUILD_WITH_FMODEX_SUPPORT=0 +-DPK_BUILD_WITH_SDL=0 +-DPK_BUILD_WITH_D3D11_SUPPORT=0 +-DPK_BUILD_WITH_D3D12_SUPPORT=0 +-DQT_NO_DEBUG +-DQT_NO_KEYWORDS +-DQT_NO_SIGNALS_SLOTS_KEYWORDS +-DPK_BUILD_WITH_METAL_SUPPORT=1 +-DPK_BUILD_WITH_OGL_SUPPORT=1 +-DGL_GLEXT_PROTOTYPES +-DGLEW_STATIC +-DGLEW_NO_GLU +-DMACOSX +-DQT_CORE_LIB +-DQT_WIDGETS_LIB +-DQT_NETWORK_LIB +-DQT_XML_LIB +-DQT_GUI_LIB +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Sources +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Include +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Precompiled +-I../../Integrations/AfterEffects/AE_Suites +-I../../Integrations/AfterEffects/External/AE SDK/Resources +-I../../Integrations/AfterEffects/External/AE SDK/Headers +-I../../Integrations/AfterEffects/External/AE SDK/Util +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/artemis +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/photoshop +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/artemis/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/photoshop/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/drawbotsuite +-I../../Runtime +-I../../Runtime/include +-I../../Runtime/include/license/AfterEffects +-I../../Tools +-I../../SDK/Samples/PK-Samples +-I../../SDK/Samples/External/GL/include +-I$(QTDIR)/include +-I$(QTDIR)/include/QtCore +-I$(QTDIR)/include/QtWidgets +-I$(QTDIR)/include/QtNetwork +-I$(QTDIR)/include/QtXml +-I$(QTDIR)/include/QtGui +-D__AEGP_PK_BEGIN=namespace AEGPPk { +-D__AEGP_PK_END=} diff --git a/projects/AfterEffects_vs2019/AE_Effect_Attribute.vcxproj b/projects/AfterEffects_vs2019/AE_Effect_Attribute.vcxproj new file mode 100644 index 00000000..97e1f6e4 --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_Effect_Attribute.vcxproj @@ -0,0 +1,199 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {71E14036-5ABF-5C62-69BF-5CFF185CCCCA} + true + Win32Proj + AE_Effect_Attribute + x64 + 10.0.17134.0 + + + + DynamicLibrary + true + MultiByte + v142 + + + DynamicLibrary + false + MultiByte + v142 + + + + + + + + + + + + + true + true + ..\..\PopcornFX\ + ..\intermediate\AfterEffects\VC142\x64\Debug\AE_Effect_Attribute\ + AE_Effect_Attribute_d + .aex + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + true + ..\..\PopcornFX\ + ..\intermediate\AfterEffects\VC142\x64\Release\AE_Effect_Attribute\ + AE_Effect_Attribute_r + .aex + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + ae_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_Attribute\Sources;..\..\AE_Effect_Attribute\Include;..\..\AE_Effect_Attribute\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + Disabled + false + MultiThreadedDebugDLL + false + Fast + true + true + + + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_Attribute\Sources;..\..\AE_Effect_Attribute\Include;..\..\AE_Effect_Attribute\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + 0x0409 + + + Windows + fmodex64_vc.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;%(AdditionalLibraryDirectories) + + + + + Use + ae_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_Attribute\Sources;..\..\AE_Effect_Attribute\Include;..\..\AE_Effect_Attribute\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + Full + true + true + false + true + MultiThreadedDLL + false + false + Fast + true + true + + + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_Attribute\Sources;..\..\AE_Effect_Attribute\Include;..\..\AE_Effect_Attribute\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + 0x0409 + + + Windows + true + true + fmodex64_vc.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + + + + + + Document + cl /nologo /I "../../External/AE SDK//Headers" /EP "%(Identity)" > "$(IntDir)/%(Filename).rr" +"../../External/AE SDK//Resources/PiPLTool" "$(IntDir)/%(Filename).rr" "$(IntDir)/%(Filename).rrc" +cl /nologo /D "MSWindows" /EP "$(IntDir)/%(Filename).rrc" > "../../projects/intermediate/AfterEffects/VC142/%(Filename).rc" + ../intermediate/AfterEffects/VC142/AE_Effect_Attribute_PiPL.rc + PiPL %(Filename).r + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/AE_Effect_Attribute.vcxproj.filters b/projects/AfterEffects_vs2019/AE_Effect_Attribute.vcxproj.filters new file mode 100644 index 00000000..5e233f7c --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_Effect_Attribute.vcxproj.filters @@ -0,0 +1,171 @@ + + + + + {B9DA08E5-A5D3-2737-CE05-0DBCBA5D0743} + + + {A68DAE81-12FA-697C-DBED-01DA47198CE4} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {21F99ECB-0DF2-BD1D-3624-A3A2227C9D29} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {000BCD17-6C75-818E-B5B3-3234215D5FE3} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {19228C0E-051B-AB60-2E4D-90E51AA58A6C} + + + {C439D9BA-B05E-283B-D9A9-0DCBC52D2759} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Precompiled + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + + + Precompiled + + + Sources + + + Sources + + + Sources + + + Sources + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + + + Resources + + + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/AE_Effect_AttributeSampler.vcxproj b/projects/AfterEffects_vs2019/AE_Effect_AttributeSampler.vcxproj new file mode 100644 index 00000000..a18a6d5c --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_Effect_AttributeSampler.vcxproj @@ -0,0 +1,199 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {205916AA-5ABF-5C62-69BF-5CFF185CCCCA} + true + Win32Proj + AE_Effect_AttributeSampler + x64 + 10.0.17134.0 + + + + DynamicLibrary + true + MultiByte + v142 + + + DynamicLibrary + false + MultiByte + v142 + + + + + + + + + + + + + true + true + ..\..\PopcornFX\ + ..\intermediate\AfterEffects\VC142\x64\Debug\AE_Effect_AttributeSampler\ + AE_Effect_AttributeSampler_d + .aex + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + true + ..\..\PopcornFX\ + ..\intermediate\AfterEffects\VC142\x64\Release\AE_Effect_AttributeSampler\ + AE_Effect_AttributeSampler_r + .aex + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + ae_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_AttributeSampler\Sources;..\..\AE_Effect_AttributeSampler\Include;..\..\AE_Effect_AttributeSampler\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + Disabled + false + MultiThreadedDebugDLL + false + Fast + true + true + + + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_AttributeSampler\Sources;..\..\AE_Effect_AttributeSampler\Include;..\..\AE_Effect_AttributeSampler\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + 0x0409 + + + Windows + fmodex64_vc.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;%(AdditionalLibraryDirectories) + + + + + Use + ae_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_AttributeSampler\Sources;..\..\AE_Effect_AttributeSampler\Include;..\..\AE_Effect_AttributeSampler\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + Full + true + true + false + true + MultiThreadedDLL + false + false + Fast + true + true + + + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_AttributeSampler\Sources;..\..\AE_Effect_AttributeSampler\Include;..\..\AE_Effect_AttributeSampler\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + 0x0409 + + + Windows + true + true + fmodex64_vc.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + + + + + + Document + cl /nologo /I "../../External/AE SDK//Headers" /EP "%(Identity)" > "$(IntDir)/%(Filename).rr" +"../../External/AE SDK//Resources/PiPLTool" "$(IntDir)/%(Filename).rr" "$(IntDir)/%(Filename).rrc" +cl /nologo /D "MSWindows" /EP "$(IntDir)/%(Filename).rrc" > "../../projects/intermediate/AfterEffects/VC142/%(Filename).rc" + ../intermediate/AfterEffects/VC142/AE_Effect_AttributeSampler_PiPL.rc + PiPL %(Filename).r + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/AE_Effect_AttributeSampler.vcxproj.filters b/projects/AfterEffects_vs2019/AE_Effect_AttributeSampler.vcxproj.filters new file mode 100644 index 00000000..45a41176 --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_Effect_AttributeSampler.vcxproj.filters @@ -0,0 +1,171 @@ + + + + + {B9DA08E5-A5D3-2737-CE05-0DBCBA5D0743} + + + {A68DAE81-12FA-697C-DBED-01DA47198CE4} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {21F99ECB-0DF2-BD1D-3624-A3A2227C9D29} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {000BCD17-6C75-818E-B5B3-3234215D5FE3} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {19228C0E-051B-AB60-2E4D-90E51AA58A6C} + + + {C439D9BA-B05E-283B-D9A9-0DCBC52D2759} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Precompiled + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + + + Precompiled + + + Sources + + + Sources + + + Sources + + + Sources + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + + + Resources + + + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/AE_Effect_Emitter.vcxproj b/projects/AfterEffects_vs2019/AE_Effect_Emitter.vcxproj new file mode 100644 index 00000000..11aba4ef --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_Effect_Emitter.vcxproj @@ -0,0 +1,199 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA} + true + Win32Proj + AE_Effect_Emitter + x64 + 10.0.17134.0 + + + + DynamicLibrary + true + MultiByte + v142 + + + DynamicLibrary + false + MultiByte + v142 + + + + + + + + + + + + + true + true + ..\..\PopcornFX\ + ..\intermediate\AfterEffects\VC142\x64\Debug\AE_Effect_Emitter\ + AE_Effect_Emitter_d + .aex + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + true + ..\..\PopcornFX\ + ..\intermediate\AfterEffects\VC142\x64\Release\AE_Effect_Emitter\ + AE_Effect_Emitter_r + .aex + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + ae_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_Emitter\Sources;..\..\AE_Effect_Emitter\Include;..\..\AE_Effect_Emitter\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + Disabled + false + MultiThreadedDebugDLL + false + Fast + true + true + + + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_Emitter\Sources;..\..\AE_Effect_Emitter\Include;..\..\AE_Effect_Emitter\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + 0x0409 + + + Windows + fmodex64_vc.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;%(AdditionalLibraryDirectories) + + + + + Use + ae_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_Emitter\Sources;..\..\AE_Effect_Emitter\Include;..\..\AE_Effect_Emitter\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + Full + true + true + false + true + MultiThreadedDLL + false + false + Fast + true + true + + + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\AE_Effect_Emitter\Sources;..\..\AE_Effect_Emitter\Include;..\..\AE_Effect_Emitter\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + 0x0409 + + + Windows + true + true + fmodex64_vc.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + + + + + + Document + cl /nologo /I "../../External/AE SDK//Headers" /EP "%(Identity)" > "$(IntDir)/%(Filename).rr" +"../../External/AE SDK//Resources/PiPLTool" "$(IntDir)/%(Filename).rr" "$(IntDir)/%(Filename).rrc" +cl /nologo /D "MSWindows" /EP "$(IntDir)/%(Filename).rrc" > "../../projects/intermediate/AfterEffects/VC142/%(Filename).rc" + ../intermediate/AfterEffects/VC142/AE_Effect_Emitter_PiPL.rc + PiPL %(Filename).r + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/AE_Effect_Emitter.vcxproj.filters b/projects/AfterEffects_vs2019/AE_Effect_Emitter.vcxproj.filters new file mode 100644 index 00000000..58c7f86e --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_Effect_Emitter.vcxproj.filters @@ -0,0 +1,171 @@ + + + + + {B9DA08E5-A5D3-2737-CE05-0DBCBA5D0743} + + + {A68DAE81-12FA-697C-DBED-01DA47198CE4} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {21F99ECB-0DF2-BD1D-3624-A3A2227C9D29} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {000BCD17-6C75-818E-B5B3-3234215D5FE3} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {19228C0E-051B-AB60-2E4D-90E51AA58A6C} + + + {C439D9BA-B05E-283B-D9A9-0DCBC52D2759} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Precompiled + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + + + Precompiled + + + Sources + + + Sources + + + Sources + + + Sources + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + + + Resources + + + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj b/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj new file mode 100644 index 00000000..c5622cbe --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj @@ -0,0 +1,328 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {EF871E43-5ABF-5C62-69BF-5CFF185CCCCA} + true + Win32Proj + AE_GeneralPlugin + x64 + 10.0.17134.0 + + + + DynamicLibrary + true + MultiByte + v142 + + + DynamicLibrary + false + MultiByte + v142 + + + + + + + + + + + + + true + true + ..\..\PopcornFX\ + ..\intermediate\AfterEffects\VC142\x64\Debug\AE_GeneralPlugin\ + AE_GeneralPlugin_d + .aex + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + true + ..\..\PopcornFX\ + ..\intermediate\AfterEffects\VC142\x64\Release\AE_GeneralPlugin\ + AE_GeneralPlugin_r + .aex + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + ae_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;PK_BUILD_WITH_METAL_SUPPORT=0;QT_NO_KEYWORDS;QT_NO_SIGNALS_SLOTS_KEYWORDS;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;QT_CORE_LIB;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + ..\..\AE_GeneralPlugin\Sources;..\..\AE_GeneralPlugin\Include;..\..\AE_GeneralPlugin\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtGui;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + Fast + true + true + + + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;PK_BUILD_WITH_METAL_SUPPORT=0;QT_NO_KEYWORDS;QT_NO_SIGNALS_SLOTS_KEYWORDS;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;QT_CORE_LIB;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + ..\..\AE_GeneralPlugin\Sources;..\..\AE_GeneralPlugin\Include;..\..\AE_GeneralPlugin\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtGui;%(AdditionalIncludeDirectories) + 0x0409 + + + Windows + true + fmodex64_vc.lib;PK-RenderHelpers_d.lib;PK-RHI_d.lib;PK-Discretizers_d.lib;PK-MCPP_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_TIFF_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Plugin_CodecImage_EXR_d.lib;PK-Plugin_CodecMesh_FBX_d.lib;PK-ZLib_d.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;libfbxsdk-md_d.lib;libxml2-md_d.lib;zlib-md_d.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;opengl32.lib;Comctl32.lib;propsys.lib;Shlwapi.lib;Qt5Cored.lib;Qt5Widgetsd.lib;Qt5Networkd.lib;Qt5Xmld.lib;Qt5Guid.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\CodecMesh_FBX\libs\vs2019\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);$(QTDIR)\lib;%(AdditionalLibraryDirectories) + + + ../../AE_GeneralPlugin/GeneralPlugin.manifest;%(AdditionalManifestFiles) + + + + + Use + ae_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;PK_BUILD_WITH_METAL_SUPPORT=0;QT_NO_DEBUG;QT_NO_KEYWORDS;QT_NO_SIGNALS_SLOTS_KEYWORDS;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;QT_CORE_LIB;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + ..\..\AE_GeneralPlugin\Sources;..\..\AE_GeneralPlugin\Include;..\..\AE_GeneralPlugin\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtGui;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + Fast + true + true + + + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MSWindows;WIN32;_WINDOWS;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;PK_BUILD_WITH_METAL_SUPPORT=0;QT_NO_DEBUG;QT_NO_KEYWORDS;QT_NO_SIGNALS_SLOTS_KEYWORDS;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;QT_CORE_LIB;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + ..\..\AE_GeneralPlugin\Sources;..\..\AE_GeneralPlugin\Include;..\..\AE_GeneralPlugin\Precompiled;..\..\AE_Suites;..\..\External\AE SDK\Resources;..\..\External\AE SDK\Headers;..\..\External\AE SDK\Util;..\..\External\AE SDK\Headers\SP;..\..\External\AE SDK\Headers\adobesdk;..\..\External\AE SDK\Headers\SP\artemis;..\..\External\AE SDK\Headers\SP\photoshop;..\..\External\AE SDK\Headers\SP\artemis\config;..\..\External\AE SDK\Headers\SP\photoshop\config;..\..\External\AE SDK\Headers\adobesdk\config;..\..\External\AE SDK\Headers\adobesdk\drawbotsuite;..\..\ExternalLibs\fmodex\inc;..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtGui;%(AdditionalIncludeDirectories) + 0x0409 + + + Windows + true + true + true + fmodex64_vc.lib;PK-RenderHelpers_r.lib;PK-RHI_r.lib;PK-Discretizers_r.lib;PK-MCPP_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_TIFF_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Plugin_CodecImage_EXR_r.lib;PK-Plugin_CodecMesh_FBX_r.lib;PK-ZLib_r.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;libfbxsdk-md_r.lib;libxml2-md_r.lib;zlib-md_r.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;opengl32.lib;Comctl32.lib;propsys.lib;Shlwapi.lib;Qt5Core.lib;Qt5Widgets.lib;Qt5Network.lib;Qt5Xml.lib;Qt5Gui.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\CodecMesh_FBX\libs\vs2019\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);$(QTDIR)\lib;%(AdditionalLibraryDirectories) + + + ../../AE_GeneralPlugin/GeneralPlugin.manifest;%(AdditionalManifestFiles) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + NotUsing + + + true + + + true + + + true + + + true + + + + + + + + + + + Document + $(QTDIR)/bin/moc "../../AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h" -o "Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.cpp" -b "ae_precompiled.h" @"Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.args" + $(QTDIR)/bin/moc "../../AE_GeneralPlugin/Include/Panels/AEGP_GraphicalResourcesTreeModel.h" -o "Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.cpp" -b "ae_precompiled.h" @"Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.args" + Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.cpp + Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.cpp + Moc AEGP_GraphicalResourcesTreeModel.h + + + Document + $(QTDIR)/bin/moc "../../AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h" -o "Qt/x64/Debug/moc_AEGP_PanelQT.cpp" -b "ae_precompiled.h" @"Qt/x64/Debug/moc_AEGP_PanelQT.args" + $(QTDIR)/bin/moc "../../AE_GeneralPlugin/Include/Panels/AEGP_PanelQT.h" -o "Qt/x64/Release/moc_AEGP_PanelQT.cpp" -b "ae_precompiled.h" @"Qt/x64/Release/moc_AEGP_PanelQT.args" + Qt/x64/Debug/moc_AEGP_PanelQT.cpp + Qt/x64/Release/moc_AEGP_PanelQT.cpp + Moc AEGP_PanelQT.h + + + Document + cl /nologo /I "../../External/AE SDK//Headers" /EP "%(Identity)" > "$(IntDir)/%(Filename).rr" +"../../External/AE SDK//Resources/PiPLTool" "$(IntDir)/%(Filename).rr" "$(IntDir)/%(Filename).rrc" +cl /nologo /D "MSWindows" /EP "$(IntDir)/%(Filename).rrc" > "../../projects/intermediate/AfterEffects/VC142/%(Filename).rc" + ../intermediate/AfterEffects/VC142/AE_GeneralPlugin_PiPL.rc + PiPL %(Filename).r + + + + + + + + + {44ECDA8C-CBA0-4035-B212-68E793243242} + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj.filters b/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj.filters new file mode 100644 index 00000000..fd87cc1f --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj.filters @@ -0,0 +1,473 @@ + + + + + {B9DA08E5-A5D3-2737-CE05-0DBCBA5D0743} + + + {A68DAE81-12FA-697C-DBED-01DA47198CE4} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {F3833128-DF51-252E-C8E5-9554B4520193} + + + {6ADB18E6-D6F1-167C-1F69-A29D8BBEE703} + + + {FC4D5FA6-E8B0-EE4A-9136-27017D78BACD} + + + {9D627D44-0925-B1CE-52D5-3F5BBED689AC} + + + {9ED424D3-8A3C-EBA0-F3A7-FFB6DF2E028D} + + + {21F99ECB-0DF2-BD1D-3624-A3A2227C9D29} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {2A755900-1601-880B-7FAF-880B6B5A880B} + + + {9BC51FCD-8767-4AA3-7022-5EF75C63D1F3} + + + {51584C87-3DBB-DB2B-E640-14E2D282A7AE} + + + {CB271FC2-B7F5-12C8-A089-83EE8CF6EE2C} + + + {000BCD17-6C75-818E-B5B3-3234215D5FE3} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {BBB258F9-A780-4CFF-9014-BD257C812864} + + + {32F58693-9E0B-8529-E782-104B53D855B1} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {5DF51B81-4984-A54A-F2A2-B945DE10B6F0} + + + {19228C0E-051B-AB60-2E4D-90E51AA58A6C} + + + {C439D9BA-B05E-283B-D9A9-0DCBC52D2759} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {B45C6617-A0EB-EFE0-490A-04DC35780087} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers\RenderApi + + + Headers\RenderApi + + + Headers\RenderApi + + + Headers\RenderApi + + + Headers\RenderApi + + + Headers\RenderApi + + + Precompiled + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + PopcornFX Suites + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + _External\FMODex\Headers + + + + + Precompiled + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources\Panels + + + Sources\Panels + + + Sources\RenderApi + + + Sources\RenderApi + + + Sources\RenderApi + + + Sources\RenderApi + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + AfterEffects SDK\Util + + + Qt\x64\Debug + + + Qt\x64\Debug + + + Qt\x64\Release + + + Qt\x64\Release + + + + + Integrations\AfterEffects\AE_GeneralPlugin + + + + + Resources + + + + + Headers\Panels + + + Headers\Panels + + + Sources + + + + + _Natvis + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj.user b/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj.user new file mode 100644 index 00000000..1db3f9f4 --- /dev/null +++ b/projects/AfterEffects_vs2019/AE_GeneralPlugin.vcxproj.user @@ -0,0 +1,11 @@ + + + + ..\..\PopcornFX + WindowsLocalDebugger + + + ..\..\PopcornFX + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj b/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj new file mode 100644 index 00000000..9770b8fc --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj @@ -0,0 +1,179 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {44CEDA8C-CBA0-4053-B122-6E8793324224} + true + Win32Proj + PK-AssetBaker + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + true + ..\..\..\release\application\BinariesVC142_x64_d\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-AssetBaker\ + PK-AssetBaker + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\application\BinariesVC142_x64_r\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-AssetBaker\ + PK-AssetBaker + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;Z_PREFIX;Z_PREFIX_CUSTOM=pk_z_;PK_USE_RENDER_HELPERS=0;USE_FBXIMPORTER;USE_IMAGE_PLUGIN_HDR;USE_IMAGE_PLUGIN_TIFF;USE_IMAGE_PLUGIN_PKM;USE_IMAGE_PLUGIN_PVR;USE_IMAGE_PLUGIN_EXR;USE_COMPILER_BACKEND_D3D;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\PK-AssetBaker;..\..\ExternalLibs\PK-AssetBakerLib;..\..\ExternalLibs\pk_upgraderlib\include;..\..\SDK\Samples\Common\PKFX;..\..\ExternalLibs\Runtime\libs\zlib-1.2.8;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Console + true + PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TIFF_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-ZLib_d.lib;PK-Plugin_CodecMesh_FBX_d.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CodecImage_EXR_d.lib;freetype.lib;libfbxsdk-md_d.lib;libxml2-md_d.lib;zlib-md_d.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\libs\freetype-2.5.5\lib\vs2015_x64\Debug;..\..\ExternalLibs\CodecMesh_FBX\libs\vs2019\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;Z_PREFIX;Z_PREFIX_CUSTOM=pk_z_;PK_USE_RENDER_HELPERS=0;USE_FBXIMPORTER;USE_IMAGE_PLUGIN_HDR;USE_IMAGE_PLUGIN_TIFF;USE_IMAGE_PLUGIN_PKM;USE_IMAGE_PLUGIN_PVR;USE_IMAGE_PLUGIN_EXR;USE_COMPILER_BACKEND_D3D;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\PK-AssetBaker;..\..\ExternalLibs\PK-AssetBakerLib;..\..\ExternalLibs\pk_upgraderlib\include;..\..\SDK\Samples\Common\PKFX;..\..\ExternalLibs\Runtime\libs\zlib-1.2.8;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TIFF_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-ZLib_r.lib;PK-Plugin_CodecMesh_FBX_r.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CodecImage_EXR_r.lib;freetype.lib;libfbxsdk-md_r.lib;libxml2-md_r.lib;zlib-md_r.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\libs\freetype-2.5.5\lib\vs2015_x64\Release;..\..\ExternalLibs\CodecMesh_FBX\libs\vs2019\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NotUsing + + + NotUsing + + + + + + + + Create + + + + + + + + + {44ECDA8C-CBA0-4035-B212-68E793243242} + + + {55ACDBF7-CBA0-4035-B212-68E793243242} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj.filters b/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj.filters new file mode 100644 index 00000000..eb63c282 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj.filters @@ -0,0 +1,140 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {D960DB0A-C52E-CF10-AEC2-3F379A2FAB75} + + + {E176A6F8-4DD8-8306-D645-CAB842A6BAC5} + + + {DB59485E-471A-C494-1055-0D127CD40871} + + + {89BA71F6-F545-DFBA-FE56-62AF6A613BBB} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {A18F02DC-8D5D-F6E1-76F1-6608625ED246} + + + {A92202BA-1584-DFC7-9EF1-257A0A521687} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\PK-ZLib + + + Headers\Common\PKFX + + + Headers\Common\PKFX + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + + + Sources\Common\PKFX + + + Sources\Common\PKFX + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj.user b/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj.user new file mode 100644 index 00000000..e771c8a4 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-AssetBaker.vcxproj.user @@ -0,0 +1,11 @@ + + + + $(TargetDir) + WindowsLocalDebugger + + + $(TargetDir) + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-AssetBakerLib.vcxproj b/projects/AfterEffects_vs2019/PK-AssetBakerLib.vcxproj new file mode 100644 index 00000000..e50dc3e5 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-AssetBakerLib.vcxproj @@ -0,0 +1,208 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {44ECDA8C-CBA0-4035-B212-68E793243242} + true + Win32Proj + PK-AssetBakerLib + x64 + 10.0.17134.0 + + + + StaticLibrary + true + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-AssetBakerLib\ + PK-AssetBakerLib_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-AssetBakerLib\ + PK-AssetBakerLib_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-AssetBakerLib\ + PK-AssetBakerLib_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\PK-AssetBakerLib;..\..\ExternalLibs\Runtime\libs\freetype-2.5.5\include;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\PK-AssetBakerLib;..\..\ExternalLibs\Runtime\libs\freetype-2.5.5\include;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\PK-AssetBakerLib;..\..\ExternalLibs\Runtime\libs\freetype-2.5.5\include;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-AssetBakerLib.vcxproj.filters b/projects/AfterEffects_vs2019/PK-AssetBakerLib.vcxproj.filters new file mode 100644 index 00000000..f8e66e1d --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-AssetBakerLib.vcxproj.filters @@ -0,0 +1,98 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Discretizers_SDK1.vcxproj b/projects/AfterEffects_vs2019/PK-Discretizers_SDK1.vcxproj new file mode 100644 index 00000000..2929ff36 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Discretizers_SDK1.vcxproj @@ -0,0 +1,180 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {F866336F-906C-411B-FFFF-AABBCC2C47CE} + true + Win32Proj + PK-Discretizers_SDK1 + x64 + 10.0.17134.0 + + + + StaticLibrary + true + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Discretizers_SDK1\ + PK-Discretizers_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Discretizers_SDK1\ + PK-Discretizers_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Discretizers_SDK1\ + PK-Discretizers_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + dc_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_discretizers\src;..\..\ExternalLibs\Runtime\pk_discretizers;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + Use + dc_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_discretizers\src;..\..\ExternalLibs\Runtime\pk_discretizers;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + Use + dc_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_discretizers\src;..\..\ExternalLibs\Runtime\pk_discretizers;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Discretizers_SDK1.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Discretizers_SDK1.vcxproj.filters new file mode 100644 index 00000000..689d4cc2 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Discretizers_SDK1.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-MCPP.vcxproj b/projects/AfterEffects_vs2019/PK-MCPP.vcxproj new file mode 100644 index 00000000..26ef7973 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-MCPP.vcxproj @@ -0,0 +1,196 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {C43F305D-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-MCPP + x64 + 10.0.17134.0 + + + + StaticLibrary + true + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-MCPP\ + PK-MCPP_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-MCPP\ + PK-MCPP_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-MCPP\ + PK-MCPP_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MCPP_LIB=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\PK-MCPP;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MCPP_LIB=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\PK-MCPP;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MCPP_LIB=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\PK-MCPP;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-MCPP.vcxproj.filters b/projects/AfterEffects_vs2019/PK-MCPP.vcxproj.filters new file mode 100644 index 00000000..c15e7b6e --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-MCPP.vcxproj.filters @@ -0,0 +1,77 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-MCPP_SDK1.vcxproj b/projects/AfterEffects_vs2019/PK-MCPP_SDK1.vcxproj new file mode 100644 index 00000000..657a9250 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-MCPP_SDK1.vcxproj @@ -0,0 +1,196 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {C43F305D-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-MCPP_SDK1 + x64 + 10.0.17134.0 + + + + StaticLibrary + true + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-MCPP_SDK1\ + PK-MCPP_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-MCPP_SDK1\ + PK-MCPP_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-MCPP_SDK1\ + PK-MCPP_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MCPP_LIB=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\PK-MCPP;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MCPP_LIB=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\PK-MCPP;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;MCPP_LIB=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\PK-MCPP;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-MCPP_SDK1.vcxproj.filters b/projects/AfterEffects_vs2019/PK-MCPP_SDK1.vcxproj.filters new file mode 100644 index 00000000..c15e7b6e --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-MCPP_SDK1.vcxproj.filters @@ -0,0 +1,77 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-ParticlesToolbox_SDK1.vcxproj b/projects/AfterEffects_vs2019/PK-ParticlesToolbox_SDK1.vcxproj new file mode 100644 index 00000000..4201253e --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-ParticlesToolbox_SDK1.vcxproj @@ -0,0 +1,196 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3} + true + Win32Proj + PK-ParticlesToolbox_SDK1 + x64 + 10.0.17134.0 + + + + StaticLibrary + true + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-ParticlesToolbox_SDK1\ + PK-ParticlesToolbox_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-ParticlesToolbox_SDK1\ + PK-ParticlesToolbox_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-ParticlesToolbox_SDK1\ + PK-ParticlesToolbox_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + pt_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_particles_toolbox;..\..\ExternalLibs\Runtime\pk_particles_toolbox\src\include;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + Use + pt_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_particles_toolbox;..\..\ExternalLibs\Runtime\pk_particles_toolbox\src\include;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + Use + pt_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_particles_toolbox;..\..\ExternalLibs\Runtime\pk_particles_toolbox\src\include;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-ParticlesToolbox_SDK1.vcxproj.filters b/projects/AfterEffects_vs2019/PK-ParticlesToolbox_SDK1.vcxproj.filters new file mode 100644 index 00000000..ab9915a2 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-ParticlesToolbox_SDK1.vcxproj.filters @@ -0,0 +1,69 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-RHI.vcxproj b/projects/AfterEffects_vs2019/PK-RHI.vcxproj new file mode 100644 index 00000000..c79af2f8 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-RHI.vcxproj @@ -0,0 +1,684 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {1822BA45-2535-4E66-B24D-AAB284A46F5B} + true + Win32Proj + PK-RHI + x64 + 10.0.17134.0 + + + + StaticLibrary + true + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-RHI\ + PK-RHI_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-RHI\ + PK-RHI_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-RHI\ + PK-RHI_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + rhi_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_rhi\include;..\..\ExternalLibs\Runtime\pk_rhi\src;..\..\ExternalLibs\Runtime\pk_rhi\src\precompiled;..\..\Samples\Common;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + Use + rhi_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_rhi\include;..\..\ExternalLibs\Runtime\pk_rhi\src;..\..\ExternalLibs\Runtime\pk_rhi\src\precompiled;..\..\Samples\Common;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + Use + rhi_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_rhi\include;..\..\ExternalLibs\Runtime\pk_rhi\src;..\..\ExternalLibs\Runtime\pk_rhi\src\precompiled;..\..\Samples\Common;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + Create + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + pk_compiler_warnings.h + + + NotUsing + 4668;%(DisableSpecificWarnings) + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-RHI.vcxproj.filters b/projects/AfterEffects_vs2019/PK-RHI.vcxproj.filters new file mode 100644 index 00000000..c05657d5 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-RHI.vcxproj.filters @@ -0,0 +1,977 @@ + + + + + {089DB854-F469-1360-1D83-010809AF48EE} + + + {13B1D40F-7F66-4D05-085B-47DC740F4409} + + + {863BBF4D-F29C-9C5B-7B0A-E30DE76AD31A} + + + {6AB1D40F-D666-4D05-5F5B-47DCCB0F4409} + + + {DDA209E4-4904-E7F1-D271-2DA43ED21DB1} + + + {1F63B8AC-0B5D-E1FE-F4C9-770FE062476B} + + + {81145F64-ED9F-CC28-F6B0-4F1D62BB2829} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {6DFA5B5D-D9BA-D793-A2F5-20110E751C70} + + + {6EFA5B5D-DABA-D793-A3F5-20110F751C70} + + + {34D71975-A0ED-170B-E964-A32C55BAE892} + + + {2A0082BF-16F9-A011-3F2B-86962B83801D} + + + {36B8AD3B-A243-1B00-AB54-9EF4175F7700} + + + {94C49712-80A8-5868-E908-53BBD50B43EA} + + + {8A04468D-76BF-3539-1F77-AE830B1180C9} + + + {E1C2C4F3-CDE7-1374-F632-F903E2B61292} + + + {CBC87F50-B72B-0FF5-60B1-47AB4CF3DA77} + + + {35158C71-21E3-7F77-0A77-F09DF6E35BDC} + + + {0F2B8960-7BEB-0497-4426-4E14B0A54973} + + + {41753E82-2D43-3288-16D7-A2AE02440EED} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {3570746B-A130-F0A1-6A6B-391FD6EA347E} + + + {3670746B-A230-F0A1-6B6B-391FD7EA347E} + + + {FCF08722-6807-86B8-B17E-11DA1DD45640} + + + {5C17C96D-48FB-89C3-B15B-84169D5E7445} + + + {5271333C-3E2C-23E8-E7E3-9B32D37D6D78} + + + {93A5FC8E-7F08-8C33-288E-C4E914D057B6} + + + {FD43B342-E911-A748-D2A5-176FBE1283AD} + + + {09A46553-F571-5959-DE05-CA7FCA7235BE} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3DCommon + + + Headers\D3DCommon + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers\details + + + Headers\details + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\async + + + Headers\interfaces\async + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\orbis + + + Headers\orbis + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Sources\D3D11 + + + Sources\D3D12 + + + Headers\_Private + + + Sources\null + + + Sources\opengl + + + Precompiled + + + Sources\vulkan + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D11 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3D12 + + + Sources\D3DCommon + + + Sources\D3DCommon + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources\interfaces + + + Sources\interfaces + + + Sources\interfaces + + + Sources\interfaces + + + Sources\interfaces + + + Sources\interfaces + + + Sources\interfaces + + + Sources\interfaces + + + Sources\interfaces\abstracts + + + Sources\interfaces\abstracts + + + Sources\interfaces\abstracts + + + Sources\interfaces\abstracts + + + Sources\interfaces\abstracts + + + Sources\interfaces\abstracts + + + Sources\interfaces\abstracts + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\null + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Sources\opengl + + + Precompiled + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + Sources\vulkan + + + External\GL\src + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-RHI_SDK1.vcxproj b/projects/AfterEffects_vs2019/PK-RHI_SDK1.vcxproj new file mode 100644 index 00000000..76614b27 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-RHI_SDK1.vcxproj @@ -0,0 +1,365 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {1822BA45-2535-4E66-FFFF-AAB284A46F5B} + true + Win32Proj + PK-RHI_SDK1 + x64 + 10.0.17134.0 + + + + StaticLibrary + true + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-RHI_SDK1\ + PK-RHI_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-RHI_SDK1\ + PK-RHI_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-RHI_SDK1\ + PK-RHI_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + rhi_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_rhi\include;..\..\ExternalLibs\Runtime\pk_rhi\src;..\..\ExternalLibs\Runtime\pk_rhi\src\precompiled;..\..\Samples\Common;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + Use + rhi_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_rhi\include;..\..\ExternalLibs\Runtime\pk_rhi\src;..\..\ExternalLibs\Runtime\pk_rhi\src\precompiled;..\..\Samples\Common;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + Use + rhi_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_rhi\include;..\..\ExternalLibs\Runtime\pk_rhi\src;..\..\ExternalLibs\Runtime\pk_rhi\src\precompiled;..\..\Samples\Common;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NotUsing + 4668;%(DisableSpecificWarnings) + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-RHI_SDK1.vcxproj.filters b/projects/AfterEffects_vs2019/PK-RHI_SDK1.vcxproj.filters new file mode 100644 index 00000000..7974f909 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-RHI_SDK1.vcxproj.filters @@ -0,0 +1,650 @@ + + + + + {089DB854-F469-1360-1D83-010809AF48EE} + + + {13B1D40F-7F66-4D05-085B-47DC740F4409} + + + {863BBF4D-F29C-9C5B-7B0A-E30DE76AD31A} + + + {6AB1D40F-D666-4D05-5F5B-47DCCB0F4409} + + + {DDA209E4-4904-E7F1-D271-2DA43ED21DB1} + + + {1F63B8AC-0B5D-E1FE-F4C9-770FE062476B} + + + {81145F64-ED9F-CC28-F6B0-4F1D62BB2829} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {6DFA5B5D-D9BA-D793-A2F5-20110E751C70} + + + {6EFA5B5D-DABA-D793-A3F5-20110F751C70} + + + {34D71975-A0ED-170B-E964-A32C55BAE892} + + + {2A0082BF-16F9-A011-3F2B-86962B83801D} + + + {36B8AD3B-A243-1B00-AB54-9EF4175F7700} + + + {94C49712-80A8-5868-E908-53BBD50B43EA} + + + {8A04468D-76BF-3539-1F77-AE830B1180C9} + + + {E1C2C4F3-CDE7-1374-F632-F903E2B61292} + + + {CBC87F50-B72B-0FF5-60B1-47AB4CF3DA77} + + + {35158C71-21E3-7F77-0A77-F09DF6E35BDC} + + + {0F2B8960-7BEB-0497-4426-4E14B0A54973} + + + {41753E82-2D43-3288-16D7-A2AE02440EED} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {3570746B-A130-F0A1-6A6B-391FD6EA347E} + + + {3670746B-A230-F0A1-6B6B-391FD7EA347E} + + + {93A5FC8E-7F08-8C33-288E-C4E914D057B6} + + + {FD43B342-E911-A748-D2A5-176FBE1283AD} + + + {09A46553-F571-5959-DE05-CA7FCA7235BE} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D11 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3D12 + + + Headers\D3DCommon + + + Headers\D3DCommon + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers\details + + + Headers\details + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\abstracts + + + Headers\interfaces\async + + + Headers\interfaces\async + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\null + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\opengl + + + Headers\orbis + + + Headers\orbis + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Headers\vulkan + + + Sources\D3D11 + + + Sources\D3D12 + + + Headers\_Private + + + Sources\null + + + Sources\opengl + + + Precompiled + + + Sources\vulkan + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\DX\include + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + External\GL\include\GL + + + + + External\GL\src + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-RenderHelpers.vcxproj b/projects/AfterEffects_vs2019/PK-RenderHelpers.vcxproj new file mode 100644 index 00000000..b3d2ab51 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-RenderHelpers.vcxproj @@ -0,0 +1,326 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {1822BA45-2535-4E66-B24D-90B284A46F5B} + true + Win32Proj + PK-RenderHelpers + x64 + 10.0.17134.0 + + + + StaticLibrary + true + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-RenderHelpers\ + PK-RenderHelpers_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-RenderHelpers\ + PK-RenderHelpers_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-RenderHelpers\ + PK-RenderHelpers_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + rh_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_render_helpers\src;..\..\ExternalLibs\Runtime\pk_render_helpers\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + Use + rh_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_render_helpers\src;..\..\ExternalLibs\Runtime\pk_render_helpers\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + Use + rh_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_render_helpers\src;..\..\ExternalLibs\Runtime\pk_render_helpers\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-RenderHelpers.vcxproj.filters b/projects/AfterEffects_vs2019/PK-RenderHelpers.vcxproj.filters new file mode 100644 index 00000000..9331abf6 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-RenderHelpers.vcxproj.filters @@ -0,0 +1,509 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {2A0082BF-16F9-A011-3F2B-86962B83801D} + + + {5F763A5A-4B5A-FBAF-B4BA-F502A0BDE531} + + + {CAAF6598-363B-D35C-3F4C-5651AB562F5D} + + + {253BF426-11CA-7DF0-BAE8-91EBA6568E96} + + + {23EDF09C-8F4E-CEAA-18BC-145D841C056A} + + + {39095868-A575-1363-6E69-ABC0DA9435CB} + + + {A1C2F4A7-0DFA-3C3F-1604-A16282BA6338} + + + {A57E694B-91A4-33B2-7AEA-B87D66AF587E} + + + {8E8F6F95-FAC6-B72C-03D1-1B506F87DE25} + + + {9294F164-7EB9-40E5-A704-267593883F03} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {27C96BB5-13AD-2C0B-7C0D-275E6810178D} + + + {92B7728E-FE42-E052-0754-6347735E3C53} + + + {ED5FC513-D9EE-4EDD-820D-63D86E7B5F83} + + + {60247608-4CDF-65B4-F596-DEFEE130B044} + + + {EB984C5E-57FA-296C-E067-701E4CC8602B} + + + {01C74DEF-6D33-09EA-3627-A147A2522B52} + + + {691251C3-D549-995A-DE53-FD7D4A0AC053} + + + {56DFCBB0-C216-1448-CB20-786B37D73A41} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\billboarders + + + Headers\billboarders + + + Headers\billboarders + + + Headers\billboarders + + + Headers\billboarders + + + Headers\buffer_pool + + + Headers\buffer_pool + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\frame_collector\legacy + + + Headers\frame_collector\legacy + + + Headers\frame_collector\legacy + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\render_features + + + Headers\render_features + + + Headers\render_features + + + Headers\resource_manager + + + Headers\resource_manager + + + Headers + + + Sources\billboarders\include + + + Sources\billboarders\include + + + Sources\billboarders\include + + + Sources\billboarders\include + + + Sources\billboarders\include + + + Headers\_Private + + + Precompiled + + + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batch_jobs + + + Sources\batches + + + Sources\billboarders + + + Sources\billboarders + + + Sources\billboarders + + + Sources\billboarders + + + Sources\billboarders + + + Sources\billboarders + + + Sources\billboarders + + + Sources\billboarders + + + Sources\billboarders + + + Sources\buffer_pool + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\draw_requests + + + Sources\frame_collector + + + Sources\frame_collector + + + Sources\frame_collector + + + Sources\frame_collector + + + Sources\frame_collector + + + Precompiled + + + Sources\render_features + + + Sources\render_features + + + Sources\render_features + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-RenderHelpers_SDK1.vcxproj b/projects/AfterEffects_vs2019/PK-RenderHelpers_SDK1.vcxproj new file mode 100644 index 00000000..5fe79757 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-RenderHelpers_SDK1.vcxproj @@ -0,0 +1,259 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {1822BA45-2535-4E66-FFFF-90B284A46F5B} + true + Win32Proj + PK-RenderHelpers_SDK1 + x64 + 10.0.17134.0 + + + + StaticLibrary + true + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-RenderHelpers_SDK1\ + PK-RenderHelpers_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-RenderHelpers_SDK1\ + PK-RenderHelpers_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-RenderHelpers_SDK1\ + PK-RenderHelpers_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + rh_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_render_helpers\src;..\..\ExternalLibs\Runtime\pk_render_helpers\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + Use + rh_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_render_helpers\src;..\..\ExternalLibs\Runtime\pk_render_helpers\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + Use + rh_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_render_helpers\src;..\..\ExternalLibs\Runtime\pk_render_helpers\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-RenderHelpers_SDK1.vcxproj.filters b/projects/AfterEffects_vs2019/PK-RenderHelpers_SDK1.vcxproj.filters new file mode 100644 index 00000000..c11cca41 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-RenderHelpers_SDK1.vcxproj.filters @@ -0,0 +1,285 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {5F763A5A-4B5A-FBAF-B4BA-F502A0BDE531} + + + {CAAF6598-363B-D35C-3F4C-5651AB562F5D} + + + {253BF426-11CA-7DF0-BAE8-91EBA6568E96} + + + {23EDF09C-8F4E-CEAA-18BC-145D841C056A} + + + {39095868-A575-1363-6E69-ABC0DA9435CB} + + + {A1C2F4A7-0DFA-3C3F-1604-A16282BA6338} + + + {A57E694B-91A4-33B2-7AEA-B87D66AF587E} + + + {8E8F6F95-FAC6-B72C-03D1-1B506F87DE25} + + + {9294F164-7EB9-40E5-A704-267593883F03} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batch_jobs + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\batches + + + Headers\billboarders + + + Headers\billboarders + + + Headers\billboarders + + + Headers\billboarders + + + Headers\billboarders + + + Headers\buffer_pool + + + Headers\buffer_pool + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\draw_requests + + + Headers\frame_collector\legacy + + + Headers\frame_collector\legacy + + + Headers\frame_collector\legacy + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\frame_collector + + + Headers\render_features + + + Headers\render_features + + + Headers\render_features + + + Headers\resource_manager + + + Headers\resource_manager + + + Headers + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Runtime_SDK1.vcxproj b/projects/AfterEffects_vs2019/PK-Runtime_SDK1.vcxproj new file mode 100644 index 00000000..14b019a0 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Runtime_SDK1.vcxproj @@ -0,0 +1,566 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {E21DB851-1449-42D8-FFFF-7FC2E9399524} + true + Win32Proj + PK-Runtime_SDK1 + x64 + 10.0.17134.0 + + + + StaticLibrary + true + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + StaticLibrary + false + MultiByte + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Runtime_SDK1\ + PK-Runtime_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Runtime_SDK1\ + PK-Runtime_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Runtime_SDK1\ + PK-Runtime_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_maths\src;..\..\ExternalLibs\Runtime\pk_maths;..\..\ExternalLibs\Runtime\pk_toolkit;..\..\ExternalLibs\Runtime\pk_toolkit\src\include;..\..\ExternalLibs\Runtime\pk_kernel;..\..\ExternalLibs\Runtime\pk_imaging;..\..\ExternalLibs\Runtime\pk_base_object\src;..\..\ExternalLibs\Runtime\pk_base_object\src\precompiled;..\..\ExternalLibs\Runtime\pk_compiler\src;..\..\ExternalLibs\Runtime\pk_compiler\src\precompiled;..\..\ExternalLibs\Runtime\pk_engine_utils\src\precompiled;..\..\ExternalLibs\Runtime\pk_geometrics;..\..\ExternalLibs\Runtime\pk_particles\src;..\intermediate\AfterEffects\VC142\x64\Debug\PK-Runtime_SDK1;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_maths\src;..\..\ExternalLibs\Runtime\pk_maths;..\..\ExternalLibs\Runtime\pk_toolkit;..\..\ExternalLibs\Runtime\pk_toolkit\src\include;..\..\ExternalLibs\Runtime\pk_kernel;..\..\ExternalLibs\Runtime\pk_imaging;..\..\ExternalLibs\Runtime\pk_base_object\src;..\..\ExternalLibs\Runtime\pk_base_object\src\precompiled;..\..\ExternalLibs\Runtime\pk_compiler\src;..\..\ExternalLibs\Runtime\pk_compiler\src\precompiled;..\..\ExternalLibs\Runtime\pk_engine_utils\src\precompiled;..\..\ExternalLibs\Runtime\pk_geometrics;..\..\ExternalLibs\Runtime\pk_particles\src;..\intermediate\AfterEffects\VC142\x64\Release\PK-Runtime_SDK1;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + NotUsing + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\Runtime\pk_maths\src;..\..\ExternalLibs\Runtime\pk_maths;..\..\ExternalLibs\Runtime\pk_toolkit;..\..\ExternalLibs\Runtime\pk_toolkit\src\include;..\..\ExternalLibs\Runtime\pk_kernel;..\..\ExternalLibs\Runtime\pk_imaging;..\..\ExternalLibs\Runtime\pk_base_object\src;..\..\ExternalLibs\Runtime\pk_base_object\src\precompiled;..\..\ExternalLibs\Runtime\pk_compiler\src;..\..\ExternalLibs\Runtime\pk_compiler\src\precompiled;..\..\ExternalLibs\Runtime\pk_engine_utils\src\precompiled;..\..\ExternalLibs\Runtime\pk_geometrics;..\..\ExternalLibs\Runtime\pk_particles\src;..\intermediate\AfterEffects\VC142\x64\Retail\PK-Runtime_SDK1;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Runtime_SDK1.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Runtime_SDK1.vcxproj.filters new file mode 100644 index 00000000..c7730b34 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Runtime_SDK1.vcxproj.filters @@ -0,0 +1,1335 @@ + + + + + {777A4BA3-6332-8DF0-CC39-664CB81028E1} + + + {2210222B-0EF4-E280-7754-DDD36357CD02} + + + {40CAD6B7-2C97-31C3-55B0-1F6B41DC6651} + + + {EB184177-D711-60C9-0044-454EEC9B3FD5} + + + {8C746564-F829-DE59-811E-D830EDD2D45D} + + + {374FCB09-A3B0-A817-2C1E-EFC9987EDFD6} + + + {9751D874-8309-1AC2-EC10-F31DD8E7B4B2} + + + {420724DB-2EEB-E430-974B-DF83834ECFB2} + + + {21CE72FC-8DAD-F197-96C5-7C6E022458F9} + + + {CC6D8F6E-38F9-FC32-410A-8027AD145933} + + + {66FB35BE-529D-6094-3B58-74E82799E7E4} + + + {1110BA88-FDDD-AD8E-E671-1EB5D2DE89F3} + + + {B800BA80-A425-0901-CD70-EE90B9F4071F} + + + {59BED26C-45E4-9CD3-2E2A-229F1AEFC19F} + + + {BAF25C6E-A618-27D5-8F5E-ACA07B234CA1} + + + {028BA70D-6E9F-CFBE-3721-731EA3F4CBEF} + + + {AD7B1F38-193C-9B6E-E276-E4EB4EF6DF4A} + + + {5AA1E5B9-C6D8-2D51-CFE2-91743B99544A} + + + {9270C55C-FE7D-F342-8764-EF2DF370BFF9} + + + {3A620F47-A6C3-EC54-2F31-33079B912314} + + + {6FC6B056-DB32-6C51-A426-04AF10528EB9} + + + {6833B8D2-5458-0753-7DA3-ECE269270671} + + + {BD745531-A903-DFFA-5222-F3F53E90EFA0} + + + {A91312A5-95F7-D2FA-FE57-CD4DEA5ABD7C} + + + {637EF141-4F78-1A94-38E5-B0A4247E8000} + + + {6C2A9B3B-D894-4FB2-21D3-00588D7C2D07} + + + {17E5C82E-83FB-C6C4-CC72-52E638C8974C} + + + {9AEC5720-06AF-8BAA-4F5F-1A37BB606488} + + + {068FAF36-7272-BE76-7B75-ECB2E7D784C7} + + + {078FAF36-7372-BE76-7C75-ECB2E8D784C7} + + + {B026337A-1C34-6160-A51A-5D4B11272D17} + + + {ED52F94D-D962-A51E-421C-0A3D2E4B94B7} + + + {E4EE2D7F-D014-F8E5-B95A-7DB1A51F1DB2} + + + {99276702-8578-5244-AEDC-40069A8CE5AD} + + + {9A276702-8678-5244-AFDC-40069B8CE5AD} + + + {E8FF2D7F-D425-F8E5-BD6B-7DB1A9301DB2} + + + {5B0AF3AA-C7CC-2635-107D-B5C17C7EFF12} + + + {A3E026A6-8F06-F10C-784C-76D8641116D9} + + + {8739146B-F31C-23AB-FC1F-51E76882E9FB} + + + {8839146B-F41C-23AB-FD1F-51E76982E9FB} + + + {56BEF1A7-C2D6-D8D1-8B83-686BF75A6D6B} + + + {E8B51981-D49C-DB78-7DED-419669B354DF} + + + {CE111D93-BA21-C963-23DB-2D820F0AB8FC} + + + {F687EE98-626B-FDD8-6B6E-2B15D7D0C329} + + + {4536E81B-315C-B282-1AA2-374E0667D74E} + + + {3ACBD0B6-261C-BCF8-4F80-AABA3B304F62} + + + {3BCBD0B6-271C-BCF8-5080-AABA3C304F62} + + + {4947E81B-356D-B282-1EB3-374E0A78D74E} + + + {8BD8DD50-F7B7-5CEC-00D0-E7C26C2EC34D} + + + {3642EB15-A2CD-58DA-ABDE-DBCE17E9B4DA} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + BaseObject\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + Compiler\Headers + + + EngineUtils\Headers + + + EngineUtils\Headers + + + EngineUtils\Headers + + + EngineUtils\Headers + + + EngineUtils\Headers + + + EngineUtils\Headers + + + EngineUtils\Headers + + + EngineUtils\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Geometrics\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Imaging\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers + + + Kernel\Headers\platforms\apple + + + Kernel\Headers\platforms\win32 + + + Kernel\Headers\platforms\win32 + + + Kernel\Headers\platforms\win32 + + + Kernel\Headers\platforms\win32 + + + Kernel\Headers\platforms\win32 + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers\CoreTypes + + + Maths\Headers + + + Maths\Headers\Interpolators + + + Maths\Headers\Interpolators + + + Maths\Headers\CoreTypes + + + Maths\Headers\CoreTypes + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers\Noise + + + Maths\Headers\Noise + + + Maths\Headers\Primitives + + + Maths\Headers\Primitives + + + Maths\Headers\Primitives + + + Maths\Headers\CoreTypes + + + Maths\Headers\CoreTypes + + + Maths\Headers\Random + + + Maths\Headers\Random + + + Maths\Headers\Random + + + Maths\Headers\Random + + + Maths\Headers\Random + + + Maths\Headers\Random + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers + + + Maths\Headers\SIMD + + + Maths\Headers\SIMD + + + Maths\Headers\CoreTypes + + + Maths\Headers\CoreTypes + + + Maths\Headers\Numeric + + + Maths\Headers\Numeric + + + Maths\Headers\Numeric + + + Maths\Headers\Numeric + + + Maths\Headers\Numeric + + + Maths\Headers\Numeric + + + Maths\Headers\Numeric + + + Maths\Headers\Numeric + + + Maths\Headers\SIMD\sse + + + Maths\Headers\SIMD\sse + + + Maths\Headers\SIMD\sse + + + Maths\Headers\SIMD\sse + + + Maths\Headers\SIMD\sse + + + Maths\Headers\SIMD\sse + + + Maths\Headers\SIMD\sse + + + Maths\Headers\SIMD\sse + + + Particles\Headers\Kernels\D3D11 + + + Particles\Headers\Kernels\D3D12 + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Renderers + + + Particles\Headers\Samplers\CPU + + + Particles\Headers\Samplers\D3D11 + + + Particles\Headers\Samplers\D3D11 + + + Particles\Headers\Samplers\D3D12 + + + Particles\Headers\Samplers\D3D12 + + + Particles\Headers\Samplers\D3D12 + + + Particles\Headers\Samplers\D3D12 + + + Particles\Headers\Samplers\GPU + + + Particles\Headers\Storage\Auto + + + Particles\Headers\Storage\D3D11 + + + Particles\Headers\Storage\D3D11 + + + Particles\Headers\Storage\D3D11 + + + Particles\Headers\Storage\D3D11 + + + Particles\Headers\Storage\D3D12 + + + Particles\Headers\Storage\D3D12 + + + Particles\Headers\Storage\D3D12 + + + Particles\Headers\Storage\GPU + + + Particles\Headers\Storage\MainMemory + + + Particles\Headers\Storage\MainMemory + + + Particles\Headers\Storage\MainMemory + + + Particles\Headers\Storage\MainMemory + + + Particles\Headers\Storage\MainMemory + + + Particles\Headers\Updaters\Auto + + + Particles\Headers\Updaters\CPU + + + Particles\Headers\Updaters\D3D11 + + + Particles\Headers\Updaters\D3D12 + + + Particles\Headers\Updaters\GPU + + + Particles\Headers\Updaters\GPU + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Particles\Headers + + + Toolkit\Headers + + + Toolkit\Headers + + + Toolkit\Headers + + + Toolkit\Headers + + + Toolkit\Headers + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-SampleLib.vcxproj b/projects/AfterEffects_vs2019/PK-SampleLib.vcxproj new file mode 100644 index 00000000..c8025c91 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-SampleLib.vcxproj @@ -0,0 +1,442 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-SampleLib + x64 + 10.0.17134.0 + + + + StaticLibrary + true + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-SampleLib\ + PK-SampleLib_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-SampleLib\ + PK-SampleLib_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-SampleLib\ + PK-SampleLib_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_SDL=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\precompiled;..\..\Samples\PK-SampleLib;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\SDL2\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\fmodex\inc;..\..\ExternalLibs\winpixeventruntime\include;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + ..\..\ExternalLibs\winpixeventruntime\bin\x64\WinPixEventRuntime.lib;%(AdditionalDependencies) + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_SDL=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\precompiled;..\..\Samples\PK-SampleLib;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\SDL2\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\fmodex\inc;..\..\ExternalLibs\winpixeventruntime\include;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + ..\..\ExternalLibs\winpixeventruntime\bin\x64\WinPixEventRuntime.lib;%(AdditionalDependencies) + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_SDL=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\precompiled;..\..\Samples\PK-SampleLib;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\SDL2\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\fmodex\inc;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NotUsing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-SampleLib.vcxproj.filters b/projects/AfterEffects_vs2019/PK-SampleLib.vcxproj.filters new file mode 100644 index 00000000..251a2b1e --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-SampleLib.vcxproj.filters @@ -0,0 +1,911 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {6F8275F3-5B66-3649-C4C6-309CB0C920CB} + + + {D90F5ADE-C509-8330-AE76-19419A0FE99C} + + + {B18ADCDD-9DAF-2B5E-C6FA-10EEB27E2A7C} + + + {C338D79E-2FFB-0A29-78AB-99B5E4ACE306} + + + {0F9D89AF-7B5F-BD39-C40F-4CC630119617} + + + {E43B44DE-D035-6D30-B9A2-0341A53BD39C} + + + {77CE0E33-6389-FEDE-0C41-7729F8DA486F} + + + {7F7F5EE9-6B0E-E8B2-142D-FCAD009BF858} + + + {00874CE1-6CE8-29EF-F555-70A161B660AE} + + + {B47FB5E3-A03A-A58F-49F2-1DDA358CEF1F} + + + {E3A03299-4F63-6623-9813-F5AF04153F01} + + + {0EB0BB5F-7AE7-03F7-83F1-671AEFA72AF0} + + + {BD14FE9D-2981-B998-F274-51F65EA0DB00} + + + {CDDC95C7-3949-51C2-023D-E91F6E68732A} + + + {DC5DCDD0-C8AF-A4C0-B1CE-E1D09DBFBDA9} + + + {E4CFDC3F-D020-C881-F984-B643E5345BEB} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {EFAC8DF2-5B8C-0C8E-64A4-9764D00273EF} + + + {4D14F45B-B92A-F2F1-02A2-7D136EF7C279} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {37D5A64E-23B9-67A4-8C19-62F7781C5226} + + + {A1860744-8D80-3096-76ED-C6A662869602} + + + {8B9A8602-F75C-BA8C-400D-4919AC0E936A} + + + {D7FE3813-43C1-6C9D-8C71-FB29F872457B} + + + {ACB2F143-98AC-1A96-8119-B1A66DB28002} + + + {3F3BFCE1-2BF6-EB8D-D4AD-64D8C047361E} + + + {47A42FD6-3333-B99F-DC51-CD9AC8BFC945} + + + {C832A8A2-3494-85B0-BD01-CC622962BC6F} + + + {7CECA292-68A7-923E-115F-0B89FDF8DCCE} + + + {AB02E2FC-17C5-1587-6075-A413CC76EE64} + + + {D6FF177B-4237-6012-4B41-C435B7F7860B} + + + {85D2F324-F13E-AF1F-BA32-477D265ED187} + + + {959A8B4E-0107-4749-CAFA-DEA6362669B1} + + + {A464DF18-90B6-B608-79D5-F31865C6CFF1} + + + {AC60C34D-98B1-AE8F-C115-9D51ADC541F9} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {683B1E79-5460-6DF9-7DAB-5289692F6C17} + + + {7142390B-5DFD-28B7-06B5-A101F24E7347} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\fmodex-4.44.19\inc + + + _External\fmodex-4.44.19\inc + + + _External\fmodex-4.44.19\inc + + + _External\fmodex-4.44.19\inc + + + _External\fmodex-4.44.19\inc + + + _External\fmodex-4.44.19\inc + + + _External\fmodex-4.44.19\inc + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + Headers\ApiContext\D3D + + + Headers\ApiContext\D3D + + + Headers\ApiContext + + + Headers\ApiContext\Metal + + + Headers\ApiContext\Metal + + + Headers\ApiContext\Metal + + + Headers\ApiContext\OpenGL + + + Headers\ApiContext\OpenGL + + + Headers\ApiContext\OpenGL + + + Headers\ApiContext\OpenGL + + + Headers\ApiContext\OpenGL + + + Headers\ApiContext\Vulkan + + + Headers + + + Shaders\Generated + + + Shaders\Generated + + + Shaders\Generated + + + Shaders\Generated + + + Shaders\Generated + + + Shaders\Generated + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers\PopcornStartup + + + Headers + + + Headers + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderIntegrationRHI + + + Headers\RenderPasses + + + Headers\RenderPasses + + + Headers\RenderPasses + + + Headers\RenderPasses + + + Headers\RenderPasses + + + Headers\RenderPasses + + + Headers\RenderPasses + + + Headers\RenderPasses + + + Headers\SampleScene + + + Headers\SampleScene + + + Headers\SampleScene\Entities + + + Headers\SampleScene\Entities + + + Headers\SampleScene\Entities + + + Headers + + + Headers\ShaderDefinitions + + + Headers\ShaderDefinitions + + + Headers\ShaderDefinitions + + + Headers\ShaderDefinitions + + + Headers\ShaderDefinitions + + + Headers\ShaderGenerator + + + Headers\ShaderGenerator + + + Headers\ShaderGenerator + + + Headers\ShaderGenerator + + + Headers\ShaderGenerator + + + Headers\ShaderGenerator + + + Headers + + + Headers\SimInterfaces + + + Headers\WindowContext + + + Headers\WindowContext\OffscreenContext + + + Headers\WindowContext\SdlContext + + + Precompiled + + + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + Sources\ApiContext\D3D + + + Sources\ApiContext\D3D + + + Sources\ApiContext\OpenGL + + + Sources\ApiContext\OpenGL + + + Sources\ApiContext\OpenGL + + + Sources\ApiContext\OpenGL + + + Sources\ApiContext\Vulkan + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources\PopcornStartup + + + Sources + + + Sources + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderIntegrationRHI + + + Sources\RenderPasses + + + Sources\RenderPasses + + + Sources\RenderPasses + + + Sources\RenderPasses + + + Sources\RenderPasses + + + Sources\RenderPasses + + + Sources\RenderPasses + + + Sources\RenderPasses + + + Sources\SampleScene + + + Sources\SampleScene + + + Sources\SampleScene\Entities + + + Sources\SampleScene\Entities + + + Sources\SampleScene\Entities + + + Sources + + + Sources\ShaderDefinitions + + + Sources\ShaderDefinitions + + + Sources\ShaderDefinitions + + + Sources\ShaderDefinitions + + + Sources\ShaderDefinitions + + + Sources\ShaderGenerator + + + Sources\ShaderGenerator + + + Sources\ShaderGenerator + + + Sources\ShaderGenerator + + + Sources\ShaderGenerator + + + Sources\ShaderGenerator + + + Sources + + + Sources\SimInterfaces + + + Sources\WindowContext + + + Sources\WindowContext\OffscreenContext + + + Sources\WindowContext\SdlContext + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj new file mode 100644 index 00000000..7d43ee8a --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj @@ -0,0 +1,237 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {94C84A6E-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_01_BasicRendering + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_01_BasicRendering\ + PK-Sample_01_BasicRendering_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_01_BasicRendering\ + PK-Sample_01_BasicRendering_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_01_BasicRendering\ + PK-Sample_01_BasicRendering_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_01_BasicRendering;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_01_BasicRendering;..\..\Samples\precompiled;..\..\Samples;..\..\SDK\Samples\Common;..\..\SDK\Samples\Common\PKFX;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;glfw3.lib;GLU32.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\GL\lib\vs2015_x64\Debug;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_01_BasicRendering;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_01_BasicRendering;..\..\Samples\precompiled;..\..\Samples;..\..\SDK\Samples\Common;..\..\SDK\Samples\Common\PKFX;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;glfw3.lib;GLU32.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\GL\lib\vs2015_x64\Release;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_01_BasicRendering;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_01_BasicRendering;..\..\Samples\precompiled;..\..\Samples;..\..\SDK\Samples\Common;..\..\SDK\Samples\Common\PKFX;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;glfw3.lib;GLU32.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\GL\lib\vs2015_x64\Release;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj.filters new file mode 100644 index 00000000..c3a58dfd --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj.filters @@ -0,0 +1,179 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {2F899A6F-1B41-DCBC-8448-B518701F77AD} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _Common\Gl + + + _Common\Gl + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Precompiled + + + + + _Common\Gl + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Precompiled + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_01_BasicRendering.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj new file mode 100644 index 00000000..eddc43d6 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj @@ -0,0 +1,200 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {6180C80A-EF04-4935-AEDB-FF9D2A087E79} + true + Win32Proj + PK-Sample_01_BasicStartup + x64 + 10.0.17134.0 + + + + Application + true + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_01_BasicStartup\ + PK-Sample_01_BasicStartup_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_01_BasicStartup\ + PK-Sample_01_BasicStartup_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_01_BasicStartup\ + PK-Sample_01_BasicStartup_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Console + true + PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-ZLib_d.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-ZLib_r.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-ZLib_s.lib;d3dcompiler.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + NotUsing + + + NotUsing + + + + Create + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj.filters new file mode 100644 index 00000000..eb10172e --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj.filters @@ -0,0 +1,50 @@ + + + + + {8EEA3EAC-7A8C-6982-6347-7DD64F88F0D2} + + + {B659DD28-220F-561E-AB03-50F517B84C22} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Common\PKFX + + + Common\PKFX + + + Headers + + + + + Common\PKFX + + + Common\PKFX + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_01_BasicStartup.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj new file mode 100644 index 00000000..7d30b7c1 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj @@ -0,0 +1,200 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {44DEC18A-CBA0-4053-B592-6ECF4D324224} + true + Win32Proj + PK-Sample_02_BasicEvolve + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_02_BasicEvolve\ + PK-Sample_02_BasicEvolve_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_02_BasicEvolve\ + PK-Sample_02_BasicEvolve_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_02_BasicEvolve\ + PK-Sample_02_BasicEvolve_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Console + true + PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-ZLib_d.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-ZLib_r.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-ZLib_s.lib;d3dcompiler.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + NotUsing + + + NotUsing + + + + Create + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj.filters new file mode 100644 index 00000000..19ae0a58 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj.filters @@ -0,0 +1,50 @@ + + + + + {8EEA3EAC-7A8C-6982-6347-7DD64F88F0D2} + + + {B659DD28-220F-561E-AB03-50F517B84C22} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Common\PKFX + + + Common\PKFX + + + Headers + + + + + Common\PKFX + + + Common\PKFX + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_02_BasicEvolve.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj new file mode 100644 index 00000000..80a507b2 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj @@ -0,0 +1,306 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {C4DA3BC6-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_02_FullIntegration + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_02_FullIntegration\ + PK-Sample_02_FullIntegration_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_02_FullIntegration\ + PK-Sample_02_FullIntegration_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_02_FullIntegration\ + PK-Sample_02_FullIntegration_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_02_FullIntegration;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_02_FullIntegration;..\..\Samples\precompiled;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_02_FullIntegration;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_02_FullIntegration;..\..\Samples\precompiled;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_02_FullIntegration;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_02_FullIntegration;..\..\Samples\precompiled;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj.filters new file mode 100644 index 00000000..3d6b7cfa --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj.filters @@ -0,0 +1,395 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {9E50865E-0A11-0295-D34B-4B123FCB4671} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {66C69E6C-D286-1AA3-9BC1-632007415F7F} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + Headers\Scene + + + Headers\Scene + + + Precompiled + + + + + Sources + + + Sources + + + Sources\Scene + + + Sources\Scene + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_02_FullIntegration.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj new file mode 100644 index 00000000..85003fe9 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj @@ -0,0 +1,196 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {44DEFFAA-CBA0-4053-B592-6ECF4D324224} + true + Win32Proj + PK-Sample_03_EngineHooks + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_03_EngineHooks\ + PK-Sample_03_EngineHooks_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_03_EngineHooks\ + PK-Sample_03_EngineHooks_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_03_EngineHooks\ + PK-Sample_03_EngineHooks_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Console + true + PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-ZLib_d.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-ZLib_r.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-ZLib_s.lib;d3dcompiler.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + NotUsing + + + + Create + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj.filters new file mode 100644 index 00000000..0d04a0e1 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj.filters @@ -0,0 +1,44 @@ + + + + + {8EEA3EAC-7A8C-6982-6347-7DD64F88F0D2} + + + {B659DD28-220F-561E-AB03-50F517B84C22} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Common\PKFX + + + Headers + + + + + Common\PKFX + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_03_EngineHooks.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj new file mode 100644 index 00000000..924ddb9a --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj @@ -0,0 +1,212 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {44DE001A-CBA0-4333-B592-6E87CC324224} + true + Win32Proj + PK-Sample_04_Baking + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_04_Baking\ + PK-Sample_04_Baking_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_04_Baking\ + PK-Sample_04_Baking_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_04_Baking\ + PK-Sample_04_Baking_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;USE_COMPILER_BACKEND_D3D;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\ExternalLibs\PK-AssetBakerLib;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Console + true + PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TIFF_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-ZLib_d.lib;PK-Plugin_CodecMesh_FBX_d.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CodecImage_EXR_d.lib;freetype.lib;libfbxsdk-md_d.lib;libxml2-md_d.lib;zlib-md_d.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\libs\freetype-2.5.5\lib\vs2015_x64\Debug;..\..\ExternalLibs\CodecMesh_FBX\libs\vs2019\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;USE_COMPILER_BACKEND_D3D;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\ExternalLibs\PK-AssetBakerLib;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TIFF_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-ZLib_r.lib;PK-Plugin_CodecMesh_FBX_r.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CodecImage_EXR_r.lib;freetype.lib;libfbxsdk-md_r.lib;libxml2-md_r.lib;zlib-md_r.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\libs\freetype-2.5.5\lib\vs2015_x64\Release;..\..\ExternalLibs\CodecMesh_FBX\libs\vs2019\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;USE_COMPILER_BACKEND_D3D;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\ExternalLibs\PK-AssetBakerLib;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TIFF_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-ZLib_s.lib;PK-Plugin_CodecMesh_FBX_s.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CodecImage_EXR_s.lib;freetype.lib;libfbxsdk-md_r.lib;libxml2-md_r.lib;zlib-md_r.lib;d3dcompiler.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\libs\freetype-2.5.5\lib\vs2015_x64\Release;..\..\ExternalLibs\CodecMesh_FBX\libs\vs2019\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + NotUsing + + + NotUsing + + + + Create + + + + + + + + {44ECDA8C-CBA0-4035-B212-68E793243242} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj.filters new file mode 100644 index 00000000..ccaa217b --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj.filters @@ -0,0 +1,74 @@ + + + + + {8EEA3EAC-7A8C-6982-6347-7DD64F88F0D2} + + + {B659DD28-220F-561E-AB03-50F517B84C22} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {DB59485E-471A-C494-1055-0D127CD40871} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Common\PKFX + + + Common\PKFX + + + Headers + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + Headers\Ovens + + + + + Common\PKFX + + + Common\PKFX + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_04_Baking.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj new file mode 100644 index 00000000..6cffb8a5 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj @@ -0,0 +1,322 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {C842904F-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_04_EffectInterface + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_04_EffectInterface\ + PK-Sample_04_EffectInterface_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_04_EffectInterface\ + PK-Sample_04_EffectInterface_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_04_EffectInterface\ + PK-Sample_04_EffectInterface_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_04_EffectInterface;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_04_EffectInterface;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_04_EffectInterface;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_04_EffectInterface;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_04_EffectInterface;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_04_EffectInterface;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj.filters new file mode 100644 index 00000000..a09da9c8 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj.filters @@ -0,0 +1,443 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_04_EffectInterface.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj new file mode 100644 index 00000000..988bec12 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj @@ -0,0 +1,306 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {BF82A3E1-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_05_Stats + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_05_Stats\ + PK-Sample_05_Stats_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_05_Stats\ + PK-Sample_05_Stats_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_05_Stats\ + PK-Sample_05_Stats_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_05_Stats;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_05_Stats;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_05_Stats;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_05_Stats;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_05_Stats;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_05_Stats;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj.filters new file mode 100644 index 00000000..e9b80df1 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj.filters @@ -0,0 +1,395 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_05_Stats.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj new file mode 100644 index 00000000..cb81d146 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj @@ -0,0 +1,211 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {44DE001A-CBA0-4333-C593-7E8642326924} + true + Win32Proj + PK-Sample_05_Upgrader + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_05_Upgrader\ + PK-Sample_05_Upgrader_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_05_Upgrader\ + PK-Sample_05_Upgrader_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_05_Upgrader\ + PK-Sample_05_Upgrader_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\ExternalLibs\pk_upgraderlib\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Console + true + PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-ZLib_d.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\ExternalLibs\pk_upgraderlib\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-ZLib_r.lib;dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_USE_RENDER_HELPERS=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\SDK\Samples\ParticleSample\src;..\..\SDK\Samples\ParticleSample\src\include;..\..\ExternalLibs\pk_upgraderlib\include;..\..\SDK\Samples\Common\PKFX;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-ZLib_s.lib;d3dcompiler.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + NotUsing + + + + Create + + + + + + + + {55ACDBF7-CBA0-4035-B212-68E793243242} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj.filters new file mode 100644 index 00000000..1ecf733d --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj.filters @@ -0,0 +1,77 @@ + + + + + {8EEA3EAC-7A8C-6982-6347-7DD64F88F0D2} + + + {B659DD28-220F-561E-AB03-50F517B84C22} + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {0AEC250B-F6E4-445D-1F17-2AE20B6F2469} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Common\PKFX + + + Headers + + + Headers\Upgrader + + + Headers\Upgrader + + + Headers\Upgrader + + + Headers\Upgrader + + + Headers\Upgrader + + + Headers\Upgrader + + + Headers\Upgrader + + + Headers\Upgrader + + + Headers\Upgrader + + + Headers\Upgrader + + + + + Common\PKFX + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_05_Upgrader.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj new file mode 100644 index 00000000..5cd50f7e --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj @@ -0,0 +1,312 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {E181876D-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_06_SimInterface + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_06_SimInterface\ + PK-Sample_06_SimInterface_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_06_SimInterface\ + PK-Sample_06_SimInterface_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_06_SimInterface\ + PK-Sample_06_SimInterface_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_06_SimInterface;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_06_SimInterface;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_06_SimInterface;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_06_SimInterface;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_06_SimInterface;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_06_SimInterface;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj.filters new file mode 100644 index 00000000..ce579755 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj.filters @@ -0,0 +1,413 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Headers + + + Headers + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterface.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj new file mode 100644 index 00000000..ffe6c0b8 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj @@ -0,0 +1,308 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {482524F9-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_06_SimInterfaceGPU + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_06_SimInterfaceGPU\ + PK-Sample_06_SimInterfaceGPU_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_06_SimInterfaceGPU\ + PK-Sample_06_SimInterfaceGPU_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_06_SimInterfaceGPU\ + PK-Sample_06_SimInterfaceGPU_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_06_SimInterfaceGPU;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_06_SimInterfaceGPU;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_06_SimInterfaceGPU;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_06_SimInterfaceGPU;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_06_SimInterfaceGPU;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_06_SimInterfaceGPU;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj.filters new file mode 100644 index 00000000..0dbd3339 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj.filters @@ -0,0 +1,401 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_06_SimInterfaceGPU.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj new file mode 100644 index 00000000..312002fb --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj @@ -0,0 +1,306 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {03233C53-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_07_LOD + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_07_LOD\ + PK-Sample_07_LOD_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_07_LOD\ + PK-Sample_07_LOD_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_07_LOD\ + PK-Sample_07_LOD_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_07_LOD;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_07_LOD;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_07_LOD;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_07_LOD;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_07_LOD;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_07_LOD;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj.filters new file mode 100644 index 00000000..4579d2ec --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj.filters @@ -0,0 +1,395 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_07_LOD.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj new file mode 100644 index 00000000..7f202faa --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj @@ -0,0 +1,312 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {2940E5DC-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_08_CustomCollision + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_08_CustomCollision\ + PK-Sample_08_CustomCollision_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_08_CustomCollision\ + PK-Sample_08_CustomCollision_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_08_CustomCollision\ + PK-Sample_08_CustomCollision_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_08_CustomCollision;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_08_CustomCollision;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_08_CustomCollision;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_08_CustomCollision;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_08_CustomCollision;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_08_CustomCollision;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj.filters new file mode 100644 index 00000000..9fb39146 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj.filters @@ -0,0 +1,413 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Headers + + + Headers + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_08_CustomCollision.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj new file mode 100644 index 00000000..d44fa433 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj @@ -0,0 +1,307 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {46713752-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_09_AsyncLoading + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_09_AsyncLoading\ + PK-Sample_09_AsyncLoading_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_09_AsyncLoading\ + PK-Sample_09_AsyncLoading_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_09_AsyncLoading\ + PK-Sample_09_AsyncLoading_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_09_AsyncLoading;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_09_AsyncLoading;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_09_AsyncLoading;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_09_AsyncLoading;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_09_AsyncLoading;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_09_AsyncLoading;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj.filters new file mode 100644 index 00000000..ff5ec5af --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj.filters @@ -0,0 +1,398 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_09_AsyncLoading.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj new file mode 100644 index 00000000..f3956210 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj @@ -0,0 +1,307 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {355F328A-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_10_AsyncRendering + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_10_AsyncRendering\ + PK-Sample_10_AsyncRendering_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_10_AsyncRendering\ + PK-Sample_10_AsyncRendering_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_10_AsyncRendering\ + PK-Sample_10_AsyncRendering_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_10_AsyncRendering;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_10_AsyncRendering;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_10_AsyncRendering;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_10_AsyncRendering;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_10_AsyncRendering;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_10_AsyncRendering;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj.filters new file mode 100644 index 00000000..92d1b6f6 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj.filters @@ -0,0 +1,398 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_10_AsyncRendering.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj new file mode 100644 index 00000000..3ae1f7cd --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj @@ -0,0 +1,308 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {2B382181-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_11_ThreadPool + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_11_ThreadPool\ + PK-Sample_11_ThreadPool_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_11_ThreadPool\ + PK-Sample_11_ThreadPool_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_11_ThreadPool\ + PK-Sample_11_ThreadPool_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_11_ThreadPool;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_11_ThreadPool;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_11_ThreadPool;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_11_ThreadPool;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_11_ThreadPool;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_11_ThreadPool;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj.filters new file mode 100644 index 00000000..2e470623 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj.filters @@ -0,0 +1,401 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_11_ThreadPool.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj b/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj new file mode 100644 index 00000000..d6bd8766 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj @@ -0,0 +1,306 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {C61ADEEC-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-Sample_12_GBufferSampling + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Sample_12_GBufferSampling\ + PK-Sample_12_GBufferSampling_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Sample_12_GBufferSampling\ + PK-Sample_12_GBufferSampling_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Sample_12_GBufferSampling\ + PK-Sample_12_GBufferSampling_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_12_GBufferSampling;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_12_GBufferSampling;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Windows + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-ZLib_d.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_12_GBufferSampling;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_12_GBufferSampling;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-ZLib_r.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PKSAMPLE_PROJNAME=PK-Sample_12_GBufferSampling;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples\PK-Sample_12_GBufferSampling;..\..\Samples\precompiled;..\..\Samples\PK-Sample_02_FullIntegration\Scene;..\..\Samples;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;..\..\ExternalLibs\imgui;..\..\ExternalLibs\SDL2\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Windows + true + true + true + dxgi.lib;opengl32.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-MCPP.lib;PK-Plugin_CompilerBackend_GPU_D3D_s.lib;PK-Plugin_CompilerBackend_CPU_VM_s.lib;PK-Plugin_CodecImage_DDS_s.lib;PK-Plugin_CodecImage_JPG_s.lib;PK-Plugin_CodecImage_PKM_s.lib;PK-Plugin_CodecImage_PNG_s.lib;PK-Plugin_CodecImage_PVR_s.lib;PK-Plugin_CodecImage_TGA_s.lib;PK-Plugin_CodecImage_HDR_s.lib;PK-Discretizers_s.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;PK-ZLib_s.lib;fmodex64_vc.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;SDL2.lib;d3dcompiler.lib;%(AdditionalDependencies) + $(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\fmodex\lib;..\..\ExternalLibs\SDL2\lib\x64;..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj.filters new file mode 100644 index 00000000..46691b89 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj.filters @@ -0,0 +1,395 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {CD0EFC38-39EE-7AD4-4206-06ABAE64E135} + + + {AAA169CD-1662-E503-DF9C-2E814B1C2AE0} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {250E8582-119D-0E4C-BABB-2247A6291FF2} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {7C75CF18-6804-59E2-1123-6DDDFD906988} + + + {5E25DCDA-CA5C-2472-D366-88953F1D4B6B} + + + {CB370DF4-B705-01FA-A099-71208C06DD5E} + + + {3EFA8EC6-2AF4-B718-1361-4E29FFF91D85} + + + {B1435977-1DCF-C63B-26E0-493092EA223C} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\DX\include + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\GL\include\GL + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\SDL2\include + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _External\imgui + + + _Common\Scene + + + Headers + + + Precompiled + + + + + _Common + + + _Common\Scene + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj.user b/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj.user new file mode 100644 index 00000000..b570b285 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Sample_12_GBufferSampling.vcxproj.user @@ -0,0 +1,15 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj b/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj new file mode 100644 index 00000000..ff102661 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj @@ -0,0 +1,171 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {2FCAC7C2-E37E-456E-B4B4-F944839A2FFC} + true + Win32Proj + PK-ShaderTool + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + true + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-ShaderTool\ + PK-ShaderTool_d + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\builds\x64_Samples\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-ShaderTool\ + PK-ShaderTool_r + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\precompiled;..\..\Samples\PK-ShaderTool;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Console + true + PK-MCPP.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-Plugin_CodecImage_DDS_d.lib;PK-Plugin_CodecImage_JPG_d.lib;PK-Plugin_CodecImage_PKM_d.lib;PK-Plugin_CodecImage_PNG_d.lib;PK-Plugin_CodecImage_PVR_d.lib;PK-Plugin_CodecImage_TGA_d.lib;PK-Plugin_CodecImage_HDR_d.lib;PK-Plugin_CompilerBackend_CPU_VM_d.lib;PK-Discretizers_d.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;PK-Plugin_CompilerBackend_GPU_D3D_d.lib;PK-ZLib_d.lib;version.lib;psapi.lib;fmodex64_vc.lib;dxgi.lib;opengl32.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;$(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;PK_BUILD_WITH_FMODEX_SUPPORT=0;PK_BUILD_WITH_D3D11_SUPPORT=1;PK_BUILD_WITH_D3D12_SUPPORT=1;PK_BUILD_WITH_OGL_SUPPORT=1;GL_GLEXT_PROTOTYPES;GLEW_STATIC;GLEW_NO_GLU;PK_BUILD_WITH_VULKAN_SUPPORT=0;PK_BUILD_WITH_SDL=0;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\Samples;..\..\Samples\precompiled;..\..\Samples\PK-ShaderTool;..\..\ExternalLibs\DX\include;..\..\ExternalLibs\GL\include;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + PK-MCPP.lib;PK-RHI.lib;PK-RenderHelpers.lib;PK-Plugin_CodecImage_DDS_r.lib;PK-Plugin_CodecImage_JPG_r.lib;PK-Plugin_CodecImage_PKM_r.lib;PK-Plugin_CodecImage_PNG_r.lib;PK-Plugin_CodecImage_PVR_r.lib;PK-Plugin_CodecImage_TGA_r.lib;PK-Plugin_CodecImage_HDR_r.lib;PK-Plugin_CompilerBackend_CPU_VM_r.lib;PK-Discretizers_r.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;PK-Plugin_CompilerBackend_GPU_D3D_r.lib;PK-ZLib_r.lib;version.lib;psapi.lib;fmodex64_vc.lib;dxgi.lib;opengl32.lib;dxguid.lib;d3dcompiler.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\fmodex\lib;$(WindowsSDK_LibraryPath_x64);..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj.filters b/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj.filters new file mode 100644 index 00000000..a222f8ca --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj.filters @@ -0,0 +1,137 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {07CD4F05-7337-047C-BC75-B521281FE2D0} + + + {B2545DA7-9EB7-EC4B-473D-2502337FB8CE} + + + {5DF51B81-4984-A54A-F2A2-B945DE10B6F0} + + + {09555DA7-F5B7-EC4B-9E3D-25028A7FB8CE} + + + {B45C6617-A0EB-EFE0-490A-04DC35780087} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\DX\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + _External\GL\Headers + + + Headers + + + Precompiled + + + + + Sources + + + Sources + + + Precompiled + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj.user b/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj.user new file mode 100644 index 00000000..dfdeaebb --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-ShaderTool.vcxproj.user @@ -0,0 +1,11 @@ + + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + + ..\..\..\release\builds\x64_Samples + WindowsLocalDebugger + + diff --git a/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj b/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj new file mode 100644 index 00000000..6c502e8c --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj @@ -0,0 +1,199 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {1821DADC-CBA0-4053-B122-6E8793324224} + true + Win32Proj + PK-Upgrader + x64 + 10.0.17134.0 + + + + Application + true + Unicode + v142 + + + Application + false + Unicode + v142 + + + Application + false + Unicode + v142 + + + + + + + + + + + + + + + + true + ..\..\..\release\application\BinariesVC142_x64_d\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-Upgrader\ + PK-Upgrader + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\application\BinariesVC142_x64_r\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-Upgrader\ + PK-Upgrader + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + false + ..\..\..\release\application\BinariesVC142_x64_r\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-Upgrader\ + PK-Upgrader_s + .exe + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\pk_upgrader;..\..\ExternalLibs;%(AdditionalIncludeDirectories) + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + + + Console + true + dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_d.lib;PK-Runtime_d.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\pk_upgrader;..\..\ExternalLibs;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + dxguid.lib;d3dcompiler.lib;PK-ParticlesToolbox_r.lib;PK-Runtime_r.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + Use + precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs\pk_upgrader;..\..\ExternalLibs;%(AdditionalIncludeDirectories) + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + + + Console + true + true + true + d3dcompiler.lib;PK-ParticlesToolbox_s.lib;PK-Runtime_s.lib;winmm.lib;User32.lib;Psapi.lib;Version.lib;dbghelp.lib;%(AdditionalDependencies) + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform);%(AdditionalLibraryDirectories) + mainCRTStartup + + + + + + + + + + Create + + + + + + + + + {55ACDBF7-CBA0-4035-B212-68E793243242} + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj.filters b/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj.filters new file mode 100644 index 00000000..3c6ad282 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj.filters @@ -0,0 +1,38 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + + + Sources + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj.user b/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj.user new file mode 100644 index 00000000..ab3e8f60 --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-Upgrader.vcxproj.user @@ -0,0 +1,18 @@ + + + + ..\..\ExternalLibs\pk_upgrader + WindowsLocalDebugger + --test + + + ..\..\ExternalLibs\pk_upgrader + WindowsLocalDebugger + --test + + + ..\..\ExternalLibs\pk_upgrader + WindowsLocalDebugger + --test + + diff --git a/projects/AfterEffects_vs2019/PK-UpgraderLib.vcxproj b/projects/AfterEffects_vs2019/PK-UpgraderLib.vcxproj new file mode 100644 index 00000000..8497217d --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-UpgraderLib.vcxproj @@ -0,0 +1,1312 @@ + + + + + Debug + x64 + + + Release + x64 + + + Retail + x64 + + + + {55ACDBF7-CBA0-4035-B212-68E793243242} + true + Win32Proj + PK-UpgraderLib + x64 + 10.0.17134.0 + + + + StaticLibrary + true + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + StaticLibrary + false + Unicode + v142 + + + + + + + + + + + + + + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Debug\PK-UpgraderLib\ + PK-UpgraderLib_d + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Release\PK-UpgraderLib\ + PK-UpgraderLib_r + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + ..\..\ExternalLibs\Runtime\bin\AfterEffects\vs2019_$(Platform)\ + ..\intermediate\AfterEffects\VC142\x64\Retail\PK-UpgraderLib\ + PK-UpgraderLib_s + .lib + $(WDKBinRoot)\$(TargetPlatformVersion)\$(PlatformTarget);$(ExecutablePath) + + + + Use + upg_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + _DEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\ExternalLibs\pk_upgraderlib\src;..\..\ExternalLibs\pk_upgraderlib\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Disabled + false + false + MultiThreadedDebugDLL + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + + + + + Use + upg_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\ExternalLibs\pk_upgraderlib\src;..\..\ExternalLibs\pk_upgraderlib\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + false + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + Use + upg_precompiled.h + Level4 + 4701;%(DisableSpecificWarnings) + 4002;4003;%(TreatSpecificWarningsAsErrors) + NDEBUG;PK_RETAIL;_CRT_SECURE_NO_WARNINGS;PK_PARTICLES_UPDATER_USE_D3D11=1;PK_COMPILER_BUILD_COMPILER_D3D11=1;PK_PARTICLES_UPDATER_USE_D3D12=1;PK_COMPILER_BUILD_COMPILER_D3D12=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) + ..\..\ExternalLibs\Runtime;..\..\ExternalLibs\Runtime\include;..\..\ExternalLibs\Runtime\include\license\AfterEffects;..\..\ExternalLibs;..\..\ExternalLibs\pk_upgraderlib\src;..\..\ExternalLibs\pk_upgraderlib\src\precompiled;%(AdditionalIncludeDirectories) + pk_compiler_warnings.h + ProgramDatabase + Full + true + true + false + true + true + MultiThreadedDLL + false + false + false + Fast + true + true + $(OutDir)$(TargetName).pdb + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(IntDir)\upg_data_Basic.pkfx1.obj + + + $(IntDir)\upg_data_FX_Simple.pkfx1.obj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(IntDir)\upg_data_Particle_Master.frag1.obj + + + $(IntDir)\upg_data_Black.dds1.obj + + + $(IntDir)\upg_data_Default_AlphaMap.dds1.obj + + + $(IntDir)\upg_data_Diffuse.dds1.obj + + + $(IntDir)\upg_data_Distort.dds1.obj + + + $(IntDir)\upg_data_NMap_Flat.dds1.obj + + + $(IntDir)\upg_data_White.dds1.obj + + + + $(IntDir)\upg_data_Editor.pkri1.obj + + + $(IntDir)\upg_data_Default_Billboard.pkma1.obj + + + $(IntDir)\upg_data_Default_Light.pkma1.obj + + + $(IntDir)\upg_data_Default_Mesh.pkma1.obj + + + $(IntDir)\upg_data_Default_Ribbon.pkma1.obj + + + $(IntDir)\upg_data_Default_Sound.pkma1.obj + + + $(IntDir)\upg_data_Distortion_Billboard.pkma1.obj + + + $(IntDir)\upg_data_SampleLibSettings.pkbo1.obj + + + $(IntDir)\upg_data_Transparent_Mesh.pkma1.obj + + + + + $(IntDir)\upg_data_Default_Billboard.frag1.obj + + + $(IntDir)\upg_data_Default_Light.frag1.obj + + + $(IntDir)\upg_data_Default_Light.vert1.obj + + + $(IntDir)\upg_data_Default_Mesh.frag1.obj + + + $(IntDir)\upg_data_Default_Ribbon.frag1.obj + + + $(IntDir)\upg_data_Distortion_Billboard.frag1.obj + + + $(IntDir)\upg_data_Transparent_Mesh.frag1.obj + + + $(IntDir)\manifest1.obj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/AfterEffects_vs2019/PK-UpgraderLib.vcxproj.filters b/projects/AfterEffects_vs2019/PK-UpgraderLib.vcxproj.filters new file mode 100644 index 00000000..f656e74a --- /dev/null +++ b/projects/AfterEffects_vs2019/PK-UpgraderLib.vcxproj.filters @@ -0,0 +1,3533 @@ + + + + + {C196CD9C-2D76-4C38-368E-D70EA2ECB299} + + + {99BE8D1E-0574-0614-8E68-00EBFA1CFD17} + + + {89565304-F535-D29F-FE4D-5D766AAC3801} + + + {D3ECD3C2-BFE5-F214-E817-D899D46FD220} + + + {0655C69B-726D-ADC5-3B1A-3D5FA7F1415F} + + + {1C5ED1EF-88CA-8CEA-51BE-2448BDE9AE52} + + + {902410B1-FC92-6530-457C-2030B1295BCC} + + + {08A810B1-7416-6630-BDFF-203029AD5BCC} + + + {AE2311B1-1A92-6630-637B-2130CF285CCC} + + + {F94111B1-65B0-6630-AE99-21301A475CCC} + + + {B3BC11B1-1F2B-6730-6814-2230D4C15CCC} + + + {B8C111B1-2430-6730-6D19-2230D9C65CCC} + + + {4F4112B1-BBAF-6730-0499-223070465DCC} + + + {A4611FB1-10D0-7430-59B9-2F30C5666ACC} + + + {856D1FB1-F1DB-7430-3AC5-2F30A6726ACC} + + + {AA6E1FB1-16DD-7430-5FC6-2F30CB736ACC} + + + {ED0220B1-5971-7530-A25A-30300E086BCC} + + + {5085144B-BCF3-69CA-05DD-24CA718A5F66} + + + {09779D25-75E5-F2A4-BECE-ADA42A7CE840} + + + {EA7F9D25-56EE-F2A4-9FD7-ADA40B85E840} + + + {15325B68-81A0-B0E7-CA89-6BE73637A683} + + + {4B9C5B68-B70A-B1E7-00F4-6BE76CA1A683} + + + {2CAD5B68-981B-B1E7-E104-6CE74DB2A683} + + + {EEB05B68-5A1F-B1E7-A308-6CE70FB6A683} + + + {4FB15B68-BB1F-B1E7-0409-6CE770B6A683} + + + {76B5BAE7-62F1-BD51-CB03-D648B75E666C} + + + {FEC7375C-EA03-3BC6-5316-53BD3F71E3E0} + + + {E4CC375C-D008-3BC6-391B-53BD2576E3E0} + + + {FDC5B4D0-E901-B83A-5214-D0313E6F6055} + + + {22BF3145-0EFB-34AF-770D-4DA66368DDC9} + + + {7CC63145-6802-35AF-D114-4DA6BD6FDDC9} + + + {85BCAEB9-71F8-B123-DA0A-CA1AC6655A3E} + + + {3FC8AEB9-2B04-B223-9416-CA1A80715A3E} + + + {1FB92B2E-0BF5-2E98-7407-478F6062D7B2} + + + {83C12B2E-6FFD-2E98-D80F-478FC46AD7B2} + + + {48C22B2E-34FE-2E98-9D10-478F896BD7B2} + + + {7DC52B2E-6901-2F98-D213-478FBE6ED7B2} + + + {E4B6A8A2-D0F2-AB0C-3905-C40325605427} + + + {4CBBA8A2-38F7-AB0C-A109-C4038D645427} + + + {87BFA8A2-73FB-AB0C-DC0D-C403C8685427} + + + {E7B72517-D3F3-2881-3C06-41782861D19B} + + + {61C02517-4DFC-2881-B60E-4178A269D19B} + + + {CCC02517-B8FC-2881-210F-41780D6AD19B} + + + {EEC02517-DAFC-2881-430F-41782F6AD19B} + + + {5BD6AF8B-4712-B3F5-B024-CBEC9C7F5B10} + + + {DEDAAF8B-CA16-B3F5-3329-CBEC1F845B10} + + + {E3DAAF8B-CF16-B3F5-3829-CBEC24845B10} + + + {A3DEAF8B-8F1A-B3F5-F82C-CBECE4875B10} + + + {C1DEAF8B-AD1A-B3F5-162D-CBEC02885B10} + + + {E1DEAF8B-CD1A-B3F5-362D-CBEC22885B10} + + + {E5DEAF8B-D11A-B3F5-3A2D-CBEC26885B10} + + + {73A31B9A-DF11-7119-28FB-2B1994A866B5} + + + {D2A7990E-3E16-EF8D-87FF-A98DF3ACE429} + + + {55A8990E-C116-EF8D-0A00-AA8D76ADE429} + + + {73B0990E-DF1E-EF8D-2808-AA8D94B5E429} + + + {4ED72383-BA45-7902-032F-34026FDC6E9E} + + + {EFDA2383-5B49-7902-A432-340210E06E9E} + + + {4CE32383-B851-7902-013B-34026DE86E9E} + + + {AD57A1F7-19C6-F676-62AF-B176CE5CEC12} + + + {D26E1E6C-3EDD-73EB-87C6-2EEBF3736987} + + + {95771E6C-01E6-73EB-4ACF-2EEBB67C6987} + + + {CEC96434-3AAD-7374-43B0-A1B0AF123AC5} + + + {C4273DAD-B078-28EF-D9DC-16B1C58CBB58} + + + {24303DAD-1081-28EF-39E5-16B12595BB58} + + + {9B9A3DAD-87EB-28EF-B04F-17B19CFFBB58} + + + {C6948099-B2E5-6BDB-DB49-5A9DC7F9FE44} + + + {42A58099-2EF6-6BDB-575A-5A9D430AFF44} + + + {D368CA24-3F22-35CF-C881-4FA9343AEB3E} + + + {D7E4BE15-434A-529C-CC22-F4743887470B} + + + {CE9A174E-3A0D-5A6A-83A1-8FEEEF522463} + + + {1FF7104E-8B60-A6B0-14A4-545B800C57F5} + + + {17B0920D-8371-C54B-0CA7-332F7867F104} + + + {BF11270A-2B32-70B4-F434-ABB26014EC23} + + + {A7AD185C-13CC-2C29-5C99-323BC8F66732} + + + {2CD1DF2C-983A-758F-217E-233A8DE625D4} + + + {9A017075-061C-D316-4F3E-E3AABB97FA1D} + + + {902D1123-7CD6-7852-A56C-94D191749393} + + + {27E0AE0E-13E1-4289-3CA9-AF0D2809B943} + + + {655E8789-5133-CF3C-7AE2-0E396616DD53} + + + {147303DC-0074-9756-293C-04DB159C0D11} + + + {AAD2559D-1612-1AB6-1FF2-E0CD8BB079FA} + + + {9ED1FF6C-8AFF-6C60-735B-08265F2865BF} + + + {6E3EB93C-5AFE-49E1-C31B-32ECAFFA5CF3} + + + {9E5438AB-0A1B-95C7-5376-232ABF7B032C} + + + {D59A6D68-412E-CF16-4A15-3FCDB62766DE} + + + {E6EB6F71-52B6-41CC-9BBC-40F107C602A7} + + + {46EBD782-B2AC-0AC1-3BE2-78A4A7A2367A} + + + {AEC4D59B-1A04-9AB4-23E4-60CC8FA2F9F8} + + + {6B5E8BAE-574D-16B3-0034-4B04EC01C191} + + + {11DDD118-7D55-4665-46CA-577AB201622B} + + + {EB4C81B9-575E-2960-E0AF-BB9F4CC0B299} + + + {E31DADB6-4F87-4219-D8CA-F0C34433F35D} + + + {8B16A68F-F7DE-7313-C06F-7C252CF7A34E} + + + {7320A1C3-DFE6-FDDF-2842-8C4294476C44} + + + {9D408211-09D4-E3BF-12BB-53767ECD7A87} + + + {D972AB51-4552-2AED-4E6A-B5C3BAC8904E} + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Sources\Upgrades\CoreUpgrades + + + Sources\Upgrades\CoreUpgrades + + + Sources\Upgrades\CoreUpgrades + + + Sources\Upgrades\Data\2.0.0.45754 + + + Sources\Upgrades\Data\2.0.0.46520 + + + Sources\Upgrades\Data\2.0.0.46520 + + + Sources\Upgrades\Data\2.0.0.47147 + + + Sources\Upgrades\Data\2.0.0.47147 + + + Sources\Upgrades\Data\2.0.0.47147 + + + Sources\Upgrades\Data\2.0.0.47147 + + + Sources\Upgrades\Data\2.0.0.47147 + + + Sources\Upgrades\Data\2.0.0.47147 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48597 + + + Sources\Upgrades\Data\2.0.0.48597 + + + Sources\Upgrades\Data\2.0.0.48597 + + + Sources\Upgrades\Data\2.0.0.48597 + + + Sources\Upgrades\Data\2.0.0.49290 + + + Sources\Upgrades\Data\2.0.0.49290 + + + Sources\Upgrades\Data\2.0.0.49290 + + + Sources\Upgrades\Data\2.0.0.49290 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50306 + + + Sources\Upgrades\Data\2.0.0.50306 + + + Sources\Upgrades\Data\2.0.0.50306 + + + Sources\Upgrades\Data\2.0.0.50306 + + + Sources\Upgrades\Data\2.0.0.50306 + + + Sources\Upgrades\Data\2.0.0.50306 + + + Sources\Upgrades\Data\2.0.0.50306 + + + Sources\Upgrades\Data\2.0.0.50392 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.2.51773 + + + Sources\Upgrades\Data\2.0.2.51773 + + + Sources\Upgrades\Data\2.0.2.51773 + + + Sources\Upgrades\Data\2.0.2.51773 + + + Sources\Upgrades\Data\2.0.2.51773 + + + Sources\Upgrades\Data\2.0.2.51773 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53244 + + + Sources\Upgrades\Data\2.1.0.53244 + + + Sources\Upgrades\Data\2.1.0.53244 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9625 + + + Sources\Upgrades\Data\2.10.0.9653 + + + Sources\Upgrades\Data\2.10.0.9653 + + + Sources\Upgrades\Data\2.10.0.9653 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12698 + + + Sources\Upgrades\Data\2.13.0.13590 + + + Sources\Upgrades\Data\2.13.0.13590 + + + Sources\Upgrades\Data\2.13.0.13590 + + + Sources\Upgrades\Data\2.13.0.13590 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16701 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17579 + + + Sources\Upgrades\Data\2.17.0.17579 + + + Sources\Upgrades\Data\2.17.0.17579 + + + Sources\Upgrades\Data\2.17.0.17579 + + + Sources\Upgrades\Data\2.17.0.17579 + + + Sources\Upgrades\Data\2.17.0.17579 + + + Sources\Upgrades\Data\2.17.0.17673 + + + Sources\Upgrades\Data\2.17.0.17673 + + + Sources\Upgrades\Data\2.17.0.17673 + + + Sources\Upgrades\Data\2.17.0.17673 + + + Sources\Upgrades\Data\2.17.0.17673 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18710 + + + Sources\Upgrades\Data\2.18.0.18710 + + + Sources\Upgrades\Data\2.18.0.18710 + + + Sources\Upgrades\Data\2.18.0.18710 + + + Sources\Upgrades\Data\2.18.0.18710 + + + Sources\Upgrades\Data\2.18.0.18710 + + + Sources\Upgrades\Data\2.18.0.18748 + + + Sources\Upgrades\Data\2.18.0.18759 + + + Sources\Upgrades\Data\2.18.0.18759 + + + Sources\Upgrades\Data\2.18.0.18759 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20470 + + + Sources\Upgrades\Data\2.19.0.20470 + + + Sources\Upgrades\Data\2.19.0.20470 + + + Sources\Upgrades\Data\2.19.0.20470 + + + Sources\Upgrades\Data\2.19.0.20470 + + + Sources\Upgrades\Data\2.19.0.20475 + + + Sources\Upgrades\Data\2.19.0.20475 + + + Sources\Upgrades\Data\2.19.0.20538 + + + Sources\Upgrades\Data\2.19.0.20538 + + + Sources\Upgrades\Data\2.19.0.20538 + + + Sources\Upgrades\Data\2.19.0.20538 + + + Sources\Upgrades\Data\2.19.0.20538 + + + Sources\Upgrades\Data\2.19.0.20545 + + + Sources\Upgrades\Data\2.19.0.20545 + + + Sources\Upgrades\Data\2.19.0.20545 + + + Sources\Upgrades\Data\2.19.0.20545 + + + Sources\Upgrades\Data\2.19.0.20554 + + + Sources\Upgrades\Data\2.19.0.20554 + + + Sources\Upgrades\Data\2.19.0.20554 + + + Sources\Upgrades\Data\2.19.0.20554 + + + Sources\Upgrades\Data\2.19.0.20554 + + + Sources\Upgrades\Data\2.19.0.20554 + + + Sources\Upgrades\Data\2.19.0.20558 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61427 + + + Sources\Upgrades\Data\2.4.0.61427 + + + Sources\Upgrades\Data\2.4.0.61427 + + + Sources\Upgrades\Data\2.4.0.61427 + + + Sources\Upgrades\Data\2.4.0.61427 + + + Sources\Upgrades\Data\2.4.0.61427 + + + Sources\Upgrades\Data\2.4.0.61613 + + + Sources\Upgrades\Data\2.4.0.61613 + + + Sources\Upgrades\Data\2.4.0.61613 + + + Sources\Upgrades\Data\2.4.0.61613 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.4071 + + + Sources\Upgrades\Data\2.8.0.4071 + + + Sources\Upgrades\Data\2.8.0.4071 + + + Sources\Upgrades\Data\2.8.0.4071 + + + Sources\Upgrades\Data\2.8.0.4071 + + + Sources\Upgrades\Data\2.9.0.6358 + + + Sources\Upgrades\Data\2.9.0.6358 + + + Sources\Upgrades\Data\2.9.0.6358 + + + Sources\Upgrades\Data\2.9.0.6358 + + + Sources\Upgrades\Data\2.9.0.6358 + + + Sources\Upgrades\Data\2.9.0.6358 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\PopcornFXCore + + + Sources\Upgrades\Data\PopcornFXEditorCore + + + Sources\Upgrades + + + Precompiled + + + Sources + + + + + Sources\Upgrades\CoreUpgrades + + + Sources\Upgrades\CoreUpgrades + + + Sources\Upgrades\Data\2.0.0.45754 + + + Sources\Upgrades\Data\2.0.0.46520 + + + Sources\Upgrades\Data\2.0.0.47147 + + + Sources\Upgrades\Data\2.0.0.47887 + + + Sources\Upgrades\Data\2.0.0.48439 + + + Sources\Upgrades\Data\2.0.0.48597 + + + Sources\Upgrades\Data\2.0.0.49290 + + + Sources\Upgrades\Data\2.0.0.50071 + + + Sources\Upgrades\Data\2.0.0.50306 + + + Sources\Upgrades\Data\2.0.0.50392 + + + Sources\Upgrades\Data\2.0.0.51547 + + + Sources\Upgrades\Data\2.0.2.51773 + + + Sources\Upgrades\Data\2.1.0.53018 + + + Sources\Upgrades\Data\2.1.0.53244 + + + Sources\Upgrades\Data\2.10.0.8984 + + + Sources\Upgrades\Data\2.10.0.9172 + + + Sources\Upgrades\Data\2.10.0.9560 + + + Sources\Upgrades\Data\2.10.0.9625 + + + Sources\Upgrades\Data\2.10.0.9653 + + + Sources\Upgrades\Data\2.11.0.11056 + + + Sources\Upgrades\Data\2.12.0.12548 + + + Sources\Upgrades\Data\2.12.0.12698 + + + Sources\Upgrades\Data\2.13.0.13590 + + + Sources\Upgrades\Data\2.14.0.14494 + + + Sources\Upgrades\Data\2.14.0.14605 + + + Sources\Upgrades\Data\2.15.0.15495 + + + Sources\Upgrades\Data\2.15.0.15714 + + + Sources\Upgrades\Data\2.16.0.16433 + + + Sources\Upgrades\Data\2.16.0.16626 + + + Sources\Upgrades\Data\2.16.0.16685 + + + Sources\Upgrades\Data\2.16.0.16701 + + + Sources\Upgrades\Data\2.17.0.17463 + + + Sources\Upgrades\Data\2.17.0.17579 + + + Sources\Upgrades\Data\2.17.0.17673 + + + Sources\Upgrades\Data\2.18.0.18518 + + + Sources\Upgrades\Data\2.18.0.18710 + + + Sources\Upgrades\Data\2.18.0.18748 + + + Sources\Upgrades\Data\2.18.0.18759 + + + Sources\Upgrades\Data\2.19.0.20350 + + + Sources\Upgrades\Data\2.19.0.20470 + + + Sources\Upgrades\Data\2.19.0.20475 + + + Sources\Upgrades\Data\2.19.0.20538 + + + Sources\Upgrades\Data\2.19.0.20545 + + + Sources\Upgrades\Data\2.19.0.20554 + + + Sources\Upgrades\Data\2.19.0.20558 + + + Sources\Upgrades\Data\2.2.0.56591 + + + Sources\Upgrades\Data\2.3.0.59136 + + + Sources\Upgrades\Data\2.3.0.59175 + + + Sources\Upgrades\Data\2.3.0.59344 + + + Sources\Upgrades\Data\2.4.0.61372 + + + Sources\Upgrades\Data\2.4.0.61427 + + + Sources\Upgrades\Data\2.4.0.61613 + + + Sources\Upgrades\Data\2.5.0.63107 + + + Sources\Upgrades\Data\2.6.0.64722 + + + Sources\Upgrades\Data\2.6.0.64941 + + + Sources\Upgrades\Data\2.7.0.835 + + + Sources\Upgrades\Data\2.8.0.3675 + + + Sources\Upgrades\Data\2.8.0.3864 + + + Sources\Upgrades\Data\2.8.0.4071 + + + Sources\Upgrades\Data\2.9.0.6358 + + + Sources\Upgrades\Data\2.9.0.6714 + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials\Interface + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore\Library\PopcornFXCore\Templates + + + Sources\Upgrades\Data\PopcornFXCore + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\AnimationTracks + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\AnimationTracks + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\AnimationTracks + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\AnimationTracks + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\Effects + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\Effects + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\MaterialEditor\Meshes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\MaterialEditor + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\MaterialEditor + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\MaterialEditor + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\MaterialEditor + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\MaterialEditor + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\MaterialEditor + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Presets\MaterialEditor + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Templates + + + Sources\Upgrades\Data\PopcornFXEditorCore\Editor\Templates + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials\Interface + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials\Interface + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials\Interface + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials\Interface + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental\includes + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders\Experimental + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Library\PopcornFXCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials\DefaultTextures + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials\Interface + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials\Interface + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Materials + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders\ShaderInclude + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders\ShaderInclude + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore\Shaders + + + Sources\Upgrades\Data\PopcornFXEditorCore + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Sources\Upgrades + + + Precompiled + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + + + _Natvis + + + diff --git a/projects/AfterEffects_vs2019/PopcornFX_AfterEffectsPlugin.sln b/projects/AfterEffects_vs2019/PopcornFX_AfterEffectsPlugin.sln new file mode 100644 index 00000000..6be470f1 --- /dev/null +++ b/projects/AfterEffects_vs2019/PopcornFX_AfterEffectsPlugin.sln @@ -0,0 +1,122 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AE", "AE", "{12390FDD-FE05-6AE8-271F-5890134B9F76}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AE_Effect_Attribute", "AE_Effect_Attribute.vcxproj", "{71E14036-5ABF-5C62-69BF-5CFF185CCCCA}" + ProjectSection(ProjectDependencies) = postProject + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA} = {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AE_Effect_AttributeSampler", "AE_Effect_AttributeSampler.vcxproj", "{205916AA-5ABF-5C62-69BF-5CFF185CCCCA}" + ProjectSection(ProjectDependencies) = postProject + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA} = {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AE_Effect_Emitter", "AE_Effect_Emitter.vcxproj", "{F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AE_GeneralPlugin", "AE_GeneralPlugin.vcxproj", "{EF871E43-5ABF-5C62-69BF-5CFF185CCCCA}" + ProjectSection(ProjectDependencies) = postProject + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA} = {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA} + {71E14036-5ABF-5C62-69BF-5CFF185CCCCA} = {71E14036-5ABF-5C62-69BF-5CFF185CCCCA} + {205916AA-5ABF-5C62-69BF-5CFF185CCCCA} = {205916AA-5ABF-5C62-69BF-5CFF185CCCCA} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Integration", "Integration", "{70E2A779-DCF8-A50F-2570-313191C57697}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-RHI_SDK1", "PK-RHI_SDK1.vcxproj", "{1822BA45-2535-4E66-FFFF-AAB284A46F5B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-RenderHelpers_SDK1", "PK-RenderHelpers_SDK1.vcxproj", "{1822BA45-2535-4E66-FFFF-90B284A46F5B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-SampleLib", "PK-SampleLib.vcxproj", "{89A78AC6-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Runtime", "Runtime", "{D04B1513-3C0C-9149-0547-DAC671C6D525}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Discretizers_SDK1", "PK-Discretizers_SDK1.vcxproj", "{F866336F-906C-411B-FFFF-AABBCC2C47CE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-ParticlesToolbox_SDK1", "PK-ParticlesToolbox_SDK1.vcxproj", "{1A87AB61-B71A-4EBA-FFFF-997BB30241A3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Runtime_SDK1", "PK-Runtime_SDK1.vcxproj", "{E21DB851-1449-42D8-FFFF-7FC2E9399524}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{DD376B17-49ED-E30C-D2E1-DDE33E96DA10}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AssetBaker", "AssetBaker", "{51B011B4-3DAA-3A06-2617-D11612B0A072}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-AssetBakerLib", "PK-AssetBakerLib.vcxproj", "{44ECDA8C-CBA0-4035-B212-68E793243242}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-MCPP_SDK1", "PK-MCPP_SDK1.vcxproj", "{C43F305D-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {71E14036-5ABF-5C62-69BF-5CFF185CCCCA}.Debug|x64.ActiveCfg = Debug|x64 + {71E14036-5ABF-5C62-69BF-5CFF185CCCCA}.Debug|x64.Build.0 = Debug|x64 + {71E14036-5ABF-5C62-69BF-5CFF185CCCCA}.Release|x64.ActiveCfg = Release|x64 + {71E14036-5ABF-5C62-69BF-5CFF185CCCCA}.Release|x64.Build.0 = Release|x64 + {205916AA-5ABF-5C62-69BF-5CFF185CCCCA}.Debug|x64.ActiveCfg = Debug|x64 + {205916AA-5ABF-5C62-69BF-5CFF185CCCCA}.Debug|x64.Build.0 = Debug|x64 + {205916AA-5ABF-5C62-69BF-5CFF185CCCCA}.Release|x64.ActiveCfg = Release|x64 + {205916AA-5ABF-5C62-69BF-5CFF185CCCCA}.Release|x64.Build.0 = Release|x64 + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA}.Debug|x64.ActiveCfg = Debug|x64 + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA}.Debug|x64.Build.0 = Debug|x64 + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA}.Release|x64.ActiveCfg = Release|x64 + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA}.Release|x64.Build.0 = Release|x64 + {EF871E43-5ABF-5C62-69BF-5CFF185CCCCA}.Debug|x64.ActiveCfg = Debug|x64 + {EF871E43-5ABF-5C62-69BF-5CFF185CCCCA}.Debug|x64.Build.0 = Debug|x64 + {EF871E43-5ABF-5C62-69BF-5CFF185CCCCA}.Release|x64.ActiveCfg = Release|x64 + {EF871E43-5ABF-5C62-69BF-5CFF185CCCCA}.Release|x64.Build.0 = Release|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Debug|x64.ActiveCfg = Debug|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Debug|x64.Build.0 = Debug|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Release|x64.ActiveCfg = Release|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Release|x64.Build.0 = Release|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Debug|x64.ActiveCfg = Debug|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Debug|x64.Build.0 = Debug|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Release|x64.ActiveCfg = Release|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Release|x64.Build.0 = Release|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Debug|x64.ActiveCfg = Debug|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Debug|x64.Build.0 = Debug|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Release|x64.ActiveCfg = Release|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Release|x64.Build.0 = Release|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Debug|x64.ActiveCfg = Debug|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Debug|x64.Build.0 = Debug|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Release|x64.ActiveCfg = Release|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Release|x64.Build.0 = Release|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Debug|x64.ActiveCfg = Debug|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Debug|x64.Build.0 = Debug|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Release|x64.ActiveCfg = Release|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Release|x64.Build.0 = Release|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Debug|x64.ActiveCfg = Debug|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Debug|x64.Build.0 = Debug|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Release|x64.ActiveCfg = Release|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Release|x64.Build.0 = Release|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {71E14036-5ABF-5C62-69BF-5CFF185CCCCA} = {12390FDD-FE05-6AE8-271F-5890134B9F76} + {205916AA-5ABF-5C62-69BF-5CFF185CCCCA} = {12390FDD-FE05-6AE8-271F-5890134B9F76} + {F745BB1C-5ABF-5C62-69BF-5CFF185CCCCA} = {12390FDD-FE05-6AE8-271F-5890134B9F76} + {EF871E43-5ABF-5C62-69BF-5CFF185CCCCA} = {12390FDD-FE05-6AE8-271F-5890134B9F76} + {1822BA45-2535-4E66-FFFF-AAB284A46F5B} = {70E2A779-DCF8-A50F-2570-313191C57697} + {1822BA45-2535-4E66-FFFF-90B284A46F5B} = {70E2A779-DCF8-A50F-2570-313191C57697} + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} = {70E2A779-DCF8-A50F-2570-313191C57697} + {F866336F-906C-411B-FFFF-AABBCC2C47CE} = {D04B1513-3C0C-9149-0547-DAC671C6D525} + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3} = {D04B1513-3C0C-9149-0547-DAC671C6D525} + {E21DB851-1449-42D8-FFFF-7FC2E9399524} = {D04B1513-3C0C-9149-0547-DAC671C6D525} + {51B011B4-3DAA-3A06-2617-D11612B0A072} = {DD376B17-49ED-E30C-D2E1-DDE33E96DA10} + {44ECDA8C-CBA0-4035-B212-68E793243242} = {51B011B4-3DAA-3A06-2617-D11612B0A072} + {C43F305D-E37E-456E-B4B4-F944839A2FFC} = {DD376B17-49ED-E30C-D2E1-DDE33E96DA10} + EndGlobalSection +EndGlobal diff --git a/projects/AfterEffects_vs2019/PopcornFX_SDK1.sln b/projects/AfterEffects_vs2019/PopcornFX_SDK1.sln new file mode 100644 index 00000000..fef663df --- /dev/null +++ b/projects/AfterEffects_vs2019/PopcornFX_SDK1.sln @@ -0,0 +1,293 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{C11D5431-2DDE-CF67-F618-19E562981444}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Basic", "Basic", "{329961B4-9EFA-3EC2-2768-857493C87581}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_01_BasicStartup", "PK-Sample_01_BasicStartup.vcxproj", "{6180C80A-EF04-4935-AEDB-FF9D2A087E79}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_02_BasicEvolve", "PK-Sample_02_BasicEvolve.vcxproj", "{44DEC18A-CBA0-4053-B592-6ECF4D324224}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_03_EngineHooks", "PK-Sample_03_EngineHooks.vcxproj", "{44DEFFAA-CBA0-4053-B592-6ECF4D324224}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_04_Baking", "PK-Sample_04_Baking.vcxproj", "{44DE001A-CBA0-4333-B592-6E87CC324224}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_05_Upgrader", "PK-Sample_05_Upgrader.vcxproj", "{44DE001A-CBA0-4333-C593-7E8642326924}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_01_BasicRendering", "PK-Sample_01_BasicRendering.vcxproj", "{94C84A6E-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_02_FullIntegration", "PK-Sample_02_FullIntegration.vcxproj", "{C4DA3BC6-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_04_EffectInterface", "PK-Sample_04_EffectInterface.vcxproj", "{C842904F-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_05_Stats", "PK-Sample_05_Stats.vcxproj", "{BF82A3E1-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_06_SimInterface", "PK-Sample_06_SimInterface.vcxproj", "{E181876D-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_06_SimInterfaceGPU", "PK-Sample_06_SimInterfaceGPU.vcxproj", "{482524F9-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_07_LOD", "PK-Sample_07_LOD.vcxproj", "{03233C53-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_08_CustomCollision", "PK-Sample_08_CustomCollision.vcxproj", "{2940E5DC-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_09_AsyncLoading", "PK-Sample_09_AsyncLoading.vcxproj", "{46713752-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_10_AsyncRendering", "PK-Sample_10_AsyncRendering.vcxproj", "{355F328A-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_11_ThreadPool", "PK-Sample_11_ThreadPool.vcxproj", "{2B382181-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Sample_12_GBufferSampling", "PK-Sample_12_GBufferSampling.vcxproj", "{C61ADEEC-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Rendering", "Rendering", "{2A23E243-96AE-4F08-9FBF-D2FC0BCAAB08}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-RHI_SDK1", "PK-RHI_SDK1.vcxproj", "{1822BA45-2535-4E66-FFFF-AAB284A46F5B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-RenderHelpers_SDK1", "PK-RenderHelpers_SDK1.vcxproj", "{1822BA45-2535-4E66-FFFF-90B284A46F5B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-SampleLib", "PK-SampleLib.vcxproj", "{89A78AC6-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Runtime", "Runtime", "{D04B1513-3C0C-9149-0547-DAC671C6D525}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Discretizers_SDK1", "PK-Discretizers_SDK1.vcxproj", "{F866336F-906C-411B-FFFF-AABBCC2C47CE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-ParticlesToolbox_SDK1", "PK-ParticlesToolbox_SDK1.vcxproj", "{1A87AB61-B71A-4EBA-FFFF-997BB30241A3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Runtime_SDK1", "PK-Runtime_SDK1.vcxproj", "{E21DB851-1449-42D8-FFFF-7FC2E9399524}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{DD376B17-49ED-E30C-D2E1-DDE33E96DA10}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AssetBaker", "AssetBaker", "{51B011B4-3DAA-3A06-2617-D11612B0A072}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-AssetBaker", "PK-AssetBaker.vcxproj", "{44CEDA8C-CBA0-4053-B122-6E8793324224}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-AssetBakerLib", "PK-AssetBakerLib.vcxproj", "{44ECDA8C-CBA0-4035-B212-68E793243242}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-MCPP_SDK1", "PK-MCPP_SDK1.vcxproj", "{C43F305D-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-ShaderTool", "PK-ShaderTool.vcxproj", "{2FCAC7C2-E37E-456E-B4B4-F944839A2FFC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Upgrader", "Upgrader", "{A68CD0DC-921B-5AA6-3B3A-6EA127A86A4C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-Upgrader", "PK-Upgrader.vcxproj", "{1821DADC-CBA0-4053-B122-6E8793324224}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PK-UpgraderLib", "PK-UpgraderLib.vcxproj", "{55ACDBF7-CBA0-4035-B212-68E793243242}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + Retail|x64 = Retail|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6180C80A-EF04-4935-AEDB-FF9D2A087E79}.Debug|x64.ActiveCfg = Debug|x64 + {6180C80A-EF04-4935-AEDB-FF9D2A087E79}.Debug|x64.Build.0 = Debug|x64 + {6180C80A-EF04-4935-AEDB-FF9D2A087E79}.Release|x64.ActiveCfg = Release|x64 + {6180C80A-EF04-4935-AEDB-FF9D2A087E79}.Release|x64.Build.0 = Release|x64 + {6180C80A-EF04-4935-AEDB-FF9D2A087E79}.Retail|x64.ActiveCfg = Retail|x64 + {6180C80A-EF04-4935-AEDB-FF9D2A087E79}.Retail|x64.Build.0 = Retail|x64 + {44DEC18A-CBA0-4053-B592-6ECF4D324224}.Debug|x64.ActiveCfg = Debug|x64 + {44DEC18A-CBA0-4053-B592-6ECF4D324224}.Debug|x64.Build.0 = Debug|x64 + {44DEC18A-CBA0-4053-B592-6ECF4D324224}.Release|x64.ActiveCfg = Release|x64 + {44DEC18A-CBA0-4053-B592-6ECF4D324224}.Release|x64.Build.0 = Release|x64 + {44DEC18A-CBA0-4053-B592-6ECF4D324224}.Retail|x64.ActiveCfg = Retail|x64 + {44DEC18A-CBA0-4053-B592-6ECF4D324224}.Retail|x64.Build.0 = Retail|x64 + {44DEFFAA-CBA0-4053-B592-6ECF4D324224}.Debug|x64.ActiveCfg = Debug|x64 + {44DEFFAA-CBA0-4053-B592-6ECF4D324224}.Debug|x64.Build.0 = Debug|x64 + {44DEFFAA-CBA0-4053-B592-6ECF4D324224}.Release|x64.ActiveCfg = Release|x64 + {44DEFFAA-CBA0-4053-B592-6ECF4D324224}.Release|x64.Build.0 = Release|x64 + {44DEFFAA-CBA0-4053-B592-6ECF4D324224}.Retail|x64.ActiveCfg = Retail|x64 + {44DEFFAA-CBA0-4053-B592-6ECF4D324224}.Retail|x64.Build.0 = Retail|x64 + {44DE001A-CBA0-4333-B592-6E87CC324224}.Debug|x64.ActiveCfg = Debug|x64 + {44DE001A-CBA0-4333-B592-6E87CC324224}.Debug|x64.Build.0 = Debug|x64 + {44DE001A-CBA0-4333-B592-6E87CC324224}.Release|x64.ActiveCfg = Release|x64 + {44DE001A-CBA0-4333-B592-6E87CC324224}.Release|x64.Build.0 = Release|x64 + {44DE001A-CBA0-4333-B592-6E87CC324224}.Retail|x64.ActiveCfg = Retail|x64 + {44DE001A-CBA0-4333-B592-6E87CC324224}.Retail|x64.Build.0 = Retail|x64 + {44DE001A-CBA0-4333-C593-7E8642326924}.Debug|x64.ActiveCfg = Debug|x64 + {44DE001A-CBA0-4333-C593-7E8642326924}.Debug|x64.Build.0 = Debug|x64 + {44DE001A-CBA0-4333-C593-7E8642326924}.Release|x64.ActiveCfg = Release|x64 + {44DE001A-CBA0-4333-C593-7E8642326924}.Release|x64.Build.0 = Release|x64 + {44DE001A-CBA0-4333-C593-7E8642326924}.Retail|x64.ActiveCfg = Retail|x64 + {44DE001A-CBA0-4333-C593-7E8642326924}.Retail|x64.Build.0 = Retail|x64 + {94C84A6E-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {94C84A6E-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {94C84A6E-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {94C84A6E-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {94C84A6E-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {94C84A6E-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {C4DA3BC6-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {C4DA3BC6-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {C4DA3BC6-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {C4DA3BC6-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {C4DA3BC6-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {C4DA3BC6-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {C842904F-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {C842904F-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {C842904F-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {C842904F-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {C842904F-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {C842904F-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {BF82A3E1-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {BF82A3E1-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {BF82A3E1-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {BF82A3E1-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {BF82A3E1-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {BF82A3E1-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {E181876D-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {E181876D-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {E181876D-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {E181876D-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {E181876D-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {E181876D-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {482524F9-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {482524F9-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {482524F9-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {482524F9-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {482524F9-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {482524F9-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {03233C53-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {03233C53-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {03233C53-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {03233C53-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {03233C53-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {03233C53-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {2940E5DC-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {2940E5DC-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {2940E5DC-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {2940E5DC-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {2940E5DC-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {2940E5DC-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {46713752-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {46713752-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {46713752-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {46713752-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {46713752-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {46713752-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {355F328A-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {355F328A-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {355F328A-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {355F328A-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {355F328A-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {355F328A-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {2B382181-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {2B382181-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {2B382181-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {2B382181-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {2B382181-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {2B382181-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {C61ADEEC-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {C61ADEEC-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {C61ADEEC-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {C61ADEEC-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {C61ADEEC-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {C61ADEEC-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Debug|x64.ActiveCfg = Debug|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Debug|x64.Build.0 = Debug|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Release|x64.ActiveCfg = Release|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Release|x64.Build.0 = Release|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Retail|x64.ActiveCfg = Retail|x64 + {1822BA45-2535-4E66-FFFF-AAB284A46F5B}.Retail|x64.Build.0 = Retail|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Debug|x64.ActiveCfg = Debug|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Debug|x64.Build.0 = Debug|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Release|x64.ActiveCfg = Release|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Release|x64.Build.0 = Release|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Retail|x64.ActiveCfg = Retail|x64 + {1822BA45-2535-4E66-FFFF-90B284A46F5B}.Retail|x64.Build.0 = Retail|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {89A78AC6-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Debug|x64.ActiveCfg = Debug|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Debug|x64.Build.0 = Debug|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Release|x64.ActiveCfg = Release|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Release|x64.Build.0 = Release|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Retail|x64.ActiveCfg = Retail|x64 + {F866336F-906C-411B-FFFF-AABBCC2C47CE}.Retail|x64.Build.0 = Retail|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Debug|x64.ActiveCfg = Debug|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Debug|x64.Build.0 = Debug|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Release|x64.ActiveCfg = Release|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Release|x64.Build.0 = Release|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Retail|x64.ActiveCfg = Retail|x64 + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3}.Retail|x64.Build.0 = Retail|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Debug|x64.ActiveCfg = Debug|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Debug|x64.Build.0 = Debug|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Release|x64.ActiveCfg = Release|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Release|x64.Build.0 = Release|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Retail|x64.ActiveCfg = Retail|x64 + {E21DB851-1449-42D8-FFFF-7FC2E9399524}.Retail|x64.Build.0 = Retail|x64 + {44CEDA8C-CBA0-4053-B122-6E8793324224}.Debug|x64.ActiveCfg = Debug|x64 + {44CEDA8C-CBA0-4053-B122-6E8793324224}.Debug|x64.Build.0 = Debug|x64 + {44CEDA8C-CBA0-4053-B122-6E8793324224}.Release|x64.ActiveCfg = Release|x64 + {44CEDA8C-CBA0-4053-B122-6E8793324224}.Release|x64.Build.0 = Release|x64 + {44CEDA8C-CBA0-4053-B122-6E8793324224}.Retail|x64.ActiveCfg = Debug|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Debug|x64.ActiveCfg = Debug|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Debug|x64.Build.0 = Debug|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Release|x64.ActiveCfg = Release|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Release|x64.Build.0 = Release|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Retail|x64.ActiveCfg = Retail|x64 + {44ECDA8C-CBA0-4035-B212-68E793243242}.Retail|x64.Build.0 = Retail|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Retail|x64 + {C43F305D-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.Build.0 = Retail|x64 + {2FCAC7C2-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.ActiveCfg = Debug|x64 + {2FCAC7C2-E37E-456E-B4B4-F944839A2FFC}.Debug|x64.Build.0 = Debug|x64 + {2FCAC7C2-E37E-456E-B4B4-F944839A2FFC}.Release|x64.ActiveCfg = Release|x64 + {2FCAC7C2-E37E-456E-B4B4-F944839A2FFC}.Release|x64.Build.0 = Release|x64 + {2FCAC7C2-E37E-456E-B4B4-F944839A2FFC}.Retail|x64.ActiveCfg = Debug|x64 + {1821DADC-CBA0-4053-B122-6E8793324224}.Debug|x64.ActiveCfg = Debug|x64 + {1821DADC-CBA0-4053-B122-6E8793324224}.Debug|x64.Build.0 = Debug|x64 + {1821DADC-CBA0-4053-B122-6E8793324224}.Release|x64.ActiveCfg = Release|x64 + {1821DADC-CBA0-4053-B122-6E8793324224}.Release|x64.Build.0 = Release|x64 + {1821DADC-CBA0-4053-B122-6E8793324224}.Retail|x64.ActiveCfg = Retail|x64 + {1821DADC-CBA0-4053-B122-6E8793324224}.Retail|x64.Build.0 = Retail|x64 + {55ACDBF7-CBA0-4035-B212-68E793243242}.Debug|x64.ActiveCfg = Debug|x64 + {55ACDBF7-CBA0-4035-B212-68E793243242}.Debug|x64.Build.0 = Debug|x64 + {55ACDBF7-CBA0-4035-B212-68E793243242}.Release|x64.ActiveCfg = Release|x64 + {55ACDBF7-CBA0-4035-B212-68E793243242}.Release|x64.Build.0 = Release|x64 + {55ACDBF7-CBA0-4035-B212-68E793243242}.Retail|x64.ActiveCfg = Retail|x64 + {55ACDBF7-CBA0-4035-B212-68E793243242}.Retail|x64.Build.0 = Retail|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {329961B4-9EFA-3EC2-2768-857493C87581} = {C11D5431-2DDE-CF67-F618-19E562981444} + {6180C80A-EF04-4935-AEDB-FF9D2A087E79} = {329961B4-9EFA-3EC2-2768-857493C87581} + {44DEC18A-CBA0-4053-B592-6ECF4D324224} = {329961B4-9EFA-3EC2-2768-857493C87581} + {44DEFFAA-CBA0-4053-B592-6ECF4D324224} = {329961B4-9EFA-3EC2-2768-857493C87581} + {44DE001A-CBA0-4333-B592-6E87CC324224} = {329961B4-9EFA-3EC2-2768-857493C87581} + {44DE001A-CBA0-4333-C593-7E8642326924} = {329961B4-9EFA-3EC2-2768-857493C87581} + {94C84A6E-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {C4DA3BC6-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {C842904F-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {BF82A3E1-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {E181876D-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {482524F9-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {03233C53-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {2940E5DC-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {46713752-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {355F328A-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {2B382181-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {C61ADEEC-E37E-456E-B4B4-F944839A2FFC} = {C11D5431-2DDE-CF67-F618-19E562981444} + {1822BA45-2535-4E66-FFFF-AAB284A46F5B} = {2A23E243-96AE-4F08-9FBF-D2FC0BCAAB08} + {1822BA45-2535-4E66-FFFF-90B284A46F5B} = {2A23E243-96AE-4F08-9FBF-D2FC0BCAAB08} + {89A78AC6-E37E-456E-B4B4-F944839A2FFC} = {2A23E243-96AE-4F08-9FBF-D2FC0BCAAB08} + {F866336F-906C-411B-FFFF-AABBCC2C47CE} = {D04B1513-3C0C-9149-0547-DAC671C6D525} + {1A87AB61-B71A-4EBA-FFFF-997BB30241A3} = {D04B1513-3C0C-9149-0547-DAC671C6D525} + {E21DB851-1449-42D8-FFFF-7FC2E9399524} = {D04B1513-3C0C-9149-0547-DAC671C6D525} + {51B011B4-3DAA-3A06-2617-D11612B0A072} = {DD376B17-49ED-E30C-D2E1-DDE33E96DA10} + {44CEDA8C-CBA0-4053-B122-6E8793324224} = {51B011B4-3DAA-3A06-2617-D11612B0A072} + {44ECDA8C-CBA0-4035-B212-68E793243242} = {51B011B4-3DAA-3A06-2617-D11612B0A072} + {C43F305D-E37E-456E-B4B4-F944839A2FFC} = {DD376B17-49ED-E30C-D2E1-DDE33E96DA10} + {2FCAC7C2-E37E-456E-B4B4-F944839A2FFC} = {DD376B17-49ED-E30C-D2E1-DDE33E96DA10} + {A68CD0DC-921B-5AA6-3B3A-6EA127A86A4C} = {DD376B17-49ED-E30C-D2E1-DDE33E96DA10} + {1821DADC-CBA0-4053-B122-6E8793324224} = {A68CD0DC-921B-5AA6-3B3A-6EA127A86A4C} + {55ACDBF7-CBA0-4035-B212-68E793243242} = {A68CD0DC-921B-5AA6-3B3A-6EA127A86A4C} + EndGlobalSection +EndGlobal diff --git a/projects/AfterEffects_vs2019/Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.args b/projects/AfterEffects_vs2019/Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.args new file mode 100644 index 00000000..9740ff3f --- /dev/null +++ b/projects/AfterEffects_vs2019/Qt/x64/Debug/moc_AEGP_GraphicalResourcesTreeModel.args @@ -0,0 +1,57 @@ +-D_DEBUG +-D_CRT_SECURE_NO_WARNINGS +-DPK_PARTICLES_UPDATER_USE_D3D11=1 +-DPK_COMPILER_BUILD_COMPILER_D3D11=1 +-DPK_PARTICLES_UPDATER_USE_D3D12=1 +-DPK_COMPILER_BUILD_COMPILER_D3D12=1 +-DMSWindows +-DWIN32 +-D_WINDOWS +-DPK_BUILD_WITH_FMODEX_SUPPORT=0 +-DPK_BUILD_WITH_SDL=0 +-DPK_BUILD_WITH_METAL_SUPPORT=0 +-DQT_NO_KEYWORDS +-DQT_NO_SIGNALS_SLOTS_KEYWORDS +-DPK_BUILD_WITH_D3D11_SUPPORT=1 +-DPK_BUILD_WITH_D3D12_SUPPORT=1 +-DPK_BUILD_WITH_OGL_SUPPORT=1 +-DGL_GLEXT_PROTOTYPES +-DGLEW_STATIC +-DGLEW_NO_GLU +-DPK_BUILD_WITH_VULKAN_SUPPORT=0 +-DQT_CORE_LIB +-DQT_WIDGETS_LIB +-DQT_NETWORK_LIB +-DQT_XML_LIB +-DQT_GUI_LIB +-I../../AE_GeneralPlugin/Sources +-I../../AE_GeneralPlugin/Include +-I../../AE_GeneralPlugin/Precompiled +-I../../AE_Suites +-I../../External/AE SDK/Resources +-I../../External/AE SDK/Headers +-I../../External/AE SDK/Util +-I../../External/AE SDK/Headers/SP +-I../../External/AE SDK/Headers/adobesdk +-I../../External/AE SDK/Headers/SP/artemis +-I../../External/AE SDK/Headers/SP/photoshop +-I../../External/AE SDK/Headers/SP/artemis/config +-I../../External/AE SDK/Headers/SP/photoshop/config +-I../../External/AE SDK/Headers/adobesdk/config +-I../../External/AE SDK/Headers/adobesdk/drawbotsuite +-I../../ExternalLibs/fmodex/inc +-I../../ExternalLibs/Runtime +-I../../ExternalLibs/Runtime/include +-I../../ExternalLibs/Runtime/include/license/AfterEffects +-I../../ExternalLibs +-I../../Samples +-I../../ExternalLibs/DX/include +-I../../ExternalLibs/GL/include +-I$(QTDIR)/include +-I$(QTDIR)/include/QtCore +-I$(QTDIR)/include/QtWidgets +-I$(QTDIR)/include/QtNetwork +-I$(QTDIR)/include/QtXml +-I$(QTDIR)/include/QtGui +-D__AEGP_PK_BEGIN=namespace AEGPPk { +-D__AEGP_PK_END=} diff --git a/projects/AfterEffects_vs2019/Qt/x64/Debug/moc_AEGP_PanelQT.args b/projects/AfterEffects_vs2019/Qt/x64/Debug/moc_AEGP_PanelQT.args new file mode 100644 index 00000000..9740ff3f --- /dev/null +++ b/projects/AfterEffects_vs2019/Qt/x64/Debug/moc_AEGP_PanelQT.args @@ -0,0 +1,57 @@ +-D_DEBUG +-D_CRT_SECURE_NO_WARNINGS +-DPK_PARTICLES_UPDATER_USE_D3D11=1 +-DPK_COMPILER_BUILD_COMPILER_D3D11=1 +-DPK_PARTICLES_UPDATER_USE_D3D12=1 +-DPK_COMPILER_BUILD_COMPILER_D3D12=1 +-DMSWindows +-DWIN32 +-D_WINDOWS +-DPK_BUILD_WITH_FMODEX_SUPPORT=0 +-DPK_BUILD_WITH_SDL=0 +-DPK_BUILD_WITH_METAL_SUPPORT=0 +-DQT_NO_KEYWORDS +-DQT_NO_SIGNALS_SLOTS_KEYWORDS +-DPK_BUILD_WITH_D3D11_SUPPORT=1 +-DPK_BUILD_WITH_D3D12_SUPPORT=1 +-DPK_BUILD_WITH_OGL_SUPPORT=1 +-DGL_GLEXT_PROTOTYPES +-DGLEW_STATIC +-DGLEW_NO_GLU +-DPK_BUILD_WITH_VULKAN_SUPPORT=0 +-DQT_CORE_LIB +-DQT_WIDGETS_LIB +-DQT_NETWORK_LIB +-DQT_XML_LIB +-DQT_GUI_LIB +-I../../AE_GeneralPlugin/Sources +-I../../AE_GeneralPlugin/Include +-I../../AE_GeneralPlugin/Precompiled +-I../../AE_Suites +-I../../External/AE SDK/Resources +-I../../External/AE SDK/Headers +-I../../External/AE SDK/Util +-I../../External/AE SDK/Headers/SP +-I../../External/AE SDK/Headers/adobesdk +-I../../External/AE SDK/Headers/SP/artemis +-I../../External/AE SDK/Headers/SP/photoshop +-I../../External/AE SDK/Headers/SP/artemis/config +-I../../External/AE SDK/Headers/SP/photoshop/config +-I../../External/AE SDK/Headers/adobesdk/config +-I../../External/AE SDK/Headers/adobesdk/drawbotsuite +-I../../ExternalLibs/fmodex/inc +-I../../ExternalLibs/Runtime +-I../../ExternalLibs/Runtime/include +-I../../ExternalLibs/Runtime/include/license/AfterEffects +-I../../ExternalLibs +-I../../Samples +-I../../ExternalLibs/DX/include +-I../../ExternalLibs/GL/include +-I$(QTDIR)/include +-I$(QTDIR)/include/QtCore +-I$(QTDIR)/include/QtWidgets +-I$(QTDIR)/include/QtNetwork +-I$(QTDIR)/include/QtXml +-I$(QTDIR)/include/QtGui +-D__AEGP_PK_BEGIN=namespace AEGPPk { +-D__AEGP_PK_END=} diff --git a/projects/AfterEffects_vs2019/Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.args b/projects/AfterEffects_vs2019/Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.args new file mode 100644 index 00000000..caa2a0d3 --- /dev/null +++ b/projects/AfterEffects_vs2019/Qt/x64/Release/moc_AEGP_GraphicalResourcesTreeModel.args @@ -0,0 +1,58 @@ +-DNDEBUG +-D_CRT_SECURE_NO_WARNINGS +-DPK_PARTICLES_UPDATER_USE_D3D11=1 +-DPK_COMPILER_BUILD_COMPILER_D3D11=1 +-DPK_PARTICLES_UPDATER_USE_D3D12=1 +-DPK_COMPILER_BUILD_COMPILER_D3D12=1 +-DMSWindows +-DWIN32 +-D_WINDOWS +-DPK_BUILD_WITH_FMODEX_SUPPORT=0 +-DPK_BUILD_WITH_SDL=0 +-DPK_BUILD_WITH_METAL_SUPPORT=0 +-DQT_NO_DEBUG +-DQT_NO_KEYWORDS +-DQT_NO_SIGNALS_SLOTS_KEYWORDS +-DPK_BUILD_WITH_D3D11_SUPPORT=1 +-DPK_BUILD_WITH_D3D12_SUPPORT=1 +-DPK_BUILD_WITH_OGL_SUPPORT=1 +-DGL_GLEXT_PROTOTYPES +-DGLEW_STATIC +-DGLEW_NO_GLU +-DPK_BUILD_WITH_VULKAN_SUPPORT=0 +-DQT_CORE_LIB +-DQT_WIDGETS_LIB +-DQT_NETWORK_LIB +-DQT_XML_LIB +-DQT_GUI_LIB +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Sources +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Include +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Precompiled +-I../../Integrations/AfterEffects/AE_Suites +-I../../Integrations/AfterEffects/External/AE SDK/Resources +-I../../Integrations/AfterEffects/External/AE SDK/Headers +-I../../Integrations/AfterEffects/External/AE SDK/Util +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/artemis +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/photoshop +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/artemis/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/photoshop/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/drawbotsuite +-I../../SDK/Samples/External/fmodex-4.44.19/inc +-I../../Runtime +-I../../Runtime/include +-I../../Runtime/include/license/AfterEffects +-I../../Tools +-I../../SDK/Samples/PK-Samples +-I../../SDK/Samples/External/DX/include +-I../../SDK/Samples/External/GL/include +-I$(QTDIR)/include +-I$(QTDIR)/include/QtCore +-I$(QTDIR)/include/QtWidgets +-I$(QTDIR)/include/QtNetwork +-I$(QTDIR)/include/QtXml +-I$(QTDIR)/include/QtGui +-D__AEGP_PK_BEGIN=namespace AEGPPk { +-D__AEGP_PK_END=} diff --git a/projects/AfterEffects_vs2019/Qt/x64/Release/moc_AEGP_PanelQT.args b/projects/AfterEffects_vs2019/Qt/x64/Release/moc_AEGP_PanelQT.args new file mode 100644 index 00000000..caa2a0d3 --- /dev/null +++ b/projects/AfterEffects_vs2019/Qt/x64/Release/moc_AEGP_PanelQT.args @@ -0,0 +1,58 @@ +-DNDEBUG +-D_CRT_SECURE_NO_WARNINGS +-DPK_PARTICLES_UPDATER_USE_D3D11=1 +-DPK_COMPILER_BUILD_COMPILER_D3D11=1 +-DPK_PARTICLES_UPDATER_USE_D3D12=1 +-DPK_COMPILER_BUILD_COMPILER_D3D12=1 +-DMSWindows +-DWIN32 +-D_WINDOWS +-DPK_BUILD_WITH_FMODEX_SUPPORT=0 +-DPK_BUILD_WITH_SDL=0 +-DPK_BUILD_WITH_METAL_SUPPORT=0 +-DQT_NO_DEBUG +-DQT_NO_KEYWORDS +-DQT_NO_SIGNALS_SLOTS_KEYWORDS +-DPK_BUILD_WITH_D3D11_SUPPORT=1 +-DPK_BUILD_WITH_D3D12_SUPPORT=1 +-DPK_BUILD_WITH_OGL_SUPPORT=1 +-DGL_GLEXT_PROTOTYPES +-DGLEW_STATIC +-DGLEW_NO_GLU +-DPK_BUILD_WITH_VULKAN_SUPPORT=0 +-DQT_CORE_LIB +-DQT_WIDGETS_LIB +-DQT_NETWORK_LIB +-DQT_XML_LIB +-DQT_GUI_LIB +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Sources +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Include +-I../../Integrations/AfterEffects/AE_GeneralPlugin/Precompiled +-I../../Integrations/AfterEffects/AE_Suites +-I../../Integrations/AfterEffects/External/AE SDK/Resources +-I../../Integrations/AfterEffects/External/AE SDK/Headers +-I../../Integrations/AfterEffects/External/AE SDK/Util +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/artemis +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/photoshop +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/artemis/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/SP/photoshop/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/config +-I../../Integrations/AfterEffects/External/AE SDK/Headers/adobesdk/drawbotsuite +-I../../SDK/Samples/External/fmodex-4.44.19/inc +-I../../Runtime +-I../../Runtime/include +-I../../Runtime/include/license/AfterEffects +-I../../Tools +-I../../SDK/Samples/PK-Samples +-I../../SDK/Samples/External/DX/include +-I../../SDK/Samples/External/GL/include +-I$(QTDIR)/include +-I$(QTDIR)/include/QtCore +-I$(QTDIR)/include/QtWidgets +-I$(QTDIR)/include/QtNetwork +-I$(QTDIR)/include/QtXml +-I$(QTDIR)/include/QtGui +-D__AEGP_PK_BEGIN=namespace AEGPPk { +-D__AEGP_PK_END=} diff --git a/qtoverride.dll.manifest b/qtoverride.dll.manifest new file mode 100644 index 00000000..4702ac28 --- /dev/null +++ b/qtoverride.dll.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file