| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
|
| |
This PR marks the `slang-rhi` a required dependecy for `platform` and
`gfx-unit-test`, and only build them when `SLANG_ENABLE_SLANG_RHI=ON`.
This should allow the slang still to be built without those tests
components when `SLANG_ENABLE_SLANG_RHI=OFF`.
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Enable debug-layers for examples when not using test-mode
* simplify in test mode
* format code (#83)
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
* 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
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bug here is subtle enough that it was missed during development of the example, and it it unlikely to be hit by typical applications.
All that said, it is good to ensure that this example does things correctly, since we are pointing developers to it as an example of how to correctly extract information using the reflection API.
In order to get the bug to surface, one can target Vulkan/SPIR-V using input code like:
```
struct Small
{
float4 v;
Texture2D t;
}
struct Big
{
float4 u;
ConstantBuffer<Small> smallCB;
ParameterBlock<Small> smallPB;
}
ConstantBuffer<Big> bigCB;
```
Without this change, the example would display an incorrect cumulative offset for `bigCB.smallPB.t`.
The incorrectly-computed offset showed that the `binding`s consumed by `bigCB.smallCB` (for both its constant buffer and its `t` field) were being included in the offset computed for the `t` within the parameter block (when the outer parameter block should have caused those offsets to be ignored).
The underlying bug in the example is that when recursively printing the cumulative offsets for the "container" and "content" part of a buffer/block, the example was including the buffer/block in the `AccessPath` when printing cumulative offsets for the "content" part, but not for the "container" part.
The fix is just to shift the order of things and use the same `AccessPath` when printing both the "container" and "content" parts of a buffer/block.
It is difficult to be 100% certain that this change is correct, and that there are no corner cases where the new code gives unexpected/wrong results.
I have manually tested the example code by throwing a variety of shader parameter declarations at it, and the new logic seems robust.
We are probably at the point where the code of this example probably needs to be turned into a stand-alone tool that we can use as part of our automated testing.
That will have to wait for a future change; the goal of this change is to just get the simple bug fixe checked in.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add MLP training examples.
* Formatting fix.
* Fix.
* Improve documentation on coopvector.
* Improve doc.
* Update doc.
* Fix typo.
* Cleanup shader.
* Cleanup.
* Fix test.
* Fix type check recursion.
* Fix.
* Fix.
* Fix override check.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Unify Debug Layer Control Logic and Add Disable Option for Debug Builds
This PR refactors and unifies the debug layer control logic in slang-test.
A new `-disable-debug-layers` option is introduced, allowing debug builds to skip enabling the validation (debug) layer.
This is currently needed to ensure stability in the debug test suite.
Previously, different toggles such as ENABLE_VALIDATION_LAYER, ENABLE_DEBUG_LAYER, and debugLayerEnabled were used inconsistently across different components of slang-test. This PR standardizes the logic by using a single variable, debugLayerEnabled, to control the enabling/disabling of the debug layer internally.
Notes:
By default, the debug/validation layer is enabled in debug builds and is not supported in release builds of slang-test.
Fixes: #7132
* Disable spirv-opt for the DebugFunctionDefinition issue
* Run debug build only in GCP machines
* Fix VUID-vkCmdPipelineBarrier-pBufferMemoryBarriers-02818
dstAcessMask can't include VK_ACCESS_TRANSFER_READ_BIT when stage mask
has VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR
* Set failed retry limit to 32
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Fix intermittent failure of slang-unit-test-tool/ReplayRecord
Three problems are addressed:
1. the graphics driver sometimes returns nullptr from GetShaderIdentifier
2. `findRecordFileName()` may not find any records at all.
3. the return value from cleanupRecordFiles() overwrote the error value
in `res` and it returned SLANG_OK even when there were errors.
* Fix compiler warnings on Windows
|
| |
|
|
|
| |
* Fix comment typos in the triangle's main.cpp example
* 2nd fix
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Expose value of constant integers in module reflection
This commit adds `VariableReflection::getDefaultValueInt` to get the value of a variable if it is a compile-time constant integer.
TODO: currently it works only if the initializer expression is an integer literal, references to other constant values are not handled.
* Update VarDecl folded constant value during DeclBodyVisitor
Constant folding for integer values is already done internally by _validateCircularVarDefinition, this just reuses the result.
* Address review comments & formatting
* Formatting
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
| |
* Fix native Windows ARM64 build.
* Fix
---------
Co-authored-by: Yong He <yongh@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add an example for reflection of parameter blocks
The example loads a shader program, compiles it for Vulkan, and then uses reflection information to set up descriptor set layouts and a pipeline layout.
It then validates that the pipeline layout that is created is compatible with the compiled code, by using them together to make a pipeline state object with the validation layer enabled.
The basic flow of the application follows the presentation in the companion article, and references its sections.
This is example could be expanded in a few ways:
* A D3D12 path could be added, to show the comparable operations for creating a root signature from reflection data
* The existing shader could be modified to touch/use more of its parameter data, to help ensure that any errors would be caught by the validation layer
* The set of shader files/modules that get loaded automatically could be expanded, to test more cases
* The code could be expanded to handle more than just compute shaders, by allowing for multiple-entry-point files to be loaded for rasterization or ray-tracing pipelines
* format code
* fixup: build errors
* format code
* fixups for build
* fixup
* fixup
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
| |
This closes #5656.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 a basic WebGPU example
This helps to address #5656.
* Use serial await rather than Promise.all
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add an example for using the reflection API
The example program is meant to accompany a document that goes into more detail about the mental model behind the reflection API and the way this program drives it.
Ideally this program can land before the document goes live, and then the document can be published with a link to the example.
After that, the example could be updated to include links into the live document.
Along with adding the example program, this change also adds some convenience functions to the reflection API to avoid cases where the program would otherwise need to cast between
`slang::ParameterCategory` and `SlangParameterCategory`.
* format code
* fixup: error noticed by clang
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
| |
Avoid mixing the variadic template argument and pass-through it with std::forward
|
| | |
|
| |
|
|
|
|
|
|
| |
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
* format
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CompilerOptionName::EmitSpirvViaGLSL and CompilerOptionName::EmitSpirvDirectly
options are not mutually exclusive, but due to compatible reason, we
cannot delete those options. Instead, this change makes the effort to
create a new option name EmitSpirvMethod, and we will turn those two
options into the new one internally. Also, we put a priority implicitly
on those two options, where EmitSpirvDirectly always win if it's set.
We have another location that can setup the same option, where is
through SlangTargetFlags::SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY.
We should definitely deprecate this flag to avoid more confusing.
But for the same compatible reason, we cannot do that in this PR.
Again, we will encourage people to not use this flag, but using the
CompilerOptionName instead. In this PR, we will also implicitly give
CompilerOptionName higher priority, it means that as long as user setup
the CompilerOptionName for emit spirv method, it always take higher
priority for the final decision.
|
| |
|
|
|
|
|
| |
* format
* Minor test fixes
* enable checking cpp format in ci
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Clang-format excludes
* Add .clang-format
* Don't clang-format in external
* Missing includes and forward declarations
* Replace wonky include-once macro name
* neaten include naming
* Add clang-format to formatting script
* Add xargs and diff to required binaries
* add clang-format to ci formatting check
* Add max version check to formatting script
* temporarily disable checking formatting for cpp files
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Split examples cmake desc
* declutter top level CMakeLists.txt
* fail if building tests without gfx
* Move llvm fetching to another cmake file
* Further split CMakeLists.txt
* Neaten llvm fetching
* Remove last premake remnant
* correct cross builds
* Neaten
* Neaten project organization in vs
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Squash redundant move warnings
* Move C interface from slang.h to slang-deprecated.h
spGetBuildTagString remains, because it's useful to have before the
global session exists.
This C API is used quite pervasively in the C++ helpers (for example
slang::UserAttribute. It's not trivial to move these to
slang-deprecated.h as they're entangled with some enums which are
themselves used elsewhere in the compiler.
The fact that these helpers use the C API can be viewed as an
implementation detail for now, and this usage moved to slang-deprecated
in due course.
Closes https://github.com/shader-slang/slang/issues/4758
* Squash warnings for our usage of our deprecated API
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Refactor the IComponentType recording
Refactor the `IComponentType` recording by creating a abstract class
`IComponentTypeRecorder` to record all the methods of `IComponentType`,
so that `ICompositeComponentType`, `IModule`, 'IEntryPoint',
'ITypeConformance' can share the same recording implementation.
Capture the out IComponentType from
linkWithOptions()
link()
specialize()
renameEntryPoint()
* fix bugs
* Finish the unimeplemented functions in json consumer
Fix the address print to use 64 bit hex.
Fix the reference count issue when allocating new recorder object.
* Disable few examples using reflection APIs
* Add gpu-printing example into slang-test
* Replace of using std::unique_ptr with RefPtr
|
| |
|
|
|
|
|
|
|
| |
* Convert 'ray-tracing-pipeline' example into slang-test
* Convert model-view and 'autodiff-texture' examples to slang-test
* Add more error message in RecordReplay test
* Fix a shader issue in autodiff-texture
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix the slang-test bug
Since we reorganize the build directory, now the libraries are
located at different directory with executables in non-Windows
platform, we have to change the code on how to find the dll directory.
* Integrate the record/replay test into slang-unit-test
We create a unit-test-record-replay.cpp to run the converted slang
examples in child process as our tests for the record-replay layer.
* Disable the test on Apple
Due to the limitation of current examples, we temporarily disable them
on apples.
Change the ci to make this test only be run on the gpu-equipped runners,
for other runners we add a white-list file
"expected-failure-record-replay-tests.txt".
* Remove 'hello-world' example from unit test
"hello-world" doesn't use gfx abstract library, instead it uses vk directly, it's
not a preferable way. So we will drop this test, instead, we will use cpu-hello-world
example.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
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
|
| | |
|
| |
|
|
|
|
| |
* Improve doc and example consistency
Improve consistency of formatting in example shaders and remove
trailing spaces in documentation files. Fix minor typos.
|
| |
|
|
| |
Changed profile string from glsl_440 to spirv_1_5 per request in
pr#4268.
|
| |
|
|
|
|
|
| |
This CL fixes a typo in the profile string for the hello-world example.
Currently "glsl440" is passed into findProfile() resulting in a return
value of SLANG_UNKNOWN_PROFILE since format of the profile name is
incorrect. The correct profile name is glsl_440, therefore the string
passed into findProfile() should be "glsl_440".
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 slangc interface to compile and use ir modules.
* Fix glsl scalar layout settings not copied to target.
* Fix.
* Cleanups.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Support visibility control and default to `internal`.
* Fix wip.
* Fixes.
* Fix.
* Fix test.
* Add legacy language detection and compatibility for existing code.
* Add doc.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
| |
(#3288)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Use direct spirv in hello-world example.
* Use vulkan 1.1
* Use vulkan 1.2.
* fix.
* Fix test.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Small fixes and improvements around reflection tool.
* Make PrettyWriter printing a class.
* Aftermath crash demo WIP.
* Enable aftermath in test project.
* Setting failCount.
* Dumping out of source maps.
* Improve comments.
Simplify handling of compile products.
* Other small fixes to aftermath example.
* Added Emit SourceLocType.
Track sourcemap association meaning.
Improved documentation.
* Small improvements.
* Capture debug information for D3D11/D3D12/Vulkan.
* Enable debug info.
* Small improvements.
* Improve aftermath example README.md.
|