summaryrefslogtreecommitdiffstats
path: root/tools/gfx/renderer-shared.h
Commit message (Collapse)AuthorAge
* Check the available VK extensions before using CoopVec APIs in GFX (#6849)Jay Kwak2025-04-18
| | | | | * Check the available VK extensions before using CoopVec APIs in GFX * Remove a redundant request for cooperative vector extension for vk
* Fix precompiledTargetModule tests (#6455)cheneym22025-02-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix precompiledTargetModule tests Add SPIRV-Tool linker support to gfx unit tests and use the linker in precompileModule tests that use precompiled modules to reconstitute SPIRV shaders that were modularly compiled. Fix a Slang reference count bug in the precompile service. * Use sm_6_6 New DXC requires higher version for linkability. * Rename helper function, pass by reference * Link through slang-glslang * Add missing files * Fix metal * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
* Move switch statement bodies to their own lines (#5493)Ellie Hermaszewska2024-11-05
| | | | | | | | | * Move switch statement bodies to their own lines * format --------- Co-authored-by: Yong He <yonghe@outlook.com>
* formatEllie Hermaszewska2024-10-29
| | | | | | | * format * Minor test fixes * enable checking cpp format in ci
* add support for callable shaders in gfx (#3460)skallweitNV2024-05-27
| | | | Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
* [gfx] Cache mutable root shader object in Vulkan (#4119)skallweitNV2024-05-08
| | | | | | | | | | | * fix comment * add caching of mutable root shader objects in vulkan * Fix. --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Refactor compiler option representations. (#3598)Yong He2024-02-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor compiler option representation. * Fix binary compatibility. * Add a test for specifying compiler options at link time. * Fix binary compatibility. * Fix binary compatibility. * Fix backward compatibility on matrix layout. * Fix. * Fix. * Fix. * Fix gfx. * Fix gfx. * Fix dynamic dispatch. * Polish.
* gfx:Add callback to IPipelineCreationAPIDispatcher (#3556)kaizhangNV2024-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | * gfx:Add callback to IPipelineCreationAPIDispatcher Add the callback to IPipelineCreationAPIDispatcher in Vulkan backend in slang-gfx lib. * gfx:add uuid for vulkan pipeline dispatcher Add a define of SLANG_UUID_IVulkanPipelineCreationAPIDispatcher for Vulkan specific IPipelineCreationAPIDispatcher such that libgfx.so can have special handle to Vulkan pipeline dispatcher without break binary compatibility. In the RendererBase::initialize call, we will provide this new UUID when the DeviceType is Vulkan. * gfx: add new variable to GfxGUID Add new variable to GfxGUID IID_IVulkanPipelineCreationAPIDispatcher with initialization of SLANG_UUID_IVulkanPipelineCreationAPIDispatcher to make the implementation aligned with existing GfxGUID::IID_IPipelineCreationAPIDispatcher. --------- Co-authored-by: Yong He <yonghe@outlook.com>
* squash warnings (#3378)Ellie Hermaszewska2023-12-05
| | | Co-authored-by: Yong He <yonghe@outlook.com>
* Parameter binding and gfx fixes. (#3302)Yong He2023-11-01
| | | | | | | | | | | * Parameter binding and gfx fixes. * Add diagnostics on entry point parameters. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Add Mesh and Task shader support to GFX (#3190)Ellie Hermaszewska2023-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Bump vulkan headers Also just use vulkan-headers as a submodule * Add drawMeshTasks to gfx graphics pipelines * Add DispatchMesh overload with no payload, with GLSL intrinsic * Require spirv 1.4 for mesh shaders * Add vulkan mesh shader feature discovery * Add mesh shader stage bits to vk-util * Add mesh and task shader support to render-test * Add mesh and task tests * Preserve "payload" specifier in task shaders * Add mesh shader pipeline support to gfx * Add TODO * Add numThreads attribute for amplification stage * Add payload to task shader test * Drop dependency on d3dx12 * Allow passing payloads from task to mesh shaders * regenerate vs projects * check DispatchMesh name correctly * Add mesh shader tests to failing tests * Detect wave-ops feature on vulkan * Add fuse-product to expected failures This fails because the global varaible `count` is not initialized * Add required extension to WaveMaskMatch SPIR-V impl * Remove meshShader member from pipeline desc * Identify mesh shader support on d3d12
* Use ankerl/unordered_dense as a hashmap implementation (#3036)Ellie Hermaszewska2023-08-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Correct namespace for getClockFrequency * missing const * Add missing assignment operator * Remove unused variables * Return correct modified variable * Use stable hash code for file system identity * terse static_assert * Structured binding for map iteration * Make (==) and getHashCode const on many structs * Add ConstIterator for LinkedList * Replace uses of ItemProxy::getValue with Dictionary::at * Extract list of loads from gradientsMap before updating it * Const correctness in type layout * Add unordered_dense hashmap submodule * Use wyhash or getHashCode in slang-hash.h * refactor slang-hash.h * Use ankerl/unordered_dense as a hashmap implementation Notable changes: - The subscript operator returns a reference directly to the value, rather than a lazy ItemProxy (pair of dict pointer and key) slang-profile time (95% over 10 runs): - Before: 6.3913906 (±0.0746) - After: 5.9276123 (±0.0964) * 64 bit hash for strings So they have the same hash as char buffers with the same contents * Narrowing warnings for gcc to match msvc * revert back to c++17 * Correct c++ version for msvc * Use path to unordered_dense which keeps tests happy * Do not assign to and read from map in same expression * Remove redundant map operations in primal-hoist * Split out stable hash functions into slang-stable-hash.h * 64 bit hash by default * regenerate vs projects * Correct return type from HashSetBase::getCount() * correct width for call to Dictionary::reserve * Use stable hash for obfuscated module ids * Signed int for reserve * clearer variable naming * Parameterize Dictionary on hash and equality functors * Allow heterogenous lookup for Dictionary * missing const * Use set over operator[] in some places * Remove unused function * s/at/getValue
* Dictionary using lowerCamel (#2835)jsmall-nvidia2023-04-25
| | | | | | | | | | | | | | | | | | | | | | | | | * #include an absolute path didn't work - because paths were taken to always be relative. * WIP lowerCamel Dictionary. * WIP more lowerCamel fixes for Dictionary. * Add/Remove/Clear * GetValue/Contains * Fix tabs in dictionary. Count -> getCount * Fix fields with caps. * Key -> key Value -> value Use m_ for members where appropriate. Use lowerCamel in linked list. * Some small fixes/improvements to Dictionary. * Kick CI.
* Refactor shader cache (#2558)skallweitNV2022-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix a bug in Path::find * Fix code formatting * Fix LockFile and add LockFileGuard * Add PersistentCache and unit test * Replace file path dependency list with source file dependency list * Add note on ordering in Module/FileDependencyList * Remove old shader cache code * Refactor shader cache implementation * Temporarily skip unit tests reading/writing files * Fix warning * Reenable lock file test * Rename shader cache tests and disable crashing test * Testing * Stop using Path::getCanonical * Fix persistent cache lock and test * Fix threading issues * Move adding file dependency hashes to getEntryPointHash() * Fix handling of #include files * Allow specifying additional search paths for gfx testing device * Work on shader cache tests * Update project files * Revive shader cache graphics tests * Split graphics pipeline test * Fix compilation
* PersistentShaderCache integration (#2453)lucy96chen2022-10-19
| | | | | | | | | | | | | | | | | | | | | | | * Shader cache index integrated into RendererBase; Added test for cache eviction policy (which currently does not pass) * Restructured main if block in getEntryPointCodeFromShaderCache; Post-rebase cleanup * undo local testing only change * Fixed issues causing shader cache tests to fail * Edited gfx.slang to reflect structural changes to IDevice::Desc and to include ShaderCacheDesc; Modified how the cache is reading in the file from disk; Added a check to the cache eviction policy test that checks for correct order of entries in the cache as well as eight total expected output files for D3D12 and Vulkan * Removed line in gfx-unit-test.cpp for local testing * Edited .gitignore to ignore all shaders automatically generated by the shader cache tests and removed the test shaders that were previously added; Review changes, most notably with an overhaul of how the cache eviction policy test handles checking order of entries * Ran premake; Removed local testing specific line (again) * Removed expected comparison files from earlier commit; Ran premake * Edited premake5.lua to also ignore the auto-generated shader files from specific shader cache tests * Fixed weird indent in premake5.lua
* Shader cache index implementation (#2452)lucy96chen2022-10-17
|
* Add gfx debug layer trampoline for D3D12 interfaces. (#2445)Yong He2022-10-12
| | | Co-authored-by: Yong He <yhe@nvidia.com>
* Shader caching (#2432)lucy96chen2022-10-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Changed all getEntryPointCode calls to use RendererBase::getEntryPointCodeFromShaderCache * Hashing hooked up, tests pass but need to add more to fully test functionality * checkpoint * Checkpoint: File system creation seems functional, saving is broken * checkpoint: Fixed filename generation from MD5 hash, shader blob might be going missing ahead of pipeline state creation * Fixed a lot of bugs related to hash code generation, shader cache is likely working but needs further testing * Added workaround for module loading by re-creating the test device, shader cache test functional * Vulkan shader caching bug fixed, checkpoint commit before more refinement * pre-ToT merge checkpoint * checkpoint commit, improving cache keys * Significantly expanded items included in the dependency hash for Module; Added dependency hash functions to SpecializedComponentType and RenamedEntryPointComponentType * Temporarily disable shader cache test * Mid cleanup changes, solution successfully builds * Added several helper update functions to slang-md5 to help simplify usage; Added a function under ISession to compute a hash for all linkage-related items; Function renames and cleaned up some comments * Ran premake.bat; Renamed getASTBasedHashCode to computeASTBasedHash * Added slang unit tests for Checksum and MD5; Extended gfx shader cache test to test with multiple shader files and one shader file with multiple entry points * Solution builds and shader cache tests pass, but at least a couple other tests now failing * ran premake.bat * More cleanup changes * Added shaderCachePath field to IDevice desc in gfx.slang, gfx-smoke.slang should be functional * ran premake * cleanup changes; Adding test printf to getEntryPointCodeFromShaderCache to see if output can be seen in CI * Removed debugging printfs; Added handling for getEntryPointCode() failing * Cleanup changes; Jonathan's fixes to SerialWriter to zero initialize otherwise uninitialized memory; Change to SwizzleExpr creation to zero initialize elementCount * Changed enable_if_t to enable_if * Fixed enable_if * Added test for import vs include and changes to included and imported files; Fixed build errors in CUDA; Renamed shader cache statistics fields * cleanup changes * Readd removed file * Restructured computeDependencyBasedHash calls, added computeDependencyBasedHashImpl to all classes dervied from ComponentType * Applied same restructuring to the AST hash functions * Cleanup changes; Moved HashBuilder out to slang-digest.h and added some helper functions to streamline the process of adding items to a hash * Cleanup; Fixed incorrect expected results for shader import and include test
* Use d3d12/vk debug layer when gfx debug layer is enabled. (#2411)Yong He2022-09-26
| | | | | | | * Use d3d12/vk debug layer when gfx debug layer is enabled. * Fix. Co-authored-by: Yong He <yhe@nvidia.com>
* Call `gfx` in slang program. (#2370)Yong He2022-08-20
|
* Add gfx interface definition in Slang. (#2364)Yong He2022-08-16
| | | | | | | | | | | | | | | | | | * Add gfx interface definition in Slang. - add gfx interface definitons in Slang. - fix slang compiler to correctly type-check `out` interface argument. - modify gfx interface to be fully COM compatible - add convenient ShaderProgram creation methods to gfx. * Fix compile errors and warnings. * Update project files * Fix cuda. * Properly implement queryInterface in command encoder impls. Co-authored-by: Yong He <yhe@nvidia.com>
* gfx: Add interop API to control descriptor heap binding. (#2211)Yong He2022-04-27
| | | Co-authored-by: Yong He <yhe@nvidia.com>
* GFX renaming work part 2: slang-gfx.h renames (#2194)lucy96chen2022-04-21
| | | | | | | | | | | | | * Fixed all build errors and type conversion warnings from renames in slang-gfx.h * Made necessary build fixes to the CUDA implementation * Renamed ITextureResource::Size to ITextureResource::Extents * More rename changes based on CI errors * More renames to fix CI build errors * Rerun tests
* GFX renaming work part 1 (#2183)lucy96chen2022-04-14
| | | | | * Added new typedefs for Size, Offset, Count, and Index; Replaced numerous instances of size_t in slang-gfx.h, render-d3d12, render-vk, and renderer-shared with either Size or Offset; Fixed compiler warnings for mismatched numerical types * Renamed Index and Count to GfxIndex and GfxCount, changed to 32 bit from 64 bit
* gfx: Add `ITransientResourceHeap::finish()` to avoid `Signal` after every ↵Yong He2022-03-11
| | | | | queue submit. (#2158) Co-authored-by: Yong He <yhe@nvidia.com>
* gfx: restructure render-d3d12.cpp (#2154)Yong He2022-03-09
| | | | | | | | | | | | | | | | | * Vulkan: deferred shader compilation and pipeline creation. * Fix 32bit build. * gfx: restructure the code in render-d3d12.cpp * Move `Submitter`. * Fix. * merge with master. * Revert dictionary change in previous PR. Co-authored-by: Yong He <yhe@nvidia.com>
* GFX Vulkan: deferred shader compilation and pipeline creation. (#2153)Yong He2022-03-08
| | | | | | | * Vulkan: deferred shader compilation and pipeline creation. * Fix 32bit build. Co-authored-by: Yong He <yhe@nvidia.com>
* Expose API-specific row alignment values (#2151)lucy96chen2022-03-08
| | | | | | | * Added function to IDevice that retrieves the row alignment for the particular API; Added rowDstStride argument to copyTextureToBuffer and changed D3D12 footprint row pitch to check that the user-supplied stride is correctly aligned before assigning to the footprint's row pitch * Changed alignment from Uint to size_t Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
* Use GLSL scalar layout for constant buffers. (#2147)Yong He2022-02-28
|
* gfx: d3d12 performance optimizations. (#2140)Yong He2022-02-23
| | | | | | | | | | | * gfx: d3d12 performance optimizations. * Fix. * Fix unit test bug. * Add gfx interface for directly allocating GPU descriptor tables. Co-authored-by: Yong He <yhe@nvidia.com>
* gfx: defer downstream shader compilation until draw/dispatch. (#2139)Yong He2022-02-20
| | | Co-authored-by: Yong He <yhe@nvidia.com>
* Optimize d3d12 mutable shader object implementation. (#2138)Yong He2022-02-19
| | | | | | | | | | | | | * Optimize d3d12 mutable shader object implementation. * Disable mismatched clear value warning message from d3d sdk. * Fix. * Fix. * gfx: Avoid redundant d3d12 QueryInterface call. Co-authored-by: Yong He <yhe@nvidia.com>
* Added implementations for IFence::getSharedHandle() for Vulkan and D3D12 (#2137)lucy96chen2022-02-18
| | | Co-authored-by: Yong He <yonghe@outlook.com>
* Fully implement the ray tracing pipeline for Vulkan (#2136)lucy96chen2022-02-18
| | | | | | | | | | | | | | | | | * Added implementation for dispatchRays() and ShaderTableImpl, currently missing extensions and createShaderTable() * Code written, working on finding and fixing bugs * SBT issues fixed; Added implementation for endEncoding() to ensure the bound pipeline is properly reset; Ray tracing pipeline example successfully runs without any validation errors * Fixed some incorrectly merged lines * Fixed spacing * Fixed alignment for member variables in VulkanApi * Restart CI * Removed accidental comment kept from merge; Changed getName() call to getNameOverride()
* Various gfx fixes. (#2132)Yong He2022-02-16
| | | | | | | | | | | | | | | * Various gfx fixes. * Fix test case. * Fix crash. * Trigger build * Trigger build 2 * Fix vulkan unit tests. Co-authored-by: Yong He <yhe@nvidia.com>
* Fix linux gfx issue (#2131)jsmall-nvidia2022-02-15
| | | | | | | | | | | | | | | * #include an absolute path didn't work - because paths were taken to always be relative. * Fix linux build issue with renderer-shared.h * Move to .cpp file. * Move some templates to stop definition order issue on linux. * Move to header because it's templated. * Fix warning about GeometryInstanceFlags::Enum flags : 8; being too small by making the enum backed by 8 bits. * Check if vkDestroySampler function is available.
* gfx: Add `resolveQuery` command. (#2125)Yong He2022-02-10
| | | Co-authored-by: Yong He <yhe@nvidia.com>
* gfx: support shader record overwrite and fix QueryPool. (#2123)Yong He2022-02-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Various fixes to gfx. * Fix. * Fixes. * Fix. * gfx: support root parameter via user-defined attribute. * Fix. * Fix. * Skip d3d12 tests on win x86. * Fixes. * gfx: support shader record overwrite. * Fix QueyPool implementation. * Rename to `getBindingRangeLeafVariable` Co-authored-by: Yong He <yhe@nvidia.com>
* Various fixes to gfx. (#2120)Yong He2022-02-09
| | | | | | | | | | | * Various fixes to gfx. * Fix. * Fixes. * Fix. Co-authored-by: Yong He <yhe@nvidia.com>
* Add gfx interop to allow more direct D3D12 usage scenarios. (#2117)Yong He2022-02-03
| | | | | | | | | | | | | * Add gfx interop to allow more direct D3D12 usage scenarios. * Fix compile error in win32. * gfx: Implement IFence::getNativeHandle() on d3d12. * More GFX-D3D interop interface. * Fix cuda. Co-authored-by: Yong He <yhe@nvidia.com>
* GFX: Add API interception mechanism for pipeline creation. (#2115)Yong He2022-02-01
| | | | | This allows the user application to intercept API calls to create pipeline states. This feature can be used to integrate NVAPI in the user application. Co-authored-by: Yong He <yhe@nvidia.com>
* GFX: seperated ShaderTable. (#2090)Yong He2022-01-21
|
* More fixes to GFX d3d12. (#2084)Yong He2022-01-19
| | | | | | | | | | | | | | | | | | | * Fixes to GFX. * Fix binding null resource views in d3d12. * Fix array render target view creation. * Add support for more primitive topologies. * More gfx fixes. * D3D12 feature report on conservative raster, programmable sample position, barycentrics and ROV. * Add QueryPool::reset. * Fix resource setDebugName. * Dynamically expanding GPU descriptor heap. * Render passes without render targets (null frame buffer). * Fix. Co-authored-by: Yong He <yhe@nvidia.com>
* Remove `PipelineType` from gfx header. (#2051)Yong He2021-12-09
| | | Co-authored-by: Yong He <yhe@nvidia.com>
* D3D12 and Vulkan to CUDA Texture Sharing (#2038)lucy96chen2021-12-08
|
* gfx: D3D12 and VK Fence implementation. (#2048)Yong He2021-12-07
| | | | | | | | | | | | | * gfx: D3D12 and VK Fence implementation. * Fix. * Update project files. * Revert project file changes. * Remove project files Co-authored-by: Yong He <yhe@nvidia.com>
* gfx Mutable Root shader object implementation. (#2042)Yong He2021-12-06
| | | | | | | * gfx Mutable Root shader object implementation. * Fix x86 build. Co-authored-by: Yong He <yhe@nvidia.com>
* gfx ShaderObject interface update, getTextureAllocationInfo() (#2019)Yong He2021-11-17
| | | | | | | * gfx ShaderObject interface update, getTextureAllocationInfo() * Fix render-vk compiler warnings and errors. Co-authored-by: Yong He <yhe@nvidia.com>
* Update gfx interface. (#2015)Yong He2021-11-15
|
* Allow buffers to be shared between D3D12 and CUDA (#2005)lucy96chen2021-11-09
| | | | | | | | | | | * Added both the SharedHandle struct containing a handle and the API the handle originated from and the getSharedHandle() method to IResource, which returns a Windows system handle for the resource that can then be shared between multiple APIs (currently only fully implemented for D3D12); Added createTextureFromNativeHandle() and createBufferFromNativeHandle() to IDevice, which creates a buffer or texture resource using the provided handle (currently only fully implemented for D3D12); Added createBufferFromSharedHandle() to IDevice, which creates a BufferResource using the provided system handle (currently only fully implemented for the D3D12 to CUDA interface); Provided a proper implementation for CUDADevice::getNativeHandle(); Added several new tests testing the aforementioned implementations; Moved NativeHandle and getNativeHandle() for IBufferResource and ITextureResource up a layer into IResource and renamed to NativeResourceHandle; Modified NativeResourceHandle to be a struct containing the handle and the API it originated from and propagated these changes where appropriate * Combined all native and shared handle representations into a unified InteropHandle struct which tracks the handle's value and source API; Modified all getNativeHandle() and getSharedHandle() variants to operate on InteropHandle and modified all affected files * D3D12 buffers and textures are now responsible for closing their shared handles if they exist; Renamed IDevice::getNativeHandle() to getNativeDeviceHandles() * Fixed getNativeDeviceHandles() in render-cuda to match updated method elsewhere * Temporarily disabling existingDeviceHandleCUDA and sharedHandleD3D12ToCUDA due to currently unreproducable test failures on TC