├── tools ├── gfx │ ├── d3d │ │ └── d3d-swapchain.cpp │ ├── cuda │ │ └── render-cuda.h │ ├── cpu │ │ └── render-cpu.h │ ├── open-gl │ │ └── render-gl.h │ ├── d3d11 │ │ └── render-d3d11.h │ ├── d3d12 │ │ └── render-d3d12.h │ └── vulkan │ │ └── render-vk.h ├── render-test │ ├── test.txt │ ├── README.md │ └── png-serialize-util.h ├── slang-generate │ └── README.md └── slang-cpp-extractor │ ├── unit-test.h │ └── diagnostics.cpp ├── docs ├── _config.yml ├── language-reference │ ├── 01-introduction.md │ ├── 08-attributes.md │ └── 03-preprocessor.md ├── gfx-user-guide │ └── nav.html └── user-guide │ └── nav.html ├── tests ├── compute │ ├── column-major.slang.expected.txt │ ├── int-generic.slang.expected.txt │ ├── generic-list.slang.expected.txt │ ├── global-type-param.slang.expected.txt │ ├── texture-sampling.slang.expected.txt │ ├── array-param.slang.expected.txt │ ├── compile-time-loop.slang.expected.txt │ ├── constexpr.slang.1.expected.txt │ ├── constexpr.slang.expected.txt │ ├── inout.slang.expected.txt │ ├── type-param-varying.slang.expected.txt │ ├── array-param.slang.1.expected.txt │ ├── discard-stmt.slang.expected.txt │ ├── empty-struct2.slang.expected.txt │ ├── enum.slang.expected.txt │ ├── frem.slang.expected.txt │ ├── generic-closer.slang.expected.txt │ ├── global-type-param1.slang.expected.txt │ ├── global-type-param2.slang.expected.txt │ ├── groupshared.slang.expected.txt │ ├── loop-unroll.slang.expected.txt │ ├── nested-generics.slang.expected.txt │ ├── nested-generics2.slang.expected.txt │ ├── struct-make.slang.expected.txt │ ├── assoctype-complex.slang.expected.txt │ ├── assoctype-nested.slang.expected.txt │ ├── atomics.slang.expected.txt │ ├── comma-operator.slang.expected.txt │ ├── enum-conversion2.slang.expected.txt │ ├── frem.slang.2.expected.txt │ ├── generic-struct-with-constraint.slang.expected.txt │ ├── global-init.slang.expected.txt │ ├── global-type-param-array.slang.expected.txt │ ├── interface-local.slang.expected.txt │ ├── interface-param.slang.expected.txt │ ├── parameter-block.slang.expected.txt │ ├── pointer-emit.slang.expected.txt │ ├── tagged-union.slang.expected.txt │ ├── texture-sample-grad-offset-clamp.slang.expected.txt │ ├── this-type.slang.expected.txt │ ├── assoctype-lookup.slang.expected.txt │ ├── atomics-buffer.slang.expected.txt │ ├── byte-address-buffer.slang.expected.txt │ ├── dynamic-dispatch-1.slang.expected.txt │ ├── dynamic-dispatch-10.slang.expected.txt │ ├── dynamic-dispatch-11.slang.expected.txt │ ├── dynamic-dispatch-12.slang.expected.txt │ ├── dynamic-dispatch-13.slang.expected.txt │ ├── dynamic-dispatch-14.slang.expected.txt │ ├── dynamic-dispatch-15.slang.expected.txt │ ├── dynamic-dispatch-16.slang.expected.txt │ ├── dynamic-dispatch-17.slang.expected.txt │ ├── dynamic-dispatch-2.slang.expected.txt │ ├── dynamic-dispatch-3.slang.expected.txt │ ├── dynamic-dispatch-4.slang.expected.txt │ ├── dynamic-dispatch-5.slang.expected.txt │ ├── dynamic-dispatch-6.slang.expected.txt │ ├── dynamic-dispatch-7.slang.expected.txt │ ├── dynamic-dispatch-8.slang.expected.txt │ ├── dynamic-dispatch-9.slang.expected.txt │ ├── dynamic-generics-simple.slang.expected.txt │ ├── generic-struct.slang.expected.txt │ ├── implicit-generic-app.slang.expected.txt │ ├── initializer-list.slang.expected.txt │ ├── modern-syntax.slang.expected.txt │ ├── mutating-methods.slang.expected.txt │ ├── ray-tracing-inline.slang.expected.txt │ ├── scope-operator.slang.expected.txt │ ├── static-const-array.slang.expected.txt │ ├── tagged-union.slang.2.expected.txt │ ├── transitive-interface.slang.expected.txt │ ├── atomics-groupshared.slang.expected.txt │ ├── cast-zero-to-struct.slang.expected.txt │ ├── default-initializer.slang.expected.txt │ ├── default-parameter.slang.expected.txt │ ├── enum-tag-conversion.slang.expected.txt │ ├── func-cbuffer-param.slang.expected.txt │ ├── func-resource-param.slang.expected.txt │ ├── interface-assoc-type-param.slang.expected.txt │ ├── interface-shader-param.slang.expected.txt │ ├── interface-shader-param2.slang.expected.txt │ ├── mutating-and-inout.slang.expected.txt │ ├── select-expr.slang.expected.txt │ ├── simple.slang.expected.txt │ ├── array-existential-parameter.slang.expected.txt │ ├── break-stmt.slang.expected.txt │ ├── default-parameter.slang.1.expected.txt │ ├── generics-simple.slang.expected.txt │ ├── generics-syntax.slang.expected.txt │ ├── half-calc.slang.expected.txt │ ├── init-list-defaults.slang.expected.txt │ ├── interface-func-param-in-struct.slang.expected.txt │ ├── interface-static-method.slang.expected.txt │ ├── multiple-continue-sites.slang.expected.txt │ ├── struct-default-init.slang.expected.txt │ ├── structured-buffer-of-matrices.slang.expected.txt │ ├── typedef-member.slang.expected.txt │ ├── user-defined-initializer.slang.expected.txt │ ├── assoctype-func-param.slang.expected.txt │ ├── buffer-type-splitting.slang.expected.txt │ ├── continue-stmt.slang.expected.txt │ ├── dump-repro.slang.2.expected.txt │ ├── dynamic-dispatch-bindless-texture.slang.expected.txt │ ├── empty-struct.slang.expected.txt │ ├── generics-overload.slang.expected.txt │ ├── generics-syntax-2.slang.expected.txt │ ├── interface-param-partial-specialize.slang.expected.txt │ ├── pack-any-value-16bit.slang.expected.txt │ ├── buffer-layout.slang.expected.txt │ ├── entry-point-uniform-params.slang.expected.txt │ ├── explicit-this-expr.slang.expected.txt │ ├── generics-constrained.slang.expected.txt │ ├── half-opaque-convert.slang.expected.txt │ ├── implicit-this-expr.slang.expected.txt │ ├── interface-shader-param3.slang.expected.txt │ ├── interface-shader-param4.slang.expected.txt │ ├── multi-interface.slang.expected.txt │ ├── non-square-row-major.slang.expected.txt │ ├── rewriter-parameter-block.hlsl.expected.txt │ ├── ssa-reduce-bug.slang.expected.txt │ ├── struct-in-generic.slang.expected.txt │ ├── switch-stmt.slang.expected.txt │ ├── type-legalize-global-with-init.slang.expected.txt │ ├── assoctype-generic-arg.slang.expected.txt │ ├── assoctype-simple.slang.expected.txt │ ├── buffer-layout.slang.1.expected.txt │ ├── buffer-layout.slang.2.expected.txt │ ├── buffer-layout.slang.3.expected.txt │ ├── buffer-layout.slang.4.expected.txt │ ├── cbuffer-legalize.slang.expected.txt │ ├── interface-shader-param-legalization.slang.expected.txt │ ├── non-square-column-major.slang.expected.txt │ ├── rewriter-parameter-block-complex.hlsl.expected.txt │ ├── extension-multi-interface.slang.expected.txt │ ├── extension-on-interface.slang.expected.txt │ ├── func-param-legalize.slang.expected.txt │ ├── generics-constructor.slang.expected.txt │ ├── half-texture-simple.slang.expected.txt │ ├── interface-shader-param-in-struct.slang.expected.txt │ ├── unbounded-array-of-array.slang.expected.txt │ ├── generic-interface-method-simple.slang.expected.txt │ ├── generic-interface-method.slang.expected.txt │ ├── global-type-param-in-entrypoint.slang.expected.txt │ ├── row-major.slang.expected.txt │ ├── default-major.slang.expected.txt │ ├── texture-simple.slang.expected.txt │ ├── unbounded-array-of-array-syntax.slang.expected.txt │ ├── half-rw-texture-simple.slang.expected.txt │ ├── rw-texture-simple.slang.expected.txt │ ├── half-rw-texture-convert.slang.expected.txt │ ├── half-vector-calc.slang.expected.txt │ ├── half-vector-compare.slang.expected.txt │ ├── half-rw-texture-convert2.slang.expected.txt │ ├── semantic.slang.expected.txt │ ├── texture-get-dimensions.slang.expected.txt │ ├── vector-scalar-compare.slang.expected.txt │ ├── transcendental.slang.expected.txt │ ├── global-generic-value-param.slang.expected.txt │ ├── static-const-vector-array.slang.expected.txt │ ├── transcendental-double.slang.expected.txt │ ├── static-const-matrix-array.slang.expected.txt │ ├── matrix-layout.hlsl.expected.txt │ ├── matrix-layout-structured-buffer.slang.2.expected.txt │ ├── matrix-layout-structured-buffer.slang.expected.txt │ ├── matrix-layout-structured-buffer.slang.1.expected.txt │ ├── matrix-layout-structured-buffer.slang.3.expected.txt │ ├── half-structured-buffer.slang.expected.txt │ ├── kernel-context-threading.slang.expected.txt │ └── write-structured-buffer-field.slang.expected.txt ├── diagnostics │ ├── local-line.slang.expected │ ├── syntax-error-intrinsic.slang.expected │ ├── syntax-error-op-line-2.slang.expected │ ├── syntax-error-op-line-3.slang.expected │ ├── syntax-error-op-line.slang.expected │ ├── illegal-character.slang │ ├── missing-file.slang.disabled │ ├── command-line │ │ ├── unknown-option.slang │ │ ├── unknown-stage.slang │ │ ├── duplicate-target.slang │ │ ├── unknown-codegen-target.slang │ │ ├── unknown-output-format.slang │ │ ├── unknown-profile.slang │ │ ├── explicit-implicit-stage-mismatch.vert │ │ ├── unknown-pass-through-target.slang │ │ ├── unknown-line-directive-mode.slang │ │ ├── duplicate-output.slang │ │ ├── output-no-target.slang │ │ ├── x-arg-tool-unknown.slang │ │ ├── output-no-entry-point.slang │ │ ├── duplicate-target.slang.expected │ │ ├── unknown-source-language.slang │ │ ├── unknown-source-language.slang.expected │ │ ├── option-missing-argument.slang.1.expected │ │ ├── unknown-output-format.slang.expected │ │ ├── duplicate-output.slang.expected │ │ ├── entry-point-conflicting-stage.slang.expected │ │ ├── profile-ignored.slang.expected │ │ ├── entry-point-conflicting-stage.slang.1.expected │ │ ├── entry-point-redundant-stage.slang │ │ ├── entry-point-conflicting-stage.slang │ │ ├── profile-ignored.slang.1.expected │ │ ├── option-missing-argument.slang │ │ ├── output-no-target.slang.expected │ │ ├── stage-ignored.slang.expected │ │ ├── pass-through-no-stage.hlsl.expected │ │ ├── unknown-stage.slang.expected │ │ ├── output-no-entry-point.slang.expected │ │ ├── unknown-option.slang.expected │ │ ├── unknown-profile.slang.expected │ │ ├── unknown-codegen-target.slang.expected │ │ ├── pass-through-no-stage.hlsl │ │ ├── option-missing-argument.slang.expected │ │ ├── entry-point-redundant-stage.slang.expected │ │ ├── explicit-implicit-stage-mismatch.vert.expected │ │ ├── unknown-pass-through-target.slang.expected │ │ ├── entry-point-redundant-stage.slang.1.expected │ │ ├── unknown-line-directive-mode.slang.expected │ │ └── stage-ignored.slang │ ├── expected-token-eof.slang │ ├── continue-outside-loop.slang │ ├── variable-void-type.slang │ ├── expected-token.slang │ ├── missing-include-file.slang │ ├── parameter-already-defined.slang │ ├── undefined-identifier.slang │ ├── function-redefinition.slang.disabled │ ├── token-line-continuation.slang │ ├── recursive-import-extra.slang │ ├── break-outside-loop.slang │ ├── static-ref-to-nonstatic-member.slang │ ├── extension-visibility-b.slang │ ├── while-predicate-type.slang │ ├── recursive-import.slang │ ├── illegal-character.slang.expected │ ├── expected-token-eof.slang.expected │ ├── single-shader-record.slang.expected │ ├── function-redefinition.slang.expected │ ├── call-argument-type.slang │ ├── extension-visibility-c.slang │ ├── packoffset.slang │ ├── hull-shader-no-domain.slang.expected │ ├── interface-requirement-not-satisfied.slang │ ├── variable-void-type.slang.expected │ ├── unreachable-code.slang.expected │ ├── expected-token.slang.expected │ ├── gh-38-fs.hlsl │ ├── hull-shader-invalid-domain.slang.expected │ ├── undefined-identifier.slang.expected │ ├── unreachable-code.slang │ ├── call-argument-type.slang.expected │ ├── missing-semicolon-after-semantic.slang.expected │ ├── token-paste-location.slang │ ├── break-outside-loop.slang.expected │ ├── entry-point-no-stage.slang │ ├── while-predicate-type.slang.expected │ ├── token-line-continuation.slang.expected │ ├── undefined-in-preprocessor-conditional.slang │ ├── x-macro-line-continuation.slang.expected │ ├── continue-outside-loop.slang.expected │ ├── local-used-before-declared.slang.expected │ ├── missing-semicolon-after-semantic.slang │ ├── packoffset.slang.expected │ ├── missing-include-file.slang.expected │ ├── token-paste-location.slang.expected │ ├── local-used-in-own-declaration.slang.expected │ ├── missing-file.slang.expected │ ├── implicit-cast-lvalue.slang │ ├── extension-visibility-a.slang │ ├── static-ref-to-nonstatic-member.slang.expected │ ├── call-instance-from-static.slang.expected │ ├── entry-point-stage-mismatch.slang │ ├── interfaces │ │ └── anyvalue-size-validation.slang.expected │ ├── undefined-in-preprocessor-conditional.slang.expected │ ├── entry-point-stage-mismatch.slang.expected │ ├── accessors.slang │ ├── entry-point-no-stage.slang.expected │ ├── single-target-intrinsic.slang.expected │ ├── overlapping-bindings.slang.expected │ ├── single-target-intrinsic.slang │ ├── gh-38-vs.hlsl │ ├── gh-38-vs.hlsl.expected │ ├── x-macro-line-continuation.slang │ ├── extension-visibility.slang.expected │ ├── interface-requirement-not-satisfied.slang.expected │ ├── void-function-returning-value.slang.expected │ ├── parameter-already-defined.slang.expected │ ├── global-uniform.slang │ ├── missing-return.slang.expected │ └── vk-bindings.slang ├── front-end │ ├── parser-empty.slang │ ├── parser-error-unclosed-curly.slang │ ├── subdir │ │ └── import-subdir-a.slang │ ├── parser-using-file-a.slang.h │ ├── import-exported-a.slang │ ├── import-exported-b.slang │ ├── parser-using-file.spire.disabled │ ├── import-subdir.slang │ ├── parser-error-unclosed-curly.slang.expected │ ├── typedef.slang │ ├── import-exported.slang │ ├── lexer-comments.slang │ └── import-subdir-search-path.slang ├── bugs │ ├── bool-init.slang.expected.txt │ ├── gh-471.slang.expected.txt │ ├── gh-487.slang.expected.txt │ ├── gh-518.slang.expected.txt │ ├── gh-519.slang.expected.txt │ ├── gh-569.slang.expected.txt │ ├── gl-33.slang.expected.txt │ ├── empty-switch.slang.expected.txt │ ├── gh-566.slang.expected.txt │ ├── ssa-loop.slang.expected.txt │ ├── static-var.slang.expected.txt │ ├── token-limit.slang.expected.txt │ ├── while-in-generic.slang.expected.txt │ ├── gh-775.slang.expected.txt │ ├── glsl-static-const-array.slang.expected.txt │ ├── paren-insertion-bug.slang.expected.txt │ ├── static-method.slang.expected.txt │ ├── gh-357.slang.expected.txt │ ├── obfuscate-specialization-naming.slang.expected.txt │ ├── vec-init.slang.expected.txt │ ├── negative-literal.slang.expected.txt │ ├── rwstructuredbuffer-existential-in-struct.slang.expected.txt │ ├── specialize-function-array-args.slang.expected.txt │ ├── mutating │ │ └── mutating-generic-method.slang.expected.txt │ ├── nested-generics-call.slang.expected.txt │ ├── nested-generics-method-call.slang.expected.txt │ ├── import-overload-error.slang │ ├── preproc-lex-failure.slang.expected │ ├── empty.slang │ ├── bool-op.slang.expected.txt │ ├── gl-33-ext.slang │ ├── dxbc-double-problem.slang.expected.txt │ ├── gh-75.hlsl.expected │ ├── gh-463.slang.expected │ ├── preproc-lex-failure.slang │ ├── glsl-layout-define.hlsl │ ├── split-nested-types.slang │ ├── gh-666.slang │ ├── preproc-lex-failure-2.slang │ ├── gh-463.slang │ ├── import-with-error.slang │ ├── vec-compare.slang.expected.txt │ ├── eroneous-generic-parse.slang.expected │ ├── glsl-vk-binding-define.hlsl │ ├── import-with-error-extra.slang │ ├── cbuffer-member-init.hlsl │ ├── ray-flags-non-constant.slang.expected │ ├── texture2d-ms.hlsl │ ├── vk-structured-buffer-binding.hlsl │ ├── vk-image-atomics.slang │ ├── vk-image-atomics.slang.glsl │ ├── preproc-lex-failure-2.slang.expected │ ├── gh-449.slang.expected │ ├── gh-941.slang │ ├── gh-133.slang │ ├── keyword-undefined-identifier.slang.expected │ └── array-size-static-const.hlsl ├── cpp-compiler │ ├── c-compile-error.c.expected │ ├── c-compile-link-error.c.expected │ ├── c-compile-shared-library-link-error.c.expected │ ├── c-compile.c.expected │ ├── cpp-compile.cpp.expected │ ├── simple-c-compile.c.expected │ ├── c-compile.c │ ├── cpp-compile.cpp │ ├── simple-c-compile.c │ ├── c-compile-error.c │ └── c-compile-link-error.c ├── downstream │ └── dxc-x-arg.slang.expected.txt ├── hlsl-intrinsic │ ├── wave-mask │ │ ├── wave-active-product.slang.expected.txt │ │ ├── wave-diverge.slang.expected.txt │ │ ├── wave-shuffle.slang.expected.txt │ │ ├── wave-equality.slang.expected.txt │ │ ├── wave-shuffle-vk.slang.expected.txt │ │ ├── wave-read-lane-at-vk.slang.expected.txt │ │ ├── wave-read-lane-at.slang.expected.txt │ │ ├── wave-broadcast-lane-at-vk.slang.expected.txt │ │ ├── wave-broadcast-lane-at.slang.expected.txt │ │ ├── wave-get-active.slang.expected.txt │ │ ├── wave-get-converged.slang.expected.txt │ │ ├── wave-mask-prefix.slang.expected.txt │ │ ├── wave-vector.slang.expected.txt │ │ ├── wave-matrix.slang.expected.txt │ │ ├── wave-prefix-sum.slang.expected.txt │ │ ├── wave-prefix-product.slang.expected.txt │ │ ├── wave.slang.expected.txt │ │ └── wave-is-first-lane.slang.expected.txt │ ├── classify-float.slang.expected.txt │ ├── scalar-int.slang.expected.txt │ ├── scalar-uint.slang.expected.txt │ ├── vector-int.slang.expected.txt │ ├── wave-diverge.slang.expected.txt │ ├── wave-shuffle.slang.expected.txt │ ├── bit-cast-double.slang.expected.txt │ ├── classify-double.slang.expected.txt │ ├── matrix-int.slang.expected.txt │ ├── wave-equality.slang.expected.txt │ ├── wave-shuffle-vk.slang.expected.txt │ ├── wave.slang.expected.txt │ ├── wave-read-lane-at-vk.slang.expected.txt │ ├── wave-read-lane-at.slang.expected.txt │ ├── literal-float.slang.expected.txt │ ├── vector-int-runtime-index.slang.expected.txt │ ├── wave-broadcast-lane-at-vk.slang.expected.txt │ ├── wave-broadcast-lane-at.slang.expected.txt │ ├── wave-get-lane-index.slang.expected.txt │ ├── matrix-int-runtime-index.slang.expected.txt │ ├── scalar-double.slang.expected.txt │ ├── scalar-float.slang.expected.txt │ ├── scalar-int64.slang.expected.txt │ ├── scalar-uint64.slang.expected.txt │ ├── wave-multi-prefix.slang.expected.txt │ ├── wave-vector.slang.expected.txt │ ├── wave-active-count-bits.slang.expected.txt │ ├── wave-prefix-count-bits.slang.expected.txt │ ├── byte-address-buffer │ │ ├── byte-address-16bit.slang.expected.txt │ │ ├── byte-address-struct.slang.expected.txt │ │ └── byte-address-16bit-vector.slang.expected.txt │ ├── wave-matrix.slang.expected.txt │ ├── bit-cast.slang.expected.txt │ ├── matrix-double.slang.expected.txt │ ├── matrix-float.slang.expected.txt │ ├── scalar-double-d3d-intrinsic.slang.expected.txt │ ├── wave-prefix-sum.slang.expected.txt │ ├── matrix-double-reduced-intrinsic.slang.expected.txt │ ├── scalar-double-simple.slang.expected.txt │ ├── scalar-double-vk-intrinsic.slang.expected.txt │ ├── wave-prefix-product.slang.expected.txt │ ├── active-mask │ │ ├── if-one-sided.slang.expected.txt │ │ ├── if.slang.expected.txt │ │ ├── if-early-exit.slang.expected.txt │ │ ├── if-conditional-exit.slang.expected.txt │ │ ├── for.slang.expected.txt │ │ ├── switch.slang.expected.txt │ │ ├── switch-no-default.slang.expected.txt │ │ └── switch-trivial-fallthrough.slang.expected.txt │ ├── bit-cast │ │ └── bit-cast-16-bit.slang.expected.txt │ ├── wave-is-first-lane.slang.expected.txt │ ├── wave-active-product.slang.expected.txt │ ├── literal-int64.slang.expected.txt │ ├── vector-double-reduced-intrinsic.slang.expected.txt │ ├── vector-float.slang.expected.txt │ └── texture │ │ └── gather-texture2darray.slang.hlsl ├── spirv │ ├── direct-spirv-compute-simple.slang.expected.txt │ ├── direct-spirv-control-flow.slang.expected.txt │ ├── direct-spirv-control-flow-2.slang.expected.txt │ ├── spirv-version-option.slang.glsl │ └── direct-spirv-emit.slang ├── cross-compile │ ├── fmod.slang.expected.txt │ ├── glsl-bool-ops.slang.expected.txt │ ├── get-dimensions.slang.expected.txt │ ├── simple-cross-compile.slang.expected.txt │ ├── sign.slang.hlsl │ ├── glsl-samplecmp.slang │ ├── glslang-error.glsl │ ├── barycentrics.slang │ ├── fxc-error.hlsl.expected │ ├── early-depth-stencil.hlsl.hlsl │ ├── barycentrics.slang.glsl │ ├── half-conversion.slang │ ├── glslang-error.glsl.expected │ ├── integer-input.slang │ ├── early-depth-stencil.hlsl │ ├── dxc-error.hlsl.expected │ ├── nointerpolation-input.slang │ ├── gl-layer-pick-version.slang │ ├── glsl-empty-struct-param-field.slang │ ├── sv-coverage.slang.glsl │ ├── c-simple.slang │ ├── early-depth-stencil.hlsl.glsl │ ├── matrix-mult.slang │ ├── sv-coverage.slang │ ├── rw-buffer.slang │ ├── fxc-error.hlsl │ ├── precise-keyword.slang.hlsl │ ├── dxc-error.hlsl │ ├── sign.slang │ └── sign.slang.glsl ├── serialization │ ├── extern │ │ ├── extern-test.slang.expected.txt │ │ ├── module-a.slang │ │ └── module-b.slang │ ├── serialized-module-test.slang.expected.txt │ ├── serialized-module-entry-point-test.slang.expected.txt │ ├── std-lib-serialize.slang.expected.txt │ ├── library-entry-point │ │ └── library-entry-point-test.slang.expected.txt │ └── serialized-module.slang ├── language-feature │ ├── bit-cast │ │ └── struct-bit-cast.slang.expected.txt │ ├── enums │ │ ├── explicit-tag-type.slang.expected.txt │ │ ├── nested-enum.slang.expected.txt │ │ ├── enum-equality.slang.expected.txt │ │ └── enum-tag-type-compare.slang.expected.txt │ ├── namespaces │ │ ├── using-namespace.slang.expected.txt │ │ └── simple-namespace.slang.expected.txt │ ├── swizzles │ │ └── matrix-swizzles.slang.expected.txt │ ├── extensions │ │ ├── interface-extension.slang.expected.txt │ │ ├── extension-import-helper.slang │ │ └── extension-import.slang │ ├── properties │ │ ├── property-decl.slang.expected.txt │ │ └── property-in-interface.slang.expected.txt │ ├── types │ │ └── opaque │ │ │ ├── return-opaque-type.slang.expected.txt │ │ │ ├── out-param-opaque-type.slang.expected.txt │ │ │ ├── inout-param-opaque-type.slang.expected.txt │ │ │ ├── return-opaque-type-in-struct.slang.expected.txt │ │ │ ├── out-param-opaque-type-in-struct.slang.expected.txt │ │ │ └── inout-param-opaque-type-in-struct.slang.expected.txt │ ├── constants │ │ └── static-const-in-struct.slang.expected.txt │ ├── generics │ │ └── struct-generic-value-param.slang.expected.txt │ ├── inheritance │ │ ├── struct-inheritance.slang.expected.txt │ │ ├── struct-inheritance-import.slang.expected.txt │ │ ├── derived-struct-init-list.slang.expected.txt │ │ ├── struct-inherit-interface-requirement.slang.expected.txt │ │ └── struct-inheritance-imported.slang │ ├── interfaces │ │ └── interface-conjunction.slang.expected.txt │ ├── parameters │ │ └── generic-func-param-default-arg.slang.expected.txt │ ├── shader-params │ │ ├── global-uniform-params.slang.expected.txt │ │ ├── entry-point-uniform-params.slang.expected.txt │ │ └── interface-shader-param-ordinary.slang.expected.txt │ ├── initializer-lists │ │ └── default-init-16bit-types.slang.expected.txt │ └── modules │ │ └── error-in-nested-import │ │ ├── c.slang │ │ ├── a.slang │ │ ├── b.slang │ │ └── error-in-nested-import.slang ├── preprocessor │ ├── include-a.slang.h │ ├── pragma-once-b.h │ ├── bugs │ │ └── pp-bug-1.slang.expected │ ├── include │ │ ├── include-pragma-once-c.h │ │ ├── special-macro-include.h │ │ └── pragma-once-c.h │ ├── preproc-detail-1.slang.expected │ ├── preproc-expand-1.slang.expected │ ├── preproc-concat-1.slang.expected │ ├── preproc-concat-5.slang.expected │ ├── preproc-pound-pound-2.slang.expected │ ├── preproc-concat-2.slang.expected │ ├── preproc-stringify-1.slang.expected │ ├── macros │ │ ├── macro-parens-from-expansion.slang.expected │ │ └── variadic-macro.slang.expected │ ├── special-macro-multi-line.slang.expected │ ├── special-macro-simple.slang │ ├── paste-non-expansion.slang.expected │ ├── pragma-once-a.h │ ├── preproc-concat-4.slang.expected │ ├── include.slang │ ├── special-macro-complex.slang.expected │ ├── special-macro-include.slang │ ├── preproc-detail-2.slang │ ├── special-macro-simple.slang.expected │ ├── error.slang │ ├── file-identity │ │ ├── b.h │ │ ├── c.h │ │ └── sub-folder │ │ │ └── file-identity.slang │ ├── preproc-pound-pound-2.slang │ ├── undef.slang.expected │ ├── error.slang.expected │ ├── special-macro-redefine-object.slang │ ├── preproc-concat-1.slang │ ├── special-macro-include.slang.expected │ ├── preproc-stringify-1.slang │ ├── define-redefine.slang │ ├── preproc-detail-3.slang.expected │ ├── warning.slang │ ├── special-macro-redefine-function.slang │ ├── include-multiple.slang │ ├── define-simple.slang │ ├── special-macro-multi-line.slang │ ├── warning.slang.expected │ ├── preproc-detail-2.slang.expected │ ├── if.slang │ ├── ifdef.slang │ ├── preproc-concat-2.slang │ ├── x-macro.slang │ ├── preproc-detail-1.slang │ ├── output-includes.slang │ ├── preproc-pound-pound-1.slang.expected │ ├── special-macro-redefine-object.slang.expected │ ├── define-redefine.slang.expected │ ├── preproc-pound-pound-1.slang │ ├── special-macro-redefine-function.slang.expected │ ├── line.slang │ ├── preproc-concat-3.slang.expected │ ├── preproc-detail-3.slang │ ├── repeated-macro-expansion.slang │ ├── include-search-path.slang │ ├── define-function-like.slang.expected │ ├── if-ignore.slang │ ├── preproc-concat-3.slang │ └── if-macro-token-paste.slang ├── cuda │ ├── cuda-texture.slang.expected.txt │ ├── cuda-array-layout.slang.expected.txt │ ├── compile-to-cuda.slang.expected.txt │ ├── cuda-compile.cu │ └── cuda-layout.slang.expected.txt ├── pipeline │ ├── ray-tracing │ │ ├── raygen.slang.expected.txt │ │ └── raygen.slang │ ├── compute │ │ └── compute-system-values.slang.expected.txt │ └── rasterization │ │ └── conservative-rasterization │ │ ├── inner-coverage.slang │ │ └── inner-coverage.slang.glsl ├── ir │ ├── string-literal-hash.slang.expected.txt │ ├── string-literal-module.slang │ ├── string-literal.slang │ └── factorial.slang.expected ├── type │ └── texture-sampler │ │ └── texture-sampler-2d.slang.expected.txt ├── optimization │ └── func-resource-result │ │ └── func-resource-result-simple.slang.expected.txt ├── slang-extension │ ├── cas-int64-byte-address-buffer.slang.expected.txt │ ├── exchange-int64-byte-address-buffer.slang.expected.txt │ ├── atomic-int64-byte-address-buffer.slang.expected.txt │ ├── atomic-min-max-u64-byte-address-buffer.slang.expected.txt │ └── atomic-float-byte-address-buffer.slang.expected.txt ├── rewriter │ ├── gh-160.slang │ ├── glslang-bug-988-workaround.slang │ ├── type-splitting.slang │ ├── resources-in-structs.slang │ ├── varying-struct.slang │ └── gh-160.hlsl ├── vkray │ ├── callable-shared.slang │ ├── miss.slang │ └── callable.slang ├── current-bugs │ └── missing-loc-on-assignment.slang.expected ├── reflection │ ├── shared-modifier.hlsl │ ├── thread-group-size.hlsl │ ├── explicit-register-space.slang │ ├── reflect-imported-code.slang │ ├── sample-index-input.hlsl │ ├── global-uniforms.hlsl │ ├── sample-rate-input.hlsl │ ├── resource-in-cbuffer.hlsl │ └── reflection0.hlsl ├── bindings │ └── glsl-parameter-blocks.slang ├── parser │ └── incomplete-member-decl.slang.expected ├── doc │ └── doc-req.slang.expected └── hlsl │ └── simple │ └── compute-numthreads.hlsl ├── slang-tag-version.h ├── prelude └── slang-hlsl-prelude.h ├── external ├── vulkan │ ├── .gitignore │ └── CODE_OF_CONDUCT.md └── spirv-tools-generated │ ├── build-version.inc │ ├── spv-amd-shader-explicit-vertex-parameter.insts.inc │ └── spv-amd-gcn-shader.insts.inc ├── .gitattributes ├── premake.bat ├── source ├── slang │ ├── slang-ir-ssa.h │ ├── slang-ir-optix-entry-point-uniforms.h │ ├── slang-value-reflect.cpp │ ├── slang-ir-constexpr.h │ ├── slang-ir-inline.h │ ├── slang-ir-specialize.h │ ├── slang-ir-missing-return.h │ ├── slang-ir-strip-witness-tables.h │ ├── slang-ast-all.h │ ├── slang-ir-explicit-global-init.h │ ├── slang-ir-entry-point-raw-ptr-params.h │ ├── slang-value-reflect.h │ ├── slang-ir-bind-existentials.h │ ├── slang-ir-lower-existential.h │ ├── slang-ir-lower-tuple-types.h │ ├── slang-ir-lower-generic-call.h │ ├── slang-ir-explicit-global-context.h │ └── slang-ir-lower-bit-cast.h └── core │ └── slang-basic.h └── examples ├── hello-world ├── README.md └── hello-world.slang ├── shader-object └── README.md └── heterogeneous-hello-world └── README.md /tools/gfx/d3d/d3d-swapchain.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-tactile -------------------------------------------------------------------------------- /docs/language-reference/01-introduction.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/compute/column-major.slang.expected.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/compute/int-generic.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /tests/compute/generic-list.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 41200000 -------------------------------------------------------------------------------- /tests/diagnostics/local-line.slang.expected: -------------------------------------------------------------------------------- 1 | 39 2 | -------------------------------------------------------------------------------- /tests/front-end/parser-empty.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | -------------------------------------------------------------------------------- /tests/compute/global-type-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/texture-sampling.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40E00000 -------------------------------------------------------------------------------- /slang-tag-version.h: -------------------------------------------------------------------------------- 1 | #define SLANG_TAG_VERSION "unknown" 2 | -------------------------------------------------------------------------------- /tests/bugs/bool-init.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 2 3 | 0 4 | 1 5 | -------------------------------------------------------------------------------- /tests/bugs/gh-471.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 10 3 | 20 4 | 30 5 | -------------------------------------------------------------------------------- /tests/bugs/gh-487.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/bugs/gh-518.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 2 3 | 4 4 | 6 5 | -------------------------------------------------------------------------------- /tests/bugs/gh-519.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | -------------------------------------------------------------------------------- /tests/bugs/gh-569.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 5 3 | 6 4 | 7 5 | -------------------------------------------------------------------------------- /tests/bugs/gl-33.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/compute/array-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 -------------------------------------------------------------------------------- /tests/compute/compile-time-loop.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40A00000 2 | -------------------------------------------------------------------------------- /tests/compute/constexpr.slang.1.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 0 3 | -------------------------------------------------------------------------------- /tests/compute/constexpr.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 0 3 | -------------------------------------------------------------------------------- /tests/compute/inout.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3 3 | 6 4 | 9 5 | -------------------------------------------------------------------------------- /tests/compute/type-param-varying.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 -------------------------------------------------------------------------------- /tests/diagnostics/syntax-error-intrinsic.slang.expected: -------------------------------------------------------------------------------- 1 | 19 2 | -------------------------------------------------------------------------------- /tests/diagnostics/syntax-error-op-line-2.slang.expected: -------------------------------------------------------------------------------- 1 | 21 2 | -------------------------------------------------------------------------------- /tests/diagnostics/syntax-error-op-line-3.slang.expected: -------------------------------------------------------------------------------- 1 | 38 2 | -------------------------------------------------------------------------------- /tests/diagnostics/syntax-error-op-line.slang.expected: -------------------------------------------------------------------------------- 1 | 21 2 | -------------------------------------------------------------------------------- /tests/bugs/empty-switch.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | -------------------------------------------------------------------------------- /tests/bugs/gh-566.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40 2 | 31 3 | 22 4 | 13 5 | -------------------------------------------------------------------------------- /tests/bugs/ssa-loop.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 10 3 | 1 4 | 10 5 | -------------------------------------------------------------------------------- /tests/bugs/static-var.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /tests/bugs/token-limit.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 9 3 | B 4 | 6 5 | -------------------------------------------------------------------------------- /tests/bugs/while-in-generic.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 6 2 | 6 3 | 6 4 | 6 -------------------------------------------------------------------------------- /tests/compute/array-param.slang.1.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 -------------------------------------------------------------------------------- /tests/compute/discard-stmt.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 0 3 | -------------------------------------------------------------------------------- /tests/compute/empty-struct2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 -------------------------------------------------------------------------------- /tests/compute/enum.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 33 3 | 22 4 | 22 5 | -------------------------------------------------------------------------------- /tests/compute/frem.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | FFFFFFFF 5 | -------------------------------------------------------------------------------- /tests/compute/generic-closer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | 2 4 | 2 -------------------------------------------------------------------------------- /tests/compute/global-type-param1.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3E800000 2 | -------------------------------------------------------------------------------- /tests/compute/global-type-param2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3E800000 2 | -------------------------------------------------------------------------------- /tests/compute/groupshared.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 0 3 | 3 4 | 2 5 | -------------------------------------------------------------------------------- /tests/compute/loop-unroll.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 0 4 | 1 5 | -------------------------------------------------------------------------------- /tests/compute/nested-generics.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 0 -------------------------------------------------------------------------------- /tests/compute/nested-generics2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 -------------------------------------------------------------------------------- /tests/compute/struct-make.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/cpp-compiler/c-compile-error.c.expected: -------------------------------------------------------------------------------- 1 | Compile: Error 2 | -------------------------------------------------------------------------------- /tests/cpp-compiler/c-compile-link-error.c.expected: -------------------------------------------------------------------------------- 1 | Link: Error 2 | -------------------------------------------------------------------------------- /tools/render-test/test.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 80000000 4 | 3F800000 5 | -------------------------------------------------------------------------------- /tests/bugs/gh-775.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3210 2 | 4321 3 | 5432 4 | 6543 5 | -------------------------------------------------------------------------------- /tests/compute/assoctype-complex.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 4 4 | 4 -------------------------------------------------------------------------------- /tests/compute/assoctype-nested.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/compute/atomics.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 210 2 | 301 3 | 32 4 | 123 5 | -------------------------------------------------------------------------------- /tests/compute/comma-operator.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 | 5 4 | 7 5 | -------------------------------------------------------------------------------- /tests/compute/enum-conversion2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | -------------------------------------------------------------------------------- /tests/compute/frem.slang.2.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | FFFFFFFE 4 | 1 5 | -------------------------------------------------------------------------------- /tests/compute/generic-struct-with-constraint.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/global-init.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /tests/compute/global-type-param-array.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40800000 2 | -------------------------------------------------------------------------------- /tests/compute/interface-local.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/compute/interface-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/compute/parameter-block.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/compute/pointer-emit.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 8 2 | 8 3 | 8 4 | 8 5 | -------------------------------------------------------------------------------- /tests/compute/tagged-union.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 9 2 | 19 3 | 29 4 | 39 5 | -------------------------------------------------------------------------------- /tests/compute/texture-sample-grad-offset-clamp.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/this-type.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 11 3 | 22 4 | 33 5 | -------------------------------------------------------------------------------- /tests/downstream/dxc-x-arg.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-active-product.slang.expected.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/bugs/glsl-static-const-array.slang.expected.txt: -------------------------------------------------------------------------------- 1 | A 2 | B 3 | C 4 | D 5 | -------------------------------------------------------------------------------- /tests/bugs/paren-insertion-bug.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 2 3 | 8 4 | 12 5 | -------------------------------------------------------------------------------- /tests/compute/assoctype-lookup.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 100 2 | 100 3 | 100 4 | 100 -------------------------------------------------------------------------------- /tests/compute/atomics-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 210 2 | 301 3 | 32 4 | 123 5 | -------------------------------------------------------------------------------- /tests/compute/byte-address-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | A 2 | 2 3 | A 4 | 2 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-1.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 5 4 | A 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-10.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 4 3 | A 4 | 14 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-11.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-12.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 4 3 | 6 4 | 8 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-13.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 4 3 | 6 4 | 8 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-14.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 4 3 | 6 4 | 8 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-15.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 19.0 3 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-16.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 6.0 3 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-17.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 6.0 3 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 4 4 | 9 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-3.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 6 4 | B 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-4.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 4 4 | 4 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-5.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 4 3 | 5 4 | 6 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-6.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 4 4 | 4 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-7.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 4 4 | 4 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-8.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 5 4 | A 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-9.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 5 4 | A 5 | -------------------------------------------------------------------------------- /tests/compute/dynamic-generics-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 4 4 | 9 -------------------------------------------------------------------------------- /tests/compute/generic-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 11 3 | 22 4 | 33 5 | -------------------------------------------------------------------------------- /tests/compute/implicit-generic-app.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/compute/initializer-list.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /tests/compute/modern-syntax.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /tests/compute/mutating-methods.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 12 3 | 14 4 | 16 5 | -------------------------------------------------------------------------------- /tests/compute/ray-tracing-inline.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 0.5 3 | -------------------------------------------------------------------------------- /tests/compute/scope-operator.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 33 3 | 22 4 | 22 5 | -------------------------------------------------------------------------------- /tests/compute/static-const-array.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 1 3 | 20 4 | 2 5 | -------------------------------------------------------------------------------- /tests/compute/tagged-union.slang.2.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /tests/compute/transitive-interface.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 3 3 | 3 4 | 3 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/classify-float.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 1 4 | 2 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-int.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F 2 | 12 3 | 18 4 | 20 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-uint.slang.expected.txt: -------------------------------------------------------------------------------- 1 | D 2 | 14 3 | 1B 4 | 23 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/vector-int.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3C 2 | 5B 3 | 75 4 | 8F 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-diverge.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 0 4 | 1 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-shuffle.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 19 2 | 2 3 | B 4 | 10 5 | -------------------------------------------------------------------------------- /tests/spirv/direct-spirv-compute-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F 2 | E 3 | D 4 | F -------------------------------------------------------------------------------- /tests/bugs/static-method.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4210 2 | 4211 3 | 4212 4 | 4213 5 | -------------------------------------------------------------------------------- /tests/compute/atomics-groupshared.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 223 2 | 322 3 | 21 4 | 120 5 | -------------------------------------------------------------------------------- /tests/compute/cast-zero-to-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 11001 3 | 22002 4 | 33003 -------------------------------------------------------------------------------- /tests/compute/default-initializer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 11 3 | 22 4 | 33 5 | -------------------------------------------------------------------------------- /tests/compute/default-parameter.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 110 2 | 112 3 | 114 4 | 116 5 | -------------------------------------------------------------------------------- /tests/compute/enum-tag-conversion.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /tests/compute/func-cbuffer-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 31 3 | 52 4 | 73 5 | -------------------------------------------------------------------------------- /tests/compute/func-resource-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 11 3 | 22 4 | 33 5 | -------------------------------------------------------------------------------- /tests/compute/interface-assoc-type-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 5 | -------------------------------------------------------------------------------- /tests/compute/interface-shader-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 20 3 | 30 4 | 40 5 | -------------------------------------------------------------------------------- /tests/compute/interface-shader-param2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | A 2 | 9 3 | C 4 | B 5 | -------------------------------------------------------------------------------- /tests/compute/mutating-and-inout.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 330 2 | 221 3 | 112 4 | 3 5 | -------------------------------------------------------------------------------- /tests/compute/select-expr.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | FFFFFFFE 4 | FFFFFFFD 5 | -------------------------------------------------------------------------------- /tests/compute/simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 -------------------------------------------------------------------------------- /tests/cpp-compiler/c-compile-shared-library-link-error.c.expected: -------------------------------------------------------------------------------- 1 | Link: Error 2 | -------------------------------------------------------------------------------- /tests/cross-compile/fmod.slang.expected.txt: -------------------------------------------------------------------------------- 1 | FFFFFFFD 2 | FFFFFFFE 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/cross-compile/glsl-bool-ops.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F0F 2 | E0E 3 | 1A1A 4 | F0F -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/bit-cast-double.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/classify-double.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 1 4 | 2 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/matrix-int.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 163 2 | 16E 3 | 179 4 | 184 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-equality.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 11 2 | 11 3 | 11 4 | 11 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-shuffle-vk.slang.expected.txt: -------------------------------------------------------------------------------- 1 | A 2 | 5 3 | 8 4 | 7 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4063 2 | 4063 3 | 4063 4 | 4063 5 | -------------------------------------------------------------------------------- /tests/serialization/extern/extern-test.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 5 2 | B 3 | 11 4 | 17 5 | -------------------------------------------------------------------------------- /tests/spirv/direct-spirv-control-flow.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 6 3 | 6 4 | 6 5 | -------------------------------------------------------------------------------- /tests/bugs/gh-357.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 5 | -------------------------------------------------------------------------------- /tests/bugs/obfuscate-specialization-naming.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3 3 | 6 4 | 7 5 | -------------------------------------------------------------------------------- /tests/compute/array-existential-parameter.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 4 3 | 6 4 | 8 5 | -------------------------------------------------------------------------------- /tests/compute/break-stmt.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | FFFFFFFF 3 | FFFFFFFE 4 | FFFFFFFD 5 | -------------------------------------------------------------------------------- /tests/compute/default-parameter.slang.1.expected.txt: -------------------------------------------------------------------------------- 1 | 110 2 | 112 3 | 114 4 | 116 5 | -------------------------------------------------------------------------------- /tests/compute/generics-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 -------------------------------------------------------------------------------- /tests/compute/generics-syntax.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 -------------------------------------------------------------------------------- /tests/compute/half-calc.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 40400000 3 | 40C00000 4 | 41100000 5 | -------------------------------------------------------------------------------- /tests/compute/init-list-defaults.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1142 2 | 2453 3 | 3060 4 | 4000 5 | -------------------------------------------------------------------------------- /tests/compute/interface-func-param-in-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 5 | -------------------------------------------------------------------------------- /tests/compute/interface-static-method.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 64 2 | 64 3 | 64 4 | 64 5 | -------------------------------------------------------------------------------- /tests/compute/multiple-continue-sites.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 220 2 | 221 3 | 122 4 | 223 5 | -------------------------------------------------------------------------------- /tests/compute/struct-default-init.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3456 2 | 7892 3 | AB02 4 | C102 5 | -------------------------------------------------------------------------------- /tests/compute/structured-buffer-of-matrices.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 7 2 | 8 3 | D 4 | 2 5 | -------------------------------------------------------------------------------- /tests/compute/typedef-member.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 -------------------------------------------------------------------------------- /tests/compute/user-defined-initializer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 12 3 | 23 4 | 34 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-diverge.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 0 4 | 1 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-shuffle.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 19 2 | 2 3 | B 4 | 10 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-read-lane-at-vk.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1E 2 | 1E 3 | 1E 4 | 1E 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-read-lane-at.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 36 2 | 36 3 | 36 4 | 36 5 | -------------------------------------------------------------------------------- /tests/serialization/serialized-module-test.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/bugs/vec-init.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40000000 2 | 41080000 3 | 41700000 4 | 41AC0000 5 | -------------------------------------------------------------------------------- /tests/compute/assoctype-func-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 -------------------------------------------------------------------------------- /tests/compute/buffer-type-splitting.slang.expected.txt: -------------------------------------------------------------------------------- 1 | C840 2 | D952 3 | EA63 4 | FB73 5 | -------------------------------------------------------------------------------- /tests/compute/continue-stmt.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | FFFFFFFF 3 | FFFFFFFE 4 | FFFFFFFD 5 | -------------------------------------------------------------------------------- /tests/compute/dump-repro.slang.2.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 | 5 4 | 7 5 | 9 6 | B 7 | D 8 | F 9 | -------------------------------------------------------------------------------- /tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 5 | -------------------------------------------------------------------------------- /tests/compute/empty-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/generics-overload.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 -------------------------------------------------------------------------------- /tests/compute/generics-syntax-2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 -------------------------------------------------------------------------------- /tests/compute/interface-param-partial-specialize.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 5 | -------------------------------------------------------------------------------- /tests/compute/pack-any-value-16bit.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 21.0 3 | 21.0 4 | 21.0 -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/literal-float.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 7F800000 2 | FF800000 3 | 0 4 | 0 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/vector-int-runtime-index.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 50 2 | 84 3 | D0 4 | 103 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 4 4 | 4 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-broadcast-lane-at.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 17 2 | 17 3 | 17 4 | 17 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-get-lane-index.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-equality.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 11 2 | 11 3 | 11 4 | 11 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-shuffle-vk.slang.expected.txt: -------------------------------------------------------------------------------- 1 | A 2 | 5 3 | 8 4 | 7 5 | -------------------------------------------------------------------------------- /tests/language-feature/bit-cast/struct-bit-cast.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 8 2 | 9 3 | A 4 | B 5 | -------------------------------------------------------------------------------- /tests/language-feature/enums/explicit-tag-type.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 0 5 | -------------------------------------------------------------------------------- /tests/language-feature/enums/nested-enum.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1071 2 | 1060 3 | 1170 4 | 70 5 | -------------------------------------------------------------------------------- /tests/language-feature/namespaces/using-namespace.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/language-feature/swizzles/matrix-swizzles.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 | 5 4 | 7 5 | -------------------------------------------------------------------------------- /tests/preprocessor/include-a.slang.h: -------------------------------------------------------------------------------- 1 | // #include support 2 | 3 | int bar() { return foo(); } -------------------------------------------------------------------------------- /tests/bugs/negative-literal.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 5 | -------------------------------------------------------------------------------- /tests/bugs/rwstructuredbuffer-existential-in-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 0 5 | -------------------------------------------------------------------------------- /tests/bugs/specialize-function-array-args.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | FFFFFFFF 4 | FFFFFFFF 5 | -------------------------------------------------------------------------------- /tests/compute/buffer-layout.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 160E0308 2 | 260E0308 3 | 360E0308 4 | 460E0308 5 | -------------------------------------------------------------------------------- /tests/compute/entry-point-uniform-params.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1230 2 | 1231 3 | 1232 4 | 1233 5 | -------------------------------------------------------------------------------- /tests/compute/explicit-this-expr.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 40000000 3 | 40C00000 4 | 41400000 5 | -------------------------------------------------------------------------------- /tests/compute/generics-constrained.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 5 | -------------------------------------------------------------------------------- /tests/compute/half-opaque-convert.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F000000 3 | 3F800000 4 | 3FC00000 5 | -------------------------------------------------------------------------------- /tests/compute/implicit-this-expr.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 40000000 3 | 40C00000 4 | 41400000 5 | -------------------------------------------------------------------------------- /tests/compute/interface-shader-param3.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10020 2 | 10010 3 | 10040 4 | 10030 5 | -------------------------------------------------------------------------------- /tests/compute/interface-shader-param4.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10042 2 | 10083 3 | 10025 4 | 10029 5 | -------------------------------------------------------------------------------- /tests/compute/multi-interface.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/non-square-row-major.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 11.000000 3 | 22.000000 4 | -------------------------------------------------------------------------------- /tests/compute/rewriter-parameter-block.hlsl.expected.txt: -------------------------------------------------------------------------------- 1 | 11110 2 | 11121 3 | 11132 4 | 11143 5 | -------------------------------------------------------------------------------- /tests/compute/ssa-reduce-bug.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 3 3 | 3 4 | 3 5 | 4 6 | 4 7 | 4 8 | 4 9 | -------------------------------------------------------------------------------- /tests/compute/struct-in-generic.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3F800000 3 | 40000000 4 | 40400000 5 | -------------------------------------------------------------------------------- /tests/compute/switch-stmt.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 0 3 | 12 4 | 0 5 | 4 6 | 15 7 | 0 8 | 0 9 | -------------------------------------------------------------------------------- /tests/compute/type-legalize-global-with-init.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 321 2 | 432 3 | 543 4 | 654 5 | -------------------------------------------------------------------------------- /tests/cuda/cuda-texture.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/matrix-int-runtime-index.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 720 2 | 207 3 | 72 4 | 720 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-double.slang.expected.txt: -------------------------------------------------------------------------------- 1 | FFFFFB7F 2 | FFFFFFA1 3 | 3E2 4 | 83B 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-float.slang.expected.txt: -------------------------------------------------------------------------------- 1 | FFFFFB7F 2 | FFFFFFAD 3 | 3FA 4 | 85F 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-read-lane-at-vk.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1E 2 | 1E 3 | 1E 4 | 1E 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-read-lane-at.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 36 2 | 36 3 | 36 4 | 36 5 | -------------------------------------------------------------------------------- /tests/language-feature/enums/enum-equality.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1011 2 | 1000 3 | 1110 4 | 10 5 | -------------------------------------------------------------------------------- /tests/language-feature/extensions/interface-extension.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 4 4 | 5 5 | -------------------------------------------------------------------------------- /tests/language-feature/properties/property-decl.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 101 2 | 100 3 | 103 4 | 102 5 | -------------------------------------------------------------------------------- /tests/pipeline/ray-tracing/raygen.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: int32_t 2 | 0 3 | 11 4 | 22 5 | 33 6 | -------------------------------------------------------------------------------- /tests/serialization/serialized-module-entry-point-test.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /prelude/slang-hlsl-prelude.h: -------------------------------------------------------------------------------- 1 | #ifdef SLANG_HLSL_ENABLE_NVAPI 2 | #include "nvHLSLExtns.h" 3 | #endif 4 | -------------------------------------------------------------------------------- /tests/bugs/mutating/mutating-generic-method.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10102 2 | 20203 3 | 30304 4 | 40405 5 | -------------------------------------------------------------------------------- /tests/bugs/nested-generics-call.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 5 | -------------------------------------------------------------------------------- /tests/compute/assoctype-generic-arg.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/assoctype-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40400000 2 | 40400000 3 | 40400000 4 | 40400000 5 | -------------------------------------------------------------------------------- /tests/compute/buffer-layout.slang.1.expected.txt: -------------------------------------------------------------------------------- 1 | 160E0308 2 | 260E0308 3 | 360E0308 4 | 460E0308 5 | -------------------------------------------------------------------------------- /tests/compute/buffer-layout.slang.2.expected.txt: -------------------------------------------------------------------------------- 1 | 18140308 2 | 28140308 3 | 38140308 4 | 48140308 5 | -------------------------------------------------------------------------------- /tests/compute/buffer-layout.slang.3.expected.txt: -------------------------------------------------------------------------------- 1 | 13080308 2 | 23080308 3 | 33080308 4 | 43080308 5 | -------------------------------------------------------------------------------- /tests/compute/buffer-layout.slang.4.expected.txt: -------------------------------------------------------------------------------- 1 | 13080308 2 | 23080308 3 | 33080308 4 | 43080308 5 | -------------------------------------------------------------------------------- /tests/compute/cbuffer-legalize.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40000000 2 | 40400000 3 | 40800000 4 | 40A00000 5 | -------------------------------------------------------------------------------- /tests/compute/interface-shader-param-legalization.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | -------------------------------------------------------------------------------- /tests/compute/non-square-column-major.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 11.000000 3 | 22.000000 4 | -------------------------------------------------------------------------------- /tests/compute/rewriter-parameter-block-complex.hlsl.expected.txt: -------------------------------------------------------------------------------- 1 | 1110 2 | 1121 3 | 1132 4 | 1143 5 | -------------------------------------------------------------------------------- /tests/cross-compile/get-dimensions.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 35 3 | 2 4 | 2 5 | 6 6 | 0 7 | 3 8 | 7 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-broadcast-lane-at-vk.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 4 4 | 4 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-broadcast-lane-at.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 17 2 | 17 3 | 17 4 | 17 5 | -------------------------------------------------------------------------------- /tests/ir/string-literal-hash.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 28D4D674 2 | 28D4D674 3 | 28D4D674 4 | 28D4D674 5 | -------------------------------------------------------------------------------- /tests/language-feature/namespaces/simple-namespace.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 111 3 | 222 4 | 333 5 | -------------------------------------------------------------------------------- /tests/language-feature/properties/property-in-interface.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 21 2 | 33 3 | 45 4 | 57 5 | -------------------------------------------------------------------------------- /tests/language-feature/types/opaque/return-opaque-type.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /tests/serialization/std-lib-serialize.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 40000000 3 | 40C00000 4 | 41400000 5 | -------------------------------------------------------------------------------- /external/vulkan/.gitignore: -------------------------------------------------------------------------------- 1 | # Python cache 2 | __pycache__ 3 | *.pyc 4 | build 5 | .vscode/ 6 | **/.*.swp 7 | -------------------------------------------------------------------------------- /tests/compute/extension-multi-interface.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/extension-on-interface.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 5 | -------------------------------------------------------------------------------- /tests/compute/func-param-legalize.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F000000 2 | 3F000000 3 | 3F000000 4 | 3F000000 5 | -------------------------------------------------------------------------------- /tests/compute/generics-constructor.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40400000 2 | 40400000 3 | 40400000 4 | 40400000 5 | -------------------------------------------------------------------------------- /tests/compute/half-texture-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 40E00000 2 | 40E00000 3 | 40E00000 4 | 40E00000 5 | -------------------------------------------------------------------------------- /tests/compute/interface-shader-param-in-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10042 2 | 10083 3 | 10025 4 | 10029 5 | -------------------------------------------------------------------------------- /tests/compute/unbounded-array-of-array.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 8 6 | 11 7 | 22 8 | 22 9 | -------------------------------------------------------------------------------- /tests/cross-compile/simple-cross-compile.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 147 2 | FFFFE732 3 | FFFFCCE6 4 | FFFFB6C7 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-int64.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1E50A006 2 | 2793FF3D 3 | 8A1AA9A7 4 | ED76E236 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-uint64.slang.expected.txt: -------------------------------------------------------------------------------- 1 | C6B4BB6F 2 | 142802D2 3 | 619FA985 4 | 34A0408 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-multi-prefix.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 3 4 | 7 5 | F 6 | 1F 7 | 3F 8 | 7F 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-vector.slang.expected.txt: -------------------------------------------------------------------------------- 1 | D6 2 | D6 3 | D6 4 | D6 5 | D6 6 | D6 7 | D6 8 | D6 9 | -------------------------------------------------------------------------------- /tests/language-feature/constants/static-const-in-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1111 3 | 2222 4 | 3333 5 | -------------------------------------------------------------------------------- /tests/language-feature/generics/struct-generic-value-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 11 2 | 22 3 | 33 4 | 44 5 | -------------------------------------------------------------------------------- /tests/language-feature/inheritance/struct-inheritance.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1113 2 | 1002 3 | 1335 4 | 1224 5 | -------------------------------------------------------------------------------- /tests/language-feature/interfaces/interface-conjunction.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 100 2 | 202 3 | 304 4 | 406 5 | -------------------------------------------------------------------------------- /tests/language-feature/types/opaque/out-param-opaque-type.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /tests/serialization/library-entry-point/library-entry-point-test.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 5 4 | A 5 | -------------------------------------------------------------------------------- /tests/spirv/direct-spirv-control-flow-2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: uint32_t 2 | 19 3 | 21 4 | 40 5 | 41 6 | -------------------------------------------------------------------------------- /tests/bugs/nested-generics-method-call.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 5 | -------------------------------------------------------------------------------- /tests/compute/generic-interface-method-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/generic-interface-method.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F000000 2 | 3F000000 3 | 3F000000 4 | 3F000000 5 | -------------------------------------------------------------------------------- /tests/compute/global-type-param-in-entrypoint.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 3F800000 2 | 3F800000 3 | 3F800000 4 | 3F800000 -------------------------------------------------------------------------------- /tests/compute/row-major.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 11.000000 3 | 22.000000 4 | 33.000000 5 | 1.000000 6 | -------------------------------------------------------------------------------- /tests/diagnostics/illegal-character.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // illegal character 3 | 4 | ` 5 | 6 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-active-count-bits.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 6 2 | 6 3 | 6 4 | 6 5 | 6 6 | 6 7 | 6 8 | 6 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-get-active.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F 2 | F 3 | F 4 | F 5 | F 6 | F 7 | F 8 | F 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-prefix-count-bits.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 1 4 | 1 5 | 2 6 | 3 7 | 4 8 | 5 9 | -------------------------------------------------------------------------------- /tests/language-feature/enums/enum-tag-type-compare.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 110100 2 | 101010 3 | 110100 4 | 110100 5 | -------------------------------------------------------------------------------- /tests/language-feature/inheritance/struct-inheritance-import.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 100 2 | 111 3 | 122 4 | 133 5 | -------------------------------------------------------------------------------- /tests/language-feature/parameters/generic-func-param-default-arg.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 11 3 | 22 4 | 33 5 | -------------------------------------------------------------------------------- /tests/language-feature/shader-params/global-uniform-params.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 102 2 | 203 3 | 304 4 | 405 5 | -------------------------------------------------------------------------------- /tests/language-feature/types/opaque/inout-param-opaque-type.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 310 2 | 611 3 | 912 4 | C13 5 | -------------------------------------------------------------------------------- /tests/language-feature/types/opaque/return-opaque-type-in-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 12 2 | 23 3 | 44 4 | 85 5 | -------------------------------------------------------------------------------- /tests/type/texture-sampler/texture-sampler-2d.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 1.0 3 | 1.0 4 | 1.0 5 | 1.0 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # indicate generated files so they don't appear in GitHub diffs 2 | *.slang.cpp linguist-generated 3 | -------------------------------------------------------------------------------- /external/spirv-tools-generated/build-version.inc: -------------------------------------------------------------------------------- 1 | "v2021.3-dev", "SPIRV-Tools v2021.3-dev v2021.1-72-ge0937d7f" 2 | -------------------------------------------------------------------------------- /tests/bugs/import-overload-error.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | void foo(int a) {} 4 | void foo(float b) {} 5 | -------------------------------------------------------------------------------- /tests/compute/default-major.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 11.000000 3 | 22.000000 4 | 33.000000 5 | 1.000000 6 | -------------------------------------------------------------------------------- /tests/compute/texture-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 7.000000 3 | 7.000000 4 | 7.000000 5 | 7.000000 6 | -------------------------------------------------------------------------------- /tests/compute/unbounded-array-of-array-syntax.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 8 6 | 11 7 | 22 8 | 22 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/byte-address-buffer/byte-address-16bit.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2001 2 | 4003 3 | 6005 4 | 8007 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/byte-address-buffer/byte-address-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 5001 2 | 6002 3 | 7003 4 | 8004 5 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-get-converged.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F 2 | F 3 | F 4 | F 5 | F 6 | F 7 | F 8 | F 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-mask-prefix.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 3 4 | 7 5 | F 6 | 1F 7 | 3F 8 | 7F 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-vector.slang.expected.txt: -------------------------------------------------------------------------------- 1 | D6 2 | D6 3 | D6 4 | D6 5 | D6 6 | D6 7 | D6 8 | D6 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-matrix.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1EC 2 | 1EC 3 | 1EC 4 | 1EC 5 | 1EC 6 | 1EC 7 | 1EC 8 | 1EC 9 | -------------------------------------------------------------------------------- /tests/language-feature/inheritance/derived-struct-init-list.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 11201 2 | 11212 3 | 11223 4 | 11234 5 | -------------------------------------------------------------------------------- /tests/language-feature/initializer-lists/default-init-16bit-types.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1111 3 | 2222 4 | 3333 5 | -------------------------------------------------------------------------------- /tests/language-feature/modules/error-in-nested-import/c.slang: -------------------------------------------------------------------------------- 1 | // c.slang 2 | //TEST_IGNORE_FILE: 3 | 4 | int a(; 5 | -------------------------------------------------------------------------------- /tests/language-feature/shader-params/entry-point-uniform-params.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 102 2 | 203 3 | 304 4 | 405 5 | -------------------------------------------------------------------------------- /tests/language-feature/types/opaque/out-param-opaque-type-in-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 12 2 | 23 3 | 44 4 | 85 5 | -------------------------------------------------------------------------------- /tests/optimization/func-resource-result/func-resource-result-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 11 2 | 22 3 | 33 4 | 44 5 | -------------------------------------------------------------------------------- /tests/slang-extension/cas-int64-byte-address-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 1 3 | 6 4 | 3 5 | 8 6 | 5 7 | A 8 | 7 9 | -------------------------------------------------------------------------------- /docs/language-reference/08-attributes.md: -------------------------------------------------------------------------------- 1 | Attributes 2 | ========== 3 | 4 | > Note: This section is not yet complete. 5 | -------------------------------------------------------------------------------- /tests/compute/half-rw-texture-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 6.000000 3 | 7.000000 4 | 8.000000 5 | 9.000000 6 | -------------------------------------------------------------------------------- /tests/compute/rw-texture-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 3.000000 3 | 6.000000 4 | 9.000000 5 | 12.000000 6 | -------------------------------------------------------------------------------- /tests/front-end/parser-error-unclosed-curly.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | void foo() { 3 | // Note: no closing curly brace 4 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/byte-address-buffer/byte-address-16bit-vector.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2001 2 | 4003 3 | 6005 4 | 8007 5 | -------------------------------------------------------------------------------- /tests/language-feature/inheritance/struct-inherit-interface-requirement.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 100 2 | FF 3 | FE 4 | FD 5 | -------------------------------------------------------------------------------- /tests/rewriter/gh-160.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // This file only exists so that `gh-160.hlsl` can import it. 4 | -------------------------------------------------------------------------------- /tests/rewriter/glslang-bug-988-workaround.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | struct Foo 4 | { 5 | float4 bar; 6 | }; 7 | -------------------------------------------------------------------------------- /tests/slang-extension/exchange-int64-byte-address-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 0 3 | 4 4 | 0 5 | 6 6 | 0 7 | 8 8 | 0 9 | -------------------------------------------------------------------------------- /tests/compute/half-rw-texture-convert.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 0.000000 3 | 1.000000 4 | 2.000000 5 | 3.000000 6 | -------------------------------------------------------------------------------- /tests/compute/half-vector-calc.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 73.000000 3 | 206.500000 4 | 539.000000 5 | 1070.000000 6 | -------------------------------------------------------------------------------- /tests/compute/half-vector-compare.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 32.000000 3 | 32.000000 4 | 32.000000 5 | 32.000000 6 | -------------------------------------------------------------------------------- /tests/cuda/cuda-array-layout.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: int32_t 2 | 48 3 | 0 4 | 16 5 | 20 6 | 44 7 | 0 8 | 0 9 | 0 10 | -------------------------------------------------------------------------------- /tests/diagnostics/missing-file.slang.disabled: -------------------------------------------------------------------------------- 1 | // trying to import a non-existant file 2 | 3 | using "does-not-exist.slang" 4 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/bit-cast.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | 0 6 | 1 7 | 2 8 | 3 9 | 0 10 | 1 11 | 2 12 | 3 -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-matrix.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1EC 2 | 1EC 3 | 1EC 4 | 1EC 5 | 1EC 6 | 1EC 7 | 1EC 8 | 1EC 9 | -------------------------------------------------------------------------------- /tests/language-feature/modules/error-in-nested-import/a.slang: -------------------------------------------------------------------------------- 1 | // a.slang 2 | //TEST_IGNORE_FILE: 3 | 4 | import b; 5 | 6 | -------------------------------------------------------------------------------- /tests/language-feature/modules/error-in-nested-import/b.slang: -------------------------------------------------------------------------------- 1 | // b.slang 2 | //TEST_IGNORE_FILE: 3 | 4 | import c; 5 | 6 | -------------------------------------------------------------------------------- /tests/language-feature/shader-params/interface-shader-param-ordinary.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10400 2 | 20303 3 | 30206 4 | 40109 5 | -------------------------------------------------------------------------------- /tests/slang-extension/atomic-int64-byte-address-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F0 2 | 3 3 | F2 4 | 3 5 | F4 6 | 7 7 | F6 8 | 7 9 | -------------------------------------------------------------------------------- /tests/slang-extension/atomic-min-max-u64-byte-address-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 6 4 | 7 5 | 0 6 | 1 7 | 6 8 | 7 9 | -------------------------------------------------------------------------------- /tests/compute/half-rw-texture-convert2.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 96.000000 3 | 100.000000 4 | 104.000000 5 | 108.000000 6 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-option.slang: -------------------------------------------------------------------------------- 1 | // unknown-option.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-destroy-all-humans 4 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/matrix-double.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: double 2 | -363.570686 3 | -128.281824 4 | 134.883405 5 | 383.294965 6 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/matrix-float.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | -916.058716 3 | -315.978027 4 | 358.120331 5 | 1035.545532 6 | -------------------------------------------------------------------------------- /tests/preprocessor/pragma-once-b.h: -------------------------------------------------------------------------------- 1 | // pragma-once-b.h 2 | 3 | // Used by the `pragma-once.slang` test 4 | 5 | #define BAR foo 6 | -------------------------------------------------------------------------------- /tests/bugs/preproc-lex-failure.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | Hello 6 | } 7 | -------------------------------------------------------------------------------- /tests/cpp-compiler/c-compile.c.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | Hello World! 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-stage.slang: -------------------------------------------------------------------------------- 1 | // unknown-stage.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-stage green_hills_zone 4 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-double-d3d-intrinsic.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: double 2 | 2.850000 3 | 2.550000 4 | 3.216667 5 | 6.621429 6 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-prefix-sum.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 10001 3 | 30003 4 | 70007 5 | F000F 6 | 1F001F 7 | 3F003F 8 | 7F007F 9 | -------------------------------------------------------------------------------- /tests/language-feature/types/opaque/inout-param-opaque-type-in-struct.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 6070102 2 | 6080103 3 | 6090104 4 | 60A0105 5 | -------------------------------------------------------------------------------- /tests/preprocessor/bugs/pp-bug-1.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | 0 1 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/include/include-pragma-once-c.h: -------------------------------------------------------------------------------- 1 | // include-pragma-once-c.h 2 | 3 | #pragma once 4 | 5 | #include "pragma-once-c.h" -------------------------------------------------------------------------------- /tests/preprocessor/preproc-detail-1.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | a b 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-expand-1.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | Hi 6 | } 7 | -------------------------------------------------------------------------------- /premake.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set ROOT=%~dp0 3 | "%ROOT%\external\slang-binaries\premake\premake-5.0.0-alpha16\bin\windows-x64\premake5.exe" %* 4 | -------------------------------------------------------------------------------- /tests/cpp-compiler/cpp-compile.cpp.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | Hello World! 6 | } 7 | -------------------------------------------------------------------------------- /tests/cpp-compiler/simple-c-compile.c.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | Hello World! 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/duplicate-target.slang: -------------------------------------------------------------------------------- 1 | // duplicate-target.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-target hlsl -target hlsl 4 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-codegen-target.slang: -------------------------------------------------------------------------------- 1 | // unknown-codegen-target.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-target z80 4 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-output-format.slang: -------------------------------------------------------------------------------- 1 | // unknown-output-format.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-o cookies.jar 4 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-profile.slang: -------------------------------------------------------------------------------- 1 | // unknown-profile.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-profile thunder_kiss_65 4 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/matrix-double-reduced-intrinsic.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: double 2 | 11.209877 3 | 8.532063 4 | 13.660064 5 | 26.660431 6 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-double-simple.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 7FF00000 3 | 0 4 | 40200000 5 | 0 6 | 40100000 7 | 55555555 8 | 40055555 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/scalar-double-vk-intrinsic.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: double 2 | -105.150000 3 | -46.277573 4 | 13.888270 5 | 74.493383 6 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-concat-1.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | AB ; 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-concat-5.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | THING 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-pound-pound-2.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | AB 6 | } 7 | -------------------------------------------------------------------------------- /tests/slang-extension/atomic-float-byte-address-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 5.000000 3 | 6.000000 4 | 7.000000 5 | 8.000000 6 | -------------------------------------------------------------------------------- /tests/compute/semantic.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 101 3 | 202 4 | 303 5 | 410 6 | 511 7 | 612 8 | 713 9 | 820 10 | 921 11 | A22 12 | B23 13 | -------------------------------------------------------------------------------- /tests/diagnostics/expected-token-eof.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // expected one token, but got EOF 3 | 4 | int foo() 5 | { 6 | int a = 3 -------------------------------------------------------------------------------- /tests/front-end/subdir/import-subdir-a.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // This is the imported code. 4 | 5 | float foo(float x) { return x; } -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-prefix-sum.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 10001 3 | 30003 4 | 70007 5 | F000F 6 | 1F001F 7 | 3F003F 8 | 7F007F 9 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-prefix-product.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10001 2 | 10001 3 | 20002 4 | 60006 5 | 180018 6 | 780078 7 | 2D002D0 8 | 13B013B0 9 | -------------------------------------------------------------------------------- /tests/ir/string-literal-module.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | int doSomethingElse() 4 | { 5 | return getStringHash("Try another"); 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-concat-2.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | a A2B2 b ; 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-stringify-1.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | "A B" ; 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/continue-outside-loop.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // `continue` where it isn't allowed 3 | 4 | void foo() { continue; } 5 | -------------------------------------------------------------------------------- /tests/diagnostics/variable-void-type.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // variable with `void` type 3 | 4 | void foo() 5 | { 6 | void a; 7 | } 8 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/active-mask/if-one-sided.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F 2 | F 3 | F 4 | F 5 | 0 6 | A 7 | 0 8 | A 9 | F 10 | F 11 | F 12 | F 13 | -------------------------------------------------------------------------------- /tests/pipeline/compute/compute-system-values.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1001010 3 | 2002020 4 | 3003030 5 | 4000101 6 | 5001111 7 | 6002121 8 | 7003131 9 | -------------------------------------------------------------------------------- /docs/gfx-user-guide/nav.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/cuda/compile-to-cuda.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | 1 6 | 2 7 | 3 8 | 4 9 | 2 10 | 3 11 | 4 12 | 5 13 | 3 14 | 4 15 | 5 16 | 6 17 | -------------------------------------------------------------------------------- /tests/diagnostics/expected-token.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // expected one token, but got another 3 | 4 | int foo() 5 | { 6 | int a = 3 ] 7 | } -------------------------------------------------------------------------------- /tests/diagnostics/missing-include-file.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // trying to include a non-existant file 3 | 4 | #include "does-not-exist.h" 5 | -------------------------------------------------------------------------------- /tests/diagnostics/parameter-already-defined.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // re-use parameter name 3 | 4 | int foo( int a, float a ) { return 0; } 5 | -------------------------------------------------------------------------------- /tests/diagnostics/undefined-identifier.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // use of undefined identifier 3 | 4 | void foo() 5 | { 6 | int a = b; 7 | } 8 | -------------------------------------------------------------------------------- /tests/front-end/parser-using-file-a.slang.h: -------------------------------------------------------------------------------- 1 | // this file exists to be included by "parser-using-file.slang" 2 | 3 | float a(float x) { return x * x; } 4 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-prefix-product.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 10001 2 | 10001 3 | 20002 4 | 60006 5 | 180018 6 | 780078 7 | 2D002D0 8 | 13B013B0 9 | -------------------------------------------------------------------------------- /tests/preprocessor/macros/macro-parens-from-expansion.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | ( 3 ) 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-multi-line.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | int x = 8 ; 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-simple.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | //__LINE__ and __FILE__ support 4 | 5 | __LINE__ 6 | 7 | __FILE__ 8 | -------------------------------------------------------------------------------- /tests/bugs/empty.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | // empty.slang 3 | 4 | // This is just an empty file so that tets 5 | // that need to `__import` something can. 6 | -------------------------------------------------------------------------------- /tests/compute/texture-get-dimensions.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 4C800000 2 | 4D008000 3 | 4C008080 4 | 4D808000 5 | 4C000080 6 | 4C808060 7 | 4D808008 8 | 3F800000 9 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert: -------------------------------------------------------------------------------- 1 | // explicit-implicit-stage-mismatch.vert 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-stage fragment 4 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-pass-through-target.slang: -------------------------------------------------------------------------------- 1 | // unknown-pass-through-target.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-pass-through subcon 4 | -------------------------------------------------------------------------------- /tests/preprocessor/include/special-macro-include.h: -------------------------------------------------------------------------------- 1 | // special-macro-include.h 2 | 3 | // Used by the `special-macro-include.slang` test 4 | 5 | __FILE__ __LINE__ -------------------------------------------------------------------------------- /tests/bugs/bool-op.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1AA 2 | 16 3 | 96 4 | 16 5 | 96 6 | 16 7 | 96 8 | 15 9 | 95 10 | 15 11 | 95 12 | 55 13 | 15 14 | 55 15 | 15 16 | 55 17 | -------------------------------------------------------------------------------- /tests/compute/vector-scalar-compare.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 0 4 | 1 5 | 1 6 | 1 7 | 1 8 | 1 9 | 0 10 | 1 11 | 0 12 | 1 13 | 1 14 | 1 15 | 1 16 | 1 17 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/active-mask/if.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F 2 | F 3 | F 4 | F 5 | 0 6 | A 7 | 0 8 | A 9 | 5 10 | 0 11 | 5 12 | 0 13 | F 14 | F 15 | F 16 | F 17 | -------------------------------------------------------------------------------- /tests/preprocessor/include/pragma-once-c.h: -------------------------------------------------------------------------------- 1 | // pragma-once-c.h 2 | 3 | // Used by the `pragma-once.slang` test 4 | 5 | #pragma once 6 | 7 | #define ONLY_DEFINED_ONCE_C -------------------------------------------------------------------------------- /tests/preprocessor/paste-non-expansion.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | someThingElse SOMETHINGAnother 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/pragma-once-a.h: -------------------------------------------------------------------------------- 1 | // pragma-once-a.h 2 | #pragma once 3 | 4 | // Used by the `pragma-once.slang` test 5 | 6 | float foo(float x) { return x; } 7 | -------------------------------------------------------------------------------- /tests/vkray/callable-shared.slang: -------------------------------------------------------------------------------- 1 | // callable-shared.slang 2 | //TEST_IGNORE_FILE: 3 | 4 | struct MaterialPayload 5 | { 6 | float4 albedo; 7 | float2 uv; 8 | }; 9 | -------------------------------------------------------------------------------- /tests/bugs/gl-33-ext.slang: -------------------------------------------------------------------------------- 1 | // gl-33-ext.slang 2 | //TEST_IGNORE_FILE: 3 | 4 | struct A 5 | { 6 | int state; 7 | [mutating] int next() { return state; } 8 | }; 9 | -------------------------------------------------------------------------------- /tests/cross-compile/sign.slang.hlsl: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | float4 main() : SV_Target 3 | { 4 | float4 s = sign(float4(1.5, 1.0, -1.5, -1.0)); 5 | return s; 6 | } -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-line-directive-mode.slang: -------------------------------------------------------------------------------- 1 | // unknown-line-directive-mode.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-line-directive-mode quizzical 4 | -------------------------------------------------------------------------------- /tests/diagnostics/function-redefinition.slang.disabled: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // redefining a function 3 | 4 | int foo(int a) { return 0; } 5 | int foo(int b) { return 1; } 6 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3 3 | D 4 | F 5 | E 6 | 12 7 | 47 8 | 4B 9 | 51 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-concat-4.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | CONCAT ( a , b ) A2B2 CONCAT ( a , b ) 6 | } 7 | -------------------------------------------------------------------------------- /tests/rewriter/type-splitting.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // This file only exists so that `type-splitting.hlsl` officially appears to be using some Slang code. 4 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/duplicate-output.slang: -------------------------------------------------------------------------------- 1 | // duplicate-output.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-entry main -stage compute -o myKernel.dxbc -o myKernel.dxbc 4 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/active-mask/if-early-exit.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F 2 | F 3 | F 4 | F 5 | 0 6 | A 7 | 0 8 | A 9 | 5 10 | 0 11 | 5 12 | 0 13 | 5 14 | 0 15 | 5 16 | 0 17 | -------------------------------------------------------------------------------- /tests/preprocessor/include.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // #include support 3 | 4 | int foo() { return 0; } 5 | 6 | #include "include-a.slang.h" 7 | 8 | int baz() { return bar(); } -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-complex.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | Thing11 Yeppers PasteConditional 10 37 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-include.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | #include "./include/special-macro-include.h" 4 | #include "include/special-macro-include.h" -------------------------------------------------------------------------------- /tests/bugs/dxbc-double-problem.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: double 2 | 0.674277 3 | 3.141593 4 | 0.017453 5 | 38.633236 6 | 0.000000 7 | 0.000000 8 | 0.000000 9 | 0.000000 10 | -------------------------------------------------------------------------------- /tests/compute/transcendental.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | -0.410156 3 | -0.910156 4 | 0.410156 5 | -0.910156 6 | -0.140625 7 | -0.988281 8 | 0.140625 9 | -0.988281 10 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/output-no-target.slang: -------------------------------------------------------------------------------- 1 | // output-no-target.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-target dxbc -target spirv -entry main -stage compute -o bad.hlsl 4 | -------------------------------------------------------------------------------- /tests/diagnostics/token-line-continuation.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | 3 | // Check the diagnostic output if a token uses \ line split 4 | 5 | void foo() { br\ 6 | eak; } 7 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/bit-cast/bit-cast-16-bit.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 4200 3 | 3 4 | 40A00000 5 | 34A00000 6 | 34E00000 7 | 4880 8 | 4980 9 | 3 10 | 5 11 | 5 12 | 7 13 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-detail-2.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | // Macro parameters must have unique names 4 | 5 | #define A(x, x) a x b x c 6 | 7 | A(,) 8 | 9 | -------------------------------------------------------------------------------- /source/slang/slang-ir-ssa.h: -------------------------------------------------------------------------------- 1 | // slang-ir-ssa.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | struct IRModule; 7 | 8 | void constructSSA(IRModule* module); 9 | } 10 | -------------------------------------------------------------------------------- /tests/compute/global-generic-value-param.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 7 2 | 18 3 | 29 4 | 3A 5 | 4B 6 | 5C 7 | 6D 8 | 7E 9 | 8F 10 | 90 11 | A1 12 | B2 13 | C3 14 | D4 15 | E5 16 | F6 17 | -------------------------------------------------------------------------------- /tests/diagnostics/recursive-import-extra.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // This file creates an `import` loop with 4 | // `recursive-import.slang` 5 | 6 | import recursive_import; 7 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-simple.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | 5 "tests/preprocessor/special-macro-simple.slang" 6 | } 7 | -------------------------------------------------------------------------------- /docs/user-guide/nav.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /tests/compute/static-const-vector-array.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | -0.267204 3 | 0.348847 4 | 0.588588 5 | 1.398255 6 | 1.590841 7 | 0.495721 8 | 1.252321 9 | 0.171198 10 | -------------------------------------------------------------------------------- /tests/compute/transcendental-double.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | -0.410156 3 | -0.910156 4 | 0.410156 5 | -0.910156 6 | -0.140625 7 | -0.988281 8 | 0.140625 9 | -0.988281 10 | -------------------------------------------------------------------------------- /tests/diagnostics/break-outside-loop.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | //DIAGNOSTIC_TEST:COMMAND_LINE_SIMPLE: 3 | 4 | // `break` where it isn't allowed 5 | 6 | void foo() { break; } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/x-arg-tool-unknown.slang: -------------------------------------------------------------------------------- 1 | // x-arg-tool-unknown.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-entry main -stage compute -o myKernel.dxbc -o myKernel.dxbc -Xthingy 4 | -------------------------------------------------------------------------------- /tests/front-end/import-exported-a.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // This file imports other code, and re-exports it to clients of this module. 4 | 5 | __exported __import import_exported_b; -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-is-first-lane.slang.expected.txt: -------------------------------------------------------------------------------- 1 | FFFFFFFF 2 | FFFFFFFF 3 | FFFFFFFF 4 | 1 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | -------------------------------------------------------------------------------- /tests/language-feature/modules/error-in-nested-import/error-in-nested-import.slang: -------------------------------------------------------------------------------- 1 | // error-in-nested-import.slang 2 | //DIAGNOSTIC_TEST:SIMPLE: 3 | 4 | import a; 5 | 6 | int main() 7 | {} -------------------------------------------------------------------------------- /tests/compute/static-const-matrix-array.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 6.000000 3 | 42.000000 4 | 6.000000 5 | 78.000000 6 | 6.000000 7 | 114.000000 8 | 6.000000 9 | 150.000000 10 | -------------------------------------------------------------------------------- /tests/preprocessor/macros/variadic-macro.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | ( 1 ; 2 , 3 ) ( 4 , 5 ) ( 1 , ) ( 2 , 3 ) ( 4 , 5 , 6 ) 6 | } 7 | -------------------------------------------------------------------------------- /tests/bugs/gh-75.hlsl.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/bugs/gh-75.hlsl(24): error 20001: unexpected '}', expected identifier 4 | } 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/compute/matrix-layout.hlsl.expected.txt: -------------------------------------------------------------------------------- 1 | 10D010D 2 | 20D020D 3 | 30D030D 4 | 10D010D 5 | 60D060D 6 | 70D070D 7 | 50D050D 8 | 60D060D 9 | B0D0B0D 10 | 90D090D 11 | A0D0A0D 12 | B0D0B0D 13 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/output-no-entry-point.slang: -------------------------------------------------------------------------------- 1 | // output-no-entry-point.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-o something.dxbc -entry vsMain -stage vertex -entry fsMain -stage fragment 4 | -------------------------------------------------------------------------------- /tests/diagnostics/static-ref-to-nonstatic-member.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | 3 | 4 | struct Color 5 | { 6 | int Red; 7 | } 8 | 9 | void test() 10 | { 11 | int x = Color.Red; 12 | } -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-active-product.slang.expected.txt: -------------------------------------------------------------------------------- 1 | FFFFFFFF 2 | FFFFFFFF 3 | FFFFFFFF 4 | 9D8 5 | 9D8 6 | 9D8 7 | 9D8 8 | 9D8 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/wave-mask/wave-is-first-lane.slang.expected.txt: -------------------------------------------------------------------------------- 1 | FFFFFFFF 2 | FFFFFFFF 3 | FFFFFFFF 4 | 1 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | -------------------------------------------------------------------------------- /tools/render-test/README.md: -------------------------------------------------------------------------------- 1 | Render Test 2 | =========== 3 | 4 | This is a simple tool for running end-to-end tests that render with Slang, so that we can validate that it generates correct code. 5 | -------------------------------------------------------------------------------- /tests/front-end/import-exported-b.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // This file defines the code that will be (transitively) imported into `import-exported.slang` 4 | 5 | float foo(float x) { return x; } -------------------------------------------------------------------------------- /tests/front-end/parser-using-file.spire.disabled: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // test that we can include a file via `using` 3 | 4 | using "parser-using-file-a.slang.h"; 5 | 6 | float base( float x ) { return a(x); } -------------------------------------------------------------------------------- /tests/cross-compile/glsl-samplecmp.slang: -------------------------------------------------------------------------------- 1 | Texture2D shadowMap; 2 | SamplerComparisonState sampler; 3 | float4 main(float4 p : SV_POSITION) 4 | { 5 | return shadowMap.SampleCmp(sampler, float2(0.0), 0.0); 6 | } -------------------------------------------------------------------------------- /tests/diagnostics/command-line/duplicate-target.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 50: the target 'hlsl' has been specified more than once 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-source-language.slang: -------------------------------------------------------------------------------- 1 | // unknown-source-language.slang 2 | 3 | // Unknown source file extension (can't deduce language) 4 | 5 | //DIAGNOSTIC_TEST:SIMPLE:batmobile.car 6 | -------------------------------------------------------------------------------- /tests/diagnostics/extension-visibility-b.slang: -------------------------------------------------------------------------------- 1 | // extension-visibility-b.slang 2 | 3 | import extension_visibility_a; 4 | 5 | extension MyThing : IThing 6 | { 7 | int getValue() { return value; } 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/while-predicate-type.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | // bad type for `while` predicate 3 | 4 | struct S {}; 5 | 6 | void foo() 7 | { 8 | S s; 9 | while(s) {break;} 10 | } 11 | -------------------------------------------------------------------------------- /tests/cross-compile/glslang-error.glsl: -------------------------------------------------------------------------------- 1 | //TEST(glslang):SIMPLE:-pass-through glslang -target spirv -entry compute -stage compute -profile sm_5_1 2 | #version 450 3 | 4 | void main() 5 | { 6 | int a = !; 7 | } 8 | -------------------------------------------------------------------------------- /tests/diagnostics/recursive-import.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | 3 | // A file that recursively imports itself 4 | // (including transitive cases) should be diagnosed. 5 | 6 | import recursive_import_extra; 7 | -------------------------------------------------------------------------------- /tests/cross-compile/barycentrics.slang: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment 2 | 3 | float4 main(float3 bary : SV_Barycentrics) : SV_Target 4 | { 5 | return float4(bary, 0); 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-source-language.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 12: can't deduce language for input file 'batmobile.car' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/front-end/import-subdir.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | 3 | // Confirming that we can use "dot notation" to import via a subdirectory 4 | 5 | __import subdir.import_subdir_a; 6 | 7 | float bar(float x) { return foo(x); } -------------------------------------------------------------------------------- /tests/preprocessor/error.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | 3 | // #error support 4 | 5 | #define FIRST 0 6 | 7 | #if FIRST 8 | #error Not this one! 9 | #else 10 | 11 | #error This isn't valid! 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /tests/preprocessor/file-identity/b.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c.h" 4 | 5 | #ifdef B_H 6 | # error "Shouldn't be included twice" 7 | #endif 8 | 9 | #define B_H 10 | 11 | float foo(float x) { return x; } -------------------------------------------------------------------------------- /tests/cross-compile/fxc-error.hlsl.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | fxc 47.0: tests/cross-compile/fxc-error.hlsl(8): error X3004: undeclared identifier 'gOutputBuffer' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/option-missing-argument.slang.1.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 100001: expected an argument for command-line option '-target' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/illegal-character.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/illegal-character.slang(4): error 10000: illegal character '`' 4 | ` 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/preprocessor/file-identity/c.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "b.h" 4 | 5 | #ifdef C_H 6 | # error "c.h shouldn't be included twice" 7 | #endif 8 | 9 | #define C_H 10 | 11 | float bar(float x) { return x; } -------------------------------------------------------------------------------- /tests/preprocessor/preproc-pound-pound-2.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | #define A a 4 | #define B b 5 | #define OBJ A ## B 6 | 7 | // Should output AB 8 | // Old Slang outputs ab 9 | 10 | OBJ 11 | 12 | -------------------------------------------------------------------------------- /tools/slang-generate/README.md: -------------------------------------------------------------------------------- 1 | # Boilerplate Code Generation Tool 2 | 3 | This directory contains the implementation of the `slang-generate` tool used to generate boilerplate code inside of the compiler implementation. 4 | 5 | -------------------------------------------------------------------------------- /examples/hello-world/README.md: -------------------------------------------------------------------------------- 1 | Slang "Hello World" Example 2 | ========================== 3 | 4 | This example shows how to use the Slang API to compile a simple 5 | compute shader written in Slang into SPIRV and run it in Vulkan. -------------------------------------------------------------------------------- /tests/bugs/gh-463.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/bugs/gh-463.slang(7): error 30015: undefined identifier 'COUNT'. 4 | [instance(COUNT)] 5 | ^~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/bugs/preproc-lex-failure.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | #if 0 4 | // Octal warning 5 | 000 6 | /// Unclosed string literal 7 | "Hello! 8 | /// A non 7 bit ascii code 9 | Š 10 | #else 11 | Hello 12 | #endif -------------------------------------------------------------------------------- /tests/compute/matrix-layout-structured-buffer.slang.2.expected.txt: -------------------------------------------------------------------------------- 1 | 80040100 2 | 91151201 3 | 8A020B02 4 | 8F130C03 5 | 84080504 6 | 950D1605 7 | 82060306 8 | 93171007 9 | 88000908 10 | 8D110E09 11 | 860A070A 12 | 970F140B -------------------------------------------------------------------------------- /tests/compute/matrix-layout-structured-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 80040100 2 | 91151201 3 | 8A020B02 4 | 8F130C03 5 | 84080504 6 | 950D1605 7 | 82060306 8 | 93171007 9 | 88000908 10 | 8D110E09 11 | 860A070A 12 | 970F140B 13 | -------------------------------------------------------------------------------- /tests/cuda/cuda-compile.cu: -------------------------------------------------------------------------------- 1 | //TEST(smoke):COMPILE: -pass-through nvrtc -target ptx -entry hello tests/cuda/cuda-compile.cu 2 | 3 | __global__ 4 | void hello(char *a, int *b) 5 | { 6 | a[threadIdx.x] += b[threadIdx.x]; 7 | } 8 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-output-format.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 60: cannot infer an output format from the output path 'cookies.jar' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/expected-token-eof.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/expected-token-eof.slang(6): error 20001: unexpected end of file, expected ';' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/single-shader-record.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | (0): error 39017: can have at most one 'shader record' attributed constant buffer; found 2. 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/preprocessor/undef.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/undef.slang(5): warning 15401: macro 'FOO' is not defined 4 | #undef FOO 5 | ^~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tools/gfx/cuda/render-cuda.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../renderer-shared.h" 4 | 5 | namespace gfx 6 | { 7 | 8 | SlangResult SLANG_MCALL createCUDADevice(const IDevice::Desc* desc, IDevice** outDevice); 9 | } 10 | -------------------------------------------------------------------------------- /tests/bugs/glsl-layout-define.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: -profile vs_5_0 2 | 3 | layout( 4 | binding = UNDEFINED_VK_BINDING, 5 | set = UNDEFINED_VK_SET) 6 | Texture2DArray Float4Texture2DArrays[] : register(t0, space100); 7 | 8 | -------------------------------------------------------------------------------- /tests/compute/matrix-layout-structured-buffer.slang.1.expected.txt: -------------------------------------------------------------------------------- 1 | 80010300 2 | 90111301 3 | 88060B02 4 | 95160C03 5 | 81020404 6 | 910F1405 7 | 86070906 8 | 96170D07 9 | 82000508 10 | 8F101209 11 | 87080A0A 12 | 97150E0B 13 | -------------------------------------------------------------------------------- /tests/compute/matrix-layout-structured-buffer.slang.3.expected.txt: -------------------------------------------------------------------------------- 1 | 80010300 2 | 90111301 3 | 88060B02 4 | 95160C03 5 | 81020404 6 | 910F1405 7 | 86070906 8 | 96170D07 9 | 82000508 10 | 8F101209 11 | 87080A0A 12 | 97150E0B 13 | -------------------------------------------------------------------------------- /tests/cpp-compiler/c-compile.c: -------------------------------------------------------------------------------- 1 | //TEST(smoke):CPP_COMPILER_EXECUTE: 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char** argv) 7 | { 8 | printf("Hello World!\n"); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /tests/current-bugs/missing-loc-on-assignment.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | (0): error 30019: expected an expression of type 'vector', got 'matrix' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/duplicate-output.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 80: multiple output paths have been specified entry point 'main' on target 'dxbc' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 31: conflicting stages have been specified for entry point 'main' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/profile-ignored.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 42: a '-profile' option was specified, but no target was specified with '-target' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/function-redefinition.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/function-redefinition.slang(5): error 30001: 'foo(int)': function redefinition. 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/literal-int64.slang.expected.txt: -------------------------------------------------------------------------------- 1 | FFFFFFFF 2 | FFFFFFFF 3 | FFFFFFFF 4 | 0 5 | 80000000 6 | 0 7 | 80000000 8 | FFFFFFFF 9 | 80000000 10 | FFFFFFFF 11 | FFFFFFFF 12 | FFFFFFFF 13 | FFFFFFFF 14 | FFFFFFFF 15 | -------------------------------------------------------------------------------- /tests/preprocessor/error.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/preprocessor/error.slang(11): error 15900: #error: This isn't valid! 4 | #error This isn't valid! 5 | ^~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/cpp-compiler/cpp-compile.cpp: -------------------------------------------------------------------------------- 1 | //TEST(smoke):CPP_COMPILER_EXECUTE: 2 | #include 3 | using namespace std; 4 | 5 | int main(int argc, char** argv) 6 | { 7 | cout << "Hello World!" << endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /tests/diagnostics/call-argument-type.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST(smoke):SIMPLE: 2 | // call function with wrong argument type 3 | 4 | struct A {}; 5 | struct B {}; 6 | 7 | void f(A a) {} 8 | void g(B b) 9 | { 10 | f(b); 11 | } 12 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 31: conflicting stages have been specified for entry point 'vsMain' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/entry-point-redundant-stage.slang: -------------------------------------------------------------------------------- 1 | // entry-point-redundant-stage.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-stage vertex -stage vertex 4 | 5 | //DIAGNOSTIC_TEST:SIMPLE:-entry vsMain -stage vertex -stage vertex 6 | -------------------------------------------------------------------------------- /tests/diagnostics/extension-visibility-c.slang: -------------------------------------------------------------------------------- 1 | // extension-visibility-c.slang 2 | 3 | import extension_visibility_a; 4 | import extension_visibility_b; 5 | 6 | int works(MyThing thing) 7 | { 8 | return helper(thing); 9 | } 10 | -------------------------------------------------------------------------------- /tests/diagnostics/packoffset.slang: -------------------------------------------------------------------------------- 1 | // packoffset.slang 2 | //DIAGNOSTIC_TEST:SIMPLE:-target hlsl 3 | 4 | // use of `packoffset` (not supported): 5 | cbuffer B 6 | { 7 | float4 x : packoffset(c0); 8 | } 9 | 10 | void main() 11 | {} -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/active-mask/if-conditional-exit.slang.expected.txt: -------------------------------------------------------------------------------- 1 | F 2 | F 3 | F 4 | F 5 | 0 6 | A 7 | 0 8 | A 9 | 0 10 | 0 11 | 0 12 | 8 13 | 0 14 | 2 15 | 0 16 | 0 17 | 5 18 | 0 19 | 5 20 | 0 21 | 7 22 | 7 23 | 7 24 | 0 25 | -------------------------------------------------------------------------------- /tests/ir/string-literal.slang: -------------------------------------------------------------------------------- 1 | //TEST(compute):SIMPLE:-dump-ir -stage compute -entry main 2 | 3 | [numthreads(1, 1, 1)] 4 | void main( 5 | uint tid : SV_DispatchThreadIndex) 6 | { 7 | "Hello \t\n\0x083 World"; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /tests/compute/half-structured-buffer.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 3C000000 4 | 42004000 5 | 1 6 | 3F800000 7 | 45004400 8 | 47004600 9 | 2 10 | 40000000 11 | 48804800 12 | 49804900 13 | 3 14 | 40400000 15 | 4A804A00 16 | 4B804B00 17 | -------------------------------------------------------------------------------- /tests/diagnostics/hull-shader-no-domain.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/hull-shader-no-domain.slang(32): error 50052: 'HullShader' requires attribute 'Domain'. 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/interface-requirement-not-satisfied.slang: -------------------------------------------------------------------------------- 1 | // interface-requirement-not-satisfied.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE: 4 | 5 | interface IFoo 6 | { 7 | void bar(); 8 | } 9 | 10 | struct T : IFoo 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /tests/diagnostics/variable-void-type.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/variable-void-type.slang(6): error 30009: invalid type 'void'. 4 | void a; 5 | ^~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/front-end/parser-error-unclosed-curly.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/front-end/parser-error-unclosed-curly.slang(4): error 20001: unexpected end of file, expected '}' 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/active-mask/for.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 0 2 | E 3 | E 4 | E 5 | 0 6 | 0 7 | C 8 | C 9 | 0 10 | 0 11 | 0 12 | 8 13 | 0 14 | 0 15 | 0 16 | 0 17 | F 18 | F 19 | F 20 | F 21 | 0 22 | 0 23 | 0 24 | 0 25 | 0 26 | 0 27 | 0 28 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-redefine-object.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | // 4 | // Check replacing __LINE__ 5 | // 6 | 7 | #define __LINE__ "Hello" 8 | 9 | __LINE__ 10 | 11 | #undef __LINE__ 12 | 13 | __LINE__ 14 | -------------------------------------------------------------------------------- /tests/bugs/split-nested-types.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | struct A { int x; }; 4 | 5 | struct B { float y; }; 6 | 7 | struct CC { Texture2D t; SamplerState s; }; 8 | 9 | struct M 10 | { 11 | A a; 12 | B b; 13 | CC c; 14 | }; 15 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/entry-point-conflicting-stage.slang: -------------------------------------------------------------------------------- 1 | // entry-point-conflicting-stage.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-stage vertex -stage fragment 4 | 5 | //DIAGNOSTIC_TEST:SIMPLE:-entry vsMain -stage compute -stage vertex 6 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/profile-ignored.slang.1.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 43: when using multiple targets, any '-profile' option must follow the '-target' it applies to 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/unreachable-code.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/diagnostics/unreachable-code.slang(10): warning 41000: unreachable code detected 4 | int x = 0; 5 | ^~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/front-end/typedef.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // test that we can `typedef` a type 3 | 4 | typedef float F32; 5 | 6 | F32 foo() 7 | { 8 | float x = 123.0; 9 | return x; 10 | } 11 | 12 | float bar() 13 | { 14 | return foo(); 15 | } 16 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-concat-1.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | #define CONCAT(a, b) a ## b 4 | 5 | // Correct output AB; 6 | // Old Slang output 7 | // ab; 8 | 9 | #define A a 10 | #define B b 11 | 12 | CONCAT(A, B); 13 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-include.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | "tests/preprocessor/include/special-macro-include.h" 5 "tests/preprocessor/include/special-macro-include.h" 5 6 | } 7 | -------------------------------------------------------------------------------- /source/slang/slang-ir-optix-entry-point-uniforms.h: -------------------------------------------------------------------------------- 1 | // slang-ir-optix-entry-point-uniforms.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | 7 | struct IRModule; 8 | void collectOptiXEntryPointUniformParams(IRModule* module); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/bugs/gh-666.slang: -------------------------------------------------------------------------------- 1 | // gh-666.slang 2 | 3 | //TEST:COMPARE_HLSL:-no-mangle -profile ps_5_0 -entry main 4 | 5 | static const uint foo = 1; 6 | static const uint bar = foo; 7 | 8 | float4 main() : SV_TARGET 9 | { 10 | return bar; 11 | } 12 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/option-missing-argument.slang: -------------------------------------------------------------------------------- 1 | // option-missing-argument.slang 2 | 3 | // Missing argument for an option: 4 | 5 | //DIAGNOSTIC_TEST:SIMPLE:-target -profile ps_4_0 6 | 7 | //DIAGNOSTIC_TEST:SIMPLE:-profile ps_4_0 -target 8 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/output-no-target.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 61: no specified '-target' option matches the output path 'bad.hlsl', which implies the 'hlsl' format 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/expected-token.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/expected-token.slang(6): error 20001: unexpected ']', expected ';' 4 | int a = 3 ] 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/gh-38-fs.hlsl: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // Companion file to `gh-38-fs.hlsl` 4 | 5 | Texture2D overlappingB : register(t0); 6 | 7 | Texture2D conflicting : register(t2); 8 | 9 | float4 main() : SV_Target { return 0; } 10 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/active-mask/switch.slang.expected.txt: -------------------------------------------------------------------------------- 1 | A0000001 2 | 0 3 | 0 4 | 0 5 | 0 6 | A1000102 7 | 0 8 | 0 9 | 0 10 | 0 11 | A2000204 12 | 0 13 | 0 14 | 0 15 | 0 16 | A3000308 17 | A000040F 18 | A100040F 19 | A200040F 20 | A300040F 21 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-stringify-1.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | #define A a 4 | #define B b 5 | 6 | // Correct output 7 | // "A B" 8 | // Old Slang output 9 | // # a b ; 10 | 11 | #define STRINGIFY(x) #x 12 | STRINGIFY(A B); -------------------------------------------------------------------------------- /tools/gfx/cpu/render-cpu.h: -------------------------------------------------------------------------------- 1 | // render-cpu.h 2 | #pragma once 3 | 4 | #include "../renderer-shared.h" 5 | 6 | namespace gfx 7 | { 8 | 9 | SlangResult SLANG_MCALL createCPUDevice(const IDevice::Desc* desc, IDevice** outDevice); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /examples/shader-object/README.md: -------------------------------------------------------------------------------- 1 | Slang "Shader Object" Example 2 | ========================== 3 | 4 | This example shows how to use the Shader Object model implemented in the `slang-gfx` layer to 5 | manage shader parameter binding and shader specialization. 6 | -------------------------------------------------------------------------------- /tests/bugs/preproc-lex-failure-2.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | // Test that diagnostics appear for invalid tokens. 4 | 5 | #if 1 6 | // Octal warning 7 | 000 8 | /// Unclosed string literal 9 | "Hello! 10 | #else 11 | Hello 12 | #endif 13 | -------------------------------------------------------------------------------- /tests/cpp-compiler/simple-c-compile.c: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: -entry main -target exe -pass-through c 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char** argv) 7 | { 8 | printf("Hello World!\n"); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /tests/diagnostics/hull-shader-invalid-domain.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/hull-shader-invalid-domain.slang(39): error 50053: 'Domain' should be either 'triangles' or 'quads'. 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/undefined-identifier.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/undefined-identifier.slang(6): error 30015: undefined identifier 'b'. 4 | int a = b; 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/unreachable-code.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | 3 | // "Obviously" unreachable code. 4 | 5 | int foo() 6 | { 7 | return 1; 8 | 9 | // The following statements can never be reached. 10 | int x = 0; 11 | return x; 12 | } 13 | -------------------------------------------------------------------------------- /tests/front-end/import-exported.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | 3 | // Confirming that we can use a re-exported function 4 | 5 | // `a` imports `b` (which defines `foo`) and re-exports it 6 | __import import_exported_a; 7 | 8 | float bar(float x) { return foo(x); } -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/active-mask/switch-no-default.slang.expected.txt: -------------------------------------------------------------------------------- 1 | A0000001 2 | 0 3 | 0 4 | 0 5 | 0 6 | A1000102 7 | 0 8 | 0 9 | 0 10 | 0 11 | A2000204 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | A000040F 18 | A100040F 19 | A200040F 20 | A300040F 21 | -------------------------------------------------------------------------------- /tests/preprocessor/define-redefine.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | 3 | // Confirm that we handle redefinition 4 | // of an existing define (with a diagnostic) 5 | 6 | #define FOO 1.0f 7 | 8 | float foo() { return FOO + 2.0; } 9 | 10 | #define FOO 2.0f 11 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-detail-3.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/preproc-detail-3.slang(9): warning 15401: macro 'C' is not defined 4 | #undef C 5 | ^ 6 | } 7 | standard output = { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /tests/preprocessor/warning.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | 3 | // #warning support 4 | 5 | #define FIRST 1 6 | 7 | #if FIRST 8 | 9 | #warning You wouldn't like me when I'm angry... 10 | 11 | #else 12 | 13 | #warning Not this one! 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /tests/spirv/spirv-version-option.slang.glsl: -------------------------------------------------------------------------------- 1 | // spirv-version-option.slang.glsl 2 | //TEST_IGNORE_FILE: 3 | 4 | #version 450 5 | 6 | layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; 7 | 8 | void main() 9 | { 10 | return; 11 | } 12 | -------------------------------------------------------------------------------- /tools/gfx/open-gl/render-gl.h: -------------------------------------------------------------------------------- 1 | // render-d3d11.h 2 | #pragma once 3 | 4 | #include "../renderer-shared.h" 5 | 6 | namespace gfx { 7 | 8 | SlangResult SLANG_MCALL createGLDevice(const IDevice::Desc* desc, IDevice** outDevice); 9 | 10 | } // gfx 11 | -------------------------------------------------------------------------------- /tests/bugs/gh-463.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | 3 | // undefined identifier used in `[instance(...)]` attribute 4 | 5 | struct V { float4 u : U; }; 6 | 7 | [instance(COUNT)] 8 | void myGS(triangle V input[3], TriangleStream output) 9 | { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/cross-compile/early-depth-stencil.hlsl.hlsl: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | #pragma pack_matrix(column_major) 3 | 4 | [earlydepthstencil] 5 | vector main() : SV_TARGET 6 | { 7 | return vector((float) 1, (float) 0, (float) 0, (float) 1); 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/call-argument-type.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/call-argument-type.slang(10): error 30019: expected an expression of type 'A', got 'B' 4 | f(b); 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/stage-ignored.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 34: when compiling multiple entry points, any '-stage' options must follow the '-entry' option that they apply to 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/missing-semicolon-after-semantic.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/missing-semicolon-after-semantic.slang(9): error 20001: unexpected '}', expected ';' 4 | }; 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/bugs/import-with-error.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | 3 | // Confirm that we correctly issue a diagnostic when 4 | // we `import` a module that has some errors in it. 5 | 6 | import import_with_error_extra; 7 | 8 | void main() 9 | { 10 | broken(); 11 | } 12 | -------------------------------------------------------------------------------- /tests/bugs/vec-compare.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 23233723 2 | 37373737 3 | 3B3B163B 4 | 3B3B3E3B 5 | 23233B23 6 | 37373B37 7 | 3B3B3E3B 8 | 3B3B383B 9 | 37373B23 10 | 16163B37 11 | 3E3E3E3B 12 | 3E3E383B 13 | 3B3B3B37 14 | 3E3E3B16 15 | 38383E3E 16 | 3838383E 17 | 18 | -------------------------------------------------------------------------------- /tools/gfx/d3d11/render-d3d11.h: -------------------------------------------------------------------------------- 1 | // render-d3d11.h 2 | #pragma once 3 | 4 | #include "../renderer-shared.h" 5 | 6 | namespace gfx 7 | { 8 | 9 | SlangResult SLANG_MCALL createD3D11Device(const IDevice::Desc* desc, IDevice** outDevice); 10 | 11 | } // gfx 12 | -------------------------------------------------------------------------------- /tools/gfx/d3d12/render-d3d12.h: -------------------------------------------------------------------------------- 1 | // render-d3d12.h 2 | #pragma once 3 | 4 | #include "../renderer-shared.h" 5 | 6 | namespace gfx 7 | { 8 | 9 | SlangResult SLANG_MCALL createD3D12Device(const IDevice::Desc* desc, IDevice** outDevice); 10 | 11 | } // gfx 12 | -------------------------------------------------------------------------------- /tests/cpp-compiler/c-compile-error.c: -------------------------------------------------------------------------------- 1 | //TEST(smoke):CPP_COMPILER_EXECUTE: 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char** argv) 7 | { 8 | int a = b + c; 9 | 10 | printf("Hello World!\n"); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /tests/front-end/lexer-comments.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // confirming that the lexer handles comments correctly 3 | 4 | // line comment 5 | 6 | /* block comment 7 | */ 8 | 9 | /* block comments don't nest 10 | /* 11 | */ 12 | 13 | float f(float f) { return f; } -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/active-mask/switch-trivial-fallthrough.slang.expected.txt: -------------------------------------------------------------------------------- 1 | A0000003 2 | A1000003 3 | 0 4 | 0 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 0 11 | A200020C 12 | A300020C 13 | 0 14 | 0 15 | 0 16 | 0 17 | A000040F 18 | A100040F 19 | A200040F 20 | A300040F 21 | -------------------------------------------------------------------------------- /tests/language-feature/inheritance/struct-inheritance-imported.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | // struct-inheritance-imported.slang 3 | 4 | struct Base 5 | { 6 | int a; 7 | } 8 | 9 | struct Derived : Base 10 | {} 11 | 12 | int getA(Derived d) { return d.a; } 13 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-redefine-function.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | // 4 | // Check replacing __FILE__ 5 | // 6 | 7 | #define __FILE__(x) "Is" x 8 | 9 | __FILE__("Anybody") 10 | __FILE__(There) 11 | 12 | #undef __FILE__ 13 | 14 | __FILE__ -------------------------------------------------------------------------------- /tests/spirv/direct-spirv-emit.slang: -------------------------------------------------------------------------------- 1 | // direct-spirv-emit.slang 2 | 3 | //TEST:SIMPLE:-target spirv -entry computeMain -stage compute -emit-spirv-directly 4 | 5 | // Test ability to directly output SPIR-V 6 | 7 | [numthreads(4,1,1)] 8 | void computeMain() 9 | {} 10 | -------------------------------------------------------------------------------- /source/slang/slang-value-reflect.cpp: -------------------------------------------------------------------------------- 1 | #include "../../slang.h" 2 | 3 | #include "slang-value-reflect.h" 4 | 5 | #include "slang-generated-value.h" 6 | #include "slang-generated-value-macro.h" 7 | 8 | namespace Slang 9 | { 10 | 11 | 12 | 13 | } // namespace Slang 14 | -------------------------------------------------------------------------------- /tests/cross-compile/barycentrics.slang.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #extension GL_NV_fragment_shader_barycentric : enable 4 | 5 | layout(location = 0) 6 | out vec4 _S1; 7 | 8 | void main() 9 | { 10 | _S1 = vec4(gl_BaryCoordNV, float(0)); 11 | return; 12 | } 13 | -------------------------------------------------------------------------------- /tests/cross-compile/half-conversion.slang: -------------------------------------------------------------------------------- 1 | // half-conversion.slang 2 | 3 | //TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment 4 | 5 | cbuffer C 6 | { 7 | uint4 u; 8 | } 9 | 10 | float4 main() : SV_Target 11 | { 12 | return f16tof32(u); 13 | } 14 | -------------------------------------------------------------------------------- /tests/diagnostics/token-paste-location.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | 3 | 4 | #define SOME + 5 | #define THING + 6 | 7 | #define A SOME 8 | #define B THING 9 | 10 | #define PASTE2(x, y) x##y 11 | #define PASTE(x, y) PASTE2(x, y) 12 | 13 | 14 | PASTE(A, B) 15 | -------------------------------------------------------------------------------- /tests/language-feature/extensions/extension-import-helper.slang: -------------------------------------------------------------------------------- 1 | // extension-import-helper.slang 2 | 3 | //TEST_IGNORE_FILE: 4 | 5 | interface IThing 6 | { 7 | float getValue(); 8 | } 9 | 10 | extension float : IThing 11 | { 12 | float getValue() { return this; } 13 | } -------------------------------------------------------------------------------- /tests/preprocessor/include-multiple.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // #include support 3 | 4 | int foo() { return 0; } 5 | 6 | #include "include-a.slang.h" 7 | #include "../preprocessor/include-a.slang.h" 8 | #include "./include-a.slang.h" 9 | 10 | int baz() { return bar(); } -------------------------------------------------------------------------------- /tests/serialization/serialized-module.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // serialized-module.slang 4 | 5 | struct Thing 6 | { 7 | int a; 8 | int b; 9 | }; 10 | 11 | int foo(Thing thing) 12 | { 13 | return (thing.a + thing.b) - thing.b; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /tools/gfx/vulkan/render-vk.h: -------------------------------------------------------------------------------- 1 | // render-vk.h 2 | #pragma once 3 | 4 | #include 5 | #include "../renderer-shared.h" 6 | 7 | namespace gfx { 8 | 9 | SlangResult SLANG_MCALL createVKDevice(const IDevice::Desc* desc, IDevice** outDevice); 10 | 11 | } // gfx 12 | -------------------------------------------------------------------------------- /tests/cpp-compiler/c-compile-link-error.c: -------------------------------------------------------------------------------- 1 | //TEST(smoke):CPP_COMPILER_EXECUTE: 2 | 3 | #include 4 | #include 5 | 6 | extern int thing; 7 | 8 | int main(int argc, char** argv) 9 | { 10 | printf("Hello World %d!\n", thing); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /tests/diagnostics/break-outside-loop.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/break-outside-loop.slang(6): error 30003: 'break' must appear inside loop constructs. 4 | void foo() { break; } 5 | ^~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/entry-point-no-stage.slang: -------------------------------------------------------------------------------- 1 | // entry-point-no-stage.slang 2 | 3 | // Confirm that we generate a diagnostic when 4 | // compiling an entry point without any 5 | // stage specified. 6 | 7 | //DIAGNOSTIC_TEST:SIMPLE:-entry main 8 | 9 | void main() 10 | {} 11 | -------------------------------------------------------------------------------- /tests/diagnostics/while-predicate-type.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/while-predicate-type.slang(9): error 30019: expected an expression of type 'bool', got 'S' 4 | while(s) {break;} 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/rewriter/resources-in-structs.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | struct Material 4 | { 5 | float4 color; 6 | Texture2D t; 7 | SamplerState s; 8 | }; 9 | 10 | float4 evaluateMaterial(Material m, float2 uv) 11 | { 12 | return m.color + m.t.Sample(m.s, uv); 13 | } 14 | -------------------------------------------------------------------------------- /source/slang/slang-ir-constexpr.h: -------------------------------------------------------------------------------- 1 | // slang-ir-constexpr.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | class DiagnosticSink; 7 | struct IRModule; 8 | 9 | void propagateConstExpr( 10 | IRModule* module, 11 | DiagnosticSink* sink); 12 | } 13 | -------------------------------------------------------------------------------- /tests/bugs/eroneous-generic-parse.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/bugs/eroneous-generic-parse.slang(7): error 20001: unexpected integer literal, expected identifier 4 | int doThing<1>() { return 2; } 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/bugs/glsl-vk-binding-define.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: -profile vs_5_0 2 | 3 | [[vk::binding(UNDEFINED_VK_BINDING, UNDEFINED_VK_SET)]] 4 | Texture2DArray Float4Texture2DArrays[] : register(t0, space100); 5 | 6 | float4 main() : SV_Position 7 | { 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /tests/cuda/cuda-layout.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: int32_t 2 | 1 3 | 2 4 | 1 5 | 4 6 | 2 7 | 4 8 | 2 9 | 8 10 | 4 11 | 8 12 | 4 13 | 16 14 | 8 15 | 16 16 | 8 17 | 16 18 | 2 19 | 4 20 | 4 21 | 4 22 | 4 23 | 8 24 | 4 25 | 16 26 | 8 27 | 16 28 | 8 29 | 16 30 | 0 31 | 0 32 | 0 33 | 0 34 | -------------------------------------------------------------------------------- /tests/diagnostics/token-line-continuation.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/token-line-continuation.slang(5): error 30003: 'break' must appear inside loop constructs. 4 | void foo() { br\ 5 | ^~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/undefined-in-preprocessor-conditional.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST(smoke):SIMPLE: 2 | 3 | // Use an undefined identifier in a preprocessor conditional 4 | 5 | #define FOO 1 6 | #define BORT 1 7 | 8 | #if FOO && BART 9 | #error Should not get here 10 | #endif 11 | -------------------------------------------------------------------------------- /tests/preprocessor/define-simple.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // #define support 3 | 4 | #define FOO 1.0f 5 | 6 | float foo() { return FOO + 2.0; } 7 | 8 | #define BAR 99 9 | 10 | #if BAR > 10 11 | int bar() { return 0; } 12 | #else 13 | BadThing shouldntCompile; 14 | #endif 15 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-multi-line.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | // Output here varies by compiler. Gcc makes the line the one with M. Clang makes it the end bracket. 4 | 5 | #define M(ARG) __LINE__ 6 | 7 | 8 | int x = M 9 | ( 10 | ignored 11 | ) 12 | ; 13 | -------------------------------------------------------------------------------- /tests/preprocessor/warning.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/warning.slang(9): warning 15901: #warning: You wouldn't like me when I'm angry... 4 | #warning You wouldn't like me when I'm angry... 5 | ^~~~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /source/slang/slang-ir-inline.h: -------------------------------------------------------------------------------- 1 | // slang-ir-inline.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | struct IRModule; 7 | 8 | /// Inline any call sites to functions marked `[unsafeForceInlineEarly]` 9 | void performMandatoryEarlyInlining(IRModule* module); 10 | } 11 | -------------------------------------------------------------------------------- /source/slang/slang-ir-specialize.h: -------------------------------------------------------------------------------- 1 | // slang-ir-specialize.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | struct IRModule; 7 | 8 | /// Specialize generic and interface-based code to use concrete types. 9 | void specializeModule( 10 | IRModule* module); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/bugs/import-with-error-extra.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // This file exists to be imported. 4 | // 5 | // It contains a semantic error that should lead to compilation failure 6 | // in the module doing the importing. 7 | 8 | void broken() 9 | { 10 | int a = b; 11 | } 12 | -------------------------------------------------------------------------------- /tests/diagnostics/x-macro-line-continuation.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/x-macro-line-continuation.slang(11): error 15501: wrong number of arguments to macro (expected 1, got 2) 4 | M(4, 4) \ 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-detail-2.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/preproc-detail-2.slang(7): error 15408: redefinition of macro parameter 'A' 4 | #define A(x, x) a x b x c 5 | ^ 6 | } 7 | standard output = { 8 | a b c 9 | } 10 | -------------------------------------------------------------------------------- /tests/vkray/miss.slang: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE: -profile glsl_460+GL_EXT_ray_tracing -stage miss -entry main -target spirv-assembly 2 | 3 | struct ShadowRay 4 | { 5 | float hitDistance; 6 | }; 7 | 8 | void main(in out ShadowRay ray) 9 | { 10 | ray.hitDistance = 10000.0f; 11 | } 12 | -------------------------------------------------------------------------------- /examples/heterogeneous-hello-world/README.md: -------------------------------------------------------------------------------- 1 | Slang "CPU Hello World Heterogeneous" Example 2 | =============================== 3 | 4 | This example is a work-in-progress to illustrate how a heterogeneous programming example might work. It should NOT be used as a reference for working Slang code yet. -------------------------------------------------------------------------------- /external/spirv-tools-generated/spv-amd-shader-explicit-vertex-parameter.insts.inc: -------------------------------------------------------------------------------- 1 | 2 | 3 | static const spv_ext_inst_desc_t spv_amd_shader_explicit_vertex_parameter_entries[] = { 4 | {"InterpolateAtVertexAMD", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} 5 | }; -------------------------------------------------------------------------------- /tests/bugs/cbuffer-member-init.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:COMPARE_HLSL: -profile vs_5_0 2 | 3 | // Allow (but ignore) initializer on `cbuffer` member 4 | 5 | cbuffer C : register(b0) 6 | { 7 | int a = -1; 8 | }; 9 | 10 | float4 main() : SV_POSITION 11 | { 12 | return 0; 13 | // return a; 14 | } 15 | -------------------------------------------------------------------------------- /tests/compute/kernel-context-threading.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | 1.000000 3 | 0.000000 4 | 0.000000 5 | 0.000000 6 | 0.000000 7 | 1.000000 8 | 0.000000 9 | 0.000000 10 | 0.000000 11 | 0.000000 12 | 1.000000 13 | 0.000000 14 | 10.000000 15 | 20.000000 16 | 30.000000 17 | 1.000000 18 | -------------------------------------------------------------------------------- /tests/compute/write-structured-buffer-field.slang.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 1 7 | 7 8 | 8 9 | 9 10 | A 11 | B 12 | C 13 | D 14 | 1 15 | F 16 | 10 17 | 11 18 | 12 19 | 13 20 | 14 21 | 15 22 | 1 23 | 17 24 | 18 25 | 19 26 | 1A 27 | 1B 28 | 1C 29 | 1D 30 | 1 31 | 1F 32 | 20 33 | -------------------------------------------------------------------------------- /tests/cross-compile/glslang-error.glsl.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | glslang: tests/cross-compile/glslang-error.glsl(6): error : '' : syntax error, unexpected SEMICOLON 4 | glslang: note : ERROR: 1 compilation errors. No code generated. 5 | } 6 | standard output = { 7 | } 8 | -------------------------------------------------------------------------------- /tests/cross-compile/integer-input.slang: -------------------------------------------------------------------------------- 1 | //TEST_DISABLED:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 2 | 3 | struct VS_OUT 4 | { 5 | uint drawID : DRAW_ID; 6 | }; 7 | 8 | float4 main(VS_OUT vsOut) : SV_Target 9 | { 10 | return float4(float(vsOut.drawID)); 11 | } 12 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 35: no stage was specified for entry point 'main'; when using the '-pass-through' option, stages must be fully specified on the command line 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/continue-outside-loop.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/continue-outside-loop.slang(4): error 30004: 'continue' must appear inside loop constructs. 4 | void foo() { continue; } 5 | ^~~~~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/preprocessor/if.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // #ifdef support 3 | 4 | 5 | #if (1 - 1*2) < 0 6 | int foo() { return 0; } 7 | #else 8 | BadThing thatWontCompile; 9 | #endif 10 | 11 | #if (1 >> 1) && ~999 12 | AnotherError onThisLine; 13 | #else 14 | int bar() { return foo(); } 15 | #endif -------------------------------------------------------------------------------- /source/slang/slang-ir-missing-return.h: -------------------------------------------------------------------------------- 1 | // slang-ir-missing-return.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | class DiagnosticSink; 7 | struct IRModule; 8 | 9 | void checkForMissingReturns( 10 | IRModule* module, 11 | DiagnosticSink* sink); 12 | } 13 | -------------------------------------------------------------------------------- /tests/bugs/ray-flags-non-constant.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/bugs/ray-flags-non-constant.slang(11): error 39999: expression does not evaluate to a compile-time constant 4 | RayQuery query; 5 | ^~~~~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/local-used-before-declared.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/local-used-before-declared.slang(14): fatal error 39999: local variable 'd' is being used before its declaration. 4 | int d = 0; 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/missing-semicolon-after-semantic.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | 3 | // Forgetting to put in the `;` after declaraing a variable/field 4 | // with a semantic used to put the compiler into an infinite loop. 5 | 6 | struct Test 7 | { 8 | float4 pos : SV_POSITION 9 | }; 10 | -------------------------------------------------------------------------------- /tests/diagnostics/packoffset.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/packoffset.slang(7): error 39012: explicit 'packoffset' bindings are not yet supported in Slang 4 | float4 x : packoffset(c0); 5 | ^~~~~~~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/preprocessor/ifdef.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // #ifdef support 3 | 4 | #define A 5 | 6 | #ifdef A 7 | int foo() { return 0; } 8 | #else 9 | BadThing thatWontCompile; 10 | #endif 11 | 12 | #ifdef BadThing 13 | AnotherError onThisLine; 14 | #else 15 | int bar() { return foo(); } 16 | #endif -------------------------------------------------------------------------------- /source/slang/slang-ir-strip-witness-tables.h: -------------------------------------------------------------------------------- 1 | // slang-ir-strip-witness-tables.cpp 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | struct IRModule; 7 | 8 | /// Strip the contents of all witness table instructions from the given IR `module` 9 | void stripWitnessTables(IRModule* module); 10 | } -------------------------------------------------------------------------------- /tests/diagnostics/missing-include-file.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/missing-include-file.slang(4): error 15300: failed to find include file 'does-not-exist.h' 4 | #include "does-not-exist.h" 5 | ^~~~~~~~~~~~~~~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/token-paste-location.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | token paste(1): error 20001: unexpected '++', expected identifier 4 | tests/diagnostics/token-paste-location.slang(10): note: see token pasted location 5 | ++ 6 | ^~ 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tests/ir/factorial.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | } 4 | standard output = { 5 | outputData[0] = 1 6 | outputData[1] = 1 7 | outputData[2] = 2 8 | outputData[3] = 6 9 | outputData[4] = 24 10 | outputData[5] = 120 11 | outputData[6] = 720 12 | outputData[7] = 5040 13 | } 14 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-concat-2.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | #define CONCAT(a, b) a ## b 4 | 5 | #define A a 6 | #define B b 7 | 8 | #define A2 A 9 | #define B2 B 10 | 11 | // Correct output: a A2B2 b; 12 | // Old Slang output 13 | // a ab b ; 14 | 15 | CONCAT(A2 A2, B2 B2); 16 | -------------------------------------------------------------------------------- /tests/preprocessor/x-macro.slang: -------------------------------------------------------------------------------- 1 | // x-macro.slang 2 | //TEST:SIMPLE: 3 | 4 | // Test the case of an "X macro" that takes another macro as a parameter 5 | 6 | #define X(M) M(0) M(1) M(2) M(3) M(4) M(5) M(6) M(7) 7 | 8 | #define A(x) + x + x + x 9 | 10 | int sum() 11 | { 12 | return X(A); 13 | } 14 | -------------------------------------------------------------------------------- /external/vulkan/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil. 2 | -------------------------------------------------------------------------------- /tests/bugs/texture2d-ms.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE: -profile lib_6_3 -entry main -stage compute -target spirv-assembly 2 | 3 | [[vk::binding(0, 0)]] 4 | Texture2DMS tex : register(t1); 5 | 6 | [numthreads(4, 4, 1)] 7 | void main(uint3 groupId : SV_GroupID) 8 | { 9 | tex.Load(groupId.xy, 0); 10 | } 11 | -------------------------------------------------------------------------------- /tests/cross-compile/early-depth-stencil.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment 2 | //TEST:CROSS_COMPILE:-profile ps_6_0 -target dxil-assembly -entry main 3 | 4 | [earlydepthstencil] 5 | float4 main(): SV_Target 6 | { 7 | return float4(1, 0, 0, 1); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /tests/diagnostics/local-used-in-own-declaration.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/local-used-in-own-declaration.slang(12): fatal error 39999: local variable 'e' is being used before its declaration. 4 | int e = e; 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/missing-file.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/missing-file.slang(1): error 20001: unexpected end of file, expected ';' 4 | tests/diagnostics/missing-file.slang(4): error 2: cannot find file 'does-not-exist.slang'. 5 | } 6 | standard output = { 7 | } 8 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/vector-double-reduced-intrinsic.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: double 2 | 2.131378 3 | 2.252492 4 | 2.512755 5 | 0.000000 6 | 2.298468 7 | 2.589615 8 | 1.887061 9 | 0.000000 10 | 2.739342 11 | 3.501444 12 | 5.431718 13 | 0.000000 14 | 3.231768 15 | 7.063389 16 | 6.968284 17 | 0.000000 18 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/vector-float.slang.expected.txt: -------------------------------------------------------------------------------- 1 | type: float 2 | -64.691277 3 | -97.906212 4 | -42.168385 5 | 0.000000 6 | -62.544128 7 | -33.527363 8 | 10.426896 9 | 0.000000 10 | -59.882103 11 | 29.953676 12 | 74.433708 13 | 0.000000 14 | -56.981304 15 | 96.036606 16 | 140.310608 17 | 0.000000 18 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-detail-1.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | // If a macro can take a single parameter, it is valid to pass in 'nothing'. 4 | // Old Slang outputs an error about the wrong amount of parameters 5 | // Correct output: a b 6 | 7 | #define A(x) a x b 8 | 9 | A() 10 | 11 | -------------------------------------------------------------------------------- /source/slang/slang-ast-all.h: -------------------------------------------------------------------------------- 1 | // slang-ast-all.h 2 | 3 | #pragma once 4 | 5 | #include "slang-ast-base.h" 6 | 7 | #include "slang-ast-expr.h" 8 | #include "slang-ast-decl.h" 9 | #include "slang-ast-modifier.h" 10 | #include "slang-ast-stmt.h" 11 | #include "slang-ast-type.h" 12 | #include "slang-ast-val.h" 13 | -------------------------------------------------------------------------------- /tests/cross-compile/dxc-error.hlsl.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | dxc: tests/cross-compile/dxc-error.hlsl(8): error : use of undeclared identifier 'gOutputBuffer' 4 | dxc: note : gOutputBuffer[tid] = dispatchThreadID.x * 0.5f; 5 | dxc: note : ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/cross-compile/nointerpolation-input.slang: -------------------------------------------------------------------------------- 1 | //TEST_DISABLED:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 2 | 3 | struct VS_OUT 4 | { 5 | nointerpolation float drawID : DRAW_ID; 6 | }; 7 | 8 | float4 main(VS_OUT vsOut) : SV_Target 9 | { 10 | return float4(vsOut.drawID); 11 | } 12 | -------------------------------------------------------------------------------- /tests/front-end/import-subdir-search-path.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: -Itests/front-end/subdir 2 | 3 | // Confirming import lookup via search paths work 4 | 5 | __import import_subdir_a; 6 | 7 | // Should realize it's the same thing 8 | __import subdir.import_subdir_a; 9 | 10 | float bar(float x) { return foo(x); } -------------------------------------------------------------------------------- /tests/diagnostics/implicit-cast-lvalue.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: 2 | 3 | // Passing an argument for an `out` parameter such 4 | // that implicit conversion would be required in 5 | // both directions. 6 | 7 | void a(out uint x) 8 | { 9 | x = 0; 10 | } 11 | 12 | void b(int y) 13 | { 14 | a(y); 15 | } 16 | -------------------------------------------------------------------------------- /tests/bugs/vk-structured-buffer-binding.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE:-profile ps_4_0 -entry main -target spirv-assembly 2 | 3 | [[vk::binding(3, 4)]] 4 | RWStructuredBuffer gDoneGroups : register(u3); 5 | 6 | float4 main( 7 | float3 uv : UV) 8 | : SV_Target 9 | { 10 | return gDoneGroups[int(uv.z)]; 11 | } -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-stage.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (1): error 15: unknown stage 'green_hills_zone' 4 | tests/diagnostics/command-line/unknown-stage.slang -stage green_hills_zone 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/preprocessor/output-includes.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-output-includes 2 | 3 | int foo() { return 0; } 4 | 5 | #include "include-a.slang.h" 6 | #include "include/include-pragma-once-c.h" 7 | #include "../preprocessor/include-a.slang.h" 8 | #include "./include-a.slang.h" 9 | 10 | int baz() { return bar(); } -------------------------------------------------------------------------------- /tests/bugs/vk-image-atomics.slang: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 2 | 3 | // Ensure that we can lower to `imageAtomicAdd` correctly. 4 | 5 | RWTexture2D t; 6 | 7 | float4 main() : SV_Target 8 | { 9 | uint u; 10 | InterlockedAdd(t[uint2(0)], 1, u); 11 | return u; 12 | } 13 | -------------------------------------------------------------------------------- /tests/diagnostics/extension-visibility-a.slang: -------------------------------------------------------------------------------- 1 | // extension-visibility-a.slang 2 | 3 | interface IThing 4 | { 5 | int getValue(); 6 | } 7 | 8 | // Note: not implementing the interface here! 9 | struct MyThing 10 | { 11 | int value; 12 | } 13 | 14 | int helper(T thing) 15 | { 16 | return thing.getValue(); 17 | } -------------------------------------------------------------------------------- /tests/diagnostics/static-ref-to-nonstatic-member.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/static-ref-to-nonstatic-member.slang(11): error 30100: type 'Color' cannot be used to refer to non-static member 'Red' 4 | int x = Color.Red; 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/preprocessor/file-identity/sub-folder/file-identity.slang: -------------------------------------------------------------------------------- 1 | //TEST(smoke):SIMPLE: 2 | //TEST(smoke):SIMPLE: -file-system load-file 3 | //TEST(smoke):SIMPLE: -file-system os 4 | 5 | #include "../b.h" 6 | #include "../c.h" 7 | 8 | #include "./../b.h" 9 | 10 | float test(float x) 11 | { 12 | return foo(x) + bar(x); 13 | } -------------------------------------------------------------------------------- /tests/preprocessor/preproc-pound-pound-1.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/preproc-pound-pound-1.slang(8): error 15405: '##' is not allowed at the start of a macro body 4 | #define POUND_POUND ## 5 | ^~ 6 | } 7 | standard output = { 8 | Hello ## There ; 9 | } 10 | -------------------------------------------------------------------------------- /tools/slang-cpp-extractor/unit-test.h: -------------------------------------------------------------------------------- 1 | #ifndef CPP_EXTRACT_UNIT_TEST_H 2 | #define CPP_EXTRACT_UNIT_TEST_H 3 | 4 | #include "diagnostics.h" 5 | 6 | namespace CppExtract { 7 | using namespace Slang; 8 | 9 | struct UnitTestUtil 10 | { 11 | static SlangResult run(); 12 | }; 13 | 14 | } // CppExtract 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /source/slang/slang-ir-explicit-global-init.h: -------------------------------------------------------------------------------- 1 | // slang-ir-explicit-global-init.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | struct IRModule; 7 | 8 | /// Move initialization logic off of global variables and onto each entry point 9 | void moveGlobalVarInitializationToEntryPoints( 10 | IRModule* module); 11 | } 12 | -------------------------------------------------------------------------------- /tests/bugs/vk-image-atomics.slang.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(r32ui) 4 | layout(binding = 0) 5 | uniform uimage2D t_0; 6 | 7 | layout(location = 0) 8 | out vec4 _S1; 9 | 10 | void main() 11 | { 12 | uint u_0; 13 | u_0 = imageAtomicAdd(t_0, ivec2(uvec2(0)), 1); 14 | _S1 = vec4(u_0); 15 | return; 16 | } 17 | -------------------------------------------------------------------------------- /tests/diagnostics/call-instance-from-static.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/call-instance-from-static.slang(14): error 30100: type 'Test' cannot be used to refer to non-static member 'instanceMethod' 4 | instanceMethod(); 5 | ^~~~~~~~~~~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/output-no-entry-point.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (0): error 70: the output path 'something.dxbc' is not associated with any entry point; a '-o' option for a compiled kernel must follow the '-entry' option for its corresponding entry point 4 | } 5 | standard output = { 6 | } 7 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-option.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (1): error 17: unknown command-line option '-destroy-all-humans' 4 | tests/diagnostics/command-line/unknown-option.slang -destroy-all-humans 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-profile.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (1): error 14: unknown profile 'thunder_kiss_65' 4 | tests/diagnostics/command-line/unknown-profile.slang -profile thunder_kiss_65 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/entry-point-stage-mismatch.slang: -------------------------------------------------------------------------------- 1 | // entry-point-stage-mismatch.slang 2 | 3 | // Confirm that we diagnose when stage specified via command 4 | // line doesn't match what was specified via attribute. 5 | 6 | //DIAGNOSTIC_TEST:SIMPLE:-entry main -stage vertex 7 | 8 | [shader("compute")] 9 | void main() 10 | {} 11 | -------------------------------------------------------------------------------- /tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/interfaces/anyvalue-size-validation.slang(11): error 41011: type 'S' does not fit in the size required by its conforming interface. 4 | struct S : IInterface 5 | ^~~~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-redefine-object.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/special-macro-redefine-object.slang(7): warning 15404: Redefinition of builtin macro '__LINE__' 4 | #define __LINE__ "Hello" 5 | ^~~~~~~~ 6 | } 7 | standard output = { 8 | "Hello" __LINE__ 9 | } 10 | -------------------------------------------------------------------------------- /tests/reflection/shared-modifier.hlsl: -------------------------------------------------------------------------------- 1 | // shared-modifier.hlsl 2 | //TEST:REFLECTION:-profile ps_5_0 -target hlsl 3 | 4 | // Confirm that we expose the `shared` modifier in reflection data. 5 | 6 | Texture2D t; 7 | shared SamplerState s; 8 | 9 | float4 main(float2 uv : UV) : SV_Target 10 | { 11 | return t.Sample(s, uv); 12 | } -------------------------------------------------------------------------------- /tests/reflection/thread-group-size.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:REFLECTION:-profile cs_5_0 -target hlsl 2 | 3 | // Confirm that we provide reflection data for the `numthreads` attribute 4 | 5 | RWStructuredBuffer b; 6 | 7 | [numthreads(3,5,7)] 8 | void main(uint3 tid : SV_DispatchThreadID) 9 | { 10 | b[tid.x] = b[tid.x + 1] + 1.0f; 11 | } -------------------------------------------------------------------------------- /tests/cross-compile/gl-layer-pick-version.slang: -------------------------------------------------------------------------------- 1 | //TEST_DISABLED:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 2 | 3 | struct VS_OUT 4 | { 5 | nointerpolation uint layerID : SV_RenderTargetArrayIndex; 6 | }; 7 | 8 | float4 main(VS_OUT vsOut) : SV_Target 9 | { 10 | return float4(float(vsOut.layerID)); 11 | } 12 | -------------------------------------------------------------------------------- /tests/reflection/explicit-register-space.slang: -------------------------------------------------------------------------------- 1 | // explicit-register-space.slang 2 | //TEST:REFLECTION:-profile ps_5_1 -target hlsl 3 | 4 | // Confirm that we handle explicit register spaces 5 | // on global shader parameters. 6 | 7 | Texture2D tx : register(t1, space2); 8 | 9 | float4 main() : SV_Target 10 | { 11 | return 0.0; 12 | } -------------------------------------------------------------------------------- /tests/cross-compile/glsl-empty-struct-param-field.slang: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE:-target spirv-assembly -entry main -profile ps_5_0 2 | 3 | struct E 4 | { 5 | }; 6 | 7 | struct P 8 | { 9 | E em; 10 | float4 param; 11 | }; 12 | ParameterBlock

