summaryrefslogtreecommitdiffstats
path: root/examples/triangle/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>
* Fix comment typos in the triangle's main.cpp example (#6976)FeuFeve2025-05-01
| | | | | * Fix comment typos in the triangle's main.cpp example * 2nd fix
* 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>
* 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>
* formatEllie Hermaszewska2024-10-29
| | | | | | | * format * Minor test fixes * enable checking cpp format in ci
* Feature/capture unit test (#4898)kaizhangNV2024-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * record/replay: Add tests Modify the hello-world example to generate the hash code for the entry point spirv code, so that we can compare it with replaying the example. Add the test script to run the example and compare the hash code with replaying it. * Check nullptr for out Diagnostics We need to check whether the output Diagnostics is a nullptr, because it's allowed. * Fix the double free pointers * Add triangle example as the new test for record-replay Change the example base to add the offline rendering path because we don't want to display anything when we're in the test mode. This change involves introducing a TestBase that will parse the command line option. It will decide whether we are in the test mode. Disable all the swapchain and windows related creation, instead we will only create one single framebuffer for the render target. * Address comments TODO: In the follow up patches, I will add more tests and integrate the test flow into slang-unit-test.
* 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
|
* Various fixes to gfx. (#2120)Yong He2022-02-09
| | | | | | | | | | | * Various fixes to gfx. * Fix. * Fixes. * Fix. 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>
* 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
* Remove resource `Usage` from `gfx` interface. (#1813)Yong He2021-04-24
| | | | | | | | | | | | | * Fix `model-viewer` crash when using Vulkan. Fixing an issue in shader object layout creation for to make sure a correct descriptor set layout is calculated for types that need an implicit constant buffer. * Fix formatting. * Fixes. * Fix memory leak in vulkan. * Remove resource `Usage` from `gfx` interface.
* Add Hello world example. (#1797)Yong He2021-04-16