summaryrefslogtreecommitdiffstats
path: root/examples/ray-tracing/main.cpp
Commit message (Collapse)AuthorAge
* Add command-line arguments to examples (#7835)Jay Kwak2025-07-21
| | | | | | | | * Add command-line arguments to triangle example - Add -h/--help flag to show usage information - Add -api flag to select rendering API (d3d11 < /dev/null | d3d12|vulkan|metal|cpu|cuda|webgpu) - Platform-specific API availability (D3D on Windows, Metal on macOS) - Output works for both console and WIN32 applications
* Convert gfx unit tests and examples to use slang-rhi (#7577)Gangzheng Tong2025-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Port first gfx unit test to slang-rhi * port triangle example to use slang-rhi * port platform-test to slang-rhi * Update platform-test to throttle mouse move events * port gpu-printing example to use slang-rhi * port model-viewer example to use slang-rhi * port ray-tracing example to use slang-rhi * port ray-tracing pipeline example to use slang-rhi * port reflection parameter blocks example to use slang-rhi * port shader-object example to use slang-rhi * port shader-toy example to use slang-rhi * Port most of tests to slang-rhi * port link-time-constant-array-size to use slang-rhi * Fix tests and find matching tests in slang-rhi * port autodiff-texture * remove gfx target; port nv-aftermath-example * update include path for shader-cursor.h * Disabled 2 more ported tests * fix build error * remove gfx test * put slang-rhi (static-lib) before slang (shared) * format code (#7621) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> * add debug callback * format code (#7649) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> * Address review comments; revert back to use SLANG_CHECK_MSG --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Cleanups related to RIFF support (#7041)Theresa Foley2025-05-12
|
* Add backtraces to examples (#5973)Anders Leino2025-01-07
| | | | | | | | | | | | | | | * examples: Log stack trace on exceptions For now, this is only implemented on Windows. This helps to address #5520. * examples: Print log file if there is any * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
* Fix some robustness issues in the examples (#5984)Anders Leino2025-01-07
| | | | | | | | | | | | | | | * examples: Make hello-world example exit gracefully if VK cannot be initialized - Check if VK API function pointers are valid before using them - Return 0 and exit if VK initialization fails - Enable hello-world example * examples: Fixes for ray-tracing examples - Assert that accelleration structure buffer is not nullptr - Check if buffer creation succeeded before proceeding - This makes initialization not hang, but it still fails. Therefore, the test expectations are just updated to point to another issue. - Enable ray-tracing tests on Windows
* Add slang example tests to CI (#5879)Anders Leino2024-12-18
| | | | | | | | | | | | * Examples: Don't proceed if 'initializeBase' fails * Examples: Only access gWindow if it's been initialized * Examples: Free memory from CommandLineToArgvW * Add example run step to CI Lots of examples are still unexpectedly failing, but is one small step towards addressing issue #5520.
* Correct include dir for libslang (#5539)Ellie Hermaszewska2024-11-13
| | | | | | | | This stops adding the repo root to the include path for anything linking with slang. This enabled a bunch of convenient includes, but might lead to confusing behavior for anyone including slang. Not to mention differences including it from an install vs source. 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
* Migrate examples (#4920)kaizhangNV2024-08-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Migrate cpu-hello-world to new slang API Migrate cpu-hello-world to new slang API, and also convert this example as one of the unit test. * Add 'shader-object' to slang-unit-test * Convert ray-tracing example into unit-test Convert ray-tracing example into unit-test * Fix some replay bugs: - Wrong decode type in 'getEntryPointHostCallable'. - Mistakes in computing the output buffer size. - Wrong decode type in array size in specialize() call. - When capture entrypoint, we should increase the reference count for the allocated entrypoint recorder object, because that is allocated by record layer, it should be owned by the layer, user should not be able to free it. - Improve json consumer on the prelude text. * Test verify change: In our test, we add a "callIdx" string at beginning of the hash-code string, as there could be more than one modules in the example, so they could call 'getEntryPointHash' multiple times, in order for the test can identify them, add "callIdx: <number>" as the key word.
* Move the file public header files to `include` dir (#4636)kaizhangNV2024-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move the file public header files to `include` dir Close the issue (#4635). Move the following headers files to a `include` dir located at root dir of slang repo: slang-com-helper.h -> include/slang-com-helper.h slang-com-ptr.h -> include/slang-com-ptr.h slang-gfx.h -> include/slang-gfx.h slang.h -> include/slang.h Change cmake/SlangTarget.cmake to add include path to every target, and change the source file to use "#include <slang.h>" to include the public headers. The source code update is by the script like follow: ``` fileNames_slang=$(grep -r "\".*slang\.h\"" source/ -l) for fileName in "${fileNames_slang[@]}" do echo "$fileName" sed -i "s/\".*slang\.h\"/\"slang\.h\"/" $fileName done ``` * Fix the test issues * Fix cpu test issues by adding include seach path * Update cmake to not add include path for every target Also change "#include <slang.h>" to "include "slang.h" " to make the coding style consistent with other slang code. * Change public include to private include for unit-test and slang-glslang
* Resource searching for examples (#4518)venkataram-nv2024-07-01
|
* [gfx] specify resource view buffer range in bytes (#4149)skallweitNV2024-05-13
| | | | | | | | | | | | | * refactor gfx buffer range to use byte range * create buffer view with zero struct stride for ClearUnorderedAccessViewUint/Float * create buffer descriptors on demand * avoid copying gfx.dll --------- Co-authored-by: Yong He <yonghe@outlook.com>
* 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>
* Various fixes to gfx. (#2120)Yong He2022-02-09
| | | | | | | | | | | * Various fixes to gfx. * Fix. * Fixes. * Fix. Co-authored-by: Yong He <yhe@nvidia.com>
* 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>
* Various fixes to GFX, nested parameter block test for d3d12. (#2081)Yong He2022-01-14
| | | | | | | | | | | | | * Various fixes. * Add nested parameter block test. * Remove slang-llvm licence info * Ingore slang-llvm/ directory. * Fixup. Co-authored-by: Yong He <yhe@nvidia.com>
* Draw call tests for Vulkan (#2073)lucy96chen2022-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | * Added instancing support to Vulkan, drawInstanced() test image is upside-down * Fixed inverted drawInstanced() test output by changing Vulkan viewport convention * Replaced vkCmdDraw with vkCmdDrawIndexed in all non-indirect indexed draws, drawIndexedIndirect test now working for Vulkan * Moved index and vertex buffer binding into setIndexBuffer and setVertexBuffers; Defaulted countBuffer to nullptr and countOffset to 0 and added a check for non-null countBuffer to drawIndirect and drawIndexedIndirect in Vulkan; All Vulkan draw tests working (but D3D12 tests broken) * Added support for drawInstanced and drawIndexedInstanced to D3D11 and added tests for both, however D3D11 tests are currently disabled due to readTextureResource assuming a fixed pixel size (among other possible problems); Fixed issues causing D3D12 tests to fail after major back-end fixes to get Vulkan up and running * Removed testing function for dumping images and some other commented out code * Removed some commented out code * Fix initializer list causing builds to fail (attempt 1) * Removed initializer list for VertexStreamDesc in createInputLayout() and fill in struct fields normally (build fix attempt 2) * Removed default values from VertexStreamDesc and changed all initializer lists to reflect this change * Moved applyBinding before setVertexBuffer in RenderTestApp::renderFrame() to ensure the pipeline has already been bound before vertex buffers are * Changed D3D11's readTextureResource to calculate pixel size using format-specific size information; Removed wrapper around D3D11 instanced and indexed instanced draw tests
* Remove `PipelineType` from gfx header. (#2051)Yong He2021-12-09
| | | Co-authored-by: Yong He <yhe@nvidia.com>
* 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>
* Expanded gfx::Format to include additional formats (#1982)lucy96chen2021-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Format list updated with additional formats supported by both D3D and Vulkan; D3DUtil::getMapFormat() and VkUtil::getVkFormat() updated to include additional formats; GFX_FORMAT() updated with all additional formats (BC compression unfinished) * Finished updating GFX_FORMAT with newly added formats and sizes; Pixel size is now tracked using the FormatPixelSize struct containing the values for bytes per block and pixels per block to accomodate BC formats; Updated gfxGetFormatSize and associated sub-calls to return FormatPixelSize instead of uint8_t; Most calls to gfxGetFormatSize() updated to reflect changes, a couple calls still unupdated * Changes to accommodate new formats finished, debugging slang-literal unit test * First format unit test working * One test added for BC1Unorm and RGBA8Unorm_SRGB, both passing * Refactored format testing code to merge BC1Unorm and RGBA8Unorm SRGB into a single file * All unit tests added for BC and Srgb formats * Most tests added and working; Added five additional formats (still need tests) and made the appropriate changes to support these; createTextureView() modified for D3D11, D3D12, and Vulkan to take into account the format specified in the texture view desc when the texture's format is typeless * Format enums renamed to more closely match their D3D counterparts; Added a universal float and uint buffer and buffer view for use across all Format tests * Remaining tests added; D3D12 tests pass, but Vulkan crashes in BC1_UNORM and D3D11 spits out a bunch of D3D11 Errors (but supposedly passes) * re-run premake * Added Sint versions of test shaders; Vulkan and D3D11 tests also pass * Size struct for format unit tests no longer use initializer lists * Fixed a Size struct missed in the previous pass * Fixed minor bugs causing tests to fail * Added documentation detailing all currently unsupported formats * Skip tests causing unsupported format warnings due to swiftshader * updated several test using old Format enum names * Revert change to compareComputeResult() that was added for debugging purposes * DEBUGGING: Added prints to identify which formats are failing on CI * Reverted attempted debugging changes; Fixed texture2d-gather.hlsl to use updated Format enums * Fixed incorrect array sizes in d3d11 _initSrvDesc() * Commented out further tests that produce unexpected results when tested for Vulkan with swiftshader * Revert "Merge branch 'expanded-format-support' of https://github.com/lucy96chen/slang into expanded-format-support" This reverts commit 20008f0d3ecc3b1405ecac8c138edaa3cd37ed6b, reversing changes made to 6081e95827315fee50e18409394d5abd62fac787. * Added a fuzzy comparison function for use with floats * submodule update * Revert messed up changes caused by previous revert after automatically merging on github
* [gfx] Inline raytracing fixes in response to code review. (#1905)Yong He2021-07-09
| | | Co-authored-by: Yong He <yhe@nvidia.com>
* Implement gfx inline ray tracing on D3D12. (#1902)Yong He2021-07-08
| | | | | | | * Update VS projects to 2019. * Empty commit to trigger build * Implement gfx inline ray tracing on D3D12.
* [gfx] Add inline ray tracing support. (#1899)Yong He2021-06-30