pblock; 13 | 14 | float4 main(float4 pos : SV_POSITION) 15 | { 16 | return pblock.param; 17 | } -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-codegen-target.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (1): error 13: unknown code generation target 'z80' 4 | tests/diagnostics/command-line/unknown-codegen-target.slang -target z80 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/undefined-in-preprocessor-conditional.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/diagnostics/undefined-in-preprocessor-conditional.slang(8): warning 15205: undefined identifier 'BART' in preprocessor expression will evaluate to zero 4 | #if FOO && BART 5 | ^~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/pass-through-no-stage.hlsl: -------------------------------------------------------------------------------- 1 | // pass-through-no-stage.hlsl 2 | 3 | // Trying to compile in `-pass-through` mode without 4 | // specifying a stage is an error, because the downstream 5 | // compilers don't support inferring the stage from 6 | // an attribute. 7 | 8 | //DIAGNOSTIC_TEST:SIMPLE:-pass-through fxc -entry main 9 | -------------------------------------------------------------------------------- /tests/preprocessor/define-redefine.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/define-redefine.slang(10): warning 15400: redefinition of macro 'FOO' 4 | #define FOO 2.0f 5 | ^~~ 6 | tests/preprocessor/define-redefine.slang(6): note: see previous definition of 'FOO' 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-pound-pound-1.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | // GCC: :1:9: error: '##' cannot appear at either end of a macro expansion. 4 | // Clang: :1:21: error: '##' cannot appear at start of macro expansion 5 | // Old Slang outputs Hello ## There; 6 | #define POUND_POUND ## 7 | 8 | Hello POUND_POUND There; 9 | -------------------------------------------------------------------------------- /tests/bindings/glsl-parameter-blocks.slang: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 2 | 3 | struct Test 4 | { 5 | float4 a; 6 | Texture2D t; 7 | SamplerState s; 8 | }; 9 | 10 | ParameterBlock gTest; 11 | 12 | float4 main(float2 uv : UV) 13 | { 14 | return gTest.a + gTest.t.Sample(gTest.s, uv); 15 | } 16 | -------------------------------------------------------------------------------- /tests/bugs/preproc-lex-failure-2.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/bugs/preproc-lex-failure-2.slang(4): warning 10002: '0' prefix indicates octal literal 4 | 000 5 | ^~~ 6 | tests/bugs/preproc-lex-failure-2.slang(5): error 10005: newline in literal 7 | 8 | ^ 9 | } 10 | standard output = { 11 | 000 "Hello! 12 | } 13 | -------------------------------------------------------------------------------- /tests/cross-compile/sv-coverage.slang.glsl: -------------------------------------------------------------------------------- 1 | // sv-coverage.slang.glsl 2 | #version 450 3 | 4 | layout(location = 0) 5 | out vec4 _S1; 6 | 7 | layout(location = 0) 8 | in vec4 _S2; 9 | 10 | void main() 11 | { 12 | uint _S3 = uint(gl_SampleMaskIn[0]) ^ uint(1); 13 | _S1 = _S2; 14 | gl_SampleMask[0] = int(_S3); 15 | return; 16 | } 17 | -------------------------------------------------------------------------------- /tests/pipeline/rasterization/conservative-rasterization/inner-coverage.slang: -------------------------------------------------------------------------------- 1 | // inner-coverage.slang 2 | 3 | //TEST:CROSS_COMPILE:-target spirv -entry main -stage fragment 4 | 5 | [shader("fragment")] 6 | void main( 7 | uint innerCoverage : SV_InnerCoverage, 8 | out float4 result : SV_Target) 9 | { 10 | result = innerCoverage; 11 | } 12 | -------------------------------------------------------------------------------- /tests/rewriter/varying-struct.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | struct VS_IN 4 | { 5 | float4 x : X; 6 | float4 y : Y; 7 | }; 8 | 9 | struct VS_OUT 10 | { 11 | float4 color : COLOR; 12 | float4 posH : SV_Position; 13 | }; 14 | 15 | VS_OUT doIt(VS_IN i) 16 | { 17 | VS_OUT o; 18 | o.color = i.x; 19 | o.posH = i.y; 20 | return o; 21 | } 22 | -------------------------------------------------------------------------------- /tools/render-test/png-serialize-util.h: -------------------------------------------------------------------------------- 1 | // png-serialize-util.h 2 | #pragma once 3 | 4 | #include "core/slang-blob.h" 5 | 6 | namespace renderer_test { 7 | 8 | struct PngSerializeUtil 9 | { 10 | static Slang::Result write(const char* filename, ISlangBlob* pixels, uint32_t width, uint32_t height); 11 | 12 | }; 13 | 14 | } // renderer_test 15 | -------------------------------------------------------------------------------- /source/slang/slang-ir-entry-point-raw-ptr-params.h: -------------------------------------------------------------------------------- 1 | // slang-ir-entry-point-raw-ptr-params.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | struct IRModule; 7 | 8 | /// Convert any entry-point parameters that use pointer types to use raw pointers (`void*`) 9 | void convertEntryPointPtrParamsToRawPtrs( 10 | IRModule* module); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /source/slang/slang-value-reflect.h: -------------------------------------------------------------------------------- 1 | // slang-value-reflect.h 2 | 3 | #ifndef SLANG_VALUE_REFLECT_H 4 | #define SLANG_VALUE_REFLECT_H 5 | 6 | #include "slang-generated-value.h" 7 | #include "slang-generated-value-macro.h" 8 | 9 | // Create the functions to automatically convert between value types 10 | 11 | 12 | 13 | #endif // SLANG_VALUE_REFLECT_H 14 | -------------------------------------------------------------------------------- /tests/cross-compile/c-simple.slang: -------------------------------------------------------------------------------- 1 | //DISABLE_TEST:SIMPLE: -profile ps_5_0 -entry main -target c 2 | 3 | //Texture2D t; 4 | //SamplerState s; 5 | 6 | float4 main(float2 uv) : SV_Target 7 | { 8 | float4 result = 1; 9 | 10 | result.x += uv.x; 11 | result.y += uv.y; 12 | result.z -= uv.x; 13 | result.w -= uv.y; 14 | 15 | return result; 16 | } 17 | -------------------------------------------------------------------------------- /tests/diagnostics/entry-point-stage-mismatch.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/diagnostics/entry-point-stage-mismatch.slang(9): warning 38006: entry point 'main' being compiled for the 'vertex' stage has a '[shader(...)]' attribute that specifies the 'compute' stage 4 | void main() 5 | ^~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/pipeline/rasterization/conservative-rasterization/inner-coverage.slang.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | #extension GL_NV_conservative_raster_underestimation : require 4 | 5 | layout(location = 0) 6 | out vec4 _S1; 7 | 8 | void main() 9 | { 10 | vec4 _S2; 11 | _S2 = vec4(uint(gl_FragFullyCoveredNV)); 12 | _S1 = _S2; 13 | return; 14 | } 15 | -------------------------------------------------------------------------------- /tests/preprocessor/special-macro-redefine-function.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/special-macro-redefine-function.slang(7): warning 15404: Redefinition of builtin macro '__FILE__' 4 | #define __FILE__(x) "Is" x 5 | ^~~~~~~~ 6 | } 7 | standard output = { 8 | "Is" "Anybody" "Is" There __FILE__ 9 | } 10 | -------------------------------------------------------------------------------- /tests/reflection/reflect-imported-code.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // Imported code used by `reflect-imported-code.hlsl` 4 | 5 | float4 use(float4 val) { return val; }; 6 | float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); } 7 | 8 | Texture2D t_i; 9 | SamplerState s_i; 10 | 11 | cbuffer C_i 12 | { 13 | float c_i; 14 | } 15 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/option-missing-argument.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (1): error 13: unknown code generation target '-profile' 4 | tests/diagnostics/command-line/option-missing-argument.slang -target -profile ps_4_0 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/preprocessor/line.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // #line support 3 | 4 | FooA a() { return 0; } 5 | 6 | #line 99 "b.slang" 7 | FooB b() { return 0; } 8 | 9 | #line default 10 | FooC c() { return 0; } 11 | 12 | #line 603 "d.slang" 13 | FooD d() { return 0; } 14 | 15 | #line 40 16 | FooE e() { return 0; } 17 | 18 | #line 19 | FooF f() { return 0; } 20 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-concat-3.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/preprocessor/preproc-concat-3.slang(5): warning 15503: toking pasting with '##' resulted in the invalid token ')CONCAT' 4 | #define CONCAT(a, b) a ## b 5 | ^~ 6 | } 7 | standard output = { 8 | CONCAT ( a , a ) CONCAT ( b , b ) ; 9 | } 10 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-detail-3.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | // Undefining a macro that is not defined within C/C++ is defined as *not* an error or a warning. 4 | // On checking with DXC/FXC they also have this behavior (ie they don't output anything) 5 | // It's arguable if Slang should match this behavior - at least it is a warning. 6 | 7 | #undef C -------------------------------------------------------------------------------- /external/spirv-tools-generated/spv-amd-gcn-shader.insts.inc: -------------------------------------------------------------------------------- 1 | 2 | 3 | static const spv_ext_inst_desc_t spv_amd_gcn_shader_entries[] = { 4 | {"CubeFaceIndexAMD", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, 5 | {"CubeFaceCoordAMD", 2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, 6 | {"TimeAMD", 3, 0, nullptr, {SPV_OPERAND_TYPE_NONE}} 7 | }; -------------------------------------------------------------------------------- /source/slang/slang-ir-bind-existentials.h: -------------------------------------------------------------------------------- 1 | // slang-ir-bind-existentials.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | 7 | class DiagnosticSink; 8 | struct IRModule; 9 | 10 | /// Bind concrete types to paameters that use existential slots. 11 | void bindExistentialSlots( 12 | IRModule* module, 13 | DiagnosticSink* sink); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /source/slang/slang-ir-lower-existential.h: -------------------------------------------------------------------------------- 1 | // slang-ir-lower-existential.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | struct SharedGenericsLoweringContext; 7 | 8 | /// Lower existential types and related instructions to Tuple types. 9 | void lowerExistentials( 10 | SharedGenericsLoweringContext* sharedContext); 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /tests/preprocessor/repeated-macro-expansion.slang: -------------------------------------------------------------------------------- 1 | // macro-expansion.slang 2 | // 3 | //TEST:SIMPLE: 4 | 5 | // Test a bug where macro expansion isn't being 6 | // triggered for back-to-back uses of a function-like 7 | // macro. 8 | 9 | #define IGNORE(THING) /* empty */ 10 | 11 | void test() 12 | { 13 | IGNORE(badStuff) 14 | IGNORE(moreBad) 15 | ; 16 | } 17 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | (0): warning 30: the stage 'vertex' was specified more than once for entry point 'main' 4 | tests/diagnostics/command-line/entry-point-redundant-stage.slang(6): error 38000: no function found matching entry point name 'main' 5 | } 6 | standard output = { 7 | } 8 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | (0): warning 32: the stage specified for entry point 'main' ('pixel') does not match the stage implied by the source file name ('vertex') 4 | (0): error 11: the Slang compiler does not support GLSL as a source language 5 | } 6 | standard output = { 7 | } 8 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-pass-through-target.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (1): error 16: unknown pass-through target 'subcon' 4 | tests/diagnostics/command-line/unknown-pass-through-target.slang -pass-through subcon 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /source/slang/slang-ir-lower-tuple-types.h: -------------------------------------------------------------------------------- 1 | // slang-ir-lower-tuple-types.h 2 | #pragma once 3 | 4 | #include "slang-ir.h" 5 | 6 | namespace Slang 7 | { 8 | struct IRModule; 9 | class DiagnosticSink; 10 | 11 | /// Lower tuple types to ordinary `struct`s. 12 | void lowerTuples( 13 | IRModule* module, 14 | DiagnosticSink* sink); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/cross-compile/early-depth-stencil.hlsl.glsl: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | #version 450 3 | layout(row_major) uniform; 4 | layout(row_major) buffer; 5 | 6 | #line 5 0 7 | layout(location = 0) 8 | out vec4 _S1; 9 | 10 | #line 5 11 | layout(early_fragment_tests) in; 12 | void main() 13 | { 14 | _S1 = vec4(float(1), float(0), float(0), float(1)); 15 | return; 16 | } 17 | -------------------------------------------------------------------------------- /tests/cross-compile/matrix-mult.slang: -------------------------------------------------------------------------------- 1 | //TEST_DISABLED:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 2 | 3 | // Confirm that order of arguments to matrix-vector 4 | // multiplication gets reversed when generating GLSL. 5 | 6 | cbuffer C 7 | { 8 | float4x3 m; 9 | }; 10 | 11 | float4 main(float3 v) : SV_Target 12 | { 13 | return mul(m, v); 14 | } 15 | -------------------------------------------------------------------------------- /tests/cross-compile/sv-coverage.slang: -------------------------------------------------------------------------------- 1 | // sv-coverage.slang 2 | 3 | //TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment 4 | 5 | float4 main( 6 | in float4 color : COLOR, 7 | in uint inputCoverage : SV_Coverage, 8 | out uint outputCoverage : SV_Coverage) 9 | : SV_Target 10 | { 11 | outputCoverage = inputCoverage ^ 1; 12 | return color; 13 | } 14 | -------------------------------------------------------------------------------- /tests/diagnostics/accessors.slang: -------------------------------------------------------------------------------- 1 | // properties.slang 2 | 3 | // Diagnostic messages related to property/subscript accessor declarations. 4 | 5 | //DIAGNOSTIC_TEST:SIMPLE: 6 | 7 | struct Test 8 | { 9 | property p : int 10 | { 11 | get(a) { return 0; } 12 | 13 | set(a, b) { } 14 | } 15 | 16 | property q : float 17 | { 18 | set(c : int) { } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | (0): warning 30: the stage 'vertex' was specified more than once for entry point 'vsMain' 4 | tests/diagnostics/command-line/entry-point-redundant-stage.slang(6): error 38000: no function found matching entry point name 'vsMain' 5 | } 6 | standard output = { 7 | } 8 | -------------------------------------------------------------------------------- /tests/diagnostics/entry-point-no-stage.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/entry-point-no-stage.slang(9): error 38007: no stage specified for entry point 'main'; use either a '[shader("name")]' function attribute or the '-stage ' command-line option to specify a stage 4 | void main() 5 | ^~~~ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/language-feature/extensions/extension-import.slang: -------------------------------------------------------------------------------- 1 | // extension-import.slang 2 | 3 | // Confirm that visibility of extensions through `import` is working. 4 | 5 | //TEST:SIMPLE: 6 | 7 | import extension_import_helper; 8 | 9 | float test(T value) 10 | { 11 | return value.getValue(); 12 | } 13 | 14 | float id(float x) 15 | { 16 | return test(x); 17 | } -------------------------------------------------------------------------------- /tests/cross-compile/rw-buffer.slang: -------------------------------------------------------------------------------- 1 | // rw-buffer.slang 2 | 3 | // Confirm that writing into a `RWBuffer` generates appropriate GLSL/SPIR-V. 4 | 5 | //TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 6 | 7 | RWBuffer buffer; 8 | 9 | 10 | float4 main(float u : U, int idx : IDX) : SV_Target 11 | { 12 | buffer[idx] = u; 13 | return u; 14 | } 15 | -------------------------------------------------------------------------------- /tests/diagnostics/single-target-intrinsic.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/single-target-intrinsic.slang(13): error 30201: function 'doThing' already has a body 4 | T doThing(T in); 5 | ^~~~~~~ 6 | tests/diagnostics/single-target-intrinsic.slang(10): note: see previous definition of 'doThing' 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tools/slang-cpp-extractor/diagnostics.cpp: -------------------------------------------------------------------------------- 1 | #include "diagnostics.h" 2 | 3 | namespace CppExtract { 4 | 5 | namespace CPPDiagnostics 6 | { 7 | using namespace Slang; 8 | 9 | #define DIAGNOSTIC(id, severity, name, messageFormat) const DiagnosticInfo name = { id, Severity::severity, #name, messageFormat }; 10 | #include "diagnostic-defs.h" 11 | } 12 | 13 | } // namespace CppExtract 14 | -------------------------------------------------------------------------------- /examples/hello-world/hello-world.slang: -------------------------------------------------------------------------------- 1 | // hello-world.slang 2 | StructuredBuffer buffer0; 3 | StructuredBuffer buffer1; 4 | RWStructuredBuffer result; 5 | 6 | [shader("compute")] 7 | [numthreads(1,1,1)] 8 | void computeMain(uint3 threadId : SV_DispatchThreadID) 9 | { 10 | uint index = threadId.x; 11 | result[index] = buffer0[index] + buffer1[index]; 12 | } 13 | -------------------------------------------------------------------------------- /tests/cross-compile/fxc-error.hlsl: -------------------------------------------------------------------------------- 1 | //TEST(fxc):SIMPLE:-pass-through fxc -target dxbc -entry computeMain -stage compute -profile sm_5_1 2 | 3 | [numthreads(4, 1, 1)] 4 | void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 5 | { 6 | uint tid = dispatchThreadID.x; 7 | // Error should be here... as gOutputBuffer is not defined... 8 | gOutputBuffer[tid] = dispatchThreadID.x * 0.5f; 9 | } -------------------------------------------------------------------------------- /tests/diagnostics/overlapping-bindings.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/diagnostics/overlapping-bindings.slang(9): warning 39001: explicit binding for parameter 'b' overlaps with parameter 'a' 4 | Texture2D b : register(t0); 5 | ^ 6 | tests/diagnostics/overlapping-bindings.slang(7): note: see declaration of 'a' 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /source/core/slang-basic.h: -------------------------------------------------------------------------------- 1 | #ifndef SLANG_CORE_BASIC_H 2 | #define SLANG_CORE_BASIC_H 3 | 4 | #include "slang-common.h" 5 | #include "slang-math.h" 6 | #include "slang-string.h" 7 | #include "slang-array.h" 8 | #include "slang-list.h" 9 | #include "slang-short-list.h" 10 | #include "slang-smart-pointer.h" 11 | #include "slang-exception.h" 12 | #include "slang-dictionary.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /tests/bugs/gh-449.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/bugs/gh-449.slang(18): error 30019: expected an expression of type 'S', got 'vector' 4 | foo(a + b); 5 | ^ 6 | tests/bugs/gh-449.slang(24): error 30019: expected an expression of type 'S', got 'vector' 7 | foo(u + f); 8 | ^ 9 | } 10 | standard output = { 11 | } 12 | -------------------------------------------------------------------------------- /tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 1 2 | standard error = { 3 | (1): error 24: unknown '#line' directive mode 'quizzical' 4 | tests/diagnostics/command-line/unknown-line-directive-mode.slang -line-directive-mode quizzical 5 | ^ 6 | } 7 | standard output = { 8 | } 9 | -------------------------------------------------------------------------------- /tests/parser/incomplete-member-decl.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/parser/incomplete-member-decl.slang(19): error 20001: unexpected identifier, expected '(' 4 | int MyType inner; 5 | ^~~~~ 6 | tests/parser/incomplete-member-decl.slang(20): error 20001: unexpected end of file, expected identifier 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tests/reflection/sample-index-input.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:REFLECTION:-profile ps_5_0 -target hlsl 2 | 3 | // Confirm that we register a shader as sample-rate when 4 | // it declares `SV_SampleIndex` as an input. 5 | 6 | struct PSInput 7 | { 8 | float4 color : COLOR; 9 | uint sampleIndex : SV_SampleIndex; 10 | }; 11 | 12 | float4 main(PSInput input) : SV_Target 13 | { 14 | return input.color; 15 | } -------------------------------------------------------------------------------- /tests/serialization/extern/module-a.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // module-a.slang 4 | 5 | struct Thing 6 | { 7 | int a; 8 | int b; 9 | }; 10 | 11 | Thing makeThing(int a, int b) 12 | { 13 | Thing thing; 14 | thing.a = a; 15 | thing.b = b; 16 | return thing; 17 | } 18 | 19 | int foo(Thing thing) 20 | { 21 | return thing.a + thing.b * 2; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /docs/language-reference/03-preprocessor.md: -------------------------------------------------------------------------------- 1 | Preprocessor 2 | ============ 3 | 4 | Slang supports a C-style preprocessor with the following directives: 5 | 6 | * `#include` 7 | * `#define` 8 | * `#undef` 9 | * `#if`, `#ifdef`, `#ifndef` 10 | * `#else`, `#elif` 11 | * `#endif` 12 | * `#error` 13 | * `#warning` 14 | * `#line` 15 | * `#pragma` 16 | 17 | > Note: This section is not yet complete. 18 | -------------------------------------------------------------------------------- /tests/cross-compile/precise-keyword.slang.hlsl: -------------------------------------------------------------------------------- 1 | // precise-keyword.slang.hlsl 2 | //TEST_IGNORE_FILE: 3 | 4 | float4 main(float2 v_0 : V) : SV_TARGET 5 | { 6 | precise float z_0; 7 | 8 | if(v_0.x > (float) 0) 9 | { 10 | z_0 = v_0.x * v_0.y + v_0.x; 11 | } 12 | else 13 | { 14 | z_0 = v_0.y * v_0.x + v_0.y; 15 | } 16 | 17 | return (float4) z_0; 18 | } -------------------------------------------------------------------------------- /tests/diagnostics/command-line/stage-ignored.slang: -------------------------------------------------------------------------------- 1 | // stage-ignored.slang 2 | 3 | // Cases where a `-stage` option gets ignored 4 | // because it doesn't apply to any entry point. 5 | 6 | // A `-stage` option before any `-entry`, possibly because 7 | // the user is specifying things in the wrong order. 8 | // 9 | //DIAGNOSTIC_TEST:SIMPLE:-stage vertex -entry vsMain -stage fragment -entry psMain 10 | -------------------------------------------------------------------------------- /tests/reflection/global-uniforms.hlsl: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE 2 | //TEST:REFLECTION:-profile ps_4_0 -target hlsl 3 | 4 | // Confirm that we handle uniforms at global scope 5 | 6 | 7 | float4 u; 8 | 9 | Texture2D t; 10 | SamplerState s; 11 | 12 | cbuffer CB 13 | { 14 | float4 v; 15 | } 16 | 17 | float4 w; 18 | 19 | float4 main() : SV_Target 20 | { 21 | return u + v + w + t.Sample(s, u.xy); 22 | } -------------------------------------------------------------------------------- /tests/serialization/extern/module-b.slang: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | 3 | // module-b.slang 4 | 5 | // This looks like a definition (and it is) but with [__extern] it's definition will be replaced at link time with a defintion 6 | [__extern] struct Thing {}; 7 | [__extern] int foo(Thing thing); 8 | 9 | int doSomething(Thing a, Thing b) 10 | { 11 | return foo(a) + foo(b); 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/cross-compile/dxc-error.hlsl: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST(dxc):SIMPLE:-pass-through dxc -target dxil -entry computeMain -stage compute -profile sm_6_1 2 | 3 | [numthreads(4, 1, 1)] 4 | void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 5 | { 6 | uint tid = dispatchThreadID.x; 7 | // Error should be here... as gOutputBuffer is not defined... 8 | gOutputBuffer[tid] = dispatchThreadID.x * 0.5f; 9 | } -------------------------------------------------------------------------------- /tests/cross-compile/sign.slang: -------------------------------------------------------------------------------- 1 | // sign.slang 2 | 3 | //TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment 4 | //TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0 5 | 6 | // Test cross compilation of the sign function 7 | 8 | float4 main() : SV_Target 9 | { 10 | float4 s = sign(float4(1.5, 1.0, -1.5, -1.0)); 11 | return s; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /tests/diagnostics/single-target-intrinsic.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST(windows):SIMPLE: 2 | 3 | 4 | T doThing(T in) 5 | { 6 | return in; 7 | } 8 | 9 | __target_intrinsic(hlsl, "doSomethingIntrinsically($0)") 10 | T doThing(T in); 11 | 12 | __target_intrinsic(hlsl, "letsRedefineIt($0)") 13 | T doThing(T in); 14 | 15 | void test() 16 | { 17 | int a = 5; 18 | int b = doThing(a); 19 | } -------------------------------------------------------------------------------- /tests/preprocessor/include-search-path.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: -Itests/preprocessor/include 2 | // #include support 3 | 4 | int foo() { return 0; } 5 | 6 | #include "pragma-once-c.h" 7 | 8 | // If include worked this will be defined 9 | #ifndef ONLY_DEFINED_ONCE_C 10 | // And so hitting this indicates and error (and will fail as bar isn't defined) 11 | int baz() { return bar(); } 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /tests/rewriter/gh-160.hlsl: -------------------------------------------------------------------------------- 1 | // Disabled because Slang should give the error, not downstream compiler 2 | //TEST_IGNORE_FILE 3 | //TEST:COMPARE_HLSL: -profile ps_4_0 -entry main 4 | 5 | #ifdef __SLANG__ 6 | __import gh_160; 7 | #endif 8 | 9 | vec4 main(VS_OUT vOut) : SV_TARGET 10 | { 11 | float3 color = float3(1,0,0); 12 | 13 | vec4 finalColor = vec4(color, 1.f); 14 | return finalColor; 15 | } -------------------------------------------------------------------------------- /tests/diagnostics/gh-38-vs.hlsl: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE: -profile sm_5_0 -entry main -stage vertex tests/diagnostics/gh-38-fs.hlsl -entry main -stage fragment -no-codegen 2 | 3 | // Ensure that we catch errors with overlapping or conflicting parameter bindings. 4 | 5 | Texture2D overlappingA : register(t0); 6 | 7 | Texture2D conflicting : register(t1); 8 | 9 | float4 main() : SV_Position { return 0; } 10 | -------------------------------------------------------------------------------- /tests/diagnostics/gh-38-vs.hlsl.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/diagnostics/gh-38-fs.hlsl(5): warning 39001: explicit binding for parameter 'overlappingB' overlaps with parameter 'overlappingA' 4 | Texture2D overlappingB : register(t0); 5 | ^~~~~~~~~~~~ 6 | tests/diagnostics/gh-38-vs.hlsl(5): note: see declaration of 'overlappingA' 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tests/preprocessor/define-function-like.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/preprocessor/define-function-like.slang(16): error 30015: undefined identifier 'x'. 4 | #define M (x) - (x) 5 | ^ 6 | tests/preprocessor/define-function-like.slang(16): error 30015: undefined identifier 'x'. 7 | #define M (x) - (x) 8 | ^ 9 | } 10 | standard output = { 11 | } 12 | -------------------------------------------------------------------------------- /source/slang/slang-ir-lower-generic-call.h: -------------------------------------------------------------------------------- 1 | // slang-ir-lower-generic-call.h 2 | #pragma once 3 | 4 | namespace Slang 5 | { 6 | struct SharedGenericsLoweringContext; 7 | 8 | /// Lower generic and interface-based code to ordinary types and functions using 9 | /// dynamic dispatch mechanisms. 10 | void lowerGenericCalls( 11 | SharedGenericsLoweringContext* sharedContext); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/diagnostics/x-macro-line-continuation.slang: -------------------------------------------------------------------------------- 1 | // x-macro-line-continuation.slang 2 | //TEST:SIMPLE: 3 | 4 | // Tests line continuations on diagnostic output of macros 5 | 6 | #define X(M) \ 7 | M(0) \ 8 | M(1) \ 9 | M(2) \ 10 | M(3) \ 11 | M(4, 4) \ 12 | M(5) \ 13 | M(6) \ 14 | M(7) 15 | 16 | #define A(x) + x + x + x 17 | 18 | int sum() 19 | { 20 | return X(A); 21 | } 22 | -------------------------------------------------------------------------------- /tests/doc/doc-req.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | -------------------------------------------------------------------------------- 4 | # `doThing` 5 | 6 | ## Signature 7 | 8 | ``` 9 | void doThing(); 10 | ``` 11 | 12 | ## Availability 13 | 14 | **GLSL** `GL_EXT_NiftyExtension`, `SPIR-V 1.3` **HLSL** `NVAPI` **CPP** **CUDA** `SM 2.0` 15 | 16 | } 17 | standard output = { 18 | } 19 | -------------------------------------------------------------------------------- /tests/hlsl-intrinsic/texture/gather-texture2darray.slang.hlsl: -------------------------------------------------------------------------------- 1 | // gather-texture2darray.slang.hlsl 2 | 3 | //TEST_IGNORE_FILE: 4 | 5 | Texture2DArray t_0; 6 | SamplerState s_0; 7 | RWBuffer b_0; 8 | 9 | // Attribute not understood by fxc 10 | //[shader("compute")] 11 | [numthreads(32, 1, 1)] 12 | void main(uint3 tid : SV_DISPATCHTHREADID) 13 | { 14 | b_0[tid.x] = t_0.Gather(s_0, tid); 15 | } 16 | -------------------------------------------------------------------------------- /tests/hlsl/simple/compute-numthreads.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:COMPARE_HLSL:-no-mangle -profile cs_5_0 -entry main 2 | 3 | // Confirm that we properly pass along the `numthreads` attribute on an entry point. 4 | 5 | #ifndef __SLANG__ 6 | #define b b_0 7 | #endif 8 | 9 | RWStructuredBuffer b; 10 | 11 | [numthreads(32,1,1)] 12 | void main(uint3 tid : SV_DispatchThreadID) 13 | { 14 | b[tid.x] = b[tid.x + 1] + 1.0f; 15 | } -------------------------------------------------------------------------------- /tests/vkray/callable.slang: -------------------------------------------------------------------------------- 1 | // callable.slang 2 | 3 | //TEST:CROSS_COMPILE: -profile glsl_460+spirv_1_4 -stage callable -entry main -target spirv-assembly 4 | 5 | import callable_shared; 6 | 7 | Texture2D gAlbedoMap; 8 | SamplerState gSampler; 9 | 10 | void main(in out MaterialPayload ioPayload) 11 | { 12 | ioPayload.albedo = gAlbedoMap.SampleLevel( 13 | gSampler, 14 | ioPayload.uv, 15 | 0); 16 | } 17 | -------------------------------------------------------------------------------- /tests/diagnostics/extension-visibility.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/extension-visibility.slang(17): error 39999: could not specialize generic for arguments of type (MyThing) 4 | return helper(thing); 5 | ^ 6 | tests/diagnostics/extension-visibility-a.slang(14): note 39999: see declaration of func helper(T) -> int 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tests/diagnostics/interface-requirement-not-satisfied.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/interface-requirement-not-satisfied.slang(10): error 38100: type 'T' does not provide required interface member 'bar' 4 | struct T : IFoo 5 | ^~~~ 6 | tests/diagnostics/interface-requirement-not-satisfied.slang(7): note: see declaration of 'bar' 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tests/diagnostics/void-function-returning-value.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/void-function-returning-value.slang(16): error 30019: expected an expression of type 'void', got 'int' 4 | return 1; 5 | ^ 6 | tests/diagnostics/void-function-returning-value.slang(16): note: explicit conversion from 'int' to 'void' is possible 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tests/pipeline/ray-tracing/raygen.slang: -------------------------------------------------------------------------------- 1 | // raygen.slang 2 | 3 | //TEST(optix):COMPARE_COMPUTE_EX:-cuda -rt -output-using-type -compute-dispatch 4,1,1 4 | 5 | //TEST_INPUT:ubuffer(data=[0 0 0 0],stride=4):name gOutput,out 6 | 7 | RWStructuredBuffer gOutput; 8 | 9 | [shader("raygeneration")] 10 | void raygenMain() 11 | { 12 | uint3 tid = DispatchRaysIndex(); 13 | 14 | gOutput[tid.x] = tid.x*11; 15 | } 16 | -------------------------------------------------------------------------------- /tests/preprocessor/if-ignore.slang: -------------------------------------------------------------------------------- 1 | //TEST:SIMPLE: 2 | // Check #if expression is ignored if outer #if/#ifndef means it is skipped 3 | 4 | #if 0 5 | BadThing thatWontCompile; 6 | #if a + b == 27 7 | BadThing thatWontCompile; 8 | #endif 9 | BadThing thatWontCompile; 10 | #endif 11 | 12 | #ifdef SOMETHING_SILLY 13 | BadThing thatWontCompile; 14 | #if SOMETHING_SILLY 15 | BadThing thatWontCompile; 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /tests/preprocessor/preproc-concat-3.slang: -------------------------------------------------------------------------------- 1 | //DIAGNOSTIC_TEST:SIMPLE:-E 2 | 3 | #define CONCAT(a, b) a ## b 4 | 5 | #define A a 6 | #define B b 7 | 8 | #define A2 A 9 | #define B2 B 10 | 11 | // Gives error (as trys to concat unexpanded input) 12 | // :11:1: error: pasting formed ')CONCAT', an invalid preprocessing token 13 | // 14 | // Old Slang output: aabb ; 15 | 16 | CONCAT(CONCAT(A2, A2), CONCAT(B2, B2)); 17 | -------------------------------------------------------------------------------- /tests/reflection/sample-rate-input.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:REFLECTION:-profile ps_5_0 -target hlsl 2 | 3 | // Confirm that we register a shader as sample-rate when 4 | // it declares (not necessarly *uses*) a `sample` qualified input 5 | 6 | struct PSInput 7 | { 8 | float4 extra : EXTRA; 9 | sample float4 color : COLOR; 10 | }; 11 | 12 | float4 main(PSInput input) : SV_Target 13 | { 14 | return input.extra + input.color; 15 | } -------------------------------------------------------------------------------- /source/slang/slang-ir-explicit-global-context.h: -------------------------------------------------------------------------------- 1 | // slang-ir-explicit-global-context.h 2 | #pragma once 3 | 4 | #include "slang-compiler.h" 5 | 6 | namespace Slang 7 | { 8 | struct IRModule; 9 | 10 | /// Collect global-scope variables/paramters to form an explicit context that gets threaded through 11 | void introduceExplicitGlobalContext( 12 | IRModule* module, 13 | CodeGenTarget target); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /tests/bugs/gh-941.slang: -------------------------------------------------------------------------------- 1 | //TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 2 | 3 | // Ensure that we add the `GL_EXT_nonuniform_qualifier` extension for any code that uses unbounded-size arrays of resources. 4 | 5 | Texture2D t[]; 6 | SamplerState s; 7 | 8 | cbuffer C 9 | { 10 | float2 uv; 11 | uint index; 12 | } 13 | 14 | float4 main() : SV_Target 15 | { 16 | return t[index].Sample(s, uv); 17 | } 18 | -------------------------------------------------------------------------------- /tests/cross-compile/sign.slang.glsl: -------------------------------------------------------------------------------- 1 | //TEST_IGNORE_FILE: 2 | #version 450 3 | layout(row_major) uniform; 4 | layout(row_major) buffer; 5 | 6 | #line 8 0 7 | layout(location = 0) 8 | out vec4 _S1; 9 | 10 | 11 | #line 8 12 | void main() 13 | { 14 | ivec4 _S2 = ivec4(sign(vec4(1.50000000000000000000, 1.00000000000000000000, -1.50000000000000000000, -1.00000000000000000000))); 15 | _S1 = vec4(_S2); 16 | return; 17 | } -------------------------------------------------------------------------------- /tests/diagnostics/parameter-already-defined.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/diagnostics/parameter-already-defined.slang(4): error 30200: declaration of 'a' conflicts with existing declaration 4 | int foo( int a, float a ) { return 0; } 5 | ^ 6 | tests/diagnostics/parameter-already-defined.slang(4): note: see previous declaration of 'a' 7 | } 8 | standard output = { 9 | } 10 | -------------------------------------------------------------------------------- /tests/reflection/resource-in-cbuffer.hlsl: -------------------------------------------------------------------------------- 1 | //TEST(smoke):REFLECTION:-profile ps_4_0 -target hlsl 2 | 3 | // Confirm that we can generate reflection 4 | // information for resources nested inside 5 | // a cbuffer: 6 | 7 | cbuffer MyConstantBuffer 8 | { 9 | float3 v; 10 | 11 | Texture2D myTexture; 12 | 13 | float c; 14 | 15 | SamplerState mySampler; 16 | } 17 | 18 | float4 main() : SV_Target 19 | { 20 | return 0.0; 21 | } -------------------------------------------------------------------------------- /tests/bugs/gh-133.slang: -------------------------------------------------------------------------------- 1 | //TEST_DISABLED:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly 2 | 3 | // Ensure that an integer output from 4 | // a fragment shader doesn't get a `flat` qualifier 5 | 6 | struct Fragment 7 | { 8 | uint foo; 9 | }; 10 | 11 | cbuffer U 12 | { 13 | uint bar; 14 | } 15 | 16 | Fragment main() : SV_Target 17 | { 18 | Fragment result; 19 | result.foo = bar; 20 | return result; 21 | } 22 | -------------------------------------------------------------------------------- /tests/bugs/keyword-undefined-identifier.slang.expected: -------------------------------------------------------------------------------- 1 | result code = -1 2 | standard error = { 3 | tests/bugs/keyword-undefined-identifier.slang(29): error 30015: undefined identifier 'instance'. 4 | return instance; 5 | ^~~~~~~~ 6 | tests/bugs/keyword-undefined-identifier.slang(34): error 30015: undefined identifier 'triangle'. 7 | return triangle; 8 | ^~~~~~~~ 9 | } 10 | standard output = { 11 | } 12 | -------------------------------------------------------------------------------- /tests/diagnostics/global-uniform.slang: -------------------------------------------------------------------------------- 1 | // global-uniform.slang 2 | //DIAGNOSTIC_TEST:SIMPLE:-target hlsl 3 | //DIAGNOSTIC_TEST:COMMAND_LINE_SIMPLE:-target hlsl 4 | 5 | // An attempt to declare a global variable that actually declares a 6 | // global shader parameter should be diagnosed, unless `uniform` was used. 7 | 8 | uniform float a; 9 | 10 | const uint4 b = uint4(0,1,2,3); 11 | 12 | struct C { float x; int y; }; 13 | C c; 14 | -------------------------------------------------------------------------------- /tests/diagnostics/missing-return.slang.expected: -------------------------------------------------------------------------------- 1 | result code = 0 2 | standard error = { 3 | tests/diagnostics/missing-return.slang(7): warning 41010: control flow may reach end of non-'void' function 4 | int bad(int a, int b) 5 | ^~~ 6 | tests/diagnostics/missing-return.slang(14): warning 41010: control flow may reach end of non-'void' function 7 | int alsoBad(int a, int b) 8 | ^~~~~~~ 9 | } 10 | standard output = { 11 | } 12 | -------------------------------------------------------------------------------- /tests/diagnostics/vk-bindings.slang: -------------------------------------------------------------------------------- 1 | // vk-bindings.slang 2 | 3 | //DIAGNOSTIC_TEST:SIMPLE:-target spirv 4 | 5 | // D3D `register` without VK binding 6 | Texture2D t : register(t0); 7 | 8 | [[vk::binding(3)]] 9 | Texture2D t1 : register(t3); 10 | 11 | struct S { float4 a; }; 12 | 13 | // Parameter block with non-zero binding: 14 | [[vk::binding(2,1)]] 15 | ParameterBlock b; 16 | 17 | [shader("compute")] 18 | void main() 19 | {} -------------------------------------------------------------------------------- /tests/preprocessor/if-macro-token-paste.slang: -------------------------------------------------------------------------------- 1 | // if-macro.slang 2 | 3 | //TEST:SIMPLE: 4 | 5 | // Test that a `#if` test can invoke a function-like macro. 6 | // 7 | // Note: this test is a reproducer for a bug reported by a user. 8 | 9 | #define is_valid_TEST 1 10 | #define isValid(name) (is_valid_##name != 0) 11 | int test() { 12 | #if isValid(TEST) 13 | return 1; 14 | #else 15 | return NO_SUCH_SYMBOL; 16 | #endif 17 | } -------------------------------------------------------------------------------- /source/slang/slang-ir-lower-bit-cast.h: -------------------------------------------------------------------------------- 1 | // slang-ir-lower-bit-cast.h 2 | #pragma once 3 | 4 | // This file defines an IR pass that lowers a BitCast(U) operation, where T and U are struct types, 5 | // into a series of bit-cast operations on basic-typed elements. 6 | 7 | namespace Slang 8 | { 9 | 10 | struct IRModule; 11 | class TargetRequest; 12 | 13 | void lowerBitCast(TargetRequest* targetReq, IRModule* module); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /tests/reflection/reflection0.hlsl: -------------------------------------------------------------------------------- 1 | //TEST:REFLECTION:-profile ps_4_0 -target hlsl 2 | 3 | // Confirm that basic reflection info can be output 4 | 5 | float4 use(float4 val) { return val; }; 6 | float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); } 7 | 8 | Texture2D t; 9 | SamplerState s; 10 | 11 | cbuffer C 12 | { 13 | float c; 14 | } 15 | 16 | float4 main() : SV_Target 17 | { 18 | return use(t,s) + use(c); 19 | } -------------------------------------------------------------------------------- /tests/bugs/array-size-static-const.hlsl: -------------------------------------------------------------------------------- 1 | // array-size-static-const.hlsl 2 | //TEST:COMPARE_HLSL: -profile cs_5_0 3 | 4 | // The bug in this case is that were have a (hidden) 5 | // cast from the `uint` constant to `int` to get 6 | // the size of the array, and this cast was tripping 7 | // up the constant-folding logic. 8 | 9 | static const uint n = 16; 10 | groupshared float b[n]; 11 | 12 | [numthreads(1,1,1)] 13 | void main() 14 | {} 15 | --------------------------------------------------------------------------------