### Install DiligentCore Libraries and Headers Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Run this CMake command from the build folder to install all necessary engine components. ```cmake cmake --build . --target install ``` -------------------------------- ### Start HTTP Server for Web Applications Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Starts a basic HTTP server from the build directory to serve web applications. Navigate to http://localhost in a browser to access them. ```bash cd ./build/Emscripten python https_server.py ``` -------------------------------- ### Start Server with Custom Port Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Starts the HTTP or HTTPS server on a custom port. This is useful if the default ports (80 for HTTP, 443 for HTTPS) are already in use. Remember to include the custom port in the URL. ```bash http://localhost:${YOUR_PORT}/DiligentSamples/Tutorials/Tutorial01_HelloTriangle/Tutorial01_HelloTriangle.html ``` -------------------------------- ### Example custom_configure_build() Function Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This is a complete example of the custom_configure_build CMake function, demonstrating how to set custom build configurations and their associated compiler/linker flags. ```cmake function(custom_configure_build) if(CMAKE_CONFIGURATION_TYPES) # Debug configurations set(DEBUG_CONFIGURATIONS DEBUG CACHE INTERNAL "" FORCE) # Release (optimized) configurations set(RELEASE_CONFIGURATIONS RELEASEMT CACHE INTERNAL "" FORCE) # CMAKE_CONFIGURATION_TYPES variable defines build configurations generated by cmake set(CMAKE_CONFIGURATION_TYPES Debug ReleaseMT CACHE STRING "Configuration types: Debug, ReleaseMT" FORCE) set(CMAKE_CXX_FLAGS_RELEASEMT "/MT" CACHE INTERNAL "" FORCE) set(CMAKE_C_FLAGS_RELEASEMT "/MT" CACHE INTERNAL "" FORCE) set(CMAKE_EXE_LINKER_FLAGS_RELEASEMT "/OPT:REF" CACHE INTERNAL "" FORCE) set(CMAKE_SHARED_LINKER_FLAGS_RELEASEMT "/OPT:REF" CACHE INTERNAL "" FORCE) endif() endfunction() ``` -------------------------------- ### Install Essential Linux Build Tools Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Installs core development tools like gcc, clang, and make on Debian-based systems. Run this before installing other dependencies. ```bash sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential ``` -------------------------------- ### Start HTTPS Server and Register Certificate Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Starts the HTTPS server and registers its certificate with the system's trust store. This can help resolve 'net::ERR_CERT_AUTHORITY_INVALID' errors when accessing pages via HTTPS. ```bash python https_server.py --mode=https --register ``` -------------------------------- ### Start HTTPS Server for Web Applications Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Starts an HTTPS server from the build directory for secure serving of web applications. Use this mode if you need to access the server from another computer on the local network or for secure connections. ```bash python https_server.py --mode=https ``` -------------------------------- ### Install Other Required Linux Packages Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Installs various development libraries for graphics and windowing on Linux, such as X11, OpenGL, and input handling. ```bash sudo apt-get install libx11-dev sudo apt-get install mesa-common-dev sudo apt-get install mesa-utils sudo apt-get install libgl-dev sudo apt-get install python3-distutils sudo apt-get install libgl1-mesa-dev sudo apt-get install libxrandr-dev sudo apt-get install libxinerama-dev sudo apt-get install libxcursor-dev sudo apt-get install libxi-dev ``` -------------------------------- ### Link Static Libraries on Windows Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This is an example list of libraries your project will need to link against when using static linking on Windows. Ensure all listed libraries and their dependencies are correctly linked. ```text DiligentCore.lib glslang.lib HLSL.lib OGLCompiler.lib OSDependent.lib spirv-cross-core.lib SPIRV.lib SPIRV-Tools-opt.lib SPIRV-Tools.lib glew-static.lib GenericCodeGen.lib MachineIndependent.lib dxgi.lib d3d11.lib d3d12.lib d3dcompiler.lib opengl32.lib ``` -------------------------------- ### Install CMake on Linux Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Installs the CMake build system generator. Required for configuring and building projects on Linux. ```bash sudo apt-get install cmake ``` -------------------------------- ### Set CMake Install Prefix Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Use this command to specify a local 'install' folder for CMake artifacts instead of the default system-wide location. ```bash cmake -S . -B ./build/Win64 -D CMAKE_INSTALL_PREFIX=install -G "Visual Studio 17 2022" -A x64 ``` -------------------------------- ### Install Cryptography Module for HTTPS Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Installs the 'cryptography' Python module, which is required to run the HTTPS server. This is a prerequisite for secure web serving. ```bash pip install cryptography ``` -------------------------------- ### Clone Diligent Engine Repository with Submodules Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Use this command to clone the main repository and all its submodules recursively. This is the recommended way to get the complete project. ```bash git clone --recursive https://github.com/DiligentGraphics/DiligentEngine.git ``` -------------------------------- ### Generate Xcode Project for macOS Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Use this command to generate the Xcode project from the engine's root folder. Ensure CMake and Xcode are installed. ```bash cmake -S . -B ./build/MacOS -G "Xcode" ``` -------------------------------- ### Get Vulkan Layout in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Retrieves the Vulkan layout for a texture. ```cpp VkImageLayout ITextureVk::GetLayout() const; ``` -------------------------------- ### Example Render State Notation JSON Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This JSON object defines shaders and a graphics pipeline state. It specifies shader names, types, source languages, file paths, and pipeline configurations including depth-stencil, render target formats, rasterizer, and blend states. ```json { "Shaders": [ { "Desc": { "Name": "My Vertex shader", "ShaderType": "VERTEX" }, "SourceLanguage": "HLSL", "FilePath": "cube.vsh" }, { "Desc": { "Name": "My Pixel shader", "ShaderType": "PIXEL" }, "SourceLanguage": "HLSL", "FilePath": "cube.psh" } ], "Pipeleines": [ { "GraphicsPipeline": { "DepthStencilDesc": { "DepthEnable": true }, "RTVFormats": { "0": "RGBA8_UNORM_SRGB" }, "RasterizerDesc": { "CullMode": "FRONT" }, "BlendDesc": { "RenderTargets": { "0": { "BlendEnable": true } } } }, "PSODesc": { "Name": "My Pipeline State", "PipelineType": "GRAPHICS" }, "pVS": "My Vertex shader", "pPS": "My Pixel shader" } ] } ``` -------------------------------- ### Get Vulkan Access Flags in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Retrieves the Vulkan access flags for a buffer. ```cpp VkAccessFlags IBufferVk::GetAccessFlags() const; ``` -------------------------------- ### Disable Direct3D11 Backend Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Example of disabling the Direct3D11 backend during the CMake configuration process. This is useful for reducing build size or when Direct3D11 is not needed. ```cmake cmake -D DILIGENT_NO_DIRECT3D11=TRUE -S . -B ./build/Win64 -G "Visual Studio 17 2022" -A x64 ``` -------------------------------- ### Get D3D12 Resource State in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Retrieves the current D3D12 resource state from a D3D12 buffer. ```cpp D3D12_RESOURCE_STATES IBufferD3D12::GetD3D12ResourceState() const; ``` -------------------------------- ### Build Documentation with Doxygen Source: https://github.com/diligentgraphics/diligentengine/blob/master/Doc/README.md Execute this command from the repository root to build the documentation using the Doxygen configuration file. ```bash doxygen Doc/doxygen.cfg ``` -------------------------------- ### Compute Pipeline Initialization (Old API) Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Shows the previous method for initializing a compute pipeline state object with `PipelineStateCreateInfo`. ```cpp PipelineStateCreateInfo PSOCreateInfo; PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; PSODesc.ComputePipeline.pCS = pCS; // ... Device->CreatePipelineState(PSOCreateInfo, &pPSO); ``` -------------------------------- ### Old API: Shader and Pipeline State Creation Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Illustrates the previous method for creating shaders and defining their associated variables and static samplers before pipeline state creation. ```cpp RefCntAutoPtr pVS; { CreationAttribs.Desc.ShaderType = SHADER_TYPE_VERTEX; CreationAttribs.EntryPoint = "main"; CreationAttribs.Desc.Name = "Cube VS"; CreationAttribs.FilePath = "cube.vsh"; pDevice->CreateShader(CreationAttribs, &pVS); pVS->GetShaderVariable("Constants")->Set(m_VSConstants); } RefCntAutoPtr pPS; { CreationAttribs.Desc.ShaderType = SHADER_TYPE_PIXEL; CreationAttribs.EntryPoint = "main"; CreationAttribs.Desc.Name = "Cube PS"; CreationAttribs.FilePath = "cube.psh"; ShaderVariableDesc Vars[] = { {"g_Texture", SHADER_VARIABLE_TYPE_MUTABLE} }; CreationAttribs.Desc.VariableDesc = Vars; CreationAttribs.Desc.NumVariables = _countof(Vars); SamplerDesc SamLinearClampDesc( FILTER_TYPE_LINEAR, FILTER_TYPE_LINEAR, FILTER_TYPE_LINEAR, TEXTURE_ADDRESS_CLAMP, TEXTURE_ADDRESS_CLAMP, TEXTURE_ADDRESS_CLAMP); StaticSamplerDesc StaticSamplers[] = { {"g_Texture", SamLinearClampDesc} }; CreationAttribs.Desc.StaticSamplers = StaticSamplers; CreationAttribs.Desc.NumStaticSamplers = _countof(StaticSamplers); pDevice->CreateShader(CreationAttribs, &pPS); } // ... pDevice->CreatePipelineState(PSODesc, &m_pPSO); ``` -------------------------------- ### Running CMake with Custom Build Configuration Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This command demonstrates how to run CMake, specifying a custom build configuration file and other build parameters. ```bash cmake -D BUILD_CONFIGURATION_FILE=BuildConfig.cmake -S . -B ./build/Win64 -G "Visual Studio 17 2022" -A x64 ``` -------------------------------- ### Graphics Pipeline Initialization (Old API) Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Illustrates the legacy method for initializing a graphics pipeline state object using `PipelineStateCreateInfo`. ```cpp PipelineStateCreateInfo PSOCreateInfo; PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; PSODesc.GraphicsPipeline.pVS = pVS; PSODesc.GraphicsPipeline.pPS = pVS; // ... Device->CreatePipelineState(PSOCreateInfo, &pPSO); ``` -------------------------------- ### New API: Shader and Pipeline State Creation Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Demonstrates the updated approach for creating shaders and defining resource layouts, including variables and static samplers, directly within the pipeline state description. ```cpp RefCntAutoPtr pVS; { ShaderCI.Desc.ShaderType = SHADER_TYPE_VERTEX; ShaderCI.EntryPoint = "main"; ShaderCI.Desc.Name = "Cube VS"; ShaderCI.FilePath = "cube.vsh"; pDevice->CreateShader(ShaderCI, &pVS); } RefCntAutoPtr pVS; { ShaderCI.Desc.ShaderType = SHADER_TYPE_VERTEX; ShaderCI.EntryPoint = "main"; ShaderCI.Desc.Name = "Cube VS"; ShaderCI.FilePath = "cube.vsh"; pDevice->CreateShader(ShaderCI, &pVS); } // ... ShaderResourceVariableDesc Vars[] = { {SHADER_TYPE_PIXEL, "g_Texture", SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE} }; PSODesc.ResourceLayout.Variables = Vars; PSODesc.ResourceLayout.NumVariables = _countof(Vars); // Define static sampler for g_Texture. Static samplers should be used whenever possible SamplerDesc SamLinearClampDesc( FILTER_TYPE_LINEAR, FILTER_TYPE_LINEAR, FILTER_TYPE_LINEAR, TEXTURE_ADDRESS_CLAMP, TEXTURE_ADDRESS_CLAMP, TEXTURE_ADDRESS_CLAMP); StaticSamplerDesc StaticSamplers[] = { {SHADER_TYPE_PIXEL, "g_Texture", SamLinearClampDesc} }; PSODesc.ResourceLayout.StaticSamplers = StaticSamplers; PSODesc.ResourceLayout.NumStaticSamplers = _countof(StaticSamplers); pDevice->CreatePipelineState(PSODesc, &m_pPSO); m_pPSO->GetStaticShaderVariable(SHADER_TYPE_VERTEX, "Constants")->Set(m_VSConstants); ``` -------------------------------- ### Graphics Pipeline Initialization (New API) Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Demonstrates the current approach for initializing a graphics pipeline state object using `GraphicsPipelineStateCreateInfo`. ```cpp GraphicsPipelineStateCreateInfo PSOCreateInfo; // ... PSOCreateInfo.pVS = pVS; PSOCreateInfo.pPS = pVS; Device->CreateGraphicsPipelineState(PSOCreateInfo, &pPSO); ``` -------------------------------- ### Specify Graphics Backend via Command Line Source: https://github.com/diligentgraphics/diligentengine/blob/master/Troubleshooting.md To troubleshoot rendering issues or test different graphics APIs, use command-line options to specify the desired backend. Supported options include `d3d11` and `gl`. ```bash Use `-mode d3d11` or `-mode gl` command line options ``` -------------------------------- ### Get D3D12 Resource State in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Retrieves the current D3D12 resource state from a D3D12 texture. ```cpp D3D12_RESOURCE_STATES ITextureD3D12::GetD3D12ResourceState() const; ``` -------------------------------- ### Compute Pipeline Initialization (New API) Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Presents the updated method for initializing a compute pipeline state object using `ComputePipelineStateCreateInfo`. ```cpp ComputePipelineStateCreateInfo PSOCreateInfo; PSOCreateInfo.pCS = pCS; Device->CreateComputePipelineState(PSOCreateInfo, &pPSO); ``` -------------------------------- ### Generate UWP Build Files Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Use this command to generate Visual Studio 2022 64-bit solution and project files for Universal Windows Platform. Ensure CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_VERSION are set correctly. ```bash cmake -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0 -S . -B ./build/UWP64 -G "Visual Studio 17 2022" -A x64 ``` -------------------------------- ### Generate Visual Studio 2022 Solution (Win64) Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Use this command to generate Visual Studio 2022 64-bit solution and project files for the engine. ```bash cmake -S . -B ./build/Win64 -G "Visual Studio 17 2022" -A x64 ``` -------------------------------- ### Create Shader Resource Binding with Immediate Static Resource Initialization Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Creates a shader resource binding and immediately initializes its static resources. This parameter controls whether static resources are initialized upon creation. ```cpp IMPLEMENT_INTERFACE_IMPL_க்கல்(PipelineState, IPipelineState, CreateShaderResourceBinding( { ..., InitStaticResources } ) ); ``` -------------------------------- ### Transition Resource States in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Use this method to explicitly transition resource states. Requires a count of barriers and an array of StateTransitionDesc structures. ```cpp void IDeviceContext::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers); ``` -------------------------------- ### CMakeLists.txt for Integrating Diligent Core Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This CMakeLists.txt file demonstrates how to add DiligentCore as a subdirectory and link against its various backend shared libraries. It also includes a utility to copy required DLLs. ```cmake cmake_minimum_required (VERSION 3.6) project(HelloDiligent CXX) add_subdirectory(DiligentCore) add_executable(HelloDiligent WIN32 HelloDiligent.cpp) target_compile_options(HelloDiligent PRIVATE -DUNICODE) target_link_libraries(HelloDiligent PRIVATE Diligent-GraphicsEngineD3D11-shared Diligent-GraphicsEngineOpenGL-shared Diligent-GraphicsEngineD3D12-shared Diligent-GraphicsEngineVk-shared ) copy_required_dlls(HelloDiligent) ``` -------------------------------- ### CMakeLists.txt using FetchContent to Download Diligent Modules Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This CMakeLists.txt file utilizes the FetchContent module to download and build Diligent Engine modules directly from their Git repositories. It specifies source directories and links against the necessary libraries. ```cmake cmake_minimum_required (VERSION 3.6) project(HelloDiligent CXX) include(FetchContent) FetchContent_Declare( DiligentCore GIT_REPOSITORY https://github.com/DiligentGraphics/DiligentCore.git SOURCE_DIR _deps/DiligentCore ) FetchContent_Declare( DiligentTools GIT_REPOSITORY https://github.com/DiligentGraphics/DiligentTools.git SOURCE_DIR _deps/DiligentTools ) FetchContent_Declare( DiligentFX GIT_REPOSITORY https://github.com/DiligentGraphics/DiligentFX.git SOURCE_DIR _deps/DiligentFX ) FetchContent_MakeAvailable(DiligentCore DiligentTools DiligentFX) add_executable(HelloDiligent WIN32 HelloDiligent.cpp) target_include_directories(HelloDiligent PRIVATE ${diligentcore_SOURCE_DIR} ${diligenttools_SOURCE_DIR} ${diligentfx_SOURCE_DIR} ) target_compile_definitions(HelloDiligent PRIVATE UNICODE) target_link_libraries(HelloDiligent PRIVATE Diligent-BuildSettings Diligent-GraphicsEngineD3D11-shared Diligent-GraphicsEngineD3D12-shared Diligent-GraphicsEngineOpenGL-shared Diligent-GraphicsEngineVk-shared DiligentFX ) copy_required_dlls(HelloDiligent) ``` -------------------------------- ### Configure Linux Build for Debug Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Generates build files for the 'Unix Makefiles' build system with a Debug configuration. Run from the engine's root folder. ```bash cmake -S . -B ./build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Debug" ``` -------------------------------- ### Generate Visual Studio Solution for Win8.1 SDK Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Generates a Win32 solution targeting the Win8.1 SDK using Visual Studio 2022. ```bash cmake -D CMAKE_SYSTEM_VERSION=8.1 -S . -B ./build/Win64_8.1 -G "Visual Studio 17 2022" -A x64 ``` -------------------------------- ### Set Working Directory for Command Line Execution Source: https://github.com/diligentgraphics/diligentengine/blob/master/Troubleshooting.md When running a project from the command line, ensure the project's `assets` folder is set as the working directory. This is crucial for resource loading. ```bash Set the project's `assets` folder as the working directory. ``` -------------------------------- ### Generate Markdown Pages List Source: https://github.com/diligentgraphics/diligentengine/blob/master/Doc/README.md Run this script from the repository root to organize Markdown files into a tree structure and generate the 'Doc/pages.dox' file. ```bash python Doc/md_pages.py Doc/pages.dox ``` -------------------------------- ### Update Pipeline State Creation API Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Illustrates the transition from the old API using `PipelineStateDesc` directly to the new API utilizing `PipelineStateCreateInfo` for creating pipeline states. ```cpp PipelineStateDesc PSODesc; // ... pRenderDevice->CreatePipelineState(PSODesc, &pPSO); ``` ```cpp PipelineStateCreateInfo PSOCreateInfo; PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; // ... pRenderDevice->CreatePipelineState(PSOCreateInfo, &pPSO); ``` -------------------------------- ### Configure Vulkan Build Environment for iOS Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Enable Vulkan support by specifying the path to the Vulkan SDK during CMake configuration. Ensure you use a tested SDK version. ```cmake cmake -DCMAKE_SYSTEM_NAME=iOS -DVULKAN_SDK=/Users/MyName/VulkanSDK/1.4.335.1 -S . -B ./build/iOS -G "Xcode" ``` -------------------------------- ### Generate Basic iOS Xcode Project Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Use this command to generate a basic Xcode project for iOS builds from the engine's root folder. ```cmake cmake -S . -B ./build/iOS -DCMAKE_SYSTEM_NAME=iOS -G "Xcode" ``` -------------------------------- ### Enable Sanitized Build System Environment in Xcode Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md On macOS, run this command to allow Xcode to see environment variables, which is necessary for Vulkan to be found. This is required for applications launched from the command line. ```bash defaults write com.apple.dt.Xcode UseSanitizedBuildSystemEnvironment -bool NO ``` -------------------------------- ### Generate iOS Simulator Xcode Project Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Configure the build for an iPhone simulator, specifying the system root and target architecture (e.g., arm64). ```cmake cmake -S . -B ./build/iOSSim -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=arm64 -G "Xcode" ``` -------------------------------- ### Build Diligent Engine for Web Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Builds the engine using the generated CMake build files for the Emscripten platform. This command is executed from the engine's root directory. ```cmake cmake --build ./build/Emscripten ``` -------------------------------- ### Generate MinGW Makefiles Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Generates make files for MinGW. Note that functionality may be limited and MinGW is not the recommended build environment. ```bash cmake -S . -B ./build/MinGW -D CMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" ``` -------------------------------- ### Generate Emscripten Project with CMake Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Generates the build system files for the Emscripten target using CMake and the Ninja generator. This command should be run from the engine's root directory. ```cmake emcmake cmake -S . -B ./build/Emscripten -G "Ninja" ``` -------------------------------- ### Initialize Static Shader Resources in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Explicitly initializes static resources for a shader resource binding. This is useful for multi-threaded environments to avoid race conditions. ```cpp void ISHaderResourceBinding::InitializeStaticResources(); ``` -------------------------------- ### Configure Vulkan SDK Environment Variables on macOS Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Set these environment variables to configure the Vulkan SDK and MoltenVK for macOS builds. Ensure the Vulkan SDK path is correct. ```bash export VULKAN_SDK=/Users/MyName/VulkanSDK/1.4.335.1/macOS export PATH=$VULKAN_SDK/bin:$PATH export DYLD_LIBRARY_PATH=$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH export VK_ADD_LAYER_PATH=$VULKAN_SDK/share/vulkan/explicit_layer.d export VK_ICD_FILENAMES=$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json export VK_DRIVER_FILES=$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json ``` -------------------------------- ### Setting Custom Build Configurations in CMake Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This snippet shows how to define custom build configurations (e.g., Debug, ReleaseMT) and specify which are debug and release types within the custom_configure_build function. ```cmake set(CMAKE_CONFIGURATION_TYPES Debug ReleaseMT CACHE STRING "Configuration types: Debug, ReleaseMT" FORCE) ``` ```cmake set(DEBUG_CONFIGURATIONS DEBUG CACHE INTERNAL "" FORCE) ``` ```cmake set(RELEASE_CONFIGURATIONS RELEASEMT CACHE INTERNAL "" FORCE) ``` -------------------------------- ### Build Diligent Engine on Linux Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Compiles the Diligent Engine using the generated build files. This command should be run after CMake configuration. ```bash cmake --build ./build ``` -------------------------------- ### Set Vertex Buffers in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Sets vertex buffers for the input assembler. The state transition mode can be specified to control how resource states are handled. ```cpp void IDeviceContext::SetVertexBuffers(Uint32 StartSlot, Uint32 NumBuffers, IBuffer* const* ppBuffers, const Uint64* pStrides, const OffsetT* pOffsets, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, DYNAMIC_RESOURCE_BINDING_FLAGS DynamicBindingFlags); ``` -------------------------------- ### Source Emscripten Environment Variables Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Activates the necessary Emscripten SDK environment variables in the current terminal session. On Windows, a .bat file should be used instead. ```bash source ${PATH_TO_EMSDK}/emsdk/emsdk_env.sh ``` -------------------------------- ### Copy Buffer Data in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Copies data between buffers on the device. The state transition mode can be specified to control how resource states are handled during the copy operation. ```cpp void IDeviceContext::CopyBuffer(IBuffer* pSource, IBuffer* pDestination, const CopyBufferAttribs& CopyAttribs, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); ``` -------------------------------- ### Set Index Buffers in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Sets index buffers for the input assembler. The state transition mode can be specified to control how resource states are handled. ```cpp void IDeviceContext::SetIndexBuffers(Uint32 NumBuffers, IBuffer* const* ppIndexBuffers, const OffsetT* pOffsets, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); ``` -------------------------------- ### Signal Fence for CPU-GPU Synchronization in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Signals a fence to enable CPU-GPU synchronization. This method is part of the IFence interface. ```cpp void IDeviceContext::SignalFence(IFence* pFence, Uint64 Value); ``` -------------------------------- ### Update Buffer Data in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Updates buffer data on the device. The state transition mode can be specified to control how resource states are handled during the update. ```cpp void IDeviceContext::UpdateBuffer(IBuffer* pBuffer, Uint64 Offset, Uint64 Size, const void* pData, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); ``` -------------------------------- ### Conditional Loading of Graphics Engine Factory (Dynamic Linking) Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This C++ code snippet shows how to conditionally load the graphics engine factory function when dynamically linking against Diligent Engine DLLs. The ENGINE_DLL macro is defined when using shared libraries. ```cpp #if ENGINE_DLL // Load the dll and import GetEngineFactoryD3D12() function auto GetEngineFactoryD3D12 = LoadGraphicsEngineD3D12(); #endif auto* pFactoryD3D12 = GetEngineFactoryD3D12(); ``` -------------------------------- ### Setting Compiler and Linker Flags for Custom Configurations Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md This code sets specific C/C++ compiler and linker flags for a custom release configuration (ReleaseMT). These flags are applied when building the project with that configuration. ```cmake set(CMAKE_C_FLAGS_RELEASEMT "/MT" CACHE INTERNAL "" FORCE) ``` ```cmake set(CMAKE_CXX_FLAGS_RELEASEMT "/MT" CACHE INTERNAL "" FORCE) ``` ```cmake set(CMAKE_EXE_LINKER_FLAGS_RELEASEMT "/OPT:REF" CACHE INTERNAL "" FORCE) ``` ```cmake set(CMAKE_SHARED_LINKER_FLAGS_RELEASEMT "/OPT:REF" CACHE INTERNAL "" FORCE) ``` -------------------------------- ### Update Diligent Engine Repository and Submodules Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Run these commands to pull the latest changes and update all submodules for an existing repository. It's good practice to perform a clean rebuild after updating. ```bash git pull git submodule update --recursive ``` -------------------------------- ### Copy Texture Data in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Copies data between textures on the device. The state transition mode can be specified to control how resource states are handled during the copy operation. ```cpp void IDeviceContext::CopyTexture(const CopyTextureAttribs& CopyAttribs, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); ``` -------------------------------- ### Buffer Mode Raw View in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Enables raw buffer views, allowing buffers to be treated as a sequence of bytes. Supported in D3D11 and D3D12. ```cpp BUFFER_MODE_RAW ``` -------------------------------- ### Set Target Configuration Complete Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Set the `TARGET_CONFIGURATION_COMPLETE` variable to `TRUE` to indicate that all required properties for a target have been set and no further processing is needed by the build system. This is used within the parent scope. ```cmake set(TARGET_CONFIGURATION_COMPLETE TRUE PARENT_SCOPE) ``` -------------------------------- ### Update Texture Data in Diligent Engine Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Updates texture data on the device. The state transition mode can be specified to control how resource states are handled during the update. ```cpp void IDeviceContext::UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, const Box* pBox, const TextureSubResData& SubresData, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); ``` -------------------------------- ### Update Git Submodules Source: https://github.com/diligentgraphics/diligentengine/blob/master/Troubleshooting.md Ensure all submodules are up-to-date when updating an existing repository. Run this command after a `git pull`. ```bash git pull git submodule update --recursive ``` -------------------------------- ### Customize Target Properties After Configuration Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md The `custom_post_configure_target()` function is called after the engine has finished configuring a target. Use this to override or set specific properties, such as the C++ standard. ```cmake function(custom_post_configure_target TARGET) set_target_properties(${TARGET} PROPERTIES CXX_STANDARD 17 ) endfunction() ``` -------------------------------- ### Customize Target Properties Before Configuration Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md The `custom_pre_configure_target()` function is called for each target before configuration. It allows setting target-specific properties, such as release multithreaded linkage flags. It can also signal completion by setting `TARGET_CONFIGURATION_COMPLETE`. ```cmake function(custom_pre_configure_target TARGET) set_target_properties(${TARGET} PROPERTIES STATIC_LIBRARY_FLAGS_RELEASEMT /LTCG ) set(TARGET_CONFIGURATION_COMPLETE TRUE PARENT_SCOPE) endfunction() ``` -------------------------------- ### Generate iOS Xcode Project with Deployment Target Source: https://github.com/diligentgraphics/diligentengine/blob/master/README.md Specify the iOS deployment target (e.g., 13.0) when generating the Xcode project. ```cmake cmake -S . -B ./build/iOS -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 -G "Xcode" ``` -------------------------------- ### Move Format Member from BufferDesc to BufferViewDesc Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md The 'Format' member has been moved from BufferDesc to BufferViewDesc. This change affects how buffer formats are specified. ```cpp struct BufferViewDesc { ... VALUE_TYPE Format; ... }; ``` -------------------------------- ### Use Combined Texture Samplers in Shader Creation Source: https://github.com/diligentgraphics/diligentengine/blob/master/ReleaseHistory.md Controls whether combined texture samplers are used during shader creation. When false, samplers are set separately via shader or SRB objects. ```cpp struct ShaderCreationAttribs { ... bool UseCombinedTextureSamplers; const Char* CombinedSamplerSuffix; ... }; ```